diff --git a/src/AddressMainPage.tsx b/src/AddressMainPage.tsx index f1c796c..77a3e80 100644 --- a/src/AddressMainPage.tsx +++ b/src/AddressMainPage.tsx @@ -30,8 +30,6 @@ import { ChecksummedAddress } from "./types"; type AddressMainPageProps = {}; const AddressMainPage: React.FC = ({}) => { - const { provider } = useContext(RuntimeContext); - const { addressOrName, direction } = useParams(); if (addressOrName === undefined) { throw new Error("addressOrName couldn't be undefined here"); @@ -55,6 +53,7 @@ const AddressMainPage: React.FC = ({}) => { urlFixer ); + const { provider } = useContext(RuntimeContext); const hasCode = useHasCode(provider, checksummedAddress, "latest"); const addressMetadata = useSourcifyMetadata( hasCode ? checksummedAddress : undefined, diff --git a/src/AddressTransactionByNonce.tsx b/src/AddressTransactionByNonce.tsx index a8ac654..8e4cc2e 100644 --- a/src/AddressTransactionByNonce.tsx +++ b/src/AddressTransactionByNonce.tsx @@ -1,6 +1,7 @@ import React, { useCallback, useContext, useEffect, useState } from "react"; import { useNavigate, useParams, useSearchParams } from "react-router-dom"; import StandardFrame from "./StandardFrame"; +import AddressOrENSNameNotFound from "./components/AddressOrENSNameNotFound"; import AddressOrENSNameInvalidNonce from "./components/AddressOrENSNameInvalidNonce"; import AddressOrENSNameNoTx from "./components/AddressOrENSNameNoTx"; import { useTransactionBySenderAndNonce } from "./useErigonHooks"; @@ -36,7 +37,7 @@ const AddressTransactionByNonce: React.FC = ({ }, [navigate, direction, searchParams] ); - const [checksummedAddress, isENS, error] = useAddressOrENS( + const [checksummedAddress, , ensError] = useAddressOrENS( addressOrName, urlFixer ); @@ -77,12 +78,20 @@ const AddressTransactionByNonce: React.FC = ({ nonce !== undefined && isNaN(nonce) ? undefined : nonce ); + // Invalid ENS + if (ensError) { + return ( + + + + ); + } + // Loading... - if ( - checksummedAddress === undefined || - nonce === undefined || - txHash === undefined - ) { + if (checksummedAddress === undefined || nonce === undefined) { return ; } @@ -107,6 +116,11 @@ const AddressTransactionByNonce: React.FC = ({ ); } + // Valid nonce, waiting tx load + if (txHash === undefined) { + return ; + } + // Valid nonce, but no tx found if (txHash === null) { return (