Fix invalid nonce handling
This commit is contained in:
parent
17194c089a
commit
5abf171be9
|
@ -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 (
|
||||
<AddressTransactionByNonce
|
||||
checksummedAddress={checksummedAddress}
|
||||
nonce={nonce}
|
||||
rawNonce={rawNonce}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
|
|
@ -9,36 +9,34 @@ import { RuntimeContext } from "./useRuntime";
|
|||
|
||||
type AddressTransactionByNonceProps = {
|
||||
checksummedAddress: ChecksummedAddress | undefined;
|
||||
nonce: number | undefined;
|
||||
rawNonce: string;
|
||||
};
|
||||
|
||||
const AddressTransactionByNonce: React.FC<AddressTransactionByNonceProps> = ({
|
||||
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 (
|
||||
<StandardFrame>
|
||||
<AddressOrENSNameInvalidNonce
|
||||
addressOrENSName={checksummedAddress}
|
||||
nonce={"undefined"}
|
||||
nonce={rawNonce}
|
||||
/>
|
||||
</StandardFrame>
|
||||
);
|
||||
}
|
||||
if (
|
||||
checksummedAddress !== undefined &&
|
||||
nonce !== undefined &&
|
||||
txHash === null
|
||||
) {
|
||||
if (checksummedAddress !== undefined && !isNaN(nonce) && txHash === null) {
|
||||
return (
|
||||
<StandardFrame>
|
||||
<AddressOrENSNameInvalidNonce
|
||||
|
|
Loading…
Reference in New Issue