ethers.js
ethers.js copied to clipboard
`signTransaction` mutates the given transaction
Ethers Version
6.13.1
Search Terms
No response
Describe the Problem
when signTransaction is given a transaction object, it mutates the object by removing from field
Code Snippet
const test = async () => {
const wallet = new ethers.Wallet('0x0000000000000000000000000000000000000000000000000000000000000001', new JsonRpcProvider('https://holesky.drpc.org'))
const tx = { from: '0x7E5F4552091A69125d5DfCb7b8C2659029395Bdf' }
await wallet.populateTransaction(tx)
console.log(tx.from)
await wallet.signTransaction(tx)
console.log(tx.from)
}
test()
this prints:
0x7E5F4552091A69125d5DfCb7b8C2659029395Bdf
undefined
It should print:
0x7E5F4552091A69125d5DfCb7b8C2659029395Bdf
0x7E5F4552091A69125d5DfCb7b8C2659029395Bdf
Confirmed this is a bug. Looking into it now.