Skip to content
LogoLogo

token.watchAdminRole

Watches for role admin update events on TIP20 tokens.

Usage

import {  } from './viem.config'
 
const  = .token.watchAdminRole({
  : 1n, // Token ID or address
  : (, ) => {
    .('Role:', .role)
    .('New admin role:', .newAdminRole)
    .('Sender:', .sender)
  },
})
 
// Later, stop watching
()

Return Type

type ReturnType = () => void

Returns a function to unsubscribe from the event.

Parameters

onRoleAdminUpdated

  • Type: function
declare function onRoleAdminUpdated(args: Args, log: Log): void
 
type Args = {
  /** The role whose admin role is being changed */
  role: Hex
  /** The new admin role */
  newAdminRole: Hex
  /** The address that initiated the change */
  sender: Address
}

Callback to invoke when a role admin is updated.

token

  • Type: Address | bigint

Address or ID of the TIP20 token to watch.

args (optional)

  • Type: object
type Args = {
  /** Filter by role */
  role?: Hex | Hex[] | null
  /** Filter by new admin role */
  newAdminRole?: Hex | Hex[] | null
  /** Filter by sender */
  sender?: Address | Address[] | null
}

Optional filter arguments to narrow down the events to watch.

fromBlock (optional)

  • Type: bigint

Block to start listening from.

onError (optional)

  • Type: (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.