@@ -7,27 +7,17 @@ import {
77} from "@anomaorg/namada-indexer-client" ;
88import { singleUnitDurationFromInterval } from "@namada/utils" ;
99import BigNumber from "bignumber.js" ;
10- import { Address , EpochInfo , MyValidator , UnbondEntry , Validator } from "types" ;
10+ import { Address , MyValidator , UnbondEntry , Validator } from "types" ;
1111
1212export const toValidator = (
1313 indexerValidator : IndexerValidator ,
1414 indexerVotingPower : IndexerVotingPower ,
15- epochInfo : EpochInfo ,
15+ unbondingPeriod : string ,
1616 nominalApr : BigNumber
1717) : Validator => {
1818 const commission = BigNumber ( indexerValidator . commission ) ;
1919 const expectedApr = nominalApr . times ( 1 - commission . toNumber ( ) ) ;
2020
21- // Because epoch duration is in reality longer by epochSwitchBlocksDelay we have to account for that
22- const realMinEpochDuration =
23- epochInfo . minEpochDuration +
24- epochInfo . maxBlockTime * epochInfo . epochSwitchBlocksDelay ;
25-
26- const unbondingPeriod = singleUnitDurationFromInterval (
27- 0 ,
28- epochInfo . unbondingPeriodInEpochs * realMinEpochDuration
29- ) ;
30-
3121 return {
3222 uuid : indexerValidator . address ,
3323 alias : indexerValidator . name ,
@@ -65,7 +55,7 @@ export const toMyValidators = (
6555 indexerBonds : IndexerBond [ ] | IndexerMergedBond [ ] ,
6656 indexerUnbonds : IndexerUnbond [ ] ,
6757 totalVotingPower : IndexerVotingPower ,
68- epochInfo : EpochInfo ,
58+ unbondingPeriod : string ,
6959 apr : BigNumber
7060) : MyValidator [ ] => {
7161 const myValidators : Record < Address , MyValidator > = { } ;
@@ -78,7 +68,12 @@ export const toMyValidators = (
7868 unbondedAmount : new BigNumber ( 0 ) ,
7969 bondItems : [ ] ,
8070 unbondItems : [ ] ,
81- validator : toValidator ( validator , totalVotingPower , epochInfo , apr ) ,
71+ validator : toValidator (
72+ validator ,
73+ totalVotingPower ,
74+ unbondingPeriod ,
75+ apr
76+ ) ,
8277 } ;
8378 }
8479 } ;
0 commit comments