diff options
| author | Adam Soltys <[email protected]> | 2025-01-21 23:28:00 -0800 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2025-01-21 23:28:00 -0800 |
| commit | 9662c2754834599a1074d12565279674c20af467 (patch) | |
| tree | 1d77aaedf19b035378236305af582c903e025467 /lib/lightning.ts | |
| parent | eb4e16b5599e67a65962db2a07629dfdcdda57dc (diff) | |
| download | coinos-server-9662c2754834599a1074d12565279674c20af467.tar.gz coinos-server-9662c2754834599a1074d12565279674c20af467.zip | |
notes and stuff
Diffstat (limited to 'lib/lightning.ts')
| -rw-r--r-- | lib/lightning.ts | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/lib/lightning.ts b/lib/lightning.ts index 19f6949d..3888a405 100644 --- a/lib/lightning.ts +++ b/lib/lightning.ts @@ -3,7 +3,7 @@ import ln from "$lib/ln"; import { err, warn } from "$lib/logging"; import { handleZap } from "$lib/nostr"; import { credit, types } from "$lib/payments"; -import { getPayment } from "$lib/utils"; +import { getPayment, getUser } from "$lib/utils"; export async function listenForLightning() { const inv = await ln.waitanyinvoice((await g("pay_index")) || 0); @@ -35,7 +35,10 @@ export async function listenForLightning() { if (invoice?.memo) { try { - if (JSON.parse(description).kind === 9734) handleZap(inv); + if (JSON.parse(description).kind === 9734) { + const { pubkey } = await getUser(invoice.uid); + handleZap(inv, pubkey); + } } catch (e) { if (!e.message.includes("Unexpected")) warn("failed to handle zap", e.message); @@ -81,7 +84,10 @@ export async function replay(index) { if (invoice?.memo) { try { - if (JSON.parse(description).kind === 9734) handleZap(inv); + if (JSON.parse(description).kind === 9734) { + const { pubkey } = await getUser(invoice.uid); + handleZap(inv, pubkey); + } } catch (e) { if (!e.message.includes("Unexpected")) warn("failed to handle zap", e.message); |
