diff options
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/binance.js | 2 | ||||
| -rw-r--r-- | lib/buildliquidtx.js | 2 | ||||
| -rw-r--r-- | lib/persist.js | 4 | ||||
| -rw-r--r-- | lib/rates.js | 4 | ||||
| -rw-r--r-- | lib/rpc.js | 3 | ||||
| -rw-r--r-- | lib/send.js | 10 | ||||
| -rw-r--r-- | lib/sendInternal.js | 17 | ||||
| -rw-r--r-- | lib/sockets.js | 2 | ||||
| -rw-r--r-- | lib/utils.js | 5 |
9 files changed, 24 insertions, 25 deletions
diff --git a/lib/binance.js b/lib/binance.js index f81c8cc3..9f7f149f 100644 --- a/lib/binance.js +++ b/lib/binance.js @@ -28,7 +28,7 @@ export default () => { }; binance.onerror = async function(error) { - console.log(error) + console.log(error); err("binance socket error", error.message); }; diff --git a/lib/buildliquidtx.js b/lib/buildliquidtx.js index f2dce6e1..bd1a2b00 100644 --- a/lib/buildliquidtx.js +++ b/lib/buildliquidtx.js @@ -1,7 +1,7 @@ import store from "./store"; import { prod } from "./utils"; import axios from "axios"; -import liquid from 'liquidjs-lib'; +import liquid from "liquidjs-lib"; import coinselect from "coinselect"; import split from "coinselect/split"; const api = prod diff --git a/lib/persist.js b/lib/persist.js index 12020283..fd6fb146 100644 --- a/lib/persist.js +++ b/lib/persist.js @@ -4,7 +4,9 @@ export default (path, initial = {}) => { if (!initial || !Object.keys(initial).length) { try { initial = JSON.parse(fs.readFileSync("/app/" + path)); - } catch (e) { console.log(e) } + } catch (e) { + console.log(e); + } } return new Proxy(initial, { diff --git a/lib/rates.js b/lib/rates.js index a4a620ea..e896c8cc 100644 --- a/lib/rates.js +++ b/lib/rates.js @@ -31,7 +31,9 @@ let fetchRates; try { let { data: { rates: fx } - } = await axios.get(`https://api.exchangerate.host/latest?base=USD&v={(new Date()).toISOString().split('T')[0]}`); + } = await axios.get( + `https://api.exchangerate.host/latest?base=USD&v={(new Date()).toISOString().split('T')[0]}` + ); fs.writeFileSync("fx", JSON.stringify({ date, fx })); } catch (e) { try { @@ -18,8 +18,7 @@ export default ({ host, port, wallet, username, password }) => method, params }) - .json(({ result }) => result) + .json(({ result }) => result); })(prop.toLowerCase(), ...params) - } ); diff --git a/lib/send.js b/lib/send.js index e7255219..5997b379 100644 --- a/lib/send.js +++ b/lib/send.js @@ -68,10 +68,7 @@ export default async (amount, memo, hash, user) => { conversionFeeDeduction = Math.min(account.lightning_credits, conversionFee); total = amount + conversionFee - conversionFeeDeduction; - if ( - !account || - account.balance < total - ) { + if (!account || account.balance < total) { warn( "user attempting to send more than they have", user.id, @@ -104,7 +101,10 @@ export default async (amount, memo, hash, user) => { ({ fee, secret, tokens: total } = m); preimage = secret.toString("hex"); } else { - let { msatoshi, msatoshi_sent, payment_preimage } = await ln.pay(hash, tokens ? `${tokens}sats` : undefined); + let { msatoshi, msatoshi_sent, payment_preimage } = await ln.pay( + hash, + tokens ? `${tokens}sats` : undefined + ); preimage = payment_preimage; fee = parseInt((msatoshi_sent - msatoshi) / 1000); total = parseInt(msatoshi / 1000); diff --git a/lib/sendInternal.js b/lib/sendInternal.js index 80701ca3..fbe4d95f 100644 --- a/lib/sendInternal.js +++ b/lib/sendInternal.js @@ -10,15 +10,11 @@ import { sendLiquid } from "$routes/liquid/send"; import { l, err } from "$lib/logging"; import { fail } from "$lib/utils"; -export default async ({ - amount, - address, - payreq, - unconfidential, - asset, - memo, - username, -}, hostname, user) => { +export default async ( + { amount, address, payreq, unconfidential, asset, memo, username }, + hostname, + user +) => { amount = parseInt(amount); if (!asset) asset = config.liquid.btcasset; @@ -209,9 +205,8 @@ export default async ({ l("received internal", recipient.username, amount); notify(recipient, `Received ${amount} ${a2.ticker} sats`); callWebhook(invoice, p2); - } - return payment; + return payment; }); }; diff --git a/lib/sockets.js b/lib/sockets.js index 33d1d208..a8428d2f 100644 --- a/lib/sockets.js +++ b/lib/sockets.js @@ -135,7 +135,7 @@ app.register(async function(app) { }); let accounts = await user.getAccounts(); - + let keys = await user.getKeys(); user = user.get({ plain: true }); user.accounts = accounts; diff --git a/lib/utils.js b/lib/utils.js index 036ccd6d..2941bf9d 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -162,8 +162,9 @@ export const derivePayRequest = async ({ amount, memo, tip }) => { if (config.lna.clightning) { if (!memo) memo = "coinos"; - return (await ln.invoice(value ? `${value}sat` : "any", new Date(), memo, 360)) - .bolt11; + return ( + await ln.invoice(value ? `${value}sat` : "any", new Date(), memo, 360) + ).bolt11; } else { return ( await createInvoice({ |
