feat: add concrete SpvClient UniFFI object#13
Conversation
- Add `#[cfg_attr(feature = "uniffi", derive(uniffi::Enum))]` to `MempoolStrategy` - Add `#[cfg_attr(feature = "uniffi", derive(uniffi::Record))]` to `ClientConfig` - Change `max_mempool_transactions: usize` → `u64` for UniFFI compatibility - Add `custom_type!` mappings for `SocketAddr` and `PathBuf` in bridge module - Make `DashSpvClient::start()` public (was `pub(super)`) - Implement `SpvClient` UniFFI object wrapping the concrete type `DashSpvClient<WalletManager<ManagedWalletInfo>, PeerNetworkManager, DiskStorageManager>` - Export: `new()`, `start()`, `stop()`, `shutdown()`, `is_running()`, `tip_height()`, `tip_hash()`, `peer_count()`, `sync_progress()`, `is_syncing()` - Add `SpvClientError` uniffi::Error enum mapped from `SpvError` - Unit tests for construction and state queries Closes #7 Co-authored-by: Kevin Rombach <xdustinface@users.noreply.github.com>
|
@claude CI is failing with a compilation error in |
|
Claude finished @xdustinface's task in 5m 5s —— View job Fixing CI compilation error and formatting
Root cause
use crate::error::{NetworkError, NetworkResult, SpvError as Error};
// ...
pub async fn new(config: &ClientConfig) -> Result<Self, Error>It returns Changes made (30554bb)Compilation fix (
Formatting fix:
|
- `PeerNetworkManager::new` returns `Result<_, SpvError>` (it aliases `SpvError` as `Error` in manager.rs), so the original `map_err(SpvError::Network)` was wrong — that variant constructor expects a `NetworkError`, not the `SpvError` already returned. Fix: use `.map_err(SpvClientError::from)` directly. - `DiskStorageManager::new` returns `StorageResult` (`StorageError`); replace the two-step conversion via `SpvError::from` (ambiguous with many `From` impls) with an explicit inline closure. - Collapse the `SocketAddr` `try_lift` closure to a single line (85 chars) per the project's `max_width = 100` rustfmt setting. 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 #13 +/- ##
=============================================
+ Coverage 65.89% 65.91% +0.01%
=============================================
Files 312 312
Lines 64607 64683 +76
=============================================
+ Hits 42573 42636 +63
- Misses 22034 22047 +13
🚀 New features to boost your workflow:
|
|
This PR has merge conflicts with the base branch. Please rebase or merge the base branch into your branch to resolve them. |
|
@claude The pre-commit checks are still failing on all 3 platforms due to formatting issues. Please run cargo fmt --all and push. |
|
Claude finished @xdustinface's task in 32s —— View job Fixing formatting issues
Blocked:
|
88aa976 to
033ee86
Compare
Implements the concrete SpvClient UniFFI wrapper for DashSpvClient.
Closes #7
uniffi::EnumonMempoolStrategy,uniffi::RecordonClientConfigcustom_type!mappings forSocketAddrandPathBufmax_mempool_transactionschanged fromusizetou64(UniFFI compat)SpvClientUniFFI object with lifecycle (new, start, stop) and state queries