-
Hi, In v5 I had some code that roughly looks like this that was grabbing all of the events by a particular contract. Now I'm working to upgrade to v6 and I'm not sure how to change this. The first problem I'm having is getting a list of the filters from the contract. This was getting the keys from the filters object and then grabbing the appropriate topics and adding them all to an array. Now I can't seem to get anything out of contract.filters, but it's not clear why. It prints out an empty object and getting an event by name throws an error saying it can't be found. I suspect something in the underlying data structure might have changed where Object.keys no longer works? Is there a better way to do this? This was working relatively well. Thank you for any ideas or help you might have. On version 6.6.5.
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 4 replies
-
I also switched from the StaticJsonRpcProvider to AlchemyProvider because it seemed like it had been removed? I don't think that would have anything to do with the contract.filter part of the problem though. EDIT: Well ok I discovered that if I contract.queryFilter("*") it gives me the logs that I want. So maybe I can just skip that whole step where I manually put together the list of topics. |
Beta Was this translation helpful? Give feedback.
-
In v6, To deal with the contract interface, which is your interest, you can can use the interface directly: Hope that helps and explains a bit about the difference. :) |
Beta Was this translation helpful? Give feedback.
I also switched from the StaticJsonRpcProvider to AlchemyProvider because it seemed like it had been removed? I don't think that would have anything to do with the contract.filter part of the problem though.
EDIT: Well ok I discovered that if I contract.queryFilter("*") it gives me the logs that I want. So maybe I can just skip that whole step where I manually put together the list of topics.