diff --git a/src/Address.tsx b/src/Address.tsx index da1f959..3b9b62d 100644 --- a/src/Address.tsx +++ b/src/Address.tsx @@ -89,16 +89,10 @@ const Address: React.FC = () => { // Search address by nonce === transaction @ nonce const rawNonce = searchParams.get("nonce"); if (rawNonce !== null) { - let nonce: number | undefined = undefined; - try { - nonce = parseInt(rawNonce); - } catch (err) { - // ignore - } return ( ); } diff --git a/src/AddressTransactionByNonce.tsx b/src/AddressTransactionByNonce.tsx index c720bd9..1478092 100644 --- a/src/AddressTransactionByNonce.tsx +++ b/src/AddressTransactionByNonce.tsx @@ -9,36 +9,34 @@ import { RuntimeContext } from "./useRuntime"; type AddressTransactionByNonceProps = { checksummedAddress: ChecksummedAddress | undefined; - nonce: number | undefined; + rawNonce: string; }; const AddressTransactionByNonce: React.FC = ({ checksummedAddress, - nonce, + rawNonce, }) => { const { provider } = useContext(RuntimeContext); + + const nonce = parseInt(rawNonce, 10); const txHash = useTransactionBySenderAndNonce( provider, checksummedAddress, - nonce + isNaN(nonce) ? undefined : nonce ); const navigate = useNavigate(); - if (checksummedAddress !== undefined && nonce === undefined) { + if (checksummedAddress !== undefined && isNaN(nonce)) { return ( ); } - if ( - checksummedAddress !== undefined && - nonce !== undefined && - txHash === null - ) { + if (checksummedAddress !== undefined && !isNaN(nonce) && txHash === null) { return (