"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.makeCustomTransport = void 0;
const viem_1 = require("viem");
const utils_1 = require("../../src/utils");
const makeCustomTransport = (feeParams = {}) => {
    const { stdLastBaseFeePerGas = (0, utils_1.parseUnits)("12", 9), stdMaxPriorityFeePerGas = (0, utils_1.parseUnits)("1", 9) } = feeParams;
    const stdMaxFeePerGas = stdLastBaseFeePerGas.add(stdMaxPriorityFeePerGas);
    const stdGasPrice = stdMaxFeePerGas;
    return (0, viem_1.custom)({
        async request({ method, params }) {
            switch (method) {
                case "eth_gasPrice":
                    return BigInt(stdGasPrice.toString());
                case "eth_getBlockByNumber":
                    return { baseFeePerGas: BigInt(stdLastBaseFeePerGas.toString()) };
                case "eth_maxPriorityFeePerGas":
                    return BigInt(stdMaxPriorityFeePerGas.toString());
                case "linea_estimateGas":
                    return {
                        baseFeePerGas: BigInt(7),
                        priorityFeePerGas: BigInt(stdMaxPriorityFeePerGas
                            .mul(params[0]?.data?.slice(2).length > 0 ? 2 : 1)
                            .toString()),
                        gasLimit: BigInt("0"),
                    };
                default:
                    throw new Error(`Unsupported method: ${method}.`);
            }
        },
    });
};
exports.makeCustomTransport = makeCustomTransport;
//# sourceMappingURL=transport.js.map