From c7031f9936fb4ff26e3f3d0abb33f8493fb8bb8c Mon Sep 17 00:00:00 2001 From: saml33 Date: Mon, 3 Jul 2023 11:04:46 +1000 Subject: [PATCH] fix perp market logos --- components/trade/MarketLogos.tsx | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/components/trade/MarketLogos.tsx b/components/trade/MarketLogos.tsx index eef9054d..ef4f3361 100644 --- a/components/trade/MarketLogos.tsx +++ b/components/trade/MarketLogos.tsx @@ -19,29 +19,28 @@ const MarketLogos = ({ const logos = useMemo(() => { if (!group || !mangoTokens.length || !market) return { baseLogoURI: '', quoteLogoURI: '' } - - let jupiterBaseToken, jupiterQuoteToken + const marketName = market.name.split('-')[0].toLowerCase() + let baseLogoURI, quoteLogoURI if (market instanceof Serum3Market) { const baseBank = group.getFirstBankByTokenIndex(market.baseTokenIndex) const quoteBank = group.getFirstBankByTokenIndex(market.quoteTokenIndex) - jupiterBaseToken = mangoTokens.find( + const jupiterBaseToken = mangoTokens.find( (t) => t.address === baseBank.mint.toString() ) - jupiterQuoteToken = mangoTokens.find( + const jupiterQuoteToken = mangoTokens.find( (t) => t.address === quoteBank.mint.toString() ) + + baseLogoURI = jupiterBaseToken?.logoURI + quoteLogoURI = jupiterQuoteToken?.logoURI } else { - jupiterBaseToken = - mangoTokens.find( - (t) => t.symbol.toUpperCase() === market.name.split('-')[0] - ) || - mangoTokens.find((t) => - t.symbol.toUpperCase()?.includes(market.name.split('-')[0]) - ) + const jupiterBaseToken = + mangoTokens.find((t) => t.symbol.toLowerCase() === marketName) || + mangoTokens.find((t) => t.symbol.toLowerCase()?.includes(marketName)) + + baseLogoURI = `/icons/${marketName}.svg` || jupiterBaseToken?.logoURI } - const baseLogoURI = jupiterBaseToken ? jupiterBaseToken.logoURI : '' - const quoteLogoURI = jupiterQuoteToken ? jupiterQuoteToken.logoURI : '' return { baseLogoURI, quoteLogoURI,