Skip to content

Commit

Permalink
Remove last instance of useAccount getting chain information
Browse files Browse the repository at this point in the history
  • Loading branch information
adamgall committed Mar 21, 2024
1 parent 12b361e commit 9f13f38
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/hooks/utils/useAddress.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -14,7 +14,7 @@ const useAddress = (addressInput: string | undefined) => {
const [isValidAddress, setIsValidAddress] = useState<boolean>();
const [isAddressLoading, setIsAddressLoading] = useState<boolean>(false);
const { setValue, getValue } = useLocalStorage();
const { chain } = useAccount();
const { chainId } = useNetworkConfig();

useEffect(() => {
setIsAddressLoading(true);
Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -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 };
};
Expand Down

0 comments on commit 9f13f38

Please sign in to comment.