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/palletsImport all of the functionality:
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.
getDefaultPallet(chain: TChain)Example output:
"XTokens"Get all supported XCM pallets
The function returns all supported XCM pallets for the selected compatible Parachain. The function uses TChain types.
getSupportedPallets(chain: TChain)Example output:
[
"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.
getPalletIndex(chain: TChain)Example output:
54Print all supported XCM pallets
This returns all supported XCM pallets for compatible Parachains as a constant.
console.log(SUPPORTED_PALLETS)Print local pallets for native assets
The following function returns all pallets for local transfers of native assets for a specific chain. The function uses TChain types.
getNativeAssetsPallet(chain: TChain)Print local pallets for foreign assets
The following function returns all pallets for local transfers of foreign assets for a specific chain. The function uses TChain types.
getOtherAssetsPallets(chain: TChain)