The usual workflow to submit an EVM transaction seems to be:
- Call the
send(Raw)Transaction
RPC method. - Use the returned transaction hash to query the status of your transaction.
My question is, is it possible to precompute the transaction hash before submitting the transaction to the node? I believe this would simplify the transaction tracking as it would allow me to start listening for the transaction right from the start. If instead I have to wait for the hash first, then once I receive the hash I first need to check the history whether the transaction has been mined already, and only then can I start looking for the transaction in new blocks.
transactionHash(tx)
which takes a transaction object and computes its hash, but neither web3.js nor ethers.js seem to have such a function.