diff options
Diffstat (limited to 'lib/nwc.ts')
| -rw-r--r-- | lib/nwc.ts | 19 |
1 files changed, 13 insertions, 6 deletions
@@ -71,12 +71,6 @@ let handle = (method, params, user) => let invoice = await getInvoice(pr); let recipient = await g(`user:${invoice.uid}`); - if (invoice.memo.includes("9734")) { - try { - await handleZap(invoice); - } catch (e) {} - } - let { id: preimage } = await sendInternal({ amount, invoice, @@ -84,6 +78,19 @@ let handle = (method, params, user) => sender: user, }); + if (invoice.memo.includes("9734")) { + let { invoices } = await ln.listinvoices({ invstring: pr }); + let inv = invoices[0]; + inv.payment_preimage = preimage; + inv.paid_at = Math.floor(Date.now() / 1000); + try { + await handleZap(inv); + } catch (e) { + console.log("zap receipt failed", e); + } + } + + return result({ preimage }); } else { await sendLightning({ |
