-
Notifications
You must be signed in to change notification settings - Fork 4.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
sendTransaction/sendSignedTransaction does not return tx hash on error #1216
Comments
Same problem here. I need transaction hash from sendTransaction but is seems the only way to get it is monkeypatching RequestManager.prototype.send like this
It works, but monkeypatching is ugly and uses undocumented internals. It would be nice to have more straitforward way to get transaction hash from sendTransaction call. |
You are able to get the transaction hash if you use the EventEmitter API instead of the Promise API from the PromiEvent we provide. Be aware that you can't combine the EventEmitter and the Promise. web3.eth.sendTransaction(...).on('transactionHash', console.log).on('receipt', console.log) |
Scenario: Create a transaction that calls a contract's method that throws an error.
The
sendTransaction/sendSignedTransaction
call, internally ends in a call to provider'ssend/sendAsync
. The result object in the callback contains the error message, like "VM exception.... revert" but the code builds anErrorResponse
object with only the message.Although transaction hash is returned in
result.result
, it is discarded.The text was updated successfully, but these errors were encountered: