Skip to content

Instantly share code, notes, and snippets.

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;
@Yuripetusko
Yuripetusko / decode-evm-transaction-error-result.ts
Last active October 16, 2024 21:53
decode-evm-transaction-error-result.ts
import type { Abi } from 'abitype';
import {
AbiErrorSignatureNotFoundError,
BaseError,
ContractFunctionExecutionError,
type ContractFunctionExecutionErrorType,
ContractFunctionRevertedError,
decodeErrorResult,
InvalidInputRpcError,
type SimulateContractErrorType,
import fs from 'fs';
const fsPromises = fs.promises;
export const getOrCreateNdjosnLogFile = async <T>(path: string) => {
let response: T[] = [];
if (fs.existsSync(path)) {
const rawResponse = fs.readFileSync(path, 'utf-8');
if (rawResponse.length !== 0) {
response = rawResponse
import { graphqlRmrkIndexer } from 'lib/graphql/graphql-client';
export const getPlotByIdQuery = graphqlRmrkIndexer(
`
query GetPlotByIdData($plotId: String!) {
nftById(id: $plotId) {
...NftFragment
}
}
`,