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(filters?: EventQueryFilter): Promise<ContractEvent[]>;

Parameters

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

Returns:

Promise<ContractEvent[]>

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