import React, { useContext } from "react"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { faCaretRight } from "@fortawesome/free-solid-svg-icons/faCaretRight"; import { faSackDollar } from "@fortawesome/free-solid-svg-icons/faSackDollar"; import TransactionAddress from "./components/TransactionAddress"; import ValueHighlighter from "./components/ValueHighlighter"; import FormattedBalance from "./components/FormattedBalance"; import USDAmount from "./components/USDAmount"; import { AddressContext, ChecksummedAddress, TokenMeta, TokenTransfer, } from "./types"; import { RuntimeContext } from "./useRuntime"; import { useBlockNumberContext } from "./useBlockTagContext"; import { Metadata } from "./sourcify/useSourcify"; import { useTokenUSDOracle } from "./usePriceOracle"; type TokenTransferItemProps = { t: TokenTransfer; tokenMeta?: TokenMeta | null | undefined; metadatas: Record; }; // TODO: handle partial const TokenTransferItem: React.FC = ({ t, tokenMeta, metadatas, }) => { const { provider } = useContext(RuntimeContext); const blockNumber = useBlockNumberContext(); const [quote, decimals] = useTokenUSDOracle(provider, blockNumber, t.token); return (
{tokenMeta && quote !== undefined && decimals !== undefined && ( )}
); }; export default React.memo(TokenTransferItem);