@@ -2,8 +2,8 @@ import { Injectable } from '@angular/core';
22import { MinaState , selectMinaState } from '@app/app.setup' ;
33import { Actions , createEffect , ofType } from '@ngrx/effects' ;
44import { Store } from '@ngrx/store' ;
5- import { createNonDispatchableEffect , Effect , NonDispatchableEffect , removeParamsFromURL } from '@openmina/shared' ;
6- import { filter , from , map , switchMap , tap } from 'rxjs' ;
5+ import { createNonDispatchableEffect , Effect , removeParamsFromURL } from '@openmina/shared' ;
6+ import { filter , map , mergeMap , of , switchMap , tap } from 'rxjs' ;
77import { AppActions } from '@app/app.actions' ;
88import { Router } from '@angular/router' ;
99import { FeatureType , MinaNode } from '@shared/types/core/environment/mina-env.type' ;
@@ -22,9 +22,10 @@ import { AppNodeStatus } from '@shared/types/app/app-node-details.type';
2222export class AppEffects extends BaseEffect {
2323
2424 readonly init$ : Effect ;
25- readonly initSuccess$ : NonDispatchableEffect ;
25+ readonly initSuccess$ : Effect ;
2626 readonly onNodeChange$ : Effect ;
2727 readonly getNodeDetails$ : Effect ;
28+ readonly getNodeEnvBuild$ : Effect ;
2829
2930 private requestInProgress : boolean = false ;
3031
@@ -46,7 +47,7 @@ export class AppEffects extends BaseEffect {
4647 map ( ( payload : { activeNode : MinaNode , nodes : MinaNode [ ] } ) => AppActions . initSuccess ( payload ) ) ,
4748 ) ) ;
4849
49- this . initSuccess$ = createNonDispatchableEffect ( ( ) => this . actions$ . pipe (
50+ this . initSuccess$ = createEffect ( ( ) => this . actions$ . pipe (
5051 ofType ( AppActions . initSuccess ) ,
5152 this . latestActionState ( ) ,
5253 switchMap ( ( { state } ) => {
@@ -55,8 +56,9 @@ export class AppEffects extends BaseEffect {
5556 switchMap ( ( ) => this . webNodeService . startWasm$ ( ) ) ,
5657 ) ;
5758 }
58- return from ( [ ] ) ;
59+ return of ( { } ) ;
5960 } ) ,
61+ map ( ( ) => AppActions . getNodeEnvBuild ( ) ) ,
6062 ) ) ;
6163
6264 this . onNodeChange$ = createNonDispatchableEffect ( ( ) => this . actions$ . pipe (
@@ -79,9 +81,16 @@ export class AppEffects extends BaseEffect {
7981 switchMap ( ( ) => this . webNodeService . startWasm$ ( ) ) ,
8082 ) ;
8183 }
82- return from ( [ ] ) ;
84+ return of ( { } ) ;
8385 } ) ,
84- map ( ( ) => AppActions . getNodeDetails ( ) ) ,
86+ switchMap ( ( ) => [ AppActions . getNodeDetails ( ) , AppActions . getNodeEnvBuild ( ) ] ) ,
87+ ) ) ;
88+
89+ this . getNodeEnvBuild$ = createEffect ( ( ) => this . actions$ . pipe (
90+ ofType ( AppActions . getNodeEnvBuild ) ,
91+ mergeMap ( ( ) => this . appService . getEnvBuild ( ) ) ,
92+ map ( envBuild => AppActions . getNodeEnvBuildSuccess ( { envBuild } ) ) ,
93+ catchErrorAndRepeat2 ( MinaErrorType . RUST , AppActions . getNodeEnvBuildSuccess ( { envBuild : undefined } ) ) ,
8594 ) ) ;
8695
8796 this . getNodeDetails$ = createEffect ( ( ) => this . actions$ . pipe (
@@ -95,9 +104,9 @@ export class AppEffects extends BaseEffect {
95104 status : AppNodeStatus . OFFLINE ,
96105 blockHeight : null ,
97106 blockTime : null ,
98- peers : 0 ,
99- download : 0 ,
100- upload : 0 ,
107+ peersConnected : 0 ,
108+ peersDisconnected : 0 ,
109+ peersConnecting : 0 ,
101110 transactions : 0 ,
102111 snarks : 0 ,
103112 producingBlockAt : null ,
0 commit comments