aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2020-05-06 14:40:40 -0400
committerAdam Soltys <[email protected]>2020-05-06 14:40:40 -0400
commitc9d85bfe0e2d77e7305461f28e83e869b525613e (patch)
tree4766a7f96d4bf018f6a891df7fa4fd40be16e5d6
parenta50b7185e6581c52dcf881f636ea1a4e70722852 (diff)
downloadcoinos-server-c9d85bfe0e2d77e7305461f28e83e869b525613e.tar.gz
coinos-server-c9d85bfe0e2d77e7305461f28e83e869b525613e.zip
more info
-rw-r--r--routes/balances.js14
1 files changed, 8 insertions, 6 deletions
diff --git a/routes/balances.js b/routes/balances.js
index 86658ed3..6b027aab 100644
--- a/routes/balances.js
+++ b/routes/balances.js
@@ -1,7 +1,7 @@
const sequelize = require("sequelize");
const { Op } = sequelize;
-app.get("/balances", async (req, res) => {
+app.get("/info", async (req, res) => {
const assets = await lq.getBalance();
const accounts = await db.Account.findAll({
attributes: [
@@ -11,7 +11,9 @@ app.get("/balances", async (req, res) => {
group: ["asset"],
});
- const balances = {
+ const info = {
+ lninfo: await lna.getInfo({}),
+ bcinfo: await bc.getNetworkInfo(),
accounts,
assets,
bitcoin: parseInt((await bc.getBalance()) * SATS),
@@ -20,15 +22,15 @@ app.get("/balances", async (req, res) => {
lnwallet: parseInt((await lna.walletBalance({})).total_balance),
};
- const { bitcoin, liquid, lnchannel, user, lnwallet } = balances;
+ const { bitcoin, liquid, lnchannel, user, lnwallet } = info;
- balances.total =
+ info.total =
parseInt(bitcoin) +
parseInt(liquid) +
parseInt(lnchannel) +
parseInt(lnwallet);
- balances.ratio = (balances.total / parseInt(user)).toFixed(2);
+ info.ratio = (info.total / parseInt(user)).toFixed(2);
- res.send(balances);
+ res.send(info);
});