My transaction fails, so it doesn't give me a hash that I would be able to use to debug it when I call ethers.wallet.sendTransaction(tx). The tx object has 4 fields: from, to, data, value. If I do
const txSigned = await wallet.signTransaction({
...tx,
gasPrice,
gasLimit: BigNumber.from("2000000"),
});
console.log("Tx hash wrong:", ethers.utils.keccak256(txSigned));
Then this value that emerges does not in fact match the correct transaction hash. Does anyone know how I can use ethers to get such a transaction hash, to debug the failed transaction? I could manually go to the local chain itself and view the failed tx hash, but that can't be manipulated inside my code itself.