Do not recall gasPrice when it is already set

This commit is contained in:
Tornado Contrib 2024-04-14 01:15:55 +00:00
parent 29beb93ea7
commit 1cc9fcf64d
No known key found for this signature in database
GPG Key ID: 60B4DF1A076C64B1

View File

@ -127,17 +127,18 @@ export abstract class AbstractSigner<P extends null | Provider = null | Provider
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; }
if (pop.gasPrice == null) {
// 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
pop.gasPrice = feeData.gasPrice;
}
} else {
// We need to get fee data to determine things