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(listener: (event: ContractEvent) => void): () => void;
Parameters
Parameter | Type | Description |
---|---|---|
listener | (event: ContractEvent) => 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