mirror of
https://github.com/purrgrammer/grimoire.git
synced 2026-04-11 07:56:50 +02:00
c832b58fd9b4bb501b1dcc8d3dfe5edd824da61f
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/
Grimoire
A Nostr protocol explorer and developer tool with a tiling window manager interface.
Features
- Tiling Windows - Each window is a Nostr "app" (profile viewer, event feed, NIP docs, etc.)
- Command Palette - Unix-style commands via
Cmd+Kto open apps and navigate - Multi-workspace - Virtual desktops with independent layouts
- Real-time - Reactive event subscriptions with automatic updates
Stack
React 19, TypeScript, Vite, TailwindCSS, Jotai, Dexie, Applesauce
Getting Started
npm install
npm run dev
Scripts
| Command | Description |
|---|---|
npm run dev |
Start dev server |
npm run build |
Build for production |
npm test |
Run tests in watch mode |
npm run lint |
Lint code |
npm run format |
Format code |
License
MIT
Languages
TypeScript
98.9%
CSS
0.8%
JavaScript
0.3%