Web3.js: Filter in options to filter contract events is no longer a valid parameter

Created on 19 Mar 2019  路  2Comments  路  Source: ChainSafe/web3.js

Description

I used the parameter "filter" in the option that I pass to contract events like explained here:
https://web3js.readthedocs.io/en/1.0/web3-eth-contract.html#contract-events
It seems like this functionality broke between 33 and 49.

What is the proper replacement to filter events based on an array of addresses?

Steps to reproduce the behavior

1. update `web3`
2.Add options:
const options = {
    filter: {
         to:  addressArray
     },
          fromBlock: 'latest'
};
3. subscribe to events with
contract.events.Transfer(options, (error, event) => {
    stuff
}

Error Logs

Error: Provider error: Error: Node error: {"code":-32602,"message":"Invalid params: Invalid Pub-Sub parameters: unknown field `filter`, expected one of `fromBlock`, `toBlock`, `blockHash`, `address`, `topics`, `limit`."}
at /home/user/project/node_modules/web3-providers/dist/web3-providers.cjs.js:320:15
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:189:7)
  • web3.js: 49
bug

Most helpful comment

@gnorbsl FYI: It will get released today or tomorrow.

All 2 comments

Thanks for opening this issue! I'll test and fix it asap.

@gnorbsl FYI: It will get released today or tomorrow.

Was this page helpful?
0 / 5 - 0 ratings