@ledgerhq/live-common 34.51.0-nightly.10 → 34.51.0-nightly.12

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.
Files changed (96) hide show
  1. package/lib/config/index.d.ts +2 -2
  2. package/lib/config/index.d.ts.map +1 -1
  3. package/lib/config/index.js.map +1 -1
  4. package/lib/e2e/enum/DeviceLabels.d.ts +3 -2
  5. package/lib/e2e/enum/DeviceLabels.d.ts.map +1 -1
  6. package/lib/e2e/enum/DeviceLabels.js +3 -2
  7. package/lib/e2e/enum/DeviceLabels.js.map +1 -1
  8. package/lib/e2e/speculos.d.ts.map +1 -1
  9. package/lib/e2e/speculos.js +12 -10
  10. package/lib/e2e/speculos.js.map +1 -1
  11. package/lib/exchange/index.d.ts.map +1 -1
  12. package/lib/exchange/index.js +4 -15
  13. package/lib/exchange/index.js.map +1 -1
  14. package/lib/exchange/swap/getCompleteSwapHistory.d.ts +1 -1
  15. package/lib/exchange/swap/getCompleteSwapHistory.d.ts.map +1 -1
  16. package/lib/exchange/swap/getCompleteSwapHistory.js +5 -5
  17. package/lib/exchange/swap/getCompleteSwapHistory.js.map +1 -1
  18. package/lib/exchange/swap/hooks/useSelectableCurrencies.d.ts.map +1 -1
  19. package/lib/exchange/swap/hooks/useSelectableCurrencies.js +16 -4
  20. package/lib/exchange/swap/hooks/useSelectableCurrencies.js.map +1 -1
  21. package/lib/generated/specs.d.ts +1 -1
  22. package/lib/market/hooks/useLargeMoverChartData.d.ts +1 -2
  23. package/lib/market/hooks/useLargeMoverChartData.d.ts.map +1 -1
  24. package/lib/market/hooks/useLargeMoverChartData.js.map +1 -1
  25. package/lib/market/hooks/useLargeMoverCurrencies.d.ts +1 -2
  26. package/lib/market/hooks/useLargeMoverCurrencies.d.ts.map +1 -1
  27. package/lib/market/hooks/useLargeMoverCurrencies.js +1 -3
  28. package/lib/market/hooks/useLargeMoverCurrencies.js.map +1 -1
  29. package/lib/market/utils/currencyFormatter.d.ts +1 -1
  30. package/lib/market/utils/currencyFormatter.d.ts.map +1 -1
  31. package/lib/market/utils/currencyFormatter.js +1 -1
  32. package/lib/market/utils/currencyFormatter.js.map +1 -1
  33. package/lib/modularDrawer/hooks/modules/useLeftApyModule.d.ts +1 -1
  34. package/lib/modularDrawer/hooks/modules/useLeftMarketTrendModule.d.ts +1 -1
  35. package/lib/modularDrawer/hooks/modules/useRightMarketTrendModule.d.ts +1 -1
  36. package/lib/modularDrawer/hooks/useCurrenciesUnderFeatureFlag.d.ts +1 -2
  37. package/lib/modularDrawer/hooks/useCurrenciesUnderFeatureFlag.d.ts.map +1 -1
  38. package/lib/modularDrawer/hooks/useRightBalanceAsset.d.ts +1 -1
  39. package/lib/wallet-api/constants.d.ts +2 -2
  40. package/lib-es/config/index.d.ts +2 -2
  41. package/lib-es/config/index.d.ts.map +1 -1
  42. package/lib-es/config/index.js.map +1 -1
  43. package/lib-es/e2e/enum/DeviceLabels.d.ts +3 -2
  44. package/lib-es/e2e/enum/DeviceLabels.d.ts.map +1 -1
  45. package/lib-es/e2e/enum/DeviceLabels.js +3 -2
  46. package/lib-es/e2e/enum/DeviceLabels.js.map +1 -1
  47. package/lib-es/e2e/speculos.d.ts.map +1 -1
  48. package/lib-es/e2e/speculos.js +12 -10
  49. package/lib-es/e2e/speculos.js.map +1 -1
  50. package/lib-es/exchange/index.d.ts.map +1 -1
  51. package/lib-es/exchange/index.js +4 -15
  52. package/lib-es/exchange/index.js.map +1 -1
  53. package/lib-es/exchange/swap/getCompleteSwapHistory.d.ts +1 -1
  54. package/lib-es/exchange/swap/getCompleteSwapHistory.d.ts.map +1 -1
  55. package/lib-es/exchange/swap/getCompleteSwapHistory.js +5 -5
  56. package/lib-es/exchange/swap/getCompleteSwapHistory.js.map +1 -1
  57. package/lib-es/exchange/swap/hooks/useSelectableCurrencies.d.ts.map +1 -1
  58. package/lib-es/exchange/swap/hooks/useSelectableCurrencies.js +18 -6
  59. package/lib-es/exchange/swap/hooks/useSelectableCurrencies.js.map +1 -1
  60. package/lib-es/generated/specs.d.ts +1 -1
  61. package/lib-es/market/hooks/useLargeMoverChartData.d.ts +1 -2
  62. package/lib-es/market/hooks/useLargeMoverChartData.d.ts.map +1 -1
  63. package/lib-es/market/hooks/useLargeMoverChartData.js.map +1 -1
  64. package/lib-es/market/hooks/useLargeMoverCurrencies.d.ts +1 -2
  65. package/lib-es/market/hooks/useLargeMoverCurrencies.d.ts.map +1 -1
  66. package/lib-es/market/hooks/useLargeMoverCurrencies.js +1 -3
  67. package/lib-es/market/hooks/useLargeMoverCurrencies.js.map +1 -1
  68. package/lib-es/market/utils/currencyFormatter.d.ts +1 -1
  69. package/lib-es/market/utils/currencyFormatter.d.ts.map +1 -1
  70. package/lib-es/market/utils/currencyFormatter.js +1 -1
  71. package/lib-es/market/utils/currencyFormatter.js.map +1 -1
  72. package/lib-es/modularDrawer/hooks/modules/useLeftApyModule.d.ts +1 -1
  73. package/lib-es/modularDrawer/hooks/modules/useLeftMarketTrendModule.d.ts +1 -1
  74. package/lib-es/modularDrawer/hooks/modules/useRightMarketTrendModule.d.ts +1 -1
  75. package/lib-es/modularDrawer/hooks/useCurrenciesUnderFeatureFlag.d.ts +1 -2
  76. package/lib-es/modularDrawer/hooks/useCurrenciesUnderFeatureFlag.d.ts.map +1 -1
  77. package/lib-es/modularDrawer/hooks/useRightBalanceAsset.d.ts +1 -1
  78. package/lib-es/wallet-api/constants.d.ts +2 -2
  79. package/package.json +40 -40
  80. package/src/bridge/cache.test.ts +2 -2
  81. package/src/config/index.ts +2 -4
  82. package/src/currencies/sortByMarketcap.test.ts +10 -7
  83. package/src/e2e/enum/DeviceLabels.ts +3 -2
  84. package/src/e2e/speculos.ts +15 -10
  85. package/src/exchange/index.ts +4 -15
  86. package/src/exchange/swap/getCompleteSwapHistory.ts +5 -5
  87. package/src/exchange/swap/hooks/useFromState.test.ts +11 -4
  88. package/src/exchange/swap/hooks/useReverseAccounts.test.ts +11 -4
  89. package/src/exchange/swap/hooks/useSelectableCurrencies.test.ts +14 -8
  90. package/src/exchange/swap/hooks/useSelectableCurrencies.ts +23 -6
  91. package/src/exchange/swap/hooks/useToState.test.ts +11 -4
  92. package/src/exchange/swap/hooks/useUpdateMaxAmount.test.ts +11 -4
  93. package/src/exchange/swap/utils/index.test.ts +10 -4
  94. package/src/market/hooks/useLargeMoverChartData.ts +1 -2
  95. package/src/market/hooks/useLargeMoverCurrencies.ts +3 -6
  96. package/src/market/utils/currencyFormatter.ts +2 -2
