diff --git a/apps/web/src/components/common/TokenIcon/index.tsx b/apps/web/src/components/common/TokenIcon/index.tsx index a3a64d80ae..690b9faec7 100644 --- a/apps/web/src/components/common/TokenIcon/index.tsx +++ b/apps/web/src/components/common/TokenIcon/index.tsx @@ -1,8 +1,11 @@ -import { type ReactElement } from 'react' +import { memo, type ReactElement } from 'react' import ImageFallback from '../ImageFallback' import css from './styles.module.css' const FALLBACK_ICON = '/images/common/token-placeholder.svg' +const COINGECKO_URL = 'https://assets.coingecko.com/' +const COINGECKO_THUMB = '/thumb/' +const COINGECKO_SMALL = '/small/' const TokenIcon = ({ logoUri, @@ -15,15 +18,26 @@ const TokenIcon = ({ size?: number fallbackSrc?: string }): ReactElement => { + let crossOrigin = false + let src = logoUri + + if (logoUri?.startsWith(COINGECKO_URL)) { + src = logoUri?.replace(COINGECKO_THUMB, COINGECKO_SMALL) + crossOrigin = true + } + return ( ) } -export default TokenIcon +export default memo(TokenIcon)