Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 0 additions & 12 deletions app/next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,4 @@ module.exports = withBundleAnalyzer({
],
},
transpilePackages: ['@web3-name-sdk/core'],
async rewrites() {
return [
{
source: '/api/lastseen',
destination: 'https://hashi-explorer.xyz/api_bridge_ui/lastseen',
},
{
source: '/api/num_hashi_signed/:path*',
destination: 'https://hashi-explorer.xyz/api_bridge_ui/num_hashi_signed/:path*',
},
]
},
})
12 changes: 0 additions & 12 deletions app/src/hooks/subgraph/useValidators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import useSWR from 'swr'

import { BridgesValues } from '@/src/constants/config/bridges'
import { fetchExecutedTransactions, fetchSignedTransactions } from '@/src/utils/validators'
import { useHashi } from '@/src/hooks/useHashi'

export const useFetchValidatorsSignatures = (bridge: BridgesValues, afterDate: number) => {
const {
Expand All @@ -13,17 +12,6 @@ export const useFetchValidatorsSignatures = (bridge: BridgesValues, afterDate: n
fetchSignedTransactions(bridge, afterDate),
)

const { getHashiSignedTransactions } = useHashi()

const hashiSigned = getHashiSignedTransactions(afterDate)

if (Array.isArray(data)) {
const hashiIndex = data.findIndex((item) => item.name === 'Hashi')
if (hashiIndex !== -1) {
data[hashiIndex] = { ...data[hashiIndex], value: hashiSigned }
}
}

return { data, error, refetch }
}

Expand Down
79 changes: 0 additions & 79 deletions app/src/hooks/useHashi.ts

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,6 @@ export const ValidatorIcon: React.FC<Props> = ({ shortName, size, title, ...rest
? { image: `${basePath}giveth.svg`, size: 30, bgColor: '#fff' }
: validator === 'TY'
? { image: `${basePath}telepathy.svg`, size: 36, bgColor: '#fff' }
: validator === 'H'
? { image: `${basePath}hashi.svg`, size: 40, bgColor: '#fff' }
: { image: `${basePath}empty-token.png`, size: 40, bgColor: '#3E6957' }

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,9 +187,7 @@ export const Filters: React.FC<Props> = ({ bridge, filters, onResetFilters, ...r
const { validators } = useValidators(bridge as BridgesValues)
const [resetFields, setResetFields] = useState<boolean>(false)

// hide Hashi from validatorsOptions - temporary until data will be fetched from hashi explorer
// const validatorNames = validators.map((val) => val.name)
const validatorNames = validators.filter((val) => val.name !== 'Hashi').map((val) => val.name)
const validatorNames = validators.map((val) => val.name)

const statusNames = txStatus.map(
(status) => status.charAt(0).toUpperCase() + status.slice(1).toLowerCase(),
Expand Down
182 changes: 17 additions & 165 deletions app/src/pagePartials/bridgeExplorer/validators/Validator.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import styled, { css } from 'styled-components'
import styled from 'styled-components'

import { InnerCard } from '@/src/components/card/InnerCard'
import { TokenAddress } from '@/src/components/token/TokenAddress'
Expand All @@ -12,8 +12,6 @@ import {
TELEPATHY_VALIDATOR_ADDRESS,
TELEPATHY_VALIDATOR_ADDRESS_REPLACED,
} from '@/src/constants/misc'
import { IconLink } from '@/src/components/assets/IconLink'
import { Tooltip } from '@/src/components/tooltip'

const Wrapper = styled(InnerCard)`
min-height: var(--validator-item-min-height);
Expand Down Expand Up @@ -70,77 +68,6 @@ const Address = styled(TokenAddress)`
}
`

const TextCSS = css`
color: ${({ theme: { colors } }) => colors.primary};
font-size: 1.4rem;
font-weight: 400;
line-height: 1.5;
`

const ExternalLink = styled.a`
${TextCSS}

align-items: center;
column-gap: var(--theme-common-space);
display: flex;
text-decoration: none;

&:active {
opacity: 0.8;
}
`

const CommonCSS = css`
transition: color 0.15s ease-in-out;

&:hover {
color: ${({ theme: { colors } }) => colors.primaryDark};
}

&:active {
opacity: 0.6;
}
`

const Link = styled(IconLink)`
color: ${({ theme: { colors } }) => colors.primary_50};
cursor: pointer;

${CommonCSS}

svg {
color: ${({ theme: { colors } }) => colors.primary_50};

&:hover {
color: ${({ theme: { colors } }) => colors.primary};
}
}
`

const ExternalLinkWrapper = styled.span`
display: flex;
align-items: center;
column-gap: var(--theme-common-space);
`

const HashiTooltip = styled(Tooltip)`
flex-grow: 1;
margin-left: var(--theme-common-space);
`

const HashiTooltipWrapper = styled.div`
display: flex;
align-items: flex-start;
flex-grow: 1;
`

const Column = styled.div`
display: flex;
flex-direction: column;
row-gap: var(--theme-common-space);
align-items: flex-end;
`

interface Props {
bridgeValidator: ValidatorType
}
Expand All @@ -161,20 +88,6 @@ export const Validator: React.FC<Props> = ({ bridgeValidator, ...restProps }) =>
return HealthStatusTypes.success
}

// eslint-disable-next-line @typescript-eslint/no-explicit-any
const openLink = (e: any, href: string) => {
e.stopPropagation()
e.preventDefault()

window.open(href, '_blank', 'noopener noreferrer')
}

const isHashi = bridgeValidator.shortName === 'H'

// if (isHashi) {
// return null
// }

return (
<Wrapper {...restProps}>
<ValidatorHeader
Expand All @@ -189,89 +102,28 @@ export const Validator: React.FC<Props> = ({ bridgeValidator, ...restProps }) =>
</Row>
<Row>
<Text>Signed (24hs)</Text>
{isHashi && (
<HashiTooltipWrapper>
<HashiTooltip content="A message is considered signed/approved by Hashi, when a threshold amount of oracles store the same message hash w.r.t the message id." />
</HashiTooltipWrapper>
)}
<Value>{bridgeValidator.signed}</Value>
</Row>
{isHashi ? (
<Row>
<Text>Executed (24hs)</Text>
<HashiTooltipWrapper>
<HashiTooltip content="Hashi only approves messages, the message is executed either by other bridge validators or by users." />
</HashiTooltipWrapper>
<Value>N/A</Value>
</Row>
) : (
<Row>
<Text>Executed (24hs)</Text>
<Value>{bridgeValidator.executed}</Value>
</Row>
)}

<Row>
<Text>Executed (24hs)</Text>
<Value>{bridgeValidator.executed}</Value>
</Row>
</Rows>
<SubTitle>Balance</SubTitle>
<Row>
{isHashi ? (
<>
<Text>N/A</Text>
<HashiTooltipWrapper>
<HashiTooltip content="Hashi don’t need to execute a message, hence balance field is not applicable." />
</HashiTooltipWrapper>
</>
) : (
<Balance balanceType={balanceGnosis} />
)}
<Balance balanceType={balanceGnosis} />
</Row>

<Row>
<Text>Send tokens</Text>
<Address
address={validatorAddress}
characters={6}
copy
href={getAddressScanUrl(validatorAddress, bridgeValidator.scanUrl ?? 'gnosis')}
/>
</Row>
{isHashi ? (
<Row>
<Text>Find more info</Text>
<Column className="text-right">
<ExternalLinkWrapper>
<ExternalLink href="https://hashi-explorer.xyz/" rel="noreferrer" target="_blank">
Hashi Explorer
</ExternalLink>
<Link
className="externalLink"
height={14}
onClick={(e) => openLink(e, 'https://hashi-explorer.xyz/')}
width={14}
/>
</ExternalLinkWrapper>
<ExternalLinkWrapper>
<ExternalLink
href="https://docs.gnosischain.com/bridges/About%20Token%20Bridges/hashi-integration"
rel="noreferrer"
target="_blank"
>
Docs
</ExternalLink>
<Link
className="externalLink"
height={14}
onClick={(e) =>
openLink(
e,
'https://docs.gnosischain.com/bridges/About%20Token%20Bridges/hashi-integration',
)
}
width={14}
/>
</ExternalLinkWrapper>
</Column>
</Row>
) : (
<Row>
<Text>Send tokens</Text>
<Address
address={validatorAddress}
characters={6}
copy
href={getAddressScanUrl(validatorAddress, bridgeValidator.scanUrl ?? 'gnosis')}
/>
</Row>
)}
</Wrapper>
)
}
Loading