aboutsummaryrefslogtreecommitdiffstats
path: root/routes/info.js
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2022-09-02 14:47:08 -0700
committerAdam Soltys <[email protected]>2022-09-02 14:47:14 -0700
commit3161dd7ee95b6c7d70f8341298dd4fab84cda8b0 (patch)
tree16cd6c55d5dc481331b1e8b640d179f193e7ea13 /routes/info.js
parent7a8d64833de8873afb92982b3f5bfff59b30c542 (diff)
downloadcoinos-server-3161dd7ee95b6c7d70f8341298dd4fab84cda8b0.tar.gz
coinos-server-3161dd7ee95b6c7d70f8341298dd4fab84cda8b0.zip
es6 migration
Diffstat (limited to 'routes/info.js')
-rw-r--r--routes/info.js15
1 files changed, 8 insertions, 7 deletions
diff --git a/routes/info.js b/routes/info.js
index 0be7f27d..537cdc44 100644
--- a/routes/info.js
+++ b/routes/info.js
@@ -1,4 +1,5 @@
-import sequelize from 'sequelize';
+import app from "../app.js";
+import sequelize from '@sequelize/core';
const { Op } = sequelize;
/**
@@ -10,7 +11,7 @@ const { Op } = sequelize;
* @apiSuccess {String[]} networks Array of supported networks; possible values are "bitcoin", "liquid" and "lightning".
* @apiSuccess {String} clientVersion the current git commit of the ui
*/
-app.get("/info", ah(async (req, res, next) => {
+app.get("/info", async (req, res, next) => {
const { clientVersion } = config;
const info = {
@@ -20,9 +21,9 @@ app.get("/info", ah(async (req, res, next) => {
};
res.send(info);
-}));
+});
-app.get("/balances", ah(async (req, res, next) => {
+app.get("/balances", async (req, res, next) => {
const accounts = await db.Account.findAll({
attributes: [
"asset",
@@ -44,8 +45,8 @@ app.get("/balances", ah(async (req, res, next) => {
lnwallet = parseInt(funds.outputs.reduce((a, b) => a + b.value, 0));
} else {
lninfo = await lnp.getInfo({});
- lnchannel = parseInt((await lnp.channelBalance({})).balance);
- lnwallet = parseInt((await lnp.walletBalance({})).total_balance);
+ lnchannel = parseInt((await lnp.channelBalance({}).balance));
+ lnwallet = parseInt((await lnp.walletBalance({}).total_balance));
}
}
@@ -80,4 +81,4 @@ app.get("/balances", ah(async (req, res, next) => {
parseInt(lnwallet);
res.send(info);
-}));
+});