-
Notifications
You must be signed in to change notification settings - Fork 381
Closed
Description
Error: Struct: failed on assetId: Option<MultiLocationV3>:: decodeU8aStruct: failed at 0x010300a10f043205e514… on interior (index 2/2): {"_enum":{"Here":"Null","X1":"JunctionV3","X2":"(JunctionV3,JunctionV3)","X3":"(JunctionV3,JunctionV3,JunctionV3)","X4":"(JunctionV3,JunctionV3,JunctionV3,JunctionV3)","X5":"(JunctionV3,JunctionV3,JunctionV3,JunctionV3,JunctionV3)","X6":"(JunctionV3,JunctionV3,JunctionV3,JunctionV3,JunctionV3,JunctionV3)","X7":"(JunctionV3,JunctionV3,JunctionV3,JunctionV3,JunctionV3,JunctionV3,JunctionV3)","X8":"(JunctionV3,JunctionV3,JunctionV3,JunctionV3,JunctionV3,JunctionV3,JunctionV3,JunctionV3)"}}:: decodeU8aStruct: failed at 0xa10f043205e514… on key (index 2/2): [u8;20]:: Expected input with 20 bytes (160 bits), found 7 bytes
In the above error it expects AccountKey20 (derived from [u8;20]). The index of this is 3 in JunctionV3. The assetId hex string always starts with 0x0103, in which 0x01 is used for parent: 1 and 0x03 should be used for X3 of JunctionsV3. However, the 0x03 occurs to be used not only for JunctionsV3 but also for the first entry into the tuple of X3, which is JunctionV3. So, it seems to be like a mistaken overlap for the decode functionality.
I want to use the following assetId (which is USDC on AssetHub for our Zeitgeist Parachain):
let parentsNumber = api.registry.createType('u8', 1);
let parachainCompactNumber = api.registry.createType('Compact<u32>', 1000);
// let parachain = api.registry.createType('JunctionV3', { Parachain: parachainCompactNumber });
let palletInstanceNumber = api.registry.createType('u8', 50);
// let palletInstance = api.registry.createType('JunctionV3', { PalletInstance: palletInstanceNumber });
let generalIndexNumber = api.registry.createType('Compact<u128>', 1337);
// let generalIndex = api.registry.createType('JunctionV3', { GeneralIndex: generalIndexNumber });
let assetId = api.registry.createType('TAssetConversion', {
// eslint-disable-next-line sort-keys
// 0x010300a10f043205e514 (parachain, palletInstance, generalIndex) [1,1,3,0,161,15,4,50,5,229,20]
// 0x010305e51400a10f0432 (generalIndex, parachain, palletInstance) [1,1,3,5,229,20,0,161,15,4,50]
// 0x010300a10f05e5140432 (parachain, generalindex, palletInstance) [1,1,3,0,161,15,5,229,20,4,50]
// 0x0103043200a10f05e514 (palletInstance, parachain, generalIndex) [1,1,3,4,50,0,161,15,5,229,20]
// 0x0103043205e51400a10f (palletInstance, generalIndex, parachain) [1,1,3,4,50,5,229,20,0,161,15]
// 0x010305e514043200a10f (generalindex, palletInstance, parachain) [1,1,3,5,229,20,4,50,0,161,15]
// parents: 0x01 or [1,1]
// interior x3: 0x03 or [3]
// generalIndex: 0x05e514 or [5,229,20]; the 5 is the index of JunctionV3 enum
// palletInstance: 0x0432 or [4,50]; the 4 is the index of JunctionV3 enum; 50 is the palletInstance number
// parachain: 0x0a10f or [0,161,15]; the 0 is the index of JunctionV3 enum
parents: parentsNumber,
interior: {
x3: [
{ parachain: parachainCompactNumber },
{ palletInstance: palletInstanceNumber },
{ generalIndex: generalIndexNumber },
],
},
});Here is some useful debug output of @polkadot/types-codec:
Btw. I used a local fork of @polkadot/api and @polkadot/known-types to override the TAssetConversion for zeitgeist to be Option<MultiLocationV3>.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels

