Open
Description
Ethers Version
6.13.5
Search Terms
populateTransaction
Describe the Problem
Hello,
I noticed that Ethers requests the gas price in the populateTransaction method even when it is already provided in the arguments.
Could you please review the code snippet I attached? I think need to add a check similar to the EIP-1559 transaction scenario: if feeData is provided through function arguments, the request for it should be skipped.
Code Snippet
if ((pop.type === 2 || pop.type == null) && (pop.maxFeePerGas != null && pop.maxPriorityFeePerGas != null)) {
// Fully-formed EIP-1559 transaction (skip getFeeData)
pop.type = 2;
} else if (pop.type === 0 || pop.type === 1) {
// Explicit Legacy or EIP-2930 transaction
// We need to get fee data to determine things
const feeData = await provider.getFeeData();
assert(feeData.gasPrice != null, "network does not support gasPrice", "UNSUPPORTED_OPERATION", {
operation: "getGasPrice" });
// Populate missing gasPrice
if (pop.gasPrice == null) { pop.gasPrice = feeData.gasPrice; }
}
Contract ABI
Errors
Environment
No response
Environment (Other)
No response