Lazy loading

Lazy loading
pull/209/head
ShahanaFarooqui 5 years ago
parent 81699ede37
commit e93231c590

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -8,5 +8,5 @@
<link rel="stylesheet" href="styles.95c3afc83be2d91ee834.css"></head>
<body>
<rtl-app></rtl-app>
<script src="runtime-es2015.703a23e48ad83c851e49.js" type="module"></script><script src="polyfills-es2015.2a0da12c7706d5c3e2aa.js" type="module"></script><script src="runtime-es5.465c2333d355155ec5f3.js" nomodule></script><script src="polyfills-es5.84431ea76d33490d0941.js" nomodule></script><script src="main-es2015.fc022318127646298e96.js" type="module"></script><script src="main-es5.2f643e3c8130ec1ad06f.js" nomodule></script></body>
<script src="runtime-es2015.daac63f861585ab7a235.js" type="module"></script><script src="polyfills-es2015.2a0da12c7706d5c3e2aa.js" type="module"></script><script src="runtime-es5.5a48a1a46f5d6db38cc2.js" nomodule></script><script src="polyfills-es5.84431ea76d33490d0941.js" nomodule></script><script src="main-es2015.31d82cbabd2de8337eaa.js" type="module"></script><script src="main-es5.2e2e9dbae4980e7e928a.js" nomodule></script></body>
</html>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -1 +0,0 @@
!function(e){function r(r){for(var n,f,i=r[0],l=r[1],a=r[2],c=0,s=[];c<i.length;c++)o[f=i[c]]&&s.push(o[f][0]),o[f]=0;for(n in l)Object.prototype.hasOwnProperty.call(l,n)&&(e[n]=l[n]);for(p&&p(r);s.length;)s.shift()();return u.push.apply(u,a||[]),t()}function t(){for(var e,r=0;r<u.length;r++){for(var t=u[r],n=!0,i=1;i<t.length;i++)0!==o[t[i]]&&(n=!1);n&&(u.splice(r--,1),e=f(f.s=t[0]))}return e}var n={},o={0:0},u=[];function f(r){if(n[r])return n[r].exports;var t=n[r]={i:r,l:!1,exports:{}};return e[r].call(t.exports,t,t.exports,f),t.l=!0,t.exports}f.m=e,f.c=n,f.d=function(e,r,t){f.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:t})},f.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},f.t=function(e,r){if(1&r&&(e=f(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var t=Object.create(null);if(f.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var n in e)f.d(t,n,(function(r){return e[r]}).bind(null,n));return t},f.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return f.d(r,"a",r),r},f.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},f.p="";var i=window.webpackJsonp=window.webpackJsonp||[],l=i.push.bind(i);i.push=r,i=i.slice();for(var a=0;a<i.length;a++)r(i[a]);var p=l;t()}([]);

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

@ -1 +0,0 @@
!function(e){function r(r){for(var n,f,i=r[0],l=r[1],a=r[2],c=0,s=[];c<i.length;c++)o[f=i[c]]&&s.push(o[f][0]),o[f]=0;for(n in l)Object.prototype.hasOwnProperty.call(l,n)&&(e[n]=l[n]);for(p&&p(r);s.length;)s.shift()();return u.push.apply(u,a||[]),t()}function t(){for(var e,r=0;r<u.length;r++){for(var t=u[r],n=!0,i=1;i<t.length;i++)0!==o[t[i]]&&(n=!1);n&&(u.splice(r--,1),e=f(f.s=t[0]))}return e}var n={},o={0:0},u=[];function f(r){if(n[r])return n[r].exports;var t=n[r]={i:r,l:!1,exports:{}};return e[r].call(t.exports,t,t.exports,f),t.l=!0,t.exports}f.m=e,f.c=n,f.d=function(e,r,t){f.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:t})},f.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},f.t=function(e,r){if(1&r&&(e=f(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var t=Object.create(null);if(f.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var n in e)f.d(t,n,(function(r){return e[r]}).bind(null,n));return t},f.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return f.d(r,"a",r),r},f.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},f.p="";var i=window.webpackJsonp=window.webpackJsonp||[],l=i.push.bind(i);i.push=r,i=i.slice();for(var a=0;a<i.length;a++)r(i[a]);var p=l;t()}([]);

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

8
package-lock.json generated

