ChainApi
ChainApi
interface is a concept that allows Dedot to enable Types & APIs suggestions for any Substrated-based blockchains. Each Substrate-based blockchain has its own ChainApi
interface that exposes all of its Types & APIs to interact with the node & runtime.
A ChainApi
interface ussually has the following structure:
Access ChainApi
interfaces
ChainApi
interfacesDedot offers 2 different ways to access ChainApi
interfaces for different Substrate-based blockchains.
Known ChainApi
interfaces defined in @dedot/chaintypes
package
ChainApi
interfaces defined in @dedot/chaintypes
packageInstall package @dedot/chaintypes
to get access to a list of known ChainApi
interfaces. For example:
...
We're welcome everyone to open a pull request to add your favorite Substrate-based network to the existing list of supported networks in@dedot/chaintypes
repo.
There is a job running twice a day to check for any runtime upgrades in the existing supported networks list and regenerate the ChainApi
interface (Types & APIs) accordingly for these changes.
It's important to keep up with changes from the network that you're working with and prepare for any breaking upgrades coming up. Please refer to the Runtime upgrades page for more information.
Generate ChainApi
interface using Dedot's CLI
ChainApi
interface using Dedot's CLIYou can also generate ChainApi
interface for any Substrate-based blockchains using dedot
' CLI.
Generate ChainApi
interface for a local substrate-based blockchains running on ws://127.0.0.1:9944
:
You can also generate ChainApi
interface using a raw metadata file (.scale) or runtime wasm file (.wasm). More information about this can be found in the CLI page.
Using ChainApi
interface
ChainApi
interfaceChainApi
interface is the generic parameter for Dedot's clients, so when intialize a Dedot client, make sure to pick the right ChainApi
interface of the chain you're working with to enable Types & APIs suggestions for that particular chains.
Example working with Polkadot Asset Hub:
Last updated