rust - 调用 Rust 初始化函数时出现“无法反序列化合约状态”
问题描述
我已经能够near dev-deploy
使用近壳来运行Rust 合约,然后调用一个函数“new”near call my-account new '{"param1": "foo"}'
但是,当我将相同的合同部署到使用NEAR Wallet创建的首选帐户时,这不起作用。
错误是:
Smart contract panicked: panicked at 'Cannot deserialize the contract state.: Custom { kind: InvalidInput, error: "Unexpected length of input" }',
解决方案
事实证明,在同一账户/地址更新合约时,区块链世界中存在一个常见问题。这里的解决方案是删除并重新创建帐户。我曾经near-shell
删除它,然后使用 Wallet 重新创建它。
在命令行上:
near delete my-account another-account-getting-the-tokens
然后通过访问再次创建帐户: https ://wallet.nearprotocol.com/create/
这清除了状态,我能够重新部署合同并运行init
“新”功能
推荐阅读
- sql - 将 Where 子句存储在表中以获取状态
- javascript - 是否可以删除段之间的边界,但在 react-chartjs-2 中保留饼图周围的边界?
- python - 在 Python 中对字典进行排序
- python - 将单个元素与元素字典键/值对匹配,其中值是列表本身
- css - @media 的目的是什么(最大宽度:-1)
- android - Android Rx 去抖算子
- c++ - 在 Eigen::Matrix::data() 上使用 std::move 将 Eigen::Matrix 转换为向量
- python - Keras 中的 tensorflow 会话在哪里
- git - git-ftp 致命:无法获得最后一次提交。网络断了?错误的网址?使用 'git ftp init' 进行初始推送
- android - 如何从 Flutter 中获取 JSON 数据