receivePolicy.watchUpdated
Watches for receive policy update events (ReceivePolicyUpdated) on the TIP-403 Registry.
Usage
import { client } from './viem.config'
const unwatch = client.receivePolicy.watchUpdated({
onUpdated: (args, log) => {
console.log('Receive policy updated:', args)
},
})
// Later, stop watching
unwatch()import { Account, createClient } from 'viem/tempo'
export const client = createClient({
account: Account.fromSecp256k1('0x...'),
})Return Type
type ReturnType = () => voidReturns a function to unsubscribe from the event.
Parameters
onUpdated
- Type:
function
declare function onUpdated(args: Args, log: Log): void
type Args = {
/** Account the policy was set for. */
account: Address
/** TIP-403 policy restricting which senders are allowed. */
senderPolicyId: 'reject-all' | 'allow-all' | bigint
/** TIP-403 policy restricting which tokens are allowed. */
tokenPolicyId: 'reject-all' | 'allow-all' | bigint
/** Who can reclaim funds blocked by this policy. */
claimer: 'sender' | 'self' | Address
}Callback to invoke when a receive policy is updated.
fromBlock (optional)
- Type:
bigint
Block to start listening from.
onError (optional)
- Type:
function
declare function onError(error: Error): voidThe callback to call when an error occurred when trying to get for a new block.
poll (optional)
- Type:
true
Whether to use polling.
pollingInterval (optional)
- Type:
number
Polling frequency (in ms). Defaults to Client's pollingInterval config.