[FEATURE] Channel Update, [MENU] Treeview collapse on child menu click, [LOOKUP] placeholder update, [PEERS] placeholder update, [CHANNELS] sort the channels Active on Top, [LND WALLET] sort them with the latest on top, [INVOICES] sort them with the latest on top, [PAYMENTS] sort them with the latest on top

pull/47/head
ShahanaFarooqui 5 years ago
parent 4c7ef72add
commit 15e0da95b1

@ -8,5 +8,5 @@
<link rel="stylesheet" href="styles.6acb6bfec10bb1e126bd.css"></head>
<body>
<rtl-app></rtl-app>
<script type="text/javascript" src="runtime.ec2944dd8b20ec099bf3.js"></script><script type="text/javascript" src="polyfills.418928a701f2040ada02.js"></script><script type="text/javascript" src="main.8ff799723ff745ec504c.js"></script></body>
<script type="text/javascript" src="runtime.ec2944dd8b20ec099bf3.js"></script><script type="text/javascript" src="polyfills.418928a701f2040ada02.js"></script><script type="text/javascript" src="main.71e510eab464f33574ce.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

@ -13,4 +13,18 @@ common.convertTimestampToDate = (num) => {
return new Date(+num*1000).toUTCString();
};
common.sortAscByKey = (array, key) => {
return array.sort(function(a, b) {
var x = a[key]; var y = b[key];
return ((x < y) ? -1 : ((x > y) ? 1 : 0));
});
}
common.sortDescByKey = (array, key) => {
return array.sort(function(a, b) {
var x = a[key]; var y = b[key];
return ((x > y) ? -1 : ((x < y) ? 1 : 0));
});
}
module.exports = common;

