feat: add marker param to toEventTag

This commit is contained in:
Kieran 2023-12-07 16:17:21 +00:00
parent a124d49a64
commit bcab6b0f0e
Signed by: Kieran
GPG Key ID: DE71CEB3925BE941
3 changed files with 11 additions and 3 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "@snort/system-react", "name": "@snort/system-react",
"version": "1.1.6", "version": "1.1.7",
"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",

View File

@ -1,6 +1,6 @@
{ {
"name": "@snort/system", "name": "@snort/system",
"version": "1.1.6", "version": "1.1.7",
"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

@ -52,8 +52,16 @@ export class NostrLink implements ToNostrEventTag {
} }
} }
toEventTag() { toEventTag(marker?: string) {
const relayEntry = this.relays ? [this.relays[0]] : []; const relayEntry = this.relays ? [this.relays[0]] : [];
if (marker) {
if (relayEntry.length === 0) {
relayEntry.push("");
}
relayEntry.push(marker);
}
if (this.type === NostrPrefix.PublicKey || this.type === NostrPrefix.Profile) { if (this.type === NostrPrefix.PublicKey || this.type === NostrPrefix.Profile) {
return ["p", this.id, ...relayEntry]; return ["p", this.id, ...relayEntry];
} else if (this.type === NostrPrefix.Note || this.type === NostrPrefix.Event) { } else if (this.type === NostrPrefix.Note || this.type === NostrPrefix.Event) {