feat: include targetEvents in parsedZap
continuous-integration/drone/push Build is failing Details

This commit is contained in:
Kieran 2023-11-14 13:55:15 +00:00
parent e398bf8e82
commit e65845af6d
Signed by: Kieran
GPG Key ID: DE71CEB3925BE941
3 changed files with 11 additions and 4 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "@snort/system-react", "name": "@snort/system-react",
"version": "1.1.3", "version": "1.1.4",
"description": "React hooks for @snort/system", "description": "React hooks for @snort/system",
"main": "dist/index.js", "main": "dist/index.js",
"types": "dist/index.d.ts", "types": "dist/index.d.ts",
@ -16,7 +16,7 @@
], ],
"dependencies": { "dependencies": {
"@snort/shared": "^1.0.9", "@snort/shared": "^1.0.9",
"@snort/system": "^1.1.3", "@snort/system": "^1.1.4",
"react": "^18.2.0" "react": "^18.2.0"
}, },
"devDependencies": { "devDependencies": {

View File

@ -1,6 +1,6 @@
{ {
"name": "@snort/system", "name": "@snort/system",
"version": "1.1.3", "version": "1.1.4",
"description": "Snort nostr system package", "description": "Snort nostr system package",
"main": "dist/index.js", "main": "dist/index.js",
"types": "dist/index.d.ts", "types": "dist/index.d.ts",

View File

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