@ledgerhq/live-common 34.52.0 → 34.53.0-nightly.20251108023448

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 (478) hide show
  1. package/lib/DataModel.d.ts +2 -2
  2. package/lib/DataModel.d.ts.map +1 -1
  3. package/lib/DataModel.js +2 -2
  4. package/lib/DataModel.js.map +1 -1
  5. package/lib/__tests__/test-helpers/bridge.d.ts.map +1 -1
  6. package/lib/__tests__/test-helpers/bridge.js +103 -47
  7. package/lib/__tests__/test-helpers/bridge.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 -5
  10. package/lib/__tests__/test-helpers/setup.js.map +1 -1
  11. package/lib/account/serialization.d.ts +1 -1
  12. package/lib/account/serialization.d.ts.map +1 -1
  13. package/lib/account/serialization.js +2 -2
  14. package/lib/account/serialization.js.map +1 -1
  15. package/lib/api/ofacGeoBlockApi.d.ts +4 -0
  16. package/lib/api/ofacGeoBlockApi.d.ts.map +1 -0
  17. package/lib/api/ofacGeoBlockApi.js +21 -0
  18. package/lib/api/ofacGeoBlockApi.js.map +1 -0
  19. package/lib/apps/config.d.ts.map +1 -1
  20. package/lib/apps/config.js +1 -0
  21. package/lib/apps/config.js.map +1 -1
  22. package/lib/bot/engine.d.ts +5 -5
  23. package/lib/bot/engine.d.ts.map +1 -1
  24. package/lib/bot/engine.js.map +1 -1
  25. package/lib/bridge/crypto-assets/index.d.ts.map +1 -1
  26. package/lib/bridge/crypto-assets/index.js +2 -2
  27. package/lib/bridge/crypto-assets/index.js.map +1 -1
  28. package/lib/bridge/generic-alpaca/alpaca/network/network-alpaca.d.ts +2 -2
  29. package/lib/bridge/generic-alpaca/createTransaction.d.ts.map +1 -1
  30. package/lib/bridge/generic-alpaca/createTransaction.js +6 -1
  31. package/lib/bridge/generic-alpaca/createTransaction.js.map +1 -1
  32. package/lib/bridge/generic-alpaca/getTransactionStatus.d.ts.map +1 -1
  33. package/lib/bridge/generic-alpaca/getTransactionStatus.js +1 -0
  34. package/lib/bridge/generic-alpaca/getTransactionStatus.js.map +1 -1
  35. package/lib/bridge/generic-alpaca/prepareTransaction.d.ts +2 -2
  36. package/lib/bridge/generic-alpaca/prepareTransaction.d.ts.map +1 -1
  37. package/lib/bridge/generic-alpaca/prepareTransaction.js +30 -26
  38. package/lib/bridge/generic-alpaca/prepareTransaction.js.map +1 -1
  39. package/lib/bridge/generic-alpaca/signOperation.d.ts.map +1 -1
  40. package/lib/bridge/generic-alpaca/signOperation.js +6 -4
  41. package/lib/bridge/generic-alpaca/signOperation.js.map +1 -1
  42. package/lib/bridge/generic-alpaca/signer/Eth.d.ts +2 -1
  43. package/lib/bridge/generic-alpaca/signer/Eth.d.ts.map +1 -1
  44. package/lib/bridge/generic-alpaca/signer/Eth.js +2 -1
  45. package/lib/bridge/generic-alpaca/signer/Eth.js.map +1 -1
  46. package/lib/bridge/generic-alpaca/types.d.ts +61 -2
  47. package/lib/bridge/generic-alpaca/types.d.ts.map +1 -1
  48. package/lib/bridge/generic-alpaca/utils.d.ts +1 -1
  49. package/lib/bridge/generic-alpaca/utils.d.ts.map +1 -1
  50. package/lib/bridge/generic-alpaca/utils.js +121 -7
  51. package/lib/bridge/generic-alpaca/utils.js.map +1 -1
  52. package/lib/bridge/index.d.ts +1 -1
  53. package/lib/bridge/index.d.ts.map +1 -1
  54. package/lib/bridge/index.js +2 -2
  55. package/lib/bridge/index.js.map +1 -1
  56. package/lib/currencies/index.d.ts +1 -1
  57. package/lib/currencies/index.d.ts.map +1 -1
  58. package/lib/currencies/index.js +1 -4
  59. package/lib/currencies/index.js.map +1 -1
  60. package/lib/dada-client/__mocks__/assets.mock.d.ts +383 -0
  61. package/lib/dada-client/__mocks__/assets.mock.d.ts.map +1 -0
  62. package/lib/dada-client/__mocks__/assets.mock.js +260 -0
  63. package/lib/dada-client/__mocks__/assets.mock.js.map +1 -0
  64. package/lib/dada-client/hooks/useAssetsData.d.ts +2 -1
  65. package/lib/dada-client/hooks/useAssetsData.d.ts.map +1 -1
  66. package/lib/dada-client/hooks/useAssetsData.js +2 -2
  67. package/lib/dada-client/hooks/useAssetsData.js.map +1 -1
  68. package/lib/dada-client/hooks/useLazyLedgerCurrency.d.ts +13 -0
  69. package/lib/dada-client/hooks/useLazyLedgerCurrency.d.ts.map +1 -0
  70. package/lib/dada-client/hooks/useLazyLedgerCurrency.js +34 -0
  71. package/lib/dada-client/hooks/useLazyLedgerCurrency.js.map +1 -0
  72. package/lib/dada-client/index.d.ts +2 -0
  73. package/lib/dada-client/index.d.ts.map +1 -0
  74. package/lib/dada-client/index.js +18 -0
  75. package/lib/dada-client/index.js.map +1 -0
  76. package/lib/dada-client/state-manager/api.js +1 -1
  77. package/lib/dada-client/state-manager/api.js.map +1 -1
  78. package/lib/dada-client/utils/currencySelection.d.ts +10 -0
  79. package/lib/dada-client/utils/currencySelection.d.ts.map +1 -0
  80. package/lib/dada-client/utils/currencySelection.js +34 -0
  81. package/lib/dada-client/utils/currencySelection.js.map +1 -0
  82. package/lib/deposit/helper.d.ts +1 -1
  83. package/lib/deposit/helper.d.ts.map +1 -1
  84. package/lib/deposit/helper.js +3 -2
  85. package/lib/deposit/helper.js.map +1 -1
  86. package/lib/e2e/data/deviceLabelsData.d.ts.map +1 -1
  87. package/lib/e2e/data/deviceLabelsData.js +2 -1
  88. package/lib/e2e/data/deviceLabelsData.js.map +1 -1
  89. package/lib/e2e/enum/DeviceLabels.d.ts +5 -1
  90. package/lib/e2e/enum/DeviceLabels.d.ts.map +1 -1
  91. package/lib/e2e/enum/DeviceLabels.js +4 -0
  92. package/lib/e2e/enum/DeviceLabels.js.map +1 -1
  93. package/lib/e2e/index.d.ts +4 -8
  94. package/lib/e2e/index.d.ts.map +1 -1
  95. package/lib/e2e/speculos.d.ts +1 -1
  96. package/lib/e2e/speculos.d.ts.map +1 -1
  97. package/lib/e2e/speculos.js +24 -5
  98. package/lib/e2e/speculos.js.map +1 -1
  99. package/lib/e2e/speculosAppVersion.d.ts.map +1 -1
  100. package/lib/e2e/speculosAppVersion.js +1 -0
  101. package/lib/e2e/speculosAppVersion.js.map +1 -1
  102. package/lib/families/cosmos/datasets/coreum.d.ts.map +1 -1
  103. package/lib/families/cosmos/datasets/coreum.js +2 -1
  104. package/lib/families/cosmos/datasets/coreum.js.map +1 -1
  105. package/lib/families/near/config.d.ts.map +1 -1
  106. package/lib/families/near/config.js +1 -0
  107. package/lib/families/near/config.js.map +1 -1
  108. package/lib/families/solana/setup.d.ts +1 -1
  109. package/lib/families/tron/data.mock.d.ts +4 -4
  110. package/lib/families/tron/data.mock.d.ts.map +1 -1
  111. package/lib/families/tron/data.mock.js +27 -13
  112. package/lib/families/tron/data.mock.js.map +1 -1
  113. package/lib/featureFlags/defaultFeatures.d.ts.map +1 -1
  114. package/lib/featureFlags/defaultFeatures.js +3 -4
  115. package/lib/featureFlags/defaultFeatures.js.map +1 -1
  116. package/lib/featureFlags/stakePrograms/index.d.ts +1 -0
  117. package/lib/featureFlags/stakePrograms/index.d.ts.map +1 -1
  118. package/lib/featureFlags/stakePrograms/index.js +13 -1
  119. package/lib/featureFlags/stakePrograms/index.js.map +1 -1
  120. package/lib/featureFlags/useFeature.d.ts +1 -1
  121. package/lib/featureFlags/useFeature.d.ts.map +1 -1
  122. package/lib/generated/cli-transaction.d.ts +1 -1
  123. package/lib/generated/transaction.d.ts +1 -1
  124. package/lib/hw/actions/implementations.d.ts.map +1 -1
  125. package/lib/hw/actions/implementations.js +13 -7
  126. package/lib/hw/actions/implementations.js.map +1 -1
  127. package/lib/hw/connectAppEventMapper.d.ts.map +1 -1
  128. package/lib/hw/connectAppEventMapper.js +2 -2
  129. package/lib/hw/connectAppEventMapper.js.map +1 -1
  130. package/lib/market/hooks/useLargeMoverCurrencies.d.ts +1 -1
  131. package/lib/market/hooks/useMarketDataProvider.d.ts +2 -2
  132. package/lib/market/hooks/useMarketDataProvider.d.ts.map +1 -1
  133. package/lib/market/hooks/useMarketDataProvider.js +4 -7
  134. package/lib/market/hooks/useMarketDataProvider.js.map +1 -1
  135. package/lib/market/utils/currencyFormatter.d.ts +3 -4
  136. package/lib/market/utils/currencyFormatter.d.ts.map +1 -1
  137. package/lib/market/utils/currencyFormatter.js +3 -6
  138. package/lib/market/utils/currencyFormatter.js.map +1 -1
  139. package/lib/market/utils/queryKeys.d.ts +0 -1
  140. package/lib/market/utils/queryKeys.d.ts.map +1 -1
  141. package/lib/market/utils/queryKeys.js +0 -1
  142. package/lib/market/utils/queryKeys.js.map +1 -1
  143. package/lib/market/utils/types.d.ts +6 -8
  144. package/lib/market/utils/types.d.ts.map +1 -1
  145. package/lib/market/utils/types.js.map +1 -1
  146. package/lib/mock/fixtures/cryptoCurrencies.d.ts.map +1 -1
  147. package/lib/mock/fixtures/cryptoCurrencies.js +10 -1
  148. package/lib/mock/fixtures/cryptoCurrencies.js.map +1 -1
  149. package/lib/modularDrawer/__mocks__/currencies.mock.d.ts +1 -1
  150. package/lib/modularDrawer/__mocks__/currencies.mock.d.ts.map +1 -1
  151. package/lib/modularDrawer/__mocks__/currencies.mock.js +1 -1
  152. package/lib/modularDrawer/__mocks__/currencies.mock.js.map +1 -1
  153. package/lib/modularDrawer/utils/currencyUtils.d.ts +3 -3
  154. package/lib/modularDrawer/utils/currencyUtils.d.ts.map +1 -1
  155. package/lib/modularDrawer/utils/currencyUtils.js +8 -8
  156. package/lib/modularDrawer/utils/currencyUtils.js.map +1 -1
  157. package/lib/postOnboarding/hooks/usePostOnboardingHubState.d.ts.map +1 -1
  158. package/lib/postOnboarding/hooks/usePostOnboardingHubState.js +13 -4
  159. package/lib/postOnboarding/hooks/usePostOnboardingHubState.js.map +1 -1
  160. package/lib/postOnboarding/mock.d.ts +1 -0
  161. package/lib/postOnboarding/mock.d.ts.map +1 -1
  162. package/lib/postOnboarding/mock.js +3 -1
  163. package/lib/postOnboarding/mock.js.map +1 -1
  164. package/lib/postOnboarding/reducer.d.ts +16 -14
  165. package/lib/postOnboarding/reducer.d.ts.map +1 -1
  166. package/lib/transaction/index.d.ts +1 -1
  167. package/lib/transaction/index.d.ts.map +1 -1
  168. package/lib/transaction/index.js +2 -2
  169. package/lib/transaction/index.js.map +1 -1
  170. package/lib/utils/addressUtils.d.ts +15 -0
  171. package/lib/utils/addressUtils.d.ts.map +1 -0
  172. package/lib/utils/addressUtils.js +39 -0
  173. package/lib/utils/addressUtils.js.map +1 -0
  174. package/lib/wallet-api/ACRE/server.d.ts.map +1 -1
  175. package/lib/wallet-api/ACRE/server.js +19 -15
  176. package/lib/wallet-api/ACRE/server.js.map +1 -1
  177. package/lib/wallet-api/Exchange/server.d.ts.map +1 -1
  178. package/lib/wallet-api/Exchange/server.js +8 -5
  179. package/lib/wallet-api/Exchange/server.js.map +1 -1
  180. package/lib/wallet-api/logic.d.ts.map +1 -1
  181. package/lib/wallet-api/logic.js +29 -29
  182. package/lib/wallet-api/logic.js.map +1 -1
  183. package/lib/wallet-api/react.d.ts.map +1 -1
  184. package/lib/wallet-api/react.js +37 -29
  185. package/lib/wallet-api/react.js.map +1 -1
  186. package/lib/wallet-api/useDappLogic.d.ts.map +1 -1
  187. package/lib/wallet-api/useDappLogic.js +76 -60
  188. package/lib/wallet-api/useDappLogic.js.map +1 -1
  189. package/lib-es/DataModel.d.ts +2 -2
  190. package/lib-es/DataModel.d.ts.map +1 -1
  191. package/lib-es/DataModel.js +2 -2
  192. package/lib-es/DataModel.js.map +1 -1
  193. package/lib-es/__tests__/test-helpers/bridge.d.ts.map +1 -1
  194. package/lib-es/__tests__/test-helpers/bridge.js +103 -47
  195. package/lib-es/__tests__/test-helpers/bridge.js.map +1 -1
  196. package/lib-es/__tests__/test-helpers/setup.d.ts.map +1 -1
  197. package/lib-es/__tests__/test-helpers/setup.js +6 -5
  198. package/lib-es/__tests__/test-helpers/setup.js.map +1 -1
  199. package/lib-es/account/serialization.d.ts +1 -1
  200. package/lib-es/account/serialization.d.ts.map +1 -1
  201. package/lib-es/account/serialization.js +2 -2
  202. package/lib-es/account/serialization.js.map +1 -1
  203. package/lib-es/api/ofacGeoBlockApi.d.ts +4 -0
  204. package/lib-es/api/ofacGeoBlockApi.d.ts.map +1 -0
  205. package/lib-es/api/ofacGeoBlockApi.js +18 -0
  206. package/lib-es/api/ofacGeoBlockApi.js.map +1 -0
  207. package/lib-es/apps/config.d.ts.map +1 -1
  208. package/lib-es/apps/config.js +1 -0
  209. package/lib-es/apps/config.js.map +1 -1
  210. package/lib-es/bot/engine.d.ts +5 -5
  211. package/lib-es/bot/engine.d.ts.map +1 -1
  212. package/lib-es/bot/engine.js.map +1 -1
  213. package/lib-es/bridge/crypto-assets/index.d.ts.map +1 -1
  214. package/lib-es/bridge/crypto-assets/index.js +1 -1
  215. package/lib-es/bridge/crypto-assets/index.js.map +1 -1
  216. package/lib-es/bridge/generic-alpaca/alpaca/network/network-alpaca.d.ts +2 -2
  217. package/lib-es/bridge/generic-alpaca/createTransaction.d.ts.map +1 -1
  218. package/lib-es/bridge/generic-alpaca/createTransaction.js +6 -1
  219. package/lib-es/bridge/generic-alpaca/createTransaction.js.map +1 -1
  220. package/lib-es/bridge/generic-alpaca/getTransactionStatus.d.ts.map +1 -1
  221. package/lib-es/bridge/generic-alpaca/getTransactionStatus.js +1 -0
  222. package/lib-es/bridge/generic-alpaca/getTransactionStatus.js.map +1 -1
  223. package/lib-es/bridge/generic-alpaca/prepareTransaction.d.ts +2 -2
  224. package/lib-es/bridge/generic-alpaca/prepareTransaction.d.ts.map +1 -1
  225. package/lib-es/bridge/generic-alpaca/prepareTransaction.js +30 -26
  226. package/lib-es/bridge/generic-alpaca/prepareTransaction.js.map +1 -1
  227. package/lib-es/bridge/generic-alpaca/signOperation.d.ts.map +1 -1
  228. package/lib-es/bridge/generic-alpaca/signOperation.js +6 -4
  229. package/lib-es/bridge/generic-alpaca/signOperation.js.map +1 -1
  230. package/lib-es/bridge/generic-alpaca/signer/Eth.d.ts +2 -1
  231. package/lib-es/bridge/generic-alpaca/signer/Eth.d.ts.map +1 -1
  232. package/lib-es/bridge/generic-alpaca/signer/Eth.js +2 -1
  233. package/lib-es/bridge/generic-alpaca/signer/Eth.js.map +1 -1
  234. package/lib-es/bridge/generic-alpaca/types.d.ts +61 -2
  235. package/lib-es/bridge/generic-alpaca/types.d.ts.map +1 -1
  236. package/lib-es/bridge/generic-alpaca/utils.d.ts +1 -1
  237. package/lib-es/bridge/generic-alpaca/utils.d.ts.map +1 -1
  238. package/lib-es/bridge/generic-alpaca/utils.js +121 -7
  239. package/lib-es/bridge/generic-alpaca/utils.js.map +1 -1
  240. package/lib-es/bridge/index.d.ts +1 -1
  241. package/lib-es/bridge/index.d.ts.map +1 -1
  242. package/lib-es/bridge/index.js +2 -2
  243. package/lib-es/bridge/index.js.map +1 -1
  244. package/lib-es/currencies/index.d.ts +1 -1
  245. package/lib-es/currencies/index.d.ts.map +1 -1
  246. package/lib-es/currencies/index.js +1 -1
  247. package/lib-es/currencies/index.js.map +1 -1
  248. package/lib-es/dada-client/__mocks__/assets.mock.d.ts +383 -0
  249. package/lib-es/dada-client/__mocks__/assets.mock.d.ts.map +1 -0
  250. package/lib-es/dada-client/__mocks__/assets.mock.js +257 -0
  251. package/lib-es/dada-client/__mocks__/assets.mock.js.map +1 -0
  252. package/lib-es/dada-client/hooks/useAssetsData.d.ts +2 -1
  253. package/lib-es/dada-client/hooks/useAssetsData.d.ts.map +1 -1
  254. package/lib-es/dada-client/hooks/useAssetsData.js +2 -2
  255. package/lib-es/dada-client/hooks/useAssetsData.js.map +1 -1
  256. package/lib-es/dada-client/hooks/useLazyLedgerCurrency.d.ts +13 -0
  257. package/lib-es/dada-client/hooks/useLazyLedgerCurrency.d.ts.map +1 -0
  258. package/lib-es/dada-client/hooks/useLazyLedgerCurrency.js +27 -0
  259. package/lib-es/dada-client/hooks/useLazyLedgerCurrency.js.map +1 -0
  260. package/lib-es/dada-client/index.d.ts +2 -0
  261. package/lib-es/dada-client/index.d.ts.map +1 -0
  262. package/lib-es/dada-client/index.js +2 -0
  263. package/lib-es/dada-client/index.js.map +1 -0
  264. package/lib-es/dada-client/state-manager/api.js +1 -1
  265. package/lib-es/dada-client/state-manager/api.js.map +1 -1
  266. package/lib-es/dada-client/utils/currencySelection.d.ts +10 -0
  267. package/lib-es/dada-client/utils/currencySelection.d.ts.map +1 -0
  268. package/lib-es/dada-client/utils/currencySelection.js +30 -0
  269. package/lib-es/dada-client/utils/currencySelection.js.map +1 -0
  270. package/lib-es/deposit/helper.d.ts +1 -1
  271. package/lib-es/deposit/helper.d.ts.map +1 -1
  272. package/lib-es/deposit/helper.js +4 -3
  273. package/lib-es/deposit/helper.js.map +1 -1
  274. package/lib-es/e2e/data/deviceLabelsData.d.ts.map +1 -1
  275. package/lib-es/e2e/data/deviceLabelsData.js +2 -1
  276. package/lib-es/e2e/data/deviceLabelsData.js.map +1 -1
  277. package/lib-es/e2e/enum/DeviceLabels.d.ts +5 -1
  278. package/lib-es/e2e/enum/DeviceLabels.d.ts.map +1 -1
  279. package/lib-es/e2e/enum/DeviceLabels.js +4 -0
  280. package/lib-es/e2e/enum/DeviceLabels.js.map +1 -1
  281. package/lib-es/e2e/index.d.ts +4 -8
  282. package/lib-es/e2e/index.d.ts.map +1 -1
  283. package/lib-es/e2e/speculos.d.ts +1 -1
  284. package/lib-es/e2e/speculos.d.ts.map +1 -1
  285. package/lib-es/e2e/speculos.js +24 -5
  286. package/lib-es/e2e/speculos.js.map +1 -1
  287. package/lib-es/e2e/speculosAppVersion.d.ts.map +1 -1
  288. package/lib-es/e2e/speculosAppVersion.js +1 -0
  289. package/lib-es/e2e/speculosAppVersion.js.map +1 -1
  290. package/lib-es/families/cosmos/datasets/coreum.d.ts.map +1 -1
  291. package/lib-es/families/cosmos/datasets/coreum.js +2 -1
  292. package/lib-es/families/cosmos/datasets/coreum.js.map +1 -1
  293. package/lib-es/families/near/config.d.ts.map +1 -1
  294. package/lib-es/families/near/config.js +1 -0
  295. package/lib-es/families/near/config.js.map +1 -1
  296. package/lib-es/families/solana/setup.d.ts +1 -1
  297. package/lib-es/families/tron/data.mock.d.ts +4 -4
  298. package/lib-es/families/tron/data.mock.d.ts.map +1 -1
  299. package/lib-es/families/tron/data.mock.js +22 -12
  300. package/lib-es/families/tron/data.mock.js.map +1 -1
  301. package/lib-es/featureFlags/defaultFeatures.d.ts.map +1 -1
  302. package/lib-es/featureFlags/defaultFeatures.js +3 -4
  303. package/lib-es/featureFlags/defaultFeatures.js.map +1 -1
  304. package/lib-es/featureFlags/stakePrograms/index.d.ts +1 -0
  305. package/lib-es/featureFlags/stakePrograms/index.d.ts.map +1 -1
  306. package/lib-es/featureFlags/stakePrograms/index.js +11 -0
  307. package/lib-es/featureFlags/stakePrograms/index.js.map +1 -1
  308. package/lib-es/featureFlags/useFeature.d.ts +1 -1
  309. package/lib-es/featureFlags/useFeature.d.ts.map +1 -1
  310. package/lib-es/generated/cli-transaction.d.ts +1 -1
  311. package/lib-es/generated/transaction.d.ts +1 -1
  312. package/lib-es/hw/actions/implementations.d.ts.map +1 -1
  313. package/lib-es/hw/actions/implementations.js +15 -9
  314. package/lib-es/hw/actions/implementations.js.map +1 -1
  315. package/lib-es/hw/connectAppEventMapper.d.ts.map +1 -1
  316. package/lib-es/hw/connectAppEventMapper.js +3 -3
  317. package/lib-es/hw/connectAppEventMapper.js.map +1 -1
  318. package/lib-es/market/hooks/useLargeMoverCurrencies.d.ts +1 -1
  319. package/lib-es/market/hooks/useMarketDataProvider.d.ts +2 -2
  320. package/lib-es/market/hooks/useMarketDataProvider.d.ts.map +1 -1
  321. package/lib-es/market/hooks/useMarketDataProvider.js +2 -5
  322. package/lib-es/market/hooks/useMarketDataProvider.js.map +1 -1
  323. package/lib-es/market/utils/currencyFormatter.d.ts +3 -4
  324. package/lib-es/market/utils/currencyFormatter.d.ts.map +1 -1
  325. package/lib-es/market/utils/currencyFormatter.js +3 -6
  326. package/lib-es/market/utils/currencyFormatter.js.map +1 -1
  327. package/lib-es/market/utils/queryKeys.d.ts +0 -1
  328. package/lib-es/market/utils/queryKeys.d.ts.map +1 -1
  329. package/lib-es/market/utils/queryKeys.js +0 -1
  330. package/lib-es/market/utils/queryKeys.js.map +1 -1
  331. package/lib-es/market/utils/types.d.ts +6 -8
  332. package/lib-es/market/utils/types.d.ts.map +1 -1
  333. package/lib-es/market/utils/types.js.map +1 -1
  334. package/lib-es/mock/fixtures/cryptoCurrencies.d.ts.map +1 -1
  335. package/lib-es/mock/fixtures/cryptoCurrencies.js +11 -2
  336. package/lib-es/mock/fixtures/cryptoCurrencies.js.map +1 -1
  337. package/lib-es/modularDrawer/__mocks__/currencies.mock.d.ts +1 -1
  338. package/lib-es/modularDrawer/__mocks__/currencies.mock.d.ts.map +1 -1
  339. package/lib-es/modularDrawer/__mocks__/currencies.mock.js +1 -1
  340. package/lib-es/modularDrawer/__mocks__/currencies.mock.js.map +1 -1
  341. package/lib-es/modularDrawer/utils/currencyUtils.d.ts +3 -3
  342. package/lib-es/modularDrawer/utils/currencyUtils.d.ts.map +1 -1
  343. package/lib-es/modularDrawer/utils/currencyUtils.js +8 -8
  344. package/lib-es/modularDrawer/utils/currencyUtils.js.map +1 -1
  345. package/lib-es/postOnboarding/hooks/usePostOnboardingHubState.d.ts.map +1 -1
  346. package/lib-es/postOnboarding/hooks/usePostOnboardingHubState.js +13 -4
  347. package/lib-es/postOnboarding/hooks/usePostOnboardingHubState.js.map +1 -1
  348. package/lib-es/postOnboarding/mock.d.ts +1 -0
  349. package/lib-es/postOnboarding/mock.d.ts.map +1 -1
  350. package/lib-es/postOnboarding/mock.js +2 -0
  351. package/lib-es/postOnboarding/mock.js.map +1 -1
  352. package/lib-es/postOnboarding/reducer.d.ts +16 -14
  353. package/lib-es/postOnboarding/reducer.d.ts.map +1 -1
  354. package/lib-es/transaction/index.d.ts +1 -1
  355. package/lib-es/transaction/index.d.ts.map +1 -1
  356. package/lib-es/transaction/index.js +2 -2
  357. package/lib-es/transaction/index.js.map +1 -1
  358. package/lib-es/utils/addressUtils.d.ts +15 -0
  359. package/lib-es/utils/addressUtils.d.ts.map +1 -0
  360. package/lib-es/utils/addressUtils.js +35 -0
  361. package/lib-es/utils/addressUtils.js.map +1 -0
  362. package/lib-es/wallet-api/ACRE/server.d.ts.map +1 -1
  363. package/lib-es/wallet-api/ACRE/server.js +19 -15
  364. package/lib-es/wallet-api/ACRE/server.js.map +1 -1
  365. package/lib-es/wallet-api/Exchange/server.d.ts.map +1 -1
  366. package/lib-es/wallet-api/Exchange/server.js +9 -6
  367. package/lib-es/wallet-api/Exchange/server.js.map +1 -1
  368. package/lib-es/wallet-api/logic.d.ts.map +1 -1
  369. package/lib-es/wallet-api/logic.js +26 -26
  370. package/lib-es/wallet-api/logic.js.map +1 -1
  371. package/lib-es/wallet-api/react.d.ts.map +1 -1
  372. package/lib-es/wallet-api/react.js +38 -30
  373. package/lib-es/wallet-api/react.js.map +1 -1
  374. package/lib-es/wallet-api/useDappLogic.d.ts.map +1 -1
  375. package/lib-es/wallet-api/useDappLogic.js +74 -58
  376. package/lib-es/wallet-api/useDappLogic.js.map +1 -1
  377. package/package.json +51 -47
  378. package/src/DataModel.test.ts +74 -24
  379. package/src/DataModel.ts +4 -4
  380. package/src/__tests__/accounts/groupPerDay.ts +182 -177
  381. package/src/__tests__/csvExport.ts +3 -0
  382. package/src/__tests__/migration/account-migration.ts +2 -2
  383. package/src/__tests__/test-helpers/bridge.ts +426 -358
  384. package/src/__tests__/test-helpers/setup.ts +7 -6
  385. package/src/account/serialization.test.ts +6 -6
  386. package/src/account/serialization.ts +2 -2
  387. package/src/api/ofacGeoBlockApi.ts +19 -0
  388. package/src/apps/config.ts +1 -0
  389. package/src/bot/engine.ts +5 -5
  390. package/src/bridge/cache.test.ts +2 -0
  391. package/src/bridge/crypto-assets/index.test.ts +3 -9
  392. package/src/bridge/crypto-assets/index.ts +1 -1
  393. package/src/bridge/generic-alpaca/alpaca/network/network-alpaca.ts +3 -3
  394. package/src/bridge/generic-alpaca/createTransaction.ts +6 -1
  395. package/src/bridge/generic-alpaca/getTransactionStatus.ts +1 -0
  396. package/src/bridge/generic-alpaca/prepareTransaction.ts +36 -41
  397. package/src/bridge/generic-alpaca/signOperation.ts +10 -4
  398. package/src/bridge/generic-alpaca/signer/Eth.ts +4 -2
  399. package/src/bridge/generic-alpaca/tests/prepareTransaction.test.ts +29 -76
  400. package/src/bridge/generic-alpaca/tests/signOperation.test.ts +10 -2
  401. package/src/bridge/generic-alpaca/types.ts +80 -2
  402. package/src/bridge/generic-alpaca/utils.test.ts +58 -2
  403. package/src/bridge/generic-alpaca/utils.ts +151 -10
  404. package/src/bridge/index.ts +2 -2
  405. package/src/bridge/useBridgeTransaction.test.ts +9 -6
  406. package/src/currencies/cryptoIcons.test.ts +10 -5
  407. package/src/currencies/index.ts +0 -3
  408. package/src/currencies/sortByMarketcap.test.ts +4 -1
  409. package/src/dada-client/README.md +38 -0
  410. package/src/dada-client/__mocks__/assets.mock.ts +264 -0
  411. package/src/dada-client/hooks/__tests__/useLazyLedgerCurrency.test.ts +155 -0
  412. package/src/dada-client/hooks/useAssetsData.ts +14 -9
  413. package/src/dada-client/hooks/useLazyLedgerCurrency.ts +46 -0
  414. package/src/dada-client/index.ts +1 -0
  415. package/src/dada-client/state-manager/api.ts +1 -1
  416. package/src/dada-client/utils/__test__/currencySelection.test.ts +16 -0
  417. package/src/dada-client/utils/currencySelection.ts +33 -0
  418. package/src/deposit/deposit.integration.test.ts +15 -0
  419. package/src/deposit/deposit.test.ts +60 -40
  420. package/src/deposit/helper.ts +4 -8
  421. package/src/domain/getTokensWithFunds.test.ts +4 -0
  422. package/src/e2e/data/deviceLabelsData.ts +2 -1
  423. package/src/e2e/enum/DeviceLabels.ts +4 -0
  424. package/src/e2e/speculos.ts +26 -6
  425. package/src/e2e/speculosAppVersion.ts +1 -0
  426. package/src/families/aptos/__snapshots__/bridge.integration.test.ts.snap +12 -12
  427. package/src/families/bitcoin/__snapshots__/bridge.integration.test.ts.snap +1482 -843
  428. package/src/families/bitcoin/satstack.test.ts +33 -20
  429. package/src/families/cosmos/datasets/__snapshots__/babylon.integration.test.ts.snap +1 -1
  430. package/src/families/cosmos/datasets/__snapshots__/coreum.integration.test.ts.snap +4 -4
  431. package/src/families/cosmos/datasets/__snapshots__/cosmos.integration.test.ts.snap +251 -209
  432. package/src/families/cosmos/datasets/coreum.ts +2 -1
  433. package/src/families/hedera/__snapshots__/bridge.integration.test.ts.snap +675 -37
  434. package/src/families/multiversx/__snapshots__/bridge.integration.test.ts.snap +3 -3
  435. package/src/families/near/config.ts +1 -0
  436. package/src/families/polkadot/__snapshots__/bridge.integration.test.ts.snap +34 -34
  437. package/src/families/solana/__snapshots__/bridge.integration.test.ts.snap +3 -3
  438. package/src/families/stacks/__snapshots__/bridge.integration.test.ts.snap +10 -10
  439. package/src/families/stellar/__snapshots__/bridge.integration.test.ts.snap +1183 -625
  440. package/src/families/sui/__snapshots__/bridge.integration.test.ts.snap +428 -0
  441. package/src/families/tron/data.mock.ts +32 -16
  442. package/src/families/tron/react.test.ts +16 -4
  443. package/src/featureFlags/defaultFeatures.ts +3 -4
  444. package/src/featureFlags/stakePrograms/index.ts +14 -0
  445. package/src/hw/actions/implementations.ts +22 -11
  446. package/src/hw/connectAppEventMapper.ts +2 -4
  447. package/src/market/hooks/useMarketDataProvider.ts +4 -8
  448. package/src/market/utils/currencyFormatter.ts +4 -18
  449. package/src/market/utils/queryKeys.ts +0 -1
  450. package/src/market/utils/types.ts +6 -8
  451. package/src/mock/fixtures/cryptoCurrencies.ts +11 -2
  452. package/src/modularDrawer/__mocks__/currencies.mock.ts +1 -1
  453. package/src/modularDrawer/utils/__tests__/currencyUtils.test.ts +10 -10
  454. package/src/modularDrawer/utils/currencyUtils.ts +11 -10
  455. package/src/platform/serializers.test.ts +2 -2
  456. package/src/postOnboarding/hooks/usePostOnboardingHubState.test.ts +30 -3
  457. package/src/postOnboarding/hooks/usePostOnboardingHubState.ts +20 -6
  458. package/src/postOnboarding/mock.ts +2 -0
  459. package/src/transaction/index.ts +2 -2
  460. package/src/utils/__tests__/addressUtils.test.ts +229 -0
  461. package/src/utils/__tests__/getAccountTuplesForCurrency.test.ts +15 -4
  462. package/src/utils/addressUtils.ts +40 -0
  463. package/src/wallet-api/ACRE/server.test.ts +11 -8
  464. package/src/wallet-api/ACRE/server.ts +25 -22
  465. package/src/wallet-api/Exchange/server.ts +11 -8
  466. package/src/wallet-api/logic.test.ts +4 -0
  467. package/src/wallet-api/logic.ts +28 -32
  468. package/src/wallet-api/react.ts +37 -34
  469. package/src/wallet-api/useDappLogic.ts +103 -82
  470. package/lib/hooks/useOFACGeoBlockCheck.d.ts +0 -8
  471. package/lib/hooks/useOFACGeoBlockCheck.d.ts.map +0 -1
  472. package/lib/hooks/useOFACGeoBlockCheck.js +0 -32
  473. package/lib/hooks/useOFACGeoBlockCheck.js.map +0 -1
  474. package/lib-es/hooks/useOFACGeoBlockCheck.d.ts +0 -8
  475. package/lib-es/hooks/useOFACGeoBlockCheck.d.ts.map +0 -1
  476. package/lib-es/hooks/useOFACGeoBlockCheck.js +0 -28
  477. package/lib-es/hooks/useOFACGeoBlockCheck.js.map +0 -1
  478. package/src/hooks/useOFACGeoBlockCheck.ts +0 -37
