Web3.js: myContract.getPastEvents('allEvents') seems to not support filter options

Created on 8 Dec 2017  路  11Comments  路  Source: ChainSafe/web3.js

Hello guys,

The filter doesn't work with "getPastEvents" when the first parameter is "allEvents".
It returns me all the events whatever the filter.

Would be great to be able to select all the event types and filter them with indexed parameters.

Best,

clarification needed

Most helpful comment

Same for me, just stumbled on the same issue using 1.0.0-beta.26.

According to the docs it sounds like it should be supported http://web3js.readthedocs.io/en/1.0/web3-eth-contract.html#getpastevents

Edit: same on 1.0.0-beta.28.

All 11 comments

Same for me, just stumbled on the same issue using 1.0.0-beta.26.

According to the docs it sounds like it should be supported http://web3js.readthedocs.io/en/1.0/web3-eth-contract.html#getpastevents

Edit: same on 1.0.0-beta.28.

Same issue here, using 1.0.0.beta30, filter is not being considered, both with and without "allEvents"

Same for 1.0.0.beta33

From getPastEvents docs:
filter - Object (optional): Lets you filter events by indexed parameters
My param is not indexed, so probably solution is found for me

@vrolland @davodesign84 @atomixxx2 use indexed and it'll work

Hi @bshevchenko, Im already using indexed event fields, it is not working.

@alejoloaiza Please give us some more informations :)

@bshevchenko I used indexed parameters.

@nivida The filter works when I am getting a specific event but not when I am using the generic "allEvents".
For example with the following event:
event Created(bytes32 indexed identifier);

Here the filter is not taking in account:

await instanceContract.getPastEvents('allEvents', {
    filter: {identifier: value}
});

Here, the filter works:

await instanceContract.getPastEvents('Created', {
    filter: {identifier: value}
});

Is it clearer?

This got fixed in the AbstractContract object during the refactoring.

Seems like this still doesn't work

It still doesn't work on web3 1.2.11, bumping this @nivida .

Was this page helpful?
0 / 5 - 0 ratings