Skip to content
Alchemy Logo

alchemyGasAndPaymasterAndDataMiddleware

function alchemyGasAndPaymasterAndDataMiddleware(
  params,
): Pick<
  ClientMiddlewareConfig,
  "dummyPaymasterAndData" | "feeEstimator" | "gasEstimator" | "paymasterAndData"
>;

Defined in: account-kit/infra/src/middleware/gasManager.ts:186

Paymaster middleware factory that uses Alchemy's Gas Manager for sponsoring transactions. Uses Alchemy's custom alchemy_requestGasAndPaymasterAndData method instead of conforming to the standard ERC-7677 interface. Note that if you use createAlchemySmartAccountClient, this middleware is already used by default and you do not need to manually include it.

import {
  sepolia,
  alchemy,
  alchemyGasAndPaymasterAndDataMiddleware,
} from "@account-kit/infra";
import { createSmartAccountClient } from "@aa-sdk/core";
 
const client = createSmartAccountClient({
  transport: alchemy({ apiKey: "your-api-key" }),
  chain: sepolia,
  ...alchemyGasAndPaymasterAndDataMiddleware({
    policyId: "policyId",
    transport: alchemy({ apiKey: "your-api-key" }),
  }),
});

ParameterTypeDescription

params

AlchemyGasAndPaymasterAndDataMiddlewareParams

configuration params

Pick<ClientMiddlewareConfig, | "dummyPaymasterAndData" | "feeEstimator" | "gasEstimator" | "paymasterAndData">

partial client middleware configuration containing dummyPaymasterAndData, feeEstimator, gasEstimator, and paymasterAndData

Was this page helpful?