UNPKG

@ledgerhq/live-common

Version:
19 lines 768 B
import { useSelector } from "react-redux"; import { selectInterestRateByCurrency } from "../entities/interestRateSelectors"; const isValidApyType = (type) => type === "NRR" || type === "APY" || type === "APR"; export const useInterestRatesByCurrencies = (currencies) => { return useSelector((state) => { const rates = {}; for (const currency of currencies) { const apiRate = selectInterestRateByCurrency(state, currency.id); if (apiRate && isValidApyType(apiRate.type)) { rates[currency.id] = { value: apiRate.rate, type: apiRate.type, }; } } return rates; }); }; //# sourceMappingURL=useInterestRatesByCurrencies.js.map