reward.watchRewardDistributed
Watches for reward distributed events.
Usage
ts
import { Actions } from 'wagmi/tempo'
import { config } from './config'
const unwatch = Actions.reward.watchRewardDistributed(config, {
onRewardDistributed(args, log) {
console.log('args:', args)
},
token: '0x20c0000000000000000000000000000000000000',
})
// Later, stop watching
unwatch()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.