@@ -1402,8 +1402,8 @@ export default class BlockchainServiceBase {
14021402 try {
14031403 // eth_feeHistory params: blockCount, newestBlock, rewardPercentiles
14041404 // [50] = median priority fee per block
1405- const feeHistory = await web3Instance . eth . getFeeHistory ( blockCount , 'latest' , [ 50 ] ) ;
1406-
1405+ const feeHistory = await web3Instance . eth . getFeeHistory ( blockCount , 'latest' , [ 80 ] ) ;
1406+
14071407 // Extract median priority fees from each block (reward[blockIndex][percentileIndex])
14081408 const priorityFees = feeHistory . reward
14091409 ? feeHistory . reward . map ( ( blockRewards ) => BigInt ( blockRewards [ 0 ] || 0 ) )
@@ -1426,13 +1426,14 @@ export default class BlockchainServiceBase {
14261426
14271427 /**
14281428 * Apply buffer percentage to a gas price
1429- * @param {BigInt } gasPrice - Gas price in wei
1429+ * @param {BigInt } maxBaseFee - base fee in wei
1430+ * @param {BigInt } maxPriorityFee - priority fee in wei
14301431 * @param {number } gasPriceBufferPercent - Buffer percentage to add
14311432 * @returns {BigInt } Gas price with buffer applied
14321433 */
1433- applyGasPriceBuffer ( gasPrice , gasPriceBufferPercent ) {
1434- if ( ! gasPriceBufferPercent ) return gasPrice ;
1435- return ( gasPrice * BigInt ( 100 + Number ( gasPriceBufferPercent ) ) ) / 100n ;
1434+ applyGasPriceBuffer ( maxBaseFee , maxPriorityFee , gasPriceBufferPercent ) {
1435+ if ( ! gasPriceBufferPercent ) return maxBaseFee + maxPriorityFee ;
1436+ return ( ( maxBaseFee * BigInt ( 100 + Number ( gasPriceBufferPercent ) ) ) / 100n ) + maxPriorityFee ;
14361437 }
14371438
14381439 /**
@@ -1468,7 +1469,7 @@ export default class BlockchainServiceBase {
14681469 const maxBaseFee = baseFees . reduce ( ( max , bf ) => ( bf > max ? bf : max ) , 0n ) ;
14691470 const maxPriorityFee = priorityFees . reduce ( ( max , pf ) => ( pf > max ? pf : max ) , 0n ) ;
14701471
1471- return this . applyGasPriceBuffer ( maxBaseFee + maxPriorityFee , gasPriceBufferPercent ) ;
1472+ return this . applyGasPriceBuffer ( maxBaseFee , maxPriorityFee , gasPriceBufferPercent ) ;
14721473 }
14731474
14741475 /**
0 commit comments