πŸŒ‰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 provider
const wsProvider = new WsProvider('wss://rpc.polkadot.io');

// Create a new instance of the API
const api = await ApiPromise.create({ provider: wsProvider });

// From Relay Chain to Parachain
Builder(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 Chain
Builder(api)
  .from('Acala')        // Origin Parachain
  .amount(amount)       // Token amount
  .address(address)     // AccountId32 address
  .build();             // Function called to build the call

// From Parachain to Parachain
Builder(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

Last updated