# EndFiat.Money – Cashu Wallet A modern, privacy-focused Cashu ecash wallet built with React and TypeScript. Send and receive Bitcoin ecash tokens directly in your browser with support for Lightning Network integration. ## Features ### Wallet Management - **Create New Wallet**: Generate a new wallet with a secure 12-word seed phrase - **Restore Wallet**: Restore an existing wallet from a seed phrase - **PIN Protection**: Optional PIN protection with encrypted mnemonic storage - **Multiple Wallets**: Support for multiple wallet profiles with easy switching - **Wallet Export/Import**: Export and import wallet database for backup and migration ### Send & Receive - **Send Ecash**: Send Cashu tokens to other wallets via QR codes or token strings - **Receive Ecash**: Receive tokens by displaying QR codes or scanning incoming tokens - **Lightning Network Support**: - Send via Lightning invoices (`lnbc...`) - Send via Lightning addresses (`user@domain.com`) - Receive via Lightning Network (mint quote redemption) - **QR Code Scanner**: Built-in QR code scanner for easy token and invoice scanning - **Animated QR Codes**: Large, animated QR codes for better scanning reliability - **Send All**: Quick option to send entire balance from a mint ### Mint Management - **Add Mints**: Add custom Cashu mints by URL - **Discover Mints**: Browse and discover public mints via Nostr relays - **Default Mint**: Set a preferred default mint for operations - **Mint Status**: Real-time status checking for all added mints - **Mint Details**: View mint information, version, and supported NUTs - **Transfer Between Mints**: Transfer balance from one mint to another - **Consolidation**: Consolidate balances across multiple mints into one ### Transaction History - **Complete History**: View all transactions (send, receive, mint, melt) - **Transaction Details**: Detailed view of each transaction with metadata - **Status Tracking**: Real-time status updates (pending, completed, expired) - **Fee Display**: Transparent fee information for Lightning transactions - **Transaction Management**: Delete individual transactions from history ### Advanced Features - **Proof State Watcher**: Automatic background monitoring and recovery of stuck proofs - **Auto-Restore**: Automatic restoration of pending melt proofs on wallet unlock - **Balance Consolidation**: Merge balances from multiple mints into a single mint - **Bitcoin Price**: Real-time BTC/USD price conversion (powered by Mempool.space and CoinGecko) - **PWA Support**: Installable Progressive Web App for mobile and desktop - **Wake Lock**: Keeps screen awake during QR code display - **Dark/Light Theme**: System-aware theme support - **Swipe Gestures**: Intuitive swipe navigation between screens ### Security - **Client-Side Storage**: All wallet data stored locally using IndexedDB - **Encrypted Mnemonics**: Optional PIN-based encryption for seed phrases - **No Server Dependency**: Wallet operations work entirely client-side - **Trusted Mint Validation**: Automatic validation of mint trust before receiving tokens ## Technology Stack - **Frontend Framework**: React 18 with TypeScript - **Build Tool**: Vite - **UI Components**: shadcn/ui (Radix UI primitives) - **Styling**: Tailwind CSS - **Cashu Library**: coco-cashu-core, coco-cashu-indexeddb, coco-cashu-react - **State Management**: React Context API + TanStack Query - **Routing**: React Router DOM - **Animations**: Framer Motion - **QR Codes**: qrcode.react, html5-qrcode - **Backend Services**: Supabase Edge Functions - Mint discovery via Nostr relays - LNURL proxy for Lightning address resolution - Bitcoin price API with caching ## Getting Started ### Prerequisites - Node.js 18+ and npm (or use [nvm](https://github.com/nvm-sh/nvm#installing-and-updating)) - Supabase account (for backend functions) ### Installation ```bash # Clone the repository git clone cd endfiatcashu # Install dependencies npm install # Set up environment variables cp .env.example .env # Edit .env with your Supabase credentials: # VITE_SUPABASE_URL=your_supabase_url # VITE_SUPABASE_PUBLISHABLE_KEY=your_supabase_key ``` ### Development ```bash # Start the development server npm run dev ``` The app will be available at `http://localhost:5173` ### Building for Production ```bash # Build for production npm run build # Preview production build npm preview ``` ### Testing ```bash # Run tests npm test # Run tests in watch mode npm run test:watch ``` ## Supabase Functions This project uses Supabase Edge Functions for backend services: ### Discover Mints (`discover-mints`) Discovers public Cashu mints via Nostr relays (kind 38172 and 38000 events). Returns a list of mints with ratings and metadata. ### LNURL Proxy (`lnurl-proxy`) Proxies LNURL requests to resolve Lightning addresses and fetch invoices. Prevents CORS issues when interacting with Lightning services. ### BTC Price (`btc-price`) Fetches Bitcoin price in USD with caching. Uses Mempool.space as primary source and CoinGecko as fallback. ## Project Structure ``` src/ ├── components/ │ ├── wallet/ # Wallet-specific components │ │ ├── Dashboard.tsx │ │ ├── SendScreen.tsx │ │ ├── ReceiveScreen.tsx │ │ ├── MintsScreen.tsx │ │ ├── SettingsScreen.tsx │ │ └── ... │ └── ui/ # shadcn/ui components ├── contexts/ │ └── WalletContext.tsx # Global wallet state ├── hooks/ # Custom React hooks ├── lib/ │ └── wallet.ts # Wallet utilities and storage ├── integrations/ │ └── supabase/ # Supabase client configuration └── pages/ └── Index.tsx # Main app entry point supabase/ └── functions/ # Supabase Edge Functions ├── discover-mints/ ├── lnurl-proxy/ └── btc-price/ ``` ## Default Mints The wallet automatically adds these default mints on creation: - `https://mint.endfiat.money` - `https://mint.minibits.cash/Bitcoin` ## Browser Support - Chrome/Edge (recommended) - Firefox - Safari (iOS 15+) - Mobile browsers with IndexedDB support ## Privacy & Security - **No KYC**: Cashu tokens are private and don't require identity verification - **Client-Side Only**: All wallet operations happen in your browser - **No Tracking**: No analytics or tracking scripts - **Encrypted Storage**: Optional PIN encryption for sensitive data - **Open Source**: Full source code available for audit ## Contributing Contributions are welcome! Please feel free to submit a Pull Request. ## License [Add your license here] ## Acknowledgments - Built with [Cashu](https://github.com/cashubtc/cashu) protocol - Uses [coco-cashu](https://github.com/cashubtc/coco-cashu) libraries - UI components from [shadcn/ui](https://ui.shadcn.com/)