Skip to main content

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

ParameterTypeDescription
listener(event: ContractEvent) => voidthe callback function that will be called on every new event

Returns:

() => void

A function that can be called to stop listening to events