Get Blocked Balance
receivePolicy.getBlockedBalance
Gets the blocked balance for an encoded receipt.
Usage
import { } from './viem.config'
const = await ..({
: '0x1234',
})
.('Blocked balance:', )
Blocked balance: 1000000nimport { , } from 'viem/tempo'
export const = .({
: .('0x...'),
})Recipes
Skip Receipts That Were Already Resolved
A receipt's balance drops to zero once claimed or burned, so check it before receivePolicy.claimSync when replaying stored receipts.
import { } from './viem.config'
// Claim receipts indexed from `TransferBlocked` events.
const = ['0x1234', '0x5678'] as
for (const of ) {
const = await ..({ })
if ( === 0n) continue
await ..({
,
: ..,
})
}import { , } from 'viem/tempo'
export const = .({
: .('0x...'),
})Inspect a Blocked Payment for Support
Pair the held balance with ReceivePolicyReceipt.decode to show support staff who sent a blocked payment, in which token, and when.
import { } from 'viem/tempo'
import { } from './viem.config'
const = '0x1234'
const = await ..({ })
const { , , } = .()
.(`${} base units of ${} from ${}, held since ${}`)import { , } from 'viem/tempo'
export const = .({
: .('0x...'),
})Return Value
type ReturnType = bigintThe blocked balance for the encoded receipt.
Parameters
receipt
- Type:
Hex
The encoded claim receipt.
blockNumber (optional)
- Type:
bigint
Block number to read the state from.
blockOverrides (optional)
- Type:
BlockOverrides
Block overrides to apply to the state.
blockTag (optional)
- Type:
BlockTag
Block tag to read the state from.
stateOverride (optional)
- Type:
StateOverride
State override to apply.