Lookups
pull/209/head
Shahana Farooqui 5 years ago
parent fd18fc5dca
commit 4003ea0805

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

@ -9,5 +9,5 @@
<link rel="stylesheet" href="styles.13a9674cdbdfd014a4cf.css"></head> <link rel="stylesheet" href="styles.13a9674cdbdfd014a4cf.css"></head>
<body> <body>
<rtl-app></rtl-app> <rtl-app></rtl-app>
<script src="runtime.80b102e4a415b9aef63b.js"></script><script src="polyfills-es5.763f4f23e8aee5ec234d.js" nomodule></script><script src="polyfills.e59b6f9dc696bd89cf7f.js"></script><script src="main.3ea4143bd4b1f1240f56.js"></script></body> <script src="runtime.1a88617b9203e8425f30.js"></script><script src="polyfills-es5.763f4f23e8aee5ec234d.js" nomodule></script><script src="polyfills.e59b6f9dc696bd89cf7f.js"></script><script src="main.e4a9c079a5c8979cc8a1.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

@ -0,0 +1 @@
!function(e){function r(r){for(var n,a,i=r[0],c=r[1],f=r[2],p=0,s=[];p<i.length;p++)o[a=i[p]]&&s.push(o[a][0]),o[a]=0;for(n in c)Object.prototype.hasOwnProperty.call(c,n)&&(e[n]=c[n]);for(l&&l(r);s.length;)s.shift()();return u.push.apply(u,f||[]),t()}function t(){for(var e,r=0;r<u.length;r++){for(var t=u[r],n=!0,i=1;i<t.length;i++)0!==o[t[i]]&&(n=!1);n&&(u.splice(r--,1),e=a(a.s=t[0]))}return e}var n={},o={0:0},u=[];function a(r){if(n[r])return n[r].exports;var t=n[r]={i:r,l:!1,exports:{}};return e[r].call(t.exports,t,t.exports,a),t.l=!0,t.exports}a.e=function(e){var r=[],t=o[e];if(0!==t)if(t)r.push(t[2]);else{var n=new Promise(function(r,n){t=o[e]=[r,n]});r.push(t[2]=n);var u,i=document.createElement("script");i.charset="utf-8",i.timeout=120,a.nc&&i.setAttribute("nonce",a.nc),i.src=function(e){return a.p+""+({}[e]||e)+"."+{1:"5d20dbfb50eaa379bb80",6:"3d0de3786487442c9432",7:"3d047437a6897df1a06b"}[e]+".js"}(e);var c=new Error;u=function(r){i.onerror=i.onload=null,clearTimeout(f);var t=o[e];if(0!==t){if(t){var n=r&&("load"===r.type?"missing":r.type),u=r&&r.target&&r.target.src;c.message="Loading chunk "+e+" failed.\n("+n+": "+u+")",c.name="ChunkLoadError",c.type=n,c.request=u,t[1](c)}o[e]=void 0}};var f=setTimeout(function(){u({type:"timeout",target:i})},12e4);i.onerror=i.onload=u,document.head.appendChild(i)}return Promise.all(r)},a.m=e,a.c=n,a.d=function(e,r,t){a.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:t})},a.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},a.t=function(e,r){if(1&r&&(e=a(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var t=Object.create(null);if(a.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var n in e)a.d(t,n,(function(r){return e[r]}).bind(null,n));return t},a.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return a.d(r,"a",r),r},a.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},a.p="",a.oe=function(e){throw console.error(e),e};var i=window.webpackJsonp=window.webpackJsonp||[],c=i.push.bind(i);i.push=r,i=i.slice();for(var f=0;f<i.length;f++)r(i[f]);var l=c;t()}([]);

@ -1 +0,0 @@
!function(e){function r(r){for(var n,i,a=r[0],c=r[1],f=r[2],p=0,s=[];p<a.length;p++)o[i=a[p]]&&s.push(o[i][0]),o[i]=0;for(n in c)Object.prototype.hasOwnProperty.call(c,n)&&(e[n]=c[n]);for(l&&l(r);s.length;)s.shift()();return u.push.apply(u,f||[]),t()}function t(){for(var e,r=0;r<u.length;r++){for(var t=u[r],n=!0,a=1;a<t.length;a++)0!==o[t[a]]&&(n=!1);n&&(u.splice(r--,1),e=i(i.s=t[0]))}return e}var n={},o={0:0},u=[];function i(r){if(n[r])return n[r].exports;var t=n[r]={i:r,l:!1,exports:{}};return e[r].call(t.exports,t,t.exports,i),t.l=!0,t.exports}i.e=function(e){var r=[],t=o[e];if(0!==t)if(t)r.push(t[2]);else{var n=new Promise(function(r,n){t=o[e]=[r,n]});r.push(t[2]=n);var u,a=document.createElement("script");a.charset="utf-8",a.timeout=120,i.nc&&a.setAttribute("nonce",i.nc),a.src=function(e){return i.p+""+({}[e]||e)+"."+{1:"54859a9ed4dbe675e082",6:"ce8707b220b01fc9d2e2",7:"0664e0a31cfe902f29cf"}[e]+".js"}(e);var c=new Error;u=function(r){a.onerror=a.onload=null,clearTimeout(f);var t=o[e];if(0!==t){if(t){var n=r&&("load"===r.type?"missing":r.type),u=r&&r.target&&r.target.src;c.message="Loading chunk "+e+" failed.\n("+n+": "+u+")",c.name="ChunkLoadError",c.type=n,c.request=u,t[1](c)}o[e]=void 0}};var f=setTimeout(function(){u({type:"timeout",target:a})},12e4);a.onerror=a.onload=u,document.head.appendChild(a)}return Promise.all(r)},i.m=e,i.c=n,i.d=function(e,r,t){i.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:t})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,r){if(1&r&&(e=i(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var t=Object.create(null);if(i.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var n in e)i.d(t,n,(function(r){return e[r]}).bind(null,n));return t},i.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(r,"a",r),r},i.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},i.p="",i.oe=function(e){throw console.error(e),e};var a=window.webpackJsonp=window.webpackJsonp||[],c=a.push.bind(a);a.push=r,a=a.slice();for(var f=0;f<a.length;f++)r(a[f]);var l=c;t()}([]);

