问题描述
意图:
并使用 APN: [u8; 32]
和 "Address32": "[u8;32]" of MultiAddress 存储友好帐户名 (APN),可用于与其他托盘松散耦合。
功能:
这在带有这些 types 的 polkadot js 应用程序中似乎可以正常工作。我可以在存储中检查代理 acc 已创建,并且该帐户可通过其友好名称使用另一个带有 check_name
的托盘检索问题:
我想将此功能模仿并扩展(涉及映射/外部数据即/等)到前端模板中,但我遇到了解码问题?与类型相关?,以下是我尝试过的类型:
{
"Address": "AccountId","Lookupsource": "AccountId","APN": "[u8;32]","Name": "[u8;32]","ApnToken": {
"super_apn": "u32","agency_name": "Vec<u8>"
},"Source": {
"_enum": {
"Id": "AccountId","Index": "AccountIndex","Raw": "Vec<u8>","Address32": "[u8;32]","Address20": "[u8;20]"
}
}
}
这是每个 polkadot.js 和前端模板的屏幕截图。我在两种情况下都使用相同的输入。
js 应用:
前端模板:
错误:
Unhandled Rejection (Error): createType(Call):: Call: Failed decoding claimer.createApnAccount:: Struct: Failed on args: {"proxy_type":"ProxyType","delay":"BlockNumber","index":"u16","APN":"[u8;32]"}:: Struct: Failed on APN: [u8;32]:: value.subarray is not a function
▼ 5 stack frames were expanded.
createTypeUnsafe
node_modules/@polkadot/types/create/createType.mjs:62
createType
node_modules/@polkadot/types/create/createType.mjs:73
TypeRegistry.createType
node_modules/@polkadot/types/create/registry.mjs:275
extrinsicFn
node_modules/@polkadot/Metadata/decorate/extrinsics/createUnchecked.mjs:17
decorated [as createApnAccount]
node_modules/@polkadot/api/base/Decorate.mjs:320
▲ 5 stack frames were expanded.
signedTx
src/substrate-lib/components/TxButton.js:99
96 | const transformed = transformParams(paramFields,inputParams);
97 | // transformed can be empty parameters
98 |
> 99 | const txExecute = transformed
| ^ 100 | ? api.tx[palletRpc][callable](...transformed)
101 | : api.tx[palletRpc][callable]();
102 |
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)