usePrepareCalls

Hook for preparing calls to a smart account.

This hook provides functionality to prepare calls for execution on a smart account. It handles the preparation step of the Account Abstraction flow, but does not support EOA wallets.

Import

1import { usePrepareCalls } from "@account-kit/react";

Usage

1const { prepareCalls, prepareCallsAsync, isPreparingCalls, error } =
2 usePrepareCalls();
3
4// Prepare calls
5await prepareCallsAsync({
6 calls: [
7 {
8 to: "0x...",
9 data: "0x...",
10 value: "0x0",
11 },
12 ],
13});

Parameters

params

UsePrepareCallsParams

  • Configuration parameters for the hook

params.client

GetSmartWalletClientResult<Address>

  • Smart wallet client instance

Returns

UsePrepareCallsResult An object containing:

  • prepareCalls: Function to prepare calls synchronously (returns void)
  • prepareCallsAsync: Async function to prepare calls (returns Promise)
  • preparedCalls: The result of the last successful call preparation
  • isPreparingCalls: Boolean indicating if calls are currently being prepared
  • error: Error from the last failed call preparation, if any