import {marketApi} from '@/mammon/mammonService'; import {MarketTypePrice, PriceGetter} from './MarketTypePrice'; export const getMammonPrices: PriceGetter = async types => { if (types.length === 0) { return []; } const typesById = new Map(types.map(t => [t.id, t])); const response = await marketApi.currentPrices(types.map(t => t.id)); return response.data.reduce((prices, p) => { const type = typesById.get(p.marketTypeId); if (type) { prices.push({ type, buy: p.buy, sell: p.sell, orderCount: p.orderCount }); } return prices; }, []); };