Skip to content
LogoLogo

accessKey.watchAdminAuthorized

Watches for admin key authorization events (AdminKeyAuthorized), emitted when an admin key is authorized (see accessKey.authorize with admin: true).

TIP-1049

Usage

import { client } from './viem.config'
 
const unwatch = client.accessKey.watchAdminAuthorized({
  onAuthorized: (args, log) => {
    console.log('Admin key authorized:', args)
  },
})
 
// Later, stop watching
unwatch()

Return Type

type ReturnType = () => void

Returns a function to unsubscribe from the event.

Parameters

onAuthorized

  • Type: function
declare function onAuthorized(args: Args, log: Log): void
 
type Args = {
  /** The account that authorized the admin key. */
  account: Address
  /** The authorized admin key address. */
  publicKey: Address
}

Callback to invoke when an admin key is authorized.

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.