我正在制作一个dapp,它具有注册,登录功能。我正在使用罗普斯滕·因弗拉( 注册功能是状态更改功能,所以我必须使用
web3.method.signup((.send((
但是由于我们不能使用 send((,我必须使用 sendSignedTransaction(( 代替。 (=> await web3.eth.sendSignedTransaction(0x${serialTx.toString('hex')}
( (
我想在注册函数后获取返回值,但 sendSignedTransaction 没有给我返回返回值。
我该怎么做??
以太坊"写入"事务没有返回值。相反,您需要做的是在 Solidity 代码中发出事件。前端侦听这些事件,然后可以对它们做出反应。
您可以通过合约函数或直接从web3.eth.getTransactionReceipt()
获取事件。
https://web3js.readthedocs.io/en/v1.2.8/web3-eth-contract.html#events