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<TEvent extends Record<string, any>>(listener: (event: ContractEvent<TEvent>) => void): () => void;

Parameters

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

Returns:

() => void

A function that can be called to stop listening to events