Skip to content

Instantly share code, notes, and snippets.

import {
EvmBatchProcessor,
type EvmBatchProcessorFields,
type Transaction as _Transaction,
} from '@subsquid/evm-processor';
export const processor = new EvmBatchProcessor()
// .setGateway(archive[config.NETWORK])
.setRpcEndpoint({
capacity: 2,
export function retryWithExponentialBackoff<T extends () => Promise<Awaited<ReturnType<T>>>>(
fn: T,
maxAttempts = 5,
baseDelayMs = 1000,
) {
let attempt = 1;
const execute = async () => {
try {
return await fn();
{"distribution": [
{
"timestamp": "2024-11-09T00:01:27.243Z",
"address": "0x23A7c1Bb6A7D7036dF8322704D3D297AD01EEBd7",
"points": 10258
},
{
"timestamp": "2024-11-09T00:01:27.243Z",
"address": "0x70F9D0aE291de8ee2062764B309A7bD7Fa3dC0f2",
"points": 5129
export const ResourceTypes = {
clay: 'clay',
coal: 'coal',
copper: 'copper',
diamond: 'diamond',
gold: 'gold',
iron: 'iron',
// silver: 'silver',
stone: 'stone',
wood: 'wood',
import {
type Address,
type ContractFunctionParameters,
createPublicClient,
encodePacked,
http,
keccak256,
namehash,
zeroAddress,
} from 'viem';
import { Processor } from './helpers';
import * as rmrkEquippable from '../abi/rmrkEquippable';
import {
getCollectionDatabaseId,
getEquippableGroupDatabaseId,
getTokenDatabaseId,
} from '../model/helpers';
import {
CollectionValidParentEquippableGroupIdSetEventPayload,
EquippableGroup,
import { EntityClass, FindOneOptions, Store } from '@subsquid/typeorm-store';
import type { FindOptionsRelations, FindOptionsWhere } from 'typeorm';
import { In } from 'typeorm';
export const splitIntoBatches = <T>(array: T[], maxBatchSize: number): T[][] => {
const result: T[][] = [];
for (let i = 0; i < array.length; i += maxBatchSize) {
const chunk = array.slice(i, i + maxBatchSize);
result.push(chunk);
}
===========
Taks 1: Mint Bitbob NFT.
Action: https://singular.app/bitbob
API to verify the task:
curl https://singular.app/api/bitget-bob-campaign/user-minted-bitbob-nft \
-X POST \
-H "Content-Type: application/json" \
-d '{"address": "0xfbea1b97406C6945D07F50F588e54144ea8B684f"}'
import { Address } from "viem";
export const BASE_REGISTRY_API_BASE_URL = "https://base.org/api/registry";
export const BASE_REGISTRY_API_ENDPOINTS = {
entries: "entries",
featured: "featured",
};
export const BASE_REGISTRY_API_ENTRIES_QUERY_PARAMS = {
//The page number (default 1)
```
import { useAccount, useReadContract } from 'wagmi';
import { type Address, erc20Abi } from 'viem';
import { SKYBREACH_LAND_CHAIN_ID } from 'lib/constants/app';
type Props = {
tokenAddress?: Address;
allowedAddress?: Address;
enabled?: boolean;
chainId?: typeof SKYBREACH_LAND_CHAIN_ID;