policy.watchCreate
Watches for policy creation events on the TIP403 Registry.
Usage
example.ts
import { Actions } from 'tempo.ts/wagmi'
import { config } from './wagmi.config'
const unwatch = Actions.policy.watchCreate(config, {
onPolicyCreated: (args, log) => {
console.log('Policy ID:', args.policyId)
console.log('Type:', args.type)
console.log('Updater:', args.updater)
},
})
// Later, stop watching
unwatch()Return Type
type ReturnType = () => voidReturns a function to unsubscribe from the event.
Parameters
onPolicyCreated
- Type:
function
declare function onPolicyCreated(args: Args, log: Log): void
type Args = {
/** ID of the created policy */
policyId: bigint
/** Type of policy */
type: PolicyType
/** Address that created the policy */
updater: Address
}Callback to invoke when a policy is created.
args (optional)
- Type:
object
type Args = {
/** Filter by policy ID */
policyId?: bigint | bigint[] | null
/** Filter by updater address */
updater?: Address | Address[] | null
}Optional filter arguments to narrow which events to watch.
fromBlock (optional)
- Type:
bigint
Block to start listening from.
onError (optional)
- Type:
function
declare function onError(error: Error): voidThe callback to call when an error occurred when trying to get for a new block.
poll (optional)
- Type:
true
Whether to use polling.
pollingInterval (optional)
- Type:
number
Polling frequency (in ms). Defaults to Client's pollingInterval config.