@ledgerhq/live-common 34.50.0-nightly.1 → 34.50.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.
Files changed (250) hide show
  1. package/lib/bridge/generic-alpaca/buildSubAccounts.d.ts +4 -4
  2. package/lib/bridge/generic-alpaca/buildSubAccounts.d.ts.map +1 -1
  3. package/lib/bridge/generic-alpaca/buildSubAccounts.js +7 -9
  4. package/lib/bridge/generic-alpaca/buildSubAccounts.js.map +1 -1
  5. package/lib/bridge/generic-alpaca/getAccountShape.d.ts.map +1 -1
  6. package/lib/bridge/generic-alpaca/getAccountShape.js +4 -6
  7. package/lib/bridge/generic-alpaca/getAccountShape.js.map +1 -1
  8. package/lib/bridge/generic-alpaca/tests/getAccountShape.test.js +5 -3
  9. package/lib/bridge/generic-alpaca/tests/getAccountShape.test.js.map +1 -1
  10. package/lib/e2e/enum/Account.d.ts +6 -0
  11. package/lib/e2e/enum/Account.d.ts.map +1 -1
  12. package/lib/e2e/enum/Account.js +8 -0
  13. package/lib/e2e/enum/Account.js.map +1 -1
  14. package/lib/e2e/enum/AppInfos.d.ts +2 -0
  15. package/lib/e2e/enum/AppInfos.d.ts.map +1 -1
  16. package/lib/e2e/enum/AppInfos.js +2 -0
  17. package/lib/e2e/enum/AppInfos.js.map +1 -1
  18. package/lib/e2e/enum/Currency.d.ts +4 -0
  19. package/lib/e2e/enum/Currency.d.ts.map +1 -1
  20. package/lib/e2e/enum/Currency.js +6 -0
  21. package/lib/e2e/enum/Currency.js.map +1 -1
  22. package/lib/e2e/enum/Network.d.ts +3 -1
  23. package/lib/e2e/enum/Network.d.ts.map +1 -1
  24. package/lib/e2e/enum/Network.js +2 -0
  25. package/lib/e2e/enum/Network.js.map +1 -1
  26. package/lib/e2e/enum/TokenType.d.ts +2 -1
  27. package/lib/e2e/enum/TokenType.d.ts.map +1 -1
  28. package/lib/e2e/enum/TokenType.js +1 -0
  29. package/lib/e2e/enum/TokenType.js.map +1 -1
  30. package/lib/e2e/enum/TransactionStatus.d.ts +4 -1
  31. package/lib/e2e/enum/TransactionStatus.d.ts.map +1 -1
  32. package/lib/e2e/enum/TransactionStatus.js +3 -0
  33. package/lib/e2e/enum/TransactionStatus.js.map +1 -1
  34. package/lib/e2e/families/hedera.d.ts +2 -0
  35. package/lib/e2e/families/hedera.d.ts.map +1 -0
  36. package/lib/e2e/families/hedera.js +11 -0
  37. package/lib/e2e/families/hedera.js.map +1 -0
  38. package/lib/e2e/families/sui.d.ts +2 -0
  39. package/lib/e2e/families/sui.d.ts.map +1 -0
  40. package/lib/e2e/families/sui.js +11 -0
  41. package/lib/e2e/families/sui.js.map +1 -0
  42. package/lib/e2e/speculos.d.ts +1 -0
  43. package/lib/e2e/speculos.d.ts.map +1 -1
  44. package/lib/e2e/speculos.js +35 -1
  45. package/lib/e2e/speculos.js.map +1 -1
  46. package/lib/exchange/platform/types.d.ts +2 -0
  47. package/lib/exchange/platform/types.d.ts.map +1 -1
  48. package/lib/exchange/swap/completeExchange.d.ts.map +1 -1
  49. package/lib/exchange/swap/completeExchange.js +22 -1
  50. package/lib/exchange/swap/completeExchange.js.map +1 -1
  51. package/lib/exchange/swap/getIncompatibleCurrencyKeys.d.ts.map +1 -1
  52. package/lib/exchange/swap/getIncompatibleCurrencyKeys.js +8 -0
  53. package/lib/exchange/swap/getIncompatibleCurrencyKeys.js.map +1 -1
  54. package/lib/families/hedera/exchange.d.ts +9 -0
  55. package/lib/families/hedera/exchange.d.ts.map +1 -0
  56. package/lib/families/hedera/exchange.js +36 -0
  57. package/lib/families/hedera/exchange.js.map +1 -0
  58. package/lib/hw/actions/completeExchange.d.ts +2 -0
  59. package/lib/hw/actions/completeExchange.d.ts.map +1 -1
  60. package/lib/hw/actions/completeExchange.js +1 -0
  61. package/lib/hw/actions/completeExchange.js.map +1 -1
  62. package/lib/modularDrawer/hooks/useCurrenciesUnderFeatureFlag.d.ts +7 -0
  63. package/lib/modularDrawer/hooks/useCurrenciesUnderFeatureFlag.d.ts.map +1 -0
  64. package/lib/modularDrawer/hooks/useCurrenciesUnderFeatureFlag.js +224 -0
  65. package/lib/modularDrawer/hooks/useCurrenciesUnderFeatureFlag.js.map +1 -0
  66. package/lib/modularDrawer/hooks/useRightBalanceAsset.d.ts +4 -3
  67. package/lib/modularDrawer/hooks/useRightBalanceAsset.d.ts.map +1 -1
  68. package/lib/modularDrawer/hooks/useRightBalanceAsset.js +13 -47
  69. package/lib/modularDrawer/hooks/useRightBalanceAsset.js.map +1 -1
  70. package/lib/modularDrawer/hooks/useRightBalanceNetwork.d.ts +1 -5
  71. package/lib/modularDrawer/hooks/useRightBalanceNetwork.d.ts.map +1 -1
  72. package/lib/modularDrawer/hooks/useRightBalanceNetwork.js +15 -55
  73. package/lib/modularDrawer/hooks/useRightBalanceNetwork.js.map +1 -1
  74. package/lib/modularDrawer/modules/createAssetConfiguration.d.ts.map +1 -1
  75. package/lib/modularDrawer/modules/createAssetConfiguration.js +2 -2
  76. package/lib/modularDrawer/modules/createAssetConfiguration.js.map +1 -1
  77. package/lib/modularDrawer/modules/createNetworkConfiguration.d.ts +1 -1
  78. package/lib/modularDrawer/modules/createNetworkConfiguration.d.ts.map +1 -1
  79. package/lib/modularDrawer/modules/createNetworkConfiguration.js +1 -3
  80. package/lib/modularDrawer/modules/createNetworkConfiguration.js.map +1 -1
  81. package/lib/modularDrawer/utils/currencyUtils.d.ts.map +1 -1
  82. package/lib/modularDrawer/utils/currencyUtils.js.map +1 -1
  83. package/lib/modularDrawer/utils/index.d.ts +3 -6
  84. package/lib/modularDrawer/utils/index.d.ts.map +1 -1
  85. package/lib/modularDrawer/utils/index.js +3 -12
  86. package/lib/modularDrawer/utils/index.js.map +1 -1
  87. package/lib/modularDrawer/utils/index.test.js +0 -26
  88. package/lib/modularDrawer/utils/index.test.js.map +1 -1
  89. package/lib/modularDrawer/utils/type.d.ts +0 -6
  90. package/lib/modularDrawer/utils/type.d.ts.map +1 -1
  91. package/lib/wallet-api/constants.d.ts +1 -1
  92. package/lib/wallet-api/constants.d.ts.map +1 -1
  93. package/lib-es/bridge/generic-alpaca/buildSubAccounts.d.ts +4 -4
  94. package/lib-es/bridge/generic-alpaca/buildSubAccounts.d.ts.map +1 -1
  95. package/lib-es/bridge/generic-alpaca/buildSubAccounts.js +7 -9
  96. package/lib-es/bridge/generic-alpaca/buildSubAccounts.js.map +1 -1
  97. package/lib-es/bridge/generic-alpaca/getAccountShape.d.ts.map +1 -1
  98. package/lib-es/bridge/generic-alpaca/getAccountShape.js +4 -6
  99. package/lib-es/bridge/generic-alpaca/getAccountShape.js.map +1 -1
  100. package/lib-es/bridge/generic-alpaca/tests/getAccountShape.test.js +5 -3
  101. package/lib-es/bridge/generic-alpaca/tests/getAccountShape.test.js.map +1 -1
  102. package/lib-es/e2e/enum/Account.d.ts +6 -0
  103. package/lib-es/e2e/enum/Account.d.ts.map +1 -1
  104. package/lib-es/e2e/enum/Account.js +8 -0
  105. package/lib-es/e2e/enum/Account.js.map +1 -1
  106. package/lib-es/e2e/enum/AppInfos.d.ts +2 -0
  107. package/lib-es/e2e/enum/AppInfos.d.ts.map +1 -1
  108. package/lib-es/e2e/enum/AppInfos.js +2 -0
  109. package/lib-es/e2e/enum/AppInfos.js.map +1 -1
  110. package/lib-es/e2e/enum/Currency.d.ts +4 -0
  111. package/lib-es/e2e/enum/Currency.d.ts.map +1 -1
  112. package/lib-es/e2e/enum/Currency.js +6 -0
  113. package/lib-es/e2e/enum/Currency.js.map +1 -1
  114. package/lib-es/e2e/enum/Network.d.ts +3 -1
  115. package/lib-es/e2e/enum/Network.d.ts.map +1 -1
  116. package/lib-es/e2e/enum/Network.js +2 -0
  117. package/lib-es/e2e/enum/Network.js.map +1 -1
  118. package/lib-es/e2e/enum/TokenType.d.ts +2 -1
  119. package/lib-es/e2e/enum/TokenType.d.ts.map +1 -1
  120. package/lib-es/e2e/enum/TokenType.js +1 -0
  121. package/lib-es/e2e/enum/TokenType.js.map +1 -1
  122. package/lib-es/e2e/enum/TransactionStatus.d.ts +4 -1
  123. package/lib-es/e2e/enum/TransactionStatus.d.ts.map +1 -1
  124. package/lib-es/e2e/enum/TransactionStatus.js +3 -0
  125. package/lib-es/e2e/enum/TransactionStatus.js.map +1 -1
  126. package/lib-es/e2e/families/hedera.d.ts +2 -0
  127. package/lib-es/e2e/families/hedera.d.ts.map +1 -0
  128. package/lib-es/e2e/families/hedera.js +7 -0
  129. package/lib-es/e2e/families/hedera.js.map +1 -0
  130. package/lib-es/e2e/families/sui.d.ts +2 -0
  131. package/lib-es/e2e/families/sui.d.ts.map +1 -0
  132. package/lib-es/e2e/families/sui.js +7 -0
  133. package/lib-es/e2e/families/sui.js.map +1 -0
  134. package/lib-es/e2e/speculos.d.ts +1 -0
  135. package/lib-es/e2e/speculos.d.ts.map +1 -1
  136. package/lib-es/e2e/speculos.js +33 -0
  137. package/lib-es/e2e/speculos.js.map +1 -1
  138. package/lib-es/exchange/platform/types.d.ts +2 -0
  139. package/lib-es/exchange/platform/types.d.ts.map +1 -1
  140. package/lib-es/exchange/swap/completeExchange.d.ts.map +1 -1
  141. package/lib-es/exchange/swap/completeExchange.js +22 -1
  142. package/lib-es/exchange/swap/completeExchange.js.map +1 -1
  143. package/lib-es/exchange/swap/getIncompatibleCurrencyKeys.d.ts.map +1 -1
  144. package/lib-es/exchange/swap/getIncompatibleCurrencyKeys.js +8 -0
  145. package/lib-es/exchange/swap/getIncompatibleCurrencyKeys.js.map +1 -1
  146. package/lib-es/families/hedera/exchange.d.ts +9 -0
  147. package/lib-es/families/hedera/exchange.d.ts.map +1 -0
  148. package/lib-es/families/hedera/exchange.js +29 -0
  149. package/lib-es/families/hedera/exchange.js.map +1 -0
  150. package/lib-es/hw/actions/completeExchange.d.ts +2 -0
  151. package/lib-es/hw/actions/completeExchange.d.ts.map +1 -1
  152. package/lib-es/hw/actions/completeExchange.js +1 -0
  153. package/lib-es/hw/actions/completeExchange.js.map +1 -1
  154. package/lib-es/modularDrawer/hooks/useCurrenciesUnderFeatureFlag.d.ts +7 -0
  155. package/lib-es/modularDrawer/hooks/useCurrenciesUnderFeatureFlag.d.ts.map +1 -0
  156. package/lib-es/modularDrawer/hooks/useCurrenciesUnderFeatureFlag.js +217 -0
  157. package/lib-es/modularDrawer/hooks/useCurrenciesUnderFeatureFlag.js.map +1 -0
  158. package/lib-es/modularDrawer/hooks/useRightBalanceAsset.d.ts +4 -3
  159. package/lib-es/modularDrawer/hooks/useRightBalanceAsset.d.ts.map +1 -1
  160. package/lib-es/modularDrawer/hooks/useRightBalanceAsset.js +13 -47
  161. package/lib-es/modularDrawer/hooks/useRightBalanceAsset.js.map +1 -1
  162. package/lib-es/modularDrawer/hooks/useRightBalanceNetwork.d.ts +1 -5
  163. package/lib-es/modularDrawer/hooks/useRightBalanceNetwork.d.ts.map +1 -1
  164. package/lib-es/modularDrawer/hooks/useRightBalanceNetwork.js +15 -55
  165. package/lib-es/modularDrawer/hooks/useRightBalanceNetwork.js.map +1 -1
  166. package/lib-es/modularDrawer/modules/createAssetConfiguration.d.ts.map +1 -1
  167. package/lib-es/modularDrawer/modules/createAssetConfiguration.js +2 -2
  168. package/lib-es/modularDrawer/modules/createAssetConfiguration.js.map +1 -1
  169. package/lib-es/modularDrawer/modules/createNetworkConfiguration.d.ts +1 -1
  170. package/lib-es/modularDrawer/modules/createNetworkConfiguration.d.ts.map +1 -1
  171. package/lib-es/modularDrawer/modules/createNetworkConfiguration.js +1 -3
  172. package/lib-es/modularDrawer/modules/createNetworkConfiguration.js.map +1 -1
  173. package/lib-es/modularDrawer/utils/__tests__/currencyUtils.test.js +1 -1
  174. package/lib-es/modularDrawer/utils/__tests__/currencyUtils.test.js.map +1 -1
  175. package/lib-es/modularDrawer/utils/currencyUtils.d.ts.map +1 -1
  176. package/lib-es/modularDrawer/utils/currencyUtils.js.map +1 -1
  177. package/lib-es/modularDrawer/utils/index.d.ts +3 -6
  178. package/lib-es/modularDrawer/utils/index.d.ts.map +1 -1
  179. package/lib-es/modularDrawer/utils/index.js +3 -10
  180. package/lib-es/modularDrawer/utils/index.js.map +1 -1
  181. package/lib-es/modularDrawer/utils/index.test.js +1 -27
  182. package/lib-es/modularDrawer/utils/index.test.js.map +1 -1
  183. package/lib-es/modularDrawer/utils/type.d.ts +0 -6
  184. package/lib-es/modularDrawer/utils/type.d.ts.map +1 -1
  185. package/lib-es/wallet-api/constants.d.ts +1 -1
  186. package/lib-es/wallet-api/constants.d.ts.map +1 -1
  187. package/package.json +45 -43
  188. package/src/bridge/generic-alpaca/buildSubAccounts.ts +28 -28
  189. package/src/bridge/generic-alpaca/getAccountShape.ts +9 -12
  190. package/src/bridge/generic-alpaca/tests/getAccountShape.test.ts +5 -3
  191. package/src/e2e/enum/Account.ts +41 -0
  192. package/src/e2e/enum/AppInfos.ts +4 -0
  193. package/src/e2e/enum/Currency.ts +21 -0
  194. package/src/e2e/enum/Network.ts +2 -0
  195. package/src/e2e/enum/TokenType.ts +1 -0
  196. package/src/e2e/enum/TransactionStatus.ts +3 -0
  197. package/src/e2e/families/hedera.ts +7 -0
  198. package/src/e2e/families/sui.ts +7 -0
  199. package/src/e2e/speculos.ts +34 -0
  200. package/src/exchange/platform/types.ts +2 -0
  201. package/src/exchange/swap/completeExchange.ts +32 -2
  202. package/src/exchange/swap/getIncompatibleCurrencyKeys.ts +8 -0
  203. package/src/families/hedera/exchange.ts +48 -0
  204. package/src/hw/actions/completeExchange.ts +3 -0
  205. package/src/modularDrawer/hooks/useCurrenciesUnderFeatureFlag.ts +231 -0
  206. package/src/modularDrawer/hooks/useRightBalanceAsset.tsx +16 -76
  207. package/src/modularDrawer/hooks/useRightBalanceNetwork.tsx +25 -95
  208. package/src/modularDrawer/modules/createAssetConfiguration.ts +3 -11
  209. package/src/modularDrawer/modules/createNetworkConfiguration.ts +1 -8
  210. package/src/modularDrawer/utils/__tests__/currencyUtils.test.ts +1 -1
  211. package/src/modularDrawer/utils/currencyUtils.ts +0 -1
  212. package/src/modularDrawer/utils/index.test.ts +1 -32
  213. package/src/modularDrawer/utils/index.ts +4 -23
  214. package/src/modularDrawer/utils/type.ts +0 -6
  215. package/lib/modularDrawer/utils/__tests__/haveOneCommonProvider.test.d.ts +0 -2
  216. package/lib/modularDrawer/utils/__tests__/haveOneCommonProvider.test.d.ts.map +0 -1
  217. package/lib/modularDrawer/utils/__tests__/haveOneCommonProvider.test.js +0 -28
  218. package/lib/modularDrawer/utils/__tests__/haveOneCommonProvider.test.js.map +0 -1
  219. package/lib/modularDrawer/utils/buildProviderCurrenciesMap.d.ts +0 -9
  220. package/lib/modularDrawer/utils/buildProviderCurrenciesMap.d.ts.map +0 -1
  221. package/lib/modularDrawer/utils/buildProviderCurrenciesMap.js +0 -17
  222. package/lib/modularDrawer/utils/buildProviderCurrenciesMap.js.map +0 -1
  223. package/lib/modularDrawer/utils/getProviderCurrency.d.ts +0 -3
  224. package/lib/modularDrawer/utils/getProviderCurrency.d.ts.map +0 -1
  225. package/lib/modularDrawer/utils/getProviderCurrency.js +0 -14
  226. package/lib/modularDrawer/utils/getProviderCurrency.js.map +0 -1
  227. package/lib/modularDrawer/utils/haveOneCommonProvider.d.ts +0 -11
  228. package/lib/modularDrawer/utils/haveOneCommonProvider.d.ts.map +0 -1
  229. package/lib/modularDrawer/utils/haveOneCommonProvider.js +0 -29
  230. package/lib/modularDrawer/utils/haveOneCommonProvider.js.map +0 -1
  231. package/lib-es/modularDrawer/utils/__tests__/haveOneCommonProvider.test.d.ts +0 -2
  232. package/lib-es/modularDrawer/utils/__tests__/haveOneCommonProvider.test.d.ts.map +0 -1
  233. package/lib-es/modularDrawer/utils/__tests__/haveOneCommonProvider.test.js +0 -26
  234. package/lib-es/modularDrawer/utils/__tests__/haveOneCommonProvider.test.js.map +0 -1
  235. package/lib-es/modularDrawer/utils/buildProviderCurrenciesMap.d.ts +0 -9
  236. package/lib-es/modularDrawer/utils/buildProviderCurrenciesMap.d.ts.map +0 -1
  237. package/lib-es/modularDrawer/utils/buildProviderCurrenciesMap.js +0 -13
  238. package/lib-es/modularDrawer/utils/buildProviderCurrenciesMap.js.map +0 -1
  239. package/lib-es/modularDrawer/utils/getProviderCurrency.d.ts +0 -3
  240. package/lib-es/modularDrawer/utils/getProviderCurrency.d.ts.map +0 -1
  241. package/lib-es/modularDrawer/utils/getProviderCurrency.js +0 -10
  242. package/lib-es/modularDrawer/utils/getProviderCurrency.js.map +0 -1
  243. package/lib-es/modularDrawer/utils/haveOneCommonProvider.d.ts +0 -11
  244. package/lib-es/modularDrawer/utils/haveOneCommonProvider.d.ts.map +0 -1
  245. package/lib-es/modularDrawer/utils/haveOneCommonProvider.js +0 -25
  246. package/lib-es/modularDrawer/utils/haveOneCommonProvider.js.map +0 -1
  247. package/src/modularDrawer/utils/__tests__/haveOneCommonProvider.test.ts +0 -34
  248. package/src/modularDrawer/utils/buildProviderCurrenciesMap.tsx +0 -25
  249. package/src/modularDrawer/utils/getProviderCurrency.ts +0 -13
  250. package/src/modularDrawer/utils/haveOneCommonProvider.ts +0 -31
