Transaction type isn't 2 (EIP-1559) by default
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
I commented in https://github.com/ethers-io/ethers.js/issues/3587 a while ago but didn't get a reponse.
Same issue, i've migrated to ethers.js@v6, and the default transaction type is legacy instead of EIP-1559.
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?
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.