Conversation
Organize the wallet API by domain and expose request, session, plan, and receipt workflows with an explicit advanced boundary. Keep business logic in Rust and synchronize the UniFFI bridges, language tests, CLI, examples, and migration documentation. Preserve recovery of existing persisted operations and harden send ownership, quote reservation concurrency, reusable mint claims, cross-mint retries, synchronization reporting, and FFI runtime handling. BREAKING CHANGE: replace the legacy wallet and repository API with Wallet, WalletManager, domain workflows, and the opt-in advanced FFI surface. See docs/wallet-api.md and docs/wallet-api-reference.md for migration guidance.
Estimate the selected reserved proofs before confirming an offline send, preserving the receiver redemption-fee check. Keep the known one-sat fake Lightning fee separate from the estimated input fee and verify the payment receipt against both. Validated both test_fees cases against the Nutshell CI image with a 100-ppk input fee; stable/nightly formatting and targeted Clippy checks pass.
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #2479 +/- ##
==========================================
- Coverage 79.05% 78.23% -0.82%
==========================================
Files 387 393 +6
Lines 105617 109636 +4019
==========================================
+ Hits 83494 85774 +2280
- Misses 22123 23862 +1739 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
While recovery is being reshaped here, one wallet-side cost profile worth having on the radar: long-lived wallets accumulate one Send/TokenCreated row per send (by design — revoke window), and today's boot-time recovery re-resumes each sequentially with an individual NUT-07 check (~3s/row measured against a LAN mint; multi-minute passes at a few thousand rows — #2631). Not a blocker or a request for this PR — just flagging it since the loop shape is being reworked; the current branch keeps the per-saga sequential checks. A sketch of one batching shape exists in the #2631 discussion as context if it ever helps. |
Description
Reshape the real wallet API around shared, resumable application workflows, with the same model in Rust and the generated language bindings.
Walletfor one mint/unit andWalletManagerfor discovery, portfolios, payment requests, and cross-mint transfers. Keep construction local and network synchronization explicit.advanced()and the opt-inadvanced-walletFFI feature. Remove the duplicated wallet trait/repository surfaces and redundant bridge layers.Notes to the reviewers
This is an intentional breaking wallet API change, without compatibility aliases. The protocol engines remain available through the advanced boundary; the FFI layer delegates business logic to Rust.
Start with the architecture and migration guide and the API reference, then the domain implementations in
crates/cdk/src/walletand the normal/advanced FFI bridges.Existing reserved send/payment saga records written by
mainremain recoverable. No database schema migration is introduced. The wallet database contract now requires melt-quote updates to compare both the quote version and its reservation owner; SQLite/Postgres, Redb, Supabase, and the custom FFI database contract are updated together.This is one consolidated commit on top of upstream
mainat1c6f683a.Validation
Rechecked on the final branch:
cargo fmt --all -- --checkcargo +nightly fmt --all -- --checkgit diff --check upstream/main...HEADcargo clippy --workspace --all-targets -- -D warningscargo test --lib --workspace --exclude cdk-postgres --quietThe unit-test suite requires localhost access for its mock servers and was run outside the restricted network sandbox.
Stable rustfmt emits warnings about the repository's nightly-only formatting options, but exits successfully with no formatting errors. The nightly check also passes.
Additional checks completed during the preceding review:
integration_tests_pure,test_swap_flow,wallet_saga, andnwc_e2e.advanced-walletenabled.typos.Not run: the full Bitcoin/Lightning regtest environment or a live Supabase service. Dart's optional live-mint test was skipped.
Suggested CHANGELOG Updates
CHANGED
ADDED
REMOVED
FIXED
Checklist
just quick-checkbefore committing — individual checks are listed above; the aggregate recipe was not run.crates/cdk-ffi)