@@ -115,20 +115,56 @@ impl<'a> Network<'a> {
115
115
}
116
116
IoEvent :: GetBlock { number } => {
117
117
let res = Self :: get_block ( self . endpoint , number) . await ;
118
- let mut app = self . app . lock ( ) . await ;
119
118
if let Ok ( block) = res {
120
- app. pop_current_route ( ) ;
121
- app. set_route ( Route :: new ( RouteId :: Block ( block) , ActiveBlock :: Main ) ) ;
119
+ {
120
+ let mut app = self . app . lock ( ) . await ;
121
+ app. pop_current_route ( ) ;
122
+ app. set_route ( Route :: new (
123
+ RouteId :: Block ( block. to_owned ( ) ) ,
124
+ ActiveBlock :: Main ,
125
+ ) ) ;
126
+ }
127
+
128
+ if let Some ( block) = block {
129
+ let mut addresses = vec ! [ ] ;
130
+ for transaction in block. block . transactions {
131
+ addresses. push ( transaction. from ) ;
132
+ if let Some ( to) = transaction. to {
133
+ addresses. push ( to) ;
134
+ }
135
+ }
136
+
137
+ let _ = self . update_app_with_ens_ids ( & addresses) . await ;
138
+ }
122
139
}
140
+ let mut app = self . app . lock ( ) . await ;
123
141
app. is_loading = false ;
124
142
}
125
143
IoEvent :: GetBlockByHash { hash } => {
126
144
let res = Self :: get_block ( self . endpoint , hash) . await ;
127
- let mut app = self . app . lock ( ) . await ;
128
- if let Ok ( some) = res {
129
- app. pop_current_route ( ) ;
130
- app. set_route ( Route :: new ( RouteId :: Block ( some) , ActiveBlock :: Main ) ) ;
145
+ if let Ok ( block) = res {
146
+ {
147
+ let mut app = self . app . lock ( ) . await ;
148
+ app. pop_current_route ( ) ;
149
+ app. set_route ( Route :: new (
150
+ RouteId :: Block ( block. to_owned ( ) ) ,
151
+ ActiveBlock :: Main ,
152
+ ) ) ;
153
+ }
154
+
155
+ if let Some ( block) = block {
156
+ let mut addresses = vec ! [ ] ;
157
+ for transaction in block. block . transactions {
158
+ addresses. push ( transaction. from ) ;
159
+ if let Some ( to) = transaction. to {
160
+ addresses. push ( to) ;
161
+ }
162
+ }
163
+
164
+ let _ = self . update_app_with_ens_ids ( & addresses) . await ;
165
+ }
131
166
}
167
+ let mut app = self . app . lock ( ) . await ;
132
168
app. is_loading = false ;
133
169
}
134
170
IoEvent :: GetTransactionWithReceipt { transaction_hash } => {
@@ -164,7 +200,7 @@ impl<'a> Network<'a> {
164
200
Self :: get_latest_transactions ( self . endpoint , n) ,
165
201
)
166
202
. await
167
- . unwrap ( ) ;
203
+ . unwrap ( ) ; //TODO: remove unwrap
168
204
let mut addresses = vec ! [ ] ;
169
205
for transaction in & transactions {
170
206
addresses. push ( transaction. transaction . from ) ;
0 commit comments