From 8fd84ad1fca8c76a619569a0e2eb06a023a2f6a4 Mon Sep 17 00:00:00 2001 From: Evan Feenstra Date: Mon, 9 Nov 2020 19:19:17 -0800 Subject: [PATCH 1/5] chan reserve to balance --- dist/src/controllers/details.js | 23 ++++++++++----------- dist/src/controllers/details.js.map | 2 +- dist/src/utils/lightning.js | 32 +++++++++++++++++++++++++++++ dist/src/utils/lightning.js.map | 2 +- src/controllers/details.ts | 23 ++++++++++----------- src/utils/lightning.ts | 28 +++++++++++++++++++++++++ 6 files changed, 84 insertions(+), 26 deletions(-) diff --git a/dist/src/controllers/details.js b/dist/src/controllers/details.js index dc08585..89d3391 100644 --- a/dist/src/controllers/details.js +++ b/dist/src/controllers/details.js @@ -95,18 +95,17 @@ exports.getBalance = (req, res) => __awaiter(void 0, void 0, void 0, function* ( date.setMilliseconds(0); const owner = yield models_1.models.Contact.findOne({ where: { isOwner: true } }); owner.update({ lastActive: date }); - const lightning = lightning_1.loadLightning(); - var request = {}; - lightning.channelBalance(request, function (err, response) { - res.status(200); - if (err == null) { - res.json({ success: true, response }); - } - else { - res.json({ success: false }); - } - res.end(); - }); + res.status(200); + try { + const response = yield lightning_1.channelBalance(); + const channelList = yield lightning_1.listChannels(); + const { channels } = channelList; + response.reserve = channels.reduce((a, chan) => a + parseInt(chan.local_constraints.chan_reserve_sat), 0); + } + catch (e) { + res.json({ success: false }); + } + res.end(); }); exports.getLocalRemoteBalance = (req, res) => __awaiter(void 0, void 0, void 0, function* () { const lightning = lightning_1.loadLightning(); diff --git a/dist/src/controllers/details.js.map b/dist/src/controllers/details.js.map index 3bc9bb4..864aea7 100644 --- a/dist/src/controllers/details.js.map +++ b/dist/src/controllers/details.js.map @@ -1 +1 @@ -{"version":3,"file":"details.js","sourceRoot":"","sources":["../../../src/controllers/details.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,kDAA8D;AAC9D,sCAA+C;AAC/C,iDAAgD;AAChD,gDAA6C;AAC7C,6BAA4B;AAC5B,4CAAoC;AAC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B,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;IACf,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IACd,GAAG,CAAC,GAAG,EAAE,CAAA;AACV,CAAC,CAAA,CAAA;AAED,SAAe,YAAY,CAAC,KAAK,EAAE,QAAQ;;QAC1C,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,KAAK,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE;YAClD,MAAM,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;SAC3C;IACF,CAAC;CAAA"} \ No newline at end of file diff --git a/dist/src/utils/lightning.js b/dist/src/utils/lightning.js index f21e342..7df10fc 100644 --- a/dist/src/utils/lightning.js +++ b/dist/src/utils/lightning.js @@ -443,6 +443,38 @@ function getInfo() { }); } exports.getInfo = getInfo; +function listChannels() { + return __awaiter(this, void 0, void 0, function* () { + return new Promise((resolve, reject) => { + const lightning = loadLightning(); + lightning.listChannels({}, function (err, response) { + if (err == null) { + resolve(response); + } + else { + reject(err); + } + }); + }); + }); +} +exports.listChannels = listChannels; +function channelBalance() { + return __awaiter(this, void 0, void 0, function* () { + return new Promise((resolve, reject) => { + const lightning = loadLightning(); + lightning.channelBalance({}, function (err, response) { + if (err == null) { + resolve(response); + } + else { + reject(err); + } + }); + }); + }); +} +exports.channelBalance = channelBalance; function ascii_to_hexa(str) { var arr1 = []; for (var n = 0, l = str.length; n < l; n++) { diff --git a/dist/src/utils/lightning.js.map b/dist/src/utils/lightning.js.map index b6d7a72..58b78bc 100644 --- a/dist/src/utils/lightning.js.map +++ b/dist/src/utils/lightning.js.map @@ -1 +1 @@ -{"version":3,"file":"lightning.js","sourceRoot":"","sources":["../../../src/utils/lightning.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,yCAAwC;AACxC,yBAAwB;AACxB,6BAA4B;AAC5B,wCAAmC;AACnC,iCAAgC;AAChC,iCAAgC;AACh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CAAC,EAAE,CAAC,CAAC;AACtB,CAAC"} \ No newline at end of file diff --git a/src/controllers/details.ts b/src/controllers/details.ts index 92b2e4b..2a31007 100644 --- a/src/controllers/details.ts +++ b/src/controllers/details.ts @@ -1,4 +1,4 @@ -import { loadLightning, queryRoute } from '../utils/lightning' +import { loadLightning, queryRoute, channelBalance, listChannels } from '../utils/lightning' import { success, failure } from '../utils/res' import * as readLastLines from 'read-last-lines' import { nodeinfo } from '../utils/nodeinfo'; @@ -83,17 +83,16 @@ export const getBalance = async (req, res) => { const owner = await models.Contact.findOne({ where: { isOwner: true } }) owner.update({ lastActive: date }) - const lightning = loadLightning() - var request = {} - lightning.channelBalance(request, function (err, response) { - res.status(200); - if (err == null) { - res.json({ success: true, response }); - } else { - res.json({ success: false }); - } - res.end(); - }); + res.status(200); + try { + const response = await channelBalance() + const channelList = await listChannels() + const { channels } = channelList + response.reserve = channels.reduce((a, chan) => a + parseInt(chan.local_constraints.chan_reserve_sat), 0) + } catch(e) { + res.json({ success: false }); + } + res.end(); }; export const getLocalRemoteBalance = async (req, res) => { diff --git a/src/utils/lightning.ts b/src/utils/lightning.ts index 577ec3d..5f13701 100644 --- a/src/utils/lightning.ts +++ b/src/utils/lightning.ts @@ -390,6 +390,32 @@ async function getInfo(): Promise<{[k:string]:any}>{ }) } +async function listChannels(): Promise<{[k:string]:any}>{ + return new Promise((resolve,reject)=>{ + const lightning = loadLightning() + lightning.listChannels({}, function(err, response) { + if (err == null) { + resolve(response) + } else { + reject(err) + } + }); + }) +} + +async function channelBalance(): Promise<{[k:string]:any}>{ + return new Promise((resolve,reject)=>{ + const lightning = loadLightning() + lightning.channelBalance({}, function(err, response) { + if (err == null) { + resolve(response) + } else { + reject(err) + } + }); + }) +} + function ascii_to_hexa(str){ var arr1 = []; for (var n = 0, l = str.length; n < l; n ++) { @@ -423,4 +449,6 @@ export { listAllInvoices, listAllPaymentsFull, queryRoute, + listChannels, + channelBalance, } From 3cdfdceb6510a859f6659187f57e064fc17c0bc2 Mon Sep 17 00:00:00 2001 From: Evan Feenstra Date: Mon, 9 Nov 2020 19:25:04 -0800 Subject: [PATCH 2/5] 1 --- dist/src/controllers/details.js | 1 + dist/src/controllers/details.js.map | 2 +- src/controllers/details.ts | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/dist/src/controllers/details.js b/dist/src/controllers/details.js index 89d3391..4993df5 100644 --- a/dist/src/controllers/details.js +++ b/dist/src/controllers/details.js @@ -103,6 +103,7 @@ exports.getBalance = (req, res) => __awaiter(void 0, void 0, void 0, function* ( response.reserve = channels.reduce((a, chan) => a + parseInt(chan.local_constraints.chan_reserve_sat), 0); } catch (e) { + console.log("ERROR getBalance", e); res.json({ success: false }); } res.end(); diff --git a/dist/src/controllers/details.js.map b/dist/src/controllers/details.js.map index 864aea7..d6b6447 100644 --- a/dist/src/controllers/details.js.map +++ b/dist/src/controllers/details.js.map @@ -1 +1 @@ -{"version":3,"file":"details.js","sourceRoot":"","sources":["../../../src/controllers/details.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,kDAA4F;AAC5F,sCAA+C;AAC/C,iDAAgD;AAChD,gDAA6C;AAC7C,6BAA4B;AAC5B,4CAAoC;AACpC,sCAAkC;AAElC,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,QAAQ,IAAI,aAAa,CAAC;AAClD,MAAM,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,uBAAuB,CAAC,CAAC,CAAC,GAAG,CAAC,CAAA;AAE7D,QAAA,UAAU,GAAG,CAAO,GAAG,EAAE,GAAG,EAAE,EAAE;IAC5C,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,GAAG,CAAC,KAAK,CAAA;IACpC,IAAI,CAAC,CAAC,MAAM,IAAI,MAAM,CAAC,MAAM,KAAK,EAAE,CAAC;QAAE,OAAO,aAAO,CAAC,GAAG,EAAE,cAAc,CAAC,CAAA;IAE1E,IAAI;QACH,MAAM,C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EAAE,KAAK,CAAC,CAAC;SAC3C;IACF,CAAC;CAAA"} \ No newline at end of file diff --git a/src/controllers/details.ts b/src/controllers/details.ts index 2a31007..1bc5209 100644 --- a/src/controllers/details.ts +++ b/src/controllers/details.ts @@ -90,6 +90,7 @@ export const getBalance = async (req, res) => { const { channels } = channelList response.reserve = channels.reduce((a, chan) => a + parseInt(chan.local_constraints.chan_reserve_sat), 0) } catch(e) { + console.log("ERROR getBalance",e) res.json({ success: false }); } res.end(); From 0a6d75eff120c46106605d521caf57294aa3562e Mon Sep 17 00:00:00 2001 From: Evan Feenstra Date: Mon, 9 Nov 2020 19:28:16 -0800 Subject: [PATCH 3/5] fix --- dist/src/controllers/details.js | 2 +- dist/src/controllers/details.js.map | 2 +- src/controllers/details.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/dist/src/controllers/details.js b/dist/src/controllers/details.js index 4993df5..0edd10b 100644 --- a/dist/src/controllers/details.js +++ b/dist/src/controllers/details.js @@ -100,7 +100,7 @@ exports.getBalance = (req, res) => __awaiter(void 0, void 0, void 0, function* ( const response = yield lightning_1.channelBalance(); const channelList = yield lightning_1.listChannels(); const { channels } = channelList; - response.reserve = channels.reduce((a, chan) => a + parseInt(chan.local_constraints.chan_reserve_sat), 0); + response.reserve = channels.reduce((a, chan) => a + parseInt(chan.local_chan_reserve_sat), 0); } catch (e) { console.log("ERROR getBalance", e); diff --git a/dist/src/controllers/details.js.map b/dist/src/controllers/details.js.map index d6b6447..d4e7ebc 100644 --- a/dist/src/controllers/details.js.map +++ b/dist/src/controllers/details.js.map @@ -1 +1 @@ -{"version":3,"file":"details.js","sourceRoot":"","sources":["../../../src/controllers/details.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,kDAA4F;AAC5F,sCAA+C;AAC/C,iDAAgD;AAChD,gDAA6C;AAC7C,6BAA4B;AAC5B,4CAAoC;AACpC,sCAAkC;AAElC,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,QAAQ,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G,CAAC,CAAA;QACf,GAAG,CAAC,GAAG,EAAE,CAAA;QACT,OAAM;KACN;IACD,MAAM,IAAI,GAAG,MAAM,mBAAQ,EAAE,CAAA;IAC7B,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;IACf,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IACd,GAAG,CAAC,GAAG,EAAE,CAAA;AACV,CAAC,CAAA,CAAA;AAED,SAAe,YAAY,CAAC,KAAK,EAAE,QAAQ;;QAC1C,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,KAAK,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE;YAClD,MAAM,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;SAC3C;IACF,CAAC;CAAA"} \ No newline at end of file diff --git a/src/controllers/details.ts b/src/controllers/details.ts index 1bc5209..c470bfa 100644 --- a/src/controllers/details.ts +++ b/src/controllers/details.ts @@ -88,7 +88,7 @@ export const getBalance = async (req, res) => { const response = await channelBalance() const channelList = await listChannels() const { channels } = channelList - response.reserve = channels.reduce((a, chan) => a + parseInt(chan.local_constraints.chan_reserve_sat), 0) + response.reserve = channels.reduce((a, chan) => a + parseInt(chan.local_chan_reserve_sat), 0) } catch(e) { console.log("ERROR getBalance",e) res.json({ success: false }); From 412e3610c1c04f1445e44ba6e1a67a68ef3526ad Mon Sep 17 00:00:00 2001 From: Evan Feenstra Date: Mon, 9 Nov 2020 19:29:31 -0800 Subject: [PATCH 4/5] fix --- dist/src/controllers/details.js | 1 + dist/src/controllers/details.js.map | 2 +- src/controllers/details.ts | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/dist/src/controllers/details.js b/dist/src/controllers/details.js index 0edd10b..40189d2 100644 --- a/dist/src/controllers/details.js +++ b/dist/src/controllers/details.js @@ -101,6 +101,7 @@ exports.getBalance = (req, res) => __awaiter(void 0, void 0, void 0, function* ( const channelList = yield lightning_1.listChannels(); const { channels } = channelList; response.reserve = channels.reduce((a, chan) => a + parseInt(chan.local_chan_reserve_sat), 0); + res.json({ success: true, response }); } catch (e) { console.log("ERROR getBalance", e); diff --git a/dist/src/controllers/details.js.map b/dist/src/controllers/details.js.map index d4e7ebc..ef91b50 100644 --- a/dist/src/controllers/details.js.map +++ b/dist/src/controllers/details.js.map @@ -1 +1 @@ -{"version":3,"file":"details.js","sourceRoot":"","sources":["../../../src/controllers/details.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,kDAA4F;AAC5F,sCAA+C;AAC/C,iDAAgD;AAChD,gDAA6C;AAC7C,6BAA4B;AAC5B,4CAAoC;AACpC,sCAAkC;AAElC,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,QAAQ,IAAI,aAAa,CAAC;AAClD,MAAM,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,uBAAuB,CAAC,CAAC,CAAC,GAAG,CAAC,CAAA;AAE7D,QAAA,UAAU,GAAG,CAAO,GAAG,EAAE,GAAG,EAAE,EAAE;IAC5C,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,GAAG,CAAC,KAAK,CAAA;IACpC,IAAI,CAAC,CAAC,MAAM,IAAI,MAAM,CAAC,MAAM,KAAK,EAAE,CAAC;QAAE,OAAO,aAAO,CAAC,GAAG,EAAE,cAAc,CAAC,CAAA;IAE1E,IAAI;QACH,MAAM,CAAC,GAAG,MAAM,sBAAU,CAAC,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,IAAI,mBAAS,CAAC,cAAc,CAAC,CAAA;QAChF,aAAO,CAAC,GAAG,EAAE,CAAC,CAAC,CAAA;KACf;IAAC,OAAO,CAAC,EAAE;QACX,aAAO,CAAC,GAAG,EAAE,CAAC,CAAC,CAAA;KACf;AACF,CAAC,CAAA,CAAC;AAEF,MAAM,eAAe,GAAG;IACvB,+BAA+B;IAC/B,mCAAmC;IACnC,iBAAiB;CACjB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EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,aAAa,EAAE,iBAAiB,EAAE,cAAc,EAAE,kBAAkB,EAAE,EAAE,CAAC,CAAC;SAChH;aAAM;YACN,GAAG,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,CAAC;SAC7B;QACD,GAAG,CAAC,GAAG,EAAE,CAAC;IACX,CAAC,CAAC,CAAA;AACH,CAAC,CAAA,CAAC;AAEW,QAAA,WAAW,GAAG,CAAO,GAAG,EAAE,GAAG,EAAE,EAAE;IAC7C,IAAI,UAAU,GAAG,GAAG,CAAC,UAAU,CAAC,aAAa,CAAC;IAC9C,IAAI,CAAC,CAAC,UAAU,CAAC,QAAQ,CAAC,WAAW,CAAC,IAAI,UAAU,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC,EAAE;QAC5E,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;QACf,GAAG,CAAC,GAAG,EAAE,CAAA;QACT,OAAM;KACN;IACD,MAAM,IAAI,GAAG,MAAM,mBAAQ,EAAE,CAAA;IAC7B,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;IACf,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IACd,GAAG,CAAC,GAAG,EAAE,CAAA;AACV,CAAC,CAAA,CAAA;AAED,SAAe,YAAY,CAAC,KAAK,EAAE,QAAQ;;QAC1C,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,KAAK,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE;YAClD,MAAM,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;SAC3C;IACF,CAAC;CAAA"} \ No newline at end of file diff --git a/src/controllers/details.ts b/src/controllers/details.ts index c470bfa..df393e3 100644 --- a/src/controllers/details.ts +++ b/src/controllers/details.ts @@ -89,6 +89,7 @@ export const getBalance = async (req, res) => { const channelList = await listChannels() const { channels } = channelList response.reserve = channels.reduce((a, chan) => a + parseInt(chan.local_chan_reserve_sat), 0) + res.json({ success: true, response }); } catch(e) { console.log("ERROR getBalance",e) res.json({ success: false }); From f372c18f3a8ab98c8fa4187b93f85b3d21458028 Mon Sep 17 00:00:00 2001 From: Evan Feenstra Date: Mon, 9 Nov 2020 20:07:00 -0800 Subject: [PATCH 5/5] full --- dist/src/controllers/details.js | 9 +++++++-- dist/src/controllers/details.js.map | 2 +- src/controllers/details.ts | 14 ++++++++++++-- 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/dist/src/controllers/details.js b/dist/src/controllers/details.js index 40189d2..da1fbce 100644 --- a/dist/src/controllers/details.js +++ b/dist/src/controllers/details.js @@ -100,8 +100,13 @@ exports.getBalance = (req, res) => __awaiter(void 0, void 0, void 0, function* ( const response = yield lightning_1.channelBalance(); const channelList = yield lightning_1.listChannels(); const { channels } = channelList; - response.reserve = channels.reduce((a, chan) => a + parseInt(chan.local_chan_reserve_sat), 0); - res.json({ success: true, response }); + const reserve = channels.reduce((a, chan) => a + parseInt(chan.local_chan_reserve_sat), 0); + res.json({ success: true, response: { + reserve, + full_balance: parseInt(response.balance), + balance: parseInt(response.balance) - reserve, + pending_open_balance: parseInt(response.pending_open_balance), + } }); } catch (e) { console.log("ERROR getBalance", e); diff --git a/dist/src/controllers/details.js.map b/dist/src/controllers/details.js.map index ef91b50..41b9eeb 100644 --- a/dist/src/controllers/details.js.map +++ b/dist/src/controllers/details.js.map @@ -1 +1 @@ -{"version":3,"file":"details.js","sourceRoot":"","sources":["../../../src/controllers/details.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,kDAA4F;AAC5F,sCAA+C;AAC/C,iDAAgD;AAChD,gDAA6C;AAC7C,6BAA4B;AAC5B,4CAAoC;AACpC,sCAAkC;AAElC,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,QAAQ,IAAI,aAAa,CAAC;AAClD,MAAM,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI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ACH,CAAC,CAAA,CAAC;AAEW,QAAA,WAAW,GAAG,CAAO,GAAG,EAAE,GAAG,EAAE,EAAE;IAC7C,IAAI,UAAU,GAAG,GAAG,CAAC,UAAU,CAAC,aAAa,CAAC;IAC9C,IAAI,CAAC,CAAC,UAAU,CAAC,QAAQ,CAAC,WAAW,CAAC,IAAI,UAAU,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC,EAAE;QAC5E,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;QACf,GAAG,CAAC,GAAG,EAAE,CAAA;QACT,OAAM;KACN;IACD,MAAM,IAAI,GAAG,MAAM,mBAAQ,EAAE,CAAA;IAC7B,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;IACf,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IACd,GAAG,CAAC,GAAG,EAAE,CAAA;AACV,CAAC,CAAA,CAAA;AAED,SAAe,YAAY,CAAC,KAAK,EAAE,QAAQ;;QAC1C,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,KAAK,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE;YAClD,MAAM,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;SAC3C;IACF,CAAC;CAAA"} \ No newline at end of file diff --git a/src/controllers/details.ts b/src/controllers/details.ts index df393e3..30bf3dc 100644 --- a/src/controllers/details.ts +++ b/src/controllers/details.ts @@ -76,6 +76,11 @@ export const getChannels = async (req, res) => { }); }; +interface BalanceRes { + pending_open_balance: number + balance: number + reserve: number +} export const getBalance = async (req, res) => { var date = new Date() @@ -88,8 +93,13 @@ export const getBalance = async (req, res) => { const response = await channelBalance() const channelList = await listChannels() const { channels } = channelList - response.reserve = channels.reduce((a, chan) => a + parseInt(chan.local_chan_reserve_sat), 0) - res.json({ success: true, response }); + const reserve = channels.reduce((a, chan) => a + parseInt(chan.local_chan_reserve_sat), 0) + res.json({ success: true, response:{ + reserve, + full_balance: parseInt(response.balance), + balance: parseInt(response.balance) - reserve, + pending_open_balance: parseInt(response.pending_open_balance), + } }); } catch(e) { console.log("ERROR getBalance",e) res.json({ success: false });