@ledgerhq/live-common 34.35.0-nightly.1 → 34.35.0-nightly.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/families/hedera/logic.d.ts +2 -0
- package/lib/families/hedera/logic.d.ts.map +1 -0
- package/lib/families/hedera/logic.js +19 -0
- package/lib/families/hedera/logic.js.map +1 -0
- package/lib/market/hooks/useLargeMoverChartData.d.ts +18 -0
- package/lib/market/hooks/useLargeMoverChartData.d.ts.map +1 -0
- package/lib/market/hooks/useLargeMoverChartData.js +28 -0
- package/lib/market/hooks/useLargeMoverChartData.js.map +1 -0
- package/lib/market/hooks/useLargeMoverCurrencies.d.ts +13 -0
- package/lib/market/hooks/useLargeMoverCurrencies.d.ts.map +1 -0
- package/lib/market/hooks/useLargeMoverCurrencies.js +29 -0
- package/lib/market/hooks/useLargeMoverCurrencies.js.map +1 -0
- package/lib-es/families/hedera/logic.d.ts +2 -0
- package/lib-es/families/hedera/logic.d.ts.map +1 -0
- package/lib-es/families/hedera/logic.js +3 -0
- package/lib-es/families/hedera/logic.js.map +1 -0
- package/lib-es/market/hooks/useLargeMoverChartData.d.ts +18 -0
- package/lib-es/market/hooks/useLargeMoverChartData.d.ts.map +1 -0
- package/lib-es/market/hooks/useLargeMoverChartData.js +24 -0
- package/lib-es/market/hooks/useLargeMoverChartData.js.map +1 -0
- package/lib-es/market/hooks/useLargeMoverCurrencies.d.ts +13 -0
- package/lib-es/market/hooks/useLargeMoverCurrencies.d.ts.map +1 -0
- package/lib-es/market/hooks/useLargeMoverCurrencies.js +25 -0
- package/lib-es/market/hooks/useLargeMoverCurrencies.js.map +1 -0
- package/package.json +23 -23
- package/src/families/hedera/logic.ts +2 -0
- package/src/market/hooks/useLargeMoverChartData.ts +38 -0
- package/src/market/hooks/useLargeMoverCurrencies.ts +36 -0
- package/lib/market/hooks/useLargeMoverDataProvider.d.ts +0 -17
- package/lib/market/hooks/useLargeMoverDataProvider.d.ts.map +0 -1
- package/lib/market/hooks/useLargeMoverDataProvider.js +0 -48
- package/lib/market/hooks/useLargeMoverDataProvider.js.map +0 -1
- package/lib-es/market/hooks/useLargeMoverDataProvider.d.ts +0 -17
- package/lib-es/market/hooks/useLargeMoverDataProvider.d.ts.map +0 -1
- package/lib-es/market/hooks/useLargeMoverDataProvider.js +0 -44
- package/lib-es/market/hooks/useLargeMoverDataProvider.js.map +0 -1
- package/src/market/hooks/useLargeMoverDataProvider.ts +0 -70
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"logic.d.ts","sourceRoot":"","sources":["../../../src/families/hedera/logic.ts"],"names":[],"mappings":"AACA,cAAc,6BAA6B,CAAC"}
|
@@ -0,0 +1,19 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
3
|
+
if (k2 === undefined) k2 = k;
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
7
|
+
}
|
8
|
+
Object.defineProperty(o, k2, desc);
|
9
|
+
}) : (function(o, m, k, k2) {
|
10
|
+
if (k2 === undefined) k2 = k;
|
11
|
+
o[k2] = m[k];
|
12
|
+
}));
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
15
|
+
};
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
17
|
+
// Encapsulate for LLD & LLM
|
18
|
+
__exportStar(require("@ledgerhq/coin-hedera/logic"), exports);
|
19
|
+
//# sourceMappingURL=logic.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"logic.js","sourceRoot":"","sources":["../../../src/families/hedera/logic.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4BAA4B;AAC5B,8DAA4C"}
|
@@ -0,0 +1,18 @@
|
|
1
|
+
import { MarketCoinDataChart } from "../utils/types";
|
2
|
+
type UseLargeMoverChartDataParams = {
|
3
|
+
ids: string[];
|
4
|
+
counterCurrency: string;
|
5
|
+
range: string;
|
6
|
+
};
|
7
|
+
export declare const useLargeMoverChartData: ({ ids, counterCurrency, range, }: UseLargeMoverChartDataParams) => {
|
8
|
+
chartDataArray: {
|
9
|
+
idChartData: string;
|
10
|
+
chartData: MarketCoinDataChart | undefined;
|
11
|
+
isLoading: boolean;
|
12
|
+
isError: boolean;
|
13
|
+
}[];
|
14
|
+
loadingChart: boolean;
|
15
|
+
errorChart: boolean;
|
16
|
+
};
|
17
|
+
export {};
|
18
|
+
//# sourceMappingURL=useLargeMoverChartData.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"useLargeMoverChartData.d.ts","sourceRoot":"","sources":["../../../src/market/hooks/useLargeMoverChartData.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAErD,KAAK,4BAA4B,GAAG;IAClC,GAAG,EAAE,MAAM,EAAE,CAAC;IACd,eAAe,EAAE,MAAM,CAAC;IACxB,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,eAAO,MAAM,sBAAsB,qCAIhC,4BAA4B;;;;;;;;;CAqB9B,CAAC"}
|
@@ -0,0 +1,28 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.useLargeMoverChartData = void 0;
|
4
|
+
const react_query_1 = require("@tanstack/react-query");
|
5
|
+
const api_1 = require("../api");
|
6
|
+
const queryKeys_1 = require("../utils/queryKeys");
|
7
|
+
const timers_1 = require("../utils/timers");
|
8
|
+
const useLargeMoverChartData = ({ ids, counterCurrency, range, }) => {
|
9
|
+
const chartQueries = (0, react_query_1.useQueries)({
|
10
|
+
queries: ids.map(id => ({
|
11
|
+
queryKey: [queryKeys_1.QUERY_KEY.CurrencyChartData, id, counterCurrency, range],
|
12
|
+
queryFn: () => (0, api_1.fetchCurrencyChartData)({ id, counterCurrency, range }),
|
13
|
+
refetchInterval: timers_1.REFETCH_TIME_ONE_MINUTE * timers_1.BASIC_REFETCH,
|
14
|
+
staleTime: timers_1.REFETCH_TIME_ONE_MINUTE * timers_1.BASIC_REFETCH,
|
15
|
+
})),
|
16
|
+
});
|
17
|
+
const loadingChart = chartQueries.some(query => query.isLoading);
|
18
|
+
const errorChart = chartQueries.every(query => query.isError);
|
19
|
+
const chartDataArray = ids.map((id, index) => ({
|
20
|
+
idChartData: id,
|
21
|
+
chartData: chartQueries[index]?.data,
|
22
|
+
isLoading: chartQueries[index]?.isLoading || false,
|
23
|
+
isError: chartQueries[index]?.isError || false,
|
24
|
+
}));
|
25
|
+
return { chartDataArray, loadingChart, errorChart };
|
26
|
+
};
|
27
|
+
exports.useLargeMoverChartData = useLargeMoverChartData;
|
28
|
+
//# sourceMappingURL=useLargeMoverChartData.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"useLargeMoverChartData.js","sourceRoot":"","sources":["../../../src/market/hooks/useLargeMoverChartData.ts"],"names":[],"mappings":";;;AAAA,uDAAmD;AACnD,gCAAgD;AAChD,kDAA+C;AAC/C,4CAAyE;AASlE,MAAM,sBAAsB,GAAG,CAAC,EACrC,GAAG,EACH,eAAe,EACf,KAAK,GACwB,EAAE,EAAE;IACjC,MAAM,YAAY,GAAG,IAAA,wBAAU,EAAC;QAC9B,OAAO,EAAE,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;YACtB,QAAQ,EAAE,CAAC,qBAAS,CAAC,iBAAiB,EAAE,EAAE,EAAE,eAAe,EAAE,KAAK,CAAC;YACnE,OAAO,EAAE,GAAG,EAAE,CAAC,IAAA,4BAAsB,EAAC,EAAE,EAAE,EAAE,eAAe,EAAE,KAAK,EAAE,CAAC;YACrE,eAAe,EAAE,gCAAuB,GAAG,sBAAa;YACxD,SAAS,EAAE,gCAAuB,GAAG,sBAAa;SACnD,CAAC,CAAC;KACJ,CAAC,CAAC;IAEH,MAAM,YAAY,GAAG,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;IACjE,MAAM,UAAU,GAAG,YAAY,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IAE9D,MAAM,cAAc,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC;QAC7C,WAAW,EAAE,EAAE;QACf,SAAS,EAAE,YAAY,CAAC,KAAK,CAAC,EAAE,IAAuC;QACvE,SAAS,EAAE,YAAY,CAAC,KAAK,CAAC,EAAE,SAAS,IAAI,KAAK;QAClD,OAAO,EAAE,YAAY,CAAC,KAAK,CAAC,EAAE,OAAO,IAAI,KAAK;KAC/C,CAAC,CAAC,CAAC;IAEJ,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,UAAU,EAAE,CAAC;AACtD,CAAC,CAAC;AAzBW,QAAA,sBAAsB,0BAyBjC"}
|
@@ -0,0 +1,13 @@
|
|
1
|
+
import { CurrencyData } from "../utils/types";
|
2
|
+
type UseLargeMoverCurrenciesParams = {
|
3
|
+
ids: string[];
|
4
|
+
counterCurrency: string;
|
5
|
+
};
|
6
|
+
export declare const useLargeMoverCurrencies: ({ ids, counterCurrency, }: UseLargeMoverCurrenciesParams) => {
|
7
|
+
id: string;
|
8
|
+
data: CurrencyData | undefined;
|
9
|
+
isLoading: boolean;
|
10
|
+
isError: boolean;
|
11
|
+
}[];
|
12
|
+
export {};
|
13
|
+
//# sourceMappingURL=useLargeMoverCurrencies.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"useLargeMoverCurrencies.d.ts","sourceRoot":"","sources":["../../../src/market/hooks/useLargeMoverCurrencies.ts"],"names":[],"mappings":"AAIA,OAAO,EAAsB,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAMlE,KAAK,6BAA6B,GAAG;IACnC,GAAG,EAAE,MAAM,EAAE,CAAC;IACd,eAAe,EAAE,MAAM,CAAC;CACzB,CAAC;AAEF,eAAO,MAAM,uBAAuB,8BAGjC,6BAA6B;;;;;GAiB/B,CAAC"}
|
@@ -0,0 +1,29 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.useLargeMoverCurrencies = void 0;
|
4
|
+
const react_query_1 = require("@tanstack/react-query");
|
5
|
+
const api_1 = require("../api");
|
6
|
+
const queryKeys_1 = require("../utils/queryKeys");
|
7
|
+
const timers_1 = require("../utils/timers");
|
8
|
+
const currencyFormatter_1 = require("../utils/currencyFormatter");
|
9
|
+
const currencies_1 = require("@ledgerhq/cryptoassets/currencies");
|
10
|
+
const cryptoCurrenciesList = [...(0, currencies_1.listCryptoCurrencies)()];
|
11
|
+
const useLargeMoverCurrencies = ({ ids, counterCurrency, }) => {
|
12
|
+
const currencyQueries = (0, react_query_1.useQueries)({
|
13
|
+
queries: ids.map(id => ({
|
14
|
+
queryKey: [queryKeys_1.QUERY_KEY.CurrencyDataRaw, id, counterCurrency],
|
15
|
+
queryFn: () => (0, api_1.fetchCurrency)({ id, counterCurrency }),
|
16
|
+
refetchInterval: timers_1.REFETCH_TIME_ONE_MINUTE * timers_1.BASIC_REFETCH,
|
17
|
+
staleTime: timers_1.REFETCH_TIME_ONE_MINUTE * timers_1.BASIC_REFETCH,
|
18
|
+
select: (data) => (0, currencyFormatter_1.format)(data, cryptoCurrenciesList),
|
19
|
+
})),
|
20
|
+
});
|
21
|
+
return ids.map((id, index) => ({
|
22
|
+
id,
|
23
|
+
data: currencyQueries[index]?.data,
|
24
|
+
isLoading: currencyQueries[index]?.isLoading || false,
|
25
|
+
isError: currencyQueries[index]?.isError || false,
|
26
|
+
}));
|
27
|
+
};
|
28
|
+
exports.useLargeMoverCurrencies = useLargeMoverCurrencies;
|
29
|
+
//# sourceMappingURL=useLargeMoverCurrencies.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"useLargeMoverCurrencies.js","sourceRoot":"","sources":["../../../src/market/hooks/useLargeMoverCurrencies.ts"],"names":[],"mappings":";;;AAAA,uDAAmD;AACnD,gCAAuC;AACvC,kDAA+C;AAC/C,4CAAyE;AAEzE,kEAAoD;AACpD,kEAAyE;AAEzE,MAAM,oBAAoB,GAAG,CAAC,GAAG,IAAA,iCAAoB,GAAE,CAAC,CAAC;AAOlD,MAAM,uBAAuB,GAAG,CAAC,EACtC,GAAG,EACH,eAAe,GACe,EAAE,EAAE;IAClC,MAAM,eAAe,GAAG,IAAA,wBAAU,EAAC;QACjC,OAAO,EAAE,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;YACtB,QAAQ,EAAE,CAAC,qBAAS,CAAC,eAAe,EAAE,EAAE,EAAE,eAAe,CAAC;YAC1D,OAAO,EAAE,GAAG,EAAE,CAAC,IAAA,mBAAa,EAAC,EAAE,EAAE,EAAE,eAAe,EAAE,CAAC;YACrD,eAAe,EAAE,gCAAuB,GAAG,sBAAa;YACxD,SAAS,EAAE,gCAAuB,GAAG,sBAAa;YAClD,MAAM,EAAE,CAAC,IAAwB,EAAE,EAAE,CAAC,IAAA,0BAAM,EAAC,IAAI,EAAE,oBAAoB,CAAC;SACzE,CAAC,CAAC;KACJ,CAAC,CAAC;IAEH,OAAO,GAAG,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC;QAC7B,EAAE;QACF,IAAI,EAAE,eAAe,CAAC,KAAK,CAAC,EAAE,IAAgC;QAC9D,SAAS,EAAE,eAAe,CAAC,KAAK,CAAC,EAAE,SAAS,IAAI,KAAK;QACrD,OAAO,EAAE,eAAe,CAAC,KAAK,CAAC,EAAE,OAAO,IAAI,KAAK;KAClD,CAAC,CAAC,CAAC;AACN,CAAC,CAAC;AApBW,QAAA,uBAAuB,2BAoBlC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"logic.d.ts","sourceRoot":"","sources":["../../../src/families/hedera/logic.ts"],"names":[],"mappings":"AACA,cAAc,6BAA6B,CAAC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"logic.js","sourceRoot":"","sources":["../../../src/families/hedera/logic.ts"],"names":[],"mappings":"AAAA,4BAA4B;AAC5B,cAAc,6BAA6B,CAAC"}
|
@@ -0,0 +1,18 @@
|
|
1
|
+
import { MarketCoinDataChart } from "../utils/types";
|
2
|
+
type UseLargeMoverChartDataParams = {
|
3
|
+
ids: string[];
|
4
|
+
counterCurrency: string;
|
5
|
+
range: string;
|
6
|
+
};
|
7
|
+
export declare const useLargeMoverChartData: ({ ids, counterCurrency, range, }: UseLargeMoverChartDataParams) => {
|
8
|
+
chartDataArray: {
|
9
|
+
idChartData: string;
|
10
|
+
chartData: MarketCoinDataChart | undefined;
|
11
|
+
isLoading: boolean;
|
12
|
+
isError: boolean;
|
13
|
+
}[];
|
14
|
+
loadingChart: boolean;
|
15
|
+
errorChart: boolean;
|
16
|
+
};
|
17
|
+
export {};
|
18
|
+
//# sourceMappingURL=useLargeMoverChartData.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"useLargeMoverChartData.d.ts","sourceRoot":"","sources":["../../../src/market/hooks/useLargeMoverChartData.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAErD,KAAK,4BAA4B,GAAG;IAClC,GAAG,EAAE,MAAM,EAAE,CAAC;IACd,eAAe,EAAE,MAAM,CAAC;IACxB,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,eAAO,MAAM,sBAAsB,qCAIhC,4BAA4B;;;;;;;;;CAqB9B,CAAC"}
|
@@ -0,0 +1,24 @@
|
|
1
|
+
import { useQueries } from "@tanstack/react-query";
|
2
|
+
import { fetchCurrencyChartData } from "../api";
|
3
|
+
import { QUERY_KEY } from "../utils/queryKeys";
|
4
|
+
import { REFETCH_TIME_ONE_MINUTE, BASIC_REFETCH } from "../utils/timers";
|
5
|
+
export const useLargeMoverChartData = ({ ids, counterCurrency, range, }) => {
|
6
|
+
const chartQueries = useQueries({
|
7
|
+
queries: ids.map(id => ({
|
8
|
+
queryKey: [QUERY_KEY.CurrencyChartData, id, counterCurrency, range],
|
9
|
+
queryFn: () => fetchCurrencyChartData({ id, counterCurrency, range }),
|
10
|
+
refetchInterval: REFETCH_TIME_ONE_MINUTE * BASIC_REFETCH,
|
11
|
+
staleTime: REFETCH_TIME_ONE_MINUTE * BASIC_REFETCH,
|
12
|
+
})),
|
13
|
+
});
|
14
|
+
const loadingChart = chartQueries.some(query => query.isLoading);
|
15
|
+
const errorChart = chartQueries.every(query => query.isError);
|
16
|
+
const chartDataArray = ids.map((id, index) => ({
|
17
|
+
idChartData: id,
|
18
|
+
chartData: chartQueries[index]?.data,
|
19
|
+
isLoading: chartQueries[index]?.isLoading || false,
|
20
|
+
isError: chartQueries[index]?.isError || false,
|
21
|
+
}));
|
22
|
+
return { chartDataArray, loadingChart, errorChart };
|
23
|
+
};
|
24
|
+
//# sourceMappingURL=useLargeMoverChartData.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"useLargeMoverChartData.js","sourceRoot":"","sources":["../../../src/market/hooks/useLargeMoverChartData.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,sBAAsB,EAAE,MAAM,QAAQ,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,uBAAuB,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AASzE,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,EACrC,GAAG,EACH,eAAe,EACf,KAAK,GACwB,EAAE,EAAE;IACjC,MAAM,YAAY,GAAG,UAAU,CAAC;QAC9B,OAAO,EAAE,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;YACtB,QAAQ,EAAE,CAAC,SAAS,CAAC,iBAAiB,EAAE,EAAE,EAAE,eAAe,EAAE,KAAK,CAAC;YACnE,OAAO,EAAE,GAAG,EAAE,CAAC,sBAAsB,CAAC,EAAE,EAAE,EAAE,eAAe,EAAE,KAAK,EAAE,CAAC;YACrE,eAAe,EAAE,uBAAuB,GAAG,aAAa;YACxD,SAAS,EAAE,uBAAuB,GAAG,aAAa;SACnD,CAAC,CAAC;KACJ,CAAC,CAAC;IAEH,MAAM,YAAY,GAAG,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;IACjE,MAAM,UAAU,GAAG,YAAY,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IAE9D,MAAM,cAAc,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC;QAC7C,WAAW,EAAE,EAAE;QACf,SAAS,EAAE,YAAY,CAAC,KAAK,CAAC,EAAE,IAAuC;QACvE,SAAS,EAAE,YAAY,CAAC,KAAK,CAAC,EAAE,SAAS,IAAI,KAAK;QAClD,OAAO,EAAE,YAAY,CAAC,KAAK,CAAC,EAAE,OAAO,IAAI,KAAK;KAC/C,CAAC,CAAC,CAAC;IAEJ,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,UAAU,EAAE,CAAC;AACtD,CAAC,CAAC"}
|
@@ -0,0 +1,13 @@
|
|
1
|
+
import { CurrencyData } from "../utils/types";
|
2
|
+
type UseLargeMoverCurrenciesParams = {
|
3
|
+
ids: string[];
|
4
|
+
counterCurrency: string;
|
5
|
+
};
|
6
|
+
export declare const useLargeMoverCurrencies: ({ ids, counterCurrency, }: UseLargeMoverCurrenciesParams) => {
|
7
|
+
id: string;
|
8
|
+
data: CurrencyData | undefined;
|
9
|
+
isLoading: boolean;
|
10
|
+
isError: boolean;
|
11
|
+
}[];
|
12
|
+
export {};
|
13
|
+
//# sourceMappingURL=useLargeMoverCurrencies.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"useLargeMoverCurrencies.d.ts","sourceRoot":"","sources":["../../../src/market/hooks/useLargeMoverCurrencies.ts"],"names":[],"mappings":"AAIA,OAAO,EAAsB,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAMlE,KAAK,6BAA6B,GAAG;IACnC,GAAG,EAAE,MAAM,EAAE,CAAC;IACd,eAAe,EAAE,MAAM,CAAC;CACzB,CAAC;AAEF,eAAO,MAAM,uBAAuB,8BAGjC,6BAA6B;;;;;GAiB/B,CAAC"}
|
@@ -0,0 +1,25 @@
|
|
1
|
+
import { useQueries } from "@tanstack/react-query";
|
2
|
+
import { fetchCurrency } from "../api";
|
3
|
+
import { QUERY_KEY } from "../utils/queryKeys";
|
4
|
+
import { REFETCH_TIME_ONE_MINUTE, BASIC_REFETCH } from "../utils/timers";
|
5
|
+
import { format } from "../utils/currencyFormatter";
|
6
|
+
import { listCryptoCurrencies } from "@ledgerhq/cryptoassets/currencies";
|
7
|
+
const cryptoCurrenciesList = [...listCryptoCurrencies()];
|
8
|
+
export const useLargeMoverCurrencies = ({ ids, counterCurrency, }) => {
|
9
|
+
const currencyQueries = useQueries({
|
10
|
+
queries: ids.map(id => ({
|
11
|
+
queryKey: [QUERY_KEY.CurrencyDataRaw, id, counterCurrency],
|
12
|
+
queryFn: () => fetchCurrency({ id, counterCurrency }),
|
13
|
+
refetchInterval: REFETCH_TIME_ONE_MINUTE * BASIC_REFETCH,
|
14
|
+
staleTime: REFETCH_TIME_ONE_MINUTE * BASIC_REFETCH,
|
15
|
+
select: (data) => format(data, cryptoCurrenciesList),
|
16
|
+
})),
|
17
|
+
});
|
18
|
+
return ids.map((id, index) => ({
|
19
|
+
id,
|
20
|
+
data: currencyQueries[index]?.data,
|
21
|
+
isLoading: currencyQueries[index]?.isLoading || false,
|
22
|
+
isError: currencyQueries[index]?.isError || false,
|
23
|
+
}));
|
24
|
+
};
|
25
|
+
//# sourceMappingURL=useLargeMoverCurrencies.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"useLargeMoverCurrencies.js","sourceRoot":"","sources":["../../../src/market/hooks/useLargeMoverCurrencies.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AACvC,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,uBAAuB,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEzE,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AACpD,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AAEzE,MAAM,oBAAoB,GAAG,CAAC,GAAG,oBAAoB,EAAE,CAAC,CAAC;AAOzD,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,EACtC,GAAG,EACH,eAAe,GACe,EAAE,EAAE;IAClC,MAAM,eAAe,GAAG,UAAU,CAAC;QACjC,OAAO,EAAE,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;YACtB,QAAQ,EAAE,CAAC,SAAS,CAAC,eAAe,EAAE,EAAE,EAAE,eAAe,CAAC;YAC1D,OAAO,EAAE,GAAG,EAAE,CAAC,aAAa,CAAC,EAAE,EAAE,EAAE,eAAe,EAAE,CAAC;YACrD,eAAe,EAAE,uBAAuB,GAAG,aAAa;YACxD,SAAS,EAAE,uBAAuB,GAAG,aAAa;YAClD,MAAM,EAAE,CAAC,IAAwB,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,EAAE,oBAAoB,CAAC;SACzE,CAAC,CAAC;KACJ,CAAC,CAAC;IAEH,OAAO,GAAG,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC;QAC7B,EAAE;QACF,IAAI,EAAE,eAAe,CAAC,KAAK,CAAC,EAAE,IAAgC;QAC9D,SAAS,EAAE,eAAe,CAAC,KAAK,CAAC,EAAE,SAAS,IAAI,KAAK;QACrD,OAAO,EAAE,eAAe,CAAC,KAAK,CAAC,EAAE,OAAO,IAAI,KAAK;KAClD,CAAC,CAAC,CAAC;AACN,CAAC,CAAC"}
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "@ledgerhq/live-common",
|
3
3
|
"description": "Common ground for the Ledger Live apps",
|
4
|
-
"version": "34.35.0-nightly.
|
4
|
+
"version": "34.35.0-nightly.3",
|
5
5
|
"repository": {
|
6
6
|
"type": "git",
|
7
7
|
"url": "https://github.com/LedgerHQ/ledger-live.git"
|
@@ -163,46 +163,47 @@
|
|
163
163
|
"yargs": "^17.0.0",
|
164
164
|
"zod": "^3.22.4",
|
165
165
|
"@ledgerhq/coin-algorand": "^0.9.6",
|
166
|
-
"@ledgerhq/coin-
|
166
|
+
"@ledgerhq/coin-bitcoin": "^0.15.6",
|
167
167
|
"@ledgerhq/coin-cardano": "^0.8.6",
|
168
168
|
"@ledgerhq/coin-casper": "^1.7.1",
|
169
|
-
"@ledgerhq/coin-
|
169
|
+
"@ledgerhq/coin-aptos": "^1.10.0-nightly.0",
|
170
170
|
"@ledgerhq/coin-celo": "^1.1.4",
|
171
171
|
"@ledgerhq/coin-cosmos": "^0.14.2",
|
172
172
|
"@ledgerhq/coin-evm": "^2.22.0",
|
173
|
-
"@ledgerhq/coin-filecoin": "^1.9.6",
|
174
173
|
"@ledgerhq/coin-framework": "^5.0.2",
|
175
|
-
"@ledgerhq/coin-hedera": "^1.6.7-nightly.
|
174
|
+
"@ledgerhq/coin-hedera": "^1.6.7-nightly.1",
|
175
|
+
"@ledgerhq/coin-internet_computer": "^1.7.6",
|
176
176
|
"@ledgerhq/coin-icon": "^0.10.6",
|
177
|
+
"@ledgerhq/coin-filecoin": "^1.9.6",
|
177
178
|
"@ledgerhq/coin-mina": "^1.1.5",
|
178
179
|
"@ledgerhq/coin-multiversx": "^0.4.6",
|
179
|
-
"@ledgerhq/coin-
|
180
|
+
"@ledgerhq/coin-near": "^0.11.6",
|
180
181
|
"@ledgerhq/coin-polkadot": "^6.1.0",
|
181
182
|
"@ledgerhq/coin-solana": "^0.24.0-nightly.0",
|
182
|
-
"@ledgerhq/coin-stacks": "^0.8.6",
|
183
183
|
"@ledgerhq/coin-stellar": "^5.0.2",
|
184
184
|
"@ledgerhq/coin-sui": "^0.4.0-nightly.0",
|
185
185
|
"@ledgerhq/coin-tezos": "^5.2.0-nightly.0",
|
186
|
-
"@ledgerhq/coin-ton": "^0.11.0-nightly.0",
|
187
186
|
"@ledgerhq/coin-tron": "^4.1.0",
|
187
|
+
"@ledgerhq/coin-ton": "^0.11.0-nightly.0",
|
188
|
+
"@ledgerhq/coin-stacks": "^0.8.6",
|
188
189
|
"@ledgerhq/coin-vechain": "^2.7.6",
|
189
|
-
"@ledgerhq/coin-xrp": "^6.1.1",
|
190
190
|
"@ledgerhq/crypto-icons-ui": "^1.14.0",
|
191
191
|
"@ledgerhq/cryptoassets": "^13.17.0",
|
192
|
-
"@ledgerhq/
|
192
|
+
"@ledgerhq/coin-xrp": "^6.1.1",
|
193
193
|
"@ledgerhq/devices": "8.4.5-nightly.2",
|
194
|
-
"@ledgerhq/
|
194
|
+
"@ledgerhq/device-core": "^0.4.25-nightly.2",
|
195
195
|
"@ledgerhq/hw-app-algorand": "^6.31.1-nightly.1",
|
196
196
|
"@ledgerhq/hw-app-aptos": "^6.34.1-nightly.1",
|
197
197
|
"@ledgerhq/hw-app-btc": "^10.9.1-nightly.1",
|
198
|
+
"@ledgerhq/errors": "^6.21.0-nightly.0",
|
198
199
|
"@ledgerhq/hw-app-celo": "^6.33.3-nightly.2",
|
199
|
-
"@ledgerhq/hw-app-cosmos": "^6.32.1-nightly.1",
|
200
200
|
"@ledgerhq/hw-app-eth": "^6.45.5-nightly.2",
|
201
|
+
"@ledgerhq/hw-app-cosmos": "^6.32.1-nightly.1",
|
201
202
|
"@ledgerhq/hw-app-exchange": "^0.10.1-nightly.1",
|
202
203
|
"@ledgerhq/hw-app-hedera": "^1.2.1-nightly.1",
|
203
204
|
"@ledgerhq/hw-app-icon": "^1.3.1-nightly.1",
|
204
|
-
"@ledgerhq/hw-app-multiversx": "^6.24.1-nightly.1",
|
205
205
|
"@ledgerhq/hw-app-near": "^6.31.1-nightly.1",
|
206
|
+
"@ledgerhq/hw-app-multiversx": "^6.24.1-nightly.1",
|
206
207
|
"@ledgerhq/hw-app-polkadot": "^6.34.1-nightly.1",
|
207
208
|
"@ledgerhq/hw-app-str": "^7.2.1-nightly.1",
|
208
209
|
"@ledgerhq/hw-app-sui": "^1.1.0",
|
@@ -210,9 +211,9 @@
|
|
210
211
|
"@ledgerhq/hw-app-trx": "^6.31.1-nightly.1",
|
211
212
|
"@ledgerhq/hw-app-vet": "^0.5.3",
|
212
213
|
"@ledgerhq/hw-app-xrp": "^6.31.1-nightly.1",
|
213
|
-
"@ledgerhq/hw-transport": "^6.31.5-nightly.2",
|
214
214
|
"@ledgerhq/hw-transport-mocker": "^6.29.5-nightly.2",
|
215
|
-
"@ledgerhq/
|
215
|
+
"@ledgerhq/hw-transport": "^6.31.5-nightly.2",
|
216
|
+
"@ledgerhq/ledger-cal-service": "^0.5.0-nightly.2",
|
216
217
|
"@ledgerhq/live-config": "^3.1.0",
|
217
218
|
"@ledgerhq/live-countervalues": "^0.5.6",
|
218
219
|
"@ledgerhq/live-countervalues-react": "^0.2.35",
|
@@ -220,15 +221,14 @@
|
|
220
221
|
"@ledgerhq/live-hooks": "0.1.0",
|
221
222
|
"@ledgerhq/live-network": "^2.0.8-nightly.1",
|
222
223
|
"@ledgerhq/live-nft": "^0.8.6",
|
223
|
-
"@ledgerhq/live-promise": "^0.1.0",
|
224
224
|
"@ledgerhq/live-signer-evm": "^0.4.2",
|
225
|
-
"@ledgerhq/live-signer-solana": "^0.1.1-nightly.
|
226
|
-
"@ledgerhq/live-
|
225
|
+
"@ledgerhq/live-signer-solana": "^0.1.1-nightly.3",
|
226
|
+
"@ledgerhq/live-promise": "^0.1.0",
|
227
227
|
"@ledgerhq/logs": "^6.12.0",
|
228
|
-
"@ledgerhq/speculos-transport": "^0.2.1-nightly.1",
|
229
228
|
"@ledgerhq/wallet-api-acre-module": "^0.5.0",
|
230
|
-
"@ledgerhq/
|
231
|
-
"@ledgerhq/
|
229
|
+
"@ledgerhq/speculos-transport": "^0.2.1-nightly.1",
|
230
|
+
"@ledgerhq/live-wallet": "^0.10.10-nightly.0",
|
231
|
+
"@ledgerhq/wallet-api-exchange-module": "^0.13.0"
|
232
232
|
},
|
233
233
|
"devDependencies": {
|
234
234
|
"@solana/web3.js": "1.95.4",
|
@@ -278,8 +278,8 @@
|
|
278
278
|
"ws": "7",
|
279
279
|
"@ledgerhq/device-react": "^0.2.31-nightly.2",
|
280
280
|
"@ledgerhq/types-cryptoassets": "^7.23.0",
|
281
|
-
"@ledgerhq/types-
|
282
|
-
"@ledgerhq/types-
|
281
|
+
"@ledgerhq/types-live": "^6.71.0-nightly.1",
|
282
|
+
"@ledgerhq/types-devices": "^6.25.3"
|
283
283
|
},
|
284
284
|
"scripts": {
|
285
285
|
"build": "zx ./scripts/build-ts.mjs",
|
@@ -0,0 +1,38 @@
|
|
1
|
+
import { useQueries } from "@tanstack/react-query";
|
2
|
+
import { fetchCurrencyChartData } from "../api";
|
3
|
+
import { QUERY_KEY } from "../utils/queryKeys";
|
4
|
+
import { REFETCH_TIME_ONE_MINUTE, BASIC_REFETCH } from "../utils/timers";
|
5
|
+
import { MarketCoinDataChart } from "../utils/types";
|
6
|
+
|
7
|
+
type UseLargeMoverChartDataParams = {
|
8
|
+
ids: string[];
|
9
|
+
counterCurrency: string;
|
10
|
+
range: string;
|
11
|
+
};
|
12
|
+
|
13
|
+
export const useLargeMoverChartData = ({
|
14
|
+
ids,
|
15
|
+
counterCurrency,
|
16
|
+
range,
|
17
|
+
}: UseLargeMoverChartDataParams) => {
|
18
|
+
const chartQueries = useQueries({
|
19
|
+
queries: ids.map(id => ({
|
20
|
+
queryKey: [QUERY_KEY.CurrencyChartData, id, counterCurrency, range],
|
21
|
+
queryFn: () => fetchCurrencyChartData({ id, counterCurrency, range }),
|
22
|
+
refetchInterval: REFETCH_TIME_ONE_MINUTE * BASIC_REFETCH,
|
23
|
+
staleTime: REFETCH_TIME_ONE_MINUTE * BASIC_REFETCH,
|
24
|
+
})),
|
25
|
+
});
|
26
|
+
|
27
|
+
const loadingChart = chartQueries.some(query => query.isLoading);
|
28
|
+
const errorChart = chartQueries.every(query => query.isError);
|
29
|
+
|
30
|
+
const chartDataArray = ids.map((id, index) => ({
|
31
|
+
idChartData: id,
|
32
|
+
chartData: chartQueries[index]?.data as MarketCoinDataChart | undefined,
|
33
|
+
isLoading: chartQueries[index]?.isLoading || false,
|
34
|
+
isError: chartQueries[index]?.isError || false,
|
35
|
+
}));
|
36
|
+
|
37
|
+
return { chartDataArray, loadingChart, errorChart };
|
38
|
+
};
|
@@ -0,0 +1,36 @@
|
|
1
|
+
import { useQueries } from "@tanstack/react-query";
|
2
|
+
import { fetchCurrency } from "../api";
|
3
|
+
import { QUERY_KEY } from "../utils/queryKeys";
|
4
|
+
import { REFETCH_TIME_ONE_MINUTE, BASIC_REFETCH } from "../utils/timers";
|
5
|
+
import { MarketItemResponse, CurrencyData } from "../utils/types";
|
6
|
+
import { format } from "../utils/currencyFormatter";
|
7
|
+
import { listCryptoCurrencies } from "@ledgerhq/cryptoassets/currencies";
|
8
|
+
|
9
|
+
const cryptoCurrenciesList = [...listCryptoCurrencies()];
|
10
|
+
|
11
|
+
type UseLargeMoverCurrenciesParams = {
|
12
|
+
ids: string[];
|
13
|
+
counterCurrency: string;
|
14
|
+
};
|
15
|
+
|
16
|
+
export const useLargeMoverCurrencies = ({
|
17
|
+
ids,
|
18
|
+
counterCurrency,
|
19
|
+
}: UseLargeMoverCurrenciesParams) => {
|
20
|
+
const currencyQueries = useQueries({
|
21
|
+
queries: ids.map(id => ({
|
22
|
+
queryKey: [QUERY_KEY.CurrencyDataRaw, id, counterCurrency],
|
23
|
+
queryFn: () => fetchCurrency({ id, counterCurrency }),
|
24
|
+
refetchInterval: REFETCH_TIME_ONE_MINUTE * BASIC_REFETCH,
|
25
|
+
staleTime: REFETCH_TIME_ONE_MINUTE * BASIC_REFETCH,
|
26
|
+
select: (data: MarketItemResponse) => format(data, cryptoCurrenciesList),
|
27
|
+
})),
|
28
|
+
});
|
29
|
+
|
30
|
+
return ids.map((id, index) => ({
|
31
|
+
id,
|
32
|
+
data: currencyQueries[index]?.data as CurrencyData | undefined,
|
33
|
+
isLoading: currencyQueries[index]?.isLoading || false,
|
34
|
+
isError: currencyQueries[index]?.isError || false,
|
35
|
+
}));
|
36
|
+
};
|
@@ -1,17 +0,0 @@
|
|
1
|
-
import { CurrencyData, MarketCoinDataChart } from "../utils/types";
|
2
|
-
type UseLargeMoverDataProviderParams = {
|
3
|
-
ids: string[];
|
4
|
-
counterCurrency: string;
|
5
|
-
range: string;
|
6
|
-
};
|
7
|
-
export declare const useLargeMoverDataProvider: ({ ids, counterCurrency, range, }: UseLargeMoverDataProviderParams) => {
|
8
|
-
currencies: {
|
9
|
-
id: string;
|
10
|
-
data?: CurrencyData;
|
11
|
-
chartData?: MarketCoinDataChart;
|
12
|
-
isLoading: boolean;
|
13
|
-
isError: boolean;
|
14
|
-
}[];
|
15
|
-
};
|
16
|
-
export {};
|
17
|
-
//# sourceMappingURL=useLargeMoverDataProvider.d.ts.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"useLargeMoverDataProvider.d.ts","sourceRoot":"","sources":["../../../src/market/hooks/useLargeMoverDataProvider.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAsB,MAAM,gBAAgB,CAAC;AAMvF,KAAK,+BAA+B,GAAG;IACrC,GAAG,EAAE,MAAM,EAAE,CAAC;IACd,eAAe,EAAE,MAAM,CAAC;IACxB,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAMF,eAAO,MAAM,yBAAyB,qCAInC,+BAA+B;gBACpB;QACV,EAAE,EAAE,MAAM,CAAC;QACX,IAAI,CAAC,EAAE,YAAY,CAAC;QACpB,SAAS,CAAC,EAAE,mBAAmB,CAAC;QAChC,SAAS,EAAE,OAAO,CAAC;QACnB,OAAO,EAAE,OAAO,CAAC;KAClB,EAAE;CAsCJ,CAAC"}
|
@@ -1,48 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.useLargeMoverDataProvider = void 0;
|
4
|
-
const react_query_1 = require("@tanstack/react-query");
|
5
|
-
const api_1 = require("../api");
|
6
|
-
const queryKeys_1 = require("../utils/queryKeys");
|
7
|
-
const timers_1 = require("../utils/timers");
|
8
|
-
const currencyFormatter_1 = require("../utils/currencyFormatter");
|
9
|
-
const currencies_1 = require("@ledgerhq/cryptoassets/currencies");
|
10
|
-
const cryptoCurrenciesList = [...(0, currencies_1.listCryptoCurrencies)()];
|
11
|
-
function mapIdsToQueries(ids, queries) {
|
12
|
-
return Object.fromEntries(ids.map((id, index) => [id, queries[index]]));
|
13
|
-
}
|
14
|
-
const useLargeMoverDataProvider = ({ ids, counterCurrency, range, }) => {
|
15
|
-
const currencyQueries = (0, react_query_1.useQueries)({
|
16
|
-
queries: ids.map(id => ({
|
17
|
-
queryKey: [queryKeys_1.QUERY_KEY.CurrencyDataRaw, id, counterCurrency],
|
18
|
-
queryFn: () => (0, api_1.fetchCurrency)({ id, counterCurrency }),
|
19
|
-
refetchInterval: timers_1.REFETCH_TIME_ONE_MINUTE * timers_1.BASIC_REFETCH,
|
20
|
-
staleTime: timers_1.REFETCH_TIME_ONE_MINUTE * timers_1.BASIC_REFETCH,
|
21
|
-
select: (data) => (0, currencyFormatter_1.format)(data, cryptoCurrenciesList),
|
22
|
-
})),
|
23
|
-
});
|
24
|
-
const chartQueries = (0, react_query_1.useQueries)({
|
25
|
-
queries: ids.map(id => ({
|
26
|
-
queryKey: [queryKeys_1.QUERY_KEY.CurrencyChartData, id, counterCurrency, range],
|
27
|
-
queryFn: () => (0, api_1.fetchCurrencyChartData)({ id, counterCurrency, range }),
|
28
|
-
refetchInterval: timers_1.REFETCH_TIME_ONE_MINUTE * timers_1.BASIC_REFETCH,
|
29
|
-
staleTime: timers_1.REFETCH_TIME_ONE_MINUTE * timers_1.BASIC_REFETCH,
|
30
|
-
})),
|
31
|
-
});
|
32
|
-
const currencyQueryMap = mapIdsToQueries(ids, currencyQueries);
|
33
|
-
const chartQueryMap = mapIdsToQueries(ids, chartQueries);
|
34
|
-
const currencies = ids.map(id => {
|
35
|
-
const currencyQuery = currencyQueryMap[id];
|
36
|
-
const chartQuery = chartQueryMap[id];
|
37
|
-
return {
|
38
|
-
id,
|
39
|
-
data: currencyQuery?.data,
|
40
|
-
chartData: chartQuery?.data,
|
41
|
-
isLoading: currencyQuery?.isLoading || chartQuery?.isLoading || false,
|
42
|
-
isError: currencyQuery?.isError || chartQuery?.isError || false,
|
43
|
-
};
|
44
|
-
});
|
45
|
-
return { currencies };
|
46
|
-
};
|
47
|
-
exports.useLargeMoverDataProvider = useLargeMoverDataProvider;
|
48
|
-
//# sourceMappingURL=useLargeMoverDataProvider.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"useLargeMoverDataProvider.js","sourceRoot":"","sources":["../../../src/market/hooks/useLargeMoverDataProvider.ts"],"names":[],"mappings":";;;AAAA,uDAAmD;AACnD,gCAA+D;AAC/D,kDAA+C;AAC/C,4CAAyE;AAEzE,kEAAoD;AACpD,kEAAyE;AAEzE,MAAM,oBAAoB,GAAG,CAAC,GAAG,IAAA,iCAAoB,GAAE,CAAC,CAAC;AAQzD,SAAS,eAAe,CAAI,GAAa,EAAE,OAAY;IACrD,OAAO,MAAM,CAAC,WAAW,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;AAC1E,CAAC;AAEM,MAAM,yBAAyB,GAAG,CAAC,EACxC,GAAG,EACH,eAAe,EACf,KAAK,GAC2B,EAQhC,EAAE;IACF,MAAM,eAAe,GAAG,IAAA,wBAAU,EAAC;QACjC,OAAO,EAAE,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;YACtB,QAAQ,EAAE,CAAC,qBAAS,CAAC,eAAe,EAAE,EAAE,EAAE,eAAe,CAAC;YAC1D,OAAO,EAAE,GAAG,EAAE,CAAC,IAAA,mBAAa,EAAC,EAAE,EAAE,EAAE,eAAe,EAAE,CAAC;YACrD,eAAe,EAAE,gCAAuB,GAAG,sBAAa;YACxD,SAAS,EAAE,gCAAuB,GAAG,sBAAa;YAClD,MAAM,EAAE,CAAC,IAAwB,EAAE,EAAE,CAAC,IAAA,0BAAM,EAAC,IAAI,EAAE,oBAAoB,CAAC;SACzE,CAAC,CAAC;KACJ,CAAC,CAAC;IAEH,MAAM,YAAY,GAAG,IAAA,wBAAU,EAAC;QAC9B,OAAO,EAAE,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;YACtB,QAAQ,EAAE,CAAC,qBAAS,CAAC,iBAAiB,EAAE,EAAE,EAAE,eAAe,EAAE,KAAK,CAAC;YACnE,OAAO,EAAE,GAAG,EAAE,CAAC,IAAA,4BAAsB,EAAC,EAAE,EAAE,EAAE,eAAe,EAAE,KAAK,EAAE,CAAC;YACrE,eAAe,EAAE,gCAAuB,GAAG,sBAAa;YACxD,SAAS,EAAE,gCAAuB,GAAG,sBAAa;SACnD,CAAC,CAAC;KACJ,CAAC,CAAC;IAEH,MAAM,gBAAgB,GAAG,eAAe,CAAC,GAAG,EAAE,eAAe,CAAC,CAAC;IAC/D,MAAM,aAAa,GAAG,eAAe,CAAC,GAAG,EAAE,YAAY,CAAC,CAAC;IAEzD,MAAM,UAAU,GAAG,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE;QAC9B,MAAM,aAAa,GAAG,gBAAgB,CAAC,EAAE,CAAC,CAAC;QAC3C,MAAM,UAAU,GAAG,aAAa,CAAC,EAAE,CAAC,CAAC;QAErC,OAAO;YACL,EAAE;YACF,IAAI,EAAE,aAAa,EAAE,IAAI;YACzB,SAAS,EAAE,UAAU,EAAE,IAAI;YAC3B,SAAS,EAAE,aAAa,EAAE,SAAS,IAAI,UAAU,EAAE,SAAS,IAAI,KAAK;YACrE,OAAO,EAAE,aAAa,EAAE,OAAO,IAAI,UAAU,EAAE,OAAO,IAAI,KAAK;SAChE,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,OAAO,EAAE,UAAU,EAAE,CAAC;AACxB,CAAC,CAAC;AAjDW,QAAA,yBAAyB,6BAiDpC"}
|
@@ -1,17 +0,0 @@
|
|
1
|
-
import { CurrencyData, MarketCoinDataChart } from "../utils/types";
|
2
|
-
type UseLargeMoverDataProviderParams = {
|
3
|
-
ids: string[];
|
4
|
-
counterCurrency: string;
|
5
|
-
range: string;
|
6
|
-
};
|
7
|
-
export declare const useLargeMoverDataProvider: ({ ids, counterCurrency, range, }: UseLargeMoverDataProviderParams) => {
|
8
|
-
currencies: {
|
9
|
-
id: string;
|
10
|
-
data?: CurrencyData;
|
11
|
-
chartData?: MarketCoinDataChart;
|
12
|
-
isLoading: boolean;
|
13
|
-
isError: boolean;
|
14
|
-
}[];
|
15
|
-
};
|
16
|
-
export {};
|
17
|
-
//# sourceMappingURL=useLargeMoverDataProvider.d.ts.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"useLargeMoverDataProvider.d.ts","sourceRoot":"","sources":["../../../src/market/hooks/useLargeMoverDataProvider.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAsB,MAAM,gBAAgB,CAAC;AAMvF,KAAK,+BAA+B,GAAG;IACrC,GAAG,EAAE,MAAM,EAAE,CAAC;IACd,eAAe,EAAE,MAAM,CAAC;IACxB,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAMF,eAAO,MAAM,yBAAyB,qCAInC,+BAA+B;gBACpB;QACV,EAAE,EAAE,MAAM,CAAC;QACX,IAAI,CAAC,EAAE,YAAY,CAAC;QACpB,SAAS,CAAC,EAAE,mBAAmB,CAAC;QAChC,SAAS,EAAE,OAAO,CAAC;QACnB,OAAO,EAAE,OAAO,CAAC;KAClB,EAAE;CAsCJ,CAAC"}
|
@@ -1,44 +0,0 @@
|
|
1
|
-
import { useQueries } from "@tanstack/react-query";
|
2
|
-
import { fetchCurrency, fetchCurrencyChartData } from "../api";
|
3
|
-
import { QUERY_KEY } from "../utils/queryKeys";
|
4
|
-
import { REFETCH_TIME_ONE_MINUTE, BASIC_REFETCH } from "../utils/timers";
|
5
|
-
import { format } from "../utils/currencyFormatter";
|
6
|
-
import { listCryptoCurrencies } from "@ledgerhq/cryptoassets/currencies";
|
7
|
-
const cryptoCurrenciesList = [...listCryptoCurrencies()];
|
8
|
-
function mapIdsToQueries(ids, queries) {
|
9
|
-
return Object.fromEntries(ids.map((id, index) => [id, queries[index]]));
|
10
|
-
}
|
11
|
-
export const useLargeMoverDataProvider = ({ ids, counterCurrency, range, }) => {
|
12
|
-
const currencyQueries = useQueries({
|
13
|
-
queries: ids.map(id => ({
|
14
|
-
queryKey: [QUERY_KEY.CurrencyDataRaw, id, counterCurrency],
|
15
|
-
queryFn: () => fetchCurrency({ id, counterCurrency }),
|
16
|
-
refetchInterval: REFETCH_TIME_ONE_MINUTE * BASIC_REFETCH,
|
17
|
-
staleTime: REFETCH_TIME_ONE_MINUTE * BASIC_REFETCH,
|
18
|
-
select: (data) => format(data, cryptoCurrenciesList),
|
19
|
-
})),
|
20
|
-
});
|
21
|
-
const chartQueries = useQueries({
|
22
|
-
queries: ids.map(id => ({
|
23
|
-
queryKey: [QUERY_KEY.CurrencyChartData, id, counterCurrency, range],
|
24
|
-
queryFn: () => fetchCurrencyChartData({ id, counterCurrency, range }),
|
25
|
-
refetchInterval: REFETCH_TIME_ONE_MINUTE * BASIC_REFETCH,
|
26
|
-
staleTime: REFETCH_TIME_ONE_MINUTE * BASIC_REFETCH,
|
27
|
-
})),
|
28
|
-
});
|
29
|
-
const currencyQueryMap = mapIdsToQueries(ids, currencyQueries);
|
30
|
-
const chartQueryMap = mapIdsToQueries(ids, chartQueries);
|
31
|
-
const currencies = ids.map(id => {
|
32
|
-
const currencyQuery = currencyQueryMap[id];
|
33
|
-
const chartQuery = chartQueryMap[id];
|
34
|
-
return {
|
35
|
-
id,
|
36
|
-
data: currencyQuery?.data,
|
37
|
-
chartData: chartQuery?.data,
|
38
|
-
isLoading: currencyQuery?.isLoading || chartQuery?.isLoading || false,
|
39
|
-
isError: currencyQuery?.isError || chartQuery?.isError || false,
|
40
|
-
};
|
41
|
-
});
|
42
|
-
return { currencies };
|
43
|
-
};
|
44
|
-
//# sourceMappingURL=useLargeMoverDataProvider.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"useLargeMoverDataProvider.js","sourceRoot":"","sources":["../../../src/market/hooks/useLargeMoverDataProvider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,sBAAsB,EAAE,MAAM,QAAQ,CAAC;AAC/D,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,uBAAuB,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEzE,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AACpD,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AAEzE,MAAM,oBAAoB,GAAG,CAAC,GAAG,oBAAoB,EAAE,CAAC,CAAC;AAQzD,SAAS,eAAe,CAAI,GAAa,EAAE,OAAY;IACrD,OAAO,MAAM,CAAC,WAAW,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;AAC1E,CAAC;AAED,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,EACxC,GAAG,EACH,eAAe,EACf,KAAK,GAC2B,EAQhC,EAAE;IACF,MAAM,eAAe,GAAG,UAAU,CAAC;QACjC,OAAO,EAAE,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;YACtB,QAAQ,EAAE,CAAC,SAAS,CAAC,eAAe,EAAE,EAAE,EAAE,eAAe,CAAC;YAC1D,OAAO,EAAE,GAAG,EAAE,CAAC,aAAa,CAAC,EAAE,EAAE,EAAE,eAAe,EAAE,CAAC;YACrD,eAAe,EAAE,uBAAuB,GAAG,aAAa;YACxD,SAAS,EAAE,uBAAuB,GAAG,aAAa;YAClD,MAAM,EAAE,CAAC,IAAwB,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,EAAE,oBAAoB,CAAC;SACzE,CAAC,CAAC;KACJ,CAAC,CAAC;IAEH,MAAM,YAAY,GAAG,UAAU,CAAC;QAC9B,OAAO,EAAE,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;YACtB,QAAQ,EAAE,CAAC,SAAS,CAAC,iBAAiB,EAAE,EAAE,EAAE,eAAe,EAAE,KAAK,CAAC;YACnE,OAAO,EAAE,GAAG,EAAE,CAAC,sBAAsB,CAAC,EAAE,EAAE,EAAE,eAAe,EAAE,KAAK,EAAE,CAAC;YACrE,eAAe,EAAE,uBAAuB,GAAG,aAAa;YACxD,SAAS,EAAE,uBAAuB,GAAG,aAAa;SACnD,CAAC,CAAC;KACJ,CAAC,CAAC;IAEH,MAAM,gBAAgB,GAAG,eAAe,CAAC,GAAG,EAAE,eAAe,CAAC,CAAC;IAC/D,MAAM,aAAa,GAAG,eAAe,CAAC,GAAG,EAAE,YAAY,CAAC,CAAC;IAEzD,MAAM,UAAU,GAAG,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE;QAC9B,MAAM,aAAa,GAAG,gBAAgB,CAAC,EAAE,CAAC,CAAC;QAC3C,MAAM,UAAU,GAAG,aAAa,CAAC,EAAE,CAAC,CAAC;QAErC,OAAO;YACL,EAAE;YACF,IAAI,EAAE,aAAa,EAAE,IAAI;YACzB,SAAS,EAAE,UAAU,EAAE,IAAI;YAC3B,SAAS,EAAE,aAAa,EAAE,SAAS,IAAI,UAAU,EAAE,SAAS,IAAI,KAAK;YACrE,OAAO,EAAE,aAAa,EAAE,OAAO,IAAI,UAAU,EAAE,OAAO,IAAI,KAAK;SAChE,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,OAAO,EAAE,UAAU,EAAE,CAAC;AACxB,CAAC,CAAC"}
|
@@ -1,70 +0,0 @@
|
|
1
|
-
import { useQueries } from "@tanstack/react-query";
|
2
|
-
import { fetchCurrency, fetchCurrencyChartData } from "../api";
|
3
|
-
import { QUERY_KEY } from "../utils/queryKeys";
|
4
|
-
import { REFETCH_TIME_ONE_MINUTE, BASIC_REFETCH } from "../utils/timers";
|
5
|
-
import { CurrencyData, MarketCoinDataChart, MarketItemResponse } from "../utils/types";
|
6
|
-
import { format } from "../utils/currencyFormatter";
|
7
|
-
import { listCryptoCurrencies } from "@ledgerhq/cryptoassets/currencies";
|
8
|
-
|
9
|
-
const cryptoCurrenciesList = [...listCryptoCurrencies()];
|
10
|
-
|
11
|
-
type UseLargeMoverDataProviderParams = {
|
12
|
-
ids: string[];
|
13
|
-
counterCurrency: string;
|
14
|
-
range: string;
|
15
|
-
};
|
16
|
-
|
17
|
-
function mapIdsToQueries<T>(ids: string[], queries: T[]): Record<string, T> {
|
18
|
-
return Object.fromEntries(ids.map((id, index) => [id, queries[index]]));
|
19
|
-
}
|
20
|
-
|
21
|
-
export const useLargeMoverDataProvider = ({
|
22
|
-
ids,
|
23
|
-
counterCurrency,
|
24
|
-
range,
|
25
|
-
}: UseLargeMoverDataProviderParams): {
|
26
|
-
currencies: {
|
27
|
-
id: string;
|
28
|
-
data?: CurrencyData;
|
29
|
-
chartData?: MarketCoinDataChart;
|
30
|
-
isLoading: boolean;
|
31
|
-
isError: boolean;
|
32
|
-
}[];
|
33
|
-
} => {
|
34
|
-
const currencyQueries = useQueries({
|
35
|
-
queries: ids.map(id => ({
|
36
|
-
queryKey: [QUERY_KEY.CurrencyDataRaw, id, counterCurrency],
|
37
|
-
queryFn: () => fetchCurrency({ id, counterCurrency }),
|
38
|
-
refetchInterval: REFETCH_TIME_ONE_MINUTE * BASIC_REFETCH,
|
39
|
-
staleTime: REFETCH_TIME_ONE_MINUTE * BASIC_REFETCH,
|
40
|
-
select: (data: MarketItemResponse) => format(data, cryptoCurrenciesList),
|
41
|
-
})),
|
42
|
-
});
|
43
|
-
|
44
|
-
const chartQueries = useQueries({
|
45
|
-
queries: ids.map(id => ({
|
46
|
-
queryKey: [QUERY_KEY.CurrencyChartData, id, counterCurrency, range],
|
47
|
-
queryFn: () => fetchCurrencyChartData({ id, counterCurrency, range }),
|
48
|
-
refetchInterval: REFETCH_TIME_ONE_MINUTE * BASIC_REFETCH,
|
49
|
-
staleTime: REFETCH_TIME_ONE_MINUTE * BASIC_REFETCH,
|
50
|
-
})),
|
51
|
-
});
|
52
|
-
|
53
|
-
const currencyQueryMap = mapIdsToQueries(ids, currencyQueries);
|
54
|
-
const chartQueryMap = mapIdsToQueries(ids, chartQueries);
|
55
|
-
|
56
|
-
const currencies = ids.map(id => {
|
57
|
-
const currencyQuery = currencyQueryMap[id];
|
58
|
-
const chartQuery = chartQueryMap[id];
|
59
|
-
|
60
|
-
return {
|
61
|
-
id,
|
62
|
-
data: currencyQuery?.data,
|
63
|
-
chartData: chartQuery?.data,
|
64
|
-
isLoading: currencyQuery?.isLoading || chartQuery?.isLoading || false,
|
65
|
-
isError: currencyQuery?.isError || chartQuery?.isError || false,
|
66
|
-
};
|
67
|
-
});
|
68
|
-
|
69
|
-
return { currencies };
|
70
|
-
};
|