rust - 未处理的拒绝:ChainErr("missing field `proof`")
问题描述
我正在使用 docker 运行带有单个验证器的本地测试网。在将用 Rust 编写的智能合约部署到链上后,我从网络服务器(也是用 Rust 编写)调用合约的方法之一。通过构建一个 SignedTransaction(来自near_primitives::transaction::*
)并通过 JSON-RPC 将其广播到网络来进行调用:
const NEAR_NODE: &'static str = "http://localhost:3030";
macro_rules! json_reqwest {
($req:expr => $client:ident) => {
{
let res = $client.post(NEAR_NODE)
.json(&$req)
.send()
.await
.map_err(|e| e.to_string())?
.json::<Response>()
.await
.map_err(|e| e.to_string())?;
serde_json::from_value(res.result.map_err(|e| e.message)?)
.map_err(|e| e.to_string())?
}
};
}
async fn broadcast_tx(client: &Client, signed_tx: &mut SignedTransaction) -> Result<FinalExecutionOutcomeView, String> {
signed_tx.init();
println!("NEAR Tx hash: {}", signed_tx.get_hash());
let tx = signed_tx.try_to_vec().map_err(|e| e.to_string())?;
Ok(json_reqwest!(Message::request("broadcast_tx_commit".to_string(), Some(json!([to_base64(&tx)]))) => client))
}
这是来自网络的回应:
Unhandled rejection: ChainErr("missing field `proof`")
这个错误是什么意思,我该如何解决?
谢谢你的帮助!
解决方案
这个问题存在于旧版本的近核中,应该在 1.0.0+ 中解决。
推荐阅读
- flutter - 列表小部件的颤振高度没有减少
- javascript - 调整大小后 SVG 多边形位置错误
- java - 如何在其他类中使用公共常量?
- sql - 总结所有日期,但只保留最后一个日期
- python - 比较嵌套列表字符的ascii值的绝对差异
- docker - 如何为 minikube 集群设置“翻译文件”?
- sql - 将 Power Query 中的日期变量传递给 ODBC 源
- openstack - ovs-dpdk中dpdk0的作用是什么?
- google-apps-script - google.script.run 不运行 Code.gs 中的函数
- swift - 使用 Vapor 中的临时文件响应请求的正确方法