ethers.js icon indicating copy to clipboard operation
ethers.js copied to clipboard

Transaction type isn't 2 (EIP-1559) by default

Open tab00 opened this issue 2 years ago • 4 comments

Ethers Version

6.7.1

Search Terms

No response

Describe the Problem

If I don't explicitly specify fee data in a transaction then the transaction that happens is of type 0 (legacy).

Default should be type 2 (EIP-1559).

I experienced this on Avalanche Fuji testnet.

Code Snippet

await wallet.sendTransaction({ to: wallet2.address, value: ethers.parseUnits("0.00001", "ether") })

feeData = await ethers.provider.getFeeData()
delete feeData.gasPrice
await wallet.sendTransaction({ to: wallet2.address, value: ethers.parseUnits("0.00002", "ether"), ...feeData })

Contract ABI

No response

Errors

No response

Environment

No response

Environment (Other)

No response

tab00 avatar Aug 30 '23 17:08 tab00

I commented in https://github.com/ethers-io/ethers.js/issues/3587 a while ago but didn't get a reponse.

tab00 avatar Aug 30 '23 17:08 tab00

Same issue, i've migrated to ethers.js@v6, and the default transaction type is legacy instead of EIP-1559.

logan272 avatar Jan 30 '24 05:01 logan272

It will use the network to derive the type. If there is abaseFee in the block, it will use EIP-1559. Which network and which provider are you on?

ricmoo avatar Jan 30 '24 05:01 ricmoo

Sorry for the confusion. The default transaction type set by etherjs@v6 is actually EIP-1559. However, in my case, the wallet connected to my dApp does not support the EIP-1559 transaction type. As a result, the wallet omits the type in the transaction overrides.

Unfortunately, all transactions made with a wallet that does not support EIP-1559 have failed. Upon investigating the transaction data, I discovered that the issue lies in the incorrect estimation of the Gas Limit.

logan272 avatar Jan 30 '24 11:01 logan272