@ledgerhq/live-common 34.43.0 → 34.44.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 (359) hide show
  1. package/lib/DataModel.test.js +6 -0
  2. package/lib/DataModel.test.js.map +1 -1
  3. package/lib/__fixtures__/solana-spl-epjfwdd5aufqssqem2qn1xzybapc8g4weggkzwytdt1v.json +53 -0
  4. package/lib/__tests__/accounts/groupPerDay.js +10 -0
  5. package/lib/__tests__/accounts/groupPerDay.js.map +1 -1
  6. package/lib/__tests__/test-helpers/environment.js +1 -0
  7. package/lib/__tests__/test-helpers/environment.js.map +1 -1
  8. package/lib/__tests__/test-helpers/setup.d.ts.map +1 -1
  9. package/lib/__tests__/test-helpers/setup.js +6 -0
  10. package/lib/__tests__/test-helpers/setup.js.map +1 -1
  11. package/lib/account/serialization.test.js +17 -1
  12. package/lib/account/serialization.test.js.map +1 -1
  13. package/lib/appSupportsQuitApp.d.ts +1 -0
  14. package/lib/appSupportsQuitApp.d.ts.map +1 -1
  15. package/lib/appSupportsQuitApp.js +1 -0
  16. package/lib/appSupportsQuitApp.js.map +1 -1
  17. package/lib/appSupportsQuitApp.test.js +28 -3
  18. package/lib/appSupportsQuitApp.test.js.map +1 -1
  19. package/lib/bridge/crypto-assets/index.d.ts.map +1 -1
  20. package/lib/bridge/crypto-assets/index.js +5 -5
  21. package/lib/bridge/crypto-assets/index.js.map +1 -1
  22. package/lib/bridge/generic-alpaca/alpaca/index.d.ts +1 -1
  23. package/lib/bridge/generic-alpaca/alpaca/index.d.ts.map +1 -1
  24. package/lib/bridge/generic-alpaca/alpaca/index.js.map +1 -1
  25. package/lib/bridge/generic-alpaca/alpaca/network/network-alpaca.d.ts +2 -6
  26. package/lib/bridge/generic-alpaca/alpaca/network/network-alpaca.d.ts.map +1 -1
  27. package/lib/bridge/generic-alpaca/alpaca/network/network-alpaca.js.map +1 -1
  28. package/lib/bridge/generic-alpaca/getAccountShape.d.ts.map +1 -1
  29. package/lib/bridge/generic-alpaca/getAccountShape.js +5 -6
  30. package/lib/bridge/generic-alpaca/getAccountShape.js.map +1 -1
  31. package/lib/bridge/generic-alpaca/signOperation.js.map +1 -1
  32. package/lib/bridge/generic-alpaca/utils.d.ts +3 -2
  33. package/lib/bridge/generic-alpaca/utils.d.ts.map +1 -1
  34. package/lib/bridge/generic-alpaca/utils.js +6 -2
  35. package/lib/bridge/generic-alpaca/utils.js.map +1 -1
  36. package/lib/bridge/generic-alpaca/utils.test.d.ts +2 -0
  37. package/lib/bridge/generic-alpaca/utils.test.d.ts.map +1 -0
  38. package/lib/bridge/generic-alpaca/utils.test.js +20 -0
  39. package/lib/bridge/generic-alpaca/utils.test.js.map +1 -0
  40. package/lib/currencies/sortByMarketcap.test.js +5 -0
  41. package/lib/currencies/sortByMarketcap.test.js.map +1 -1
  42. package/lib/e2e/enum/Currency.js +1 -1
  43. package/lib/e2e/enum/Currency.js.map +1 -1
  44. package/lib/e2e/enum/Provider.d.ts +1 -0
  45. package/lib/e2e/enum/Provider.d.ts.map +1 -1
  46. package/lib/e2e/enum/Provider.js +1 -0
  47. package/lib/e2e/enum/Provider.js.map +1 -1
  48. package/lib/e2e/index.d.ts +3 -0
  49. package/lib/e2e/index.d.ts.map +1 -1
  50. package/lib/e2e/speculos.d.ts.map +1 -1
  51. package/lib/e2e/speculos.js +45 -15
  52. package/lib/e2e/speculos.js.map +1 -1
  53. package/lib/e2e/speculosCI.d.ts.map +1 -1
  54. package/lib/e2e/speculosCI.js +22 -4
  55. package/lib/e2e/speculosCI.js.map +1 -1
  56. package/lib/env.react.d.ts +1 -1
  57. package/lib/env.react.d.ts.map +1 -1
  58. package/lib/families/bitcoin/satstack.test.js +6 -0
  59. package/lib/families/bitcoin/satstack.test.js.map +1 -1
  60. package/lib/families/canton/bridge.integration.test.d.ts +2 -0
  61. package/lib/families/canton/bridge.integration.test.d.ts.map +1 -0
  62. package/lib/families/canton/bridge.integration.test.js +7 -0
  63. package/lib/families/canton/bridge.integration.test.js.map +1 -0
  64. package/lib/families/canton/config.d.ts +3 -0
  65. package/lib/families/canton/config.d.ts.map +1 -0
  66. package/lib/families/canton/config.js +14 -0
  67. package/lib/families/canton/config.js.map +1 -0
  68. package/lib/families/canton/logic.d.ts +2 -0
  69. package/lib/families/canton/logic.d.ts.map +1 -0
  70. package/lib/families/canton/logic.js +19 -0
  71. package/lib/families/canton/logic.js.map +1 -0
  72. package/lib/families/canton/setup.d.ts +27 -0
  73. package/lib/families/canton/setup.d.ts.map +1 -0
  74. package/lib/families/canton/setup.js +27 -0
  75. package/lib/families/canton/setup.js.map +1 -0
  76. package/lib/families/canton/types.d.ts +2 -0
  77. package/lib/families/canton/types.d.ts.map +1 -0
  78. package/lib/families/canton/types.js +19 -0
  79. package/lib/families/canton/types.js.map +1 -0
  80. package/lib/families/solana/bridge/mock-data.d.ts.map +1 -1
  81. package/lib/families/solana/bridge/mock-data.js +46 -316
  82. package/lib/families/solana/bridge/mock-data.js.map +1 -1
  83. package/lib/families/solana/bridge/mock.js +2 -2
  84. package/lib/families/solana/bridge/mock.js.map +1 -1
  85. package/lib/families/stellar/ui.d.ts +6 -0
  86. package/lib/families/stellar/ui.d.ts.map +1 -0
  87. package/lib/families/stellar/ui.js +18 -0
  88. package/lib/families/stellar/ui.js.map +1 -0
  89. package/lib/families/tron/data.mock.d.ts.map +1 -1
  90. package/lib/families/tron/data.mock.js +6 -0
  91. package/lib/families/tron/data.mock.js.map +1 -1
  92. package/lib/featureFlags/defaultFeatures.d.ts +1 -0
  93. package/lib/featureFlags/defaultFeatures.d.ts.map +1 -1
  94. package/lib/featureFlags/defaultFeatures.js +1 -0
  95. package/lib/featureFlags/defaultFeatures.js.map +1 -1
  96. package/lib/generated/bridge/js.d.ts +1 -0
  97. package/lib/generated/bridge/js.d.ts.map +1 -1
  98. package/lib/generated/bridge/js.js +40 -38
  99. package/lib/generated/bridge/js.js.map +1 -1
  100. package/lib/generated/cli-transaction.d.ts +20 -0
  101. package/lib/generated/cli-transaction.d.ts.map +1 -1
  102. package/lib/generated/cli-transaction.js +42 -40
  103. package/lib/generated/cli-transaction.js.map +1 -1
  104. package/lib/generated/deviceTransactionConfig.d.ts +2 -0
  105. package/lib/generated/deviceTransactionConfig.d.ts.map +1 -1
  106. package/lib/generated/deviceTransactionConfig.js +38 -36
  107. package/lib/generated/deviceTransactionConfig.js.map +1 -1
  108. package/lib/generated/hw-getAddress.d.ts +1 -0
  109. package/lib/generated/hw-getAddress.d.ts.map +1 -1
  110. package/lib/generated/hw-getAddress.js +42 -40
  111. package/lib/generated/hw-getAddress.js.map +1 -1
  112. package/lib/generated/specs.d.ts +2 -0
  113. package/lib/generated/specs.d.ts.map +1 -1
  114. package/lib/generated/specs.js +40 -38
  115. package/lib/generated/specs.js.map +1 -1
  116. package/lib/generated/transaction.d.ts +8 -0
  117. package/lib/generated/transaction.d.ts.map +1 -1
  118. package/lib/generated/transaction.js +42 -40
  119. package/lib/generated/transaction.js.map +1 -1
  120. package/lib/generated/types.d.ts +5 -4
  121. package/lib/generated/types.d.ts.map +1 -1
  122. package/lib/modularDrawer/__mocks__/accounts.mock.d.ts +18 -0
  123. package/lib/modularDrawer/__mocks__/accounts.mock.d.ts.map +1 -0
  124. package/lib/modularDrawer/__mocks__/accounts.mock.js +48 -0
  125. package/lib/modularDrawer/__mocks__/accounts.mock.js.map +1 -0
  126. package/lib/modularDrawer/utils/__tests__/currencyUtils.test.d.ts +2 -0
  127. package/lib/modularDrawer/utils/__tests__/currencyUtils.test.d.ts.map +1 -0
  128. package/lib/modularDrawer/utils/__tests__/currencyUtils.test.js +100 -0
  129. package/lib/modularDrawer/utils/__tests__/currencyUtils.test.js.map +1 -0
  130. package/lib/modularDrawer/utils/currencyUtils.d.ts +10 -0
  131. package/lib/modularDrawer/utils/currencyUtils.d.ts.map +1 -0
  132. package/lib/modularDrawer/utils/currencyUtils.js +74 -0
  133. package/lib/modularDrawer/utils/currencyUtils.js.map +1 -0
  134. package/lib/modularDrawer/utils/haveOneCommonProvider.d.ts +1 -1
  135. package/lib/modularDrawer/utils/haveOneCommonProvider.d.ts.map +1 -1
  136. package/lib/utils/__tests__/composeHooks.test.d.ts +2 -0
  137. package/lib/utils/__tests__/composeHooks.test.d.ts.map +1 -0
  138. package/lib/utils/__tests__/composeHooks.test.js +35 -0
  139. package/lib/utils/__tests__/composeHooks.test.js.map +1 -0
  140. package/lib/utils/__tests__/getAccountTuplesForCurrency.test.d.ts +2 -0
  141. package/lib/utils/__tests__/getAccountTuplesForCurrency.test.d.ts.map +1 -0
  142. package/lib/utils/__tests__/getAccountTuplesForCurrency.test.js +104 -0
  143. package/lib/utils/__tests__/getAccountTuplesForCurrency.test.js.map +1 -0
  144. package/lib/utils/composeHooks.d.ts +11 -0
  145. package/lib/utils/composeHooks.d.ts.map +1 -0
  146. package/lib/utils/composeHooks.js +25 -0
  147. package/lib/utils/composeHooks.js.map +1 -0
  148. package/lib/utils/getAccountTuplesForCurrency.d.ts +8 -0
  149. package/lib/utils/getAccountTuplesForCurrency.d.ts.map +1 -0
  150. package/lib/utils/getAccountTuplesForCurrency.js +19 -0
  151. package/lib/utils/getAccountTuplesForCurrency.js.map +1 -0
  152. package/lib/wallet-api/helpers.d.ts +1 -0
  153. package/lib/wallet-api/helpers.d.ts.map +1 -1
  154. package/lib/wallet-api/helpers.js +16 -1
  155. package/lib/wallet-api/helpers.js.map +1 -1
  156. package/lib-es/DataModel.test.js +6 -0
  157. package/lib-es/DataModel.test.js.map +1 -1
  158. package/lib-es/__fixtures__/solana-spl-epjfwdd5aufqssqem2qn1xzybapc8g4weggkzwytdt1v.json +53 -0
  159. package/lib-es/__tests__/accounts/groupPerDay.js +10 -0
  160. package/lib-es/__tests__/accounts/groupPerDay.js.map +1 -1
  161. package/lib-es/__tests__/test-helpers/environment.js +1 -0
  162. package/lib-es/__tests__/test-helpers/environment.js.map +1 -1
  163. package/lib-es/__tests__/test-helpers/setup.d.ts.map +1 -1
  164. package/lib-es/__tests__/test-helpers/setup.js +6 -0
  165. package/lib-es/__tests__/test-helpers/setup.js.map +1 -1
  166. package/lib-es/account/serialization.test.js +15 -2
  167. package/lib-es/account/serialization.test.js.map +1 -1
  168. package/lib-es/appSupportsQuitApp.d.ts +1 -0
  169. package/lib-es/appSupportsQuitApp.d.ts.map +1 -1
  170. package/lib-es/appSupportsQuitApp.js +1 -0
  171. package/lib-es/appSupportsQuitApp.js.map +1 -1
  172. package/lib-es/appSupportsQuitApp.test.js +6 -1
  173. package/lib-es/appSupportsQuitApp.test.js.map +1 -1
  174. package/lib-es/bridge/crypto-assets/index.d.ts.map +1 -1
  175. package/lib-es/bridge/crypto-assets/index.js +4 -4
  176. package/lib-es/bridge/crypto-assets/index.js.map +1 -1
  177. package/lib-es/bridge/generic-alpaca/alpaca/index.d.ts +1 -1
  178. package/lib-es/bridge/generic-alpaca/alpaca/index.d.ts.map +1 -1
  179. package/lib-es/bridge/generic-alpaca/alpaca/index.js.map +1 -1
  180. package/lib-es/bridge/generic-alpaca/alpaca/network/network-alpaca.d.ts +2 -6
  181. package/lib-es/bridge/generic-alpaca/alpaca/network/network-alpaca.d.ts.map +1 -1
  182. package/lib-es/bridge/generic-alpaca/alpaca/network/network-alpaca.js.map +1 -1
  183. package/lib-es/bridge/generic-alpaca/getAccountShape.d.ts.map +1 -1
  184. package/lib-es/bridge/generic-alpaca/getAccountShape.js +6 -7
  185. package/lib-es/bridge/generic-alpaca/getAccountShape.js.map +1 -1
  186. package/lib-es/bridge/generic-alpaca/signOperation.js.map +1 -1
  187. package/lib-es/bridge/generic-alpaca/utils.d.ts +3 -2
  188. package/lib-es/bridge/generic-alpaca/utils.d.ts.map +1 -1
  189. package/lib-es/bridge/generic-alpaca/utils.js +4 -1
  190. package/lib-es/bridge/generic-alpaca/utils.js.map +1 -1
  191. package/lib-es/bridge/generic-alpaca/utils.test.d.ts +2 -0
  192. package/lib-es/bridge/generic-alpaca/utils.test.d.ts.map +1 -0
  193. package/lib-es/bridge/generic-alpaca/utils.test.js +18 -0
  194. package/lib-es/bridge/generic-alpaca/utils.test.js.map +1 -0
  195. package/lib-es/currencies/sortByMarketcap.test.js +5 -0
  196. package/lib-es/currencies/sortByMarketcap.test.js.map +1 -1
  197. package/lib-es/e2e/enum/Currency.js +1 -1
  198. package/lib-es/e2e/enum/Currency.js.map +1 -1
  199. package/lib-es/e2e/enum/Provider.d.ts +1 -0
  200. package/lib-es/e2e/enum/Provider.d.ts.map +1 -1
  201. package/lib-es/e2e/enum/Provider.js +1 -0
  202. package/lib-es/e2e/enum/Provider.js.map +1 -1
  203. package/lib-es/e2e/index.d.ts +3 -0
  204. package/lib-es/e2e/index.d.ts.map +1 -1
  205. package/lib-es/e2e/speculos.d.ts.map +1 -1
  206. package/lib-es/e2e/speculos.js +45 -15
  207. package/lib-es/e2e/speculos.js.map +1 -1
  208. package/lib-es/e2e/speculosCI.d.ts.map +1 -1
  209. package/lib-es/e2e/speculosCI.js +22 -4
  210. package/lib-es/e2e/speculosCI.js.map +1 -1
  211. package/lib-es/env.react.d.ts +1 -1
  212. package/lib-es/env.react.d.ts.map +1 -1
  213. package/lib-es/families/bitcoin/satstack.test.js +6 -0
  214. package/lib-es/families/bitcoin/satstack.test.js.map +1 -1
  215. package/lib-es/families/canton/bridge.integration.test.d.ts +2 -0
  216. package/lib-es/families/canton/bridge.integration.test.d.ts.map +1 -0
  217. package/lib-es/families/canton/bridge.integration.test.js +5 -0
  218. package/lib-es/families/canton/bridge.integration.test.js.map +1 -0
  219. package/lib-es/families/canton/config.d.ts +3 -0
  220. package/lib-es/families/canton/config.d.ts.map +1 -0
  221. package/lib-es/families/canton/config.js +11 -0
  222. package/lib-es/families/canton/config.js.map +1 -0
  223. package/lib-es/families/canton/logic.d.ts +2 -0
  224. package/lib-es/families/canton/logic.d.ts.map +1 -0
  225. package/lib-es/families/canton/logic.js +3 -0
  226. package/lib-es/families/canton/logic.js.map +1 -0
  227. package/lib-es/families/canton/setup.d.ts +27 -0
  228. package/lib-es/families/canton/setup.d.ts.map +1 -0
  229. package/lib-es/families/canton/setup.js +19 -0
  230. package/lib-es/families/canton/setup.js.map +1 -0
  231. package/lib-es/families/canton/types.d.ts +2 -0
  232. package/lib-es/families/canton/types.d.ts.map +1 -0
  233. package/lib-es/families/canton/types.js +3 -0
  234. package/lib-es/families/canton/types.js.map +1 -0
  235. package/lib-es/families/solana/bridge/mock-data.d.ts.map +1 -1
  236. package/lib-es/families/solana/bridge/mock-data.js +46 -316
  237. package/lib-es/families/solana/bridge/mock-data.js.map +1 -1
  238. package/lib-es/families/solana/bridge/mock.js +3 -3
  239. package/lib-es/families/solana/bridge/mock.js.map +1 -1
  240. package/lib-es/families/stellar/ui.d.ts +6 -0
  241. package/lib-es/families/stellar/ui.d.ts.map +1 -0
  242. package/lib-es/families/stellar/ui.js +14 -0
  243. package/lib-es/families/stellar/ui.js.map +1 -0
  244. package/lib-es/families/tron/data.mock.d.ts.map +1 -1
  245. package/lib-es/families/tron/data.mock.js +6 -0
  246. package/lib-es/families/tron/data.mock.js.map +1 -1
  247. package/lib-es/featureFlags/defaultFeatures.d.ts +1 -0
  248. package/lib-es/featureFlags/defaultFeatures.d.ts.map +1 -1
  249. package/lib-es/featureFlags/defaultFeatures.js +1 -0
  250. package/lib-es/featureFlags/defaultFeatures.js.map +1 -1
  251. package/lib-es/generated/bridge/js.d.ts +1 -0
  252. package/lib-es/generated/bridge/js.d.ts.map +1 -1
  253. package/lib-es/generated/bridge/js.js +2 -0
  254. package/lib-es/generated/bridge/js.js.map +1 -1
  255. package/lib-es/generated/cli-transaction.d.ts +20 -0
  256. package/lib-es/generated/cli-transaction.d.ts.map +1 -1
  257. package/lib-es/generated/cli-transaction.js +2 -0
  258. package/lib-es/generated/cli-transaction.js.map +1 -1
  259. package/lib-es/generated/deviceTransactionConfig.d.ts +2 -0
  260. package/lib-es/generated/deviceTransactionConfig.d.ts.map +1 -1
  261. package/lib-es/generated/deviceTransactionConfig.js +2 -0
  262. package/lib-es/generated/deviceTransactionConfig.js.map +1 -1
  263. package/lib-es/generated/hw-getAddress.d.ts +1 -0
  264. package/lib-es/generated/hw-getAddress.d.ts.map +1 -1
  265. package/lib-es/generated/hw-getAddress.js +2 -0
  266. package/lib-es/generated/hw-getAddress.js.map +1 -1
  267. package/lib-es/generated/specs.d.ts +2 -0
  268. package/lib-es/generated/specs.d.ts.map +1 -1
  269. package/lib-es/generated/specs.js +2 -0
  270. package/lib-es/generated/specs.js.map +1 -1
  271. package/lib-es/generated/transaction.d.ts +8 -0
  272. package/lib-es/generated/transaction.d.ts.map +1 -1
  273. package/lib-es/generated/transaction.js +2 -0
  274. package/lib-es/generated/transaction.js.map +1 -1
  275. package/lib-es/generated/types.d.ts +5 -4
  276. package/lib-es/generated/types.d.ts.map +1 -1
  277. package/lib-es/modularDrawer/__mocks__/accounts.mock.d.ts +18 -0
  278. package/lib-es/modularDrawer/__mocks__/accounts.mock.d.ts.map +1 -0
  279. package/lib-es/modularDrawer/__mocks__/accounts.mock.js +42 -0
  280. package/lib-es/modularDrawer/__mocks__/accounts.mock.js.map +1 -0
  281. package/lib-es/modularDrawer/utils/__tests__/currencyUtils.test.d.ts +2 -0
  282. package/lib-es/modularDrawer/utils/__tests__/currencyUtils.test.d.ts.map +1 -0
  283. package/lib-es/modularDrawer/utils/__tests__/currencyUtils.test.js +98 -0
  284. package/lib-es/modularDrawer/utils/__tests__/currencyUtils.test.js.map +1 -0
  285. package/lib-es/modularDrawer/utils/currencyUtils.d.ts +10 -0
  286. package/lib-es/modularDrawer/utils/currencyUtils.d.ts.map +1 -0
  287. package/lib-es/modularDrawer/utils/currencyUtils.js +65 -0
  288. package/lib-es/modularDrawer/utils/currencyUtils.js.map +1 -0
  289. package/lib-es/modularDrawer/utils/haveOneCommonProvider.d.ts +1 -1
  290. package/lib-es/modularDrawer/utils/haveOneCommonProvider.d.ts.map +1 -1
  291. package/lib-es/utils/__tests__/composeHooks.test.d.ts +2 -0
  292. package/lib-es/utils/__tests__/composeHooks.test.d.ts.map +1 -0
  293. package/lib-es/utils/__tests__/composeHooks.test.js +33 -0
  294. package/lib-es/utils/__tests__/composeHooks.test.js.map +1 -0
  295. package/lib-es/utils/__tests__/getAccountTuplesForCurrency.test.d.ts +2 -0
  296. package/lib-es/utils/__tests__/getAccountTuplesForCurrency.test.d.ts.map +1 -0
  297. package/lib-es/utils/__tests__/getAccountTuplesForCurrency.test.js +102 -0
  298. package/lib-es/utils/__tests__/getAccountTuplesForCurrency.test.js.map +1 -0
  299. package/lib-es/utils/composeHooks.d.ts +11 -0
  300. package/lib-es/utils/composeHooks.d.ts.map +1 -0
  301. package/lib-es/utils/composeHooks.js +21 -0
  302. package/lib-es/utils/composeHooks.js.map +1 -0
  303. package/lib-es/utils/getAccountTuplesForCurrency.d.ts +8 -0
  304. package/lib-es/utils/getAccountTuplesForCurrency.d.ts.map +1 -0
  305. package/lib-es/utils/getAccountTuplesForCurrency.js +15 -0
  306. package/lib-es/utils/getAccountTuplesForCurrency.js.map +1 -0
  307. package/lib-es/wallet-api/helpers.d.ts +1 -0
  308. package/lib-es/wallet-api/helpers.d.ts.map +1 -1
  309. package/lib-es/wallet-api/helpers.js +14 -0
  310. package/lib-es/wallet-api/helpers.js.map +1 -1
  311. package/package.json +40 -38
  312. package/src/DataModel.test.ts +8 -0
  313. package/src/__fixtures__/solana-spl-epjfwdd5aufqssqem2qn1xzybapc8g4weggkzwytdt1v.json +53 -0
  314. package/src/__tests__/accounts/groupPerDay.ts +13 -0
  315. package/src/__tests__/test-helpers/environment.ts +1 -0
  316. package/src/__tests__/test-helpers/setup.ts +8 -0
  317. package/src/account/serialization.test.ts +20 -2
  318. package/src/appSupportsQuitApp.test.ts +7 -1
  319. package/src/appSupportsQuitApp.ts +1 -0
  320. package/src/bridge/crypto-assets/index.ts +6 -6
  321. package/src/bridge/generic-alpaca/alpaca/index.ts +3 -3
  322. package/src/bridge/generic-alpaca/alpaca/network/network-alpaca.ts +3 -8
  323. package/src/bridge/generic-alpaca/getAccountShape.ts +6 -7
  324. package/src/bridge/generic-alpaca/signOperation.ts +1 -1
  325. package/src/bridge/generic-alpaca/utils.test.ts +19 -0
  326. package/src/bridge/generic-alpaca/utils.ts +7 -6
  327. package/src/currencies/sortByMarketcap.test.ts +7 -0
  328. package/src/e2e/enum/Currency.ts +1 -1
  329. package/src/e2e/enum/Provider.ts +1 -0
  330. package/src/e2e/speculos.ts +77 -21
  331. package/src/e2e/speculosCI.ts +32 -10
  332. package/src/families/bitcoin/satstack.test.ts +7 -0
  333. package/src/families/canton/bridge.integration.test.ts +6 -0
  334. package/src/families/canton/config.ts +12 -0
  335. package/src/families/canton/logic.ts +2 -0
  336. package/src/families/canton/setup.ts +34 -0
  337. package/src/families/canton/types.ts +2 -0
  338. package/src/families/solana/bridge/mock-data.ts +52 -316
  339. package/src/families/solana/bridge/mock.ts +3 -3
  340. package/src/families/stellar/__snapshots__/bridge.integration.test.ts.snap +1930 -94
  341. package/src/families/stellar/ui.ts +15 -0
  342. package/src/families/tron/data.mock.ts +8 -0
  343. package/src/featureFlags/defaultFeatures.ts +1 -0
  344. package/src/generated/bridge/js.ts +2 -0
  345. package/src/generated/cli-transaction.ts +2 -0
  346. package/src/generated/deviceTransactionConfig.ts +2 -0
  347. package/src/generated/hw-getAddress.ts +2 -0
  348. package/src/generated/specs.ts +2 -0
  349. package/src/generated/transaction.ts +2 -0
  350. package/src/generated/types.ts +10 -0
  351. package/src/modularDrawer/__mocks__/accounts.mock.ts +43 -0
  352. package/src/modularDrawer/utils/__tests__/currencyUtils.test.ts +126 -0
  353. package/src/modularDrawer/utils/currencyUtils.ts +95 -0
  354. package/src/modularDrawer/utils/haveOneCommonProvider.ts +1 -1
  355. package/src/utils/__tests__/composeHooks.test.ts +46 -0
  356. package/src/utils/__tests__/getAccountTuplesForCurrency.test.ts +138 -0
  357. package/src/utils/composeHooks.ts +26 -0
  358. package/src/utils/getAccountTuplesForCurrency.ts +34 -0
  359. package/src/wallet-api/helpers.ts +16 -0
