From fb75896a4000fa689a940d86f61824a65e13454e Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Thu, 26 Dec 2024 20:45:52 -0800 Subject: fix lookup invoice (fixes #69) --- lib/nwc.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'lib') 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, -- cgit v1.2.3