Skip to main content
Version: 4.x

Getting Started

useink/chains is an extension of useink that provides hundreds of chain configurations. Configurations are necessary to set up core useink React hooks and display user-facing content. They contain RPC urls, links to block explorers, official websites, and metadata QR codes, and contain native token information, and more.

It is important to note that most of these chains do not implement pallet-contracts, and therefore do not support ink! contracts, but many of the features in useink are compatible with all of these chains. We have added them here for convenience. In addition, many chains are in the process of adding pallet-contracts as they adopt the hybrid chain design, so we expect more and more compatibility with the useink library in the near future.

Installation

You must first install useink.

Configure tsconfig.json

Set moduleResolution to nodenext or bundler inside of your tsconfig.json. This feature allows your application to discover the useink/chains import paths defined in the useink package.json.

{
"compilerOptions": {
"moduleResolution": "nodenext", // or `bundler`
}
}

You can now import any of the chain configurations in useink/chains.

// Example
import { RococoContractsTestnet, ShibuyaTestnet } from 'useink/chains';

Chain Type Definition

interface Chain {
id: ChainId; // See https://use.ink/frontend/chains/chain-id for a list of all possible values.
name: string;
account: '*25519' | 'secp256k1' | 'Sr25519';
subscanUrl?: string;
overrideNativeTokenId?: string;
chainspecQrUrl?: string;
latestMetadataQrUrl?: string;
rpcs: readonly `ws://${string}` | `wss://${string}`[];
coingeckoId?: string | null;
paraId?: number;
relay?: {
id: string;
};
balanceModuleConfigs?: {
[k: string]: {
disable?: boolean;
tokens?: readonly (Token | TokenAsset)[];
};
};
}

interface Token {
symbol: string;
decimals: number;
// existentialDeposit is the minimum amount an account must hold to stay alive.
// Balances held below this amount will be removed from storage
existentialDeposit: string;
// onChainId is the ID for a token in the pallet
onChainId: string | number;
coingeckoId?: string;
}

interface TokenAsset {
assetId: string | number;
symbol: string;
coingeckoId?: string;
}

Example: RococoContractsTestnet

const RococoContractsTestnet: Chain = {
id: 'rococo-contracts-testnet',
name: 'Contracts',
account: '*25519',
rpcs: ['wss://rococo-contracts-rpc.polkadot.io'],
paraId: 1002,
relay: { id: 'rococo-testnet' },
};

Example: Astar

export const Astar: Chain = {
id: 'astar',
name: 'Astar',
account: '*25519',
subscanUrl: 'https://astar.subscan.io/',
chainspecQrUrl: 'https://metadata.novasama.io/qr/astar_specs.png',
latestMetadataQrUrl:
'https://metadata.novasama.io/qr/astar_metadata_latest.apng',
rpcs: [
'wss://rpc.astar.network',
'wss://astar.public.blastapi.io',
'wss://astar-rpc.dwellir.com',
'wss://astar.api.onfinality.io/public-ws',
'wss://astar.public.curie.radiumblock.co/ws',
'wss://public-rpc.pinknode.io/astar',
'wss://1rpc.io/astr',
],
paraId: 2006,
relay: { id: 'polkadot' },
balanceModuleConfigs: {
'substrate-assets': {
tokens: [
{ assetId: '4294969280', symbol: 'USDT', coingeckoId: 'tether' },
{
assetId: '18446744073709551616',
symbol: 'ACA',
coingeckoId: 'acala',
},
{
assetId: '18446744073709551617',
symbol: 'AUSD',
coingeckoId: 'acala-dollar',
},
{
assetId: '18446744073709551618',
symbol: 'LDOT',
coingeckoId: 'liquid-staking-dot',
},
{
assetId: '18446744073709551619',
symbol: 'GLMR',
coingeckoId: 'moonbeam',
},
{
assetId: '18446744073709551620',
symbol: 'IBTC',
coingeckoId: 'interbtc',
},
{
assetId: '18446744073709551621',
symbol: 'INTR',
coingeckoId: 'interlay',
},
{ assetId: '18446744073709551622', symbol: 'PHA', coingeckoId: 'pha' },
{
assetId: '18446744073709551623',
symbol: 'BNC',
coingeckoId: 'bifrost-native-coin',
},
{ assetId: '18446744073709551624', symbol: 'VDOT' },
{ assetId: '18446744073709551625', symbol: 'CLV' },
{ assetId: '18446744073709551626', symbol: 'VSDOT' },
{
assetId: '18446744073709551627',
symbol: 'RING',
coingeckoId: 'darwinia-network-native-token',
},
{
assetId: '18446744073709551628',
symbol: 'EQ',
coingeckoId: 'equilibrium-token',
},
{ assetId: '18446744073709551629', symbol: 'EQD' },
{
assetId: '340282366920938463463374607431768211455',
symbol: 'DOT',
coingeckoId: 'polkadot',
},
],
},
},
}