fix ticker

This commit is contained in:
saml33 2023-05-05 11:11:37 +10:00
parent e0ad0bb338
commit fc3277a5e7
1 changed files with 19 additions and 11 deletions

View File

@ -213,23 +213,31 @@ export default {
}
}
const group = mangoStore.getState().group
let ticker = mangoStore.getState().selectedMarket.name
const spotMarkets = mangoStore.getState().serumMarkets
const isSpotMarket = spotMarkets.find(
(market) => market.serumMarketExternal.toString() === symbolAddress
)
let ticker
if (group && symbolAddress) {
const serumMktName = group.getSerum3MarketByExternalMarket(
new PublicKey(symbolAddress)
)?.name
const perpMktName = Array.from(
group.perpMarketsMapByMarketIndex.values()
).find(
(perpMarket) => perpMarket.publicKey.toString() === symbolAddress
)?.name
ticker = serumMktName || perpMktName || ticker
if (isSpotMarket) {
const serumMktName = group.getSerum3MarketByExternalMarket(
new PublicKey(symbolAddress)
)?.name
ticker = serumMktName
} else {
const perpMktName = Array.from(
group.perpMarketsMapByMarketIndex.values()
).find(
(perpMarket) => perpMarket.publicKey.toString() === symbolAddress
)?.name
ticker = perpMktName
}
}
const symbolInfo: SymbolInfo = {
address: symbolItem.address,
ticker: symbolItem.address,
name: symbolItem.symbol || symbolItem.address,
name: ticker || symbolItem.address,
description: ticker || symbolItem.address,
type: symbolItem.type,
session: '24x7',