我已经能够运行 near dev-deploy
使用 near-shell对于 Rust 合约,然后使用 near call my-account new '{"param1": "foo"}'
调用函数“new”
但是,当我将相同的契约(Contract)部署到使用 NEAR Wallet 创建的首选帐户时,这不起作用。 .
错误是:
Smart contract panicked: panicked at 'Cannot deserialize the contract state.: Custom { kind: InvalidInput, error: "Unexpected length of input" }',
最佳答案
事实证明,在同一帐户/地址更新合约时,区块链世界中存在一个常见问题。
这里的解决方案是删除并重新创建帐户。
我用过 near-shell
删除它,然后钱包重新创建它。
在命令行上:
near delete my-account another-account-getting-the-tokens
然后通过访问再次创建帐户:
https://wallet.nearprotocol.com/create/
这清除了状态,我能够重新部署契约(Contract)并运行
init
功能"new"
关于rust - 调用 Rust init 函数时获取 "Cannot deserialize the contract state",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60767120/