Skip to content

Comments

feat: optimize useWatchContractEvent#64

Merged
sinzii merged 15 commits intomainfrom
tweak/system-events-handle
Jan 5, 2025
Merged

feat: optimize useWatchContractEvent#64
sinzii merged 15 commits intomainfrom
tweak/system-events-handle

Conversation

@1cedrus
Copy link
Member

@1cedrus 1cedrus commented Dec 15, 2024

Closes #62 which uses a global client.query.system.events call for all watch operations.

Changes:

  • Add ListenersProvider to handle the global client.query.system.events.
  • Update useWatchContractEvent and its unit tests.

@1cedrus 1cedrus requested a review from sinzii December 17, 2024 08:25
@1cedrus 1cedrus marked this pull request as ready for review December 17, 2024 08:26
}, [client, hasAny]);

const subscribeToEvent = (event: TypinkEvent, callback: (events: any[]) => void): Unsub => {
if (!client) return noop;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should throw an exception here, so the comsumer will be aware to have this check first.

@sinzii sinzii merged commit 1606253 into main Jan 5, 2025
2 checks passed
@sinzii sinzii deleted the tweak/system-events-handle branch January 5, 2025 07:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Optimize useWatchContractEvent & other hooks with watch mode

2 participants