Merge branch 'feature/disable-ens-when-not-supported' into develop
This commit is contained in:
commit
eb32a7bb77
|
@ -100,7 +100,10 @@ const Address: React.FC = () => {
|
|||
return (
|
||||
<StandardFrame>
|
||||
{error ? (
|
||||
<AddressOrENSNameNotFound addressOrENSName={addressOrName} />
|
||||
<AddressOrENSNameNotFound
|
||||
addressOrENSName={addressOrName}
|
||||
supportsENS={provider?.network.ensAddress !== undefined}
|
||||
/>
|
||||
) : (
|
||||
checksummedAddress && (
|
||||
<>
|
||||
|
|
|
@ -44,7 +44,9 @@ const Header: React.FC = () => {
|
|||
className="w-full border-t border-b border-l rounded-l focus:outline-none px-2 py-1 text-sm"
|
||||
type="text"
|
||||
size={60}
|
||||
placeholder='Type "/" to search by address / txn hash / block number / ENS name'
|
||||
placeholder={`Type "/" to search by address / txn hash / block number${
|
||||
provider?.network.ensAddress ? " / ENS name" : ""
|
||||
}`}
|
||||
onChange={handleChange}
|
||||
ref={searchRef}
|
||||
/>
|
||||
|
|
|
@ -39,7 +39,9 @@ const Home: React.FC = () => {
|
|||
className="w-full border-l border-t border-b rounded-l focus:outline-none px-2 py-1"
|
||||
type="text"
|
||||
size={50}
|
||||
placeholder="Search by address / txn hash / block number / ENS name"
|
||||
placeholder={`Search by address / txn hash / block number${
|
||||
provider?.network.ensAddress ? " / ENS name" : ""
|
||||
}`}
|
||||
onChange={handleChange}
|
||||
ref={searchRef}
|
||||
autoFocus
|
||||
|
|
|
@ -4,16 +4,19 @@ import ContentFrame from "../ContentFrame";
|
|||
|
||||
type AddressOrENSNameNotFoundProps = {
|
||||
addressOrENSName: string;
|
||||
supportsENS: boolean;
|
||||
};
|
||||
|
||||
const AddressOrENSNameNotFound: React.FC<AddressOrENSNameNotFoundProps> = ({
|
||||
addressOrENSName,
|
||||
supportsENS,
|
||||
}) => (
|
||||
<>
|
||||
<StandardSubtitle>Transaction Details</StandardSubtitle>
|
||||
<ContentFrame>
|
||||
<div className="py-4 text-sm">
|
||||
"{addressOrENSName}" is not an ETH address or ENS name.
|
||||
"{addressOrENSName}" is not an ETH address
|
||||
{supportsENS && " or ENS name"}.
|
||||
</div>
|
||||
</ContentFrame>
|
||||
</>
|
||||
|
|
|
@ -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];
|
||||
|
|
Loading…
Reference in New Issue