feat: add wallet event callbacks to UniFFI bridge SpvEventListener#58
Merged
xdustinface merged 1 commit intov0.42-devfrom Mar 14, 2026
Merged
feat: add wallet event callbacks to UniFFI bridge SpvEventListener#58xdustinface merged 1 commit intov0.42-devfrom
xdustinface merged 1 commit intov0.42-devfrom
Conversation
- Add `WalletEvent` enum with `#[derive(uniffi::Enum)]` containing `TransactionReceived`, `TransactionStatusChanged`, and `BalanceUpdated` variants (all complex fields serialised to primitive/String types) - Add `on_wallet_event` method to the `SpvEventListener` trait - Implement `convert_wallet_event` helper that converts the internal `key_wallet_manager::WalletEvent` to the bridge `WalletEvent`, following the same pattern as `convert_sync_event` / `convert_network_event` - Update `SpvClient::subscribe` to subscribe to wallet events via `self.inner.wallet().read().await.subscribe_events()` and forward them to `listener.on_wallet_event` inside the select loop - Update `MockListener` in tests to implement `on_wallet_event` - Add unit tests: `test_wallet_event_variants`, `test_listener_receives_wallet_event`, `test_convert_wallet_event_transaction_received`, `test_convert_wallet_event_transaction_status_changed`, and `test_convert_wallet_event_balance_updated` Closes #56 Co-authored-by: Kevin Rombach <xdustinface@users.noreply.github.com>
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## v0.42-dev #58 +/- ##
=============================================
- Coverage 73.08% 67.78% -5.31%
=============================================
Files 287 316 +29
Lines 58264 68622 +10358
=============================================
+ Hits 42584 46517 +3933
- Misses 15680 22105 +6425
🚀 New features to boost your workflow:
|
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.
Summary
Adds wallet event support to the UniFFI bridge, matching what the C FFI already provides via
FFIWalletEventCallbacks:WalletEventenum withTransactionReceived,TransactionStatusChanged,BalanceUpdatedvariantsSpvEventListenertrait withon_wallet_eventcallbacksubscribe_wallet_eventstoDashSpvClientsubscribeflowkey_wallet_manager::WalletEventto bridge typesCloses #56