🇵🇹
DAO Lunes Labs - PT
  • 👋Seja Bem-vindo a DAO Lunes Labs
  • Overview
    • 🚪Introdução
    • 🚀Manifesto DAO Lunes Labs
    • 🍕Tokenomics
    • 👑Proposta de Valor
    • 🧑‍🚀Comunidade e Participação
    • 🗺️Roadmap
    • 💼Compromisso com Ética e Responsabilidade
    • 👾Programa de Bug Bounty: Lunes Security Initiative (LSI)
  • Developers
    • 💽Para Nodes
      • 🥾Instalar Node
        • 🏗️Rust toolchain
        • 🐧Linux
    • 🖥️Para Desenvolvedores
      • 📑Smart Contract Ink! 4.x
        • ✨Configuração
          • 📐Criando um projeto com ink!
          • 🖥️Compile Seu Contrato
          • ⛓️Executar um nó Lunes
          • ⬆️Implante seu contrato
          • 🔛Chame Seu Contrato
          • 🛠️Solução de problemas
        • 🪄Fundamentos
          • 👾Modelo de Contrato
          • 👨‍🚀Armazenando Valores
          • 🔭Lendo Valores do Armazenamento
          • 🦸‍♂️Alterando os Valores de Armazenamento
          • 🎡Eventos
          • 👨‍🔧Seletores
          • 🪶Definições de Trait
          • 🗣️Chamadas entre Contratos (Cross-Contract Calls)
          • 🦸Contratos Atualizáveis
          • 🤺Funções do Ambiente
          • 🏟️Tipos de Ambiente de Cadeia
          • 💠Metadados
          • 🧪Testes de Contrato
          • 🕵️‍♂️Depuração de Contratos
          • 🔬Verificação de Contrato
        • 🎙️Macros e Atributos
          • 📇#[ink::contract]
          • 👽#[ink(anonymous)]
          • 👷#[ink(constructor)]
          • 📏#[ink(default)]
          • 🎢#[ink(event)]
          • 🛩️#[ink(impl)]
          • 📧#[ink(message)]
          • 👨‍💼#[ink(namespace = "…")]
          • 💸#[ink(payable)]
          • ⚡#[ink(selector = S:u32)]
          • 💽#[ink(storage)]
          • 💣#[ink(topic)]
          • ⛓️#[ink::chain_extension]
        • 💽Storege & Data Structires
          • Working with Mapping
          • Storage Layout
          • Custom Data Structures
          • Metadata Format
        • 👾Frontend Development
          • Getting Started
          • Connect Wallet
          • Hooks
            • All Hooks
            • Contracts
              • useCall
              • useCallSubscription
              • useContract
              • useDryRun
              • useEventSubscription
              • useEvents
              • useTx
              • useTxPaymentInfo
            • Wallets
              • useWallet
              • useAllWallets
              • useInstalledWallets
              • useUninstalledWallets
            • API
              • useApi
              • useBalance
              • useBlockHeader
          • Configuration
          • useink / core
            • Contracts
              • Call
              • decodeCallResult
              • decodeError
              • getRegistryError
              • toAbiMessage
          • useink / chains
            • Getting Started
            • Chain Configurations
            • ChainId
          • useink / notifications
            • Getting Started
            • Configuration
            • useNotifications
            • toNotificationLevel
          • useink / utils
            • Getting Started
            • Pick Helpers
            • tx Helpers
            • Types
        • 💡Examples
          • 📔Smart Contracts
          • 📱Dapps
        • 🛠️Tools
          • 🖌️OpenBrush
      • 📒Smart Contract - EVM
        • Create ERC-20 Ink Token!
      • 💰Desenvolvendo uma Wallet Lunes
        • 👾Transações de Tokens PSP22
    • 🎨Para Designers
      • 🖌️Brand Lunes
Powered by GitBook
On this page
  • Installation​
  • Configure tsconfig.json​
  • Chain Type Definition​

Was this helpful?

  1. Developers
  2. Para Desenvolvedores
  3. Smart Contract Ink! 4.x
  4. Frontend Development
  5. useink / chains

Getting Started

Last updated 1 year ago

Was this helpful?

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 , 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 , so we expect more and more compatibility with the useink library in the near future.

Installation

You must first .

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';
  • to learn how these are used in a React app built with useink.

  • for a list of all available configurations.

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

Example: RococoContractsTestnet

Example: Astar

🖥️
📑
👾
pallet-contracts
hybrid chain design
​
install useink
​
See useink Configuration
See Chain Configurations
​
​
​