Add zap support to link aggregator submissions and comments #17
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Add NIP-57 zap support to the Nostr feed / link aggregator module, letting users zap submissions and comments with sats. This builds on top of Lightning.Pub's existing
/.well-known/lnurlp/:usernameendpoint and zap receipt infrastructure (see #16).Motivation
The link aggregator currently has upvotes/downvotes (kind 7 reactions) but no way to tip or zap content creators. Zaps add a real economic signal — they're more meaningful than free votes and incentivize quality content. Since Lightning.Pub already handles zap requests (kind 9734), zap receipts (kind 9735), and Lightning Address resolution, the server-side work is done — this is purely a client-side feature.
Current State
+for upvote,-for downvoteVoteControls.vuerenders the upvote/downvote buttonsReactionServicetracks reaction counts and user vote stateSubmissionServicemanages feed subscriptions and event publishingPAYMENT_SERVICEandINVOICE_SERVICEDI tokens exist but are unused by the nostr-feed moduleImplementation
1. Zap button on submissions and comments
Modify:
VoteControls.vueModify:
SubmissionRow.vueandSubmissionDetail.vueModify:
SubmissionComment.vue2. Zap service
New file:
src/modules/nostr-feed/services/ZapService.tsBaseService, registers with DI containersendZap(targetEvent, amountSats):lud16tag → resolve Lightning Address/.well-known/lnurlp/:username→ get LNURL-pay infoe(target event),p(recipient pubkey),relays,amountamount+nostr(serialized zap request)PaymentService(wallet balance) or present QR for external walletgetZapReceipts(eventIds):etags matching the submission/comment IDsbolt11tag to extract amountgetZapTotal(eventId): return cached total sats zapped to an event3. Zap receipts in the feed subscription
Modify:
SubmissionService.ts4. Author Lightning Address resolution
For zaps to work, we need the recipient's Lightning Address. Options (in priority order):
/.well-known/lnurlp/:namelud16tag in kind 0 profile metadata (standard Nostr Lightning Address field)lud06tag (LNURL fallback)ProfileServicealready resolves Nostr profiles — extend it to extractlud16/lud06from kind 0 metadata.UX Flow
Dependencies
Files to create
src/modules/nostr-feed/services/ZapService.ts(~200 lines)Files to modify
src/modules/nostr-feed/components/VoteControls.vue— add zap button + amount pickersrc/modules/nostr-feed/components/SubmissionRow.vue— show zap totalsrc/modules/nostr-feed/components/SubmissionDetail.vue— show zap totalsrc/modules/nostr-feed/components/SubmissionComment.vue— add zap buttonsrc/modules/nostr-feed/services/SubmissionService.ts— subscribe to kind 9735 eventssrc/modules/nostr-feed/services/ProfileService.ts— extract lud16/lud06 from profilessrc/modules/nostr-feed/index.ts— register ZapService in module pluginsrc/modules/nostr-feed/types/submission.ts— addzapTotalfield to submission type