@@ -47,6 +47,7 @@ import type {
4747} from 'interchain/types/codegen/cosmos/staking/v1beta1/staking' ;
4848import type { DelegationDelegatorReward as Reward } from 'interchain/types/codegen/cosmos/distribution/v1beta1/distribution' ;
4949import { ChainName } from '@cosmos-kit/core' ;
50+ import { Thumbnail } from './all-validators' ;
5051
5152const MyValidators = ( {
5253 validators,
@@ -57,6 +58,7 @@ const MyValidators = ({
5758 updateData,
5859 unbondingDays,
5960 chainName,
61+ thumbnails,
6062} : {
6163 validators : Validator [ ] ;
6264 allValidator : Validator [ ] ;
@@ -66,6 +68,9 @@ const MyValidators = ({
6668 updateData : ( ) => void ;
6769 unbondingDays : number ;
6870 chainName : ChainName ;
71+ thumbnails : {
72+ [ key : string ] : string ;
73+ } ;
6974} ) => {
7075 const { getSigningStargateClient, address } = useChain ( chainName ) ;
7176
@@ -152,9 +157,11 @@ const MyValidators = ({
152157 return {
153158 details : validator ?. description ?. details ,
154159 name : validator ?. description ?. moniker ,
160+ identity : validator ?. description ?. identity ,
155161 address : validator . operatorAddress ,
156162 staked : exponentiate ( delegation . balance ! . amount , - exp ) ,
157163 reward : Number ( exponentiate ( rewardAmount , - exp ) . toFixed ( 6 ) ) ,
164+ commission : validator ?. commission ?. commissionRates ?. rate ,
158165 } ;
159166 } ) ;
160167
@@ -379,9 +386,17 @@ const MyValidators = ({
379386
380387 < ModalBody >
381388 < ValidatorInfo
382- imgUrl = "https://wallet.keplr.app/_next/image?url=https%3A%2F%2Fs3.amazonaws.com%2Fkeybase_processed_uploads%2F909034c1d36c1d1f3e9191f668007805_360_360.jpeg& w = 64 & q = 75 "
389+ imgUrl = {
390+ currentValidator ?. identity
391+ ? thumbnails [ currentValidator . identity ]
392+ : ''
393+ }
383394 name = { currentValidator ?. name || '' }
384- commission = { 5 }
395+ commission = {
396+ currentValidator ?. commission
397+ ? exponentiate ( currentValidator . commission , - 16 ) . toFixed ( 0 )
398+ : 0
399+ }
385400 apr = { 22.08 }
386401 />
387402 < ValidatorDesc description = { currentValidator ?. details || '' } />
@@ -427,9 +442,17 @@ const MyValidators = ({
427442
428443 < ModalBody >
429444 < ValidatorInfo
430- imgUrl = "https://wallet.keplr.app/_next/image?url=https%3A%2F%2Fs3.amazonaws.com%2Fkeybase_processed_uploads%2F909034c1d36c1d1f3e9191f668007805_360_360.jpeg& w = 64 & q = 75 "
445+ imgUrl = {
446+ currentValidator ?. identity
447+ ? thumbnails [ currentValidator . identity ]
448+ : ''
449+ }
431450 name = { currentValidator ?. name || '' }
432- commission = { 5 }
451+ commission = {
452+ currentValidator ?. commission
453+ ? exponentiate ( currentValidator . commission , - 16 ) . toFixed ( 0 )
454+ : 0
455+ }
433456 apr = { 22.08 }
434457 />
435458 < DelegateWarning unbondingDays = { unbondingDays } />
@@ -474,9 +497,17 @@ const MyValidators = ({
474497
475498 < ModalBody >
476499 < ValidatorInfo
477- imgUrl = "https://wallet.keplr.app/_next/image?url=https%3A%2F%2Fs3.amazonaws.com%2Fkeybase_processed_uploads%2F909034c1d36c1d1f3e9191f668007805_360_360.jpeg& w = 64 & q = 75 "
500+ imgUrl = {
501+ currentValidator ?. identity
502+ ? thumbnails [ currentValidator . identity ]
503+ : ''
504+ }
478505 name = { currentValidator ?. name || '' }
479- commission = { 5 }
506+ commission = {
507+ currentValidator ?. commission
508+ ? exponentiate ( currentValidator . commission , - 16 ) . toFixed ( 0 )
509+ : 0
510+ }
480511 apr = { 22.08 }
481512 />
482513 < Stack direction = "column" spacing = { 4 } >
@@ -548,23 +579,31 @@ const MyValidators = ({
548579 overflowX = "hidden"
549580 >
550581 < Text mr = { 4 } > { index + 1 } </ Text >
551- { /* <Image
552- borderRadius="full"
553- boxSize="30px"
554- src={validator.imgUrl}
555- alt={validator.description.moniker}
556- mr={2}
557- /> */ }
582+ < Thumbnail
583+ identity = { validator . description ?. identity }
584+ name = { validator . description ?. moniker }
585+ thumbnailUrl = {
586+ validator . description ?. identity
587+ ? thumbnails [ validator . description . identity ]
588+ : ''
589+ }
590+ />
558591 < Text > { validator ?. description ?. moniker } </ Text >
559592 </ Box >
560593 </ Td >
561594 < Td >
562- { /* { validator.voting} <Token color="blackAlpha.800" /> */ }
563- 10,000,000
595+ { Math . floor ( exponentiate ( validator . tokens , - exp ) ) }
596+
564597 < Token color = "blackAlpha.800" token = { coin . symbol } />
565598 </ Td >
566- { /* <Td>{validator.commission}</Td> */ }
567- < Td > 5%</ Td >
599+ < Td >
600+ { validator . commission ?. commissionRates ?. rate &&
601+ exponentiate (
602+ validator . commission . commissionRates . rate ,
603+ - 16
604+ ) . toFixed ( 0 ) }
605+ %
606+ </ Td >
568607 < Td >
569608 < Box width = "100%" display = "flex" alignItems = "center" >
570609 { /* <Text>{validator.apr}</Text> */ }
@@ -645,13 +684,13 @@ const MyValidators = ({
645684 overflowX = "hidden"
646685 >
647686 < Text mr = { 4 } > { index + 1 } </ Text >
648- { /* <Image
649- borderRadius="full"
650- boxSize="30px"
651- src={validator.imgUrl}
652- alt={ validator.name}
653- mr={2 }
654- /> */ }
687+ < Thumbnail
688+ identity = { validator . identity }
689+ name = { validator . name }
690+ thumbnailUrl = {
691+ validator . identity ? thumbnails [ validator . identity ] : ''
692+ }
693+ />
655694 < Text > { validator . name } </ Text >
656695 </ Box >
657696 </ Td >
0 commit comments