@ledgerhq/live-common
Version:
Common ground for the Ledger Live apps
25 lines • 1.32 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.useGetCounterValueIdsSortedByMarketCapQuery = exports.counterValuesApi = void 0;
const react_1 = require("@reduxjs/toolkit/query/react");
const live_env_1 = require("@ledgerhq/live-env");
const schema_1 = require("./schema");
const onSchemaFailure_1 = require("./onSchemaFailure");
const THIRTY_MINUTES = 30 * 60;
const apiName = "counterValuesApi";
exports.counterValuesApi = (0, react_1.createApi)({
reducerPath: apiName,
baseQuery: (0, react_1.fetchBaseQuery)({ baseUrl: (0, live_env_1.getEnv)("LEDGER_COUNTERVALUES_API") }),
tagTypes: [schema_1.Tags.CounterValueIdsSortedByMarketCap],
onSchemaFailure: (error, { endpoint }) => (0, onSchemaFailure_1.onSchemaFailure)({ apiName, endpoint, error }),
endpoints: build => ({
getCounterValueIdsSortedByMarketCap: build.query({
query: () => "/v3/supported/crypto",
providesTags: [schema_1.Tags.CounterValueIdsSortedByMarketCap],
keepUnusedDataFor: THIRTY_MINUTES,
responseSchema: schema_1.counterValueIdsSortedByMarketCapSchema,
}),
}),
});
exports.useGetCounterValueIdsSortedByMarketCapQuery = exports.counterValuesApi.useGetCounterValueIdsSortedByMarketCapQuery;
//# sourceMappingURL=api.js.map