2022-08-22 22:17:04 +00:00
|
|
|
import React from "react";
|
|
|
|
import { useSearchParams } from "react-router-dom";
|
|
|
|
import AddressMainPage from "./AddressMainPage";
|
2021-07-01 18:21:40 +00:00
|
|
|
|
2022-01-31 18:37:29 +00:00
|
|
|
const AddressTransactionByNonce = React.lazy(
|
2022-08-05 21:54:30 +00:00
|
|
|
() => import("./AddressTransactionByNonce")
|
2022-01-31 18:37:29 +00:00
|
|
|
);
|
|
|
|
|
2022-08-22 22:17:04 +00:00
|
|
|
/**
|
|
|
|
* This is the default handler for /address/* URL path.
|
|
|
|
*
|
|
|
|
* It can redirect to different child components depending on search
|
|
|
|
* query params, so it is not possible to use default path routing
|
|
|
|
* mechanisms to declarative-model them.
|
|
|
|
*/
|
2022-01-24 19:18:28 +00:00
|
|
|
const Address: React.FC = () => {
|
2022-01-31 18:37:29 +00:00
|
|
|
// Search address by nonce === transaction @ nonce
|
2022-08-22 22:17:04 +00:00
|
|
|
const [searchParams] = useSearchParams();
|
2022-01-31 18:37:29 +00:00
|
|
|
const rawNonce = searchParams.get("nonce");
|
|
|
|
if (rawNonce !== null) {
|
2022-08-22 22:17:04 +00:00
|
|
|
return <AddressTransactionByNonce rawNonce={rawNonce} />;
|
2022-01-31 18:37:29 +00:00
|
|
|
}
|
|
|
|
|
2022-08-22 22:17:04 +00:00
|
|
|
// Standard address main page with tabs
|
|
|
|
return <AddressMainPage />;
|
2021-07-01 18:21:40 +00:00
|
|
|
};
|
|
|
|
|
2022-01-24 19:18:28 +00:00
|
|
|
export default Address;
|