nos
nos copied to clipboard
Add Cashu wallet support with Core Data migration, UI components, and integration tests for NIP-60 and NIP-61
Summary
- Adds comprehensive Cashu wallet support for sending and receiving ecash via NIP-60 (wallet state) and NIP-61 (nutzaps)
- Implements Nutzaps for peer-to-peer token transfers using P2PK-locked Cashu tokens
- Introduces wallet balance display with offline viewing capability
- Adds wallet onboarding flow with mnemonic backup
- Provides transaction history view for tracking ecash movements
- Integrates CashuSwift package dependency for Cashu protocol support
- Adds Core Data entities for local wallet caching: CashuWalletCache, CashuTokenCache, CashuTransaction
- Implements NIP-44 encryption for wallet and token events
- Adds dependency injection for CashuWalletService, NutzapService, and CashuCacheService
- Supports new event kinds: 7375 (cashuToken), 7376 (cashuHistory), 17375 (cashuWallet), 9321 (nutzap), 10019 (nutzapInfo)
- Includes a detailed Core Data migration guide for Cashu wallet entities
- Provides extensive integration plans, technical considerations, and implementation checklists
- Adds integration and unit tests for Cashu wallet and Nutzap features
Changes
Core Data Migration Guide: CORE_DATA_MIGRATION_GUIDE.md
- Step-by-step instructions for adding Cashu wallet entities to Core Data model
- Details on creating new model version, setting current version, adding entities and relationships
- Guidance on generating NSManagedObject subclasses and troubleshooting migration issues
Wallet Integration Research: wallet-integration-research.md
- Detailed NIP-60 and NIP-61 specifications for wallet events and nutzap events
- Analysis of Cashu Development Kit (CDK) and native Swift integration options
- Proposed Nos integration architecture with event kinds, Core Data entities, service layers, and UI components
- Phased implementation plan with milestones and risk mitigation
- Technical considerations including security, performance, and UX
Cashu Library Evaluation: cashu-library-evaluation.md
- Comparison of CashuSwift, CashuKit, and CDK with Swift-Rust bindings
- Pros, cons, maturity ratings, and resource analysis
- Recommendation to use CashuKit for initial integration with migration path to CDK
CashuKit Integration Plan: cashukit-integration-plan.md
- Week-by-week milestones covering core integration, NIP-60/61 implementation, UI, security, and testing
- Risk mitigation strategies and success metrics
- Communication and post-launch plans
CashuKit Technical Considerations: cashukit-technical-considerations.md
- Architecture alignment with Nos async/await and Core Data
- Event serialization and relay sync strategies
- Security implementations including Keychain and NIP-44 encryption
- Performance optimizations and error handling
- Migration path preparation and testing considerations
- Monitoring and UI/UX state management
CashuKit Implementation Checklist: cashukit-implementation-checklist.md
- Checklist for tracking implementation progress
- Daily standup and blocker log templates
- Success criteria and post-launch monitoring
Code and UI Changes
- Added CashuSwift package dependency and integrated into project
- Implemented Core Data entities and relationships for wallet caching
- Developed CashuWallet, CashuTokenCache, CashuTransaction models and services
- Added wallet UI components: balance display, onboarding, transaction history, nutzap sending
- Integrated NIP-44 encryption and dependency injection
- Added support for new event kinds related to Cashu wallet and nutzaps
Tests
- Added integration tests for Cashu wallet features
- Added unit tests for CashuWalletService and NutzapService
- Added wallet event and nutzap event tests
Test plan
- Validate Core Data migration guide by creating test wallets and verifying data integrity
- Test wallet event processing, token state management, UI integration, and nutzap interoperability
- Confirm encryption and security implementations
- Engage Nos team and Cashu/Nostr community for feedback and validation
🌿 Generated by Terry
ℹ️ Tag @terragon-labs to ask questions and address PR feedback
📎 Task: https://www.terragonlabs.com/task/c16cb320-8b52-462a-961c-8d9f274ad6f5
📎 Task: https://www.terragonlabs.com/task/1fe36ba3-ba06-4321-96ee-05daaf8855ff