> ## Documentation Index
> Fetch the complete documentation index at: https://docs.startale.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Batched calls

> Bundle multiple calls into a single atomic transaction with wallet_sendCalls.

`wallet_sendCalls` (EIP-5792) sends multiple calls in a single user operation. All calls succeed together or revert together. The user approves once.

## When to use it

* ERC-20 approve + spend in one click.
* Batch state changes that should atomically commit.
* Multi-token settlement.

## Send a batch

```ts theme={null}
const { id } = await provider.request({
  method: 'wallet_sendCalls',
  params: [
    {
      version: '1',
      from: address,
      chainId: '0x74c', // 1868 Soneium Mainnet
      atomicRequired: true,
      calls: [
        {
          to: USDSC_ADDRESS,
          data: encodeFunctionData({
            abi: erc20Abi,
            functionName: 'approve',
            args: [SPENDER, amount],
          }),
        },
        {
          to: SPENDER,
          data: encodeFunctionData({
            abi: spenderAbi,
            functionName: 'pull',
            args: [amount],
          }),
        },
      ],
    },
  ],
})
```

The `from` field is rewritten to the user's smart account. The popup shows a single approval covering both calls.

## With wagmi

Wagmi exposes `useSendCalls` for the same flow:

```tsx theme={null}
import { useSendCalls } from 'wagmi/experimental'

const { sendCalls } = useSendCalls()
sendCalls({
  calls: [
    { to: USDSC_ADDRESS, data: approveData },
    { to: SPENDER, data: pullData },
  ],
})
```

## Track status

```ts theme={null}
const status = await provider.request({
  method: 'wallet_getCallsStatus',
  params: [id],
})
```

The SDK forwards `wallet_getCallsStatus` unchanged to the bundler RPC. The status format depends on which EIP-5792 version the bundler implements: older endpoints return string values (`'PENDING'`, `'CONFIRMED'`, `'FAILED'`, `'REVERTED'`); EIP-5792 v2 endpoints return numeric codes (`100` pending, `200` confirmed, `400` reverted, `500` failed). Check `status.receipts` on a confirmed response for the onchain receipts for each call.

## Show status to the user

```ts theme={null}
await provider.request({
  method: 'wallet_showCallsStatus',
  params: [id],
})
```

Opens the popup at the call status screen for the given batch ID.

## Atomic vs non-atomic

Set `atomicRequired: true` to require all calls land in a single transaction. With `atomicRequired: false`, the wallet may execute calls
sequentially in separate transactions, useful when the user has a non-AA fallback. Startale's smart accounts always execute
atomically regardless.

## Same primitive at the AA layer

`wallet_sendCalls` is the EIP-5792 wrapper. Under it, the SDK packs every entry of `calls` into a single ERC-4337 UserOperation and submits it through the bundler. If you skip the App SDK and work with [`@startale-scs/aa-sdk`](/aa-sdk/tutorials/contract-interactions#batch-multiple-calls-atomically) directly, you build the same batch by appending to the `calls` array on `sendUserOperation`. The execution semantics are identical in both layers.
