Skip to content

reward.watchRewardScheduled

Watches for reward scheduled events when new reward streams are started.

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

onRewardScheduled

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

type Args = {
  /** Total amount allocated to the stream */
  amount: bigint
  /** Address that funded the stream */
  funder: Address
}

Callback to invoke when a reward stream is scheduled.

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[]
  /** Filter by stream ID */
  id?: bigint | bigint[]
}

Optional filters to narrow down events by funder address or stream ID.

Viem

Released under the MIT License.