sendUserOperation

Sends a user operation or batch of user operations using the connected account. Before executing, sendUserOperation will run the user operation through the middleware pipeline.

Import

1import { sendUserOperation } from "@aa-sdk/core";

Usage

1import { createSmartAccountClient, toSmartContractAccount } from "@aa-sdk/core";
2
3const account = await toSmartContractAccount(...);
4const result = await createSmartAccountClient(...).sendUserOperation({
5uo: {
6target: "0x...",
7data: "0x...", // or "0x",
8value: 0n, // optional
9}
10});

Parameters

client_

Client<TTransport, TChain, TAccount> the smart account client to use for RPC requests

args

SendUserOperationParameters<TAccount, TContext> contains the UO or batch to send, context, overrides, and account if not hoisted on the client

Returns

Promise<SendUserOperationResult<TEntryPointVersion>> a Promise containing the result of the user operation