From c7f6f73ae783857f0b3052509ab1e7acab36eb64 Mon Sep 17 00:00:00 2001 From: zmeyer44 Date: Wed, 18 Oct 2023 17:06:15 -0400 Subject: [PATCH] fixed --- lib/actions/zap.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/actions/zap.ts b/lib/actions/zap.ts index 58a00c1..e7f7907 100644 --- a/lib/actions/zap.ts +++ b/lib/actions/zap.ts @@ -40,11 +40,15 @@ export async function checkPayment( pubkey: string, event: NostrEvent, ) { - const paymentEvent = await ndk.fetchEvent({ + console.log("CHeck payment called", tagId); + const paymentEvents = await ndk.fetchEvents({ kinds: [9735], ["#a"]: [tagId], - ["#p"]: [pubkey], }); + if (!paymentEvents) return; + const paymentEvent = Array.from(paymentEvents).find( + (e) => zapInvoiceFromEvent(e)?.zappee === pubkey, + ); console.log("paymentEvent", paymentEvent); if (!paymentEvent) return; const invoice = zapInvoiceFromEvent(paymentEvent); @@ -55,7 +59,7 @@ export async function checkPayment( } const zappedUser = ndk.getUser({ - npub: invoice.zappee, + hexpubkey: invoice.zapped, }); await zappedUser.fetchProfile(); if (!zappedUser.profile) {