@ -3,6 +3,74 @@ var common = require('../../common');
var logger = require('../logger'); var logger = require('../logger');
var options = {}; var options = {};
exports.listChannels = (req, res, next) => {
options = common.getOptions();
options.url = common.getSelLNServerUrl() + '/channel/listChannels';
request(options).then(function (body) {
logger.info({fileName: 'Channels', msg: 'List Channels: ' + JSON.stringify(body)});
res.status(200).json(body);
})
.catch(function (err) {
logger.error({fileName: 'Channels', lineNum: 14, msg: 'List Channels: ' + JSON.stringify(err)});
return res.status(500).json({
message: 'Fetching List Channels Failed!',
error: err.error
});
});
}
exports.openChannel = (req, res, next) => {}
exports.setChannelFee = (req, res, next) => {
options = common.getOptions();
options.url = common.getSelLNServerUrl() + '/channel/setChannelFee';
options.body = req.body;
logger.info({fileName: 'Channels', msg: 'Update Channel Policy Options: ' + JSON.stringify(options)});
request.post(options).then((body) => {
logger.info({fileName: 'Channels', msg: 'Update Channel Policy: ' + JSON.stringify(body)});
if(undefined === body || body.error) {
res.status(500).json({
message: 'Update Channel Policy Failed!',
error: (undefined === body) ? 'Error From Server!' : body.error
});
} else {
res.status(201).json(body);
}
})
.catch(function (err) {
logger.error({fileName: 'Channels', lineNum: 211, msg: 'Update Channel Policy: ' + JSON.stringify(err)});
return res.status(500).json({
message: 'Update Channel Policy Failed!',
error: err.error
});
});
}
exports.closeChannel = (req, res, next) => {
options = common.getOptions();
const unilateralTimeoutQuery = req.query.unilateralTimeout ? '?unilateralTimeout=' + req.query.unilateralTimeout : '';
options.url = common.getSelLNServerUrl() + '/channel/closeChannel/' + req.params.channelId + unilateralTimeoutQuery;
logger.info({fileName: 'Channels', msg: 'Closing Channel: ' + options.url});
request.delete(options).then((body) => {
logger.info({fileName: 'Channels', msg: 'Close Channel Response: ' + JSON.stringify(body)});
if(undefined === body || body.error) {
res.status(500).json({
message: 'Close Channel Failed!',
error: (undefined === body) ? 'Error From Server!' : body.error
});
} else {
res.status(204).json(body);
}
})
.catch(function (err) {
logger.error({fileName: 'Channels', lineNum: 41, msg: 'Close Channel: ' + JSON.stringify(err)});
return res.status(500).json({
message: 'Close Channel Failed!',
error: err.error
});
});
}
exports.getLocalRemoteBalance = (req, res, next) => { exports.getLocalRemoteBalance = (req, res, next) => {
options = common.getOptions(); options = common.getOptions();
options.url = common.getSelLNServerUrl() + '/channel/localremotebal'; options.url = common.getSelLNServerUrl() + '/channel/localremotebal';
@ -32,7 +100,7 @@ exports.getLocalRemoteBalance = (req, res, next) => {
}); });
}; };
exports.forwardingHistory = (req, res, next) => { exports.listForwards = (req, res, next) => {
options = common.getOptions(); options = common.getOptions();
options.url = common.getSelLNServerUrl() + '/switch'; options.url = common.getSelLNServerUrl() + '/switch';
options.form = {}; options.form = {};

@ -26,26 +26,22 @@ exports.getInvoice = (req, res, next) => {
exports.listInvoices = (req, res, next) => { exports.listInvoices = (req, res, next) => {
options = common.getOptions(); options = common.getOptions();
options.url = common.getSelLNServerUrl() + '/invoices?num_max_invoices=' + req.query.num_max_invoices + '&index_offset=' + req.query.index_offset + const labelQuery = req.query.label ? '?label=' + req.query.label : '';
'&reversed=' + req.query.reversed; options.url = common.getSelLNServerUrl() + '/invoice/listInvoices' + labelQuery;
request(options).then((body) => { request(options).then((body) => {
const body_str = (undefined === body) ? '' : JSON.stringify(body); logger.info({fileName: 'Invoice', msg: 'Invoices List Received: ' + body});
const search_idx = (undefined === body) ? -1 : body_str.search('Not Found'); if(undefined === body || body.error) {
logger.info({fileName: 'Invoice', msg: 'Invoices List Received: ' + body_str});
if(undefined === body || search_idx > -1 || body.error) {
res.status(500).json({ res.status(500).json({
message: "Fetching Invoice Info failed!", message: "Fetching Invoice Info failed!",
error: (undefined === body || search_idx > -1) ? 'Error From Server!' : body.error error: (undefined === body) ? 'Error From Server!' : body.error
}); });
} else { } else {
if (undefined !== body.invoices) { if (undefined !== body.invoices) {
body.invoices.forEach(invoice => { body.invoices.forEach(invoice => {
invoice.creation_date_str = (undefined === invoice.creation_date) ? '' : common.convertTimestampToDate(invoice.creation_date); invoice.paid_at_str = (undefined === invoice.paid_at) ? '' : common.convertTimestampToDate(invoice.paid_at);
invoice.settle_date_str = (undefined === invoice.settle_date) ? '' : common.convertTimestampToDate(invoice.settle_date); invoice.expires_at_str = (undefined === invoice.expires_at) ? '' : common.convertTimestampToDate(invoice.expires_at);
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'); body.invoices = common.sortDescByKey(body.invoices, 'expires_at');
} }
logger.info({fileName: 'Invoice', msg: 'Invoices List Received: ' + JSON.stringify(body)}); logger.info({fileName: 'Invoice', msg: 'Invoices List Received: ' + JSON.stringify(body)});
res.status(200).json(body); res.status(200).json(body);

@ -26,15 +26,15 @@ exports.getRoute = (req, res, next) => {
exports.listNode = (req, res, next) => { exports.listNode = (req, res, next) => {
options = common.getOptions(); options = common.getOptions();
options.url = common.getSelLNServerUrl() + '/peer/listPeers'; options.url = common.getSelLNServerUrl() + '/network/listNode/' + req.params.id;
request(options).then(function (body) { request(options).then(function (body) {
let peers = (undefined !== body) ? common.sortDescByKey(body, 'alias') : []; logger.info({fileName: 'Network', msg: 'Node Lookup: ' + JSON.stringify(body)});
logger.info({fileName: 'Peers', msg: 'Peers with Alias: ' + JSON.stringify(peers)}); body.last_timestamp_str = (body.last_timestamp) ? common.convertTimestampToDate(body.last_timestamp) : '';
res.status(200).json(peers); res.status(200).json(body);
}) })
.catch((err) => { .catch((err) => {
return res.status(500).json({ return res.status(500).json({
message: "Peers Fetch Failed!", message: "Node Lookup Failed!",
error: err.error error: err.error
}); });
}); });
@ -42,15 +42,16 @@ exports.listNode = (req, res, next) => {
exports.listChannel = (req, res, next) => { exports.listChannel = (req, res, next) => {
options = common.getOptions(); options = common.getOptions();
options.url = common.getSelLNServerUrl() + '/peer/listPeers'; options.url = common.getSelLNServerUrl() + '/network/listChannel/' + req.params.channelShortId;
request(options).then(function (body) { request(options).then(function (body) {
let peers = (undefined !== body) ? common.sortDescByKey(body, 'alias') : []; logger.info({fileName: 'Network', msg: 'Channel Lookup: ' + JSON.stringify(body)});
logger.info({fileName: 'Peers', msg: 'Peers with Alias: ' + JSON.stringify(peers)}); body[0].last_update_str = (body.length > 0 && body[0].last_update) ? common.convertTimestampToDate(body[0].last_update) : '';
res.status(200).json(peers); body[1].last_update_str = (body.length > 1 && body[1].last_update) ? common.convertTimestampToDate(body[1].last_update) : '';
res.status(200).json(body);
}) })
.catch((err) => { .catch((err) => {
return res.status(500).json({ return res.status(500).json({
message: "Peers Fetch Failed!", message: "Channel Lookup Failed!",
error: err.error error: err.error
}); });
}); });

@ -3,7 +3,12 @@ const express = require("express");
const router = express.Router(); const router = express.Router();
const authCheck = require("../authCheck"); const authCheck = require("../authCheck");
router.get("/listChannels", authCheck, ChannelsController.listChannels);
router.post("/", authCheck, ChannelsController.openChannel);
router.post("/setChannelFee", authCheck, ChannelsController.setChannelFee);
router.delete("/:channelId", authCheck, ChannelsController.closeChannel);
router.get("/localremotebalance", authCheck, ChannelsController.getLocalRemoteBalance); router.get("/localremotebalance", authCheck, ChannelsController.getLocalRemoteBalance);
router.post("/", authCheck, ChannelsController.forwardingHistory); router.get("/listForwards", authCheck, ChannelsController.listForwards);
module.exports = router; module.exports = router;

@ -4,8 +4,8 @@ const router = express.Router();
const authCheck = require("../authCheck"); const authCheck = require("../authCheck");
router.get("/getRoute/:destPubkey/:amount", authCheck, NetworkController.getRoute); router.get("/getRoute/:destPubkey/:amount", authCheck, NetworkController.getRoute);
router.get("/listNode", authCheck, NetworkController.listNode); router.get("/listNode/:id", authCheck, NetworkController.listNode);
router.get("/listChannel", authCheck, NetworkController.listChannel); router.get("/listChannel/:channelShortId", authCheck, NetworkController.listChannel);
router.get("/feeRates", authCheck, NetworkController.feeRates); router.get("/feeRates", authCheck, NetworkController.feeRates);
module.exports = router; module.exports = router;

@ -1,4 +1,4 @@
<!-- <div fxLayout="column"> <div fxLayout="column">
<div class="padding-gap"> <div class="padding-gap">
<mat-card [ngClass]="{'flip': redirectedWithPeer}"> <mat-card [ngClass]="{'flip': redirectedWithPeer}">
<mat-card-header> <mat-card-header>
@ -7,22 +7,28 @@
</mat-card-subtitle> </mat-card-subtitle>
</mat-card-header> </mat-card-header>
<mat-card-content> <mat-card-content>
<form fxLayout="column" fxLayout.gt-sm="row wrap" (ngSubmit)="openChannelForm.form.valid && onOpenChannel(openChannelForm)" #openChannelForm="ngForm"> <form fxLayout="column" fxLayout.gt-sm="row wrap"
(ngSubmit)="openChannelForm.form.valid && onOpenChannel(openChannelForm)" #openChannelForm="ngForm">
<mat-form-field fxFlex="40" fxLayoutAlign="start end"> <mat-form-field fxFlex="40" fxLayoutAlign="start end">
<mat-select [(ngModel)]="selectedPeer" placeholder="Alias" name="peer_alias" tabindex="1" required name="selPeer" #selPeer="ngModel"> <mat-select [(ngModel)]="selectedPeer" placeholder="Alias" name="peer_alias" tabindex="1" required
name="selPeer" #selPeer="ngModel">
<mat-option *ngFor="let peer of peers" [value]="peer.pub_key"> <mat-option *ngFor="let peer of peers" [value]="peer.pub_key">
{{peer.alias}} {{peer.alias}}
</mat-option> </mat-option>
</mat-select> </mat-select>
</mat-form-field> </mat-form-field>
<mat-form-field fxFlex="25" fxLayoutAlign="start end"> <mat-form-field fxFlex="25" fxLayoutAlign="start end">
<input matInput [(ngModel)]="fundingAmount" placeholder="Amount ({{information?.smaller_currency_unit}})" type="number" step="1000" min="1" tabindex="2" required name="amount" #amount="ngModel"> <input matInput [(ngModel)]="fundingAmount" placeholder="Amount ({{information?.smaller_currency_unit}})"
<mat-hint>(Wallet Bal: {{totalBalance}}, Remaining Bal: {{totalBalance - ((fundingAmount) ? fundingAmount : 0)}})</mat-hint> type="number" step="1000" min="1" tabindex="2" required name="amount" #amount="ngModel">
<mat-hint>(Wallet Bal: {{totalBalance}}, Remaining Bal:
{{totalBalance - ((fundingAmount) ? fundingAmount : 0)}})</mat-hint>
</mat-form-field> </mat-form-field>
<div fxFlex="15" tabindex="3" fxLayoutAlign="start center" class="chkbox-options"> <div fxFlex="15" tabindex="3" fxLayoutAlign="start center" class="chkbox-options">
<mat-checkbox [(ngModel)]="moreOptions" name="moreOptions" (change)="onMoreOptionsChange($event)">Options</mat-checkbox> <mat-checkbox [(ngModel)]="moreOptions" name="moreOptions" (change)="onMoreOptionsChange($event)">Options
</mat-checkbox>
</div> </div>
<span *ngIf="moreOptions" fxLayout="column" fxLayout.gt-sm="row wrap" fxFlex="80" fxLayoutAlign.gt-sm="space-between center"> <span *ngIf="moreOptions" fxLayout="column" fxLayout.gt-sm="row wrap" fxFlex="80"
fxLayoutAlign.gt-sm="space-between center">
<mat-form-field fxFlex="25" fxLayoutAlign="start end"> <mat-form-field fxFlex="25" fxLayoutAlign="start end">
<mat-select tabindex="4" [(value)]="selTransType"> <mat-select tabindex="4" [(value)]="selTransType">
<mat-option *ngFor="let transType of transTypes" [value]="transType.id"> <mat-option *ngFor="let transType of transTypes" [value]="transType.id">
@ -34,22 +40,34 @@
<input matInput placeholder="Channel Opening Priority" disabled> <input matInput placeholder="Channel Opening Priority" disabled>
</mat-form-field> </mat-form-field>
<mat-form-field fxFlex="25" *ngIf="selTransType=='1'"> <mat-form-field fxFlex="25" *ngIf="selTransType=='1'">
<input matInput [(ngModel)]="transTypeValue.blocks" placeholder="Target Confirmation Blocks" type="number" name="blocks" step="1" min="0" required tabindex="5" #blocks="ngModel"> <input matInput [(ngModel)]="transTypeValue.blocks" placeholder="Target Confirmation Blocks" type="number"
name="blocks" step="1" min="0" required tabindex="5" #blocks="ngModel">
</mat-form-field> </mat-form-field>
<mat-form-field fxFlex="25" *ngIf="selTransType=='2'"> <mat-form-field fxFlex="25" *ngIf="selTransType=='2'">
<input matInput [(ngModel)]="transTypeValue.fees" placeholder="Fee ({{information?.smaller_currency_unit}}/Byte)" type="number" name="fees" step="1" min="0" required tabindex="6" #fees="ngModel"> <input matInput [(ngModel)]="transTypeValue.fees"
placeholder="Fee ({{information?.smaller_currency_unit}}/Byte)" type="number" name="fees" step="1"
min="0" required tabindex="6" #fees="ngModel">
</mat-form-field> </mat-form-field>
<mat-checkbox fxFlex="25" fxFlex.lt-lg="35" tabindex="7" [(ngModel)]="spendUnconfirmed" name="spendUnconfirmed">Spend Unconfirmed Output</mat-checkbox> <mat-checkbox fxFlex="25" fxFlex.lt-lg="35" tabindex="7" [(ngModel)]="spendUnconfirmed"
<mat-checkbox fxFlex="20" fxFlex.lt-lg="15" tabindex="8" [(ngModel)]="isPrivate" name="isPrivate">Private</mat-checkbox> name="spendUnconfirmed">Spend Unconfirmed Output</mat-checkbox>
<mat-checkbox fxFlex="20" fxFlex.lt-lg="15" tabindex="8" [(ngModel)]="isPrivate" name="isPrivate">Private
</mat-checkbox>
</span> </span>
<div fxFlex="10" fxLayoutAlign="end start"> <div fxFlex="10" fxLayoutAlign="end start">
<button fxFlex="90" fxLayoutAlign="center center" mat-raised-button color="primary" [disabled]="selectedPeer === '' || fundingAmount == null || (totalBalance - ((fundingAmount) ? fundingAmount : 0) < 0)" type="submit" tabindex="8"> <button fxFlex="90" fxLayoutAlign="center center" mat-raised-button color="primary"
<p *ngIf="(selectedPeer === '' || fundingAmount == null) && (selPeer.touched || selPeer.dirty) && (amount.touched || amount.dirty); else openText">Invalid Values</p> [disabled]="selectedPeer === '' || fundingAmount == null || (totalBalance - ((fundingAmount) ? fundingAmount : 0) < 0)"
<ng-template #openText><p>Open</p></ng-template> type="submit" tabindex="8">
<p
*ngIf="(selectedPeer === '' || fundingAmount == null) && (selPeer.touched || selPeer.dirty) && (amount.touched || amount.dirty); else openText">
Invalid Values</p>
<ng-template #openText>
<p>Open</p>
</ng-template>
</button> </button>
</div> </div>
<div fxFlex="10" fxLayoutAlign="end start"> <div fxFlex="10" fxLayoutAlign="end start">
<button fxFlex="90" fxLayoutAlign="center center" mat-raised-button color="accent" tabindex="9" type="reset" (click)="resetData()">Clear</button> <button fxFlex="90" fxLayoutAlign="center center" mat-raised-button color="accent" tabindex="9" type="reset"
(click)="resetData()">Clear</button>
</div> </div>
</form> </form>
</mat-card-content> </mat-card-content>
@ -65,59 +83,54 @@
</div> </div>
<div perfectScrollbar class="table-container mat-elevation-z8"> <div perfectScrollbar class="table-container mat-elevation-z8">
<mat-progress-bar *ngIf="flgLoading[0]===true" mode="indeterminate"></mat-progress-bar> <mat-progress-bar *ngIf="flgLoading[0]===true" mode="indeterminate"></mat-progress-bar>
<table mat-table #table [dataSource]="channels" matSort [ngClass]="{'mat-elevation-z8 overflow-auto error-border': flgLoading[0]==='error','mat-elevation-z8 overflow-auto': true}"> <table mat-table #table [dataSource]="channels" matSort
[ngClass]="{'mat-elevation-z8 overflow-auto error-border': flgLoading[0]==='error','mat-elevation-z8 overflow-auto': true}">
<ng-container matColumnDef="close"> <ng-container matColumnDef="close">
<th mat-header-cell *matHeaderCellDef> Close Channel </th> <th mat-header-cell *matHeaderCellDef> Close Channel </th>
<td mat-cell *matCellDef="let channel"><mat-icon color="accent" (click)="onChannelClose(channel)">link_off</mat-icon></td> <td mat-cell *matCellDef="let channel">
<mat-icon color="accent" (click)="onChannelClose(channel)">link_off</mat-icon>
</td>
</ng-container> </ng-container>
<ng-container matColumnDef="update"> <ng-container matColumnDef="update">
<th mat-header-cell *matHeaderCellDef><mat-icon color="accent" (click)="onChannelUpdate('all')">edit</mat-icon></th> <th mat-header-cell *matHeaderCellDef><mat-icon color="accent" (click)="onChannelUpdate('all')">edit</mat-icon></th>
<td mat-cell *matCellDef="let channel"><mat-icon color="accent" (click)="onChannelUpdate(channel)">edit</mat-icon></td>
</ng-container>
<ng-container matColumnDef="active">
<th mat-header-cell *matHeaderCellDef mat-sort-header> Status </th>
<td mat-cell *matCellDef="let channel"> {{(channel.active) ? 'Active' : 'Inactive'}} </td>
</ng-container>
<ng-container matColumnDef="chan_id">
<th mat-header-cell *matHeaderCellDef mat-sort-header> ID </th>
<td mat-cell *matCellDef="let channel"> {{channel.chan_id}} </td>
</ng-container>
<ng-container matColumnDef="remote_pubkey">
<th mat-header-cell *matHeaderCellDef mat-sort-header> Pub Key </th>
<td mat-cell *matCellDef="let channel"> <td mat-cell *matCellDef="let channel">
<div>{{channel.remote_pubkey | slice:0:10}}...</div></td> <mat-icon color="accent" (click)="onChannelUpdate(channel)">edit</mat-icon>
</td>
</ng-container> </ng-container>
<ng-container matColumnDef="remote_alias"> <ng-container matColumnDef="short_channel_id">
<th mat-header-cell *matHeaderCellDef mat-sort-header> Alias </th> <th mat-header-cell *matHeaderCellDef mat-sort-header> Short Channel ID </th>
<td mat-cell *matCellDef="let channel">{{channel.remote_alias}}</td> <td mat-cell *matCellDef="let channel"> {{channel?.short_channel_id}}</td>
</ng-container> </ng-container>
<ng-container matColumnDef="capacity"> <ng-container matColumnDef="peer_id">
<th mat-header-cell *matHeaderCellDef mat-sort-header arrowPosition="before"> Capacity </th> <th mat-header-cell *matHeaderCellDef mat-sort-header> Alias </th>
<td mat-cell *matCellDef="let channel"><span fxLayoutAlign="end center"> {{channel.capacity | number}} </span></td> <td mat-cell *matCellDef="let channel">{{channel?.peer_id | slice:0:10}}...</td>
</ng-container> </ng-container>
<ng-container matColumnDef="local_balance"> <ng-container matColumnDef="connected">
<th mat-header-cell *matHeaderCellDef mat-sort-header arrowPosition="before"> Local Bal </th> <th mat-header-cell *matHeaderCellDef mat-sort-header> Connected </th>
<td mat-cell *matCellDef="let channel"><span fxLayoutAlign="end center"> {{channel.local_balance | number}} </span></td> <td mat-cell *matCellDef="let channel"> {{(channel?.connected) ? 'Connected' : 'Disconnected'}} </td>
</ng-container> </ng-container>
<ng-container matColumnDef="remote_balance"> <ng-container matColumnDef="private">
<th mat-header-cell *matHeaderCellDef mat-sort-header arrowPosition="before"> Remote Bal </th> <th mat-header-cell *matHeaderCellDef mat-sort-header> Private </th>
<td mat-cell *matCellDef="let channel"><span fxLayoutAlign="end center"> {{channel.remote_balance | number}} </span></td> <td mat-cell *matCellDef="let channel"> {{(channel?.private ? 'Private' : 'Public')}} </td>
</ng-container> </ng-container>
<ng-container matColumnDef="total_satoshis_sent"> <ng-container matColumnDef="state">
<th mat-header-cell *matHeaderCellDef mat-sort-header arrowPosition="before"> {{information?.smaller_currency_unit}} Sent </th> <th mat-header-cell *matHeaderCellDef mat-sort-header> State </th>
<td mat-cell *matCellDef="let channel"><span fxLayoutAlign="end center"> {{channel.total_satoshis_sent | number}} </span></td> <td mat-cell *matCellDef="let channel"> {{channel?.state}}</td>
</ng-container> </ng-container>
<ng-container matColumnDef="total_satoshis_received"> <ng-container matColumnDef="msatoshi_to_us">
<th mat-header-cell *matHeaderCellDef mat-sort-header arrowPosition="before"> {{information?.smaller_currency_unit}} Recv </th> <th mat-header-cell *matHeaderCellDef mat-sort-header arrowPosition="before"> mSatoshi To Us </th>
<td mat-cell *matCellDef="let channel"><span fxLayoutAlign="end center"> {{channel.total_satoshis_received | number}} </span></td> <td mat-cell *matCellDef="let channel"><span fxLayoutAlign="end center">
{{channel?.msatoshi_to_us | number}} </span></td>
</ng-container> </ng-container>
<ng-container matColumnDef="commit_fee"> <ng-container matColumnDef="msatoshi_total">
<th mat-header-cell *matHeaderCellDef mat-sort-header arrowPosition="before"> Fee </th> <th mat-header-cell *matHeaderCellDef mat-sort-header arrowPosition="before"> mSatoshi Total </th>
<td mat-cell *matCellDef="let channel"><span fxLayoutAlign="end center"> {{channel.commit_fee | number}} </span></td> <td mat-cell *matCellDef="let channel"><span fxLayoutAlign="end center">
{{channel?.msatoshi_total | number}} </span></td>
</ng-container> </ng-container>
<ng-container matColumnDef="private"> <ng-container matColumnDef="spendable_msatoshi">
<th mat-header-cell *matHeaderCellDef mat-sort-header> Private </th> <th mat-header-cell *matHeaderCellDef mat-sort-header arrowPosition="before"> Spendable Satoshi </th>
<td mat-cell *matCellDef="let channel"> {{(channel.private ? 'Private' : 'Public')}} </td> <td mat-cell *matCellDef="let channel"><span fxLayoutAlign="end center">
{{channel?.spendable_msatoshi | number}} </span></td>
</ng-container> </ng-container>
<tr mat-header-row *matHeaderRowDef="displayedColumns; sticky: flgSticky;"></tr> <tr mat-header-row *matHeaderRowDef="displayedColumns; sticky: flgSticky;"></tr>
<tr mat-row *matRowDef="let row; columns: displayedColumns;" (click)="onChannelClick(row, $event)"></tr> <tr mat-row *matRowDef="let row; columns: displayedColumns;" (click)="onChannelClick(row, $event)"></tr>
@ -126,6 +139,4 @@
</mat-card-content> </mat-card-content>
</mat-card> </mat-card>
</div> </div>
</div> </div>
-->
<h3>CHANNELS</h3>

@ -1,21 +1,12 @@
.mat-column-close, .mat-column-update, .mat-column-active, .mat-column-private { .mat-column-close, .mat-column-update, .mat-column-connected, .mat-column-private {
flex: 0 0 6%; flex: 0 0 6%;
min-width: 60px; min-width: 60px;
} }
.mat-column-private {
padding-left: 10px;
}
.mat-cell.mat-column-close, .mat-column-update { .mat-cell.mat-column-close, .mat-column-update {
cursor: pointer; cursor: pointer;
} }
.mat-column-chan_id {
flex: 0 0 16%;
min-width: 160px;
}
.mat-checkbox-inner-container:focus, .mat-checkbox-input:focus { .mat-checkbox-inner-container:focus, .mat-checkbox-input:focus {
outline: none !important; outline: none !important;
} }

@ -7,7 +7,7 @@ import { Store } from '@ngrx/store';
import { Actions } from '@ngrx/effects'; import { Actions } from '@ngrx/effects';
import { MatTableDataSource, MatSort } from '@angular/material'; import { MatTableDataSource, MatSort } from '@angular/material';
import { ChannelCL, PeerCL, GetInfoCL } from '../../shared/models/clModels'; import { ChannelCL, PeerCL, GetInfoCL, ChannelEdgeCL } from '../../shared/models/clModels';
import { LoggerService } from '../../shared/services/logger.service'; import { LoggerService } from '../../shared/services/logger.service';
import { CLEffects } from '../store/cl.effects'; import { CLEffects } from '../store/cl.effects';
@ -43,64 +43,68 @@ export class CLChannelsComponent implements OnInit, OnDestroy {
public redirectedWithPeer = false; public redirectedWithPeer = false;
private unsub: Array<Subject<void>> = [new Subject(), new Subject(), new Subject(), new Subject()]; private unsub: Array<Subject<void>> = [new Subject(), new Subject(), new Subject(), new Subject()];
ngOnInit() {} constructor(private logger: LoggerService, private store: Store<fromRTLReducer.RTLState>, private rtlEffects: RTLEffects, private clEffects: CLEffects, private activatedRoute: ActivatedRoute) {
// constructor(private logger: LoggerService, private store: Store<fromRTLReducer.RTLState>, private rtlEffects: RTLEffects, private clEffects: CLEffects, private activatedRoute: ActivatedRoute) { switch (true) {
// switch (true) { case (window.innerWidth <= 415):
// case (window.innerWidth <= 415): this.displayedColumns = ['close', 'update', 'short_channel_id', 'state', 'msatoshi_total'];
// this.displayedColumns = ['close', 'update', 'active', 'chan_id', 'remote_alias']; break;
// break; case (window.innerWidth > 415 && window.innerWidth <= 730):
// case (window.innerWidth > 415 && window.innerWidth <= 730): this.displayedColumns = ['close', 'update', 'short_channel_id', 'state', 'msatoshi_to_us', 'msatoshi_total', 'spendable_msatoshi'];
// this.displayedColumns = ['close', 'update', 'active', 'chan_id', 'remote_alias', 'capacity']; break;
// break; case (window.innerWidth > 730 && window.innerWidth <= 1024):
// case (window.innerWidth > 730 && window.innerWidth <= 1024): this.displayedColumns = [
// this.displayedColumns = ['close', 'update', 'active', 'chan_id', 'remote_alias', 'capacity', 'local_balance', 'remote_balance']; 'close', 'update', 'short_channel_id', 'peer_id', 'connected', 'private', 'state', 'msatoshi_to_us', 'msatoshi_total', 'spendable_msatoshi'
// break; ];
// case (window.innerWidth > 1024 && window.innerWidth <= 1280): break;
// this.flgSticky = true; case (window.innerWidth > 1024 && window.innerWidth <= 1280):
// this.displayedColumns = ['close', 'update', 'active', 'chan_id', 'remote_alias', 'capacity', 'local_balance', 'remote_balance', 'total_satoshis_sent', this.flgSticky = true;
// 'total_satoshis_received', 'commit_fee', 'private']; this.displayedColumns = [
// break; 'close', 'update', 'short_channel_id', 'peer_id', 'connected', 'private', 'state', 'msatoshi_to_us', 'msatoshi_total', 'spendable_msatoshi'
// default: ];
// this.flgSticky = true; break;
// this.displayedColumns = ['close', 'update', 'active', 'chan_id', 'remote_pubkey', 'remote_alias', 'capacity', 'local_balance', 'remote_balance', default:
// 'total_satoshis_sent', 'total_satoshis_received', 'commit_fee', 'private']; this.flgSticky = true;
// break; this.displayedColumns = [
// } 'close', 'update', 'short_channel_id', 'peer_id', 'connected', 'private', 'state', 'msatoshi_to_us', 'msatoshi_total', 'spendable_msatoshi'
// } ];
break;
}
}
// ngOnInit() { ngOnInit() {
// this.store.select('cl') this.store.dispatch(new RTLActions.FetchChannelsCL());
// .pipe(takeUntil(this.unsub[0])) this.store.select('cl')
// .subscribe((rtlStore) => { .pipe(takeUntil(this.unsub[0]))
// rtlStore.effectErrorsCl.forEach(effectsErr => { .subscribe((rtlStore) => {
// if (effectsErr.action === 'FetchChannels/all') { rtlStore.effectErrorsCl.forEach(effectsErr => {
// this.flgLoading[0] = 'error'; if (effectsErr.action === 'FetchChannelsCL') {
// } this.flgLoading[0] = 'error';
// }); }
// this.information = rtlStore.information; });
// this.peers = rtlStore.peers; this.information = rtlStore.information;
// this.peers.forEach(peer => { this.peers = rtlStore.peers;
// if (undefined === peer.alias || peer.alias === '') { this.peers.forEach(peer => {
// peer.alias = peer.pub_key.substring(0, 15) + '...'; if (undefined === peer.alias || peer.alias === '') {
// } peer.alias = peer.id.substring(0, 15) + '...';
// }); }
});
// this.totalBalance = +rtlStore.blockchainBalance.total_balance; this.totalBalance = +rtlStore.balance.totalBalance;
// if (undefined !== rtlStore.allChannels) { if (undefined !== rtlStore.allChannels) {
// this.loadChannelsTable(rtlStore.allChannels); this.loadChannelsTable(rtlStore.allChannels);
// } }
// if (this.flgLoading[0] !== 'error') { if (this.flgLoading[0] !== 'error') {
// this.flgLoading[0] = (undefined !== rtlStore.allChannels) ? false : true; this.flgLoading[0] = (undefined !== rtlStore.allChannels) ? false : true;
// } }
// this.logger.info(rtlStore); this.logger.info(rtlStore);
// }); });
// this.activatedRoute.paramMap.subscribe(() => { this.activatedRoute.paramMap.subscribe(() => {
// this.selectedPeer = window.history.state.peer; this.selectedPeer = window.history.state.peer;
// this.redirectedWithPeer = (window.history.state.peer) ? true : false; this.redirectedWithPeer = (window.history.state.peer) ? true : false;
// }); });
// } }
// onOpenChannel(form: any) { onOpenChannel(form: any) {
// this.store.dispatch(new RTLActions.OpenSpinner('Opening Channel...')); // this.store.dispatch(new RTLActions.OpenSpinner('Opening Channel...'));
// let transTypeValue = '0'; // let transTypeValue = '0';
// if (this.selTransType === '1') { // if (this.selTransType === '1') {
@ -112,149 +116,151 @@ export class CLChannelsComponent implements OnInit, OnDestroy {
// selectedPeerPubkey: this.selectedPeer, fundingAmount: this.fundingAmount, private: this.isPrivate, // selectedPeerPubkey: this.selectedPeer, fundingAmount: this.fundingAmount, private: this.isPrivate,
// transType: this.selTransType, transTypeValue: transTypeValue, spendUnconfirmed: this.spendUnconfirmed // transType: this.selTransType, transTypeValue: transTypeValue, spendUnconfirmed: this.spendUnconfirmed
// })); // }));
// } }
// onChannelUpdate(channelToUpdate: any) { onChannelUpdate(channelToUpdate: ChannelCL | 'all') {
// if (channelToUpdate === 'all') { if (channelToUpdate === 'all') {
// const titleMsg = 'Updated Values for ALL Channels'; const titleMsg = 'Updated Values for ALL Channels';
// const confirmationMsg = {}; const confirmationMsg = {};
// this.store.dispatch(new RTLActions.OpenConfirmation({ width: '70%', data: { this.store.dispatch(new RTLActions.OpenConfirmation({ width: '70%', data: {
// type: 'CONFIRM', titleMessage: titleMsg, noBtnText: 'Cancel', yesBtnText: 'Update', message: JSON.stringify(confirmationMsg), flgShowInput: true, getInputs: [ type: 'CONFIRM', titleMessage: titleMsg, noBtnText: 'Cancel', yesBtnText: 'Update', message: JSON.stringify(confirmationMsg), flgShowInput: true, getInputs: [
// {placeholder: 'Base Fee msat', inputType: 'number', inputValue: 1000}, {placeholder: 'Base Fee msat', inputType: 'number', inputValue: 1000},
// {placeholder: 'Fee Rate mili msat', inputType: 'number', inputValue: 1, min: 1}, {placeholder: 'Fee Rate mili msat', inputType: 'number', inputValue: 1, min: 1}
// {placeholder: 'Time Lock Delta', inputType: 'number', inputValue: 144} ]
// ] }}));
// }})); this.rtlEffects.closeConfirm
// this.rtlEffects.closeConfirm .pipe(takeUntil(this.unsub[2]))
// .pipe(takeUntil(this.unsub[2])) .subscribe(confirmRes => {
// .subscribe(confirmRes => { if (confirmRes) {
// if (confirmRes) { const base_fee = confirmRes[0].inputValue;
// const base_fee = confirmRes[0].inputValue; const fee_rate = confirmRes[1].inputValue;
// const fee_rate = confirmRes[1].inputValue; this.store.dispatch(new RTLActions.OpenSpinner('Updating Channel Policy...'));
// const time_lock_delta = confirmRes[2].inputValue; this.store.dispatch(new RTLActions.UpdateChannelsCL({baseFeeMsat: base_fee, feeRate: fee_rate, channelId: 'all'}));
// this.store.dispatch(new RTLActions.OpenSpinner('Updating Channel Policy...')); }
// this.store.dispatch(new RTLActions.UpdateChannels({baseFeeMsat: base_fee, feeRate: fee_rate, timeLockDelta: time_lock_delta, chanPoint: 'all'})); });
// } } else {
// }); this.myChanPolicy = {fee_base_msat: 0, fee_rate_milli_msat: 0};
// } else { this.store.dispatch(new RTLActions.OpenSpinner('Fetching Channel Policy...'));
// this.myChanPolicy = {fee_base_msat: 0, fee_rate_milli_msat: 0, time_lock_delta: 0}; this.store.dispatch(new RTLActions.ChannelLookupCL(channelToUpdate.short_channel_id));
// this.store.dispatch(new RTLActions.OpenSpinner('Fetching Channel Policy...')); this.clEffects.setLookupCL
// this.store.dispatch(new RTLActions.ChannelLookup(channelToUpdate.chan_id.toString())); .pipe(takeUntil(this.unsub[3]))
// this.clEffects.setLookup .subscribe((resLookup: ChannelEdgeCL[]) => {
// .pipe(takeUntil(this.unsub[3])) this.logger.info(resLookup);
// .subscribe(resLookup => { if (resLookup.length > 0 && resLookup[0].source === this.information.id) {
// this.logger.info(resLookup); this.myChanPolicy = {fee_base_msat: resLookup[0].base_fee_millisatoshi, fee_rate_milli_msat: resLookup[0].fee_per_millionth};
// if (resLookup.node1_pub === this.information.id) { } else if (resLookup.length > 1 && resLookup[1].source === this.information.id) {
// this.myChanPolicy = resLookup.node1_policy; this.myChanPolicy = {fee_base_msat: resLookup[1].base_fee_millisatoshi, fee_rate_milli_msat: resLookup[1].fee_per_millionth};
// } else if (resLookup.node2_pub === this.information.id) { } else {
// this.myChanPolicy = resLookup.node2_policy; this.myChanPolicy = {fee_base_msat: 0, fee_rate_milli_msat: 0};
// } else { }
// this.myChanPolicy = {fee_base_msat: 0, fee_rate_milli_msat: 0, time_lock_delta: 0}; this.logger.info(this.myChanPolicy);
// } this.store.dispatch(new RTLActions.CloseSpinner());
// this.logger.info(this.myChanPolicy); const titleMsg = 'Updated Values for Channel: ' + channelToUpdate.channel_id;
// this.store.dispatch(new RTLActions.CloseSpinner()); const confirmationMsg = {};
// const titleMsg = 'Updated Values for Channel Point: ' + channelToUpdate.channel_point; this.store.dispatch(new RTLActions.OpenConfirmation({ width: '70%', data: {
// const confirmationMsg = {}; type: 'CONFIRM', titleMessage: titleMsg, noBtnText: 'Cancel', yesBtnText: 'Update', message: JSON.stringify(confirmationMsg), flgShowInput: true, getInputs: [
// this.store.dispatch(new RTLActions.OpenConfirmation({ width: '70%', data: { {placeholder: 'Base Fee msat', inputType: 'number', inputValue: (this.myChanPolicy.fee_base_msat === '') ? 0 : this.myChanPolicy.fee_base_msat},
// type: 'CONFIRM', titleMessage: titleMsg, noBtnText: 'Cancel', yesBtnText: 'Update', message: JSON.stringify(confirmationMsg), flgShowInput: true, getInputs: [ {placeholder: 'Fee Rate mili msat', inputType: 'number', inputValue: this.myChanPolicy.fee_rate_milli_msat, min: 1}
// {placeholder: 'Base Fee msat', inputType: 'number', inputValue: (this.myChanPolicy.fee_base_msat === '') ? 0 : this.myChanPolicy.fee_base_msat}, ]
// {placeholder: 'Fee Rate mili msat', inputType: 'number', inputValue: this.myChanPolicy.fee_rate_milli_msat, min: 1}, }}));
// {placeholder: 'Time Lock Delta', inputType: 'number', inputValue: this.myChanPolicy.time_lock_delta} });
// ] this.rtlEffects.closeConfirm
// }})); .pipe(takeUntil(this.unsub[2]))
// }); .subscribe(confirmRes => {
// this.rtlEffects.closeConfirm if (confirmRes) {
// .pipe(takeUntil(this.unsub[2])) const base_fee = confirmRes[0].inputValue;
// .subscribe(confirmRes => { const fee_rate = confirmRes[1].inputValue;
// if (confirmRes) { this.store.dispatch(new RTLActions.OpenSpinner('Updating Channel Policy...'));
// const base_fee = confirmRes[0].inputValue; this.store.dispatch(new RTLActions.UpdateChannelsCL({baseFeeMsat: base_fee, feeRate: fee_rate, channelId: channelToUpdate.channel_id}));
// const fee_rate = confirmRes[1].inputValue; }
// const time_lock_delta = confirmRes[2].inputValue; });
// this.store.dispatch(new RTLActions.OpenSpinner('Updating Channel Policy...')); }
// this.store.dispatch(new RTLActions.UpdateChannels({baseFeeMsat: base_fee, feeRate: fee_rate, timeLockDelta: time_lock_delta, chanPoint: channelToUpdate.channel_point})); this.applyFilter();
// } }
// });
// }
// this.applyFilter();
// }
// onChannelClose(channelToClose: ChannelCL) { onChannelClose(channelToClose: ChannelCL) {
// this.store.dispatch(new RTLActions.OpenConfirmation({ if (channelToClose.state === 'AWAITING_UNILATERAL' || channelToClose.state === 'ONCHAIN') {
// width: '70%', data: { type: 'CONFIRM', titleMessage: 'Closing channel: ' + channelToClose.chan_id, noBtnText: 'Cancel', yesBtnText: 'Close Channel' this.store.dispatch(new RTLActions.OpenAlert({ width: '75%', data: {
// }})); type: 'WARN',
// this.rtlEffects.closeConfirm titleMessage: 'Channel can not be closed when it is in AWAITING UNILATERAL/ONCHAIN state.'
// .pipe(takeUntil(this.unsub[1])) }}));
// .subscribe(confirmRes => { } else {
// if (confirmRes) { this.store.dispatch(new RTLActions.OpenConfirmation({
// this.store.dispatch(new RTLActions.OpenSpinner('Closing Channel...')); width: '70%', data: { type: 'CONFIRM', titleMessage: 'Closing channel: ' + channelToClose.channel_id, noBtnText: 'Cancel', yesBtnText: 'Close Channel'
// this.store.dispatch(new RTLActions.CloseChannel({channelPoint: channelToClose.channel_point, forcibly: !channelToClose.active})); }}));
// } this.rtlEffects.closeConfirm
// }); .pipe(takeUntil(this.unsub[1]))
// } .subscribe(confirmRes => {
if (confirmRes) {
this.store.dispatch(new RTLActions.OpenSpinner('Closing Channel...'));
this.store.dispatch(new RTLActions.CloseChannelCL({channelId: channelToClose.channel_id}));
}
});
}
}
// applyFilter() { applyFilter() {
// this.selectedFilter = this.selFilter; this.selectedFilter = this.selFilter;
// this.channels.filter = this.selFilter; this.channels.filter = this.selFilter;
// } }
// onChannelClick(selRow: ChannelCL, event: any) { onChannelClick(selRow: ChannelCL, event: any) {
// const flgCloseClicked = const flgCloseClicked =
// event.target.className.includes('mat-column-close') event.target.className.includes('mat-column-close')
// || event.target.className.includes('mat-column-update') || event.target.className.includes('mat-column-update')
// || event.target.className.includes('mat-icon'); || event.target.className.includes('mat-icon');
// if (flgCloseClicked) { if (flgCloseClicked) {
// return; return;
// } }
// const selChannel = this.channels.data.filter(channel => { const selChannel = this.channels.data.filter(channel => {
// return channel.chan_id === selRow.chan_id; return channel.channel_id === selRow.channel_id;
// })[0]; })[0];
// const reorderedChannel = JSON.parse(JSON.stringify(selChannel, [ const reorderedChannel = JSON.parse(JSON.stringify(selChannel, [
// 'active', 'remote_pubkey', 'remote_alias', 'channel_point', 'chan_id', 'capacity', 'local_balance', 'remote_balance', 'commit_fee', 'commit_weight', 'channel_id', 'short_channel_id', 'peer_id', 'connected', 'private', 'state', 'funding_txid', 'msatoshi_to_us', 'msatoshi_total', 'their_channel_reserve_satoshis', 'our_channel_reserve_satoshis', 'spendable_msatoshi'
// 'fee_per_kw', 'unsettled_balance', 'total_satoshis_sent', 'total_satoshis_received', 'num_updates', 'pending_htlcs', 'csv_delay', 'private' ] , 2));
// ] , 2)); this.store.dispatch(new RTLActions.OpenAlert({ width: '75%', data: {
// this.store.dispatch(new RTLActions.OpenAlert({ width: '75%', data: { type: 'INFO',
// type: 'INFO', message: JSON.stringify(reorderedChannel)
// message: JSON.stringify(reorderedChannel) }}));
// }})); }
// }
// loadChannelsTable(channels) { loadChannelsTable(channels) {
// channels.sort(function(a, b) { channels.sort(function(a, b) {
// return (a.active === b.active) ? 0 : ((b.active) ? 1 : -1); return (a.active === b.active) ? 0 : ((b.active) ? 1 : -1);
// }); });
// this.channels = new MatTableDataSource<ChannelCL>([...channels]); this.channels = new MatTableDataSource<ChannelCL>([...channels]);
// this.channels.sort = this.sort; this.channels.sort = this.sort;
// this.channels.filterPredicate = (channel: ChannelCL, fltr: string) => { this.channels.filterPredicate = (channel: ChannelCL, fltr: string) => {
// const newChannel = ((channel.active) ? 'active' : 'inactive') + (channel.chan_id ? channel.chan_id : '') + const newChannel = ((channel.connected) ? 'connected' : 'disconnected') + (channel.channel_id ? channel.channel_id : '') +
// (channel.remote_pubkey ? channel.remote_pubkey : '') + (channel.remote_alias ? channel.remote_alias : '') + (channel.short_channel_id ? channel.short_channel_id : '') + (channel.peer_id ? channel.peer_id : '') + (channel.peer_alias ? channel.peer_alias : '') +
// (channel.capacity ? channel.capacity : '') + (channel.local_balance ? channel.local_balance : '') + (channel.private ? 'private' : 'public') + (channel.state ? channel.state.toLowerCase() : '') +
// (channel.remote_balance ? channel.remote_balance : '') + (channel.total_satoshis_sent ? channel.total_satoshis_sent : '') + (channel.funding_txid ? channel.funding_txid : '') + (channel.msatoshi_to_us ? channel.msatoshi_to_us : '') +
// (channel.total_satoshis_received ? channel.total_satoshis_received : '') + (channel.commit_fee ? channel.commit_fee : '') + (channel.msatoshi_total ? channel.msatoshi_total : '') + (channel.their_channel_reserve_satoshis ? channel.their_channel_reserve_satoshis : '') +
// (channel.private ? 'private' : 'public'); (channel.our_channel_reserve_satoshis ? channel.our_channel_reserve_satoshis : '') + (channel.spendable_msatoshi ? channel.spendable_msatoshi : '');
// return newChannel.includes(fltr); return newChannel.includes(fltr.toLowerCase());
// }; };
// this.logger.info(this.channels); this.logger.info(this.channels);
// } }
// resetData() { resetData() {
// this.selectedPeer = ''; this.selectedPeer = '';
// this.fundingAmount = 0; this.fundingAmount = 0;
// this.moreOptions = false; this.moreOptions = false;
// this.spendUnconfirmed = false; this.spendUnconfirmed = false;
// this.isPrivate = false; this.isPrivate = false;
// this.selTransType = '0'; this.selTransType = '0';
// this.transTypeValue = {blocks: '', fees: ''}; this.transTypeValue = {blocks: '', fees: ''};
// this.redirectedWithPeer = false; this.redirectedWithPeer = false;
// } }
// onMoreOptionsChange(event: any) { onMoreOptionsChange(event: any) {
// if (!event.checked) { // if (!event.checked) {
// this.spendUnconfirmed = false; // this.spendUnconfirmed = false;
// this.isPrivate = false; // this.isPrivate = false;
// this.selTransType = '0'; // this.selTransType = '0';
// this.transTypeValue = {blocks: '', fees: ''}; // this.transTypeValue = {blocks: '', fees: ''};
// } // }
// } }
ngOnDestroy() { ngOnDestroy() {
this.unsub.forEach(completeSub => { this.unsub.forEach(completeSub => {

@ -1,3 +1,12 @@
.mat-list-base .mat-list-item, .mat-list-base .mat-list-option { .mat-list-base .mat-list-item, .mat-list-base .mat-list-option {
height: 38px !important; height: 38px !important;
}
.word-break-all {
word-break: break-all !important;
padding-top: 8px;
}
.list-tall {
height: 50px !important;
} }

@ -1,29 +1,3 @@
<!-- <div fxLayout="column" fxLayout.gt-sm="row wrap">
<mat-card fxFlex="100" fxLayoutAlign="start start">
<mat-card-content fxFlex="100" *ngIf="lookupResult">
<mat-list fxLayoutAlign="space-between start">
<mat-list-item fxFlex="30" fxLayoutAlign="start start">Channel Id</mat-list-item>
<mat-list-item fxFlex="68" fxLayoutAlign="start start">{{lookupResult.channel_id}}</mat-list-item>
<mat-divider></mat-divider>
</mat-list>
<mat-list fxLayoutAlign="space-between start">
<mat-list-item fxFlex="30" fxLayoutAlign="start start">Channel Point</mat-list-item>
<mat-list-item fxFlex="68" fxLayoutAlign="start start" class="word-break">{{lookupResult.chan_point}}</mat-list-item>
<mat-divider></mat-divider>
</mat-list>
<mat-list fxLayoutAlign="space-between start">
<mat-list-item fxFlex="30" fxLayoutAlign="start start">Last Update</mat-list-item>
<mat-list-item fxFlex="68" fxLayoutAlign="start start">{{lookupResult.last_update_str}}</mat-list-item>
<mat-divider></mat-divider>
</mat-list>
<mat-list fxLayoutAlign="space-between start">
<mat-list-item fxFlex="30" fxLayoutAlign="start start">Capacity (Sats)</mat-list-item>
<mat-list-item fxFlex="68" fxLayoutAlign="start start">{{lookupResult.capacity | number}}</mat-list-item>
<mat-divider></mat-divider>
</mat-list>
</mat-card-content>
</mat-card>
</div>
<div fxLayout="column" fxLayoutAlign="space-between start" fxLayout.gt-sm="row wrap" class="mt-2"> <div fxLayout="column" fxLayoutAlign="space-between start" fxLayout.gt-sm="row wrap" class="mt-2">
<div fxFlex="48"> <div fxFlex="48">
<mat-card class="custom-card mat-elevation-z12"> <mat-card class="custom-card mat-elevation-z12">
@ -33,78 +7,181 @@
<h5 *ngIf="node1_match">Node 1 (Your Node)</h5> <h5 *ngIf="node1_match">Node 1 (Your Node)</h5>
</mat-card-title> </mat-card-title>
</mat-card-header> </mat-card-header>
<mat-card-content class="px-2"> <mat-card-content class="px-2" *ngIf="lookupResult.length > 0">
<mat-list fxLayoutAlign="start start"> <mat-list fxLayoutAlign="start start">
<mat-list-item fxFlex="100" fxLayoutAlign="start start" class="word-break">{{lookupResult.node1_pub}}</mat-list-item> <mat-list-item fxFlex="50" fxLayoutAlign="start start">Short Channel Id</mat-list-item>
<mat-list-item fxFlex="50" fxLayoutAlign="start start">{{lookupResult[0].short_channel_id}}</mat-list-item>
<mat-divider></mat-divider> <mat-divider></mat-divider>
</mat-list> </mat-list>
<mat-list fxLayoutAlign="start start"> <mat-list fxLayoutAlign="start start">
<mat-list-item fxFlex="50" fxLayoutAlign="start start">Time Lock Delta</mat-list-item> <mat-list-item fxFlex="50" fxLayoutAlign="start start">Active</mat-list-item>
<mat-list-item fxFlex="50" fxLayoutAlign="start start">{{lookupResult.node1_policy.time_lock_delta}}</mat-list-item> <mat-list-item fxFlex="50" fxLayoutAlign="start start" class="word-break">{{lookupResult[0].active}}
</mat-list-item>
<mat-divider></mat-divider> <mat-divider></mat-divider>
</mat-list> </mat-list>
<mat-list fxLayoutAlign="start start"> <mat-list fxLayoutAlign="start start">
<mat-list-item fxFlex="50" fxLayoutAlign="start start">Min HTLC</mat-list-item> <mat-list-item fxFlex="50" fxLayoutAlign="start start">Last Update</mat-list-item>
<mat-list-item fxFlex="50" fxLayoutAlign="start start">{{lookupResult.node1_policy.min_htlc}}</mat-list-item> <mat-list-item fxFlex="50" fxLayoutAlign="start start">{{lookupResult[0].last_update_str}}</mat-list-item>
<mat-divider></mat-divider> <mat-divider></mat-divider>
</mat-list> </mat-list>
<mat-list fxLayoutAlign="start start"> <mat-list fxLayoutAlign="start start">
<mat-list-item fxFlex="50" fxLayoutAlign="start start">Fee Base Msat</mat-list-item> <mat-list-item fxFlex="50" fxLayoutAlign="start start">Amount mSats</mat-list-item>
<mat-list-item fxFlex="50" fxLayoutAlign="start start">{{lookupResult.node1_policy.fee_base_msat}}</mat-list-item> <mat-list-item fxFlex="50" fxLayoutAlign="start start">{{lookupResult[0].amount_msat}}
</mat-list-item>
<mat-divider></mat-divider> <mat-divider></mat-divider>
</mat-list> </mat-list>
<mat-list fxLayoutAlign="start start"> <mat-list fxLayoutAlign="start start">
<mat-list-item fxFlex="50" fxLayoutAlign="start start">Fee Rate Milli Msat</mat-list-item> <mat-list-item fxFlex="50" fxLayoutAlign="start start">Base Fee mSats</mat-list-item>
<mat-list-item fxFlex="50" fxLayoutAlign="start start">{{lookupResult.node1_policy.fee_rate_milli_msat}}</mat-list-item> <mat-list-item fxFlex="50" fxLayoutAlign="start start">{{lookupResult[0].base_fee_millisatoshi | number}}
</mat-list-item>
<mat-divider></mat-divider> <mat-divider></mat-divider>
</mat-list> </mat-list>
<mat-list fxLayoutAlign="start start"> <mat-list fxLayoutAlign="start start">
<mat-list-item fxFlex="50" fxLayoutAlign="start start">Disabled</mat-list-item> <mat-list-item fxFlex="50" fxLayoutAlign="start start">Channel Flags</mat-list-item>
<mat-list-item fxFlex="50" fxLayoutAlign="start start">{{lookupResult.node1_policy.disabled}}</mat-list-item> <mat-list-item fxFlex="50" fxLayoutAlign="start start">{{lookupResult[0].channel_flags | number}}
</mat-list-item>
<mat-divider></mat-divider>
</mat-list>
<mat-list fxLayoutAlign="start start">
<mat-list-item fxFlex="50" fxLayoutAlign="start start">Delay</mat-list-item>
<mat-list-item fxFlex="50" fxLayoutAlign="start start">{{lookupResult[0].delay | number}}</mat-list-item>
<mat-divider></mat-divider>
</mat-list>
<mat-list fxLayoutAlign="start start" class="list-tall">
<mat-list-item fxFlex="50" fxLayoutAlign="start start" class="word-break-all">Destination</mat-list-item>
<mat-list-item fxFlex="50" fxLayoutAlign="start start" class="word-break-all">{{lookupResult[0].destination}}</mat-list-item>
<mat-divider></mat-divider>
</mat-list>
<mat-list fxLayoutAlign="start start">
<mat-list-item fxFlex="50" fxLayoutAlign="start start">Fee Per Millionth</mat-list-item>
<mat-list-item fxFlex="50" fxLayoutAlign="start start">{{lookupResult[0].fee_per_millionth | number}}
</mat-list-item>
<mat-divider></mat-divider>
</mat-list>
<mat-list fxLayoutAlign="start start">
<mat-list-item fxFlex="50" fxLayoutAlign="start start">Htlc Max mSat</mat-list-item>
<mat-list-item fxFlex="50" fxLayoutAlign="start start">{{lookupResult[0].htlc_maximum_msat}}</mat-list-item>
<mat-divider></mat-divider>
</mat-list>
<mat-list fxLayoutAlign="start start">
<mat-list-item fxFlex="50" fxLayoutAlign="start start">Htlc Min mSat</mat-list-item>
<mat-list-item fxFlex="50" fxLayoutAlign="start start">{{lookupResult[0].htlc_minimum_msat}}</mat-list-item>
<mat-divider></mat-divider>
</mat-list>
<mat-list fxLayoutAlign="start start">
<mat-list-item fxFlex="50" fxLayoutAlign="start start">Message Flags</mat-list-item>
<mat-list-item fxFlex="50" fxLayoutAlign="start start">{{lookupResult[0].message_flags | number}}
</mat-list-item>
<mat-divider></mat-divider>
</mat-list>
<mat-list fxLayoutAlign="start start">
<mat-list-item fxFlex="50" fxLayoutAlign="start start">Public</mat-list-item>
<mat-list-item fxFlex="50" fxLayoutAlign="start start">{{lookupResult[0].public}}</mat-list-item>
<mat-divider></mat-divider>
</mat-list>
<mat-list fxLayoutAlign="start start">
<mat-list-item fxFlex="50" fxLayoutAlign="start start">Satoshis</mat-list-item>
<mat-list-item fxFlex="50" fxLayoutAlign="start start">{{lookupResult[0].satoshis | number}}</mat-list-item>
<mat-divider></mat-divider>
</mat-list>
<mat-list fxLayoutAlign="start start" class="list-tall">
<mat-list-item fxFlex="50" fxLayoutAlign="start start" class="word-break-all">Source</mat-list-item>
<mat-list-item fxFlex="50" fxLayoutAlign="start start" class="word-break-all">{{lookupResult[0].source}}</mat-list-item>
<mat-divider></mat-divider> <mat-divider></mat-divider>
</mat-list> </mat-list>
</mat-card-content> </mat-card-content>
</mat-card> </mat-card>
</div> </div>
<div fxFlex="48"> <div fxFlex="48">
<mat-card class="custom-card mat-elevation-z12"> <mat-card class="custom-card mat-elevation-z12">
<mat-card-header class="bg-primary" fxLayoutAlign="center center"> <mat-card-header class="bg-primary" fxLayoutAlign="center center">
<mat-card-title class="m-0 pt-2"> <mat-card-title class="m-0 pt-2">
<h5 *ngIf="!node2_match">Node 2</h5> <h5 *ngIf="!node2_match">Node 2</h5>
<h5 *ngIf="node2_match">Node 2 (Your Node)</h5> <h5 *ngIf="node2_match">Node 2 (Your Node)</h5>
</mat-card-title> </mat-card-title>
</mat-card-header> </mat-card-header>
<mat-card-content class="px-2"> <mat-card-content class="px-2" *ngIf="lookupResult.length > 1">
<mat-list fxLayoutAlign="start start"> <mat-list fxLayoutAlign="start start">
<mat-list-item fxFlex="100" fxLayoutAlign="start start" class="word-break">{{lookupResult.node2_pub}}</mat-list-item> <mat-list-item fxFlex="50" fxLayoutAlign="start start">Short Channel Id</mat-list-item>
<mat-divider></mat-divider> <mat-list-item fxFlex="50" fxLayoutAlign="start start">{{lookupResult[1].short_channel_id}}</mat-list-item>
</mat-list> <mat-divider></mat-divider>
<mat-list fxLayoutAlign="start start"> </mat-list>
<mat-list-item fxFlex="50" fxLayoutAlign="start start">Time Lock Delta</mat-list-item> <mat-list fxLayoutAlign="start start">
<mat-list-item fxFlex="50" fxLayoutAlign="start start">{{lookupResult.node2_policy.time_lock_delta}}</mat-list-item> <mat-list-item fxFlex="50" fxLayoutAlign="start start">Active</mat-list-item>
<mat-divider></mat-divider> <mat-list-item fxFlex="50" fxLayoutAlign="start start" class="word-break">{{lookupResult[1].active}}
</mat-list> </mat-list-item>
<mat-list fxLayoutAlign="start start"> <mat-divider></mat-divider>
<mat-list-item fxFlex="50" fxLayoutAlign="start start">Min HTLC</mat-list-item> </mat-list>
<mat-list-item fxFlex="50" fxLayoutAlign="start start">{{lookupResult.node2_policy.min_htlc}}</mat-list-item> <mat-list fxLayoutAlign="start start">
<mat-divider></mat-divider> <mat-list-item fxFlex="50" fxLayoutAlign="start start">Last Update</mat-list-item>
</mat-list> <mat-list-item fxFlex="50" fxLayoutAlign="start start">{{lookupResult[1].last_update_str}}</mat-list-item>
<mat-list fxLayoutAlign="start start"> <mat-divider></mat-divider>
<mat-list-item fxFlex="50" fxLayoutAlign="start start">Fee Base Msat</mat-list-item> </mat-list>
<mat-list-item fxFlex="50" fxLayoutAlign="start start">{{lookupResult.node2_policy.fee_base_msat}}</mat-list-item> <mat-list fxLayoutAlign="start start">
<mat-divider></mat-divider> <mat-list-item fxFlex="50" fxLayoutAlign="start start">Amount mSats</mat-list-item>
</mat-list> <mat-list-item fxFlex="50" fxLayoutAlign="start start">{{lookupResult[1].amount_msat}}
<mat-list fxLayoutAlign="start start"> </mat-list-item>
<mat-list-item fxFlex="50" fxLayoutAlign="start start">Fee Rate Milli Msat</mat-list-item> <mat-divider></mat-divider>
<mat-list-item fxFlex="50" fxLayoutAlign="start start">{{lookupResult.node2_policy.fee_rate_milli_msat}}</mat-list-item> </mat-list>
<mat-divider></mat-divider> <mat-list fxLayoutAlign="start start">
</mat-list> <mat-list-item fxFlex="50" fxLayoutAlign="start start">Base Fee mSats</mat-list-item>
<mat-list fxLayoutAlign="start start"> <mat-list-item fxFlex="50" fxLayoutAlign="start start">{{lookupResult[1].base_fee_millisatoshi | number}}
<mat-list-item fxFlex="50" fxLayoutAlign="start start">Disabled</mat-list-item> </mat-list-item>
<mat-list-item fxFlex="50" fxLayoutAlign="start start">{{lookupResult.node2_policy.disabled}}</mat-list-item> <mat-divider></mat-divider>
<mat-divider></mat-divider> </mat-list>
</mat-list> <mat-list fxLayoutAlign="start start">
</mat-card-content> <mat-list-item fxFlex="50" fxLayoutAlign="start start">Channel Flags</mat-list-item>
</mat-card> <mat-list-item fxFlex="50" fxLayoutAlign="start start">{{lookupResult[1].channel_flags | number}}
</div> --> </mat-list-item>
<h3>CHANNEL LOOKUP</h3> <mat-divider></mat-divider>
</mat-list>
<mat-list fxLayoutAlign="start start">
<mat-list-item fxFlex="50" fxLayoutAlign="start start">Delay</mat-list-item>
<mat-list-item fxFlex="50" fxLayoutAlign="start start">{{lookupResult[1].delay | number}}</mat-list-item>
<mat-divider></mat-divider>
</mat-list>
<mat-list fxLayoutAlign="start start" class="list-tall">
<mat-list-item fxFlex="50" fxLayoutAlign="start start" class="word-break-all">Destination</mat-list-item>
<mat-list-item fxFlex="50" fxLayoutAlign="start start" class="word-break-all">{{lookupResult[1].destination}}</mat-list-item>
<mat-divider></mat-divider>
</mat-list>
<mat-list fxLayoutAlign="start start">
<mat-list-item fxFlex="50" fxLayoutAlign="start start">Fee Per Millionth</mat-list-item>
<mat-list-item fxFlex="50" fxLayoutAlign="start start">{{lookupResult[1].fee_per_millionth | number}}
</mat-list-item>
<mat-divider></mat-divider>
</mat-list>
<mat-list fxLayoutAlign="start start">
<mat-list-item fxFlex="50" fxLayoutAlign="start start">Htlc Max mSat</mat-list-item>
<mat-list-item fxFlex="50" fxLayoutAlign="start start">{{lookupResult[1].htlc_maximum_msat}}</mat-list-item>
<mat-divider></mat-divider>
</mat-list>
<mat-list fxLayoutAlign="start start">
<mat-list-item fxFlex="50" fxLayoutAlign="start start">Htlc Min mSat</mat-list-item>
<mat-list-item fxFlex="50" fxLayoutAlign="start start">{{lookupResult[1].htlc_minimum_msat}}</mat-list-item>
<mat-divider></mat-divider>
</mat-list>
<mat-list fxLayoutAlign="start start">
<mat-list-item fxFlex="50" fxLayoutAlign="start start">Message Flags</mat-list-item>
<mat-list-item fxFlex="50" fxLayoutAlign="start start">{{lookupResult[1].message_flags | number}}
</mat-list-item>
<mat-divider></mat-divider>
</mat-list>
<mat-list fxLayoutAlign="start start">
<mat-list-item fxFlex="50" fxLayoutAlign="start start">Public</mat-list-item>
<mat-list-item fxFlex="50" fxLayoutAlign="start start">{{lookupResult[1].public}}</mat-list-item>
<mat-divider></mat-divider>
</mat-list>
<mat-list fxLayoutAlign="start start">
<mat-list-item fxFlex="50" fxLayoutAlign="start start">Satoshis</mat-list-item>
<mat-list-item fxFlex="50" fxLayoutAlign="start start">{{lookupResult[1].satoshis | number}}</mat-list-item>
<mat-divider></mat-divider>
</mat-list>
<mat-list fxLayoutAlign="start start" class="list-tall">
<mat-list-item fxFlex="50" fxLayoutAlign="start start" class="word-break-all">Source</mat-list-item>
<mat-list-item fxFlex="50" fxLayoutAlign="start start" class="word-break-all">{{lookupResult[1].source}}</mat-list-item>
<mat-divider></mat-divider>
</mat-list>
</mat-card-content>
</mat-card>
</div>

@ -13,7 +13,7 @@ import * as fromRTLReducer from '../../../store/rtl.reducers';
styleUrls: ['./channel-lookup.component.css'] styleUrls: ['./channel-lookup.component.css']
}) })
export class CLChannelLookupComponent implements OnInit { export class CLChannelLookupComponent implements OnInit {
@Input() lookupResult: ChannelEdgeCL; @Input() lookupResult: ChannelEdgeCL[];
public node1_match = false; public node1_match = false;
public node2_match = false; public node2_match = false;
private unSubs: Array<Subject<void>> = [new Subject(), new Subject(), new Subject(), new Subject()]; private unSubs: Array<Subject<void>> = [new Subject(), new Subject(), new Subject(), new Subject()];
@ -21,17 +21,21 @@ export class CLChannelLookupComponent implements OnInit {
constructor(private store: Store<fromRTLReducer.RTLState>) { } constructor(private store: Store<fromRTLReducer.RTLState>) { }
ngOnInit() { ngOnInit() {
if (undefined !== this.lookupResult && undefined !== this.lookupResult.last_update_str) { if (this.lookupResult.length > 0 && undefined !== this.lookupResult[0].last_update_str) {
this.lookupResult.last_update_str = (this.lookupResult.last_update_str === '') ? this.lookupResult[0].last_update_str = (this.lookupResult[0].last_update_str === '') ?
'' : formatDate(this.lookupResult.last_update_str, 'MMM/dd/yy HH:mm:ss', 'en-US'); '' : formatDate(this.lookupResult[0].last_update_str, 'MMM/dd/yy HH:mm:ss', 'en-US');
}
if (this.lookupResult.length > 1 && undefined !== this.lookupResult[1].last_update_str) {
this.lookupResult[1].last_update_str = (this.lookupResult[1].last_update_str === '') ?
'' : formatDate(this.lookupResult[1].last_update_str, 'MMM/dd/yy HH:mm:ss', 'en-US');
} }
this.store.select('cl') this.store.select('cl')
.pipe(takeUntil(this.unSubs[0])) .pipe(takeUntil(this.unSubs[0]))
.subscribe((rtlStore) => { .subscribe((rtlStore) => {
if (this.lookupResult.node1_pub === rtlStore.information.id) { if (this.lookupResult.length > 0 && this.lookupResult[0].source === rtlStore.information.id) {
this.node1_match = true; this.node1_match = true;
} }
if (this.lookupResult.node2_pub === rtlStore.information.id) { if (this.lookupResult.length > 1 && this.lookupResult[1].source === rtlStore.information.id) {
this.node2_match = true; this.node2_match = true;
} }
}); });

@ -1,4 +1,4 @@
<!-- <div fxLayout="column"> <div fxLayout="column">
<div class="padding-gap"> <div class="padding-gap">
<mat-card> <mat-card>
<mat-card-header> <mat-card-header>
@ -37,12 +37,11 @@
</mat-card-header> </mat-card-header>
<mat-card-content> <mat-card-content>
<div [ngSwitch]="selectedField.id"> <div [ngSwitch]="selectedField.id">
<span *ngSwitchCase="0"><rtl-node-lookup [lookupResult]="lookupValue"></rtl-node-lookup></span> <span *ngSwitchCase="0"><rtl-cl-node-lookup [lookupResult]="lookupValue[0]"></rtl-cl-node-lookup></span>
<span *ngSwitchCase="1"><rtl-channel-lookup [lookupResult]="lookupValue"></rtl-channel-lookup></span> <span *ngSwitchCase="1"><rtl-cl-channel-lookup [lookupResult]="lookupValue"></rtl-cl-channel-lookup></span>
<span *ngSwitchDefault><h3>Error! Unable to find details!</h3></span> <span *ngSwitchDefault><h3>Error! Unable to find details!</h3></span>
</div> </div>
</mat-card-content> </mat-card-content>
</mat-card> </mat-card>
</div> </div>
</div> --> </div>
<h3>LOOKUP</h3>

@ -20,10 +20,10 @@ export class CLLookupsComponent implements OnInit, OnDestroy {
public flgSetLookupValue = false; public flgSetLookupValue = false;
public temp: any; public temp: any;
public messageObj = []; public messageObj = [];
public selectedField = { id: '0', name: 'Node', placeholder: 'Pubkey'}; public selectedField = { id: '0', name: 'Node', placeholder: 'ID'};
public lookupFields = [ public lookupFields = [
{ id: '0', name: 'Node', placeholder: 'Pubkey'}, { id: '0', name: 'Node', placeholder: 'ID'},
{ id: '1', name: 'Channel', placeholder: 'Channel ID'} { id: '1', name: 'Channel', placeholder: 'Short Channel ID'}
]; ];
public flgLoading: Array<Boolean | 'error'> = [true]; public flgLoading: Array<Boolean | 'error'> = [true];
private unSubs: Array<Subject<void>> = [new Subject()]; private unSubs: Array<Subject<void>> = [new Subject()];
@ -34,9 +34,9 @@ export class CLLookupsComponent implements OnInit, OnDestroy {
this.actions$ this.actions$
.pipe( .pipe(
takeUntil(this.unSubs[0]), takeUntil(this.unSubs[0]),
filter((action) => (action.type === RTLActions.SET_LOOKUP || action.type === RTLActions.EFFECT_ERROR_CL)) filter((action) => (action.type === RTLActions.SET_LOOKUP_CL || action.type === RTLActions.EFFECT_ERROR_CL))
).subscribe((resLookup: RTLActions.SetLookup) => { ).subscribe((resLookup: RTLActions.SetLookupCL) => {
if (resLookup.payload.action === 'Lookup') { if (resLookup.payload.action === 'LookupCL') {
this.flgLoading[0] = 'error'; this.flgLoading[0] = 'error';
} else { } else {
this.flgLoading[0] = true; this.flgLoading[0] = true;
@ -53,10 +53,10 @@ export class CLLookupsComponent implements OnInit, OnDestroy {
this.store.dispatch(new RTLActions.OpenSpinner('Searching ' + this.selectedField.name + '...')); this.store.dispatch(new RTLActions.OpenSpinner('Searching ' + this.selectedField.name + '...'));
switch (this.selectedField.id) { switch (this.selectedField.id) {
case '0': case '0':
this.store.dispatch(new RTLActions.PeerLookup(this.lookupKey.trim())); this.store.dispatch(new RTLActions.PeerLookupCL(this.lookupKey.trim()));
break; break;
case '1': case '1':
this.store.dispatch(new RTLActions.ChannelLookup(this.lookupKey.trim())); this.store.dispatch(new RTLActions.ChannelLookupCL(this.lookupKey.trim()));
break; break;
default: default:
break; break;
@ -72,7 +72,7 @@ export class CLLookupsComponent implements OnInit, OnDestroy {
resetData() { resetData() {
this.flgSetLookupValue = false; this.flgSetLookupValue = false;
this.lookupKey = ''; this.lookupKey = '';
this.selectedField = { id: '0', name: 'Node', placeholder: 'Pubkey'}; this.selectedField = { id: '0', name: 'Node', placeholder: 'ID'};
this.lookupValue = {}; this.lookupValue = {};
this.flgLoading.forEach((flg, i) => { this.flgLoading.forEach((flg, i) => {
this.flgLoading[i] = true; this.flgLoading[i] = true;

@ -5,3 +5,8 @@
.mat-list-base .mat-list-item, .mat-list-base .mat-list-option { .mat-list-base .mat-list-item, .mat-list-base .mat-list-option {
height: 38px !important; height: 38px !important;
} }
.mat-column-type, .mat-column-port {
flex: 0 0 15%;
min-width: 100px;
}

@ -1,49 +1,60 @@
<!-- <div fxLayout="column"> <div fxLayout="column">
<div class="padding-gap"> <div class="padding-gap">
<mat-card> <mat-card>
<mat-card-content *ngIf="lookupResult"> <mat-card-content *ngIf="lookupResult">
<div fxLayout="column"> <div fxLayout="column">
<mat-list fxLayoutAlign="start start"> <mat-list fxLayoutAlign="start start">
<mat-list-item fxFlex="50" fxLayoutAlign="start start">Alias</mat-list-item> <mat-list-item fxFlex="50" fxLayoutAlign="start start">ID</mat-list-item>
<mat-list-item fxFlex="40" fxLayoutAlign="start start">{{lookupResult.node.alias}}</mat-list-item> <mat-list-item fxFlex="40" fxLayoutAlign="start start">{{lookupResult?.nodeid}}</mat-list-item>
<mat-divider></mat-divider> <mat-divider></mat-divider>
</mat-list> </mat-list>
<mat-list fxLayoutAlign="start start"> <mat-list fxLayoutAlign="start start">
<mat-list-item fxFlex="50" fxLayoutAlign="start start">Pub Key</mat-list-item> <mat-list-item fxFlex="50" fxLayoutAlign="start start">Alias</mat-list-item>
<mat-list-item fxFlex="40" fxLayoutAlign="start start">{{lookupResult.node.pub_key}}</mat-list-item> <mat-list-item fxFlex="40" fxLayoutAlign="start start">{{lookupResult?.alias}}</mat-list-item>
<mat-divider></mat-divider> <mat-divider></mat-divider>
</mat-list> </mat-list>
<mat-list fxLayoutAlign="start start"> <mat-list fxLayoutAlign="start start">
<mat-list-item fxFlex="50" fxLayoutAlign="start start">Color</mat-list-item> <mat-list-item fxFlex="50" fxLayoutAlign="start start">Last Timestamp</mat-list-item>
<mat-list-item fxFlex="40" fxLayoutAlign="start start"><span [ngStyle]="{'background-color': lookupResult.node?.color}">{{lookupResult.node?.color}}</span></mat-list-item> <mat-list-item fxFlex="40" fxLayoutAlign="start start">{{lookupResult?.last_timestamp_str}}</mat-list-item>
<mat-divider></mat-divider> <mat-divider></mat-divider>
</mat-list> </mat-list>
<mat-list fxLayoutAlign="start start"> <mat-list fxLayoutAlign="start start">
<mat-list-item fxFlex="50" fxLayoutAlign="start start">Last Update</mat-list-item> <mat-list-item fxFlex="50" fxLayoutAlign="start start">Color</mat-list-item>
<mat-list-item fxFlex="40" fxLayoutAlign="start start">{{lookupResult.node.last_update_str}}</mat-list-item> <mat-list-item fxFlex="40" fxLayoutAlign="start start"><span
[ngStyle]="{'background-color': '#' + lookupResult.color}">{{lookupResult?.color}}</span></mat-list-item>
<mat-divider></mat-divider> <mat-divider></mat-divider>
</mat-list> </mat-list>
<mat-list fxLayoutAlign="start start"> <mat-list fxLayoutAlign="start start">
<mat-list-item fxFlex="50" fxLayoutAlign="start start">Total Capacity (Sats)</mat-list-item> <mat-list-item fxFlex="50" fxLayoutAlign="start start">Global Features</mat-list-item>
<mat-list-item fxFlex="40" fxLayoutAlign="start start">{{lookupResult.total_capacity | number}}</mat-list-item> <mat-list-item fxFlex="40" fxLayoutAlign="start start">{{lookupResult?.globalfeatures}}</mat-list-item>
<mat-divider></mat-divider> <mat-divider></mat-divider>
</mat-list> </mat-list>
<mat-list fxLayoutAlign="start start"> <mat-list fxLayoutAlign="start start">
<mat-list-item fxFlex="50" fxLayoutAlign="start start">Number of Channels</mat-list-item> <mat-list-item fxFlex="50" fxLayoutAlign="start start">Global_Features</mat-list-item>
<mat-list-item fxFlex="40" fxLayoutAlign="start start">{{lookupResult.num_channels | number}}</mat-list-item> <mat-list-item fxFlex="40" fxLayoutAlign="start start">{{lookupResult?.global_features}}</mat-list-item>
<mat-divider></mat-divider> <mat-divider></mat-divider>
</mat-list> </mat-list>
<mat-list fxLayout="column" fxLayoutAlign="start start"> <mat-list fxLayout="column" fxLayoutAlign="start start">
<mat-divider></mat-divider> <mat-divider></mat-divider>
<mat-list-item fxFlex="100" fxLayoutAlign="start start">Addresses</mat-list-item> <mat-list-item fxFlex="100" fxLayoutAlign="start start">Addresses</mat-list-item>
<mat-table [dataSource]="lookupResult.node.addresses" matSort class="mat-elevation-z8 overflow-auto"> <mat-table [dataSource]="lookupResult?.addresses" matSort class="mat-elevation-z8 overflow-auto">
<ng-container matColumnDef="network"> <ng-container matColumnDef="type">
<mat-header-cell *matHeaderCellDef mat-sort-header>Network</mat-header-cell> <mat-header-cell *matHeaderCellDef mat-sort-header>Type</mat-header-cell>
<mat-cell *matCellDef="let address"><div>{{address?.network}}</div></mat-cell> <mat-cell *matCellDef="let address">
<div>{{address?.type}}</div>
</mat-cell>
</ng-container> </ng-container>
<ng-container matColumnDef="addr"> <ng-container matColumnDef="address">
<mat-header-cell *matHeaderCellDef mat-sort-header>Address</mat-header-cell> <mat-header-cell *matHeaderCellDef mat-sort-header>Address</mat-header-cell>
<mat-cell *matCellDef="let address"><div>{{address?.addr}}</div></mat-cell> <mat-cell *matCellDef="let address">
<div>{{address?.address}}</div>
</mat-cell>
</ng-container>
<ng-container matColumnDef="port">
<mat-header-cell *matHeaderCellDef mat-sort-header>Port</mat-header-cell>
<mat-cell *matCellDef="let address">
<div>{{address?.port}}</div>
</mat-cell>
</ng-container> </ng-container>
<mat-header-row *matHeaderRowDef="displayedColumns;"></mat-header-row> <mat-header-row *matHeaderRowDef="displayedColumns;"></mat-header-row>
<mat-row fxLayoutAlign="stretch stretch" *matRowDef="let row; columns: displayedColumns;"></mat-row> <mat-row fxLayoutAlign="stretch stretch" *matRowDef="let row; columns: displayedColumns;"></mat-row>
@ -53,5 +64,4 @@
</mat-card-content> </mat-card-content>
</mat-card> </mat-card>
</div> </div>
</div> --> </div>
<h3>NODE LOOKUP</h3>

@ -1,7 +1,7 @@
import { Component, OnInit, Input } from '@angular/core'; import { Component, OnInit, Input } from '@angular/core';
import { formatDate } from '@angular/common'; import { formatDate } from '@angular/common';
import { GraphNodeCL } from '../../../shared/models/clModels'; import { LookupNodeCL } from '../../../shared/models/clModels';
@Component({ @Component({
selector: 'rtl-cl-node-lookup', selector: 'rtl-cl-node-lookup',
@ -9,15 +9,16 @@ import { GraphNodeCL } from '../../../shared/models/clModels';
styleUrls: ['./node-lookup.component.css'] styleUrls: ['./node-lookup.component.css']
}) })
export class CLNodeLookupComponent implements OnInit { export class CLNodeLookupComponent implements OnInit {
@Input() lookupResult: GraphNodeCL; @Input() lookupResult: LookupNodeCL;
public displayedColumns = ['network', 'addr']; public displayedColumns = ['type', 'address', 'port'];
constructor() { } constructor() { }
ngOnInit() { ngOnInit() {
if (undefined !== this.lookupResult && undefined !== this.lookupResult.node && undefined !== this.lookupResult.node.last_update_str) { console.warn(this.lookupResult);
this.lookupResult.node.last_update_str = (this.lookupResult.node.last_update_str === '') ? if (undefined !== this.lookupResult && undefined !== this.lookupResult.last_timestamp_str) {
'' : formatDate(this.lookupResult.node.last_update_str, 'MMM/dd/yy HH:mm:ss', 'en-US'); this.lookupResult.last_timestamp_str = (this.lookupResult.last_timestamp_str === '') ?
'' : formatDate(this.lookupResult.last_timestamp_str, 'MMM/dd/yy HH:mm:ss', 'en-US');
} }
} }

@ -14,7 +14,7 @@
tabindex="1" required #destPubkey="ngModel"> tabindex="1" required #destPubkey="ngModel">
</mat-form-field> </mat-form-field>
<mat-form-field fxFlex="20" fxLayoutAlign="start end"> <mat-form-field fxFlex="20" fxLayoutAlign="start end">
<input matInput placeholder="Amount (Sats)" name="amount" [(ngModel)]="amount" tabindex="2" type="number" <input matInput placeholder="Amount (mSats)" name="amount" [(ngModel)]="amount" tabindex="2" type="number"
step="1000" min="0" required #destAmount="ngModel"> step="1000" min="0" required #destAmount="ngModel">
</mat-form-field> </mat-form-field>
<div fxFlex="15" fxLayoutAlign="start start"> <div fxFlex="15" fxLayoutAlign="start start">

@ -221,6 +221,94 @@ export class CLEffects implements OnDestroy {
} }
)); ));
@Effect()
channelsFetchCL = this.actions$.pipe(
ofType(RTLActions.FETCH_CHANNELS_CL),
mergeMap((action: RTLActions.FetchChannelsCL) => {
this.store.dispatch(new RTLActions.ClearEffectErrorCl('FetchChannelsCL'));
return this.httpClient.get(this.CHILD_API_URL + environment.CHANNELS_API + '/listChannels')
.pipe(
map((channels: any) => {
this.logger.info(channels);
return {
type: RTLActions.SET_CHANNELS_CL,
payload: (undefined !== channels && channels.length > 0) ? channels : []
};
},
catchError((err: any) => {
return this.handleErrorWithoutAlert('FetchChannelsCL', err);
})
));
}
));
@Effect()
openNewChannelCL = this.actions$.pipe(
ofType(RTLActions.SAVE_NEW_CHANNEL_CL),
mergeMap((action: RTLActions.SaveNewChannelCL) => {
return this.httpClient.post(this.CHILD_API_URL + environment.CHANNELS_API, {
channelId: action.payload.channelId, satoshis: action.payload.satoshis, feeRate: action.payload.feeRate, private: action.payload.private, minconf: (action.payload.minconf) ? action.payload.minconf : ''
})
.pipe(
map((postRes: any) => {
this.logger.info(postRes);
this.store.dispatch(new RTLActions.CloseSpinner());
return {
type: RTLActions.FETCH_CHANNELS_CL
};
}),
catchError((err: any) => {
return this.handleErrorWithAlert('ERROR', 'Open Channel Failed', this.CHILD_API_URL + environment.CHANNELS_API, err);
})
);
}
));
@Effect()
updateChannelCL = this.actions$.pipe(
ofType(RTLActions.UPDATE_CHANNELS_CL),
mergeMap((action: RTLActions.UpdateChannelsCL) => {
return this.httpClient.post(this.CHILD_API_URL + environment.CHANNELS_API + '/setChannelFee',
{ id: action.payload.channelId, base: action.payload.baseFeeMsat, ppm: action.payload.feeRate })
.pipe(
map((postRes: any) => {
this.logger.info(postRes);
this.store.dispatch(new RTLActions.CloseSpinner());
this.store.dispatch(new RTLActions.OpenAlert({ width: '70%', data: { type: 'SUCCESS', titleMessage: 'Channel Updated Successfully!' } }));
return {
type: RTLActions.FETCH_CHANNELS_CL
};
}),
catchError((err: any) => {
return this.handleErrorWithAlert('ERROR', 'Update Channel Failed', this.CHILD_API_URL + environment.CHANNELS_API, err);
})
);
}
));
@Effect()
closeChannelCL = this.actions$.pipe(
ofType(RTLActions.CLOSE_CHANNEL_CL),
mergeMap((action: RTLActions.CloseChannelCL) => {
const queryParam = action.payload.timeoutSec ? '?unilateralTimeout =' + action.payload.timeoutSec : '';
return this.httpClient.delete(this.CHILD_API_URL + environment.CHANNELS_API + '/' + action.payload.channelId + queryParam)
.pipe(
map((postRes: any) => {
this.logger.info(postRes);
this.store.dispatch(new RTLActions.CloseSpinner());
this.store.dispatch(new RTLActions.FetchChannelsCL());
return {
type: RTLActions.REMOVE_CHANNEL_CL,
payload: { channelId: action.payload.channelId }
};
}),
catchError((err: any) => {
return this.handleErrorWithAlert('ERROR', 'Unable to Close Channel. Try again later.', this.CHILD_API_URL + environment.CHANNELS_API, err);
})
);
}
));
@Effect() @Effect()
paymentsFetchCL = this.actions$.pipe( paymentsFetchCL = this.actions$.pipe(
ofType(RTLActions.FETCH_PAYMENTS_CL), ofType(RTLActions.FETCH_PAYMENTS_CL),
@ -344,6 +432,84 @@ export class CLEffects implements OnDestroy {
}) })
); );
@Effect()
peerLookupCL = this.actions$.pipe(
ofType(RTLActions.PEER_LOOKUP_CL),
mergeMap((action: RTLActions.PeerLookupCL) => {
this.store.dispatch(new RTLActions.ClearEffectErrorCl('LookupCL'));
return this.httpClient.get(this.CHILD_API_URL + environment.NETWORK_API + '/listNode/' + action.payload)
.pipe(
map((resPeer) => {
this.logger.info(resPeer);
this.store.dispatch(new RTLActions.CloseSpinner());
return {
type: RTLActions.SET_LOOKUP_CL,
payload: resPeer
};
}),
catchError((err: any) => {
this.store.dispatch(new RTLActions.EffectErrorCl({ action: 'LookupCL', code: err.status, message: err.error.message }));
return this.handleErrorWithAlert('ERROR', 'Peer Lookup Failed', this.CHILD_API_URL + environment.NETWORK_API + '/listNode/' + action.payload, err);
})
);
})
);
@Effect()
channelLookupCL = this.actions$.pipe(
ofType(RTLActions.CHANNEL_LOOKUP_CL),
mergeMap((action: RTLActions.ChannelLookupCL) => {
this.store.dispatch(new RTLActions.ClearEffectErrorCl('LookupCL'));
return this.httpClient.get(this.CHILD_API_URL + environment.NETWORK_API + '/listChannel/' + action.payload)
.pipe(
map((resChannel) => {
this.logger.info(resChannel);
this.store.dispatch(new RTLActions.CloseSpinner());
return {
type: RTLActions.SET_LOOKUP_CL,
payload: resChannel
};
}),
catchError((err: any) => {
this.store.dispatch(new RTLActions.EffectErrorCl({ action: 'LookupCL', code: err.status, message: err.error.message }));
return this.handleErrorWithAlert('ERROR', 'Channel Lookup Failed', this.CHILD_API_URL + environment.NETWORK_API + '/listChannel/' + action.payload, err);
})
);
})
);
@Effect()
invoiceLookupCL = this.actions$.pipe(
ofType(RTLActions.INVOICE_LOOKUP_CL),
mergeMap((action: RTLActions.InvoiceLookupCL) => {
this.store.dispatch(new RTLActions.ClearEffectErrorCl('LookupCL'));
return this.httpClient.get(this.CHILD_API_URL + environment.INVOICES_API + '/listInvoice?label=' + action.payload)
.pipe(
map((resInvoice) => {
this.logger.info(resInvoice);
this.store.dispatch(new RTLActions.CloseSpinner());
return {
type: RTLActions.SET_LOOKUP_CL,
payload: resInvoice
};
}),
catchError((err: any) => {
this.store.dispatch(new RTLActions.EffectErrorCl({ action: 'LookupCL', code: err.status, message: err.error.message }));
return this.handleErrorWithAlert('ERROR', 'Invoice Lookup Failed', this.CHILD_API_URL + environment.NETWORK_API + '/listInvoice?label=' + action.payload, err);
})
);
})
);
@Effect({ dispatch: false })
setLookupCL = this.actions$.pipe(
ofType(RTLActions.SET_LOOKUP_CL),
map((action: RTLActions.SetLookupCL) => {
this.logger.info(action.payload);
return action.payload;
})
);
handleErrorWithoutAlert(actionName: string, err: {status: number, error: any}) { handleErrorWithoutAlert(actionName: string, err: {status: number, error: any}) {
this.logger.error(err); this.logger.error(err);
if(err.status === 401) { if(err.status === 401) {

@ -1,5 +1,5 @@
import { SelNodeChild } from '../../shared/models/RTLconfig'; import { SelNodeChild } from '../../shared/models/RTLconfig';
import { GetInfoCL, FeesCL, BalanceCL, LocalRemoteBalanceCL, AddressTypeCL, PeerCL, PaymentCL } from '../../shared/models/clModels'; import { GetInfoCL, FeesCL, BalanceCL, LocalRemoteBalanceCL, AddressTypeCL, PeerCL, PaymentCL, ChannelCL } from '../../shared/models/clModels';
import { ErrorPayload } from '../../shared/models/errorPayload'; import { ErrorPayload } from '../../shared/models/errorPayload';
import * as RTLActions from '../../store/rtl.actions'; import * as RTLActions from '../../store/rtl.actions';
@ -11,6 +11,7 @@ export interface CLState {
balance: BalanceCL; balance: BalanceCL;
localRemoteBalance: LocalRemoteBalanceCL; localRemoteBalance: LocalRemoteBalanceCL;
peers: PeerCL[]; peers: PeerCL[];
allChannels: ChannelCL[];
payments: PaymentCL[]; payments: PaymentCL[];
addressTypes: AddressTypeCL[]; addressTypes: AddressTypeCL[];
} }
@ -23,6 +24,7 @@ export const initCLState: CLState = {
balance: {}, balance: {},
localRemoteBalance: {}, localRemoteBalance: {},
peers: [], peers: [],
allChannels: [],
payments: [], payments: [],
addressTypes: [ addressTypes: [
{ addressId: '0', addressTp: 'bech32', addressDetails: 'bech32' }, { addressId: '0', addressTp: 'bech32', addressDetails: 'bech32' },
@ -96,7 +98,24 @@ export function CLReducer(state = initCLState, action: RTLActions.RTLActions) {
...state, ...state,
peers: modifiedPeers peers: modifiedPeers
}; };
case RTLActions.SET_PAYMENTS_CL: case RTLActions.SET_CHANNELS_CL:
return {
...state,
allChannels: action.payload,
};
case RTLActions.REMOVE_CHANNEL_CL:
const modifiedChannels = [...state.allChannels];
const removeChannelIdx = state.allChannels.findIndex(channel => {
return channel.channel_id === action.payload.channelId;
});
if (removeChannelIdx > -1) {
modifiedChannels.splice(removeChannelIdx, 1);
}
return {
...state,
allChannels: modifiedChannels
};
case RTLActions.SET_PAYMENTS_CL:
return { return {
...state, ...state,
payments: action.payload payments: action.payload

@ -495,6 +495,7 @@ export class LNDEffects implements OnDestroy {
channelsFetch = this.actions$.pipe( channelsFetch = this.actions$.pipe(
ofType(RTLActions.FETCH_CHANNELS), ofType(RTLActions.FETCH_CHANNELS),
mergeMap((action: RTLActions.FetchChannels) => { mergeMap((action: RTLActions.FetchChannels) => {
this.store.dispatch(new RTLActions.ClearEffectErrorLnd('FetchChannels/' + action.payload.routeParam));
return this.httpClient.get(this.CHILD_API_URL + environment.CHANNELS_API + '/' + action.payload.routeParam) return this.httpClient.get(this.CHILD_API_URL + environment.CHANNELS_API + '/' + action.payload.routeParam)
.pipe( .pipe(
map((channels: any) => { map((channels: any) => {

@ -1,4 +1,4 @@
export interface GetInfoAddress { export interface Address {
type?: string; type?: string;
address?: string; address?: string;
port?: number; port?: number;
@ -12,8 +12,8 @@ export interface GetInfoCL {
num_pending_channels?: number; num_pending_channels?: number;
num_active_channels?: number; num_active_channels?: number;
num_inactive_channels?: number; num_inactive_channels?: number;
address?: GetInfoAddress[]; address?: Address[];
binding?: GetInfoAddress[]; binding?: Address[];
version?: string; version?: string;
blockheight?: number; blockheight?: number;
network?: string; network?: string;
@ -44,27 +44,6 @@ export interface LocalRemoteBalanceCL {
btc_remoteBalance?: number; btc_remoteBalance?: number;
} }
export interface ChannelCL {
active?: boolean;
remote_pubkey?: string;
remote_alias?: string;
channel_point?: string;
chan_id?: number;
capacity?: number;
local_balance?: number;
remote_balance?: number;
commit_fee?: number;
commit_weight?: number;
fee_per_kw?: number;
unsettled_balance?: number;
total_satoshis_sent?: number;
total_satoshis_received?: number;
num_updates?: number;
private?: boolean;
pending_htlcs?: any[];
csv_delay?: number;
}
export interface PeerCL { export interface PeerCL {
id?: string; id?: string;
connected?: boolean; connected?: boolean;
@ -101,24 +80,6 @@ export interface InvoiceCL {
amt_paid_msat?: string; amt_paid_msat?: string;
} }
export interface ChannelEdgeCL {
channel_id?: string;
chan_point?: string;
last_update?: number;
last_update_str?: string;
node1_pub?: string;
node2_pub?: string;
capacity?: string;
node1_policy?: any;
node2_policy?: any;
}
export interface GraphNodeCL {
node?: any;
num_channels?: number;
total_capacity?: string;
}
export interface OnChainCL { export interface OnChainCL {
address?: string; address?: string;
amount?: number; amount?: number;
@ -200,4 +161,50 @@ export interface RoutesCL {
amount_msat?: string; amount_msat?: string;
delay?: number; delay?: number;
alias?: string; alias?: string;
} }
export interface ChannelCL {
peer_id?: string;
peer_alias?: string;
connected?: boolean;
state?: string;
short_channel_id?: string;
channel_id?: string;
funding_txid?: string;
private?: boolean;
msatoshi_to_us?: string;
msatoshi_total?: string;
their_channel_reserve_satoshis?: string;
our_channel_reserve_satoshis?: string;
spendable_msatoshi?: string;
}
export interface ChannelEdgeCL {
active?: boolean;
amount_msat?: string;
base_fee_millisatoshi?: number;
channel_flags?: number;
delay?: number;
destination?: string;
fee_per_millionth?: number;
htlc_maximum_msat?: string;
htlc_minimum_msat?: string;
last_update?: number;
last_update_str?: string;
message_flags?: number;
public?: boolean;
satoshis?: number;
short_channel_id?: string;
source?: string;
}
export interface LookupNodeCL {
nodeid?: string;
alias?: string;
color?: string;
last_timestamp?: number;
last_timestamp_str?: string;
globalfeatures?: string;
global_features?: string;
addresses?: Address[];
}

@ -3,7 +3,7 @@ import { Action } from '@ngrx/store';
import { ErrorPayload } from '../shared/models/errorPayload'; import { ErrorPayload } from '../shared/models/errorPayload';
import { RTLConfiguration, Settings, LightningNode, GetInfoRoot, SelNodeChild } from '../shared/models/RTLconfig'; import { RTLConfiguration, Settings, LightningNode, GetInfoRoot, SelNodeChild } from '../shared/models/RTLconfig';
import { GetInfoCL, FeesCL, AddressTypeCL, PeerCL, PaymentCL, PayRequestCL, QueryRoutesCL } from '../shared/models/clModels'; import { GetInfoCL, FeesCL, AddressTypeCL, PeerCL, PaymentCL, PayRequestCL, QueryRoutesCL, ChannelCL } from '../shared/models/clModels';
import { import {
GetInfo, Peer, Balance, NetworkInfo, Fees, Channel, Invoice, ListInvoices, Payment, GraphNode, AddressType, GetInfo, Peer, Balance, NetworkInfo, Fees, Channel, Invoice, ListInvoices, Payment, GraphNode, AddressType,
PayRequest, ChannelsTransaction, PendingChannels, ClosedChannel, Transaction, SwitchReq, SwitchRes, QueryRoutes PayRequest, ChannelsTransaction, PendingChannels, ClosedChannel, Transaction, SwitchReq, SwitchRes, QueryRoutes
@ -114,6 +114,12 @@ export const SAVE_NEW_PEER_CL = 'SAVE_NEW_PEER_CL';
export const ADD_PEER_CL = 'ADD_PEER_CL'; export const ADD_PEER_CL = 'ADD_PEER_CL';
export const DETACH_PEER_CL = 'DETACH_PEER_CL'; export const DETACH_PEER_CL = 'DETACH_PEER_CL';
export const REMOVE_PEER_CL = 'REMOVE_PEER_CL'; export const REMOVE_PEER_CL = 'REMOVE_PEER_CL';
export const FETCH_CHANNELS_CL = 'FETCH_CHANNELS_CL';
export const SET_CHANNELS_CL = 'SET_CHANNELS_CL';
export const UPDATE_CHANNELS_CL = 'UPDATE_CHANNELS_CL';
export const SAVE_NEW_CHANNEL_CL = 'SAVE_NEW_CHANNEL_CL';
export const CLOSE_CHANNEL_CL = 'CLOSE_CHANNEL_CL';
export const REMOVE_CHANNEL_CL = 'REMOVE_CHANNEL_CL';
export const FETCH_PAYMENTS_CL = 'FETCH_PAYMENTS_CL'; export const FETCH_PAYMENTS_CL = 'FETCH_PAYMENTS_CL';
export const SET_PAYMENTS_CL = 'SET_PAYMENTS_CL'; export const SET_PAYMENTS_CL = 'SET_PAYMENTS_CL';
export const DECODE_PAYMENT_CL = 'DECODE_PAYMENT_CL'; export const DECODE_PAYMENT_CL = 'DECODE_PAYMENT_CL';
@ -121,6 +127,10 @@ export const SEND_PAYMENT_CL = 'SEND_PAYMENT_CL';
export const SET_DECODED_PAYMENT_CL = 'SET_DECODED_PAYMENT_CL'; export const SET_DECODED_PAYMENT_CL = 'SET_DECODED_PAYMENT_CL';
export const GET_QUERY_ROUTES_CL = 'GET_QUERY_ROUTES_CL'; export const GET_QUERY_ROUTES_CL = 'GET_QUERY_ROUTES_CL';
export const SET_QUERY_ROUTES_CL = 'SET_QUERY_ROUTES_CL'; export const SET_QUERY_ROUTES_CL = 'SET_QUERY_ROUTES_CL';
export const PEER_LOOKUP_CL = 'PEER_LOOKUP_CL';
export const CHANNEL_LOOKUP_CL = 'CHANNEL_LOOKUP_CL';
export const INVOICE_LOOKUP_CL = 'INVOICE_LOOKUP_CL';
export const SET_LOOKUP_CL = 'SET_LOOKUP_CL';
export class VoidAction implements Action { export class VoidAction implements Action {
readonly type = VOID; readonly type = VOID;
@ -645,6 +655,55 @@ export class SetQueryRoutesCL implements Action {
constructor(public payload: QueryRoutesCL) {} constructor(public payload: QueryRoutesCL) {}
} }
export class FetchChannelsCL implements Action {
readonly type = FETCH_CHANNELS_CL;
}
export class SetChannelsCL implements Action {
readonly type = SET_CHANNELS_CL;
constructor(public payload: ChannelCL[]) {}
}
export class UpdateChannelsCL implements Action {
readonly type = UPDATE_CHANNELS_CL;
constructor(public payload: {channelId: string, baseFeeMsat: number, feeRate: number}) {}
}
export class SaveNewChannelCL implements Action {
readonly type = SAVE_NEW_CHANNEL_CL;
constructor(public payload: {channelId: string, satoshis: number, feeRate: string, private: boolean, minconf?: number}) {}
}
export class CloseChannelCL implements Action {
readonly type = CLOSE_CHANNEL_CL;
constructor(public payload: {channelId: string, timeoutSec?: number}) {}
}
export class RemoveChannelCL implements Action {
readonly type = REMOVE_CHANNEL_CL;
constructor(public payload: {channelId: string}) {}
}
export class PeerLookupCL implements Action {
readonly type = PEER_LOOKUP_CL;
constructor(public payload: string) {} // payload = id
}
export class ChannelLookupCL implements Action {
readonly type = CHANNEL_LOOKUP_CL;
constructor(public payload: string) {} // payload = channel_short_id
}
export class InvoiceLookupCL implements Action {
readonly type = INVOICE_LOOKUP_CL;
constructor(public payload: string) {} // payload = rHashStr
}
export class SetLookupCL implements Action {
readonly type = SET_LOOKUP_CL;
constructor(public payload: any) {} // payload = lookup Response (Peer/Channel/Invoice)
}
export type RTLActions = export type RTLActions =
ClearEffectErrorRoot | EffectErrorRoot | ClearEffectErrorLnd | EffectErrorLnd | ClearEffectErrorCl | EffectErrorCl | ClearEffectErrorRoot | EffectErrorRoot | ClearEffectErrorLnd | EffectErrorLnd | ClearEffectErrorCl | EffectErrorCl |
VoidAction | OpenSpinner | CloseSpinner | FetchRTLConfig | SetRTLConfig | SaveSettings | VoidAction | OpenSpinner | CloseSpinner | FetchRTLConfig | SetRTLConfig | SaveSettings |
@ -672,5 +731,7 @@ export type RTLActions =
FetchBalanceCL | SetBalanceCL | FetchLocalRemoteBalanceCL | SetLocalRemoteBalanceCL | FetchBalanceCL | SetBalanceCL | FetchLocalRemoteBalanceCL | SetLocalRemoteBalanceCL |
GetNewAddressCL | SetNewAddressCL | GetNewAddressCL | SetNewAddressCL |
FetchPeersCL | SetPeersCL | AddPeerCL | DetachPeerCL | SaveNewPeerCL | RemovePeerCL | FetchPeersCL | SetPeersCL | AddPeerCL | DetachPeerCL | SaveNewPeerCL | RemovePeerCL |
FetchChannelsCL | SetChannelsCL | UpdateChannelsCL | SaveNewChannelCL | CloseChannelCL | RemoveChannelCL |
FetchPaymentsCL | SetPaymentsCL | SendPaymentCL | DecodePaymentCL | SetDecodedPaymentCL | FetchPaymentsCL | SetPaymentsCL | SendPaymentCL | DecodePaymentCL | SetDecodedPaymentCL |
GetQueryRoutesCL | SetQueryRoutesCL; GetQueryRoutesCL | SetQueryRoutesCL |
PeerLookupCL | ChannelLookupCL | InvoiceLookupCL | SetLookupCL;

Loading…
Cancel
Save