@@ -2,7 +2,7 @@ import { encodeAccountId } from "@ledgerhq/coin-framework/account/index";
2
2
  import { GetAccountShape, mergeOps } from "@ledgerhq/coin-framework/bridge/jsHelpers";
3
3
  import BigNumber from "bignumber.js";
4
4
  import { getAlpacaApi } from "./alpaca";
5
- import { adaptCoreOperationToLiveOperation } from "./utils";
5
+ import { adaptCoreOperationToLiveOperation, extractBalance } from "./utils";
6
6
 
7
7
  export function genericGetAccountShape(network: string, kind: "local" | "remote"): GetAccountShape {
8
8
  return async info => {
@@ -18,15 +18,14 @@ export function genericGetAccountShape(network: string, kind: "local" | "remote"
18
18
 
19
19
  const blockInfo = await getAlpacaApi(network, kind).lastBlock();
20
20
 
21
- const balanceRes = await getAlpacaApi(network, kind).getBalance(address);
22
- // FIXME: fix type Balance -> check "native" balance
23
- // is balance[0] always the native ?
24
- const balance = BigNumber(balanceRes[0].value.toString());
21
+ const balances = await getAlpacaApi(network, kind).getBalance(address);
22
+ const nativeBalance = extractBalance(balances, "native");
23
+ const balance = BigNumber(nativeBalance.value.toString());
25
24
 
26
25
  let spendableBalance: BigNumber;
27
- if (balanceRes[0]?.locked) {
26
+ if (nativeBalance.locked) {
28
27
  spendableBalance = BigNumber.max(
29
- balance.minus(BigNumber(balanceRes[0].locked.toString())),
28
+ balance.minus(BigNumber(nativeBalance.locked.toString())),
30
29
  BigNumber(0),
31
30
  );
32
31
  } else {
@@ -40,7 +40,7 @@ export const genericSignOperation =
40
40
  const transactionIntent = transactionToIntent(account, transaction);
41
41
  transactionIntent.senderPublicKey = publicKey;
42
42
  // NOTE: is setting the memo here instead of transactionToIntent sensible?
43
- const txWithMemo = transactionIntent as TransactionIntent<any, MapMemo<string, string>>;
43
+ const txWithMemo = transactionIntent as TransactionIntent<MapMemo<string, string>>;
44
44
  if (transaction["tag"]) {
45
45
  const txMemo = String(transaction["tag"]);
46
46
  txWithMemo.memo = {
@@ -0,0 +1,19 @@
1
+ import { extractBalance } from "./utils";
2
+
3
+ describe("Alpaca utils", () => {
4
+ describe("extractBalance", () => {
5
+ it("extracts an existing balance", () => {
6
+ expect(extractBalance([{ value: 4n, asset: { type: "type1" } }], "type1")).toEqual({
7
+ value: 4n,
8
+ asset: { type: "type1" },
9
+ });
10
+ });
11
+
12
+ it("generates an empty balance for a missing type", () => {
13
+ expect(extractBalance([{ value: 4n, asset: { type: "type1" } }], "type2")).toEqual({
14
+ value: 0n,
15
+ asset: { type: "type2" },
16
+ });
17
+ });
18
+ });
19
+ });
@@ -1,17 +1,18 @@
1
1
  import { encodeOperationId } from "@ledgerhq/coin-framework/operation";
2
2
  import { Account, Operation, OperationType, TransactionCommon } from "@ledgerhq/types-live";
3
3
  import {
4
+ Balance,
4
5
  Operation as CoreOperation,
5
- Asset,
6
6
  TransactionIntent,
7
7
  } from "@ledgerhq/coin-framework/api/types";
8
8
  import BigNumber from "bignumber.js";
9
9
  import { fromBigNumberToBigInt } from "@ledgerhq/coin-framework/utils";
10
10
 
11
- export function adaptCoreOperationToLiveOperation(
12
- accountId: string,
13
- op: CoreOperation<Asset>,
14
- ): Operation {
11
+ export function extractBalance(balances: Balance[], type: string): Balance {
12
+ return balances.find(balance => balance.asset.type === type) ?? { asset: { type }, value: 0n };
13
+ }
14
+
15
+ export function adaptCoreOperationToLiveOperation(accountId: string, op: CoreOperation): Operation {
15
16
  return {
16
17
  id: encodeOperationId(accountId, op.tx.hash, op.type),
17
18
  hash: op.tx.hash,
@@ -38,7 +39,7 @@ export function transactionToIntent(
38
39
  sender: account.freshAddress,
39
40
  recipient: transaction.recipient,
40
41
  amount: fromBigNumberToBigInt(transaction.amount, BigInt(0)),
41
- asset: null,
42
+ asset: { type: "native" },
42
43
  };
43
44
  }
44
45
 
@@ -2,6 +2,13 @@ import { sortCurrenciesByIds } from "./sortByMarketcap";
2
2
  import { findCurrencyByTicker, listCryptoCurrencies, listTokens } from ".";
3
3
  import { getBTCValues } from "@ledgerhq/live-countervalues/mock";
4
4
  import { CURRENCIES_LIST, IDS } from "./mock";
5
+ import { setCryptoAssetsStore as setCryptoAssetsStoreForCoinFramework } from "@ledgerhq/coin-framework/crypto-assets/index";
6
+ import { CryptoAssetsStore } from "@ledgerhq/coin-framework/crypto-assets/type";
7
+
8
+ // eslint-disable-next-line @typescript-eslint/consistent-type-assertions
9
+ setCryptoAssetsStoreForCoinFramework({
10
+ findTokenByTicker: (_: string) => undefined,
11
+ } as CryptoAssetsStore);
5
12
 
6
13
  test("sortCurrenciesByIds snapshot", () => {
7
14
  const list = [...listCryptoCurrencies(), ...listTokens()];
@@ -87,7 +87,7 @@ export class Currency {
87
87
  static readonly ETH_LIDO = new Currency(
88
88
  "LIDO Staked ETH",
89
89
  "STETH",
90
- "ethereum",
90
+ "ethereum/erc20/steth",
91
91
  AppInfos.ETHEREUM,
92
92
  );
93
93
  static readonly XLM_USCD = new Currency("USDC", "usdc", "stellar", AppInfos.STELLAR);
@@ -19,6 +19,7 @@ export class Provider {
19
19
  static readonly KILN = new Provider("kiln", "Kiln staking Pool", false, true, true);
20
20
  static readonly STADER_LABS = new Provider("stader", "Stader Labs", false, true, true);
21
21
  static readonly LIDO = new Provider("lido", "Lido", false, true, true);
22
+ static readonly TRANSAK = new Provider("transak", "Transak", false, true, true);
22
23
 
23
24
  static getNameByUiName(uiName: string): string {
24
25
  const provider = Object.values(Provider).find(p => p.uiName === uiName);
@@ -11,7 +11,7 @@ import { createSpeculosDeviceCI, releaseSpeculosDeviceCI } from "./speculosCI";
11
11
  import type { AppCandidate } from "@ledgerhq/coin-framework/bot/types";
12
12
  import { DeviceModelId } from "@ledgerhq/devices";
13
13
  import { CryptoCurrency } from "@ledgerhq/types-cryptoassets";
14
- import axios from "axios";
14
+ import axios, { AxiosError, AxiosResponse } from "axios";
15
15
  import { getEnv } from "@ledgerhq/live-env";
16
16
  import { getCryptoCurrencyById } from "../currencies";
17
17
  import { DeviceLabels } from "../e2e/enum/DeviceLabels";
@@ -415,13 +415,59 @@ interface ResponseData {
415
415
  events: Event[];
416
416
  }
417
417
 
418
+ function getSpeculosAddress(): string {
419
+ const speculosAddress = process.env.SPECULOS_ADDRESS;
420
+ return speculosAddress || "http://127.0.0.1";
421
+ }
422
+
423
+ async function retryAxiosRequest<T>(
424
+ requestFn: () => Promise<AxiosResponse<T>>,
425
+ maxRetries: number = 5,
426
+ baseDelay: number = 1000,
427
+ retryableStatusCodes: number[] = [500, 502, 503, 504],
428
+ ): Promise<AxiosResponse<T>> {
429
+ let lastError: AxiosError | Error;
430
+
431
+ for (let attempt = 0; attempt <= maxRetries; attempt++) {
432
+ try {
433
+ return await requestFn();
434
+ } catch (error) {
435
+ lastError = error as AxiosError | Error;
436
+
437
+ const isRetryable =
438
+ axios.isAxiosError(error) &&
439
+ error.response &&
440
+ retryableStatusCodes.includes(error.response.status);
441
+
442
+ const isNetworkError = axios.isAxiosError(error) && !error.response;
443
+
444
+ if ((isRetryable || isNetworkError) && attempt < maxRetries) {
445
+ const delay = baseDelay * (attempt + 1);
446
+ console.warn(
447
+ `Axios request failed (attempt ${attempt + 1}/${maxRetries + 1}), retrying in ${delay}ms...`,
448
+ {
449
+ status: axios.isAxiosError(error) ? error.response?.status : "network error",
450
+ message: error.message,
451
+ },
452
+ );
453
+ await new Promise(resolve => setTimeout(resolve, delay));
454
+ continue;
455
+ }
456
+
457
+ throw lastError;
458
+ }
459
+ }
460
+
461
+ throw lastError!;
462
+ }
463
+
418
464
  export async function waitFor(text: string, maxAttempts = 15): Promise<string[]> {
419
465
  const port = getEnv("SPECULOS_API_PORT");
420
- const address = process.env.SPECULOS_ADDRESS || "http://127.0.0.1";
466
+ const address = getSpeculosAddress();
421
467
  const url = `${address}:${port}/events?stream=false&currentscreenonly=true`;
422
468
 
423
469
  for (let attempt = 0; attempt < maxAttempts; attempt++) {
424
- const { data } = await axios.get<ResponseData>(url);
470
+ const { data } = await retryAxiosRequest(() => axios.get<ResponseData>(url));
425
471
  const texts = data.events.map(event => event.text);
426
472
 
427
473
  if (texts?.some(t => t?.toLowerCase().includes(text.toLowerCase()))) {
@@ -436,10 +482,12 @@ export async function waitFor(text: string, maxAttempts = 15): Promise<string[]>
436
482
 
437
483
  export async function pressBoth() {
438
484
  const speculosApiPort = getEnv("SPECULOS_API_PORT");
439
- const speculosAddress = process.env.SPECULOS_ADDRESS || "http://127.0.0.1";
440
- await axios.post(`${speculosAddress}:${speculosApiPort}/button/both`, {
441
- action: "press-and-release",
442
- });
485
+ const speculosAddress = getSpeculosAddress();
486
+ await retryAxiosRequest(() =>
487
+ axios.post(`${speculosAddress}:${speculosApiPort}/button/both`, {
488
+ action: "press-and-release",
489
+ }),
490
+ );
443
491
  }
444
492
 
445
493
  export async function pressUntilTextFound(
@@ -465,27 +513,33 @@ export async function pressUntilTextFound(
465
513
  }
466
514
 
467
515
  async function fetchCurrentScreenTexts(speculosApiPort: number): Promise<string> {
468
- const speculosAddress = process.env.SPECULOS_ADDRESS || "http://127.0.0.1";
469
- const response = await axios.get<ResponseData>(
470
- `${speculosAddress}:${speculosApiPort}/events?stream=false&currentscreenonly=true`,
516
+ const speculosAddress = getSpeculosAddress();
517
+ const response = await retryAxiosRequest(() =>
518
+ axios.get<ResponseData>(
519
+ `${speculosAddress}:${speculosApiPort}/events?stream=false&currentscreenonly=true`,
520
+ ),
471
521
  );
472
522
  return response.data.events.map(event => event.text).join("");
473
523
  }
474
524
 
475
525
  async function fetchAllEvents(speculosApiPort: number): Promise<string[]> {
476
- const speculosAddress = process.env.SPECULOS_ADDRESS || "http://127.0.0.1";
477
- const response = await axios.get<ResponseData>(
478
- `${speculosAddress}:${speculosApiPort}/events?stream=false&currentscreenonly=false`,
526
+ const speculosAddress = getSpeculosAddress();
527
+ const response = await retryAxiosRequest(() =>
528
+ axios.get<ResponseData>(
529
+ `${speculosAddress}:${speculosApiPort}/events?stream=false&currentscreenonly=false`,
530
+ ),
479
531
  );
480
532
  return response.data.events.map(event => event.text);
481
533
  }
482
534
 
483
535
  export async function pressRightButton(): Promise<void> {
484
536
  const speculosApiPort = getEnv("SPECULOS_API_PORT");
485
- const speculosAddress = process.env.SPECULOS_ADDRESS || "http://127.0.0.1";
486
- await axios.post(`${speculosAddress}:${speculosApiPort}/button/right`, {
487
- action: "press-and-release",
488
- });
537
+ const speculosAddress = getSpeculosAddress();
538
+ await retryAxiosRequest(() =>
539
+ axios.post(`${speculosAddress}:${speculosApiPort}/button/right`, {
540
+ action: "press-and-release",
541
+ }),
542
+ );
489
543
  }
490
544
 
491
545
  export function containsSubstringInEvent(targetString: string, events: string[]): boolean {
@@ -503,12 +557,14 @@ export function containsSubstringInEvent(targetString: string, events: string[])
503
557
  }
504
558
 
505
559
  export async function takeScreenshot(port?: number): Promise<Buffer | undefined> {
506
- const speculosAddress = process.env.SPECULOS_ADDRESS || "http://127.0.0.1";
560
+ const speculosAddress = getSpeculosAddress();
507
561
  const speculosApiPort = port ?? getEnv("SPECULOS_API_PORT");
508
562
  try {
509
- const response = await axios.get(`${speculosAddress}:${speculosApiPort}/screenshot`, {
510
- responseType: "arraybuffer",
511
- });
563
+ const response = await retryAxiosRequest(() =>
564
+ axios.get(`${speculosAddress}:${speculosApiPort}/screenshot`, {
565
+ responseType: "arraybuffer",
566
+ }),
567
+ );
512
568
  return response.data;
513
569
  } catch (error) {
514
570
  console.error("Error downloading speculos screenshot:", error);
@@ -61,22 +61,44 @@ async function githubApiRequest<T = unknown>({
61
61
  function waitForSpeculosReady(url: string, { interval = 2000, timeout = 300_000 } = {}) {
62
62
  return new Promise((resolve, reject) => {
63
63
  const startTime = Date.now();
64
+ let currentRequest: ReturnType<typeof https.get> | null = null;
65
+
66
+ function cleanup() {
67
+ if (currentRequest) {
68
+ currentRequest.destroy();
69
+ currentRequest = null;
70
+ }
71
+ }
64
72
 
65
73
  function check() {
66
- https
67
- .get(url, res => {
68
- if (res.statusCode && res.statusCode >= 200 && res.statusCode < 400) {
69
- process.env.SPECULOS_ADDRESS = url;
70
- resolve(true);
71
- } else {
72
- retry();
73
- }
74
- })
75
- .on("error", retry);
74
+ cleanup();
75
+
76
+ currentRequest = https.get(url, { timeout: 10000 }, res => {
77
+ if (res.statusCode && res.statusCode >= 200 && res.statusCode < 400) {
78
+ process.env.SPECULOS_ADDRESS = url;
79
+ cleanup();
80
+ console.warn(`Speculos is ready at ${url}`);
81
+ resolve(true);
82
+ } else {
83
+ console.warn(`Speculos not ready yet, status: ${res.statusCode}`);
84
+ retry();
85
+ }
86
+ });
87
+
88
+ currentRequest.on("error", error => {
89
+ console.error(`Request error: ${error.message}`);
90
+ retry();
91
+ });
92
+
93
+ currentRequest.on("timeout", () => {
94
+ console.error("Request timeout");
95
+ retry();
96
+ });
76
97
  }
77
98
 
78
99
  function retry() {
79
100
  if (Date.now() - startTime >= timeout) {
101
+ cleanup();
80
102
  reject(new Error(`Timeout: ${url} did not become available within ${timeout}ms`));
81
103
  } else {
82
104
  setTimeout(check, interval);
@@ -18,6 +18,8 @@ import { inferDescriptorFromAccount, AccountDescriptor } from "@ledgerhq/coin-bi
18
18
  import { setEnv } from "@ledgerhq/live-env";
19
19
  import { fromAccountRaw } from "../../account";
20
20
  import { setSupportedCurrencies } from "../../currencies";
21
+ import { setCryptoAssetsStore as setCryptoAssetsStoreForCoinFramework } from "@ledgerhq/coin-framework/crypto-assets/index";
22
+ import { CryptoAssetsStore } from "@ledgerhq/coin-framework/crypto-assets/type";
21
23
 
22
24
  setSupportedCurrencies(["bitcoin"]);
23
25
  jest.setTimeout(10000);
@@ -230,6 +232,11 @@ describe("stringifySatStackConfig", () => {
230
232
  });
231
233
  });
232
234
  describe("editSatStackConfig", () => {
235
+ // eslint-disable-next-line @typescript-eslint/consistent-type-assertions
236
+ setCryptoAssetsStoreForCoinFramework({
237
+ findTokenById: (_: string) => undefined,
238
+ findTokenByAddressInCurrency: (_: string, __: string) => undefined,
239
+ } as CryptoAssetsStore);
233
240
  const config = {
234
241
  node: { ...mockConfig, tls: false },
235
242
  extra: {
@@ -0,0 +1,6 @@
1
+ import "../../__tests__/test-helpers/setup";
2
+
3
+ import { dataset } from "@ledgerhq/coin-canton/test/index";
4
+ import { testBridge } from "../../__tests__/test-helpers/bridge";
5
+
6
+ testBridge(dataset);
@@ -0,0 +1,12 @@
1
+ import { ConfigInfo } from "@ledgerhq/live-config/LiveConfig";
2
+
3
+ export const cantonConfig: Record<string, ConfigInfo> = {
4
+ config_currency_canton: {
5
+ type: "object",
6
+ default: {
7
+ status: {
8
+ type: "active",
9
+ },
10
+ },
11
+ },
12
+ };
@@ -0,0 +1,2 @@
1
+ // Encapsulate for LLD & LLM
2
+ export * from "@ledgerhq/coin-canton/common-logic/index";
@@ -0,0 +1,34 @@
1
+ // Goal of this file is to inject all necessary device/signer dependency to coin-modules
2
+
3
+ import { createBridges } from "@ledgerhq/coin-canton/bridge/index";
4
+ import Transport from "@ledgerhq/hw-transport";
5
+ import { CantonSigner } from "@ledgerhq/coin-canton";
6
+ import cantonResolver from "@ledgerhq/coin-canton/signer";
7
+ import type { Account, Bridge } from "@ledgerhq/types-live";
8
+ import makeCliTools from "@ledgerhq/coin-canton/test/cli";
9
+ import { CantonCoinConfig } from "@ledgerhq/coin-canton/config";
10
+ import { TransactionStatus, Transaction } from "@ledgerhq/coin-canton/types";
11
+ import { LegacySignerCanton } from "@ledgerhq/live-signer-canton";
12
+ import { CreateSigner, createResolver, executeWithSigner } from "../../bridge/setup";
13
+ import { Resolver } from "../../hw/getAddress/types";
14
+ import { getCurrencyConfiguration } from "../../config";
15
+ import { getCryptoCurrencyById } from "../../currencies";
16
+
17
+ const createSigner: CreateSigner<CantonSigner> = (transport: Transport) => {
18
+ return new LegacySignerCanton(transport);
19
+ };
20
+
21
+ const getCurrencyConfig = () => {
22
+ return getCurrencyConfiguration<CantonCoinConfig>(getCryptoCurrencyById("canton_network"));
23
+ };
24
+
25
+ const bridge: Bridge<Transaction, Account, TransactionStatus> = createBridges(
26
+ executeWithSigner(createSigner),
27
+ getCurrencyConfig,
28
+ );
29
+
30
+ const resolver: Resolver = createResolver(createSigner, cantonResolver);
31
+
32
+ const cliTools = makeCliTools();
33
+
34
+ export { bridge, cliTools, resolver };
@@ -0,0 +1,2 @@
1
+ // Encapsulate for LLD & LLM
2
+ export * from "@ledgerhq/coin-canton/types/index";