Getting started with your journey accross Paraverse π¨βπ β
This guide guides you through implementation of XCM SDK that allows you to do various exciting actions on Polkadot and Kusama chains. To start proceed with steps mentioned below. Good luck adventurer!
Starter template π« β
Don't want to go through setup and build from ground up?
- Our team has created a XCM SDK Starter template for you!
This template is programmed with React & Vite framework. It contains basic components ready to set you off on your cross-chain dApp journey.
Install Dependencies β
Install peer dependencies according to the API package you choose.
ParaSpell XCM SDK is the π₯ first in the ecosystem to support PolkadotJS, Polkadot API and Dedot.
Choose your package manager:
Polkadot API (PAPI) Peer Dependencies β
pnpm add polkadot-apiPolkadotJS (PJS) Peer Dependencies β
pnpm add @polkadot/api @polkadot/types @polkadot/api-base @polkadot/util @polkadot/util-cryptoDedot Peer Dependencies β
pnpm add dedot @polkadot/keyringInstall XCM SDK package β
XCM SDK supports three different Javascript client providers. It is advised to use PAPI JS provider or Dedot JS provider, but in case your project heavily relies on Polkadot JS you can also install PJS SDK version. Please note, that PJS and Dedot version does not have Swap functionality yet.
Polkadot API (PAPI) client version β
pnpm add @paraspell/sdkPolkadotJS (PJS) client version β
pnpm add @paraspell/sdk-pjsDedot client version β
pnpm add @paraspell/sdk-dedotInstall swap extension β
If you plan to do Swap XCMs you can install Swap package which allows you to do cross-chain swaps on popular Polkadot, Kusama, Paseo, Westend exchanges. Only available in PAPI version of SDK.
IMPORTANT
- β οΈ WebAssembly (Wasm) must be enabled in your project because of the Hydration SDK (One of the exchanges implemented in XCM Router). Wasm can be enabled either through the web application configuration or through the appropriate plugin. Additionally, Hydration requires the use of the augment package (see: https://github.com/galacticcouncil/sdk/issues/114).
pnpm add @paraspell/swapImport package β
There are two ways to import package to your project. Importing builder or classic import.
Named import β
Named import is restricted for sending XCM messages and using transfer info.
// Polkadot API version
import { Builder } from '@paraspell/sdk'
// Polkadot JS version
import { Builder } from '@paraspell/sdk-pjs'
// Dedot version
import { Builder } from '@paraspell/sdk-dedot'Default import β
Default import allows you to use every functionality XCM SDK offers.
// ESM PAPI
import * as paraspell from '@paraspell/sdk'
// ESM PJS
import * as paraspell from '@paraspell/sdk-pjs'
// ESM DEDOT
import * as paraspell from '@paraspell/sdk-dedot'