2

I have two contract address and I want to check events on both in one call. I mean, can we pass two contract address in one option param like i do below?

let web3 = new Web3();
web3.setProvider(web3Provider);
let options = {
  fromBlock:'latest',
  toBlock: 'latest',
  address: ADDRESS1,Address2
};
let filter = web3.eth.filter(options);
filter.watch(function(error, result){
  console.log(JSON.stringify(result));
});

Or there is any way to combine all events from both contract?

0

This would only work if the events have the same signature (event name and arguments) or none ( [] ).
You pass in an array of the addresses you want to scan.

let options = {
  fromBlock:'latest',
  toBlock: 'latest',
  address: [ADDRESS1,Address2],
  topics: []
};

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.