diff --git a/packages/system/src/zaps.ts b/packages/system/src/zaps.ts index bf9a65b5..fb4c321e 100644 --- a/packages/system/src/zaps.ts +++ b/packages/system/src/zaps.ts @@ -1,9 +1,13 @@ import { FeedCache } from "@snort/shared"; -import { sha256, decodeInvoice, InvoiceDetails } from "@snort/shared"; -import { HexKey, NostrEvent } from "./nostr"; +import { decodeInvoice, InvoiceDetails } from "@snort/shared"; +import { NostrEvent } from "./nostr"; import { findTag } from "./utils"; import { MetadataCache } from "./cache"; +import { EventExt } from "./event-ext"; +import { NostrLink } from "./nostr-link"; +import debug from "debug"; +const Log = debug("zaps"); const ParsedZapCache = new Map(); function getInvoice(zap: NostrEvent): InvoiceDetails | undefined { @@ -32,15 +36,17 @@ export function parseZap(zapReceipt: NostrEvent, userCache: FeedCache a[0] === "zap") ?? false; const anonZap = zapRequest.tags.find(a => a[0] === "anon"); - const metaHash = sha256(innerZapJson); const pollOpt = zapRequest.tags.find(a => a[0] === "poll_option")?.[1]; const ret: ParsedZap = { id: zapReceipt.id, zapService: zapReceipt.pubkey, amount: (invoice?.amount ?? 0) / 1000, - event: findTag(zapRequest, "e"), + event: requestContext ? NostrLink.fromThreadTag(requestContext) : undefined, sender: zapRequest.pubkey, receiver: findTag(zapRequest, "p"), valid: true, @@ -49,18 +55,10 @@ export function parseZap(zapReceipt: NostrEvent, userCache: FeedCache; + + anonZap: boolean; + event?: NostrLink; + receiver?: string; + content?: string; + sender?: string; pollOption?: number; }