"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getEffectivePriorityFee = exports.getUpfrontCost = void 0; function getUpfrontCost(tx, baseFee) { const prio = tx.maxPriorityFeePerGas; const maxBase = tx.maxFeePerGas - baseFee; const inclusionFeePerGas = prio < maxBase ? prio : maxBase; const gasPrice = inclusionFeePerGas + baseFee; return tx.gasLimit * gasPrice + tx.value; } exports.getUpfrontCost = getUpfrontCost; function getEffectivePriorityFee(tx, baseFee) { if (baseFee === undefined || baseFee > tx.maxFeePerGas) { throw new Error('Tx cannot pay baseFee'); } // The remaining fee for the coinbase, which can take up to this value, capped at `maxPriorityFeePerGas` const remainingFee = tx.maxFeePerGas - baseFee; return tx.maxPriorityFeePerGas < remainingFee ? tx.maxPriorityFeePerGas : remainingFee; } exports.getEffectivePriorityFee = getEffectivePriorityFee; //# sourceMappingURL=eip1559.js.map