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
import { sendUserOperation } from "@aa-sdk/core";
Usage
import { createSmartAccountClient, toSmartContractAccount } from "@aa-sdk/core";
const account = await toSmartContractAccount(...);
const result = await createSmartAccountClient(...).sendUserOperation({
uo: {
target: "0x...",
data: "0x...", // or "0x",
value: 0n, // optional
}
});
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