Skip to content
On this page

Send XCM messages across Paraverse 🪐

You can use our SDK in all three scenarios:

  • Relay chain to Parachain XCM transfer
  • Parachain to Relay chain XCM transfer
  • Parachain to Parachain XCM transfer

Video guide for this section:

xcmPallet

Relay chain to Parachain

Only the to parameter is provided, thus the Relay chain to Parachain scenario will be used.

Builder pattern

js
  await Builder(api)        //Api parameter is optional
      .to('Basilisk')       // Destination Parachain //You can now add custom ParachainID eg. .to('Basilisk', 2024) or use custom Multilocation
      .amount(amount)       // Token amount
      .address(address)     // AccountId32 or AccountKey20 address or custom Multilocation
      .build()              // Function called to build call

Function pattern

js
await paraspell.xcmPallet.transferRelayToPara(
  {
    api?,                 //Api parameter (Optional)
    destination,          // Destination Parachain or custom Multilocation
    amount,               // Token amount
    to                    // AccountId32 or AccountKey20 address or custom Multilocation
    paraIdTo?,            //Custom destination parachain ID (Optional)
    destApiForKeepAlive?  //Api parameter for keep alive check (Optional)
  }
)

AccountId32 and AccountKey20 addresses can be directly copied from PolkadotJS as our SDK has a handler to convert it into the desired hex string automatically.

Eg. use standard public key 141NGS2jjZca5Ss2Nysth2stJ6rimcnufCNHnh5ExSsftn7U Instead of 0x84fc49ce30071ea611731838cc7736113c1ec68fbc47119be8a0805066df9b2b

To find out more about custom multilocations reffer to the following PR.

Parachain to Relay chain

Only the from parameter is provided, thus the Parachain to Relay chain scenario will be used.

Builder pattern

js
  await Builder(api)            //Api parameter is optional
      .from('Acala')            // Origin Parachain
      .feeAsset(feeAsset)       // Fee asset select id - optional
      .amount(amount)           // Token amount
      .address(address)         // AccountId32 address or custom Multilocation
      .build()                  // Function called to build call

Function pattern

js
await paraspell.xcmPallet.send(
  {
    api?,                 //Api parameter (Optional)
    origin,               // Origin Parachain
    amount,               // Token amount
    feeAsset?             // Fee asset select id
    to                    // AccountId32 or AccountKey20 address or custom Multilocation
    paraIdTo?,            //Custom destination parachain ID (Optional)
    destApiForKeepAlive?  //Api parameter for keep alive check (Optional)
  }
)

AccountId32 and AccountKey20 addresses can be directly copied from PolkadotJS as our SDK has a handler to convert it into the desired hex string automatically.

Eg. use standard public key 141NGS2jjZca5Ss2Nysth2stJ6rimcnufCNHnh5ExSsftn7U Instead of 0x84fc49ce30071ea611731838cc7736113c1ec68fbc47119be8a0805066df9b2b

To find out more about custom multilocations reffer to the following PR.

Parachain to Parachain

Both from and to parameters are provided, thus the Parachain to Parachain scenario will be used.

NOTE If you wish to transfer from Parachain that uses long IDs for example Moonbeam you have to add character 'n' the end of currencyID. Eg: .currency(42259045809535163221576417993425387648n) will mean you transfer xcDOT.

Builder pattern

js
  await Builder(api)            //Api parameter is optional
      .from('Karura')           // Origin Parachain
      .to('Basilisk')       // Destination Parachain //You can now add custom ParachainID eg. .to('Basilisk', 2024) or use custom Multilocation
      .currency('KSM')          // Token symbol (String) || TokenID (Number) or custom Multilocation
      .feeAsset(feeAsset)       // Fee asset select id - optional
      .amount(amount)           // Token amount
      .address(address)         // AccountId32 or AccountKey20 address or custom Multilocation
      .build()                  // Function called to build call

Function pattern

js
await paraspell.xcmPallet.send(
  {
    api?,                 //Api parameter (Optional)
    origin,               // Origin Parachain
    currency,             // Token symbol (String) || TokenID (Number) or custom Multilocation
    feeAsset?             // Fee asset select id,
    amount,               // Token amount
    to,                   // AccountId32 or AccountKey20 address or custom Multilocation
    destination,          // Destination Parachain or custom Multilocation
    paraIdTo?,            //Custom destination parachain ID (Optional)
    destApiForKeepAlive?  //Api parameter for keep alive check (Optional)
  }
)

AccountId32 and AccountKey20 addresses can be directly copied from PolkadotJS as our SDK has a handler to convert it into the desired hex string automatically.

Eg. use standard public key 141NGS2jjZca5Ss2Nysth2stJ6rimcnufCNHnh5ExSsftn7U Instead of 0x84fc49ce30071ea611731838cc7736113c1ec68fbc47119be8a0805066df9b2b

To find out more about custom multilocations reffer to the following PR.

Query existential deposit

Latest SDK versions now offer ability to query existential deposit on implemented chains using simple call:

ts
import { getExistentialDeposit } from "@paraspell/sdk";

const ed = getExistentialDeposit('Acala')

