From f909795887a2a51309a3aa083893608ecd7d473b Mon Sep 17 00:00:00 2001 From: lemonknowsall Date: Mon, 20 Oct 2025 23:23:38 -0700 Subject: [PATCH] Add wallet reference in Agents file with file hierarchy --- AGENTS.md | 2 +- docs/WALLET_INTEGRATION.md | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+), 1 deletion(-) diff --git a/AGENTS.md b/AGENTS.md index 4d6da41..1cdfb78 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -110,7 +110,7 @@ The project includes a **`docs/`** directory containing specialized documentatio - **`docs/NOSTR_INFINITE_SCROLL.md`**: Read when building feed interfaces, implementing pagination for Nostr events, or creating social media-style infinite scroll experiences. -- **`docs/CASHU_ZAP_INTEGRATION.md`**: Read when implementing zap functionality, integrating Cashu wallet payments, or building Lightning payment features. Essential for understanding the unified ZapButton architecture and Cashu-powered Lightning zaps. **CRITICAL**: Follow the two-component architecture - `CashuWallet` for standalone wallet management, `ZapButton` for content integration. +- **`docs/WALLET_INTEGRATION.md`**: Read when implementing comprehensive wallet functionality, Lightning zaps, Cashu token operations, or Bitcoin transactions. Essential for understanding the three-mode wallet system (Tokens/Lightning/Bitcoin), unified ZapButton architecture, and Cashu-powered Lightning zaps. **CRITICAL**: Follow the two-component architecture - `CashuWallet` for standalone wallet management, `ZapButton` for content integration. Includes Bitcoin Taproot address derivation, UTXO management, and complete payment method fallbacks. ## Cashu Integration Architecture diff --git a/docs/WALLET_INTEGRATION.md b/docs/WALLET_INTEGRATION.md index f492442..61492b8 100644 --- a/docs/WALLET_INTEGRATION.md +++ b/docs/WALLET_INTEGRATION.md @@ -12,6 +12,41 @@ NutStack includes a comprehensive three-mode wallet system that supports multipl The `CashuWallet` component provides a complete standalone wallet interface with seamless mode switching, while the `ZapButton` component offers intelligent Lightning zaps with Cashu integration for content feeds. +## File Hierarchy + +Understanding the wallet system requires familiarity with these key directories and files: + +### Core Components +- **`src/components/wallet/CashuWallet.tsx`** - Main three-mode wallet interface (Tokens/Lightning/Bitcoin) +- **`src/components/ZapButton.tsx`** - Intelligent zap button for content feeds + +### Context & State Management +- **`src/contexts/CashuContext.tsx`** - Required context provider for Cashu wallet state +- **`src/hooks/useNpubCash.ts`** - Main hook for npub.cash integration and wallet operations + +### Cashu-Specific Hooks +- **`src/hooks/cashu/useCashu.ts`** - Core Cashu wallet functionality and balance management +- **`src/hooks/cashu/useMintManager.ts`** - Mint URL management and switching +- **`src/hooks/cashu/useWalletTransactions.ts`** - Transaction history and tracking + +### Lightning Integration +- **`src/hooks/useLightningAddress.ts`** - Lightning address resolution and invoice handling +- **`src/lib/bolt11Decoder.ts`** - Lightning invoice parsing and validation + +### Bitcoin Integration +- **`src/lib/bitcoin.ts`** - Bitcoin address derivation, UTXO management, transaction building +- **`src/hooks/useBitcoinBalance.ts`** - Bitcoin balance fetching and UTXO management +- **`src/hooks/useNsecAccess.ts`** - Private key access for Bitcoin transaction signing + +### Utility Functions +- **`src/lib/nostr.ts`** - Nostr key utilities and address derivation +- **`src/lib/lightning.ts`** - Lightning payment processing and WebLN integration + +### Key Integration Points +- **`src/hooks/useZaps.ts`** - Zap data fetching and management +- **`src/components/TransactionHistory.tsx`** - Unified transaction history display +- **`src/components/MintSelector.tsx`** - Cashu mint management interface + ### Three-Mode Architecture **Tokens Mode**: