@@ -12,6 +12,7 @@ use subvt_config::Config;
12
12
use subvt_persistence:: postgres:: network:: PostgreSQLNetworkStorage ;
13
13
use subvt_persistence:: redis:: Redis ;
14
14
use subvt_service_common:: { err:: InternalServerError , Service } ;
15
+ use subvt_substrate_client:: SubstrateClient ;
15
16
use subvt_types:: report:: BlockSummary ;
16
17
use subvt_types:: subvt:: ValidatorSummary ;
17
18
@@ -31,6 +32,7 @@ pub(crate) type ResultResponse = Result<HttpResponse, InternalServerError>;
31
32
pub ( crate ) struct ServiceState {
32
33
postgres : Arc < PostgreSQLNetworkStorage > ,
33
34
redis : Arc < Redis > ,
35
+ substrate_client : Arc < SubstrateClient > ,
34
36
finalized_block_summary : Arc < RwLock < BlockSummary > > ,
35
37
active_validator_list : Arc < RwLock < Vec < ValidatorSummary > > > ,
36
38
inactive_validator_list : Arc < RwLock < Vec < ValidatorSummary > > > ,
@@ -65,6 +67,7 @@ impl Service for ReportService {
65
67
"Cannot connect to Redis at URL {}." ,
66
68
CONFIG . redis. url
67
69
) ) ?;
70
+ let substrate_client = Arc :: new ( SubstrateClient :: new ( & CONFIG ) . await ?) ;
68
71
let mut pubsub_connection = redis_client. get_async_connection ( ) . await ?. into_pubsub ( ) ;
69
72
pubsub_connection
70
73
. subscribe ( format ! (
@@ -168,6 +171,7 @@ impl Service for ReportService {
168
171
. app_data ( web:: Data :: new ( ServiceState {
169
172
postgres : postgres. clone ( ) ,
170
173
redis : redis. clone ( ) ,
174
+ substrate_client : substrate_client. clone ( ) ,
171
175
finalized_block_summary : finalized_block_summary. clone ( ) ,
172
176
active_validator_list : active_validator_list. clone ( ) ,
173
177
inactive_validator_list : inactive_validator_list. clone ( ) ,
@@ -214,6 +218,7 @@ impl Service for ReportService {
214
218
. service ( validator:: validator_search_service)
215
219
. service ( validator:: validator_era_rewards_service)
216
220
. service ( validator:: validator_era_payouts_service)
221
+ . service ( validator:: validator_reward_chart_service)
217
222
} )
218
223
. workers ( 10 )
219
224
. disable_signals ( )
0 commit comments