Skip to content

alchemyUserOperationSimulator

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

Import

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

Usage

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,
});

Parameters

transport

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

Returns

ClientMiddlewareFn A middleware function to simulate and process user operations