prepareCalls

Prepares a set of contract calls for execution by building a user operation. Returns the built user operation and a signature request that needs to be signed before submitting to sendPreparedCalls.

Import

1import { prepareCalls } from "@account-kit/wallet-client";

Usage

1// Prepare a sponsored user operation call
2const result = await client.prepareCalls({
3 calls: [
4 {
5 to: "0x1234...",
6 data: "0xabcdef...",
7 value: "0x0",
8 },
9 ],
10 capabilities: {
11 paymasterService: { policyId: "your-policy-id" },
12 },
13});

Parameters

client

InnerWalletApiClient<TAccount>

  • The wallet API client to use for the request

params

PrepareCallsParams<TAccount>

  • Parameters for preparing calls

params.calls

Array<{to: Address, data?: Hex, value?: Hex}>

  • Array of contract calls to execute

params.from

Address

  • The address to execute the calls from (required if the client wasn’t initialized with an account)

params.capabilities

object

  • Optional capabilities to include with the request

Returns

Promise<PrepareCallsResult> A Promise that resolves to the prepared calls result containing the user operation data and signature request