@ -1,6 +1,6 @@
{
"name": "rtl",
"version": "0.4.4-beta",
"version": "0.4.5-beta",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
@ -4168,9 +4168,9 @@
"integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0="
},
"electron-to-chromium": {
"version": "1.3.201",
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.201.tgz",
"integrity": "sha512-aCTPIfY1Jvuam5b6vuWRjt1F8i4kY7zX0Qtpu5SNd6l1zjuxU9fDNpbM4o6+oJsra+TMD2o7D20GnkSIgpTr9w==",
"version": "1.3.202",
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.202.tgz",
"integrity": "sha512-oJHvNNYM3Y9mJfiujbFQxRa0v7mzrc6Pv76fq6A4Dd6MxbfiVGhmgXtIeMBloTF8crmlJ1rXQW95VS4Zp/9ZSg==",
"dev": true
},
"elliptic": {

@ -1,6 +1,6 @@
{
"name": "rtl",
"version": "0.4.4-beta",
"version": "0.4.5-beta",
"license": "MIT",
"scripts": {
"ng": "ng",

@ -11,8 +11,10 @@ import { LoggerService } from './shared/services/logger.service';
import { RTLConfiguration, Settings, Node } from './shared/models/RTLconfig';
import { GetInfo } from './shared/models/lndModels';
import * as RTLActions from './shared/store/rtl.actions';
import * as fromRTLReducer from './shared/store/rtl.reducers';
import * as LNDActions from './lnd/store/lnd.actions';
import * as fromLNDReducer from './lnd/store/lnd.reducers';
import * as RTLActions from './store/rtl.actions';
import * as fromRTLReducer from './store/rtl.reducers';
@Component({
selector: 'rtl-app',
@ -30,22 +32,27 @@ export class AppComponent implements OnInit, AfterViewInit, OnDestroy {
public appConfig: RTLConfiguration;
public accessKey = '';
public smallScreen = false;
unsubs: Array<Subject<void>> = [new Subject(), new Subject(), new Subject()];
unsubs: Array<Subject<void>> = [new Subject(), new Subject(), new Subject(), new Subject()];
constructor(private logger: LoggerService, private store: Store<fromRTLReducer.State>, private actions$: Actions,
constructor(private logger: LoggerService, private store: Store<fromRTLReducer.State>, private lndStore: Store<fromLNDReducer.LNDState>, private actions$: Actions,
private userIdle: UserIdleService, private router: Router) {}
ngOnInit() {
this.store.dispatch(new RTLActions.FetchRTLConfig());
this.accessKey = this.readAccessKey();
this.lndStore.select('lnd')
.pipe(takeUntil(this.unsubs[3]))
.subscribe(lndStore => {
this.information = lndStore ? lndStore.information : {};
this.flgLoading[0] = (undefined !== this.information.identity_pubkey) ? false : true;
this.logger.info(lndStore);
});
this.store.select('rtlRoot')
.pipe(takeUntil(this.unsubs[0]))
.subscribe(rtlStore => {
this.selNode = rtlStore.selNode;
this.settings = this.selNode.settings;
this.appConfig = rtlStore.appConfig;
this.information = rtlStore.information;
this.flgLoading[0] = (undefined !== this.information.identity_pubkey) ? false : true;
if (window.innerWidth <= 768) {
this.settings.menu = 'Vertical';
this.settings.flgSidenavOpened = false;
@ -60,7 +67,7 @@ export class AppComponent implements OnInit, AfterViewInit, OnDestroy {
}
});
if (sessionStorage.getItem('token')) {
this.store.dispatch(new RTLActions.FetchInfo());
this.lndStore.dispatch(new LNDActions.FetchInfo());
}
this.actions$
.pipe(
@ -83,14 +90,14 @@ export class AppComponent implements OnInit, AfterViewInit, OnDestroy {
setTimeout(() => { this.settingSidenav.toggle(); }, 100);
}
} else if (actionPayload.type === RTLActions.INIT_APP_DATA) {
this.store.dispatch(new RTLActions.FetchInfo());
this.lndStore.dispatch(new LNDActions.FetchInfo());
}
});
this.actions$
.pipe(
takeUntil(this.unsubs[1]),
filter((action) => action.type === RTLActions.SET_INFO)
).subscribe((infoData: RTLActions.SetInfo) => {
filter((action) => action.type === LNDActions.SET_INFO)
).subscribe((infoData: LNDActions.SetInfo) => {
if (undefined !== infoData.payload.identity_pubkey) {
this.initializeRemainingData();
}
@ -116,14 +123,14 @@ export class AppComponent implements OnInit, AfterViewInit, OnDestroy {
}
initializeRemainingData() {
this.store.dispatch(new RTLActions.FetchPeers());
this.store.dispatch(new RTLActions.FetchBalance('channels'));
this.store.dispatch(new RTLActions.FetchFees());
this.store.dispatch(new RTLActions.FetchNetwork());
this.store.dispatch(new RTLActions.FetchChannels({routeParam: 'all'}));
this.store.dispatch(new RTLActions.FetchChannels({routeParam: 'pending'}));
this.store.dispatch(new RTLActions.FetchInvoices({num_max_invoices: 25, reversed: true}));
this.store.dispatch(new RTLActions.FetchPayments());
this.lndStore.dispatch(new LNDActions.FetchPeers());
this.lndStore.dispatch(new LNDActions.FetchBalance('channels'));
this.lndStore.dispatch(new LNDActions.FetchFees());
this.lndStore.dispatch(new LNDActions.FetchNetwork());
this.lndStore.dispatch(new LNDActions.FetchChannels({routeParam: 'all'}));
this.lndStore.dispatch(new LNDActions.FetchChannels({routeParam: 'pending'}));
this.lndStore.dispatch(new LNDActions.FetchInvoices({num_max_invoices: 25, reversed: true}));
this.lndStore.dispatch(new LNDActions.FetchPayments());
}
ngAfterViewInit() {

@ -1,7 +1,6 @@
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { HttpClientModule, HTTP_INTERCEPTORS } from '@angular/common/http';
import { StoreModule } from '@ngrx/store';
import { EffectsModule } from '@ngrx/effects';
@ -9,7 +8,6 @@ import { StoreDevtoolsModule } from '@ngrx/store-devtools';
import { UserIdleModule } from 'angular-user-idle';
import { OverlayContainer } from '@angular/cdk/overlay';
import { NgxChartsModule } from '@swimlane/ngx-charts';
import { PerfectScrollbarModule } from 'ngx-perfect-scrollbar';
import { PERFECT_SCROLLBAR_CONFIG } from 'ngx-perfect-scrollbar';
@ -23,49 +21,22 @@ import { environment } from '../environments/environment';
import { routing } from './app.routing';
import { SharedModule } from './shared/shared.module';
import { ThemeOverlay } from './shared/theme/overlay-container/theme-overlay';
import { AppComponent } from './app.component';
import { HomeComponent } from './pages/home/home.component';
import { PeersComponent } from './pages/peers/peers.component';
import { SendReceiveTransComponent } from './pages/transactions/send-receive/send-receive-trans.component';
import { InvoicesComponent } from './pages/invoices/invoices.component';
import { ServerConfigComponent } from './pages/server-config/server-config.component';
import { HelpComponent } from './pages/help/help.component';
import { UnlockLNDComponent } from './pages/unlock-lnd/unlock-lnd.component';
import { PaymentsComponent } from './pages/payments/send-receive/payments.component';
import { SideNavigationComponent } from './pages/navigation/side-navigation/side-navigation.component';
import { TopMenuComponent } from './pages/navigation/top-menu/top-menu.component';
import { HorizontalNavigationComponent } from './pages/navigation/horizontal-navigation/horizontal-navigation.component';
import { ChannelManageComponent } from './pages/channels/channel-manage/channel-manage.component';
import { ChannelPendingComponent } from './pages/channels/channel-pending/channel-pending.component';
import { SigninComponent } from './pages/signin/signin.component';
import { RTLRootReducer } from './shared/store/rtl.reducers';
import { RTLEffects } from './shared/store/rtl.effects';
import { RTLRootReducer } from './store/rtl.reducers';
import { RTLEffects } from './store/rtl.effects';
import { AppComponent } from './app.component';
import { CommonService } from './shared/services/common.service';
import { LoggerService, ConsoleLoggerService } from './shared/services/logger.service';
import { AuthGuard, LNDUnlockedGuard } from './shared/services/auth.guard';
import { AuthInterceptor } from './shared/services/auth.interceptor';
import { ChannelClosedComponent } from './pages/channels/channel-closed/channel-closed.component';
import { ListTransactionsComponent } from './pages/transactions/list-transactions/list-transactions.component';
import { LookupsComponent } from './pages/lookups/lookups.component';
import { ForwardingHistoryComponent } from './pages/switch/forwarding-history.component';
import { RoutingPeersComponent } from './pages/routing-peers/routing-peers.component';
import { ChannelLookupComponent } from './pages/lookups/channel-lookup/channel-lookup.component';
import { NodeLookupComponent } from './pages/lookups/node-lookup/node-lookup.component';
import { ChannelBackupComponent } from './pages/channels/channel-backup/channel-backup.component';
import { QueryRoutesComponent } from './pages/payments/query-routes/query-routes.component';
@NgModule({
imports: [
BrowserModule,
BrowserAnimationsModule,
FormsModule,
ReactiveFormsModule,
HttpClientModule,
PerfectScrollbarModule,
SharedModule,
NgxChartsModule,
routing,
UserIdleModule.forRoot({idle: 60 * 60, timeout: 1, ping: null}),
StoreModule.forRoot({rtlRoot: RTLRootReducer}),
@ -73,30 +44,7 @@ import { QueryRoutesComponent } from './pages/payments/query-routes/query-routes
!environment.production ? StoreDevtoolsModule.instrument() : []
],
declarations: [
AppComponent,
HomeComponent,
PeersComponent,
SendReceiveTransComponent,
InvoicesComponent,
ServerConfigComponent,
HelpComponent,
UnlockLNDComponent,
PaymentsComponent,
SideNavigationComponent,
TopMenuComponent,
HorizontalNavigationComponent,
ChannelManageComponent,
ChannelPendingComponent,
SigninComponent,
ChannelClosedComponent,
ListTransactionsComponent,
LookupsComponent,
ForwardingHistoryComponent,
RoutingPeersComponent,
ChannelLookupComponent,
NodeLookupComponent,
ChannelBackupComponent,
QueryRoutesComponent
AppComponent
],
providers: [
{ provide: LoggerService, useClass: ConsoleLoggerService },

@ -1,52 +1,8 @@
import { Routes, RouterModule } from '@angular/router';
import { ModuleWithProviders } from '@angular/core';
import { NotFoundComponent } from './shared/components/not-found/not-found.component';
import { HomeComponent } from './pages/home/home.component';
import { UnlockLNDComponent } from './pages/unlock-lnd/unlock-lnd.component';
import { ChannelClosedComponent } from './pages/channels/channel-closed/channel-closed.component';
import { ChannelManageComponent } from './pages/channels/channel-manage/channel-manage.component';
import { ChannelPendingComponent } from './pages/channels/channel-pending/channel-pending.component';
import { PeersComponent } from './pages/peers/peers.component';
import { SendReceiveTransComponent } from './pages/transactions/send-receive/send-receive-trans.component';
import { ListTransactionsComponent } from './pages/transactions/list-transactions/list-transactions.component';
import { PaymentsComponent } from './pages/payments/send-receive/payments.component';
import { QueryRoutesComponent } from './pages/payments/query-routes/query-routes.component';
import { ServerConfigComponent } from './pages/server-config/server-config.component';
import { HelpComponent } from './pages/help/help.component';
import { InvoicesComponent } from './pages/invoices/invoices.component';
import { LookupsComponent } from './pages/lookups/lookups.component';
import { SigninComponent } from './pages/signin/signin.component';
import { ForwardingHistoryComponent } from './pages/switch/forwarding-history.component';
import { RoutingPeersComponent } from './pages/routing-peers/routing-peers.component';
import { SsoFailedComponent } from './shared/components/sso-failed/sso-failed.component';
import { ChannelBackupComponent } from './pages/channels/channel-backup/channel-backup.component';
import { AuthGuard, LNDUnlockedGuard } from './shared/services/auth.guard';
export const routes: Routes = [
{ path: '', redirectTo: '/home', pathMatch: 'full', canActivate: [AuthGuard, LNDUnlockedGuard] },
{ path: 'unlocklnd', component: UnlockLNDComponent, canActivate: [AuthGuard] },
{ path: 'home', component: HomeComponent, canActivate: [AuthGuard, LNDUnlockedGuard] },
{ path: 'peers', component: PeersComponent, canActivate: [AuthGuard, LNDUnlockedGuard] },
{ path: 'chnlclosed', component: ChannelClosedComponent, canActivate: [AuthGuard, LNDUnlockedGuard] },
{ path: 'chnlmanage', component: ChannelManageComponent, canActivate: [AuthGuard, LNDUnlockedGuard] },
{ path: 'chnlpending', component: ChannelPendingComponent, canActivate: [AuthGuard, LNDUnlockedGuard] },
{ path: 'chnlbackup', component: ChannelBackupComponent, canActivate: [AuthGuard, LNDUnlockedGuard] },
{ path: 'transsendreceive', component: SendReceiveTransComponent, canActivate: [AuthGuard, LNDUnlockedGuard] },
{ path: 'translist', component: ListTransactionsComponent, canActivate: [AuthGuard, LNDUnlockedGuard] },
{ path: 'paymentsend', component: PaymentsComponent, canActivate: [AuthGuard, LNDUnlockedGuard] },
{ path: 'queryroutes', component: QueryRoutesComponent, canActivate: [AuthGuard, LNDUnlockedGuard] },
{ path: 'invoices', component: InvoicesComponent, canActivate: [AuthGuard, LNDUnlockedGuard] },
{ path: 'switch', component: ForwardingHistoryComponent, canActivate: [AuthGuard, LNDUnlockedGuard] },
{ path: 'routingpeers', component: RoutingPeersComponent, canActivate: [AuthGuard, LNDUnlockedGuard] },
{ path: 'lookups', component: LookupsComponent, canActivate: [AuthGuard, LNDUnlockedGuard] },
{ path: 'sconfig', component: ServerConfigComponent, canActivate: [AuthGuard] },
{ path: 'login', component: SigninComponent },
{ path: 'help', component: HelpComponent },
{ path: 'ssoerror', component: SsoFailedComponent },
{ path: '**', component: NotFoundComponent }
{ path: '', loadChildren: () => import('./lnd/lnd.module').then(childModule => childModule.LndModule)},
];
export const routing: ModuleWithProviders = RouterModule.forRoot(routes);

@ -1,5 +1,4 @@
import { Component, OnInit, OnDestroy, ViewChild } from '@angular/core';
import { Router } from '@angular/router';
import { Subject } from 'rxjs';
import { takeUntil, filter } from 'rxjs/operators';
@ -11,9 +10,10 @@ import { Node } from '../../../shared/models/RTLconfig';
import { Channel } from '../../../shared/models/lndModels';
import { LoggerService } from '../../../shared/services/logger.service';
import { RTLEffects } from '../../../shared/store/rtl.effects';
import * as RTLActions from '../../../shared/store/rtl.actions';
import * as fromRTLReducer from '../../../shared/store/rtl.reducers';
import * as LNDActions from '../../store/lnd.actions';
import * as fromLNDReducer from '../../store/lnd.reducers';
import * as RTLActions from '../../../store/rtl.actions';
import * as fromRTLReducer from '../../../store/rtl.reducers';
@Component({
selector: 'rtl-channel-backup',
@ -28,25 +28,20 @@ export class ChannelBackupComponent implements OnInit, OnDestroy {
public channels: any;
public flgLoading: Array<Boolean | 'error'> = [true]; // 0: channels
public flgSticky = false;
private unSubs: Array<Subject<void>> = [new Subject(), new Subject(), new Subject(), new Subject()];
private unSubs: Array<Subject<void>> = [new Subject(), new Subject(), new Subject(), new Subject(), new Subject()];
constructor(private logger: LoggerService, private store: Store<fromRTLReducer.State>, private rtlEffects: RTLEffects, private actions$: Actions, private router: Router) {}
constructor(private logger: LoggerService, private store: Store<fromRTLReducer.State>,
private lndStore: Store<fromLNDReducer.LNDState>, private actions$: Actions) {}
ngOnInit() {
this.store.select('rtlRoot')
.pipe(takeUntil(this.unSubs[0]))
.subscribe((rtlStore: fromRTLReducer.State) => {
this.selNode = rtlStore.selNode;
rtlStore.effectErrors.forEach(effectsErr => {
if (effectsErr.action === 'Fetchchannels') {
this.flgLoading[0] = 'error';
}
});
this.lndStore.select('lnd')
.pipe(takeUntil(this.unSubs[4]))
.subscribe(lndStore => {
this.channels = new MatTableDataSource([]);
this.channels.data = [];
if (undefined !== rtlStore.allChannels) {
this.channels = new MatTableDataSource<Channel>([...rtlStore.allChannels]);
this.channels.data = rtlStore.allChannels;
if (undefined !== lndStore.allChannels) {
this.channels = new MatTableDataSource<Channel>([...lndStore.allChannels]);
this.channels.data = lndStore.allChannels;
}
this.channels.sort = this.sort;
this.channels.filterPredicate = (channel: Channel, fltr: string) => {
@ -61,25 +56,36 @@ export class ChannelBackupComponent implements OnInit, OnDestroy {
if (this.flgLoading[0] !== 'error') {
this.flgLoading[0] = false;
}
this.logger.info(lndStore);
});
this.store.select('rtlRoot')
.pipe(takeUntil(this.unSubs[0]))
.subscribe((rtlStore: fromRTLReducer.State) => {
this.selNode = rtlStore.selNode;
rtlStore.effectErrors.forEach(effectsErr => {
if (effectsErr.action === 'Fetchchannels') {
this.flgLoading[0] = 'error';
}
});
this.logger.info(rtlStore);
});
this.actions$
.pipe(
takeUntil(this.unSubs[1]),
filter((action) => action.type === RTLActions.SET_CHANNELS)
).subscribe((setchannels: RTLActions.SetChannels) => {
filter((action) => action.type === LNDActions.SET_CHANNELS)
).subscribe((setchannels: LNDActions.SetChannels) => {
this.selChannel = undefined;
});
}
onBackupChannels(selChannel: Channel) {
this.store.dispatch(new RTLActions.OpenSpinner('Backup Channels...'));
this.store.dispatch(new RTLActions.BackupChannels({channelPoint: (selChannel.channel_point) ? selChannel.channel_point : 'ALL', showMessage: ''}));
this.store.dispatch(new LNDActions.BackupChannels({channelPoint: (selChannel.channel_point) ? selChannel.channel_point : 'ALL', showMessage: ''}));
}
onVerifyChannels(selChannel: Channel) {
this.store.dispatch(new RTLActions.OpenSpinner('Verify Channels...'));
this.store.dispatch(new RTLActions.VerifyChannels({channelPoint: (selChannel.channel_point) ? selChannel.channel_point : 'ALL'}));
this.store.dispatch(new LNDActions.VerifyChannels({channelPoint: (selChannel.channel_point) ? selChannel.channel_point : 'ALL'}));
}
onChannelClick(selRow: Channel, event: any) {

@ -8,9 +8,10 @@ import { MatTableDataSource, MatSort } from '@angular/material';
import { ClosedChannel } from '../../../shared/models/lndModels';
import { LoggerService } from '../../../shared/services/logger.service';
import { RTLEffects } from '../../../shared/store/rtl.effects';
import * as RTLActions from '../../../shared/store/rtl.actions';
import * as fromRTLReducer from '../../../shared/store/rtl.reducers';
import * as LNDActions from '../../store/lnd.actions';
import * as fromLNDReducer from '../../store/lnd.reducers';
import * as RTLActions from '../../../store/rtl.actions';
import * as fromRTLReducer from '../../../store/rtl.reducers';
@Component({
selector: 'rtl-channel-closed',
@ -24,9 +25,9 @@ export class ChannelClosedComponent implements OnInit, OnDestroy {
public flgLoading: Array<Boolean | 'error'> = [true];
public selectedFilter = '';
public flgSticky = false;
private unsub: Array<Subject<void>> = [new Subject(), new Subject(), new Subject()];
private unsubs: Array<Subject<void>> = [new Subject(), new Subject(), new Subject(), new Subject()];
constructor(private logger: LoggerService, private store: Store<fromRTLReducer.State>, private rtlEffects: RTLEffects, private actions$: Actions) {
constructor(private logger: LoggerService, private store: Store<fromRTLReducer.State>, private lndStore: Store<fromLNDReducer.LNDState>, private actions$: Actions) {
switch (true) {
case (window.innerWidth <= 415):
this.displayedColumns = ['close_type', 'chan_id', 'settled_balance'];
@ -51,24 +52,29 @@ export class ChannelClosedComponent implements OnInit, OnDestroy {
}
ngOnInit() {
this.store.dispatch(new RTLActions.FetchChannels({routeParam: 'closed'}));
this.actions$.pipe(takeUntil(this.unsub[2]), filter((action) => action.type === RTLActions.RESET_STORE)).subscribe((resetStore: RTLActions.ResetStore) => {
this.store.dispatch(new RTLActions.FetchChannels({routeParam: 'closed'}));
this.store.dispatch(new LNDActions.FetchChannels({routeParam: 'closed'}));
this.actions$.pipe(takeUntil(this.unsubs[2]), filter((action) => action.type === RTLActions.RESET_STORE)).subscribe((resetStore: RTLActions.ResetStore) => {
this.store.dispatch(new LNDActions.FetchChannels({routeParam: 'closed'}));
});
this.lndStore.select('lnd')
.pipe(takeUntil(this.unsubs[3]))
.subscribe(lndStore => {
if (undefined !== lndStore.closedChannels) {
this.loadClosedChannelsTable(lndStore.closedChannels);
}
if (this.flgLoading[0] !== 'error') {
this.flgLoading[0] = (undefined !== lndStore.closedChannels) ? false : true;
}
this.logger.info(lndStore);
});
this.store.select('rtlRoot')
.pipe(takeUntil(this.unsub[0]))
.pipe(takeUntil(this.unsubs[0]))
.subscribe((rtlStore: fromRTLReducer.State) => {
rtlStore.effectErrors.forEach(effectsErr => {
if (effectsErr.action === 'FetchChannels/closed') {
this.flgLoading[0] = 'error';
}
});
if (undefined !== rtlStore.closedChannels) {
this.loadClosedChannelsTable(rtlStore.closedChannels);
}
if (this.flgLoading[0] !== 'error') {
this.flgLoading[0] = (undefined !== rtlStore.closedChannels) ? false : true;
}
this.logger.info(rtlStore);
});
@ -102,7 +108,7 @@ export class ChannelClosedComponent implements OnInit, OnDestroy {
}
ngOnDestroy() {
this.unsub.forEach(completeSub => {
this.unsubs.forEach(completeSub => {
completeSub.next();
completeSub.complete();
});

@ -10,9 +10,12 @@ import { MatTableDataSource, MatSort } from '@angular/material';
import { Channel, Peer, GetInfo } from '../../../shared/models/lndModels';
import { LoggerService } from '../../../shared/services/logger.service';
import { RTLEffects } from '../../../shared/store/rtl.effects';
import * as RTLActions from '../../../shared/store/rtl.actions';
import * as fromRTLReducer from '../../../shared/store/rtl.reducers';
import { LNDEffects } from '../../store/lnd.effects';
import * as LNDActions from '../../store/lnd.actions';
import * as fromLNDReducer from '../../store/lnd.reducers';
import { RTLEffects } from '../../../store/rtl.effects';
import * as RTLActions from '../../../store/rtl.actions';
import * as fromRTLReducer from '../../../store/rtl.reducers';
@Component({
selector: 'rtl-channel-manage',
@ -40,9 +43,10 @@ export class ChannelManageComponent implements OnInit, OnDestroy {
public moreOptions = false;
public flgSticky = false;
public redirectedWithPeer = false;
private unsub: Array<Subject<void>> = [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()];
constructor(private logger: LoggerService, private store: Store<fromRTLReducer.State>, private rtlEffects: RTLEffects, private activatedRoute: ActivatedRoute) {
constructor(private logger: LoggerService, private store: Store<fromRTLReducer.State>, private rtlEffects: RTLEffects,
private lndEffects: LNDEffects, private lndStore: Store<fromLNDReducer.LNDState>, private activatedRoute: ActivatedRoute) {
switch (true) {
case (window.innerWidth <= 415):
this.displayedColumns = ['close', 'update', 'active', 'chan_id', 'remote_alias'];
@ -67,29 +71,35 @@ export class ChannelManageComponent implements OnInit, OnDestroy {
}
ngOnInit() {
this.store.select('rtlRoot')
.pipe(takeUntil(this.unsub[0]))
.subscribe((rtlStore: fromRTLReducer.State) => {
rtlStore.effectErrors.forEach(effectsErr => {
if (effectsErr.action === 'FetchChannels/all') {
this.flgLoading[0] = 'error';
}
});
this.information = rtlStore.information;
this.peers = rtlStore.peers;
this.lndStore.select('lnd')
.pipe(takeUntil(this.unsubs[5]))
.subscribe(lndStore => {
this.information = lndStore.information;
this.peers = lndStore.peers;
this.peers.forEach(peer => {
if (undefined === peer.alias || peer.alias === '') {
peer.alias = peer.pub_key.substring(0, 15) + '...';
}
});
this.totalBalance = +rtlStore.blockchainBalance.total_balance;
if (undefined !== rtlStore.allChannels) {
this.loadChannelsTable(rtlStore.allChannels);
this.totalBalance = lndStore ? +lndStore.blockchainBalance.total_balance : -1;
if (undefined !== lndStore.allChannels) {
this.loadChannelsTable(lndStore.allChannels);
}
if (this.flgLoading[0] !== 'error') {
this.flgLoading[0] = (undefined !== rtlStore.allChannels) ? false : true;
this.flgLoading[0] = (undefined !== lndStore.allChannels) ? false : true;
}
this.logger.info(lndStore);
});
this.store.select('rtlRoot')
.pipe(takeUntil(this.unsubs[0]))
.subscribe((rtlStore: fromRTLReducer.State) => {
rtlStore.effectErrors.forEach(effectsErr => {
if (effectsErr.action === 'FetchChannels/all') {
this.flgLoading[0] = 'error';
}
});
this.logger.info(rtlStore);
});
this.activatedRoute.paramMap.subscribe(() => {
@ -106,7 +116,7 @@ export class ChannelManageComponent implements OnInit, OnDestroy {
} else if (this.selTransType === '2') {
transTypeValue = this.transTypeValue.fees;
}
this.store.dispatch(new RTLActions.SaveNewChannel({
this.store.dispatch(new LNDActions.SaveNewChannel({
selectedPeerPubkey: this.selectedPeer, fundingAmount: this.fundingAmount, private: this.isPrivate,
transType: this.selTransType, transTypeValue: transTypeValue, spendUnconfirmed: this.spendUnconfirmed
}));
@ -124,22 +134,22 @@ export class ChannelManageComponent implements OnInit, OnDestroy {
]
}}));
this.rtlEffects.closeConfirm
.pipe(takeUntil(this.unsub[2]))
.pipe(takeUntil(this.unsubs[2]))
.subscribe(confirmRes => {
if (confirmRes) {
const base_fee = confirmRes[0].inputValue;
const fee_rate = confirmRes[1].inputValue;
const time_lock_delta = confirmRes[2].inputValue;
this.store.dispatch(new RTLActions.OpenSpinner('Updating Channel Policy...'));
this.store.dispatch(new RTLActions.UpdateChannels({baseFeeMsat: base_fee, feeRate: fee_rate, timeLockDelta: time_lock_delta, chanPoint: 'all'}));
this.store.dispatch(new LNDActions.UpdateChannels({baseFeeMsat: base_fee, feeRate: fee_rate, timeLockDelta: time_lock_delta, chanPoint: 'all'}));
}
});
} else {
this.myChanPolicy = {fee_base_msat: 0, fee_rate_milli_msat: 0, time_lock_delta: 0};
this.store.dispatch(new RTLActions.OpenSpinner('Fetching Channel Policy...'));
this.store.dispatch(new RTLActions.ChannelLookup(channelToUpdate.chan_id.toString()));
this.rtlEffects.setLookup
.pipe(takeUntil(this.unsub[3]))
this.store.dispatch(new LNDActions.ChannelLookup(channelToUpdate.chan_id.toString()));
this.lndEffects.setLookup
.pipe(takeUntil(this.unsubs[3]))
.subscribe(resLookup => {
this.logger.info(resLookup);
if (resLookup.node1_pub === this.information.identity_pubkey) {
@ -162,14 +172,14 @@ export class ChannelManageComponent implements OnInit, OnDestroy {
}}));
});
this.rtlEffects.closeConfirm
.pipe(takeUntil(this.unsub[2]))
.pipe(takeUntil(this.unsubs[4]))
.subscribe(confirmRes => {
if (confirmRes) {
const base_fee = confirmRes[0].inputValue;
const fee_rate = confirmRes[1].inputValue;
const time_lock_delta = confirmRes[2].inputValue;
this.store.dispatch(new RTLActions.OpenSpinner('Updating Channel Policy...'));
this.store.dispatch(new RTLActions.UpdateChannels({baseFeeMsat: base_fee, feeRate: fee_rate, timeLockDelta: time_lock_delta, chanPoint: channelToUpdate.channel_point}));
this.store.dispatch(new LNDActions.UpdateChannels({baseFeeMsat: base_fee, feeRate: fee_rate, timeLockDelta: time_lock_delta, chanPoint: channelToUpdate.channel_point}));
}
});
}
@ -181,11 +191,11 @@ export class ChannelManageComponent implements OnInit, OnDestroy {
width: '70%', data: { type: 'CONFIRM', titleMessage: 'Closing channel: ' + channelToClose.chan_id, noBtnText: 'Cancel', yesBtnText: 'Close Channel'
}}));
this.rtlEffects.closeConfirm
.pipe(takeUntil(this.unsub[1]))
.pipe(takeUntil(this.unsubs[1]))
.subscribe(confirmRes => {
if (confirmRes) {
this.store.dispatch(new RTLActions.OpenSpinner('Closing Channel...'));
this.store.dispatch(new RTLActions.CloseChannel({channelPoint: channelToClose.channel_point, forcibly: !channelToClose.active}));
this.store.dispatch(new LNDActions.CloseChannel({channelPoint: channelToClose.channel_point, forcibly: !channelToClose.active}));
}
});
}
@ -255,7 +265,7 @@ export class ChannelManageComponent implements OnInit, OnDestroy {
}
ngOnDestroy() {
this.unsub.forEach(completeSub => {
this.unsubs.forEach(completeSub => {
completeSub.next();
completeSub.complete();
});

@ -8,9 +8,9 @@ import { Channel, GetInfo, PendingChannels } from '../../../shared/models/lndMod
import { Node } from '../../../shared/models/RTLconfig';
import { LoggerService } from '../../../shared/services/logger.service';
import { RTLEffects } from '../../../shared/store/rtl.effects';
import * as RTLActions from '../../../shared/store/rtl.actions';
import * as fromRTLReducer from '../../../shared/store/rtl.reducers';
import * as fromLNDReducer from '../../store/lnd.reducers';
import * as RTLActions from '../../../store/rtl.actions';
import * as fromRTLReducer from '../../../store/rtl.reducers';
@Component({
selector: 'rtl-channel-pending',
@ -48,9 +48,9 @@ export class ChannelPendingComponent implements OnInit, OnDestroy {
public pendingWaitClosingChannelsLength = 0;
public pendingWaitClosingChannels: any;
public flgLoading: Array<Boolean | 'error'> = [true];
private unsub: Array<Subject<void>> = [new Subject(), new Subject()];
private unsubs: Array<Subject<void>> = [new Subject(), new Subject(), new Subject()];
constructor(private logger: LoggerService, private store: Store<fromRTLReducer.State>, private rtlEffects: RTLEffects) {
constructor(private logger: LoggerService, private store: Store<fromRTLReducer.State>, private lndStore: Store<fromLNDReducer.LNDState>) {
switch (true) {
case (window.innerWidth <= 415):
this.displayedClosingColumns = ['remote_node_pub', 'local_balance', 'remote_balance'];
@ -96,18 +96,11 @@ export class ChannelPendingComponent implements OnInit, OnDestroy {
}
ngOnInit() {
this.store.select('rtlRoot')
.pipe(takeUntil(this.unsub[0]))
.subscribe((rtlStore: fromRTLReducer.State) => {
rtlStore.effectErrors.forEach(effectsErr => {
if (effectsErr.action === 'FetchChannels/pending') {
this.flgLoading[0] = 'error';
}
});
this.selNode = rtlStore.selNode;
this.information = rtlStore.information;
this.pendingChannels = rtlStore.pendingChannels;
this.lndStore.select('lnd')
.pipe(takeUntil(this.unsubs[2]))
.subscribe(lndStore => {
this.information = lndStore.information;
this.pendingChannels = lndStore.pendingChannels;
if (undefined !== this.pendingChannels.total_limbo_balance) {
this.flgLoading[1] = false;
if (undefined !== this.pendingChannels.pending_closing_channels) {
@ -126,6 +119,19 @@ export class ChannelPendingComponent implements OnInit, OnDestroy {
if (this.flgLoading[0] !== 'error') {
this.flgLoading[0] = (undefined !== this.information.identity_pubkey) ? false : true;
}
this.logger.info(lndStore);
});
this.store.select('rtlRoot')
.pipe(takeUntil(this.unsubs[0]))
.subscribe((rtlStore: fromRTLReducer.State) => {
rtlStore.effectErrors.forEach(effectsErr => {
if (effectsErr.action === 'FetchChannels/pending') {
this.flgLoading[0] = 'error';
}
});
this.selNode = rtlStore.selNode;
this.logger.info(rtlStore);
});
@ -232,7 +238,7 @@ export class ChannelPendingComponent implements OnInit, OnDestroy {
}
ngOnDestroy() {
this.unsub.forEach(completeSub => {
this.unsubs.forEach(completeSub => {
completeSub.next();
completeSub.complete();
});

@ -7,7 +7,8 @@ import { LoggerService } from '../../shared/services/logger.service';
import { GetInfo, NetworkInfo, Fees, Peer } from '../../shared/models/lndModels';
import { Node } from '../../shared/models/RTLconfig';
import * as fromRTLReducer from '../../shared/store/rtl.reducers';
import * as fromLNDReducer from '../store/lnd.reducers';
import * as fromRTLReducer from '../../store/rtl.reducers';
@Component({
selector: 'rtl-home',
@ -26,7 +27,7 @@ export class HomeComponent implements OnInit, OnDestroy {
public BTCchannelBalance = '';
public networkInfo: NetworkInfo = {};
public flgLoading: Array<Boolean | 'error'> = [true, true, true, true, true, true, true, true]; // 0: Info, 1: Fee, 2: Wallet, 3: Channel, 4: Network
private unsub: Array<Subject<void>> = [new Subject(), new Subject(), new Subject()];
private unsubs: Array<Subject<void>> = [new Subject(), new Subject()];
public channels: any;
public position = 'below';
public activeChannels = 0;
@ -41,7 +42,7 @@ export class HomeComponent implements OnInit, OnDestroy {
yAxisLabel = 'Balance';
colorScheme = {domain: ['#FFFFFF']};
constructor(private logger: LoggerService, private store: Store<fromRTLReducer.State>) {
constructor(private logger: LoggerService, private store: Store<fromRTLReducer.State>, private lndStore: Store<fromLNDReducer.LNDState>) {
switch (true) {
case (window.innerWidth <= 730):
this.view = [250, 352];
@ -64,8 +65,50 @@ export class HomeComponent implements OnInit, OnDestroy {
ngOnInit() {
this.flgTotalCalculated = false;
this.lndStore.select('lnd')
.pipe(takeUntil(this.unsubs[1]))
.subscribe(lndStore => {
this.information = lndStore.information;
if (this.flgLoading[0] !== 'error') {
this.flgLoading[0] = (undefined !== this.information.identity_pubkey) ? false : true;
}
this.fees = lndStore.fees;
if (this.flgLoading[1] !== 'error') {
this.flgLoading[1] = (undefined !== this.fees.day_fee_sum) ? false : true;
}
this.totalBalance = lndStore.blockchainBalance.total_balance;
this.BTCtotalBalance = lndStore.blockchainBalance.btc_total_balance;
if (this.flgLoading[2] !== 'error') {
this.flgLoading[2] = ('' !== this.totalBalance) ? false : true;
}
this.channelBalance = lndStore.channelBalance.balance;
this.BTCchannelBalance = lndStore.channelBalance.btc_balance;
if (this.flgLoading[3] !== 'error') {
this.flgLoading[3] = ('' !== this.channelBalance) ? false : true;
}
this.networkInfo = lndStore.networkInfo;
if (this.flgLoading[4] !== 'error') {
this.flgLoading[4] = (undefined !== this.networkInfo.num_nodes) ? false : true;
}
this.totalBalances = [...[{'name': 'Local Balance', 'value': +lndStore.totalLocalBalance}, {'name': 'Remote Balance', 'value': +lndStore.totalRemoteBalance}]];
this.maxBalanceValue = (lndStore.totalLocalBalance > lndStore.totalRemoteBalance) ? lndStore.totalLocalBalance : lndStore.totalRemoteBalance;
if (lndStore.totalLocalBalance >= 0 && lndStore.totalRemoteBalance >= 0) {
this.flgTotalCalculated = true;
if (this.flgLoading[5] !== 'error') {
this.flgLoading[5] = false;
}
}
this.activeChannels = lndStore.numberOfActiveChannels;
this.inactiveChannels = lndStore.numberOfInactiveChannels;
this.pendingChannels = (undefined !== lndStore.pendingChannels.pending_open_channels) ? lndStore.pendingChannels.pending_open_channels.length : 0;
if (lndStore.totalLocalBalance >= 0 && lndStore.totalRemoteBalance >= 0 && this.flgLoading[6] !== 'error') {
this.flgLoading[6] = false;
}
this.totalPeers = (lndStore.peers !== null) ? lndStore.peers.length : 0;
this.logger.info(lndStore);
});
this.store.select('rtlRoot')
.pipe(takeUntil(this.unsub[0]))
.pipe(takeUntil(this.unsubs[0]))
.subscribe((rtlStore: fromRTLReducer.State) => {
rtlStore.effectErrors.forEach(effectsErr => {
if (effectsErr.action === 'FetchInfo') {
@ -89,57 +132,12 @@ export class HomeComponent implements OnInit, OnDestroy {
}
});
this.selNode = rtlStore.selNode;
this.information = rtlStore.information;
if (this.flgLoading[0] !== 'error') {
this.flgLoading[0] = (undefined !== this.information.identity_pubkey) ? false : true;
}
this.fees = rtlStore.fees;
if (this.flgLoading[1] !== 'error') {
this.flgLoading[1] = (undefined !== this.fees.day_fee_sum) ? false : true;
}
this.totalBalance = rtlStore.blockchainBalance.total_balance;
this.BTCtotalBalance = rtlStore.blockchainBalance.btc_total_balance;
if (this.flgLoading[2] !== 'error') {
this.flgLoading[2] = ('' !== this.totalBalance) ? false : true;
}
this.channelBalance = rtlStore.channelBalance.balance;
this.BTCchannelBalance = rtlStore.channelBalance.btc_balance;
if (this.flgLoading[3] !== 'error') {
this.flgLoading[3] = ('' !== this.channelBalance) ? false : true;
}
this.networkInfo = rtlStore.networkInfo;
if (this.flgLoading[4] !== 'error') {
this.flgLoading[4] = (undefined !== this.networkInfo.num_nodes) ? false : true;
}
this.totalBalances = [...[{'name': 'Local Balance', 'value': +rtlStore.totalLocalBalance}, {'name': 'Remote Balance', 'value': +rtlStore.totalRemoteBalance}]];
this.maxBalanceValue = (rtlStore.totalLocalBalance > rtlStore.totalRemoteBalance) ? rtlStore.totalLocalBalance : rtlStore.totalRemoteBalance;
if (rtlStore.totalLocalBalance >= 0 && rtlStore.totalRemoteBalance >= 0) {
this.flgTotalCalculated = true;
if (this.flgLoading[5] !== 'error') {
this.flgLoading[5] = false;
}
}
this.activeChannels = rtlStore.numberOfActiveChannels;
this.inactiveChannels = rtlStore.numberOfInactiveChannels;
this.pendingChannels = (undefined !== rtlStore.pendingChannels.pending_open_channels) ? rtlStore.pendingChannels.pending_open_channels.length : 0;
if (rtlStore.totalLocalBalance >= 0 && rtlStore.totalRemoteBalance >= 0 && this.flgLoading[6] !== 'error') {
this.flgLoading[6] = false;
}
this.totalPeers = (rtlStore.peers !== null) ? rtlStore.peers.length : 0;
this.logger.info(rtlStore);
});
}
ngOnDestroy() {
this.unsub.forEach(completeSub => {
this.unsubs.forEach(completeSub => {
completeSub.next();
completeSub.complete();
});

@ -1,9 +1,8 @@
import { Component, OnInit, OnDestroy, ViewChild } from '@angular/core';
import { formatDate } from '@angular/common';
import { Subject } from 'rxjs';
import { takeUntil, filter } from 'rxjs/operators';
import { takeUntil } from 'rxjs/operators';
import { Store } from '@ngrx/store';
import { Actions } from '@ngrx/effects';
import { MatTableDataSource, MatSort } from '@angular/material';
import { Node } from '../../shared/models/RTLconfig';
@ -11,8 +10,11 @@ import { GetInfo, Invoice } from '../../shared/models/lndModels';
import { LoggerService } from '../../shared/services/logger.service';
import { newlyAddedRowAnimation } from '../../shared/animation/row-animation';
import * as RTLActions from '../../shared/store/rtl.actions';
import * as fromRTLReducer from '../../shared/store/rtl.reducers';
import * as LNDActions from '../store/lnd.actions';
import * as fromLNDReducer from '../store/lnd.reducers';
import * as RTLActions from '../../store/rtl.actions';
import * as fromRTLReducer from '../../store/rtl.reducers';
@Component({
selector: 'rtl-invoices',
@ -41,9 +43,9 @@ export class InvoicesComponent implements OnInit, OnDestroy {
public pageSizeOptions = [5, 10, 25, 100];
private firstOffset = -1;
private lastOffset = -1;
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(), new Subject()];
constructor(private logger: LoggerService, private store: Store<fromRTLReducer.State>, private actions$: Actions) {
constructor(private logger: LoggerService, private store: Store<fromRTLReducer.State>, private lndStore: Store<fromLNDReducer.LNDState>) {
switch (true) {
case (window.innerWidth <= 415):
this.displayedColumns = ['settled', 'creation_date', 'memo', 'value'];
@ -66,6 +68,20 @@ export class InvoicesComponent implements OnInit, OnDestroy {
}
ngOnInit() {
this.lndStore.select('lnd')
.pipe(takeUntil(this.unSubs[5]))
.subscribe(lndStore => {
this.information = lndStore ? lndStore.information : {};
this.totalInvoices = lndStore ? lndStore.totalInvoices : -1;
this.firstOffset = lndStore ? +lndStore.invoices.first_index_offset : -1;
this.lastOffset = lndStore ? +lndStore.invoices.last_index_offset : -1;
this.loadInvoicesTable(lndStore.invoices.invoices);
if (this.flgLoading[0] !== 'error') {
this.flgLoading[0] = (undefined !== lndStore && undefined !== lndStore.invoices) ? false : true;
}
this.logger.info(lndStore);
});
this.store.select('rtlRoot')
.pipe(takeUntil(this.unSubs[0]))
.subscribe((rtlStore: fromRTLReducer.State) => {
@ -75,15 +91,6 @@ export class InvoicesComponent implements OnInit, OnDestroy {
}
});
this.selNode = rtlStore.selNode;
this.information = rtlStore.information;
this.totalInvoices = rtlStore.totalInvoices;
this.firstOffset = +rtlStore.invoices.first_index_offset;
this.lastOffset = +rtlStore.invoices.last_index_offset;
this.logger.info(rtlStore);
this.loadInvoicesTable(rtlStore.invoices.invoices);
if (this.flgLoading[0] !== 'error') {
this.flgLoading[0] = (undefined !== rtlStore.invoices) ? false : true;
}
});
}
@ -93,7 +100,7 @@ export class InvoicesComponent implements OnInit, OnDestroy {
this.newlyAddedInvoiceMemo = this.memo;
this.newlyAddedInvoiceValue = this.invoiceValue;
this.store.dispatch(new RTLActions.OpenSpinner('Adding Invoice...'));
this.store.dispatch(new RTLActions.SaveNewInvoice({
this.store.dispatch(new LNDActions.SaveNewInvoice({
memo: this.memo, invoiceValue: this.invoiceValue, private: this.private, expiry: (this.expiry ? this.expiry : 3600), pageSize: this.pageSize
}));
this.resetData();
@ -151,7 +158,7 @@ export class InvoicesComponent implements OnInit, OnDestroy {
reversed = true;
index_offset = 0;
}
this.store.dispatch(new RTLActions.FetchInvoices({num_max_invoices: event.pageSize, index_offset: index_offset, reversed: reversed}));
this.store.dispatch(new LNDActions.FetchInvoices({num_max_invoices: event.pageSize, index_offset: index_offset, reversed: reversed}));
}
ngOnDestroy() {

@ -0,0 +1,48 @@
<div fxLayout="column" id="rtl-container" class="rtl-container" [ngClass]="settings.theme" [class.horizontal]="settings.menu === 'Horizontal'" [class.compact]="settings.menuType === 'Compact'" [class.mini]="settings.menuType === 'Mini'">
<mat-sidenav-container>
<mat-sidenav perfectScrollbar *ngIf="settings.menu === 'Vertical'" [opened]="settings.flgSidenavOpened" [mode]="(settings.flgSidenavPinned) ? 'side' : 'over'"
#sideNavigation class="sidenav mat-elevation-z6 overflow-auto">
<rtl-side-navigation (ChildNavClicked)="onNavigationClicked($event)"></rtl-side-navigation>
</mat-sidenav>
<mat-sidenav-content perfectScrollbar class="overflow-auto">
<mat-toolbar fxLayout="row" fxLayoutAlign="space-between center" color="primary" class="padding-gap-x">
<div fxLayoutAlign="center center">
<button *ngIf="settings.menu === 'Vertical'" mat-icon-button (click)="sideNavToggle()">
<mat-icon>menu</mat-icon>
</button>
</div>
<div>
<h2>Ride The Lightning <span class="font-60-percent">(Beta)</span></h2>
</div>
<div fxLayoutAlign="space-between center">
<rtl-top-menu></rtl-top-menu>
</div>
</mat-toolbar>
<div fxLayout="row" fxLayoutAlign="center center" class="bg-primary flex-wrap pubkey-info-top" rtlClipboard [payload]="information?.identity_pubkey" (copied)="copiedText($event)">
<mat-icon [ngClass]="{'icon-smaller': smallScreen}">vpn_key</mat-icon>
<div [ngClass]="{'word-break font-9px': smallScreen, 'word-break': !smallScreen}">&nbsp;{{information?.identity_pubkey}}
<mat-spinner [diameter]="20" *ngIf="flgLoading[0]" class="inline-spinner foreground"></mat-spinner>
<mat-icon [ngClass]="{'icon-smaller cursor-pointer copy-icon-smaller': smallScreen, 'icon-small cursor-pointer copy-icon': !smallScreen}">file_copy</mat-icon><span [hidden]="!flgCopied">Copied</span>
</div>
</div>
<mat-toolbar color="primary" *ngIf="settings.menu === 'Horizontal'" class="padding-gap-x horizontal-nav">
<div fxLayout="row" fxFlex="100" fxLayoutAlign="center center" class="h-100">
<rtl-horizontal-navigation></rtl-horizontal-navigation>
</div>
</mat-toolbar>
<div [ngClass]="{'mt-minus-1': smallScreen, 'inner-sidenav-content': true}">
<router-outlet></router-outlet>
</div>
<div fxLayout="row" fxLayoutAlign="center center" class="bg-primary settings-icon" (click)="settingSidenav.toggle()">
<mat-icon class="animate-settings">settings</mat-icon>
</div>
</mat-sidenav-content>
<mat-sidenav #settingSidenav position="end" class="settings mat-elevation-z6" mode="side">
<rtl-settings-nav (done)="settingSidenav.toggle()"></rtl-settings-nav>
</mat-sidenav>
</mat-sidenav-container>
<div class="rtl-spinner" *ngIf="undefined === settings.theme">
<mat-spinner color="accent"></mat-spinner>
<h4>Loading RTL...</h4>
</div>
</div>

@ -0,0 +1,4 @@
.inline-spinner {
display: inline-flex !important;
top: 0px !important;
}

@ -0,0 +1,172 @@
import { Component, OnInit, AfterViewInit, OnDestroy, ViewChild, HostListener } from '@angular/core';
import { Router } from '@angular/router';
import { Subject } from 'rxjs';
import { takeUntil, filter } from 'rxjs/operators';
import { Store } from '@ngrx/store';
import { Actions } from '@ngrx/effects';
import { UserIdleService } from 'angular-user-idle';
import * as sha256 from 'sha256';
import { LoggerService } from '../shared/services/logger.service';
import { RTLConfiguration, Settings, Node } from '../shared/models/RTLconfig';
import { GetInfo } from '../shared/models/lndModels';
import * as LNDActions from './store/lnd.actions';
import * as RTLActions from '../store/rtl.actions';
import * as fromRTLReducer from '../store/rtl.reducers';
@Component({
selector: 'rtl-lnd-root-app',
templateUrl: './lnd-root.component.html',
styleUrls: ['./lnd-root.component.scss']
})
export class LndRootComponent implements OnInit, AfterViewInit, OnDestroy {
@ViewChild('sideNavigation', { static: true }) sideNavigation: any;
@ViewChild('settingSidenav', { static: true }) settingSidenav: any;
public selNode: Node;
public settings: Settings;
public information: GetInfo = {};
public flgLoading: Array<Boolean | 'error'> = [true]; // 0: Info
public flgCopied = false;
public appConfig: RTLConfiguration;
public accessKey = '';
public smallScreen = false;
unsubs: Array<Subject<void>> = [new Subject(), new Subject(), new Subject()];
constructor(private logger: LoggerService, private store: Store<fromRTLReducer.State>, private actions$: Actions,
private userIdle: UserIdleService, private router: Router) {}
ngOnInit() {
this.store.dispatch(new RTLActions.FetchRTLConfig());
this.accessKey = this.readAccessKey();
this.store.select('rtlRoot')
.pipe(takeUntil(this.unsubs[0]))
.subscribe(rtlStore => {
this.selNode = rtlStore.selNode;
this.settings = this.selNode.settings;
this.appConfig = rtlStore.appConfig;
this.information = rtlStore.information;
this.flgLoading[0] = (undefined !== this.information.identity_pubkey) ? false : true;
if (window.innerWidth <= 768) {
this.settings.menu = 'Vertical';
this.settings.flgSidenavOpened = false;
this.settings.flgSidenavPinned = false;
}
if (window.innerWidth <= 414) {
this.smallScreen = true;
}
this.logger.info(this.settings);
if (!sessionStorage.getItem('token')) {
this.flgLoading[0] = false;
}
});
if (sessionStorage.getItem('token')) {
this.store.dispatch(new LNDActions.FetchInfo());
}
this.actions$
.pipe(
takeUntil(this.unsubs[1]),
filter((action) => action.type === RTLActions.INIT_APP_DATA || action.type === RTLActions.SET_RTL_CONFIG)
).subscribe((actionPayload: (RTLActions.InitAppData | RTLActions.SetRTLConfig)) => {
if (actionPayload.type === RTLActions.SET_RTL_CONFIG) {
if (!sessionStorage.getItem('token')) {
if (+actionPayload.payload.sso.rtlSSO) {
this.store.dispatch(new RTLActions.Signin(sha256(this.accessKey)));
} else {
this.router.navigate([this.appConfig.sso.logoutRedirectLink]);
}
}
if (
this.settings.menu === 'Horizontal' ||
this.settings.menuType === 'Compact' ||
this.settings.menuType === 'Mini') {
this.settingSidenav.toggle(); // To dynamically update the width to 100% after side nav is closed
setTimeout(() => { this.settingSidenav.toggle(); }, 100);
}
} else if (actionPayload.type === RTLActions.INIT_APP_DATA) {
this.store.dispatch(new LNDActions.FetchInfo());
}
});
this.actions$
.pipe(
takeUntil(this.unsubs[1]),
filter((action) => action.type === LNDActions.SET_INFO)
).subscribe((infoData: LNDActions.SetInfo) => {
if (undefined !== infoData.payload.identity_pubkey) {
this.initializeRemainingData();
}
});
this.userIdle.startWatching();
this.userIdle.onTimerStart().subscribe(count => {});
this.userIdle.onTimeout().subscribe(() => {
if (sessionStorage.getItem('token')) {
this.logger.warn('Time limit exceeded for session inactivity! Logging out!');
this.store.dispatch(new RTLActions.OpenAlert({ width: '75%', data: {
type: 'WARN',
titleMessage: 'Time limit exceeded for session inactivity! Logging out!'
}}));
this.store.dispatch(new RTLActions.Signout());
this.userIdle.resetTimer();
}
});
}
private readAccessKey() {
const url = window.location.href;
return url.substring(url.lastIndexOf('access-key=') + 11).trim();
}
initializeRemainingData() {
this.store.dispatch(new LNDActions.FetchPeers());
this.store.dispatch(new LNDActions.FetchBalance('channels'));
this.store.dispatch(new LNDActions.FetchFees());
this.store.dispatch(new LNDActions.FetchNetwork());
this.store.dispatch(new LNDActions.FetchChannels({routeParam: 'all'}));
this.store.dispatch(new LNDActions.FetchChannels({routeParam: 'pending'}));
this.store.dispatch(new LNDActions.FetchInvoices({num_max_invoices: 25, reversed: true}));
this.store.dispatch(new LNDActions.FetchPayments());
}
ngAfterViewInit() {
if (!this.settings.flgSidenavPinned) {
this.sideNavigation.close();
this.settingSidenav.toggle();
}
if (window.innerWidth <= 768) {
this.sideNavigation.close();
this.settingSidenav.toggle();
}
}
@HostListener('window:resize')
public onWindowResize(): void {
if (window.innerWidth <= 768) {
this.settings.menu = 'Vertical';
this.settings.flgSidenavOpened = false;
this.settings.flgSidenavPinned = false;
}
}
sideNavToggle() {
this.sideNavigation.toggle();
}
onNavigationClicked(event: any) {
if (window.innerWidth <= 414) {
this.sideNavigation.close();
}
}
copiedText(payload) {
this.flgCopied = true;
setTimeout(() => {this.flgCopied = false; }, 5000);
this.logger.info('Copied Text: ' + payload);
}
ngOnDestroy() {
this.unsubs.forEach(unsub => {
unsub.next();
unsub.complete();
});
}
}

@ -0,0 +1,72 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { NgxChartsModule } from '@swimlane/ngx-charts';
import { StoreModule } from '@ngrx/store';
import { StoreDevtoolsModule } from '@ngrx/store-devtools';
import { EffectsModule } from '@ngrx/effects';
import { environment } from '../../environments/environment';
import { SharedModule } from '../shared/shared.module';
import { LNDReducer } from './store/lnd.reducers';
import { LNDEffects } from './store/lnd.effects';
import { lndRouting } from './lnd.routing';
import { LndRootComponent } from './lnd-root.component';
import { HomeComponent } from './home/home.component';
import { PeersComponent } from './peers/peers.component';
import { SendReceiveTransComponent } from './transactions/send-receive/send-receive-trans.component';
import { InvoicesComponent } from './invoices/invoices.component';
import { ServerConfigComponent } from './server-config/server-config.component';
import { HelpComponent } from './help/help.component';
import { UnlockLNDComponent } from './unlock-lnd/unlock-lnd.component';
import { PaymentsComponent } from './payments/send-receive/payments.component';
import { ChannelManageComponent } from './channels/channel-manage/channel-manage.component';
import { ChannelPendingComponent } from './channels/channel-pending/channel-pending.component';
import { SigninComponent } from './signin/signin.component';
import { ChannelClosedComponent } from './channels/channel-closed/channel-closed.component';
import { ListTransactionsComponent } from './transactions/list-transactions/list-transactions.component';
import { LookupsComponent } from './lookups/lookups.component';
import { ForwardingHistoryComponent } from './switch/forwarding-history.component';
import { RoutingPeersComponent } from './routing-peers/routing-peers.component';
import { ChannelLookupComponent } from './lookups/channel-lookup/channel-lookup.component';
import { NodeLookupComponent } from './lookups/node-lookup/node-lookup.component';
import { ChannelBackupComponent } from './channels/channel-backup/channel-backup.component';
import { QueryRoutesComponent } from './payments/query-routes/query-routes.component';
@NgModule({
imports: [
CommonModule,
SharedModule,
lndRouting,
NgxChartsModule,
EffectsModule.forFeature([LNDEffects]),
StoreModule.forFeature('lnd', LNDReducer),
!environment.production ? StoreDevtoolsModule.instrument() : []
],
declarations: [
LndRootComponent,
HomeComponent,
PeersComponent,
SendReceiveTransComponent,
InvoicesComponent,
ServerConfigComponent,
HelpComponent,
UnlockLNDComponent,
PaymentsComponent,
ChannelManageComponent,
ChannelPendingComponent,
SigninComponent,
ChannelClosedComponent,
ListTransactionsComponent,
LookupsComponent,
ForwardingHistoryComponent,
RoutingPeersComponent,
ChannelLookupComponent,
NodeLookupComponent,
ChannelBackupComponent,
QueryRoutesComponent
],
providers: [],
bootstrap: [LndRootComponent]
})
export class LndModule {}

@ -0,0 +1,51 @@
import { Routes, RouterModule } from '@angular/router';
import { ModuleWithProviders } from '@angular/core';
import { NotFoundComponent } from '../shared/components/not-found/not-found.component';
import { SsoFailedComponent } from '../shared/components/sso-failed/sso-failed.component';
import { AuthGuard, LNDUnlockedGuard } from '../shared/services/auth.guard';
import { HomeComponent } from './home/home.component';
import { UnlockLNDComponent } from './unlock-lnd/unlock-lnd.component';
import { ChannelClosedComponent } from './channels/channel-closed/channel-closed.component';
import { ChannelManageComponent } from './channels/channel-manage/channel-manage.component';
import { ChannelPendingComponent } from './channels/channel-pending/channel-pending.component';
import { PeersComponent } from './peers/peers.component';
import { SendReceiveTransComponent } from './transactions/send-receive/send-receive-trans.component';
import { ListTransactionsComponent } from './transactions/list-transactions/list-transactions.component';
import { PaymentsComponent } from './payments/send-receive/payments.component';
import { QueryRoutesComponent } from './payments/query-routes/query-routes.component';
import { ServerConfigComponent } from './server-config/server-config.component';
import { HelpComponent } from './help/help.component';
import { InvoicesComponent } from './invoices/invoices.component';
import { LookupsComponent } from './lookups/lookups.component';
import { SigninComponent } from './signin/signin.component';
import { ForwardingHistoryComponent } from './switch/forwarding-history.component';
import { RoutingPeersComponent } from './routing-peers/routing-peers.component';
import { ChannelBackupComponent } from './channels/channel-backup/channel-backup.component';
export const lndRoutes: Routes = [
{ path: '', redirectTo: '/home', pathMatch: 'full', canActivate: [AuthGuard, LNDUnlockedGuard] },
{ path: 'unlocklnd', component: UnlockLNDComponent, canActivate: [AuthGuard] },
{ path: 'home', component: HomeComponent, canActivate: [AuthGuard, LNDUnlockedGuard] },
{ path: 'peers', component: PeersComponent, canActivate: [AuthGuard, LNDUnlockedGuard] },
{ path: 'chnlclosed', component: ChannelClosedComponent, canActivate: [AuthGuard, LNDUnlockedGuard] },
{ path: 'chnlmanage', component: ChannelManageComponent, canActivate: [AuthGuard, LNDUnlockedGuard] },
{ path: 'chnlpending', component: ChannelPendingComponent, canActivate: [AuthGuard, LNDUnlockedGuard] },
{ path: 'chnlbackup', component: ChannelBackupComponent, canActivate: [AuthGuard, LNDUnlockedGuard] },
{ path: 'transsendreceive', component: SendReceiveTransComponent, canActivate: [AuthGuard, LNDUnlockedGuard] },
{ path: 'translist', component: ListTransactionsComponent, canActivate: [AuthGuard, LNDUnlockedGuard] },
{ path: 'paymentsend', component: PaymentsComponent, canActivate: [AuthGuard, LNDUnlockedGuard] },
{ path: 'queryroutes', component: QueryRoutesComponent, canActivate: [AuthGuard, LNDUnlockedGuard] },
{ path: 'invoices', component: InvoicesComponent, canActivate: [AuthGuard, LNDUnlockedGuard] },
{ path: 'switch', component: ForwardingHistoryComponent, canActivate: [AuthGuard, LNDUnlockedGuard] },
{ path: 'routingpeers', component: RoutingPeersComponent, canActivate: [AuthGuard, LNDUnlockedGuard] },
{ path: 'lookups', component: LookupsComponent, canActivate: [AuthGuard, LNDUnlockedGuard] },
{ path: 'sconfig', component: ServerConfigComponent, canActivate: [AuthGuard] },
{ path: 'login', component: SigninComponent },
{ path: 'help', component: HelpComponent },
{ path: 'ssoerror', component: SsoFailedComponent },
{ path: '**', component: NotFoundComponent }
];
export const lndRouting: ModuleWithProviders = RouterModule.forChild(lndRoutes);

@ -1,40 +1,47 @@
import { Component, OnInit, Input } from '@angular/core';
import { Component, OnInit, Input, OnDestroy } from '@angular/core';
import { formatDate } from '@angular/common';
import { Subject } from 'rxjs';
import { takeUntil } from 'rxjs/operators';
import { Store } from '@ngrx/store';
import { ChannelEdge } from '../../../shared/models/lndModels';
import * as fromRTLReducer from '../../../shared/store/rtl.reducers';
import * as fromLNDReducer from '../../store/lnd.reducers';
@Component({
selector: 'rtl-channel-lookup',
templateUrl: './channel-lookup.component.html',
styleUrls: ['./channel-lookup.component.css']
})
export class ChannelLookupComponent implements OnInit {
export class ChannelLookupComponent implements OnInit, OnDestroy {
@Input() lookupResult: ChannelEdge;
public node1_match = false;
public node2_match = false;
private unSubs: Array<Subject<void>> = [new Subject(), new Subject(), new Subject(), new Subject()];
private unSubs: Array<Subject<void>> = [new Subject(), new Subject()];
constructor(private store: Store<fromRTLReducer.State>) { }
constructor(private lndStore: Store<fromLNDReducer.LNDState>) { }
ngOnInit() {
if (undefined !== this.lookupResult && undefined !== this.lookupResult.last_update_str) {
this.lookupResult.last_update_str = (this.lookupResult.last_update_str === '') ?
'' : formatDate(this.lookupResult.last_update_str, 'MMM/dd/yy HH:mm:ss', 'en-US');
}
this.store.select('rtlRoot')
.pipe(takeUntil(this.unSubs[0]))
.subscribe((rtlStore: fromRTLReducer.State) => {
if (this.lookupResult.node1_pub === rtlStore.information.identity_pubkey) {
this.lndStore.select('lnd')
.pipe(takeUntil(this.unSubs[1]))
.subscribe(lndStore => {
if (this.lookupResult.node1_pub === lndStore.information.identity_pubkey) {
this.node1_match = true;
}
if (this.lookupResult.node2_pub === rtlStore.information.identity_pubkey) {
if (this.lookupResult.node2_pub === lndStore.information.identity_pubkey) {
this.node2_match = true;
}
});
}
ngOnDestroy() {
this.unSubs.forEach(unsub => {
unsub.next();
unsub.complete();
});
}
}

@ -6,8 +6,10 @@ import { Actions } from '@ngrx/effects';
import { LoggerService } from '../../shared/services/logger.service';
import * as RTLActions from '../../shared/store/rtl.actions';
import * as fromRTLReducer from '../../shared/store/rtl.reducers';
import { LNDEffects } from '../store/lnd.effects';
import * as LNDActions from '../store/lnd.actions';
import * as RTLActions from '../../store/rtl.actions';
import * as fromRTLReducer from '../../store/rtl.reducers';
@Component({
selector: 'rtl-lookups',
@ -34,8 +36,8 @@ export class LookupsComponent implements OnInit, OnDestroy {
this.actions$
.pipe(
takeUntil(this.unSubs[0]),
filter((action) => (action.type === RTLActions.SET_LOOKUP || action.type === RTLActions.EFFECT_ERROR))
).subscribe((resLookup: RTLActions.SetLookup) => {
filter((action) => (action.type === LNDActions.SET_LOOKUP || action.type === RTLActions.EFFECT_ERROR))
).subscribe((resLookup: LNDActions.SetLookup) => {
if (resLookup.payload.action === 'Lookup') {
this.flgLoading[0] = 'error';
} else {
@ -53,10 +55,10 @@ export class LookupsComponent implements OnInit, OnDestroy {
this.store.dispatch(new RTLActions.OpenSpinner('Searching ' + this.selectedField.name + '...'));
switch (this.selectedField.id) {
case '0':
this.store.dispatch(new RTLActions.PeerLookup(this.lookupKey.trim()));
this.store.dispatch(new LNDActions.PeerLookup(this.lookupKey.trim()));
break;
case '1':
this.store.dispatch(new RTLActions.ChannelLookup(this.lookupKey.trim()));
this.store.dispatch(new LNDActions.ChannelLookup(this.lookupKey.trim()));
break;
default:
break;

@ -9,9 +9,11 @@ import { MatTableDataSource, MatSort } from '@angular/material';
import { Hop } from '../../../shared/models/lndModels';
import { LoggerService } from '../../../shared/services/logger.service';
import { RTLEffects } from '../../../shared/store/rtl.effects';
import * as RTLActions from '../../../shared/store/rtl.actions';
import * as fromRTLReducer from '../../../shared/store/rtl.reducers';
import { LNDEffects } from '../../store/lnd.effects';
import * as LNDActions from '../../store/lnd.actions';
import { RTLEffects } from '../../../store/rtl.effects';
import * as RTLActions from '../../../store/rtl.actions';
import * as fromRTLReducer from '../../../store/rtl.reducers';
@Component({
selector: 'rtl-query-routes',
@ -28,7 +30,7 @@ export class QueryRoutesComponent implements OnInit, OnDestroy {
public flgLoading: Array<Boolean | 'error'> = [false]; // 0: peers
private unSubs: Array<Subject<void>> = [new Subject(), new Subject()];
constructor(private logger: LoggerService, private store: Store<fromRTLReducer.State>, private rtlEffects: RTLEffects, private actions$: Actions) {
constructor(private logger: LoggerService, private store: Store<fromRTLReducer.State>, private lndEffects: LNDEffects, private actions$: Actions) {
switch (true) {
case (window.innerWidth <= 415):
this.displayedColumns = ['hop_sequence', 'pubkey_alias', 'fee_msat'];
@ -56,7 +58,7 @@ export class QueryRoutesComponent implements OnInit, OnDestroy {
.subscribe((rtlStore: fromRTLReducer.State) => {
this.logger.info(rtlStore);
});
this.rtlEffects.setQueryRoutes
this.lndEffects.setQueryRoutes
.pipe(takeUntil(this.unSubs[1]))
.subscribe(queryRoute => {
this.qrHops = new MatTableDataSource([]);
@ -74,7 +76,7 @@ export class QueryRoutesComponent implements OnInit, OnDestroy {
onQueryRoutes() {
this.flgLoading[0] = true;
this.store.dispatch(new RTLActions.GetQueryRoutes({destPubkey: this.destinationPubkey, amount: this.amount}));
this.store.dispatch(new LNDActions.GetQueryRoutes({destPubkey: this.destinationPubkey, amount: this.amount}));
}
resetData() {

@ -10,9 +10,13 @@ import { GetInfo, Payment, PayRequest } from '../../../shared/models/lndModels';
import { LoggerService } from '../../../shared/services/logger.service';
import { newlyAddedRowAnimation } from '../../../shared/animation/row-animation';
import { RTLEffects } from '../../../shared/store/rtl.effects';
import * as RTLActions from '../../../shared/store/rtl.actions';
import * as fromRTLReducer from '../../../shared/store/rtl.reducers';
import { LNDEffects } from '../../store/lnd.effects';
import * as LNDActions from '../../store/lnd.actions';
import * as fromLNDReducer from '../../store/lnd.reducers';
import { RTLEffects } from '../../../store/rtl.effects';
import * as RTLActions from '../../../store/rtl.actions';
import * as fromRTLReducer from '../../../store/rtl.reducers';
@Component({
selector: 'rtl-payments',
@ -34,9 +38,10 @@ export class PaymentsComponent implements OnInit, OnDestroy {
public paymentDecoded: PayRequest = {};
public paymentRequest = '';
public flgSticky = false;
private unsub: Array<Subject<void>> = [new Subject(), new Subject(), new Subject(), new Subject()];
private unsubs: Array<Subject<void>> = [new Subject(), new Subject(), new Subject(), new Subject(), new Subject()];
constructor(private logger: LoggerService, private store: Store<fromRTLReducer.State>, private rtlEffects: RTLEffects) {
constructor(private logger: LoggerService, private store: Store<fromRTLReducer.State>, private rtlEffects: RTLEffects,
private lndEffects: LNDEffects, private lndStore: Store<fromLNDReducer.LNDState>) {
switch (true) {
case (window.innerWidth <= 415):
this.displayedColumns = ['creation_date', 'fee', 'value'];
@ -59,18 +64,13 @@ export class PaymentsComponent implements OnInit, OnDestroy {
}
ngOnInit() {
this.store.select('rtlRoot')
.pipe(takeUntil(this.unsub[0]))
.subscribe((rtlStore: fromRTLReducer.State) => {
rtlStore.effectErrors.forEach(effectsErr => {
if (effectsErr.action === 'FetchPayments') {
this.flgLoading[0] = 'error';
}
});
this.selNode = rtlStore.selNode;
this.information = rtlStore.information;
this.paymentJSONArr = (null !== rtlStore.payments && rtlStore.payments.length > 0) ? rtlStore.payments : [];
this.payments = (undefined === rtlStore.payments || null == rtlStore.payments) ? new MatTableDataSource([]) : new MatTableDataSource<Payment>([...this.paymentJSONArr]);
this.lndStore.select('lnd')
.pipe(takeUntil(this.unsubs[4]))
.subscribe(lndStore => {
this.information = lndStore.information;
this.paymentJSONArr = (null !== lndStore.payments && lndStore.payments.length > 0) ? lndStore.payments : [];
this.payments = (undefined === lndStore.payments || null == lndStore.payments) ?
new MatTableDataSource([]) : new MatTableDataSource<Payment>([...this.paymentJSONArr]);
this.payments.data = this.paymentJSONArr;
this.payments.sort = this.sort;
this.payments.data.forEach(payment => {
@ -80,6 +80,18 @@ export class PaymentsComponent implements OnInit, OnDestroy {
if (this.flgLoading[0] !== 'error') {
this.flgLoading[0] = (undefined !== this.paymentJSONArr) ? false : true;
}
this.logger.info(lndStore);
});
this.store.select('rtlRoot')
.pipe(takeUntil(this.unsubs[0]))
.subscribe((rtlStore: fromRTLReducer.State) => {
rtlStore.effectErrors.forEach(effectsErr => {
if (effectsErr.action === 'FetchPayments') {
this.flgLoading[0] = 'error';
}
});
this.selNode = rtlStore.selNode;
this.logger.info(rtlStore);
});
@ -90,8 +102,8 @@ export class PaymentsComponent implements OnInit, OnDestroy {
this.sendPayment();
} else {
this.store.dispatch(new RTLActions.OpenSpinner('Decoding Payment...'));
this.store.dispatch(new RTLActions.DecodePayment(this.paymentRequest));
this.rtlEffects.setDecodedPayment
this.store.dispatch(new LNDActions.DecodePayment(this.paymentRequest));
this.lndEffects.setDecodedPayment
.pipe(take(1))
.subscribe(decodedPayment => {
this.paymentDecoded = decodedPayment;
@ -126,7 +138,7 @@ export class PaymentsComponent implements OnInit, OnDestroy {
if (confirmRes) {
this.paymentDecoded.num_satoshis = confirmRes[0].inputValue;
this.store.dispatch(new RTLActions.OpenSpinner('Sending Payment...'));
this.store.dispatch(new RTLActions.SendPayment([this.paymentRequest, this.paymentDecoded, true]));
this.store.dispatch(new LNDActions.SendPayment([this.paymentRequest, this.paymentDecoded, true]));
this.resetData();
}
});
@ -139,7 +151,7 @@ export class PaymentsComponent implements OnInit, OnDestroy {
.subscribe(confirmRes => {
if (confirmRes) {
this.store.dispatch(new RTLActions.OpenSpinner('Sending Payment...'));
this.store.dispatch(new RTLActions.SendPayment([this.paymentRequest, this.paymentDecoded, false]));
this.store.dispatch(new LNDActions.SendPayment([this.paymentRequest, this.paymentDecoded, false]));
this.resetData();
}
});
@ -148,8 +160,8 @@ export class PaymentsComponent implements OnInit, OnDestroy {
onVerifyPayment() {
this.store.dispatch(new RTLActions.OpenSpinner('Decoding Payment...'));
this.store.dispatch(new RTLActions.DecodePayment(this.paymentRequest));
this.rtlEffects.setDecodedPayment.subscribe(decodedPayment => {
this.store.dispatch(new LNDActions.DecodePayment(this.paymentRequest));
this.lndEffects.setDecodedPayment.subscribe(decodedPayment => {
this.paymentDecoded = decodedPayment;
if (undefined !== this.paymentDecoded.timestamp_str) {
this.paymentDecoded.timestamp_str = (this.paymentDecoded.timestamp_str === '') ? '' :
@ -187,7 +199,7 @@ export class PaymentsComponent implements OnInit, OnDestroy {
}
ngOnDestroy() {
this.unsub.forEach(completeSub => {
this.unsubs.forEach(completeSub => {
completeSub.next();
completeSub.complete();
});

@ -11,9 +11,13 @@ import { Peer, GetInfo } from '../../shared/models/lndModels';
import { LoggerService } from '../../shared/services/logger.service';
import { newlyAddedRowAnimation } from '../../shared/animation/row-animation';
import { RTLEffects } from '../../shared/store/rtl.effects';
import * as RTLActions from '../../shared/store/rtl.actions';
import * as fromRTLReducer from '../../shared/store/rtl.reducers';
import { LNDEffects } from '../store/lnd.effects';
import * as LNDActions from '../store/lnd.actions';
import * as fromLNDReducer from '../store/lnd.reducers';
import { RTLEffects } from '../../store/rtl.effects';
import * as RTLActions from '../../store/rtl.actions';
import * as fromRTLReducer from '../../store/rtl.reducers';
@Component({
selector: 'rtl-peers',
@ -31,9 +35,10 @@ export class PeersComponent implements OnInit, OnDestroy {
public information: GetInfo = {};
public flgLoading: Array<Boolean | 'error'> = [true]; // 0: peers
public flgSticky = false;
private unSubs: Array<Subject<void>> = [new Subject(), new Subject(), new Subject(), new Subject()];
private unSubs: Array<Subject<void>> = [new Subject(), new Subject(), new Subject(), new Subject(), new Subject()];
constructor(private logger: LoggerService, private store: Store<fromRTLReducer.State>, private rtlEffects: RTLEffects, private actions$: Actions, private router: Router) {
constructor(private logger: LoggerService, private store: Store<fromRTLReducer.State>, private rtlEffects: RTLEffects,
private lndStore: Store<fromLNDReducer.LNDState>, private lndEffects: LNDEffects, private actions$: Actions, private router: Router) {
switch (true) {
case (window.innerWidth <= 415):
this.displayedColumns = ['detach', 'pub_key', 'alias'];
@ -56,33 +61,39 @@ export class PeersComponent implements OnInit, OnDestroy {
}
ngOnInit() {
this.store.select('rtlRoot')
.pipe(takeUntil(this.unSubs[0]))
.subscribe((rtlStore: fromRTLReducer.State) => {
rtlStore.effectErrors.forEach(effectsErr => {
if (effectsErr.action === 'FetchPeers') {
this.flgLoading[0] = 'error';
}
});
this.information = rtlStore.information;
this.lndStore.select('lnd')
.pipe(takeUntil(this.unSubs[4]))
.subscribe(lndStore => {
this.information = lndStore.information;
this.peers = new MatTableDataSource([]);
this.peers.data = [];
if (undefined !== rtlStore.peers) {
this.peers = new MatTableDataSource<Peer>([...rtlStore.peers]);
this.peers.data = rtlStore.peers;
if (undefined !== lndStore.peers) {
this.peers = new MatTableDataSource<Peer>([...lndStore.peers]);
this.peers.data = lndStore.peers;
setTimeout(() => { this.flgAnimate = false; }, 3000);
}
this.peers.sort = this.sort;
if (this.flgLoading[0] !== 'error') {
this.flgLoading[0] = false;
}
this.logger.info(lndStore);
});
this.store.select('rtlRoot')
.pipe(takeUntil(this.unSubs[0]))
.subscribe((rtlStore: fromRTLReducer.State) => {
rtlStore.effectErrors.forEach(effectsErr => {
if (effectsErr.action === 'FetchPeers') {
this.flgLoading[0] = 'error';
}
});
this.logger.info(rtlStore);
});
this.actions$
.pipe(
takeUntil(this.unSubs[1]),
filter((action) => action.type === RTLActions.SET_PEERS)
).subscribe((setPeers: RTLActions.SetPeers) => {
filter((action) => action.type === LNDActions.SET_PEERS)
).subscribe((setPeers: LNDActions.SetPeers) => {
this.peerAddress = undefined;
});
}
@ -101,8 +112,8 @@ export class PeersComponent implements OnInit, OnDestroy {
} else {
pubkey = (deviderIndex > -1) ? this.peerAddress.substring(0, deviderIndex) : this.peerAddress;
this.store.dispatch(new RTLActions.OpenSpinner('Getting Node Address...'));
this.store.dispatch(new RTLActions.FetchGraphNode(pubkey));
this.rtlEffects.setGraphNode
this.store.dispatch(new LNDActions.FetchGraphNode(pubkey));
this.lndEffects.setGraphNode
.pipe(take(1))
.subscribe(graphNode => {
host = (undefined === graphNode.node.addresses || undefined === graphNode.node.addresses[0].addr) ? '' : graphNode.node.addresses[0].addr;
@ -114,7 +125,7 @@ export class PeersComponent implements OnInit, OnDestroy {
connectPeerWithParams(pubkey: string, host: string) {
this.newlyAddedPeer = pubkey;
this.store.dispatch(new RTLActions.OpenSpinner('Adding Peer...'));
this.store.dispatch(new RTLActions.SaveNewPeer({pubkey: pubkey, host: host, perm: false}));
this.store.dispatch(new LNDActions.SaveNewPeer({pubkey: pubkey, host: host, perm: false}));
}
onPeerClick(selRow: Peer, event: any) {
@ -148,7 +159,7 @@ export class PeersComponent implements OnInit, OnDestroy {
.subscribe(confirmRes => {
if (confirmRes) {
this.store.dispatch(new RTLActions.OpenSpinner('Detaching Peer...'));
this.store.dispatch(new RTLActions.DetachPeer({pubkey: peerToDetach.pub_key}));
this.store.dispatch(new LNDActions.DetachPeer({pubkey: peerToDetach.pub_key}));
}
});
}

@ -9,8 +9,10 @@ import { ForwardingEvent, RoutingPeers } from '../../shared/models/lndModels';
import { LoggerService } from '../../shared/services/logger.service';
import { CommonService } from '../../shared/services/common.service';
import * as RTLActions from '../../shared/store/rtl.actions';
import * as fromRTLReducer from '../../shared/store/rtl.reducers';
import * as LNDActions from '../store/lnd.actions';
import * as fromLNDReducer from '../store/lnd.reducers';
import * as RTLActions from '../../store/rtl.actions';
import * as fromRTLReducer from '../../store/rtl.reducers';
@Component({
selector: 'rtl-routing-peers',
@ -33,9 +35,10 @@ export class RoutingPeersComponent implements OnInit, OnDestroy {
public endDate = this.today;
public startDate = this.lastMonthDay;
public flgSticky = false;
private unsub: Array<Subject<void>> = [new Subject(), new Subject(), new Subject()];
private unsubs: Array<Subject<void>> = [new Subject(), new Subject(), new Subject(), new Subject()];
constructor(private logger: LoggerService, private commonService: CommonService, private store: Store<fromRTLReducer.State>, private actions$: Actions) {
constructor(private logger: LoggerService, private commonService: CommonService, private store: Store<fromRTLReducer.State>,
private lndStore: Store<fromLNDReducer.LNDState>, private actions$: Actions) {
switch (true) {
case (window.innerWidth <= 415):
this.displayedColumns = ['chan_id', 'events', 'total_amount'];
@ -59,26 +62,31 @@ export class RoutingPeersComponent implements OnInit, OnDestroy {
ngOnInit() {
this.onRoutingPeersFetch();
this.actions$.pipe(takeUntil(this.unsub[2]), filter((action) => action.type === RTLActions.RESET_STORE)).subscribe((resetStore: RTLActions.ResetStore) => {
this.actions$.pipe(takeUntil(this.unsubs[2]), filter((action) => action.type === RTLActions.RESET_STORE)).subscribe((resetStore: RTLActions.ResetStore) => {
this.onRoutingPeersFetch();
});
this.lndStore.select('lnd')
.pipe(takeUntil(this.unsubs[3]))
.subscribe(lndStore => {
if (undefined !== lndStore.forwardingHistory && undefined !== lndStore.forwardingHistory.forwarding_events) {
this.loadRoutingPeersTable(lndStore.forwardingHistory.forwarding_events);
} else {
// To reset table after other Forwarding history calls
this.loadRoutingPeersTable([]);
}
if (this.flgLoading[0] !== 'error') {
this.flgLoading[0] = (undefined !== lndStore.forwardingHistory) ? false : true;
}
this.logger.info(lndStore);
});
this.store.select('rtlRoot')
.pipe(takeUntil(this.unsub[0]))
.pipe(takeUntil(this.unsubs[0]))
.subscribe((rtlStore: fromRTLReducer.State) => {
rtlStore.effectErrors.forEach(effectsErr => {
if (effectsErr.action === 'GetForwardingHistory') {
this.flgLoading[0] = 'error';
}
});
if (undefined !== rtlStore.forwardingHistory && undefined !== rtlStore.forwardingHistory.forwarding_events) {
this.loadRoutingPeersTable(rtlStore.forwardingHistory.forwarding_events);
} else {
// To reset table after other Forwarding history calls
this.loadRoutingPeersTable([]);
}
if (this.flgLoading[0] !== 'error') {
this.flgLoading[0] = (undefined !== rtlStore.forwardingHistory) ? false : true;
}
this.logger.info(rtlStore);
});
@ -147,7 +155,7 @@ export class RoutingPeersComponent implements OnInit, OnDestroy {
if (undefined === this.startDate || this.startDate == null) {
this.startDate = new Date(this.endDate.getFullYear(), this.endDate.getMonth(), this.endDate.getDate() - 30);
}
this.store.dispatch(new RTLActions.GetForwardingHistory({
this.store.dispatch(new LNDActions.GetForwardingHistory({
end_time: Math.round(this.endDate.getTime() / 1000).toString(),
start_time: Math.round(this.startDate.getTime() / 1000).toString()
}));
@ -166,7 +174,7 @@ export class RoutingPeersComponent implements OnInit, OnDestroy {
ngOnDestroy() {
this.resetData();
this.unsub.forEach(completeSub => {
this.unsubs.forEach(completeSub => {
completeSub.next();
completeSub.complete();
});

@ -4,9 +4,12 @@ import { takeUntil } from 'rxjs/operators';
import { Store } from '@ngrx/store';
import { Node } from '../../shared/models/RTLconfig';
import { RTLEffects } from '../../shared/store/rtl.effects';
import * as RTLActions from '../../shared/store/rtl.actions';
import * as fromRTLReducer from '../../shared/store/rtl.reducers';
import { LNDEffects } from '../store/lnd.effects';
import * as LNDActions from '../store/lnd.actions';
import { RTLEffects } from '../../store/rtl.effects';
import * as RTLActions from '../../store/rtl.actions';
import * as fromRTLReducer from '../../store/rtl.reducers';
@Component({
selector: 'rtl-server-config',
@ -22,7 +25,7 @@ export class ServerConfigComponent implements OnInit, OnDestroy {
public fileFormat = 'INI';
private unsubs: Array<Subject<void>> = [new Subject(), new Subject()];
constructor(private store: Store<fromRTLReducer.State>, private rtlEffects: RTLEffects) {}
constructor(private store: Store<fromRTLReducer.State>, private lndEffects: LNDEffects) {}
ngOnInit() {
this.store.select('rtlRoot')
@ -59,8 +62,8 @@ export class ServerConfigComponent implements OnInit, OnDestroy {
onShowConfig() {
this.store.dispatch(new RTLActions.OpenSpinner('Opening Config File...'));
this.store.dispatch(new RTLActions.FetchConfig(this.selectedNodeType));
this.rtlEffects.showLNDConfig
this.store.dispatch(new LNDActions.FetchConfig(this.selectedNodeType));
this.lndEffects.showLNDConfig
.pipe(takeUntil(this.unsubs[1]))
.subscribe((config: any) => {
const configFile = config.data;

@ -6,8 +6,8 @@ import { Store } from '@ngrx/store';
import { Node } from '../../shared/models/RTLconfig';
import { LoggerService } from '../../shared/services/logger.service';
import * as fromRTLReducer from '../../shared/store/rtl.reducers';
import * as RTLActions from '../../shared/store/rtl.actions';
import * as fromRTLReducer from '../../store/rtl.reducers';
import * as RTLActions from '../../store/rtl.actions';
@Component({
selector: 'rtl-signin',

@ -1,27 +1,9 @@
import { Action } from '@ngrx/store';
import { RTLConfiguration, Settings, Node } from '../models/RTLconfig';
import { ErrorPayload } from '../models/errorPayload';
import {
GetInfo, Peer, Balance, NetworkInfo, Fees, Channel, Invoice, ListInvoices, Payment, GraphNode, AddressType,
PayRequest, ChannelsTransaction, PendingChannels, ClosedChannel, Transaction, SwitchReq, SwitchRes, QueryRoutes
} from '../models/lndModels';
import { MatDialogConfig } from '@angular/material';
export const RESET_STORE = 'RESET_STORE';
export const CLEAR_EFFECT_ERROR = 'CLEAR_EFFECT_ERROR';
export const EFFECT_ERROR = 'EFFECT_ERROR';
export const OPEN_SPINNER = 'OPEN_SPINNER';
export const CLOSE_SPINNER = 'CLOSE_SPINNER';
export const OPEN_ALERT = 'OPEN_ALERT';
export const CLOSE_ALERT = 'CLOSE_ALERT';
export const OPEN_CONFIRMATION = 'OPEN_CONFIRMATION';
export const CLOSE_CONFIRMATION = 'CLOSE_CONFIRMATION';
export const FETCH_STORE = 'FETCH_STORE';
export const SET_STORE = 'SET_STORE';
export const FETCH_RTL_CONFIG = 'FETCH_RTL_CONFIG';
export const SET_RTL_CONFIG = 'SET_RTL_CONFIG';
export const SAVE_SETTINGS = 'SAVE_SETTINGS';
export const SET_SELECTED_NODE = 'SET_SELECTED_NODE';
} from '../../shared/models/lndModels';
export const FETCH_INFO = 'FETCH_INFO';
export const SET_INFO = 'SET_INFO';
export const FETCH_PEERS = 'FETCH_PEERS';
@ -72,11 +54,6 @@ export const INIT_WALLET_RESPONSE = 'INIT_WALLET_RESPONSE';
export const UNLOCK_WALLET = 'UNLOCK_WALLET';
export const FETCH_CONFIG = 'FETCH_CONFIG';
export const SHOW_CONFIG = 'SHOW_CONFIG';
export const IS_AUTHORIZED = 'IS_AUTHORIZED';
export const IS_AUTHORIZED_RES = 'IS_AUTHORIZED_RES';
export const SIGNIN = 'SIGNIN';
export const SIGNOUT = 'SIGNOUT';
export const INIT_APP_DATA = 'INIT_APP_DATA';
export const PEER_LOOKUP = 'PEER_LOOKUP';
export const CHANNEL_LOOKUP = 'CHANNEL_LOOKUP';
export const INVOICE_LOOKUP = 'INVOICE_LOOKUP';
@ -86,68 +63,6 @@ export const SET_FORWARDING_HISTORY = 'SET_FORWARDING_HISTORY';
export const GET_QUERY_ROUTES = 'GET_QUERY_ROUTES';
export const SET_QUERY_ROUTES = 'SET_QUERY_ROUTES';
export class ClearEffectError implements Action {
readonly type = CLEAR_EFFECT_ERROR;
constructor(public payload: string) {} // payload = errorAction
}
export class EffectError implements Action {
readonly type = EFFECT_ERROR;
constructor(public payload: ErrorPayload) {}
}
export class OpenSpinner implements Action {
readonly type = OPEN_SPINNER;
constructor(public payload: string) {} // payload = titleMessage
}
export class CloseSpinner implements Action {
readonly type = CLOSE_SPINNER;
}
export class OpenAlert implements Action {
readonly type = OPEN_ALERT;
constructor(public payload: MatDialogConfig) {}
}
export class CloseAlert implements Action {
readonly type = CLOSE_ALERT;
}
export class OpenConfirmation implements Action {
readonly type = OPEN_CONFIRMATION;
constructor(public payload: MatDialogConfig) {}
}
export class CloseConfirmation implements Action {
readonly type = CLOSE_CONFIRMATION;
constructor(public payload: boolean) {}
}
export class ResetStore implements Action {
readonly type = RESET_STORE;
constructor(public payload: Node) {}
}
export class FetchRTLConfig implements Action {
readonly type = FETCH_RTL_CONFIG;
}
export class SetRTLConfig implements Action {
readonly type = SET_RTL_CONFIG;
constructor(public payload: RTLConfiguration) {}
}
export class SaveSettings implements Action {
readonly type = SAVE_SETTINGS;
constructor(public payload: Settings) {}
}
export class SetSelelectedNode implements Action {
readonly type = SET_SELECTED_NODE;
constructor(public payload: Node) {}
}
export class FetchInfo implements Action {
readonly type = FETCH_INFO;
}
@ -432,40 +347,11 @@ export class SetQueryRoutes implements Action {
constructor(public payload: QueryRoutes) {}
}
export class IsAuthorized implements Action {
readonly type = IS_AUTHORIZED;
constructor(public payload: string) {} // payload = password
}
export class IsAuthorizedRes implements Action {
readonly type = IS_AUTHORIZED_RES;
constructor(public payload: any) {} // payload = token/error
}
export class Signin implements Action {
readonly type = SIGNIN;
constructor(public payload: string) {} // payload = password
}
export class Signout implements Action {
readonly type = SIGNOUT;
constructor() {}
}
export class InitAppData implements Action {
readonly type = INIT_APP_DATA;
}
export type RTLActions =
ClearEffectError | EffectError | OpenSpinner | CloseSpinner |
FetchRTLConfig | SetRTLConfig | SaveSettings |
OpenAlert | CloseAlert | OpenConfirmation | CloseConfirmation |
ResetStore | SetSelelectedNode | FetchInfo | SetInfo |
FetchPeers | SetPeers | AddPeer | DetachPeer | SaveNewPeer | RemovePeer |
AddInvoice | SaveNewInvoice | GetForwardingHistory | SetForwardingHistory |
FetchFees | SetFees |
FetchBalance | SetBalance |
FetchNetwork | SetNetwork |
export type LNDActions =
FetchInfo | SetInfo | FetchPeers | SetPeers | AddPeer |
DetachPeer | SaveNewPeer | RemovePeer | AddInvoice | SaveNewInvoice |
GetForwardingHistory | SetForwardingHistory | FetchFees | SetFees |
FetchBalance | SetBalance | FetchNetwork | SetNetwork |
FetchChannels | SetChannels | SetPendingChannels | SetClosedChannels | UpdateChannels |
SaveNewChannel | CloseChannel | RemoveChannel |
BackupChannels | VerifyChannels | BackupChannelsRes | VerifyChannelsRes |
@ -476,5 +362,4 @@ export type RTLActions =
FetchGraphNode | SetGraphNode | GetQueryRoutes | SetQueryRoutes |
GetNewAddress | SetNewAddress | SetChannelTransaction |
GenSeed | GenSeedResponse | InitWallet | InitWalletResponse | UnlockWallet |
FetchConfig | ShowConfig | PeerLookup | ChannelLookup | InvoiceLookup | SetLookup |
IsAuthorized | IsAuthorizedRes | Signin | Signout | InitAppData;
FetchConfig | ShowConfig | PeerLookup | ChannelLookup | InvoiceLookup | SetLookup;

@ -1,124 +1,40 @@
import { Injectable, OnDestroy } from '@angular/core';
import { HttpClient, HttpParams, HttpHeaders } from '@angular/common/http';
import { HttpClient } from '@angular/common/http';
import { Router } from '@angular/router';
import { Store } from '@ngrx/store';
import { Actions, Effect, ofType } from '@ngrx/effects';
import { of, Subject } from 'rxjs';
import { map, mergeMap, catchError, take, withLatestFrom } from 'rxjs/operators';
import { map, mergeMap, catchError, withLatestFrom } from 'rxjs/operators';
import { MatDialog } from '@angular/material';
import { environment } from '../../../environments/environment';
import { LoggerService } from '../services/logger.service';
import { Settings } from '../models/RTLconfig';
import { GetInfo, Fees, Balance, NetworkInfo, Payment, GraphNode, Transaction, SwitchReq, ListInvoices } from '../models/lndModels';
import { LoggerService } from '../../shared/services/logger.service';
import { GetInfo, Fees, Balance, NetworkInfo, Payment, GraphNode, Transaction, SwitchReq, ListInvoices } from '../../shared/models/lndModels';
import { SpinnerDialogComponent } from '../components/spinner-dialog/spinner-dialog.component';
import { AlertMessageComponent } from '../components/alert-message/alert-message.component';
import { ConfirmationMessageComponent } from '../components/confirmation-message/confirmation-message.component';
import * as RTLActions from './rtl.actions';
import * as fromRTLReducer from './rtl.reducers';
import * as RTLActions from '../../store/rtl.actions';
import * as fromRTLReducer from '../../store/rtl.reducers';
import * as LNDActions from './lnd.actions';
import * as fromLNDReducer from './lnd.reducers';
@Injectable()
export class RTLEffects implements OnDestroy {
export class LNDEffects implements OnDestroy {
dialogRef: any;
private unSubs: Array<Subject<void>> = [new Subject(), new Subject()];
constructor(
private actions$: Actions,
private httpClient: HttpClient,
private store: Store<fromRTLReducer.State>,
private store: Store<fromLNDReducer.LNDState>,
private logger: LoggerService,
public dialog: MatDialog,
private router: Router) { }
@Effect({ dispatch: false })
openSpinner = this.actions$.pipe(
ofType(RTLActions.OPEN_SPINNER),
map((action: RTLActions.OpenSpinner) => {
this.dialogRef = this.dialog.open(SpinnerDialogComponent, { data: { titleMessage: action.payload}});
}
));
@Effect({ dispatch: false })
closeSpinner = this.actions$.pipe(
ofType(RTLActions.CLOSE_SPINNER),
map((action: RTLActions.CloseSpinner) => {
if (this.dialogRef) { this.dialogRef.close(); }
}
));
@Effect({ dispatch: false })
openAlert = this.actions$.pipe(
ofType(RTLActions.OPEN_ALERT),
map((action: RTLActions.OpenAlert) => {
this.dialogRef = this.dialog.open(AlertMessageComponent, action.payload);
}
));
@Effect({ dispatch: false })
closeAlert = this.actions$.pipe(
ofType(RTLActions.CLOSE_ALERT),
map((action: RTLActions.CloseAlert) => {
if (this.dialogRef) { this.dialogRef.close(); }
}
));
@Effect({ dispatch: false })
openConfirm = this.actions$.pipe(
ofType(RTLActions.OPEN_CONFIRMATION),
map((action: RTLActions.OpenConfirmation) => {
this.dialogRef = this.dialog.open(ConfirmationMessageComponent, action.payload);
})
);
@Effect({ dispatch: false })
closeConfirm = this.actions$.pipe(
ofType(RTLActions.CLOSE_CONFIRMATION),
take(1),
map((action: RTLActions.CloseConfirmation) => {
this.dialogRef.close();
this.logger.info(action.payload);
return action.payload;
}
));
@Effect()
appConfigFetch = this.actions$.pipe(
ofType(RTLActions.FETCH_RTL_CONFIG),
mergeMap((action: RTLActions.FetchRTLConfig) => {
this.store.dispatch(new RTLActions.ClearEffectError('FetchRTLConfig'));
return this.httpClient.get(environment.CONF_API + '/rtlconf');
}),
map((rtlConfig: any) => {
this.logger.info(rtlConfig);
if (+rtlConfig.sso.rtlSSO) { this.store.dispatch(new RTLActions.Signout()); }
return {
type: RTLActions.SET_RTL_CONFIG,
payload: rtlConfig
};
},
catchError((err) => {
this.logger.error(err);
this.store.dispatch(new RTLActions.EffectError({ action: 'FetchRTLConfig', code: err.status, message: err.error.error }));
return of();
})
));
@Effect({ dispatch: false })
settingSave = this.actions$.pipe(
ofType(RTLActions.SAVE_SETTINGS),
mergeMap((action: RTLActions.SaveSettings) => {
return this.httpClient.post<Settings>(environment.CONF_API, { updatedSettings: action.payload });
}
));
@Effect()
infoFetch = this.actions$.pipe(
ofType(RTLActions.FETCH_INFO),
ofType(LNDActions.FETCH_INFO),
withLatestFrom(this.store.select('rtlRoot')),
mergeMap(([action, store]: [RTLActions.FetchInfo, fromRTLReducer.State]) => {
mergeMap(([action, store]: [LNDActions.FetchInfo, fromRTLReducer.State]) => {
this.store.dispatch(new RTLActions.ClearEffectError('FetchInfo'));
return this.httpClient.get<GetInfo>(environment.GETINFO_API)
.pipe(
@ -129,13 +45,13 @@ export class RTLEffects implements OnDestroy {
this.logger.info('Redirecting to Unlock');
this.router.navigate(['/unlocklnd']);
return {
type: RTLActions.SET_INFO,
type: LNDActions.SET_INFO,
payload: {}
};
} else {
sessionStorage.setItem('lndUnlocked', 'true');
return {
type: RTLActions.SET_INFO,
type: LNDActions.SET_INFO,
payload: (undefined !== info) ? info : {}
};
}
@ -163,15 +79,15 @@ export class RTLEffects implements OnDestroy {
@Effect()
peersFetch = this.actions$.pipe(
ofType(RTLActions.FETCH_PEERS),
mergeMap((action: RTLActions.FetchPeers) => {
ofType(LNDActions.FETCH_PEERS),
mergeMap((action: LNDActions.FetchPeers) => {
this.store.dispatch(new RTLActions.ClearEffectError('FetchPeers'));
return this.httpClient.get(environment.PEERS_API)
.pipe(
map((peers: any) => {
this.logger.info(peers);
return {
type: RTLActions.SET_PEERS,
type: LNDActions.SET_PEERS,
payload: (undefined !== peers) ? peers : []
};
}),
@ -186,8 +102,8 @@ export class RTLEffects implements OnDestroy {
@Effect()
saveNewPeer = this.actions$.pipe(
ofType(RTLActions.SAVE_NEW_PEER),
mergeMap((action: RTLActions.SaveNewPeer) => {
ofType(LNDActions.SAVE_NEW_PEER),
mergeMap((action: LNDActions.SaveNewPeer) => {
return this.httpClient.post(environment.PEERS_API, {pubkey: action.payload.pubkey, host: action.payload.host, perm: action.payload.perm})
.pipe(
map((postRes: any) => {
@ -195,7 +111,7 @@ export class RTLEffects implements OnDestroy {
this.store.dispatch(new RTLActions.CloseSpinner());
this.store.dispatch(new RTLActions.OpenAlert({ width: '70%', data: { type: 'SUCCESS', titleMessage: 'Peer Added Successfully!'}}));
return {
type: RTLActions.SET_PEERS,
type: LNDActions.SET_PEERS,
payload: (undefined !== postRes && postRes.length > 0) ? postRes : []
};
}),
@ -217,8 +133,8 @@ export class RTLEffects implements OnDestroy {
@Effect()
detachPeer = this.actions$.pipe(
ofType(RTLActions.DETACH_PEER),
mergeMap((action: RTLActions.DetachPeer) => {
ofType(LNDActions.DETACH_PEER),
mergeMap((action: LNDActions.DetachPeer) => {
return this.httpClient.delete(environment.PEERS_API + '/' + action.payload.pubkey)
.pipe(
map((postRes: any) => {
@ -226,7 +142,7 @@ export class RTLEffects implements OnDestroy {
this.store.dispatch(new RTLActions.CloseSpinner());
this.store.dispatch(new RTLActions.OpenAlert({ width: '70%', data: {type: 'SUCCESS', titleMessage: 'Peer Detached Successfully!'}}));
return {
type: RTLActions.REMOVE_PEER,
type: LNDActions.REMOVE_PEER,
payload: { pubkey: action.payload.pubkey }
};
}),
@ -248,8 +164,8 @@ export class RTLEffects implements OnDestroy {
@Effect()
saveNewInvoice = this.actions$.pipe(
ofType(RTLActions.SAVE_NEW_INVOICE),
mergeMap((action: RTLActions.SaveNewInvoice) => {
ofType(LNDActions.SAVE_NEW_INVOICE),
mergeMap((action: LNDActions.SaveNewInvoice) => {
return this.httpClient.post(environment.INVOICES_API, {
memo: action.payload.memo, amount: action.payload.invoiceValue, private: action.payload.private, expiry: action.payload.expiry
})
@ -267,7 +183,7 @@ export class RTLEffects implements OnDestroy {
this.store.dispatch(new RTLActions.OpenAlert({ width: '70%',
data: { type: 'SUCCESS', titleMessage: 'Invoice Added Successfully!', message: JSON.stringify(msg) }}));
return {
type: RTLActions.FETCH_INVOICES,
type: LNDActions.FETCH_INVOICES,
payload: {num_max_invoices: action.payload.pageSize, reversed: true}
};
}),
@ -289,8 +205,8 @@ export class RTLEffects implements OnDestroy {
@Effect()
openNewChannel = this.actions$.pipe(
ofType(RTLActions.SAVE_NEW_CHANNEL),
mergeMap((action: RTLActions.SaveNewChannel) => {
ofType(LNDActions.SAVE_NEW_CHANNEL),
mergeMap((action: LNDActions.SaveNewChannel) => {
return this.httpClient.post(environment.CHANNELS_API, {
node_pubkey: action.payload.selectedPeerPubkey, local_funding_amount: action.payload.fundingAmount, private: action.payload.private,
trans_type: action.payload.transType, trans_type_value: action.payload.transTypeValue, spend_unconfirmed: action.payload.spendUnconfirmed
@ -299,11 +215,11 @@ export class RTLEffects implements OnDestroy {
map((postRes: any) => {
this.logger.info(postRes);
this.store.dispatch(new RTLActions.CloseSpinner());
this.store.dispatch(new RTLActions.FetchBalance('blockchain'));
this.store.dispatch(new RTLActions.FetchChannels({routeParam: 'all'}));
this.store.dispatch(new RTLActions.BackupChannels({channelPoint: 'ALL', showMessage: 'Channel Added Successfully!'}));
this.store.dispatch(new LNDActions.FetchBalance('blockchain'));
this.store.dispatch(new LNDActions.FetchChannels({routeParam: 'all'}));
this.store.dispatch(new LNDActions.BackupChannels({channelPoint: 'ALL', showMessage: 'Channel Added Successfully!'}));
return {
type: RTLActions.FETCH_CHANNELS,
type: LNDActions.FETCH_CHANNELS,
payload: {routeParam: 'pending', channelStatus: ''}
};
}),
@ -325,8 +241,8 @@ export class RTLEffects implements OnDestroy {
@Effect()
updateChannel = this.actions$.pipe(
ofType(RTLActions.UPDATE_CHANNELS),
mergeMap((action: RTLActions.UpdateChannels) => {
ofType(LNDActions.UPDATE_CHANNELS),
mergeMap((action: LNDActions.UpdateChannels) => {
return this.httpClient.post(environment.CHANNELS_API + '/chanPolicy',
{ baseFeeMsat: action.payload.baseFeeMsat, feeRate: action.payload.feeRate, timeLockDelta: action.payload.timeLockDelta, chanPoint: action.payload.chanPoint })
.pipe(
@ -335,7 +251,7 @@ export class RTLEffects implements OnDestroy {
this.store.dispatch(new RTLActions.CloseSpinner());
this.store.dispatch(new RTLActions.OpenAlert({ width: '70%', data: {type: 'SUCCESS', titleMessage: 'Channel Updated Successfully!'}}));
return {
type: RTLActions.FETCH_CHANNELS,
type: LNDActions.FETCH_CHANNELS,
payload: {routeParam: 'all', channelStatus: ''}
};
}),
@ -357,24 +273,24 @@ export class RTLEffects implements OnDestroy {
@Effect()
closeChannel = this.actions$.pipe(
ofType(RTLActions.CLOSE_CHANNEL),
mergeMap((action: RTLActions.CloseChannel) => {
ofType(LNDActions.CLOSE_CHANNEL),
mergeMap((action: LNDActions.CloseChannel) => {
return this.httpClient.delete(environment.CHANNELS_API + '/' + action.payload.channelPoint + '?force=' + action.payload.forcibly)
.pipe(
map((postRes: any) => {
this.logger.info(postRes);
this.store.dispatch(new RTLActions.CloseSpinner());
this.store.dispatch(new RTLActions.FetchBalance('channels'));
this.store.dispatch(new RTLActions.FetchBalance('blockchain'));
this.store.dispatch(new RTLActions.FetchChannels({routeParam: 'all'}));
this.store.dispatch(new LNDActions.FetchBalance('channels'));
this.store.dispatch(new LNDActions.FetchBalance('blockchain'));
this.store.dispatch(new LNDActions.FetchChannels({routeParam: 'all'}));
if (action.payload.forcibly) {
this.store.dispatch(new RTLActions.FetchChannels({routeParam: 'pending'}));
this.store.dispatch(new LNDActions.FetchChannels({routeParam: 'pending'}));
} else {
this.store.dispatch(new RTLActions.FetchChannels({routeParam: 'closed'}));
this.store.dispatch(new LNDActions.FetchChannels({routeParam: 'closed'}));
}
this.store.dispatch(new RTLActions.BackupChannels({channelPoint: 'ALL', showMessage: 'Channel Closed Successfully!'}));
this.store.dispatch(new LNDActions.BackupChannels({channelPoint: 'ALL', showMessage: 'Channel Closed Successfully!'}));
return {
type: RTLActions.REMOVE_CHANNEL,
type: LNDActions.REMOVE_CHANNEL,
payload: { channelPoint: action.payload.channelPoint }
};
}),
@ -395,8 +311,8 @@ export class RTLEffects implements OnDestroy {
@Effect()
backupChannels = this.actions$.pipe(
ofType(RTLActions.BACKUP_CHANNELS),
mergeMap((action: RTLActions.BackupChannels) => {
ofType(LNDActions.BACKUP_CHANNELS),
mergeMap((action: LNDActions.BackupChannels) => {
this.store.dispatch(new RTLActions.ClearEffectError('BackupChannels'));
return this.httpClient.get(environment.CHANNELS_BACKUP_API + '/' + action.payload.channelPoint)
.pipe(
@ -405,7 +321,7 @@ export class RTLEffects implements OnDestroy {
this.store.dispatch(new RTLActions.CloseSpinner());
this.store.dispatch(new RTLActions.OpenAlert({ width: '70%', data: {type: 'SUCCESS', titleMessage: action.payload.showMessage + ' ' + postRes.message}}));
return {
type: RTLActions.BACKUP_CHANNELS_RES,
type: LNDActions.BACKUP_CHANNELS_RES,
payload: postRes.message
};
}),
@ -427,8 +343,8 @@ export class RTLEffects implements OnDestroy {
@Effect()
verifyChannels = this.actions$.pipe(
ofType(RTLActions.VERIFY_CHANNELS),
mergeMap((action: RTLActions.VerifyChannels) => {
ofType(LNDActions.VERIFY_CHANNELS),
mergeMap((action: LNDActions.VerifyChannels) => {
this.store.dispatch(new RTLActions.ClearEffectError('VerifyChannels'));
return this.httpClient.post(environment.CHANNELS_BACKUP_API + '/verify/' + action.payload.channelPoint, {})
.pipe(
@ -437,7 +353,7 @@ export class RTLEffects implements OnDestroy {
this.store.dispatch(new RTLActions.CloseSpinner());
this.store.dispatch(new RTLActions.OpenAlert({ width: '70%', data: {type: 'SUCCESS', titleMessage: postRes.message}}));
return {
type: RTLActions.VERIFY_CHANNELS_RES,
type: LNDActions.VERIFY_CHANNELS_RES,
payload: postRes.message
};
}),
@ -459,15 +375,15 @@ export class RTLEffects implements OnDestroy {
@Effect()
fetchFees = this.actions$.pipe(
ofType(RTLActions.FETCH_FEES),
mergeMap((action: RTLActions.FetchFees) => {
ofType(LNDActions.FETCH_FEES),
mergeMap((action: LNDActions.FetchFees) => {
this.store.dispatch(new RTLActions.ClearEffectError('FetchFees'));
return this.httpClient.get<Fees>(environment.FEES_API);
}),
map((fees) => {
this.logger.info(fees);
return {
type: RTLActions.SET_FEES,
type: LNDActions.SET_FEES,
payload: (undefined !== fees) ? fees : {}
};
}),
@ -480,19 +396,19 @@ export class RTLEffects implements OnDestroy {
@Effect()
balanceFetch = this.actions$.pipe(
ofType(RTLActions.FETCH_BALANCE),
mergeMap((action: RTLActions.FetchBalance) => {
ofType(LNDActions.FETCH_BALANCE),
mergeMap((action: LNDActions.FetchBalance) => {
this.store.dispatch(new RTLActions.ClearEffectError('FetchBalance/' + action.payload));
return this.httpClient.get<Balance>(environment.BALANCE_API + '/' + action.payload)
.pipe(
map((res: any) => {
if (action.payload === 'channels') {
this.store.dispatch(new RTLActions.FetchBalance('blockchain'));
this.store.dispatch(new LNDActions.FetchBalance('blockchain'));
}
this.logger.info(res);
const emptyRes = (action.payload === 'channels') ? {balance: '', btc_balance: ''} : {total_balance: '', btc_total_balance: ''};
return {
type: RTLActions.SET_BALANCE,
type: LNDActions.SET_BALANCE,
payload: (undefined !== res) ? { target: action.payload, balance: res } : { target: action.payload, balance: emptyRes }
};
}),
@ -507,15 +423,15 @@ export class RTLEffects implements OnDestroy {
@Effect()
networkInfoFetch = this.actions$.pipe(
ofType(RTLActions.FETCH_NETWORK),
mergeMap((action: RTLActions.FetchNetwork) => {
ofType(LNDActions.FETCH_NETWORK),
mergeMap((action: LNDActions.FetchNetwork) => {
this.store.dispatch(new RTLActions.ClearEffectError('FetchNetwork'));
return this.httpClient.get<NetworkInfo>(environment.NETWORK_API + '/info');
}),
map((networkInfo) => {
this.logger.info(networkInfo);
return {
type: RTLActions.SET_NETWORK,
type: LNDActions.SET_NETWORK,
payload: (undefined !== networkInfo) ? networkInfo : {}
};
}),
@ -528,25 +444,25 @@ export class RTLEffects implements OnDestroy {
@Effect()
channelsFetch = this.actions$.pipe(
ofType(RTLActions.FETCH_CHANNELS),
mergeMap((action: RTLActions.FetchChannels) => {
ofType(LNDActions.FETCH_CHANNELS),
mergeMap((action: LNDActions.FetchChannels) => {
return this.httpClient.get(environment.CHANNELS_API + '/' + action.payload.routeParam)
.pipe(
map((channels: any) => {
this.logger.info(channels);
if (action.payload.routeParam === 'pending') {
return {
type: RTLActions.SET_PENDING_CHANNELS,
type: LNDActions.SET_PENDING_CHANNELS,
payload: (undefined !== channels) ? channels : {}
};
} else if (action.payload.routeParam === 'closed') {
return {
type: RTLActions.SET_CLOSED_CHANNELS,
type: LNDActions.SET_CLOSED_CHANNELS,
payload: (undefined !== channels && undefined !== channels.channels && channels.channels.length > 0) ? channels.channels : []
};
} else if (action.payload.routeParam === 'all') {
return {
type: RTLActions.SET_CHANNELS,
type: LNDActions.SET_CHANNELS,
payload: (undefined !== channels && undefined !== channels.channels && channels.channels.length > 0) ? channels.channels : []
};
}
@ -562,8 +478,8 @@ export class RTLEffects implements OnDestroy {
@Effect()
invoicesFetch = this.actions$.pipe(
ofType(RTLActions.FETCH_INVOICES),
mergeMap((action: RTLActions.FetchInvoices) => {
ofType(LNDActions.FETCH_INVOICES),
mergeMap((action: LNDActions.FetchInvoices) => {
this.store.dispatch(new RTLActions.ClearEffectError('FetchInvoices'));
const num_max_invoices = (action.payload.num_max_invoices) ? action.payload.num_max_invoices : 100;
const index_offset = (action.payload.index_offset) ? action.payload.index_offset : 0;
@ -572,10 +488,10 @@ export class RTLEffects implements OnDestroy {
.pipe(map((res: ListInvoices) => {
this.logger.info(res);
if (action.payload.reversed && !action.payload.index_offset) {
this.store.dispatch(new RTLActions.SetTotalInvoices(+res.last_index_offset));
this.store.dispatch(new LNDActions.SetTotalInvoices(+res.last_index_offset));
}
return {
type: RTLActions.SET_INVOICES,
type: LNDActions.SET_INVOICES,
payload: res
};
}),
@ -589,15 +505,15 @@ export class RTLEffects implements OnDestroy {
@Effect()
transactionsFetch = this.actions$.pipe(
ofType(RTLActions.FETCH_TRANSACTIONS),
mergeMap((action: RTLActions.FetchTransactions) => {
ofType(LNDActions.FETCH_TRANSACTIONS),
mergeMap((action: LNDActions.FetchTransactions) => {
this.store.dispatch(new RTLActions.ClearEffectError('FetchTransactions'));
return this.httpClient.get<Transaction[]>(environment.TRANSACTIONS_API);
}),
map((transactions) => {
this.logger.info(transactions);
return {
type: RTLActions.SET_TRANSACTIONS,
type: LNDActions.SET_TRANSACTIONS,
payload: (undefined !== transactions && transactions.length > 0) ? transactions : []
};
}),
@ -610,15 +526,15 @@ export class RTLEffects implements OnDestroy {
@Effect()
paymentsFetch = this.actions$.pipe(
ofType(RTLActions.FETCH_PAYMENTS),
mergeMap((action: RTLActions.FetchPayments) => {
ofType(LNDActions.FETCH_PAYMENTS),
mergeMap((action: LNDActions.FetchPayments) => {
this.store.dispatch(new RTLActions.ClearEffectError('FetchPayments'));
return this.httpClient.get<Payment[]>(environment.PAYMENTS_API);
}),
map((payments) => {
this.logger.info(payments);
return {
type: RTLActions.SET_PAYMENTS,
type: LNDActions.SET_PAYMENTS,
payload: (undefined !== payments && null != payments) ? payments : []
};
}),
@ -631,15 +547,15 @@ export class RTLEffects implements OnDestroy {
@Effect()
decodePayment = this.actions$.pipe(
ofType(RTLActions.DECODE_PAYMENT),
mergeMap((action: RTLActions.DecodePayment) => {
ofType(LNDActions.DECODE_PAYMENT),
mergeMap((action: LNDActions.DecodePayment) => {
return this.httpClient.get(environment.PAYREQUEST_API + '/' + action.payload)
.pipe(
map((decodedPayment) => {
this.logger.info(decodedPayment);
this.store.dispatch(new RTLActions.CloseSpinner());
return {
type: RTLActions.SET_DECODED_PAYMENT,
type: LNDActions.SET_DECODED_PAYMENT,
payload: (undefined !== decodedPayment) ? decodedPayment : {}
};
}),
@ -660,8 +576,8 @@ export class RTLEffects implements OnDestroy {
@Effect({ dispatch: false })
setDecodedPayment = this.actions$.pipe(
ofType(RTLActions.SET_DECODED_PAYMENT),
map((action: RTLActions.SetDecodedPayment) => {
ofType(LNDActions.SET_DECODED_PAYMENT),
map((action: LNDActions.SetDecodedPayment) => {
this.logger.info(action.payload);
return action.payload;
})
@ -669,9 +585,9 @@ export class RTLEffects implements OnDestroy {
@Effect()
sendPayment = this.actions$.pipe(
ofType(RTLActions.SEND_PAYMENT),
ofType(LNDActions.SEND_PAYMENT),
withLatestFrom(this.store.select('rtlRoot')),
mergeMap(([action, store]: [RTLActions.SendPayment, fromRTLReducer.State]) => {
mergeMap(([action, store]: [LNDActions.SendPayment, fromLNDReducer.LNDState]) => {
let queryHeaders = {};
if (action.payload[2]) {
queryHeaders = {paymentDecoded: action.payload[1]};
@ -703,11 +619,11 @@ export class RTLEffects implements OnDestroy {
Object.assign(msg, confirmationMsg);
this.store.dispatch(new RTLActions.OpenAlert({ width: '70%',
data: { type: 'SUCCESS', titleMessage: 'Payment Sent Successfully!', message: JSON.stringify(msg) }}));
this.store.dispatch(new RTLActions.FetchChannels({routeParam: 'all'}));
this.store.dispatch(new RTLActions.FetchBalance('channels'));
this.store.dispatch(new RTLActions.FetchPayments());
this.store.dispatch(new LNDActions.FetchChannels({routeParam: 'all'}));
this.store.dispatch(new LNDActions.FetchBalance('channels'));
this.store.dispatch(new LNDActions.FetchPayments());
return {
type: RTLActions.SET_DECODED_PAYMENT,
type: LNDActions.SET_DECODED_PAYMENT,
payload: {}
};
}
@ -729,14 +645,14 @@ export class RTLEffects implements OnDestroy {
@Effect()
graphNodeFetch = this.actions$.pipe(
ofType(RTLActions.FETCH_GRAPH_NODE),
mergeMap((action: RTLActions.FetchGraphNode) => {
ofType(LNDActions.FETCH_GRAPH_NODE),
mergeMap((action: LNDActions.FetchGraphNode) => {
return this.httpClient.get<GraphNode>(environment.NETWORK_API + '/node/' + action.payload)
.pipe(map((graphNode: any) => {
this.logger.info(graphNode);
this.store.dispatch(new RTLActions.CloseSpinner());
return {
type: RTLActions.SET_GRAPH_NODE,
type: LNDActions.SET_GRAPH_NODE,
payload: (undefined !== graphNode) ? graphNode : {}
};
}),
@ -756,8 +672,8 @@ export class RTLEffects implements OnDestroy {
@Effect({ dispatch: false })
setGraphNode = this.actions$.pipe(
ofType(RTLActions.SET_GRAPH_NODE),
map((action: RTLActions.SetGraphNode) => {
ofType(LNDActions.SET_GRAPH_NODE),
map((action: LNDActions.SetGraphNode) => {
this.logger.info(action.payload);
return action.payload;
})
@ -765,14 +681,14 @@ export class RTLEffects implements OnDestroy {
@Effect()
getNewAddress = this.actions$.pipe(
ofType(RTLActions.GET_NEW_ADDRESS),
mergeMap((action: RTLActions.GetNewAddress) => {
ofType(LNDActions.GET_NEW_ADDRESS),
mergeMap((action: LNDActions.GetNewAddress) => {
return this.httpClient.get(environment.NEW_ADDRESS_API + '?type=' + action.payload.addressId)
.pipe(map((newAddress: any) => {
this.logger.info(newAddress);
this.store.dispatch(new RTLActions.CloseSpinner());
return {
type: RTLActions.SET_NEW_ADDRESS,
type: LNDActions.SET_NEW_ADDRESS,
payload: (undefined !== newAddress && undefined !== newAddress.address) ? newAddress.address : {}
};
}),
@ -792,8 +708,8 @@ export class RTLEffects implements OnDestroy {
@Effect({ dispatch: false })
setNewAddress = this.actions$.pipe(
ofType(RTLActions.SET_NEW_ADDRESS),
map((action: RTLActions.SetNewAddress) => {
ofType(LNDActions.SET_NEW_ADDRESS),
map((action: LNDActions.SetNewAddress) => {
this.logger.info(action.payload);
return action.payload;
})
@ -801,15 +717,15 @@ export class RTLEffects implements OnDestroy {
@Effect()
configFetch = this.actions$.pipe(
ofType(RTLActions.FETCH_CONFIG),
mergeMap((action: RTLActions.FetchConfig) => {
ofType(LNDActions.FETCH_CONFIG),
mergeMap((action: LNDActions.FetchConfig) => {
this.store.dispatch(new RTLActions.ClearEffectError('fetchConfig'));
return this.httpClient.get(environment.CONF_API + '/config/' + action.payload)
.pipe(
map((configFile: any) => {
this.store.dispatch(new RTLActions.CloseSpinner());
return {
type: RTLActions.SHOW_CONFIG,
type: LNDActions.SHOW_CONFIG,
payload: configFile
};
}),
@ -831,16 +747,16 @@ export class RTLEffects implements OnDestroy {
@Effect({ dispatch: false })
showLNDConfig = this.actions$.pipe(
ofType(RTLActions.SHOW_CONFIG),
map((action: RTLActions.ShowConfig) => {
ofType(LNDActions.SHOW_CONFIG),
map((action: LNDActions.ShowConfig) => {
return action.payload;
})
);
@Effect()
SetChannelTransaction = this.actions$.pipe(
ofType(RTLActions.SET_CHANNEL_TRANSACTION),
mergeMap((action: RTLActions.SetChannelTransaction) => {
ofType(LNDActions.SET_CHANNEL_TRANSACTION),
mergeMap((action: LNDActions.SetChannelTransaction) => {
this.store.dispatch(new RTLActions.ClearEffectError('SetChannelTransaction'));
return this.httpClient.post(environment.TRANSACTIONS_API,
{ amount: action.payload.amount, address: action.payload.address, sendAll: action.payload.sendAll, fees: action.payload.fees, blocks: action.payload.blocks }
@ -849,7 +765,7 @@ export class RTLEffects implements OnDestroy {
map((postRes: any) => {
this.logger.info(postRes);
this.store.dispatch(new RTLActions.CloseSpinner());
this.store.dispatch(new RTLActions.FetchBalance('blockchain'));
this.store.dispatch(new LNDActions.FetchBalance('blockchain'));
return {
type: RTLActions.OPEN_ALERT,
payload: { data: {type: 'SUCCESS', titleMessage: 'Fund Sent Successfully!'} }
@ -872,8 +788,8 @@ export class RTLEffects implements OnDestroy {
@Effect()
fetchForwardingHistory = this.actions$.pipe(
ofType(RTLActions.GET_FORWARDING_HISTORY),
mergeMap((action: RTLActions.GetForwardingHistory) => {
ofType(LNDActions.GET_FORWARDING_HISTORY),
mergeMap((action: LNDActions.GetForwardingHistory) => {
this.store.dispatch(new RTLActions.ClearEffectError('GetForwardingHistory'));
const queryHeaders: SwitchReq = {
num_max_events: action.payload.num_max_events, index_offset: action.payload.index_offset, end_time: action.payload.end_time , start_time: action.payload.start_time
@ -883,7 +799,7 @@ export class RTLEffects implements OnDestroy {
map((fhRes: any) => {
this.logger.info(fhRes);
return {
type: RTLActions.SET_FORWARDING_HISTORY,
type: LNDActions.SET_FORWARDING_HISTORY,
payload: fhRes
};
}),
@ -904,19 +820,19 @@ export class RTLEffects implements OnDestroy {
@Effect()
queryRoutesFetch = this.actions$.pipe(
ofType(RTLActions.GET_QUERY_ROUTES),
mergeMap((action: RTLActions.GetQueryRoutes) => {
ofType(LNDActions.GET_QUERY_ROUTES),
mergeMap((action: LNDActions.GetQueryRoutes) => {
return this.httpClient.get(environment.NETWORK_API + '/routes/' + action.payload.destPubkey + '/' + action.payload.amount)
.pipe(
map((qrRes: any) => {
this.logger.info(qrRes);
return {
type: RTLActions.SET_QUERY_ROUTES,
type: LNDActions.SET_QUERY_ROUTES,
payload: qrRes
};
}),
catchError((err: any) => {
this.store.dispatch(new RTLActions.SetQueryRoutes({}));
this.store.dispatch(new LNDActions.SetQueryRoutes({}));
this.logger.error(err);
return of(
{
@ -932,16 +848,16 @@ export class RTLEffects implements OnDestroy {
@Effect({ dispatch: false })
setQueryRoutes = this.actions$.pipe(
ofType(RTLActions.SET_QUERY_ROUTES),
map((action: RTLActions.SetQueryRoutes) => {
ofType(LNDActions.SET_QUERY_ROUTES),
map((action: LNDActions.SetQueryRoutes) => {
return action.payload;
})
);
@Effect()
genSeed = this.actions$.pipe(
ofType(RTLActions.GEN_SEED),
mergeMap((action: RTLActions.GenSeed) => {
ofType(LNDActions.GEN_SEED),
mergeMap((action: LNDActions.GenSeed) => {
return this.httpClient.get(environment.WALLET_API + '/genseed/' + action.payload)
.pipe(
map((postRes: any) => {
@ -949,7 +865,7 @@ export class RTLEffects implements OnDestroy {
this.logger.info(postRes);
this.store.dispatch(new RTLActions.CloseSpinner());
return {
type: RTLActions.GEN_SEED_RESPONSE,
type: LNDActions.GEN_SEED_RESPONSE,
payload: postRes.cipher_seed_mnemonic
};
}),
@ -965,24 +881,24 @@ export class RTLEffects implements OnDestroy {
@Effect({ dispatch: false })
genSeedResponse = this.actions$.pipe(
ofType(RTLActions.GEN_SEED_RESPONSE),
map((action: RTLActions.GenSeedResponse) => {
ofType(LNDActions.GEN_SEED_RESPONSE),
map((action: LNDActions.GenSeedResponse) => {
return action.payload;
})
);
@Effect({ dispatch: false })
initWalletRes = this.actions$.pipe(
ofType(RTLActions.INIT_WALLET_RESPONSE),
map((action: RTLActions.InitWalletResponse) => {
ofType(LNDActions.INIT_WALLET_RESPONSE),
map((action: LNDActions.InitWalletResponse) => {
return action.payload;
})
);
@Effect()
initWallet = this.actions$.pipe(
ofType(RTLActions.INIT_WALLET),
mergeMap((action: RTLActions.InitWallet) => {
ofType(LNDActions.INIT_WALLET),
mergeMap((action: LNDActions.InitWallet) => {
return this.httpClient.post(environment.WALLET_API + '/initwallet',
{ wallet_password: action.payload.pwd,
cipher_seed_mnemonic: action.payload.cipher ? action.payload.cipher : '',
@ -992,7 +908,7 @@ export class RTLEffects implements OnDestroy {
this.logger.info(postRes);
this.store.dispatch(new RTLActions.CloseSpinner());
return {
type: RTLActions.INIT_WALLET_RESPONSE,
type: LNDActions.INIT_WALLET_RESPONSE,
payload: postRes
};
}),
@ -1008,8 +924,8 @@ export class RTLEffects implements OnDestroy {
@Effect({ dispatch : false })
unlockWallet = this.actions$.pipe(
ofType(RTLActions.UNLOCK_WALLET),
mergeMap((action: RTLActions.UnlockWallet) => {
ofType(LNDActions.UNLOCK_WALLET),
mergeMap((action: LNDActions.UnlockWallet) => {
return this.httpClient.post(environment.WALLET_API + '/unlockwallet', { wallet_password: action.payload.pwd })
.pipe(
map((postRes) => {
@ -1036,92 +952,10 @@ export class RTLEffects implements OnDestroy {
}
));
@Effect()
isAuthorized = this.actions$.pipe(
ofType(RTLActions.IS_AUTHORIZED),
withLatestFrom(this.store.select('rtlRoot')),
mergeMap(([action, store]: [RTLActions.IsAuthorized, fromRTLReducer.State]) => {
this.store.dispatch(new RTLActions.ClearEffectError('IsAuthorized'));
return this.httpClient.post(environment.AUTHENTICATE_API, { password: action.payload })
.pipe(
map((postRes: any) => {
this.logger.info(postRes);
this.logger.info('Successfully Authorized!');
return {
type: RTLActions.IS_AUTHORIZED_RES,
payload: postRes
};
}),
catchError((err) => {
this.store.dispatch(new RTLActions.OpenAlert({ width: '70%', data: {type: 'ERROR', titleMessage: 'Authorization Failed',
message: JSON.stringify({Code: err.status, Message: err.error.error})}}));
this.store.dispatch(new RTLActions.EffectError({ action: 'IsAuthorized', code: err.status, message: err.error.message }));
this.logger.error(err.error);
return of({
type: RTLActions.IS_AUTHORIZED_RES,
payload: 'ERROR'
});
})
);
}));
@Effect({ dispatch: false })
isAuthorizedRes = this.actions$.pipe(
ofType(RTLActions.IS_AUTHORIZED_RES),
map((action: RTLActions.IsAuthorizedRes) => {
return action.payload;
})
);
@Effect({ dispatch: false })
authSignin = this.actions$.pipe(
ofType(RTLActions.SIGNIN),
withLatestFrom(this.store.select('rtlRoot')),
mergeMap(([action, store]: [RTLActions.Signin, fromRTLReducer.State]) => {
this.store.dispatch(new RTLActions.ClearEffectError('Signin'));
return this.httpClient.post(environment.AUTHENTICATE_API, { password: action.payload })
.pipe(
map((postRes: any) => {
this.logger.info(postRes);
this.logger.info('Successfully Authorized!');
this.SetToken(postRes.token);
this.router.navigate(['/']);
}),
catchError((err) => {
this.store.dispatch(new RTLActions.OpenAlert({ width: '70%', data: {type: 'ERROR', message: JSON.stringify(err.error)}}));
this.store.dispatch(new RTLActions.EffectError({ action: 'Signin', code: err.status, message: err.error.message }));
this.logger.error(err.error);
this.logger.info('Redirecting to Signin Error Page');
if (+store.appConfig.sso.rtlSSO) {
this.router.navigate(['/ssoerror']);
} else {
this.router.navigate([store.appConfig.sso.logoutRedirectLink]);
}
return of();
})
);
}));
@Effect({ dispatch: false })
signOut = this.actions$.pipe(
ofType(RTLActions.SIGNOUT),
withLatestFrom(this.store.select('rtlRoot')),
mergeMap(([action, store]: [RTLActions.Signout, fromRTLReducer.State]) => {
if (+store.appConfig.sso.rtlSSO) {
window.location.href = store.appConfig.sso.logoutRedirectLink;
} else {
this.router.navigate([store.appConfig.sso.logoutRedirectLink]);
}
sessionStorage.removeItem('lndUnlocked');
sessionStorage.removeItem('token');
this.logger.warn('LOGGED OUT');
return of();
}));
@Effect()
peerLookup = this.actions$.pipe(
ofType(RTLActions.PEER_LOOKUP),
mergeMap((action: RTLActions.PeerLookup) => {
ofType(LNDActions.PEER_LOOKUP),
mergeMap((action: LNDActions.PeerLookup) => {
this.store.dispatch(new RTLActions.ClearEffectError('Lookup'));
return this.httpClient.get(environment.NETWORK_API + '/node/' + action.payload)
.pipe(
@ -1129,7 +963,7 @@ export class RTLEffects implements OnDestroy {
this.logger.info(resPeer);
this.store.dispatch(new RTLActions.CloseSpinner());
return {
type: RTLActions.SET_LOOKUP,
type: LNDActions.SET_LOOKUP,
payload: resPeer
};
}),
@ -1151,8 +985,8 @@ export class RTLEffects implements OnDestroy {
@Effect()
channelLookup = this.actions$.pipe(
ofType(RTLActions.CHANNEL_LOOKUP),
mergeMap((action: RTLActions.ChannelLookup) => {
ofType(LNDActions.CHANNEL_LOOKUP),
mergeMap((action: LNDActions.ChannelLookup) => {
this.store.dispatch(new RTLActions.ClearEffectError('Lookup'));
return this.httpClient.get(environment.NETWORK_API + '/edge/' + action.payload)
.pipe(
@ -1160,7 +994,7 @@ export class RTLEffects implements OnDestroy {
this.logger.info(resChannel);
this.store.dispatch(new RTLActions.CloseSpinner());
return {
type: RTLActions.SET_LOOKUP,
type: LNDActions.SET_LOOKUP,
payload: resChannel
};
}),
@ -1182,8 +1016,8 @@ export class RTLEffects implements OnDestroy {
@Effect()
invoiceLookup = this.actions$.pipe(
ofType(RTLActions.INVOICE_LOOKUP),
mergeMap((action: RTLActions.InvoiceLookup) => {
ofType(LNDActions.INVOICE_LOOKUP),
mergeMap((action: LNDActions.InvoiceLookup) => {
this.store.dispatch(new RTLActions.ClearEffectError('Lookup'));
return this.httpClient.get(environment.INVOICES_API + '/' + action.payload)
.pipe(
@ -1191,7 +1025,7 @@ export class RTLEffects implements OnDestroy {
this.logger.info(resInvoice);
this.store.dispatch(new RTLActions.CloseSpinner());
return {
type: RTLActions.SET_LOOKUP,
type: LNDActions.SET_LOOKUP,
payload: resInvoice
};
}),
@ -1213,61 +1047,13 @@ export class RTLEffects implements OnDestroy {
@Effect({ dispatch: false })
setLookup = this.actions$.pipe(
ofType(RTLActions.SET_LOOKUP),
map((action: RTLActions.SetLookup) => {
ofType(LNDActions.SET_LOOKUP),
map((action: LNDActions.SetLookup) => {
this.logger.info(action.payload);
return action.payload;
})
);
@Effect()
setSelectedNode = this.actions$.pipe(
ofType(RTLActions.SET_SELECTED_NODE),
mergeMap((action: RTLActions.SetSelelectedNode) => {
this.store.dispatch(new RTLActions.ClearEffectError('UpdateSelNode'));
return this.httpClient.post(environment.CONF_API + '/updateSelNode', { selNodeIndex: action.payload.index })
.pipe(
map((postRes: any) => {
this.logger.info(postRes);
this.store.dispatch(new RTLActions.CloseSpinner());
if (sessionStorage.getItem('token')) {
this.store.dispatch(new RTLActions.ResetStore(action.payload));
return { type: RTLActions.FETCH_INFO };
} else {
return {
type: RTLActions.OPEN_ALERT,
payload: { width: '70%', data: {type: 'WARN', titleMessage: 'Authorization required to get the data from the node!' }}
};
}
}),
catchError((err: any) => {
this.store.dispatch(new RTLActions.CloseSpinner());
this.store.dispatch(new RTLActions.EffectError({ action: 'UpdateSelNode', code: err.status, message: err.error.message }));
this.logger.error(err);
return of(
{
type: RTLActions.OPEN_ALERT,
payload: { width: '70%', data: {type: 'ERROR', titleMessage: 'Update Selected Node Failed!',
message: JSON.stringify({code: err.status, Message: err.error.error})
}}
}
);
})
);
}
));
SetToken(token: string) {
if (token) {
sessionStorage.setItem('lndUnlocked', 'true');
sessionStorage.setItem('token', token);
this.store.dispatch(new RTLActions.InitAppData());
} else {
sessionStorage.removeItem('lndUnlocked');
sessionStorage.removeItem('token');
}
}
ngOnDestroy() {
this.unSubs.forEach(completeSub => {
completeSub.next();

@ -1,15 +1,15 @@
import * as RTLActions from './rtl.actions';
import { ErrorPayload } from '../models/errorPayload';
import { RTLConfiguration, Node } from '../models/RTLconfig';
import * as LNDActions from './lnd.actions';
import {
GetInfo, GetInfoChain, Peer, AddressType, Fees, NetworkInfo, Balance, Channel, Payment, ListInvoices, PendingChannels, ClosedChannel, Transaction, SwitchRes, QueryRoutes
} from '../models/lndModels';
GetInfo, GetInfoChain, Peer, AddressType, Fees, NetworkInfo, Balance, Channel,
Payment, ListInvoices, PendingChannels, ClosedChannel, Transaction, SwitchRes, QueryRoutes
} from '../../shared/models/lndModels';
import * as fromApp from '../../store/rtl.reducers';
export interface FeatureState extends fromApp.State {
lnd: LNDState;
}
export interface State {
effectErrors: ErrorPayload[];
selNode: Node;
appConfig: RTLConfiguration;
export interface LNDState {
information: GetInfo;
peers: Peer[];
fees: Fees;
@ -32,17 +32,7 @@ export interface State {
addressTypes: AddressType[];
}
const initNodeSettings = { flgSidenavOpened: true, flgSidenavPinned: true, menu: 'Vertical', menuType: 'Regular', theme: 'dark-blue', satsToBTC: false };
const initNodeAuthentication = { nodeAuthType: 'CUSTOM', lndConfigPath: '', bitcoindConfigPath: '' };
const initialState: State = {
effectErrors: [],
selNode: {settings: initNodeSettings, authentication: initNodeAuthentication},
appConfig: {
selectedNodeIndex: -1,
sso: { rtlSSO: 0, logoutRedirectLink: '/login' },
nodes: [{ settings: initNodeSettings, authentication: initNodeAuthentication}]
},
export const LNDInitialState: LNDState = {
information: {},
peers: [],
fees: {},
@ -68,43 +58,9 @@ const initialState: State = {
]
};
export function RTLRootReducer(state = initialState, action: RTLActions.RTLActions) {
export function LNDReducer(state = LNDInitialState, action: LNDActions.LNDActions) {
switch (action.type) {
case RTLActions.CLEAR_EFFECT_ERROR:
const clearedEffectErrors = [...state.effectErrors];
const removeEffectIdx = state.effectErrors.findIndex(err => {
return err.action === action.payload;
});
if (removeEffectIdx > -1) {
clearedEffectErrors.splice(removeEffectIdx, 1);
}
return {
...state,
effectErrors: clearedEffectErrors
};
case RTLActions.EFFECT_ERROR:
return {
...state,
effectErrors: [...state.effectErrors, action.payload]
};
case RTLActions.RESET_STORE:
return {
...initialState,
appConfig: state.appConfig,
selNode: action.payload
};
case RTLActions.SET_SELECTED_NODE:
return {
...state,
selNode: action.payload
};
case RTLActions.SET_RTL_CONFIG:
return {
...state,
selNode: action.payload.nodes.find(node => +node.index === action.payload.selectedNodeIndex),
appConfig: action.payload
};
case RTLActions.SET_INFO:
case LNDActions.SET_INFO:
if (undefined !== action.payload.chains) {
if (typeof action.payload.chains[0] === 'string') {
action.payload.smaller_currency_unit = (action.payload.chains[0].toString().toLowerCase().indexOf('bitcoin') < 0) ? 'Litoshis' : 'Sats';
@ -124,17 +80,17 @@ export function RTLRootReducer(state = initialState, action: RTLActions.RTLActio
...state,
information: action.payload
};
case RTLActions.SET_PEERS:
case LNDActions.SET_PEERS:
return {
...state,
peers: action.payload
};
case RTLActions.ADD_PEER:
case LNDActions.ADD_PEER:
return {
...state,
peers: [...state.peers, action.payload]
};
case RTLActions.REMOVE_PEER:
case LNDActions.REMOVE_PEER:
const modifiedPeers = [...state.peers];
const removePeerIdx = state.peers.findIndex(peer => {
return peer.pub_key === action.payload.pubkey;
@ -146,24 +102,24 @@ export function RTLRootReducer(state = initialState, action: RTLActions.RTLActio
...state,
peers: modifiedPeers
};
case RTLActions.ADD_INVOICE:
case LNDActions.ADD_INVOICE:
const newInvoices = state.invoices;
newInvoices.invoices.unshift(action.payload);
return {
...state,
invoices: newInvoices
};
case RTLActions.SET_FEES:
case LNDActions.SET_FEES:
return {
...state,
fees: action.payload
};
case RTLActions.SET_CLOSED_CHANNELS:
case LNDActions.SET_CLOSED_CHANNELS:
return {
...state,
closedChannels: action.payload,
};
case RTLActions.SET_PENDING_CHANNELS:
case LNDActions.SET_PENDING_CHANNELS:
let pendingChannels = -1;
if (action.payload) {
pendingChannels = 0;
@ -185,7 +141,7 @@ export function RTLRootReducer(state = initialState, action: RTLActions.RTLActio
pendingChannels: action.payload,
numberOfPendingChannels: pendingChannels,
};
case RTLActions.SET_CHANNELS:
case LNDActions.SET_CHANNELS:
let localBal = 0, remoteBal = 0, activeChannels = 0, inactiveChannels = 0;
if (action.payload) {
action.payload.filter(channel => {
@ -210,7 +166,7 @@ export function RTLRootReducer(state = initialState, action: RTLActions.RTLActio
totalLocalBalance: localBal,
totalRemoteBalance: remoteBal
};
case RTLActions.REMOVE_CHANNEL:
case LNDActions.REMOVE_CHANNEL:
const modifiedChannels = [...state.allChannels];
const removeChannelIdx = state.allChannels.findIndex(channel => {
return channel.channel_point === action.payload.channelPoint;
@ -222,7 +178,7 @@ export function RTLRootReducer(state = initialState, action: RTLActions.RTLActio
...state,
allChannels: modifiedChannels
};
case RTLActions.SET_BALANCE:
case LNDActions.SET_BALANCE:
if (action.payload.target === 'channels') {
return {
...state,
@ -234,32 +190,32 @@ export function RTLRootReducer(state = initialState, action: RTLActions.RTLActio
blockchainBalance: action.payload.balance
};
}
case RTLActions.SET_NETWORK:
case LNDActions.SET_NETWORK:
return {
...state,
networkInfo: action.payload
};
case RTLActions.SET_INVOICES:
case LNDActions.SET_INVOICES:
return {
...state,
invoices: action.payload
};
case RTLActions.SET_TOTAL_INVOICES:
case LNDActions.SET_TOTAL_INVOICES:
return {
...state,
totalInvoices: action.payload
};
case RTLActions.SET_TRANSACTIONS:
case LNDActions.SET_TRANSACTIONS:
return {
...state,
transactions: action.payload
};
case RTLActions.SET_PAYMENTS:
case LNDActions.SET_PAYMENTS:
return {
...state,
payments: action.payload
};
case RTLActions.SET_FORWARDING_HISTORY:
case LNDActions.SET_FORWARDING_HISTORY:
if (action.payload.forwarding_events) {
const storedChannels = [...state.allChannels];
action.payload.forwarding_events.forEach(event => {

@ -9,8 +9,10 @@ import { MatTableDataSource, MatSort } from '@angular/material';
import { ForwardingEvent } from '../../shared/models/lndModels';
import { LoggerService } from '../../shared/services/logger.service';
import * as RTLActions from '../../shared/store/rtl.actions';
import * as fromRTLReducer from '../../shared/store/rtl.reducers';
import * as LNDActions from '../store/lnd.actions';
import * as fromLNDReducer from '../store/lnd.reducers';
import * as RTLActions from '../../store/rtl.actions';
import * as fromRTLReducer from '../../store/rtl.reducers';
@Component({
selector: 'rtl-forwarding-history',
@ -28,9 +30,9 @@ export class ForwardingHistoryComponent implements OnInit, OnDestroy {
public endDate = this.today;
public startDate = this.yesterday;
public flgSticky = false;
private unsub: Array<Subject<void>> = [new Subject(), new Subject(), new Subject()];
private unsubs: Array<Subject<void>> = [new Subject(), new Subject(), new Subject(), new Subject()];
constructor(private logger: LoggerService, private store: Store<fromRTLReducer.State>, private actions$: Actions) {
constructor(private logger: LoggerService, private store: Store<fromRTLReducer.State>, private lndStore: Store<fromLNDReducer.LNDState>, private actions$: Actions) {
switch (true) {
case (window.innerWidth <= 415):
this.displayedColumns = ['timestamp', 'amt_out', 'amt_in'];
@ -54,29 +56,33 @@ export class ForwardingHistoryComponent implements OnInit, OnDestroy {
ngOnInit() {
this.onForwardingHistoryFetch();
this.actions$.pipe(takeUntil(this.unsub[2]), filter((action) => action.type === RTLActions.RESET_STORE)).subscribe((resetStore: RTLActions.ResetStore) => {
this.actions$.pipe(takeUntil(this.unsubs[2]), filter((action) => action.type === RTLActions.RESET_STORE)).subscribe((resetStore: RTLActions.ResetStore) => {
this.onForwardingHistoryFetch();
});
this.store.select('rtlRoot')
.pipe(takeUntil(this.unsub[0]))
.subscribe((rtlStore: fromRTLReducer.State) => {
rtlStore.effectErrors.forEach(effectsErr => {
if (effectsErr.action === 'GetForwardingHistory') {
this.flgLoading[0] = 'error';
}
});
if (undefined !== rtlStore.forwardingHistory && undefined !== rtlStore.forwardingHistory.forwarding_events) {
this.lastOffsetIndex = rtlStore.forwardingHistory.last_offset_index;
this.loadForwardingEventsTable(rtlStore.forwardingHistory.forwarding_events);
this.lndStore.select('lnd')
.pipe(takeUntil(this.unsubs[3]))
.subscribe(lndStore => {
if (undefined !== lndStore.forwardingHistory && undefined !== lndStore.forwardingHistory.forwarding_events) {
this.lastOffsetIndex = lndStore.forwardingHistory.last_offset_index;
this.loadForwardingEventsTable(lndStore.forwardingHistory.forwarding_events);
} else {
// To reset table after other Forwarding history calls
this.lastOffsetIndex = 0;
this.loadForwardingEventsTable([]);
}
if (this.flgLoading[0] !== 'error') {
this.flgLoading[0] = (undefined !== rtlStore.forwardingHistory) ? false : true;
this.flgLoading[0] = (undefined !== lndStore.forwardingHistory) ? false : true;
}
this.logger.info(lndStore);
});
this.store.select('rtlRoot')
.pipe(takeUntil(this.unsubs[0]))
.subscribe((rtlStore: fromRTLReducer.State) => {
rtlStore.effectErrors.forEach(effectsErr => {
if (effectsErr.action === 'GetForwardingHistory') {
this.flgLoading[0] = 'error';
}
});
this.logger.info(rtlStore);
});
@ -111,7 +117,7 @@ export class ForwardingHistoryComponent implements OnInit, OnDestroy {
if (undefined === this.startDate || this.startDate == null) {
this.startDate = new Date(this.endDate.getFullYear(), this.endDate.getMonth(), this.endDate.getDate() - 1);
}
this.store.dispatch(new RTLActions.GetForwardingHistory({
this.store.dispatch(new LNDActions.GetForwardingHistory({
end_time: Math.round(this.endDate.getTime() / 1000).toString(),
start_time: Math.round(this.startDate.getTime() / 1000).toString()
}));
@ -127,7 +133,7 @@ export class ForwardingHistoryComponent implements OnInit, OnDestroy {
ngOnDestroy() {
this.resetData();
this.unsub.forEach(completeSub => {
this.unsubs.forEach(completeSub => {
completeSub.next();
completeSub.complete();
});

@ -9,9 +9,10 @@ import { MatTableDataSource, MatSort } from '@angular/material';
import { Transaction } from '../../../shared/models/lndModels';
import { LoggerService } from '../../../shared/services/logger.service';
import { RTLEffects } from '../../../shared/store/rtl.effects';
import * as RTLActions from '../../../shared/store/rtl.actions';
import * as fromRTLReducer from '../../../shared/store/rtl.reducers';
import * as LNDActions from '../../store/lnd.actions';
import * as fromLNDReducer from '../../store/lnd.reducers';
import * as RTLActions from '../../../store/rtl.actions';
import * as fromRTLReducer from '../../../store/rtl.reducers';
@Component({
selector: 'rtl-list-transactions',
@ -24,9 +25,9 @@ export class ListTransactionsComponent implements OnInit, OnDestroy {
public listTransactions: any;
public flgLoading: Array<Boolean | 'error'> = [true];
public flgSticky = false;
private unsub: Array<Subject<void>> = [new Subject(), new Subject(), new Subject()];
private unsubs: Array<Subject<void>> = [new Subject(), new Subject(), new Subject(), new Subject()];
constructor(private logger: LoggerService, private store: Store<fromRTLReducer.State>, private rtlEffects: RTLEffects, private actions$: Actions) {
constructor(private logger: LoggerService, private store: Store<fromRTLReducer.State>, private lndStore: Store<fromLNDReducer.LNDState>, private actions$: Actions) {
switch (true) {
case (window.innerWidth <= 415):
this.displayedColumns = ['dest_addresses', 'total_fees', 'amount'];
@ -49,25 +50,29 @@ export class ListTransactionsComponent implements OnInit, OnDestroy {
}
ngOnInit() {
this.store.dispatch(new RTLActions.FetchTransactions());
this.actions$.pipe(takeUntil(this.unsub[2]), filter((action) => action.type === RTLActions.RESET_STORE)).subscribe((resetStore: RTLActions.ResetStore) => {
this.store.dispatch(new RTLActions.FetchTransactions());
this.store.dispatch(new LNDActions.FetchTransactions());
this.actions$.pipe(takeUntil(this.unsubs[2]), filter((action) => action.type === RTLActions.RESET_STORE)).subscribe((resetStore: RTLActions.ResetStore) => {
this.store.dispatch(new LNDActions.FetchTransactions());
});
this.lndStore.select('lnd')
.pipe(takeUntil(this.unsubs[3]))
.subscribe(lndStore => {
if (undefined !== lndStore.transactions) {
this.loadTransactionsTable(lndStore.transactions);
}
if (this.flgLoading[0] !== 'error') {
this.flgLoading[0] = (undefined !== lndStore.transactions) ? false : true;
}
this.logger.info(lndStore);
});
this.store.select('rtlRoot')
.pipe(takeUntil(this.unsub[0]))
.pipe(takeUntil(this.unsubs[0]))
.subscribe((rtlStore: fromRTLReducer.State) => {
rtlStore.effectErrors.forEach(effectsErr => {
if (effectsErr.action === 'FetchTransactions') {
this.flgLoading[0] = 'error';
}
});
if (undefined !== rtlStore.transactions) {
this.loadTransactionsTable(rtlStore.transactions);
}
if (this.flgLoading[0] !== 'error') {
this.flgLoading[0] = (undefined !== rtlStore.transactions) ? false : true;
}
this.logger.info(rtlStore);
});
@ -109,7 +114,7 @@ export class ListTransactionsComponent implements OnInit, OnDestroy {
}
ngOnDestroy() {
this.unsub.forEach(completeSub => {
this.unsubs.forEach(completeSub => {
completeSub.next();
completeSub.complete();
});

@ -9,9 +9,12 @@ import { RTLConfiguration } from '../../../shared/models/RTLconfig';
import { LoggerService } from '../../../shared/services/logger.service';
import * as sha256 from 'sha256';
import { RTLEffects } from '../../../shared/store/rtl.effects';
import * as RTLActions from '../../../shared/store/rtl.actions';
import * as fromRTLReducer from '../../../shared/store/rtl.reducers';
import { LNDEffects } from '../../store/lnd.effects';
import * as LNDActions from '../../store/lnd.actions';
import * as fromLNDReducer from '../../store/lnd.reducers';
import { RTLEffects } from '../../../store/rtl.effects';
import * as RTLActions from '../../../store/rtl.actions';
import * as fromRTLReducer from '../../../store/rtl.reducers';
@Component({
selector: 'rtl-send-receive-trans',
@ -31,25 +34,19 @@ export class SendReceiveTransComponent implements OnInit, OnDestroy {
public transTypes = [{id: '1', name: 'Target Confirmation Blocks'}, {id: '2', name: 'Fee'}];
public selTransType = '1';
public flgCustomAmount = '1';
private unsub: 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(), new Subject()];
constructor(private logger: LoggerService, private store: Store<fromRTLReducer.State>, private rtlEffects: RTLEffects) {}
constructor(private logger: LoggerService, private store: Store<fromRTLReducer.State>, private rtlEffects: RTLEffects,
private lndStore: Store<fromLNDReducer.LNDState>, private lndEffects: LNDEffects) {}
ngOnInit() {
this.store.select('rtlRoot')
.pipe(takeUntil(this.unsub[0]))
.subscribe((rtlStore: fromRTLReducer.State) => {
rtlStore.effectErrors.forEach(effectsErr => {
if (effectsErr.action === 'FetchBalance/blockchain') {
this.flgLoadingWallet = 'error';
}
});
this.selNode = rtlStore.selNode;
this.appConfig = rtlStore.appConfig;
this.information = rtlStore.information;
this.addressTypes = rtlStore.addressTypes;
this.lndStore.select('lnd')
.pipe(takeUntil(this.unsubs[5]))
.subscribe(lndStore => {
this.information = lndStore.information;
this.addressTypes = lndStore.addressTypes;
this.blockchainBalance = rtlStore.blockchainBalance;
this.blockchainBalance = lndStore.blockchainBalance;
if (undefined === this.blockchainBalance.total_balance) {
this.blockchainBalance.total_balance = '0';
}
@ -62,7 +59,19 @@ export class SendReceiveTransComponent implements OnInit, OnDestroy {
if (this.flgLoadingWallet !== 'error') {
this.flgLoadingWallet = false;
}
this.logger.info(lndStore);
});
this.store.select('rtlRoot')
.pipe(takeUntil(this.unsubs[0]))
.subscribe((rtlStore: fromRTLReducer.State) => {
rtlStore.effectErrors.forEach(effectsErr => {
if (effectsErr.action === 'FetchBalance/blockchain') {
this.flgLoadingWallet = 'error';
}
});
this.selNode = rtlStore.selNode;
this.appConfig = rtlStore.appConfig;
this.logger.info(rtlStore);
});
@ -70,9 +79,9 @@ export class SendReceiveTransComponent implements OnInit, OnDestroy {
onGenerateAddress() {
this.store.dispatch(new RTLActions.OpenSpinner('Getting New Address...'));
this.store.dispatch(new RTLActions.GetNewAddress(this.selectedAddress));
this.rtlEffects.setNewAddress
.pipe(takeUntil(this.unsub[1]))
this.store.dispatch(new LNDActions.GetNewAddress(this.selectedAddress));
this.lndEffects.setNewAddress
.pipe(takeUntil(this.unsubs[1]))
.subscribe(newAddress => {
this.newAddress = newAddress;
});
@ -101,7 +110,7 @@ export class SendReceiveTransComponent implements OnInit, OnDestroy {
}));
this.rtlEffects.closeConfirm
.pipe(takeUntil(this.unsub[2]))
.pipe(takeUntil(this.unsubs[2]))
.subscribe(confirmRes => {
if (confirmRes) {
if (this.transaction.sendAll && !+this.appConfig.sso.rtlSSO) {
@ -111,7 +120,7 @@ export class SendReceiveTransComponent implements OnInit, OnDestroy {
]}
}));
this.rtlEffects.closeConfirm
.pipe(takeUntil(this.unsub[3]))
.pipe(takeUntil(this.unsubs[3]))
.subscribe(pwdConfirmRes => {
if (pwdConfirmRes) {
const pwd = pwdConfirmRes[0].inputValue;
@ -134,7 +143,7 @@ export class SendReceiveTransComponent implements OnInit, OnDestroy {
dispatchToSendFunds() {
this.store.dispatch(new RTLActions.OpenSpinner('Sending Funds...'));
this.store.dispatch(new RTLActions.SetChannelTransaction(this.transaction));
this.store.dispatch(new LNDActions.SetChannelTransaction(this.transaction));
this.transaction = {address: '', amount: 0, blocks: 0, fees: 0};
}
@ -168,7 +177,7 @@ export class SendReceiveTransComponent implements OnInit, OnDestroy {
}
ngOnDestroy() {
this.unsub.forEach(completeSub => {
this.unsubs.forEach(completeSub => {
completeSub.next();
completeSub.complete();
});

@ -7,9 +7,11 @@ import { FormBuilder, FormGroup, Validators, ValidatorFn, AbstractControl, Valid
import { STEPPER_GLOBAL_OPTIONS } from '@angular/cdk/stepper';
import { MatStepper } from '@angular/material';
import { RTLEffects } from '../../shared/store/rtl.effects';
import * as RTLActions from '../../shared/store/rtl.actions';
import * as fromRTLReducer from '../../shared/store/rtl.reducers';
import { LNDEffects } from '../store/lnd.effects';
import * as LNDActions from '../store/lnd.actions';
import { RTLEffects } from '../../store/rtl.effects';
import * as RTLActions from '../../store/rtl.actions';
import * as fromRTLReducer from '../../store/rtl.reducers';
export const matchedPasswords: ValidatorFn = (control: FormGroup): ValidationErrors | null => {
const initWalletPassword = control.get('initWalletPassword');
@ -46,7 +48,8 @@ export class UnlockLNDComponent implements OnInit, OnDestroy {
warnRes = true;
private unsubs = [new Subject(), new Subject(), new Subject(), new Subject(), new Subject()];
constructor(private store: Store<fromRTLReducer.State>, private formBuilder: FormBuilder, private rtlEffects: RTLEffects, private router: Router) {}
constructor(private store: Store<fromRTLReducer.State>, private formBuilder: FormBuilder, private rtlEffects: RTLEffects,
private lndEffects: LNDEffects, private router: Router) {}
ngOnInit() {
this.walletPassword = '';
@ -85,13 +88,13 @@ export class UnlockLNDComponent implements OnInit, OnDestroy {
this.insecureLND = !window.location.protocol.includes('https://');
this.rtlEffects.initWalletRes
this.lndEffects.initWalletRes
.pipe(takeUntil(this.unsubs[2]))
.subscribe(initWalletResponse => {
this.initWalletResponse = initWalletResponse;
});
this.rtlEffects.genSeedResponse
this.lndEffects.genSeedResponse
.pipe(takeUntil(this.unsubs[3]))
.subscribe(genSeedRes => {
this.genSeedResponse = genSeedRes;
@ -102,7 +105,7 @@ export class UnlockLNDComponent implements OnInit, OnDestroy {
// passphrase: window.btoa(this.passphraseFormGroup.controls.passphrase.value)
// }));
// } else {
this.store.dispatch(new RTLActions.InitWallet({
this.store.dispatch(new LNDActions.InitWallet({
pwd: window.btoa(this.passwordFormGroup.controls.initWalletPassword.value),
cipher: this.genSeedResponse
}));
@ -113,7 +116,7 @@ export class UnlockLNDComponent implements OnInit, OnDestroy {
onOperateWallet() {
this.store.dispatch(new RTLActions.OpenSpinner('Unlocking...'));
this.store.dispatch(new RTLActions.UnlockWallet({pwd: window.btoa(this.walletPassword)}));
this.store.dispatch(new LNDActions.UnlockWallet({pwd: window.btoa(this.walletPassword)}));
}
onInitWallet() {
@ -121,22 +124,22 @@ export class UnlockLNDComponent implements OnInit, OnDestroy {
if (this.cipherFormGroup.controls.existingCipher.value) {
const cipherArr = this.cipherFormGroup.controls.cipherSeed.value.toString().trim().split(',');
if (this.passphraseFormGroup.controls.enterPassphrase.value) {
this.store.dispatch(new RTLActions.InitWallet({
this.store.dispatch(new LNDActions.InitWallet({
pwd: window.btoa(this.passwordFormGroup.controls.initWalletPassword.value),
cipher: cipherArr,
passphrase: window.btoa(this.passphraseFormGroup.controls.passphrase.value)
}));
} else {
this.store.dispatch(new RTLActions.InitWallet({
this.store.dispatch(new LNDActions.InitWallet({
pwd: window.btoa(this.passwordFormGroup.controls.initWalletPassword.value),
cipher: cipherArr
}));
}
} else {
if (this.passphraseFormGroup.controls.enterPassphrase.value) {
this.store.dispatch(new RTLActions.GenSeed(window.btoa(this.passphraseFormGroup.controls.passphrase.value)));
this.store.dispatch(new LNDActions.GenSeed(window.btoa(this.passphraseFormGroup.controls.passphrase.value)));
} else {
this.store.dispatch(new RTLActions.GenSeed(''));
this.store.dispatch(new LNDActions.GenSeed(''));
}
}
}

@ -5,8 +5,8 @@ import { Store } from '@ngrx/store';
import { LoggerService } from '../../../shared/services/logger.service';
import { AlertData, InputData } from '../../../shared/models/alertData';
import * as RTLActions from '../../../shared/store/rtl.actions';
import * as fromRTLReducer from '../../../shared/store/rtl.reducers';
import * as RTLActions from '../../../store/rtl.actions';
import * as fromRTLReducer from '../../../store/rtl.reducers';
@Component({
selector: 'rtl-confirmation-message',

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

Loading…
Cancel
Save