Enable real-time fight spectating for all live fights (not just human fights). Multiple spectators can watch simultaneously via SSE. Spectator count is tracked per-fight and broadcast with every SSE event. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
37 lines
1.8 KiB
Markdown
37 lines
1.8 KiB
Markdown
# Plan: Create Zaps.md Implementation Guide
|
|
|
|
## Context
|
|
The user wants a `Zaps.md` planning document at the project root that serves as a comprehensive implementation guide for a future Claude session. When the user says "implement zaps", Claude reads this doc and knows exactly what to build.
|
|
|
|
## What to create
|
|
- **File**: `/Users/dorian/Projects/botfights/Zaps.md`
|
|
|
|
## Key design decisions from research
|
|
|
|
### Payment model: NWC (primary) + Cashu (alternative)
|
|
- NWC (NIP-47): User connects Lightning wallet once. Server sends encrypted payment requests via Nostr relay. Use nostr-tools directly (no Alby SDK) for privacy.
|
|
- Cashu ecash: Alternative — user pastes ecash token, server redeems with mint.
|
|
- Server wallet: Small Lightning wallet (Alby Hub or LNbits) via `BOTFIGHTS_NWC_URL` env var. Transient escrow only (seconds, not balances).
|
|
|
|
### Two modes: Free (unchanged) + Ranked (new, 21 sats)
|
|
- Ranked: both pay 21 sats → winner gets 42 sats
|
|
- Ranked queue never matches against mock bots
|
|
- Timeout = refund (not mock fallback)
|
|
|
|
### New files needed
|
|
- DB tables: `payments`, `wallet_connections` + new columns on fights/bots
|
|
- Server: `engine/payments.ts`, `engine/ranked-queue.ts`, `routes/payments.ts`
|
|
- Frontend: `composables/useWallet.ts`, `components/WalletConnect.vue`
|
|
- Modifications to: orchestrator, queue routes, JoinBoutPage, FightPage, BotProfilePage, schema
|
|
|
|
### Dependencies (all MIT)
|
|
- `nostr-tools` ^2.x — NWC protocol
|
|
- `@cashu/cashu-ts` ^2.x — ecash tokens
|
|
|
|
## Implementation
|
|
Write Zaps.md with full architecture, schema SQL, function signatures, edge cases, phases, and security notes — enough for a fresh Claude session to implement from.
|
|
|
|
## Verification
|
|
- Read the written Zaps.md and confirm completeness
|
|
- Ensure all file paths match actual codebase structure
|