@@ -0,0 +1,229 @@
1
+ import { addressSplit } from "../addressUtils";
2
+
3
+ describe("addressSplit", () => {
4
+ describe("Basic functionality", () => {
5
+ it("should split a simple address correctly", () => {
6
+ const result = addressSplit("HelloWorld", 2);
7
+ expect(result).toEqual({
8
+ start: "He",
9
+ middle: "lloWor",
10
+ end: "ld",
11
+ });
12
+ });
13
+
14
+ it("should split a longer address with size 4", () => {
15
+ const result = addressSplit("0x1234567890abcdef", 4);
16
+ expect(result).toEqual({
17
+ start: "0x12",
18
+ middle: "34567890ab",
19
+ end: "cdef",
20
+ });
21
+ });
22
+ });
23
+
24
+ describe("Boundary conditions", () => {
25
+ it("should handle exact boundary where size * 2 equals address length", () => {
26
+ const result = addressSplit("ABCDEF", 3);
27
+ expect(result).toEqual({
28
+ start: "ABC",
29
+ middle: "",
30
+ end: "DEF",
31
+ });
32
+ });
33
+
34
+ it("should handle size equal to half address length", () => {
35
+ const result = addressSplit("ABCDEFGH", 4);
36
+ expect(result).toEqual({
37
+ start: "ABCD",
38
+ middle: "",
39
+ end: "EFGH",
40
+ });
41
+ });
42
+
43
+ it("should handle odd-length address with equal split", () => {
44
+ const result = addressSplit("ABCDE", 2);
45
+ expect(result).toEqual({
46
+ start: "AB",
47
+ middle: "C",
48
+ end: "DE",
49
+ });
50
+ });
51
+
52
+ it("should handle very long address", () => {
53
+ const longAddress = "A".repeat(1000);
54
+ const result = addressSplit(longAddress, 10);
55
+ expect(result).toEqual({
56
+ start: "A".repeat(10),
57
+ middle: "A".repeat(980),
58
+ end: "A".repeat(10),
59
+ });
60
+ expect(result.start.length + result.middle.length + result.end.length).toBe(1000);
61
+ });
62
+ });
63
+
64
+ describe("Edge cases - size variations", () => {
65
+ it("should handle size of 0", () => {
66
+ const result = addressSplit("HelloWorld", 0);
67
+ expect(result).toEqual({
68
+ start: "",
69
+ middle: "HelloWorld",
70
+ end: "",
71
+ });
72
+ });
73
+
74
+ it("should handle size of 1", () => {
75
+ const result = addressSplit("HelloWorld", 1);
76
+ expect(result).toEqual({
77
+ start: "H",
78
+ middle: "elloWorl",
79
+ end: "d",
80
+ });
81
+ });
82
+
83
+ it("should handle negative size", () => {
84
+ const result = addressSplit("HelloWorld", -5);
85
+ expect(result).toEqual({
86
+ start: "",
87
+ middle: "HelloWorld",
88
+ end: "",
89
+ });
90
+ });
91
+
92
+ it("should handle size larger than half the address length", () => {
93
+ const result = addressSplit("Hello", 3);
94
+ expect(result).toEqual({
95
+ start: "He",
96
+ middle: "",
97
+ end: "llo",
98
+ });
99
+ });
100
+
101
+ it("should handle size equal to address length", () => {
102
+ const result = addressSplit("Hello", 5);
103
+ expect(result).toEqual({
104
+ start: "He",
105
+ middle: "",
106
+ end: "llo",
107
+ });
108
+ });
109
+
110
+ it("should handle size larger than address length", () => {
111
+ const result = addressSplit("Hello", 10);
112
+ expect(result).toEqual({
113
+ start: "He",
114
+ middle: "",
115
+ end: "llo",
116
+ });
117
+ });
118
+ });
119
+
120
+ describe("Edge cases - address variations", () => {
121
+ it("should handle empty string", () => {
122
+ const result = addressSplit("", 2);
123
+ expect(result).toEqual({
124
+ start: "",
125
+ middle: "",
126
+ end: "",
127
+ });
128
+ });
129
+
130
+ it("should handle single character address", () => {
131
+ const result = addressSplit("A", 1);
132
+ expect(result).toEqual({
133
+ start: "",
134
+ middle: "",
135
+ end: "A",
136
+ });
137
+ });
138
+
139
+ it("should handle two character address", () => {
140
+ const result = addressSplit("AB", 1);
141
+ expect(result).toEqual({
142
+ start: "A",
143
+ middle: "",
144
+ end: "B",
145
+ });
146
+ });
147
+
148
+ it("should handle three character address with size 1", () => {
149
+ const result = addressSplit("ABC", 1);
150
+ expect(result).toEqual({
151
+ start: "A",
152
+ middle: "B",
153
+ end: "C",
154
+ });
155
+ });
156
+ });
157
+
158
+ describe("Real-world cryptocurrency addresses", () => {
159
+ it("should split a Bitcoin address correctly", () => {
160
+ const bitcoinAddress = "1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa";
161
+ const result = addressSplit(bitcoinAddress, 5);
162
+ expect(result).toEqual({
163
+ start: "1A1zP",
164
+ middle: "1eP5QGefi2DMPTfTL5SLmv7D",
165
+ end: "ivfNa",
166
+ });
167
+ });
168
+
169
+ it("should split an Ethereum address correctly", () => {
170
+ const ethAddress = "0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb";
171
+ const result = addressSplit(ethAddress, 6);
172
+ expect(result).toEqual({
173
+ start: "0x742d",
174
+ middle: "35Cc6634C0532925a3b844Bc9e759",
175
+ end: "5f0bEb",
176
+ });
177
+ });
178
+
179
+ it("should handle a Solana address", () => {
180
+ const solanaAddress = "7EqQdEULxWcraVx3mXKFjc84LhCkMGZCkRuDpvcMwJeK";
181
+ const result = addressSplit(solanaAddress, 4);
182
+ expect(result).toEqual({
183
+ start: "7EqQ",
184
+ middle: "dEULxWcraVx3mXKFjc84LhCkMGZCkRuDpvcM",
185
+ end: "wJeK",
186
+ });
187
+ });
188
+
189
+ it("should handle a Polkadot address", () => {
190
+ const polkadotAddress = "15oF4uVJwmo4TdGW7VfQxNLavjCXviqxT9S1MgbjMNHr6Sp5";
191
+ const result = addressSplit(polkadotAddress, 6);
192
+ expect(result).toEqual({
193
+ start: "15oF4u",
194
+ middle: "VJwmo4TdGW7VfQxNLavjCXviqxT9S1MgbjMN",
195
+ end: "Hr6Sp5",
196
+ });
197
+ });
198
+
199
+ it("should handle a Cardano address", () => {
200
+ const cardanoAddress =
201
+ "addr1qxy3w7depgr3wle7kqwzz8u4h5f6gxqe9q0rk8w3n0d7wqxqk0n7n8s3w3w3w3w3w3w3w3w3w3w3w3w3w3w";
202
+ const result = addressSplit(cardanoAddress, 8);
203
+ expect(result).toEqual({
204
+ start: "addr1qxy",
205
+ middle: "3w7depgr3wle7kqwzz8u4h5f6gxqe9q0rk8w3n0d7wqxqk0n7n8s3w3w3w3w3w3w3w3w3w3w",
206
+ end: "3w3w3w3w",
207
+ });
208
+ });
209
+
210
+ it("should handle a Near protocol address", () => {
211
+ const nearAddress = "alice.near";
212
+ const result = addressSplit(nearAddress, 3);
213
+ expect(result).toEqual({
214
+ start: "ali",
215
+ middle: "ce.n",
216
+ end: "ear",
217
+ });
218
+ });
219
+ });
220
+
221
+ describe("Data integrity", () => {
222
+ it("should preserve the entire address when concatenated", () => {
223
+ const address = "1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa";
224
+ const result = addressSplit(address, 5);
225
+ const reconstructed = result.start + result.middle + result.end;
226
+ expect(reconstructed).toBe(address);
227
+ });
228
+ });
229
+ });
@@ -1,8 +1,12 @@
1
- import { getCryptoCurrencyById, findTokenById } from "@ledgerhq/cryptoassets";
1
+ import { getCryptoCurrencyById } from "@ledgerhq/cryptoassets";
2
2
  import { genAccount } from "../../mock/account";
