Skip to content

Conversation

@teogeb
Copy link
Contributor

@teogeb teogeb commented Dec 4, 2024

Refactored ChainEventPoller to support multiple contracts simultaneously. Now the class is a singleton and we can define contract methods as a listener parameter. This optimizes log fetching by reducing required HTTP calls to the JSON RPC as there needs to be only one poller running even if multiple contract events are listened.

Also we don't now need to create a Contract instance just for adding event a listener. This allows us to simplify e.g. Operator class (in a follow-up PR).

@github-actions github-actions bot added the sdk label Dec 4, 2024
@teogeb teogeb requested a review from harbu December 4, 2024 09:14
@harbu
Copy link
Contributor

harbu commented Dec 4, 2024

To address your point

Added try-catch around the event listener so that the polling doesn't stop if a listener throws an error.

We had a discussion on video meeting (me and Teo ofc), maybe better to leave out and have it as caller's responsibility (especially since it was like this before).

On that front, regarding the async case, maybe eslint rule that giving async callback to place where (sync) callback is expected would be an error?

@github-actions github-actions bot added the Stale label Feb 3, 2025
@github-actions github-actions bot closed this Feb 10, 2025
@teogeb teogeb reopened this Feb 19, 2025
@github-actions github-actions bot removed the Stale label Feb 20, 2025
@teogeb teogeb requested a review from harbu March 10, 2025 12:14
@teogeb teogeb merged commit 1030a11 into main Mar 14, 2025
24 checks passed
@teogeb teogeb deleted the sdk-chaineventpoller-supports-multiple-contracts branch March 14, 2025 15:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants