reward.watchRewardScheduled
Watches for reward scheduled events when new reward streams are started.
Usage
example.ts
import { Actions } from 'tempo.ts/wagmi'
import { config } from './wagmi.config'
const unwatch = Actions.reward.watchRewardScheduled(config, {
onRewardScheduled: (args, log) => {
console.log('Stream ID:', args.id)
console.log('Funder:', args.funder)
console.log('Amount:', args.amount)
console.log('Duration:', args.durationSeconds, 'seconds')
},
token: '0x20c0000000000000000000000000000000000000',
})
// Later, stop watching
unwatch()Return Type
type ReturnType = () => voidReturns a function to unsubscribe from the event.
Parameters
onRewardScheduled
- Type:
function
declare function onRewardScheduled(args: Args, log: Log): void
type Args = {
/** Total amount allocated to the stream */
amount: bigint
/** Duration of the stream in seconds (0 for immediate distributions) */
durationSeconds: number
/** Address that funded the stream */
funder: Address
/** Unique stream ID (0 for immediate distributions) */
id: bigint
}Callback to invoke when a reward stream is scheduled.
token
- Type:
Address
Address of the TIP-20 token to watch.
args (optional)
- Type:
object
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.