import React, { Suspense, useContext } from "react"; import { useImage } from "react-image"; import { tokenLogoURL } from "../url"; import { RuntimeContext } from "../useRuntime"; type TokenLogoProps = { address: string; name: string; }; const TokenLogo: React.FC = (props) => ( }> ); const InternalTokenLogo: React.FC = ({ address, name }) => { const { config } = useContext(RuntimeContext); const srcList: string[] = []; if (config) { srcList.push(tokenLogoURL(config.assetsURLPrefix ?? "", address)); } srcList.push("/eth-diamond-black.png"); const { src } = useImage({ srcList }); return (
{`${name}
); }; export default React.memo(TokenLogo);