Skip to main content

ContractEvents.getAllEvents() method

Get All Events

Example

// Optionally pass in filters to limit the blocks from which events are retrieved
const filters = {
fromBlock: 0,
toBlock: 1000000,
};
const events = await contract.events.getAllEvents(filters);
console.log(events[0].eventName);
console.log(events[0].data);

Signature:

getAllEvents<TEvent extends Record<string, any>>(filters?: EventQueryFilter): Promise<ContractEvent<TEvent>[]>;

Parameters

ParameterTypeDescription
filtersEventQueryFilter(Optional) Specify the from and to block numbers to get events for, defaults to all blocks

Returns:

Promise<ContractEvent<TEvent>[]>

The event objects of the events emitted with event names and data for each event

Remarks

Get a list of all the events emitted from this contract during the specified time period