Skip to content

Query which XCM pallet Parachain uses πŸ“¦ ​

This functionality allows developers to query the XCM pallets that Parachains currently support.

Getting Started ​

You have two options for using this functionality: install it as a standalone package, or use it by directly importing it from XCM SDK (if you already have it installed).

Standalone Pallet Package ​

You do not need to have XCM SDK installed for the following functionality. You can also install it as a standalone package and use it separately, which is a good approach for vanilla projects.

Choose your package manager:

pnpm add @paraspell/pallets

Import all of the functionality:

ts
import {
  getDefaultPallet,
  getSupportedPallets,
  getPalletIndex,
  SUPPORTED_PALLETS,
  getNativeAssetsPallet,
  getOtherAssetsPallets
} from '@paraspell/pallets'

Already using XCM SDK ​

The pallet package is included with the XCM SDK. If you already have the XCM SDK installed, you can directly import the functionality:

import {
  getDefaultPallet,
  getSupportedPallets,
  getPalletIndex,
  SUPPORTED_PALLETS,
  getNativeAssetsPallet,
  getOtherAssetsPallets
} from '@paraspell/sdk'

Get default XCM pallet ​

The function returns the default XCM pallet for the selected compatible Parachain. The function uses TChain types.

ts
getDefaultPallet(chain: TChain)

Example output:

json
"XTokens"

Get all supported XCM pallets ​

The function returns all supported XCM pallets for the selected compatible Parachain. The function uses TChain types.

ts
getSupportedPallets(chain: TChain)

Example output:

json
[
  "PolkadotXcm",
  "XTokens"
]

Get index of XCM Pallet ​

The function returns the index of the XCM Pallet for the selected Parachain. The function uses TChain types.

ts
getPalletIndex(chain: TChain)

Example output:

json
54

This returns all supported XCM pallets for compatible Parachains as a constant.

ts
console.log(SUPPORTED_PALLETS)

The following function returns all pallets for local transfers of native assets for a specific chain. The function uses TChain types.

ts
getNativeAssetsPallet(chain: TChain)

The following function returns all pallets for local transfers of foreign assets for a specific chain. The function uses TChain types.

ts
getOtherAssetsPallets(chain: TChain)