UNPKG

@ledgerhq/live-common

Version:
23 lines 1.08 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.useMarketByCurrencies = void 0; const react_redux_1 = require("react-redux"); const marketSelectors_1 = require("../entities/marketSelectors"); const useMarketByCurrencies = (currencies) => { return (0, react_redux_1.useSelector)((state) => { const marketByCurrencies = {}; for (const currency of currencies) { const currencyMarket = (0, marketSelectors_1.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; }, react_redux_1.shallowEqual); }; exports.useMarketByCurrencies = useMarketByCurrencies; //# sourceMappingURL=useMarketByCurrencies.js.map