feat: implement event subscription in UniFFI bridge#48
Merged
xdustinface merged 1 commit intov0.42-devfrom Mar 14, 2026
Merged
Conversation
|
This PR has merge conflicts with the base branch. Please rebase or merge the base branch into your branch to resolve them. |
Adds event subscription support to the SpvClient wrapper in the UniFFI bridge module so foreign consumers (React Native / Swift) can receive real-time sync progress, peer-connection, and transaction events. Changes: - Add subscription_handle field to SpvClient to store the background JoinHandle - Add subscribe(listener) method that spawns a background tokio task reading from the inner client's broadcast channels and forwarding converted events - Add unsubscribe() method that aborts the background task - Add convert_sync_event helper (MempoolActivated maps to None) - Add convert_network_event helper for all three NetworkEvent variants - Add unit tests for subscribe/unsubscribe lifecycle and event conversion Co-authored-by: Kevin Rombach <xdustinface@users.noreply.github.com>
8aee4f6 to
7c03d64
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #46
Adds
subscribeandunsubscribemethods toSpvClientin the UniFFI bridge so that foreign consumers (React Native / Swift) can receive real-time sync progress, peer-connection, and transaction events.Changes
SpvClientstores aMutex<Option<JoinHandle<()>>>for the active subscriptionsubscribe(listener: Arc<dyn SpvEventListener>)spawns a background tokio task that reads from sync, network, and progress channelsunsubscribe()aborts the background taskconvert_sync_eventandconvert_network_eventhelpers map internal types to bridge types