Skip to content

Commit

Permalink
Merge branch 'master' into eth-custom-dest-4
Browse files Browse the repository at this point in the history
  • Loading branch information
fionnachan authored Oct 16, 2024
2 parents 98ae080 + d5e7548 commit 02b4a3d
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions packages/arb-token-bridge-ui/src/hooks/useAccountIsBlocked.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import { useMemo } from 'react'
import { useAccount, useNetwork } from 'wagmi'
import { useAccount } from 'wagmi'
import useSWRImmutable from 'swr/immutable'

import { ApiResponseSuccess } from '../pages/api/screenings'
import { trackEvent } from '../util/AnalyticsUtils'
import { isNetwork } from '../util/networks'
import { Address } from '../util/AddressUtils'

async function isBlocked(address: Address): Promise<boolean> {
Expand Down Expand Up @@ -40,21 +39,15 @@ async function fetcher(address: Address): Promise<boolean> {

export function useAccountIsBlocked() {
const { address } = useAccount()
const { chain } = useNetwork()

const queryKey = useMemo(() => {
if (typeof address === 'undefined') {
// Don't fetch
return null
}

if (isNetwork(chain?.id ?? 0).isTestnet) {
// Don't fetch
return null
}

return [address.toLowerCase(), 'useAccountIsBlocked']
}, [address, chain?.id])
}, [address])

const { data: isBlocked } = useSWRImmutable<boolean>(
queryKey,
Expand Down

0 comments on commit 02b4a3d

Please sign in to comment.