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:
Relay chain to Parachain
Only the to
parameter is provided, thus the Relay chain to Parachain scenario will be used.
Builder pattern
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
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
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
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
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
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:
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.
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.
Supported chains
Relay chains
Node name | Website | Github | Polkadot.js | Supported XCM Pallet | Current latest XCM Version |
---|---|---|---|---|---|
Polkadot | Website | - | Polkadot.js | polkadotXCM | XCM V3 |
Kusama | Website | - | Polkadot.js | polkadotXCM | XCM V3 |
Polkadot Parachains
Node name | Website | Github | Polkadot.js | Node id | Supported XCM Pallet | Current latest XCM Version |
---|---|---|---|---|---|---|
PolkadotAssetHub | Website | Github | Polkadot.js | 1000 | polkadotXCM | XCM V3 |
Acala | Website | Github | Polkadot.js | 2000 | xTokens | XCM V3 |
Astar | Website | Github | Polkadot.js | 2006 | polkadotXCM | XCM V3 |
BifrostPolkadot | Website | Github | Polkadot.js | 2030 | xTokens | XCM V3 |
Centrifuge | Website | Github | Polkadot.js | 2031 | xTokens | XCM V3 |
Clover | Website | Github | Polkadot.js | 2002 | xTokens | XCM V1 |
ComposableFinance | Website | Github | Polkadot.js | 2019 | xTokens | XCM V3 |
Crust | Website | Github | Polkadot.js | 2008 | xTokens | XCM V3 |
Darwinia | Website | Github | Polkadot.js | 2046 | polkadotXCM | XCM V3 |
Equilibrium | Website | Github | Polkadot.js | 2011 | polkadotXcm | XCM V3 |
HydraDX | Website | Github | Polkadot.js | 2034 | xTokens | XCM V3 |
Interlay | Website | Github | Polkadot.js | 2032 | xTokens | XCM V3 |
Litentry | Website | Github | Polkadot.js | 2013 | xTokens | XCM V3 |
Manta | Website | Github | Polkadot.js | 2104 | xTokens | XCM V3 |
Moonbeam | Website | Github | Polkadot.js | 2004 | xTokens | XCM V3 |
Nodle | Website | Github | Polkadot.js | 2026 | xTokens | XCM V3 |
OriginTrail | Website | Github | Polkadot.js | 2043 | polkadotXCM | XCM V3 |
Pendulum | Website | Github | Polkadot.js | 2094 | xTokens | XCM V3 |
Polkadex | Website | Github | Polkadot.js | 2040 | xTokens | XCM V3 |
Parallel | Website | Github | Polkadot.js | 2012 | xTokens | XCM V3 |
Unique | Website | Github | Polkadot.js | 2037 | xTokens | XCM V3 |
Zeitgeist | Website | Github | Polkadot.js | 2092 | xTokens | XCM V3 |
Phala | Website | Github | Polkadot.js | 2035 | xTransfer | XCM V3 |
Collectives | Website | Github | Polkadot.js | 1001 | PolkadotXCM | XCM V3 |
Kusama Parachains
Node name | Website | Github | Polkadot.js | Node id | Supported XCM Pallet | Current latest XCM Version |
---|---|---|---|---|---|---|
KusamaAssetHub | Website | Github | Polkadot.js | 1000 | polkadotXCM | XCM V3 |
Encointer | Website | Github | Polkadot.js | 1001 | polkadotXCM | XCM V3 |
Altair | Website | Github | Polkadot.js | 2088 | xTokens | XCM V1 |
Amplitude | Website | Github | Polkadot.js | 2124 | xTokens | XCM V3 |
Basilisk | Website | Github | Polkadot.js | 2090 | xTokens | XCM V3 |
BifrostKusama | Website | Github | Polkadot.js | 2001 | xTokens | XCM V3 |
Pioneer | Website | Github | Polkadot.js | 2096 | xTokens | XCM V1 |
Calamari | Website | Github | Polkadot.js | 2084 | xTokens | XCM V3 |
CrustShadow | Website | Github | Polkadot.js | 2012 | xTokens | XCM V3 |
Crab | Website | Github | Polkadot.js | 2105 | polkadotXCM | XCM V3 |
Genshiro | Website | Github | Polkadot.js | 2024 | polkadotXCM | XCM V3 |
Imbue | Website | Github | Polkadot.js | 2121 | xTokens | XCM V3 |
Integritee | Website | Github | Polkadot.js | 2015 | xTokens | XCM V3 |
InvArchTinker | Website | Github | Polkadot.js | 2125 | xTokens | XCM V3 |
Karura | Website | Github | Polkadot.js | 2000 | xTokens | XCM V3 |
Kintsugi | Website | Github | Polkadot.js | 2092 | xTokens | XCM V3 |
Litmus | Website | Github | Polkadot.js | 2106 | xTokens | XCM V1 |
Mangata | Website | Github | Polkadot.js | 2110 | xTokens | XCM V3 |
Moonriver | Website | Github | Polkadot.js | 2023 | xTokens | XCM V3 |
ParallelHeiko | Website | Github | Polkadot.js | 2085 | xTokens | XCM V3 |
Picasso | Website | Github | Polkadot.js | 2087 | xTokens | XCM V3 |
Quartz | Website | Github | Polkadot.js | 2095 | xTokens | XCM V3 |
Robonomics | Website | Github | Polkadot.js | 2048 | polkadotXCM | XCM V1 |
Shiden | Website | Github | Polkadot.js | 2007 | polkadotXCM | XCM V3 |
Turing | Website | Github | Polkadot.js | 2114 | xTokens | XCM V3 |
Khala | Website | Github | Polkadot.js | 2004 | xTransfer | XCM V3 |