getTransactionConfirmations
Returns the number of blocks passed (confirmations) since the transaction was processed on a block.
Import
ts
import { getTransactionConfirmations } from 'viem/public'
Usage
ts
import { getTransactionConfirmations } from 'viem/public'
import { publicClient } from '.'
const transactionReceipt = await getTransactionReceipt(publicClient, { hash: '...' })
const confirmations = await getTransactionConfirmations(publicClient, {
transactionReceipt
})
// 15n
You can also fetch confirmations by Transaction hash:
ts
import { getTransactionConfirmations } from 'viem/public'
import { publicClient } from '.'
const confirmations = await getTransactionConfirmations(publicClient, {
hash: '0x...'
})
// 15n
Returns
bigint
The number of blocks passed since the transaction was processed. If confirmations is 0
, then the Transaction has not been confirmed & processed yet.
Parameters
transactionReceipt
- Type:
TransactionReceipt
The transaction receipt.
ts
const balance = await getTransactionConfirmations(publicClient, {
transactionReceipt: { ... },
})
hash
- Type:
0x${string}
The hash of the transaction.
ts
const balance = await getTransactionConfirmations(publicClient, {
hash: '0x...'
})