From 9fa5c7475a43588126e4d809fcdea0c7cedd3d8c Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Tue, 30 Jan 2024 00:13:29 +0000 Subject: amount in msats --- lib/payments.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/payments.js b/lib/payments.js index 461b07c1..7d8bafb0 100644 --- a/lib/payments.js +++ b/lib/payments.js @@ -222,6 +222,7 @@ export let autowithdraw = async (user) => { let to = destination.trim(); let balance = await g(`balance:${id}`); let amount = balance - reserve; + console.log("AMT", amount, balance, reserve, threshold); if (balance > threshold) await pay({ amount, to, user }); } } catch (e) { @@ -245,12 +246,10 @@ let pay = async ({ amount, to, user }) => { if (lnurl) { amount -= maxfee; let { callback } = await got(lnurl).json(); - ({ pr } = await got(`${callback}?amount=${amount}`).json()); + ({ pr } = await got(`${callback}?amount=${amount * 1000}`).json()); } else if (to.startsWith("ln")) { - try { - await ln.decode(to); + amount -= maxfee; pr = to; - } catch (e) {} } if (pr) await sendLightning({ user, pr, amount, maxfee }); -- cgit v1.2.3