1
1
// cSpell:ignore delegators
2
- /* eslint-disable camelcase */
2
+ /* eslint-disable camelcase, new-cap */
3
3
/* eslint-disable unicorn/no-array-callback-reference */
4
4
5
5
import { BlockfrostClient } from '@cardano-sdk/cardano-services-client' ;
@@ -12,7 +12,7 @@ import {
12
12
StakePoolSortOptions ,
13
13
StakePoolStats
14
14
} from '@cardano-sdk/core' ;
15
- import { fromSerializableObject , toSerializableObject } from '@cardano-sdk/util' ;
15
+ import { fromSerializableObject , Percent , toSerializableObject } from '@cardano-sdk/util' ;
16
16
import { Storage } from 'webextension-polyfill' ;
17
17
import type { Responses } from '@blockfrost/blockfrost-js' ;
18
18
import Fuse from 'fuse.js' ;
@@ -89,11 +89,11 @@ const toCore = (pool: BlockFrostPool): Cardano.StakePool => ({
89
89
blocksCreated : pool . blocks_minted ,
90
90
delegators : 0 ,
91
91
livePledge : BigInt ( 0 ) ,
92
- saturation : pool . live_saturation ,
93
- size : { active : 0 , live : 0 } ,
92
+ saturation : Percent ( pool . live_saturation ) ,
93
+ size : { active : Percent ( 0 ) , live : Percent ( 0 ) } ,
94
94
stake : { active : BigInt ( pool . active_stake ) , live : BigInt ( pool . live_stake ) } ,
95
- lastRos : 0 ,
96
- ros : 0
95
+ lastRos : Percent ( 0 ) ,
96
+ ros : Percent ( 0 )
97
97
} ,
98
98
owners : [ ] ,
99
99
pledge : BigInt ( pool . declared_pledge ) ,
@@ -216,9 +216,9 @@ const enrichStakePool = ({ details, networkData, id, stakePools }: enrichStakePo
216
216
stakePool . metrics . livePledge = BigInt ( details . live_pledge ) ;
217
217
stakePool . metrics . delegators = details . live_delegators ;
218
218
// The `if` containing this branch makes the stakePool a StakePoolWithMetrics
219
- stakePool . metrics . ros = estimateROS ( stakePool as StakePoolWithMetrics , networkData ) ;
219
+ stakePool . metrics . ros = Percent ( estimateROS ( stakePool as StakePoolWithMetrics , networkData ) ) ;
220
220
}
221
- stakePool . owners = details . owners ;
221
+ stakePool . owners = details . owners . map ( ( owner ) => Cardano . RewardAccount ( owner ) ) ;
222
222
}
223
223
} ;
224
224
0 commit comments