waitForCallsStatus
Waits for a call batch to be confirmed & included on a Block before returning the status & receipts.
Usage
example.ts
import { parseEther } from 'viem'
import { account, walletClient } from './config'
const { id } = await walletClient.sendCalls({
account,
calls: [{
to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8',
value: parseEther('1')
}],
})
const result = await walletClient.waitForCallsStatus({
id,
})
{ atomic: false, chainId: 1, id: '0x1234567890abcdef', statusCode: 200, status: 'success', receipts: [{ ... }], }
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,
})
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',
})
timeout
- Type:
number
- Default:
60_000
Timeout in milliseconds before waitForCallsStatus
stops polling.
const result = await walletClient.waitForCallsStatus({
id: '0xdeadbeef',
timeout: 10_000,
})