import React, { useMemo } from "react";
import { useInterestRatesByCurrencies } from "../../../dada-client/hooks/useInterestRatesByCurrencies";
import { getInterestRateForAsset } from "../../utils/getInterestRateForAsset";
const createApyItem = ({ value, type, ApyIndicator, }) => React.createElement(ApyIndicator, { value: value, type: type });
export const useLeftApyModule = (currencies, ApyIndicator) => {
    const interestRates = useInterestRatesByCurrencies(currencies);
    return useMemo(() => {
        return currencies.map(currency => {
            const { interestRate, interestRatePercentageRounded } = getInterestRateForAsset(currency, interestRates);
            if (!interestRate || interestRatePercentageRounded <= 0) {
                return currency;
            }
            return {
                ...currency,
                leftElement: createApyItem({
                    value: interestRatePercentageRounded,
                    type: interestRate.type,
                    ApyIndicator,
                }),
            };
        });
    }, [currencies, interestRates, ApyIndicator]);
};
//# sourceMappingURL=useLeftApyModule.js.map