Skip to content

Cashu wallet#194

Draft
1-leo wants to merge 197 commits intomasterfrom
cashu-wallet
Draft

Cashu wallet#194
1-leo wants to merge 197 commits intomasterfrom
cashu-wallet

Conversation

@1-leo
Copy link
Contributor

@1-leo 1-leo commented Jul 15, 2025

No description provided.

@1-leo 1-leo self-assigned this Jul 15, 2025
@1-leo 1-leo added the enhancement New feature or request label Jul 15, 2025
@1-leo 1-leo added this to ndk-dev Jul 15, 2025
@1-leo 1-leo moved this to In Progress in ndk-dev Jul 15, 2025
@1-leo 1-leo added this to the 0.6 milestone Jul 15, 2025
@codecov
Copy link

codecov bot commented Jul 15, 2025

Codecov Report

❌ Patch coverage is 71.19016% with 656 lines in your changes missing coverage. Please review.
✅ Project coverage is 72.08%. Comparing base (81278a3) to head (6caa8db).
⚠️ Report is 92 commits behind head on master.

Files with missing lines Patch % Lines
..._layer/repositories/wallets/wallets_repo_impl.dart 9.21% 128 Missing ⚠️
...ndk/lib/domain_layer/usecases/wallets/wallets.dart 24.22% 122 Missing ⚠️
...ges/ndk/lib/domain_layer/usecases/cashu/cashu.dart 82.59% 90 Missing ⚠️
...data_layer/repositories/cashu/cashu_repo_impl.dart 73.56% 60 Missing ⚠️
...lib/domain_layer/usecases/cashu/cashu_restore.dart 66.35% 36 Missing ⚠️
...main_layer/entities/wallet/wallet_transaction.dart 49.23% 33 Missing ⚠️
.../repositories/cache_manager/mem_cache_manager.dart 74.41% 22 Missing ⚠️
...s/ndk/lib/domain_layer/entities/wallet/wallet.dart 25.00% 18 Missing ⚠️
.../lib/domain_layer/entities/cashu/cashu_keyset.dart 76.36% 13 Missing ⚠️
...in_layer/usecases/cashu/cashu_cache_decorator.dart 67.50% 13 Missing ⚠️
... and 26 more
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #194      +/-   ##
==========================================
- Coverage   72.41%   72.08%   -0.34%     
==========================================
  Files         144      179      +35     
  Lines        5598     7849    +2251     
==========================================
+ Hits         4054     5658    +1604     
- Misses       1544     2191     +647     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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

@1-leo
Copy link
Contributor Author

1-leo commented Jul 16, 2025

As a user I want to donate ecash without fees
(locked token to pubkey without swap)

1-leo and others added 30 commits January 28, 2026 18:33
…ding/decoding

Co-authored-by: 1-leo <58687994+1-leo@users.noreply.github.com>
Co-authored-by: 1-leo <58687994+1-leo@users.noreply.github.com>
Co-authored-by: 1-leo <58687994+1-leo@users.noreply.github.com>
Co-authored-by: 1-leo <58687994+1-leo@users.noreply.github.com>
…odes

Implement NUT-16 UR encoding/decoding for animated QR codes
- Added restore endpoint to CashuRepo interface
- Implemented restore endpoint in CashuRepoImpl
- Created cashu_restore.dart with full restore logic
- Added restore method to Cashu class
- Created comprehensive tests for restore functionality
- Tests verify deterministic secret generation

Co-authored-by: 1-leo <58687994+1-leo@users.noreply.github.com>
Co-authored-by: 1-leo <58687994+1-leo@users.noreply.github.com>
- Created comprehensive test that funds wallet1 and restores to wallet2
- Both wallets use the same seed phrase but separate caches
- Test verifies that wallet2 can restore all funds from wallet1
- Test is skipped by default but can be enabled for manual testing with real mint
- Includes detailed logging and step-by-step verification
- Validates that both wallets have identical balances after restore

Co-authored-by: 1-leo <58687994+1-leo@users.noreply.github.com>
Co-authored-by: 1-leo <58687994+1-leo@users.noreply.github.com>
The bug was in the matching logic between signatures and blinded messages.
The code was trying to match by keyset ID, but all blinded messages in a
batch share the same keyset ID, so firstWhere always returned the first item.

Solution:
- Updated restore endpoint to parse BOTH outputs and signatures from response
- Match outputs[i] with signatures[i] by index
- Use the B_ value from outputs to find the corresponding blinded message item
- Fallback to trying each combination if outputs aren't provided

This ensures each restored proof gets its correct unique secret and blinding factor.

Co-authored-by: 1-leo <58687994+1-leo@users.noreply.github.com>
As requested, the restore method now returns a Stream instead of a Future.
This allows clients to track progress as proofs are discovered and restored.

Changes:
- Changed Cashu.restore() to return Stream<CashuRestoreResult>
- Changed CashuRestore.restoreAllKeysets() to return Stream<CashuRestoreResult>
- Yields progress updates after each keyset is processed
- Saves proofs incrementally and updates balances as they're discovered
- Updated test to consume stream and show progress
- Added test to verify all proofs have unique secrets (validates the bug fix)

Co-authored-by: 1-leo <58687994+1-leo@users.noreply.github.com>
…estore

Fix restore bug: all proofs had same secret; convert to streaming API
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

4 participants