sendSignedTransaction does not give return values

Viewed 818

i'm making a dapp and it has sign-up, sign-in functions.(i'm using ropsten infura) sign-up function is state-change function, so i have to use

web3.method.signup().send()

but as we can't use send(), i have to use sendSignedTransaction() instead. (=> await web3.eth.sendSignedTransaction(0x${serialTx.toString('hex')}) )

i want to get return values after signup function, but sendSignedTransaction doesn't give me return return values.

how i have to do??

1 Answers

Ethereum "write" transaction do not have return values. What you instead need to do is to emit events in your Solidity code. The front end listens to these events and then can react to them.

You can get events via contract functions or directly from the web3.eth.getTransactionReceipt().

https://web3js.readthedocs.io/en/v1.2.8/web3-eth-contract.html#events

Related