TS Lint Errors Fixes

TS Lint Errors Fixes
pull/1099/head
ShahanaFarooqui 2 years ago
parent 20bb789c47
commit 25ba51c467

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

@ -13,6 +13,6 @@
<style>@font-face{font-family:Roboto;src:url(Roboto-Thin.f7a95c9c5999532c.woff2) format("woff2"),url(Roboto-Thin.c13c157cb81e8ebb.woff) format("woff");font-weight:100;font-style:normal}@font-face{font-family:Roboto;src:url(Roboto-ThinItalic.b0e084abf689f393.woff2) format("woff2"),url(Roboto-ThinItalic.1111028df6cea564.woff) format("woff");font-weight:100;font-style:italic}@font-face{font-family:Roboto;src:url(Roboto-Light.0e01b6cd13b3857f.woff2) format("woff2"),url(Roboto-Light.603ca9a537b88428.woff) format("woff");font-weight:300;font-style:normal}@font-face{font-family:Roboto;src:url(Roboto-LightItalic.232ef4b20215f720.woff2) format("woff2"),url(Roboto-LightItalic.1b5e142f787151c8.woff) format("woff");font-weight:300;font-style:italic}@font-face{font-family:Roboto;src:url(Roboto-Regular.475ba9e4e2d63456.woff2) format("woff2"),url(Roboto-Regular.bcefbfee882bc1cb.woff) format("woff");font-weight:400;font-style:normal}@font-face{font-family:Roboto;src:url(Roboto-RegularItalic.e3a9ebdaac06bbc4.woff2) format("woff2"),url(Roboto-RegularItalic.0668fae6af0cf8c2.woff) format("woff");font-weight:400;font-style:italic}@font-face{font-family:Roboto;src:url(Roboto-Medium.457532032ceb0168.woff2) format("woff2"),url(Roboto-Medium.6e1ae5f0b324a0aa.woff) format("woff");font-weight:500;font-style:normal}@font-face{font-family:Roboto;src:url(Roboto-MediumItalic.872f7060602d55d2.woff2) format("woff2"),url(Roboto-MediumItalic.e06fb533801cbb08.woff) format("woff");font-weight:500;font-style:italic}@font-face{font-family:Roboto;src:url(Roboto-Bold.447291a88c067396.woff2) format("woff2"),url(Roboto-Bold.fc482e6133cf5e26.woff) format("woff");font-weight:700;font-style:normal}@font-face{font-family:Roboto;src:url(Roboto-BoldItalic.1b15168ef6fa4e16.woff2) format("woff2"),url(Roboto-BoldItalic.e26ba339b06f09f7.woff) format("woff");font-weight:700;font-style:italic}@font-face{font-family:Roboto;src:url(Roboto-Black.2eaa390d458c877d.woff2) format("woff2"),url(Roboto-Black.b25f67ad8583da68.woff) format("woff");font-weight:900;font-style:normal}@font-face{font-family:Roboto;src:url(Roboto-BlackItalic.7dc03ee444552bc5.woff2) format("woff2"),url(Roboto-BlackItalic.c8dc642467cb3099.woff) format("woff");font-weight:900;font-style:italic}html{width:100%;height:99%;line-height:1.5;overflow-x:hidden;font-family:Roboto,sans-serif!important;font-size:62.5%}body{box-sizing:border-box;height:100%;margin:0;overflow:hidden}*{margin:0;padding:0}</style><link rel="stylesheet" href="styles.43515fc39338348b.css" media="print" onload="this.media='all'"><noscript><link rel="stylesheet" href="styles.43515fc39338348b.css"></noscript></head> <style>@font-face{font-family:Roboto;src:url(Roboto-Thin.f7a95c9c5999532c.woff2) format("woff2"),url(Roboto-Thin.c13c157cb81e8ebb.woff) format("woff");font-weight:100;font-style:normal}@font-face{font-family:Roboto;src:url(Roboto-ThinItalic.b0e084abf689f393.woff2) format("woff2"),url(Roboto-ThinItalic.1111028df6cea564.woff) format("woff");font-weight:100;font-style:italic}@font-face{font-family:Roboto;src:url(Roboto-Light.0e01b6cd13b3857f.woff2) format("woff2"),url(Roboto-Light.603ca9a537b88428.woff) format("woff");font-weight:300;font-style:normal}@font-face{font-family:Roboto;src:url(Roboto-LightItalic.232ef4b20215f720.woff2) format("woff2"),url(Roboto-LightItalic.1b5e142f787151c8.woff) format("woff");font-weight:300;font-style:italic}@font-face{font-family:Roboto;src:url(Roboto-Regular.475ba9e4e2d63456.woff2) format("woff2"),url(Roboto-Regular.bcefbfee882bc1cb.woff) format("woff");font-weight:400;font-style:normal}@font-face{font-family:Roboto;src:url(Roboto-RegularItalic.e3a9ebdaac06bbc4.woff2) format("woff2"),url(Roboto-RegularItalic.0668fae6af0cf8c2.woff) format("woff");font-weight:400;font-style:italic}@font-face{font-family:Roboto;src:url(Roboto-Medium.457532032ceb0168.woff2) format("woff2"),url(Roboto-Medium.6e1ae5f0b324a0aa.woff) format("woff");font-weight:500;font-style:normal}@font-face{font-family:Roboto;src:url(Roboto-MediumItalic.872f7060602d55d2.woff2) format("woff2"),url(Roboto-MediumItalic.e06fb533801cbb08.woff) format("woff");font-weight:500;font-style:italic}@font-face{font-family:Roboto;src:url(Roboto-Bold.447291a88c067396.woff2) format("woff2"),url(Roboto-Bold.fc482e6133cf5e26.woff) format("woff");font-weight:700;font-style:normal}@font-face{font-family:Roboto;src:url(Roboto-BoldItalic.1b15168ef6fa4e16.woff2) format("woff2"),url(Roboto-BoldItalic.e26ba339b06f09f7.woff) format("woff");font-weight:700;font-style:italic}@font-face{font-family:Roboto;src:url(Roboto-Black.2eaa390d458c877d.woff2) format("woff2"),url(Roboto-Black.b25f67ad8583da68.woff) format("woff");font-weight:900;font-style:normal}@font-face{font-family:Roboto;src:url(Roboto-BlackItalic.7dc03ee444552bc5.woff2) format("woff2"),url(Roboto-BlackItalic.c8dc642467cb3099.woff) format("woff");font-weight:900;font-style:italic}html{width:100%;height:99%;line-height:1.5;overflow-x:hidden;font-family:Roboto,sans-serif!important;font-size:62.5%}body{box-sizing:border-box;height:100%;margin:0;overflow:hidden}*{margin:0;padding:0}</style><link rel="stylesheet" href="styles.43515fc39338348b.css" media="print" onload="this.media='all'"><noscript><link rel="stylesheet" href="styles.43515fc39338348b.css"></noscript></head>
<body> <body>
<rtl-app></rtl-app> <rtl-app></rtl-app>
<script src="runtime.4665fe090c507b74.js" type="module"></script><script src="polyfills.eddc63f1737a019a.js" type="module"></script><script src="main.4ce8058ec57eb017.js" type="module"></script> <script src="runtime.b2f592475a75f0a0.js" type="module"></script><script src="polyfills.eddc63f1737a019a.js" type="module"></script><script src="main.a477d212baf7bc20.js" type="module"></script>
</body></html> </body></html>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -1 +1 @@
(()=>{"use strict";var e,v={},g={};function r(e){var n=g[e];if(void 0!==n)return n.exports;var t=g[e]={id:e,loaded:!1,exports:{}};return v[e].call(t.exports,t,t.exports,r),t.loaded=!0,t.exports}r.m=v,e=[],r.O=(n,t,f,o)=>{if(!t){var a=1/0;for(i=0;i<e.length;i++){for(var[t,f,o]=e[i],s=!0,d=0;d<t.length;d++)(!1&o||a>=o)&&Object.keys(r.O).every(b=>r.O[b](t[d]))?t.splice(d--,1):(s=!1,o<a&&(a=o));if(s){e.splice(i--,1);var l=f();void 0!==l&&(n=l)}}return n}o=o||0;for(var i=e.length;i>0&&e[i-1][2]>o;i--)e[i]=e[i-1];e[i]=[t,f,o]},r.n=e=>{var n=e&&e.__esModule?()=>e.default:()=>e;return r.d(n,{a:n}),n},r.d=(e,n)=>{for(var t in n)r.o(n,t)&&!r.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:n[t]})},r.f={},r.e=e=>Promise.all(Object.keys(r.f).reduce((n,t)=>(r.f[t](e,n),n),[])),r.u=e=>e+"."+{564:"be9ebe6c4e3faeaa",636:"8c8e515a2dc3c81e",893:"9a615c46b89a5a79",924:"a2489290b287f550"}[e]+".js",r.miniCssF=e=>{},r.o=(e,n)=>Object.prototype.hasOwnProperty.call(e,n),(()=>{var e={},n="RTLApp:";r.l=(t,f,o,i)=>{if(e[t])e[t].push(f);else{var a,s;if(void 0!==o)for(var d=document.getElementsByTagName("script"),l=0;l<d.length;l++){var u=d[l];if(u.getAttribute("src")==t||u.getAttribute("data-webpack")==n+o){a=u;break}}a||(s=!0,(a=document.createElement("script")).type="module",a.charset="utf-8",a.timeout=120,r.nc&&a.setAttribute("nonce",r.nc),a.setAttribute("data-webpack",n+o),a.src=r.tu(t)),e[t]=[f];var c=(m,b)=>{a.onerror=a.onload=null,clearTimeout(p);var h=e[t];if(delete e[t],a.parentNode&&a.parentNode.removeChild(a),h&&h.forEach(_=>_(b)),m)return m(b)},p=setTimeout(c.bind(null,void 0,{type:"timeout",target:a}),12e4);a.onerror=c.bind(null,a.onerror),a.onload=c.bind(null,a.onload),s&&document.head.appendChild(a)}}})(),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.nmd=e=>(e.paths=[],e.children||(e.children=[]),e),(()=>{var e;r.tt=()=>(void 0===e&&(e={createScriptURL:n=>n},"undefined"!=typeof trustedTypes&&trustedTypes.createPolicy&&(e=trustedTypes.createPolicy("angular#bundler",e))),e)})(),r.tu=e=>r.tt().createScriptURL(e),r.p="",(()=>{var e={666:0};r.f.j=(f,o)=>{var i=r.o(e,f)?e[f]:void 0;if(0!==i)if(i)o.push(i[2]);else if(666!=f){var a=new Promise((u,c)=>i=e[f]=[u,c]);o.push(i[2]=a);var s=r.p+r.u(f),d=new Error;r.l(s,u=>{if(r.o(e,f)&&(0!==(i=e[f])&&(e[f]=void 0),i)){var c=u&&("load"===u.type?"missing":u.type),p=u&&u.target&&u.target.src;d.message="Loading chunk "+f+" failed.\n("+c+": "+p+")",d.name="ChunkLoadError",d.type=c,d.request=p,i[1](d)}},"chunk-"+f,f)}else e[f]=0},r.O.j=f=>0===e[f];var n=(f,o)=>{var d,l,[i,a,s]=o,u=0;if(i.some(p=>0!==e[p])){for(d in a)r.o(a,d)&&(r.m[d]=a[d]);if(s)var c=s(r)}for(f&&f(o);u<i.length;u++)r.o(e,l=i[u])&&e[l]&&e[l][0](),e[l]=0;return r.O(c)},t=self.webpackChunkRTLApp=self.webpackChunkRTLApp||[];t.forEach(n.bind(null,0)),t.push=n.bind(null,t.push.bind(t))})()})(); (()=>{"use strict";var e,v={},g={};function r(e){var n=g[e];if(void 0!==n)return n.exports;var t=g[e]={id:e,loaded:!1,exports:{}};return v[e].call(t.exports,t,t.exports,r),t.loaded=!0,t.exports}r.m=v,e=[],r.O=(n,t,f,o)=>{if(!t){var a=1/0;for(i=0;i<e.length;i++){for(var[t,f,o]=e[i],s=!0,u=0;u<t.length;u++)(!1&o||a>=o)&&Object.keys(r.O).every(b=>r.O[b](t[u]))?t.splice(u--,1):(s=!1,o<a&&(a=o));if(s){e.splice(i--,1);var d=f();void 0!==d&&(n=d)}}return n}o=o||0;for(var i=e.length;i>0&&e[i-1][2]>o;i--)e[i]=e[i-1];e[i]=[t,f,o]},r.n=e=>{var n=e&&e.__esModule?()=>e.default:()=>e;return r.d(n,{a:n}),n},r.d=(e,n)=>{for(var t in n)r.o(n,t)&&!r.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:n[t]})},r.f={},r.e=e=>Promise.all(Object.keys(r.f).reduce((n,t)=>(r.f[t](e,n),n),[])),r.u=e=>e+"."+{564:"9c466ff107a4d969",636:"f006527ee1d33a67",893:"9a615c46b89a5a79",924:"1c1eb885f1f101d2"}[e]+".js",r.miniCssF=e=>{},r.o=(e,n)=>Object.prototype.hasOwnProperty.call(e,n),(()=>{var e={},n="RTLApp:";r.l=(t,f,o,i)=>{if(e[t])e[t].push(f);else{var a,s;if(void 0!==o)for(var u=document.getElementsByTagName("script"),d=0;d<u.length;d++){var l=u[d];if(l.getAttribute("src")==t||l.getAttribute("data-webpack")==n+o){a=l;break}}a||(s=!0,(a=document.createElement("script")).type="module",a.charset="utf-8",a.timeout=120,r.nc&&a.setAttribute("nonce",r.nc),a.setAttribute("data-webpack",n+o),a.src=r.tu(t)),e[t]=[f];var c=(m,b)=>{a.onerror=a.onload=null,clearTimeout(p);var h=e[t];if(delete e[t],a.parentNode&&a.parentNode.removeChild(a),h&&h.forEach(_=>_(b)),m)return m(b)},p=setTimeout(c.bind(null,void 0,{type:"timeout",target:a}),12e4);a.onerror=c.bind(null,a.onerror),a.onload=c.bind(null,a.onload),s&&document.head.appendChild(a)}}})(),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.nmd=e=>(e.paths=[],e.children||(e.children=[]),e),(()=>{var e;r.tt=()=>(void 0===e&&(e={createScriptURL:n=>n},"undefined"!=typeof trustedTypes&&trustedTypes.createPolicy&&(e=trustedTypes.createPolicy("angular#bundler",e))),e)})(),r.tu=e=>r.tt().createScriptURL(e),r.p="",(()=>{var e={666:0};r.f.j=(f,o)=>{var i=r.o(e,f)?e[f]:void 0;if(0!==i)if(i)o.push(i[2]);else if(666!=f){var a=new Promise((l,c)=>i=e[f]=[l,c]);o.push(i[2]=a);var s=r.p+r.u(f),u=new Error;r.l(s,l=>{if(r.o(e,f)&&(0!==(i=e[f])&&(e[f]=void 0),i)){var c=l&&("load"===l.type?"missing":l.type),p=l&&l.target&&l.target.src;u.message="Loading chunk "+f+" failed.\n("+c+": "+p+")",u.name="ChunkLoadError",u.type=c,u.request=p,i[1](u)}},"chunk-"+f,f)}else e[f]=0},r.O.j=f=>0===e[f];var n=(f,o)=>{var u,d,[i,a,s]=o,l=0;if(i.some(p=>0!==e[p])){for(u in a)r.o(a,u)&&(r.m[u]=a[u]);if(s)var c=s(r)}for(f&&f(o);l<i.length;l++)r.o(e,d=i[l])&&e[d]&&e[d][0](),e[d]=0;return r.O(c)},t=self.webpackChunkRTLApp=self.webpackChunkRTLApp||[];t.forEach(n.bind(null,0)),t.push=n.bind(null,t.push.bind(t))})()})();

@ -76,7 +76,7 @@ export class AppComponent implements OnInit, AfterViewInit, OnDestroy {
} }
}); });
this.store.dispatch(fetchRTLConfig()); this.store.dispatch(fetchRTLConfig());
this.accessKey = this.readAccessKey(); this.accessKey = this.readAccessKey() || '';
this.store.select(rootSelectedNode).pipe(takeUntil(this.unSubs[1])).subscribe((selNode) => { this.store.select(rootSelectedNode).pipe(takeUntil(this.unSubs[1])).subscribe((selNode) => {
this.settings = selNode.settings; this.settings = selNode.settings;
if (!this.sessionService.getItem('token')) { if (!this.sessionService.getItem('token')) {

@ -43,7 +43,7 @@ export class CLNHomeComponent implements OnInit, OnDestroy {
public faNetworkWired = faNetworkWired; public faNetworkWired = faNetworkWired;
public userPersonaEnum = UserPersonaEnum; public userPersonaEnum = UserPersonaEnum;
public channelBalances = { localBalance: 0, remoteBalance: 0, balancedness: 0 }; public channelBalances = { localBalance: 0, remoteBalance: 0, balancedness: 0 };
public selNode: SelNodeChild = {}; public selNode: SelNodeChild | null = {};
public fees: Fees; public fees: Fees;
public information: GetInfo = {}; public information: GetInfo = {};
public totalBalance: Balance = {}; public totalBalance: Balance = {};
@ -120,7 +120,7 @@ export class CLNHomeComponent implements OnInit, OnDestroy {
ngOnInit() { ngOnInit() {
this.store.select(nodeInfoAndNodeSettingsAndAPIsStatus).pipe(takeUntil(this.unSubs[0])). this.store.select(nodeInfoAndNodeSettingsAndAPIsStatus).pipe(takeUntil(this.unSubs[0])).
subscribe((infoSettingsStatusSelector: { information: GetInfo, nodeSettings: SelNodeChild, apisCallStatus: ApiCallStatusPayload[] }) => { subscribe((infoSettingsStatusSelector: { information: GetInfo, nodeSettings: SelNodeChild | null, apisCallStatus: ApiCallStatusPayload[] }) => {
this.errorMessages[0] = ''; this.errorMessages[0] = '';
this.errorMessages[5] = ''; this.errorMessages[5] = '';
this.apiCallStatusNodeInfo = infoSettingsStatusSelector.apisCallStatus[0]; this.apiCallStatusNodeInfo = infoSettingsStatusSelector.apisCallStatus[0];

@ -18,9 +18,9 @@ export class CLNFeeRatesComponent implements AfterContentChecked {
ngAfterContentChecked() { ngAfterContentChecked() {
if (this.feeRateStyle === feeRateStyle.KB) { if (this.feeRateStyle === feeRateStyle.KB) {
this.perkbw = this.feeRates.perkb; this.perkbw = this.feeRates.perkb!;
} else if (this.feeRateStyle === feeRateStyle.KW) { } else if (this.feeRateStyle === feeRateStyle.KW) {
this.perkbw = this.feeRates.perkw; this.perkbw = this.feeRates.perkw!;
} }
} }

@ -5,7 +5,7 @@ import { Store } from '@ngrx/store';
import { faBolt, faServer, faNetworkWired, faLink } from '@fortawesome/free-solid-svg-icons'; import { faBolt, faServer, faNetworkWired, faLink } from '@fortawesome/free-solid-svg-icons';
import { SelNodeChild } from '../../shared/models/RTLconfig'; import { SelNodeChild } from '../../shared/models/RTLconfig';
import { GetInfo, Fees, ChannelsStatus, FeeRates, ForwardingEvent, LocalRemoteBalance, Channel, ListForwards } from '../../shared/models/clnModels'; import { GetInfo, Fees, ChannelsStatus, FeeRates, LocalRemoteBalance, Channel, ListForwards } from '../../shared/models/clnModels';
import { APICallStatusEnum, ScreenSizeEnum, UserPersonaEnum } from '../../shared/services/consts-enums-functions'; import { APICallStatusEnum, ScreenSizeEnum, UserPersonaEnum } from '../../shared/services/consts-enums-functions';
import { ApiCallStatusPayload } from '../../shared/models/apiCallsPayload'; import { ApiCallStatusPayload } from '../../shared/models/apiCallsPayload';
import { LoggerService } from '../../shared/services/logger.service'; import { LoggerService } from '../../shared/services/logger.service';
@ -25,25 +25,25 @@ export class CLNNetworkInfoComponent implements OnInit, OnDestroy {
public faServer = faServer; public faServer = faServer;
public faNetworkWired = faNetworkWired; public faNetworkWired = faNetworkWired;
public faLink = faLink; public faLink = faLink;
public selNode: SelNodeChild = {}; public selNode: SelNodeChild | null = {};
public information: GetInfo = {}; public information: GetInfo = {};
public fees: Fees; public fees: Fees;
public channelsStatus: ChannelsStatus = { active: {}, pending: {}, inactive: {} }; public channelsStatus: ChannelsStatus = { active: {}, pending: {}, inactive: {} };
public feeRatesPerKB: FeeRates = {}; public feeRatesPerKB: FeeRates = {};
public feeRatesPerKW: FeeRates = {}; public feeRatesPerKW: FeeRates = {};
public nodeCardsOperator = []; public nodeCardsOperator: any[] = [];
public nodeCardsMerchant = []; public nodeCardsMerchant: any[] = [];
public screenSize = ''; public screenSize = '';
public screenSizeEnum = ScreenSizeEnum; public screenSizeEnum = ScreenSizeEnum;
public userPersonaEnum = UserPersonaEnum; public userPersonaEnum = UserPersonaEnum;
public errorMessages = ['', '', '', '', '', '', '']; public errorMessages = ['', '', '', '', '', '', ''];
public apiCallStatusNodeInfo: ApiCallStatusPayload = null; public apiCallStatusNodeInfo: ApiCallStatusPayload | null = null;
public apiCallStatusLRBal: ApiCallStatusPayload = null; public apiCallStatusLRBal: ApiCallStatusPayload | null = null;
public apiCallStatusChannels: ApiCallStatusPayload = null; public apiCallStatusChannels: ApiCallStatusPayload | null = null;
public apiCallStatusFees: ApiCallStatusPayload = null; public apiCallStatusFees: ApiCallStatusPayload | null = null;
public apiCallStatusFHistory: ApiCallStatusPayload = null; public apiCallStatusFHistory: ApiCallStatusPayload | null = null;
public apiCallStatusPerKB: ApiCallStatusPayload = null; public apiCallStatusPerKB: ApiCallStatusPayload | null = null;
public apiCallStatusPerKW: ApiCallStatusPayload = null; public apiCallStatusPerKW: ApiCallStatusPayload | null = null;
public apiCallStatusEnum = APICallStatusEnum; public apiCallStatusEnum = APICallStatusEnum;
private unSubs: Array<Subject<void>> = [new Subject(), new Subject(), new Subject(), new Subject(), new Subject(), new Subject(), new Subject()]; private unSubs: Array<Subject<void>> = [new Subject(), new Subject(), new Subject(), new Subject(), new Subject(), new Subject(), new Subject()];
@ -82,11 +82,11 @@ export class CLNNetworkInfoComponent implements OnInit, OnDestroy {
ngOnInit() { ngOnInit() {
this.store.select(nodeInfoAndNodeSettingsAndAPIsStatus).pipe(takeUntil(this.unSubs[0])). this.store.select(nodeInfoAndNodeSettingsAndAPIsStatus).pipe(takeUntil(this.unSubs[0])).
subscribe((infoSettingsStatusSelector: { information: GetInfo, nodeSettings: SelNodeChild, apisCallStatus: ApiCallStatusPayload[] }) => { subscribe((infoSettingsStatusSelector: { information: GetInfo, nodeSettings: SelNodeChild | null, apisCallStatus: ApiCallStatusPayload[] }) => {
this.errorMessages[0] = ''; this.errorMessages[0] = '';
this.apiCallStatusNodeInfo = infoSettingsStatusSelector.apisCallStatus[0]; this.apiCallStatusNodeInfo = infoSettingsStatusSelector.apisCallStatus[0];
if (this.apiCallStatusNodeInfo.status === APICallStatusEnum.ERROR) { if (this.apiCallStatusNodeInfo.status === APICallStatusEnum.ERROR) {
this.errorMessages[0] = (typeof (this.apiCallStatusNodeInfo.message) === 'object') ? JSON.stringify(this.apiCallStatusNodeInfo.message) : this.apiCallStatusNodeInfo.message; this.errorMessages[0] = (typeof (this.apiCallStatusNodeInfo.message) === 'object') ? JSON.stringify(this.apiCallStatusNodeInfo.message) : this.apiCallStatusNodeInfo.message ? this.apiCallStatusNodeInfo.message : '';
} }
this.selNode = infoSettingsStatusSelector.nodeSettings; this.selNode = infoSettingsStatusSelector.nodeSettings;
this.information = infoSettingsStatusSelector.information; this.information = infoSettingsStatusSelector.information;
@ -100,10 +100,10 @@ export class CLNNetworkInfoComponent implements OnInit, OnDestroy {
this.apiCallStatusLRBal = channelsSeletor.apiCallStatus; this.apiCallStatusLRBal = channelsSeletor.apiCallStatus;
this.apiCallStatusChannels = lrBalanceSeletor.apiCallStatus; this.apiCallStatusChannels = lrBalanceSeletor.apiCallStatus;
if (this.apiCallStatusLRBal.status === APICallStatusEnum.ERROR) { if (this.apiCallStatusLRBal.status === APICallStatusEnum.ERROR) {
this.errorMessages[2] = (typeof (this.apiCallStatusLRBal.message) === 'object') ? JSON.stringify(this.apiCallStatusLRBal.message) : this.apiCallStatusLRBal.message; this.errorMessages[2] = (typeof (this.apiCallStatusLRBal.message) === 'object') ? JSON.stringify(this.apiCallStatusLRBal.message) : this.apiCallStatusLRBal.message ? this.apiCallStatusLRBal.message : '';
} }
if (this.apiCallStatusChannels.status === APICallStatusEnum.ERROR) { if (this.apiCallStatusChannels.status === APICallStatusEnum.ERROR) {
this.errorMessages[3] = (typeof (this.apiCallStatusChannels.message) === 'object') ? JSON.stringify(this.apiCallStatusChannels.message) : this.apiCallStatusChannels.message; this.errorMessages[3] = (typeof (this.apiCallStatusChannels.message) === 'object') ? JSON.stringify(this.apiCallStatusChannels.message) : this.apiCallStatusChannels.message ? this.apiCallStatusChannels.message : '';
} }
this.channelsStatus.active.channels = channelsSeletor.activeChannels.length || 0; this.channelsStatus.active.channels = channelsSeletor.activeChannels.length || 0;
this.channelsStatus.pending.channels = channelsSeletor.pendingChannels.length || 0; this.channelsStatus.pending.channels = channelsSeletor.pendingChannels.length || 0;
@ -117,7 +117,7 @@ export class CLNNetworkInfoComponent implements OnInit, OnDestroy {
this.errorMessages[1] = ''; this.errorMessages[1] = '';
this.apiCallStatusFees = feesSeletor.apiCallStatus; this.apiCallStatusFees = feesSeletor.apiCallStatus;
if (this.apiCallStatusFees.status === APICallStatusEnum.ERROR) { if (this.apiCallStatusFees.status === APICallStatusEnum.ERROR) {
this.errorMessages[1] = (typeof (this.apiCallStatusFees.message) === 'object') ? JSON.stringify(this.apiCallStatusFees.message) : this.apiCallStatusFees.message; this.errorMessages[1] = (typeof (this.apiCallStatusFees.message) === 'object') ? JSON.stringify(this.apiCallStatusFees.message) : this.apiCallStatusFees.message ? this.apiCallStatusFees.message : '';
} }
this.fees = feesSeletor.fees; this.fees = feesSeletor.fees;
}); });
@ -126,9 +126,9 @@ export class CLNNetworkInfoComponent implements OnInit, OnDestroy {
this.errorMessages[4] = ''; this.errorMessages[4] = '';
this.apiCallStatusFHistory = fhSeletor.apiCallStatus; this.apiCallStatusFHistory = fhSeletor.apiCallStatus;
if (this.apiCallStatusFHistory.status === APICallStatusEnum.ERROR) { if (this.apiCallStatusFHistory.status === APICallStatusEnum.ERROR) {
this.errorMessages[4] = (typeof (this.apiCallStatusFHistory.message) === 'object') ? JSON.stringify(this.apiCallStatusFHistory.message) : this.apiCallStatusFHistory.message; this.errorMessages[4] = (typeof (this.apiCallStatusFHistory.message) === 'object') ? JSON.stringify(this.apiCallStatusFHistory.message) : this.apiCallStatusFHistory.message ? this.apiCallStatusFHistory.message : '';
} }
if (fhSeletor.forwardingHistory && fhSeletor.forwardingHistory.listForwards.length) { if (fhSeletor.forwardingHistory && fhSeletor.forwardingHistory.listForwards && fhSeletor.forwardingHistory.listForwards.length) {
this.fees.totalTxCount = fhSeletor.forwardingHistory.listForwards.length; this.fees.totalTxCount = fhSeletor.forwardingHistory.listForwards.length;
} }
}); });
@ -137,7 +137,7 @@ export class CLNNetworkInfoComponent implements OnInit, OnDestroy {
this.errorMessages[5] = ''; this.errorMessages[5] = '';
this.apiCallStatusPerKB = frbSeletor.apiCallStatus; this.apiCallStatusPerKB = frbSeletor.apiCallStatus;
if (this.apiCallStatusPerKB.status === APICallStatusEnum.ERROR) { if (this.apiCallStatusPerKB.status === APICallStatusEnum.ERROR) {
this.errorMessages[5] = (typeof (this.apiCallStatusPerKB.message) === 'object') ? JSON.stringify(this.apiCallStatusPerKB.message) : this.apiCallStatusPerKB.message; this.errorMessages[5] = (typeof (this.apiCallStatusPerKB.message) === 'object') ? JSON.stringify(this.apiCallStatusPerKB.message) : this.apiCallStatusPerKB.message ? this.apiCallStatusPerKB.message : '';
} }
this.feeRatesPerKB = frbSeletor.feeRatesPerKB; this.feeRatesPerKB = frbSeletor.feeRatesPerKB;
}); });
@ -146,7 +146,7 @@ export class CLNNetworkInfoComponent implements OnInit, OnDestroy {
this.errorMessages[6] = ''; this.errorMessages[6] = '';
this.apiCallStatusPerKW = frwSeletor.apiCallStatus; this.apiCallStatusPerKW = frwSeletor.apiCallStatus;
if (this.apiCallStatusPerKW.status === APICallStatusEnum.ERROR) { if (this.apiCallStatusPerKW.status === APICallStatusEnum.ERROR) {
this.errorMessages[6] = (typeof (this.apiCallStatusPerKW.message) === 'object') ? JSON.stringify(this.apiCallStatusPerKW.message) : this.apiCallStatusPerKW.message; this.errorMessages[6] = (typeof (this.apiCallStatusPerKW.message) === 'object') ? JSON.stringify(this.apiCallStatusPerKW.message) : this.apiCallStatusPerKW.message ? this.apiCallStatusPerKW.message : '';
} }
this.feeRatesPerKW = frwSeletor.feeRatesPerKW; this.feeRatesPerKW = frwSeletor.feeRatesPerKW;
}); });

@ -38,19 +38,19 @@ export class CLNOnChainSendModalComponent implements OnInit, OnDestroy {
@ViewChild('stepper', { static: false }) stepper: MatStepper; @ViewChild('stepper', { static: false }) stepper: MatStepper;
public faExclamationTriangle = faExclamationTriangle; public faExclamationTriangle = faExclamationTriangle;
public sweepAll = false; public sweepAll = false;
public selNode: SelNodeChild = {}; public selNode: SelNodeChild | null = {};
public appConfig: RTLConfiguration; public appConfig: RTLConfiguration;
public addressTypes = []; public addressTypes = [];
public utxos: UTXO[] = []; public utxos: UTXO[] = [];
public selUTXOs = []; public selUTXOs: UTXO[] = [];
public flgUseAllBalance = false; public flgUseAllBalance = false;
public totalSelectedUTXOAmount = null; public totalSelectedUTXOAmount: number | null = null;
public selectedAddress = ADDRESS_TYPES[1]; public selectedAddress = ADDRESS_TYPES[1];
public blockchainBalance: Balance = {}; public blockchainBalance: Balance = {};
public information: GetInfo = {}; public information: GetInfo = {};
public isCompatibleVersion = false; public isCompatibleVersion = false;
public newAddress = ''; public newAddress = '';
public transaction: OnChain = {}; public transaction: OnChain | any = {};
public feeRateTypes = FEE_RATE_TYPES; public feeRateTypes = FEE_RATE_TYPES;
public selFeeRate = ''; public selFeeRate = '';
public customFeeRate = null; public customFeeRate = null;
@ -179,7 +179,7 @@ export class CLNOnChainSendModalComponent implements OnInit, OnDestroy {
} }
if (this.selUTXOs.length && this.selUTXOs.length > 0) { if (this.selUTXOs.length && this.selUTXOs.length > 0) {
this.transaction.utxos = []; this.transaction.utxos = [];
this.selUTXOs.forEach((utxo) => this.transaction.utxos.push(utxo.txid + ':' + utxo.output)); this.selUTXOs.forEach((utxo: UTXO) => this.transaction.utxos?.push(utxo.txid + ':' + utxo.output));
} }
if (this.sweepAll) { if (this.sweepAll) {
if ( if (
@ -256,7 +256,7 @@ export class CLNOnChainSendModalComponent implements OnInit, OnDestroy {
this.passwordFormLabel = 'User authenticated successfully'; this.passwordFormLabel = 'User authenticated successfully';
this.sendFundFormLabel = 'Sweep funds | Address: ' + this.sendFundFormGroup.controls.transactionAddress.value + this.sendFundFormLabel = 'Sweep funds | Address: ' + this.sendFundFormGroup.controls.transactionAddress.value +
(this.sendFundFormGroup.controls.flgMinConf.value ? (' | Min Confirmation Blocks: ' + this.sendFundFormGroup.controls.minConfValue.value) : (this.sendFundFormGroup.controls.selFeeRate.value ? (' | Fee Rate: ' + (this.sendFundFormGroup.controls.flgMinConf.value ? (' | Min Confirmation Blocks: ' + this.sendFundFormGroup.controls.minConfValue.value) : (this.sendFundFormGroup.controls.selFeeRate.value ? (' | Fee Rate: ' +
this.feeRateTypes.find((frType) => frType.feeRateId === this.sendFundFormGroup.controls.selFeeRate.value).feeRateType) : '')); this.feeRateTypes.find((frType) => frType.feeRateId === this.sendFundFormGroup.controls.selFeeRate.value)?.feeRateType) : ''));
break; break;
default: default:
@ -272,12 +272,8 @@ export class CLNOnChainSendModalComponent implements OnInit, OnDestroy {
} }
onUTXOSelectionChange(event: any) { onUTXOSelectionChange(event: any) {
const utxoNew = { value: 0 };
if (this.selUTXOs.length && this.selUTXOs.length > 0) { if (this.selUTXOs.length && this.selUTXOs.length > 0) {
this.totalSelectedUTXOAmount = this.selUTXOs?.reduce((a, b) => { this.totalSelectedUTXOAmount = this.selUTXOs?.reduce((total, curr) => (total + (curr.value || 0)), 0);
utxoNew.value = a.value + b.value;
return utxoNew;
}).value;
if (this.flgUseAllBalance) { if (this.flgUseAllBalance) {
this.onUTXOAllBalanceChange(); this.onUTXOAllBalanceChange();
} }

@ -20,7 +20,7 @@ import { ApiCallStatusPayload } from '../../shared/models/apiCallsPayload';
}) })
export class CLNOnChainComponent implements OnInit, OnDestroy { export class CLNOnChainComponent implements OnInit, OnDestroy {
public selNode: SelNodeChild = {}; public selNode: SelNodeChild | null = {};
public faExchangeAlt = faExchangeAlt; public faExchangeAlt = faExchangeAlt;
public faChartPie = faChartPie; public faChartPie = faChartPie;
public balances = [{ title: 'Total Balance', dataValue: 0 }, { title: 'Confirmed', dataValue: 0 }, { title: 'Unconfirmed', dataValue: 0 }]; public balances = [{ title: 'Total Balance', dataValue: 0 }, { title: 'Confirmed', dataValue: 0 }, { title: 'Unconfirmed', dataValue: 0 }];
@ -35,22 +35,22 @@ export class CLNOnChainComponent implements OnInit, OnDestroy {
ngOnInit() { ngOnInit() {
const linkFound = this.links.find((link) => this.router.url.includes(link.link)); const linkFound = this.links.find((link) => this.router.url.includes(link.link));
this.activeLink = linkFound ? linkFound.link : this.links[0].link; this.activeLink = linkFound ? linkFound.link : this.links[0].link;
this.selectedTable = this.tables.find((table) => table.name === this.router.url.substring(this.router.url.lastIndexOf('/') + 1)); this.selectedTable = this.tables.find((table) => table.name === this.router.url.substring(this.router.url.lastIndexOf('/') + 1)) || this.tables[0];
this.router.events.pipe(takeUntil(this.unSubs[0]), filter((e) => e instanceof ResolveEnd)). this.router.events.pipe(takeUntil(this.unSubs[0]), filter((e) => e instanceof ResolveEnd)).
subscribe({ subscribe({
next: (value: ResolveEnd | Event) => { next: (value: ResolveEnd | Event) => {
const linkFound = this.links.find((link) => (<ResolveEnd>value).urlAfterRedirects.includes(link.link)); const linkFound = this.links.find((link) => (<ResolveEnd>value).urlAfterRedirects.includes(link.link));
this.activeLink = linkFound ? linkFound.link : this.links[0].link; this.activeLink = linkFound ? linkFound.link : this.links[0].link;
this.selectedTable = this.tables.find((table) => table.name === (<ResolveEnd>value).urlAfterRedirects.substring((<ResolveEnd>value).urlAfterRedirects.lastIndexOf('/') + 1)); this.selectedTable = this.tables.find((table) => table.name === (<ResolveEnd>value).urlAfterRedirects.substring((<ResolveEnd>value).urlAfterRedirects.lastIndexOf('/') + 1)) || this.tables[0];
} }
}); });
this.store.select(clnNodeSettings).pipe(takeUntil(this.unSubs[1])). this.store.select(clnNodeSettings).pipe(takeUntil(this.unSubs[1])).
subscribe((nodeSettings: SelNodeChild) => { subscribe((nodeSettings: SelNodeChild | null) => {
this.selNode = nodeSettings; this.selNode = nodeSettings;
}); });
this.store.select(balance).pipe(takeUntil(this.unSubs[2])). this.store.select(balance).pipe(takeUntil(this.unSubs[2])).
subscribe((balanceSeletor: { balance: Balance, apiCallStatus: ApiCallStatusPayload }) => { subscribe((balanceSeletor: { balance: Balance, apiCallStatus: ApiCallStatusPayload }) => {
this.balances = [{ title: 'Total Balance', dataValue: balanceSeletor.balance.totalBalance || 0 }, { title: 'Confirmed', dataValue: balanceSeletor.balance.confBalance }, { title: 'Unconfirmed', dataValue: balanceSeletor.balance.unconfBalance }]; this.balances = [{ title: 'Total Balance', dataValue: balanceSeletor.balance.totalBalance || 0 }, { title: 'Confirmed', dataValue: (balanceSeletor.balance.confBalance || 0)}, { title: 'Unconfirmed', dataValue: (balanceSeletor.balance.unconfBalance || 0) }];
}); });
} }
@ -66,7 +66,7 @@ export class CLNOnChainComponent implements OnInit, OnDestroy {
} }
onSelectedTableIndexChanged(event: number) { onSelectedTableIndexChanged(event: number) {
this.selectedTable = this.tables.find((table) => table.id === event); this.selectedTable = this.tables.find((table) => table.id === event) || this.tables[0];
this.router.navigate(['./', this.activeLink, this.selectedTable.name], { relativeTo: this.activatedRoute }); this.router.navigate(['./', this.activeLink, this.selectedTable.name], { relativeTo: this.activatedRoute });
} }

@ -33,7 +33,7 @@ export class CLNUTXOTablesComponent implements OnInit, OnDestroy {
if (utxosSeletor.utxos && utxosSeletor.utxos.length > 0) { if (utxosSeletor.utxos && utxosSeletor.utxos.length > 0) {
this.utxos = utxosSeletor.utxos; this.utxos = utxosSeletor.utxos;
this.numUtxos = this.utxos.length; this.numUtxos = this.utxos.length;
this.dustUtxos = utxosSeletor.utxos?.filter((utxo) => +utxo.value < 1000); this.dustUtxos = utxosSeletor.utxos?.filter((utxo) => +(utxo.value || 0) < 1000);
this.numDustUtxos = this.dustUtxos.length; this.numDustUtxos = this.dustUtxos.length;
} }
if (utxosSeletor.utxos && utxosSeletor.utxos.length > 0) { if (utxosSeletor.utxos && utxosSeletor.utxos.length > 0) {

@ -94,7 +94,7 @@ export class CLNOnChainUtxosComponent implements OnInit, OnChanges, AfterViewIni
[{ key: 'txid', value: selUtxo.txid, title: 'Transaction ID', width: 100 }], [{ key: 'txid', value: selUtxo.txid, title: 'Transaction ID', width: 100 }],
[{ key: 'output', value: selUtxo.output, title: 'Output', width: 50, type: DataTypeEnum.NUMBER }, [{ key: 'output', value: selUtxo.output, title: 'Output', width: 50, type: DataTypeEnum.NUMBER },
{ key: 'value', value: selUtxo.value, title: 'Value (Sats)', width: 50, type: DataTypeEnum.NUMBER }], { key: 'value', value: selUtxo.value, title: 'Value (Sats)', width: 50, type: DataTypeEnum.NUMBER }],
[{ key: 'status', value: this.commonService.titleCase(selUtxo.status), title: 'Status', width: 50, type: DataTypeEnum.STRING }, [{ key: 'status', value: this.commonService.titleCase(selUtxo.status || ''), title: 'Status', width: 50, type: DataTypeEnum.STRING },
{ key: 'blockheight', value: selUtxo.blockheight, title: 'Blockheight', width: 50, type: DataTypeEnum.NUMBER }], { key: 'blockheight', value: selUtxo.blockheight, title: 'Blockheight', width: 50, type: DataTypeEnum.NUMBER }],
[{ key: 'address', value: selUtxo.address, title: 'Address', width: 100 }] [{ key: 'address', value: selUtxo.address, title: 'Address', width: 100 }]
]; ];

@ -60,7 +60,7 @@ export class CLNBumpFeeComponent implements OnInit, OnDestroy {
address: action.payload, address: action.payload,
satoshis: 'all', satoshis: 'all',
feeRate: (+(this.fees || 0) * 1000).toString(), feeRate: (+(this.fees || 0) * 1000).toString(),
utxos: [this.bumpFeeChannel.funding_txid + ':' + this.outputIndex.toString()] utxos: [this.bumpFeeChannel.funding_txid + ':' + (this.outputIndex || '').toString()]
} }
})); }));
}); });

@ -28,7 +28,7 @@ export class CLNChannelInformationComponent implements OnInit {
ngOnInit() { ngOnInit() {
this.channel = this.data.channel; this.channel = this.data.channel;
this.showCopy = this.data.showCopy; this.showCopy = !!this.data.showCopy;
this.screenSize = this.commonService.getScreenSize(); this.screenSize = this.commonService.getScreenSize();
} }

@ -78,7 +78,7 @@ export class CLNChannelPendingTableComponent implements OnInit, AfterViewInit, O
this.isCompatibleVersion = this.commonService.isVersionCompatible(this.information.api_version, '0.4.2'); this.isCompatibleVersion = this.commonService.isVersionCompatible(this.information.api_version, '0.4.2');
} }
this.numPeers = infoBalNumpeersSelector.numPeers; this.numPeers = infoBalNumpeersSelector.numPeers;
this.totalBalance = infoBalNumpeersSelector.balance.totalBalance; this.totalBalance = infoBalNumpeersSelector.balance.totalBalance || 0;
this.logger.info(infoBalNumpeersSelector); this.logger.info(infoBalNumpeersSelector);
}); });
this.store.select(channels).pipe(takeUntil(this.unSubs[1])). this.store.select(channels).pipe(takeUntil(this.unSubs[1])).
@ -89,7 +89,7 @@ export class CLNChannelPendingTableComponent implements OnInit, AfterViewInit, O
this.errorMessage = !this.apiCallStatus.message ? '' : (typeof (this.apiCallStatus.message) === 'object') ? JSON.stringify(this.apiCallStatus.message) : this.apiCallStatus.message; this.errorMessage = !this.apiCallStatus.message ? '' : (typeof (this.apiCallStatus.message) === 'object') ? JSON.stringify(this.apiCallStatus.message) : this.apiCallStatus.message;
} }
this.channelsData = [...channelsSeletor.pendingChannels, ...channelsSeletor.inactiveChannels]; this.channelsData = [...channelsSeletor.pendingChannels, ...channelsSeletor.inactiveChannels];
this.channelsData = this.channelsData.sort((a, b) => ((this.CLNChannelPendingState[a.state] >= this.CLNChannelPendingState[b.state]) ? 1 : -1)); this.channelsData = this.channelsData.sort((a, b) => ((this.CLNChannelPendingState[a.state || ''] >= this.CLNChannelPendingState[b.state || '']) ? 1 : -1));
if (this.channelsData && this.channelsData.length > 0) { if (this.channelsData && this.channelsData.length > 0) {
this.loadChannelsTable(this.channelsData); this.loadChannelsTable(this.channelsData);
} }
@ -146,7 +146,7 @@ export class CLNChannelPendingTableComponent implements OnInit, AfterViewInit, O
pipe(takeUntil(this.unSubs[2])). pipe(takeUntil(this.unSubs[2])).
subscribe((confirmRes) => { subscribe((confirmRes) => {
if (confirmRes) { if (confirmRes) {
this.store.dispatch(closeChannel({ payload: { id: channelToClose.id, channelId: channelToClose.channel_id, force: true } })); this.store.dispatch(closeChannel({ payload: { id: channelToClose.id!, channelId: channelToClose.channel_id!, force: true } }));
} }
}); });
} }

@ -24,7 +24,7 @@ export class CLNChannelsTablesComponent implements OnInit, OnDestroy {
public openChannels = 0; public openChannels = 0;
public pendingChannels = 0; public pendingChannels = 0;
public selNode: SelNodeChild = {}; public selNode: SelNodeChild | null = {};
public information: GetInfo = {}; public information: GetInfo = {};
public peers: Peer[] = []; public peers: Peer[] = [];
public utxos: UTXO[] = []; public utxos: UTXO[] = [];
@ -44,10 +44,10 @@ export class CLNChannelsTablesComponent implements OnInit, OnDestroy {
} }
}); });
this.store.select(nodeInfoAndNodeSettingsAndBalance).pipe(takeUntil(this.unSubs[1])). this.store.select(nodeInfoAndNodeSettingsAndBalance).pipe(takeUntil(this.unSubs[1])).
subscribe((infoSettingsBalSelector: { information: GetInfo, nodeSettings: SelNodeChild, balance: Balance }) => { subscribe((infoSettingsBalSelector: { information: GetInfo, nodeSettings: SelNodeChild | null, balance: Balance }) => {
this.selNode = infoSettingsBalSelector.nodeSettings; this.selNode = infoSettingsBalSelector.nodeSettings;
this.information = infoSettingsBalSelector.information; this.information = infoSettingsBalSelector.information;
this.totalBalance = infoSettingsBalSelector.balance.totalBalance; this.totalBalance = infoSettingsBalSelector.balance.totalBalance || 0;
this.logger.info(infoSettingsBalSelector); this.logger.info(infoSettingsBalSelector);
}); });
this.store.select(peers).pipe(takeUntil(this.unSubs[2])). this.store.select(peers).pipe(takeUntil(this.unSubs[2])).

@ -28,7 +28,7 @@ export class CLNOpenChannelComponent implements OnInit, OnDestroy {
public faExclamationTriangle = faExclamationTriangle; public faExclamationTriangle = faExclamationTriangle;
public alertTitle: string; public alertTitle: string;
public isCompatibleVersion = false; public isCompatibleVersion = false;
public peer: Peer; public peer: Peer | null;
public peers: Peer[]; public peers: Peer[];
public sortedPeers: Peer[]; public sortedPeers: Peer[];
public filteredPeers: Observable<Peer[]>; public filteredPeers: Observable<Peer[]>;
@ -40,7 +40,7 @@ export class CLNOpenChannelComponent implements OnInit, OnDestroy {
public advancedTitle = 'Advanced Options'; public advancedTitle = 'Advanced Options';
public information: GetInfo; public information: GetInfo;
public totalBalance = 0; public totalBalance = 0;
public fundingAmount = null; public fundingAmount: number | null = null;
public selectedPubkey = ''; public selectedPubkey = '';
public isPrivate = false; public isPrivate = false;
public feeRateTypes = FEE_RATE_TYPES; public feeRateTypes = FEE_RATE_TYPES;
@ -57,13 +57,22 @@ export class CLNOpenChannelComponent implements OnInit, OnDestroy {
} }
ngOnInit() { ngOnInit() {
this.isCompatibleVersion = this.data.message.isCompatibleVersion; if (this.data.message) {
this.information = this.data.message.information; this.isCompatibleVersion = this.data.message.isCompatibleVersion;
this.totalBalance = this.data.message.balance; this.information = this.data.message.information;
this.utxos = this.data.message.utxos; this.totalBalance = this.data.message.balance;
this.alertTitle = this.data.alertTitle; this.utxos = this.data.message.utxos;
this.peer = this.data.message.peer || null; this.peer = this.data.message.peer || null;
this.peers = this.data.message.peers || []; this.peers = this.data.message.peers || [];
} else {
this.isCompatibleVersion = false;
this.information = {};
this.totalBalance = 0;
this.utxos = [];
this.peer = null;
this.peers = [];
}
this.alertTitle = this.data.alertTitle || 'Alert';
this.actions.pipe( this.actions.pipe(
takeUntil(this.unSubs[0]), takeUntil(this.unSubs[0]),
filter((action) => action.type === CLNActions.UPDATE_API_CALL_STATUS_CLN || action.type === CLNActions.FETCH_CHANNELS_CLN)). filter((action) => action.type === CLNActions.UPDATE_API_CALL_STATUS_CLN || action.type === CLNActions.FETCH_CHANNELS_CLN)).
@ -79,7 +88,7 @@ export class CLNOpenChannelComponent implements OnInit, OnDestroy {
y = ''; y = '';
this.sortedPeers = this.peers.sort((p1, p2) => { this.sortedPeers = this.peers.sort((p1, p2) => {
x = p1.alias ? p1.alias.toLowerCase() : p1.id ? p1.id.toLowerCase() : ''; x = p1.alias ? p1.alias.toLowerCase() : p1.id ? p1.id.toLowerCase() : '';
y = p2.alias ? p2.alias.toLowerCase() : p1.id.toLowerCase(); y = p2.alias ? p2.alias.toLowerCase() : p1.id ? p1.id.toLowerCase() : '';
return ((x < y) ? -1 : ((x > y) ? 1 : 0)); return ((x < y) ? -1 : ((x > y) ? 1 : 0));
}); });
this.filteredPeers = this.selectedPeer.valueChanges.pipe(takeUntil(this.unSubs[1]), startWith(''), this.filteredPeers = this.selectedPeer.valueChanges.pipe(takeUntil(this.unSubs[1]), startWith(''),
@ -89,7 +98,7 @@ export class CLNOpenChannelComponent implements OnInit, OnDestroy {
} }
private filterPeers(newlySelectedPeer: string): Peer[] { private filterPeers(newlySelectedPeer: string): Peer[] {
return this.sortedPeers?.filter((peer) => peer.alias.toLowerCase().indexOf(newlySelectedPeer ? newlySelectedPeer.toLowerCase() : '') === 0); return this.sortedPeers?.filter((peer) => peer.alias?.toLowerCase().indexOf(newlySelectedPeer ? newlySelectedPeer.toLowerCase() : '') === 0);
} }
displayFn(peer: Peer): string { displayFn(peer: Peer): string {
@ -100,7 +109,7 @@ export class CLNOpenChannelComponent implements OnInit, OnDestroy {
this.channelConnectionError = ''; this.channelConnectionError = '';
this.selectedPubkey = (this.selectedPeer.value && this.selectedPeer.value.id) ? this.selectedPeer.value.id : null; this.selectedPubkey = (this.selectedPeer.value && this.selectedPeer.value.id) ? this.selectedPeer.value.id : null;
if (typeof this.selectedPeer.value === 'string') { if (typeof this.selectedPeer.value === 'string') {
const selPeer = this.peers?.filter((peer) => peer.alias.length === this.selectedPeer.value.length && peer.alias.toLowerCase().indexOf(this.selectedPeer.value ? this.selectedPeer.value.toLowerCase() : '') === 0); const selPeer = this.peers?.filter((peer) => peer.alias?.length === this.selectedPeer.value.length && peer.alias?.toLowerCase().indexOf(this.selectedPeer.value ? this.selectedPeer.value.toLowerCase() : '') === 0);
if (selPeer.length === 1 && selPeer[0].id) { if (selPeer.length === 1 && selPeer[0].id) {
this.selectedPubkey = selPeer[0].id; this.selectedPubkey = selPeer[0].id;
} }
@ -138,7 +147,7 @@ export class CLNOpenChannelComponent implements OnInit, OnDestroy {
this.advancedTitle = this.advancedTitle + ' | Min Confirmation Blocks: ' + this.minConfValue; this.advancedTitle = this.advancedTitle + ' | Min Confirmation Blocks: ' + this.minConfValue;
} }
if (this.selFeeRate) { if (this.selFeeRate) {
this.advancedTitle = this.advancedTitle + ' | Fee Rate: ' + (this.customFeeRate ? (this.customFeeRate + ' (Sats/vByte)') : (this.feeRateTypes.find((feeRateType) => feeRateType.feeRateId === this.selFeeRate).feeRateType)); this.advancedTitle = this.advancedTitle + ' | Fee Rate: ' + (this.customFeeRate ? (this.customFeeRate + ' (Sats/vByte)') : (this.feeRateTypes.find((feeRateType) => feeRateType.feeRateId === this.selFeeRate)?.feeRateType));
} }
if (this.selUTXOs.length && this.selUTXOs.length > 0) { if (this.selUTXOs.length && this.selUTXOs.length > 0) {
this.advancedTitle = this.advancedTitle + ' | Total Selected: ' + this.selUTXOs.length + ' | Selected UTXOs: ' + this.decimalPipe.transform(this.totalSelectedUTXOAmount) + ' Sats'; this.advancedTitle = this.advancedTitle + ' | Total Selected: ' + this.selUTXOs.length + ' | Selected UTXOs: ' + this.decimalPipe.transform(this.totalSelectedUTXOAmount) + ' Sats';
@ -150,12 +159,8 @@ export class CLNOpenChannelComponent implements OnInit, OnDestroy {
} }
onUTXOSelectionChange(event: any) { onUTXOSelectionChange(event: any) {
const utxoNew = { value: 0 };
if (this.selUTXOs.length && this.selUTXOs.length > 0) { if (this.selUTXOs.length && this.selUTXOs.length > 0) {
this.totalSelectedUTXOAmount = this.selUTXOs?.reduce((a, b) => { this.totalSelectedUTXOAmount = this.selUTXOs?.reduce((acc, curr: UTXO) => acc + (curr.value || 0), 0);
utxoNew.value = a.value + b.value;
return utxoNew;
}).value;
if (this.flgUseAllBalance) { if (this.flgUseAllBalance) {
this.onUTXOAllBalanceChange(); this.onUTXOAllBalanceChange();
} }
@ -182,7 +187,7 @@ export class CLNOpenChannelComponent implements OnInit, OnDestroy {
newChannel['feeRate'] = (this.selFeeRate === 'customperkb' && !this.flgMinConf && this.customFeeRate) ? (this.customFeeRate * 1000) + 'perkb' : this.selFeeRate; newChannel['feeRate'] = (this.selFeeRate === 'customperkb' && !this.flgMinConf && this.customFeeRate) ? (this.customFeeRate * 1000) + 'perkb' : this.selFeeRate;
if (this.selUTXOs.length && this.selUTXOs.length > 0) { if (this.selUTXOs.length && this.selUTXOs.length > 0) {
newChannel['utxos'] = []; newChannel['utxos'] = [];
this.selUTXOs.forEach((utxo) => newChannel['utxos'].push(utxo.txid + ':' + utxo.output)); this.selUTXOs.forEach((utxo: UTXO) => newChannel['utxos'].push(utxo.txid + ':' + utxo.output));
} }
this.store.dispatch(saveNewChannel({ payload: newChannel })); this.store.dispatch(saveNewChannel({ payload: newChannel }));
} }

@ -32,7 +32,7 @@ export class CLNConnectPeerComponent implements OnInit, OnDestroy {
public feeRateTypes = FEE_RATE_TYPES; public feeRateTypes = FEE_RATE_TYPES;
public flgChannelOpened = false; public flgChannelOpened = false;
public channelOpenStatus = null; public channelOpenStatus = null;
public newlyAddedPeer: Peer = null; public newlyAddedPeer: Peer | null = null;
public flgEditable = true; public flgEditable = true;
public peerConnectionError = ''; public peerConnectionError = '';
public channelConnectionError = ''; public channelConnectionError = '';
@ -50,9 +50,14 @@ export class CLNConnectPeerComponent implements OnInit, OnDestroy {
} }
ngOnInit() { ngOnInit() {
this.totalBalance = this.data.message.balance; if (this.data.message) {
this.peerAddress = (this.data.message.peer && this.data.message.peer.id && this.data.message.peer.netaddr) ? (this.data.message.peer.id + '@' + this.data.message.peer.netaddr) : this.totalBalance = this.data.message.balance;
(this.data.message.peer && this.data.message.peer.id && !this.data.message.peer.netaddr) ? this.data.message.peer.id : ''; this.peerAddress = (this.data.message.peer && this.data.message.peer.id && this.data.message.peer.netaddr) ? (this.data.message.peer.id + '@' + this.data.message.peer.netaddr) :
(this.data.message.peer && this.data.message.peer.id && !this.data.message.peer.netaddr) ? this.data.message.peer.id : '';
} else {
this.totalBalance = 0;
this.peerAddress = '';
}
this.peerFormGroup = this.formBuilder.group({ this.peerFormGroup = this.formBuilder.group({
hiddenAddress: ['', [Validators.required]], hiddenAddress: ['', [Validators.required]],
peerAddress: [this.peerAddress, [Validators.required]] peerAddress: [this.peerAddress, [Validators.required]]
@ -130,7 +135,7 @@ export class CLNConnectPeerComponent implements OnInit, OnDestroy {
this.channelConnectionError = ''; this.channelConnectionError = '';
this.store.dispatch(saveNewChannel({ this.store.dispatch(saveNewChannel({
payload: { payload: {
peerId: this.newlyAddedPeer.id, satoshis: this.channelFormGroup.controls.fundingAmount.value, announce: !this.channelFormGroup.controls.isPrivate.value, peerId: this.newlyAddedPeer?.id!, satoshis: this.channelFormGroup.controls.fundingAmount.value, announce: !this.channelFormGroup.controls.isPrivate.value,
feeRate: (this.channelFormGroup.controls.selFeeRate.value === 'customperkb' && !this.channelFormGroup.controls.flgMinConf.value && this.channelFormGroup.controls.customFeeRate.value) ? ((this.channelFormGroup.controls.customFeeRate.value * 1000) + 'perkb') : this.channelFormGroup.controls.selFeeRate.value, feeRate: (this.channelFormGroup.controls.selFeeRate.value === 'customperkb' && !this.channelFormGroup.controls.flgMinConf.value && this.channelFormGroup.controls.customFeeRate.value) ? ((this.channelFormGroup.controls.customFeeRate.value * 1000) + 'perkb') : this.channelFormGroup.controls.selFeeRate.value,
minconf: this.channelFormGroup.controls.flgMinConf.value ? this.channelFormGroup.controls.minConfValue.value : null minconf: this.channelFormGroup.controls.flgMinConf.value ? this.channelFormGroup.controls.minConfValue.value : null
} }
@ -150,7 +155,7 @@ export class CLNConnectPeerComponent implements OnInit, OnDestroy {
case 1: case 1:
if (this.peerFormGroup.controls.peerAddress.value) { if (this.peerFormGroup.controls.peerAddress.value) {
this.peerFormLabel = 'Peer Added: ' + (this.newlyAddedPeer.alias ? this.newlyAddedPeer.alias : this.newlyAddedPeer.id); this.peerFormLabel = 'Peer Added: ' + (this.newlyAddedPeer?.alias ? this.newlyAddedPeer.alias : this.newlyAddedPeer?.id);
} else { } else {
this.peerFormLabel = 'Peer Details'; this.peerFormLabel = 'Peer Details';
} }
@ -159,7 +164,7 @@ export class CLNConnectPeerComponent implements OnInit, OnDestroy {
case 2: case 2:
if (this.peerFormGroup.controls.peerAddress.value) { if (this.peerFormGroup.controls.peerAddress.value) {
this.peerFormLabel = 'Peer Added: ' + (this.newlyAddedPeer.alias ? this.newlyAddedPeer.alias : this.newlyAddedPeer.id); this.peerFormLabel = 'Peer Added: ' + (this.newlyAddedPeer?.alias ? this.newlyAddedPeer?.alias : this.newlyAddedPeer?.id);
} else { } else {
this.peerFormLabel = 'Peer Details'; this.peerFormLabel = 'Peer Details';
} }

@ -49,7 +49,7 @@ export class CLNConnectionsComponent implements OnInit, OnDestroy {
}); });
this.store.select(balance).pipe(takeUntil(this.unSubs[3])). this.store.select(balance).pipe(takeUntil(this.unSubs[3])).
subscribe((balanceSeletor: { balance: Balance, apiCallStatus: ApiCallStatusPayload }) => { subscribe((balanceSeletor: { balance: Balance, apiCallStatus: ApiCallStatusPayload }) => {
this.balances = [{ title: 'Total Balance', dataValue: balanceSeletor.balance.totalBalance || 0 }, { title: 'Confirmed', dataValue: balanceSeletor.balance.confBalance }, { title: 'Unconfirmed', dataValue: balanceSeletor.balance.unconfBalance }]; this.balances = [{ title: 'Total Balance', dataValue: balanceSeletor.balance.totalBalance || 0 }, { title: 'Confirmed', dataValue: (balanceSeletor.balance.confBalance || 0) }, { title: 'Unconfirmed', dataValue: (balanceSeletor.balance.unconfBalance || 0) }];
}); });
} }

@ -38,7 +38,7 @@ export class CLNPeersComponent implements OnInit, AfterViewInit, OnDestroy {
public faUsers = faUsers; public faUsers = faUsers;
public newlyAddedPeer = ''; public newlyAddedPeer = '';
public displayedColumns: any[] = []; public displayedColumns: any[] = [];
public peerAddress = ''; public peerAddress: string | null = '';
public peersData: Peer[] = []; public peersData: Peer[] = [];
public peers: any; public peers: any;
public information: GetInfo = {}; public information: GetInfo = {};
@ -171,7 +171,7 @@ export class CLNPeersComponent implements OnInit, AfterViewInit, OnDestroy {
pipe(takeUntil(this.unSubs[3])). pipe(takeUntil(this.unSubs[3])).
subscribe((confirmRes) => { subscribe((confirmRes) => {
if (confirmRes) { if (confirmRes) {
this.store.dispatch(detachPeer({ payload: { id: peerToDetach.id, force: false } })); this.store.dispatch(detachPeer({ payload: { id: peerToDetach.id!, force: false } }));
} }
}); });
} }

@ -52,7 +52,7 @@ export class CLNTransactionsReportComponent implements OnInit, OnDestroy {
withLatestFrom(this.store.select(listInvoices))). withLatestFrom(this.store.select(listInvoices))).
subscribe(([paymentsSelector, invoicesSelector]: [{ payments: Payment[], apiCallStatus: ApiCallStatusPayload }, { listInvoices: ListInvoices, apiCallStatus: ApiCallStatusPayload }]) => { subscribe(([paymentsSelector, invoicesSelector]: [{ payments: Payment[], apiCallStatus: ApiCallStatusPayload }, { listInvoices: ListInvoices, apiCallStatus: ApiCallStatusPayload }]) => {
this.payments = paymentsSelector.payments; this.payments = paymentsSelector.payments;
this.invoices = invoicesSelector.listInvoices.invoices; this.invoices = invoicesSelector.listInvoices.invoices || [];
this.transactionsReportData = this.filterTransactionsForSelectedPeriod(this.startDate, this.endDate); this.transactionsReportData = this.filterTransactionsForSelectedPeriod(this.startDate, this.endDate);
this.transactionsNonZeroReportData = this.prepareTableData(); this.transactionsNonZeroReportData = this.prepareTableData();
}); });
@ -93,10 +93,10 @@ export class CLNTransactionsReportComponent implements OnInit, OnDestroy {
filterTransactionsForSelectedPeriod(start: Date, end: Date) { filterTransactionsForSelectedPeriod(start: Date, end: Date) {
const startDateInSeconds = Math.round(start.getTime() / 1000); const startDateInSeconds = Math.round(start.getTime() / 1000);
const endDateInSeconds = Math.round(end.getTime() / 1000); const endDateInSeconds = Math.round(end.getTime() / 1000);
const transactionsReport = []; const transactionsReport: any[] = [];
this.transactionsReportSummary = { paymentsSelectedPeriod: 0, invoicesSelectedPeriod: 0, amountPaidSelectedPeriod: 0, amountReceivedSelectedPeriod: 0 }; this.transactionsReportSummary = { paymentsSelectedPeriod: 0, invoicesSelectedPeriod: 0, amountPaidSelectedPeriod: 0, amountReceivedSelectedPeriod: 0 };
const filteredPayments = this.payments?.filter((payment) => payment.status === 'complete' && payment.created_at >= startDateInSeconds && payment.created_at < endDateInSeconds); const filteredPayments = this.payments?.filter((payment: Payment) => payment.status === 'complete' && payment.created_at && payment.created_at >= startDateInSeconds && payment.created_at < endDateInSeconds);
const filteredInvoices = this.invoices?.filter((invoice) => invoice.status === 'paid' && invoice.paid_at >= startDateInSeconds && invoice.paid_at < endDateInSeconds); const filteredInvoices = this.invoices?.filter((invoice: Invoice) => invoice.status === 'paid' && invoice.paid_at && invoice.paid_at >= startDateInSeconds && invoice.paid_at < endDateInSeconds);
this.transactionsReportSummary.paymentsSelectedPeriod = filteredPayments.length; this.transactionsReportSummary.paymentsSelectedPeriod = filteredPayments.length;
this.transactionsReportSummary.invoicesSelectedPeriod = filteredInvoices.length; this.transactionsReportSummary.invoicesSelectedPeriod = filteredInvoices.length;
if (this.reportPeriod === SCROLL_RANGES[1]) { if (this.reportPeriod === SCROLL_RANGES[1]) {
@ -104,16 +104,16 @@ export class CLNTransactionsReportComponent implements OnInit, OnDestroy {
transactionsReport.push({ name: MONTHS[i].name, date: new Date(start.getFullYear(), i, 1, 0, 0, 0, 0), series: [{ name: 'Paid', value: 0, extra: { total: 0 } }, { name: 'Received', value: 0, extra: { total: 0 } }] }); transactionsReport.push({ name: MONTHS[i].name, date: new Date(start.getFullYear(), i, 1, 0, 0, 0, 0), series: [{ name: 'Paid', value: 0, extra: { total: 0 } }, { name: 'Received', value: 0, extra: { total: 0 } }] });
} }
filteredPayments?.map((payment) => { filteredPayments?.map((payment) => {
const monthNumber = new Date((payment.created_at) * 1000).getMonth(); const monthNumber = new Date((payment.created_at || 0) * 1000).getMonth();
this.transactionsReportSummary.amountPaidSelectedPeriod = this.transactionsReportSummary.amountPaidSelectedPeriod + payment.msatoshi_sent; this.transactionsReportSummary.amountPaidSelectedPeriod = this.transactionsReportSummary.amountPaidSelectedPeriod + (payment.msatoshi_sent || 0);
transactionsReport[monthNumber].series[0].value = transactionsReport[monthNumber].series[0].value + (payment.msatoshi_sent / 1000); transactionsReport[monthNumber].series[0].value = transactionsReport[monthNumber].series[0].value + ((payment.msatoshi_sent || 0) / 1000);
transactionsReport[monthNumber].series[0].extra.total = transactionsReport[monthNumber].series[0].extra.total + 1; transactionsReport[monthNumber].series[0].extra.total = transactionsReport[monthNumber].series[0].extra.total + 1;
return this.transactionsReportSummary; return this.transactionsReportSummary;
}); });
filteredInvoices?.map((invoice) => { filteredInvoices?.map((invoice) => {
const monthNumber = new Date((+invoice.paid_at) * 1000).getMonth(); const monthNumber = new Date(+(invoice.paid_at || 0) * 1000).getMonth();
this.transactionsReportSummary.amountReceivedSelectedPeriod = this.transactionsReportSummary.amountReceivedSelectedPeriod + invoice.msatoshi_received; this.transactionsReportSummary.amountReceivedSelectedPeriod = this.transactionsReportSummary.amountReceivedSelectedPeriod + (invoice.msatoshi_received || 0);
transactionsReport[monthNumber].series[1].value = transactionsReport[monthNumber].series[1].value + (invoice.msatoshi_received / 1000); transactionsReport[monthNumber].series[1].value = transactionsReport[monthNumber].series[1].value + ((invoice.msatoshi_received || 0) / 1000);
transactionsReport[monthNumber].series[1].extra.total = transactionsReport[monthNumber].series[1].extra.total + 1; transactionsReport[monthNumber].series[1].extra.total = transactionsReport[monthNumber].series[1].extra.total + 1;
return this.transactionsReportSummary; return this.transactionsReportSummary;
}); });
@ -122,16 +122,16 @@ export class CLNTransactionsReportComponent implements OnInit, OnDestroy {
transactionsReport.push({ name: (i + 1).toString(), date: new Date((((i) * this.secondsInADay) + startDateInSeconds) * 1000), series: [{ name: 'Paid', value: 0, extra: { total: 0 } }, { name: 'Received', value: 0, extra: { total: 0 } }] }); transactionsReport.push({ name: (i + 1).toString(), date: new Date((((i) * this.secondsInADay) + startDateInSeconds) * 1000), series: [{ name: 'Paid', value: 0, extra: { total: 0 } }, { name: 'Received', value: 0, extra: { total: 0 } }] });
} }
filteredPayments?.map((payment) => { filteredPayments?.map((payment) => {
const dateNumber = Math.floor((+payment.created_at - startDateInSeconds) / this.secondsInADay); const dateNumber = Math.floor((+(payment.created_at || 0) - startDateInSeconds) / this.secondsInADay);
this.transactionsReportSummary.amountPaidSelectedPeriod = this.transactionsReportSummary.amountPaidSelectedPeriod + payment.msatoshi_sent; this.transactionsReportSummary.amountPaidSelectedPeriod = this.transactionsReportSummary.amountPaidSelectedPeriod + (payment.msatoshi_sent || 0);
transactionsReport[dateNumber].series[0].value = transactionsReport[dateNumber].series[0].value + (payment.msatoshi_sent / 1000); transactionsReport[dateNumber].series[0].value = transactionsReport[dateNumber].series[0].value + ((payment.msatoshi_sent || 0) / 1000);
transactionsReport[dateNumber].series[0].extra.total = transactionsReport[dateNumber].series[0].extra.total + 1; transactionsReport[dateNumber].series[0].extra.total = transactionsReport[dateNumber].series[0].extra.total + 1;
return this.transactionsReportSummary; return this.transactionsReportSummary;
}); });
filteredInvoices?.map((invoice) => { filteredInvoices?.map((invoice) => {
const dateNumber = Math.floor((+invoice.paid_at - startDateInSeconds) / this.secondsInADay); const dateNumber = Math.floor((+(invoice.paid_at || 0) - startDateInSeconds) / this.secondsInADay);
this.transactionsReportSummary.amountReceivedSelectedPeriod = this.transactionsReportSummary.amountReceivedSelectedPeriod + invoice.msatoshi_received; this.transactionsReportSummary.amountReceivedSelectedPeriod = this.transactionsReportSummary.amountReceivedSelectedPeriod + (invoice.msatoshi_received || 0);
transactionsReport[dateNumber].series[1].value = transactionsReport[dateNumber].series[1].value + (invoice.msatoshi_received / 1000); transactionsReport[dateNumber].series[1].value = transactionsReport[dateNumber].series[1].value + ((invoice.msatoshi_received || 0) / 1000);
transactionsReport[dateNumber].series[1].extra.total = transactionsReport[dateNumber].series[1].extra.total + 1; transactionsReport[dateNumber].series[1].extra.total = transactionsReport[dateNumber].series[1].extra.total + 1;
return this.transactionsReportSummary; return this.transactionsReportSummary;
}); });

@ -68,5 +68,5 @@
<tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr> <tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
</table> </table>
</div> </div>
<mat-paginator *ngIf="errorMessage === ''" [length]="totalFailedTransactions" (page)="onPageChange($event)" [pageSize]="pageSize" [pageSizeOptions]="pageSizeOptions" [showFirstLastButtons]="screenSize === screenSizeEnum.XS ? false : true" class="mb-1"></mat-paginator> <mat-paginator *ngIf="errorMessage === ''" [pageSize]="pageSize" [pageSizeOptions]="pageSizeOptions" [showFirstLastButtons]="screenSize === screenSizeEnum.XS ? false : true" class="mb-1"></mat-paginator>
</div> </div>

@ -4,7 +4,7 @@ import { DatePipe } from '@angular/common';
import { Subject } from 'rxjs'; import { Subject } from 'rxjs';
import { takeUntil } from 'rxjs/operators'; import { takeUntil } from 'rxjs/operators';
import { Store } from '@ngrx/store'; import { Store } from '@ngrx/store';
import { MatPaginator, MatPaginatorIntl, PageEvent } from '@angular/material/paginator'; import { MatPaginator, MatPaginatorIntl } from '@angular/material/paginator';
import { MatSort } from '@angular/material/sort'; import { MatSort } from '@angular/material/sort';
import { MatTableDataSource } from '@angular/material/table'; import { MatTableDataSource } from '@angular/material/table';
@ -39,7 +39,6 @@ export class CLNFailedTransactionsComponent implements OnInit, AfterViewInit, On
public failedForwardingEvents: any; public failedForwardingEvents: any;
public flgSticky = false; public flgSticky = false;
public selFilter = ''; public selFilter = '';
private indexOffset = -1;
public totalFailedTransactions = 0; public totalFailedTransactions = 0;
public pageSize = PAGE_SIZE; public pageSize = PAGE_SIZE;
public pageSizeOptions = PAGE_SIZE_OPTIONS; public pageSizeOptions = PAGE_SIZE_OPTIONS;
@ -77,7 +76,7 @@ export class CLNFailedTransactionsComponent implements OnInit, AfterViewInit, On
this.totalFailedTransactions = ffhSeletor.failedForwardingHistory.totalForwards || 0; this.totalFailedTransactions = ffhSeletor.failedForwardingHistory.totalForwards || 0;
this.failedEvents = ffhSeletor.failedForwardingHistory.listForwards || []; this.failedEvents = ffhSeletor.failedForwardingHistory.listForwards || [];
if (this.failedEvents.length > 0 && this.sort && this.paginator) { if (this.failedEvents.length > 0 && this.sort && this.paginator) {
this.loadFailedEventsTable(this.failedEvents.slice(0, this.pageSize)); this.loadFailedEventsTable(this.failedEvents);
} }
this.logger.info(ffhSeletor); this.logger.info(ffhSeletor);
}); });
@ -85,7 +84,7 @@ export class CLNFailedTransactionsComponent implements OnInit, AfterViewInit, On
ngAfterViewInit() { ngAfterViewInit() {
if (this.failedEvents.length > 0) { if (this.failedEvents.length > 0) {
this.loadFailedEventsTable(this.failedEvents.slice(0, this.pageSize)); this.loadFailedEventsTable(this.failedEvents);
} }
} }
@ -118,14 +117,16 @@ export class CLNFailedTransactionsComponent implements OnInit, AfterViewInit, On
this.failedForwardingEvents.sort = this.sort; this.failedForwardingEvents.sort = this.sort;
this.failedForwardingEvents.sortingDataAccessor = (data: any, sortHeaderId: string) => ((data[sortHeaderId] && isNaN(data[sortHeaderId])) ? data[sortHeaderId].toLocaleLowerCase() : data[sortHeaderId] ? +data[sortHeaderId] : null); this.failedForwardingEvents.sortingDataAccessor = (data: any, sortHeaderId: string) => ((data[sortHeaderId] && isNaN(data[sortHeaderId])) ? data[sortHeaderId].toLocaleLowerCase() : data[sortHeaderId] ? +data[sortHeaderId] : null);
this.failedForwardingEvents.filterPredicate = (event: ForwardingEvent, fltr: string) => { this.failedForwardingEvents.filterPredicate = (event: ForwardingEvent, fltr: string) => {
const newEvent = (event.received_time ? this.datePipe.transform(new Date(event.received_time * 1000), 'dd/MMM/YYYY HH:mm')?.toLowerCase() : '' + const newEvent =
(event.received_time ? this.datePipe.transform(new Date(event.received_time * 1000), 'dd/MMM/YYYY HH:mm')!.toLowerCase() : '') +
(event.resolved_time ? this.datePipe.transform(new Date(event.resolved_time * 1000), 'dd/MMM/YYYY HH:mm')?.toLowerCase() : '') + (event.resolved_time ? this.datePipe.transform(new Date(event.resolved_time * 1000), 'dd/MMM/YYYY HH:mm')?.toLowerCase() : '') +
(event.payment_hash ? event.payment_hash.toLowerCase() : '') + (event.payment_hash ? event.payment_hash.toLowerCase() : '') +
(event.in_channel ? event.in_channel.toLowerCase() : '') + (event.out_channel ? event.out_channel.toLowerCase() : '') + (event.in_channel ? event.in_channel.toLowerCase() : '') + (event.out_channel ? event.out_channel.toLowerCase() : '') +
(event.in_channel_alias ? event.in_channel_alias.toLowerCase() : '') + (event.out_channel_alias ? event.out_channel_alias.toLowerCase() : '') + (event.in_channel_alias ? event.in_channel_alias.toLowerCase() : '') + (event.out_channel_alias ? event.out_channel_alias.toLowerCase() : '') +
(event.in_msatoshi ? (event.in_msatoshi / 1000) : '') + (event.out_msatoshi ? (event.out_msatoshi / 1000) : '') + (event.fee ? event.fee : '')); (event.in_msatoshi ? (event.in_msatoshi / 1000) : '') + (event.out_msatoshi ? (event.out_msatoshi / 1000) : '') + (event.fee ? event.fee : '');
return newEvent?.includes(fltr) || false; return newEvent?.includes(fltr) || false;
}; };
this.failedForwardingEvents.paginator = this.paginator;
this.applyFilter(); this.applyFilter();
this.logger.info(this.failedForwardingEvents); this.logger.info(this.failedForwardingEvents);
} }
@ -140,16 +141,6 @@ export class CLNFailedTransactionsComponent implements OnInit, AfterViewInit, On
this.failedForwardingEvents.filter = this.selFilter.trim().toLowerCase(); this.failedForwardingEvents.filter = this.selFilter.trim().toLowerCase();
} }
onPageChange(event: PageEvent) {
if (this.pageSize !== event.pageSize) {
this.pageSize = event.pageSize;
this.indexOffset = 0;
} else {
this.indexOffset = event.pageIndex * this.pageSize;
}
this.loadFailedEventsTable(this.failedEvents.slice(this.indexOffset, (this.indexOffset + this.pageSize)));
}
ngOnDestroy() { ngOnDestroy() {
this.unSubs.forEach((completeSub) => { this.unSubs.forEach((completeSub) => {
completeSub.next(<any>null); completeSub.next(<any>null);

@ -145,6 +145,7 @@ export class CLNForwardingHistoryComponent implements OnInit, OnChanges, AfterVi
return newEvent.includes(fltr); return newEvent.includes(fltr);
}; };
this.forwardingHistoryEvents.paginator = this.paginator; this.forwardingHistoryEvents.paginator = this.paginator;
this.applyFilter();
this.logger.info(this.forwardingHistoryEvents); this.logger.info(this.forwardingHistoryEvents);
} }

@ -56,5 +56,5 @@
<tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr> <tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
</table> </table>
</div> </div>
<mat-paginator *ngIf="errorMessage === ''" [length]="totalLocalFailedTransactions" (page)="onPageChange($event)" [pageSize]="pageSize" [pageSizeOptions]="pageSizeOptions" [showFirstLastButtons]="screenSize === screenSizeEnum.XS ? false : true" class="mb-1"></mat-paginator> <mat-paginator *ngIf="errorMessage === ''" [pageSize]="pageSize" [pageSizeOptions]="pageSizeOptions" [showFirstLastButtons]="screenSize === screenSizeEnum.XS ? false : true" class="mb-1"></mat-paginator>
</div> </div>

@ -4,7 +4,7 @@ import { DatePipe } from '@angular/common';
import { Subject } from 'rxjs'; import { Subject } from 'rxjs';
import { takeUntil } from 'rxjs/operators'; import { takeUntil } from 'rxjs/operators';
import { Store } from '@ngrx/store'; import { Store } from '@ngrx/store';
import { MatPaginator, MatPaginatorIntl, PageEvent } from '@angular/material/paginator'; import { MatPaginator, MatPaginatorIntl } from '@angular/material/paginator';
import { MatSort } from '@angular/material/sort'; import { MatSort } from '@angular/material/sort';
import { MatTableDataSource } from '@angular/material/table'; import { MatTableDataSource } from '@angular/material/table';
@ -40,7 +40,6 @@ export class CLNLocalFailedTransactionsComponent implements OnInit, AfterViewIni
public failedLocalForwardingEvents: any; public failedLocalForwardingEvents: any;
public flgSticky = false; public flgSticky = false;
public selFilter = ''; public selFilter = '';
private indexOffset = 0;
public totalLocalFailedTransactions = 0; public totalLocalFailedTransactions = 0;
public pageSize = PAGE_SIZE; public pageSize = PAGE_SIZE;
public pageSizeOptions = PAGE_SIZE_OPTIONS; public pageSizeOptions = PAGE_SIZE_OPTIONS;
@ -78,7 +77,7 @@ export class CLNLocalFailedTransactionsComponent implements OnInit, AfterViewIni
this.totalLocalFailedTransactions = lffhSeletor.localFailedForwardingHistory.totalForwards || 0; this.totalLocalFailedTransactions = lffhSeletor.localFailedForwardingHistory.totalForwards || 0;
this.failedLocalEvents = lffhSeletor.localFailedForwardingHistory.listForwards || []; this.failedLocalEvents = lffhSeletor.localFailedForwardingHistory.listForwards || [];
if (this.failedLocalEvents.length > 0 && this.sort && this.paginator) { if (this.failedLocalEvents.length > 0 && this.sort && this.paginator) {
this.loadLocalfailedLocalEventsTable(this.failedLocalEvents.slice(0, this.pageSize)); this.loadLocalfailedLocalEventsTable(this.failedLocalEvents);
} }
this.logger.info(lffhSeletor); this.logger.info(lffhSeletor);
}); });
@ -86,7 +85,7 @@ export class CLNLocalFailedTransactionsComponent implements OnInit, AfterViewIni
ngAfterViewInit() { ngAfterViewInit() {
if (this.failedLocalEvents.length > 0) { if (this.failedLocalEvents.length > 0) {
this.loadLocalfailedLocalEventsTable(this.failedLocalEvents.slice(0, this.pageSize)); this.loadLocalfailedLocalEventsTable(this.failedLocalEvents);
} }
} }
@ -127,6 +126,7 @@ export class CLNLocalFailedTransactionsComponent implements OnInit, AfterViewIni
return (data[sortHeaderId] && isNaN(data[sortHeaderId])) ? data[sortHeaderId].toLocaleLowerCase() : data[sortHeaderId] ? +data[sortHeaderId] : null; return (data[sortHeaderId] && isNaN(data[sortHeaderId])) ? data[sortHeaderId].toLocaleLowerCase() : data[sortHeaderId] ? +data[sortHeaderId] : null;
} }
}; };
this.failedLocalForwardingEvents.paginator = this.paginator;
this.applyFilter(); this.applyFilter();
this.logger.info(this.failedLocalForwardingEvents); this.logger.info(this.failedLocalForwardingEvents);
} }
@ -141,16 +141,6 @@ export class CLNLocalFailedTransactionsComponent implements OnInit, AfterViewIni
this.failedLocalForwardingEvents.filter = this.selFilter.trim().toLowerCase(); this.failedLocalForwardingEvents.filter = this.selFilter.trim().toLowerCase();
} }
onPageChange(event: PageEvent) {
if (this.pageSize !== event.pageSize) {
this.pageSize = event.pageSize;
this.indexOffset = 0;
} else {
this.indexOffset = event.pageIndex * this.pageSize;
}
this.loadLocalfailedLocalEventsTable(this.failedLocalEvents.slice(this.indexOffset, (this.indexOffset + this.pageSize)));
}
ngOnDestroy() { ngOnDestroy() {
this.unSubs.forEach((completeSub) => { this.unSubs.forEach((completeSub) => {
completeSub.next(<any>null); completeSub.next(<any>null);

@ -31,7 +31,7 @@ export class CLNRoutingPeersComponent implements OnInit, OnChanges, AfterViewIni
@ViewChild('paginatorOut', { static: false }) paginatorOut: MatPaginator | undefined; @ViewChild('paginatorOut', { static: false }) paginatorOut: MatPaginator | undefined;
@Input() eventsData = []; @Input() eventsData = [];
@Input() filterValue = ''; @Input() filterValue = '';
public successfulEvents = []; public successfulEvents: ForwardingEvent[] = [];
public displayedColumns: any[] = []; public displayedColumns: any[] = [];
public RoutingPeersIncoming: any = []; public RoutingPeersIncoming: any = [];
public RoutingPeersOutgoing: any = []; public RoutingPeersOutgoing: any = [];
@ -126,22 +126,22 @@ export class CLNRoutingPeersComponent implements OnInit, OnChanges, AfterViewIni
groupRoutingPeers(forwardingEvents: ForwardingEvent[]) { groupRoutingPeers(forwardingEvents: ForwardingEvent[]) {
const incomingResults: RoutingPeer[] = []; const incomingResults: RoutingPeer[] = [];
const outgoingResults: RoutingPeer[] = []; const outgoingResults: RoutingPeer[] = [];
forwardingEvents.forEach((event) => { forwardingEvents.forEach((event: ForwardingEvent) => {
const incoming = incomingResults.find((result) => result.channel_id === event.in_channel); const incoming: any = incomingResults?.find((result) => result.channel_id === event.in_channel);
const outgoing = outgoingResults.find((result) => result.channel_id === event.out_channel); const outgoing: any = outgoingResults?.find((result) => result.channel_id === event.out_channel);
if (!incoming) { if (!incoming) {
incomingResults.push({ channel_id: event.in_channel, alias: event.in_channel_alias, events: 1, total_amount: event.in_msatoshi, total_fee: (event.in_msatoshi - event.out_msatoshi) }); incomingResults.push({ channel_id: event.in_channel, alias: event.in_channel_alias, events: 1, total_amount: event.in_msatoshi, total_fee: ((event.in_msatoshi || 0) - (event.out_msatoshi || 0)) });
} else { } else {
incoming.events++; incoming.events++;
incoming.total_amount = +incoming.total_amount + +event.in_msatoshi; incoming.total_amount = +incoming.total_amount + +(event.in_msatoshi || 0);
incoming.total_fee = +incoming.total_fee + (event.in_msatoshi - event.out_msatoshi); incoming.total_fee = +incoming.total_fee + ((event.in_msatoshi || 0) - (event.out_msatoshi || 0));
} }
if (!outgoing) { if (!outgoing) {
outgoingResults.push({ channel_id: event.out_channel, alias: event.out_channel_alias, events: 1, total_amount: event.out_msatoshi, total_fee: (event.in_msatoshi - event.out_msatoshi) }); outgoingResults.push({ channel_id: event.out_channel, alias: event.out_channel_alias, events: 1, total_amount: event.out_msatoshi, total_fee: ((event.in_msatoshi || 0) - (event.out_msatoshi || 0)) });
} else { } else {
outgoing.events++; outgoing.events++;
outgoing.total_amount = +outgoing.total_amount + +event.out_msatoshi; outgoing.total_amount = +outgoing.total_amount + +(event.out_msatoshi || 0);
outgoing.total_fee = +outgoing.total_fee + (event.in_msatoshi - event.out_msatoshi); outgoing.total_fee = +outgoing.total_fee + ((event.in_msatoshi || 0) - (event.out_msatoshi || 0));
} }
}); });
return [this.commonService.sortDescByKey(incomingResults, 'total_fee'), this.commonService.sortDescByKey(outgoingResults, 'total_fee')]; return [this.commonService.sortDescByKey(incomingResults, 'total_fee'), this.commonService.sortDescByKey(outgoingResults, 'total_fee')];

@ -18,7 +18,7 @@ export class CLNVerifyComponent implements OnDestroy {
public signature = ''; public signature = '';
public verifiedSignature = ''; public verifiedSignature = '';
public showVerifyStatus = false; public showVerifyStatus = false;
public verifyRes = { pubkey: '', verified: null }; public verifyRes: any = { pubkey: '', verified: null };
private unSubs: Array<Subject<void>> = [new Subject(), new Subject()]; private unSubs: Array<Subject<void>> = [new Subject(), new Subject()];
constructor(private dataService: DataService, private snackBar: MatSnackBar, private logger: LoggerService) { } constructor(private dataService: DataService, private snackBar: MatSnackBar, private logger: LoggerService) { }

@ -12,13 +12,15 @@ import { CLNForwardingEventsStatusEnum } from '../../shared/services/consts-enum
export const CLNReducer = createReducer(initCLNState, export const CLNReducer = createReducer(initCLNState,
on(updateCLAPICallStatus, (state, { payload }) => { on(updateCLAPICallStatus, (state, { payload }) => {
const updatedApisCallStatus = JSON.parse(JSON.stringify(state.apisCallStatus)); const updatedApisCallStatus = JSON.parse(JSON.stringify(state.apisCallStatus));
updatedApisCallStatus[payload.action || 0] = { if (payload.action) {
status: payload.status, updatedApisCallStatus[payload.action] = {
statusCode: payload.statusCode, status: payload.status,
message: payload.message, statusCode: payload.statusCode,
URL: payload.URL, message: payload.message,
filePath: payload.filePath URL: payload.URL,
}; filePath: payload.filePath
};
}
return { return {
...state, ...state,
apisCallStatus: updatedApisCallStatus apisCallStatus: updatedApisCallStatus

@ -25,10 +25,10 @@ import { clnNodeInformation, clnNodeSettings } from '../../../store/cln.selector
export class CLNCreateInvoiceComponent implements OnInit, OnDestroy { export class CLNCreateInvoiceComponent implements OnInit, OnDestroy {
public faExclamationTriangle = faExclamationTriangle; public faExclamationTriangle = faExclamationTriangle;
public selNode: SelNodeChild = {}; public selNode: SelNodeChild | null = {};
public description = ''; public description = '';
public expiry: number; public expiry: number | null;
public invoiceValue: number; public invoiceValue: number | null;
public invoiceValueHint = ''; public invoiceValueHint = '';
public invoicePaymentReq = ''; public invoicePaymentReq = '';
public invoices: any; public invoices: any;
@ -46,7 +46,7 @@ export class CLNCreateInvoiceComponent implements OnInit, OnDestroy {
ngOnInit() { ngOnInit() {
this.pageSize = this.data.pageSize; this.pageSize = this.data.pageSize;
this.store.select(clnNodeSettings).pipe(takeUntil(this.unSubs[0])).subscribe((nodeSettings: SelNodeChild) => { this.store.select(clnNodeSettings).pipe(takeUntil(this.unSubs[0])).subscribe((nodeSettings: SelNodeChild | null) => {
this.selNode = nodeSettings; this.selNode = nodeSettings;
}); });
this.store.select(clnNodeInformation).pipe(takeUntil(this.unSubs[1])).subscribe((nodeInfo: GetInfo) => { this.store.select(clnNodeInformation).pipe(takeUntil(this.unSubs[1])).subscribe((nodeInfo: GetInfo) => {
@ -73,7 +73,7 @@ export class CLNCreateInvoiceComponent implements OnInit, OnDestroy {
this.invoiceValue = 0; this.invoiceValue = 0;
} }
let expiryInSecs = (this.expiry ? this.expiry : 3600); let expiryInSecs = (this.expiry ? this.expiry : 3600);
if (this.selTimeUnit !== TimeUnitEnum.SECS) { if (this.selTimeUnit !== TimeUnitEnum.SECS && this.expiry) {
expiryInSecs = this.commonService.convertTime(this.expiry, this.selTimeUnit, TimeUnitEnum.SECS); expiryInSecs = this.commonService.convertTime(this.expiry, this.selTimeUnit, TimeUnitEnum.SECS);
} }
this.store.dispatch(saveNewInvoice({ this.store.dispatch(saveNewInvoice({
@ -94,7 +94,7 @@ export class CLNCreateInvoiceComponent implements OnInit, OnDestroy {
} }
onInvoiceValueChange() { onInvoiceValueChange() {
if (this.selNode.fiatConversion && this.invoiceValue > 99) { if (this.selNode && this.selNode.fiatConversion && this.invoiceValue && this.invoiceValue > 99) {
this.invoiceValueHint = ''; this.invoiceValueHint = '';
this.commonService.convertCurrency(this.invoiceValue, CurrencyUnitEnum.SATS, CurrencyUnitEnum.OTHER, (this.selNode.currencyUnits && this.selNode.currencyUnits.length > 2 ? this.selNode.currencyUnits[2] : ''), this.selNode.fiatConversion). this.commonService.convertCurrency(this.invoiceValue, CurrencyUnitEnum.SATS, CurrencyUnitEnum.OTHER, (this.selNode.currencyUnits && this.selNode.currencyUnits.length > 2 ? this.selNode.currencyUnits[2] : ''), this.selNode.fiatConversion).
pipe(takeUntil(this.unSubs[3])). pipe(takeUntil(this.unSubs[3])).

@ -39,7 +39,7 @@ export class CLNInvoiceInformationComponent implements OnInit, OnDestroy {
ngOnInit() { ngOnInit() {
this.invoice = this.data.invoice; this.invoice = this.data.invoice;
this.newlyAdded = this.data.newlyAdded; this.newlyAdded = !!this.data.newlyAdded;
this.screenSize = this.commonService.getScreenSize(); this.screenSize = this.commonService.getScreenSize();
if (this.screenSize === ScreenSizeEnum.XS) { if (this.screenSize === ScreenSizeEnum.XS) {
this.qrWidth = 220; this.qrWidth = 220;
@ -52,7 +52,7 @@ export class CLNInvoiceInformationComponent implements OnInit, OnDestroy {
subscribe((invoicesSelector: { listInvoices: ListInvoices, apiCallStatus: ApiCallStatusPayload }) => { subscribe((invoicesSelector: { listInvoices: ListInvoices, apiCallStatus: ApiCallStatusPayload }) => {
const invoiceStatus = this.invoice.status; const invoiceStatus = this.invoice.status;
const invoices = invoicesSelector.listInvoices.invoices || []; const invoices = invoicesSelector.listInvoices.invoices || [];
this.invoice = invoices.find((invoice) => invoice.payment_hash === this.invoice.payment_hash); this.invoice = invoices?.find((invoice) => invoice.payment_hash === this.invoice.payment_hash)!;
if (invoiceStatus !== this.invoice.status && this.invoice.status === 'paid') { if (invoiceStatus !== this.invoice.status && this.invoice.status === 'paid') {
this.flgInvoicePaid = true; this.flgInvoicePaid = true;
setTimeout(() => { this.flgInvoicePaid = false; }, 4000); setTimeout(() => { this.flgInvoicePaid = false; }, 4000);

@ -39,7 +39,7 @@ export class CLNLightningInvoicesTableComponent implements OnInit, AfterViewInit
@ViewChild(MatSort, { static: false }) sort: MatSort | undefined; @ViewChild(MatSort, { static: false }) sort: MatSort | undefined;
@ViewChild(MatPaginator, { static: false }) paginator: MatPaginator | undefined; @ViewChild(MatPaginator, { static: false }) paginator: MatPaginator | undefined;
faHistory = faHistory; faHistory = faHistory;
public selNode: SelNodeChild = {}; public selNode: SelNodeChild | null = {};
public newlyAddedInvoiceMemo = ''; public newlyAddedInvoiceMemo = '';
public newlyAddedInvoiceValue = 0; public newlyAddedInvoiceValue = 0;
public description = ''; public description = '';

@ -25,9 +25,9 @@ import { clnNodeInformation, clnNodeSettings } from '../../../store/cln.selector
export class CLNCreateOfferComponent implements OnInit, OnDestroy { export class CLNCreateOfferComponent implements OnInit, OnDestroy {
public faExclamationTriangle = faExclamationTriangle; public faExclamationTriangle = faExclamationTriangle;
public selNode: SelNodeChild = {}; public selNode: SelNodeChild | null = {};
public description = ''; public description = '';
public offerValue: number; public offerValue: number | null;
public vendor = ''; public vendor = '';
public offerValueHint = ''; public offerValueHint = '';
public offers: any; public offers: any;
@ -40,12 +40,12 @@ export class CLNCreateOfferComponent implements OnInit, OnDestroy {
ngOnInit() { ngOnInit() {
this.pageSize = this.data.pageSize; this.pageSize = this.data.pageSize;
this.store.select(clnNodeSettings).pipe(takeUntil(this.unSubs[0])).subscribe((nodeSettings: SelNodeChild) => { this.store.select(clnNodeSettings).pipe(takeUntil(this.unSubs[0])).subscribe((nodeSettings: SelNodeChild | null) => {
this.selNode = nodeSettings; this.selNode = nodeSettings;
}); });
this.store.select(clnNodeInformation).pipe(takeUntil(this.unSubs[1])).subscribe((nodeInfo: GetInfo) => { this.store.select(clnNodeInformation).pipe(takeUntil(this.unSubs[1])).subscribe((nodeInfo: GetInfo) => {
this.information = nodeInfo; this.information = nodeInfo;
this.vendor = this.information.alias; this.vendor = this.information.alias!;
}); });
this.actions.pipe( this.actions.pipe(
takeUntil(this.unSubs[2]), takeUntil(this.unSubs[2]),
@ -70,14 +70,14 @@ export class CLNCreateOfferComponent implements OnInit, OnDestroy {
resetData() { resetData() {
this.description = ''; this.description = '';
this.vendor = this.information.alias; this.vendor = this.information.alias!;
this.offerValue = null; this.offerValue = null;
this.offerValueHint = ''; this.offerValueHint = '';
this.offerError = ''; this.offerError = '';
} }
onOfferValueChange() { onOfferValueChange() {
if (this.selNode.fiatConversion && this.offerValue > 99) { if (this.selNode && this.selNode.fiatConversion && this.offerValue && this.offerValue > 99) {
this.offerValueHint = ''; this.offerValueHint = '';
this.commonService.convertCurrency(this.offerValue, CurrencyUnitEnum.SATS, CurrencyUnitEnum.OTHER, (this.selNode.currencyUnits && this.selNode.currencyUnits.length > 2 ? this.selNode.currencyUnits[2] : ''), this.selNode.fiatConversion). this.commonService.convertCurrency(this.offerValue, CurrencyUnitEnum.SATS, CurrencyUnitEnum.OTHER, (this.selNode.currencyUnits && this.selNode.currencyUnits.length > 2 ? this.selNode.currencyUnits[2] : ''), this.selNode.fiatConversion).
pipe(takeUntil(this.unSubs[3])). pipe(takeUntil(this.unSubs[3])).

@ -113,7 +113,7 @@ export class CLNOfferBookmarksTableComponent implements OnInit, AfterViewInit, O
})); }));
this.rtlEffects.closeConfirm.pipe(takeUntil(this.unSubs[1])).subscribe((confirmRes) => { this.rtlEffects.closeConfirm.pipe(takeUntil(this.unSubs[1])).subscribe((confirmRes) => {
if (confirmRes) { if (confirmRes) {
this.store.dispatch(deleteOfferBookmark({ payload: { bolt12: selOffer.bolt12 } })); this.store.dispatch(deleteOfferBookmark({ payload: { bolt12: selOffer.bolt12! } }));
} }
}); });
} }

@ -40,7 +40,7 @@ export class CLNOfferInformationComponent implements OnInit, OnDestroy {
ngOnInit() { ngOnInit() {
this.offer = this.data.offer; this.offer = this.data.offer;
this.newlyAdded = this.data.newlyAdded; this.newlyAdded = !!this.data.newlyAdded;
this.screenSize = this.commonService.getScreenSize(); this.screenSize = this.commonService.getScreenSize();
if (this.screenSize === ScreenSizeEnum.XS) { if (this.screenSize === ScreenSizeEnum.XS) {
this.qrWidth = 220; this.qrWidth = 220;
@ -49,14 +49,14 @@ export class CLNOfferInformationComponent implements OnInit, OnDestroy {
subscribe((nodeInfo: GetInfo) => { subscribe((nodeInfo: GetInfo) => {
this.flgVersionCompatible = this.commonService.isVersionCompatible(nodeInfo.api_version, '0.6.0'); this.flgVersionCompatible = this.commonService.isVersionCompatible(nodeInfo.api_version, '0.6.0');
}); });
this.dataService.decodePayment(this.offer.bolt12, true). this.dataService.decodePayment(this.offer.bolt12!, true).
pipe(takeUntil(this.unSubs[1])).subscribe((decodedOffer: OfferRequest) => { pipe(takeUntil(this.unSubs[1])).subscribe((decodedOffer: OfferRequest) => {
this.offerDecoded = decodedOffer; this.offerDecoded = decodedOffer;
if (this.offerDecoded.offer_id && !this.offerDecoded.amount_msat) { if (this.offerDecoded.offer_id && !this.offerDecoded.amount_msat) {
this.offerDecoded.amount_msat = '0msat'; this.offerDecoded.amount_msat = '0msat';
this.offerDecoded.amount = 0; this.offerDecoded.amount = 0;
} else { } else {
this.offerDecoded.amount = +(this.offerDecoded.amount || this.offerDecoded.amount_msat.slice(0, -4)); this.offerDecoded.amount = this.offerDecoded.amount ? +this.offerDecoded.amount : this.offerDecoded.amount_msat ? +(this.offerDecoded.amount_msat)?.slice(0, -4) : null;
} }
}); });
} }

@ -41,12 +41,12 @@ export class CLNOffersTableComponent implements OnInit, AfterViewInit, OnDestroy
@ViewChild(MatSort, { static: false }) sort: MatSort | undefined; @ViewChild(MatSort, { static: false }) sort: MatSort | undefined;
@ViewChild(MatPaginator, { static: false }) paginator: MatPaginator | undefined; @ViewChild(MatPaginator, { static: false }) paginator: MatPaginator | undefined;
faHistory = faHistory; faHistory = faHistory;
public selNode: SelNodeChild = {}; public selNode: SelNodeChild | null = {};
public newlyAddedOfferMemo = ''; public newlyAddedOfferMemo = '';
public newlyAddedOfferValue = 0; public newlyAddedOfferValue = 0;
public description = ''; public description = '';
public expiry: number; public expiry: number;
public offerValue: number = null; public offerValue: number | null = null;
public offerValueHint = ''; public offerValueHint = '';
public displayedColumns: any[] = []; public displayedColumns: any[] = [];
public offerPaymentReq = ''; public offerPaymentReq = '';
@ -84,7 +84,7 @@ export class CLNOffersTableComponent implements OnInit, AfterViewInit, OnDestroy
} }
ngOnInit() { ngOnInit() {
this.store.select(clnNodeSettings).pipe(takeUntil(this.unSubs[0])).subscribe((nodeSettings: SelNodeChild) => { this.store.select(clnNodeSettings).pipe(takeUntil(this.unSubs[0])).subscribe((nodeSettings: SelNodeChild | null) => {
this.selNode = nodeSettings; this.selNode = nodeSettings;
}); });
this.store.select(clnNodeInformation).pipe(takeUntil(this.unSubs[1])).subscribe((nodeInfo: GetInfo) => { this.store.select(clnNodeInformation).pipe(takeUntil(this.unSubs[1])).subscribe((nodeInfo: GetInfo) => {
@ -156,19 +156,19 @@ export class CLNOffersTableComponent implements OnInit, AfterViewInit, OnDestroy
})); }));
this.rtlEffects.closeConfirm.pipe(takeUntil(this.unSubs[3])).subscribe((confirmRes) => { this.rtlEffects.closeConfirm.pipe(takeUntil(this.unSubs[3])).subscribe((confirmRes) => {
if (confirmRes) { if (confirmRes) {
this.store.dispatch(disableOffer({ payload: { offer_id: selOffer.offer_id } })); this.store.dispatch(disableOffer({ payload: { offer_id: selOffer.offer_id! } }));
} }
}); });
} }
onPrintOffer(selOffer: Offer) { onPrintOffer(selOffer: Offer) {
this.dataService.decodePayment(selOffer.bolt12, false). this.dataService.decodePayment(selOffer.bolt12!, false).
pipe(take(1)).subscribe((offerDecoded: OfferRequest) => { pipe(take(1)).subscribe((offerDecoded: OfferRequest) => {
if (offerDecoded.offer_id && !offerDecoded.amount_msat) { if (offerDecoded.offer_id && !offerDecoded.amount_msat) {
offerDecoded.amount_msat = '0msat'; offerDecoded.amount_msat = '0msat';
offerDecoded.amount = 0; offerDecoded.amount = 0;
} else { } else {
offerDecoded.amount = +(offerDecoded.amount || offerDecoded.amount_msat.slice(0, -4)); offerDecoded.amount = offerDecoded.amount ? +offerDecoded.amount : offerDecoded.amount_msat ? +offerDecoded.amount_msat.slice(0, -4) : null;
} }
const documentDefinition = { const documentDefinition = {
pageSize: 'A5', pageSize: 'A5',
@ -196,7 +196,7 @@ export class CLNOffersTableComponent implements OnInit, AfterViewInit, OnDestroy
}, },
{ text: offerDecoded.description ? offerDecoded.description.substring(0, 160) : '', alignment: 'center', fontSize: 16, color: '#5C5C5C' }, { text: offerDecoded.description ? offerDecoded.description.substring(0, 160) : '', alignment: 'center', fontSize: 16, color: '#5C5C5C' },
{ qr: selOffer.bolt12, eccLevel: 'M', fit: '227', alignment: 'center', absolutePosition: { x: 7, y: 205 } }, { qr: selOffer.bolt12, eccLevel: 'M', fit: '227', alignment: 'center', absolutePosition: { x: 7, y: 205 } },
{ text: (!offerDecoded?.amount_msat || offerDecoded?.amount === 0 ? 'Open amount' : (this.decimalPipe.transform(offerDecoded.amount / 1000) + ' SATS')), fontSize: 20, bold: false, color: 'white', alignment: 'center', absolutePosition: { x: 0, y: 430 } }, { text: (!offerDecoded?.amount_msat || offerDecoded?.amount === 0 ? 'Open amount' : (this.decimalPipe.transform((offerDecoded.amount || 0) / 1000) + ' SATS')), fontSize: 20, bold: false, color: 'white', alignment: 'center', absolutePosition: { x: 0, y: 430 } },
{ text: 'SCAN TO PAY', fontSize: 22, bold: true, color: 'white', alignment: 'center', absolutePosition: { x: 0, y: 455 } } { text: 'SCAN TO PAY', fontSize: 22, bold: true, color: 'white', alignment: 'center', absolutePosition: { x: 0, y: 455 } }
], ],
footer: { footer: {

@ -47,7 +47,7 @@ export class CLNLightningSendPaymentsComponent implements OnInit, OnDestroy {
public faExclamationTriangle = faExclamationTriangle; public faExclamationTriangle = faExclamationTriangle;
public paymentTypes = PaymentTypes; public paymentTypes = PaymentTypes;
public paymentType = PaymentTypes.INVOICE; public paymentType = PaymentTypes.INVOICE;
public selNode: SelNodeChild = {}; public selNode: SelNodeChild | null = {};
public offerDecoded: OfferRequest = {}; public offerDecoded: OfferRequest = {};
public offerRequest = ''; public offerRequest = '';
@ -56,8 +56,8 @@ export class CLNLightningSendPaymentsComponent implements OnInit, OnDestroy {
public offerVendor = ''; public offerVendor = '';
public offerTitle = ''; public offerTitle = '';
public zeroAmtOffer = false; public zeroAmtOffer = false;
public offerInvoice: OfferInvoice = null; public offerInvoice: OfferInvoice | null = null;
public offerAmount = null; public offerAmount: number | null = null;
public flgSaveToDB = false; public flgSaveToDB = false;
public paymentDecoded: PayRequest = {}; public paymentDecoded: PayRequest = {};
@ -68,7 +68,7 @@ export class CLNLightningSendPaymentsComponent implements OnInit, OnDestroy {
public pubkey = ''; public pubkey = '';
public keysendAmount = null; public keysendAmount = null;
public selActiveChannel: Channel = {}; public selActiveChannel: Channel | null = {};
public activeChannels = {}; public activeChannels = {};
public feeLimit = null; public feeLimit = null;
public selFeeLimitType = FEE_LIMIT_TYPES[0]; public selFeeLimitType = FEE_LIMIT_TYPES[0];
@ -84,21 +84,21 @@ export class CLNLightningSendPaymentsComponent implements OnInit, OnDestroy {
this.paymentType = this.data.paymentType; this.paymentType = this.data.paymentType;
switch (this.paymentType) { switch (this.paymentType) {
case PaymentTypes.INVOICE: case PaymentTypes.INVOICE:
this.paymentRequest = this.data.invoiceBolt11; this.paymentRequest = this.data.invoiceBolt11!;
break; break;
case PaymentTypes.KEYSEND: case PaymentTypes.KEYSEND:
this.pubkey = this.data.pubkeyKeysend; this.pubkey = this.data.pubkeyKeysend!;
break; break;
case PaymentTypes.OFFER: case PaymentTypes.OFFER:
this.onPaymentRequestEntry(this.data.bolt12); this.onPaymentRequestEntry(this.data.bolt12);
this.offerTitle = this.data.offerTitle; this.offerTitle = this.data.offerTitle!;
this.flgSaveToDB = false; this.flgSaveToDB = false;
break; break;
default: default:
break; break;
} }
} }
this.store.select(clnNodeSettings).pipe(takeUntil(this.unSubs[0])).subscribe((nodeSettings: SelNodeChild) => { this.store.select(clnNodeSettings).pipe(takeUntil(this.unSubs[0])).subscribe((nodeSettings: SelNodeChild | null) => {
this.selNode = nodeSettings; this.selNode = nodeSettings;
}); });
this.store.select(clnNodeInformation).pipe(takeUntil(this.unSubs[1])).subscribe((nodeInfo: GetInfo) => { this.store.select(clnNodeInformation).pipe(takeUntil(this.unSubs[1])).subscribe((nodeInfo: GetInfo) => {
@ -203,26 +203,30 @@ export class CLNLightningSendPaymentsComponent implements OnInit, OnDestroy {
} }
keysendPayment() { keysendPayment() {
this.store.dispatch(sendPayment({ payload: { uiMessage: UI_MESSAGES.SEND_KEYSEND, paymentType: PaymentTypes.KEYSEND, pubkey: this.pubkey, amount: this.keysendAmount * 1000, fromDialog: true } })); if (this.keysendAmount) {
this.store.dispatch(sendPayment({ payload: { uiMessage: UI_MESSAGES.SEND_KEYSEND, paymentType: PaymentTypes.KEYSEND, pubkey: this.pubkey, amount: this.keysendAmount * 1000, fromDialog: true } }));
}
} }
sendPayment() { sendPayment() {
this.paymentError = ''; this.paymentError = '';
if (this.paymentType === PaymentTypes.INVOICE) { if (this.paymentType === PaymentTypes.INVOICE) {
if (this.zeroAmtInvoice) { if (this.zeroAmtInvoice && this.paymentAmount) {
this.store.dispatch(sendPayment({ payload: { uiMessage: UI_MESSAGES.SEND_PAYMENT, paymentType: PaymentTypes.INVOICE, invoice: this.paymentRequest, amount: this.paymentAmount * 1000, fromDialog: true } })); this.store.dispatch(sendPayment({ payload: { uiMessage: UI_MESSAGES.SEND_PAYMENT, paymentType: PaymentTypes.INVOICE, invoice: this.paymentRequest, amount: this.paymentAmount * 1000, fromDialog: true } }));
} else { } else {
this.store.dispatch(sendPayment({ payload: { uiMessage: UI_MESSAGES.SEND_PAYMENT, paymentType: PaymentTypes.INVOICE, invoice: this.paymentRequest, fromDialog: true } })); this.store.dispatch(sendPayment({ payload: { uiMessage: UI_MESSAGES.SEND_PAYMENT, paymentType: PaymentTypes.INVOICE, invoice: this.paymentRequest, fromDialog: true } }));
} }
} else if (this.paymentType === PaymentTypes.OFFER) { } else if (this.paymentType === PaymentTypes.OFFER) {
if (!this.offerInvoice) { if (!this.offerInvoice) {
if (this.zeroAmtOffer) { if (this.zeroAmtOffer && this.offerAmount) {
this.store.dispatch(fetchOfferInvoice({ payload: { offer: this.offerRequest, msatoshi: this.offerAmount * 1000 } })); this.store.dispatch(fetchOfferInvoice({ payload: { offer: this.offerRequest, msatoshi: this.offerAmount * 1000 } }));
} else { } else {
this.store.dispatch(fetchOfferInvoice({ payload: { offer: this.offerRequest } })); this.store.dispatch(fetchOfferInvoice({ payload: { offer: this.offerRequest } }));
} }
} else { } else {
this.store.dispatch(sendPayment({ payload: { uiMessage: UI_MESSAGES.SEND_PAYMENT, paymentType: PaymentTypes.OFFER, invoice: this.offerInvoice.invoice, saveToDB: this.flgSaveToDB, bolt12: this.offerRequest, amount: this.offerAmount * 1000, zeroAmtOffer: this.zeroAmtOffer, title: this.offerTitle, vendor: this.offerVendor, description: this.offerDescription, fromDialog: true } })); if (this.offerAmount) {
this.store.dispatch(sendPayment({ payload: { uiMessage: UI_MESSAGES.SEND_PAYMENT, paymentType: PaymentTypes.OFFER, invoice: this.offerInvoice.invoice, saveToDB: this.flgSaveToDB, bolt12: this.offerRequest, amount: this.offerAmount * 1000, zeroAmtOffer: this.zeroAmtOffer, title: this.offerTitle, vendor: this.offerVendor, description: this.offerDescription, fromDialog: true } }));
}
} }
} }
} }
@ -300,16 +304,16 @@ export class CLNLightningSendPaymentsComponent implements OnInit, OnDestroy {
this.offerDecoded.amount_msat = '0msat'; this.offerDecoded.amount_msat = '0msat';
this.offerDecoded.amount = 0; this.offerDecoded.amount = 0;
this.zeroAmtOffer = true; this.zeroAmtOffer = true;
this.offerDescription = this.offerDecoded.description; this.offerDescription = this.offerDecoded.description || '';
this.offerVendor = this.offerDecoded.vendor ? this.offerDecoded.vendor : this.offerDecoded.issuer ? this.offerDecoded.issuer : ''; this.offerVendor = this.offerDecoded.vendor ? this.offerDecoded.vendor : this.offerDecoded.issuer ? this.offerDecoded.issuer : '';
this.offerDecodedHint = 'Zero Amount Offer | Description: ' + this.offerDecoded.description; this.offerDecodedHint = 'Zero Amount Offer | Description: ' + this.offerDecoded.description;
} else { } else {
this.zeroAmtOffer = false; this.zeroAmtOffer = false;
this.offerDecoded.amount = +(this.offerDecoded.amount || this.offerDecoded.amount_msat.slice(0, -4)); this.offerDecoded.amount = this.offerDecoded.amount ? +this.offerDecoded.amount : this.offerDecoded.amount_msat ? +this.offerDecoded.amount_msat.slice(0, -4) : null;
this.offerAmount = this.offerDecoded.amount ? this.offerDecoded.amount / 1000 : 0; this.offerAmount = this.offerDecoded.amount ? this.offerDecoded.amount / 1000 : 0;
this.offerDescription = this.offerDecoded.description; this.offerDescription = this.offerDecoded.description || '';
this.offerVendor = this.offerDecoded.vendor ? this.offerDecoded.vendor : this.offerDecoded.issuer ? this.offerDecoded.issuer : ''; this.offerVendor = this.offerDecoded.vendor ? this.offerDecoded.vendor : this.offerDecoded.issuer ? this.offerDecoded.issuer : '';
if (this.selNode.fiatConversion) { if (this.selNode && this.selNode.fiatConversion) {
this.commonService.convertCurrency(this.offerAmount, CurrencyUnitEnum.SATS, CurrencyUnitEnum.OTHER, (this.selNode.currencyUnits && this.selNode.currencyUnits.length > 2 ? this.selNode.currencyUnits[2] : ''), this.selNode.fiatConversion). this.commonService.convertCurrency(this.offerAmount, CurrencyUnitEnum.SATS, CurrencyUnitEnum.OTHER, (this.selNode.currencyUnits && this.selNode.currencyUnits.length > 2 ? this.selNode.currencyUnits[2] : ''), this.selNode.fiatConversion).
pipe(takeUntil(this.unSubs[7])). pipe(takeUntil(this.unSubs[7])).
subscribe({ subscribe({
@ -332,7 +336,7 @@ export class CLNLightningSendPaymentsComponent implements OnInit, OnDestroy {
this.paymentDecodedHint = 'Zero Amount Invoice | Memo: ' + this.paymentDecoded.description; this.paymentDecodedHint = 'Zero Amount Invoice | Memo: ' + this.paymentDecoded.description;
} else { } else {
this.zeroAmtInvoice = false; this.zeroAmtInvoice = false;
if (this.selNode.fiatConversion) { if (this.selNode && this.selNode.fiatConversion) {
this.commonService.convertCurrency(this.paymentDecoded.msatoshi ? this.paymentDecoded.msatoshi / 1000 : 0, CurrencyUnitEnum.SATS, CurrencyUnitEnum.OTHER, (this.selNode.currencyUnits && this.selNode.currencyUnits.length > 2 ? this.selNode.currencyUnits[2] : ''), this.selNode.fiatConversion). this.commonService.convertCurrency(this.paymentDecoded.msatoshi ? this.paymentDecoded.msatoshi / 1000 : 0, CurrencyUnitEnum.SATS, CurrencyUnitEnum.OTHER, (this.selNode.currencyUnits && this.selNode.currencyUnits.length > 2 ? this.selNode.currencyUnits[2] : ''), this.selNode.fiatConversion).
pipe(takeUntil(this.unSubs[8])). pipe(takeUntil(this.unSubs[8])).
subscribe({ subscribe({

@ -24,10 +24,10 @@ export class CLNTransactionsComponent implements OnInit, OnDestroy {
faExchangeAlt = faExchangeAlt; faExchangeAlt = faExchangeAlt;
faChartPie = faChartPie; faChartPie = faChartPie;
currencyUnits = []; currencyUnits: string[] = [];
routerUrl = ''; routerUrl = '';
balances = [{ title: 'Local Capacity', dataValue: 0, tooltip: 'Amount you can send' }, { title: 'Remote Capacity', dataValue: 0, tooltip: 'Amount you can receive' }]; balances = [{ title: 'Local Capacity', dataValue: 0, tooltip: 'Amount you can send' }, { title: 'Remote Capacity', dataValue: 0, tooltip: 'Amount you can receive' }];
public selNode: SelNodeChild = {}; public selNode: SelNodeChild | null = {};
public links = [{ link: 'payments', name: 'Payments' }, { link: 'invoices', name: 'Invoices' }]; public links = [{ link: 'payments', name: 'Payments' }, { link: 'invoices', name: 'Invoices' }];
public activeLink = this.links[0].link; public activeLink = this.links[0].link;
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()];
@ -45,9 +45,9 @@ export class CLNTransactionsComponent implements OnInit, OnDestroy {
this.routerUrl = (<ResolveEnd>value).urlAfterRedirects; this.routerUrl = (<ResolveEnd>value).urlAfterRedirects;
} }
}); });
this.store.select(clnNodeSettings).pipe(takeUntil(this.unSubs[1])).subscribe((nodeSettings: SelNodeChild) => { this.store.select(clnNodeSettings).pipe(takeUntil(this.unSubs[1])).subscribe((nodeSettings: SelNodeChild | null) => {
this.selNode = nodeSettings; this.selNode = nodeSettings;
if (this.selNode.enableOffers) { if (this.selNode && this.selNode.enableOffers) {
this.store.dispatch(fetchOffers()); this.store.dispatch(fetchOffers());
this.store.dispatch(fetchOfferBookmarks()); this.store.dispatch(fetchOfferBookmarks());
this.links.push({ link: 'offers', name: 'Offers' }); this.links.push({ link: 'offers', name: 'Offers' });
@ -58,9 +58,9 @@ export class CLNTransactionsComponent implements OnInit, OnDestroy {
}); });
this.store.select(localRemoteBalance).pipe(takeUntil(this.unSubs[2]), this.store.select(localRemoteBalance).pipe(takeUntil(this.unSubs[2]),
withLatestFrom(this.store.select(clnNodeSettings))). withLatestFrom(this.store.select(clnNodeSettings))).
subscribe(([lrBalSeletor, nodeSettings]: [{ localRemoteBalance: LocalRemoteBalance, apiCallStatus: ApiCallStatusPayload }, SelNodeChild]) => { subscribe(([lrBalSeletor, nodeSettings]: [{ localRemoteBalance: LocalRemoteBalance, apiCallStatus: ApiCallStatusPayload }, (SelNodeChild | null)]) => {
this.currencyUnits = nodeSettings.currencyUnits; this.currencyUnits = nodeSettings?.currencyUnits || [];
if (nodeSettings.userPersona === UserPersonaEnum.OPERATOR) { if (nodeSettings && nodeSettings.userPersona === UserPersonaEnum.OPERATOR) {
this.balances = [{ title: 'Local Capacity', dataValue: lrBalSeletor.localRemoteBalance.localBalance, tooltip: 'Amount you can send' }, { title: 'Remote Capacity', dataValue: lrBalSeletor.localRemoteBalance.remoteBalance, tooltip: 'Amount you can receive' }]; this.balances = [{ title: 'Local Capacity', dataValue: lrBalSeletor.localRemoteBalance.localBalance, tooltip: 'Amount you can send' }, { title: 'Remote Capacity', dataValue: lrBalSeletor.localRemoteBalance.remoteBalance, tooltip: 'Amount you can receive' }];
} else { } else {
this.balances = [{ title: 'Outbound Capacity', dataValue: lrBalSeletor.localRemoteBalance.localBalance, tooltip: 'Amount you can send' }, { title: 'Inbound Capacity', dataValue: lrBalSeletor.localRemoteBalance.remoteBalance, tooltip: 'Amount you can receive' }]; this.balances = [{ title: 'Outbound Capacity', dataValue: lrBalSeletor.localRemoteBalance.localBalance, tooltip: 'Amount you can send' }, { title: 'Inbound Capacity', dataValue: lrBalSeletor.localRemoteBalance.remoteBalance, tooltip: 'Amount you can receive' }];

@ -59,7 +59,7 @@ export class ECLQueryRoutesComponent implements OnInit, OnDestroy {
if (queryRoute && queryRoute.routes && queryRoute.routes.length) { if (queryRoute && queryRoute.routes && queryRoute.routes.length) {
this.flgLoading[0] = false; this.flgLoading[0] = false;
this.allQRoutes = queryRoute.routes; this.allQRoutes = queryRoute.routes;
this.allQRoutes.forEach((route, i) => { this.allQRoutes.forEach((route: any, i) => {
this.qrHops[i] = new MatTableDataSource<QueryRoutes>([...route.nodeIds]); this.qrHops[i] = new MatTableDataSource<QueryRoutes>([...route.nodeIds]);
}); });
} else { } else {

@ -17,7 +17,7 @@ export class ECLFeeInfoComponent implements OnChanges {
ngOnChanges() { ngOnChanges() {
if (this.fees?.monthly_fee) { if (this.fees?.monthly_fee) {
this.totalFees = [{ name: 'Monthly', value: this.fees.monthly_fee }, { name: 'Weekly', value: this.fees.weekly_fee }, { name: 'Daily ', value: this.fees.daily_fee }]; this.totalFees = [{ name: 'Monthly', value: this.fees.monthly_fee }, { name: 'Weekly', value: this.fees.weekly_fee || 0 }, { name: 'Daily ', value: this.fees.daily_fee || 0}];
const e = Math.ceil(Math.log(this.fees.monthly_fee + 1) / Math.LN10); const e = Math.ceil(Math.log(this.fees.monthly_fee + 1) / Math.LN10);
const m = 10 ** (e - 1); const m = 10 ** (e - 1);
this.maxFeeValue = (Math.ceil(this.fees.monthly_fee / m) * m) / 5 || 100; this.maxFeeValue = (Math.ceil(this.fees.monthly_fee / m) * m) / 5 || 100;

@ -43,7 +43,7 @@ export class ECLHomeComponent implements OnInit, OnDestroy {
public faNetworkWired = faNetworkWired; public faNetworkWired = faNetworkWired;
public userPersonaEnum = UserPersonaEnum; public userPersonaEnum = UserPersonaEnum;
public channelBalances = { localBalance: 0, remoteBalance: 0, balancedness: 0 }; public channelBalances = { localBalance: 0, remoteBalance: 0, balancedness: 0 };
public selNode: SelNodeChild = {}; public selNode: SelNodeChild | null = {};
public fees: Fees; public fees: Fees;
public information: GetInfo = {}; public information: GetInfo = {};
public channels: Channel[] = []; public channels: Channel[] = [];
@ -126,7 +126,7 @@ export class ECLHomeComponent implements OnInit, OnDestroy {
this.errorMessages[0] = ''; this.errorMessages[0] = '';
this.apiCallStatusNodeInfo = selNodeInfoStatusSelector.apiCallStatus; this.apiCallStatusNodeInfo = selNodeInfoStatusSelector.apiCallStatus;
if (this.apiCallStatusNodeInfo.status === APICallStatusEnum.ERROR) { if (this.apiCallStatusNodeInfo.status === APICallStatusEnum.ERROR) {
this.errorMessages[0] = (typeof (this.apiCallStatusNodeInfo.message) === 'object') ? JSON.stringify(this.apiCallStatusNodeInfo.message) : this.apiCallStatusNodeInfo.message; this.errorMessages[0] = (typeof (this.apiCallStatusNodeInfo.message) === 'object') ? JSON.stringify(this.apiCallStatusNodeInfo.message) : this.apiCallStatusNodeInfo.message ? this.apiCallStatusNodeInfo.message : '';
} }
this.information = selNodeInfoStatusSelector.information; this.information = selNodeInfoStatusSelector.information;
}); });
@ -136,7 +136,7 @@ export class ECLHomeComponent implements OnInit, OnDestroy {
this.errorMessages[1] = ''; this.errorMessages[1] = '';
this.apiCallStatusFees = feesSelector.apiCallStatus; this.apiCallStatusFees = feesSelector.apiCallStatus;
if (this.apiCallStatusFees.status === APICallStatusEnum.ERROR) { if (this.apiCallStatusFees.status === APICallStatusEnum.ERROR) {
this.errorMessages[1] = (typeof (this.apiCallStatusFees.message) === 'object') ? JSON.stringify(this.apiCallStatusFees.message) : this.apiCallStatusFees.message; this.errorMessages[1] = (typeof (this.apiCallStatusFees.message) === 'object') ? JSON.stringify(this.apiCallStatusFees.message) : this.apiCallStatusFees.message ? this.apiCallStatusFees.message : '';
} }
this.fees = feesSelector.fees; this.fees = feesSelector.fees;
}); });
@ -148,14 +148,14 @@ export class ECLHomeComponent implements OnInit, OnDestroy {
this.apiCallStatusAllChannels = allChannelsSelector.apiCallStatus; this.apiCallStatusAllChannels = allChannelsSelector.apiCallStatus;
this.apiCallStatusOCBal = oCBalanceSelector.apiCallStatus; this.apiCallStatusOCBal = oCBalanceSelector.apiCallStatus;
if (this.apiCallStatusAllChannels.status === APICallStatusEnum.ERROR) { if (this.apiCallStatusAllChannels.status === APICallStatusEnum.ERROR) {
this.errorMessages[2] = (typeof (this.apiCallStatusAllChannels.message) === 'object') ? JSON.stringify(this.apiCallStatusAllChannels.message) : this.apiCallStatusAllChannels.message; this.errorMessages[2] = (typeof (this.apiCallStatusAllChannels.message) === 'object') ? JSON.stringify(this.apiCallStatusAllChannels.message) : this.apiCallStatusAllChannels.message ? this.apiCallStatusAllChannels.message : '';
} }
if (this.apiCallStatusOCBal.status === APICallStatusEnum.ERROR) { if (this.apiCallStatusOCBal.status === APICallStatusEnum.ERROR) {
this.errorMessages[3] = (typeof (this.apiCallStatusOCBal.message) === 'object') ? JSON.stringify(this.apiCallStatusOCBal.message) : this.apiCallStatusOCBal.message; this.errorMessages[3] = (typeof (this.apiCallStatusOCBal.message) === 'object') ? JSON.stringify(this.apiCallStatusOCBal.message) : this.apiCallStatusOCBal.message ? this.apiCallStatusOCBal.message : '';
} }
this.channels = allChannelsSelector.activeChannels; this.channels = allChannelsSelector.activeChannels;
this.onchainBalance = oCBalanceSelector.onchainBalance; this.onchainBalance = oCBalanceSelector.onchainBalance;
this.balances.onchain = this.onchainBalance.total; this.balances.onchain = this.onchainBalance.total || 0;
this.balances.lightning = allChannelsSelector.lightningBalance.localBalance; this.balances.lightning = allChannelsSelector.lightningBalance.localBalance;
this.balances.total = this.balances.lightning + this.balances.onchain; this.balances.total = this.balances.lightning + this.balances.onchain;
this.balances = Object.assign({}, this.balances); this.balances = Object.assign({}, this.balances);
@ -167,11 +167,11 @@ export class ECLHomeComponent implements OnInit, OnDestroy {
this.totalInboundLiquidity = 0; this.totalInboundLiquidity = 0;
this.totalOutboundLiquidity = 0; this.totalOutboundLiquidity = 0;
this.allChannelsCapacity = JSON.parse(JSON.stringify(this.commonService.sortDescByKey(this.channels, 'balancedness'))); this.allChannelsCapacity = JSON.parse(JSON.stringify(this.commonService.sortDescByKey(this.channels, 'balancedness')));
this.allInboundChannels = JSON.parse(JSON.stringify(this.commonService.sortDescByKey(this.channels?.filter((channel) => channel.toRemote > 0), 'toRemote'))); this.allInboundChannels = JSON.parse(JSON.stringify(this.commonService.sortDescByKey(this.channels?.filter((channel: Channel) => (channel.toRemote || 0) > 0), 'toRemote')));
this.allOutboundChannels = JSON.parse(JSON.stringify(this.commonService.sortDescByKey(this.channels?.filter((channel) => channel.toLocal > 0), 'toLocal'))); this.allOutboundChannels = JSON.parse(JSON.stringify(this.commonService.sortDescByKey(this.channels?.filter((channel: Channel) => (channel.toLocal || 0) > 0), 'toLocal')));
this.channels.forEach((channel) => { this.channels.forEach((channel: Channel) => {
this.totalInboundLiquidity = this.totalInboundLiquidity + Math.ceil(channel.toRemote); this.totalInboundLiquidity = this.totalInboundLiquidity + Math.ceil(channel.toRemote || 0);
this.totalOutboundLiquidity = this.totalOutboundLiquidity + Math.floor(channel.toLocal); this.totalOutboundLiquidity = this.totalOutboundLiquidity + Math.floor(channel.toLocal || 0);
}); });
this.logger.info(allChannelsSelector); this.logger.info(allChannelsSelector);
}); });
@ -184,9 +184,9 @@ export class ECLHomeComponent implements OnInit, OnDestroy {
onsortChannelsBy() { onsortChannelsBy() {
if (this.sortField === 'Balance Score') { if (this.sortField === 'Balance Score') {
this.sortField = 'Capacity'; this.sortField = 'Capacity';
this.allChannelsCapacity = this.channels.sort((a, b) => { this.allChannelsCapacity = this.channels.sort((a: Channel, b: Channel) => {
const x = +a.toLocal + +a.toRemote; const x = +(a.toLocal || 0) + +(a.toRemote || 0);
const y = +b.toLocal + +b.toRemote; const y = +(b.toLocal || 0) + +(b.toRemote || 0);
return ((x > y) ? -1 : ((x < y) ? 1 : 0)); return ((x > y) ? -1 : ((x < y) ? 1 : 0));
}); });
} else { } else {

@ -7,9 +7,9 @@ import { Actions } from '@ngrx/effects';
import { MatDialogRef } from '@angular/material/dialog'; import { MatDialogRef } from '@angular/material/dialog';
import { faExclamationTriangle } from '@fortawesome/free-solid-svg-icons'; import { faExclamationTriangle } from '@fortawesome/free-solid-svg-icons';
import { SelNodeChild, GetInfoRoot, RTLConfiguration } from '../../../shared/models/RTLconfig'; import { SelNodeChild } from '../../../shared/models/RTLconfig';
import { GetInfo, OnChainBalance, SendPaymentOnChain } from '../../../shared/models/eclModels'; import { GetInfo, OnChainBalance, SendPaymentOnChain } from '../../../shared/models/eclModels';
import { CURRENCY_UNITS, CurrencyUnitEnum, CURRENCY_UNIT_FORMATS, ADDRESS_TYPES, APICallStatusEnum, UI_MESSAGES, ECLActions } from '../../../shared/services/consts-enums-functions'; import { CURRENCY_UNITS, CurrencyUnitEnum, CURRENCY_UNIT_FORMATS, ADDRESS_TYPES, APICallStatusEnum, ECLActions } from '../../../shared/services/consts-enums-functions';
import { CommonService } from '../../../shared/services/common.service'; import { CommonService } from '../../../shared/services/common.service';
import { LoggerService } from '../../../shared/services/logger.service'; import { LoggerService } from '../../../shared/services/logger.service';
@ -27,7 +27,7 @@ export class ECLOnChainSendModalComponent implements OnInit, OnDestroy {
@ViewChild('form', { static: true }) form: any; @ViewChild('form', { static: true }) form: any;
public faExclamationTriangle = faExclamationTriangle; public faExclamationTriangle = faExclamationTriangle;
public selNode: SelNodeChild = {}; public selNode: SelNodeChild | null = {};
public addressTypes = []; public addressTypes = [];
public selectedAddress = ADDRESS_TYPES[1]; public selectedAddress = ADDRESS_TYPES[1];
public blockchainBalance: OnChainBalance = {}; public blockchainBalance: OnChainBalance = {};
@ -81,7 +81,6 @@ export class ECLOnChainSendModalComponent implements OnInit, OnDestroy {
this.selAmountUnit = CurrencyUnitEnum.SATS; this.selAmountUnit = CurrencyUnitEnum.SATS;
this.store.dispatch(sendOnchainFunds({ payload: this.transaction })); this.store.dispatch(sendOnchainFunds({ payload: this.transaction }));
}, error: (err) => { }, error: (err) => {
this.transaction.amount = null;
this.selAmountUnit = CurrencyUnitEnum.SATS; this.selAmountUnit = CurrencyUnitEnum.SATS;
this.amountError = 'Conversion Error: ' + err; this.amountError = 'Conversion Error: ' + err;
} }
@ -112,9 +111,8 @@ export class ECLOnChainSendModalComponent implements OnInit, OnDestroy {
subscribe({ subscribe({
next: (data) => { next: (data) => {
this.selAmountUnit = event.value; this.selAmountUnit = event.value;
self.transaction.amount = +self.decimalPipe.transform(data[currSelectedUnit], self.currencyUnitFormats[currSelectedUnit])?.replace(/,/g, ''); self.transaction.amount = +self.decimalPipe.transform(data[currSelectedUnit], self.currencyUnitFormats[currSelectedUnit])!.replace(/,/g, '');
}, error: (err) => { }, error: (err) => {
self.transaction.amount = null;
this.amountError = 'Conversion Error: ' + err; this.amountError = 'Conversion Error: ' + err;
this.selAmountUnit = prevSelectedUnit; this.selAmountUnit = prevSelectedUnit;
currSelectedUnit = prevSelectedUnit; currSelectedUnit = prevSelectedUnit;

@ -108,7 +108,7 @@ export class ECLOnChainTransactionHistoryComponent implements OnInit, OnDestroy
this.listTransactions.sort = this.sort; this.listTransactions.sort = this.sort;
this.listTransactions.sortingDataAccessor = (data: any, sortHeaderId: string) => ((data[sortHeaderId] && isNaN(data[sortHeaderId])) ? data[sortHeaderId].toLocaleLowerCase() : data[sortHeaderId] ? +data[sortHeaderId] : null); this.listTransactions.sortingDataAccessor = (data: any, sortHeaderId: string) => ((data[sortHeaderId] && isNaN(data[sortHeaderId])) ? data[sortHeaderId].toLocaleLowerCase() : data[sortHeaderId] ? +data[sortHeaderId] : null);
this.listTransactions.filterPredicate = (rowData: Transaction, fltr: string) => { this.listTransactions.filterPredicate = (rowData: Transaction, fltr: string) => {
const newRowData = ((rowData.timestamp) ? this.datePipe.transform(new Date(rowData.timestamp * 1000), 'dd/MMM/YYYY HH:mm').toLowerCase() : '') + JSON.stringify(rowData).toLowerCase(); const newRowData = ((rowData.timestamp) ? this.datePipe.transform(new Date(rowData.timestamp * 1000), 'dd/MMM/YYYY HH:mm')?.toLowerCase() : '') + JSON.stringify(rowData).toLowerCase();
return newRowData.includes(fltr); return newRowData.includes(fltr);
}; };
this.listTransactions.paginator = this.paginator; this.listTransactions.paginator = this.paginator;

@ -20,7 +20,7 @@ import { ApiCallStatusPayload } from '../../shared/models/apiCallsPayload';
}) })
export class ECLOnChainComponent implements OnInit, OnDestroy { export class ECLOnChainComponent implements OnInit, OnDestroy {
public selNode: SelNodeChild = {}; public selNode: SelNodeChild | null = {};
public faExchangeAlt = faExchangeAlt; public faExchangeAlt = faExchangeAlt;
public faChartPie = faChartPie; public faChartPie = faChartPie;
public balances = [{ title: 'Total Balance', dataValue: 0 }, { title: 'Confirmed', dataValue: 0 }, { title: 'Unconfirmed', dataValue: 0 }]; public balances = [{ title: 'Total Balance', dataValue: 0 }, { title: 'Confirmed', dataValue: 0 }, { title: 'Unconfirmed', dataValue: 0 }];
@ -46,7 +46,7 @@ export class ECLOnChainComponent implements OnInit, OnDestroy {
}); });
this.store.select(onchainBalance).pipe(takeUntil(this.unSubs[2])). this.store.select(onchainBalance).pipe(takeUntil(this.unSubs[2])).
subscribe((oCBalanceSelector: { onchainBalance: OnChainBalance, apiCallStatus: ApiCallStatusPayload }) => { subscribe((oCBalanceSelector: { onchainBalance: OnChainBalance, apiCallStatus: ApiCallStatusPayload }) => {
this.balances = [{ title: 'Total Balance', dataValue: oCBalanceSelector.onchainBalance.total || 0 }, { title: 'Confirmed', dataValue: oCBalanceSelector.onchainBalance.confirmed }, { title: 'Unconfirmed', dataValue: oCBalanceSelector.onchainBalance.unconfirmed }]; this.balances = [{ title: 'Total Balance', dataValue: oCBalanceSelector.onchainBalance.total || 0 }, { title: 'Confirmed', dataValue: (oCBalanceSelector.onchainBalance.confirmed || 0) }, { title: 'Unconfirmed', dataValue: (oCBalanceSelector.onchainBalance.unconfirmed || 0) }];
}); });
} }

@ -27,7 +27,7 @@ export class ECLChannelInformationComponent implements OnInit {
ngOnInit() { ngOnInit() {
this.channel = this.data.channel; this.channel = this.data.channel;
this.channelsType = this.data.channelsType; this.channelsType = this.data.channelsType || '';
this.screenSize = this.commonService.getScreenSize(); this.screenSize = this.commonService.getScreenSize();
} }

@ -89,7 +89,7 @@ export class ECLChannelPendingTableComponent implements OnInit, AfterViewInit, O
}); });
this.store.select(onchainBalance).pipe(takeUntil(this.unSubs[5])). this.store.select(onchainBalance).pipe(takeUntil(this.unSubs[5])).
subscribe((oCBalanceSelector: { onchainBalance: OnChainBalance, apiCallStatus: ApiCallStatusPayload }) => { subscribe((oCBalanceSelector: { onchainBalance: OnChainBalance, apiCallStatus: ApiCallStatusPayload }) => {
this.totalBalance = oCBalanceSelector.onchainBalance.total; this.totalBalance = oCBalanceSelector.onchainBalance.total || 0;
}); });
} }

@ -24,7 +24,7 @@ export class ECLChannelsTablesComponent implements OnInit, OnDestroy {
public numOfOpenChannels = 0; public numOfOpenChannels = 0;
public numOfPendingChannels = 0; public numOfPendingChannels = 0;
public numOfInactiveChannels = 0; public numOfInactiveChannels = 0;
public selNode: SelNodeChild = {}; public selNode: SelNodeChild | null = {};
public information: GetInfo = {}; public information: GetInfo = {};
public peers: Peer[] = []; public peers: Peer[] = [];
public totalBalance = 0; public totalBalance = 0;
@ -50,7 +50,7 @@ export class ECLChannelsTablesComponent implements OnInit, OnDestroy {
this.logger.info(allChannelsSelector); this.logger.info(allChannelsSelector);
}); });
this.store.select(eclnNodeSettings).pipe(takeUntil(this.unSubs[2])). this.store.select(eclnNodeSettings).pipe(takeUntil(this.unSubs[2])).
subscribe((nodeSettings: SelNodeChild) => { subscribe((nodeSettings: SelNodeChild | null) => {
this.selNode = nodeSettings; this.selNode = nodeSettings;
}); });
this.store.select(eclNodeInformation).pipe(takeUntil(this.unSubs[3])). this.store.select(eclNodeInformation).pipe(takeUntil(this.unSubs[3])).
@ -63,7 +63,7 @@ export class ECLChannelsTablesComponent implements OnInit, OnDestroy {
}); });
this.store.select(onchainBalance).pipe(takeUntil(this.unSubs[5])). this.store.select(onchainBalance).pipe(takeUntil(this.unSubs[5])).
subscribe((oCBalanceSelector: { onchainBalance: OnChainBalance, apiCallStatus: ApiCallStatusPayload }) => { subscribe((oCBalanceSelector: { onchainBalance: OnChainBalance, apiCallStatus: ApiCallStatusPayload }) => {
this.totalBalance = oCBalanceSelector.onchainBalance.total; this.totalBalance = oCBalanceSelector.onchainBalance.total || 0;
}); });
} }

@ -7,7 +7,7 @@ import { Store } from '@ngrx/store';
import { Actions } from '@ngrx/effects'; import { Actions } from '@ngrx/effects';
import { faExclamationTriangle } from '@fortawesome/free-solid-svg-icons'; import { faExclamationTriangle } from '@fortawesome/free-solid-svg-icons';
import { Peer, GetInfo } from '../../../../shared/models/eclModels'; import { Peer, GetInfo, SaveChannel } from '../../../../shared/models/eclModels';
import { APICallStatusEnum, ECLActions } from '../../../../shared/services/consts-enums-functions'; import { APICallStatusEnum, ECLActions } from '../../../../shared/services/consts-enums-functions';
import { ECLOpenChannelAlert } from '../../../../shared/models/alertData'; import { ECLOpenChannelAlert } from '../../../../shared/models/alertData';
@ -25,7 +25,7 @@ export class ECLOpenChannelComponent implements OnInit, OnDestroy {
public selectedPeer = new FormControl(); public selectedPeer = new FormControl();
public faExclamationTriangle = faExclamationTriangle; public faExclamationTriangle = faExclamationTriangle;
public alertTitle: string; public alertTitle: string;
public peer: Peer; public peer: Peer | null;
public peers: Peer[]; public peers: Peer[];
public sortedPeers: Peer[]; public sortedPeers: Peer[];
public filteredPeers: Observable<Peer[]>; public filteredPeers: Observable<Peer[]>;
@ -33,20 +33,27 @@ export class ECLOpenChannelComponent implements OnInit, OnDestroy {
public advancedTitle = 'Advanced Options'; public advancedTitle = 'Advanced Options';
public information: GetInfo; public information: GetInfo;
public totalBalance = 0; public totalBalance = 0;
public fundingAmount: number; public fundingAmount: number | null;
public selectedPubkey = ''; public selectedPubkey = '';
public isPrivate = false; public isPrivate = false;
public feeRate = null; public feeRate : number | null = null;
private unSubs: Array<Subject<void>> = [new Subject(), new Subject()]; private unSubs: Array<Subject<void>> = [new Subject(), new Subject()];
constructor(public dialogRef: MatDialogRef<ECLOpenChannelComponent>, @Inject(MAT_DIALOG_DATA) public data: ECLOpenChannelAlert, private store: Store<RTLState>, private actions: Actions) { } constructor(public dialogRef: MatDialogRef<ECLOpenChannelComponent>, @Inject(MAT_DIALOG_DATA) public data: ECLOpenChannelAlert, private store: Store<RTLState>, private actions: Actions) { }
ngOnInit() { ngOnInit() {
this.information = this.data.message.information; if (this.data.message) {
this.totalBalance = this.data.message.balance; this.information = this.data.message.information;
this.alertTitle = this.data.alertTitle; this.totalBalance = this.data.message.balance;
this.peer = this.data.message.peer || null; this.peer = this.data.message.peer || null;
this.peers = this.data.message.peers || []; this.peers = this.data.message.peers || [];
} else {
this.information = {};
this.totalBalance = 0;
this.peer = null;
this.peers = [];
}
this.alertTitle = this.data.alertTitle || 'Alert';
this.actions.pipe( this.actions.pipe(
takeUntil(this.unSubs[0]), takeUntil(this.unSubs[0]),
filter((action) => action.type === ECLActions.UPDATE_API_CALL_STATUS_ECL || action.type === ECLActions.FETCH_CHANNELS_ECL)). filter((action) => action.type === ECLActions.UPDATE_API_CALL_STATUS_ECL || action.type === ECLActions.FETCH_CHANNELS_ECL)).
@ -62,7 +69,7 @@ export class ECLOpenChannelComponent implements OnInit, OnDestroy {
let y = ''; let y = '';
this.sortedPeers = this.peers.sort((p1, p2) => { this.sortedPeers = this.peers.sort((p1, p2) => {
x = p1.alias ? p1.alias.toLowerCase() : p1.nodeId ? p1.nodeId.toLowerCase() : ''; x = p1.alias ? p1.alias.toLowerCase() : p1.nodeId ? p1.nodeId.toLowerCase() : '';
y = p2.alias ? p2.alias.toLowerCase() : p1.nodeId.toLowerCase(); y = p2.alias ? p2.alias.toLowerCase() : p1.nodeId ? p1.nodeId.toLowerCase() : '';
return ((x < y) ? -1 : ((x > y) ? 1 : 0)); return ((x < y) ? -1 : ((x > y) ? 1 : 0));
}); });
this.filteredPeers = this.selectedPeer.valueChanges.pipe( this.filteredPeers = this.selectedPeer.valueChanges.pipe(
@ -73,7 +80,7 @@ export class ECLOpenChannelComponent implements OnInit, OnDestroy {
} }
private filterPeers(newlySelectedPeer: string): Peer[] { private filterPeers(newlySelectedPeer: string): Peer[] {
return this.sortedPeers?.filter((peer) => peer.alias.toLowerCase().indexOf(newlySelectedPeer ? newlySelectedPeer.toLowerCase() : '') === 0); return this.sortedPeers?.filter((peer) => peer.alias?.toLowerCase().indexOf(newlySelectedPeer ? newlySelectedPeer.toLowerCase() : '') === 0);
} }
displayFn(peer: Peer): string { displayFn(peer: Peer): string {
@ -84,7 +91,7 @@ export class ECLOpenChannelComponent implements OnInit, OnDestroy {
this.channelConnectionError = ''; this.channelConnectionError = '';
this.selectedPubkey = (this.selectedPeer.value && this.selectedPeer.value.nodeId) ? this.selectedPeer.value.nodeId : null; this.selectedPubkey = (this.selectedPeer.value && this.selectedPeer.value.nodeId) ? this.selectedPeer.value.nodeId : null;
if (typeof this.selectedPeer.value === 'string') { if (typeof this.selectedPeer.value === 'string') {
const selPeer = this.peers?.filter((peer) => peer.alias.length === this.selectedPeer.value.length && peer.alias.toLowerCase().indexOf(this.selectedPeer.value ? this.selectedPeer.value.toLowerCase() : '') === 0); const selPeer = this.peers?.filter((peer) => peer.alias?.length === this.selectedPeer.value.length && peer.alias?.toLowerCase().indexOf(this.selectedPeer.value ? this.selectedPeer.value.toLowerCase() : '') === 0);
if (selPeer.length === 1 && selPeer[0].nodeId) { if (selPeer.length === 1 && selPeer[0].nodeId) {
this.selectedPubkey = selPeer[0].nodeId; this.selectedPubkey = selPeer[0].nodeId;
} }
@ -122,11 +129,9 @@ export class ECLOpenChannelComponent implements OnInit, OnDestroy {
if ((!this.peer && !this.selectedPubkey) || (!this.fundingAmount || ((this.totalBalance - this.fundingAmount) < 0))) { if ((!this.peer && !this.selectedPubkey) || (!this.fundingAmount || ((this.totalBalance - this.fundingAmount) < 0))) {
return true; return true;
} }
this.store.dispatch(saveNewChannel({ const saveChannelPayload: SaveChannel = { nodeId: ((!this.peer || !this.peer.nodeId) ? this.selectedPubkey : this.peer.nodeId), amount: this.fundingAmount, private: this.isPrivate };
payload: { if (this.feeRate) { saveChannelPayload['feeRate'] = this.feeRate; }
nodeId: ((!this.peer || !this.peer.nodeId) ? this.selectedPubkey : this.peer.nodeId), amount: this.fundingAmount, private: this.isPrivate, feeRate: this.feeRate this.store.dispatch(saveNewChannel({ payload: saveChannelPayload }));
}
}));
} }
ngOnDestroy() { ngOnDestroy() {

@ -30,7 +30,7 @@ export class ECLConnectPeerComponent implements OnInit, OnDestroy {
public totalBalance = 0; public totalBalance = 0;
public flgChannelOpened = false; public flgChannelOpened = false;
public channelOpenStatus = null; public channelOpenStatus = null;
public newlyAddedPeer: Peer = null; public newlyAddedPeer: Peer | null = null;
public flgEditable = true; public flgEditable = true;
public peerConnectionError = ''; public peerConnectionError = '';
public channelConnectionError = ''; public channelConnectionError = '';
@ -44,9 +44,14 @@ export class ECLConnectPeerComponent implements OnInit, OnDestroy {
constructor(public dialogRef: MatDialogRef<ECLConnectPeerComponent>, @Inject(MAT_DIALOG_DATA) public data: ECLOpenChannelAlert, private store: Store<RTLState>, private formBuilder: FormBuilder, private actions: Actions, private logger: LoggerService) { } constructor(public dialogRef: MatDialogRef<ECLConnectPeerComponent>, @Inject(MAT_DIALOG_DATA) public data: ECLOpenChannelAlert, private store: Store<RTLState>, private formBuilder: FormBuilder, private actions: Actions, private logger: LoggerService) { }
ngOnInit() { ngOnInit() {
this.totalBalance = this.data.message.balance; if (this.data.message) {
this.peerAddress = (this.data.message.peer && this.data.message.peer.nodeId && this.data.message.peer.address) ? (this.data.message.peer.nodeId + '@' + this.data.message.peer.address) : this.totalBalance = this.data.message.balance;
(this.data.message.peer && this.data.message.peer.nodeId && !this.data.message.peer.address) ? this.data.message.peer.nodeId : ''; this.peerAddress = (this.data.message.peer && this.data.message.peer.nodeId && this.data.message.peer.address) ? (this.data.message.peer.nodeId + '@' + this.data.message.peer.address) :
(this.data.message.peer && this.data.message.peer.nodeId && !this.data.message.peer.address) ? this.data.message.peer.nodeId : '';
} else {
this.totalBalance = 0;
this.peerAddress = '';
}
this.peerFormGroup = this.formBuilder.group({ this.peerFormGroup = this.formBuilder.group({
hiddenAddress: ['', [Validators.required]], hiddenAddress: ['', [Validators.required]],
peerAddress: [this.peerAddress, [Validators.required]] peerAddress: [this.peerAddress, [Validators.required]]
@ -97,7 +102,7 @@ export class ECLConnectPeerComponent implements OnInit, OnDestroy {
this.channelConnectionError = ''; this.channelConnectionError = '';
this.store.dispatch(saveNewChannel({ this.store.dispatch(saveNewChannel({
payload: { payload: {
nodeId: this.newlyAddedPeer.nodeId, amount: this.channelFormGroup.controls.fundingAmount.value, private: this.channelFormGroup.controls.isPrivate.value, feeRate: this.channelFormGroup.controls.feeRate.value nodeId: this.newlyAddedPeer?.nodeId!, amount: this.channelFormGroup.controls.fundingAmount.value, private: this.channelFormGroup.controls.isPrivate.value, feeRate: this.channelFormGroup.controls.feeRate.value
} }
})); }));
} }
@ -115,7 +120,7 @@ export class ECLConnectPeerComponent implements OnInit, OnDestroy {
case 1: case 1:
if (this.peerFormGroup.controls.peerAddress.value) { if (this.peerFormGroup.controls.peerAddress.value) {
this.peerFormLabel = 'Peer Added: ' + (this.newlyAddedPeer.alias ? this.newlyAddedPeer.alias : this.newlyAddedPeer.nodeId); this.peerFormLabel = 'Peer Added: ' + (this.newlyAddedPeer?.alias ? this.newlyAddedPeer.alias : this.newlyAddedPeer?.nodeId);
} else { } else {
this.peerFormLabel = 'Peer Details'; this.peerFormLabel = 'Peer Details';
} }
@ -124,7 +129,7 @@ export class ECLConnectPeerComponent implements OnInit, OnDestroy {
case 2: case 2:
if (this.peerFormGroup.controls.peerAddress.value) { if (this.peerFormGroup.controls.peerAddress.value) {
this.peerFormLabel = 'Peer Added: ' + (this.newlyAddedPeer.alias ? this.newlyAddedPeer.alias : this.newlyAddedPeer.nodeId); this.peerFormLabel = 'Peer Added: ' + (this.newlyAddedPeer?.alias ? this.newlyAddedPeer.alias : this.newlyAddedPeer?.nodeId);
} else { } else {
this.peerFormLabel = 'Peer Details'; this.peerFormLabel = 'Peer Details';
} }

@ -46,7 +46,7 @@ export class ECLConnectionsComponent implements OnInit, OnDestroy {
}); });
this.store.select(onchainBalance).pipe(takeUntil(this.unSubs[3])). this.store.select(onchainBalance).pipe(takeUntil(this.unSubs[3])).
subscribe((oCBalanceSelector: { onchainBalance: OnChainBalance, apiCallStatus: ApiCallStatusPayload }) => { subscribe((oCBalanceSelector: { onchainBalance: OnChainBalance, apiCallStatus: ApiCallStatusPayload }) => {
this.balances = [{ title: 'Total Balance', dataValue: oCBalanceSelector.onchainBalance.total || 0 }, { title: 'Confirmed', dataValue: oCBalanceSelector.onchainBalance.confirmed }, { title: 'Unconfirmed', dataValue: oCBalanceSelector.onchainBalance.unconfirmed }]; this.balances = [{ title: 'Total Balance', dataValue: oCBalanceSelector.onchainBalance.total || 0 }, { title: 'Confirmed', dataValue: (oCBalanceSelector.onchainBalance.confirmed || 0) }, { title: 'Unconfirmed', dataValue: (oCBalanceSelector.onchainBalance.unconfirmed || 0) }];
}); });
} }

@ -38,7 +38,7 @@ export class ECLPeersComponent implements OnInit, AfterViewInit, OnDestroy {
public faUsers = faUsers; public faUsers = faUsers;
public newlyAddedPeer = ''; public newlyAddedPeer = '';
public displayedColumns: any[] = []; public displayedColumns: any[] = [];
public peerAddress = ''; public peerAddress: string | null = '';
public peersData: Peer[] = []; public peersData: Peer[] = [];
public peers: any; public peers: any;
public information: GetInfo = {}; public information: GetInfo = {};
@ -108,7 +108,7 @@ export class ECLPeersComponent implements OnInit, AfterViewInit, OnDestroy {
[{ key: 'nodeId', value: selPeer.nodeId, title: 'Public Key', width: 100 }], [{ key: 'nodeId', value: selPeer.nodeId, title: 'Public Key', width: 100 }],
[{ key: 'address', value: selPeer.address, title: 'Address', width: 50 }, [{ key: 'address', value: selPeer.address, title: 'Address', width: 50 },
{ key: 'alias', value: selPeer.alias, title: 'Alias', width: 50 }], { key: 'alias', value: selPeer.alias, title: 'Alias', width: 50 }],
[{ key: 'state', value: this.commonService.titleCase(selPeer.state), title: 'State', width: 50 }, [{ key: 'state', value: this.commonService.titleCase(selPeer.state || ''), title: 'State', width: 50 },
{ key: 'channels', value: selPeer.channels, title: 'Channels', width: 50 }] { key: 'channels', value: selPeer.channels, title: 'Channels', width: 50 }]
]; ];
this.store.dispatch(openAlert({ this.store.dispatch(openAlert({
@ -158,7 +158,7 @@ export class ECLPeersComponent implements OnInit, AfterViewInit, OnDestroy {
} }
onPeerDetach(peerToDetach: Peer) { onPeerDetach(peerToDetach: Peer) {
if (peerToDetach.channels > 0) { if (peerToDetach && peerToDetach.channels && peerToDetach.channels > 0) {
this.store.dispatch(openAlert({ this.store.dispatch(openAlert({
payload: { payload: {
data: { data: {
@ -185,7 +185,7 @@ export class ECLPeersComponent implements OnInit, AfterViewInit, OnDestroy {
pipe(takeUntil(this.unSubs[4])). pipe(takeUntil(this.unSubs[4])).
subscribe((confirmRes) => { subscribe((confirmRes) => {
if (confirmRes) { if (confirmRes) {
this.store.dispatch(disconnectPeer({ payload: { nodeId: peerToDetach.nodeId } })); this.store.dispatch(disconnectPeer({ payload: { nodeId: (peerToDetach.nodeId || '') } }));
} }
}); });
} }

@ -28,7 +28,7 @@ export class ECLRoutingReportComponent implements OnInit, OnDestroy {
public eventFilterValue = ''; public eventFilterValue = '';
public reportBy = ReportBy; public reportBy = ReportBy;
public selReportBy = ReportBy.FEES; public selReportBy = ReportBy.FEES;
public totalFeeSat = null; public totalFeeSat: number | null = null;
public today = new Date(Date.now()); public today = new Date(Date.now());
public startDate = new Date(this.today.getFullYear(), this.today.getMonth(), 1, 0, 0, 0); public startDate = new Date(this.today.getFullYear(), this.today.getMonth(), 1, 0, 0, 0);
public endDate = new Date(this.today.getFullYear(), this.today.getMonth(), this.getMonthDays(this.today.getMonth(), this.today.getFullYear()), 23, 59, 59); public endDate = new Date(this.today.getFullYear(), this.today.getMonth(), this.getMonthDays(this.today.getMonth(), this.today.getFullYear()), 23, 59, 59);
@ -83,7 +83,7 @@ export class ECLRoutingReportComponent implements OnInit, OnDestroy {
this.totalFeeSat = null; this.totalFeeSat = null;
if (this.events && this.events.length > 0) { if (this.events && this.events.length > 0) {
this.events.forEach((event) => { this.events.forEach((event) => {
if (Math.floor(event.timestamp / 1000) >= startDateInSeconds && Math.floor(event.timestamp / 1000) < endDateInSeconds) { if (Math.floor((event.timestamp || 0) / 1000) >= startDateInSeconds && Math.floor((event.timestamp || 0) / 1000) < endDateInSeconds) {
this.filteredEventsBySelectedPeriod.push(event); this.filteredEventsBySelectedPeriod.push(event);
} }
}); });
@ -108,7 +108,7 @@ export class ECLRoutingReportComponent implements OnInit, OnDestroy {
prepareFeeReport(start: Date) { prepareFeeReport(start: Date) {
const startDateInSeconds = Math.round(start.getTime() / 1000); const startDateInSeconds = Math.round(start.getTime() / 1000);
const feeReport = []; const feeReport: any = [];
this.totalFeeSat = 0; this.totalFeeSat = 0;
this.logger.info('Fee Report Prepare Starting at ' + new Date(Date.now()).toLocaleString() + ' From ' + start.toLocaleString()); this.logger.info('Fee Report Prepare Starting at ' + new Date(Date.now()).toLocaleString() + ' From ' + start.toLocaleString());
if (this.reportPeriod === SCROLL_RANGES[1]) { if (this.reportPeriod === SCROLL_RANGES[1]) {
@ -116,10 +116,10 @@ export class ECLRoutingReportComponent implements OnInit, OnDestroy {
feeReport.push({ name: MONTHS[i].name, value: 0.0, extra: { totalEvents: 0 } }); feeReport.push({ name: MONTHS[i].name, value: 0.0, extra: { totalEvents: 0 } });
} }
this.filteredEventsBySelectedPeriod?.map((event) => { this.filteredEventsBySelectedPeriod?.map((event) => {
const monthNumber = new Date(event.timestamp).getMonth(); const monthNumber = new Date((event.timestamp || 0)).getMonth();
feeReport[monthNumber].value = feeReport[monthNumber].value + (event.amountIn - event.amountOut); feeReport[monthNumber].value = feeReport[monthNumber].value + ((event.amountIn || 0) - (event.amountOut || 0));
feeReport[monthNumber].extra.totalEvents = feeReport[monthNumber].extra.totalEvents + 1; feeReport[monthNumber].extra.totalEvents = feeReport[monthNumber].extra.totalEvents + 1;
this.totalFeeSat = (this.totalFeeSat ? this.totalFeeSat : 0) + (event.amountIn - event.amountOut); this.totalFeeSat = (this.totalFeeSat ? this.totalFeeSat : 0) + ((event.amountIn || 0) - (event.amountOut || 0));
return this.filteredEventsBySelectedPeriod; return this.filteredEventsBySelectedPeriod;
}); });
} else { } else {
@ -127,10 +127,10 @@ export class ECLRoutingReportComponent implements OnInit, OnDestroy {
feeReport.push({ name: i + 1, value: 0.0, extra: { totalEvents: 0 } }); feeReport.push({ name: i + 1, value: 0.0, extra: { totalEvents: 0 } });
} }
this.filteredEventsBySelectedPeriod?.map((event) => { this.filteredEventsBySelectedPeriod?.map((event) => {
const dateNumber = Math.floor((Math.floor(event.timestamp / 1000) - startDateInSeconds) / this.secondsInADay); const dateNumber = Math.floor((Math.floor((event.timestamp || 0) / 1000) - startDateInSeconds) / this.secondsInADay);
feeReport[dateNumber].value = feeReport[dateNumber].value + (event.amountIn - event.amountOut); feeReport[dateNumber].value = feeReport[dateNumber].value + ((event.amountIn || 0) - (event.amountOut || 0));
feeReport[dateNumber].extra.totalEvents = feeReport[dateNumber].extra.totalEvents + 1; feeReport[dateNumber].extra.totalEvents = feeReport[dateNumber].extra.totalEvents + 1;
this.totalFeeSat = (this.totalFeeSat ? this.totalFeeSat : 0) + (event.amountIn - event.amountOut); this.totalFeeSat = (this.totalFeeSat ? this.totalFeeSat : 0) + ((event.amountIn || 0) - (event.amountOut || 0));
return this.filteredEventsBySelectedPeriod; return this.filteredEventsBySelectedPeriod;
}); });
} }
@ -140,7 +140,7 @@ export class ECLRoutingReportComponent implements OnInit, OnDestroy {
prepareEventsReport(start: Date) { prepareEventsReport(start: Date) {
const startDateInSeconds = Math.round(start.getTime() / 1000); const startDateInSeconds = Math.round(start.getTime() / 1000);
const eventsReport = []; const eventsReport: any = [];
this.totalFeeSat = 0; this.totalFeeSat = 0;
this.logger.info('Events Report Prepare Starting at ' + new Date(Date.now()).toLocaleString() + ' From ' + start.toLocaleString()); this.logger.info('Events Report Prepare Starting at ' + new Date(Date.now()).toLocaleString() + ' From ' + start.toLocaleString());
if (this.reportPeriod === SCROLL_RANGES[1]) { if (this.reportPeriod === SCROLL_RANGES[1]) {
@ -148,10 +148,10 @@ export class ECLRoutingReportComponent implements OnInit, OnDestroy {
eventsReport.push({ name: MONTHS[i].name, value: 0, extra: { totalFees: 0.0 } }); eventsReport.push({ name: MONTHS[i].name, value: 0, extra: { totalFees: 0.0 } });
} }
this.filteredEventsBySelectedPeriod?.map((event) => { this.filteredEventsBySelectedPeriod?.map((event) => {
const monthNumber = new Date(event.timestamp).getMonth(); const monthNumber = new Date((event.timestamp || 0)).getMonth();
eventsReport[monthNumber].value = eventsReport[monthNumber].value + 1; eventsReport[monthNumber].value = eventsReport[monthNumber].value + 1;
eventsReport[monthNumber].extra.totalFees = eventsReport[monthNumber].extra.totalFees + (event.amountIn - event.amountOut); eventsReport[monthNumber].extra.totalFees = eventsReport[monthNumber].extra.totalFees + ((event.amountIn || 0) - (event.amountOut || 0));
this.totalFeeSat = (this.totalFeeSat ? this.totalFeeSat : 0) + (event.amountIn - event.amountOut); this.totalFeeSat = (this.totalFeeSat ? this.totalFeeSat : 0) + ((event.amountIn || 0) - (event.amountOut || 0));
return this.filteredEventsBySelectedPeriod; return this.filteredEventsBySelectedPeriod;
}); });
} else { } else {
@ -159,10 +159,10 @@ export class ECLRoutingReportComponent implements OnInit, OnDestroy {
eventsReport.push({ name: i + 1, value: 0, extra: { totalFees: 0.0 } }); eventsReport.push({ name: i + 1, value: 0, extra: { totalFees: 0.0 } });
} }
this.filteredEventsBySelectedPeriod?.map((event) => { this.filteredEventsBySelectedPeriod?.map((event) => {
const dateNumber = Math.floor((Math.floor(event.timestamp / 1000) - startDateInSeconds) / this.secondsInADay); const dateNumber = Math.floor((Math.floor((event.timestamp || 0) / 1000) - startDateInSeconds) / this.secondsInADay);
eventsReport[dateNumber].value = eventsReport[dateNumber].value + 1; eventsReport[dateNumber].value = eventsReport[dateNumber].value + 1;
eventsReport[dateNumber].extra.totalFees = eventsReport[dateNumber].extra.totalFees + (event.amountIn - event.amountOut); eventsReport[dateNumber].extra.totalFees = eventsReport[dateNumber].extra.totalFees + ((event.amountIn || 0) - (event.amountOut || 0));
this.totalFeeSat = (this.totalFeeSat ? this.totalFeeSat : 0) + (event.amountIn - event.amountOut); this.totalFeeSat = (this.totalFeeSat ? this.totalFeeSat : 0) + ((event.amountIn || 0) - (event.amountOut || 0));
return this.filteredEventsBySelectedPeriod; return this.filteredEventsBySelectedPeriod;
}); });
} }

@ -95,10 +95,10 @@ export class ECLTransactionsReportComponent implements OnInit, OnDestroy {
filterTransactionsForSelectedPeriod(start: Date, end: Date) { filterTransactionsForSelectedPeriod(start: Date, end: Date) {
const startDateInSeconds = Math.round(start.getTime() / 1000); const startDateInSeconds = Math.round(start.getTime() / 1000);
const endDateInSeconds = Math.round(end.getTime() / 1000); const endDateInSeconds = Math.round(end.getTime() / 1000);
const transactionsReport = []; const transactionsReport: any = [];
this.transactionsReportSummary = { paymentsSelectedPeriod: 0, invoicesSelectedPeriod: 0, amountPaidSelectedPeriod: 0, amountReceivedSelectedPeriod: 0 }; this.transactionsReportSummary = { paymentsSelectedPeriod: 0, invoicesSelectedPeriod: 0, amountPaidSelectedPeriod: 0, amountReceivedSelectedPeriod: 0 };
const filteredPayments = this.payments?.filter((payment) => Math.floor(payment.firstPartTimestamp / 1000) >= startDateInSeconds && Math.floor(payment.firstPartTimestamp / 1000) < endDateInSeconds); const filteredPayments = this.payments?.filter((payment) => payment.firstPartTimestamp && Math.floor(payment.firstPartTimestamp / 1000) >= startDateInSeconds && Math.floor(payment.firstPartTimestamp / 1000) < endDateInSeconds);
const filteredInvoices = this.invoices?.filter((invoice) => invoice.status === 'received' && invoice.timestamp >= startDateInSeconds && invoice.timestamp < endDateInSeconds); const filteredInvoices = this.invoices?.filter((invoice) => invoice.status === 'received' && invoice.timestamp && invoice.timestamp >= startDateInSeconds && invoice.timestamp < endDateInSeconds);
this.transactionsReportSummary.paymentsSelectedPeriod = filteredPayments.length; this.transactionsReportSummary.paymentsSelectedPeriod = filteredPayments.length;
this.transactionsReportSummary.invoicesSelectedPeriod = filteredInvoices.length; this.transactionsReportSummary.invoicesSelectedPeriod = filteredInvoices.length;
if (this.reportPeriod === SCROLL_RANGES[1]) { if (this.reportPeriod === SCROLL_RANGES[1]) {
@ -106,15 +106,15 @@ export class ECLTransactionsReportComponent implements OnInit, OnDestroy {
transactionsReport.push({ name: MONTHS[i].name, date: new Date(start.getFullYear(), i, 1, 0, 0, 0, 0), series: [{ name: 'Paid', value: 0, extra: { total: 0 } }, { name: 'Received', value: 0, extra: { total: 0 } }] }); transactionsReport.push({ name: MONTHS[i].name, date: new Date(start.getFullYear(), i, 1, 0, 0, 0, 0), series: [{ name: 'Paid', value: 0, extra: { total: 0 } }, { name: 'Received', value: 0, extra: { total: 0 } }] });
} }
filteredPayments?.map((payment) => { filteredPayments?.map((payment) => {
const monthNumber = new Date(payment.firstPartTimestamp).getMonth(); const monthNumber = new Date(payment.firstPartTimestamp || 0).getMonth();
this.transactionsReportSummary.amountPaidSelectedPeriod = this.transactionsReportSummary.amountPaidSelectedPeriod + payment.recipientAmount; this.transactionsReportSummary.amountPaidSelectedPeriod = this.transactionsReportSummary.amountPaidSelectedPeriod + (payment.recipientAmount || 0);
transactionsReport[monthNumber].series[0].value = transactionsReport[monthNumber].series[0].value + payment.recipientAmount; transactionsReport[monthNumber].series[0].value = transactionsReport[monthNumber].series[0].value + payment.recipientAmount;
transactionsReport[monthNumber].series[0].extra.total = transactionsReport[monthNumber].series[0].extra.total + 1; transactionsReport[monthNumber].series[0].extra.total = transactionsReport[monthNumber].series[0].extra.total + 1;
return this.transactionsReportSummary; return this.transactionsReportSummary;
}); });
filteredInvoices?.map((invoice) => { filteredInvoices?.map((invoice) => {
const monthNumber = new Date((invoice.timestamp) * 1000).getMonth(); const monthNumber = new Date((invoice.timestamp || 0) * 1000).getMonth();
this.transactionsReportSummary.amountReceivedSelectedPeriod = this.transactionsReportSummary.amountReceivedSelectedPeriod + invoice.amountSettled; this.transactionsReportSummary.amountReceivedSelectedPeriod = this.transactionsReportSummary.amountReceivedSelectedPeriod + (invoice.amountSettled || 0);
transactionsReport[monthNumber].series[1].value = transactionsReport[monthNumber].series[1].value + invoice.amountSettled; transactionsReport[monthNumber].series[1].value = transactionsReport[monthNumber].series[1].value + invoice.amountSettled;
transactionsReport[monthNumber].series[1].extra.total = transactionsReport[monthNumber].series[1].extra.total + 1; transactionsReport[monthNumber].series[1].extra.total = transactionsReport[monthNumber].series[1].extra.total + 1;
return this.transactionsReportSummary; return this.transactionsReportSummary;
@ -124,15 +124,15 @@ export class ECLTransactionsReportComponent implements OnInit, OnDestroy {
transactionsReport.push({ name: (i + 1).toString(), date: new Date((((i) * this.secondsInADay) + startDateInSeconds) * 1000), series: [{ name: 'Paid', value: 0, extra: { total: 0 } }, { name: 'Received', value: 0, extra: { total: 0 } }] }); transactionsReport.push({ name: (i + 1).toString(), date: new Date((((i) * this.secondsInADay) + startDateInSeconds) * 1000), series: [{ name: 'Paid', value: 0, extra: { total: 0 } }, { name: 'Received', value: 0, extra: { total: 0 } }] });
} }
filteredPayments?.map((payment) => { filteredPayments?.map((payment) => {
const dateNumber = Math.floor((Math.floor(payment.firstPartTimestamp / 1000) - startDateInSeconds) / this.secondsInADay); const dateNumber = Math.floor((Math.floor((payment.firstPartTimestamp || 0) / 1000) - startDateInSeconds) / this.secondsInADay);
this.transactionsReportSummary.amountPaidSelectedPeriod = this.transactionsReportSummary.amountPaidSelectedPeriod + payment.recipientAmount; this.transactionsReportSummary.amountPaidSelectedPeriod = this.transactionsReportSummary.amountPaidSelectedPeriod + (payment.recipientAmount || 0);
transactionsReport[dateNumber].series[0].value = transactionsReport[dateNumber].series[0].value + payment.recipientAmount; transactionsReport[dateNumber].series[0].value = transactionsReport[dateNumber].series[0].value + payment.recipientAmount;
transactionsReport[dateNumber].series[0].extra.total = transactionsReport[dateNumber].series[0].extra.total + 1; transactionsReport[dateNumber].series[0].extra.total = transactionsReport[dateNumber].series[0].extra.total + 1;
return this.transactionsReportSummary; return this.transactionsReportSummary;
}); });
filteredInvoices?.map((invoice) => { filteredInvoices?.map((invoice) => {
const dateNumber = Math.floor((invoice.timestamp - startDateInSeconds) / this.secondsInADay); const dateNumber = Math.floor(((invoice.timestamp || 0) - startDateInSeconds) / this.secondsInADay);
this.transactionsReportSummary.amountReceivedSelectedPeriod = this.transactionsReportSummary.amountReceivedSelectedPeriod + invoice.amountSettled; this.transactionsReportSummary.amountReceivedSelectedPeriod = this.transactionsReportSummary.amountReceivedSelectedPeriod + (invoice.amountSettled || 0);
transactionsReport[dateNumber].series[1].value = transactionsReport[dateNumber].series[1].value + invoice.amountSettled; transactionsReport[dateNumber].series[1].value = transactionsReport[dateNumber].series[1].value + invoice.amountSettled;
transactionsReport[dateNumber].series[1].extra.total = transactionsReport[dateNumber].series[1].extra.total + 1; transactionsReport[dateNumber].series[1].extra.total = transactionsReport[dateNumber].series[1].extra.total + 1;
return this.transactionsReportSummary; return this.transactionsReportSummary;

@ -29,7 +29,7 @@ export class ECLRoutingPeersComponent implements OnInit, AfterViewInit, OnDestro
@ViewChild('tableOut', { read: MatSort, static: false }) sortOut: MatSort; @ViewChild('tableOut', { read: MatSort, static: false }) sortOut: MatSort;
@ViewChild('paginatorIn', { static: false }) paginatorIn: MatPaginator | undefined; @ViewChild('paginatorIn', { static: false }) paginatorIn: MatPaginator | undefined;
@ViewChild('paginatorOut', { static: false }) paginatorOut: MatPaginator | undefined; @ViewChild('paginatorOut', { static: false }) paginatorOut: MatPaginator | undefined;
public routingPeersData = []; public routingPeersData: PaymentRelayed[] = [];
public displayedColumns: any[] = []; public displayedColumns: any[] = [];
public RoutingPeersIncoming: any; public RoutingPeersIncoming: any;
public RoutingPeersOutgoing: any; public RoutingPeersOutgoing: any;
@ -110,9 +110,9 @@ export class ECLRoutingPeersComponent implements OnInit, AfterViewInit, OnDestro
groupRoutingPeers(forwardingEvents: PaymentRelayed[]) { groupRoutingPeers(forwardingEvents: PaymentRelayed[]) {
const incomingResults: RoutingPeers[] = []; const incomingResults: RoutingPeers[] = [];
const outgoingResults: RoutingPeers[] = []; const outgoingResults: RoutingPeers[] = [];
forwardingEvents.forEach((event) => { forwardingEvents.forEach((event: PaymentRelayed) => {
const incoming = incomingResults.find((result) => result.channelId === event.fromChannelId); const incoming: any = incomingResults.find((result) => result.channelId === event.fromChannelId);
const outgoing = outgoingResults.find((result) => result.channelId === event.toChannelId); const outgoing: any = outgoingResults.find((result) => result.channelId === event.toChannelId);
if (!incoming) { if (!incoming) {
incomingResults.push({ channelId: event.fromChannelId, alias: event.fromChannelAlias, events: 1, totalAmount: +event.amountIn, totalFee: (event.amountIn - event.amountOut) }); incomingResults.push({ channelId: event.fromChannelId, alias: event.fromChannelAlias, events: 1, totalAmount: +event.amountIn, totalFee: (event.amountIn - event.amountOut) });
} else { } else {

@ -648,30 +648,30 @@ export class ECLEffects implements OnDestroy {
let totalLocalBalance = 0; let totalLocalBalance = 0;
let totalRemoteBalance = 0; let totalRemoteBalance = 0;
let lightningBalances = { localBalance: 0, remoteBalance: 0 }; let lightningBalances = { localBalance: 0, remoteBalance: 0 };
let activeChannels = []; let activeChannels: Channel[] = [];
const pendingChannels = []; const pendingChannels: Channel[] = [];
const inactiveChannels = []; const inactiveChannels: Channel[] = [];
const channelStatus = { active: { channels: 0, capacity: 0 }, inactive: { channels: 0, capacity: 0 }, pending: { channels: 0, capacity: 0 } }; const channelStatus = { active: { channels: 0, capacity: 0 }, inactive: { channels: 0, capacity: 0 }, pending: { channels: 0, capacity: 0 } };
this.rawChannelsList.forEach((channel, i) => { this.rawChannelsList.forEach((channel: Channel, i) => {
if (channel) { if (channel) {
if (channel.state === 'NORMAL') { if (channel.state === 'NORMAL') {
channelTotal = channel.toLocal + channel.toRemote; channelTotal = (channel.toLocal || 0) + (channel.toRemote || 0);
totalLocalBalance = totalLocalBalance + channel.toLocal; totalLocalBalance = totalLocalBalance + (channel.toLocal || 0);
totalRemoteBalance = totalRemoteBalance + channel.toRemote; totalRemoteBalance = totalRemoteBalance + (channel.toRemote || 0);
channel.balancedness = (channelTotal === 0) ? 1 : +(1 - Math.abs((channel.toLocal - channel.toRemote) / channelTotal)).toFixed(3); channel.balancedness = (channelTotal === 0) ? 1 : +(1 - Math.abs(((channel.toLocal || 0) - (channel.toRemote || 0)) / channelTotal)).toFixed(3);
activeChannels.push(channel); activeChannels.push(channel);
channelStatus.active.channels = channelStatus.active.channels + 1; channelStatus.active.channels = channelStatus.active.channels + 1;
channelStatus.active.capacity = channelStatus.active.capacity + channel.toLocal; channelStatus.active.capacity = channelStatus.active.capacity + (channel.toLocal || 0);
} else if (channel.state.includes('WAIT') || channel.state.includes('CLOSING') || channel.state.includes('SYNCING')) { } else if (channel.state?.includes('WAIT') || channel.state?.includes('CLOSING') || channel.state?.includes('SYNCING')) {
channel.state = channel.state?.replace(/_/g, ' '); channel.state = channel.state?.replace(/_/g, ' ');
pendingChannels.push(channel); pendingChannels.push(channel);
channelStatus.pending.channels = channelStatus.pending.channels + 1; channelStatus.pending.channels = channelStatus.pending.channels + 1;
channelStatus.pending.capacity = channelStatus.pending.capacity + channel.toLocal; channelStatus.pending.capacity = channelStatus.pending.capacity + (channel.toLocal || 0);
} else { } else {
channel.state = channel.state?.replace(/_/g, ' '); channel.state = channel.state?.replace(/_/g, ' ');
inactiveChannels.push(channel); inactiveChannels.push(channel);
channelStatus.inactive.channels = channelStatus.inactive.channels + 1; channelStatus.inactive.channels = channelStatus.inactive.channels + 1;
channelStatus.inactive.capacity = channelStatus.inactive.capacity + channel.toLocal; channelStatus.inactive.capacity = channelStatus.inactive.capacity + (channel.toLocal || 0);
} }
} }
}); });

@ -7,13 +7,15 @@ import { Channel, PaymentReceived, PaymentRelayed } from '../../shared/models/ec
export const ECLReducer = createReducer(initECLState, export const ECLReducer = createReducer(initECLState,
on(updateECLAPICallStatus, (state, { payload }) => { on(updateECLAPICallStatus, (state, { payload }) => {
const updatedApisCallStatus = JSON.parse(JSON.stringify(state.apisCallStatus)); const updatedApisCallStatus = JSON.parse(JSON.stringify(state.apisCallStatus));
updatedApisCallStatus[payload.action || 0] = { if (payload.action) {
status: payload.status, updatedApisCallStatus[payload.action] = {
statusCode: payload.statusCode, status: payload.status,
message: payload.message, statusCode: payload.statusCode,
URL: payload.URL, message: payload.message,
filePath: payload.filePath URL: payload.URL,
}; filePath: payload.filePath
};
}
return { return {
...state, ...state,
apisCallStatus: updatedApisCallStatus apisCallStatus: updatedApisCallStatus
@ -288,12 +290,12 @@ const mapAliases = (rlEvent: PaymentRelayed, storedChannels: Channel[]) => {
outgoingEvent.shortChannelId = ''; outgoingEvent.shortChannelId = '';
}); });
} }
rlEvent.amountIn = rlEvent.incoming?.reduce((acc, curr) => acc + curr.amount, 0); rlEvent.amountIn = rlEvent.incoming?.reduce((acc, curr) => acc + curr.amount, 0) || 0;
rlEvent.fromChannelId = rlEvent.incoming && rlEvent.incoming.length ? rlEvent.incoming[0].channelId : ''; rlEvent.fromChannelId = rlEvent.incoming && rlEvent.incoming.length ? rlEvent.incoming[0].channelId : '';
rlEvent.fromChannelAlias = rlEvent.incoming && rlEvent.incoming.length ? rlEvent.incoming[0].channelAlias : ''; rlEvent.fromChannelAlias = rlEvent.incoming && rlEvent.incoming.length ? rlEvent.incoming[0].channelAlias : '';
rlEvent.fromShortChannelId = rlEvent.incoming && rlEvent.incoming.length ? rlEvent.incoming[0].shortChannelId : ''; rlEvent.fromShortChannelId = rlEvent.incoming && rlEvent.incoming.length ? rlEvent.incoming[0].shortChannelId : '';
rlEvent.amountOut = rlEvent.outgoing?.reduce((acc, curr) => acc + curr.amount, 0); rlEvent.amountOut = rlEvent.outgoing?.reduce((acc, curr) => acc + curr.amount, 0) || 0;
rlEvent.toChannelId = rlEvent.outgoing && rlEvent.outgoing.length ? rlEvent.outgoing[0].channelId : ''; rlEvent.toChannelId = rlEvent.outgoing && rlEvent.outgoing.length ? rlEvent.outgoing[0].channelId : '';
rlEvent.toChannelAlias = rlEvent.outgoing && rlEvent.outgoing.length ? rlEvent.outgoing[0].channelAlias : ''; rlEvent.toChannelAlias = rlEvent.outgoing && rlEvent.outgoing.length ? rlEvent.outgoing[0].channelAlias : '';
rlEvent.toShortChannelId = rlEvent.outgoing && rlEvent.outgoing.length ? rlEvent.outgoing[0].shortChannelId : ''; rlEvent.toShortChannelId = rlEvent.outgoing && rlEvent.outgoing.length ? rlEvent.outgoing[0].shortChannelId : '';

@ -25,10 +25,10 @@ import { eclNodeInformation, eclnNodeSettings } from '../../store/ecl.selector';
export class ECLCreateInvoiceComponent implements OnInit, OnDestroy { export class ECLCreateInvoiceComponent implements OnInit, OnDestroy {
public faExclamationTriangle = faExclamationTriangle; public faExclamationTriangle = faExclamationTriangle;
public selNode: SelNodeChild = {}; public selNode: SelNodeChild | null = {};
public description = ''; public description = '';
public expiry: number; public expiry: number | null;
public invoiceValue: number = null; public invoiceValue: number | null = null;
public invoiceValueHint = ''; public invoiceValueHint = '';
public invoicePaymentReq = ''; public invoicePaymentReq = '';
public invoices: any; public invoices: any;
@ -47,7 +47,7 @@ export class ECLCreateInvoiceComponent implements OnInit, OnDestroy {
ngOnInit() { ngOnInit() {
this.pageSize = this.data.pageSize; this.pageSize = this.data.pageSize;
this.store.select(eclnNodeSettings).pipe(takeUntil(this.unSubs[0])). this.store.select(eclnNodeSettings).pipe(takeUntil(this.unSubs[0])).
subscribe((nodeSettings: SelNodeChild) => { subscribe((nodeSettings: SelNodeChild | null) => {
this.selNode = nodeSettings; this.selNode = nodeSettings;
}); });
this.store.select(eclNodeInformation).pipe(takeUntil(this.unSubs[1])). this.store.select(eclNodeInformation).pipe(takeUntil(this.unSubs[1])).
@ -75,10 +75,10 @@ export class ECLCreateInvoiceComponent implements OnInit, OnDestroy {
return true; return true;
} }
let expiryInSecs = (this.expiry ? this.expiry : 3600); let expiryInSecs = (this.expiry ? this.expiry : 3600);
if (this.selTimeUnit !== TimeUnitEnum.SECS) { if (this.expiry && this.selTimeUnit !== TimeUnitEnum.SECS) {
expiryInSecs = this.commonService.convertTime(this.expiry, this.selTimeUnit, TimeUnitEnum.SECS); expiryInSecs = this.commonService.convertTime(this.expiry, this.selTimeUnit, TimeUnitEnum.SECS);
} }
let invoicePayload = null; let invoicePayload: any = null;
if (this.invoiceValue) { if (this.invoiceValue) {
invoicePayload = { description: this.description, expireIn: expiryInSecs, amountMsat: this.invoiceValue * 1000 }; invoicePayload = { description: this.description, expireIn: expiryInSecs, amountMsat: this.invoiceValue * 1000 };
} else { } else {
@ -98,7 +98,7 @@ export class ECLCreateInvoiceComponent implements OnInit, OnDestroy {
} }
onInvoiceValueChange() { onInvoiceValueChange() {
if (this.selNode.fiatConversion && this.invoiceValue > 99) { if (this.selNode && this.selNode.fiatConversion && this.invoiceValue && this.invoiceValue > 99) {
this.invoiceValueHint = ''; this.invoiceValueHint = '';
this.commonService.convertCurrency(this.invoiceValue, CurrencyUnitEnum.SATS, CurrencyUnitEnum.OTHER, (this.selNode.currencyUnits && this.selNode.currencyUnits.length > 2 ? this.selNode.currencyUnits[2] : ''), this.selNode.fiatConversion). this.commonService.convertCurrency(this.invoiceValue, CurrencyUnitEnum.SATS, CurrencyUnitEnum.OTHER, (this.selNode.currencyUnits && this.selNode.currencyUnits.length > 2 ? this.selNode.currencyUnits[2] : ''), this.selNode.fiatConversion).
pipe(takeUntil(this.unSubs[3])). pipe(takeUntil(this.unSubs[3])).

@ -38,7 +38,7 @@ export class ECLInvoiceInformationComponent implements OnInit, OnDestroy {
ngOnInit() { ngOnInit() {
this.invoice = this.data.invoice; this.invoice = this.data.invoice;
this.newlyAdded = this.data.newlyAdded; this.newlyAdded = !!this.data.newlyAdded;
this.screenSize = this.commonService.getScreenSize(); this.screenSize = this.commonService.getScreenSize();
if (this.screenSize === ScreenSizeEnum.XS) { if (this.screenSize === ScreenSizeEnum.XS) {
this.qrWidth = 220; this.qrWidth = 220;
@ -51,7 +51,7 @@ export class ECLInvoiceInformationComponent implements OnInit, OnDestroy {
subscribe((invoicesSelector: { invoices: Invoice[], apiCallStatus: ApiCallStatusPayload }) => { subscribe((invoicesSelector: { invoices: Invoice[], apiCallStatus: ApiCallStatusPayload }) => {
const invoiceStatus = this.invoice.status; const invoiceStatus = this.invoice.status;
const invoices = (invoicesSelector.invoices && invoicesSelector.invoices.length > 0) ? invoicesSelector.invoices : []; const invoices = (invoicesSelector.invoices && invoicesSelector.invoices.length > 0) ? invoicesSelector.invoices : [];
this.invoice = invoices.find((invoice) => invoice.paymentHash === this.invoice.paymentHash); this.invoice = invoices?.find((invoice) => invoice.paymentHash === this.invoice.paymentHash) || {};
if (invoiceStatus !== this.invoice.status && this.invoice.status === 'received') { if (invoiceStatus !== this.invoice.status && this.invoice.status === 'received') {
this.flgInvoicePaid = true; this.flgInvoicePaid = true;
setTimeout(() => { this.flgInvoicePaid = false; }, 4000); setTimeout(() => { this.flgInvoicePaid = false; }, 4000);

@ -38,12 +38,12 @@ export class ECLLightningInvoicesComponent implements OnInit, AfterViewInit, OnD
@ViewChild(MatSort, { static: false }) sort: MatSort | undefined; @ViewChild(MatSort, { static: false }) sort: MatSort | undefined;
@ViewChild(MatPaginator, { static: false }) paginator: MatPaginator | undefined; @ViewChild(MatPaginator, { static: false }) paginator: MatPaginator | undefined;
faHistory = faHistory; faHistory = faHistory;
public selNode: SelNodeChild = {}; public selNode: SelNodeChild | null = {};
public newlyAddedInvoiceMemo = ''; public newlyAddedInvoiceMemo: string | null = '';
public newlyAddedInvoiceValue = 0; public newlyAddedInvoiceValue: number | null = 0;
public description = ''; public description: string | null = '';
public expiry: number; public expiry: number | null;
public invoiceValue: number = null; public invoiceValue: number | null = null;
public invoiceValueHint = ''; public invoiceValueHint = '';
public displayedColumns: any[] = []; public displayedColumns: any[] = [];
public invoicePaymentReq = ''; public invoicePaymentReq = '';
@ -80,7 +80,7 @@ export class ECLLightningInvoicesComponent implements OnInit, AfterViewInit, OnD
ngOnInit() { ngOnInit() {
this.store.select(eclnNodeSettings).pipe(takeUntil(this.unSubs[0])). this.store.select(eclnNodeSettings).pipe(takeUntil(this.unSubs[0])).
subscribe((nodeSettings: SelNodeChild) => { subscribe((nodeSettings: SelNodeChild | null) => {
this.selNode = nodeSettings; this.selNode = nodeSettings;
}); });
this.store.select(eclNodeInformation).pipe(takeUntil(this.unSubs[1])). this.store.select(eclNodeInformation).pipe(takeUntil(this.unSubs[1])).
@ -135,7 +135,7 @@ export class ECLLightningInvoicesComponent implements OnInit, AfterViewInit, OnD
const expiryInSecs = (this.expiry ? this.expiry : 3600); const expiryInSecs = (this.expiry ? this.expiry : 3600);
this.newlyAddedInvoiceMemo = 'ulbl' + Math.random().toString(36).slice(2) + Date.now(); this.newlyAddedInvoiceMemo = 'ulbl' + Math.random().toString(36).slice(2) + Date.now();
this.newlyAddedInvoiceValue = this.invoiceValue; this.newlyAddedInvoiceValue = this.invoiceValue;
let invoicePayload = null; let invoicePayload: any = null;
if (this.invoiceValue) { if (this.invoiceValue) {
invoicePayload = { description: this.description, expireIn: expiryInSecs, amountMsat: this.invoiceValue * 1000 }; invoicePayload = { description: this.description, expireIn: expiryInSecs, amountMsat: this.invoiceValue * 1000 };
} else { } else {
@ -158,7 +158,7 @@ export class ECLLightningInvoicesComponent implements OnInit, AfterViewInit, OnD
} }
onRefreshInvoice(selInvoice: Invoice) { onRefreshInvoice(selInvoice: Invoice) {
this.store.dispatch(invoiceLookup({ payload: selInvoice.paymentHash })); this.store.dispatch(invoiceLookup({ payload: selInvoice.paymentHash! }));
} }
updateInvoicesData(newInvoice: Invoice) { updateInvoicesData(newInvoice: Invoice) {
@ -170,7 +170,7 @@ export class ECLLightningInvoicesComponent implements OnInit, AfterViewInit, OnD
this.invoices.sortingDataAccessor = (data: any, sortHeaderId: string) => ((data[sortHeaderId] && isNaN(data[sortHeaderId])) ? data[sortHeaderId].toLocaleLowerCase() : data[sortHeaderId] ? +data[sortHeaderId] : null); this.invoices.sortingDataAccessor = (data: any, sortHeaderId: string) => ((data[sortHeaderId] && isNaN(data[sortHeaderId])) ? data[sortHeaderId].toLocaleLowerCase() : data[sortHeaderId] ? +data[sortHeaderId] : null);
this.invoices.sort = this.sort; this.invoices.sort = this.sort;
this.invoices.filterPredicate = (rowData: Invoice, fltr: string) => { this.invoices.filterPredicate = (rowData: Invoice, fltr: string) => {
const newRowData = ((rowData.timestamp) ? this.datePipe.transform(new Date(rowData.timestamp * 1000), 'dd/MMM/YYYY HH:mm').toLowerCase() : '') + JSON.stringify(rowData).toLowerCase(); const newRowData = ((rowData.timestamp) ? this.datePipe.transform(new Date(rowData.timestamp * 1000), 'dd/MMM/YYYY HH:mm')?.toLowerCase() : '') + JSON.stringify(rowData).toLowerCase();
return newRowData.includes(fltr); return newRowData.includes(fltr);
}; };
this.invoices.paginator = this.paginator; this.invoices.paginator = this.paginator;
@ -189,7 +189,7 @@ export class ECLLightningInvoicesComponent implements OnInit, AfterViewInit, OnD
} }
onInvoiceValueChange() { onInvoiceValueChange() {
if (this.selNode.fiatConversion && this.invoiceValue > 99) { if (this.selNode && this.selNode.fiatConversion && this.invoiceValue && this.invoiceValue > 99) {
this.invoiceValueHint = ''; this.invoiceValueHint = '';
this.commonService.convertCurrency(this.invoiceValue, CurrencyUnitEnum.SATS, CurrencyUnitEnum.OTHER, (this.selNode.currencyUnits && this.selNode.currencyUnits.length > 2 ? this.selNode.currencyUnits[2] : ''), this.selNode.fiatConversion). this.commonService.convertCurrency(this.invoiceValue, CurrencyUnitEnum.SATS, CurrencyUnitEnum.OTHER, (this.selNode.currencyUnits && this.selNode.currencyUnits.length > 2 ? this.selNode.currencyUnits[2] : ''), this.selNode.fiatConversion).
pipe(takeUntil(this.unSubs[4])). pipe(takeUntil(this.unSubs[4])).

@ -13,7 +13,7 @@ export class ECLPaymentInformationComponent implements OnInit, AfterViewChecked
@ViewChild('scrollContainer', { static: false }) scrollContainer: ElementRef; @ViewChild('scrollContainer', { static: false }) scrollContainer: ElementRef;
public payment: PaymentSent; public payment: PaymentSent;
public description: string = null; public description: string | null = null;
public shouldScroll = true; public shouldScroll = true;
public expansionOpen = true; public expansionOpen = true;

@ -41,13 +41,13 @@ export class ECLLightningPaymentsComponent implements OnInit, AfterViewInit, OnD
@ViewChild(MatPaginator, { static: false }) paginator: MatPaginator | undefined; @ViewChild(MatPaginator, { static: false }) paginator: MatPaginator | undefined;
public faHistory = faHistory; public faHistory = faHistory;
public newlyAddedPayment = ''; public newlyAddedPayment = '';
public selNode: SelNodeChild = {}; public selNode: SelNodeChild | null = {};
public information: GetInfo = {}; public information: GetInfo = {};
public payments: any; public payments: any;
public paymentJSONArr: PaymentSent[] = []; public paymentJSONArr: PaymentSent[] = [];
public paymentDecoded: PayRequest = {}; public paymentDecoded: PayRequest = {};
public displayedColumns: any[] = []; public displayedColumns: any[] = [];
public partColumns = []; public partColumns: string[] = [];
public paymentRequest = ''; public paymentRequest = '';
public paymentDecodedHint = ''; public paymentDecodedHint = '';
public flgSticky = false; public flgSticky = false;
@ -84,7 +84,7 @@ export class ECLLightningPaymentsComponent implements OnInit, AfterViewInit, OnD
ngOnInit() { ngOnInit() {
this.store.select(eclnNodeSettings).pipe(takeUntil(this.unSubs[0])). this.store.select(eclnNodeSettings).pipe(takeUntil(this.unSubs[0])).
subscribe((nodeSettings: SelNodeChild) => { subscribe((nodeSettings: SelNodeChild | null) => {
this.selNode = nodeSettings; this.selNode = nodeSettings;
}); });
this.store.select(eclNodeInformation).pipe(takeUntil(this.unSubs[1])). this.store.select(eclNodeInformation).pipe(takeUntil(this.unSubs[1])).
@ -119,13 +119,17 @@ export class ECLLightningPaymentsComponent implements OnInit, AfterViewInit, OnD
// } // }
// This.paymentJSONArr = this.paymentJSONArr.splice(2, 5); // This.paymentJSONArr = this.paymentJSONArr.splice(2, 5);
// FOR MPP TESTING END // FOR MPP TESTING END
this.loadPaymentsTable(this.paymentJSONArr); if(this.paymentJSONArr.length > 0 && this.sort && this.paginator) {
this.loadPaymentsTable(this.paymentJSONArr);
}
this.logger.info(paymentsSeletor); this.logger.info(paymentsSeletor);
}); });
} }
ngAfterViewInit() { ngAfterViewInit() {
this.loadPaymentsTable(this.paymentJSONArr); if(this.paymentJSONArr.length > 0) {
this.loadPaymentsTable(this.paymentJSONArr);
}
} }
loadPaymentsTable(payms: PaymentSent[]) { loadPaymentsTable(payms: PaymentSent[]) {
@ -134,19 +138,19 @@ export class ECLLightningPaymentsComponent implements OnInit, AfterViewInit, OnD
this.payments.sortingDataAccessor = (data: any, sortHeaderId: string) => { this.payments.sortingDataAccessor = (data: any, sortHeaderId: string) => {
switch (sortHeaderId) { switch (sortHeaderId) {
case 'firstPartTimestamp': case 'firstPartTimestamp':
this.commonService.sortByKey(data.parts, 'timestamp', 'number', this.sort.direction); this.commonService.sortByKey(data.parts, 'timestamp', 'number', this.sort?.direction);
return data.firstPartTimestamp; return data.firstPartTimestamp;
case 'id': case 'id':
this.commonService.sortByKey(data.parts, 'id', 'string', this.sort.direction); this.commonService.sortByKey(data.parts, 'id', 'string', this.sort?.direction);
return data.id; return data.id;
case 'recipientNodeAlias': case 'recipientNodeAlias':
this.commonService.sortByKey(data.parts, 'toChannelAlias', 'string', this.sort.direction); this.commonService.sortByKey(data.parts, 'toChannelAlias', 'string', this.sort?.direction);
return data.recipientNodeAlias; return data.recipientNodeAlias;
case 'recipientAmount': case 'recipientAmount':
this.commonService.sortByKey(data.parts, 'amount', 'number', this.sort.direction); this.commonService.sortByKey(data.parts, 'amount', 'number', this.sort?.direction);
return data.recipientAmount; return data.recipientAmount;
default: default:
@ -154,7 +158,7 @@ export class ECLLightningPaymentsComponent implements OnInit, AfterViewInit, OnD
} }
}; };
this.payments.filterPredicate = (rowData: PaymentSent, fltr: string) => { this.payments.filterPredicate = (rowData: PaymentSent, fltr: string) => {
const newRowData = ((rowData.firstPartTimestamp) ? this.datePipe.transform(new Date(rowData.firstPartTimestamp), 'dd/MMM/YYYY HH:mm').toLowerCase() : '') + JSON.stringify(rowData).toLowerCase(); const newRowData = ((rowData.firstPartTimestamp) ? this.datePipe.transform(new Date(rowData.firstPartTimestamp), 'dd/MMM/YYYY HH:mm')?.toLowerCase() : '') + JSON.stringify(rowData).toLowerCase();
return newRowData.includes(fltr); return newRowData.includes(fltr);
}; };
this.payments.paginator = this.paginator; this.payments.paginator = this.paginator;
@ -184,7 +188,7 @@ export class ECLLightningPaymentsComponent implements OnInit, AfterViewInit, OnD
} }
sendPayment() { sendPayment() {
this.newlyAddedPayment = this.paymentDecoded.paymentHash; this.newlyAddedPayment = this.paymentDecoded.paymentHash || '';
if (!this.paymentDecoded.amount || this.paymentDecoded.amount === 0) { if (!this.paymentDecoded.amount || this.paymentDecoded.amount === 0) {
const reorderedPaymentDecoded = [ const reorderedPaymentDecoded = [
[{ key: 'paymentHash', value: this.paymentDecoded.paymentHash, title: 'Payment Hash', width: 100 }], [{ key: 'paymentHash', value: this.paymentDecoded.paymentHash, title: 'Payment Hash', width: 100 }],
@ -260,7 +264,7 @@ export class ECLLightningPaymentsComponent implements OnInit, AfterViewInit, OnD
pipe(take(1)).subscribe((decodedPayment: PayRequest) => { pipe(take(1)).subscribe((decodedPayment: PayRequest) => {
this.paymentDecoded = decodedPayment; this.paymentDecoded = decodedPayment;
if (this.paymentDecoded.amount) { if (this.paymentDecoded.amount) {
if (this.selNode.fiatConversion) { if (this.selNode && this.selNode.fiatConversion) {
this.commonService.convertCurrency(+this.paymentDecoded.amount, CurrencyUnitEnum.SATS, CurrencyUnitEnum.OTHER, (this.selNode.currencyUnits && this.selNode.currencyUnits.length > 2 ? this.selNode.currencyUnits[2] : ''), this.selNode.fiatConversion). this.commonService.convertCurrency(+this.paymentDecoded.amount, CurrencyUnitEnum.SATS, CurrencyUnitEnum.OTHER, (this.selNode.currencyUnits && this.selNode.currencyUnits.length > 2 ? this.selNode.currencyUnits[2] : ''), this.selNode.fiatConversion).
pipe(takeUntil(this.unSubs[3])). pipe(takeUntil(this.unSubs[3])).
subscribe({ subscribe({
@ -358,7 +362,7 @@ export class ECLLightningPaymentsComponent implements OnInit, AfterViewInit, OnD
[{ key: 'amount', value: selPart.amount, title: 'Amount (Sats)', width: 50, type: DataTypeEnum.NUMBER }, [{ key: 'amount', value: selPart.amount, title: 'Amount (Sats)', width: 50, type: DataTypeEnum.NUMBER },
{ key: 'feesPaid', value: selPart.feesPaid, title: 'Fee (Sats)', width: 50, type: DataTypeEnum.NUMBER }] { key: 'feesPaid', value: selPart.feesPaid, title: 'Fee (Sats)', width: 50, type: DataTypeEnum.NUMBER }]
]; ];
if (sentPaymentInfo.length > 0 && sentPaymentInfo[0].paymentRequest && sentPaymentInfo[0].paymentRequest.description && sentPaymentInfo[0].paymentRequest.description !== '') { if (sentPaymentInfo && sentPaymentInfo.length > 0 && sentPaymentInfo[0].paymentRequest && sentPaymentInfo[0].paymentRequest.description && sentPaymentInfo[0].paymentRequest.description !== '') {
reorderedPart.splice(3, 0, [{ key: 'description', value: sentPaymentInfo[0].paymentRequest.description, title: 'Description', width: 100, type: DataTypeEnum.STRING }]); reorderedPart.splice(3, 0, [{ key: 'description', value: sentPaymentInfo[0].paymentRequest.description, title: 'Description', width: 100, type: DataTypeEnum.STRING }]);
} }
this.store.dispatch(openAlert({ this.store.dispatch(openAlert({
@ -393,7 +397,7 @@ export class ECLLightningPaymentsComponent implements OnInit, AfterViewInit, OnD
paymentsDataCopy[idx].description = decodedPayment[0].paymentRequest.description; paymentsDataCopy[idx].description = decodedPayment[0].paymentRequest.description;
} }
}); });
const flattenedPayments = paymentsDataCopy?.reduce((acc, curr) => acc.concat(curr), []); const flattenedPayments = paymentsDataCopy?.reduce((acc, curr: any) => acc.concat(curr), []);
this.commonService.downloadFile(flattenedPayments, 'Payments'); this.commonService.downloadFile(flattenedPayments, 'Payments');
}); });
} }

@ -30,13 +30,13 @@ export class ECLLightningSendPaymentsComponent implements OnInit, OnDestroy {
@ViewChild('paymentReq', { static: false }) paymentReq: NgModel; @ViewChild('paymentReq', { static: false }) paymentReq: NgModel;
public faExclamationTriangle = faExclamationTriangle; public faExclamationTriangle = faExclamationTriangle;
public selNode: SelNodeChild = {}; public selNode: SelNodeChild | null = {};
public paymentDecoded: PayRequest = {}; public paymentDecoded: PayRequest = {};
public zeroAmtInvoice = false; public zeroAmtInvoice = false;
public paymentAmount = null; public paymentAmount = null;
public paymentRequest = ''; public paymentRequest = '';
public paymentDecodedHint = ''; public paymentDecodedHint = '';
public selActiveChannel: Channel = {}; public selActiveChannel: Channel | null = {};
public activeChannels = {}; public activeChannels = {};
public feeLimit = null; public feeLimit = null;
public selFeeLimitType = FEE_LIMIT_TYPES[0]; public selFeeLimitType = FEE_LIMIT_TYPES[0];
@ -48,7 +48,7 @@ export class ECLLightningSendPaymentsComponent implements OnInit, OnDestroy {
ngOnInit() { ngOnInit() {
this.store.select(eclnNodeSettings).pipe(takeUntil(this.unSubs[0])). this.store.select(eclnNodeSettings).pipe(takeUntil(this.unSubs[0])).
subscribe((nodeSettings: SelNodeChild) => { subscribe((nodeSettings: SelNodeChild | null) => {
this.selNode = nodeSettings; this.selNode = nodeSettings;
}); });
this.store.select(allChannelsInfo).pipe(takeUntil(this.unSubs[1])). this.store.select(allChannelsInfo).pipe(takeUntil(this.unSubs[1])).
@ -91,7 +91,7 @@ export class ECLLightningSendPaymentsComponent implements OnInit, OnDestroy {
this.paymentDecodedHint = 'Zero Amount Invoice | Memo: ' + this.paymentDecoded.description; this.paymentDecodedHint = 'Zero Amount Invoice | Memo: ' + this.paymentDecoded.description;
} else { } else {
this.zeroAmtInvoice = false; this.zeroAmtInvoice = false;
if (this.selNode.fiatConversion) { if (this.selNode && this.selNode.fiatConversion && this.paymentDecoded.amount) {
this.commonService.convertCurrency(+this.paymentDecoded.amount, CurrencyUnitEnum.SATS, CurrencyUnitEnum.OTHER, (this.selNode.currencyUnits && this.selNode.currencyUnits.length > 2 ? this.selNode.currencyUnits[2] : ''), this.selNode.fiatConversion). this.commonService.convertCurrency(+this.paymentDecoded.amount, CurrencyUnitEnum.SATS, CurrencyUnitEnum.OTHER, (this.selNode.currencyUnits && this.selNode.currencyUnits.length > 2 ? this.selNode.currencyUnits[2] : ''), this.selNode.fiatConversion).
pipe(takeUntil(this.unSubs[2])). pipe(takeUntil(this.unSubs[2])).
subscribe({ subscribe({
@ -115,7 +115,7 @@ export class ECLLightningSendPaymentsComponent implements OnInit, OnDestroy {
} }
sendPayment() { sendPayment() {
if (this.zeroAmtInvoice) { if (this.zeroAmtInvoice && this.paymentAmount) {
this.store.dispatch(sendPayment({ payload: { invoice: this.paymentRequest, amountMsat: this.paymentAmount * 1000, fromDialog: true } })); this.store.dispatch(sendPayment({ payload: { invoice: this.paymentRequest, amountMsat: this.paymentAmount * 1000, fromDialog: true } }));
} else { } else {
this.store.dispatch(sendPayment({ payload: { invoice: this.paymentRequest, fromDialog: true } })); this.store.dispatch(sendPayment({ payload: { invoice: this.paymentRequest, fromDialog: true } }));
@ -140,7 +140,7 @@ export class ECLLightningSendPaymentsComponent implements OnInit, OnDestroy {
this.paymentDecodedHint = 'Zero Amount Invoice | Memo: ' + this.paymentDecoded.description; this.paymentDecodedHint = 'Zero Amount Invoice | Memo: ' + this.paymentDecoded.description;
} else { } else {
this.zeroAmtInvoice = false; this.zeroAmtInvoice = false;
if (this.selNode.fiatConversion) { if (this.selNode && this.selNode.fiatConversion && this.paymentDecoded.amount) {
this.commonService.convertCurrency(+this.paymentDecoded.amount, CurrencyUnitEnum.SATS, CurrencyUnitEnum.OTHER, (this.selNode.currencyUnits && this.selNode.currencyUnits.length > 2 ? this.selNode.currencyUnits[2] : ''), this.selNode.fiatConversion). this.commonService.convertCurrency(+this.paymentDecoded.amount, CurrencyUnitEnum.SATS, CurrencyUnitEnum.OTHER, (this.selNode.currencyUnits && this.selNode.currencyUnits.length > 2 ? this.selNode.currencyUnits[2] : ''), this.selNode.fiatConversion).
pipe(takeUntil(this.unSubs[3])). pipe(takeUntil(this.unSubs[3])).
subscribe({ subscribe({

@ -22,7 +22,7 @@ export class ECLTransactionsComponent implements OnInit, OnDestroy {
faExchangeAlt = faExchangeAlt; faExchangeAlt = faExchangeAlt;
faChartPie = faChartPie; faChartPie = faChartPie;
currencyUnits = []; currencyUnits: string[] = [];
balances = [{ title: 'Local Capacity', dataValue: 0, tooltip: 'Amount you can send' }, { title: 'Remote Capacity', dataValue: 0, tooltip: 'Amount you can receive' }]; balances = [{ title: 'Local Capacity', dataValue: 0, tooltip: 'Amount you can send' }, { title: 'Remote Capacity', dataValue: 0, tooltip: 'Amount you can receive' }];
public links = [{ link: 'payments', name: 'Payments' }, { link: 'invoices', name: 'Invoices' }]; public links = [{ link: 'payments', name: 'Payments' }, { link: 'invoices', name: 'Invoices' }];
public activeLink = this.links[0].link; public activeLink = this.links[0].link;
@ -42,9 +42,9 @@ export class ECLTransactionsComponent implements OnInit, OnDestroy {
}); });
this.store.select(allChannelsInfo).pipe(takeUntil(this.unSubs[1]), this.store.select(allChannelsInfo).pipe(takeUntil(this.unSubs[1]),
withLatestFrom(this.store.select(eclnNodeSettings))). withLatestFrom(this.store.select(eclnNodeSettings))).
subscribe(([allChannels, nodeSettings]: [{ activeChannels: Channel[], pendingChannels: Channel[], inactiveChannels: Channel[], lightningBalance: LightningBalance, channelsStatus: ChannelsStatus, apiCallStatus: ApiCallStatusPayload }, SelNodeChild]) => { subscribe(([allChannels, nodeSettings]: [{ activeChannels: Channel[], pendingChannels: Channel[], inactiveChannels: Channel[], lightningBalance: LightningBalance, channelsStatus: ChannelsStatus, apiCallStatus: ApiCallStatusPayload }, (SelNodeChild | null)]) => {
this.currencyUnits = nodeSettings.currencyUnits; this.currencyUnits = nodeSettings?.currencyUnits || [];
if (nodeSettings.userPersona === UserPersonaEnum.OPERATOR) { if (nodeSettings && nodeSettings.userPersona === UserPersonaEnum.OPERATOR) {
this.balances = [{ title: 'Local Capacity', dataValue: allChannels.lightningBalance.localBalance, tooltip: 'Amount you can send' }, { title: 'Remote Capacity', dataValue: allChannels.lightningBalance.remoteBalance, tooltip: 'Amount you can receive' }]; this.balances = [{ title: 'Local Capacity', dataValue: allChannels.lightningBalance.localBalance, tooltip: 'Amount you can send' }, { title: 'Remote Capacity', dataValue: allChannels.lightningBalance.remoteBalance, tooltip: 'Amount you can receive' }];
} else { } else {
this.balances = [{ title: 'Outbound Capacity', dataValue: allChannels.lightningBalance.localBalance, tooltip: 'Amount you can send' }, { title: 'Inbound Capacity', dataValue: allChannels.lightningBalance.remoteBalance, tooltip: 'Amount you can receive' }]; this.balances = [{ title: 'Outbound Capacity', dataValue: allChannels.lightningBalance.localBalance, tooltip: 'Amount you can send' }, { title: 'Inbound Capacity', dataValue: allChannels.lightningBalance.remoteBalance, tooltip: 'Amount you can receive' }];

@ -38,10 +38,10 @@ export class ChannelBackupTableComponent implements OnInit, AfterViewInit, OnDes
public faArchive = faArchive; public faArchive = faArchive;
public pageSize = PAGE_SIZE; public pageSize = PAGE_SIZE;
public pageSizeOptions = PAGE_SIZE_OPTIONS; public pageSizeOptions = PAGE_SIZE_OPTIONS;
public selNode: SelNodeChild = {}; public selNode: SelNodeChild | null = {};
public displayedColumns = ['channel_point', 'actions']; public displayedColumns = ['channel_point', 'actions'];
public selectedChannel: Channel; public selectedChannel: Channel | null;
public channelsData = []; public channelsData: Channel[] = [];
public channels: any; public channels: any;
public flgSticky = false; public flgSticky = false;
public screenSize = ''; public screenSize = '';
@ -57,7 +57,7 @@ export class ChannelBackupTableComponent implements OnInit, AfterViewInit, OnDes
} }
ngOnInit() { ngOnInit() {
this.store.select(lndNodeSettings).pipe(takeUntil(this.unSubs[0])).subscribe((nodeSettings: SelNodeChild) => { this.selNode = nodeSettings; }); this.store.select(lndNodeSettings).pipe(takeUntil(this.unSubs[0])).subscribe((nodeSettings: SelNodeChild | null) => { this.selNode = nodeSettings; });
this.store.select(channels).pipe(takeUntil(this.unSubs[1])). this.store.select(channels).pipe(takeUntil(this.unSubs[1])).
subscribe((channelsSeletor: { channels: Channel[], channelsSummary: ChannelsSummary, lightningBalance: LightningBalance, apiCallStatus: ApiCallStatusPayload }) => { subscribe((channelsSeletor: { channels: Channel[], channelsSummary: ChannelsSummary, lightningBalance: LightningBalance, apiCallStatus: ApiCallStatusPayload }) => {
this.errorMessage = ''; this.errorMessage = '';
@ -76,7 +76,7 @@ export class ChannelBackupTableComponent implements OnInit, AfterViewInit, OnDes
this.selectedChannel = null; this.selectedChannel = null;
} }
if (action.type === RTLActions.SHOW_FILE) { if (action.type === RTLActions.SHOW_FILE) {
this.commonService.downloadFile(action.payload, 'channel-' + (this.selectedChannel.channel_point ? this.selectedChannel.channel_point : 'all'), '.bak', '.bak'); this.commonService.downloadFile(action.payload, 'channel-' + (this.selectedChannel?.channel_point ? this.selectedChannel.channel_point : 'all'), '.bak', '.bak');
this.selectedChannel = null; this.selectedChannel = null;
} }
}); });

@ -31,7 +31,7 @@ export class ChannelRestoreTableComponent implements OnInit, AfterViewInit, OnDe
@ViewChild(MatPaginator, { static: false }) paginator: MatPaginator | undefined; @ViewChild(MatPaginator, { static: false }) paginator: MatPaginator | undefined;
public pageSize = PAGE_SIZE; public pageSize = PAGE_SIZE;
public pageSizeOptions = PAGE_SIZE_OPTIONS; public pageSizeOptions = PAGE_SIZE_OPTIONS;
public selNode: SelNodeChild = {}; public selNode: SelNodeChild | null = {};
public displayedColumns = ['channel_point', 'actions']; public displayedColumns = ['channel_point', 'actions'];
public selChannel: Channel; public selChannel: Channel;
public channelsData = []; public channelsData = [];
@ -50,7 +50,7 @@ export class ChannelRestoreTableComponent implements OnInit, AfterViewInit, OnDe
ngOnInit() { ngOnInit() {
this.store.dispatch(restoreChannelsList()); this.store.dispatch(restoreChannelsList());
this.store.select(lndNodeSettings).pipe(takeUntil(this.unSubs[0])).subscribe((nodeSettings: SelNodeChild) => { this.selNode = nodeSettings; }); this.store.select(lndNodeSettings).pipe(takeUntil(this.unSubs[0])).subscribe((nodeSettings: SelNodeChild | null) => { this.selNode = nodeSettings; });
this.lndEffects.setRestoreChannelList.pipe(takeUntil(this.unSubs[1])). this.lndEffects.setRestoreChannelList.pipe(takeUntil(this.unSubs[1])).
subscribe((resRCList) => { subscribe((resRCList) => {
this.allRestoreExists = resRCList.all_restore_exists; this.allRestoreExists = resRCList.all_restore_exists;

@ -36,8 +36,8 @@ export class ChannelLiquidityInfoComponent implements OnInit, OnDestroy {
ngOnInit() { ngOnInit() {
this.screenSize = this.commonService.getScreenSize(); this.screenSize = this.commonService.getScreenSize();
this.store.select(lndNodeSettings).pipe(takeUntil(this.unSubs[0])).subscribe((nodeSettings: SelNodeChild) => { this.store.select(lndNodeSettings).pipe(takeUntil(this.unSubs[0])).subscribe((nodeSettings: SelNodeChild | null) => {
this.showLoop = !!((nodeSettings.swapServerUrl && nodeSettings.swapServerUrl.trim() !== '')); this.showLoop = !!((nodeSettings?.swapServerUrl && nodeSettings.swapServerUrl.trim() !== ''));
}); });
} }

@ -17,7 +17,7 @@ export class FeeInfoComponent implements OnChanges {
ngOnChanges() { ngOnChanges() {
if (this.fees.month_fee_sum) { if (this.fees.month_fee_sum) {
this.totalFees = [{ name: 'Monthly', value: this.fees.month_fee_sum }, { name: 'Weekly', value: this.fees.week_fee_sum }, { name: 'Daily ', value: this.fees.day_fee_sum }]; this.totalFees = [{ name: 'Monthly', value: this.fees.month_fee_sum }, { name: 'Weekly', value: (this.fees.week_fee_sum || 0) }, { name: 'Daily ', value: (this.fees.day_fee_sum || 0) }];
const e = Math.ceil(Math.log(this.fees.month_fee_sum + 1) / Math.LN10); const e = Math.ceil(Math.log(this.fees.month_fee_sum + 1) / Math.LN10);
const m = 10 ** (e - 1); const m = 10 ** (e - 1);
this.maxFeeValue = (Math.ceil(this.fees.month_fee_sum / m) * m) / 5 || 100; this.maxFeeValue = (Math.ceil(this.fees.month_fee_sum / m) * m) / 5 || 100;

@ -47,7 +47,7 @@ export class HomeComponent implements OnInit, OnDestroy {
public activeChannels = 0; public activeChannels = 0;
public inactiveChannels = 0; public inactiveChannels = 0;
public channelBalances = { localBalance: 0, remoteBalance: 0, balancedness: 0 }; public channelBalances = { localBalance: 0, remoteBalance: 0, balancedness: 0 };
public selNode: SelNodeChild = {}; public selNode: SelNodeChild | null = {};
public fees: Fees; public fees: Fees;
public information: GetInfo = {}; public information: GetInfo = {};
public balances = { onchain: -1, lightning: -1, total: 0 }; public balances = { onchain: -1, lightning: -1, total: 0 };
@ -66,11 +66,11 @@ export class HomeComponent implements OnInit, OnDestroy {
public sortField = 'Balance Score'; public sortField = 'Balance Score';
public screenSizeEnum = ScreenSizeEnum; public screenSizeEnum = ScreenSizeEnum;
public errorMessages = ['', '', '', '', '']; public errorMessages = ['', '', '', '', ''];
public apiCallStatusNodeInfo: ApiCallStatusPayload = null; public apiCallStatusNodeInfo: ApiCallStatusPayload | null = null;
public apiCallStatusFees: ApiCallStatusPayload = null; public apiCallStatusFees: ApiCallStatusPayload | null = null;
public apiCallStatusBlockchainBalance: ApiCallStatusPayload = null; public apiCallStatusBlockchainBalance: ApiCallStatusPayload | null = null;
public apiCallStatusChannels: ApiCallStatusPayload = null; public apiCallStatusChannels: ApiCallStatusPayload | null = null;
public apiCallStatusPendingChannels: ApiCallStatusPayload = null; public apiCallStatusPendingChannels: ApiCallStatusPayload | null = null;
public apiCallStatusEnum = APICallStatusEnum; public apiCallStatusEnum = APICallStatusEnum;
private unSubs: Array<Subject<void>> = [new Subject(), new Subject(), new Subject(), new Subject(), new Subject(), new Subject(), new Subject(), new Subject(), new Subject()]; private unSubs: Array<Subject<void>> = [new Subject(), new Subject(), new Subject(), new Subject(), new Subject(), new Subject(), new Subject(), new Subject(), new Subject()];
@ -145,11 +145,11 @@ export class HomeComponent implements OnInit, OnDestroy {
ngOnInit() { ngOnInit() {
this.store.select(nodeInfoAndNodeSettingsAndAPIStatus).pipe(takeUntil(this.unSubs[0])). this.store.select(nodeInfoAndNodeSettingsAndAPIStatus).pipe(takeUntil(this.unSubs[0])).
subscribe((infoSettingsStatusSelector: { information: GetInfo, nodeSettings: SelNodeChild, apiCallStatus: ApiCallStatusPayload }) => { subscribe((infoSettingsStatusSelector: { information: GetInfo, nodeSettings: SelNodeChild | null, apiCallStatus: ApiCallStatusPayload }) => {
this.errorMessages[0] = ''; this.errorMessages[0] = '';
this.apiCallStatusNodeInfo = infoSettingsStatusSelector.apiCallStatus; this.apiCallStatusNodeInfo = infoSettingsStatusSelector.apiCallStatus;
if (this.apiCallStatusNodeInfo.status === APICallStatusEnum.ERROR) { if (this.apiCallStatusNodeInfo.status === APICallStatusEnum.ERROR) {
this.errorMessages[0] = (typeof (this.apiCallStatusNodeInfo.message) === 'object') ? JSON.stringify(this.apiCallStatusNodeInfo.message) : this.apiCallStatusNodeInfo.message; this.errorMessages[0] = (typeof (this.apiCallStatusNodeInfo.message) === 'object') ? JSON.stringify(this.apiCallStatusNodeInfo.message) : this.apiCallStatusNodeInfo.message ? this.apiCallStatusNodeInfo.message : '';
} }
this.selNode = infoSettingsStatusSelector.nodeSettings; this.selNode = infoSettingsStatusSelector.nodeSettings;
this.information = infoSettingsStatusSelector.information; this.information = infoSettingsStatusSelector.information;
@ -159,7 +159,7 @@ export class HomeComponent implements OnInit, OnDestroy {
this.errorMessages[1] = ''; this.errorMessages[1] = '';
this.apiCallStatusFees = feesSelector.apiCallStatus; this.apiCallStatusFees = feesSelector.apiCallStatus;
if (this.apiCallStatusFees.status === APICallStatusEnum.ERROR) { if (this.apiCallStatusFees.status === APICallStatusEnum.ERROR) {
this.errorMessages[1] = (typeof (this.apiCallStatusFees.message) === 'object') ? JSON.stringify(this.apiCallStatusFees.message) : this.apiCallStatusFees.message; this.errorMessages[1] = (typeof (this.apiCallStatusFees.message) === 'object') ? JSON.stringify(this.apiCallStatusFees.message) : this.apiCallStatusFees.message ? this.apiCallStatusFees.message : '';
} }
this.fees = feesSelector.fees; this.fees = feesSelector.fees;
}); });
@ -168,9 +168,9 @@ export class HomeComponent implements OnInit, OnDestroy {
this.errorMessages[2] = ''; this.errorMessages[2] = '';
this.apiCallStatusBlockchainBalance = bcBalanceSelector.apiCallStatus; this.apiCallStatusBlockchainBalance = bcBalanceSelector.apiCallStatus;
if (this.apiCallStatusBlockchainBalance.status === APICallStatusEnum.ERROR) { if (this.apiCallStatusBlockchainBalance.status === APICallStatusEnum.ERROR) {
this.errorMessages[2] = (typeof (this.apiCallStatusBlockchainBalance.message) === 'object') ? JSON.stringify(this.apiCallStatusBlockchainBalance.message) : this.apiCallStatusBlockchainBalance.message; this.errorMessages[2] = (typeof (this.apiCallStatusBlockchainBalance.message) === 'object') ? JSON.stringify(this.apiCallStatusBlockchainBalance.message) : this.apiCallStatusBlockchainBalance.message ? this.apiCallStatusBlockchainBalance.message : '';
} }
this.balances.onchain = (+bcBalanceSelector.blockchainBalance.total_balance >= 0) ? +bcBalanceSelector.blockchainBalance.total_balance : 0; this.balances.onchain = (bcBalanceSelector.blockchainBalance.total_balance && +bcBalanceSelector.blockchainBalance.total_balance >= 0) ? +bcBalanceSelector.blockchainBalance.total_balance : 0;
this.balances.total = this.balances.lightning + this.balances.onchain; this.balances.total = this.balances.lightning + this.balances.onchain;
this.balances = Object.assign({}, this.balances); this.balances = Object.assign({}, this.balances);
}); });
@ -179,11 +179,11 @@ export class HomeComponent implements OnInit, OnDestroy {
this.errorMessages[4] = ''; this.errorMessages[4] = '';
this.apiCallStatusPendingChannels = pendingChannelsSelector.apiCallStatus; this.apiCallStatusPendingChannels = pendingChannelsSelector.apiCallStatus;
if (this.apiCallStatusPendingChannels.status === APICallStatusEnum.ERROR) { if (this.apiCallStatusPendingChannels.status === APICallStatusEnum.ERROR) {
this.errorMessages[4] = (typeof (this.apiCallStatusPendingChannels.message) === 'object') ? JSON.stringify(this.apiCallStatusPendingChannels.message) : this.apiCallStatusPendingChannels.message; this.errorMessages[4] = (typeof (this.apiCallStatusPendingChannels.message) === 'object') ? JSON.stringify(this.apiCallStatusPendingChannels.message) : this.apiCallStatusPendingChannels.message ? this.apiCallStatusPendingChannels.message : '';
} }
this.channelsStatus.pending = { num_channels: pendingChannelsSelector.pendingChannelsSummary.open.num_channels, capacity: pendingChannelsSelector.pendingChannelsSummary.open.limbo_balance }; this.channelsStatus.pending = { num_channels: pendingChannelsSelector.pendingChannelsSummary.open?.num_channels, capacity: pendingChannelsSelector.pendingChannelsSummary.open?.limbo_balance };
this.channelsStatus.closing = { this.channelsStatus.closing = {
num_channels: pendingChannelsSelector.pendingChannelsSummary.closing.num_channels + pendingChannelsSelector.pendingChannelsSummary.force_closing.num_channels + pendingChannelsSelector.pendingChannelsSummary.waiting_close.num_channels, num_channels: (pendingChannelsSelector.pendingChannelsSummary.closing?.num_channels || 0) + (pendingChannelsSelector.pendingChannelsSummary.force_closing?.num_channels || 0) + (pendingChannelsSelector.pendingChannelsSummary.waiting_close?.num_channels || 0),
capacity: pendingChannelsSelector.pendingChannelsSummary.total_limbo_balance capacity: pendingChannelsSelector.pendingChannelsSummary.total_limbo_balance
}; };
}); });
@ -192,30 +192,30 @@ export class HomeComponent implements OnInit, OnDestroy {
this.errorMessages[3] = ''; this.errorMessages[3] = '';
this.apiCallStatusChannels = channelsSelector.apiCallStatus; this.apiCallStatusChannels = channelsSelector.apiCallStatus;
if (this.apiCallStatusChannels.status === APICallStatusEnum.ERROR) { if (this.apiCallStatusChannels.status === APICallStatusEnum.ERROR) {
this.errorMessages[3] = (typeof (this.apiCallStatusChannels.message) === 'object') ? JSON.stringify(this.apiCallStatusChannels.message) : this.apiCallStatusChannels.message; this.errorMessages[3] = (typeof (this.apiCallStatusChannels.message) === 'object') ? JSON.stringify(this.apiCallStatusChannels.message) : this.apiCallStatusChannels.message ? this.apiCallStatusChannels.message : '';
} }
const local = (channelsSelector.lightningBalance && channelsSelector.lightningBalance.local) ? +channelsSelector.lightningBalance.local : 0; const local = (channelsSelector.lightningBalance && channelsSelector.lightningBalance.local) ? +channelsSelector.lightningBalance.local : 0;
const remote = (channelsSelector.lightningBalance && channelsSelector.lightningBalance.remote) ? +channelsSelector.lightningBalance.remote : 0; const remote = (channelsSelector.lightningBalance && channelsSelector.lightningBalance.remote) ? +channelsSelector.lightningBalance.remote : 0;
const total = local + remote; const total = local + remote;
this.channelBalances = { localBalance: local, remoteBalance: remote, balancedness: +(1 - Math.abs((local - remote) / total)).toFixed(3) }; this.channelBalances = { localBalance: local, remoteBalance: remote, balancedness: +(1 - Math.abs((local - remote) / total)).toFixed(3) };
this.balances.lightning = channelsSelector.lightningBalance.local; this.balances.lightning = channelsSelector.lightningBalance.local || 0;
this.balances.total = this.balances.lightning + this.balances.onchain; this.balances.total = this.balances.lightning + this.balances.onchain;
this.balances = Object.assign({}, this.balances); this.balances = Object.assign({}, this.balances);
this.activeChannels = channelsSelector.channelsSummary.active.num_channels; this.activeChannels = channelsSelector.channelsSummary.active?.num_channels || 0;
this.inactiveChannels = channelsSelector.channelsSummary.inactive.num_channels; this.inactiveChannels = channelsSelector.channelsSummary.inactive?.num_channels || 0;
this.channelsStatus.active = channelsSelector.channelsSummary.active; this.channelsStatus.active = channelsSelector.channelsSummary.active;
this.channelsStatus.inactive = channelsSelector.channelsSummary.inactive; this.channelsStatus.inactive = channelsSelector.channelsSummary.inactive;
this.totalInboundLiquidity = 0; this.totalInboundLiquidity = 0;
this.totalOutboundLiquidity = 0; this.totalOutboundLiquidity = 0;
this.allChannels = channelsSelector.channels?.filter((channel) => channel.active === true); this.allChannels = channelsSelector.channels?.filter((channel) => channel.active === true);
this.allChannelsCapacity = JSON.parse(JSON.stringify(this.commonService.sortDescByKey(this.allChannels, 'balancedness'))); this.allChannelsCapacity = JSON.parse(JSON.stringify(this.commonService.sortDescByKey(this.allChannels, 'balancedness')));
this.allInboundChannels = JSON.parse(JSON.stringify(this.commonService.sortDescByKey(this.allChannels?.filter((channel) => channel.remote_balance > 0), 'remote_balance'))); this.allInboundChannels = JSON.parse(JSON.stringify(this.commonService.sortDescByKey(this.allChannels?.filter((channel) => channel.remote_balance && channel.remote_balance > 0), 'remote_balance')));
this.allOutboundChannels = JSON.parse(JSON.stringify(this.commonService.sortDescByKey(this.allChannels?.filter((channel) => channel.local_balance > 0), 'local_balance'))); this.allOutboundChannels = JSON.parse(JSON.stringify(this.commonService.sortDescByKey(this.allChannels?.filter((channel) => channel.local_balance && channel.local_balance > 0), 'local_balance')));
this.allChannels.forEach((channel) => { this.allChannels.forEach((channel) => {
this.totalInboundLiquidity = this.totalInboundLiquidity + +channel.remote_balance; this.totalInboundLiquidity = this.totalInboundLiquidity + +(channel.remote_balance || 0);
this.totalOutboundLiquidity = this.totalOutboundLiquidity + +channel.local_balance; this.totalOutboundLiquidity = this.totalOutboundLiquidity + +(channel.local_balance || 0);
}); });
if (this.balances.lightning >= 0 && this.balances.onchain >= 0 && this.fees.month_fee_sum >= 0) { if (this.balances.lightning >= 0 && this.balances.onchain >= 0 && this.fees.month_fee_sum && this.fees.month_fee_sum >= 0) {
this.flgChildInfoUpdated = true; this.flgChildInfoUpdated = true;
} else { } else {
this.flgChildInfoUpdated = false; this.flgChildInfoUpdated = false;
@ -247,8 +247,8 @@ export class HomeComponent implements OnInit, OnDestroy {
if (this.sortField === 'Balance Score') { if (this.sortField === 'Balance Score') {
this.sortField = 'Capacity'; this.sortField = 'Capacity';
this.allChannelsCapacity = this.allChannels.sort((a, b) => { this.allChannelsCapacity = this.allChannels.sort((a, b) => {
const x = +a.local_balance + +a.remote_balance; const x = +(a.local_balance || 0) + +(a.remote_balance || 0);
const y = +b.local_balance + +b.remote_balance; const y = +(b.local_balance || 0) + +(b.remote_balance || 0);
return ((x > y) ? -1 : ((x < y) ? 1 : 0)); return ((x > y) ? -1 : ((x < y) ? 1 : 0));
}); });
} else { } else {

@ -25,22 +25,22 @@ export class NetworkInfoComponent implements OnInit, OnDestroy {
public faBolt = faBolt; public faBolt = faBolt;
public faServer = faServer; public faServer = faServer;
public faNetworkWired = faNetworkWired; public faNetworkWired = faNetworkWired;
public selNode: SelNodeChild = {}; public selNode: SelNodeChild | null = {};
public information: GetInfo = {}; public information: GetInfo = {};
public fees: Fees; public fees: Fees;
public channelsStatus: ChannelsStatus = {}; public channelsStatus: ChannelsStatus = {};
public networkInfo: NetworkInfo = {}; public networkInfo: NetworkInfo = {};
public networkCards = []; public networkCards: any[] = [];
public nodeCards = []; public nodeCards: any[] = [];
public screenSize = ''; public screenSize = '';
public screenSizeEnum = ScreenSizeEnum; public screenSizeEnum = ScreenSizeEnum;
public userPersonaEnum = UserPersonaEnum; public userPersonaEnum = UserPersonaEnum;
public errorMessages = ['', '', '', '', '']; public errorMessages = ['', '', '', '', ''];
public apiCallStatusNodeInfo: ApiCallStatusPayload = null; public apiCallStatusNodeInfo: ApiCallStatusPayload | null = null;
public apiCallStatusNetwork: ApiCallStatusPayload = null; public apiCallStatusNetwork: ApiCallStatusPayload | null = null;
public apiCallStatusFees: ApiCallStatusPayload = null; public apiCallStatusFees: ApiCallStatusPayload | null = null;
public apiCallStatusChannels: ApiCallStatusPayload = null; public apiCallStatusChannels: ApiCallStatusPayload | null = null;
public apiCallStatusPendingChannels: ApiCallStatusPayload = null; public apiCallStatusPendingChannels: ApiCallStatusPayload | null = null;
public apiCallStatusEnum = APICallStatusEnum; public apiCallStatusEnum = APICallStatusEnum;
private unSubs: Array<Subject<void>> = [new Subject(), new Subject(), new Subject(), new Subject(), new Subject(), new Subject(), new Subject()]; private unSubs: Array<Subject<void>> = [new Subject(), new Subject(), new Subject(), new Subject(), new Subject(), new Subject(), new Subject()];
@ -73,11 +73,11 @@ export class NetworkInfoComponent implements OnInit, OnDestroy {
ngOnInit() { ngOnInit() {
this.store.select(nodeInfoAndNodeSettingsAndAPIStatus).pipe(takeUntil(this.unSubs[0])). this.store.select(nodeInfoAndNodeSettingsAndAPIStatus).pipe(takeUntil(this.unSubs[0])).
subscribe((infoSettingsStatusSelector: { information: GetInfo, nodeSettings: SelNodeChild, apiCallStatus: ApiCallStatusPayload }) => { subscribe((infoSettingsStatusSelector: { information: GetInfo, nodeSettings: SelNodeChild | null, apiCallStatus: ApiCallStatusPayload }) => {
this.errorMessages[0] = ''; this.errorMessages[0] = '';
this.apiCallStatusNodeInfo = infoSettingsStatusSelector.apiCallStatus; this.apiCallStatusNodeInfo = infoSettingsStatusSelector.apiCallStatus;
if (this.apiCallStatusNodeInfo.status === APICallStatusEnum.ERROR) { if (this.apiCallStatusNodeInfo.status === APICallStatusEnum.ERROR) {
this.errorMessages[0] = (typeof (this.apiCallStatusNodeInfo.message) === 'object') ? JSON.stringify(this.apiCallStatusNodeInfo.message) : this.apiCallStatusNodeInfo.message; this.errorMessages[0] = (typeof (this.apiCallStatusNodeInfo.message) === 'object') ? JSON.stringify(this.apiCallStatusNodeInfo.message) : this.apiCallStatusNodeInfo.message ? this.apiCallStatusNodeInfo.message : '';
} }
this.selNode = infoSettingsStatusSelector.nodeSettings; this.selNode = infoSettingsStatusSelector.nodeSettings;
this.information = infoSettingsStatusSelector.information; this.information = infoSettingsStatusSelector.information;
@ -87,7 +87,7 @@ export class NetworkInfoComponent implements OnInit, OnDestroy {
this.errorMessages[1] = ''; this.errorMessages[1] = '';
this.apiCallStatusNetwork = networkInfoSelector.apiCallStatus; this.apiCallStatusNetwork = networkInfoSelector.apiCallStatus;
if (this.apiCallStatusNetwork.status === APICallStatusEnum.ERROR) { if (this.apiCallStatusNetwork.status === APICallStatusEnum.ERROR) {
this.errorMessages[1] = (typeof (this.apiCallStatusNetwork.message) === 'object') ? JSON.stringify(this.apiCallStatusNetwork.message) : this.apiCallStatusNetwork.message; this.errorMessages[1] = (typeof (this.apiCallStatusNetwork.message) === 'object') ? JSON.stringify(this.apiCallStatusNetwork.message) : this.apiCallStatusNetwork.message ? this.apiCallStatusNetwork.message : '';
} }
this.networkInfo = networkInfoSelector.networkInfo; this.networkInfo = networkInfoSelector.networkInfo;
}); });
@ -96,7 +96,7 @@ export class NetworkInfoComponent implements OnInit, OnDestroy {
this.errorMessages[2] = ''; this.errorMessages[2] = '';
this.apiCallStatusFees = feesSelector.apiCallStatus; this.apiCallStatusFees = feesSelector.apiCallStatus;
if (this.apiCallStatusFees.status === APICallStatusEnum.ERROR) { if (this.apiCallStatusFees.status === APICallStatusEnum.ERROR) {
this.errorMessages[2] = (typeof (this.apiCallStatusFees.message) === 'object') ? JSON.stringify(this.apiCallStatusFees.message) : this.apiCallStatusFees.message; this.errorMessages[2] = (typeof (this.apiCallStatusFees.message) === 'object') ? JSON.stringify(this.apiCallStatusFees.message) : this.apiCallStatusFees.message ? this.apiCallStatusFees.message : '';
} }
this.fees = feesSelector.fees; this.fees = feesSelector.fees;
}); });
@ -105,11 +105,11 @@ export class NetworkInfoComponent implements OnInit, OnDestroy {
this.errorMessages[4] = ''; this.errorMessages[4] = '';
this.apiCallStatusPendingChannels = pendingChannelsSelector.apiCallStatus; this.apiCallStatusPendingChannels = pendingChannelsSelector.apiCallStatus;
if (this.apiCallStatusPendingChannels.status === APICallStatusEnum.ERROR) { if (this.apiCallStatusPendingChannels.status === APICallStatusEnum.ERROR) {
this.errorMessages[4] = (typeof (this.apiCallStatusPendingChannels.message) === 'object') ? JSON.stringify(this.apiCallStatusPendingChannels.message) : this.apiCallStatusPendingChannels.message; this.errorMessages[4] = (typeof (this.apiCallStatusPendingChannels.message) === 'object') ? JSON.stringify(this.apiCallStatusPendingChannels.message) : this.apiCallStatusPendingChannels.message ? this.apiCallStatusPendingChannels.message : '';
} }
this.channelsStatus.pending = { num_channels: pendingChannelsSelector.pendingChannelsSummary.open.num_channels, capacity: pendingChannelsSelector.pendingChannelsSummary.open.limbo_balance }; this.channelsStatus.pending = { num_channels: pendingChannelsSelector.pendingChannelsSummary.open?.num_channels, capacity: pendingChannelsSelector.pendingChannelsSummary.open?.limbo_balance };
this.channelsStatus.closing = { this.channelsStatus.closing = {
num_channels: pendingChannelsSelector.pendingChannelsSummary.closing.num_channels + pendingChannelsSelector.pendingChannelsSummary.force_closing.num_channels + pendingChannelsSelector.pendingChannelsSummary.waiting_close.num_channels, num_channels: (pendingChannelsSelector.pendingChannelsSummary.closing?.num_channels || 0) + (pendingChannelsSelector.pendingChannelsSummary.force_closing?.num_channels || 0) + (pendingChannelsSelector.pendingChannelsSummary.waiting_close?.num_channels || 0),
capacity: pendingChannelsSelector.pendingChannelsSummary.total_limbo_balance capacity: pendingChannelsSelector.pendingChannelsSummary.total_limbo_balance
}; };
}); });
@ -118,7 +118,7 @@ export class NetworkInfoComponent implements OnInit, OnDestroy {
this.errorMessages[3] = ''; this.errorMessages[3] = '';
this.apiCallStatusChannels = channelsSelector.apiCallStatus; this.apiCallStatusChannels = channelsSelector.apiCallStatus;
if (this.apiCallStatusChannels.status === APICallStatusEnum.ERROR) { if (this.apiCallStatusChannels.status === APICallStatusEnum.ERROR) {
this.errorMessages[3] = (typeof (this.apiCallStatusChannels.message) === 'object') ? JSON.stringify(this.apiCallStatusChannels.message) : this.apiCallStatusChannels.message; this.errorMessages[3] = (typeof (this.apiCallStatusChannels.message) === 'object') ? JSON.stringify(this.apiCallStatusChannels.message) : this.apiCallStatusChannels.message ? this.apiCallStatusChannels.message : '';
} }
this.channelsStatus.active = channelsSelector.channelsSummary.active; this.channelsStatus.active = channelsSelector.channelsSummary.active;
this.channelsStatus.inactive = channelsSelector.channelsSummary.inactive; this.channelsStatus.inactive = channelsSelector.channelsSummary.inactive;

@ -23,7 +23,7 @@ export class OnChainLabelModalComponent implements OnInit, OnDestroy {
@ViewChild('form', { static: true }) form: any; @ViewChild('form', { static: true }) form: any;
public faExclamationTriangle = faExclamationTriangle; public faExclamationTriangle = faExclamationTriangle;
public utxo: UTXO = null; public utxo: UTXO | null = null;
public label = ''; public label = '';
public labelError = ''; public labelError = '';
private unSubs: Array<Subject<void>> = [new Subject(), new Subject(), new Subject(), new Subject(), new Subject()]; private unSubs: Array<Subject<void>> = [new Subject(), new Subject(), new Subject(), new Subject(), new Subject()];
@ -32,7 +32,7 @@ export class OnChainLabelModalComponent implements OnInit, OnDestroy {
ngOnInit() { ngOnInit() {
this.utxo = this.data.utxo; this.utxo = this.data.utxo;
this.label = this.utxo.label; this.label = this.utxo.label || '';
} }
onLabelUTXO(): boolean | void { onLabelUTXO(): boolean | void {
@ -40,7 +40,7 @@ export class OnChainLabelModalComponent implements OnInit, OnDestroy {
return true; return true;
} }
this.labelError = ''; this.labelError = '';
this.dataService.labelUTXO(this.utxo.outpoint.txid_bytes, this.label, true). this.dataService.labelUTXO((this.utxo && this.utxo.outpoint && this.utxo.outpoint.txid_bytes ? this.utxo.outpoint.txid_bytes : ''), this.label, true).
pipe(takeUntil(this.unSubs[0])). pipe(takeUntil(this.unSubs[0])).
subscribe({ subscribe({
next: (res) => { next: (res) => {

@ -36,7 +36,7 @@ export class OnChainSendModalComponent implements OnInit, OnDestroy {
@ViewChild('stepper', { static: false }) stepper: MatStepper; @ViewChild('stepper', { static: false }) stepper: MatStepper;
public faExclamationTriangle = faExclamationTriangle; public faExclamationTriangle = faExclamationTriangle;
public sweepAll = false; public sweepAll = false;
public selNode: SelNodeChild = {}; public selNode: SelNodeChild | null = {};
public appConfig: RTLConfiguration; public appConfig: RTLConfiguration;
public addressTypes = []; public addressTypes = [];
public selectedAddress: AddressType = {}; public selectedAddress: AddressType = {};
@ -44,9 +44,9 @@ export class OnChainSendModalComponent implements OnInit, OnDestroy {
public information: GetInfo = {}; public information: GetInfo = {};
public newAddress = ''; public newAddress = '';
public transactionAddress = ''; public transactionAddress = '';
public transactionAmount = null; public transactionAmount: number | null = null;
public transactionFees = null; public transactionFees: number | null = null;
public transactionBlocks = null; public transactionBlocks: number | null = null;
public transTypes = [{ id: '1', name: 'Target Confirmation Blocks' }, { id: '2', name: 'Fee' }]; public transTypes = [{ id: '1', name: 'Target Confirmation Blocks' }, { id: '2', name: 'Fee' }];
public selTransType = '1'; public selTransType = '1';
public fiatConversion = false; public fiatConversion = false;
@ -167,7 +167,7 @@ export class OnChainSendModalComponent implements OnInit, OnDestroy {
subscribe({ subscribe({
next: (data) => { next: (data) => {
this.selAmountUnit = CurrencyUnitEnum.SATS; this.selAmountUnit = CurrencyUnitEnum.SATS;
postTransaction.amount = +this.decimalPipe.transform(data[this.amountUnits[0]], this.currencyUnitFormats[this.amountUnits[0]])?.replace(/,/g, ''); postTransaction.amount = +(this.decimalPipe.transform(data[this.amountUnits[0]], this.currencyUnitFormats[this.amountUnits[0]])?.replace(/,/g, '') || 0);
this.store.dispatch(setChannelTransaction({ payload: postTransaction })); this.store.dispatch(setChannelTransaction({ payload: postTransaction }));
}, error: (err) => { }, error: (err) => {
this.transactionAmount = null; this.transactionAmount = null;
@ -245,7 +245,7 @@ export class OnChainSendModalComponent implements OnInit, OnDestroy {
subscribe({ subscribe({
next: (data) => { next: (data) => {
this.selAmountUnit = event.value; this.selAmountUnit = event.value;
self.transactionAmount = +self.decimalPipe.transform(data[currSelectedUnit], self.currencyUnitFormats[currSelectedUnit])?.replace(/,/g, ''); self.transactionAmount = +(self.decimalPipe.transform(data[currSelectedUnit], self.currencyUnitFormats[currSelectedUnit])?.replace(/,/g, '') || 0);
}, error: (err) => { }, error: (err) => {
self.transactionAmount = null; self.transactionAmount = null;
this.amountError = 'Conversion Error: ' + err; this.amountError = 'Conversion Error: ' + err;

@ -18,7 +18,7 @@ import { BlockchainBalance } from '../../shared/models/lndModels';
}) })
export class OnChainComponent implements OnInit, OnDestroy { export class OnChainComponent implements OnInit, OnDestroy {
public selNode: SelNodeChild = {}; public selNode: SelNodeChild | null = {};
public faExchangeAlt = faExchangeAlt; public faExchangeAlt = faExchangeAlt;
public faChartPie = faChartPie; public faChartPie = faChartPie;
public balances = [{ title: 'Total Balance', dataValue: 0 }, { title: 'Confirmed', dataValue: 0 }, { title: 'Unconfirmed', dataValue: 0 }]; public balances = [{ title: 'Total Balance', dataValue: 0 }, { title: 'Confirmed', dataValue: 0 }, { title: 'Unconfirmed', dataValue: 0 }];
@ -33,27 +33,27 @@ export class OnChainComponent implements OnInit, OnDestroy {
ngOnInit() { ngOnInit() {
const linkFound = this.links.find((link) => this.router.url.includes(link.link)); const linkFound = this.links.find((link) => this.router.url.includes(link.link));
this.activeLink = linkFound ? linkFound.link : this.links[0].link; this.activeLink = linkFound ? linkFound.link : this.links[0].link;
this.selectedTable = this.tables.find((table) => table.name === this.router.url.substring(this.router.url.lastIndexOf('/') + 1)); this.selectedTable = this.tables.find((table) => table.name === this.router.url.substring(this.router.url.lastIndexOf('/') + 1)) || this.tables[0];
this.router.events.pipe(takeUntil(this.unSubs[0]), filter((e) => e instanceof ResolveEnd)). this.router.events.pipe(takeUntil(this.unSubs[0]), filter((e) => e instanceof ResolveEnd)).
subscribe({ subscribe({
next: (value: ResolveEnd | Event) => { next: (value: ResolveEnd | Event) => {
const linkFound = this.links.find((link) => (<ResolveEnd>value).urlAfterRedirects.includes(link.link)); const linkFound = this.links.find((link) => (<ResolveEnd>value).urlAfterRedirects.includes(link.link));
this.activeLink = linkFound ? linkFound.link : this.links[0].link; this.activeLink = linkFound ? linkFound.link : this.links[0].link;
this.selectedTable = this.tables.find((table) => table.name === (<ResolveEnd>value).urlAfterRedirects.substring((<ResolveEnd>value).urlAfterRedirects.lastIndexOf('/') + 1)); this.selectedTable = this.tables.find((table) => table.name === (<ResolveEnd>value).urlAfterRedirects.substring((<ResolveEnd>value).urlAfterRedirects.lastIndexOf('/') + 1)) || this.tables[0];
} }
}); });
this.store.select(lndNodeSettings).pipe(takeUntil(this.unSubs[1])). this.store.select(lndNodeSettings).pipe(takeUntil(this.unSubs[1])).
subscribe((nodeSettings: SelNodeChild) => { subscribe((nodeSettings: SelNodeChild | null) => {
this.selNode = nodeSettings; this.selNode = nodeSettings;
}); });
this.store.select(blockchainBalance).pipe(takeUntil(this.unSubs[2])). this.store.select(blockchainBalance).pipe(takeUntil(this.unSubs[2])).
subscribe((bcBalanceSelector: { blockchainBalance: BlockchainBalance, apiCallStatus: ApiCallStatusPayload }) => { subscribe((bcBalanceSelector: { blockchainBalance: BlockchainBalance, apiCallStatus: ApiCallStatusPayload }) => {
this.balances = [{ title: 'Total Balance', dataValue: bcBalanceSelector.blockchainBalance.total_balance || 0 }, { title: 'Confirmed', dataValue: bcBalanceSelector.blockchainBalance.confirmed_balance }, { title: 'Unconfirmed', dataValue: bcBalanceSelector.blockchainBalance.unconfirmed_balance }]; this.balances = [{ title: 'Total Balance', dataValue: bcBalanceSelector.blockchainBalance.total_balance || 0 }, { title: 'Confirmed', dataValue: (bcBalanceSelector.blockchainBalance.confirmed_balance || 0) }, { title: 'Unconfirmed', dataValue: (bcBalanceSelector.blockchainBalance.unconfirmed_balance || 0)}];
}); });
} }
onSelectedTableIndexChanged(event: number) { onSelectedTableIndexChanged(event: number) {
this.selectedTable = this.tables.find((table) => table.id === event); this.selectedTable = this.tables.find((table) => table.id === event) || this.tables[0];
this.router.navigate(['./', this.activeLink, this.selectedTable.name], { relativeTo: this.activatedRoute }); this.router.navigate(['./', this.activeLink, this.selectedTable.name], { relativeTo: this.activatedRoute });
} }

@ -117,7 +117,7 @@ export class OnChainTransactionHistoryComponent implements OnInit, OnChanges, On
this.listTransactions.sort = this.sort; this.listTransactions.sort = this.sort;
this.listTransactions.sortingDataAccessor = (data: any, sortHeaderId: string) => ((data[sortHeaderId] && isNaN(data[sortHeaderId])) ? data[sortHeaderId].toLocaleLowerCase() : data[sortHeaderId] ? +data[sortHeaderId] : null); this.listTransactions.sortingDataAccessor = (data: any, sortHeaderId: string) => ((data[sortHeaderId] && isNaN(data[sortHeaderId])) ? data[sortHeaderId].toLocaleLowerCase() : data[sortHeaderId] ? +data[sortHeaderId] : null);
this.listTransactions.filterPredicate = (rowData: Transaction, fltr: string) => { this.listTransactions.filterPredicate = (rowData: Transaction, fltr: string) => {
const newRowData = ((rowData.time_stamp) ? this.datePipe.transform(new Date(rowData.time_stamp * 1000), 'dd/MMM/YYYY HH:mm').toLowerCase() : '') + JSON.stringify(rowData).toLowerCase(); const newRowData = ((rowData.time_stamp) ? this.datePipe.transform(new Date(rowData.time_stamp * 1000), 'dd/MMM/YYYY HH:mm')?.toLowerCase() : '') + JSON.stringify(rowData).toLowerCase();
return newRowData.includes(fltr); return newRowData.includes(fltr);
}; };
this.listTransactions.paginator = this.paginator; this.listTransactions.paginator = this.paginator;

@ -34,7 +34,7 @@ export class UTXOTablesComponent implements OnInit, OnDestroy {
subscribe((utxosSelector: { utxos: UTXO[], apiCallStatus: ApiCallStatusPayload }) => { subscribe((utxosSelector: { utxos: UTXO[], apiCallStatus: ApiCallStatusPayload }) => {
if (utxosSelector.utxos && utxosSelector.utxos.length > 0) { if (utxosSelector.utxos && utxosSelector.utxos.length > 0) {
this.numUtxos = utxosSelector.utxos.length; this.numUtxos = utxosSelector.utxos.length;
this.numDustUtxos = utxosSelector.utxos?.filter((utxo) => +utxo.amount_sat < 1000).length; this.numDustUtxos = utxosSelector.utxos?.filter((utxo) => utxo.amount_sat && +utxo.amount_sat < 1000).length;
} }
this.logger.info(utxosSelector); this.logger.info(utxosSelector);
}); });

@ -77,7 +77,7 @@ export class OnChainUTXOsComponent implements OnInit, OnChanges, OnDestroy {
this.errorMessage = !this.apiCallStatus.message ? '' : (typeof (this.apiCallStatus.message) === 'object') ? JSON.stringify(this.apiCallStatus.message) : this.apiCallStatus.message; this.errorMessage = !this.apiCallStatus.message ? '' : (typeof (this.apiCallStatus.message) === 'object') ? JSON.stringify(this.apiCallStatus.message) : this.apiCallStatus.message;
} }
if (utxosSelector.utxos && utxosSelector.utxos.length > 0) { if (utxosSelector.utxos && utxosSelector.utxos.length > 0) {
this.dustUtxos = utxosSelector.utxos?.filter((utxo) => +utxo.amount_sat < 1000); this.dustUtxos = utxosSelector.utxos?.filter((utxo) => +(utxo.amount_sat || 0) < 1000);
this.utxos = utxosSelector.utxos; this.utxos = utxosSelector.utxos;
this.loadUTXOsTable((this.isDustUTXO) ? this.dustUtxos : this.utxos); this.loadUTXOsTable((this.isDustUTXO) ? this.dustUtxos : this.utxos);
} }
@ -100,12 +100,12 @@ export class OnChainUTXOsComponent implements OnInit, OnChanges, OnDestroy {
onUTXOClick(selUTXO: UTXO) { onUTXOClick(selUTXO: UTXO) {
const reorderedUTXOs = [ const reorderedUTXOs = [
[{ key: 'txid', value: selUTXO.outpoint.txid_str, title: 'Transaction ID', width: 100, type: DataTypeEnum.STRING }], [{ key: 'txid', value: selUTXO.outpoint?.txid_str, title: 'Transaction ID', width: 100, type: DataTypeEnum.STRING }],
[{ key: 'label', value: selUTXO.label, title: 'Label', width: 100, type: DataTypeEnum.STRING }], [{ key: 'label', value: selUTXO.label, title: 'Label', width: 100, type: DataTypeEnum.STRING }],
[{ key: 'output_index', value: selUTXO.outpoint.output_index, title: 'Output Index', width: 34, type: DataTypeEnum.NUMBER }, [{ key: 'output_index', value: selUTXO.outpoint?.output_index, title: 'Output Index', width: 34, type: DataTypeEnum.NUMBER },
{ key: 'amount_sat', value: selUTXO.amount_sat, title: 'Amount (Sats)', width: 33, type: DataTypeEnum.NUMBER }, { key: 'amount_sat', value: selUTXO.amount_sat, title: 'Amount (Sats)', width: 33, type: DataTypeEnum.NUMBER },
{ key: 'confirmations', value: selUTXO.confirmations, title: 'Confirmations', width: 33, type: DataTypeEnum.NUMBER }], { key: 'confirmations', value: selUTXO.confirmations, title: 'Confirmations', width: 33, type: DataTypeEnum.NUMBER }],
[{ key: 'address_type', value: this.addressType[selUTXO.address_type].name, title: 'Address Type', width: 34 }, [{ key: 'address_type', value: (selUTXO.address_type ? this.addressType[selUTXO.address_type].name : ''), title: 'Address Type', width: 34 },
{ key: 'address', value: selUTXO.address, title: 'Address', width: 66 }], { key: 'address', value: selUTXO.address, title: 'Address', width: 66 }],
[{ key: 'pk_script', value: selUTXO.pk_script, title: 'PK Script', width: 100, type: DataTypeEnum.STRING }] [{ key: 'pk_script', value: selUTXO.pk_script, title: 'PK Script', width: 100, type: DataTypeEnum.STRING }]
]; ];
@ -123,8 +123,8 @@ export class OnChainUTXOsComponent implements OnInit, OnChanges, OnDestroy {
loadUTXOsTable(UTXOs: UTXO[]) { loadUTXOsTable(UTXOs: UTXO[]) {
this.listUTXOs = new MatTableDataSource<UTXO>([...UTXOs]); this.listUTXOs = new MatTableDataSource<UTXO>([...UTXOs]);
this.listUTXOs.filterPredicate = (utxo: UTXO, fltr: string) => { this.listUTXOs.filterPredicate = (utxo: UTXO, fltr: string) => {
const newUTXO = ((utxo.label ? utxo.label.toLowerCase() : '') + (utxo.outpoint.txid_str ? utxo.outpoint.txid_str.toLowerCase() : '') + (utxo.outpoint.output_index ? utxo.outpoint.output_index : '') + const newUTXO = ((utxo.label ? utxo.label.toLowerCase() : '') + (utxo.outpoint?.txid_str ? utxo.outpoint.txid_str.toLowerCase() : '') + (utxo.outpoint?.output_index ? utxo.outpoint?.output_index : '') +
(utxo.outpoint.txid_bytes ? utxo.outpoint.txid_bytes.toLowerCase() : '') + (utxo.address ? utxo.address.toLowerCase() : '') + (utxo.address_type ? utxo.address_type.toLowerCase() : '') + (utxo.outpoint?.txid_bytes ? utxo.outpoint?.txid_bytes.toLowerCase() : '') + (utxo.address ? utxo.address.toLowerCase() : '') + (utxo.address_type ? utxo.address_type.toLowerCase() : '') +
(utxo.amount_sat ? utxo.amount_sat : '') + (utxo.confirmations ? utxo.confirmations : '') + (utxo.pk_script ? utxo.pk_script.toLowerCase() : '')); (utxo.amount_sat ? utxo.amount_sat : '') + (utxo.confirmations ? utxo.confirmations : '') + (utxo.pk_script ? utxo.pk_script.toLowerCase() : ''));
return newUTXO.includes(fltr); return newUTXO.includes(fltr);
}; };
@ -155,7 +155,7 @@ export class OnChainUTXOsComponent implements OnInit, OnChanges, OnDestroy {
onLeaseUTXO(utxo: UTXO) { onLeaseUTXO(utxo: UTXO) {
const utxoDetails = [ const utxoDetails = [
[{ key: 'txid_str', value: utxo.outpoint.txid_str, title: 'Transaction ID', width: 100 }], [{ key: 'txid_str', value: utxo.outpoint?.txid_str, title: 'Transaction ID', width: 100 }],
[{ key: 'amount_sat', value: this.decimalPipe.transform(utxo.amount_sat), title: 'Amount (Sats)', width: 100 }] [{ key: 'amount_sat', value: this.decimalPipe.transform(utxo.amount_sat), title: 'Amount (Sats)', width: 100 }]
]; ];
if (utxo.label) { if (utxo.label) {
@ -177,7 +177,7 @@ export class OnChainUTXOsComponent implements OnInit, OnChanges, OnDestroy {
pipe(takeUntil(this.unSubs[0])). pipe(takeUntil(this.unSubs[0])).
subscribe((confirmRes) => { subscribe((confirmRes) => {
if (confirmRes) { if (confirmRes) {
this.dataService.leaseUTXO(utxo.outpoint.txid_bytes, utxo.outpoint.output_index); this.dataService.leaseUTXO((utxo.outpoint?.txid_bytes || ''), (utxo.outpoint?.output_index || 0));
} }
}); });
} }

@ -28,9 +28,9 @@ export class BumpFeeComponent implements OnInit, OnDestroy {
public bumpFeeChannel: PendingOpenChannel; public bumpFeeChannel: PendingOpenChannel;
public transTypes = [...TRANS_TYPES]; public transTypes = [...TRANS_TYPES];
public selTransType = '2'; public selTransType = '2';
public blocks = null; public blocks: number | null = null;
public fees = null; public fees: number | null = null;
public outputIndex = null; public outputIndex: number | null = null;
public faCopy = faCopy; public faCopy = faCopy;
public faInfoCircle = faInfoCircle; public faInfoCircle = faInfoCircle;
public faExclamationTriangle = faExclamationTriangle; public faExclamationTriangle = faExclamationTriangle;
@ -42,20 +42,22 @@ export class BumpFeeComponent implements OnInit, OnDestroy {
ngOnInit() { ngOnInit() {
this.transTypes = this.transTypes.splice(1); this.transTypes = this.transTypes.splice(1);
this.bumpFeeChannel = this.data.pendingChannel; this.bumpFeeChannel = this.data.pendingChannel;
const channelPointArr = this.bumpFeeChannel.channel.channel_point.split(':') || []; const channelPointArr = this.bumpFeeChannel.channel?.channel_point?.split(':') || [];
this.bumpFeeChannel.channel.txid_str = channelPointArr[0] || (this.bumpFeeChannel.channel && this.bumpFeeChannel.channel.channel_point ? this.bumpFeeChannel.channel.channel_point : ''); if (this.bumpFeeChannel && this.bumpFeeChannel.channel) {
this.bumpFeeChannel.channel.output_index = +channelPointArr[1] || null; this.bumpFeeChannel.channel.txid_str = channelPointArr[0] || (this.bumpFeeChannel.channel && this.bumpFeeChannel.channel.channel_point ? this.bumpFeeChannel.channel.channel_point : '');
this.bumpFeeChannel.channel.output_index = +channelPointArr[1] || null;
}
} }
onBumpFee(): boolean | void { onBumpFee(): boolean | void {
if (this.outputIndex === this.bumpFeeChannel.channel.output_index) { if (this.outputIndex === this.bumpFeeChannel.channel?.output_index) {
this.outputIdx.control.setErrors({ pendingChannelOutputIndex: true }); this.outputIdx.control.setErrors({ pendingChannelOutputIndex: true });
return true; return true;
} }
if ((!this.outputIndex && this.outputIndex !== 0) || (this.selTransType === '1' && (!this.blocks || this.blocks === 0)) || (this.selTransType === '2' && (!this.fees || this.fees === 0))) { if ((!this.outputIndex && this.outputIndex !== 0) || (this.selTransType === '1' && (!this.blocks || this.blocks === 0)) || (this.selTransType === '2' && (!this.fees || this.fees === 0))) {
return true; return true;
} }
this.dataService.bumpFee(this.bumpFeeChannel.channel.txid_str, this.outputIndex, this.blocks, this.fees).pipe(takeUntil(this.unSubs[0])). this.dataService.bumpFee((this.bumpFeeChannel && this.bumpFeeChannel.channel && this.bumpFeeChannel.channel.txid_str ? this.bumpFeeChannel.channel.txid_str : ''), this.outputIndex, (this.blocks || null), (this.fees || null)).pipe(takeUntil(this.unSubs[0])).
subscribe({ subscribe({
next: (res) => { next: (res) => {
this.dialogRef.close(false); this.dialogRef.close(false);

@ -28,7 +28,7 @@ export class ChannelInformationComponent implements OnInit {
ngOnInit() { ngOnInit() {
this.channel = this.data.channel; this.channel = this.data.channel;
this.showCopy = this.data.showCopy; this.showCopy = !!this.data.showCopy;
this.screenSize = this.commonService.getScreenSize(); this.screenSize = this.commonService.getScreenSize();
} }

@ -33,10 +33,10 @@ export class ChannelRebalanceComponent implements OnInit, OnDestroy {
public faInfoCircle = faInfoCircle; public faInfoCircle = faInfoCircle;
public invoices: ListInvoices = {}; public invoices: ListInvoices = {};
public selChannel: Channel = {}; public selChannel: Channel = {};
public activeChannels = []; public activeChannels: Channel[] = [];
public filteredActiveChannels: Observable<Channel[]>; public filteredActiveChannels: Observable<Channel[]>;
public feeLimitTypes = []; public feeLimitTypes: any[] = [];
public queryRoute: QueryRoutes = {}; public queryRoute: QueryRoutes | null = {};
public paymentRequest = ''; public paymentRequest = '';
public paymentStatus: any = null; public paymentStatus: any = null;
public flgReusingInvoice = false; public flgReusingInvoice = false;
@ -61,11 +61,11 @@ export class ChannelRebalanceComponent implements OnInit, OnDestroy {
this.screenSize = this.commonService.getScreenSize(); this.screenSize = this.commonService.getScreenSize();
let x = ''; let x = '';
let y = ''; let y = '';
this.selChannel = this.data.message.selChannel; this.selChannel = this.data.message?.selChannel || {};
this.activeChannels = this.data.message.channels?.filter((channel) => channel.active && channel.chan_id !== this.selChannel.chan_id && channel.remote_balance > 0); this.activeChannels = this.data.message?.channels?.filter((channel) => channel.active && channel.chan_id !== this.selChannel.chan_id && channel.remote_balance && channel.remote_balance > 0) || [];
this.activeChannels = this.activeChannels.sort((c1: Channel, c2: Channel) => { this.activeChannels = this.activeChannels.sort((c1: Channel, c2: Channel) => {
x = c1.remote_alias ? c1.remote_alias.toLowerCase() : c1.chan_id ? c1.chan_id.toLowerCase() : ''; x = c1.remote_alias ? c1.remote_alias.toLowerCase() : c1.chan_id ? c1.chan_id.toLowerCase() : '';
y = c2.remote_alias ? c2.remote_alias.toLowerCase() : c1.chan_id.toLowerCase(); y = c2.remote_alias ? c2.remote_alias.toLowerCase() : c1.chan_id ? c1.chan_id.toLowerCase() : '';
return ((x < y) ? -1 : ((x > y) ? 1 : 0)); return ((x < y) ? -1 : ((x > y) ? 1 : 0));
}); });
FEE_LIMIT_TYPES.forEach((FEE_LIMIT_TYPE, i) => { FEE_LIMIT_TYPES.forEach((FEE_LIMIT_TYPE, i) => {
@ -77,7 +77,7 @@ export class ChannelRebalanceComponent implements OnInit, OnDestroy {
// User should be able to go to next step only by clicking the action button on the step. // User should be able to go to next step only by clicking the action button on the step.
this.inputFormGroup = this.formBuilder.group({ this.inputFormGroup = this.formBuilder.group({
hiddenAmount: ['', [Validators.required]], hiddenAmount: ['', [Validators.required]],
rebalanceAmount: ['', [Validators.required, Validators.min(1), Validators.max(this.selChannel.local_balance)]], rebalanceAmount: ['', [Validators.required, Validators.min(1), Validators.max(this.selChannel.local_balance || 0)]],
selRebalancePeer: [null, Validators.required] selRebalancePeer: [null, Validators.required]
}); });
this.feeFormGroup = this.formBuilder.group({ this.feeFormGroup = this.formBuilder.group({
@ -110,14 +110,14 @@ export class ChannelRebalanceComponent implements OnInit, OnDestroy {
this.sendPayment(action.payload.paymentRequest); this.sendPayment(action.payload.paymentRequest);
} }
}); });
this.inputFormGroup.get('rebalanceAmount').valueChanges.pipe( this.inputFormGroup.get('rebalanceAmount')?.valueChanges.pipe(
takeUntil(this.unSubs[2]), startWith(0)). takeUntil(this.unSubs[2]), startWith(0)).
subscribe((amount) => { subscribe((amount) => {
this.inputFormGroup.controls.selRebalancePeer.setValue(''); this.inputFormGroup.controls.selRebalancePeer.setValue('');
this.inputFormGroup.controls.selRebalancePeer.setErrors(null); this.inputFormGroup.controls.selRebalancePeer.setErrors(null);
this.filteredActiveChannels = of(amount ? this.filterActiveChannels() : this.activeChannels.slice()); this.filteredActiveChannels = of(amount ? this.filterActiveChannels() : this.activeChannels.slice());
}); });
this.inputFormGroup.get('selRebalancePeer').valueChanges.pipe( this.inputFormGroup.get('selRebalancePeer')?.valueChanges.pipe(
takeUntil(this.unSubs[3]), startWith('')). takeUntil(this.unSubs[3]), startWith('')).
subscribe((alias) => { subscribe((alias) => {
if (typeof alias === 'string') { if (typeof alias === 'string') {
@ -171,7 +171,7 @@ export class ChannelRebalanceComponent implements OnInit, OnDestroy {
this.inputFormLabel = 'Amount to rebalance'; this.inputFormLabel = 'Amount to rebalance';
} }
if (this.queryRoute && this.queryRoute.routes && this.queryRoute.routes.length > 0 && (this.queryRoute.routes[0].total_fees_msat || (this.queryRoute.routes[0].hops && this.queryRoute.routes[0].hops.length))) { if (this.queryRoute && this.queryRoute.routes && this.queryRoute.routes.length > 0 && (this.queryRoute.routes[0].total_fees_msat || (this.queryRoute.routes[0].hops && this.queryRoute.routes[0].hops.length))) {
this.feeFormLabel = this.feeFormGroup.controls.selFeeLimitType.value.placeholder + ': ' + this.decimalPipe.transform(this.feeFormGroup.controls.feeLimit.value ? this.feeFormGroup.controls.feeLimit.value : 0) + ' | Hops: ' + this.queryRoute.routes[0].hops.length; this.feeFormLabel = this.feeFormGroup.controls.selFeeLimitType.value.placeholder + ': ' + this.decimalPipe.transform(this.feeFormGroup.controls.feeLimit.value ? this.feeFormGroup.controls.feeLimit.value : 0) + ' | Hops: ' + this.queryRoute.routes[0].hops?.length;
} else { } else {
this.feeFormLabel = 'Select rebalance fee'; this.feeFormLabel = 'Select rebalance fee';
} }
@ -192,7 +192,7 @@ export class ChannelRebalanceComponent implements OnInit, OnDestroy {
} }
onRebalance(): boolean | void { onRebalance(): boolean | void {
if (!this.inputFormGroup.controls.rebalanceAmount.value || this.inputFormGroup.controls.rebalanceAmount.value <= 0 || this.inputFormGroup.controls.rebalanceAmount.value > +this.selChannel.local_balance || !this.feeFormGroup.controls.feeLimit.value || this.feeFormGroup.controls.feeLimit.value < 0 || !this.inputFormGroup.controls.selRebalancePeer.value.remote_pubkey) { if (!this.inputFormGroup.controls.rebalanceAmount.value || this.inputFormGroup.controls.rebalanceAmount.value <= 0 || (this.selChannel.local_balance && this.inputFormGroup.controls.rebalanceAmount.value > +this.selChannel.local_balance) || !this.feeFormGroup.controls.feeLimit.value || this.feeFormGroup.controls.feeLimit.value < 0 || !this.inputFormGroup.controls.selRebalancePeer.value.remote_pubkey) {
return true; return true;
} }
this.feeFormGroup.controls.hiddenFeeLimit.setValue(this.feeFormGroup.controls.feeLimit.value); this.feeFormGroup.controls.hiddenFeeLimit.setValue(this.feeFormGroup.controls.feeLimit.value);
@ -206,7 +206,7 @@ export class ChannelRebalanceComponent implements OnInit, OnDestroy {
const unsettledInvoice = this.findUnsettledInvoice(); const unsettledInvoice = this.findUnsettledInvoice();
if (unsettledInvoice) { if (unsettledInvoice) {
this.flgReusingInvoice = true; this.flgReusingInvoice = true;
this.sendPayment(unsettledInvoice.payment_request); this.sendPayment(unsettledInvoice.payment_request || '');
} else { } else {
this.store.dispatch(saveNewInvoice({ this.store.dispatch(saveNewInvoice({
payload: { payload: {
@ -217,7 +217,7 @@ export class ChannelRebalanceComponent implements OnInit, OnDestroy {
} }
findUnsettledInvoice() { findUnsettledInvoice() {
return this.invoices.invoices.find((invoice) => (+invoice.settle_date === 0 || !invoice.settle_date) && invoice.memo === 'Local-Rebalance-' + this.inputFormGroup.controls.rebalanceAmount.value + '-Sats' && invoice.state !== 'CANCELED'); return this.invoices.invoices?.find((invoice) => (!invoice.settle_date || +invoice.settle_date === 0) && invoice.memo === 'Local-Rebalance-' + this.inputFormGroup.controls.rebalanceAmount.value + '-Sats' && invoice.state !== 'CANCELED');
} }
sendPayment(payReq: string) { sendPayment(payReq: string) {
@ -231,13 +231,13 @@ export class ChannelRebalanceComponent implements OnInit, OnDestroy {
} }
filterActiveChannels() { filterActiveChannels() {
return this.activeChannels?.filter((channel) => channel.remote_balance >= this.inputFormGroup.controls.rebalanceAmount.value && return this.activeChannels?.filter((channel) => channel.remote_balance && channel.remote_balance >= this.inputFormGroup.controls.rebalanceAmount.value &&
channel.chan_id !== this.selChannel.chan_id && ((channel.remote_alias.toLowerCase().indexOf(this.inputFormGroup.controls.selRebalancePeer.value ? this.inputFormGroup.controls.selRebalancePeer.value.toLowerCase() : '') === 0) || (channel.chan_id.toLowerCase().indexOf(this.inputFormGroup.controls.selRebalancePeer.value ? this.inputFormGroup.controls.selRebalancePeer.value.toLowerCase() : '') === 0))); channel.chan_id !== this.selChannel.chan_id && ((channel.remote_alias?.toLowerCase().indexOf(this.inputFormGroup.controls.selRebalancePeer.value ? this.inputFormGroup.controls.selRebalancePeer.value.toLowerCase() : '') === 0) || (channel.chan_id?.toLowerCase().indexOf(this.inputFormGroup.controls.selRebalancePeer.value ? this.inputFormGroup.controls.selRebalancePeer.value.toLowerCase() : '') === 0)));
} }
onSelectedPeerChanged() { onSelectedPeerChanged() {
if (this.inputFormGroup.controls.selRebalancePeer.value && this.inputFormGroup.controls.selRebalancePeer.value.length > 0 && typeof this.inputFormGroup.controls.selRebalancePeer.value === 'string') { if (this.inputFormGroup.controls.selRebalancePeer.value && this.inputFormGroup.controls.selRebalancePeer.value.length > 0 && typeof this.inputFormGroup.controls.selRebalancePeer.value === 'string') {
const foundChannels = this.activeChannels?.filter((channel) => channel.remote_alias.length === this.inputFormGroup.controls.selRebalancePeer.value.length && channel.remote_alias.toLowerCase().indexOf(this.inputFormGroup.controls.selRebalancePeer.value ? this.inputFormGroup.controls.selRebalancePeer.value.toLowerCase() : '') === 0); const foundChannels = this.activeChannels?.filter((channel) => channel.remote_alias?.length === this.inputFormGroup.controls.selRebalancePeer.value.length && channel.remote_alias?.toLowerCase().indexOf(this.inputFormGroup.controls.selRebalancePeer.value ? this.inputFormGroup.controls.selRebalancePeer.value.toLowerCase() : '') === 0);
if (foundChannels && foundChannels.length > 0) { if (foundChannels && foundChannels.length > 0) {
this.inputFormGroup.controls.selRebalancePeer.setValue(foundChannels[0]); this.inputFormGroup.controls.selRebalancePeer.setValue(foundChannels[0]);
this.inputFormGroup.controls.selRebalancePeer.setErrors(null); this.inputFormGroup.controls.selRebalancePeer.setErrors(null);

@ -120,19 +120,19 @@ export class ChannelActiveHTLCsTableComponent implements OnInit, AfterViewInit,
this.channels.sortingDataAccessor = (data: any, sortHeaderId: string) => { this.channels.sortingDataAccessor = (data: any, sortHeaderId: string) => {
switch (sortHeaderId) { switch (sortHeaderId) {
case 'amount': case 'amount':
this.commonService.sortByKey(data.pending_htlcs, sortHeaderId, 'number', this.sort.direction); this.commonService.sortByKey(data.pending_htlcs, sortHeaderId, 'number', this.sort?.direction);
return data.pending_htlcs && data.pending_htlcs.length ? data.pending_htlcs.length : null; return data.pending_htlcs && data.pending_htlcs.length ? data.pending_htlcs.length : null;
case 'incoming': case 'incoming':
this.commonService.sortByKey(data.pending_htlcs, sortHeaderId, 'boolean', this.sort.direction); this.commonService.sortByKey(data.pending_htlcs, sortHeaderId, 'boolean', this.sort?.direction);
return data.remote_alias ? data.remote_alias : data.remote_pubkey ? data.remote_pubkey : null; return data.remote_alias ? data.remote_alias : data.remote_pubkey ? data.remote_pubkey : null;
case 'expiration_height': case 'expiration_height':
this.commonService.sortByKey(data.pending_htlcs, sortHeaderId, 'number', this.sort.direction); this.commonService.sortByKey(data.pending_htlcs, sortHeaderId, 'number', this.sort?.direction);
return data; return data;
case 'hash_lock': case 'hash_lock':
this.commonService.sortByKey(data.pending_htlcs, sortHeaderId, 'number', this.sort.direction); this.commonService.sortByKey(data.pending_htlcs, sortHeaderId, 'number', this.sort?.direction);
return data; return data;
default: default:

@ -42,7 +42,7 @@ export class ChannelOpenTableComponent implements OnInit, AfterViewInit, OnDestr
@ViewChild(MatPaginator, { static: false }) paginator: MatPaginator | undefined; @ViewChild(MatPaginator, { static: false }) paginator: MatPaginator | undefined;
public timeUnit = 'mins:secs'; public timeUnit = 'mins:secs';
public userPersonaEnum = UserPersonaEnum; public userPersonaEnum = UserPersonaEnum;
public selNode: SelNodeChild = {}; public selNode: SelNodeChild | null = {};
public totalBalance = 0; public totalBalance = 0;
public displayedColumns: any[] = []; public displayedColumns: any[] = [];
public channelsData: Channel[] = []; public channelsData: Channel[] = [];

@ -25,7 +25,7 @@ import { lndNodeInformation, lndNodeSettings, pendingChannels } from '../../../.
export class ChannelPendingTableComponent implements OnInit, AfterViewInit, OnDestroy { export class ChannelPendingTableComponent implements OnInit, AfterViewInit, OnDestroy {
@ViewChild(MatSort, { static: false }) sort: MatSort | undefined; @ViewChild(MatSort, { static: false }) sort: MatSort | undefined;
public selNode: SelNodeChild = {}; public selNode: SelNodeChild | null = {};
public selectedFilter = ''; public selectedFilter = '';
public information: GetInfo = {}; public information: GetInfo = {};
public pendingChannels: PendingChannels = {}; public pendingChannels: PendingChannels = {};
@ -69,7 +69,7 @@ export class ChannelPendingTableComponent implements OnInit, AfterViewInit, OnDe
} }
ngOnInit() { ngOnInit() {
this.store.select(lndNodeSettings).pipe(takeUntil(this.unSubs[0])).subscribe((nodeSettings: SelNodeChild) => { this.selNode = nodeSettings; }); this.store.select(lndNodeSettings).pipe(takeUntil(this.unSubs[0])).subscribe((nodeSettings: SelNodeChild | null) => { this.selNode = nodeSettings; });
this.store.select(lndNodeInformation).pipe(takeUntil(this.unSubs[1])).subscribe((nodeInfo: GetInfo) => { this.information = nodeInfo; }); this.store.select(lndNodeInformation).pipe(takeUntil(this.unSubs[1])).subscribe((nodeInfo: GetInfo) => { this.information = nodeInfo; });
this.store.select(pendingChannels).pipe(takeUntil(this.unSubs[0])). this.store.select(pendingChannels).pipe(takeUntil(this.unSubs[0])).
subscribe((pendingChannelsSelector: { pendingChannels: PendingChannels, apiCallStatus: ApiCallStatusPayload }) => { subscribe((pendingChannelsSelector: { pendingChannels: PendingChannels, apiCallStatus: ApiCallStatusPayload }) => {

@ -58,14 +58,14 @@ export class ChannelsTablesComponent implements OnInit, OnDestroy {
}); });
this.store.select(blockchainBalance).pipe(takeUntil(this.unSubs[5])). this.store.select(blockchainBalance).pipe(takeUntil(this.unSubs[5])).
subscribe((bcBalanceSelector: { blockchainBalance: BlockchainBalance, apiCallStatus: ApiCallStatusPayload }) => { subscribe((bcBalanceSelector: { blockchainBalance: BlockchainBalance, apiCallStatus: ApiCallStatusPayload }) => {
this.totalBalance = +bcBalanceSelector.blockchainBalance.total_balance; this.totalBalance = +(bcBalanceSelector.blockchainBalance.total_balance || 0);
}); });
this.store.select(peers).pipe(takeUntil(this.unSubs[6])). this.store.select(peers).pipe(takeUntil(this.unSubs[6])).
subscribe((peersSelector: { peers: Peer[], apiCallStatus: ApiCallStatusPayload }) => { subscribe((peersSelector: { peers: Peer[], apiCallStatus: ApiCallStatusPayload }) => {
this.peers = peersSelector.peers; this.peers = peersSelector.peers;
this.peers.forEach((peer) => { this.peers.forEach((peer) => {
if (!peer.alias || peer.alias === '') { if (!peer.alias || peer.alias === '') {
peer.alias = peer.pub_key.substring(0, 15) + '...'; peer.alias = peer.pub_key?.substring(0, 15) + '...';
} }
}); });
this.logger.info(peersSelector); this.logger.info(peersSelector);

@ -26,7 +26,7 @@ export class OpenChannelComponent implements OnInit, OnDestroy {
public amount = new FormControl(); public amount = new FormControl();
public faExclamationTriangle = faExclamationTriangle; public faExclamationTriangle = faExclamationTriangle;
public alertTitle: string; public alertTitle: string;
public peer: Peer; public peer: Peer | null;
public peers: Peer[]; public peers: Peer[];
public sortedPeers: Peer[]; public sortedPeers: Peer[];
public filteredPeers: Observable<Peer[]>; public filteredPeers: Observable<Peer[]>;
@ -34,7 +34,7 @@ export class OpenChannelComponent implements OnInit, OnDestroy {
public advancedTitle = 'Advanced Options'; public advancedTitle = 'Advanced Options';
public information: GetInfo; public information: GetInfo;
public totalBalance = 0; public totalBalance = 0;
public fundingAmount: number; public fundingAmount: number | null;
public selectedPubkey = ''; public selectedPubkey = '';
public isPrivate = false; public isPrivate = false;
public selTransType = '0'; public selTransType = '0';
@ -46,11 +46,18 @@ export class OpenChannelComponent implements OnInit, OnDestroy {
constructor(public dialogRef: MatDialogRef<OpenChannelComponent>, @Inject(MAT_DIALOG_DATA) public data: OpenChannelAlert, private store: Store<RTLState>, private actions: Actions) { } constructor(public dialogRef: MatDialogRef<OpenChannelComponent>, @Inject(MAT_DIALOG_DATA) public data: OpenChannelAlert, private store: Store<RTLState>, private actions: Actions) { }
ngOnInit() { ngOnInit() {
this.information = this.data.message.information; if (this.data.message) {
this.totalBalance = this.data.message.balance; this.information = this.data.message.information;
this.alertTitle = this.data.alertTitle; this.totalBalance = this.data.message.balance;
this.peer = this.data.message.peer || null; this.peer = this.data.message.peer || null;
this.peers = this.data.message.peers || []; this.peers = this.data.message.peers || [];
} else {
this.information = {};
this.totalBalance = 0;
this.peer = null;
this.peers = [];
}
this.alertTitle = this.data.alertTitle || 'Alert';
this.actions.pipe( this.actions.pipe(
takeUntil(this.unSubs[0]), takeUntil(this.unSubs[0]),
filter((action) => action.type === LNDActions.UPDATE_API_CALL_STATUS_LND || action.type === LNDActions.FETCH_CHANNELS_LND)). filter((action) => action.type === LNDActions.UPDATE_API_CALL_STATUS_LND || action.type === LNDActions.FETCH_CHANNELS_LND)).
@ -66,7 +73,7 @@ export class OpenChannelComponent implements OnInit, OnDestroy {
let y = ''; let y = '';
this.sortedPeers = this.peers.sort((p1, p2) => { this.sortedPeers = this.peers.sort((p1, p2) => {
x = p1.alias ? p1.alias.toLowerCase() : p1.pub_key ? p1.pub_key.toLowerCase() : ''; x = p1.alias ? p1.alias.toLowerCase() : p1.pub_key ? p1.pub_key.toLowerCase() : '';
y = p2.alias ? p2.alias.toLowerCase() : p1.pub_key.toLowerCase(); y = p2.alias ? p2.alias.toLowerCase() : p1.pub_key ? p1.pub_key.toLowerCase() : '';
return ((x < y) ? -1 : ((x > y) ? 1 : 0)); return ((x < y) ? -1 : ((x > y) ? 1 : 0));
}); });
this.filteredPeers = this.selectedPeer.valueChanges.pipe( this.filteredPeers = this.selectedPeer.valueChanges.pipe(
@ -77,7 +84,7 @@ export class OpenChannelComponent implements OnInit, OnDestroy {
} }
private filterPeers(newlySelectedPeer: string): Peer[] { private filterPeers(newlySelectedPeer: string): Peer[] {
return this.sortedPeers?.filter((peer) => peer.alias.toLowerCase().indexOf(newlySelectedPeer ? newlySelectedPeer.toLowerCase() : '') === 0); return this.sortedPeers?.filter((peer) => peer.alias?.toLowerCase().indexOf(newlySelectedPeer ? newlySelectedPeer.toLowerCase() : '') === 0);
} }
displayFn(peer: Peer): string { displayFn(peer: Peer): string {
@ -88,7 +95,7 @@ export class OpenChannelComponent implements OnInit, OnDestroy {
this.channelConnectionError = ''; this.channelConnectionError = '';
this.selectedPubkey = (this.selectedPeer.value && this.selectedPeer.value.pub_key) ? this.selectedPeer.value.pub_key : null; this.selectedPubkey = (this.selectedPeer.value && this.selectedPeer.value.pub_key) ? this.selectedPeer.value.pub_key : null;
if (typeof this.selectedPeer.value === 'string') { if (typeof this.selectedPeer.value === 'string') {
const selPeer = this.peers?.filter((peer) => peer.alias.length === this.selectedPeer.value.length && peer.alias.toLowerCase().indexOf(this.selectedPeer.value ? this.selectedPeer.value.toLowerCase() : '') === 0); const selPeer = this.peers?.filter((peer) => peer.alias?.length === this.selectedPeer.value.length && peer.alias?.toLowerCase().indexOf(this.selectedPeer.value ? this.selectedPeer.value.toLowerCase() : '') === 0);
if (selPeer.length === 1 && selPeer[0].pub_key) { if (selPeer.length === 1 && selPeer[0].pub_key) {
this.selectedPubkey = selPeer[0].pub_key; this.selectedPubkey = selPeer[0].pub_key;
} }

@ -32,7 +32,7 @@ export class ConnectPeerComponent implements OnInit, OnDestroy {
public transTypes = TRANS_TYPES; public transTypes = TRANS_TYPES;
public flgChannelOpened = false; public flgChannelOpened = false;
public channelOpenStatus = null; public channelOpenStatus = null;
public newlyAddedPeer: Peer = null; public newlyAddedPeer: Peer | null = null;
public flgEditable = true; public flgEditable = true;
public peerConnectionError = ''; public peerConnectionError = '';
public channelConnectionError = ''; public channelConnectionError = '';
@ -46,7 +46,7 @@ export class ConnectPeerComponent implements OnInit, OnDestroy {
constructor(public dialogRef: MatDialogRef<ConnectPeerComponent>, @Inject(MAT_DIALOG_DATA) public data: OpenChannelAlert, private store: Store<RTLState>, private lndEffects: LNDEffects, private formBuilder: FormBuilder, private actions: Actions, private logger: LoggerService) { } constructor(public dialogRef: MatDialogRef<ConnectPeerComponent>, @Inject(MAT_DIALOG_DATA) public data: OpenChannelAlert, private store: Store<RTLState>, private lndEffects: LNDEffects, private formBuilder: FormBuilder, private actions: Actions, private logger: LoggerService) { }
ngOnInit() { ngOnInit() {
this.totalBalance = this.data.message.balance; this.totalBalance = this.data.message?.balance || 0;
this.peerFormGroup = this.formBuilder.group({ this.peerFormGroup = this.formBuilder.group({
hiddenAddress: ['', [Validators.required]], hiddenAddress: ['', [Validators.required]],
peerAddress: ['', [Validators.required]] peerAddress: ['', [Validators.required]]
@ -130,7 +130,7 @@ export class ConnectPeerComponent implements OnInit, OnDestroy {
this.channelConnectionError = ''; this.channelConnectionError = '';
this.store.dispatch(saveNewChannel({ this.store.dispatch(saveNewChannel({
payload: { payload: {
selectedPeerPubkey: this.newlyAddedPeer.pub_key, fundingAmount: this.channelFormGroup.controls.fundingAmount.value, private: this.channelFormGroup.controls.isPrivate.value, selectedPeerPubkey: this.newlyAddedPeer?.pub_key!, fundingAmount: this.channelFormGroup.controls.fundingAmount.value, private: this.channelFormGroup.controls.isPrivate.value,
transType: this.channelFormGroup.controls.selTransType.value, transTypeValue: this.channelFormGroup.controls.transTypeValue.value, spendUnconfirmed: this.channelFormGroup.controls.spendUnconfirmed.value transType: this.channelFormGroup.controls.selTransType.value, transTypeValue: this.channelFormGroup.controls.transTypeValue.value, spendUnconfirmed: this.channelFormGroup.controls.spendUnconfirmed.value
} }
})); }));
@ -149,7 +149,7 @@ export class ConnectPeerComponent implements OnInit, OnDestroy {
case 1: case 1:
if (this.peerFormGroup.controls.peerAddress.value) { if (this.peerFormGroup.controls.peerAddress.value) {
this.peerFormLabel = 'Peer Added: ' + this.newlyAddedPeer.alias; this.peerFormLabel = 'Peer Added: ' + this.newlyAddedPeer?.alias;
} else { } else {
this.peerFormLabel = 'Peer Details'; this.peerFormLabel = 'Peer Details';
} }
@ -158,7 +158,7 @@ export class ConnectPeerComponent implements OnInit, OnDestroy {
case 2: case 2:
if (this.peerFormGroup.controls.peerAddress.value) { if (this.peerFormGroup.controls.peerAddress.value) {
this.peerFormLabel = 'Peer Added: ' + this.newlyAddedPeer.alias; this.peerFormLabel = 'Peer Added: ' + this.newlyAddedPeer?.alias;
} else { } else {
this.peerFormLabel = 'Peer Details'; this.peerFormLabel = 'Peer Details';
} }

@ -20,9 +20,9 @@ import { BlockchainBalance, Channel, ChannelsSummary, LightningBalance, Peer } f
}) })
export class ConnectionsComponent implements OnInit, OnDestroy { export class ConnectionsComponent implements OnInit, OnDestroy {
public selNode: SelNodeChild = {}; public selNode: SelNodeChild | null = {};
public activePeers = 0; public activePeers = 0;
public activeChannels = 0; public activeChannels: number = 0;
public faUsers = faUsers; public faUsers = faUsers;
public faChartPie = faChartPie; public faChartPie = faChartPie;
public balances = [{ title: 'Total Balance', dataValue: 0 }, { title: 'Confirmed', dataValue: 0 }, { title: 'Unconfirmed', dataValue: 0 }]; public balances = [{ title: 'Total Balance', dataValue: 0 }, { title: 'Confirmed', dataValue: 0 }, { title: 'Unconfirmed', dataValue: 0 }];
@ -40,7 +40,7 @@ export class ConnectionsComponent implements OnInit, OnDestroy {
this.activeLink = this.links.findIndex((link) => link.link === (<ResolveEnd>value).urlAfterRedirects.substring((<ResolveEnd>value).urlAfterRedirects.lastIndexOf('/') + 1)); this.activeLink = this.links.findIndex((link) => link.link === (<ResolveEnd>value).urlAfterRedirects.substring((<ResolveEnd>value).urlAfterRedirects.lastIndexOf('/') + 1));
} }
}); });
this.store.select(lndNodeSettings).pipe(takeUntil(this.unSubs[1])).subscribe((nodeSettings: SelNodeChild) => { this.selNode = nodeSettings; }); this.store.select(lndNodeSettings).pipe(takeUntil(this.unSubs[1])).subscribe((nodeSettings: SelNodeChild | null) => { this.selNode = nodeSettings; });
this.store.select(peers).pipe(takeUntil(this.unSubs[2])). this.store.select(peers).pipe(takeUntil(this.unSubs[2])).
subscribe((peersSelector: { peers: Peer[], apiCallStatus: ApiCallStatusPayload }) => { subscribe((peersSelector: { peers: Peer[], apiCallStatus: ApiCallStatusPayload }) => {
this.activePeers = (peersSelector.peers && peersSelector.peers.length) ? peersSelector.peers.length : 0; this.activePeers = (peersSelector.peers && peersSelector.peers.length) ? peersSelector.peers.length : 0;
@ -48,12 +48,12 @@ export class ConnectionsComponent implements OnInit, OnDestroy {
}); });
this.store.select(channels).pipe(takeUntil(this.unSubs[3])). this.store.select(channels).pipe(takeUntil(this.unSubs[3])).
subscribe((channelsSelector: { channels: Channel[], channelsSummary: ChannelsSummary, lightningBalance: LightningBalance, apiCallStatus: ApiCallStatusPayload }) => { subscribe((channelsSelector: { channels: Channel[], channelsSummary: ChannelsSummary, lightningBalance: LightningBalance, apiCallStatus: ApiCallStatusPayload }) => {
this.activeChannels = channelsSelector.channelsSummary.active.num_channels; this.activeChannels = channelsSelector.channelsSummary.active?.num_channels || 0;
this.logger.info(channelsSelector); this.logger.info(channelsSelector);
}); });
this.store.select(blockchainBalance).pipe(takeUntil(this.unSubs[4])). this.store.select(blockchainBalance).pipe(takeUntil(this.unSubs[4])).
subscribe((bcBalanceSelector: { blockchainBalance: BlockchainBalance, apiCallStatus: ApiCallStatusPayload }) => { subscribe((bcBalanceSelector: { blockchainBalance: BlockchainBalance, apiCallStatus: ApiCallStatusPayload }) => {
this.balances = [{ title: 'Total Balance', dataValue: bcBalanceSelector.blockchainBalance.total_balance || 0 }, { title: 'Confirmed', dataValue: bcBalanceSelector.blockchainBalance.confirmed_balance }, { title: 'Unconfirmed', dataValue: bcBalanceSelector.blockchainBalance.unconfirmed_balance }]; this.balances = [{ title: 'Total Balance', dataValue: bcBalanceSelector.blockchainBalance.total_balance || 0 }, { title: 'Confirmed', dataValue: (bcBalanceSelector.blockchainBalance.confirmed_balance || 0)}, { title: 'Unconfirmed', dataValue: (bcBalanceSelector.blockchainBalance.unconfirmed_balance || 0)}];
this.logger.info(bcBalanceSelector); this.logger.info(bcBalanceSelector);
}); });
} }

@ -160,7 +160,7 @@ export class PeersComponent implements OnInit, AfterViewInit, OnDestroy {
pipe(takeUntil(this.unSubs[3])). pipe(takeUntil(this.unSubs[3])).
subscribe((confirmRes) => { subscribe((confirmRes) => {
if (confirmRes) { if (confirmRes) {
this.store.dispatch(detachPeer({ payload: { pubkey: peerToDetach.pub_key } })); this.store.dispatch(detachPeer({ payload: { pubkey: peerToDetach.pub_key! } }));
} }
}); });
} }

@ -112,17 +112,17 @@ export class RoutingReportComponent implements OnInit, OnDestroy {
prepareFeeReport(start: Date) { prepareFeeReport(start: Date) {
const startDateInSeconds = Math.round(start.getTime() / 1000); const startDateInSeconds = Math.round(start.getTime() / 1000);
const feeReport = []; const feeReport: any[] = [];
this.events.total_fee_msat = 0; this.events.total_fee_msat = 0;
if (this.reportPeriod === SCROLL_RANGES[1]) { if (this.reportPeriod === SCROLL_RANGES[1]) {
for (let i = 0; i < 12; i++) { for (let i = 0; i < 12; i++) {
feeReport.push({ name: MONTHS[i].name, value: 0.0, extra: { totalEvents: 0 } }); feeReport.push({ name: MONTHS[i].name, value: 0.0, extra: { totalEvents: 0 } });
} }
this.events.forwarding_events?.map((event) => { this.events.forwarding_events?.map((event) => {
const monthNumber = new Date((+event.timestamp) * 1000).getMonth(); const monthNumber = new Date(+(event.timestamp || 0) * 1000).getMonth();
feeReport[monthNumber].value = feeReport[monthNumber].value + (+event.fee_msat / 1000); feeReport[monthNumber].value = feeReport[monthNumber].value + (+(event.fee_msat || 0) / 1000);
feeReport[monthNumber].extra.totalEvents = feeReport[monthNumber].extra.totalEvents + 1; feeReport[monthNumber].extra.totalEvents = feeReport[monthNumber].extra.totalEvents + 1;
this.events.total_fee_msat = (this.events.total_fee_msat ? this.events.total_fee_msat : 0) + +event.fee_msat; this.events.total_fee_msat = (this.events.total_fee_msat ? this.events.total_fee_msat : 0) + +(event.fee_msat || 0);
return this.events; return this.events;
}); });
} else { } else {
@ -130,10 +130,10 @@ export class RoutingReportComponent implements OnInit, OnDestroy {
feeReport.push({ name: i + 1, value: 0.0, extra: { totalEvents: 0 } }); feeReport.push({ name: i + 1, value: 0.0, extra: { totalEvents: 0 } });
} }
this.events.forwarding_events?.map((event) => { this.events.forwarding_events?.map((event) => {
const dateNumber = Math.floor((+event.timestamp - startDateInSeconds) / this.secondsInADay); const dateNumber = Math.floor((+(event.timestamp || 0) - startDateInSeconds) / this.secondsInADay);
feeReport[dateNumber].value = feeReport[dateNumber].value + (+event.fee_msat / 1000); feeReport[dateNumber].value = feeReport[dateNumber].value + (+(event.fee_msat || 0) / 1000);
feeReport[dateNumber].extra.totalEvents = feeReport[dateNumber].extra.totalEvents + 1; feeReport[dateNumber].extra.totalEvents = feeReport[dateNumber].extra.totalEvents + 1;
this.events.total_fee_msat = (this.events.total_fee_msat ? this.events.total_fee_msat : 0) + +event.fee_msat; this.events.total_fee_msat = (this.events.total_fee_msat ? this.events.total_fee_msat : 0) + +(event.fee_msat || 0);
return this.events; return this.events;
}); });
} }
@ -142,17 +142,17 @@ export class RoutingReportComponent implements OnInit, OnDestroy {
prepareEventsReport(start: Date) { prepareEventsReport(start: Date) {
const startDateInSeconds = Math.round(start.getTime() / 1000); const startDateInSeconds = Math.round(start.getTime() / 1000);
const eventsReport = []; const eventsReport: any[] = [];
this.events.total_fee_msat = 0; this.events.total_fee_msat = 0;
if (this.reportPeriod === SCROLL_RANGES[1]) { if (this.reportPeriod === SCROLL_RANGES[1]) {
for (let i = 0; i < 12; i++) { for (let i = 0; i < 12; i++) {
eventsReport.push({ name: MONTHS[i].name, value: 0, extra: { totalFees: 0.0 } }); eventsReport.push({ name: MONTHS[i].name, value: 0, extra: { totalFees: 0.0 } });
} }
this.events.forwarding_events?.map((event) => { this.events.forwarding_events?.map((event) => {
const monthNumber = new Date((+event.timestamp) * 1000).getMonth(); const monthNumber = new Date(+(event.timestamp || 0) * 1000).getMonth();
eventsReport[monthNumber].value = eventsReport[monthNumber].value + 1; eventsReport[monthNumber].value = eventsReport[monthNumber].value + 1;
eventsReport[monthNumber].extra.totalFees = eventsReport[monthNumber].extra.totalFees + (+event.fee_msat / 1000); eventsReport[monthNumber].extra.totalFees = eventsReport[monthNumber].extra.totalFees + (+(event.fee_msat || 0) / 1000);
this.events.total_fee_msat = (this.events.total_fee_msat ? this.events.total_fee_msat : 0) + +event.fee_msat; this.events.total_fee_msat = (this.events.total_fee_msat ? this.events.total_fee_msat : 0) + +(event.fee_msat || 0);
return this.events; return this.events;
}); });
} else { } else {
@ -160,10 +160,10 @@ export class RoutingReportComponent implements OnInit, OnDestroy {
eventsReport.push({ name: i + 1, value: 0, extra: { totalFees: 0.0 } }); eventsReport.push({ name: i + 1, value: 0, extra: { totalFees: 0.0 } });
} }
this.events.forwarding_events?.map((event) => { this.events.forwarding_events?.map((event) => {
const dateNumber = Math.floor((+event.timestamp - startDateInSeconds) / this.secondsInADay); const dateNumber = Math.floor((+(event.timestamp || 0) - startDateInSeconds) / this.secondsInADay);
eventsReport[dateNumber].value = eventsReport[dateNumber].value + 1; eventsReport[dateNumber].value = eventsReport[dateNumber].value + 1;
eventsReport[dateNumber].extra.totalFees = eventsReport[dateNumber].extra.totalFees + (+event.fee_msat / 1000); eventsReport[dateNumber].extra.totalFees = eventsReport[dateNumber].extra.totalFees + (+(event.fee_msat || 0) / 1000);
this.events.total_fee_msat = (this.events.total_fee_msat ? this.events.total_fee_msat : 0) + +event.fee_msat; this.events.total_fee_msat = (this.events.total_fee_msat ? this.events.total_fee_msat : 0) + +(event.fee_msat || 0);
return this.events; return this.events;
}); });
} }

@ -107,11 +107,11 @@ export class TransactionsReportComponent implements OnInit, OnDestroy {
filterTransactionsForSelectedPeriod(start: Date, end: Date) { filterTransactionsForSelectedPeriod(start: Date, end: Date) {
const startDateInSeconds = Math.round(start.getTime() / 1000); const startDateInSeconds = Math.round(start.getTime() / 1000);
const endDateInSeconds = Math.round(end.getTime() / 1000); const endDateInSeconds = Math.round(end.getTime() / 1000);
const transactionsReport = []; const transactionsReport: any[] = [];
this.transactionsNonZeroReportData = []; this.transactionsNonZeroReportData = [];
this.transactionsReportSummary = { paymentsSelectedPeriod: 0, invoicesSelectedPeriod: 0, amountPaidSelectedPeriod: 0, amountReceivedSelectedPeriod: 0 }; this.transactionsReportSummary = { paymentsSelectedPeriod: 0, invoicesSelectedPeriod: 0, amountPaidSelectedPeriod: 0, amountReceivedSelectedPeriod: 0 };
const filteredPayments = this.payments?.filter((payment) => payment.status === 'SUCCEEDED' && payment.creation_date >= startDateInSeconds && payment.creation_date < endDateInSeconds); const filteredPayments = this.payments?.filter((payment) => payment.status === 'SUCCEEDED' && payment.creation_date && payment.creation_date >= startDateInSeconds && payment.creation_date < endDateInSeconds);
const filteredInvoices = this.invoices?.filter((invoice) => invoice.settled && +invoice.creation_date >= startDateInSeconds && +invoice.creation_date < endDateInSeconds); const filteredInvoices = this.invoices?.filter((invoice) => invoice.settled && invoice.creation_date && +invoice.creation_date >= startDateInSeconds && +invoice.creation_date < endDateInSeconds);
this.transactionsReportSummary.paymentsSelectedPeriod = filteredPayments.length; this.transactionsReportSummary.paymentsSelectedPeriod = filteredPayments.length;
this.transactionsReportSummary.invoicesSelectedPeriod = filteredInvoices.length; this.transactionsReportSummary.invoicesSelectedPeriod = filteredInvoices.length;
if (this.reportPeriod === SCROLL_RANGES[1]) { if (this.reportPeriod === SCROLL_RANGES[1]) {
@ -119,16 +119,16 @@ export class TransactionsReportComponent implements OnInit, OnDestroy {
transactionsReport.push({ name: MONTHS[i].name, date: new Date(start.getFullYear(), i, 1, 0, 0, 0, 0), series: [{ name: 'Paid', value: 0, extra: { total: 0 } }, { name: 'Received', value: 0, extra: { total: 0 } }] }); transactionsReport.push({ name: MONTHS[i].name, date: new Date(start.getFullYear(), i, 1, 0, 0, 0, 0), series: [{ name: 'Paid', value: 0, extra: { total: 0 } }, { name: 'Received', value: 0, extra: { total: 0 } }] });
} }
filteredPayments?.map((payment) => { filteredPayments?.map((payment) => {
const monthNumber = new Date((+payment.creation_date) * 1000).getMonth(); const monthNumber = new Date(+(payment.creation_date || 0) * 1000).getMonth();
this.transactionsReportSummary.amountPaidSelectedPeriod = this.transactionsReportSummary.amountPaidSelectedPeriod + (+payment.value_msat) + (+payment.fee_msat); this.transactionsReportSummary.amountPaidSelectedPeriod = this.transactionsReportSummary.amountPaidSelectedPeriod + (+(payment.value_msat || 0)) + (+(payment.fee_msat || 0));
transactionsReport[monthNumber].series[0].value = transactionsReport[monthNumber].series[0].value + ((+payment.value_msat + +payment.fee_msat) / 1000); transactionsReport[monthNumber].series[0].value = transactionsReport[monthNumber].series[0].value + ((+(payment.value_msat || 0) + +(payment.fee_msat || 0)) / 1000);
transactionsReport[monthNumber].series[0].extra.total = transactionsReport[monthNumber].series[0].extra.total + 1; transactionsReport[monthNumber].series[0].extra.total = transactionsReport[monthNumber].series[0].extra.total + 1;
return this.transactionsReportSummary; return this.transactionsReportSummary;
}); });
filteredInvoices?.map((invoice) => { filteredInvoices?.map((invoice) => {
const monthNumber = new Date((+invoice.creation_date) * 1000).getMonth(); const monthNumber = new Date(+(invoice.creation_date || 0) * 1000).getMonth();
this.transactionsReportSummary.amountReceivedSelectedPeriod = this.transactionsReportSummary.amountReceivedSelectedPeriod + (+invoice.amt_paid_msat); this.transactionsReportSummary.amountReceivedSelectedPeriod = this.transactionsReportSummary.amountReceivedSelectedPeriod + (+(invoice.amt_paid_msat || 0));
transactionsReport[monthNumber].series[1].value = transactionsReport[monthNumber].series[1].value + (+invoice.amt_paid_msat / 1000); transactionsReport[monthNumber].series[1].value = transactionsReport[monthNumber].series[1].value + (+(invoice.amt_paid_msat || 0) / 1000);
transactionsReport[monthNumber].series[1].extra.total = transactionsReport[monthNumber].series[1].extra.total + 1; transactionsReport[monthNumber].series[1].extra.total = transactionsReport[monthNumber].series[1].extra.total + 1;
return this.transactionsReportSummary; return this.transactionsReportSummary;
}); });
@ -137,16 +137,16 @@ export class TransactionsReportComponent implements OnInit, OnDestroy {
transactionsReport.push({ name: (i + 1).toString(), date: new Date((((i) * this.secondsInADay) + startDateInSeconds) * 1000), series: [{ name: 'Paid', value: 0, extra: { total: 0 } }, { name: 'Received', value: 0, extra: { total: 0 } }] }); transactionsReport.push({ name: (i + 1).toString(), date: new Date((((i) * this.secondsInADay) + startDateInSeconds) * 1000), series: [{ name: 'Paid', value: 0, extra: { total: 0 } }, { name: 'Received', value: 0, extra: { total: 0 } }] });
} }
filteredPayments?.map((payment) => { filteredPayments?.map((payment) => {
const dateNumber = Math.floor((+payment.creation_date - startDateInSeconds) / this.secondsInADay); const dateNumber = Math.floor((+(payment.creation_date || 0) - startDateInSeconds) / this.secondsInADay);
this.transactionsReportSummary.amountPaidSelectedPeriod = this.transactionsReportSummary.amountPaidSelectedPeriod + (+payment.value_msat) + (+payment.fee_msat); this.transactionsReportSummary.amountPaidSelectedPeriod = this.transactionsReportSummary.amountPaidSelectedPeriod + (+(payment.value_msat || 0)) + (+(payment.fee_msat || 0));
transactionsReport[dateNumber].series[0].value = transactionsReport[dateNumber].series[0].value + ((+payment.value_msat + +payment.fee_msat) / 1000); transactionsReport[dateNumber].series[0].value = transactionsReport[dateNumber].series[0].value + ((+(payment.value_msat || 0) + +(payment.fee_msat || 0)) / 1000);
transactionsReport[dateNumber].series[0].extra.total = transactionsReport[dateNumber].series[0].extra.total + 1; transactionsReport[dateNumber].series[0].extra.total = transactionsReport[dateNumber].series[0].extra.total + 1;
return this.transactionsReportSummary; return this.transactionsReportSummary;
}); });
filteredInvoices?.map((invoice) => { filteredInvoices?.map((invoice) => {
const dateNumber = Math.floor((+invoice.creation_date - startDateInSeconds) / this.secondsInADay); const dateNumber = Math.floor((+(invoice.creation_date || 0) - startDateInSeconds) / this.secondsInADay);
this.transactionsReportSummary.amountReceivedSelectedPeriod = this.transactionsReportSummary.amountReceivedSelectedPeriod + (+invoice.amt_paid_msat); this.transactionsReportSummary.amountReceivedSelectedPeriod = this.transactionsReportSummary.amountReceivedSelectedPeriod + (+(invoice.amt_paid_msat || 0));
transactionsReport[dateNumber].series[1].value = transactionsReport[dateNumber].series[1].value + (+invoice.amt_paid_msat / 1000); transactionsReport[dateNumber].series[1].value = transactionsReport[dateNumber].series[1].value + (+(invoice.amt_paid_msat || 0) / 1000);
transactionsReport[dateNumber].series[1].extra.total = transactionsReport[dateNumber].series[1].extra.total + 1; transactionsReport[dateNumber].series[1].extra.total = transactionsReport[dateNumber].series[1].extra.total + 1;
return this.transactionsReportSummary; return this.transactionsReportSummary;
}); });

@ -31,7 +31,7 @@ export class ForwardingHistoryComponent implements OnInit, AfterViewInit, OnChan
@ViewChild(MatPaginator, { static: false }) paginator: MatPaginator | undefined; @ViewChild(MatPaginator, { static: false }) paginator: MatPaginator | undefined;
@Input() eventsData = []; @Input() eventsData = [];
@Input() filterValue = ''; @Input() filterValue = '';
public forwardingHistoryData = []; public forwardingHistoryData: ForwardingEvent[] = [];
public displayedColumns: any[] = []; public displayedColumns: any[] = [];
public forwardingHistoryEvents: any; public forwardingHistoryEvents: any;
public flgSticky = false; public flgSticky = false;
@ -122,7 +122,7 @@ export class ForwardingHistoryComponent implements OnInit, AfterViewInit, OnChan
this.forwardingHistoryEvents.sort = this.sort; this.forwardingHistoryEvents.sort = this.sort;
this.forwardingHistoryEvents.sortingDataAccessor = (data: any, sortHeaderId: string) => ((data[sortHeaderId] && isNaN(data[sortHeaderId])) ? data[sortHeaderId].toLocaleLowerCase() : data[sortHeaderId] ? +data[sortHeaderId] : null); this.forwardingHistoryEvents.sortingDataAccessor = (data: any, sortHeaderId: string) => ((data[sortHeaderId] && isNaN(data[sortHeaderId])) ? data[sortHeaderId].toLocaleLowerCase() : data[sortHeaderId] ? +data[sortHeaderId] : null);
this.forwardingHistoryEvents.filterPredicate = (rowData: ForwardingEvent, fltr: string) => { this.forwardingHistoryEvents.filterPredicate = (rowData: ForwardingEvent, fltr: string) => {
const newRowData = ((rowData.timestamp) ? this.datePipe.transform(new Date(rowData.timestamp * 1000), 'dd/MMM/YYYY HH:mm').toLowerCase() : '') + JSON.stringify(rowData).toLowerCase(); const newRowData = ((rowData.timestamp) ? this.datePipe.transform(new Date(rowData.timestamp * 1000), 'dd/MMM/YYYY HH:mm')?.toLowerCase() : '') + JSON.stringify(rowData).toLowerCase();
return newRowData.includes(fltr); return newRowData.includes(fltr);
}; };
this.forwardingHistoryEvents.paginator = this.paginator; this.forwardingHistoryEvents.paginator = this.paginator;

@ -27,9 +27,9 @@ export class NonRoutingPeersComponent implements OnInit, AfterViewInit, OnDestro
@ViewChild(MatSort, { static: false }) sort: MatSort | undefined; @ViewChild(MatSort, { static: false }) sort: MatSort | undefined;
@ViewChild(MatPaginator, { static: false }) paginator: MatPaginator | undefined; @ViewChild(MatPaginator, { static: false }) paginator: MatPaginator | undefined;
public routingPeersData = []; public routingPeersData: any[] = [];
public displayedColumns: any[] = []; public displayedColumns: any[] = [];
public NonRoutingPeers = new MatTableDataSource<any>([]); public NonRoutingPeers: any = new MatTableDataSource<any>([]);
public flgSticky = false; public flgSticky = false;
public pageSize = PAGE_SIZE; public pageSize = PAGE_SIZE;
public pageSizeOptions = PAGE_SIZE_OPTIONS; public pageSizeOptions = PAGE_SIZE_OPTIONS;

@ -29,7 +29,7 @@ export class RoutingPeersComponent implements OnInit, AfterViewInit, OnDestroy {
@ViewChild('tableOut', { read: MatSort, static: false }) sortOut: MatSort; @ViewChild('tableOut', { read: MatSort, static: false }) sortOut: MatSort;
@ViewChild('paginatorIn', { static: false }) paginatorIn: MatPaginator | undefined; @ViewChild('paginatorIn', { static: false }) paginatorIn: MatPaginator | undefined;
@ViewChild('paginatorOut', { static: false }) paginatorOut: MatPaginator | undefined; @ViewChild('paginatorOut', { static: false }) paginatorOut: MatPaginator | undefined;
public routingPeersData = []; public routingPeersData: any[] = [];
public displayedColumns: any[] = []; public displayedColumns: any[] = [];
public RoutingPeersIncoming = new MatTableDataSource<RoutingPeers>([]); public RoutingPeersIncoming = new MatTableDataSource<RoutingPeers>([]);
public RoutingPeersOutgoing = new MatTableDataSource<RoutingPeers>([]); public RoutingPeersOutgoing = new MatTableDataSource<RoutingPeers>([]);
@ -119,12 +119,12 @@ export class RoutingPeersComponent implements OnInit, AfterViewInit, OnDestroy {
this.RoutingPeersIncoming = new MatTableDataSource<RoutingPeers>(results[0]); this.RoutingPeersIncoming = new MatTableDataSource<RoutingPeers>(results[0]);
this.RoutingPeersIncoming.sort = this.sortIn; this.RoutingPeersIncoming.sort = this.sortIn;
this.RoutingPeersIncoming.filterPredicate = (rpIn: RoutingPeers, fltr: string) => JSON.stringify(rpIn).toLowerCase().includes(fltr); this.RoutingPeersIncoming.filterPredicate = (rpIn: RoutingPeers, fltr: string) => JSON.stringify(rpIn).toLowerCase().includes(fltr);
this.RoutingPeersIncoming.paginator = this.paginatorIn; this.RoutingPeersIncoming.paginator = this.paginatorIn!;
this.logger.info(this.RoutingPeersIncoming); this.logger.info(this.RoutingPeersIncoming);
this.RoutingPeersOutgoing = new MatTableDataSource<RoutingPeers>(results[1]); this.RoutingPeersOutgoing = new MatTableDataSource<RoutingPeers>(results[1]);
this.RoutingPeersOutgoing.sort = this.sortOut; this.RoutingPeersOutgoing.sort = this.sortOut;
this.RoutingPeersOutgoing.filterPredicate = (rpOut: RoutingPeers, fltr: string) => JSON.stringify(rpOut).toLowerCase().includes(fltr); this.RoutingPeersOutgoing.filterPredicate = (rpOut: RoutingPeers, fltr: string) => JSON.stringify(rpOut).toLowerCase().includes(fltr);
this.RoutingPeersOutgoing.paginator = this.paginatorOut; this.RoutingPeersOutgoing.paginator = this.paginatorOut!;
this.logger.info(this.RoutingPeersOutgoing); this.logger.info(this.RoutingPeersOutgoing);
} else { } else {
// To reset table after other Forwarding history calls // To reset table after other Forwarding history calls
@ -136,22 +136,22 @@ export class RoutingPeersComponent implements OnInit, AfterViewInit, OnDestroy {
} }
groupRoutingPeers(forwardingEvents: ForwardingEvent[]) { groupRoutingPeers(forwardingEvents: ForwardingEvent[]) {
const incomingResults = []; const incomingResults: any = [];
const outgoingResults = []; const outgoingResults: any = [];
forwardingEvents.forEach((event) => { forwardingEvents.forEach((event) => {
const incoming = incomingResults.find((result) => result.chan_id === event.chan_id_in); const incoming: any = incomingResults.find((result) => result.chan_id === event.chan_id_in);
const outgoing = outgoingResults.find((result) => result.chan_id === event.chan_id_out); const outgoing: any = outgoingResults.find((result) => result.chan_id === event.chan_id_out);
if (!incoming) { if (!incoming) {
incomingResults.push({ chan_id: event.chan_id_in, alias: event.alias_in, events: 1, total_amount: +event.amt_in }); incomingResults.push({ chan_id: event.chan_id_in, alias: event.alias_in, events: 1, total_amount: +(event.amt_in || 0) });
} else { } else {
incoming.events++; incoming.events++;
incoming.total_amount = +incoming.total_amount + +event.amt_in; incoming.total_amount = +incoming.total_amount + +(event.amt_in || 0);
} }
if (!outgoing) { if (!outgoing) {
outgoingResults.push({ chan_id: event.chan_id_out, alias: event.alias_out, events: 1, total_amount: +event.amt_out }); outgoingResults.push({ chan_id: event.chan_id_out, alias: event.alias_out, events: 1, total_amount: +(event.amt_out || 0)});
} else { } else {
outgoing.events++; outgoing.events++;
outgoing.total_amount = +outgoing.total_amount + +event.amt_out; outgoing.total_amount = +outgoing.total_amount + +(event.amt_out || 0);
} }
}); });
return [this.commonService.sortDescByKey(incomingResults, 'total_amount'), this.commonService.sortDescByKey(outgoingResults, 'total_amount')]; return [this.commonService.sortDescByKey(incomingResults, 'total_amount'), this.commonService.sortDescByKey(outgoingResults, 'total_amount')];

@ -18,7 +18,7 @@ export class VerifyComponent implements OnDestroy {
public signature = ''; public signature = '';
public verifiedSignature = ''; public verifiedSignature = '';
public showVerifyStatus = false; public showVerifyStatus = false;
public verifyRes = { pubkey: '', valid: null }; public verifyRes: any = { pubkey: '', valid: null };
private unSubs: Array<Subject<void>> = [new Subject(), new Subject()]; private unSubs: Array<Subject<void>> = [new Subject(), new Subject()];
constructor(private dataService: DataService, private snackBar: MatSnackBar, private logger: LoggerService) { } constructor(private dataService: DataService, private snackBar: MatSnackBar, private logger: LoggerService) { }

@ -91,7 +91,7 @@ export class LNDEffects implements OnDestroy {
this.logger.info(info); this.logger.info(info);
if (info.chains && info.chains.length && info.chains[0] && ( if (info.chains && info.chains.length && info.chains[0] && (
(typeof info.chains[0] === 'string' && info.chains[0].toLowerCase().indexOf('bitcoin') < 0) || (typeof info.chains[0] === 'string' && info.chains[0].toLowerCase().indexOf('bitcoin') < 0) ||
(typeof info.chains[0] === 'object' && info.chains[0].hasOwnProperty('chain') && info.chains[0].chain.toLowerCase().indexOf('bitcoin') < 0) (typeof info.chains[0] === 'object' && info.chains[0].hasOwnProperty('chain') && info.chains[0].chain && info.chains[0].chain.toLowerCase().indexOf('bitcoin') < 0)
) )
) { ) {
this.store.dispatch(updateLNDAPICallStatus({ payload: { action: 'FetchInfo', status: APICallStatusEnum.COMPLETED } })); this.store.dispatch(updateLNDAPICallStatus({ payload: { action: 'FetchInfo', status: APICallStatusEnum.COMPLETED } }));
@ -524,31 +524,31 @@ export class LNDEffects implements OnDestroy {
if (pendingChannels) { if (pendingChannels) {
pendingChannelsSummary.total_limbo_balance = pendingChannels.total_limbo_balance; pendingChannelsSummary.total_limbo_balance = pendingChannels.total_limbo_balance;
if (pendingChannels.pending_closing_channels) { if (pendingChannels.pending_closing_channels) {
pendingChannelsSummary.closing.num_channels = pendingChannels.pending_closing_channels.length; pendingChannelsSummary.closing!.num_channels = pendingChannels.pending_closing_channels.length;
pendingChannelsSummary.total_channels = pendingChannelsSummary.total_channels + pendingChannels.pending_closing_channels.length; pendingChannelsSummary.total_channels = pendingChannelsSummary.total_channels + pendingChannels.pending_closing_channels.length;
pendingChannels.pending_closing_channels.forEach((closingChannel) => { pendingChannels.pending_closing_channels.forEach((closingChannel) => {
pendingChannelsSummary.closing.limbo_balance = +pendingChannelsSummary.closing.limbo_balance + (closingChannel.channel.local_balance ? +closingChannel.channel.local_balance : 0); pendingChannelsSummary.closing!.limbo_balance = +pendingChannelsSummary.closing!.limbo_balance + (closingChannel.channel.local_balance ? +closingChannel.channel.local_balance : 0);
}); });
} }
if (pendingChannels.pending_force_closing_channels) { if (pendingChannels.pending_force_closing_channels) {
pendingChannelsSummary.force_closing.num_channels = pendingChannels.pending_force_closing_channels.length; pendingChannelsSummary.force_closing!.num_channels = pendingChannels.pending_force_closing_channels.length;
pendingChannelsSummary.total_channels = pendingChannelsSummary.total_channels + pendingChannels.pending_force_closing_channels.length; pendingChannelsSummary.total_channels = pendingChannelsSummary.total_channels + pendingChannels.pending_force_closing_channels.length;
pendingChannels.pending_force_closing_channels.forEach((closingChannel) => { pendingChannels.pending_force_closing_channels.forEach((closingChannel) => {
pendingChannelsSummary.force_closing.limbo_balance = +pendingChannelsSummary.force_closing.limbo_balance + (closingChannel.channel.local_balance ? +closingChannel.channel.local_balance : 0); pendingChannelsSummary.force_closing!.limbo_balance = +pendingChannelsSummary.force_closing!.limbo_balance + (closingChannel.channel.local_balance ? +closingChannel.channel.local_balance : 0);
}); });
} }
if (pendingChannels.pending_open_channels) { if (pendingChannels.pending_open_channels) {
pendingChannelsSummary.open.num_channels = pendingChannels.pending_open_channels.length; pendingChannelsSummary.open!.num_channels = pendingChannels.pending_open_channels.length;
pendingChannelsSummary.total_channels = pendingChannelsSummary.total_channels + pendingChannels.pending_open_channels.length; pendingChannelsSummary.total_channels = pendingChannelsSummary.total_channels + pendingChannels.pending_open_channels.length;
pendingChannels.pending_open_channels.forEach((openingChannel) => { pendingChannels.pending_open_channels.forEach((openingChannel) => {
pendingChannelsSummary.open.limbo_balance = +pendingChannelsSummary.open.limbo_balance + (openingChannel.channel.local_balance ? +openingChannel.channel.local_balance : 0); pendingChannelsSummary.open!.limbo_balance = +pendingChannelsSummary.open!.limbo_balance + (openingChannel.channel.local_balance ? +openingChannel.channel.local_balance : 0);
}); });
} }
if (pendingChannels.waiting_close_channels) { if (pendingChannels.waiting_close_channels) {
pendingChannelsSummary.waiting_close.num_channels = pendingChannels.waiting_close_channels.length; pendingChannelsSummary.waiting_close!.num_channels = pendingChannels.waiting_close_channels.length;
pendingChannelsSummary.total_channels = pendingChannelsSummary.total_channels + pendingChannels.waiting_close_channels.length; pendingChannelsSummary.total_channels = pendingChannelsSummary.total_channels + pendingChannels.waiting_close_channels.length;
pendingChannels.waiting_close_channels.forEach((closingChannel) => { pendingChannels.waiting_close_channels.forEach((closingChannel) => {
pendingChannelsSummary.waiting_close.limbo_balance = +pendingChannelsSummary.waiting_close.limbo_balance + (closingChannel.channel.local_balance ? +closingChannel.channel.local_balance : 0); pendingChannelsSummary.waiting_close!.limbo_balance = +pendingChannelsSummary.waiting_close!.limbo_balance + (closingChannel.channel.local_balance ? +closingChannel.channel.local_balance : 0);
}); });
} }
} }
@ -596,7 +596,7 @@ export class LNDEffects implements OnDestroy {
this.logger.info(res); this.logger.info(res);
this.store.dispatch(updateLNDAPICallStatus({ payload: { action: 'FetchInvoices', status: APICallStatusEnum.COMPLETED } })); this.store.dispatch(updateLNDAPICallStatus({ payload: { action: 'FetchInvoices', status: APICallStatusEnum.COMPLETED } }));
if (action.payload.reversed && !action.payload.index_offset) { if (action.payload.reversed && !action.payload.index_offset) {
res['total_invoices'] = +res.last_index_offset; res['total_invoices'] = +(res.last_index_offset || 0);
} }
return { return {
type: LNDActions.SET_INVOICES_LND, type: LNDActions.SET_INVOICES_LND,

@ -10,13 +10,15 @@ let flgUTXOsSet = false;
export const LNDReducer = createReducer(initLNDState, export const LNDReducer = createReducer(initLNDState,
on(updateLNDAPICallStatus, (state, { payload }) => { on(updateLNDAPICallStatus, (state, { payload }) => {
const updatedApisCallStatus = JSON.parse(JSON.stringify(state.apisCallStatus)); const updatedApisCallStatus = JSON.parse(JSON.stringify(state.apisCallStatus));
updatedApisCallStatus[payload.action || 0] = { if (payload.action) {
status: payload.status, updatedApisCallStatus[payload.action] = {
statusCode: payload.statusCode, status: payload.status,
message: payload.message, statusCode: payload.statusCode,
URL: payload.URL, message: payload.message,
filePath: payload.filePath URL: payload.URL,
}; filePath: payload.filePath
};
}
return { return {
...state, ...state,
apisCallStatus: updatedApisCallStatus apisCallStatus: updatedApisCallStatus

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save