Skip to content
LogoLogo

waitForCallsStatus

Waits for a call batch to be confirmed & included on a Block before returning the status & receipts.

Usage

import {  } from 'viem'
import { ,  } from './config'
 
const {  } = await .sendCalls({
  ,
  : [{
    : '0x70997970c51812dc3a010c7d01b50e0d17dc79c8',
    : ('1')
  }],
})
 
const  = await .waitForCallsStatus({ 
  , 
}) 
}

Returns

WaitForCallsStatusReturnType

Status and receipts of the calls.

Parameters

id

  • Type: string

Identifier of the call batch.

const result = await walletClient.waitForCallsStatus({
  id: '0xdeadbeef', 
})

pollingInterval

  • Type: number
  • Default: client.pollingInterval

Polling interval in milliseconds.

const result = await walletClient.waitForCallsStatus({
  id: '0xdeadbeef',
  pollingInterval: 1_000, 
})

retryCount

  • Type: number
  • Default: 4

Number of times to retry if the call bundle fails.

const result = await walletClient.waitForCallsStatus({
  id: '0xdeadbeef',
  retryCount: 10, 
})

retryDelay

  • Type: number
  • Default: ({ count }) => ~~(1 << count) * 200

Time to wait (in ms) between retries.

const result = await walletClient.waitForCallsStatus({
  id: '0xdeadbeef',
  retryDelay: 1_000, 
})

status

  • Type: (parameters: { statusCode: number, status: string | undefined }) => boolean
  • Default: (parameters) => parameters.statusCode >= 200

Status to wait for. Defaults to non-pending status codes (>=200).

const result = await walletClient.waitForCallsStatus({
  id: '0xdeadbeef',
  status: ({ status }) => status === 'success', 
})

throwOnFailure

  • Type: boolean
  • Default: false

Whether to throw an error if the call bundle fails.

const result = await walletClient.waitForCallsStatus({
  id: '0xdeadbeef',
  throwOnFailure: true, 
})

timeout

  • Type: number
  • Default: 60_000

Timeout in milliseconds before waitForCallsStatus stops polling.

const result = await walletClient.waitForCallsStatus({
  id: '0xdeadbeef',
  timeout: 10_000, 
})