@@ -1,26 +0,0 @@
1
- import { haveOneCommonProvider } from "../haveOneCommonProvider";
2
- import { useGroupedCurrenciesByProvider } from "../../__mocks__/useGroupedCurrenciesByProvider.mock";
3
- jest.mock("../../../deposit/useGroupedCurrenciesByProvider.hook", () => ({
4
- useGroupedCurrenciesByProvider: () => useGroupedCurrenciesByProvider(),
5
- }));
6
- describe("haveOneCommonProvider", () => {
7
- it("should return false for an empty array", () => {
8
- expect(haveOneCommonProvider([], [])).toBe(false);
9
- });
10
- it("should return true for a single currency with one provider", () => {
11
- const { result } = useGroupedCurrenciesByProvider(true);
12
- const { currenciesByProvider } = result;
13
- expect(haveOneCommonProvider(["bitcoin"], currenciesByProvider)).toBe(true);
14
- });
15
- it("should return false for multiple currencies with different providers", () => {
16
- const { result } = useGroupedCurrenciesByProvider(true);
17
- const { currenciesByProvider } = result;
18
- expect(haveOneCommonProvider(["bitcoin", "ethereum"], currenciesByProvider)).toBe(false);
19
- });
20
- it("should return true for multiple currencies with the same provider", () => {
21
- const { result } = useGroupedCurrenciesByProvider(true);
22
- const { currenciesByProvider } = result;
23
- expect(haveOneCommonProvider(["ethereum", "arbitrum"], currenciesByProvider)).toBe(true);
24
- });
25
- });
26
- //# sourceMappingURL=haveOneCommonProvider.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"haveOneCommonProvider.test.js","sourceRoot":"","sources":["../../../../src/modularDrawer/utils/__tests__/haveOneCommonProvider.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,EAAE,8BAA8B,EAAE,MAAM,qDAAqD,CAAC;AAGrG,IAAI,CAAC,IAAI,CAAC,sDAAsD,EAAE,GAAG,EAAE,CAAC,CAAC;IACvE,8BAA8B,EAAE,GAAG,EAAE,CAAC,8BAA8B,EAAE;CACvE,CAAC,CAAC,CAAC;AAEJ,QAAQ,CAAC,uBAAuB,EAAE,GAAG,EAAE;IACrC,EAAE,CAAC,wCAAwC,EAAE,GAAG,EAAE;QAChD,MAAM,CAAC,qBAAqB,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACpD,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,4DAA4D,EAAE,GAAG,EAAE;QACpE,MAAM,EAAE,MAAM,EAAE,GAAG,8BAA8B,CAAC,IAAI,CAAkC,CAAC;QACzF,MAAM,EAAE,oBAAoB,EAAE,GAAG,MAAM,CAAC;QAExC,MAAM,CAAC,qBAAqB,CAAC,CAAC,SAAS,CAAC,EAAE,oBAAoB,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC9E,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,sEAAsE,EAAE,GAAG,EAAE;QAC9E,MAAM,EAAE,MAAM,EAAE,GAAG,8BAA8B,CAAC,IAAI,CAAkC,CAAC;QACzF,MAAM,EAAE,oBAAoB,EAAE,GAAG,MAAM,CAAC;QAExC,MAAM,CAAC,qBAAqB,CAAC,CAAC,SAAS,EAAE,UAAU,CAAC,EAAE,oBAAoB,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC3F,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,mEAAmE,EAAE,GAAG,EAAE;QAC3E,MAAM,EAAE,MAAM,EAAE,GAAG,8BAA8B,CAAC,IAAI,CAAkC,CAAC;QACzF,MAAM,EAAE,oBAAoB,EAAE,GAAG,MAAM,CAAC;QAExC,MAAM,CAAC,qBAAqB,CAAC,CAAC,UAAU,EAAE,UAAU,CAAC,EAAE,oBAAoB,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC3F,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -1,9 +0,0 @@
1
- import { CryptoOrTokenCurrency } from "@ledgerhq/types-cryptoassets";
2
- export declare const buildProviderCurrenciesMap: (currenciesByProvider?: Array<{
3
- providerId: string;
4
- currenciesByNetwork?: CryptoOrTokenCurrency[];
5
- }>) => Map<string, {
6
- mainCurrency: CryptoOrTokenCurrency;
7
- currencies: CryptoOrTokenCurrency[];
8
- }> | null;
9
- //# sourceMappingURL=buildProviderCurrenciesMap.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"buildProviderCurrenciesMap.d.ts","sourceRoot":"","sources":["../../../src/modularDrawer/utils/buildProviderCurrenciesMap.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAErE,eAAO,MAAM,0BAA0B,0BACd,MAAM;IAC3B,UAAU,EAAE,MAAM,CAAC;IACnB,mBAAmB,CAAC,EAAE,qBAAqB,EAAE,CAAC;CAC/C,CAAC;kBAMgB,qBAAqB;gBAAc,qBAAqB,EAAE;SAY7E,CAAC"}
@@ -1,13 +0,0 @@
1
- export const buildProviderCurrenciesMap = (currenciesByProvider) => {
2
- if (!currenciesByProvider?.length)
3
- return null;
4
- const map = new Map();
5
- currenciesByProvider.forEach(({ providerId, currenciesByNetwork = [] }) => {
6
- if (currenciesByNetwork.length > 0) {
7
- const mainCurrency = currenciesByNetwork.find(c => c.id === providerId) ?? currenciesByNetwork[0];
8
- map.set(providerId, { mainCurrency, currencies: currenciesByNetwork });
9
- }
10
- });
11
- return map;
12
- };
13
- //# sourceMappingURL=buildProviderCurrenciesMap.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"buildProviderCurrenciesMap.js","sourceRoot":"","sources":["../../../src/modularDrawer/utils/buildProviderCurrenciesMap.tsx"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,0BAA0B,GAAG,CACxC,oBAGE,EACF,EAAE;IACF,IAAI,CAAC,oBAAoB,EAAE,MAAM;QAAE,OAAO,IAAI,CAAC;IAE/C,MAAM,GAAG,GAAG,IAAI,GAAG,EAGhB,CAAC;IAEJ,oBAAoB,CAAC,OAAO,CAAC,CAAC,EAAE,UAAU,EAAE,mBAAmB,GAAG,EAAE,EAAE,EAAE,EAAE;QACxE,IAAI,mBAAmB,CAAC,MAAM,GAAG,CAAC,EAAE;YAClC,MAAM,YAAY,GAChB,mBAAmB,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,UAAU,CAAC,IAAI,mBAAmB,CAAC,CAAC,CAAC,CAAC;YAC/E,GAAG,CAAC,GAAG,CAAC,UAAU,EAAE,EAAE,YAAY,EAAE,UAAU,EAAE,mBAAmB,EAAE,CAAC,CAAC;SACxE;IACH,CAAC,CAAC,CAAC;IAEH,OAAO,GAAG,CAAC;AACb,CAAC,CAAC"}
@@ -1,3 +0,0 @@
1
- import { CryptoOrTokenCurrency } from "@ledgerhq/types-cryptoassets";
2
- export declare const getProviderCurrency: (mainCurrency: CryptoOrTokenCurrency, currencies: CryptoOrTokenCurrency[]) => CryptoOrTokenCurrency;
3
- //# sourceMappingURL=getProviderCurrency.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getProviderCurrency.d.ts","sourceRoot":"","sources":["../../../src/modularDrawer/utils/getProviderCurrency.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAGrE,eAAO,MAAM,mBAAmB,iBAChB,qBAAqB,cACvB,qBAAqB,EAAE,0BAOpC,CAAC"}
@@ -1,10 +0,0 @@
1
- import { getTokenOrCryptoCurrencyById } from "../../deposit/helper";
2
- export const getProviderCurrency = (mainCurrency, currencies) => {
3
- try {
4
- return getTokenOrCryptoCurrencyById(mainCurrency.id);
5
- }
6
- catch {
7
- return getTokenOrCryptoCurrencyById(currencies[0].id);
8
- }
9
- };
10
- //# sourceMappingURL=getProviderCurrency.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getProviderCurrency.js","sourceRoot":"","sources":["../../../src/modularDrawer/utils/getProviderCurrency.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,4BAA4B,EAAE,MAAM,sBAAsB,CAAC;AAEpE,MAAM,CAAC,MAAM,mBAAmB,GAAG,CACjC,YAAmC,EACnC,UAAmC,EACnC,EAAE;IACF,IAAI;QACF,OAAO,4BAA4B,CAAC,YAAY,CAAC,EAAE,CAAC,CAAC;KACtD;IAAC,MAAM;QACN,OAAO,4BAA4B,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;KACvD;AACH,CAAC,CAAC"}
@@ -1,11 +0,0 @@
1
- import { CurrenciesByProviderId } from "../../deposit/type";
2
- /**
3
- * This function checks if all currencies in the provided array
4
- * it stopped at the first currency that does not match to prevent unnecessary iterations.
5
- *
6
- * @param currenciesIdsArray array of currency IDs to check
7
- * @param currenciesByProvider array of currencies grouped by provider
8
- * @returns boolean indicating whether all currencies in the array have one common provider
9
- */
10
- export declare const haveOneCommonProvider: (currenciesIdsArray: string[], currenciesByProvider: CurrenciesByProviderId[]) => boolean;
11
- //# sourceMappingURL=haveOneCommonProvider.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"haveOneCommonProvider.d.ts","sourceRoot":"","sources":["../../../src/modularDrawer/utils/haveOneCommonProvider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAE5D;;;;;;;GAOG;AACH,eAAO,MAAM,qBAAqB,uBACZ,MAAM,EAAE,wBACN,sBAAsB,EAAE,KAC7C,OAiBF,CAAC"}
@@ -1,25 +0,0 @@
1
- /**
2
- * This function checks if all currencies in the provided array
3
- * it stopped at the first currency that does not match to prevent unnecessary iterations.
4
- *
5
- * @param currenciesIdsArray array of currency IDs to check
6
- * @param currenciesByProvider array of currencies grouped by provider
7
- * @returns boolean indicating whether all currencies in the array have one common provider
8
- */
9
- export const haveOneCommonProvider = (currenciesIdsArray, currenciesByProvider) => {
10
- if (currenciesIdsArray.length === 0)
11
- return false;
12
- const providerIds = new Set();
13
- for (const currencyId of currenciesIdsArray) {
14
- for (const provider of currenciesByProvider) {
15
- if (provider.currenciesByNetwork.some(currency => currency.id === currencyId)) {
16
- providerIds.add(provider.providerId);
17
- if (providerIds.size > 1) {
18
- return false;
19
- }
20
- }
21
- }
22
- }
23
- return true;
24
- };
25
- //# sourceMappingURL=haveOneCommonProvider.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"haveOneCommonProvider.js","sourceRoot":"","sources":["../../../src/modularDrawer/utils/haveOneCommonProvider.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,CACnC,kBAA4B,EAC5B,oBAA8C,EACrC,EAAE;IACX,IAAI,kBAAkB,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC;IAElD,MAAM,WAAW,GAAG,IAAI,GAAG,EAAU,CAAC;IAEtC,KAAK,MAAM,UAAU,IAAI,kBAAkB,EAAE;QAC3C,KAAK,MAAM,QAAQ,IAAI,oBAAoB,EAAE;YAC3C,IAAI,QAAQ,CAAC,mBAAmB,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,QAAQ,CAAC,EAAE,KAAK,UAAU,CAAC,EAAE;gBAC7E,WAAW,CAAC,GAAG,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC;gBACrC,IAAI,WAAW,CAAC,IAAI,GAAG,CAAC,EAAE;oBACxB,OAAO,KAAK,CAAC;iBACd;aACF;SACF;KACF;IAED,OAAO,IAAI,CAAC;AACd,CAAC,CAAC"}
@@ -1,34 +0,0 @@
1
- import { haveOneCommonProvider } from "../haveOneCommonProvider";
2
- import { useGroupedCurrenciesByProvider } from "../../__mocks__/useGroupedCurrenciesByProvider.mock";
3
- import { LoadingBasedGroupedCurrencies } from "../../../deposit/type";
4
-
5
- jest.mock("../../../deposit/useGroupedCurrenciesByProvider.hook", () => ({
6
- useGroupedCurrenciesByProvider: () => useGroupedCurrenciesByProvider(),
7
- }));
8
-
9
- describe("haveOneCommonProvider", () => {
10
- it("should return false for an empty array", () => {
11
- expect(haveOneCommonProvider([], [])).toBe(false);
12
- });
13
-
14
- it("should return true for a single currency with one provider", () => {
15
- const { result } = useGroupedCurrenciesByProvider(true) as LoadingBasedGroupedCurrencies;
16
- const { currenciesByProvider } = result;
17
-
18
- expect(haveOneCommonProvider(["bitcoin"], currenciesByProvider)).toBe(true);
19
- });
20
-
21
- it("should return false for multiple currencies with different providers", () => {
22
- const { result } = useGroupedCurrenciesByProvider(true) as LoadingBasedGroupedCurrencies;
23
- const { currenciesByProvider } = result;
24
-
25
- expect(haveOneCommonProvider(["bitcoin", "ethereum"], currenciesByProvider)).toBe(false);
26
- });
27
-
28
- it("should return true for multiple currencies with the same provider", () => {
29
- const { result } = useGroupedCurrenciesByProvider(true) as LoadingBasedGroupedCurrencies;
30
- const { currenciesByProvider } = result;
31
-
32
- expect(haveOneCommonProvider(["ethereum", "arbitrum"], currenciesByProvider)).toBe(true);
33
- });
34
- });
@@ -1,25 +0,0 @@
1
- import { CryptoOrTokenCurrency } from "@ledgerhq/types-cryptoassets";
2
-
3
- export const buildProviderCurrenciesMap = (
4
- currenciesByProvider?: Array<{
5
- providerId: string;
6
- currenciesByNetwork?: CryptoOrTokenCurrency[];
7
- }>,
8
- ) => {
9
- if (!currenciesByProvider?.length) return null;
10
-
11
- const map = new Map<
12
- string,
13
- { mainCurrency: CryptoOrTokenCurrency; currencies: CryptoOrTokenCurrency[] }
14
- >();
15
-
16
- currenciesByProvider.forEach(({ providerId, currenciesByNetwork = [] }) => {
17
- if (currenciesByNetwork.length > 0) {
18
- const mainCurrency =
19
- currenciesByNetwork.find(c => c.id === providerId) ?? currenciesByNetwork[0];
20
- map.set(providerId, { mainCurrency, currencies: currenciesByNetwork });
21
- }
22
- });
23
-
24
- return map;
25
- };
@@ -1,13 +0,0 @@
1
- import { CryptoOrTokenCurrency } from "@ledgerhq/types-cryptoassets";
2
- import { getTokenOrCryptoCurrencyById } from "../../deposit/helper";
3
-
4
- export const getProviderCurrency = (
5
- mainCurrency: CryptoOrTokenCurrency,
6
- currencies: CryptoOrTokenCurrency[],
7
- ) => {
8
- try {
9
- return getTokenOrCryptoCurrencyById(mainCurrency.id);
10
- } catch {
11
- return getTokenOrCryptoCurrencyById(currencies[0].id);
12
- }
13
- };
@@ -1,31 +0,0 @@
1
- import { CurrenciesByProviderId } from "../../deposit/type";
2
-
3
- /**
4
- * This function checks if all currencies in the provided array
5
- * it stopped at the first currency that does not match to prevent unnecessary iterations.
6
- *
7
- * @param currenciesIdsArray array of currency IDs to check
8
- * @param currenciesByProvider array of currencies grouped by provider
9
- * @returns boolean indicating whether all currencies in the array have one common provider
10
- */
11
- export const haveOneCommonProvider = (
12
- currenciesIdsArray: string[],
13
- currenciesByProvider: CurrenciesByProviderId[],
14
- ): boolean => {
15
- if (currenciesIdsArray.length === 0) return false;
16
-
17
- const providerIds = new Set<string>();
18
-
19
- for (const currencyId of currenciesIdsArray) {
20
- for (const provider of currenciesByProvider) {
21
- if (provider.currenciesByNetwork.some(currency => currency.id === currencyId)) {
22
- providerIds.add(provider.providerId);
23
- if (providerIds.size > 1) {
24
- return false;
25
- }
26
- }
27
- }
28
- }
29
-
30
- return true;
31
- };