aboutsummaryrefslogtreecommitdiffstats
path: root/lib/payments.js
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2024-01-30 00:13:29 +0000
committerAdam Soltys <[email protected]>2024-01-30 00:13:29 +0000
commit9fa5c7475a43588126e4d809fcdea0c7cedd3d8c (patch)
treedd7a6ec44abd8fa73308940e7adc788761a9638d /lib/payments.js
parente879b16e5f7f3f6ffae86d3eaa208991e574f5fc (diff)
downloadcoinos-server-9fa5c7475a43588126e4d809fcdea0c7cedd3d8c.tar.gz
coinos-server-9fa5c7475a43588126e4d809fcdea0c7cedd3d8c.zip
amount in msats
Diffstat (limited to 'lib/payments.js')
-rw-r--r--lib/payments.js7
1 files 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 });