0
votes

Extending the front end template to do some new things and running into issues with multiaddress lookup functionality as specified in our chain here: https://github.com/Greenetwork/BLX_chain/blob/f14ad8705debcc8033069b4fdda046271e1b61f1/pallets/allocator/src/lib.rs#L140

So it seems that the issue is that we are missing one piece of data that the extrinsic (tradeTokens) wants (the piece that defines which "type" for fromapn:Source and toapn:Source)

You can see below that the using the dropdown menus to select Address32 in polkadot js apps yields a 3 being populated in the encoded call data (Address32 is the 3rd entry in the Source enum) enter image description here

and further here that 3 is shown as ‘snip< Address32: >snip’ enter image description here

Currently as the code in our front-end-template: https://github.com/Greenetwork/BLX_frontend_new/blob/afe6f9f256e6c9c2a3164f72cf80d4a9057bb893/src/Transfer.js#L71-L72

the error is:

Unhandled Rejection (Error): createType(Call):: Call: failed decoding allocator.tradeTokens:: Struct: failed on args: {"asset_id":"AssetId","fromapn":"Source","toapn":"Source","amt":"Balance1"}:: Struct: failed on fromapn: {"_enum":{"Id":"AccountId","Index":"AccountIndex","Raw":"Bytes","Address32":"[u8;32]","Address20":"[u8;20]"}}:: Invalid AccountId provided, expected 32 bytes, found 31

I think the issue is that the extrinsic is reading the first (or second, see call data in first picture) value of the data being submitted to fromapn as the index of Source, in the current case, that is 0, so it is proceeding to treat the remainder of the data that it was passed as an AccountId.

It is failing on the fact that by using one of the values as the index of Source so we are only left with 31 bytes instead of 32. AccountId is also 32 bytes i think.

Do we need another helper function to append that extra piece of data which specifies the type? Or is there another path?

1

1 Answers