From 76c0a2a00eaa4f6b77cb34290e207c78fea971f8 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Sat, 16 Nov 2024 23:33:25 -0800 Subject: bolt12 pay --- lib/payments.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'lib') diff --git a/lib/payments.ts b/lib/payments.ts index 4a394469..ae36725b 100644 --- a/lib/payments.ts +++ b/lib/payments.ts @@ -425,10 +425,11 @@ export const sendLightning = async ({ fail("Invalid amount"); } - let total = amount; + const total = amount; const decoded = await ln.decode(pr); - const { amount_msat } = decoded; - if (amount_msat) total = Math.round(amount_msat / 1000); + const amount_msat = decoded.type.includes("bolt12") + ? decoded.invoice_amount_msat + : decoded.amount_msat; if (maxfee) maxfee = parseInt(maxfee); if (maxfee < 0) fail("Max fee cannot be negative"); -- cgit v1.2.3