From 9f13f388151c585c6646f624400592467e2de4db Mon Sep 17 00:00:00 2001 From: Adam Gall Date: Thu, 21 Mar 2024 13:14:43 -0400 Subject: [PATCH] Remove last instance of `useAccount` getting chain information --- src/hooks/utils/useAddress.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/hooks/utils/useAddress.ts b/src/hooks/utils/useAddress.ts index 192426e68d..f390ad89c7 100644 --- a/src/hooks/utils/useAddress.ts +++ b/src/hooks/utils/useAddress.ts @@ -1,8 +1,8 @@ import { ethers } from 'ethers'; import { useEffect, useState } from 'react'; -import { useAccount } from 'wagmi'; import { supportsENS } from '../../helpers'; import { useEthersProvider } from '../../providers/Ethers/hooks/useEthersProvider'; +import { useNetworkConfig } from '../../providers/NetworkConfig/NetworkConfigProvider'; import { couldBeENS } from '../../utils/url'; import { CacheKeys, CacheExpiry } from './cache/cacheDefaults'; import { useLocalStorage } from './cache/useLocalStorage'; @@ -14,7 +14,7 @@ const useAddress = (addressInput: string | undefined) => { const [isValidAddress, setIsValidAddress] = useState(); const [isAddressLoading, setIsAddressLoading] = useState(false); const { setValue, getValue } = useLocalStorage(); - const { chain } = useAccount(); + const { chainId } = useNetworkConfig(); useEffect(() => { setIsAddressLoading(true); @@ -43,7 +43,7 @@ const useAddress = (addressInput: string | undefined) => { } // only continue with ENS checks if the chain actually supports ENS - if (chain && !supportsENS(chain.id)) { + if (!supportsENS(chainId)) { return; } @@ -103,7 +103,7 @@ const useAddress = (addressInput: string | undefined) => { .finally(() => { setIsAddressLoading(false); }); - }, [provider, addressInput, getValue, setValue, chain]); + }, [provider, addressInput, getValue, setValue, chainId]); return { address, isValidAddress, isAddressLoading }; };