Files
grimoire/src
Claude c832b58fd9 Add NIP-60 Cashu wallet viewer command
Implemented a new `wallet` command to view and display NIP-60 Cashu wallets stored on Nostr relays.

## Changes

### New Command: wallet
- Added `wallet [identifier]` command to man pages (src/types/man.ts)
- Supports viewing own wallet (`wallet` or `wallet $me`)
- Supports viewing other users' wallets (`wallet npub1...`, `wallet fiatjaf.com`)
- Added wallet app ID to AppId type (src/types/app.ts)

### WalletViewer Component (src/components/WalletViewer.tsx)
Created comprehensive NIP-60 wallet viewer with:

**Data Fetching:**
- Fetches kind:17375 (wallet config) using eventStore.replaceable()
- Fetches kind:7375 (token events) using eventStore.timeline()
- Fetches kind:7376 (history events) using eventStore.timeline()
- Reactive updates using applesauce-react hooks (use$)

**UI Features:**
- Wallet status display (config, tokens, history counts)
- Balance card (shows encrypted state, token count)
- Transaction history card (shows encrypted state)
- Developer info section with raw event JSON
- Educational content about NIP-60 and Cashu
- Links to compatible apps (noStrudel, Cashu.me)
- "What is NIP-60?" help section

**States Handled:**
- No active account (requires login)
- No wallet found (educational content for own wallet)
- Wallet found but encrypted (displays structure)
- Own wallet vs other user's wallet

**Security:**
- Shows wallet data is NIP-44 encrypted
- Indicates decryption functionality is planned for future
- Prevents viewing other users' encrypted wallet data
- Educational content about privacy model

### WindowRenderer Integration
- Added lazy import for WalletViewer component
- Added case for "wallet" appId in switch statement
- Passes pubkey prop to WalletViewer

## User Experience

The wallet command provides:
 Clear indication of wallet existence
 Visual feedback on encrypted state
 Event counts for transparency
 Educational content for new users
 Developer-friendly raw event inspection
 Links to specification and compatible apps

## Future Enhancements

This implementation provides the foundation for:
- NIP-44 decryption with user's private key
- Balance calculation from decrypted proofs
- Transaction history display
- Wallet management operations (pending applesauce-wallet API)

## Testing

The component:
- Handles missing account gracefully
- Displays appropriate messaging for different states
- Uses proper TypeScript types
- Follows codebase patterns (ProfileViewer, BlossomViewer)
- No TypeScript compilation errors

## Documentation Referenced

- NIP-60 specification: github.com/nostr-protocol/nips/blob/master/60.md
- .claude/skills/nostr/references/nip-60-cashu-wallet.md
- applesauce documentation: hzrd149.github.io/applesauce/
2026-01-15 12:26:58 +00:00
..
2026-01-14 19:24:37 +01:00
2026-01-14 19:24:37 +01:00
2026-01-14 19:24:37 +01:00