feat: include targetEvents in parsedZap

This commit is contained in:
2023-11-14 13:55:15 +00:00
parent e398bf8e82
commit e65845af6d
3 changed files with 11 additions and 4 deletions

View File

@ -51,6 +51,7 @@ export function parseZap(zapReceipt: NostrEvent): ParsedZap {
content: zapRequest.content,
errors: [],
pollOption: pollOpt ? Number(pollOpt) : undefined,
targetEvents: NostrLink.fromTags(zapRequest.tags),
};
if (findTag(zapRequest, "p") !== findTag(zapReceipt, "p")) {
ret.valid = false;
@ -75,7 +76,8 @@ export function parseZap(zapReceipt: NostrEvent): ParsedZap {
valid: false,
anonZap: false,
errors: ["invalid zap, parsing failed"],
};
targetEvents: [],
} as ParsedZap;
if (!ret.valid) {
Log("Invalid zap %O", ret);
}
@ -96,4 +98,9 @@ export interface ParsedZap {
content?: string;
sender?: string;
pollOption?: number;
/**
* A list of targets this zap is zapping
*/
targetEvents: Array<NostrLink>;
}