opstack-kit-chains
Version:
Support your OP-Stack network with 'opstack-kit'
32 lines • 1.07 kB
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.fees = void 0;
exports.fees = {
estimateFeesPerGas: async (params) => {
if (!params.request?.feeCurrency)
return null;
const [maxFeePerGas, maxPriorityFeePerGas] = await Promise.all([
estimateFeePerGasInFeeCurrency(params.client, params.request.feeCurrency),
estimateMaxPriorityFeePerGasInFeeCurrency(params.client, params.request.feeCurrency),
]);
return {
maxFeePerGas,
maxPriorityFeePerGas,
};
},
};
async function estimateFeePerGasInFeeCurrency(client, feeCurrency) {
const fee = await client.request({
method: 'eth_gasPrice',
params: [feeCurrency],
});
return BigInt(fee);
}
async function estimateMaxPriorityFeePerGasInFeeCurrency(client, feeCurrency) {
const feesPerGas = await client.request({
method: 'eth_maxPriorityFeePerGas',
params: [feeCurrency],
});
return BigInt(feesPerGas);
}
//# sourceMappingURL=fees.js.map
;