aboutsummaryrefslogtreecommitdiffstats
path: root/lib/nwc.ts
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2024-10-01 18:49:58 +0000
committerAdam Soltys <[email protected]>2024-10-01 18:49:58 +0000
commit61148ad9ef6ba72c97caee69d490f2bb27470ced (patch)
treefcd04c1f09b0c16e0ddfdab806b148947676f8fc /lib/nwc.ts
parent8097f7e6e23c393a6df7c8e62ab036af31eea554 (diff)
downloadcoinos-server-61148ad9ef6ba72c97caee69d490f2bb27470ced.tar.gz
coinos-server-61148ad9ef6ba72c97caee69d490f2bb27470ced.zip
fake zap receipt for internal
Diffstat (limited to 'lib/nwc.ts')
-rw-r--r--lib/nwc.ts19
1 files changed, 13 insertions, 6 deletions
diff --git a/lib/nwc.ts b/lib/nwc.ts
index e889dfdf..2b2649a6 100644
--- a/lib/nwc.ts
+++ b/lib/nwc.ts
@@ -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({