When working with extrinsics, call parameters are often represented as complex, nested structures. The library provides a way to decompose these types to understand the required schema for specific pallet calls. For example, a currency_id might be a simple string or a complex object depending on the pallet and the specific token type (e.g., DexShare, Erc20, StableAssetPoolToken).
Commonly encountered types in parameter decomposition include:
- Token identifiers: Can be a simple string (e.g.,
'DOT', 'KSM') or a structured object. - Account identifiers: Often involve nested structures like
AccountId32 which contains network information (Polkadot, Kusama, etc.) and the raw id ([u8; 32]). - Plurality/Governance types: Complex structures defining membership, fractions, or proportions (e.g.,
nom, denom).
{
'currency_id': {
'Token': ('ACA', 'AUSD', 'DOT', 'LDOT', 'TAP', 'RENBTC', 'CASH', 'KAR', 'KUSD', 'KSM', 'LKSM', 'TAI', 'BNC', 'VSKSM', 'PHA', 'KINT', 'KBTC'),
'DexShare': ({
'Token': ('ACA', 'AUSD', 'DOT', 'LDOT', 'TAP', 'RENBTC', 'CASH', 'KAR', 'KUSD', 'KSM', 'LKSM', 'TAI', 'BNC', 'VSKSM', 'PHA', 'KINT', 'KBTC'),
'Erc20': '[u8; 20]',
'LiquidCrowdloan': 'u32',
'ForeignAsset': 'u16',
'StableAssetPoolToken': 'u32'
}, {
'Token': ('ACA', 'AUSD', 'DOT', 'LDOT', 'TAP', 'RENBTC', 'CASH', 'KAR', 'KUSD', 'KSM', 'LKSM', 'TAI', 'BNC', 'VSKSM', 'PHA', 'KINT', 'KBTC'),
'Erc20': '[u8; 20]',
'LiquidCrowdloan': 'u32',
'ForeignAsset': 'u16',
'StableAssetPoolToken': 'u32'
}),
'Erc20': '[u8; 20]',
'StableAssetPoolToken': 'u32'
}
}