> **Can't find what you're looking for?** Use `search_docs` on the docs MCP server at `https://v3.viem.sh/api/mcp` to find what you need.

# Wait for Call Status \[wallet.waitForCallsStatus]

Waits for the status and receipts of a call batch that was sent via [`Actions.wallet.sendCalls`](/docs/actions/wallet/sendCalls) ([EIP-5792](https://eips.ethereum.org/EIPS/eip-5792)).

## Usage

This example waits for a call batch's status and receipts.

:::code-group
```ts twoslash [example.ts]
import { client } from './viem.config'

const { receipts, status } = await client.wallet.waitForCallsStatus({
  id: '0xdeadbeef',
})
```

```ts twoslash [viem.config.ts] filename="viem.config.ts"
import { Client, custom, walletActions } from 'viem'
import 'viem/window'

export const client = Client.create({
  transport: custom(window.ethereum!),
}).extend(walletActions())
```
:::

### Standalone Action

Call `Actions.wallet.waitForCallsStatus` directly by passing the Client as the first argument.

:::code-group
```ts twoslash [example.ts]
import { Actions } from 'viem'
import { client } from './viem.config'

const { receipts, status } = await Actions.wallet.waitForCallsStatus(client, {
  id: '0xdeadbeef',
})
```

```ts twoslash [viem.config.ts] filename="viem.config.ts"
import { Client, custom } from 'viem'
import 'viem/window'

export const client = Client.create({
  transport: custom(window.ethereum!),
})
```
:::

## Recipes

### Require a Successful Batch

Use a success predicate with `throwOnFailure` when a failed batch must reject instead of returning
a failure result.

:::code-group
```ts twoslash [example.ts]
import { client } from './viem.config'

export function waitForSuccess(id: string) {
  return client.wallet.waitForCallsStatus({
    id,
    status: ({ status }) => status === 'success', // [!code focus]
    throwOnFailure: true, // [!code focus]
  })
}
```

```ts twoslash [viem.config.ts] filename="viem.config.ts"
import { Client, custom, walletActions } from 'viem'
import { mainnet } from 'viem/chains'
import 'viem/window'

export const client = Client.create({
  chain: mainnet,
  transport: custom(window.ethereum!),
}).extend(walletActions())
```
:::

### Bound Polling and Retries

Set a polling interval and timeout to bound the overall wait. Configure retry behavior separately
for failed status requests.

:::code-group
```ts twoslash [example.ts]
import { client } from './viem.config'

export function waitWithDeadline(id: string) {
  return client.wallet.waitForCallsStatus({
    id,
    pollingInterval: 1_000, // [!code focus]
    retryCount: 2, // [!code focus]
    retryDelay: ({ count }) => (count + 1) * 250, // [!code focus]
    timeout: 30_000, // [!code focus]
  })
}
```

```ts twoslash [viem.config.ts] filename="viem.config.ts"
import { Client, custom, walletActions } from 'viem'
import { mainnet } from 'viem/chains'
import 'viem/window'

export const client = Client.create({
  chain: mainnet,
  transport: custom(window.ethereum!),
}).extend(walletActions())
```
:::

## Return Value

`{ atomic: boolean; capabilities?: Capabilities.Extract<'getCallsStatus', 'ReturnType'>; chainId: number | undefined; id: string; receipts: readonly Receipt[]; status: 'pending' | 'success' | 'failure' | undefined; statusCode: number; version: string }`

The status and receipts of the call bundle. See [`Actions.wallet.getCallsStatus`](/docs/actions/wallet/getCallsStatus#return-value).

## Parameters

### id

* **Type:** `string`

The identifier of the call batch to wait for.

```ts twoslash
import { Actions } from 'viem'
// [!include ~/snippets/docs/reference-client.ts:setup]
// ---cut---
const { receipts, status } = await Actions.wallet.waitForCallsStatus(client, {
  id: '0xdeadbeef', // [!code focus]
})
```

### pollingInterval

* **Type:** `number`
* **Default:** `client.pollingInterval`

Polling frequency (in ms).

```ts twoslash
import { Actions } from 'viem'
// [!include ~/snippets/docs/reference-client.ts:setup]
// ---cut---
const { receipts, status } = await Actions.wallet.waitForCallsStatus(client, {
  id: '0xdeadbeef',
  pollingInterval: 1_000, // [!code focus]
})
```

### retryCount

* **Type:** `number`
* **Default:** `4`

Number of times to retry if the call bundle failed.

```ts twoslash
import { Actions } from 'viem'
// [!include ~/snippets/docs/reference-client.ts:setup]
// ---cut---
const { receipts, status } = await Actions.wallet.waitForCallsStatus(client, {
  id: '0xdeadbeef',
  retryCount: 4, // [!code focus]
})
```

### retryDelay

* **Type:** `number | (({ count }) => number)`
* **Default:** exponential backoff

Time to wait (in ms) between retries.

```ts twoslash
import { Actions } from 'viem'
// [!include ~/snippets/docs/reference-client.ts:setup]
// ---cut---
const { receipts, status } = await Actions.wallet.waitForCallsStatus(client, {
  id: '0xdeadbeef',
  retryDelay: ({ count }) => count * 200, // [!code focus]
})
```

### status

* **Type:** `(result: Actions.wallet.getCallsStatus.ReturnType) => boolean`
* **Default:** `({ statusCode }) => statusCode === 200 || statusCode >= 300`

The predicate that determines when to stop waiting.

```ts twoslash
import { Actions } from 'viem'
// [!include ~/snippets/docs/reference-client.ts:setup]
// ---cut---
const { receipts, status } = await Actions.wallet.waitForCallsStatus(client, {
  id: '0xdeadbeef',
  status: ({ status }) => status === 'success', // [!code focus]
})
```

### throwOnFailure

* **Type:** `boolean`
* **Default:** `false`

Whether to throw an error if the call bundle fails.

```ts twoslash
import { Actions } from 'viem'
// [!include ~/snippets/docs/reference-client.ts:setup]
// ---cut---
const { receipts, status } = await Actions.wallet.waitForCallsStatus(client, {
  id: '0xdeadbeef',
  throwOnFailure: true, // [!code focus]
})
```

### timeout

* **Type:** `number`
* **Default:** `60_000`

Timeout (in ms) to wait before stopping polling.

```ts twoslash
import { Actions } from 'viem'
// [!include ~/snippets/docs/reference-client.ts:setup]
// ---cut---
const { receipts, status } = await Actions.wallet.waitForCallsStatus(client, {
  id: '0xdeadbeef',
  timeout: 30_000, // [!code focus]
})
```

## Errors

| Error | Description |
| --- | --- |
| `Actions.wallet.Errors.BundleFailedError` | The call bundle failed and `throwOnFailure` was enabled. |
| `Actions.wallet.Errors.WaitForCallsStatusTimeoutError` | The action timed out while waiting for the call bundle. |
