From 23de34af237e06ab2ebc5917513edd48a3af2b6f Mon Sep 17 00:00:00 2001 From: Arnaud Date: Wed, 2 Apr 2025 09:45:15 +0200 Subject: [PATCH] Allow override maxFeePerGas --- ethers/signer.nim | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/ethers/signer.nim b/ethers/signer.nim index ac9cafe..5b8f5d3 100644 --- a/ethers/signer.nim +++ b/ethers/signer.nim @@ -139,12 +139,11 @@ method populateTransaction*( # Multiply by 2 because during times of congestion, baseFeePerGas can increase by 12.5% per block. # https://github.com/ethers-io/ethers.js/discussions/3601#discussioncomment-4461273 - let maxFeePerGas = baseFeePerGas * 2 + maxPriorityFeePerGas - populated.maxFeePerGas = some(maxFeePerGas) + populated.maxFeePerGas = some(transaction.maxFeePerGas |? baseFeePerGas * 2 + maxPriorityFeePerGas) populated.gasPrice = none(UInt256) - trace "EIP-1559 is supported", maxPriorityFeePerGas = maxPriorityFeePerGas, maxFeePerGas = maxFeePerGas + trace "EIP-1559 is supported", maxPriorityFeePerGas = maxPriorityFeePerGas, maxFeePerGas = populated.maxFeePerGas else: populated.gasPrice = some(transaction.gasPrice |? (await signer.getGasPrice())) trace "EIP-1559 is not supported", gasPrice = populated.gasPrice