diff --git a/src/Address.tsx b/src/Address.tsx
index 24260c3..2e1d3bb 100644
--- a/src/Address.tsx
+++ b/src/Address.tsx
@@ -88,7 +88,7 @@ const Address: React.FC = () => {
? metadatas[checksummedAddress]
: undefined;
- const { faucets } = useChainInfo();
+ const { network, faucets } = useChainInfo();
// Search address by nonce === transaction @ nonce
const rawNonce = searchParams.get("nonce");
@@ -124,7 +124,7 @@ const Address: React.FC = () => {
{/* Only display faucets for testnets who actually have any */}
- {faucets && faucets.length > 0 && (
+ {network === "testnet" && faucets && faucets.length > 0 && (
)}
{isENS && (
diff --git a/src/Faucets.tsx b/src/Faucets.tsx
index d9c1eab..9e4527d 100644
--- a/src/Faucets.tsx
+++ b/src/Faucets.tsx
@@ -8,17 +8,21 @@ import ContentFrame from "./ContentFrame";
import StandardFrame from "./StandardFrame";
import StandardSubtitle from "./StandardSubtitle";
import { useChainInfo } from "./useChainInfo";
+
const Faucets: React.FC = () => {
- const { faucets } = useChainInfo();
+ const { network, faucets } = useChainInfo();
const loc = useLocation();
const urls = useMemo(() => {
const s = new URLSearchParams(loc.search);
const address = s.get("address");
- const _urls = faucets.map((u) =>
- // eslint-disable-next-line no-template-curly-in-string
- address !== null ? u.replaceAll("${ADDRESS}", address) : u
- );
+ const _urls: string[] =
+ network === "testnet"
+ ? faucets.map((u) =>
+ // eslint-disable-next-line no-template-curly-in-string
+ address !== null ? u.replaceAll("${ADDRESS}", address) : u
+ )
+ : [];
// Shuffle faucets to avoid UI bias
for (let i = _urls.length - 1; i > 0; i--) {
@@ -27,7 +31,7 @@ const Faucets: React.FC = () => {
}
return _urls;
- }, [faucets, loc]);
+ }, [network, faucets, loc]);
return (
diff --git a/src/useChainInfo.ts b/src/useChainInfo.ts
index c737c68..dec3798 100644
--- a/src/useChainInfo.ts
+++ b/src/useChainInfo.ts
@@ -3,6 +3,7 @@ import { chainInfoURL } from "./url";
import { OtterscanRuntime } from "./useRuntime";
export type ChainInfo = {
+ network: string | undefined;
faucets: string[];
nativeCurrency: {
name: string;
@@ -12,6 +13,7 @@ export type ChainInfo = {
};
export const defaultChainInfo: ChainInfo = {
+ network: undefined,
faucets: [],
nativeCurrency: {
name: "Ether",