Skip to content
Alchemy Logo

alchemyUserOperationSimulator

function alchemyUserOperationSimulator<TContext>(
  transport,
): ClientMiddlewareFn<TContext>;

Defined in: account-kit/infra/src/middleware/userOperationSimulator.ts:32

A middleware function to be used during simulation of user operations which leverages Alchemy's RPC uo simulation method.

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

Type ParameterDefault type

TContext extends undefined | UserOperationContext

undefined | UserOperationContext

ParameterTypeDescription

transport

AlchemyTransport

An Alchemy Transport that can be used for making RPC calls to alchemy

ClientMiddlewareFn<TContext>

A middleware function to simulate and process user operations

Was this page helpful?