@ledgerhq/live-common 34.46.0-nightly.4 → 34.46.0

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 (210) hide show
  1. package/lib/bridge/crypto-assets/index.d.ts +1 -1
  2. package/lib/bridge/crypto-assets/index.d.ts.map +1 -1
  3. package/lib/bridge/crypto-assets/index.js +1 -1
  4. package/lib/bridge/crypto-assets/index.js.map +1 -1
  5. package/lib/bridge/impl.d.ts +1 -1
  6. package/lib/bridge/impl.d.ts.map +1 -1
  7. package/lib/domain/getTokensWithFunds.test.js +1 -1
  8. package/lib/domain/getTokensWithFunds.test.js.map +1 -1
  9. package/lib/e2e/enum/DeviceLabels.d.ts +2 -3
  10. package/lib/e2e/enum/DeviceLabels.d.ts.map +1 -1
  11. package/lib/e2e/enum/DeviceLabels.js +1 -2
  12. package/lib/e2e/enum/DeviceLabels.js.map +1 -1
  13. package/lib/e2e/families/solana.d.ts.map +1 -1
  14. package/lib/e2e/families/solana.js +4 -4
  15. package/lib/e2e/families/solana.js.map +1 -1
  16. package/lib/e2e/index.d.ts +0 -3
  17. package/lib/e2e/index.d.ts.map +1 -1
  18. package/lib/e2e/speculos.js +1 -1
  19. package/lib/e2e/speculos.js.map +1 -1
  20. package/lib/env.react.d.ts +1 -1
  21. package/lib/env.react.d.ts.map +1 -1
  22. package/lib/exchange/swap/api/v5/actions.js +1 -1
  23. package/lib/exchange/swap/api/v5/actions.js.map +1 -1
  24. package/lib/exchange/swap/types.d.ts +1 -1
  25. package/lib/exchange/swap/types.d.ts.map +1 -1
  26. package/lib/families/evm/setup.d.ts.map +1 -1
  27. package/lib/families/evm/setup.js +1 -11
  28. package/lib/families/evm/setup.js.map +1 -1
  29. package/lib/families/hedera/setup.d.ts +5 -5
  30. package/lib/families/hedera/setup.d.ts.map +1 -1
  31. package/lib/families/hedera/setup.js.map +1 -1
  32. package/lib/families/solana/setup.d.ts.map +1 -1
  33. package/lib/families/solana/setup.js +1 -2
  34. package/lib/families/solana/setup.js.map +1 -1
  35. package/lib/generated/bridge/js.d.ts +1 -1
  36. package/lib/market/utils/countervalueFormatter.d.ts.map +1 -1
  37. package/lib/market/utils/countervalueFormatter.js.map +1 -1
  38. package/lib/market/utils/types.d.ts +0 -2
  39. package/lib/market/utils/types.d.ts.map +1 -1
  40. package/lib/modularDrawer/__mocks__/currencies.mock.d.ts.map +1 -1
  41. package/lib/modularDrawer/__mocks__/currencies.mock.js +7 -7
  42. package/lib/modularDrawer/__mocks__/currencies.mock.js.map +1 -1
  43. package/lib/modularDrawer/__mocks__/useGroupedCurrenciesByProvider.mock.js +1 -1
  44. package/lib/modularDrawer/__mocks__/useGroupedCurrenciesByProvider.mock.js.map +1 -1
  45. package/lib/modularDrawer/utils/__tests__/currencyUtils.test.js +1 -1
  46. package/lib/modularDrawer/utils/__tests__/currencyUtils.test.js.map +1 -1
  47. package/lib/modularDrawer/utils/__tests__/haveOneCommonProvider.test.js +1 -1
  48. package/lib/modularDrawer/utils/__tests__/haveOneCommonProvider.test.js.map +1 -1
  49. package/lib/utils/__tests__/getAccountTuplesForCurrency.test.js +1 -1
  50. package/lib/utils/__tests__/getAccountTuplesForCurrency.test.js.map +1 -1
  51. package/lib-es/bridge/crypto-assets/index.d.ts +1 -1
  52. package/lib-es/bridge/crypto-assets/index.d.ts.map +1 -1
  53. package/lib-es/bridge/crypto-assets/index.js +1 -1
  54. package/lib-es/bridge/crypto-assets/index.js.map +1 -1
  55. package/lib-es/bridge/impl.d.ts +1 -1
  56. package/lib-es/bridge/impl.d.ts.map +1 -1
  57. package/lib-es/domain/getTokensWithFunds.test.js +1 -1
  58. package/lib-es/domain/getTokensWithFunds.test.js.map +1 -1
  59. package/lib-es/e2e/enum/DeviceLabels.d.ts +2 -3
  60. package/lib-es/e2e/enum/DeviceLabels.d.ts.map +1 -1
  61. package/lib-es/e2e/enum/DeviceLabels.js +1 -2
  62. package/lib-es/e2e/enum/DeviceLabels.js.map +1 -1
  63. package/lib-es/e2e/families/solana.d.ts.map +1 -1
  64. package/lib-es/e2e/families/solana.js +4 -4
  65. package/lib-es/e2e/families/solana.js.map +1 -1
  66. package/lib-es/e2e/index.d.ts +0 -3
  67. package/lib-es/e2e/index.d.ts.map +1 -1
  68. package/lib-es/e2e/speculos.js +1 -1
  69. package/lib-es/e2e/speculos.js.map +1 -1
  70. package/lib-es/env.react.d.ts +1 -1
  71. package/lib-es/env.react.d.ts.map +1 -1
  72. package/lib-es/exchange/swap/api/v5/actions.js +1 -1
  73. package/lib-es/exchange/swap/api/v5/actions.js.map +1 -1
  74. package/lib-es/exchange/swap/types.d.ts +1 -1
  75. package/lib-es/exchange/swap/types.d.ts.map +1 -1
  76. package/lib-es/families/evm/setup.d.ts.map +1 -1
  77. package/lib-es/families/evm/setup.js +1 -11
  78. package/lib-es/families/evm/setup.js.map +1 -1
  79. package/lib-es/families/hedera/setup.d.ts +5 -5
  80. package/lib-es/families/hedera/setup.d.ts.map +1 -1
  81. package/lib-es/families/hedera/setup.js.map +1 -1
  82. package/lib-es/families/solana/setup.d.ts.map +1 -1
  83. package/lib-es/families/solana/setup.js +1 -2
  84. package/lib-es/families/solana/setup.js.map +1 -1
  85. package/lib-es/generated/bridge/js.d.ts +1 -1
  86. package/lib-es/market/utils/countervalueFormatter.d.ts.map +1 -1
  87. package/lib-es/market/utils/countervalueFormatter.js.map +1 -1
  88. package/lib-es/market/utils/types.d.ts +0 -2
  89. package/lib-es/market/utils/types.d.ts.map +1 -1
  90. package/lib-es/modularDrawer/__mocks__/currencies.mock.d.ts.map +1 -1
  91. package/lib-es/modularDrawer/__mocks__/currencies.mock.js +1 -1
  92. package/lib-es/modularDrawer/__mocks__/currencies.mock.js.map +1 -1
  93. package/lib-es/modularDrawer/__mocks__/useGroupedCurrenciesByProvider.mock.js +1 -1
  94. package/lib-es/modularDrawer/__mocks__/useGroupedCurrenciesByProvider.mock.js.map +1 -1
  95. package/lib-es/modularDrawer/utils/__tests__/currencyUtils.test.js +1 -1
  96. package/lib-es/modularDrawer/utils/__tests__/currencyUtils.test.js.map +1 -1
  97. package/lib-es/modularDrawer/utils/__tests__/haveOneCommonProvider.test.js +1 -1
  98. package/lib-es/modularDrawer/utils/__tests__/haveOneCommonProvider.test.js.map +1 -1
  99. package/lib-es/utils/__tests__/getAccountTuplesForCurrency.test.js +1 -1
  100. package/lib-es/utils/__tests__/getAccountTuplesForCurrency.test.js.map +1 -1
  101. package/package.json +72 -73
  102. package/src/DataModel.test.ts +1 -1
  103. package/src/__tests__/accounts/groupPerDay.ts +1 -1
  104. package/src/__tests__/test-helpers/setup.ts +1 -1
  105. package/src/account/serialization.test.ts +1 -1
  106. package/src/bridge/crypto-assets/index.test.ts +1 -1
  107. package/src/bridge/crypto-assets/index.ts +2 -3
  108. package/src/bridge/impl.ts +1 -1
  109. package/src/currencies/sortByMarketcap.test.ts +1 -1
  110. package/src/domain/getTokensWithFunds.test.ts +1 -1
  111. package/src/e2e/enum/DeviceLabels.ts +1 -2
  112. package/src/e2e/families/solana.ts +4 -7
  113. package/src/e2e/speculos.ts +1 -1
  114. package/src/exchange/swap/api/v5/actions.ts +1 -1
  115. package/src/exchange/swap/types.ts +1 -1
  116. package/src/families/bitcoin/__snapshots__/bridge.integration.test.ts.snap +0 -7
  117. package/src/families/bitcoin/satstack.test.ts +1 -1
  118. package/src/families/evm/setup.ts +1 -12
  119. package/src/families/hedera/__snapshots__/bridge.integration.test.ts.snap +1135 -464
  120. package/src/families/hedera/setup.ts +3 -7
  121. package/src/families/solana/setup.ts +0 -2
  122. package/src/families/tron/data.mock.ts +1 -1
  123. package/src/market/utils/countervalueFormatter.ts +1 -0
  124. package/src/market/utils/types.ts +0 -4
  125. package/src/modularDrawer/__mocks__/currencies.mock.ts +1 -1
  126. package/src/modularDrawer/__mocks__/useGroupedCurrenciesByProvider.mock.ts +1 -1
  127. package/src/modularDrawer/utils/__tests__/currencyUtils.test.ts +1 -1
  128. package/src/modularDrawer/utils/__tests__/haveOneCommonProvider.test.ts +2 -2
  129. package/src/utils/__tests__/getAccountTuplesForCurrency.test.ts +1 -1
  130. package/lib/families/hedera/constants.d.ts +0 -2
  131. package/lib/families/hedera/constants.d.ts.map +0 -1
  132. package/lib/families/hedera/constants.js +0 -19
  133. package/lib/families/hedera/constants.js.map +0 -1
  134. package/lib/modularDrawer/utils/__tests__/counterValueFormatter.test.d.ts +0 -2
  135. package/lib/modularDrawer/utils/__tests__/counterValueFormatter.test.d.ts.map +0 -1
  136. package/lib/modularDrawer/utils/__tests__/counterValueFormatter.test.js +0 -496
  137. package/lib/modularDrawer/utils/__tests__/counterValueFormatter.test.js.map +0 -1
  138. package/lib/modularDrawer/utils/calculateProviderTotal.d.ts +0 -9
  139. package/lib/modularDrawer/utils/calculateProviderTotal.d.ts.map +0 -1
  140. package/lib/modularDrawer/utils/calculateProviderTotal.js +0 -23
  141. package/lib/modularDrawer/utils/calculateProviderTotal.js.map +0 -1
  142. package/lib/modularDrawer/utils/counterValueFormatter.d.ts +0 -14
  143. package/lib/modularDrawer/utils/counterValueFormatter.d.ts.map +0 -1
  144. package/lib/modularDrawer/utils/counterValueFormatter.js +0 -107
  145. package/lib/modularDrawer/utils/counterValueFormatter.js.map +0 -1
  146. package/lib/modularDrawer/utils/getBalanceAndFiatValueByAssets.d.ts +0 -11
  147. package/lib/modularDrawer/utils/getBalanceAndFiatValueByAssets.d.ts.map +0 -1
  148. package/lib/modularDrawer/utils/getBalanceAndFiatValueByAssets.js +0 -45
  149. package/lib/modularDrawer/utils/getBalanceAndFiatValueByAssets.js.map +0 -1
  150. package/lib/modularDrawer/utils/getProviderCurrency.d.ts +0 -3
  151. package/lib/modularDrawer/utils/getProviderCurrency.d.ts.map +0 -1
  152. package/lib/modularDrawer/utils/getProviderCurrency.js +0 -14
  153. package/lib/modularDrawer/utils/getProviderCurrency.js.map +0 -1
  154. package/lib/modularDrawer/utils/groupAccountsByAsset.d.ts +0 -11
  155. package/lib/modularDrawer/utils/groupAccountsByAsset.d.ts.map +0 -1
  156. package/lib/modularDrawer/utils/groupAccountsByAsset.js +0 -32
  157. package/lib/modularDrawer/utils/groupAccountsByAsset.js.map +0 -1
  158. package/lib/modularDrawer/utils/parseToBigNumber.d.ts +0 -9
  159. package/lib/modularDrawer/utils/parseToBigNumber.d.ts.map +0 -1
  160. package/lib/modularDrawer/utils/parseToBigNumber.js +0 -24
  161. package/lib/modularDrawer/utils/parseToBigNumber.js.map +0 -1
  162. package/lib/modularDrawer/utils/type.d.ts +0 -21
  163. package/lib/modularDrawer/utils/type.d.ts.map +0 -1
  164. package/lib/modularDrawer/utils/type.js +0 -3
  165. package/lib/modularDrawer/utils/type.js.map +0 -1
  166. package/lib-es/families/hedera/constants.d.ts +0 -2
  167. package/lib-es/families/hedera/constants.d.ts.map +0 -1
  168. package/lib-es/families/hedera/constants.js +0 -3
  169. package/lib-es/families/hedera/constants.js.map +0 -1
  170. package/lib-es/modularDrawer/utils/__tests__/counterValueFormatter.test.d.ts +0 -2
  171. package/lib-es/modularDrawer/utils/__tests__/counterValueFormatter.test.d.ts.map +0 -1
  172. package/lib-es/modularDrawer/utils/__tests__/counterValueFormatter.test.js +0 -494
  173. package/lib-es/modularDrawer/utils/__tests__/counterValueFormatter.test.js.map +0 -1
  174. package/lib-es/modularDrawer/utils/calculateProviderTotal.d.ts +0 -9
  175. package/lib-es/modularDrawer/utils/calculateProviderTotal.d.ts.map +0 -1
  176. package/lib-es/modularDrawer/utils/calculateProviderTotal.js +0 -16
  177. package/lib-es/modularDrawer/utils/calculateProviderTotal.js.map +0 -1
  178. package/lib-es/modularDrawer/utils/counterValueFormatter.d.ts +0 -14
  179. package/lib-es/modularDrawer/utils/counterValueFormatter.d.ts.map +0 -1
  180. package/lib-es/modularDrawer/utils/counterValueFormatter.js +0 -103
  181. package/lib-es/modularDrawer/utils/counterValueFormatter.js.map +0 -1
  182. package/lib-es/modularDrawer/utils/getBalanceAndFiatValueByAssets.d.ts +0 -11
  183. package/lib-es/modularDrawer/utils/getBalanceAndFiatValueByAssets.d.ts.map +0 -1
  184. package/lib-es/modularDrawer/utils/getBalanceAndFiatValueByAssets.js +0 -41
  185. package/lib-es/modularDrawer/utils/getBalanceAndFiatValueByAssets.js.map +0 -1
  186. package/lib-es/modularDrawer/utils/getProviderCurrency.d.ts +0 -3
  187. package/lib-es/modularDrawer/utils/getProviderCurrency.d.ts.map +0 -1
  188. package/lib-es/modularDrawer/utils/getProviderCurrency.js +0 -10
  189. package/lib-es/modularDrawer/utils/getProviderCurrency.js.map +0 -1
  190. package/lib-es/modularDrawer/utils/groupAccountsByAsset.d.ts +0 -11
  191. package/lib-es/modularDrawer/utils/groupAccountsByAsset.d.ts.map +0 -1
  192. package/lib-es/modularDrawer/utils/groupAccountsByAsset.js +0 -25
  193. package/lib-es/modularDrawer/utils/groupAccountsByAsset.js.map +0 -1
  194. package/lib-es/modularDrawer/utils/parseToBigNumber.d.ts +0 -9
  195. package/lib-es/modularDrawer/utils/parseToBigNumber.d.ts.map +0 -1
  196. package/lib-es/modularDrawer/utils/parseToBigNumber.js +0 -17
  197. package/lib-es/modularDrawer/utils/parseToBigNumber.js.map +0 -1
  198. package/lib-es/modularDrawer/utils/type.d.ts +0 -21
  199. package/lib-es/modularDrawer/utils/type.d.ts.map +0 -1
  200. package/lib-es/modularDrawer/utils/type.js +0 -2
  201. package/lib-es/modularDrawer/utils/type.js.map +0 -1
  202. package/src/families/hedera/constants.ts +0 -2
  203. package/src/modularDrawer/utils/__tests__/counterValueFormatter.test.ts +0 -549
  204. package/src/modularDrawer/utils/calculateProviderTotal.ts +0 -23
  205. package/src/modularDrawer/utils/counterValueFormatter.ts +0 -165
  206. package/src/modularDrawer/utils/getBalanceAndFiatValueByAssets.ts +0 -76
  207. package/src/modularDrawer/utils/getProviderCurrency.ts +0 -13
  208. package/src/modularDrawer/utils/groupAccountsByAsset.ts +0 -51
  209. package/src/modularDrawer/utils/parseToBigNumber.ts +0 -17
  210. package/src/modularDrawer/utils/type.ts +0 -22
