Pending Channels and Detach Peer

This commit is contained in:
ShahanaFarooqui 2018-12-24 23:01:31 -05:00
parent 57f04b7228
commit b6aaea3115
15 changed files with 51 additions and 28 deletions

View file

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

View file

@ -6,8 +6,8 @@
<base href="/">
<meta name="viewport" content="width=device-width, initial-scale=1">
<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>
<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>

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

View file

@ -38,21 +38,28 @@ exports.getChannels = (req, res, next) => {
let channels = [];
if (undefined === req.params.channelType || req.params.channelType === 'all') {
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 {
channels = (undefined === body.pending_open_channels) ? [] : body.pending_open_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)}`);
if (undefined === body.total_limbo_balance) {
body.total_limbo_balance = 0;
body.btc_total_limbo_balance = 0;
} else {
body.btc_total_limbo_balance = common.convertToBTC(body.total_limbo_balance);
}
console.log(`\nPending Channels Fetched: ${JSON.stringify(body)}`);
res.status(200).json(body);
}).catch(err => {
console.error(err.error);
});
}
});
};

View file

@ -16,7 +16,8 @@ getAliasForPeers = (peer) => {
});
}
exports.getPeers = (req, res, next) => {
exports.getPeers = (req, res, next) =>
{
options.url = common.lnd_server_url + '/peers';
request(options).then(function (body) {
let peers = (undefined === body.peers) ? [] : body.peers;
@ -44,7 +45,7 @@ exports.postPeer = (req, res, next) => {
console.log(body);
if(undefined === body || body.error) {
res.status(500).json({
message: "Adding peers failed!",
message: "Adding peer failed!",
error: (undefined === body) ? 'Error From Server!' : body.error
});
} 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!'});
}
});
};

View file

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

View file

@ -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}