From f5f34e31faf615e5b74e8ebb7d1a74af96859be0 Mon Sep 17 00:00:00 2001 From: codytseng Date: Sat, 26 Apr 2025 09:37:47 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=F0=9F=90=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/lib/event.ts | 3 +++ src/providers/NoteStatsProvider.tsx | 8 ++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/lib/event.ts b/src/lib/event.ts index e461048..1249a3f 100644 --- a/src/lib/event.ts +++ b/src/lib/event.ts @@ -419,6 +419,7 @@ export function extractZapInfoFromReceipt(receiptEvent: Event) { let senderPubkey: string | undefined let recipientPubkey: string | undefined + let originalEventId: string | undefined let eventId: string | undefined let invoice: string | undefined let amount: number | undefined @@ -436,6 +437,7 @@ export function extractZapInfoFromReceipt(receiptEvent: Event) { recipientPubkey = tagValue break case 'e': + originalEventId = tag[1] eventId = generateEventIdFromETag(tag) break case 'bolt11': @@ -467,6 +469,7 @@ export function extractZapInfoFromReceipt(receiptEvent: Event) { senderPubkey, recipientPubkey, eventId, + originalEventId, invoice, amount, comment, diff --git a/src/providers/NoteStatsProvider.tsx b/src/providers/NoteStatsProvider.tsx index cb033bc..63abb42 100644 --- a/src/providers/NoteStatsProvider.tsx +++ b/src/providers/NoteStatsProvider.tsx @@ -170,11 +170,11 @@ export function NoteStatsProvider({ children }: { children: React.ReactNode }) { if (evt.kind === kinds.Zap) { const info = extractZapInfoFromReceipt(evt) if (!info) return - const { eventId, senderPubkey, invoice, amount, comment } = info - if (!eventId || !senderPubkey) return - const newZaps = newZapsMap.get(eventId) || [] + const { originalEventId, senderPubkey, invoice, amount, comment } = info + if (!originalEventId || !senderPubkey) return + const newZaps = newZapsMap.get(originalEventId) || [] newZaps.push({ pr: invoice, pubkey: senderPubkey, amount, comment }) - newZapsMap.set(eventId, newZaps) + newZapsMap.set(originalEventId, newZaps) return } })