"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.eip1559 = eip1559;
const linea_1 = require("viem/linea");
const constants_1 = require("../../constants");
const utils_1 = require("../../utils");
async function eip1559(provider, opts) {
    const { unsignedTx: _unsignedTx, priorityFeeMultiplier } = opts;
    const unsignedTx = _unsignedTx;
    const { baseFeePerGas, priorityFeePerGas: _priorityFeePerGas } = await (0, linea_1.estimateGas)(provider, {
        account: unsignedTx?.from ?? constants_1.DEFAULT_SIMULATED_RELAYER_ADDRESS,
        to: unsignedTx?.to ?? constants_1.DEFAULT_SIMULATED_RELAYER_ADDRESS,
        value: BigInt(unsignedTx?.value?.toString() ?? "0"),
        data: unsignedTx?.data ?? "0x",
    });
    const priorityFeePerGas = (_priorityFeePerGas * BigInt(priorityFeeMultiplier.toString())) / BigInt(utils_1.fixedPointAdjustment.toString());
    return {
        maxFeePerGas: baseFeePerGas + priorityFeePerGas,
        maxPriorityFeePerGas: priorityFeePerGas,
    };
}
//# sourceMappingURL=linea-viem.js.map