Skip to content

provider.getLogs({topics}) does not allow for multiple topics filtering #4595

Answered by ricmoo
pocin asked this question in Q&A
Discussion options

You must be logged in to vote

That should work. But keep in mind your filter you specified isn’t correct for filtering by two topic0. You would want { topics: [ [ topic.topics[0], topic2.topics[0] ] ] }.

Your filter is looking for logs with topic in the first position and topic2 in the second position. The filter I posted above looks for topic or topic2 in the first position. You are also passing in the entire filter as the positions, while what you mean to pass in is the topic0.

Constructing a complex getLog query is more complex than I have figured out a simple API for because the filtering is an AND-ed set of positions with OR-ed sets. So you could do “any Transfer or Approve for account A or B” but you could not d…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@pocin
Comment options

Answer selected by pocin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants