aboutsummaryrefslogtreecommitdiffstats
path: root/lib/nostr.ts
diff options
context:
space:
mode:
Diffstat (limited to 'lib/nostr.ts')
-rw-r--r--lib/nostr.ts9
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/nostr.ts b/lib/nostr.ts
index d6c9c643..90c33694 100644
--- a/lib/nostr.ts
+++ b/lib/nostr.ts
@@ -6,6 +6,7 @@ import { fail, wait } from "$lib/utils";
import { nip19, finalizeEvent } from "nostr-tools";
import { emit } from "$lib/sockets";
import { hex } from "@scure/base";
+import { Relay as ntr } from 'nostr-tools/relay'
export const serverPubkey = hex.encode(
getPublicKey(nip19.decode(config.nostrKey).data),
@@ -264,9 +265,13 @@ export async function handleZap(invoice) {
tags.push(["preimage", invoice.payment_preimage]);
let ev = { pubkey, kind, created_at, content, tags };
- ev = await finalizeEvent(ev, sk);
+ let signed = await finalizeEvent(ev, sk);
l("sending receipt");
- await Promise.allSettled(relays.map((r) => send(ev, r)));
+ await Promise.allSettled(relays.map(async (url) => {
+ let r = await ntr.connect(url);
+ await r.publish(signed);
+ r.close()
+ }));
}