import React from "react"; import { BigNumber, FixedNumber } from "@ethersproject/bignumber"; import { commify } from "@ethersproject/units"; import { useChainInfo } from "../useChainInfo"; const ETH_FEED_DECIMALS = 8; type USDValueProps = { value: BigNumber | undefined; }; const USDValue: React.FC = ({ value }) => { const { nativeCurrency: { symbol }, } = useChainInfo(); return ( {value ? ( <> $ {commify( FixedNumber.fromValue(value, ETH_FEED_DECIMALS) .round(2) .toString() )} {" "} / {symbol} ) : ( "N/A" )} ); }; export default React.memo(USDValue);