diff --git a/src/TokenTransferItem.tsx b/src/TokenTransferItem.tsx index 2cf91a0..940d9e2 100644 --- a/src/TokenTransferItem.tsx +++ b/src/TokenTransferItem.tsx @@ -1,4 +1,4 @@ -import React from "react"; +import React, { useContext } from "react"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { faCaretRight } from "@fortawesome/free-solid-svg-icons/faCaretRight"; import TransactionAddress from "./components/TransactionAddress"; @@ -9,13 +9,17 @@ import { ChecksummedAddress, TokenMeta, TokenTransfer, + TransactionData, } from "./types"; +import { RuntimeContext } from "./useRuntime"; +import { useHasCode } from "./useErigonHooks"; import { Metadata } from "./sourcify/useSourcify"; type TokenTransferItemProps = { t: TokenTransfer; tokenMeta?: TokenMeta | null | undefined; metadatas: Record; + txData: TransactionData; }; // TODO: handle partial @@ -23,42 +27,59 @@ const TokenTransferItem: React.FC = ({ t, tokenMeta, metadatas, -}) => ( -
- - - -
-
- From - -
-
- To - -
-
- For - - - - - - + txData, +}) => { + const { provider } = useContext(RuntimeContext); + const fromHasCode = useHasCode( + provider, + t.from, + txData.confirmedData ? txData.confirmedData.blockNumber - 1 : undefined + ); + const toHasCode = useHasCode( + provider, + t.to, + txData.confirmedData ? txData.confirmedData.blockNumber - 1 : undefined + ); + + return ( +
+ + + +
+
+ From + +
+
+ To + +
+
+ For + + + + + + +
-
-); + ); +}; export default React.memo(TokenTransferItem); diff --git a/src/transaction/Details.tsx b/src/transaction/Details.tsx index 258cb84..fd8acab 100644 --- a/src/transaction/Details.tsx +++ b/src/transaction/Details.tsx @@ -314,6 +314,7 @@ const Details: React.FC = ({ t={t} tokenMeta={txData.tokenMetas[t.token]} metadatas={metadatas} + txData={txData} /> ))}