Pending Channels and Detach Peer

pull/47/head
ShahanaFarooqui 6 years ago
parent 57f04b7228
commit b6aaea3115

@ -23,6 +23,9 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. SOFTWARE.
@angular/router
MIT
hammerjs hammerjs
MIT MIT
The MIT License (MIT) The MIT License (MIT)
@ -622,9 +625,6 @@ MIT
@angular/material/progress-spinner @angular/material/progress-spinner
@angular/router
MIT
@angular/material/form-field @angular/material/form-field
@angular/material/progress-bar @angular/material/progress-bar

@ -6,8 +6,8 @@
<base href="/"> <base href="/">
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/x-icon" href="assets/images/favicon.ico"> <link rel="icon" type="image/x-icon" href="assets/images/favicon.ico">
<link rel="stylesheet" href="styles.e4aab088ea7dc1035ccf.css"></head> <link rel="stylesheet" href="styles.2a5891112b56c0c8c573.css"></head>
<body> <body>
<rtl-app></rtl-app> <rtl-app></rtl-app>
<script type="text/javascript" src="runtime.ec2944dd8b20ec099bf3.js"></script><script type="text/javascript" src="polyfills.b2575713cefb95077d85.js"></script><script type="text/javascript" src="main.878d0165b8c37c9796f3.js"></script></body> <script type="text/javascript" src="runtime.ec2944dd8b20ec099bf3.js"></script><script type="text/javascript" src="polyfills.b2575713cefb95077d85.js"></script><script type="text/javascript" src="main.c75ae329270bdd93986b.js"></script></body>
</html> </html>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -38,21 +38,28 @@ exports.getChannels = (req, res, next) => {
let channels = []; let channels = [];
if (undefined === req.params.channelType || req.params.channelType === 'all') { if (undefined === req.params.channelType || req.params.channelType === 'all') {
channels = (undefined === body.channels) ? [] : body.channels; channels = (undefined === body.channels) ? [] : body.channels;
Promise.all(
channels.map(channel => {
// console.log(`\nChannel before getting Alias: ${JSON.stringify(channel)} \nAnd Channel Type: ${req.params.channelType}`);
return getAliasForChannel(channel, req.params.channelType);
})
)
.then(function(values) {
console.log(`\nChannels Fetched with Alias: ${JSON.stringify(body)}`);
res.status(200).json(body);
}).catch(err => {
console.error(err.error);
});
} else { } else {
channels = (undefined === body.pending_open_channels) ? [] : body.pending_open_channels; if (undefined === body.total_limbo_balance) {
} body.total_limbo_balance = 0;
Promise.all( body.btc_total_limbo_balance = 0;
channels.map(channel => { } else {
// console.log(`\nChannel before getting Alias: ${JSON.stringify(channel)} \nAnd Channel Type: ${req.params.channelType}`); body.btc_total_limbo_balance = common.convertToBTC(body.total_limbo_balance);
return getAliasForChannel(channel, req.params.channelType); }
}) console.log(`\nPending Channels Fetched: ${JSON.stringify(body)}`);
)
.then(function(values) {
console.log(`\nChannels Fetched with Alias: ${JSON.stringify(body)}`);
res.status(200).json(body); res.status(200).json(body);
}).catch(err => { }
console.error(err.error);
});
}); });
}; };

@ -16,7 +16,8 @@ getAliasForPeers = (peer) => {
}); });
} }
exports.getPeers = (req, res, next) => { exports.getPeers = (req, res, next) =>
{
options.url = common.lnd_server_url + '/peers'; options.url = common.lnd_server_url + '/peers';
request(options).then(function (body) { request(options).then(function (body) {
let peers = (undefined === body.peers) ? [] : body.peers; let peers = (undefined === body.peers) ? [] : body.peers;
@ -44,7 +45,7 @@ exports.postPeer = (req, res, next) => {
console.log(body); console.log(body);
if(undefined === body || body.error) { if(undefined === body || body.error) {
res.status(500).json({ res.status(500).json({
message: "Adding peers failed!", message: "Adding peer failed!",
error: (undefined === body) ? 'Error From Server!' : body.error error: (undefined === body) ? 'Error From Server!' : body.error
}); });
} else { } else {
@ -63,3 +64,22 @@ exports.postPeer = (req, res, next) => {
} }
}); });
}; };
exports.deletePeer = (req, res, next) => {
options.url = common.lnd_server_url + '/peers/' + req.params.peerPubKey;
console.log('Detach Peer Options: ');
console.log(options.url);
request.delete(options, (error, response, body) => {
console.log('Detach Peer Response: ');
console.log(body);
if(undefined === body || body.error) {
res.status(500).json({
message: "Detach peer failed!",
error: (undefined === body) ? 'Error From Server!' : body.error
});
} else {
console.log('\nPeer Detached: ' + req.params.peerPubKey);
res.status(204).json({message: 'Peer Detached!'});
}
});
};

@ -4,5 +4,6 @@ const router = express.Router();
router.get("/", PeersController.getPeers); router.get("/", PeersController.getPeers);
router.post("/", PeersController.postPeer); router.post("/", PeersController.postPeer);
router.delete("/:peerPubKey", PeersController.deletePeer);
module.exports = router; module.exports = router;

@ -1 +1 @@
{"flgSidenavOpened":true,"flgSidenavPinned":true,"menu":"Vertical","menuType":"Regular","theme":"dark-blue","lndConfigPath":"","satsToBTC":false} {"flgSidenavOpened":true,"flgSidenavPinned":true,"menu":"Vertical","menuType":"Regular","theme":"dark-blue","lndConfigPath":"C:\\Users\\Suheb\\AppData\\Local\\Lnd\\lnd.conf","satsToBTC":false}
Loading…
Cancel
Save