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)