mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2026-08-09 08:04:45 +00:00
Wires the receiving side of NIP-XX BOLT12 zaps (kind 9736) into every place a NIP-57 lightning zap is counted or shown. Sending is intentionally left for later. Modeled on the lightning-zap scheme (synchronous, the proof carries the amount, counted the moment it validates) rather than the onchain scheme (async chain backend, PENDING/CONFIRMED, CONFIRMED-only) — BOLT12 proof verification is a self-contained synchronous check, so no resolver/backend is needed. Model (commons): - Bolt12ZapEntry + Note.bolt12Zaps map keyed by the proof's invoice_payment_hash (the spec dedup key); addBolt12Zap/removeBolt12ZapBySource; folded into updateZapTotal (millisats → sats) alongside lightning/onchain/nutzap amounts; wired into clearChildLinks, moveAllReferencesTo, removeNote, hasZapsBoostsOrReactions, hasZapped, and the isZappedBy family. Ingestion (LocalCache): - consume(Bolt12ZapEvent): validate synchronously via Bolt12ZapValidator, then addBolt12Zap on the resolved targets (e / a / profile); computeReplyTo and live-activity channel routing branches; dispatch case. Subscriptions: added kind 9736 to every filter carrying LnZapEvent.KIND (notifications, replies/reactions to notes & addresses, profile received-zaps, live-activity goal + messages, nest room + collectors, notification dispatcher, shared NotificationKinds, app-functions). Aggregation / notifications: UserProfileZapsViewModel (mapper), NotificationSummaryState (both passes), NotificationFeedFilter (kinds, zap-receipt detection, payer author resolution, muted-thread + own-event gates), NotificationKinds own-event exception, ThreadAssembler.anchorsItsOwnThread, and the commons live-activity aggregators (RoomZapsState, LiveStreamTopZappers, NestViewModel). UI: RenderBolt12Zap standalone card (styled like the lightning card, labeled BOLT12) wired into NoteCompose + ThreadFeedView; Bolt12ZapGallery in the reactions row (payer avatars + amounts, unverified/compressed proofs dimmed); reaction-row counter gate; KindNames / KindDisplayName entries. Note: validated BOLT12 zaps are counted immediately; a compressed proof whose signatures aren't yet verifiable (pending lightning/bolts#1346 merkle reconstruction) is stored with cryptoVerified=false and dimmed in the gallery. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SpgpWLKzgD7vS9Fs4CXTR3