@@ -2,7 +2,7 @@
2
2
  * @jest-environment jsdom
3
3
  */
4
4
  import "../../../__tests__/test-helpers/dom-polyfill";
5
- import { getCryptoCurrencyById, findTokenById } from "@ledgerhq/cryptoassets";
5
+ import { getCryptoCurrencyById } from "@ledgerhq/cryptoassets";
6
6
  import { act, renderHook } from "@testing-library/react";
7
7
  import BigNumber from "bignumber.js";
8
8
  import { checkAccountSupported } from "../../../account/index";
@@ -19,9 +19,16 @@ jest.mock("../../../families/evm/bridge/mock");
19
19
  const mockedEstimateMaxSpendable = jest.mocked(ethBridge.accountBridge.estimateMaxSpendable);
20
20
 
21
21
  const ETH = getCryptoCurrencyById("ethereum");
22
- const usdtToken = findTokenById("ethereum/erc20/usd_tether__erc20_");
23
- if (!usdtToken) throw new Error("USDT token not found");
24
- const USDT = usdtToken;
22
+ const USDT = {
23
+ type: "TokenCurrency" as const,
24
+ id: "ethereum/erc20/usd_tether__erc20_",
25
+ name: "Tether USD (ERC-20)",
26
+ ticker: "USDT",
27
+ units: [{ name: "Tether USD", code: "USDT", magnitude: 6 }],
28
+ contractAddress: "0xdac17f958d2ee523a2206206994597c13d831ec7",
29
+ parentCurrency: ETH,
30
+ tokenType: "erc20" as const,
31
+ };
25
32
 
