This repository was archived by the owner on Mar 5, 2025. It is now read-only.

Description
Is there an existing issue for this?
Current Behavior
Following two code snippets behaves exactly the same:
myContract.events.MyEvent({fromBlock: 0})
myContract.events.MyEvent()
Expected Behavior
If one subscribe for the events with fromBlock it should get the past logs with getPastEvents and emit those.
myContract.events.MyEvent({fromBlock: 0})
Steps to Reproduce
Following snippet should emit the two events which were triggered in the past.
myContract.methods.fireStrintEvent('event1');
myContract.methods.fireStrintEvent('event2');
(await myContract.events.MyEvent({fromBlock: 0})).on('data', console.log));
Web3.js Version
4.x
Environment
- Operating System:
- Browser:
- Node.js Version:
- NPM Version:
Anything Else?
This behavior can be implemented with combination of getPastEvents inside the event subscriber.