"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.useFetchCurrencyAll = void 0;
const featureFlags_1 = require("../../../../featureFlags");
const useAPI_1 = require("../../../../hooks/useAPI");
const v5_1 = require("../../api/v5");
const constants_1 = require("./constants");
const useFilteredProviders_1 = require("./useFilteredProviders");
function useFetchCurrencyAll() {
    const fetchAdditionalCoins = (0, featureFlags_1.useFeature)("fetchAdditionalCoins");
    const { providers, error } = (0, useFilteredProviders_1.useFilteredProviders)();
    const { data, ...rest } = (0, useAPI_1.useAPI)({
        queryFn: v5_1.fetchCurrencyAll,
        queryProps: {
            additionalCoinsFlag: fetchAdditionalCoins?.enabled,
            providers,
        },
        staleTimeout: constants_1.FETCH_CURRENCIES_TIMEOUT_MS,
        enabled: !error && providers.length > 0,
    });
    return {
        ...rest,
        data: data ?? [],
    };
}
exports.useFetchCurrencyAll = useFetchCurrencyAll;
//# sourceMappingURL=useFetchCurrencyAll.js.map