TypeScript definitions for various PolkadotSDK-based known networks.
# Install dedot
npm i dedot
# Install chaintypes as a dev dependency
npm i -D @dedot/chaintypesNote:
@dedot/chaintypesshould be installed as a dev dependency since it only provides TypeScript type definitions for known-chains and is not needed at runtime.
Import types for specific networks:
// Import types for Polkadotimporttype{PolkadotApi}from'@dedot/chaintypes';// Import types for Kusamaimporttype{KusamaApi}from'@dedot/chaintypes';// Import types for other networksimporttype{AstarApi,MoonbeamApi,// ... other networks}from'@dedot/chaintypes';You can also import types for specific networks directly:
// Import types for Polkadot directlyimporttype{PolkadotApi}from'@dedot/chaintypes/polkadot';To get full TypeScript support when working with a specific network, you can initialize a DedotClient with the appropriate ChainApi:
import{DedotClient,WsProvider}from'dedot';importtype{PolkadotApi}from'@dedot/chaintypes';// Initialize a typed client for Polkadotconstclient=awaitDedotClient.new<PolkadotApi>(newWsProvider('wss://rpc.polkadot.io'));// Now you get full TypeScript support for Polkadot-specific APIsconstbalance=awaitclient.query.system.account('ADDRESS');import{DedotClient,WsProvider}from'dedot';importtype{PolkadotApi,KusamaApi,AstarApi,PolkadotAssetHubApi}from'@dedot/chaintypes';// For KusamaconstkusamaClient=awaitDedotClient.new<KusamaApi>(newWsProvider('wss://kusama-rpc.polkadot.io'));// For AstarconstastarClient=awaitDedotClient.new<AstarApi>(newWsProvider('wss://rpc.astar.network'));// For Polkadot Asset HubconstpolkadotAssetHubClient=awaitDedotClient.new<PolkadotAssetHubApi>(newWsProvider('wss://polkadot-asset-hub-rpc.polkadot.io'));For more detailed information on connecting to networks, see the official documentation.
- Polkadot
- Polkadot Asset Hub
- Polkadot People
- Kusama
- Kusama Asset Hub
- Kusama People
- Westend
- Westend Asset Hub
- Westend People
- Paseo
- Paseo Asset Hub
- Paseo People
- Paseo Hydration
- Astar
- Moonbeam
- Aleph
- Hydration
- Basilisk
- Vara
Don't see your network? We welcome Pull Requests to add support for additional PolkadotSDK-based networks!
Apache-2.0