Skip to content

Commit

Permalink
fetch correct block explorer url (balancer#1017)
Browse files Browse the repository at this point in the history
  • Loading branch information
groninge01 authored Aug 27, 2024
1 parent d7acc01 commit 662c62d
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,14 @@ import { TokenIcon } from '@/lib/modules/tokens/TokenIcon'
import { fNum } from '@/lib/shared/utils/numbers'
import React from 'react'
import { GqlChain } from '@/lib/shared/services/api/generated/graphql'
import { usePool } from '../../PoolProvider'

interface Props extends GridProps {
event: PoolActivityEl
keyValue: number
}

function EnsOrAddress({ userAddress }: { userAddress: `0x${string}` }) {
function EnsOrAddress({ userAddress, chain }: { userAddress: `0x${string}`; chain: GqlChain }) {
const chainId = getChainId(GqlChain.Mainnet) // perform ENS lookup through mainnet
const { data: name } = useEnsName({ address: userAddress, chainId })

Expand All @@ -49,7 +50,7 @@ function EnsOrAddress({ userAddress }: { userAddress: `0x${string}` }) {
})

return (
<Link target="_blank" href={getBlockExplorerAddressUrl(userAddress)}>
<Link target="_blank" href={getBlockExplorerAddressUrl(userAddress, chain)}>
<HStack>
<Image
src={ensAvatar || fallbackSVG.toDataUriSync()}
Expand Down Expand Up @@ -116,6 +117,7 @@ function TransactionDetails({
export function PoolActivityTableRow({ event, keyValue, ...rest }: Props) {
const { toCurrency } = useCurrency()
const theme = useTheme()
const { chain } = usePool()

const poolEvent = event[2]

Expand All @@ -133,7 +135,7 @@ export function PoolActivityTableRow({ event, keyValue, ...rest }: Props) {
>
<Grid {...rest} py={{ base: 'ms', md: 'md' }} pr="4">
<GridItem>
<EnsOrAddress userAddress={poolEvent.userAddress as `0x${string}`} />
<EnsOrAddress userAddress={poolEvent.userAddress as `0x${string}`} chain={chain} />
</GridItem>
<GridItem>
<HStack>
Expand Down Expand Up @@ -161,7 +163,7 @@ export function PoolActivityTableRow({ event, keyValue, ...rest }: Props) {
<Text>{toCurrency(poolEvent.usdValue)}</Text>
</GridItem>
<GridItem>
<Link target="_blank" href={getBlockExplorerTxUrl(poolEvent.tx)}>
<Link target="_blank" href={getBlockExplorerTxUrl(poolEvent.tx, chain)}>
<HStack gap="0.5" justifyContent="flex-end">
<Text>
{formatDistanceToNow(new Date(secondsToMilliseconds(event[0])), {
Expand Down

0 comments on commit 662c62d

Please sign in to comment.