alchemyFeeEstimator

1const alchemyFeeEstimator: (transport) => ClientMiddlewareFn;

Defined in: account-kit/infra/dist/types/middleware/feeEstimator.d.ts:26

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.

Example

1import { alchemyFeeEstimator, alchemy } from "@account-kit/infra";
2import { createSmartAccountClient } from "@aa-sdk/core";
3
4const alchemyTransport = alchemy({
5 chain: sepolia,
6 apiKey: "your-api-key",
7});
8
9const client = createSmartAccountClient({
10 feeEstimator: alchemyFeeEstimator(alchemyTransport),
11 ...otherParams,
12});

Parameters

ParameterTypeDescription

transport

AlchemyTransport

An alchemy transport for making Alchemy specific RPC calls

Returns

ClientMiddlewareFn

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