3
3
  import type { CryptoCurrency, TokenCurrency } from "@ledgerhq/types-cryptoassets";
4
4
  import type { Account, TokenAccount } from "@ledgerhq/types-live";
5
5
  import { getAccountTuplesForCurrency } from "../getAccountTuplesForCurrency";
6
+ import { initializeLegacyTokens } from "@ledgerhq/cryptoassets/legacy/legacy-data";
7
+ import { addTokens } from "@ledgerhq/cryptoassets/legacy/legacy-utils";
8
+
9
+ initializeLegacyTokens(addTokens);
6
10
 
7
11
  function* accountGenerator(currency: CryptoCurrency): Generator<Account> {
8
12
  let id = 0;
@@ -66,9 +70,16 @@ describe("getAccountTuplesForCurrency", () => {
66
70
  });
67
71
 
68
72
  describe("TokenCurrency", () => {
69
- const token = findTokenById("ethereum/erc20/aave");
70
- if (!token) throw new Error("AAVE token not found");
71
- const aaveToken = token;
73
+ const aaveToken = {
74
+ type: "TokenCurrency" as const,
75
+ id: "ethereum/erc20/aave",
76
+ name: "Aave Token",
77
+ ticker: "AAVE",
78
+ units: [{ name: "Aave Token", code: "AAVE", magnitude: 18 }],
79
+ contractAddress: "0x7fc66500c84a76ad7e9c93437bfc5ac33e2ddae9",
80
+ parentCurrency: getCryptoCurrencyById("ethereum"),
81
+ tokenType: "erc20" as const,
82
+ };
72
83
 
73
84
  test("returns correct parent accounts including a new subAccount when a TokenCurrency is provided", () => {
74
85
  const ethAccounts = [
@@ -0,0 +1,40 @@
1
+ /**
2
+ * Split an address into start, middle, and end sections
3
+ *
4
+ * @param address - The address string to split
5
+ * @param size - The number of characters to include in the start and end sections
6
+ * @returns An object containing the start, middle, and end portions of the address
7
+ * @example
8
+ * addressSplit("HelloWorld", 2) // => { start: "He", middle: "lloWor", end: "ld" }
9
+ */
10
+ export function addressSplit(
11
+ address: string,
12
+ size: number,
13
+ ): { start: string; middle: string; end: string } {
14
+ if (!address) {
15
+ return { start: "", middle: "", end: "" };
16
+ }
17
+
18
+ if (size < 0) {
19
+ return { start: "", middle: address, end: "" };
20
+ } else if (size === 0) {
21
+ return { start: "", middle: address, end: "" };
22
+ }
23
+
24
+ // Handle edge case of address length smaller than or equal to size * 2
25
+ // In this case, we can't extract both start and end without overlapping
26
+ if (address.length <= size * 2) {
27
+ const halfLength = Math.floor(address.length / 2);
28
+ return {
29
+ start: address.slice(0, halfLength),
30
+ middle: "",
31
+ end: address.slice(halfLength),
32
+ };
33
+ }
34
+
35
+ const start = address.slice(0, size);
36
+ const end = address.slice(-size);
37
+ const middle = address.slice(size, -size);
38
+
39
+ return { start, middle, end };
40
+ }
@@ -11,11 +11,13 @@ jest.mock("@ledgerhq/wallet-api-server", () => ({
11
11
  }));
12
12
 
13
13
  jest.mock("@ledgerhq/cryptoassets", () => ({
14
- findTokenById: jest.fn(),
15
- findTokenByAddressInCurrency: jest.fn(),
16
14
  getCryptoCurrencyById: jest.fn(),
17
15
  }));
18
16
 
17
+ jest.mock("../../bridge/crypto-assets/index", () => ({
18
+ getCryptoAssetsStore: jest.fn(),
19
+ }));
20
+
19
21
  jest.mock("../converters", () => ({
20
22
  getAccountIdFromWalletAccountId: jest.fn(),
21
23
  getWalletAPITransactionSignFlowInfos: jest.fn(),
@@ -148,8 +150,15 @@ describe("ACRE Server Handlers", () => {
148
150
  let mockUiHooks: any;
149
151
  let serverHandlers: any;
150
152
 
153
+ const { getCryptoAssetsStore } = jest.requireMock("../../bridge/crypto-assets/index");
154
+
151
155
  beforeEach(() => {
152
156
  jest.clearAllMocks();
157
+
158
+ getCryptoAssetsStore.mockReturnValue({
159
+ findTokenByAddressInCurrency: jest.fn().mockResolvedValue(mockTokenCurrency),
160
+ findTokenById: jest.fn().mockResolvedValue(mockTokenCurrency),
161
+ });
153
162
  mockUiHooks = {
154
163
  "custom.acre.messageSign": jest.fn().mockImplementation(({ onSuccess }) => {
155
164
  onSuccess("0x1234567890abcdef");
@@ -166,12 +175,6 @@ describe("ACRE Server Handlers", () => {
166
175
  }),
167
176
  };
168
177
 
169
- // Mock the cryptoassets functions globally
170
- const { findTokenByAddressInCurrency, getCryptoCurrencyById } =
171
- jest.requireMock("@ledgerhq/cryptoassets");
172
- findTokenByAddressInCurrency.mockReturnValue(mockTokenCurrency);
173
- getCryptoCurrencyById.mockReturnValue(mockEthereumCurrency);
174
-
175
178
  // Mock the account functions
176
179
  const { makeEmptyTokenAccount, getMainAccount, getParentAccount } = jest.requireMock(
177
180
  "@ledgerhq/coin-framework/account/index",
@@ -8,7 +8,7 @@ import {
8
8
  isTokenAccount,
9
9
  } from "@ledgerhq/coin-framework/account/index";
10
10
  import { Account, AccountLike, AnyMessage, Operation, SignedOperation } from "@ledgerhq/types-live";
11
- import { findTokenById, findTokenByAddressInCurrency } from "@ledgerhq/cryptoassets";
11
+ import { getCryptoAssetsStore } from "../../bridge/crypto-assets/index";
12
12
  import { getCryptoCurrencyById } from "@ledgerhq/cryptoassets/currencies";
13
13
  import {
14
14
  MessageSignParams,
@@ -115,16 +115,19 @@ function validateInputs(params: RegisterYieldBearingEthereumAddressParams): {
115
115
  }
116
116
 
117
117
  // Helper function to find acreToken by address or token id
118
- function findAcreToken(
118
+ async function findAcreToken(
119
119
  tokenContractAddress?: string,
120
120
  tokenTicker?: string,
121
- ): { token: TokenCurrency; contractAddress: string } {
121
+ ): Promise<{ token: TokenCurrency; contractAddress: string }> {
122
122
  let foundToken: TokenCurrency | undefined;
123
123
  // Try to find token by contract address first (if provided)
124
124
  if (tokenContractAddress) {
125
- foundToken = findTokenByAddressInCurrency(tokenContractAddress, "ethereum");
125
+ foundToken = await getCryptoAssetsStore().findTokenByAddressInCurrency(
126
+ tokenContractAddress,
127
+ "ethereum",
128
+ );
126
129
  } else if (tokenTicker) {
127
- foundToken = findTokenById(tokenTicker.toLowerCase());
130
+ foundToken = await getCryptoAssetsStore().findTokenById(tokenTicker.toLowerCase());
128
131
  }
129
132
  if (!foundToken) {
130
133
  throw new Error(
@@ -202,7 +205,7 @@ export const handlers = ({
202
205
  manifest: AppManifest;
203
206
  uiHooks: ACREUiHooks;
204
207
  }) => {
205
- function signTransaction({
208
+ async function signTransaction({
206
209
  accountId: walletAccountId,
207
210
  rawTransaction,
208
211
  options,
@@ -213,17 +216,17 @@ export const handlers = ({
213
216
  tracking.signTransactionRequested(manifest);
214
217
  if (!transaction) {
215
218
  tracking.signTransactionFail(manifest);
216
- return Promise.reject(new Error("Transaction required"));
219
+ throw new Error("Transaction required");
217
220
  }
218
221
  const accountId = getAccountIdFromWalletAccountId(walletAccountId);
219
222
  if (!accountId) {
220
223
  tracking.signTransactionFail(manifest);
221
- return Promise.reject(new Error(`accountId ${walletAccountId} unknown`));
224
+ throw new Error(`accountId ${walletAccountId} unknown`);
222
225
  }
223
226
  const account = accounts.find(account => account.id === accountId);
224
227
  if (!account) {
225
228
  tracking.signTransactionFail(manifest);
226
- return Promise.reject(new Error("Account required"));
229
+ throw new Error("Account required");
227
230
  }
228
231
 
229
232
  const parentAccount = getParentAccount(account, accounts);
@@ -233,7 +236,9 @@ export const handlers = ({
233
236
  : account.currency.family;
234
237
 
235
238
  const mainAccount = getMainAccount(account, parentAccount);
236
- const currency = tokenCurrency ? findTokenById(tokenCurrency) : null;
239
+ const currency = tokenCurrency
240
+ ? await getCryptoAssetsStore().findTokenById(tokenCurrency)
241
+ : null;
237
242
  const signerAccount = currency ? makeEmptyTokenAccount(mainAccount, currency) : account;
238
243
  const { canEditFees, liveTx, hasFeesProvided } = getWalletAPITransactionSignFlowInfos({
239
244
  walletApiTransaction: transaction,
@@ -241,10 +246,8 @@ export const handlers = ({
241
246
  });
242
247
 
243
248
  if (accountFamily !== liveTx.family) {
244
- return Promise.reject(
245
- new Error(
246
- `Account and transaction must be from the same family. Account family: ${accountFamily}, Transaction family: ${liveTx.family}`,
247
- ),
249
+ throw new Error(
250
+ `Account and transaction must be from the same family. Account family: ${accountFamily}, Transaction family: ${liveTx.family}`,
248
251
  );
249
252
  }
250
253
 
@@ -291,13 +294,13 @@ export const handlers = ({
291
294
  const accountId = getAccountIdFromWalletAccountId(walletAccountId);
292
295
  if (!accountId) {
293
296
  tracking.signMessageFail(manifest);
294
- return Promise.reject(new Error(`accountId ${walletAccountId} unknown`));
297
+ throw new Error(`accountId ${walletAccountId} unknown`);
295
298
  }
296
299
 
297
300
  const account = accounts.find(account => account.id === accountId);
298
301
  if (account === undefined) {
299
302
  tracking.signMessageFail(manifest);
300
- return Promise.reject(new Error("account not found"));
303
+ throw new Error("account not found");
301
304
  }
302
305
 
303
306
  const path = fromRelativePath(getMainAccount(account).freshAddressPath, derivationPath);
@@ -328,7 +331,7 @@ export const handlers = ({
328
331
  if (done) return;
329
332
  done = true;
330
333
  tracking.signMessageFail(manifest);
331
- reject(error);
334
+ reject(error instanceof Error ? error : new Error(String(error)));
332
335
  },
333
336
  });
334
337
  });
@@ -379,7 +382,9 @@ export const handlers = ({
379
382
  return Promise.reject(new Error("Account required"));
380
383
  }
381
384
 
382
- const currency = tokenCurrency ? findTokenById(tokenCurrency) : null;
385
+ const currency = tokenCurrency
386
+ ? await getCryptoAssetsStore().findTokenById(tokenCurrency)
387
+ : null;
383
388
  const parentAccount = getParentAccount(account, accounts);
384
389
  const mainAccount = getMainAccount(account, parentAccount);
385
390
  const signerAccount = currency ? makeEmptyTokenAccount(mainAccount, currency) : account;
@@ -415,10 +420,8 @@ export const handlers = ({
415
420
  }
416
421
  const validatedInputs = validateInputs(params);
417
422
  const ethereumCurrency = getCryptoCurrencyById("ethereum");
418
- const { token: existingToken, contractAddress: finalTokenContractAddress } = findAcreToken(
419
- validatedInputs.tokenContractAddress,
420
- validatedInputs.tokenTicker,
421
- );
423
+ const { token: existingToken, contractAddress: finalTokenContractAddress } =
424
+ await findAcreToken(validatedInputs.tokenContractAddress, validatedInputs.tokenTicker);
422
425
  const existingBearingAccount = accounts.find(
423
426
  account =>
424
427
  "freshAddress" in account &&
@@ -4,7 +4,8 @@ import {
4
4
  getParentAccount,
5
5
  makeEmptyTokenAccount,
6
6
  } from "@ledgerhq/coin-framework/account/index";
7
- import { findTokenById, listTokensForCryptoCurrency } from "@ledgerhq/cryptoassets";
7
+ import { listTokensForCryptoCurrency } from "@ledgerhq/cryptoassets";
8
+ import { getCryptoAssetsStore } from "../../bridge/crypto-assets/index";
8
9
  import { decodeSwapPayload } from "@ledgerhq/hw-app-exchange";
9
10
  import { CryptoOrTokenCurrency } from "@ledgerhq/types-cryptoassets";
10
11
  import { Account, AccountLike, getCurrencyForAccount, TokenAccount } from "@ledgerhq/types-live";
@@ -172,7 +173,7 @@ export const handlers = ({
172
173
 
173
174
  // Use `if else` instead of switch to leverage TS type narrowing and avoid `params` force cast.
174
175
  if (params.exchangeType == "SWAP") {
175
- exchangeParams = extractSwapStartParam(params, accounts);
176
+ exchangeParams = await extractSwapStartParam(params, accounts);
176
177
  } else if (params.exchangeType == "SELL") {
177
178
  exchangeParams = extractSellStartParam(params, accounts);
178
179
  } else {
@@ -237,7 +238,7 @@ export const handlers = ({
237
238
  let toParentAccount = getParentAccount(toAccount, accounts);
238
239
  let newTokenAccount: TokenAccount | undefined;
239
240
  if (params.tokenCurrency) {
240
- const currency = findTokenById(params.tokenCurrency);
241
+ const currency = await getCryptoAssetsStore().findTokenById(params.tokenCurrency);
241
242
  if (!currency) {
242
243
  throw new ServerError(createCurrencyNotFound(params.tokenCurrency));
243
244
  }
@@ -397,10 +398,10 @@ export const handlers = ({
397
398
 
398
399
  tracking.startExchangeRequested(trackingParams);
399
400
 
400
- const exchangeStartParams: ExchangeStartParamsUiRequest = extractSwapStartParam(
401
+ const exchangeStartParams: ExchangeStartParamsUiRequest = (await extractSwapStartParam(
401
402
  params,
402
403
  accounts,
403
- ) as SwapStartParamsUiRequest;
404
+ )) as SwapStartParamsUiRequest;
404
405
 
405
406
  const {
406
407
  fromCurrency,
@@ -621,10 +622,10 @@ export const handlers = ({
621
622
  }),
622
623
  }) as const satisfies Handlers;
623
624
 
624
- function extractSwapStartParam(
625
+ async function extractSwapStartParam(
625
626
  params: ExchangeStartSwapParams,
626
627
  accounts: AccountLike[],
627
- ): ExchangeStartParamsUiRequest {
628
+ ): Promise<ExchangeStartParamsUiRequest> {
628
629
  if (!("fromAccountId" in params && "toAccountId" in params)) {
629
630
  throw new ExchangeError(createWrongSwapParams(params));
630
631
  }
@@ -657,7 +658,9 @@ function extractSwapStartParam(
657
658
  const fromParentAccount = getParentAccount(fromAccount, accounts);
658
659
  const toParentAccount = toAccount ? getParentAccount(toAccount, accounts) : undefined;
659
660
 
660
- const currency = params.tokenCurrency ? findTokenById(params.tokenCurrency) : null;
661
+ const currency = params.tokenCurrency
662
+ ? await getCryptoAssetsStore().findTokenById(params.tokenCurrency)
663
+ : null;
661
664
  const newTokenAccount = currency ? makeEmptyTokenAccount(toAccount, currency) : null;
662
665
 
663
666
  return {
@@ -26,6 +26,10 @@ import { TrackingAPI } from "./tracking";
26
26
  import { cryptocurrenciesById } from "@ledgerhq/cryptoassets/currencies";
27
27
  import { setSupportedCurrencies } from "../currencies";
28
28
  import { initialState as walletState } from "@ledgerhq/live-wallet/store";
29
+ import { initializeLegacyTokens } from "@ledgerhq/cryptoassets/legacy/legacy-data";
30
+ import { addTokens } from "@ledgerhq/cryptoassets/legacy/legacy-utils";
31
+
32
+ initializeLegacyTokens(addTokens);
29
33
 
30
34
  describe("receiveOnAccountLogic", () => {
31
35
  // Given