diff --git a/src/Address.tsx b/src/Address.tsx index 3b9b62d..f739e7b 100644 --- a/src/Address.tsx +++ b/src/Address.tsx @@ -100,7 +100,10 @@ const Address: React.FC = () => { return ( {error ? ( - + ) : ( checksummedAddress && ( <> diff --git a/src/components/AddressOrENSNameNotFound.tsx b/src/components/AddressOrENSNameNotFound.tsx index 437aa6c..8cc5059 100644 --- a/src/components/AddressOrENSNameNotFound.tsx +++ b/src/components/AddressOrENSNameNotFound.tsx @@ -4,16 +4,19 @@ import ContentFrame from "../ContentFrame"; type AddressOrENSNameNotFoundProps = { addressOrENSName: string; + supportsENS: boolean; }; const AddressOrENSNameNotFound: React.FC = ({ addressOrENSName, + supportsENS, }) => ( <> Transaction Details
- "{addressOrENSName}" is not an ETH address or ENS name. + "{addressOrENSName}" is not an ETH address + {supportsENS && " or ENS name"}.
diff --git a/src/useResolvedAddresses.ts b/src/useResolvedAddresses.ts index 4870072..93db361 100644 --- a/src/useResolvedAddresses.ts +++ b/src/useResolvedAddresses.ts @@ -48,19 +48,25 @@ export const useAddressOrENS = ( if (!provider) { return; } - const resolveName = async () => { - const resolvedAddress = await provider.resolveName(addressOrName); - if (resolvedAddress !== null) { - setENS(true); - setError(false); - setChecksummedAddress(resolvedAddress); - } else { - setENS(false); - setError(true); - setChecksummedAddress(undefined); - } - }; - resolveName(); + if (provider.network.ensAddress) { + const resolveName = async () => { + const resolvedAddress = await provider.resolveName(addressOrName); + if (resolvedAddress !== null) { + setENS(true); + setError(false); + setChecksummedAddress(resolvedAddress); + } else { + setENS(false); + setError(true); + setChecksummedAddress(undefined); + } + }; + resolveName(); + } else { + setENS(false); + setError(true); + setChecksummedAddress(undefined); + } }, [provider, addressOrName, urlFixer]); return [checksummedAddress, isENS, error];