@ledgerhq/live-common 34.42.1 → 34.43.0-nightly.1

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 (229) hide show
  1. package/lib/__tests__/migration/account-migration.js +3 -0
  2. package/lib/__tests__/migration/account-migration.js.map +1 -1
  3. package/lib/__tests__/test-helpers/environment.js +3 -0
  4. package/lib/__tests__/test-helpers/environment.js.map +1 -1
  5. package/lib/bridge/crypto-assets/index.d.ts +4 -0
  6. package/lib/bridge/crypto-assets/index.d.ts.map +1 -0
  7. package/lib/bridge/crypto-assets/index.js +52 -0
  8. package/lib/bridge/crypto-assets/index.js.map +1 -0
  9. package/lib/bridge/crypto-assets/index.test.d.ts +2 -0
  10. package/lib/bridge/crypto-assets/index.test.d.ts.map +1 -0
  11. package/lib/bridge/crypto-assets/index.test.js +85 -0
  12. package/lib/bridge/crypto-assets/index.test.js.map +1 -0
  13. package/lib/bridge/generic-alpaca/alpaca/network/network-alpaca.d.ts +3 -1
  14. package/lib/bridge/generic-alpaca/alpaca/network/network-alpaca.d.ts.map +1 -1
  15. package/lib/bridge/generic-alpaca/alpaca/network/network-alpaca.js +6 -0
  16. package/lib/bridge/generic-alpaca/alpaca/network/network-alpaca.js.map +1 -1
  17. package/lib/bridge/impl.d.ts +2 -0
  18. package/lib/bridge/impl.d.ts.map +1 -1
  19. package/lib/bridge/impl.js +8 -1
  20. package/lib/bridge/impl.js.map +1 -1
  21. package/lib/bridge/useBridgeTransaction.test.js +1 -1
  22. package/lib/bridge/useBridgeTransaction.test.js.map +1 -1
  23. package/lib/e2e/families/osmosis.d.ts +3 -0
  24. package/lib/e2e/families/osmosis.d.ts.map +1 -0
  25. package/lib/e2e/families/osmosis.js +19 -0
  26. package/lib/e2e/families/osmosis.js.map +1 -0
  27. package/lib/e2e/index.d.ts +9 -0
  28. package/lib/e2e/index.d.ts.map +1 -1
  29. package/lib/e2e/speculos.d.ts.map +1 -1
  30. package/lib/e2e/speculos.js +50 -17
  31. package/lib/e2e/speculos.js.map +1 -1
  32. package/lib/e2e/speculosCI.d.ts.map +1 -1
  33. package/lib/e2e/speculosCI.js +22 -4
  34. package/lib/e2e/speculosCI.js.map +1 -1
  35. package/lib/env.react.d.ts +1 -1
  36. package/lib/env.react.d.ts.map +1 -1
  37. package/lib/exchange/error.d.ts +2 -1
  38. package/lib/exchange/error.d.ts.map +1 -1
  39. package/lib/exchange/error.js +5 -3
  40. package/lib/exchange/error.js.map +1 -1
  41. package/lib/exchange/swap/completeExchange.js +2 -2
  42. package/lib/exchange/swap/completeExchange.js.map +1 -1
  43. package/lib/families/evm/config.d.ts.map +1 -1
  44. package/lib/families/evm/config.js +51 -0
  45. package/lib/families/evm/config.js.map +1 -1
  46. package/lib/families/evm/walletApiAdapter.js +1 -1
  47. package/lib/families/solana/bridge/mock-data.d.ts.map +1 -1
  48. package/lib/families/solana/bridge/mock-data.js +46 -316
  49. package/lib/families/solana/bridge/mock-data.js.map +1 -1
  50. package/lib/families/solana/bridge/mock.js +2 -2
  51. package/lib/families/solana/bridge/mock.js.map +1 -1
  52. package/lib/featureFlags/defaultFeatures.d.ts +3 -0
  53. package/lib/featureFlags/defaultFeatures.d.ts.map +1 -1
  54. package/lib/featureFlags/defaultFeatures.js +4 -0
  55. package/lib/featureFlags/defaultFeatures.js.map +1 -1
  56. package/lib/featureFlags/useFeature.d.ts +1 -1
  57. package/lib/featureFlags/useFeature.d.ts.map +1 -1
  58. package/lib/modularDrawer/__mocks__/accounts.mock.d.ts +18 -0
  59. package/lib/modularDrawer/__mocks__/accounts.mock.d.ts.map +1 -0
  60. package/lib/modularDrawer/__mocks__/accounts.mock.js +48 -0
  61. package/lib/modularDrawer/__mocks__/accounts.mock.js.map +1 -0
  62. package/lib/modularDrawer/__mocks__/currencies.mock.d.ts +17 -0
  63. package/lib/modularDrawer/__mocks__/currencies.mock.d.ts.map +1 -0
  64. package/lib/modularDrawer/__mocks__/currencies.mock.js +60 -0
  65. package/lib/modularDrawer/__mocks__/currencies.mock.js.map +1 -0
  66. package/lib/modularDrawer/__mocks__/useGroupedCurrenciesByProvider.mock.d.ts +22 -0
  67. package/lib/modularDrawer/__mocks__/useGroupedCurrenciesByProvider.mock.d.ts.map +1 -0
  68. package/lib/modularDrawer/__mocks__/useGroupedCurrenciesByProvider.mock.js +41 -0
  69. package/lib/modularDrawer/__mocks__/useGroupedCurrenciesByProvider.mock.js.map +1 -0
  70. package/lib/modularDrawer/utils/__tests__/haveOneCommonProvider.test.d.ts +2 -0
  71. package/lib/modularDrawer/utils/__tests__/haveOneCommonProvider.test.d.ts.map +1 -0
  72. package/lib/modularDrawer/utils/__tests__/haveOneCommonProvider.test.js +28 -0
  73. package/lib/modularDrawer/utils/__tests__/haveOneCommonProvider.test.js.map +1 -0
  74. package/lib/modularDrawer/utils/haveOneCommonProvider.d.ts +11 -0
  75. package/lib/modularDrawer/utils/haveOneCommonProvider.d.ts.map +1 -0
  76. package/lib/modularDrawer/utils/haveOneCommonProvider.js +29 -0
  77. package/lib/modularDrawer/utils/haveOneCommonProvider.js.map +1 -0
  78. package/lib/modularDrawer/utils/index.d.ts +2 -1
  79. package/lib/modularDrawer/utils/index.d.ts.map +1 -1
  80. package/lib/modularDrawer/utils/index.js +3 -1
  81. package/lib/modularDrawer/utils/index.js.map +1 -1
  82. package/lib/utils/__tests__/composeHooks.test.d.ts +2 -0
  83. package/lib/utils/__tests__/composeHooks.test.d.ts.map +1 -0
  84. package/lib/utils/__tests__/composeHooks.test.js +35 -0
  85. package/lib/utils/__tests__/composeHooks.test.js.map +1 -0
  86. package/lib/utils/__tests__/getAccountTuplesForCurrency.test.d.ts +2 -0
  87. package/lib/utils/__tests__/getAccountTuplesForCurrency.test.d.ts.map +1 -0
  88. package/lib/utils/__tests__/getAccountTuplesForCurrency.test.js +104 -0
  89. package/lib/utils/__tests__/getAccountTuplesForCurrency.test.js.map +1 -0
  90. package/lib/utils/composeHooks.d.ts +11 -0
  91. package/lib/utils/composeHooks.d.ts.map +1 -0
  92. package/lib/utils/composeHooks.js +25 -0
  93. package/lib/utils/composeHooks.js.map +1 -0
  94. package/lib/utils/getAccountTuplesForCurrency.d.ts +8 -0
  95. package/lib/utils/getAccountTuplesForCurrency.d.ts.map +1 -0
  96. package/lib/utils/getAccountTuplesForCurrency.js +19 -0
  97. package/lib/utils/getAccountTuplesForCurrency.js.map +1 -0
  98. package/lib/wallet-api/Exchange/server.d.ts.map +1 -1
  99. package/lib/wallet-api/Exchange/server.js +6 -6
  100. package/lib/wallet-api/Exchange/server.js.map +1 -1
  101. package/lib-es/__tests__/migration/account-migration.js +3 -0
  102. package/lib-es/__tests__/migration/account-migration.js.map +1 -1
  103. package/lib-es/__tests__/test-helpers/environment.js +3 -0
  104. package/lib-es/__tests__/test-helpers/environment.js.map +1 -1
  105. package/lib-es/bridge/crypto-assets/index.d.ts +4 -0
  106. package/lib-es/bridge/crypto-assets/index.d.ts.map +1 -0
  107. package/lib-es/bridge/crypto-assets/index.js +24 -0
  108. package/lib-es/bridge/crypto-assets/index.js.map +1 -0
  109. package/lib-es/bridge/crypto-assets/index.test.d.ts +2 -0
  110. package/lib-es/bridge/crypto-assets/index.test.d.ts.map +1 -0
  111. package/lib-es/bridge/crypto-assets/index.test.js +60 -0
  112. package/lib-es/bridge/crypto-assets/index.test.js.map +1 -0
  113. package/lib-es/bridge/generic-alpaca/alpaca/network/network-alpaca.d.ts +3 -1
  114. package/lib-es/bridge/generic-alpaca/alpaca/network/network-alpaca.d.ts.map +1 -1
  115. package/lib-es/bridge/generic-alpaca/alpaca/network/network-alpaca.js +6 -0
  116. package/lib-es/bridge/generic-alpaca/alpaca/network/network-alpaca.js.map +1 -1
  117. package/lib-es/bridge/impl.d.ts +2 -0
  118. package/lib-es/bridge/impl.d.ts.map +1 -1
  119. package/lib-es/bridge/impl.js +6 -0
  120. package/lib-es/bridge/impl.js.map +1 -1
  121. package/lib-es/bridge/useBridgeTransaction.test.js +1 -1
  122. package/lib-es/bridge/useBridgeTransaction.test.js.map +1 -1
  123. package/lib-es/e2e/families/osmosis.d.ts +3 -0
  124. package/lib-es/e2e/families/osmosis.d.ts.map +1 -0
  125. package/lib-es/e2e/families/osmosis.js +12 -0
  126. package/lib-es/e2e/families/osmosis.js.map +1 -0
  127. package/lib-es/e2e/index.d.ts +9 -0
  128. package/lib-es/e2e/index.d.ts.map +1 -1
  129. package/lib-es/e2e/speculos.d.ts.map +1 -1
  130. package/lib-es/e2e/speculos.js +50 -17
  131. package/lib-es/e2e/speculos.js.map +1 -1
  132. package/lib-es/e2e/speculosCI.d.ts.map +1 -1
  133. package/lib-es/e2e/speculosCI.js +22 -4
  134. package/lib-es/e2e/speculosCI.js.map +1 -1
  135. package/lib-es/env.react.d.ts +1 -1
  136. package/lib-es/env.react.d.ts.map +1 -1
  137. package/lib-es/exchange/error.d.ts +2 -1
  138. package/lib-es/exchange/error.d.ts.map +1 -1
  139. package/lib-es/exchange/error.js +5 -3
  140. package/lib-es/exchange/error.js.map +1 -1
  141. package/lib-es/exchange/swap/completeExchange.js +2 -2
  142. package/lib-es/exchange/swap/completeExchange.js.map +1 -1
  143. package/lib-es/families/evm/config.d.ts.map +1 -1
  144. package/lib-es/families/evm/config.js +51 -0
  145. package/lib-es/families/evm/config.js.map +1 -1
  146. package/lib-es/families/evm/walletApiAdapter.js +1 -1
  147. package/lib-es/families/solana/bridge/mock-data.d.ts.map +1 -1
  148. package/lib-es/families/solana/bridge/mock-data.js +46 -316
  149. package/lib-es/families/solana/bridge/mock-data.js.map +1 -1
  150. package/lib-es/families/solana/bridge/mock.js +3 -3
  151. package/lib-es/families/solana/bridge/mock.js.map +1 -1
  152. package/lib-es/featureFlags/defaultFeatures.d.ts +3 -0
  153. package/lib-es/featureFlags/defaultFeatures.d.ts.map +1 -1
  154. package/lib-es/featureFlags/defaultFeatures.js +4 -0
  155. package/lib-es/featureFlags/defaultFeatures.js.map +1 -1
  156. package/lib-es/featureFlags/useFeature.d.ts +1 -1
  157. package/lib-es/featureFlags/useFeature.d.ts.map +1 -1
  158. package/lib-es/modularDrawer/__mocks__/accounts.mock.d.ts +18 -0
  159. package/lib-es/modularDrawer/__mocks__/accounts.mock.d.ts.map +1 -0
  160. package/lib-es/modularDrawer/__mocks__/accounts.mock.js +42 -0
  161. package/lib-es/modularDrawer/__mocks__/accounts.mock.js.map +1 -0
  162. package/lib-es/modularDrawer/__mocks__/currencies.mock.d.ts +17 -0
  163. package/lib-es/modularDrawer/__mocks__/currencies.mock.d.ts.map +1 -0
  164. package/lib-es/modularDrawer/__mocks__/currencies.mock.js +55 -0
  165. package/lib-es/modularDrawer/__mocks__/currencies.mock.js.map +1 -0
  166. package/lib-es/modularDrawer/__mocks__/useGroupedCurrenciesByProvider.mock.d.ts +22 -0
  167. package/lib-es/modularDrawer/__mocks__/useGroupedCurrenciesByProvider.mock.d.ts.map +1 -0
  168. package/lib-es/modularDrawer/__mocks__/useGroupedCurrenciesByProvider.mock.js +38 -0
  169. package/lib-es/modularDrawer/__mocks__/useGroupedCurrenciesByProvider.mock.js.map +1 -0
  170. package/lib-es/modularDrawer/utils/__tests__/haveOneCommonProvider.test.d.ts +2 -0
  171. package/lib-es/modularDrawer/utils/__tests__/haveOneCommonProvider.test.d.ts.map +1 -0
  172. package/lib-es/modularDrawer/utils/__tests__/haveOneCommonProvider.test.js +26 -0
  173. package/lib-es/modularDrawer/utils/__tests__/haveOneCommonProvider.test.js.map +1 -0
  174. package/lib-es/modularDrawer/utils/haveOneCommonProvider.d.ts +11 -0
  175. package/lib-es/modularDrawer/utils/haveOneCommonProvider.d.ts.map +1 -0
  176. package/lib-es/modularDrawer/utils/haveOneCommonProvider.js +25 -0
  177. package/lib-es/modularDrawer/utils/haveOneCommonProvider.js.map +1 -0
  178. package/lib-es/modularDrawer/utils/index.d.ts +2 -1
  179. package/lib-es/modularDrawer/utils/index.d.ts.map +1 -1
  180. package/lib-es/modularDrawer/utils/index.js +2 -1
  181. package/lib-es/modularDrawer/utils/index.js.map +1 -1
  182. package/lib-es/utils/__tests__/composeHooks.test.d.ts +2 -0
  183. package/lib-es/utils/__tests__/composeHooks.test.d.ts.map +1 -0
  184. package/lib-es/utils/__tests__/composeHooks.test.js +33 -0
  185. package/lib-es/utils/__tests__/composeHooks.test.js.map +1 -0
  186. package/lib-es/utils/__tests__/getAccountTuplesForCurrency.test.d.ts +2 -0
  187. package/lib-es/utils/__tests__/getAccountTuplesForCurrency.test.d.ts.map +1 -0
  188. package/lib-es/utils/__tests__/getAccountTuplesForCurrency.test.js +102 -0
  189. package/lib-es/utils/__tests__/getAccountTuplesForCurrency.test.js.map +1 -0
  190. package/lib-es/utils/composeHooks.d.ts +11 -0
  191. package/lib-es/utils/composeHooks.d.ts.map +1 -0
  192. package/lib-es/utils/composeHooks.js +21 -0
  193. package/lib-es/utils/composeHooks.js.map +1 -0
  194. package/lib-es/utils/getAccountTuplesForCurrency.d.ts +8 -0
  195. package/lib-es/utils/getAccountTuplesForCurrency.d.ts.map +1 -0
  196. package/lib-es/utils/getAccountTuplesForCurrency.js +15 -0
  197. package/lib-es/utils/getAccountTuplesForCurrency.js.map +1 -0
  198. package/lib-es/wallet-api/Exchange/server.d.ts.map +1 -1
  199. package/lib-es/wallet-api/Exchange/server.js +6 -6
  200. package/lib-es/wallet-api/Exchange/server.js.map +1 -1
  201. package/package.json +50 -50
  202. package/src/__tests__/migration/account-migration.ts +3 -0
  203. package/src/__tests__/test-helpers/environment.ts +3 -0
  204. package/src/bridge/crypto-assets/index.test.ts +71 -0
  205. package/src/bridge/crypto-assets/index.ts +30 -0
  206. package/src/bridge/generic-alpaca/alpaca/network/network-alpaca.ts +8 -1
  207. package/src/bridge/impl.ts +8 -0
  208. package/src/bridge/useBridgeTransaction.test.ts +1 -1
  209. package/src/e2e/families/osmosis.ts +13 -0
  210. package/src/e2e/speculos.ts +82 -23
  211. package/src/e2e/speculosCI.ts +32 -10
  212. package/src/exchange/error.ts +5 -3
  213. package/src/exchange/swap/completeExchange.ts +2 -2
  214. package/src/families/evm/config.ts +51 -0
  215. package/src/families/evm/walletApiAdapter.ts +1 -1
  216. package/src/families/solana/bridge/mock-data.ts +52 -316
  217. package/src/families/solana/bridge/mock.ts +3 -3
  218. package/src/featureFlags/defaultFeatures.ts +4 -0
  219. package/src/modularDrawer/__mocks__/accounts.mock.ts +43 -0
  220. package/src/modularDrawer/__mocks__/currencies.mock.ts +62 -0
  221. package/src/modularDrawer/__mocks__/useGroupedCurrenciesByProvider.mock.ts +49 -0
  222. package/src/modularDrawer/utils/__tests__/haveOneCommonProvider.test.ts +34 -0
  223. package/src/modularDrawer/utils/haveOneCommonProvider.ts +31 -0
  224. package/src/modularDrawer/utils/index.ts +2 -1
  225. package/src/utils/__tests__/composeHooks.test.ts +46 -0
  226. package/src/utils/__tests__/getAccountTuplesForCurrency.test.ts +138 -0
  227. package/src/utils/composeHooks.ts +26 -0
  228. package/src/utils/getAccountTuplesForCurrency.ts +34 -0
  229. package/src/wallet-api/Exchange/server.ts +7 -6
