Skip to content

Commit

Permalink
fix: bug not show validator name
Browse files Browse the repository at this point in the history
  • Loading branch information
tiendn committed Mar 15, 2023
1 parent 83b077f commit 2252626
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 16 deletions.
7 changes: 4 additions & 3 deletions components/Search/SearchResult.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,15 +85,16 @@ export default function SearchResult({ status, data }: SearchResultProps) {
for (let item of validators) {
if (!items.find((i: SearchResultViewItem) => item.operatorAddress === i.key)) {
const validator = validatorSummary.find(
(v: ValidatorData) => v.operatorAddress.toLowerCase() === item.operatorAddress.toLowerCase()
(v: ValidatorData) =>
v.initialDelegatorAddress.toLowerCase() === item.initialDelegatorAddress.toLowerCase()
)
const name = validator?.moniker
items.push({
status: item.status,
type: 'Validator',
key: item.operatorAddress,
value: name ? `${name} (item.operatorAddress)` : item.operatorAddress,
linkValue: item.operatorAddress
value: name ? `${name} (${item.initialDelegatorAddressHash})` : item.operatorAddress,
linkValue: item.initialDelegatorAddressHash
})
}
}
Expand Down
4 changes: 3 additions & 1 deletion pages/address/[address].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ const AddressDetailPage: React.FC<Props> = props => {
const validatorSummary = useAppSelector(getValidatorSummary)

const isMainnet = window?.location?.hostname?.includes('.astranaut.io')
const validator = validatorSummary.find((v: ValidatorData) => astraToEth(v.initialDelegatorAddress) === address)
const validator = validatorSummary.find(
(v: ValidatorData) => astraToEth(v.initialDelegatorAddress).toLowerCase() === address.toLowerCase()
)

return (
<Layout>
Expand Down
1 change: 1 addition & 0 deletions project.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ interface ValidatorData {
operatorAddress: string
consensusNodeAddress: string
initialDelegatorAddress: string
initialDelegatorAddressHash?: string
tendermintPubkey: string
tendermintAddress: string
status: string
Expand Down
23 changes: 11 additions & 12 deletions views/accounts/AddressOverview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ const AddressOverview = ({ validator, address, addressData }: Props) => {

const addressCounter = useAddressCounter(address)
const astraSummary = useAppSelector(getAstraSummary)

const isValidator = !isEmpty(validator)
const isContract = addressData.type === AddressTypeEnum.Contract
const [totalLock, totalUnvested, totalVested] = useMemo<Array<TokenAmount | undefined>>(() => {
Expand Down Expand Up @@ -116,6 +115,16 @@ const AddressOverview = ({ validator, address, addressData }: Props) => {
{/* <QrButton textTitle="qrcode" content={address} /> */}
</div>
</Row>
{validator && (
<div
style={{ justifyContent: 'space-between' }}
className={clsx(styles.borderBottom, 'padding-bottom-lg padding-top-lg')}
>
<span className="text text-base contrast-color-50">Description</span>
<br />
<span className="text text-base">{validator.details}</span>
</div>
)}
{isContract && (
<div style={{ justifyContent: 'space-between' }} className={clsx('padding-bottom-lg ')}>
{addressData.tokenSymbol && (
Expand Down Expand Up @@ -175,17 +184,7 @@ const AddressOverview = ({ validator, address, addressData }: Props) => {
{isUndefined(addressCounter?.tokenTransferCount) ? 'NaN' : addressCounter?.tokenTransferCount}
</span>
</div>
{/* <div className={styles.colLastBalanceUpdated}>
<span className="text text-base contrast-color-50">Fee:</span>
<br />
<TypographyUI.Balance
size="sm"
currency={'ASA'}
icon={<CryptoIcon name="asa" size="sm" />}
value={addressCounter.feesCount ? addressCounter.feesCount : 0}
fixNumber={5}
/>
</div> */}

<div className={styles.colGasUsed}>
<span className="text text-base contrast-color-50">Gas used:</span>
<br />
Expand Down

0 comments on commit 2252626

Please sign in to comment.