@@ -155,6 +155,7 @@ export default class Nominator extends EventEmitter {
155155 const stash = await this . stash ( ) ;
156156 const isBonded = await this . chaindata . isBonded ( stash ) ;
157157 const [ bonded , err ] = await this . chaindata . getDenomBondedAmount ( stash ) ;
158+ const currentBlock = await this . chaindata . getLatestBlock ( ) ;
158159
159160 const currentEra = ( await this . chaindata . getCurrentEra ( ) ) || 0 ;
160161 const lastNominationEra =
@@ -170,13 +171,15 @@ export default class Nominator extends EventEmitter {
170171 name = ( await this . chaindata . getFormattedIdentity ( target ) ) ?. name ;
171172 }
172173
173- const score = await queries . getLatestValidatorScore ( target ) ;
174+ const scoreResult = await queries . getLatestValidatorScore ( target ) ;
175+ const score =
176+ scoreResult && scoreResult . total ? scoreResult . total : 0 ;
174177
175178 return {
176179 stash : target ,
177180 name : name ,
178181 kyc : kyc ,
179- score : score && score [ 0 ] && score [ 0 ] . total ? score [ 0 ] . total : 0 ,
182+ score : score ,
180183 } ;
181184 } ) ,
182185 ) ;
@@ -193,23 +196,29 @@ export default class Nominator extends EventEmitter {
193196 let name = await queries . getIdentityName ( target ) ;
194197
195198 if ( ! name ) {
196- name = ( await this . chaindata . getFormattedIdentity ( target ) )
197- ?. name ;
199+ const formattedIdentity =
200+ await this . chaindata . getFormattedIdentity ( target ) ;
201+ name = formattedIdentity ?. name ;
198202 }
199203
200- const score = await queries . getLatestValidatorScore ( target ) ;
204+ const scoreResult = await queries . getLatestValidatorScore ( target ) ;
205+ const score =
206+ scoreResult && scoreResult . total ? scoreResult . total : 0 ;
201207
202208 return {
203209 stash : target ,
204210 name : name ,
205211 kyc : kyc ,
206- score : score && score . total ? score . total : 0 ,
212+ score : score ,
207213 } ;
208214 } ) ,
209215 ) ;
210-
216+ const executionMsTime =
217+ ( this . _proxyDelay + currentBlock - announcement . number ) * 6 * 1000 ;
211218 return {
212- namedTargets,
219+ ...announcement ,
220+ targets : namedTargets ,
221+ executionTime : executionMsTime ,
213222 } ;
214223 } ) ,
215224 ) ;
0 commit comments