@@ -7,6 +7,34 @@ import {
7
7
  } from "@ledgerhq/coin-solana/network/index";
8
8
  import { Functions } from "@ledgerhq/coin-solana/utils";
9
9
 
10
+ // Helper function to generate mock prioritization fees
11
+ const generatePrioritizationFees = (
12
+ startSlot: number,
13
+ count: number = 150,
14
+ prioritizationFee: number = 0,
15
+ ) => {
16
+ return Array.from({ length: count }, (_, index) => ({
17
+ prioritizationFee,
18
+ slot: startSlot + index,
19
+ }));
20
+ };
21
+
22
+ // Helper function to generate nested prioritization fees format
23
+ const generateNestedPrioritizationFees = (slot: number, prioritizationFee: number = 0) => {
24
+ return [
25
+ [
26
+ {
27
+ slot,
28
+ prioritizationFee,
29
+ },
30
+ {
31
+ slot,
32
+ prioritizationFee,
33
+ },
34
+ ],
35
+ ];
36
+ };
37
+
10
38
  export const getMockedMethods = (): {
11
39
  method: Functions<ChainAPI>;
12
40
  params: any[];
@@ -889,18 +917,7 @@ export const getMockedMethods = (): {
889
917
  {
890
918
  method: "getRecentPrioritizationFees",
891
919
  params: [["AQbkEagmPgmsdAfS4X8V8UyJnXXjVPMvjeD15etqQ3Jh"]],
892
- answer: [
893
- [
894
- {
895
- slot: 122422797,
896
- prioritizationFee: 0,
897
- },
898
- {
899
- slot: 122422797,
900
- prioritizationFee: 0,
901
- },
902
- ],
903
- ],
920
+ answer: generateNestedPrioritizationFees(122422797),
904
921
  },
905
922
  {
906
923
  method: "getAccountInfo",
@@ -946,158 +963,7 @@ export const getMockedMethods = (): {
946
963
  {
947
964
  method: "getRecentPrioritizationFees",
948
965
  params: [["4iWtrn54zi89sHQv6xHyYwDsrPJvqcSKRJGBLrbErCsx"]],
949
- answer: [
950
- { prioritizationFee: 0, slot: 349496453 },
951
- { prioritizationFee: 0, slot: 349496454 },
952
- { prioritizationFee: 0, slot: 349496455 },
953
- { prioritizationFee: 0, slot: 349496456 },
954
- { prioritizationFee: 0, slot: 349496457 },
955
- { prioritizationFee: 0, slot: 349496458 },
956
- { prioritizationFee: 0, slot: 349496459 },
957
- { prioritizationFee: 0, slot: 349496460 },
958
- { prioritizationFee: 0, slot: 349496461 },
959
- { prioritizationFee: 0, slot: 349496462 },
960
- { prioritizationFee: 0, slot: 349496463 },
961
- { prioritizationFee: 0, slot: 349496464 },
962
- { prioritizationFee: 0, slot: 349496465 },
963
- { prioritizationFee: 0, slot: 349496466 },
964
- { prioritizationFee: 0, slot: 349496467 },
965
- { prioritizationFee: 0, slot: 349496468 },
966
- { prioritizationFee: 0, slot: 349496469 },
967
- { prioritizationFee: 0, slot: 349496470 },
968
- { prioritizationFee: 0, slot: 349496471 },
969
- { prioritizationFee: 0, slot: 349496472 },
970
- { prioritizationFee: 0, slot: 349496473 },
971
- { prioritizationFee: 0, slot: 349496474 },
972
- { prioritizationFee: 0, slot: 349496475 },
973
- { prioritizationFee: 0, slot: 349496476 },
974
- { prioritizationFee: 0, slot: 349496477 },
975
- { prioritizationFee: 0, slot: 349496478 },
976
- { prioritizationFee: 0, slot: 349496479 },
977
- { prioritizationFee: 0, slot: 349496480 },
978
- { prioritizationFee: 0, slot: 349496481 },
979
- { prioritizationFee: 0, slot: 349496482 },
980
- { prioritizationFee: 0, slot: 349496483 },
981
- { prioritizationFee: 0, slot: 349496484 },
982
- { prioritizationFee: 0, slot: 349496485 },
983
- { prioritizationFee: 0, slot: 349496486 },
984
- { prioritizationFee: 0, slot: 349496487 },
985
- { prioritizationFee: 0, slot: 349496488 },
986
- { prioritizationFee: 0, slot: 349496489 },
987
- { prioritizationFee: 0, slot: 349496490 },
988
- { prioritizationFee: 0, slot: 349496491 },
989
- { prioritizationFee: 0, slot: 349496492 },
990
- { prioritizationFee: 0, slot: 349496493 },
991
- { prioritizationFee: 0, slot: 349496494 },
992
- { prioritizationFee: 0, slot: 349496495 },
993
- { prioritizationFee: 0, slot: 349496496 },
994
- { prioritizationFee: 0, slot: 349496497 },
995
- { prioritizationFee: 0, slot: 349496498 },
996
- { prioritizationFee: 0, slot: 349496499 },
997
- { prioritizationFee: 0, slot: 349496500 },
998
- { prioritizationFee: 0, slot: 349496501 },
999
- { prioritizationFee: 0, slot: 349496502 },
1000
- { prioritizationFee: 0, slot: 349496503 },
1001
- { prioritizationFee: 0, slot: 349496504 },
1002
- { prioritizationFee: 0, slot: 349496505 },
1003
- { prioritizationFee: 0, slot: 349496506 },
1004
- { prioritizationFee: 0, slot: 349496507 },
1005
- { prioritizationFee: 0, slot: 349496508 },
1006
- { prioritizationFee: 0, slot: 349496509 },
1007
- { prioritizationFee: 0, slot: 349496510 },
1008
- { prioritizationFee: 0, slot: 349496511 },
1009
- { prioritizationFee: 0, slot: 349496512 },
1010
- { prioritizationFee: 0, slot: 349496513 },
1011
- { prioritizationFee: 0, slot: 349496514 },
1012
- { prioritizationFee: 0, slot: 349496515 },
1013
- { prioritizationFee: 0, slot: 349496516 },
1014
- { prioritizationFee: 0, slot: 349496517 },
1015
- { prioritizationFee: 0, slot: 349496518 },
1016
- { prioritizationFee: 0, slot: 349496519 },
1017
- { prioritizationFee: 0, slot: 349496520 },
1018
- { prioritizationFee: 0, slot: 349496521 },
1019
- { prioritizationFee: 0, slot: 349496522 },
1020
- { prioritizationFee: 0, slot: 349496523 },
1021
- { prioritizationFee: 0, slot: 349496524 },
1022
- { prioritizationFee: 0, slot: 349496525 },
1023
- { prioritizationFee: 0, slot: 349496526 },
1024
- { prioritizationFee: 0, slot: 349496527 },
1025
- { prioritizationFee: 0, slot: 349496528 },
1026
- { prioritizationFee: 0, slot: 349496529 },
1027
- { prioritizationFee: 0, slot: 349496530 },
1028
- { prioritizationFee: 0, slot: 349496531 },
1029
- { prioritizationFee: 0, slot: 349496532 },
1030
- { prioritizationFee: 0, slot: 349496533 },
1031
- { prioritizationFee: 0, slot: 349496534 },
1032
- { prioritizationFee: 0, slot: 349496535 },
1033
- { prioritizationFee: 0, slot: 349496536 },
1034
- { prioritizationFee: 0, slot: 349496537 },
1035
- { prioritizationFee: 0, slot: 349496538 },
1036
- { prioritizationFee: 0, slot: 349496539 },
1037
- { prioritizationFee: 0, slot: 349496540 },
1038
- { prioritizationFee: 0, slot: 349496541 },
1039
- { prioritizationFee: 0, slot: 349496542 },
1040
- { prioritizationFee: 0, slot: 349496543 },
1041
- { prioritizationFee: 0, slot: 349496544 },
1042
- { prioritizationFee: 0, slot: 349496545 },
1043
- { prioritizationFee: 0, slot: 349496546 },
1044
- { prioritizationFee: 0, slot: 349496547 },
1045
- { prioritizationFee: 0, slot: 349496548 },
1046
- { prioritizationFee: 0, slot: 349496549 },
1047
- { prioritizationFee: 0, slot: 349496550 },
1048
- { prioritizationFee: 0, slot: 349496551 },
1049
- { prioritizationFee: 0, slot: 349496552 },
1050
- { prioritizationFee: 0, slot: 349496553 },
1051
- { prioritizationFee: 0, slot: 349496554 },
1052
- { prioritizationFee: 0, slot: 349496555 },
1053
- { prioritizationFee: 0, slot: 349496556 },
1054
- { prioritizationFee: 0, slot: 349496557 },
1055
- { prioritizationFee: 0, slot: 349496558 },
1056
- { prioritizationFee: 0, slot: 349496559 },
1057
- { prioritizationFee: 0, slot: 349496560 },
1058
- { prioritizationFee: 0, slot: 349496561 },
1059
- { prioritizationFee: 0, slot: 349496562 },
1060
- { prioritizationFee: 0, slot: 349496563 },
1061
- { prioritizationFee: 0, slot: 349496564 },
1062
- { prioritizationFee: 0, slot: 349496565 },
1063
- { prioritizationFee: 0, slot: 349496566 },
1064
- { prioritizationFee: 0, slot: 349496567 },
1065
- { prioritizationFee: 0, slot: 349496568 },
1066
- { prioritizationFee: 0, slot: 349496569 },
1067
- { prioritizationFee: 0, slot: 349496570 },
1068
- { prioritizationFee: 0, slot: 349496571 },
1069
- { prioritizationFee: 0, slot: 349496572 },
1070
- { prioritizationFee: 0, slot: 349496573 },
1071
- { prioritizationFee: 0, slot: 349496574 },
1072
- { prioritizationFee: 0, slot: 349496575 },
1073
- { prioritizationFee: 0, slot: 349496576 },
1074
- { prioritizationFee: 0, slot: 349496577 },
1075
- { prioritizationFee: 0, slot: 349496578 },
1076
- { prioritizationFee: 0, slot: 349496579 },
1077
- { prioritizationFee: 0, slot: 349496580 },
1078
- { prioritizationFee: 0, slot: 349496581 },
1079
- { prioritizationFee: 0, slot: 349496582 },
1080
- { prioritizationFee: 0, slot: 349496583 },
1081
- { prioritizationFee: 0, slot: 349496584 },
1082
- { prioritizationFee: 0, slot: 349496585 },
1083
- { prioritizationFee: 0, slot: 349496586 },
1084
- { prioritizationFee: 0, slot: 349496587 },
1085
- { prioritizationFee: 0, slot: 349496588 },
1086
- { prioritizationFee: 0, slot: 349496589 },
1087
- { prioritizationFee: 0, slot: 349496590 },
1088
- { prioritizationFee: 0, slot: 349496591 },
1089
- { prioritizationFee: 0, slot: 349496592 },
1090
- { prioritizationFee: 0, slot: 349496593 },
1091
- { prioritizationFee: 0, slot: 349496594 },
1092
- { prioritizationFee: 0, slot: 349496595 },
1093
- { prioritizationFee: 0, slot: 349496596 },
1094
- { prioritizationFee: 0, slot: 349496597 },
1095
- { prioritizationFee: 0, slot: 349496598 },
1096
- { prioritizationFee: 0, slot: 349496599 },
1097
- { prioritizationFee: 0, slot: 349496600 },
1098
- { prioritizationFee: 0, slot: 349496601 },
1099
- { prioritizationFee: 0, slot: 349496602 },
1100
- ],
966
+ answer: generatePrioritizationFees(349496453),
1101
967
  },
1102
968
  {
1103
969
  method: "getSimulationComputeUnits",
@@ -1139,158 +1005,7 @@ export const getMockedMethods = (): {
1139
1005
  "63M7kPJvLsG46jbR2ZriEU8xwPqkMNKNoBBQ46pobbvo",
1140
1006
  ],
1141
1007
  ],
1142
- answer: [
1143
- { prioritizationFee: 0, slot: 349496454 },
1144
- { prioritizationFee: 0, slot: 349496455 },
1145
- { prioritizationFee: 0, slot: 349496456 },
1146
- { prioritizationFee: 0, slot: 349496457 },
1147
- { prioritizationFee: 0, slot: 349496458 },
1148
- { prioritizationFee: 0, slot: 349496459 },
1149
- { prioritizationFee: 0, slot: 349496460 },
1150
- { prioritizationFee: 0, slot: 349496461 },
1151
- { prioritizationFee: 0, slot: 349496462 },
1152
- { prioritizationFee: 0, slot: 349496463 },
1153
- { prioritizationFee: 0, slot: 349496464 },
1154
- { prioritizationFee: 0, slot: 349496465 },
1155
- { prioritizationFee: 0, slot: 349496466 },
1156
- { prioritizationFee: 0, slot: 349496467 },
1157
- { prioritizationFee: 0, slot: 349496468 },
1158
- { prioritizationFee: 0, slot: 349496469 },
1159
- { prioritizationFee: 0, slot: 349496470 },
1160
- { prioritizationFee: 0, slot: 349496471 },
1161
- { prioritizationFee: 0, slot: 349496472 },
1162
- { prioritizationFee: 0, slot: 349496473 },
1163
- { prioritizationFee: 0, slot: 349496474 },
1164
- { prioritizationFee: 0, slot: 349496475 },
1165
- { prioritizationFee: 0, slot: 349496476 },
1166
- { prioritizationFee: 0, slot: 349496477 },
1167
- { prioritizationFee: 0, slot: 349496478 },
1168
- { prioritizationFee: 0, slot: 349496479 },
1169
- { prioritizationFee: 0, slot: 349496480 },
1170
- { prioritizationFee: 0, slot: 349496481 },
1171
- { prioritizationFee: 0, slot: 349496482 },
1172
- { prioritizationFee: 0, slot: 349496483 },
1173
- { prioritizationFee: 0, slot: 349496484 },
1174
- { prioritizationFee: 0, slot: 349496485 },
1175
- { prioritizationFee: 0, slot: 349496486 },
1176
- { prioritizationFee: 0, slot: 349496487 },
1177
- { prioritizationFee: 0, slot: 349496488 },
1178
- { prioritizationFee: 0, slot: 349496489 },
1179
- { prioritizationFee: 0, slot: 349496490 },
1180
- { prioritizationFee: 0, slot: 349496491 },
1181
- { prioritizationFee: 0, slot: 349496492 },
1182
- { prioritizationFee: 0, slot: 349496493 },
1183
- { prioritizationFee: 0, slot: 349496494 },
1184
- { prioritizationFee: 0, slot: 349496495 },
1185
- { prioritizationFee: 0, slot: 349496496 },
1186
- { prioritizationFee: 0, slot: 349496497 },
1187
- { prioritizationFee: 0, slot: 349496498 },
1188
- { prioritizationFee: 0, slot: 349496499 },
1189
- { prioritizationFee: 0, slot: 349496500 },
1190
- { prioritizationFee: 0, slot: 349496501 },
1191
- { prioritizationFee: 0, slot: 349496502 },
1192
- { prioritizationFee: 0, slot: 349496503 },
1193
- { prioritizationFee: 0, slot: 349496504 },
1194
- { prioritizationFee: 0, slot: 349496505 },
1195
- { prioritizationFee: 0, slot: 349496506 },
1196
- { prioritizationFee: 0, slot: 349496507 },
1197
- { prioritizationFee: 0, slot: 349496508 },
1198
- { prioritizationFee: 0, slot: 349496509 },
1199
- { prioritizationFee: 0, slot: 349496510 },
1200
- { prioritizationFee: 0, slot: 349496511 },
1201
- { prioritizationFee: 0, slot: 349496512 },
1202
- { prioritizationFee: 0, slot: 349496513 },
1203
- { prioritizationFee: 0, slot: 349496514 },
1204
- { prioritizationFee: 0, slot: 349496515 },
1205
- { prioritizationFee: 0, slot: 349496516 },
1206
- { prioritizationFee: 0, slot: 349496517 },
1207
- { prioritizationFee: 0, slot: 349496518 },
1208
- { prioritizationFee: 0, slot: 349496519 },
1209
- { prioritizationFee: 0, slot: 349496520 },
1210
- { prioritizationFee: 0, slot: 349496521 },
1211
- { prioritizationFee: 0, slot: 349496522 },
1212
- { prioritizationFee: 0, slot: 349496523 },
1213
- { prioritizationFee: 0, slot: 349496524 },
1214
- { prioritizationFee: 0, slot: 349496525 },
1215
- { prioritizationFee: 0, slot: 349496526 },
1216
- { prioritizationFee: 0, slot: 349496527 },
1217
- { prioritizationFee: 0, slot: 349496528 },
1218
- { prioritizationFee: 0, slot: 349496529 },
1219
- { prioritizationFee: 0, slot: 349496530 },
1220
- { prioritizationFee: 0, slot: 349496531 },
1221
- { prioritizationFee: 0, slot: 349496532 },
1222
- { prioritizationFee: 0, slot: 349496533 },
1223
- { prioritizationFee: 0, slot: 349496534 },
1224
- { prioritizationFee: 0, slot: 349496535 },
1225
- { prioritizationFee: 0, slot: 349496536 },
1226
- { prioritizationFee: 0, slot: 349496537 },
1227
- { prioritizationFee: 0, slot: 349496538 },
1228
- { prioritizationFee: 0, slot: 349496539 },
1229
- { prioritizationFee: 0, slot: 349496540 },
1230
- { prioritizationFee: 0, slot: 349496541 },
1231
- { prioritizationFee: 0, slot: 349496542 },
1232
- { prioritizationFee: 0, slot: 349496543 },
1233
- { prioritizationFee: 0, slot: 349496544 },
1234
- { prioritizationFee: 0, slot: 349496545 },
1235
- { prioritizationFee: 0, slot: 349496546 },
1236
- { prioritizationFee: 0, slot: 349496547 },
1237
- { prioritizationFee: 0, slot: 349496548 },
1238
- { prioritizationFee: 0, slot: 349496549 },
1239
- { prioritizationFee: 0, slot: 349496550 },
1240
- { prioritizationFee: 0, slot: 349496551 },
1241
- { prioritizationFee: 0, slot: 349496552 },
1242
- { prioritizationFee: 0, slot: 349496553 },
1243
- { prioritizationFee: 0, slot: 349496554 },
1244
- { prioritizationFee: 0, slot: 349496555 },
1245
- { prioritizationFee: 0, slot: 349496556 },
1246
- { prioritizationFee: 0, slot: 349496557 },
1247
- { prioritizationFee: 0, slot: 349496558 },
1248
- { prioritizationFee: 0, slot: 349496559 },
1249
- { prioritizationFee: 0, slot: 349496560 },
1250
- { prioritizationFee: 0, slot: 349496561 },
1251
- { prioritizationFee: 0, slot: 349496562 },
1252
- { prioritizationFee: 0, slot: 349496563 },
1253
- { prioritizationFee: 0, slot: 349496564 },
1254
- { prioritizationFee: 0, slot: 349496565 },
1255
- { prioritizationFee: 0, slot: 349496566 },
1256
- { prioritizationFee: 0, slot: 349496567 },
1257
- { prioritizationFee: 0, slot: 349496568 },
1258
- { prioritizationFee: 0, slot: 349496569 },
1259
- { prioritizationFee: 0, slot: 349496570 },
1260
- { prioritizationFee: 0, slot: 349496571 },
1261
- { prioritizationFee: 0, slot: 349496572 },
1262
- { prioritizationFee: 0, slot: 349496573 },
1263
- { prioritizationFee: 0, slot: 349496574 },
1264
- { prioritizationFee: 0, slot: 349496575 },
1265
- { prioritizationFee: 0, slot: 349496576 },
1266
- { prioritizationFee: 0, slot: 349496577 },
1267
- { prioritizationFee: 0, slot: 349496578 },
1268
- { prioritizationFee: 0, slot: 349496579 },
1269
- { prioritizationFee: 0, slot: 349496580 },
1270
- { prioritizationFee: 0, slot: 349496581 },
1271
- { prioritizationFee: 0, slot: 349496582 },
1272
- { prioritizationFee: 0, slot: 349496583 },
1273
- { prioritizationFee: 0, slot: 349496584 },
1274
- { prioritizationFee: 0, slot: 349496585 },
1275
- { prioritizationFee: 0, slot: 349496586 },
1276
- { prioritizationFee: 0, slot: 349496587 },
1277
- { prioritizationFee: 0, slot: 349496588 },
1278
- { prioritizationFee: 0, slot: 349496589 },
1279
- { prioritizationFee: 0, slot: 349496590 },
1280
- { prioritizationFee: 0, slot: 349496591 },
1281
- { prioritizationFee: 0, slot: 349496592 },
1282
- { prioritizationFee: 0, slot: 349496593 },
1283
- { prioritizationFee: 0, slot: 349496594 },
1284
- { prioritizationFee: 0, slot: 349496595 },
1285
- { prioritizationFee: 0, slot: 349496596 },
1286
- { prioritizationFee: 0, slot: 349496597 },
1287
- { prioritizationFee: 0, slot: 349496598 },
1288
- { prioritizationFee: 0, slot: 349496599 },
1289
- { prioritizationFee: 0, slot: 349496600 },
1290
- { prioritizationFee: 0, slot: 349496601 },
1291
- { prioritizationFee: 0, slot: 349496602 },
1292
- { prioritizationFee: 0, slot: 349496603 },
1293
- ],
1008
+ answer: generatePrioritizationFees(349496454),
1294
1009
  },
1295
1010
  {
1296
1011
  method: "getSimulationComputeUnits",
@@ -1317,4 +1032,25 @@ export const getMockedMethods = (): {
1317
1032
  ],
1318
1033
  answer: 300,
1319
1034
  },
1035
+ {
1036
+ method: "getFeeForMessage",
1037
+ params: [
1038
+ "gAEAAwo3NaziKyCZH4sQdjxlyAEEsycLhyQPWK6FJrb9j7r0jyRhB0FkC3pA/3bwHKZzD9v7Rt2mGOXiT8AiHUK2gDwsRJgSfTDFH6xNF2pMhFGZxLZWMl8EsYB3Ro87lHwnuWJUb9EWTtCgOsaT9mU8t4D2GHpAPhkXU2fcZBXT6D+pjfj05KOdlS9AiDNsbZdFpLzbJQ+lmsMa+8nfR2JZTeC89UIrAvAD7ZOgJ4wimZg0XyXSOCz2YXE8kINJuux17h3+Z4YL4MPru92uqdoO9qUoSbP2t3tFyBv0piXrLPXBPgMGRm/lIRcy/+ytunLDm+e8jOW7xfcSayxDmzpAAAAABHnVW/IxwG7udMVuzmgVB/2xst6j9I5RArHNola8E48G3fbh12Whk9nL4UbO63msHLSF7V9bN5E6jPWFfv8AqRa6MXuFOieWIcE2CMOB5dDllphXzarmndZ4yX86tmlPBQcABQL1qAQABwAJA5PxAgAAAAAACAUFAB0JGAmT8Xtk9ISudv0IPwkbAAMKCwUaHQgIGQghGwoLDA4NDyAiHycJJhsaKQoEExIQESQlIycJHioXKhUUBAsdKRYqGwkJKCoGAgEIHCzBIJszQdacgQADAAAAOV0AA08HAAImZAIDgIQeAAAAAAAxibAAAAAAADIAAAkDBQAAAQkEKb+VBypPvwTfcXWT5zi8zCEnKBXCRxqA2fn1VbDUhCUCKRgHEwAoAwIXFVl9OSuqqDQaRb6IYUBogcRuGRFfhgIEuha8cjU4fZPaBGAGBWUEAwkCAX3AxxcCHMtm5xM+0XoyZnzQ09ar0YPXd26YYBeNqWxqBHj0dPIF8W95dfO3dNOoPmZnmihT46QbLY1Y/HoBFLJX/wryNAMqjbbuHQTj5MrHA87Gyw==",
1039
+ ],
1040
+ answer: 5126,
1041
+ },
1042
+ {
1043
+ method: "getFeeForMessage",
1044
+ params: [
1045
+ "AQABAzc1rOIrIJkfixB2PGXIAQSzJwuHJA9YroUmtv2PuvSPdaMhhWgGf/cOLK4MfSqKoh7TzOlbq+4eA+l1aEoKxIQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAC7eSTZPjADfAV2K5ZMTBC9Qv7DN/mRWMGcOHqHwTiqeAQICAAEMAgAAAICWmAAAAAAA",
1046
+ ],
1047
+ answer: 5000,
1048
+ },
1049
+ {
1050
+ method: "getFeeForMessage",
1051
+ params: [
1052
+ "gAEAAQM3NaziKyCZH4sQdjxlyAEEsycLhyQPWK6FJrb9j7r0j3WjIYVoBn/3DiyuDH0qiqIe08zpW6vuHgPpdWhKCsSEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAXy8ypDosdfEh+2iQdH7SMOBblSXabBjQnkjkz87PSigECAgABDAIAAACAlpgAAAAAAAA=",
1053
+ ],
1054
+ answer: 5000,
1055
+ },
1320
1056
  ];
@@ -11,7 +11,7 @@ import { Functions } from "@ledgerhq/coin-solana/utils";
11
11
  import { makeBridges } from "@ledgerhq/coin-solana/bridge/bridge";
12
12
  import { PubKeyDisplayMode, SolanaSigner } from "@ledgerhq/coin-solana/signer";
13
13
  import { makeLRUCache, minutes } from "@ledgerhq/live-network/cache";
14
- import { Message } from "@solana/web3.js";
14
+ import { Message, MessageV0 } from "@solana/web3.js";
15
15
  import { flow, isArray, isEqual, isObject, isUndefined, mapValues, omitBy } from "lodash/fp";
16
16
  import { getMockedMethods } from "./mock-data";
17
17
  import { scanAccounts, sync } from "../../../bridge/mockHelpers";
@@ -59,8 +59,8 @@ function removeUndefineds(input: unknown): unknown {
59
59
  function preprocessArgs(method: keyof ChainAPI, args: any) {
60
60
  if (method === "getFeeForMessage") {
61
61
  // getFeeForMessage needs some args preprocessing
62
- if (args.length === 1 && args[0] instanceof Message) {
63
- return [args[0].serialize().toString("base64")];
62
+ if (args.length === 1 && (args[0] instanceof Message || args[0] instanceof MessageV0)) {
63
+ return [Buffer.from(args[0].serialize()).toString("base64")];
64
64
  } else {
65
65
  throw new Error("unexpected getFeeForMessage function signature");
66
66
  }
@@ -92,6 +92,9 @@ export const CURRENCY_DEFAULT_FEATURES = {
92
92
  currencySui: DEFAULT_FEATURE,
93
93
  currencyMina: DEFAULT_FEATURE,
94
94
  currencyBabylon: DEFAULT_FEATURE,
95
+ currencySeiNetworkEvm: DEFAULT_FEATURE,
96
+ currencyBerachain: DEFAULT_FEATURE,
97
+ currencyHyperevm: DEFAULT_FEATURE,
95
98
  };
96
99
 
97
100
  /**
@@ -619,6 +622,7 @@ export const DEFAULT_FEATURES: Features = {
619
622
  enableModularization: false,
620
623
  },
621
624
  },
625
+ lldModularDrawerBackendData: DEFAULT_FEATURE,
622
626
  llmModularDrawer: {
623
627
  ...DEFAULT_FEATURE,
624
628
  params: {
@@ -0,0 +1,43 @@
1
+ import { genAccount } from "@ledgerhq/coin-framework/lib/mocks/account";
2
+ import BigNumber from "bignumber.js";
3
+ import { mockBtcCryptoCurrency } from "./currencies.mock";
4
+ import { mockArbitrumCryptoCurrency } from "./currencies.mock";
5
+ import { mockEthCryptoCurrency } from "./currencies.mock";
6
+ import { mockBaseCryptoCurrency } from "./currencies.mock";
7
+ import { mockScrollCryptoCurrency } from "./currencies.mock";
8
+
9
+ export const MOCKED_ARB_ACCOUNT = {
10
+ type: "Account",
11
+ id: "arbitrum1",
12
+ balance: new BigNumber(34455),
13
+ creationDate: "2024-12-10T09:27:22.000Z",
14
+ currency: mockArbitrumCryptoCurrency,
15
+ derivationMode: "",
16
+ freshAddress: "s37rhmi7hsm3i73hsm7i3hm83m8h87hsm87h3s8h33",
17
+ };
18
+
19
+ export const ETH_ACCOUNT = genAccount("ethereum-1", {
20
+ currency: mockEthCryptoCurrency,
21
+ });
22
+ export const ETH_ACCOUNT_2 = genAccount("ethereum-2", {
23
+ currency: mockEthCryptoCurrency,
24
+ });
25
+ export const BTC_ACCOUNT = genAccount("bitcoin-1", {
26
+ currency: mockBtcCryptoCurrency,
27
+ });
28
+ export const ARB_ACCOUNT = genAccount("arbitrum-1", {
29
+ currency: mockArbitrumCryptoCurrency,
30
+ tokenIds: ["arbitrum/erc20/arbitrum"],
31
+ });
32
+ export const ETH_ACCOUNT_WITH_USDC = genAccount("ethereum-usdc", {
33
+ currency: mockEthCryptoCurrency,
34
+ tokenIds: ["ethereum/erc20/usdc"],
35
+ });
36
+ export const BASE_ACCOUNT = genAccount("base-1", {
37
+ currency: mockBaseCryptoCurrency,
38
+ operationsSize: 100,
39
+ });
40
+ export const SCROLL_ACCOUNT = genAccount("scroll-1", {
41
+ currency: mockScrollCryptoCurrency,
42
+ operationsSize: 100,
43
+ });
@@ -0,0 +1,62 @@
1
+ import { getCryptoCurrencyById } from "@ledgerhq/live-common/currencies/index";
2
+ import { TokenCurrency } from "@ledgerhq/types-cryptoassets";
3
+
4
+ export const mockBtcCryptoCurrency = getCryptoCurrencyById("bitcoin");
5
+ export const mockEthCryptoCurrency = getCryptoCurrencyById("ethereum");
6
+ export const mockArbitrumCryptoCurrency = getCryptoCurrencyById("arbitrum");
7
+ export const mockBaseCryptoCurrency = getCryptoCurrencyById("base");
8
+ export const mockScrollCryptoCurrency = getCryptoCurrencyById("scroll");
9
+ export const mockInjectiveCryptoCurrency = getCryptoCurrencyById("injective");
10
+
11
+ export const arbitrumToken: TokenCurrency = {
12
+ type: "TokenCurrency",
13
+ id: "arbitrum/erc20/arbitrum",
14
+ contractAddress: "0x912CE59144191C1204E64559FE8253a0e49E6548",
15
+ parentCurrency: mockArbitrumCryptoCurrency,
16
+ tokenType: "erc20",
17
+ name: "Arbitrum",
18
+ ticker: "ARB",
19
+ units: [
20
+ {
21
+ name: "Arbitrum",
22
+ code: "ARB",
23
+ magnitude: 18,
24
+ },
25
+ ],
26
+ };
27
+ export const usdcToken: TokenCurrency = {
28
+ type: "TokenCurrency",
29
+ id: "ethereum/erc20/usd__coin",
30
+ contractAddress: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
31
+ parentCurrency: mockEthCryptoCurrency,
32
+ tokenType: "erc20",
33
+ name: "USD Coin",
34
+ ticker: "USDC",
35
+ units: [
36
+ {
37
+ name: "USD Coin",
38
+ code: "USDC",
39
+ magnitude: 6,
40
+ },
41
+ ],
42
+ };
43
+
44
+ export const findCryptoCurrencyById = (id: string) =>
45
+ [mockBtcCryptoCurrency, mockEthCryptoCurrency, mockArbitrumCryptoCurrency].find(a => a.id === id);
46
+ export const getTokenOrCryptoCurrencyById = (id: string) =>
47
+ [
48
+ mockBtcCryptoCurrency,
49
+ mockEthCryptoCurrency,
50
+ mockArbitrumCryptoCurrency,
51
+ arbitrumToken,
52
+ usdcToken,
53
+ ].find(a => a.id === id);
54
+
55
+ export const mockCurrenciesByProvider = [
56
+ {
57
+ providerId: "ethereum",
58
+ currenciesByNetwork: [mockEthCryptoCurrency],
59
+ },
60
+ ];
61
+
62
+ export const mockCurrencyIds = ["bitcoin", "ethereum", "arbitrum", "base"];
@@ -0,0 +1,49 @@
1
+ import { LoadingStatus } from "@ledgerhq/live-common/deposit/type";
2
+ import {
3
+ arbitrumToken,
4
+ mockArbitrumCryptoCurrency,
5
+ mockBaseCryptoCurrency,
6
+ mockBtcCryptoCurrency,
7
+ mockEthCryptoCurrency,
8
+ mockInjectiveCryptoCurrency,
9
+ mockScrollCryptoCurrency,
10
+ usdcToken,
11
+ } from "./currencies.mock";
12
+
13
+ export const providers = [
14
+ {
15
+ providerId: "bitcoin",
16
+ currenciesByNetwork: [mockBtcCryptoCurrency],
17
+ },
18
+ {
19
+ providerId: "ethereum",
20
+ currenciesByNetwork: [
21
+ mockEthCryptoCurrency,
22
+ mockArbitrumCryptoCurrency,
23
+ mockBaseCryptoCurrency,
24
+ mockScrollCryptoCurrency,
25
+ ],
26
+ },
27
+ { providerId: "arbitrum", currenciesByNetwork: [arbitrumToken] },
28
+ { providerId: "usd-coin", currenciesByNetwork: [usdcToken] },
29
+ { providerId: "injective-protocol", currenciesByNetwork: [mockInjectiveCryptoCurrency] },
30
+ ];
31
+
32
+ export const res = {
33
+ result: {
34
+ currenciesByProvider: providers,
35
+ sortedCryptoCurrencies: [
36
+ mockBtcCryptoCurrency,
37
+ mockEthCryptoCurrency,
38
+ mockArbitrumCryptoCurrency,
39
+ mockBaseCryptoCurrency,
40
+ mockScrollCryptoCurrency,
41
+ mockInjectiveCryptoCurrency,
42
+ ],
43
+ },
44
+ };
45
+
46
+ export const useGroupedCurrenciesByProvider: jest.Mock = jest.fn(() => ({
47
+ ...res,
48
+ loadingStatus: LoadingStatus.Success,
49
+ }));
@@ -0,0 +1,34 @@
1
+ import { haveOneCommonProvider } from "../haveOneCommonProvider";
2
+ import { useGroupedCurrenciesByProvider } from "../../__mocks__/useGroupedCurrenciesByProvider.mock";
3
+ import { LoadingBasedGroupedCurrencies } from "@ledgerhq/live-common/deposit/type";
4
+
5
+ jest.mock("@ledgerhq/live-common/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
+ });
@@ -0,0 +1,31 @@
1
+ import { CurrenciesByProviderId } from "@ledgerhq/live-common/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
+ };
@@ -1,5 +1,6 @@
1
1
  import { CryptoOrTokenCurrency } from "@ledgerhq/types-cryptoassets";
2
2
  import { CurrenciesByProviderId } from "../../deposit/type";
3
+ import { haveOneCommonProvider } from "./haveOneCommonProvider";
3
4
 
4
5
  function isCorrespondingCurrency(
5
6
  elem: CryptoOrTokenCurrency,
@@ -26,4 +27,4 @@ const getEffectiveCurrency = (
26
27
  return provider.currenciesByNetwork.find(elem => currencyIds.includes(elem.id)) ?? currency;
27
28
  };
28
29
 
29
- export { isCorrespondingCurrency, getEffectiveCurrency };
30
+ export { isCorrespondingCurrency, getEffectiveCurrency, haveOneCommonProvider };