Incomplete lazy load 7

Incomplete lazy load 7
pull/209/head
Shahana Farooqui 5 years ago
parent 0dd25df982
commit 700015756b

@ -34,8 +34,10 @@ common.setOptions = () => {
json: true,
form: ''
};
if(node.ln_implementation !== 'CLightning') {
if(node.ln_implementation.toLowerCase() !== 'clightning') {
node.options.headers = {'Grpc-Metadata-macaroon': fs.readFileSync(node.macaroon_path + '/admin.macaroon').toString('hex')};
} else {
node.options.headers = {'macaroon': fs.readFileSync(node.macaroon_path + '/access.macaroon').toString('hex')};
}
});
// Options cannot be set before selected node initializes. Updating selected node's options separatly
@ -45,7 +47,7 @@ common.setOptions = () => {
json: true,
form: ''
};
if(common.selectedNode.ln_implementation !== 'CLightning') {
if(common.selectedNode.ln_implementation.toLowerCase() !== 'clightning') {
common.selectedNode.options.headers = {'Grpc-Metadata-macaroon': fs.readFileSync(common.selectedNode.macaroon_path + '/admin.macaroon').toString('hex')};
}
} catch(err) {

@ -8,11 +8,11 @@ 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 { RTLConfiguration, Settings, LightningNode } 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 RTLActions from './store/rtl.actions';
import * as fromRTLReducer from './store/rtl.reducers';
@Component({
selector: 'rtl-app',
@ -22,7 +22,7 @@ import * as fromRTLReducer from './shared/store/rtl.reducers';
export class AppComponent implements OnInit, AfterViewInit, OnDestroy {
@ViewChild('sideNavigation', { static: false }) sideNavigation: any;
@ViewChild('settingSidenav', { static: true }) settingSidenav: any;
public selNode: Node;
public selNode: LightningNode;
public settings: Settings;
public information: GetInfo = {};
public flgLoading: Array<Boolean | 'error'> = [true]; // 0: Info
@ -32,13 +32,13 @@ export class AppComponent implements OnInit, AfterViewInit, OnDestroy {
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,
constructor(private logger: LoggerService, private store: Store<fromRTLReducer.RTLState>, private actions$: Actions,
private userIdle: UserIdleService, private router: Router, private activatedRoute: ActivatedRoute) {}
ngOnInit() {
this.store.dispatch(new RTLActions.FetchRTLConfig());
this.accessKey = this.readAccessKey();
this.store.select('rtlRoot')
this.store.select('rtl')
.pipe(takeUntil(this.unsubs[0]))
.subscribe(rtlStore => {
this.selNode = rtlStore.selNode;

@ -23,13 +23,14 @@ import { ThemeOverlay } from './shared/theme/overlay-container/theme-overlay';
import { AppComponent } from './app.component';
import { environment } from '../environments/environment';
import { RTLRootReducer } from './shared/store/rtl.reducers';
import { RTLEffects } from './shared/store/rtl.effects';
import { CommonService } from './shared/services/common.service';
import { LoggerService, ConsoleLoggerService } from './shared/services/logger.service';
import { AuthGuard } from './shared/services/auth.guard';
import { AuthInterceptor } from './shared/services/auth.interceptor';
import { RTLReducer } from './store/rtl.reducers';
import { RTLEffects } from './store/rtl.effects';
@NgModule({
imports: [
BrowserModule,
@ -38,7 +39,7 @@ import { AuthInterceptor } from './shared/services/auth.interceptor';
PerfectScrollbarModule,
routing,
UserIdleModule.forRoot({idle: 60 * 60, timeout: 1, ping: null}),
StoreModule.forRoot({rtlRoot: RTLRootReducer}),
StoreModule.forRoot({rtl: RTLReducer}),
EffectsModule.forRoot([RTLEffects]),
!environment.production ? StoreDevtoolsModule.instrument() : []
],

@ -5,8 +5,8 @@ import { takeUntil, filter } from 'rxjs/operators';
import { Store } from '@ngrx/store';
import { Actions } from '@ngrx/effects';
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-cl-root',
@ -17,25 +17,26 @@ export class CLRootComponent implements OnInit, OnDestroy {
unsubs: Array<Subject<void>> = [new Subject(), new Subject()];
constructor(private store: Store<fromRTLReducer.State>, private actions$: Actions, private router: Router, private activatedRoute: ActivatedRoute) {}
constructor(private store: Store<fromRTLReducer.RTLState>, private actions$: Actions, private router: Router, private activatedRoute: ActivatedRoute) {}
ngOnInit() {
console.warn('CL ROOT')
this.store.dispatch(new RTLActions.FetchInfo());
this.router.navigate(['./home'], {relativeTo: this.activatedRoute});
this.actions$.pipe(takeUntil(this.unsubs[0]), filter((action) => action.type === RTLActions.SET_INFO || action.type === RTLActions.INIT_APP_DATA))
.subscribe((infoData: RTLActions.SetInfo | RTLActions.InitAppData) => {
if(infoData.type === RTLActions.SET_INFO && undefined !== infoData.payload.identity_pubkey) {
this.initializeRemainingData();
}
if(infoData.type === RTLActions.INIT_APP_DATA) {
this.store.dispatch(new RTLActions.FetchInfo());
}
});
this.initializeRemainingData();
// this.store.dispatch(new RTLActions.FetchCLInfo());
// this.actions$.pipe(takeUntil(this.unsubs[0]), filter((action) => action.type === RTLActions.SET_CL_INFO || action.type === RTLActions.INIT_APP_DATA))
// .subscribe((infoData: RTLActions.SetCLInfo | RTLActions.InitAppData) => {
// if(infoData.type === RTLActions.SET_CL_INFO && undefined !== infoData.payload.identity_pubkey) {
// this.initializeRemainingData();
// }
// if(infoData.type === RTLActions.INIT_APP_DATA) {
// this.store.dispatch(new RTLActions.FetchCLInfo());
// }
// });
}
initializeRemainingData() {
this.store.dispatch(new RTLActions.FetchFees());
this.store.dispatch(new RTLActions.FetchCLFees());
// this.store.dispatch(new RTLActions.FetchPeers());
// this.store.dispatch(new RTLActions.FetchBalance('channels'));
// this.store.dispatch(new RTLActions.FetchNetwork());

@ -5,9 +5,9 @@ import { Store } from '@ngrx/store';
import { LoggerService } from '../../shared/services/logger.service';
import { GetInfo, Fees } from '../../shared/models/lndModels';
import { Node } from '../../shared/models/RTLconfig';
import { LightningNode } from '../../shared/models/RTLconfig';
import * as fromRTLReducer from '../../shared/store/rtl.reducers';
import * as fromRTLReducer from '../../store/rtl.reducers';
@Component({
selector: 'rtl-cl-home',
@ -15,18 +15,18 @@ import * as fromRTLReducer from '../../shared/store/rtl.reducers';
styleUrls: ['./home.component.scss']
})
export class CLHomeComponent implements OnInit, OnDestroy {
public selNode: Node;
public selNode: LightningNode;
public fees: Fees;
public information: GetInfo = {};
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()];
constructor(private logger: LoggerService, private store: Store<fromRTLReducer.State>) {}
constructor(private logger: LoggerService, private store: Store<fromRTLReducer.RTLState>) {}
ngOnInit() {
this.store.select('rtlRoot')
this.store.select('rtl')
.pipe(takeUntil(this.unsub[0]))
.subscribe((rtlStore: fromRTLReducer.State) => {
.subscribe((rtlStore) => {
rtlStore.effectErrors.forEach(effectsErr => {
if (effectsErr.action === 'FetchInfo') {
this.flgLoading[0] = 'error';

@ -7,13 +7,13 @@ import { Store } from '@ngrx/store';
import { Actions } from '@ngrx/effects';
import { MatTableDataSource, MatSort } from '@angular/material';
import { Node } from '../../../shared/models/RTLconfig';
import { LightningNode } 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 { RTLEffects } from '../../../store/rtl.effects';
import * as RTLActions from '../../../store/rtl.actions';
import * as fromRTLReducer from '../../../store/rtl.reducers';
@Component({
selector: 'rtl-channel-backup',
@ -22,7 +22,7 @@ import * as fromRTLReducer from '../../../shared/store/rtl.reducers';
})
export class ChannelBackupComponent implements OnInit, OnDestroy {
@ViewChild(MatSort, { static: true }) sort: MatSort;
public selNode: Node;
public selNode: LightningNode;
public displayedColumns = ['chan_id', 'backup', 'verify'];
public selChannel: Channel;
public channels: any;
@ -30,12 +30,12 @@ export class ChannelBackupComponent implements OnInit, OnDestroy {
public flgSticky = false;
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, private router: Router) {}
constructor(private logger: LoggerService, private store: Store<fromRTLReducer.RTLState>, private rtlEffects: RTLEffects, private actions$: Actions, private router: Router) {}
ngOnInit() {
this.store.select('rtlRoot')
this.store.select('rtl')
.pipe(takeUntil(this.unSubs[0]))
.subscribe((rtlStore: fromRTLReducer.State) => {
.subscribe((rtlStore) => {
this.selNode = rtlStore.selNode;
rtlStore.effectErrors.forEach(effectsErr => {
if (effectsErr.action === 'Fetchchannels') {

@ -8,9 +8,9 @@ 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 { RTLEffects } from '../../../store/rtl.effects';
import * as RTLActions from '../../../store/rtl.actions';
import * as fromRTLReducer from '../../../store/rtl.reducers';
@Component({
selector: 'rtl-channel-closed',
@ -26,7 +26,7 @@ export class ChannelClosedComponent implements OnInit, OnDestroy {
public flgSticky = false;
private unsub: Array<Subject<void>> = [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.RTLState>, private rtlEffects: RTLEffects, private actions$: Actions) {
switch (true) {
case (window.innerWidth <= 415):
this.displayedColumns = ['close_type', 'chan_id', 'settled_balance'];
@ -55,9 +55,9 @@ export class ChannelClosedComponent implements OnInit, OnDestroy {
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.select('rtlRoot')
this.store.select('rtl')
.pipe(takeUntil(this.unsub[0]))
.subscribe((rtlStore: fromRTLReducer.State) => {
.subscribe((rtlStore) => {
rtlStore.effectErrors.forEach(effectsErr => {
if (effectsErr.action === 'FetchChannels/closed') {
this.flgLoading[0] = 'error';

@ -10,9 +10,9 @@ 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 { RTLEffects } from '../../../store/rtl.effects';
import * as RTLActions from '../../../store/rtl.actions';
import * as fromRTLReducer from '../../../store/rtl.reducers';
@Component({
selector: 'rtl-channel-manage',
@ -42,7 +42,7 @@ export class ChannelManageComponent implements OnInit, OnDestroy {
public redirectedWithPeer = false;
private unsub: Array<Subject<void>> = [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.RTLState>, private rtlEffects: RTLEffects, private activatedRoute: ActivatedRoute) {
switch (true) {
case (window.innerWidth <= 415):
this.displayedColumns = ['close', 'update', 'active', 'chan_id', 'remote_alias'];
@ -67,9 +67,9 @@ export class ChannelManageComponent implements OnInit, OnDestroy {
}
ngOnInit() {
this.store.select('rtlRoot')
this.store.select('rtl')
.pipe(takeUntil(this.unsub[0]))
.subscribe((rtlStore: fromRTLReducer.State) => {
.subscribe((rtlStore) => {
rtlStore.effectErrors.forEach(effectsErr => {
if (effectsErr.action === 'FetchChannels/all') {
this.flgLoading[0] = 'error';

@ -5,12 +5,12 @@ import { Store } from '@ngrx/store';
import { MatTableDataSource, MatSort } from '@angular/material';
import { Channel, GetInfo, PendingChannels } from '../../../shared/models/lndModels';
import { Node } from '../../../shared/models/RTLconfig';
import { LightningNode } 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 { RTLEffects } from '../../../store/rtl.effects';
import * as RTLActions from '../../../store/rtl.actions';
import * as fromRTLReducer from '../../../store/rtl.reducers';
@Component({
selector: 'rtl-channel-pending',
@ -19,7 +19,7 @@ import * as fromRTLReducer from '../../../shared/store/rtl.reducers';
})
export class ChannelPendingComponent implements OnInit, OnDestroy {
@ViewChild(MatSort, { static: true }) sort: MatSort;
public selNode: Node;
public selNode: LightningNode;
public selectedFilter = 0;
public information: GetInfo = {};
public pendingChannels: PendingChannels = {};
@ -50,7 +50,7 @@ export class ChannelPendingComponent implements OnInit, OnDestroy {
public flgLoading: Array<Boolean | 'error'> = [true];
private unsub: Array<Subject<void>> = [new Subject(), new Subject()];
constructor(private logger: LoggerService, private store: Store<fromRTLReducer.State>, private rtlEffects: RTLEffects) {
constructor(private logger: LoggerService, private store: Store<fromRTLReducer.RTLState>, private rtlEffects: RTLEffects) {
switch (true) {
case (window.innerWidth <= 415):
this.displayedClosingColumns = ['remote_node_pub', 'local_balance', 'remote_balance'];
@ -96,9 +96,9 @@ export class ChannelPendingComponent implements OnInit, OnDestroy {
}
ngOnInit() {
this.store.select('rtlRoot')
this.store.select('rtl')
.pipe(takeUntil(this.unsub[0]))
.subscribe((rtlStore: fromRTLReducer.State) => {
.subscribe((rtlStore) => {
rtlStore.effectErrors.forEach(effectsErr => {
if (effectsErr.action === 'FetchChannels/pending') {
this.flgLoading[0] = 'error';

@ -5,9 +5,9 @@ import { Store } from '@ngrx/store';
import { LoggerService } from '../../shared/services/logger.service';
import { GetInfo, NetworkInfo, Fees, Peer } from '../../shared/models/lndModels';
import { Node } from '../../shared/models/RTLconfig';
import { LightningNode } from '../../shared/models/RTLconfig';
import * as fromRTLReducer from '../../shared/store/rtl.reducers';
import * as fromRTLReducer from '../../store/rtl.reducers';
@Component({
selector: 'rtl-home',
@ -15,7 +15,7 @@ import * as fromRTLReducer from '../../shared/store/rtl.reducers';
styleUrls: ['./home.component.scss']
})
export class HomeComponent implements OnInit, OnDestroy {
public selNode: Node;
public selNode: LightningNode;
public fees: Fees;
public information: GetInfo = {};
public remainder = 0;
@ -41,7 +41,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.RTLState>) {
switch (true) {
case (window.innerWidth <= 730):
this.view = [250, 352];
@ -64,9 +64,9 @@ export class HomeComponent implements OnInit, OnDestroy {
ngOnInit() {
this.flgTotalCalculated = false;
this.store.select('rtlRoot')
this.store.select('rtl')
.pipe(takeUntil(this.unsub[0]))
.subscribe((rtlStore: fromRTLReducer.State) => {
.subscribe((rtlStore) => {
rtlStore.effectErrors.forEach(effectsErr => {
if (effectsErr.action === 'FetchInfo') {
this.flgLoading[0] = 'error';

@ -6,13 +6,13 @@ import { Store } from '@ngrx/store';
import { Actions } from '@ngrx/effects';
import { MatTableDataSource, MatSort } from '@angular/material';
import { Node } from '../../shared/models/RTLconfig';
import { LightningNode } from '../../shared/models/RTLconfig';
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 RTLActions from '../../store/rtl.actions';
import * as fromRTLReducer from '../../store/rtl.reducers';
@Component({
selector: 'rtl-invoices',
@ -22,7 +22,7 @@ import * as fromRTLReducer from '../../shared/store/rtl.reducers';
})
export class InvoicesComponent implements OnInit, OnDestroy {
@ViewChild(MatSort, { static: true }) sort: MatSort;
public selNode: Node;
public selNode: LightningNode;
public newlyAddedInvoiceMemo = '';
public newlyAddedInvoiceValue = 0;
public flgAnimate = true;
@ -43,7 +43,7 @@ export class InvoicesComponent implements OnInit, OnDestroy {
private lastOffset = -1;
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 actions$: Actions) {
constructor(private logger: LoggerService, private store: Store<fromRTLReducer.RTLState>, private actions$: Actions) {
switch (true) {
case (window.innerWidth <= 415):
this.displayedColumns = ['settled', 'creation_date', 'memo', 'value'];
@ -66,9 +66,9 @@ export class InvoicesComponent implements OnInit, OnDestroy {
}
ngOnInit() {
this.store.select('rtlRoot')
this.store.select('rtl')
.pipe(takeUntil(this.unSubs[0]))
.subscribe((rtlStore: fromRTLReducer.State) => {
.subscribe((rtlStore) => {
rtlStore.effectErrors.forEach(effectsErr => {
if (effectsErr.action === 'FetchInvoices') {
this.flgLoading[0] = 'error';

@ -5,8 +5,8 @@ import { takeUntil, filter } from 'rxjs/operators';
import { Store } from '@ngrx/store';
import { Actions } from '@ngrx/effects';
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-lnd-root',
@ -16,7 +16,7 @@ import * as fromRTLReducer from '../shared/store/rtl.reducers';
export class LNDRootComponent implements OnInit, OnDestroy {
unsubs: Array<Subject<void>> = [new Subject(), new Subject()];
constructor(private store: Store<fromRTLReducer.State>, private actions$: Actions, private router: Router, private activatedRoute: ActivatedRoute) {}
constructor(private store: Store<fromRTLReducer.RTLState>, private actions$: Actions, private router: Router, private activatedRoute: ActivatedRoute) {}
ngOnInit() {
console.warn('LND ROOT')

@ -5,7 +5,7 @@ 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 fromRTLReducer from '../../../store/rtl.reducers';
@Component({
selector: 'rtl-channel-lookup',
@ -18,16 +18,16 @@ export class ChannelLookupComponent implements OnInit {
public node2_match = false;
private unSubs: Array<Subject<void>> = [new Subject(), new Subject(), new Subject(), new Subject()];
constructor(private store: Store<fromRTLReducer.State>) { }
constructor(private store: Store<fromRTLReducer.RTLState>) { }
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')
this.store.select('rtl')
.pipe(takeUntil(this.unSubs[0]))
.subscribe((rtlStore: fromRTLReducer.State) => {
.subscribe((rtlStore) => {
if (this.lookupResult.node1_pub === rtlStore.information.identity_pubkey) {
this.node1_match = true;
}

@ -6,8 +6,8 @@ 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 * as RTLActions from '../../store/rtl.actions';
import * as fromRTLReducer from '../../store/rtl.reducers';
@Component({
selector: 'rtl-lookups',
@ -28,7 +28,7 @@ export class LookupsComponent implements OnInit, OnDestroy {
public flgLoading: Array<Boolean | 'error'> = [true];
private unSubs: Array<Subject<void>> = [new Subject()];
constructor(private logger: LoggerService, private store: Store<fromRTLReducer.State>, private actions$: Actions) {}
constructor(private logger: LoggerService, private store: Store<fromRTLReducer.RTLState>, private actions$: Actions) {}
ngOnInit() {
this.actions$

@ -9,9 +9,9 @@ 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 { 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 +28,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.RTLState>, private rtlEffects: RTLEffects, private actions$: Actions) {
switch (true) {
case (window.innerWidth <= 415):
this.displayedColumns = ['hop_sequence', 'pubkey_alias', 'fee_msat'];
@ -51,11 +51,6 @@ export class QueryRoutesComponent implements OnInit, OnDestroy {
}
ngOnInit() {
this.store.select('rtlRoot')
.pipe(takeUntil(this.unSubs[0]))
.subscribe((rtlStore: fromRTLReducer.State) => {
this.logger.info(rtlStore);
});
this.rtlEffects.setQueryRoutes
.pipe(takeUntil(this.unSubs[1]))
.subscribe(queryRoute => {

@ -5,14 +5,14 @@ import { takeUntil, take } from 'rxjs/operators';
import { Store } from '@ngrx/store';
import { MatTableDataSource, MatSort } from '@angular/material';
import { Node } from '../../../shared/models/RTLconfig';
import { LightningNode } from '../../../shared/models/RTLconfig';
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 { RTLEffects } from '../../../store/rtl.effects';
import * as RTLActions from '../../../store/rtl.actions';
import * as fromRTLReducer from '../../../store/rtl.reducers';
@Component({
selector: 'rtl-payments',
@ -23,7 +23,7 @@ import * as fromRTLReducer from '../../../shared/store/rtl.reducers';
export class PaymentsComponent implements OnInit, OnDestroy {
@ViewChild(MatSort, { static: true }) sort: MatSort;
@ViewChild('sendPaymentForm', { static: true }) form;
public selNode: Node;
public selNode: LightningNode;
public newlyAddedPayment = '';
public flgAnimate = true;
public flgLoading: Array<Boolean | 'error'> = [true];
@ -36,7 +36,7 @@ export class PaymentsComponent implements OnInit, OnDestroy {
public flgSticky = false;
private unsub: Array<Subject<void>> = [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.RTLState>, private rtlEffects: RTLEffects) {
switch (true) {
case (window.innerWidth <= 415):
this.displayedColumns = ['creation_date', 'fee', 'value'];
@ -59,9 +59,9 @@ export class PaymentsComponent implements OnInit, OnDestroy {
}
ngOnInit() {
this.store.select('rtlRoot')
this.store.select('rtl')
.pipe(takeUntil(this.unsub[0]))
.subscribe((rtlStore: fromRTLReducer.State) => {
.subscribe((rtlStore) => {
rtlStore.effectErrors.forEach(effectsErr => {
if (effectsErr.action === 'FetchPayments') {
this.flgLoading[0] = 'error';

@ -11,9 +11,9 @@ 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 { RTLEffects } from '../../store/rtl.effects';
import * as RTLActions from '../../store/rtl.actions';
import * as fromRTLReducer from '../../store/rtl.reducers';
@Component({
selector: 'rtl-peers',
@ -33,7 +33,7 @@ export class PeersComponent implements OnInit, OnDestroy {
public flgSticky = false;
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, private router: Router) {
constructor(private logger: LoggerService, private store: Store<fromRTLReducer.RTLState>, private rtlEffects: RTLEffects, private actions$: Actions, private router: Router) {
switch (true) {
case (window.innerWidth <= 415):
this.displayedColumns = ['detach', 'pub_key', 'alias'];
@ -56,9 +56,9 @@ export class PeersComponent implements OnInit, OnDestroy {
}
ngOnInit() {
this.store.select('rtlRoot')
this.store.select('rtl')
.pipe(takeUntil(this.unSubs[0]))
.subscribe((rtlStore: fromRTLReducer.State) => {
.subscribe((rtlStore) => {
rtlStore.effectErrors.forEach(effectsErr => {
if (effectsErr.action === 'FetchPeers') {
this.flgLoading[0] = 'error';

@ -9,8 +9,8 @@ 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 RTLActions from '../../store/rtl.actions';
import * as fromRTLReducer from '../../store/rtl.reducers';
@Component({
selector: 'rtl-routing-peers',
@ -35,7 +35,7 @@ export class RoutingPeersComponent implements OnInit, OnDestroy {
public flgSticky = false;
private unsub: Array<Subject<void>> = [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.RTLState>, private actions$: Actions) {
switch (true) {
case (window.innerWidth <= 415):
this.displayedColumns = ['chan_id', 'events', 'total_amount'];
@ -62,9 +62,9 @@ export class RoutingPeersComponent implements OnInit, OnDestroy {
this.actions$.pipe(takeUntil(this.unsub[2]), filter((action) => action.type === RTLActions.RESET_STORE)).subscribe((resetStore: RTLActions.ResetStore) => {
this.onRoutingPeersFetch();
});
this.store.select('rtlRoot')
this.store.select('rtl')
.pipe(takeUntil(this.unsub[0]))
.subscribe((rtlStore: fromRTLReducer.State) => {
.subscribe((rtlStore) => {
rtlStore.effectErrors.forEach(effectsErr => {
if (effectsErr.action === 'GetForwardingHistory') {
this.flgLoading[0] = 'error';

@ -9,8 +9,8 @@ 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 RTLActions from '../../store/rtl.actions';
import * as fromRTLReducer from '../../store/rtl.reducers';
@Component({
selector: 'rtl-forwarding-history',
@ -30,7 +30,7 @@ export class ForwardingHistoryComponent implements OnInit, OnDestroy {
public flgSticky = false;
private unsub: Array<Subject<void>> = [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.RTLState>, private actions$: Actions) {
switch (true) {
case (window.innerWidth <= 415):
this.displayedColumns = ['timestamp', 'amt_out', 'amt_in'];
@ -58,9 +58,9 @@ export class ForwardingHistoryComponent implements OnInit, OnDestroy {
this.onForwardingHistoryFetch();
});
this.store.select('rtlRoot')
this.store.select('rtl')
.pipe(takeUntil(this.unsub[0]))
.subscribe((rtlStore: fromRTLReducer.State) => {
.subscribe((rtlStore) => {
rtlStore.effectErrors.forEach(effectsErr => {
if (effectsErr.action === 'GetForwardingHistory') {
this.flgLoading[0] = 'error';

@ -9,9 +9,9 @@ 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 { RTLEffects } from '../../../store/rtl.effects';
import * as RTLActions from '../../../store/rtl.actions';
import * as fromRTLReducer from '../../../store/rtl.reducers';
@Component({
selector: 'rtl-list-transactions',
@ -26,7 +26,7 @@ export class ListTransactionsComponent implements OnInit, OnDestroy {
public flgSticky = false;
private unsub: Array<Subject<void>> = [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.RTLState>, private rtlEffects: RTLEffects, private actions$: Actions) {
switch (true) {
case (window.innerWidth <= 415):
this.displayedColumns = ['dest_addresses', 'total_fees', 'amount'];
@ -54,9 +54,9 @@ export class ListTransactionsComponent implements OnInit, OnDestroy {
this.store.dispatch(new RTLActions.FetchTransactions());
});
this.store.select('rtlRoot')
this.store.select('rtl')
.pipe(takeUntil(this.unsub[0]))
.subscribe((rtlStore: fromRTLReducer.State) => {
.subscribe((rtlStore) => {
rtlStore.effectErrors.forEach(effectsErr => {
if (effectsErr.action === 'FetchTransactions') {
this.flgLoading[0] = 'error';

@ -3,15 +3,15 @@ import { Subject } from 'rxjs';
import { takeUntil, take } from 'rxjs/operators';
import { Store } from '@ngrx/store';
import { Node } from '../../../shared/models/RTLconfig';
import { LightningNode } from '../../../shared/models/RTLconfig';
import { GetInfo, Balance, ChannelsTransaction, AddressType } from '../../../shared/models/lndModels';
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 { 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',
@ -19,7 +19,7 @@ import * as fromRTLReducer from '../../../shared/store/rtl.reducers';
styleUrls: ['./send-receive-trans.component.scss']
})
export class SendReceiveTransComponent implements OnInit, OnDestroy {
public selNode: Node;
public selNode: LightningNode;
public appConfig: RTLConfiguration;
public addressTypes = [];
public flgLoadingWallet: Boolean | 'error' = true;
@ -33,12 +33,12 @@ export class SendReceiveTransComponent implements OnInit, OnDestroy {
public flgCustomAmount = '1';
private unsub: 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.RTLState>, private rtlEffects: RTLEffects) {}
ngOnInit() {
this.store.select('rtlRoot')
this.store.select('rtl')
.pipe(takeUntil(this.unsub[0]))
.subscribe((rtlStore: fromRTLReducer.State) => {
.subscribe((rtlStore) => {
rtlStore.effectErrors.forEach(effectsErr => {
if (effectsErr.action === 'FetchBalance/blockchain') {
this.flgLoadingWallet = 'error';

@ -7,9 +7,9 @@ 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 { 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 +46,7 @@ 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.RTLState>, private formBuilder: FormBuilder, private rtlEffects: RTLEffects, private router: Router) {}
ngOnInit() {
this.walletPassword = '';

@ -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',
@ -24,7 +24,7 @@ export class ConfirmationMessageComponent implements OnInit {
public getInputs: Array<InputData> = [{placeholder: '', inputType: 'text', inputValue: ''}];
constructor(public dialogRef: MatDialogRef<ConfirmationMessageComponent>, @Inject(MAT_DIALOG_DATA) public data: AlertData, private logger: LoggerService,
private store: Store<fromRTLReducer.State>) { }
private store: Store<fromRTLReducer.RTLState>) { }
ngOnInit() {
this.flgShowInput = this.data.flgShowInput;

@ -7,9 +7,9 @@ import { Actions } from '@ngrx/effects';
import { LoggerService } from '../../../services/logger.service';
import { MENU_DATA } from '../../../models/navMenu';
import { RTLEffects } from '../../../store/rtl.effects';
import * as RTLActions from '../../../store/rtl.actions';
import * as fromRTLReducer from '../../../store/rtl.reducers';
import { RTLEffects } from '../../../../store/rtl.effects';
import * as RTLActions from '../../../../store/rtl.actions';
import * as fromRTLReducer from '../../../../store/rtl.reducers';
@Component({
selector: 'rtl-horizontal-navigation',
@ -23,13 +23,13 @@ export class HorizontalNavigationComponent implements OnInit {
public numPendingChannels = 0;
private unSubs = [new Subject(), new Subject(), new Subject()];
constructor(private logger: LoggerService, private store: Store<fromRTLReducer.State>, private actions$: Actions, private rtlEffects: RTLEffects) {
constructor(private logger: LoggerService, private store: Store<fromRTLReducer.RTLState>, private actions$: Actions, private rtlEffects: RTLEffects) {
}
ngOnInit() {
this.store.select('rtlRoot')
this.store.select('rtl')
.pipe(takeUntil(this.unSubs[0]))
.subscribe((rtlStore: fromRTLReducer.State) => {
.subscribe((rtlStore) => {
this.numPendingChannels = rtlStore.numberOfPendingChannels;
if(rtlStore.selNode.lnImplementation.toLowerCase() === 'clightning') {
this.menuNodes = MENU_DATA.CLChildren;

@ -9,14 +9,14 @@ import { environment } from '../../../../../environments/environment';
import { FlatTreeControl } from '@angular/cdk/tree';
import { MatTreeFlatDataSource, MatTreeFlattener } from '@angular/material/tree';
import { Node, Settings } from '../../../models/RTLconfig';
import { LightningNode, Settings } from '../../../models/RTLconfig';
import { LoggerService } from '../../../services/logger.service';
import { GetInfo, GetInfoChain } from '../../../models/lndModels';
import { MenuChildNode, FlatMenuNode, MENU_DATA } from '../../../models/navMenu';
import { RTLEffects } from '../../../store/rtl.effects';
import * as RTLActions from '../../../store/rtl.actions';
import * as fromRTLReducer from '../../../store/rtl.reducers';
import { RTLEffects } from '../../../../store/rtl.effects';
import * as RTLActions from '../../../../store/rtl.actions';
import * as fromRTLReducer from '../../../../store/rtl.reducers';
@Component({
selector: 'rtl-side-navigation',
@ -25,7 +25,7 @@ import * as fromRTLReducer from '../../../store/rtl.reducers';
})
export class SideNavigationComponent implements OnInit, OnDestroy {
@Output() ChildNavClicked = new EventEmitter<any>();
public selNode: Node;
public selNode: LightningNode;
public settings: Settings;
public version = '';
public information: GetInfo = {};
@ -44,7 +44,7 @@ export class SideNavigationComponent implements OnInit, OnDestroy {
navMenus: MatTreeFlatDataSource<MenuChildNode, FlatMenuNode>;
navMenusLogout: MatTreeFlatDataSource<MenuChildNode, FlatMenuNode>;
constructor(private logger: LoggerService, private store: Store<fromRTLReducer.State>, private actions$: Actions, private rtlEffects: RTLEffects, private router: Router, private activatedRoute: ActivatedRoute) {
constructor(private logger: LoggerService, private store: Store<fromRTLReducer.RTLState>, private actions$: Actions, private rtlEffects: RTLEffects, private router: Router, private activatedRoute: ActivatedRoute) {
this.version = environment.VERSION;
if (MENU_DATA.LNDChildren[MENU_DATA.LNDChildren.length - 1].id === 200) {
MENU_DATA.LNDChildren.pop();
@ -61,7 +61,7 @@ export class SideNavigationComponent implements OnInit, OnDestroy {
}
ngOnInit() {
this.store.select('rtlRoot')
this.store.select('rtl')
.pipe(takeUntil(this.unSubs[0]))
.subscribe(rtlStore => {
this.selNode = rtlStore.selNode;

@ -4,14 +4,14 @@ import { takeUntil, filter } from 'rxjs/operators';
import { Store } from '@ngrx/store';
import { Actions } from '@ngrx/effects';
import { Node } from '../../../models/RTLconfig';
import { LightningNode } from '../../../models/RTLconfig';
import { LoggerService } from '../../../services/logger.service';
import { GetInfo, GetInfoChain } from '../../../models/lndModels';
import { environment } from '../../../../../environments/environment';
import { RTLEffects } from '../../../store/rtl.effects';
import * as fromRTLReducer from '../../../store/rtl.reducers';
import * as RTLActions from '../../../store/rtl.actions';
import { RTLEffects } from '../../../../store/rtl.effects';
import * as fromRTLReducer from '../../../../store/rtl.reducers';
import * as RTLActions from '../../../../store/rtl.actions';
@Component({
selector: 'rtl-top-menu',
@ -19,7 +19,7 @@ import * as RTLActions from '../../../store/rtl.actions';
styleUrls: ['./top-menu.component.scss']
})
export class TopMenuComponent implements OnInit, OnDestroy {
public selNode: Node;
public selNode: LightningNode;
public version = '';
public information: GetInfo = {};
public informationChain: GetInfoChain = {};
@ -27,14 +27,14 @@ export class TopMenuComponent implements OnInit, OnDestroy {
public showLogout = false;
private unSubs = [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.RTLState>, private rtlEffects: RTLEffects, private actions$: Actions) {
this.version = environment.VERSION;
}
ngOnInit() {
this.store.select('rtlRoot')
this.store.select('rtl')
.pipe(takeUntil(this.unSubs[0]))
.subscribe((rtlStore: fromRTLReducer.State) => {
.subscribe((rtlStore) => {
this.selNode = rtlStore.selNode;
this.information = rtlStore.information;

@ -3,10 +3,10 @@ import { Subject } from 'rxjs';
import { takeUntil } from 'rxjs/operators';
import { Store } from '@ngrx/store';
import { Node } from '../../models/RTLconfig';
import { RTLEffects } from '../../store/rtl.effects';
import * as RTLActions from '../../store/rtl.actions';
import * as fromRTLReducer from '../../store/rtl.reducers';
import { LightningNode } from '../../models/RTLconfig';
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',
@ -14,7 +14,7 @@ import * as fromRTLReducer from '../../store/rtl.reducers';
styleUrls: ['./server-config.component.scss']
})
export class ServerConfigComponent implements OnInit, OnDestroy {
public selNode: Node;
public selNode: LightningNode;
public selectedNodeType = 'rtl';
public showLND = false;
public showBitcoind = false;
@ -22,12 +22,12 @@ 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.RTLState>, private rtlEffects: RTLEffects) {}
ngOnInit() {
this.store.select('rtlRoot')
this.store.select('rtl')
.pipe(takeUntil(this.unsubs[0]))
.subscribe((rtlStore: fromRTLReducer.State) => {
.subscribe((rtlStore) => {
rtlStore.effectErrors.forEach(effectsErr => {
if (effectsErr.action === 'fetchConfig') {
this.resetData();

@ -3,12 +3,12 @@ import { Subject } from 'rxjs';
import { takeUntil } from 'rxjs/operators';
import { Store } from '@ngrx/store';
import { Node, RTLConfiguration } from '../../models/RTLconfig';
import { LightningNode, RTLConfiguration } from '../../models/RTLconfig';
import { GetInfo } from '../../models/lndModels';
import { LoggerService } from '../../services/logger.service';
import * as RTLActions from '../../store/rtl.actions';
import * as fromRTLReducer from '../../store/rtl.reducers';
import * as RTLActions from '../../../store/rtl.actions';
import * as fromRTLReducer from '../../../store/rtl.reducers';
@Component({
selector: 'rtl-settings-nav',
@ -16,7 +16,7 @@ import * as fromRTLReducer from '../../store/rtl.reducers';
styleUrls: ['./settings-nav.component.scss']
})
export class SettingsNavComponent implements OnInit, OnDestroy {
public selNode: Node;
public selNode: LightningNode;
public information: GetInfo = {};
public menus = ['Vertical', 'Horizontal'];
public menuTypes = ['Regular', 'Compact', 'Mini'];
@ -29,12 +29,12 @@ export class SettingsNavComponent implements OnInit, OnDestroy {
unsubs: Array<Subject<void>> = [new Subject(), new Subject()];
@Output('done') done: EventEmitter<void> = new EventEmitter();
constructor(private logger: LoggerService, private store: Store<fromRTLReducer.State>) {}
constructor(private logger: LoggerService, private store: Store<fromRTLReducer.RTLState>) {}
ngOnInit() {
this.store.select('rtlRoot')
this.store.select('rtl')
.pipe(takeUntil(this.unsubs[0]))
.subscribe((rtlStore: fromRTLReducer.State) => {
.subscribe((rtlStore) => {
this.appConfig = rtlStore.appConfig;
this.selNode = rtlStore.selNode;
this.selectedMenu = this.selNode.settings.menu;
@ -73,7 +73,7 @@ export class SettingsNavComponent implements OnInit, OnDestroy {
this.done.emit();
}
onSelectionChange(selNodeValue: Node) {
onSelectionChange(selNodeValue: LightningNode) {
this.selNode = selNodeValue;
this.store.dispatch(new RTLActions.OpenSpinner('Updating Selected Node...'));
this.store.dispatch(new RTLActions.SetSelelectedNode(selNodeValue));

@ -4,10 +4,10 @@ import { takeUntil } from 'rxjs/operators';
import * as sha256 from 'sha256';
import { Store } from '@ngrx/store';
import { Node } from '../../models/RTLconfig';
import { LightningNode } from '../../models/RTLconfig';
import { LoggerService } from '../../services/logger.service';
import * as fromRTLReducer from '../../store/rtl.reducers';
import * as RTLActions from '../../store/rtl.actions';
import * as fromRTLReducer from '../../../store/rtl.reducers';
import * as RTLActions from '../../../store/rtl.actions';
@Component({
selector: 'rtl-signin',
@ -15,7 +15,7 @@ import * as RTLActions from '../../store/rtl.actions';
styleUrls: ['./signin.component.scss']
})
export class SigninComponent implements OnInit, OnDestroy {
public selNode: Node;
public selNode: LightningNode;
public password = '';
public nodeAuthType = '';
public rtlSSO = 0;
@ -25,12 +25,12 @@ export class SigninComponent implements OnInit, OnDestroy {
private unsub: Array<Subject<void>> = [new Subject(), new Subject(), new Subject()];
constructor(private logger: LoggerService, private store: Store<fromRTLReducer.State>) { }
constructor(private logger: LoggerService, private store: Store<fromRTLReducer.RTLState>) { }
ngOnInit() {
this.store.select('rtlRoot')
this.store.select('rtl')
.pipe(takeUntil(this.unsub[0]))
.subscribe((rtlStore: fromRTLReducer.State) => {
.subscribe((rtlStore) => {
rtlStore.effectErrors.forEach(effectsErr => {
this.logger.error(effectsErr);
});

@ -28,7 +28,7 @@ export class Authentication {
) { }
}
export class Node {
export class LightningNode {
constructor(
public settings: Settings,
public authentication: Authentication,
@ -42,6 +42,6 @@ export class RTLConfiguration {
constructor(
public selectedNodeIndex: number,
public sso: SSO,
public nodes: Node[]
public nodes: LightningNode[]
) { }
}

@ -0,0 +1,52 @@
// export interface GetInfoAddress {
// type?: string;
// address?: string;
// port?: number;
// }
// export interface GetInfo {
// id?: string;
// alias?: string;
// color?: string;
// num_peers?: number;
// num_pending_channels?: number;
// num_active_channels?: number;
// num_inactive_channels?: number;
// address?: GetInfoAddress[];
// binding?: GetInfoAddress[];
// version?: string;
// blockheight?: number;
// network?: string;
// msatoshi_fees_collected?: number;
// fees_collected_msat?: string;
// }
export interface GetInfoChain {
chain?: string;
network?: string;
}
export interface GetInfoCL {
identity_pubkey?: string;
alias?: string;
num_pending_channels?: number;
num_active_channels?: number;
num_inactive_channels?: number;
num_peers?: number;
block_height?: number;
synced_to_chain?: boolean;
testnet?: boolean;
chains?: GetInfoChain[];
version?: string;
currency_unit?: string;
smaller_currency_unit?: string;
}
export interface FeesCL {
day_fee_sum?: number;
week_fee_sum?: number;
month_fee_sum?: number;
btc_day_fee_sum?: number;
btc_week_fee_sum?: number;
btc_month_fee_sum?: number;
}

@ -5,16 +5,16 @@ export interface AddressType {
}
export interface Balance {
btc_balance?: string; // For Channels Balance
balance?: string; // For Channels Balance
btc_pending_open_balance?: string; // For Channels Balance
pending_open_balance?: string; // For Channels Balance
btc_total_balance?: string; // For Blockchain Balance
total_balance?: string; // For Blockchain Balance
btc_confirmed_balance?: string; // For Blockchain Balance
confirmed_balance?: string; // For Blockchain Balance
btc_unconfirmed_balance?: string; // For Blockchain Balance
unconfirmed_balance?: string; // For Blockchain Balance
btc_balance?: string;
balance?: string;
btc_pending_open_balance?: string;
pending_open_balance?: string;
btc_total_balance?: string;
total_balance?: string;
btc_confirmed_balance?: string;
confirmed_balance?: string;
btc_unconfirmed_balance?: string;
unconfirmed_balance?: string;
}
export interface ChannelFeeReport {
@ -271,7 +271,7 @@ export interface PayRequest {
export interface Peer {
pub_key?: string;
alias?: string;
address?: string; // host
address?: string;
bytes_sent?: number;
bytes_recv?: number;
sat_sent?: string;

@ -1,11 +1,14 @@
import { MatDialogConfig } from '@angular/material';
import { Action } from '@ngrx/store';
import { RTLConfiguration, Settings, Node } from '../models/RTLconfig';
import { ErrorPayload } from '../models/errorPayload';
import { GetInfoCL } from '../shared/models/clModels';
import { RTLConfiguration, Settings, LightningNode } from '../shared/models/RTLconfig';
import { ErrorPayload } from '../shared/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';
} from '../shared/models/lndModels';
export const RESET_STORE = 'RESET_STORE';
export const CLEAR_EFFECT_ERROR = 'CLEAR_EFFECT_ERROR';
@ -86,6 +89,11 @@ 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 const FETCH_CL_INFO = 'FETCH_CL_INFO';
export const SET_CL_INFO = 'SET_CL_INFO';
export const FETCH_CL_FEES = 'FETCH_CL_FEES';
export const SET_CL_FEES = 'SET_CL_FEES';
export class ClearEffectError implements Action {
readonly type = CLEAR_EFFECT_ERROR;
constructor(public payload: string) {} // payload = errorAction
@ -126,7 +134,7 @@ export class CloseConfirmation implements Action {
export class ResetStore implements Action {
readonly type = RESET_STORE;
constructor(public payload: Node) {}
constructor(public payload: LightningNode) {}
}
export class FetchRTLConfig implements Action {
@ -145,7 +153,7 @@ export class SaveSettings implements Action {
export class SetSelelectedNode implements Action {
readonly type = SET_SELECTED_NODE;
constructor(public payload: Node) {}
constructor(public payload: LightningNode) {}
}
export class FetchInfo implements Action {
@ -456,6 +464,24 @@ export class InitAppData implements Action {
readonly type = INIT_APP_DATA;
}
export class FetchCLInfo implements Action {
readonly type = FETCH_CL_INFO;
}
export class SetCLInfo implements Action {
readonly type = SET_CL_INFO;
constructor(public payload: GetInfoCL) {}
}
export class FetchCLFees implements Action {
readonly type = FETCH_CL_FEES;
}
export class SetCLFees implements Action {
readonly type = SET_CL_FEES;
constructor(public payload: {}) {}
}
export type RTLActions =
ClearEffectError | EffectError | OpenSpinner | CloseSpinner |
FetchRTLConfig | SetRTLConfig | SaveSettings |
@ -477,4 +503,5 @@ export type RTLActions =
GetNewAddress | SetNewAddress | SetChannelTransaction |
GenSeed | GenSeedResponse | InitWallet | InitWalletResponse | UnlockWallet |
FetchConfig | ShowConfig | PeerLookup | ChannelLookup | InvoiceLookup | SetLookup |
IsAuthorized | IsAuthorizedRes | Signin | Signout | InitAppData;
IsAuthorized | IsAuthorizedRes | Signin | Signout | InitAppData |
FetchCLInfo | SetCLInfo | FetchCLFees | SetCLFees;

@ -1,5 +1,5 @@
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';
@ -8,14 +8,14 @@ import { map, mergeMap, catchError, take, 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 { environment } from '../../environments/environment';
import { LoggerService } from '../shared/services/logger.service';
import { Settings } from '../shared/models/RTLconfig';
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 { SpinnerDialogComponent } from '../shared/components/spinner-dialog/spinner-dialog.component';
import { AlertMessageComponent } from '../shared/components/alert-message/alert-message.component';
import { ConfirmationMessageComponent } from '../shared/components/confirmation-message/confirmation-message.component';
import * as RTLActions from './rtl.actions';
import * as fromRTLReducer from './rtl.reducers';
@ -28,7 +28,7 @@ export class RTLEffects implements OnDestroy {
constructor(
private actions$: Actions,
private httpClient: HttpClient,
private store: Store<fromRTLReducer.State>,
private store: Store<fromRTLReducer.RTLState>,
private logger: LoggerService,
public dialog: MatDialog,
private router: Router) { }
@ -117,8 +117,8 @@ export class RTLEffects implements OnDestroy {
@Effect()
infoFetch = this.actions$.pipe(
ofType(RTLActions.FETCH_INFO),
withLatestFrom(this.store.select('rtlRoot')),
mergeMap(([action, store]: [RTLActions.FetchInfo, fromRTLReducer.State]) => {
withLatestFrom(this.store.select('rtl')),
mergeMap(([action, store]) => {
this.store.dispatch(new RTLActions.ClearEffectError('FetchInfo'));
return this.httpClient.get<GetInfo>(environment.GETINFO_API)
.pipe(
@ -670,8 +670,8 @@ export class RTLEffects implements OnDestroy {
@Effect()
sendPayment = this.actions$.pipe(
ofType(RTLActions.SEND_PAYMENT),
withLatestFrom(this.store.select('rtlRoot')),
mergeMap(([action, store]: [RTLActions.SendPayment, fromRTLReducer.State]) => {
withLatestFrom(this.store.select('rtl')),
mergeMap(([action, store]: [RTLActions.SendPayment, any]) => {
let queryHeaders = {};
if (action.payload[2]) {
queryHeaders = {paymentDecoded: action.payload[1]};
@ -1039,8 +1039,8 @@ 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]) => {
withLatestFrom(this.store.select('rtl')),
mergeMap(([action, store]: [RTLActions.IsAuthorized, any]) => {
this.store.dispatch(new RTLActions.ClearEffectError('IsAuthorized'));
return this.httpClient.post(environment.AUTHENTICATE_API, { password: action.payload })
.pipe(
@ -1076,8 +1076,8 @@ export class RTLEffects implements OnDestroy {
@Effect({ dispatch: false })
authSignin = this.actions$.pipe(
ofType(RTLActions.SIGNIN),
withLatestFrom(this.store.select('rtlRoot')),
mergeMap(([action, store]: [RTLActions.Signin, fromRTLReducer.State]) => {
withLatestFrom(this.store.select('rtl')),
mergeMap(([action, store]: [RTLActions.Signin, any]) => {
this.store.dispatch(new RTLActions.ClearEffectError('Signin'));
return this.httpClient.post(environment.AUTHENTICATE_API, { password: action.payload })
.pipe(
@ -1105,8 +1105,8 @@ export class RTLEffects implements OnDestroy {
@Effect({ dispatch: false })
signOut = this.actions$.pipe(
ofType(RTLActions.SIGNOUT),
withLatestFrom(this.store.select('rtlRoot')),
mergeMap(([action, store]: [RTLActions.Signout, fromRTLReducer.State]) => {
withLatestFrom(this.store.select('rtl')),
mergeMap(([action, store]) => {
if (+store.appConfig.sso.rtlSSO) {
window.location.href = store.appConfig.sso.logoutRedirectLink;
} else {
@ -1231,13 +1231,14 @@ export class RTLEffects implements OnDestroy {
this.logger.info(postRes);
this.store.dispatch(new RTLActions.CloseSpinner());
if (sessionStorage.getItem('token')) {
this.store.dispatch(new RTLActions.ResetStore(action.payload));
if(action.payload.lnImplementation.toLowerCase() === 'clightning') {
this.router.navigate(['/cl/home']);
return { type: RTLActions.FETCH_CL_INFO };
} else {
this.router.navigate(['/lnd/home']);
return { type: RTLActions.FETCH_INFO };
}
this.store.dispatch(new RTLActions.ResetStore(action.payload));
return { type: RTLActions.FETCH_INFO };
} else {
return {
type: RTLActions.OPEN_ALERT,
@ -1262,6 +1263,52 @@ export class RTLEffects implements OnDestroy {
}
));
@Effect()
infoFetchCL = this.actions$.pipe(
ofType(RTLActions.FETCH_CL_INFO),
withLatestFrom(this.store.select('rtl')),
mergeMap(([action, store]) => {
this.store.dispatch(new RTLActions.ClearEffectError('FetchCLInfo'));
return this.httpClient.get<GetInfo>(environment.GETINFO_API)
.pipe(
map((info) => {
this.logger.info(info);
sessionStorage.setItem('clUnlocked', 'true');
return {
type: RTLActions.SET_CL_INFO,
payload: (undefined !== info) ? info : {}
};
}),
catchError((err) => {
this.logger.error(err);
this.store.dispatch(new RTLActions.EffectError({ action: 'FetchCLInfo', code: err.status, message: err.error.error }));
return of();
})
);
}
));
@Effect()
fetchFeesCL = this.actions$.pipe(
ofType(RTLActions.FETCH_CL_FEES),
mergeMap((action: RTLActions.FetchCLFees) => {
this.store.dispatch(new RTLActions.ClearEffectError('FetchCLFees'));
return this.httpClient.get<Fees>(environment.FEES_API);
}),
map((fees) => {
this.logger.info(fees);
return {
type: RTLActions.SET_CL_FEES,
payload: (undefined !== fees) ? fees : {}
};
}),
catchError((err: any) => {
this.logger.error(err);
this.store.dispatch(new RTLActions.EffectError({ action: 'FetchCLFees', code: err.status, message: err.error.error }));
return of();
}
));
SetToken(token: string) {
if (token) {
sessionStorage.setItem('lndUnlocked', 'true');

@ -1,14 +1,56 @@
import * as RTLActions from './rtl.actions';
import { ErrorPayload } from '../models/errorPayload';
import { RTLConfiguration, Node } from '../models/RTLconfig';
import { ActionReducerMap } from '@ngrx/store';
import { ErrorPayload } from '../shared/models/errorPayload';
import { RTLConfiguration, LightningNode } from '../shared/models/RTLconfig';
import {
GetInfo, GetInfoChain, Peer, AddressType, Fees, NetworkInfo, Balance, Channel, Payment, ListInvoices, PendingChannels, ClosedChannel, Transaction, SwitchRes, QueryRoutes
} from '../models/lndModels';
} from '../shared/models/lndModels';
import { GetInfoCL, FeesCL } from '../shared/models/clModels';
import * as RTLActions from './rtl.actions';
// export interface RTLState {
// root: RootState,
// lnd: LNDState,
// cl: CLState
// }
// export interface CLState {
// information: GetInfoCL;
// fees: FeesCL;
// }
// export interface LNDState {
// information: GetInfo;
// peers: Peer[];
// fees: Fees;
// networkInfo: NetworkInfo;
// channelBalance: Balance;
// blockchainBalance: Balance;
// allChannels: Channel[];
// closedChannels: ClosedChannel[];
// pendingChannels: PendingChannels;
// numberOfActiveChannels: number;
// numberOfInactiveChannels: number;
// numberOfPendingChannels: number;
// totalLocalBalance: number;
// totalRemoteBalance: number;
// totalInvoices: number;
// transactions: Transaction[];
// payments: Payment[];
// invoices: ListInvoices;
// forwardingHistory: SwitchRes;
// addressTypes: AddressType[];
// }
export interface State {
// export interface RootState {
// effectErrors: ErrorPayload[];
// selNode: LightningNode;
// appConfig: RTLConfiguration;
// }
export interface RTLState {
effectErrors: ErrorPayload[];
selNode: Node;
selNode: LightningNode;
appConfig: RTLConfiguration;
information: GetInfo;
peers: Peer[];
@ -30,19 +72,21 @@ export interface State {
invoices: ListInvoices;
forwardingHistory: SwitchRes;
addressTypes: AddressType[];
CLinformation: GetInfoCL;
CLfees: FeesCL;
}
const initNodeSettings = { flgSidenavOpened: true, flgSidenavPinned: true, menu: 'Vertical', menuType: 'Regular', theme: 'dark-blue', satsToBTC: false };
const initNodeAuthentication = { nodeAuthType: 'CUSTOM', lndConfigPath: '', bitcoindConfigPath: '' };
const initialState: State = {
const initialState: RTLState = {
effectErrors: [],
selNode: {settings: initNodeSettings, authentication: initNodeAuthentication},
appConfig: {
selectedNodeIndex: -1,
sso: { rtlSSO: 0, logoutRedirectLink: '/login' },
nodes: [{ settings: initNodeSettings, authentication: initNodeAuthentication}]
},
}, // ROOT ENDS
information: {},
peers: [],
fees: {},
@ -65,10 +109,12 @@ const initialState: State = {
addressTypes: [
{ addressId: '0', addressTp: 'p2wkh', addressDetails: 'Pay to witness key hash'},
{ addressId: '1', addressTp: 'np2wkh', addressDetails: 'Pay to nested witness key hash (default)'}
]
], //LND ENDS
CLinformation: {},
CLfees: {}
};
export function RTLRootReducer(state = initialState, action: RTLActions.RTLActions) {
export function RTLReducer(state = initialState, action: RTLActions.RTLActions) {
switch (action.type) {
case RTLActions.CLEAR_EFFECT_ERROR:
const clearedEffectErrors = [...state.effectErrors];
@ -283,6 +329,16 @@ export function RTLRootReducer(state = initialState, action: RTLActions.RTLActio
...state,
forwardingHistory: action.payload
};
case RTLActions.SET_CL_INFO:
return {
...state,
CLinformation: action.payload
};
case RTLActions.SET_CL_FEES:
return {
...state,
CLfees: action.payload
};
default:
return state;
}
Loading…
Cancel
Save