aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2023-04-04 00:05:39 -0700
committerAdam Soltys <[email protected]>2023-04-04 00:05:39 -0700
commit8b67a32b6ffc87b14ef1fa26b6596695419b8e3e (patch)
tree86f7acca86021d5a1cc02aae0f6d4edefe60376c /lib
parent0aea60330afff02ad8bb525c5fddd7c367abf03a (diff)
downloadcoinos-server-8b67a32b6ffc87b14ef1fa26b6596695419b8e3e.tar.gz
coinos-server-8b67a32b6ffc87b14ef1fa26b6596695419b8e3e.zip
prettier
Diffstat (limited to 'lib')
-rw-r--r--lib/invoices.js2
-rw-r--r--lib/lightning.js2
-rw-r--r--lib/payments.js6
-rw-r--r--lib/rates.js6
-rw-r--r--lib/utils.js18
5 files changed, 17 insertions, 17 deletions
diff --git a/lib/invoices.js b/lib/invoices.js
index 74870f82..9aade609 100644
--- a/lib/invoices.js
+++ b/lib/invoices.js
@@ -63,7 +63,7 @@ export let generate = async ({ invoice, user, sender, memo }) => {
text,
tip,
type,
- uid: user.id
+ uid: user.id,
};
l("creating invoice", user.username, amount, tip, currency, invoice.hash);
diff --git a/lib/lightning.js b/lib/lightning.js
index 7ef62cc9..e4a2bbd9 100644
--- a/lib/lightning.js
+++ b/lib/lightning.js
@@ -15,7 +15,7 @@ export async function listenForLightning() {
pay_index,
status,
msatoshi_received,
- payment_preimage: preimage
+ payment_preimage: preimage,
} = event;
await s("pay_index", pay_index);
diff --git a/lib/payments.js b/lib/payments.js
index 5dc24c9b..7eab01b0 100644
--- a/lib/payments.js
+++ b/lib/payments.js
@@ -13,7 +13,7 @@ export const types = {
bitcoin: "bitcoin",
lightning: "lightning",
pot: "pot",
- classic: "classic"
+ classic: "classic",
};
export let debit = async (
@@ -89,7 +89,7 @@ export let debit = async (
type,
ref,
tip,
- created: Date.now()
+ created: Date.now(),
};
await s(`payment:${id}`, p);
@@ -136,7 +136,7 @@ export let credit = async (hash, amount, memo, ref, type = types.internal) => {
tip,
type,
confirmed: true,
- created: Date.now()
+ created: Date.now(),
};
invoice.received += amount;
diff --git a/lib/rates.js b/lib/rates.js
index 362aaa98..0b2daab2 100644
--- a/lib/rates.js
+++ b/lib/rates.js
@@ -15,11 +15,11 @@ let connect = async () => {
ws = new WebSocket("wss://stream.binance.com:9443/ws/btcusdt@ticker");
- ws.onmessage = async function(event) {
+ ws.onmessage = async function (event) {
try {
let msg = JSON.parse(event.data);
- Object.keys(store.fx).map(symbol => {
+ Object.keys(store.fx).map((symbol) => {
store.rates[symbol] = msg.c * store.fx[symbol];
});
@@ -31,7 +31,7 @@ let connect = async () => {
}
};
- ws.onerror = async function(error) {
+ ws.onerror = async function (error) {
err("binance socket error", error.message);
};
diff --git a/lib/utils.js b/lib/utils.js
index 05819ecb..1e12214b 100644
--- a/lib/utils.js
+++ b/lib/utils.js
@@ -4,7 +4,7 @@ import config from "$config";
export const nada = () => {};
-export const sleep = n => new Promise(r => setTimeout(r, n));
+export const sleep = (n) => new Promise((r) => setTimeout(r, n));
export const wait = async (f, s = 300, n = 50) => {
let i = 0;
while (!(await f()) && i < s) (await sleep(n)) && i++;
@@ -13,17 +13,17 @@ export const wait = async (f, s = 300, n = 50) => {
};
export const prod = process.env.NODE_ENV === "production";
-export const fail = msg => {
+export const fail = (msg) => {
throw new Error(msg);
};
export const bail = (res, msg) => res.code(500).send(msg);
export const SATS = 100000000;
-export const sats = n => Math.round(n * SATS);
-export const btc = n => parseFloat((n / SATS).toFixed(8));
+export const sats = (n) => Math.round(n * SATS);
+export const btc = (n) => parseFloat((n / SATS).toFixed(8));
-export const uniq = (a, k) => [...new Map(a.map(x => [k(x), x])).values()];
+export const uniq = (a, k) => [...new Map(a.map((x) => [k(x), x])).values()];
export const pick = (O, K) =>
K.reduce((o, k) => (typeof O[k] !== "undefined" && (o[k] = O[k]), o), {});
@@ -53,11 +53,11 @@ export const fields = [
"haspin",
"profile",
"prompt",
- "banner"
+ "banner",
];
-export const getUser = async username => {
- username = username.replace(/\s/g, "").toLowerCase()
- let uid = await g(`user:${username}`);
+export const getUser = async (username) => {
+ username = username.replace(/\s/g, "").toLowerCase();
+ let uid = await g(`user:${username}`);
return g(`user:${uid}`);
};