import useMarketList from '../hooks/useMarketList' import useMangoStore from '../stores/useMangoStore' const MarketSelect = () => { const { spotMarkets } = useMarketList() const selectedMarketName = useMangoStore((s) => s.selectedMarket.name) const selectedMangoGroupMarkets = useMangoStore( (s) => s.selectedMangoGroup.markets ) const setMangoStore = useMangoStore((s) => s.set) const handleChange = (mktName) => { const newMarket = Object.entries(selectedMangoGroupMarkets).find( (m) => m[0] == spotMarkets[mktName] )[1] setMangoStore((state) => { state.selectedMarket.current = newMarket state.selectedMarket.name = mktName state.selectedMarket.address = spotMarkets[mktName] }) } return (