"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] = {
                    ...(currencyMarket.price && { price: currencyMarket.price }),
                    ...(currencyMarket.priceChangePercentage24h && {
                        priceChangePercentage24h: Math.round(currencyMarket.priceChangePercentage24h * 100) / 100,
                    }),
                };
            }
        }
        return marketByCurrencies;
    });
};
exports.useMarketByCurrencies = useMarketByCurrencies;
//# sourceMappingURL=useMarketByCurrencies.js.map