erc7677Middleware

1function erc7677Middleware<TContext>(
2 params?,
3): Required<
4 Pick<ClientMiddlewareConfig, "dummyPaymasterAndData" | "paymasterAndData">
5>;

Defined in: aa-sdk/core/src/middleware/erc7677middleware.ts:97

Middleware function for interacting with ERC-7677 enabled clients. It supports resolving paymaster and data fields for user operations. This middleware assumes that your RPC provider supports the ERC-7677 methods (pm_getPaymasterStubData and pm_getPaymasterData).

Example

1import { createSmartAccountClient, erc7677Middleware } from "@aa-sdk/core";
2import { http } from "viem";
3import { sepolia } from "viem/chains";
4
5const client = createSmartAccountClient({
6 transport: http("rpc-url"),
7 chain: sepolia,
8 // this assumes that your RPC provider supports the ERC-7677 methods AND takes no context
9 ...erc7677Middleware(),
10});

Type Parameters

Type ParameterDefault type

TContext extends undefined | Record<string, any>

undefined | Record<string, any>

Parameters

ParameterTypeDescription

params?

Erc7677MiddlewareParams<TContext, EntryPointVersion>

Middleware parameters including context function or object. Context can be resolved dynamically by passing in a function which takes in the context at the time of sending a user op

Returns

Required<Pick<ClientMiddlewareConfig, "dummyPaymasterAndData" | "paymasterAndData">>

An object containing middleware functions dummyPaymasterAndData and paymasterAndData for processing user operations with the paymaster data