Ethers.js Events – Unable to Fetch Events Using Ethers.js and Troubleshooting Steps

ethers.jsevent-handlingevents

I am trying to fetch two events from a contract on Goerli. One of them is being fetched correctly but the other one doesn't.

The working one :

 let eventFilter = Core.filters.AddChannel();//Core is the contract instance, and it is correctly initialized. 
  let events = await Core.queryFilter(eventFilter);
  console.log(`Total ${events.length} Add events found `);

Not working :

let Filter = Core.filters.UpdateChannel();
 let events = await Core.queryFilter(Filter);

 console.log(`Total ${events.length} update events found`);

here is the contract address : 0x23346b732d56d34ec4e890419fbfb8548216a799

The later one is printing an empty array, there is no error popping up either.

Best Answer

My bad.

The deployed contract was an old contract, containing only two parameters in the event, but the instance I was creating had three parameters, producing a wrong filter for the event.

Related Topic