fixed
This commit is contained in:
parent
a6d6384e8c
commit
c7f6f73ae7
@ -40,11 +40,15 @@ export async function checkPayment(
|
|||||||
pubkey: string,
|
pubkey: string,
|
||||||
event: NostrEvent,
|
event: NostrEvent,
|
||||||
) {
|
) {
|
||||||
const paymentEvent = await ndk.fetchEvent({
|
console.log("CHeck payment called", tagId);
|
||||||
|
const paymentEvents = await ndk.fetchEvents({
|
||||||
kinds: [9735],
|
kinds: [9735],
|
||||||
["#a"]: [tagId],
|
["#a"]: [tagId],
|
||||||
["#p"]: [pubkey],
|
|
||||||
});
|
});
|
||||||
|
if (!paymentEvents) return;
|
||||||
|
const paymentEvent = Array.from(paymentEvents).find(
|
||||||
|
(e) => zapInvoiceFromEvent(e)?.zappee === pubkey,
|
||||||
|
);
|
||||||
console.log("paymentEvent", paymentEvent);
|
console.log("paymentEvent", paymentEvent);
|
||||||
if (!paymentEvent) return;
|
if (!paymentEvent) return;
|
||||||
const invoice = zapInvoiceFromEvent(paymentEvent);
|
const invoice = zapInvoiceFromEvent(paymentEvent);
|
||||||
@ -55,7 +59,7 @@ export async function checkPayment(
|
|||||||
}
|
}
|
||||||
|
|
||||||
const zappedUser = ndk.getUser({
|
const zappedUser = ndk.getUser({
|
||||||
npub: invoice.zappee,
|
hexpubkey: invoice.zapped,
|
||||||
});
|
});
|
||||||
await zappedUser.fetchProfile();
|
await zappedUser.fetchProfile();
|
||||||
if (!zappedUser.profile) {
|
if (!zappedUser.profile) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user