5 python3 调用合约方法报错 TypeError: transaction_dict must be dict-like, got <Function withdraw() bound to ()>

合约代码


function withdraw() public {
        require(owner == msg.sender);
        msg.sender.transfer(address(this).balance);
    }

python 代码


 transaction = contracts.functions.withdraw()
    signed_tx = w3.eth.account.signTransaction(transaction, private_key=private_key)
    tx_hash = w3.eth.sendRawTransaction(signed_tx.rawTransaction)
    print(tx_hash)
请先 登录 后评论

2 个回答

Tiny熊
  擅长:智能合约,以太坊
请先 登录 后评论
YangLLL
请先 登录 后评论
  • 2 关注
  • 0 收藏,2476 浏览
  • bbbbbb 提出于 2022-12-18 22:54