
Dedot
Delightful JavaScript/TypeScript client for Polkadot & Polkadot SDK-based blockchains.

Dedot is the next-generation JavaScript client for Polkadot and Polkadot SDK-based blockchains. Designed to elevate the dapp development experience, Dedot is built & optimized to be lightweight and tree-shakable, offering precise Types & APIs suggestions for individual Polkadot SDK-based blockchain network and ink! Smart Contracts. Dedot also helps dapps efficiently connect to multiple chains simultaneously as we head toward a seamless multi-chain future.
Features
[!TIP]
Are you developing an ink! dApp?
Check out Typink (https://typink.dev), a comprehensive toolkit for ink! dApp development, built on Dedot!
Documentation
Check out Dedot documentation on the website: https://dedot.dev
Example
npm i dedot # or yarn, pnpm
npm i -D @dedot/chaintypes
import { DedotClient, WsProvider } from 'dedot';
import type { PolkadotApi } from '@dedot/chaintypes';
const provider = new WsProvider('wss://rpc.polkadot.io');
const client = await DedotClient.new<PolkadotApi>(provider);
const metadata = await client.rpc.state_getMetadata();
console.log('Metadata:', metadata);
client.on('bestBlock', (block: PinnedBlock) => {
console.log(`Current best block number: ${block.number}, hash: ${block.hash}`);
});
const balance = await client.query.system.account(<address>);
console.log('Balance:', balance);
const ss58Prefix = client.consts.system.ss58Prefix;
console.log('Polkadot ss58Prefix:', ss58Prefix);
const pendingRewards = await client.call.nominationPoolsApi.pendingRewards(<address>)
console.log('Pending rewards:', pendingRewards);
Resources & announcements
Real-World Projects Powered by Dedot
Acknowledgment
Dedot take a lot of inspirations from project @polkadot/api. A big thank to all the maintainers/contributors of this awesome library.
Proudly supported by Web3 Foundation Grants Program.
License
Apache-2.0