Skip to content

How can I listen for contract events without specifying exact contract address? #3635

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

You must be logged in to vote

That isn’t something built-in, but you can create a provider and an Interface instance, and inside the provider listener, parse the log:

const iface = new Interface(abi);
provider.on(filter, (log) => {
  const event = iface.parseLog(log);
  // …
});

Replies: 2 comments 2 replies

Comment options

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

Comment options

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

Answer selected by calebgattegno
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