-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Filter events with multi address #3831
Comments
Getting same error, this was new useful feature in v6 but it seems it is not working, tried with Infura provider. BTW I tried with provider.getLogs function. |
Also does it actually reduce number of Infura calls, or does it send new eth_getLogs request for each contract address? |
Ignore above comment I found that this could be Infura specific issue, it requires eth_getFilterLogs method for multi address support. NOTE: it seems Infura is not spec-compliant. it should be supported as per this official specs: |
Sorry. Missed this before. Looking into it now. Does it work with other providers? InfuraProvider should by default use a filter ID subscriber. Can you also make sure you are on the latest version of ethers? |
Hello, sorry for the confusion error was due to potentially invalid eventFilter use like |
Yes, topic filters don't support that syntax, but could have something like that added in the future (using another wrapper to indicate OR), because it would complicate refining the event. You could also use the contract to generate the filter and swap out the single address with your array and use the |
Ok, by looking closely I found that in v5 I was using code like this to get topic filter with multiple addresses: const eventFilter = tokenContract.filters['Approval']!(
null,
[address1, address2, ...],
null
); & then I was passing eventFilter.topics in getLogs call. but in v6 it gives following error: Also eventFilter.topics is not available directly so need to use how can I generate similar filter in v6? |
For now used the following code to make it work like v5: const erc20tInterface = new ethers.Interface(erc20Contract.abi);
const topics = erc20tInterface.encodeFilterTopics('Approval', [
null,
[address1, address2, address3],
null,
]); & I have passed these topics to provider.getLogs function. |
Ethers Version
6.0.8
Search Terms
No response
Describe the Problem
i can not filter multi-address event
Code Snippet
Contract ABI
No response
Errors
No response
Environment
No response
Environment (Other)
No response
The text was updated successfully, but these errors were encountered: