我已经能够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" }',
Run Code Online (Sandbox Code Playgroud)
事实证明,在同一帐户/地址更新合约时,区块链世界中存在一个常见问题。这里的解决方案是删除并重新创建帐户。我曾经near-shell删除它,然后钱包重新创建它。
在命令行上:
near delete my-account another-account-getting-the-tokens
Run Code Online (Sandbox Code Playgroud)
然后通过访问再次创建帐户:https : //wallet.nearprotocol.com/create/
这清除了状态,我能够重新部署合同并运行init“新”功能