aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2024-01-23 15:22:05 -0800
committerAdam Soltys <[email protected]>2024-01-23 15:22:08 -0800
commit9c7d46dbd78e4ba217adbc9d48fbd6e91f5fad99 (patch)
tree7637d90396c0006527c44a0e69cf6f2f2a7aa0b3 /lib
parent05967b7d4b004860113ea44cf1b01b9135437f1e (diff)
downloadcoinos-server-9c7d46dbd78e4ba217adbc9d48fbd6e91f5fad99.tar.gz
coinos-server-9c7d46dbd78e4ba217adbc9d48fbd6e91f5fad99.zip
format
Diffstat (limited to 'lib')
-rw-r--r--lib/auth.js3
-rw-r--r--lib/invoices.js4
-rw-r--r--lib/payments.js15
3 files changed, 9 insertions, 13 deletions
diff --git a/lib/auth.js b/lib/auth.js
index 1eca2fa5..944cc3b2 100644
--- a/lib/auth.js
+++ b/lib/auth.js
@@ -22,8 +22,7 @@ export const auth = {
};
export const requirePin = async ({ body, user }) => {
- if (!user || (user.pin && user.pin !== body.pin))
- fail("Invalid pin");
+ if (!user || (user.pin && user.pin !== body.pin)) fail("Invalid pin");
};
export const jwtStrategy = new jwt.Strategy(
diff --git a/lib/invoices.js b/lib/invoices.js
index 8023bdbb..8ac8a868 100644
--- a/lib/invoices.js
+++ b/lib/invoices.js
@@ -47,7 +47,7 @@ export let generate = async ({ invoice, user, sender, memo }) => {
description: memo || "",
expiry: expiry || 60 * 60 * 24 * 30,
deschashonly: true,
- cltv: 19
+ cltv: 19,
});
hash = r.bolt11;
@@ -84,8 +84,6 @@ export let generate = async ({ invoice, user, sender, memo }) => {
webhook,
};
- if (!user.username === 'lightningins') l(type, "invoice", user.username, amount);
-
if (type === "liquid") {
let { unconfidential } = await lq.getAddressInfo(hash);
await s(`invoice:${unconfidential}`, id);
diff --git a/lib/payments.js b/lib/payments.js
index 8da04b38..550e3791 100644
--- a/lib/payments.js
+++ b/lib/payments.js
@@ -72,7 +72,7 @@ export let debit = async ({
? Math.round(amount * config.fee)
: 0;
- let r = await db.debit(
+ let r = await db.debit(
`balance:${uid}`,
`credit:${type}:${uid}`,
amount || 0,
@@ -89,7 +89,7 @@ export let debit = async ({
amount: -amount,
fee,
hash,
- ourfee: r.ourfee,
+ ourfee: r.ourfee,
memo,
iid,
uid,
@@ -188,9 +188,6 @@ export let credit = async (hash, amount, memo, ref, type = types.internal) => {
.incrBy(`${balance}:${uid}`, amount)
.exec();
- if (!username.startsWith("lightning"))
- l(username, "received", type, amount, tip);
-
emit(uid, "payment", p);
notify(user, `Received ${amount} sats`);
callWebhook(invoice, p);
@@ -383,7 +380,10 @@ export let build = async ({ amount, address, feeRate }, user) => {
let balance = await g(`balance:${user.id}`);
if (amount + fee + ourfee > balance) {
- if (amount <= fee + ourfee + dust) fail(`insufficient funds ⚡️${balance} of ⚡️${amount + fee + ourfee + dust}`);
+ if (amount <= fee + ourfee + dust)
+ fail(
+ `insufficient funds ⚡️${balance} of ⚡️${amount + fee + ourfee + dust}`,
+ );
outs = [{ [address]: btc(amount - ourfee) }];
raw = await node.createRawTransaction([], outs, 0, replaceable);
@@ -403,7 +403,7 @@ export let build = async ({ amount, address, feeRate }, user) => {
let seen;
export let catchUp = async () => {
try {
- if (!seen) seen = await db.sMembers("missing");
+ if (!seen) seen = await db.sMembers("missing");
let txns = [];
for (let [type, n] of Object.entries({ bitcoin: bc, liquid: lq })) {
txns.push(
@@ -432,4 +432,3 @@ export let catchUp = async () => {
setTimeout(catchUp, 2000);
};
-