diff options
| author | Adam Soltys <[email protected]> | 2024-10-01 18:49:58 +0000 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2024-10-01 18:49:58 +0000 |
| commit | 61148ad9ef6ba72c97caee69d490f2bb27470ced (patch) | |
| tree | fcd04c1f09b0c16e0ddfdab806b148947676f8fc /lib/nostr.ts | |
| parent | 8097f7e6e23c393a6df7c8e62ab036af31eea554 (diff) | |
| download | coinos-server-61148ad9ef6ba72c97caee69d490f2bb27470ced.tar.gz coinos-server-61148ad9ef6ba72c97caee69d490f2bb27470ced.zip | |
fake zap receipt for internal
Diffstat (limited to 'lib/nostr.ts')
| -rw-r--r-- | lib/nostr.ts | 9 |
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() + })); } |
