mecha kucha
mecha kucha

Reputation: 131

sendSignedTransaction does not give return values

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??

Upvotes: 2

Views: 1260

Answers (1)

Mikko Ohtamaa
Mikko Ohtamaa

Reputation: 83338

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

Upvotes: 1

Related Questions