Skip to content

reward.watchRewardRecipientSet

Watches for reward recipient set events when token holders change their reward recipient.

Usage

example.ts
import { client, token } from './viem.config'
 
const unwatch = client.reward.watchRewardRecipientSet({
  onRewardRecipientSet: (args, log) => {
    console.log('Holder:', args.holder)
    console.log('Recipient:', args.recipient)
  },
  token,
})
 
// Later, stop watching
unwatch()

Return Type

type ReturnType = () => void

Returns a function to unsubscribe from the event.

Parameters

onRewardRecipientSet

  • Type:
declare function onRewardRecipientSet(args: Args, log: Log): void
 
type Args = {
  /** Token holder address who set their reward recipient */
  holder: Address
  /** New reward recipient address (zero address indicates opt-out) */
  recipient: Address
}

Callback to invoke when a reward recipient is set.

token

  • Type: Address

Address of the TIP-20 token to watch.

args (optional)

  • Type: object
type Args = {
  /** Filter events by holder address */
  holder?: Address
  /** Filter events by recipient address */
  recipient?: Address
}

Optional filters for the event.