useSendCalls

1function useSendCalls<TEntryPointVersion>(
2 params,
3): UseSendCallsResult<TEntryPointVersion>;

Defined in: account-kit/react/src/hooks/useSendCalls.ts:120

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.

<Note> 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. </Note>

Example

import { 
function useSendCalls<TEntryPointVersion extends EntryPointVersion = keyof EntryPointRegistryBase<unknown>>(params: UseSendCallsParams): UseSendCallsResult<TEntryPointVersion>

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.

useSendCalls
} from "@account-kit/react";
const {
const sendCalls: UseMutateFunction<MutationResult<keyof EntryPointRegistryBase<unknown>>, Error, { calls: { data?: `0x${string}` | undefined; value?: `0x${string}` | undefined; to: `0x${string}`; }[]; capabilities?: { permissions?: { context: `0x${string}`; } | { sessionId: `0x${string}`; signature: `0x${string}`; } | undefined; paymasterService?: (({ policyId: string; } | { policyIds: string[]; }) & { onlyEstimation?: boolean | undefined; erc20?: ({ maxTokenAmount?: `0x${string}` | undefined; tokenAddress: `0x${string}`; } & ({ preOpSettings: { autoPermit: { durationSeconds?: `0x${string}` | undefined; below: `0x${string}`; amount: `0x${string}`; }; } | { ...; }; } | { ...; } | {})) | undefined; }) | undefined; gasParamsOverride?: { ...; } | undefined; eip7702Auth?: true | ... 1 more ... | undefined; nonceOverride?: { ...; } | undefined; } | undefined; paymasterPermitSignature?: { ...; } | ... 1 more ... | undefined; from?: never | undefined; }, unknown>
sendCalls
,
const sendCallsAsync: UseMutateAsyncFunction<MutationResult<keyof EntryPointRegistryBase<unknown>>, Error, { calls: { data?: `0x${string}` | undefined; value?: `0x${string}` | undefined; to: `0x${string}`; }[]; capabilities?: { permissions?: { context: `0x${string}`; } | { sessionId: `0x${string}`; signature: `0x${string}`; } | undefined; paymasterService?: (({ policyId: string; } | { policyIds: string[]; }) & { onlyEstimation?: boolean | undefined; erc20?: ({ maxTokenAmount?: `0x${string}` | undefined; tokenAddress: `0x${string}`; } & ({ preOpSettings: { autoPermit: { durationSeconds?: `0x${string}` | undefined; below: `0x${string}`; amount: `0x${string}`; }; } | { ...; }; } | { ...; } | {})) | undefined; }) | undefined; gasParamsOverride?: { ...; } | undefined; eip7702Auth?: true | ... 1 more ... | undefined; nonceOverride?: { ...; } | undefined; } | undefined; paymasterPermitSignature?: { ...; } | ... 1 more ... | undefined; from?: never | undefined; }, unknown>
sendCallsAsync
,
const isSendingCalls: boolean
isSendingCalls
,
const error: Error | null
error
} =
useSendCalls<keyof EntryPointRegistryBase<unknown>>(params: UseSendCallsParams): UseSendCallsResult<keyof EntryPointRegistryBase<unknown>>

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.

useSendCalls
();
// Send a single call await
const sendCallsAsync: (variables: { calls: { data?: `0x${string}` | undefined; value?: `0x${string}` | undefined; to: `0x${string}`; }[]; capabilities?: { permissions?: { context: `0x${string}`; } | { sessionId: `0x${string}`; signature: `0x${string}`; } | undefined; paymasterService?: (({ policyId: string; } | { policyIds: string[]; }) & { onlyEstimation?: boolean | undefined; erc20?: ({ maxTokenAmount?: `0x${string}` | undefined; tokenAddress: `0x${string}`; } & ({ preOpSettings: { autoPermit: { durationSeconds?: `0x${string}` | undefined; below: `0x${string}`; amount: `0x${string}`; }; } | { permitDetails: { value: `0x${string}`; deadline: `0x${string}`; }; }; } | { postOpSettings: { ...; }; } | {})) | undefined; }) | undefined; gasParamsOverride?: { ...; } | undefined; eip7702Auth?: true | ... 1 more ... | undefined; nonceOverride?: { ...; } | undefined; } | undefined; paymasterPermitSignature?: { ...; } | ... 1 more ... | undefined; from?: never | undefined; }, options?: MutateOptions<...> | undefined) => Promise<...>
sendCallsAsync
({
calls: { data?: `0x${string}` | undefined; value?: `0x${string}` | undefined; to: `0x${string}`; }[]
calls
: [
{
to: `0x${string}`
to
: "0x...",
data?: `0x${string}` | undefined
data
: "0x...",
value?: `0x${string}` | undefined
value
: "0x0",
}, ], }); // Send multiple calls (smart account only) await
const sendCallsAsync: (variables: { calls: { data?: `0x${string}` | undefined; value?: `0x${string}` | undefined; to: `0x${string}`; }[]; capabilities?: { permissions?: { context: `0x${string}`; } | { sessionId: `0x${string}`; signature: `0x${string}`; } | undefined; paymasterService?: (({ policyId: string; } | { policyIds: string[]; }) & { onlyEstimation?: boolean | undefined; erc20?: ({ maxTokenAmount?: `0x${string}` | undefined; tokenAddress: `0x${string}`; } & ({ preOpSettings: { autoPermit: { durationSeconds?: `0x${string}` | undefined; below: `0x${string}`; amount: `0x${string}`; }; } | { permitDetails: { value: `0x${string}`; deadline: `0x${string}`; }; }; } | { postOpSettings: { ...; }; } | {})) | undefined; }) | undefined; gasParamsOverride?: { ...; } | undefined; eip7702Auth?: true | ... 1 more ... | undefined; nonceOverride?: { ...; } | undefined; } | undefined; paymasterPermitSignature?: { ...; } | ... 1 more ... | undefined; from?: never | undefined; }, options?: MutateOptions<...> | undefined) => Promise<...>
sendCallsAsync
({
calls: { data?: `0x${string}` | undefined; value?: `0x${string}` | undefined; to: `0x${string}`; }[]
calls
: [
{
to: `0x${string}`
to
: "0x...",
data?: `0x${string}` | undefined
data
: "0x..." },
{
to: `0x${string}`
to
: "0x...",
data?: `0x${string}` | undefined
data
: "0x..." },
], });

Type Parameters

Type ParameterDefault typeDescription

TEntryPointVersion extends keyof EntryPointRegistryBase<unknown>

keyof EntryPointRegistryBase<unknown>

The entry point version to use for user operations (defaults to EntryPointVersion)

Parameters

ParameterTypeDescription

params

UseSendCallsParams

Configuration parameters for the hook

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

Description

  • When connected to an EOA wallet, only single calls are supported (batch execution is not allowed)
  • For smart accounts, the returned ids are the prepared call IDs
  • For EOA wallets, the returned ids are transaction hashes