"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.useInterestRatesByCurrencies = void 0;
const react_redux_1 = require("react-redux");
const interestRateSelectors_1 = require("../entities/interestRateSelectors");
const isValidApyType = (type) => type === "NRR" || type === "APY" || type === "APR";
const useInterestRatesByCurrencies = (currencies) => {
    return (0, react_redux_1.useSelector)(state => {
        const rates = {};
        for (const currency of currencies) {
            const apiRate = (0, interestRateSelectors_1.selectInterestRateByCurrency)(state, currency.id);
            if (apiRate && isValidApyType(apiRate.type)) {
                rates[currency.id] = {
                    value: apiRate.rate,
                    type: apiRate.type,
                };
            }
        }
        return rates;
    });
};
exports.useInterestRatesByCurrencies = useInterestRatesByCurrencies;
//# sourceMappingURL=useInterestRatesByCurrencies.js.map