You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

31 lines
913 B

const lightningLogic = require('logic/lightning.js');
const networkLogic = require('logic/network.js');
async function lndDetails() {
const calls = [networkLogic.getBitcoindAddresses(),
lightningLogic.getChannelBalance(),
lightningLogic.getWalletBalance(),
lightningLogic.getChannels(),
lightningLogic.getGeneralInfo()
];
// prevent fail fast, ux will expect a null on failed calls
const [externalIP, channelBalance, walletBalance, channels, lightningInfo]
= await Promise.all(calls.map(p => p.catch(err => null))); // eslint-disable-line
return {
externalIP: externalIP, // eslint-disable-line object-shorthand
balance: {
wallet: walletBalance,
channel: channelBalance,
},
channels: channels, // eslint-disable-line object-shorthand
lightningInfo: lightningInfo // eslint-disable-line object-shorthand
};
}
module.exports = {
lndDetails
};