26
33
  const parentAccount = genAccount("parent-account", {
27
34
  currency: ETH,
@@ -1,4 +1,3 @@
1
- import { findTokenById } from "@ledgerhq/cryptoassets";
2
1
  import type { CryptoCurrency, TokenCurrency } from "@ledgerhq/types-cryptoassets";
3
2
  import type { Account, TokenAccount } from "@ledgerhq/types-live";
4
3
  import BigNumber from "bignumber.js";
@@ -87,9 +86,16 @@ describe("swap/utils/getAccountTuplesForCurrency", () => {
87
86
  });
88
87
 
89
88
  describe("TokenCurrency", () => {
90
- const token = findTokenById("ethereum/erc20/aave");
91
- if (!token) throw new Error("AAVE token not found");
92
- const aaveToken = Object.freeze(token);
89
+ const aaveToken = Object.freeze({
90
+ type: "TokenCurrency" as const,
91
+ id: "ethereum/erc20/aave",
92
+ name: "Aave Token",
93
+ ticker: "AAVE",
94
+ units: [{ name: "Aave Token", code: "AAVE", magnitude: 18 }],
95
+ contractAddress: "0x7fc66500c84a76ad7e9c93437bfc5ac33e2ddae9",
96
+ parentCurrency: getCryptoCurrencyById("ethereum"),
97
+ tokenType: "erc20" as const,
98
+ });
93
99
 
94
100
  test("returns correct parent accounts including a new subAccount when a TokenCurrency is provided", () => {
95
101
  const ethAccounts = [
@@ -2,7 +2,6 @@ import { useQueries } from "@tanstack/react-query";
2
2
  import { fetchCurrencyChartData } from "../api";
3
3
  import { QUERY_KEY } from "../utils/queryKeys";
4
4
  import { REFETCH_TIME_ONE_MINUTE, BASIC_REFETCH } from "../utils/timers";
5
- import { MarketCoinDataChart } from "../utils/types";
6
5
 
7
6
  type UseLargeMoverChartDataParams = {
8
7
  ids: string[];
@@ -29,7 +28,7 @@ export const useLargeMoverChartData = ({
29
28
 
30
29
  const chartDataArray = ids.map((id, index) => ({
31
30
  idChartData: id,
32
- chartData: chartQueries[index]?.data as MarketCoinDataChart | undefined,
31
+ chartData: chartQueries[index]?.data,
33
32
  isLoading: chartQueries[index]?.isLoading || false,
34
33
  isError: chartQueries[index]?.isError || false,
35
34
  }));
@@ -2,11 +2,8 @@ import { useQueries } from "@tanstack/react-query";
2
2
  import { fetchCurrency } from "../api";
3
3
  import { QUERY_KEY } from "../utils/queryKeys";
4
4
  import { REFETCH_TIME_ONE_MINUTE, BASIC_REFETCH } from "../utils/timers";
5
- import { MarketItemResponse, CurrencyData } from "../utils/types";
5
+ import { MarketItemResponse } from "../utils/types";
6
6
  import { format } from "../utils/currencyFormatter";
7
- import { listCryptoCurrencies } from "@ledgerhq/cryptoassets/currencies";
8
-
9
- const cryptoCurrenciesList = [...listCryptoCurrencies()];
10
7
 
11
8
  type UseLargeMoverCurrenciesParams = {
12
9
  ids: string[];
@@ -23,13 +20,13 @@ export const useLargeMoverCurrencies = ({
23
20
  queryFn: () => fetchCurrency({ id, counterCurrency }),
24
21
  refetchInterval: REFETCH_TIME_ONE_MINUTE * BASIC_REFETCH,
25
22
  staleTime: REFETCH_TIME_ONE_MINUTE * BASIC_REFETCH,
26
- select: (data: MarketItemResponse) => format(data, cryptoCurrenciesList),
23
+ select: (data: MarketItemResponse) => format(data),
27
24
  })),
28
25
  });
29
26
 
30
27
  return ids.map((id, index) => ({
31
28
  id,
32
- data: currencyQueries[index]?.data as CurrencyData | undefined,
29
+ data: currencyQueries[index]?.data,
33
30
  isLoading: currencyQueries[index]?.isLoading || false,
34
31
  isError: currencyQueries[index]?.isError || false,
35
32
  }));
@@ -54,11 +54,11 @@ export function currencyFormatter(
54
54
 
55
55
  export const format = (
56
56
  currency: MarketItemResponse,
57
- cryptoCurrenciesList: (CryptoCurrency | TokenCurrency)[],
57
+ cryptoCurrenciesList?: (CryptoCurrency | TokenCurrency)[],
58
58
  ): CurrencyData => {
59
59
  const ledgerIdsSet = new Set(currency.ledgerIds.map(id => id.toLowerCase()));
60
60
 
61
- const internalCurrency = cryptoCurrenciesList.find(({ id }) =>
61
+ const internalCurrency = cryptoCurrenciesList?.find(({ id }) =>
62
62
  ledgerIdsSet.has(id.toLowerCase()),
63
63
  );
64
64