aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2024-12-26 20:45:52 -0800
committerAdam Soltys <[email protected]>2024-12-26 20:45:52 -0800
commitfb75896a4000fa689a940d86f61824a65e13454e (patch)
tree87e15c4ab6db98eff451604ce63acf8d76ec32c6
parentcc0e94b7db8ec2e8adefc4f9145b0061684dba96 (diff)
downloadcoinos-server-fb75896a4000fa689a940d86f61824a65e13454e.tar.gz
coinos-server-fb75896a4000fa689a940d86f61824a65e13454e.zip
fix lookup invoice (fixes #69)
-rw-r--r--lib/nwc.ts10
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/nwc.ts b/lib/nwc.ts
index 626c7ed0..96be559a 100644
--- a/lib/nwc.ts
+++ b/lib/nwc.ts
@@ -212,7 +212,7 @@ const handle = (method, params, user, ev) =>
},
async lookup_invoice() {
- const { invoice, payment_hash } = params;
+ let { invoice, payment_hash } = params;
const { invoices } = await ln.listinvoices({
invstring: invoice,
@@ -224,15 +224,17 @@ const handle = (method, params, user, ev) =>
amount_received_msat: amount,
description,
expires_at,
- preimage,
+ payment_preimage,
paid_at: settled_at,
} = invoices[0];
+ ({ bolt11: invoice, payment_hash } = invoices[0]);
+
return result({
type: "incoming",
invoice,
description,
- preimage,
+ preimage: payment_preimage,
payment_hash,
amount,
fees_paid: 0,
@@ -255,6 +257,8 @@ const handle = (method, params, user, ev) =>
completed_at: settled_at,
} = pays[0];
+ ({ bolt11: invoice, payment_hash } = pays[0]);
+
return result({
type: "outgoing",
invoice,