本文介绍了无法在节点和运行时之间转换参数`tx`:解码字段调用时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当我想要使用基于基片的链中内置的方法和自定义类型时,我得到以下错误:
2020-04-13 21:03:01 RPC-CORE: submitAndWatchExtrinsic(extrinsic: Extrinsic): ExtrinsicStatus:: 1002: Verification Error: Execution(ApiError("Could not convert parameter `tx` between node and runtime: Error decoding field Call :: Poe.0")): RuntimeApi("Execution(ApiError("Could not convert parameter `tx` between node and runtime: Error de
2020-04-13 21:03:01 DRR: Error: 1002: Verification Error: Execution(ApiError("Could not convert parameter `tx` between node and runtime: Error decoding field Call :: Poe.0")): RuntimeApi("Execution(ApiError("Could not convert parameter `tx` between node and runtime: Error
de
at RpcCoder._checkError (/c/substrate-mvce/js-cli/node_modules/@polkadot/rpc-provider/coder/index.js:83:13)
at RpcCoder.decodeResponse (/c/substrate-mvce/js-cli/node_modules/@polkadot/rpc-provider/coder/index.js:46:10)
at WsProvider.value (/c/substrate-mvce/js-cli/node_modules/@polkadot/rpc-provider/ws/Provider.js:160:90)
at W3CWebSocket.value [as onmessage] (/c/substrate-mvce/js-cli/node_modules/@polkadot/rpc-provider/ws/Provider.js:140:153)
at W3CWebSocket._dispatchEvent [as dispatchEvent] (/c/substrate-mvce/js-cli/node_modules/yaeti/lib/EventTarget.js:107:17)
at W3CWebSocket.onMessage (/c/substrate-mvce/js-cli/node_modules/websocket/lib/W3CWebSocket.js:234:14)
at WebSocketConnection.<anonymous> (/c/substrate-mvce/js-cli/node_modules/websocket/lib/W3CWebSocket.js:205:19)
at WebSocketConnection.emit (events.js:315:20)
at WebSocketConnection.processFrame (/c/substrate-mvce/js-cli/node_modules/websocket/lib/WebSocketConnection.js:554:26)
at /c/substrate-mvce/js-cli/node_modules/websocket/lib/WebSocketConnection.js:323:40
基本上,我尝试使用我在运行时托盘中定义的类型。这些类型是使用@polkadot/typegen
包从元数据自动生成的。此处提供了复制此文件的完整代码https://github.com/woss/substrate-mvce
推荐答案
是的,缺少hashBits
,但这不是解决方案。添加hashBits
并修改定义以使其具有与运行时完全相同的结构(键的位置相同)之后,它就可以正常工作了。这意味着遵循
pub struct Rule {
version: u32,
description: Vec<u8>,
creator: Vec<u8>,
for_what: ForWhat,
parent: Vec<u8>,
ops: Vec<Operation>,
build_params: Operation,
}
必须是JS应用程序中的
{
Rule: {
version: 'u32',
description: 'Vec<u8>',
creator: 'Vec<u8>',
forWhat: 'ForWhat',
parent: 'Vec<u8>',
ops: 'Vec<Operation>',
buildParams: 'Operation',
}
}
如果我们要更改定义中键的顺序,它将失败。
这篇关于无法在节点和运行时之间转换参数`tx`:解码字段调用时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!