我正在制作一个dapp,它有登录、登录功能。(我使用ropsten infura)注册函数是状态变化函数,所以我必须使用
web3.method.signup().send()
但是,由于不能使用send(),所以必须使用sendSignedTransaction()。( web3.eth.sendSignedTransaction(0x${serialTx.toString('hex')}
)等待=>)
我希望在注册函数之后获得返回值,但是sendSignedTransaction不给我返回返回值。
我该怎么做??
发布于 2020-05-22 08:02:23
Ethereum“写”事务没有返回值。相反,您需要做的是在您的稳固代码中发出事件。前端倾听这些事件,然后对它们作出反应。
您可以通过契约函数或直接从web3.eth.getTransactionReceipt()
获取事件。
https://web3js.readthedocs.io/en/v1.2.8/web3-eth-contract.html#events
https://stackoverflow.com/questions/61921326
复制相似问题