import React, { useContext } from "react"; import { useParams, Route, Routes } from "react-router-dom"; import { Tab } from "@headlessui/react"; import StandardFrame from "./StandardFrame"; import StandardSubtitle from "./StandardSubtitle"; import ContentFrame from "./ContentFrame"; import NavTab from "./components/NavTab"; import { RuntimeContext } from "./useRuntime"; import { useTxData } from "./useErigonHooks"; import { SelectionContext, useSelection } from "./useSelection"; import { SelectedTransactionContext } from "./useSelectedTransaction"; import { BlockNumberContext } from "./useBlockTagContext"; const Details = React.lazy(() => import("./transaction/Details")); const Logs = React.lazy(() => import("./transaction/Logs")); const Trace = React.lazy(() => import("./transaction/Trace")); const Transaction: React.FC = () => { const { txhash: txHash } = useParams(); if (txHash === undefined) { throw new Error("txhash couldn't be undefined here"); } const { provider } = useContext(RuntimeContext); const txData = useTxData(provider, txHash); const selectionCtx = useSelection(); return ( Transaction Details {txData === null && (
Transaction {txHash} not found.
)} {txData && ( Overview {txData.confirmedData?.blockNumber !== undefined && ( Logs {` (${txData.confirmedData?.logs?.length ?? 0})`} )} Trace } /> } /> } /> )}
); }; export default Transaction;