useSendCalls

Hook for sending calls to a smart account or EOA wallet.

This hook provides functionality to execute calls on a smart account using Account Abstraction, or fall back to regular EOA transactions when connected to an EOA wallet. It handles the complete flow of preparing, signing, and sending calls.

If using this hook with an ERC-20 paymaster in pre-operation mode with autoPermit, the contents of the permit will be hidden from the user. It is recommended to use the usePrepareCalls hook instead to manually handle the permit signature.

Import

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

Usage

1const { sendCalls, sendCallsAsync, isSendingCalls, error } = useSendCalls();
2
3// Send a single call
4await sendCallsAsync({
5 calls: [
6 {
7 to: "0x...",
8 data: "0x...",
9 value: "0x0",
10 },
11 ],
12});
13
14// Send multiple calls (smart account only)
15await sendCallsAsync({
16 calls: [
17 { to: "0x...", data: "0x..." },
18 { to: "0x...", data: "0x..." },
19 ],
20});

Parameters

params

UseSendCallsParams

  • Configuration parameters for the hook

params.client

GetSmartWalletClientResult<Address>

  • Optional smart wallet client instance (Required if an EOA is not connected)

Returns

UseSendCallsResult<TEntryPointVersion> An object containing:

  • sendCalls: Function to send calls synchronously (returns void)
  • sendCallsAsync: Async function to send calls (returns Promise)
  • sendCallsResult: The result of the last successful call execution
  • isSendingCalls: Boolean indicating if calls are currently being sent
  • error: Error from the last failed call execution, if any