aboutsummaryrefslogtreecommitdiffstats
path: root/routes/info.js
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2022-09-06 09:20:25 -0700
committerAdam Soltys <[email protected]>2022-09-06 09:20:25 -0700
commitc2464b2407ee23134732fd67586758dbfe18f9b5 (patch)
tree3e2d9f009bb325a9a7c4304ea02f6e64dda85bd1 /routes/info.js
parent8a080ef9a198799e7ee31cf81f92afd5495e4074 (diff)
downloadcoinos-server-c2464b2407ee23134732fd67586758dbfe18f9b5.tar.gz
coinos-server-c2464b2407ee23134732fd67586758dbfe18f9b5.zip
prettier
Diffstat (limited to 'routes/info.js')
-rw-r--r--routes/info.js24
1 files changed, 13 insertions, 11 deletions
diff --git a/routes/info.js b/routes/info.js
index d8785333..1b92624b 100644
--- a/routes/info.js
+++ b/routes/info.js
@@ -1,5 +1,5 @@
import app from "$app";
-import sequelize from '@sequelize/core';
+import sequelize from "@sequelize/core";
import config from "$config";
import store from "$lib/store";
import ln from "$lib/ln";
@@ -21,7 +21,7 @@ app.get("/info", async (req, res, next) => {
const info = {
nodes: store.networks,
- clientVersion,
+ clientVersion
};
res.send(info);
@@ -34,35 +34,37 @@ app.get("/balances", async (req, res, next) => {
"pubkey",
[sequelize.fn("sum", sequelize.col("balance")), "total"]
],
- group: ["asset", "pubkey"],
+ group: ["asset", "pubkey"]
});
- let lnchannel;
+ let lnchannel;
let lnwallet;
if (config.lna) {
if (config.lna.clightning) {
const funds = await lna.listfunds();
- lnchannel = parseInt(funds.channels.reduce((a, b) => a + b.channel_sat, 0));
+ lnchannel = parseInt(
+ funds.channels.reduce((a, b) => a + b.channel_sat, 0)
+ );
lnwallet = parseInt(funds.outputs.reduce((a, b) => a + b.value, 0));
} else {
- lnchannel = parseInt((await getChannelBalance({ lnd }).channel_balance));
- lnwallet = parseInt((await getChainBalance({ lnd }).chain_balance));
- }
+ lnchannel = parseInt(await getChannelBalance({ lnd }).channel_balance);
+ lnwallet = parseInt(await getChainBalance({ lnd }).chain_balance);
+ }
}
let bitcoin, bitcoind;
if (config.bitcoin) {
bitcoin = parseInt((await bc.getBalance()) * SATS);
bitcoind = await bc.getNetworkInfo();
- }
+ }
let assets, liquid, elementsd;
if (config.liquid) {
assets = await lq.getBalance();
liquid = parseInt(assets.bitcoin * SATS);
elementsd = await lq.getNetworkInfo();
- }
+ }
const info = {
bitcoind,
@@ -72,7 +74,7 @@ app.get("/balances", async (req, res, next) => {
bitcoin,
liquid,
lnchannel,
- lnwallet,
+ lnwallet
};
info.total =