ContractEvents.listenToAllEvents() method
Listen to all events emitted from this contract
Example
contract.events.listenToAllEvents((event) => {
console.log(event.eventName) // the name of the emitted event
console.log(event.data) // event payload
}
Signature:
listenToAllEvents<TEvent extends Record<string, any>>(listener: (event: ContractEvent<TEvent>) => void): () => void;
Parameters
Parameter | Type | Description |
---|---|---|
listener | (event: ContractEvent<TEvent>) => void | the callback function that will be called on every new event |
Returns:
() => void
A function that can be called to stop listening to events