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 { RuntimeContext } from "./useRuntime"; import { useBlockNumberContext } from "./useBlockTagContext"; import { useTokenMetadata } from "./useErigonHooks"; import { useTokenUSDOracle } from "./usePriceOracle"; import { AddressContext, TokenTransfer } from "./types"; type TokenTransferItemProps = { t: TokenTransfer; }; const TokenTransferItem: React.FC = ({ t }) => { const { provider } = useContext(RuntimeContext); const blockNumber = useBlockNumberContext(); const [quote, decimals] = useTokenUSDOracle(provider, blockNumber, t.token); const tokenMeta = useTokenMetadata(provider, t.token); return (
{tokenMeta && quote !== undefined && decimals !== undefined && ( )}
); }; export default React.memo(TokenTransferItem);