Alchemy Logo

usePrepareCalls

function usePrepareCalls(params): UsePrepareCallsResult;

Defined in: account-kit/react/src/hooks/usePrepareCalls.ts:88

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 { usePrepareCalls } from "@account-kit/react";
 
const { prepareCalls, prepareCallsAsync, isPreparingCalls, error } =
  usePrepareCalls();
 
// Prepare calls
await prepareCallsAsync({
  calls: [
    {
      to: "0x...",
      data: "0x...",
      value: "0x0",
    },
  ],
});

ParameterTypeDescription

params

UsePrepareCallsParams

Configuration parameters for the hook

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

  • This hook only works with smart accounts and does not support EOA wallets
  • The hook handles the preparation step of the Account Abstraction flow
  • Prepared calls must be signed, then can be used with useSendPreparedCalls to complete the execution
Was this page helpful?