hardhat
hardhat copied to clipboard
Hardhat Support for eth_signTransaction
Hardhat node does not currently have support for eth_signTransaction, which is defined in the Ethereum JSON-RPC specifications. It would be good to have this particular feature for dApp development purposes as it would allow for simpler unit-testing through unlocked accounts, while still handling raw transaction submission the same way.
This issue is also being tracked on Linear.
We use Linear to manage our development process, but we keep the conversations on Github.
LINEAR-ID: 9a131121-a6a9-4b7f-a2d6-dee349232fdc
Should the required functionality not be similar to the current implementation of eth_sendTransactionAction
in packages/hardhat-core/src/internal/hardhat-network/provider/modules/eth.ts
?
Just replacing the this._sendTransactionAndReturnHash(tx)
source code line of sendTransaction at the end of the function by tx
as shown in the screenshot below.
I believe you are right that this functionality does what is requested. Would it be possible to expose this as a public functionality?
Any chance of this getting picked up?
I'm not (in principle) against implementing this; we've just had other priorities. Also, no one else seems to be asking for this to be implemented (it's not a very commonly used method AFAIK; you normally send the transaction and your library, wallet or node handles it).
Maybe having specific use cases that are not possible right now would help us prioritize this.
Ah I was just bitten by this trying to use signTransaction
from a client provided by hardhat-viem
and was getting unknown account
. A bit surprising when sendTransaction
and signMessage
were working fine.
My use case was signing an approval + swap manually, with precise control of the nonce. But I guess I can just use sendTransaction
for now.