import React, { useMemo } from "react"; import { TransactionDescription } from "@ethersproject/abi"; import { BigNumber } from "@ethersproject/bignumber"; import { toUtf8String } from "@ethersproject/strings"; import { Tab } from "@headlessui/react"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { faCheckCircle } from "@fortawesome/free-solid-svg-icons/faCheckCircle"; import { faCube } from "@fortawesome/free-solid-svg-icons/faCube"; import { faTimesCircle } from "@fortawesome/free-solid-svg-icons/faTimesCircle"; import ContentFrame from "../ContentFrame"; import InfoRow from "../components/InfoRow"; import BlockLink from "../components/BlockLink"; import BlockConfirmations from "../components/BlockConfirmations"; import AddressHighlighter from "../components/AddressHighlighter"; import DecoratedAddressLink from "../components/DecoratedAddressLink"; import Copy from "../components/Copy"; import Nonce from "../components/Nonce"; import Timestamp from "../components/Timestamp"; import InternalTransactionOperation from "../components/InternalTransactionOperation"; import MethodName from "../components/MethodName"; import TransactionType from "../components/TransactionType"; import RewardSplit from "./RewardSplit"; import GasValue from "../components/GasValue"; import USDValue from "../components/USDValue"; import FormattedBalance from "../components/FormattedBalance"; import ETH2USDValue from "../components/ETH2USDValue"; import TokenTransferItem from "../TokenTransferItem"; import { TransactionData, InternalOperation } from "../types"; import PercentageBar from "../components/PercentageBar"; import ExternalLink from "../components/ExternalLink"; import RelativePosition from "../components/RelativePosition"; import PercentagePosition from "../components/PercentagePosition"; import ModeTab from "../components/ModeTab"; import DecodedParamsTable from "./DecodedParamsTable"; type DetailsProps = { txData: TransactionData; txDesc: TransactionDescription | null | undefined; internalOps?: InternalOperation[]; sendsEthToMiner: boolean; ethUSDPrice: BigNumber | undefined; }; const Details: React.FC = ({ txData, txDesc, internalOps, sendsEthToMiner, ethUSDPrice, }) => { const hasEIP1559 = txData.confirmedData?.blockBaseFeePerGas !== undefined && txData.confirmedData?.blockBaseFeePerGas !== null; const utfInput = useMemo(() => { try { return txData && toUtf8String(txData.data); } catch (err) { console.error("Error while converting input data to string"); console.error(err); return ""; } }, [txData]); return (
{txData.transactionHash}
{txData.confirmedData === undefined ? ( Pending ) : txData.confirmedData.status ? ( Success ) : ( Fail )} {txData.confirmedData && ( <>
)}
{txData.to ? (
) : txData.confirmedData === undefined ? ( Pending contract creation ) : (
)} {internalOps && internalOps.length > 0 && (
{internalOps.map((op, i) => ( ))}
)}
{txData.tokenTransfers.length > 0 && (
{txData.tokenTransfers.map((t, i) => ( ))}
)} Ether{" "} {!txData.value.isZero() && ethUSDPrice && ( )} Type ( EIP-2718 ) } > {txData.type === 2 && ( <> Ether ( {" "} Gwei) Ether ( {" "} Gwei) )} {txData.gasPrice && (
Ether ( Gwei) {sendsEthToMiner && ( Flashbots )}
)} {txData.confirmedData && (
} total={} />
)} {txData.confirmedData && hasEIP1559 && ( {" "} Gwei ( {" "} wei) )} {txData.confirmedData && ( <>
Ether{" "} {ethUSDPrice && ( )}
{hasEIP1559 && }
)} Decoded Raw UTF-8 {txDesc === undefined ? ( <>Waiting for data... ) : txDesc === null ? ( <>No decoded data ) : ( )}