Handle search for latest nonce on uninitialized addresses
This commit is contained in:
parent
9d7709ca63
commit
c728dd881d
|
@ -2,6 +2,7 @@ import React, { useContext, useEffect, useState } from "react";
|
||||||
import { useNavigate } from "react-router-dom";
|
import { useNavigate } from "react-router-dom";
|
||||||
import StandardFrame from "./StandardFrame";
|
import StandardFrame from "./StandardFrame";
|
||||||
import AddressOrENSNameInvalidNonce from "./components/AddressOrENSNameInvalidNonce";
|
import AddressOrENSNameInvalidNonce from "./components/AddressOrENSNameInvalidNonce";
|
||||||
|
import AddressOrENSNameNoTx from "./components/AddressOrENSNameNoTx";
|
||||||
import { ChecksummedAddress } from "./types";
|
import { ChecksummedAddress } from "./types";
|
||||||
import { transactionURL } from "./url";
|
import { transactionURL } from "./url";
|
||||||
import { useTransactionBySenderAndNonce } from "./useErigonHooks";
|
import { useTransactionBySenderAndNonce } from "./useErigonHooks";
|
||||||
|
@ -37,7 +38,7 @@ const AddressTransactionByNonce: React.FC<AddressTransactionByNonceProps> = ({
|
||||||
// in case of latest
|
// in case of latest
|
||||||
let nonce: number | undefined;
|
let nonce: number | undefined;
|
||||||
if (rawNonce === "latest") {
|
if (rawNonce === "latest") {
|
||||||
if (txCount !== undefined && txCount > 0) {
|
if (txCount !== undefined) {
|
||||||
nonce = txCount - 1;
|
nonce = txCount - 1;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -52,10 +53,20 @@ const AddressTransactionByNonce: React.FC<AddressTransactionByNonceProps> = ({
|
||||||
);
|
);
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
|
||||||
|
// Loading...
|
||||||
if (checksummedAddress === undefined || nonce === undefined) {
|
if (checksummedAddress === undefined || nonce === undefined) {
|
||||||
return <StandardFrame />;
|
return <StandardFrame />;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Address hasn't made the first outbound tx yet
|
||||||
|
if (nonce < 0) {
|
||||||
|
return (
|
||||||
|
<StandardFrame>
|
||||||
|
<AddressOrENSNameNoTx addressOrENSName={checksummedAddress} />
|
||||||
|
</StandardFrame>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
// Garbage nonce
|
// Garbage nonce
|
||||||
if (isNaN(nonce)) {
|
if (isNaN(nonce)) {
|
||||||
return (
|
return (
|
||||||
|
|
|
@ -0,0 +1,24 @@
|
||||||
|
import React from "react";
|
||||||
|
import StandardSubtitle from "../StandardSubtitle";
|
||||||
|
import ContentFrame from "../ContentFrame";
|
||||||
|
import AddressOrENSName from "./AddressOrENSName";
|
||||||
|
|
||||||
|
type AddressOrENSNameNoTxProps = {
|
||||||
|
addressOrENSName: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
const AddressOrENSNameNoTx: React.FC<AddressOrENSNameNoTxProps> = ({
|
||||||
|
addressOrENSName,
|
||||||
|
}) => (
|
||||||
|
<>
|
||||||
|
<StandardSubtitle>Transaction Details</StandardSubtitle>
|
||||||
|
<ContentFrame>
|
||||||
|
<div className="flex py-4 text-sm">
|
||||||
|
<AddressOrENSName address={addressOrENSName} />
|
||||||
|
<span>: no outbound transactions found.</span>
|
||||||
|
</div>
|
||||||
|
</ContentFrame>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
|
||||||
|
export default React.memo(AddressOrENSNameNoTx);
|
Loading…
Reference in New Issue