Skip to content

Repository files navigation

Dedot Banner

Dedot

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

VersionUnit testE2E testLicenseweekly downloadsChat on Telegram

👉 Join our Telegram group to receive the latest updates and support!! 👈


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

  • ✅ Fully support light clients (e.g: smoldot)
  • ✅ Small bundle size, tree-shakable (no more bn.js or wasm-blob tight dependencies)
  • ✅ Types & APIs suggestions for each individual Polkadot SDK-based blockchain network (@dedot/chaintypes)
  • ✅ Familiar api style with @polkadot/api, easy & fast migration!
  • ✅ Native TypeScript type system for scale-codec
  • ✅ Compatible with @polkadot/extension-based wallets
  • ✅ Support Metadata V14, V15, V16 (latest)
  • ✅ Built-in metadata optimization (caching)
  • ✅ Build on top of both the new & legacy ( deprecated soon) JSON-RPC APIs
  • Unified Typesafe Contract APIs for ink! v5 (WASM, pallet-contracts), ink! v6 and solidity contracts (PVM, pallet-revive)
  • ✅ Fully-typed low-level JSON-RPC client

Tip

Are you building dapps on Polkadot?

Check out Typink (https://typink.dev), a comprehensive toolkit for dapps development, powered by Dedot!

Documentation

Check out Dedot documentation on the website: https://dedot.dev

Example

  1. Install packages
npm i dedot # or yarn, pnpm
npm i -D @dedot/chaintypes
  1. Connect to the network
import{DedotClient,WsProvider}from'dedot';importtype{PolkadotApi}from'@dedot/chaintypes';constprovider=newWsProvider('wss://rpc.polkadot.io');constclient=awaitDedotClient.new<PolkadotApi>(provider);// Get current best blockconstbestBlock=awaitclient.block.best();console.log('Best block:',bestBlock.number,bestBlock.hash);// Subscribe to finalized blocksconstunsub=client.block.finalized((block)=>{console.log('Finalized block:',block.number);});// Query on-chain storageconstbalance=awaitclient.query.system.account(<address>);console.log('Balance:',balance);// Get pallet constantsconstss58Prefix=client.consts.system.ss58Prefix;console.log('Polkadot ss58Prefix:',ss58Prefix);// Call runtime apiconstpendingRewards=awaitclient.call.nominationPoolsApi.pendingRewards(<address>);console.log('Pending rewards:',pendingRewards);// Sign and send transactionconstresult=awaitclient.tx.balances.transferKeepAlive(<dest>,1_000_000_000_000n).signAndSend(signer).untilFinalized();// Disconnectawaitclient.disconnect();

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

About

Delightful JavaScript client for Polkadot & Polkadot SDK-based blockchain networks

Topics

Resources

Stars

71 stars

Watchers

4 watching

Forks

Releases

Used by

Contributors

Languages