@@ -4,21 +4,17 @@ import { createBridges } from "@ledgerhq/coin-hedera/bridge/index";
4
4
  import Transport from "@ledgerhq/hw-transport";
5
5
  import Hedera from "@ledgerhq/hw-app-hedera";
6
6
  import hederaResolver from "@ledgerhq/coin-hedera/signer/index";
7
- import type {
8
- TransactionStatus,
9
- Transaction,
10
- HederaAccount,
11
- } from "@ledgerhq/coin-hedera/types/index";
12
- import type { Bridge } from "@ledgerhq/types-live";
7
+ import type { Account, Bridge } from "@ledgerhq/types-live";
13
8
  import makeCliTools from "@ledgerhq/coin-hedera/test/cli";
14
9
  import { CreateSigner, createResolver, executeWithSigner } from "../../bridge/setup";
15
10
  import { Resolver } from "../../hw/getAddress/types";
11
+ import { TransactionStatus, Transaction } from "@ledgerhq/coin-hedera/types/index";
16
12
 
17
13
  const createSigner: CreateSigner<Hedera> = (transport: Transport) => {
18
14
  return new Hedera(transport);
19
15
  };
20
16
 
21
- const bridge: Bridge<Transaction, HederaAccount, TransactionStatus> = createBridges(
17
+ const bridge: Bridge<Transaction, Account, TransactionStatus> = createBridges(
22
18
  executeWithSigner(createSigner),
23
19
  );
24
20
 
@@ -19,7 +19,6 @@ import { SolanaCoinConfig } from "@ledgerhq/coin-solana/config";
19
19
  import { getCryptoCurrencyById } from "../../currencies";
20
20
  import { signMessage } from "@ledgerhq/coin-solana/hw-signMessage";
21
21
  import { LegacySignerSolana } from "@ledgerhq/live-signer-solana";
22
- import { getCryptoAssetsStore } from "../../bridge/crypto-assets";
23
22
 
24
23
  const createSigner: CreateSigner<SolanaSigner> = (transport: Transport) =>
25
24
  new LegacySignerSolana(transport);
@@ -31,7 +30,6 @@ const getCurrencyConfig = () => {
31
30
  const bridge: Bridge<Transaction, SolanaAccount, TransactionStatus> = createBridges(
32
31
  executeWithSigner(createSigner),
33
32
  getCurrencyConfig,
34
- getCryptoAssetsStore,
35
33
  );
36
34
 
37
35
  const messageSigner = {
@@ -1,7 +1,7 @@
1
1
  import { fromAccountRaw } from "../../account/serialization";
2
2
  import { TronAccount } from "@ledgerhq/coin-tron/types/index";
3
3
  import { setCryptoAssetsStore as setCryptoAssetsStoreForCoinFramework } from "@ledgerhq/coin-framework/crypto-assets/index";
4
- import type { CryptoAssetsStore } from "@ledgerhq/types-live";
4
+ import { CryptoAssetsStore } from "@ledgerhq/coin-framework/crypto-assets/type";
5
5
 
6
6
  export const __NEXT_REWARD_DATE__ = new Date(Date.now() - 6 * 60 * 60 * 1000);
7
7
 
@@ -12,6 +12,7 @@ export const counterValueFormatter = ({
12
12
  if (!value) {
13
13
  return "-";
14
14
  }
15
+
15
16
  return new Intl.NumberFormat(locale, {
16
17
  style: currency ? "currency" : "decimal",
17
18
  currency,
@@ -144,7 +144,6 @@ export type MarketItemResponse = {
144
144
  circulatingSupply: number;
145
145
  fullyDilutedValuation: number;
146
146
  high24h: number;
147
- currencyId: string;
148
147
  id: string;
149
148
  image: string;
150
149
  ledgerIds: string[];
@@ -168,9 +167,6 @@ export type MarketItemResponse = {
168
167
  totalVolume: number;
169
168
  updatedAt: string;
170
169
  };
171
-
172
- export type PartialMarketItemResponse = Partial<MarketItemResponse>;
173
-
174
170
  export type MarketItemPerformer = {
175
171
  id: string;
176
172
  name: string;
@@ -1,5 +1,5 @@
1
+ import { getCryptoCurrencyById } from "@ledgerhq/live-common/currencies/index";
1
2
  import { TokenCurrency } from "@ledgerhq/types-cryptoassets";
2
- import { getCryptoCurrencyById } from "../../currencies";
3
3
 
4
4
  export const mockBtcCryptoCurrency = getCryptoCurrencyById("bitcoin");
5
5
  export const mockEthCryptoCurrency = getCryptoCurrencyById("ethereum");
@@ -1,4 +1,4 @@
1
- import { LoadingStatus } from "../../deposit/type";
1
+ import { LoadingStatus } from "@ledgerhq/live-common/deposit/type";
2
2
  import {
3
3
  arbitrumToken,
4
4
  mockArbitrumCryptoCurrency,
@@ -1,4 +1,4 @@
1
- import { useGroupedCurrenciesByProvider } from "../../__mocks__/useGroupedCurrenciesByProvider.mock";
1
+ import { useGroupedCurrenciesByProvider } from "@ledgerhq/live-common/modularDrawer/__mocks__/useGroupedCurrenciesByProvider.mock";
2
2
  import { TokenCurrency } from "@ledgerhq/types-cryptoassets";
3
3
 
4
4
  import {
@@ -1,8 +1,8 @@
1
1
  import { haveOneCommonProvider } from "../haveOneCommonProvider";
2
2
  import { useGroupedCurrenciesByProvider } from "../../__mocks__/useGroupedCurrenciesByProvider.mock";
3
- import { LoadingBasedGroupedCurrencies } from "../../../deposit/type";
3
+ import { LoadingBasedGroupedCurrencies } from "@ledgerhq/live-common/deposit/type";
4
4
 
5
- jest.mock("../../../deposit/useGroupedCurrenciesByProvider.hook", () => ({
5
+ jest.mock("@ledgerhq/live-common/deposit/useGroupedCurrenciesByProvider.hook", () => ({
6
6
  useGroupedCurrenciesByProvider: () => useGroupedCurrenciesByProvider(),
7
7
  }));
8
8
 
@@ -1,5 +1,5 @@
1
1
  import { getCryptoCurrencyById, getTokenById } from "@ledgerhq/cryptoassets";
2
- import { genAccount } from "../../mock/account";
2
+ import { genAccount } from "@ledgerhq/live-common/mock/account";
3
3
  import type { CryptoCurrency, TokenCurrency } from "@ledgerhq/types-cryptoassets";
4
4
  import type { Account, TokenAccount } from "@ledgerhq/types-live";
5
5
  import { getAccountTuplesForCurrency } from "../getAccountTuplesForCurrency";
@@ -1,2 +0,0 @@
1
- export * from "@ledgerhq/coin-hedera/constants";
2
- //# sourceMappingURL=constants.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/families/hedera/constants.ts"],"names":[],"mappings":"AACA,cAAc,iCAAiC,CAAC"}
@@ -1,19 +0,0 @@
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/constants"), exports);
19
- //# sourceMappingURL=constants.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/families/hedera/constants.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4BAA4B;AAC5B,kEAAgD"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=counterValueFormatter.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"counterValueFormatter.test.d.ts","sourceRoot":"","sources":["../../../../src/modularDrawer/utils/__tests__/counterValueFormatter.test.ts"],"names":[],"mappings":""}
@@ -1,496 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const counterValueFormatter_1 = require("../counterValueFormatter");
4
- const translations = {
5
- "numberCompactNotation.K": "K",
6
- "numberCompactNotation.M": "M",
7
- "numberCompactNotation.B": "B",
8
- };
9
- const mockT = jest.fn().mockImplementation((key) => {
10
- return translations[key] || key;
11
- });
12
- describe("counterValueFormatter", () => {
13
- it("should return '-' for NaN values", () => {
14
- const result = (0, counterValueFormatter_1.counterValueFormatter)({
15
- value: NaN,
16
- locale: "en-US",
17
- });
18
- expect(result).toBe("-");
19
- });
20
- it("should format a number as currency", () => {
21
- const result = (0, counterValueFormatter_1.counterValueFormatter)({
22
- value: 1234.56,
23
- currency: "USD",
24
- locale: "en-US",
25
- });
26
- expect(result).toBe("$1,234.56");
27
- });
28
- it("should format a number as decimal when no currency is provided", () => {
29
- const result = (0, counterValueFormatter_1.counterValueFormatter)({
30
- value: 1234.56,
31
- locale: "en-US",
32
- });
33
- expect(result).toBe("1,234.56");
34
- });
35
- it("should format a number in compact notation when shorten is true", () => {
36
- const result = (0, counterValueFormatter_1.counterValueFormatter)({
37
- value: 1234567,
38
- locale: "en-US",
39
- shorten: true,
40
- });
41
- expect(result).toContain("1.235M");
42
- });
43
- it("should include the ticker in the formatted value", () => {
44
- const result = (0, counterValueFormatter_1.counterValueFormatter)({
45
- value: 1234.56,
46
- locale: "en-US",
47
- ticker: "BTC",
48
- });
49
- expect(result).toBe("1,234.56 BTC");
50
- });
51
- it("should allow zero values when allowZeroValue is true", () => {
52
- const result = (0, counterValueFormatter_1.counterValueFormatter)({
53
- value: 0,
54
- locale: "en-US",
55
- allowZeroValue: true,
56
- });
57
- expect(result).toBe("0.00");
58
- });
59
- it("should format a number with specified decimal places set to 0", () => {
60
- const result = (0, counterValueFormatter_1.counterValueFormatter)({
61
- value: 10.231023213,
62
- locale: "en-US",
63
- decimalPlaces: 0,
64
- allowZeroValue: true,
65
- });
66
- expect(result).toBe("10");
67
- });
68
- it("should format a number with specified decimal places set to 4", () => {
69
- const result = (0, counterValueFormatter_1.counterValueFormatter)({
70
- value: 10.231023213,
71
- locale: "en-US",
72
- decimalPlaces: 4,
73
- allowZeroValue: true,
74
- });
75
- expect(result).toBe("10.2310");
76
- });
77
- it("should format a number in compact notation with translation", () => {
78
- const result = (0, counterValueFormatter_1.counterValueFormatter)({
79
- value: 1234567,
80
- locale: "en-US",
81
- shorten: true,
82
- t: mockT,
83
- });
84
- expect(result).toContain("1.235 M");
85
- expect(mockT).toHaveBeenCalledWith("numberCompactNotation.M");
86
- });
87
- it("should handle different locales for formatting", () => {
88
- const result = (0, counterValueFormatter_1.counterValueFormatter)({
89
- value: 1234.56,
90
- locale: "fr-FR",
91
- });
92
- expect(result).toBe("1\u202f234,56");
93
- });
94
- it("should handle invalid currency gracefully", () => {
95
- const result = (0, counterValueFormatter_1.counterValueFormatter)({
96
- value: 1234.56,
97
- currency: "INVALID",
98
- locale: "en-US",
99
- });
100
- expect(result).toBe("1,234.56");
101
- });
102
- it("should return - if value is NaN and it's not discreet mode", () => {
103
- const result = (0, counterValueFormatter_1.counterValueFormatter)({
104
- value: NaN,
105
- locale: "en-US",
106
- });
107
- expect(result).toBe("-");
108
- });
109
- it("should return sanitized value with *** in discreet mode for NaN", () => {
110
- const result = (0, counterValueFormatter_1.counterValueFormatter)({
111
- value: NaN,
112
- locale: "en-US",
113
- discreetMode: true,
114
- });
115
- expect(result).toBe("***");
116
- });
117
- it("should return sanitized value with *** in discreet mode for zero value", () => {
118
- const result = (0, counterValueFormatter_1.counterValueFormatter)({
119
- value: 0,
120
- locale: "en-US",
121
- discreetMode: true,
122
- });
123
- expect(result).toBe("***");
124
- });
125
- it("should return sanitized value with *** in discreet mode for non-zero value", () => {
126
- const result = (0, counterValueFormatter_1.counterValueFormatter)({
127
- value: 1234.56,
128
- locale: "en-US",
129
- discreetMode: true,
130
- });
131
- expect(result).toBe("***");
132
- });
133
- it("should return sanitized value with *** in discreet mode for zero value with allowZeroValue", () => {
134
- const result = (0, counterValueFormatter_1.counterValueFormatter)({
135
- value: 0,
136
- locale: "en-US",
137
- allowZeroValue: true,
138
- discreetMode: true,
139
- currency: "USD",
140
- });
141
- expect(result).toBe("$***");
142
- });
143
- describe("Multiple locales", () => {
144
- it("should format German locale with EUR currency", () => {
145
- const result = (0, counterValueFormatter_1.counterValueFormatter)({
146
- value: 1234.56,
147
- locale: "de-DE",
148
- currency: "EUR",
149
- });
150
- expect(result).toBe("1.234,56\u00A0€");
151
- });
152
- it("should handle french locale", () => {
153
- const result = (0, counterValueFormatter_1.counterValueFormatter)({
154
- value: 10.23,
155
- locale: "fr-FR",
156
- allowZeroValue: true,
157
- currency: "EUR",
158
- });
159
- expect(result).toBe("10,23\u00A0€");
160
- });
161
- it("should handle french locale with allowZeroValue", () => {
162
- const result = (0, counterValueFormatter_1.counterValueFormatter)({
163
- value: 0,
164
- locale: "fr-FR",
165
- allowZeroValue: true,
166
- currency: "EUR",
167
- });
168
- expect(result).toBe("0,00\u00A0€");
169
- });
170
- it("should handle french locale with USD currency", () => {
171
- const result = (0, counterValueFormatter_1.counterValueFormatter)({
172
- value: 0,
173
- locale: "fr-FR",
174
- allowZeroValue: true,
175
- currency: "USD",
176
- });
177
- expect(result).toBe("0,00\u00A0$US");
178
- });
179
- it("should format German locale with zero value", () => {
180
- const result = (0, counterValueFormatter_1.counterValueFormatter)({
181
- value: 0,
182
- locale: "de-DE",
183
- currency: "EUR",
184
- allowZeroValue: true,
185
- });
186
- expect(result).toBe("0,00\u00A0€");
187
- });
188
- it("should format Japanese locale with JPY currency", () => {
189
- const result = (0, counterValueFormatter_1.counterValueFormatter)({
190
- value: 1234.56,
191
- locale: "ja-JP",
192
- currency: "JPY",
193
- });
194
- expect(result).toBe("¥1,235");
195
- });
196
- it("should format Japanese locale with zero value", () => {
197
- const result = (0, counterValueFormatter_1.counterValueFormatter)({
198
- value: 0,
199
- locale: "ja-JP",
200
- currency: "JPY",
201
- allowZeroValue: true,
202
- });
203
- expect(result).toBe("¥0");
204
- });
205
- it("should format UK locale with GBP currency", () => {
206
- const result = (0, counterValueFormatter_1.counterValueFormatter)({
207
- value: 1234.56,
208
- locale: "en-GB",
209
- currency: "GBP",
210
- });
211
- expect(result).toBe("£1,234.56");
212
- });
213
- it("should format UK locale with zero value", () => {
214
- const result = (0, counterValueFormatter_1.counterValueFormatter)({
215
- value: 0,
216
- locale: "en-GB",
217
- currency: "GBP",
218
- allowZeroValue: true,
219
- });
220
- expect(result).toBe("£0.00");
221
- });
222
- it("should format Italian locale with EUR currency", () => {
223
- const result = (0, counterValueFormatter_1.counterValueFormatter)({
224
- value: 1234.56,
225
- locale: "it-IT",
226
- currency: "EUR",
227
- });
228
- expect(result).toBe("1234,56\u00A0€");
229
- });
230
- it("should format Italian locale with zero value", () => {
231
- const result = (0, counterValueFormatter_1.counterValueFormatter)({
232
- value: 0,
233
- locale: "it-IT",
234
- currency: "EUR",
235
- allowZeroValue: true,
236
- });
237
- expect(result).toBe("0,00\u00A0€");
238
- });
239
- it("should format Spanish locale with EUR currency", () => {
240
- const result = (0, counterValueFormatter_1.counterValueFormatter)({
241
- value: 1234.56,
242
- locale: "es-ES",
243
- currency: "EUR",
244
- });
245
- expect(result).toBe("1234,56\u00A0€");
246
- });
247
- it("should format Spanish locale with zero value", () => {
248
- const result = (0, counterValueFormatter_1.counterValueFormatter)({
249
- value: 0,
250
- locale: "es-ES",
251
- currency: "EUR",
252
- allowZeroValue: true,
253
- });
254
- expect(result).toBe("0,00\u00A0€");
255
- });
256
- it("should format Chinese locale with CNY currency", () => {
257
- const result = (0, counterValueFormatter_1.counterValueFormatter)({
258
- value: 1234.56,
259
- locale: "zh-CN",
260
- currency: "CNY",
261
- });
262
- expect(result).toBe("¥1,234.56");
263
- });
264
- it("should format Chinese locale with zero value", () => {
265
- const result = (0, counterValueFormatter_1.counterValueFormatter)({
266
- value: 0,
267
- locale: "zh-CN",
268
- currency: "CNY",
269
- allowZeroValue: true,
270
- });
271
- expect(result).toBe("¥0.00");
272
- });
273
- it("should format Canadian locale with CAD currency", () => {
274
- const result = (0, counterValueFormatter_1.counterValueFormatter)({
275
- value: 1234.56,
276
- locale: "en-CA",
277
- currency: "CAD",
278
- });
279
- expect(result).toBe("$1,234.56");
280
- });
281
- it("should format Canadian locale with zero value", () => {
282
- const result = (0, counterValueFormatter_1.counterValueFormatter)({
283
- value: 0,
284
- locale: "en-CA",
285
- currency: "CAD",
286
- allowZeroValue: true,
287
- });
288
- expect(result).toBe("$0.00");
289
- });
290
- it("should format Brazilian locale with BRL currency", () => {
291
- const result = (0, counterValueFormatter_1.counterValueFormatter)({
292
- value: 1234.56,
293
- locale: "pt-BR",
294
- currency: "BRL",
295
- });
296
- expect(result).toBe("R$\u00A01.234,56");
297
- });
298
- it("should format Brazilian locale with zero value", () => {
299
- const result = (0, counterValueFormatter_1.counterValueFormatter)({
300
- value: 0,
301
- locale: "pt-BR",
302
- currency: "BRL",
303
- allowZeroValue: true,
304
- });
305
- expect(result).toBe("R$\u00A00,00");
306
- });
307
- it("should format Thai locale with THB currency", () => {
308
- const result = (0, counterValueFormatter_1.counterValueFormatter)({
309
- value: 1234.56,
310
- locale: "th-TH",
311
- currency: "THB",
312
- });
313
- expect(result).toBe("฿1,234.56");
314
- });
315
- it("should format Thai locale with zero value", () => {
316
- const result = (0, counterValueFormatter_1.counterValueFormatter)({
317
- value: 0,
318
- locale: "th-TH",
319
- currency: "THB",
320
- allowZeroValue: true,
321
- });
322
- expect(result).toBe("฿0.00");
323
- });
324
- it("should format Turkish locale with TRY currency", () => {
325
- const result = (0, counterValueFormatter_1.counterValueFormatter)({
326
- value: 1234.56,
327
- locale: "tr-TR",
328
- currency: "TRY",
329
- });
330
- expect(result).toBe("₺1.234,56");
331
- });
332
- it("should format Turkish locale with zero value", () => {
333
- const result = (0, counterValueFormatter_1.counterValueFormatter)({
334
- value: 0,
335
- locale: "tr-TR",
336
- currency: "TRY",
337
- allowZeroValue: true,
338
- });
339
- expect(result).toBe("₺0,00");
340
- });
341
- it("should format Russian locale with RUB currency", () => {
342
- const result = (0, counterValueFormatter_1.counterValueFormatter)({
343
- value: 1234.56,
344
- locale: "ru-RU",
345
- currency: "RUB",
346
- });
347
- expect(result).toBe("1\u00A0234,56\u00A0₽");
348
- });
349
- it("should format Russian locale with zero value", () => {
350
- const result = (0, counterValueFormatter_1.counterValueFormatter)({
351
- value: 0,
352
- locale: "ru-RU",
353
- currency: "RUB",
354
- allowZeroValue: true,
355
- });
356
- expect(result).toBe("0,00\u00A0₽");
357
- });
358
- it("should format Indian locale with INR currency", () => {
359
- const result = (0, counterValueFormatter_1.counterValueFormatter)({
360
- value: 1234.56,
361
- locale: "hi-IN",
362
- currency: "INR",
363
- });
364
- expect(result).toBe("₹1,234.56");
365
- });
366
- it("should format Indian locale with zero value", () => {
367
- const result = (0, counterValueFormatter_1.counterValueFormatter)({
368
- value: 0,
369
- locale: "hi-IN",
370
- currency: "INR",
371
- allowZeroValue: true,
372
- });
373
- expect(result).toBe("₹0.00");
374
- });
375
- it("should format Korean locale with KRW currency", () => {
376
- const result = (0, counterValueFormatter_1.counterValueFormatter)({
377
- value: 1234.56,
378
- locale: "ko-KR",
379
- currency: "KRW",
380
- });
381
- expect(result).toBe("₩1,235");
382
- });
383
- it("should format Korean locale with zero value", () => {
384
- const result = (0, counterValueFormatter_1.counterValueFormatter)({
385
- value: 0,
386
- locale: "ko-KR",
387
- currency: "KRW",
388
- allowZeroValue: true,
389
- });
390
- expect(result).toBe("₩0");
391
- });
392
- it("should format Mexican locale with MXN currency", () => {
393
- const result = (0, counterValueFormatter_1.counterValueFormatter)({
394
- value: 1234.56,
395
- locale: "es-MX",
396
- currency: "MXN",
397
- });
398
- expect(result).toBe("$1,234.56");
399
- });
400
- it("should format Mexican locale with zero value", () => {
401
- const result = (0, counterValueFormatter_1.counterValueFormatter)({
402
- value: 0,
403
- locale: "es-MX",
404
- currency: "MXN",
405
- allowZeroValue: true,
406
- });
407
- expect(result).toBe("$0.00");
408
- });
409
- it("should format South African locale with ZAR currency", () => {
410
- const result = (0, counterValueFormatter_1.counterValueFormatter)({
411
- value: 1234.56,
412
- locale: "en-ZA",
413
- currency: "ZAR",
414
- });
415
- expect(result).toBe("R\u00A01\u00A0234,56");
416
- });
417
- it("should format South African locale with zero value", () => {
418
- const result = (0, counterValueFormatter_1.counterValueFormatter)({
419
- value: 0,
420
- locale: "en-ZA",
421
- currency: "ZAR",
422
- allowZeroValue: true,
423
- });
424
- expect(result).toBe("R\u00A00,00");
425
- });
426
- it("should format Swedish locale with SEK currency", () => {
427
- const result = (0, counterValueFormatter_1.counterValueFormatter)({
428
- value: 1234.56,
429
- locale: "sv-SE",
430
- currency: "SEK",
431
- });
432
- expect(result).toBe("1\u00A0234,56\u00A0kr");
433
- });
434
- it("should format Swedish locale with zero value", () => {
435
- const result = (0, counterValueFormatter_1.counterValueFormatter)({
436
- value: 0,
437
- locale: "sv-SE",
438
- currency: "SEK",
439
- allowZeroValue: true,
440
- });
441
- expect(result).toBe("0,00\u00A0kr");
442
- });
443
- it("should format Norwegian locale with NOK currency", () => {
444
- const result = (0, counterValueFormatter_1.counterValueFormatter)({
445
- value: 1234.56,
446
- locale: "no-NO",
447
- currency: "NOK",
448
- });
449
- expect(result).toBe("1\u00A0234,56\u00A0kr");
450
- });
451
- it("should format Norwegian locale with zero value", () => {
452
- const result = (0, counterValueFormatter_1.counterValueFormatter)({
453
- value: 0,
454
- locale: "no-NO",
455
- currency: "NOK",
456
- allowZeroValue: true,
457
- });
458
- expect(result).toBe("0,00\u00A0kr");
459
- });
460
- it("should format Swiss locale with CHF currency", () => {
461
- const result = (0, counterValueFormatter_1.counterValueFormatter)({
462
- value: 1234.56,
463
- locale: "de-CH",
464
- currency: "CHF",
465
- });
466
- expect(result).toBe("CHF\u00A01’234.56");
467
- });
468
- it("should format Swiss locale with zero value", () => {
469
- const result = (0, counterValueFormatter_1.counterValueFormatter)({
470
- value: 0,
471
- locale: "de-CH",
472
- currency: "CHF",
473
- allowZeroValue: true,
474
- });
475
- expect(result).toBe("CHF\u00A00.00");
476
- });
477
- it("should format Vietnamese locale with VND currency", () => {
478
- const result = (0, counterValueFormatter_1.counterValueFormatter)({
479
- value: 1234.56,
480
- locale: "vi-VN",
481
- currency: "VND",
482
- });
483
- expect(result).toBe("1.235\u00A0₫");
484
- });
485
- it("should format Vietnamese locale with zero value", () => {
486
- const result = (0, counterValueFormatter_1.counterValueFormatter)({
487
- value: 0,
488
- locale: "vi-VN",
489
- currency: "VND",
490
- allowZeroValue: true,
491
- });
492
- expect(result).toBe("0\u00A0₫");
493
- });
494
- });
495
- });
496
- //# sourceMappingURL=counterValueFormatter.test.js.map