【问题标题】:"Error: Returned error: The method eth_sendTransaction does not exist" on non-payable functions only“错误:返回错误:方法 eth_sendTransaction 不存在”仅适用于非付费函数
【发布时间】:2021-10-01 12:56:03
【问题描述】:

我可以调用可改变合约状态的应付函数。我不能调用改变状态的非付费函数。

问题不在于函数,我可以在 Remix IDE 上调用它。

await contract.methods.test().send({from:account}).catch(err=>console.log(err))

我做错了什么?

【问题讨论】:

标签: ethereum solidity web3 web3js


【解决方案1】:

您需要将 0 传递给value 参数。

contract.methods.test().send({from:account, value: 0})

【讨论】:

    猜你喜欢
    • 2021-09-15
    • 2022-07-08
    • 2019-08-04
    • 2021-03-30
    • 2020-09-30
    • 2022-01-23
    • 1970-01-01
    • 1970-01-01
    • 2014-02-28
    相关资源
    最近更新 更多