diff options
| author | Adam Soltys <[email protected]> | 2025-02-05 15:20:32 -0800 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2025-02-05 15:20:32 -0800 |
| commit | 084b62733b99bc3caaf4ac177e678929faf3151f (patch) | |
| tree | a140a843150eda91d4b7fa03e18e57758267bd04 | |
| parent | cf63622c234446c0a385cd792dceeb7e04ef72a0 (diff) | |
| download | coinos-server-084b62733b99bc3caaf4ac177e678929faf3151f.tar.gz coinos-server-084b62733b99bc3caaf4ac177e678929faf3151f.zip | |
use real lightning payments for mint payments
| -rw-r--r-- | lib/nwc.ts | 36 |
1 files changed, 19 insertions, 17 deletions
@@ -101,26 +101,28 @@ const handle = (method, params, user, ev) => const invoice = await getInvoice(pr); const recipient = await g(`user:${invoice.uid}`); - const { id: preimage } = await sendInternal({ - amount, - invoice, - recipient, - sender: user, - }); + if (recipient?.username !== "mint") { + const { id: preimage } = await sendInternal({ + amount, + invoice, + recipient, + sender: user, + }); - if (invoice.memo?.includes("9734")) { - const { invoices } = await ln.listinvoices({ invstring: pr }); - const inv = invoices[0]; - inv.payment_preimage = preimage; - inv.paid_at = Math.floor(Date.now() / 1000); - try { - await handleZap(inv, user.pubkey); - } catch (e) { - console.log("zap receipt failed", e); + if (invoice.memo?.includes("9734")) { + const { invoices } = await ln.listinvoices({ invstring: pr }); + const inv = invoices[0]; + inv.payment_preimage = preimage; + inv.paid_at = Math.floor(Date.now() / 1000); + try { + await handleZap(inv, user.pubkey); + } catch (e) { + console.log("zap receipt failed", e); + } } - } - return result({ preimage }); + return result({ preimage }); + } } await sendLightning({ amount, |
