UNPKG

@ledgerhq/live-common

Version:
19 lines 874 B
import { shallowEqual, useSelector } from "react-redux"; import { selectMarketByCurrency } from "../entities/marketSelectors"; export const useMarketByCurrencies = (currencies) => { return useSelector((state) => { const marketByCurrencies = {}; for (const currency of currencies) { const currencyMarket = selectMarketByCurrency(state, currency.id); if (currencyMarket?.price !== undefined && currencyMarket?.priceChangePercentage24h !== undefined) { marketByCurrencies[currency.id] = { price: currencyMarket.price, priceChangePercentage24h: Math.round(currencyMarket.priceChangePercentage24h * 100) / 100, }; } } return marketByCurrencies; }, shallowEqual); }; //# sourceMappingURL=useMarketByCurrencies.js.map