Developer experience

Builder pattern experience

When developing with the Builder pattern, the developer is guided by the typescript and thus knows which parameter can be added next. This increases the developer experience and makes SDK easier to use. builder

Control messages into the console

Once the call is being constructed developer is warned about major details regarding the call into the console. This way they can ensure, that the call they wanted to create is being created. 212045110-c001fcb7-8cc2-421c-9cd0-6d8205b3b11f

Supported chains

Relay chains

Node nameWebsiteGithubPolkadot.jsSupported XCM PalletCurrent latest XCM Version
PolkadotWebsite-Polkadot.jspolkadotXCMXCM V3
KusamaWebsite-Polkadot.jspolkadotXCMXCM V3

Polkadot Parachains

Node nameWebsiteGithubPolkadot.jsNode idSupported XCM PalletCurrent latest XCM Version
PolkadotAssetHubWebsiteGithubPolkadot.js1000polkadotXCMXCM V3
AcalaWebsiteGithubPolkadot.js2000xTokensXCM V3
AstarWebsiteGithubPolkadot.js2006polkadotXCMXCM V3
BifrostPolkadotWebsiteGithubPolkadot.js2030xTokensXCM V3
CentrifugeWebsiteGithubPolkadot.js2031xTokensXCM V3
CloverWebsiteGithubPolkadot.js2002xTokensXCM V1
ComposableFinanceWebsiteGithubPolkadot.js2019xTokensXCM V3
CrustWebsiteGithubPolkadot.js2008xTokensXCM V3
DarwiniaWebsiteGithubPolkadot.js2046polkadotXCMXCM V3
EquilibriumWebsiteGithubPolkadot.js2011polkadotXcmXCM V3
HydraDXWebsiteGithubPolkadot.js2034xTokensXCM V3
InterlayWebsiteGithubPolkadot.js2032xTokensXCM V3
LitentryWebsiteGithubPolkadot.js2013xTokensXCM V3
MantaWebsiteGithubPolkadot.js2104xTokensXCM V3
MoonbeamWebsiteGithubPolkadot.js2004xTokensXCM V3
NodleWebsiteGithubPolkadot.js2026xTokensXCM V3
OriginTrailWebsiteGithubPolkadot.js2043polkadotXCMXCM V3
PendulumWebsiteGithubPolkadot.js2094xTokensXCM V3
PolkadexWebsiteGithubPolkadot.js2040xTokensXCM V3
ParallelWebsiteGithubPolkadot.js2012xTokensXCM V3
UniqueWebsiteGithubPolkadot.js2037xTokensXCM V3
ZeitgeistWebsiteGithubPolkadot.js2092xTokensXCM V3
PhalaWebsiteGithubPolkadot.js2035xTransferXCM V3
CollectivesWebsiteGithubPolkadot.js1001PolkadotXCMXCM V3

Kusama Parachains

Node nameWebsiteGithubPolkadot.jsNode idSupported XCM PalletCurrent latest XCM Version
KusamaAssetHubWebsiteGithubPolkadot.js1000polkadotXCMXCM V3
EncointerWebsiteGithubPolkadot.js1001polkadotXCMXCM V3
AltairWebsiteGithubPolkadot.js2088xTokensXCM V1
AmplitudeWebsiteGithubPolkadot.js2124xTokensXCM V3
BasiliskWebsiteGithubPolkadot.js2090xTokensXCM V3
BifrostKusamaWebsiteGithubPolkadot.js2001xTokensXCM V3
PioneerWebsiteGithubPolkadot.js2096xTokensXCM V1
CalamariWebsiteGithubPolkadot.js2084xTokensXCM V3
CrustShadowWebsiteGithubPolkadot.js2012xTokensXCM V3
CrabWebsiteGithubPolkadot.js2105polkadotXCMXCM V3
GenshiroWebsiteGithubPolkadot.js2024polkadotXCMXCM V3
ImbueWebsiteGithubPolkadot.js2121xTokensXCM V3
IntegriteeWebsiteGithubPolkadot.js2015xTokensXCM V3
InvArchTinkerWebsiteGithubPolkadot.js2125xTokensXCM V3
KaruraWebsiteGithubPolkadot.js2000xTokensXCM V3
KintsugiWebsiteGithubPolkadot.js2092xTokensXCM V3
LitmusWebsiteGithubPolkadot.js2106xTokensXCM V1
MangataWebsiteGithubPolkadot.js2110xTokensXCM V3
MoonriverWebsiteGithubPolkadot.js2023xTokensXCM V3
ParallelHeikoWebsiteGithubPolkadot.js2085xTokensXCM V3
PicassoWebsiteGithubPolkadot.js2087xTokensXCM V3
QuartzWebsiteGithubPolkadot.js2095xTokensXCM V3
RobonomicsWebsiteGithubPolkadot.js2048polkadotXCMXCM V1
ShidenWebsiteGithubPolkadot.js2007polkadotXCMXCM V3
TuringWebsiteGithubPolkadot.js2114xTokensXCM V3
KhalaWebsiteGithubPolkadot.js2004xTransferXCM V3