fix perp market logos
This commit is contained in:
parent
7afcfb897b
commit
c7031f9936
|
@ -19,29 +19,28 @@ const MarketLogos = ({
|
||||||
const logos = useMemo(() => {
|
const logos = useMemo(() => {
|
||||||
if (!group || !mangoTokens.length || !market)
|
if (!group || !mangoTokens.length || !market)
|
||||||
return { baseLogoURI: '', quoteLogoURI: '' }
|
return { baseLogoURI: '', quoteLogoURI: '' }
|
||||||
|
const marketName = market.name.split('-')[0].toLowerCase()
|
||||||
let jupiterBaseToken, jupiterQuoteToken
|
let baseLogoURI, quoteLogoURI
|
||||||
if (market instanceof Serum3Market) {
|
if (market instanceof Serum3Market) {
|
||||||
const baseBank = group.getFirstBankByTokenIndex(market.baseTokenIndex)
|
const baseBank = group.getFirstBankByTokenIndex(market.baseTokenIndex)
|
||||||
const quoteBank = group.getFirstBankByTokenIndex(market.quoteTokenIndex)
|
const quoteBank = group.getFirstBankByTokenIndex(market.quoteTokenIndex)
|
||||||
|
|
||||||
jupiterBaseToken = mangoTokens.find(
|
const jupiterBaseToken = mangoTokens.find(
|
||||||
(t) => t.address === baseBank.mint.toString()
|
(t) => t.address === baseBank.mint.toString()
|
||||||
)
|
)
|
||||||
jupiterQuoteToken = mangoTokens.find(
|
const jupiterQuoteToken = mangoTokens.find(
|
||||||
(t) => t.address === quoteBank.mint.toString()
|
(t) => t.address === quoteBank.mint.toString()
|
||||||
)
|
)
|
||||||
|
|
||||||
|
baseLogoURI = jupiterBaseToken?.logoURI
|
||||||
|
quoteLogoURI = jupiterQuoteToken?.logoURI
|
||||||
} else {
|
} else {
|
||||||
jupiterBaseToken =
|
const jupiterBaseToken =
|
||||||
mangoTokens.find(
|
mangoTokens.find((t) => t.symbol.toLowerCase() === marketName) ||
|
||||||
(t) => t.symbol.toUpperCase() === market.name.split('-')[0]
|
mangoTokens.find((t) => t.symbol.toLowerCase()?.includes(marketName))
|
||||||
) ||
|
|
||||||
mangoTokens.find((t) =>
|
baseLogoURI = `/icons/${marketName}.svg` || jupiterBaseToken?.logoURI
|
||||||
t.symbol.toUpperCase()?.includes(market.name.split('-')[0])
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
const baseLogoURI = jupiterBaseToken ? jupiterBaseToken.logoURI : ''
|
|
||||||
const quoteLogoURI = jupiterQuoteToken ? jupiterQuoteToken.logoURI : ''
|
|
||||||
return {
|
return {
|
||||||
baseLogoURI,
|
baseLogoURI,
|
||||||
quoteLogoURI,
|
quoteLogoURI,
|
||||||
|
|
Loading…
Reference in New Issue