@ -58,6 +58,7 @@ exports.getChannels = (req, res, next) => {
}
})
.catch(function (err) {
logger.info('\r\nChannels: 61: ' + JSON.stringify(Date.now()) + ': ERROR: Get Channel: ' + JSON.stringify(err));
return res.status(500).json({
message: 'Fetching Channels Failed!',
error: err.error
@ -83,6 +84,7 @@ exports.postChannel = (req, res, next) => {
}
})
.catch(function (err) {
logger.info('\r\nChannels: 86: ' + JSON.stringify(Date.now()) + ': ERROR: Open Channel: ' + JSON.stringify(err));
return res.status(500).json({
message: 'Open Channel Failed!',
error: err.error
@ -121,6 +123,7 @@ exports.postTransactions = (req, res, next) => {
}
})
.catch(function (err) {
logger.info('\r\nChannels: 124: ' + JSON.stringify(Date.now()) + ': ERROR: Send Payment: ' + JSON.stringify(err));
return res.status(500).json({
message: 'Send Payment Failed!',
error: err.error
@ -143,9 +146,51 @@ exports.closeChannel = (req, res, next) => {
}
})
.catch(function (err) {
logger.info('\r\nChannels: 146: ' + JSON.stringify(Date.now()) + ': ERROR: Close Channel: ' + JSON.stringify(err));
return res.status(500).json({
message: 'Close Channel Failed!',
error: err.error
});
});
}
}
exports.postChanPolicy = (req, res, next) => {
options.url = common.lnd_server_url + '/chanpolicy';
if(req.body.chanPoint === 'all') {
options.form = JSON.stringify({
global: true,
base_fee_msat: req.body.baseFeeMsat,
fee_rate: parseFloat(req.body.feeRate/1000000),
time_lock_delta: parseInt(req.body.timeLockDelta)
});
} else {
let breakPoint = req.body.chanPoint.indexOf(':');
let txid_str = req.body.chanPoint.substring(0, breakPoint);
let output_idx = req.body.chanPoint.substring(breakPoint+1, req.body.chanPoint.length);
options.form = JSON.stringify({
base_fee_msat: req.body.baseFeeMsat,
fee_rate: parseFloat(req.body.feeRate/1000000),
time_lock_delta: parseInt(req.body.timeLockDelta),
chan_point: {funding_txid_str: txid_str, output_index: parseInt(output_idx)}
});
}
logger.info('\r\nChannels: 161: ' + JSON.stringify(Date.now()) + ': INFO: Update Channel Policy Options: ' + JSON.stringify(options));
request.post(options).then((body) => {
logger.info('\r\nChannels: 163: ' + JSON.stringify(Date.now()) + ': INFO: Update Channel Policy: ' + JSON.stringify(body));
if(undefined === body || body.error) {
res.status(500).json({
message: 'Update Channel Failed!',
error: (undefined === body) ? 'Error From Server!' : body.error
});
} else {
res.status(201).json(body);
}
})
.catch(function (err) {
logger.info('\r\nChannels: 177: ' + JSON.stringify(Date.now()) + ': ERROR: Update Channel Policy: ' + JSON.stringify(err));
return res.status(500).json({
message: 'Update Channel Failed!',
error: err.error
});
});
};

@ -36,13 +36,14 @@ exports.listInvoices = (req, res, next) => {
});
} else {
if (undefined !== body.invoices) {
body.invoices.forEach(invoice => {
invoice.creation_date_str = (undefined === invoice.creation_date) ? '' : common.convertTimestampToDate(invoice.creation_date);
invoice.settle_date_str = (undefined === invoice.settle_date) ? '' : common.convertTimestampToDate(invoice.settle_date);
invoice.btc_value = (undefined === invoice.value) ? 0 : common.convertToBTC(invoice.value);
invoice.btc_amt_paid_sat = (undefined === invoice.amt_paid_sat) ? 0 : common.convertToBTC(invoice.amt_paid_sat);
});
}
body.invoices.forEach(invoice => {
invoice.creation_date_str = (undefined === invoice.creation_date) ? '' : common.convertTimestampToDate(invoice.creation_date);
invoice.settle_date_str = (undefined === invoice.settle_date) ? '' : common.convertTimestampToDate(invoice.settle_date);
invoice.btc_value = (undefined === invoice.value) ? 0 : common.convertToBTC(invoice.value);
invoice.btc_amt_paid_sat = (undefined === invoice.amt_paid_sat) ? 0 : common.convertToBTC(invoice.amt_paid_sat);
});
body.invoices = common.sortDescByKey(body.invoices, 'creation_date');
}
logger.info('\r\nInvoice: 45: ' + JSON.stringify(Date.now()) + ': INFO: Invoices List Received: ' + JSON.stringify(body));
res.status(200).json(body);
}

@ -19,6 +19,7 @@ exports.getPayments = (req, res, next) => {
body.payments.forEach(payment => {
payment.creation_date_str = (undefined === payment.creation_date) ? '' : common.convertTimestampToDate(payment.creation_date);
});
body.payments = common.sortDescByKey(body.payments, 'creation_date');
}
res.status(200).json(body.payments);
}

@ -19,6 +19,7 @@ exports.getTransactions = (req, res, next) => {
body.transactions.forEach(transaction => {
transaction.time_stamp_str = (undefined === transaction.time_stamp) ? '' : common.convertTimestampToDate(transaction.time_stamp);
});
body.transactions = common.sortDescByKey(body.transactions, 'time_stamp');
}
res.status(200).json(body.transactions);
}

2
package-lock.json generated

@ -1,6 +1,6 @@
{
"name": "rtl",
"version": "0.1.13-alpha",
"version": "0.1.14-alpha",
"lockfileVersion": 1,
"requires": true,
"dependencies": {

@ -1,6 +1,6 @@
{
"name": "rtl",
"version": "0.1.13-alpha",
"version": "0.1.14-alpha",
"license": "MIT",
"scripts": {
"ng": "ng",

@ -8,5 +8,6 @@ router.post("/", authCheck, ChannelsController.postChannel);
router.get("/:channelType", authCheck, ChannelsController.getChannels);
router.post("/transactions", authCheck, ChannelsController.postTransactions);
router.delete("/:channelPoint", authCheck, ChannelsController.closeChannel);
router.post("/chanPolicy", authCheck, ChannelsController.postChanPolicy);
module.exports = router;

Loading…
Cancel
Save