Skip to content

alchemyFeeEstimator

Function that estimates the transaction fees using Alchemy methods for a given client. It fetches the latest block and estimates the max priority fee per gas, applying any overrides or fee options provided.

Import

import { alchemyFeeEstimator } from "@account-kit/infra";

Usage

import { alchemyFeeEstimator, createAlchemyPublicRpcClient } from "@account-kit/infra";
import { createSmartAccountClient } from "@aa-sdk/core";
 
const bundlerClient = createAlchemyPublicRpcClient(...);
const client = createSmartAccountClient({
feeEstimator: alchemyFeeEstimator(bundlerClient),
...otherParams
});

Parameters

client

ClientWithAlchemyMethods The client with Alchemy methods

Returns

ClientMiddlewareFn A middleware function that takes a transaction structure and fee options, and returns the augmented structure with estimated fees