Skip to content

policy.watchAdminUpdated

Watches for policy admin update events on the TIP403 Registry.

Usage

example.ts
import { client } from './viem.config'
 
const unwatch = client.policy.watchAdminUpdated({
  onAdminUpdated: (args, log) => {
    console.log('Admin:', args.admin)
    console.log('Policy ID:', args.policyId)
    console.log('Updater:', args.updater)
  },
})
 
// Later, stop watching
unwatch()

Return Type

type ReturnType = () => void

Returns a function to unsubscribe from the event.

Parameters

onAdminUpdated

  • Type: function
declare function onAdminUpdated(args: Args, log: Log): void
 
type Args = {
  /** ID of the policy */
  policyId: bigint
  /** Address that updated the admin */
  updater: Address
  /** Address of the admin */
  admin: Address
}

Callback to invoke when a policy admin is updated.

args (optional)

  • Type: object
type Args = {
  /** Filter by policy ID */
  policyId?: bigint | bigint[] | null
  /** Filter by updater address */
  updater?: Address | Address[] | null
  /** Filter by admin address */
  admin?: Address | Address[] | null
}

Optional filter arguments for the event.

fromBlock (optional)

  • Type: bigint

Block to start listening from.

onError (optional)

  • Type: function
declare function onError(error: Error): void

The 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.