πTransfer tokens between parachains (or relay chain) using XCM and ParaSpell SDK
In this section you'll learn how to send tokens from any Substrate chains to Moonbeam
Executing a XCM route using LightSpell SDK
import { Builder } from'@paraspell/sdk';// Create a connection to the WebSocket providerconstwsProvider=newWsProvider('wss://rpc.polkadot.io');// Create a new instance of the APIconstapi=awaitApiPromise.create({ provider: wsProvider });// From Relay Chain to ParachainBuilder(api).to('Basilisk') // Destination Parachain.amount(amount) // Token amount.address(address) // AccountId32 or AccountKey20 address.build(); // Function called to build the call// From Parachain to Relay ChainBuilder(api).from('Acala') // Origin Parachain.amount(amount) // Token amount.address(address) // AccountId32 address.build(); // Function called to build the call// From Parachain to ParachainBuilder(api).from('Karura') // Origin Parachain.to('Basilisk') // Destination Parachain.currency('KSM') // Token symbol (String) || TokenID (Number).amount(amount) // Token amount.address(address) // AccountId32 or AccountKey20 address.build(); // Function called to build the call