Skip to content

feat: add wallet event callbacks to UniFFI bridge SpvEventListener#58

Merged
xdustinface merged 1 commit intov0.42-devfrom
claude/issue-56-20260314-0123
Mar 14, 2026
Merged

feat: add wallet event callbacks to UniFFI bridge SpvEventListener#58
xdustinface merged 1 commit intov0.42-devfrom
claude/issue-56-20260314-0123

Conversation

@xdustinface
Copy link
Owner

Summary

Adds wallet event support to the UniFFI bridge, matching what the C FFI already provides via FFIWalletEventCallbacks:

  • New WalletEvent enum with TransactionReceived, TransactionStatusChanged, BalanceUpdated variants
  • Updates SpvEventListener trait with on_wallet_event callback
  • Adds subscribe_wallet_events to DashSpvClient
  • Wires wallet events into the subscribe flow
  • Conversion from key_wallet_manager::WalletEvent to bridge types
  • Unit tests for all new paths

Closes #56

- 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-commenter
Copy link

codecov-commenter commented Mar 14, 2026

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 91.89189% with 12 lines in your changes missing coverage. Please review.
✅ Project coverage is 67.78%. Comparing base (aa28af3) to head (0254955).

Files with missing lines Patch % Lines
dash-spv/src/bridge/mod.rs 91.89% 12 Missing ⚠️
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.
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     
Flag Coverage Δ
core 75.14% <ø> (ø)
ffi 37.22% <ø> (?)
rpc 19.92% <ø> (ø)
spv 84.70% <91.89%> (+0.04%) ⬆️
wallet 66.40% <ø> (ø)
Files with missing lines Coverage Δ
dash-spv/src/bridge/mod.rs 89.94% <91.89%> (+0.18%) ⬆️

... and 35 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@xdustinface xdustinface merged commit 8aaa68a into v0.42-dev Mar 14, 2026
80 of 82 checks passed
@xdustinface xdustinface deleted the claude/issue-56-20260314-0123 branch March 14, 2026 02:02
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.

feat: add wallet event callbacks to UniFFI bridge SpvEventListener

2 participants