Skip to content

reward.watchRewardDistributed

Watches for reward distributed events.

Usage

ts
import {  } from 'wagmi/tempo'
import {  } from './config'

const  = ..(, {
  (, ) {
    .('args:', )
  },
  : '0x20c0000000000000000000000000000000000000',
})

// Later, stop watching
()
ts
import { createConfig, http } from 'wagmi'
import { tempoTestnet } from 'wagmi/chains'
import { KeyManager, webAuthn } from 'wagmi/tempo'

export const config = createConfig({
  connectors: [
    webAuthn({
      keyManager: KeyManager.localStorage(),
    }),
  ],
  chains: [tempoTestnet],
  multiInjectedProviderDiscovery: false,
  transports: {
    [tempoTestnet.id]: http(),
  },
})

Return Type

() => void

Returns a function to unsubscribe from the event.

Parameters

onRewardDistributed

  • Type: function
ts
declare function onRewardDistributed(args: Args, log: Log): void

type Args = {
  /** Total amount distributed */
  amount: bigint
  /** Address that funded the distribution */
  funder: Address
}

Callback to invoke when a reward is distributed.

token

  • Type: Address

Address of the TIP-20 token to watch.

args (optional)

  • Type: object
ts
type Args = {
  /** Filter by funder address */
  funder?: Address | Address[]
}

Optional filters to narrow down events by funder address.

Viem

Released under the MIT License.