buildUserOperation

1function buildUserOperation<
2 TTransport,
3 TChain,
4 TAccount,
5 TContext,
6 TEntryPointVersion,
7>(client_, args): Promise<UserOperationStruct<TEntryPointVersion>>;

Defined in: aa-sdk/core/src/actions/smartAccount/buildUserOperation.ts:42

Builds a user operation using the provided client and operation parameters. Ensures that the account exists and the client is compatible.

Example

1import { createSmartAccountClient } from "@aa-sdk/core";
2
3// smart account client is already extended with buildUserOperation
4const client = createSmartAccountClient(...);
5const result = await client.buildUserOperation({
6 uo: {
7 target: "0x...",
8 data: "0x...", // or "0x",
9 value: 0n, // optional
10 },
11 account, // only required if the client above is not connected to an account
12});

Type Parameters

Type ParameterDefault type

TTransport extends Transport

Transport

TChain extends undefined | Chain

undefined | Chain

TAccount extends | undefined | SmartContractAccount

| undefined | SmartContractAccount

TContext extends any

any

TEntryPointVersion extends keyof EntryPointRegistryBase<unknown>

GetEntryPointFromAccount<TAccount>

Parameters

ParameterTypeDescription

client_

Client<TTransport, TChain, TAccount>

the client instance used to build the user operation

args

BuildUserOperationParameters<TAccount, TContext, TEntryPointVersion>

the parameters required to build the user operation, including account, overrides, and context

Returns

Promise<UserOperationStruct<TEntryPointVersion>>

a promise that resolves to a UserOperationStruct object containing the built user operation details