diff --git a/src/TokenTransferItem.tsx b/src/TokenTransferItem.tsx index d28a538..5b9fc72 100644 --- a/src/TokenTransferItem.tsx +++ b/src/TokenTransferItem.tsx @@ -6,25 +6,26 @@ import ValueHighlighter from "./components/ValueHighlighter"; import FormattedBalance from "./components/FormattedBalance"; import { AddressContext, + ChecksummedAddress, TokenMeta, TokenTransfer, - TransactionData, } from "./types"; import { ResolvedAddresses } from "./api/address-resolver"; +import { Metadata } from "./useSourcify"; type TokenTransferItemProps = { t: TokenTransfer; - txData: TransactionData; tokenMeta?: TokenMeta | undefined; resolvedAddresses: ResolvedAddresses | undefined; + metadatas: Record; }; // TODO: handle partial const TokenTransferItem: React.FC = ({ t, - txData, tokenMeta, resolvedAddresses, + metadatas, }) => (
@@ -37,6 +38,7 @@ const TokenTransferItem: React.FC = ({ address={t.from} addressCtx={AddressContext.FROM} resolvedAddresses={resolvedAddresses} + metadata={metadatas[t.from]} />
@@ -45,6 +47,7 @@ const TokenTransferItem: React.FC = ({ address={t.to} addressCtx={AddressContext.TO} resolvedAddresses={resolvedAddresses} + metadata={metadatas[t.to]} />
@@ -60,6 +63,7 @@ const TokenTransferItem: React.FC = ({
diff --git a/src/components/InternalCreate.tsx b/src/components/InternalCreate.tsx index 7a723ce..e086e9d 100644 --- a/src/components/InternalCreate.tsx +++ b/src/components/InternalCreate.tsx @@ -1,45 +1,44 @@ import React from "react"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { faAngleRight } from "@fortawesome/free-solid-svg-icons/faAngleRight"; +import TransactionAddress from "./TransactionAddress"; import AddressHighlighter from "./AddressHighlighter"; import DecoratedAddressLink from "./DecoratedAddressLink"; -import { TransactionData, InternalOperation } from "../types"; +import { InternalOperation } from "../types"; +import { ResolvedAddresses } from "../api/address-resolver"; type InternalCreateProps = { - txData: TransactionData; internalOp: InternalOperation; + resolvedAddresses: ResolvedAddresses | undefined; }; const InternalCreate: React.FC = ({ - txData, internalOp, -}) => { - return ( - <> -
- - CREATE - - Contract -
- - - -
- - (Creator:{" "} - - - - ) - -
- - ); -}; + resolvedAddresses, +}) => ( +
+ + CREATE + + Contract +
+ + + +
+ + (Creator:{" "} + + ) + +
+); -export default React.memo(InternalCreate); +export default InternalCreate; diff --git a/src/components/InternalSelfDestruct.tsx b/src/components/InternalSelfDestruct.tsx index 007fb32..794b987 100644 --- a/src/components/InternalSelfDestruct.tsx +++ b/src/components/InternalSelfDestruct.tsx @@ -1,52 +1,57 @@ -import React, { useContext } from "react"; +import React from "react"; import { formatEther } from "@ethersproject/units"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { faAngleRight } from "@fortawesome/free-solid-svg-icons/faAngleRight"; import AddressHighlighter from "./AddressHighlighter"; import DecoratedAddressLink from "./DecoratedAddressLink"; -import { RuntimeContext } from "../useRuntime"; import { TransactionData, InternalOperation } from "../types"; - -const CHI_ADDRESS = "0x0000000000004946c0e9F43F4Dee607b0eF1fA1c"; -const GST2_ADDRESS = "0x0000000000b3F879cb30FE243b4Dfee438691c04"; +import { ResolvedAddresses } from "../api/address-resolver"; +import TransactionAddress from "./TransactionAddress"; type InternalSelfDestructProps = { txData: TransactionData; internalOp: InternalOperation; + resolvedAddresses: ResolvedAddresses | undefined; }; const InternalSelfDestruct: React.FC = ({ txData, internalOp, + resolvedAddresses, }) => { - const { provider } = useContext(RuntimeContext); - const network = provider?.network; - const toMiner = txData.confirmedData?.miner !== undefined && internalOp.to === txData.confirmedData.miner; return ( <> -
+
SELF DESTRUCT Contract
- +
- {network?.chainId === 1 && internalOp.to === CHI_ADDRESS && ( - (Chi Gastoken) - )} - {network?.chainId === 1 && internalOp.to === GST2_ADDRESS && ( - (GST2 Gastoken) + {internalOp.value.isZero() && ( +
+ (To:{" "} + + ) +
)}
{!internalOp.value.isZero() && ( -
+
TRANSFER @@ -59,7 +64,11 @@ const InternalSelfDestruct: React.FC = ({ toMiner ? "rounded px-2 py-1 bg-yellow-100" : "" }`} > - +
@@ -69,4 +78,4 @@ const InternalSelfDestruct: React.FC = ({ ); }; -export default React.memo(InternalSelfDestruct); +export default InternalSelfDestruct; diff --git a/src/components/InternalTransactionOperation.tsx b/src/components/InternalTransactionOperation.tsx index 7de3bb2..f167eb5 100644 --- a/src/components/InternalTransactionOperation.tsx +++ b/src/components/InternalTransactionOperation.tsx @@ -22,11 +22,18 @@ const InternalTransactionOperation: React.FC /> )} {internalOp.type === OperationType.SELF_DESTRUCT && ( - + )} {(internalOp.type === OperationType.CREATE || internalOp.type === OperationType.CREATE2) && ( - + )} ); diff --git a/src/components/InternalTransfer.tsx b/src/components/InternalTransfer.tsx index 2958452..bf46778 100644 --- a/src/components/InternalTransfer.tsx +++ b/src/components/InternalTransfer.tsx @@ -26,7 +26,7 @@ const InternalTransfer: React.FC = ({ internalOp.to === txData.confirmedData.miner; return ( -
+
TRANSFER @@ -44,6 +44,7 @@ const InternalTransfer: React.FC = ({ miner={fromMiner} txFrom={internalOp.from === txData.from} txTo={internalOp.from === txData.to} + resolvedAddresses={resolvedAddresses} />
@@ -61,6 +62,7 @@ const InternalTransfer: React.FC = ({ miner={toMiner} txFrom={internalOp.to === txData.from} txTo={internalOp.to === txData.to} + resolvedAddresses={resolvedAddresses} />
@@ -69,4 +71,4 @@ const InternalTransfer: React.FC = ({ ); }; -export default React.memo(InternalTransfer); +export default InternalTransfer; diff --git a/src/transaction/Details.tsx b/src/transaction/Details.tsx index 37226f7..0b474af 100644 --- a/src/transaction/Details.tsx +++ b/src/transaction/Details.tsx @@ -95,6 +95,11 @@ const Details: React.FC = ({ if (txData.confirmedData?.createdContractAddress) { _addresses.push(txData.confirmedData.createdContractAddress); } + for (const t of txData.tokenTransfers) { + _addresses.push(t.from); + _addresses.push(t.to); + _addresses.push(t.token); + } return _addresses; }, [txData]); const { sourcifySource } = useAppConfigContext(); @@ -201,7 +206,7 @@ const Details: React.FC = ({
)} {internalOps && internalOps.length > 0 && ( -
+
{internalOps.map((op, i) => ( = ({ )} {txData.tokenTransfers.length > 0 && ( -
- {txData.tokenTransfers.map((t, i) => ( - - ))} -
+ {txData.tokenTransfers.map((t, i) => ( + + ))}
)} @@ -257,24 +260,16 @@ const Details: React.FC = ({ {txData.type === 2 && ( <> - - Ether ( - {" "} - Gwei) - + Ether ( + {" "} + Gwei) - - Ether ( - {" "} - Gwei) - + Ether ( + Gwei) )} @@ -316,18 +311,16 @@ const Details: React.FC = ({ )} {txData.confirmedData && hasEIP1559 && ( - - {" "} - Gwei ( - {" "} - wei) - + {" "} + Gwei ( + {" "} + wei) )} {txData.confirmedData && (