import useMangoGroupConfig from '../hooks/useMangoGroupConfig' import useMangoStore from '../stores/useMangoStore' import { getMarketByBaseSymbolAndKind } from '@blockworks-foundation/mango-client' const MarketSelect = () => { const groupConfig = useMangoGroupConfig() const selectedMarket = useMangoStore((s) => s.selectedMarket.config) const setMangoStore = useMangoStore((s) => s.set) const handleChange = (symbol, kind) => { const newMarket = getMarketByBaseSymbolAndKind(groupConfig, symbol, kind) setMangoStore((state) => { state.selectedMarket.current = null state.selectedMarket.config = newMarket }) } return (
MARKETS
{groupConfig.perpMarkets.map((s) => (
handleChange(s.baseSymbol, 'perp')} key={s.publicKey.toBase58()} > {s.name}
))} {groupConfig.spotMarkets.map((s) => (
handleChange(s.baseSymbol, 'spot')} key={s.publicKey.toBase58()} > {s.name}
))}
Go to Mango V1
) } export default MarketSelect