@ledgerhq/live-common 34.47.0 → 34.48.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 (449) hide show
  1. package/lib/bridge/crypto-assets/cal-integration.d.ts +4 -0
  2. package/lib/bridge/crypto-assets/cal-integration.d.ts.map +1 -0
  3. package/lib/bridge/crypto-assets/cal-integration.js +26 -0
  4. package/lib/bridge/crypto-assets/cal-integration.js.map +1 -0
  5. package/lib/bridge/crypto-assets/cal-integration.test.d.ts +2 -0
  6. package/lib/bridge/crypto-assets/cal-integration.test.d.ts.map +1 -0
  7. package/lib/bridge/crypto-assets/cal-integration.test.js +45 -0
  8. package/lib/bridge/crypto-assets/cal-integration.test.js.map +1 -0
  9. package/lib/bridge/crypto-assets/cal-store.d.ts +14 -0
  10. package/lib/bridge/crypto-assets/cal-store.d.ts.map +1 -0
  11. package/lib/bridge/crypto-assets/cal-store.js +58 -0
  12. package/lib/bridge/crypto-assets/cal-store.js.map +1 -0
  13. package/lib/bridge/crypto-assets/cal-store.test.d.ts +2 -0
  14. package/lib/bridge/crypto-assets/cal-store.test.d.ts.map +1 -0
  15. package/lib/bridge/crypto-assets/cal-store.test.js +70 -0
  16. package/lib/bridge/crypto-assets/cal-store.test.js.map +1 -0
  17. package/lib/bridge/crypto-assets/index.d.ts.map +1 -1
  18. package/lib/bridge/crypto-assets/index.js +4 -0
  19. package/lib/bridge/crypto-assets/index.js.map +1 -1
  20. package/lib/bridge/crypto-assets/index.test.js +36 -0
  21. package/lib/bridge/crypto-assets/index.test.js.map +1 -1
  22. package/lib/bridge/generic-alpaca/alpaca/index.d.ts.map +1 -1
  23. package/lib/bridge/generic-alpaca/alpaca/index.js +6 -1
  24. package/lib/bridge/generic-alpaca/alpaca/index.js.map +1 -1
  25. package/lib/bridge/generic-alpaca/alpaca/index.unit.test.d.ts +2 -0
  26. package/lib/bridge/generic-alpaca/alpaca/index.unit.test.d.ts.map +1 -0
  27. package/lib/bridge/generic-alpaca/alpaca/index.unit.test.js +89 -0
  28. package/lib/bridge/generic-alpaca/alpaca/index.unit.test.js.map +1 -0
  29. package/lib/bridge/generic-alpaca/alpaca/network/network-alpaca.d.ts +2 -2
  30. package/lib/bridge/generic-alpaca/alpaca/network/network-alpaca.d.ts.map +1 -1
  31. package/lib/bridge/generic-alpaca/alpaca/network/network-alpaca.js +2 -2
  32. package/lib/bridge/generic-alpaca/alpaca/network/network-alpaca.js.map +1 -1
  33. package/lib/bridge/generic-alpaca/buildSubAccounts.d.ts +2 -3
  34. package/lib/bridge/generic-alpaca/buildSubAccounts.d.ts.map +1 -1
  35. package/lib/bridge/generic-alpaca/buildSubAccounts.js +4 -14
  36. package/lib/bridge/generic-alpaca/buildSubAccounts.js.map +1 -1
  37. package/lib/bridge/generic-alpaca/getAccountShape.d.ts.map +1 -1
  38. package/lib/bridge/generic-alpaca/getAccountShape.js +4 -4
  39. package/lib/bridge/generic-alpaca/getAccountShape.js.map +1 -1
  40. package/lib/bridge/generic-alpaca/getTransactionStatus.d.ts.map +1 -1
  41. package/lib/bridge/generic-alpaca/getTransactionStatus.js +0 -1
  42. package/lib/bridge/generic-alpaca/getTransactionStatus.js.map +1 -1
  43. package/lib/bridge/generic-alpaca/prepareTransaction.d.ts +14 -3
  44. package/lib/bridge/generic-alpaca/prepareTransaction.d.ts.map +1 -1
  45. package/lib/bridge/generic-alpaca/prepareTransaction.js +21 -5
  46. package/lib/bridge/generic-alpaca/prepareTransaction.js.map +1 -1
  47. package/lib/bridge/generic-alpaca/signOperation.js +1 -1
  48. package/lib/bridge/generic-alpaca/signOperation.js.map +1 -1
  49. package/lib/bridge/generic-alpaca/utils.d.ts.map +1 -1
  50. package/lib/bridge/generic-alpaca/utils.js +6 -5
  51. package/lib/bridge/generic-alpaca/utils.js.map +1 -1
  52. package/lib/bridge/generic-alpaca/utils.test.d.ts.map +1 -0
  53. package/lib/bridge/generic-alpaca/utils.test.js +123 -0
  54. package/lib/bridge/generic-alpaca/utils.test.js.map +1 -0
  55. package/lib/e2e/enum/DeviceLabels.d.ts +9 -6
  56. package/lib/e2e/enum/DeviceLabels.d.ts.map +1 -1
  57. package/lib/e2e/enum/DeviceLabels.js +8 -5
  58. package/lib/e2e/enum/DeviceLabels.js.map +1 -1
  59. package/lib/e2e/families/tezos.d.ts.map +1 -1
  60. package/lib/e2e/families/tezos.js +2 -0
  61. package/lib/e2e/families/tezos.js.map +1 -1
  62. package/lib/e2e/index.d.ts +7 -6
  63. package/lib/e2e/index.d.ts.map +1 -1
  64. package/lib/e2e/speculos.d.ts +2 -1
  65. package/lib/e2e/speculos.d.ts.map +1 -1
  66. package/lib/e2e/speculos.js +25 -17
  67. package/lib/e2e/speculos.js.map +1 -1
  68. package/lib/env.react.d.ts +1 -1
  69. package/lib/env.react.d.ts.map +1 -1
  70. package/lib/exchange/platform/transfer/completeExchange.d.ts.map +1 -1
  71. package/lib/exchange/platform/transfer/completeExchange.js +3 -5
  72. package/lib/exchange/platform/transfer/completeExchange.js.map +1 -1
  73. package/lib/exchange/swap/completeExchange.d.ts.map +1 -1
  74. package/lib/exchange/swap/completeExchange.js +5 -2
  75. package/lib/exchange/swap/completeExchange.js.map +1 -1
  76. package/lib/exchange/swap/initSwap.d.ts.map +1 -1
  77. package/lib/exchange/swap/initSwap.js +5 -2
  78. package/lib/exchange/swap/initSwap.js.map +1 -1
  79. package/lib/families/canton/config.d.ts.map +1 -1
  80. package/lib/families/canton/config.js +4 -0
  81. package/lib/families/canton/config.js.map +1 -1
  82. package/lib/families/solana/setup.d.ts.map +1 -1
  83. package/lib/families/solana/setup.js +9 -0
  84. package/lib/families/solana/setup.js.map +1 -1
  85. package/lib/featureFlags/defaultFeatures.d.ts.map +1 -1
  86. package/lib/featureFlags/defaultFeatures.js +1 -2
  87. package/lib/featureFlags/defaultFeatures.js.map +1 -1
  88. package/lib/featureFlags/useFeature.d.ts +1 -1
  89. package/lib/featureFlags/useFeature.d.ts.map +1 -1
  90. package/lib/modularDrawer/__mocks__/dada.mock.d.ts +3336 -0
  91. package/lib/modularDrawer/__mocks__/dada.mock.d.ts.map +1 -0
  92. package/lib/modularDrawer/__mocks__/dada.mock.js +3879 -0
  93. package/lib/modularDrawer/__mocks__/dada.mock.js.map +1 -0
  94. package/lib/modularDrawer/data/entities/interestRateSelectors.d.ts +16 -0
  95. package/lib/modularDrawer/data/entities/interestRateSelectors.d.ts.map +1 -0
  96. package/lib/modularDrawer/data/entities/interestRateSelectors.js +21 -0
  97. package/lib/modularDrawer/data/entities/interestRateSelectors.js.map +1 -0
  98. package/lib/modularDrawer/data/state-manager/api.d.ts +727 -37
  99. package/lib/modularDrawer/data/state-manager/api.d.ts.map +1 -1
  100. package/lib/modularDrawer/data/state-manager/api.js +38 -17
  101. package/lib/modularDrawer/data/state-manager/api.js.map +1 -1
  102. package/lib/modularDrawer/data/state-manager/types.d.ts +24 -0
  103. package/lib/modularDrawer/data/state-manager/types.d.ts.map +1 -0
  104. package/lib/modularDrawer/data/state-manager/types.js +13 -0
  105. package/lib/modularDrawer/data/state-manager/types.js.map +1 -0
  106. package/lib/modularDrawer/hooks/__test__/useAssetsData.test.js +134 -78
  107. package/lib/modularDrawer/hooks/__test__/useAssetsData.test.js.map +1 -1
  108. package/lib/modularDrawer/hooks/__test__/useModularDrawerConfiguration.test.d.ts +2 -0
  109. package/lib/modularDrawer/hooks/__test__/useModularDrawerConfiguration.test.d.ts.map +1 -0
  110. package/lib/modularDrawer/hooks/__test__/useModularDrawerConfiguration.test.js +206 -0
  111. package/lib/modularDrawer/hooks/__test__/useModularDrawerConfiguration.test.js.map +1 -0
  112. package/lib/modularDrawer/hooks/modules/useLeftApyModule.d.ts +3 -3
  113. package/lib/modularDrawer/hooks/modules/useLeftApyModule.d.ts.map +1 -1
  114. package/lib/modularDrawer/hooks/modules/useLeftApyModule.js +43 -10
  115. package/lib/modularDrawer/hooks/modules/useLeftApyModule.js.map +1 -1
  116. package/lib/modularDrawer/hooks/{modules/useAssetAccountCounts.d.ts → useAssetAccountCounts.d.ts} +1 -1
  117. package/lib/modularDrawer/hooks/useAssetAccountCounts.d.ts.map +1 -0
  118. package/lib/modularDrawer/hooks/{modules/useAssetAccountCounts.js → useAssetAccountCounts.js} +1 -1
  119. package/lib/modularDrawer/hooks/useAssetAccountCounts.js.map +1 -0
  120. package/lib/modularDrawer/hooks/useAssetsData.d.ts +10 -6
  121. package/lib/modularDrawer/hooks/useAssetsData.d.ts.map +1 -1
  122. package/lib/modularDrawer/hooks/useAssetsData.js +40 -17
  123. package/lib/modularDrawer/hooks/useAssetsData.js.map +1 -1
  124. package/lib/modularDrawer/hooks/useInterestRatesByCurrencies.d.ts +3 -0
  125. package/lib/modularDrawer/hooks/useInterestRatesByCurrencies.d.ts.map +1 -0
  126. package/lib/modularDrawer/hooks/useInterestRatesByCurrencies.js +23 -0
  127. package/lib/modularDrawer/hooks/useInterestRatesByCurrencies.js.map +1 -0
  128. package/lib/modularDrawer/hooks/useLeftAccounts.d.ts +13 -0
  129. package/lib/modularDrawer/hooks/useLeftAccounts.d.ts.map +1 -0
  130. package/lib/modularDrawer/hooks/useLeftAccounts.js +15 -0
  131. package/lib/modularDrawer/hooks/useLeftAccounts.js.map +1 -0
  132. package/lib/modularDrawer/hooks/useLeftAccountsApy.d.ts +4 -0
  133. package/lib/modularDrawer/hooks/useLeftAccountsApy.d.ts.map +1 -0
  134. package/lib/modularDrawer/hooks/useLeftAccountsApy.js +30 -0
  135. package/lib/modularDrawer/hooks/useLeftAccountsApy.js.map +1 -0
  136. package/lib/modularDrawer/hooks/useModularDrawerConfiguration.d.ts +13 -0
  137. package/lib/modularDrawer/hooks/useModularDrawerConfiguration.d.ts.map +1 -0
  138. package/lib/modularDrawer/hooks/useModularDrawerConfiguration.js +29 -0
  139. package/lib/modularDrawer/hooks/useModularDrawerConfiguration.js.map +1 -0
  140. package/lib/modularDrawer/hooks/useRightBalanceAsset.d.ts +57 -0
  141. package/lib/modularDrawer/hooks/useRightBalanceAsset.d.ts.map +1 -0
  142. package/lib/modularDrawer/hooks/useRightBalanceAsset.js +87 -0
  143. package/lib/modularDrawer/hooks/useRightBalanceAsset.js.map +1 -0
  144. package/lib/modularDrawer/hooks/useRightBalanceNetwork.d.ts +63 -0
  145. package/lib/modularDrawer/hooks/useRightBalanceNetwork.d.ts.map +1 -0
  146. package/lib/modularDrawer/hooks/useRightBalanceNetwork.js +66 -0
  147. package/lib/modularDrawer/hooks/useRightBalanceNetwork.js.map +1 -0
  148. package/lib/modularDrawer/modules/createAssetConfiguration.d.ts +4 -0
  149. package/lib/modularDrawer/modules/createAssetConfiguration.d.ts.map +1 -0
  150. package/lib/modularDrawer/modules/createAssetConfiguration.js +41 -0
  151. package/lib/modularDrawer/modules/createAssetConfiguration.js.map +1 -0
  152. package/lib/modularDrawer/modules/createNetworkConfiguration.d.ts +6 -0
  153. package/lib/modularDrawer/modules/createNetworkConfiguration.d.ts.map +1 -0
  154. package/lib/modularDrawer/modules/createNetworkConfiguration.js +54 -0
  155. package/lib/modularDrawer/modules/createNetworkConfiguration.js.map +1 -0
  156. package/lib/modularDrawer/utils/__tests__/getInterestRateForAsset.test.d.ts +2 -0
  157. package/lib/modularDrawer/utils/__tests__/getInterestRateForAsset.test.d.ts.map +1 -0
  158. package/lib/modularDrawer/utils/__tests__/getInterestRateForAsset.test.js +36 -0
  159. package/lib/modularDrawer/utils/__tests__/getInterestRateForAsset.test.js.map +1 -0
  160. package/lib/modularDrawer/utils/buildProviderCurrenciesMap.d.ts +9 -0
  161. package/lib/modularDrawer/utils/buildProviderCurrenciesMap.d.ts.map +1 -0
  162. package/lib/modularDrawer/utils/buildProviderCurrenciesMap.js +17 -0
  163. package/lib/modularDrawer/utils/buildProviderCurrenciesMap.js.map +1 -0
  164. package/lib/modularDrawer/utils/getInterestRateForAsset.d.ts +13 -0
  165. package/lib/modularDrawer/utils/getInterestRateForAsset.d.ts.map +1 -0
  166. package/lib/modularDrawer/utils/getInterestRateForAsset.js +20 -0
  167. package/lib/modularDrawer/utils/getInterestRateForAsset.js.map +1 -0
  168. package/lib/modularDrawer/utils/getLoadingStatus.d.ts +9 -0
  169. package/lib/modularDrawer/utils/getLoadingStatus.d.ts.map +1 -0
  170. package/lib/modularDrawer/utils/getLoadingStatus.js +18 -0
  171. package/lib/modularDrawer/utils/getLoadingStatus.js.map +1 -0
  172. package/lib/modularDrawer/utils/sortByBalance.d.ts +6 -0
  173. package/lib/modularDrawer/utils/sortByBalance.d.ts.map +1 -0
  174. package/lib/modularDrawer/utils/sortByBalance.js +32 -0
  175. package/lib/modularDrawer/utils/sortByBalance.js.map +1 -0
  176. package/lib/modularDrawer/utils/type.d.ts +90 -1
  177. package/lib/modularDrawer/utils/type.d.ts.map +1 -1
  178. package/lib/wallet-api/Exchange/server.js +2 -2
  179. package/lib/wallet-api/Exchange/server.js.map +1 -1
  180. package/lib/wallet-api/ModularDrawer/types.d.ts +6 -6
  181. package/lib/wallet-api/ModularDrawer/types.d.ts.map +1 -1
  182. package/lib/wallet-api/ModularDrawer/types.js +1 -1
  183. package/lib/wallet-api/ModularDrawer/types.js.map +1 -1
  184. package/lib/wallet-api/react.d.ts +2 -0
  185. package/lib/wallet-api/react.d.ts.map +1 -1
  186. package/lib/wallet-api/react.js +3 -1
  187. package/lib/wallet-api/react.js.map +1 -1
  188. package/lib-es/bridge/crypto-assets/cal-integration.d.ts +4 -0
  189. package/lib-es/bridge/crypto-assets/cal-integration.d.ts.map +1 -0
  190. package/lib-es/bridge/crypto-assets/cal-integration.js +21 -0
  191. package/lib-es/bridge/crypto-assets/cal-integration.js.map +1 -0
  192. package/lib-es/bridge/crypto-assets/cal-integration.test.d.ts +2 -0
  193. package/lib-es/bridge/crypto-assets/cal-integration.test.d.ts.map +1 -0
  194. package/lib-es/bridge/crypto-assets/cal-integration.test.js +43 -0
  195. package/lib-es/bridge/crypto-assets/cal-integration.test.js.map +1 -0
  196. package/lib-es/bridge/crypto-assets/cal-store.d.ts +14 -0
  197. package/lib-es/bridge/crypto-assets/cal-store.d.ts.map +1 -0
  198. package/lib-es/bridge/crypto-assets/cal-store.js +54 -0
  199. package/lib-es/bridge/crypto-assets/cal-store.js.map +1 -0
  200. package/lib-es/bridge/crypto-assets/cal-store.test.d.ts +2 -0
  201. package/lib-es/bridge/crypto-assets/cal-store.test.d.ts.map +1 -0
  202. package/lib-es/bridge/crypto-assets/cal-store.test.js +68 -0
  203. package/lib-es/bridge/crypto-assets/cal-store.test.js.map +1 -0
  204. package/lib-es/bridge/crypto-assets/index.d.ts.map +1 -1
  205. package/lib-es/bridge/crypto-assets/index.js +4 -0
  206. package/lib-es/bridge/crypto-assets/index.js.map +1 -1
  207. package/lib-es/bridge/crypto-assets/index.test.js +36 -0
  208. package/lib-es/bridge/crypto-assets/index.test.js.map +1 -1
  209. package/lib-es/bridge/generic-alpaca/alpaca/index.d.ts.map +1 -1
  210. package/lib-es/bridge/generic-alpaca/alpaca/index.js +6 -1
  211. package/lib-es/bridge/generic-alpaca/alpaca/index.js.map +1 -1
  212. package/lib-es/bridge/generic-alpaca/alpaca/index.unit.test.d.ts +2 -0
  213. package/lib-es/bridge/generic-alpaca/alpaca/index.unit.test.d.ts.map +1 -0
  214. package/lib-es/bridge/generic-alpaca/alpaca/index.unit.test.js +64 -0
  215. package/lib-es/bridge/generic-alpaca/alpaca/index.unit.test.js.map +1 -0
  216. package/lib-es/bridge/generic-alpaca/alpaca/network/network-alpaca.d.ts +2 -2
  217. package/lib-es/bridge/generic-alpaca/alpaca/network/network-alpaca.d.ts.map +1 -1
  218. package/lib-es/bridge/generic-alpaca/alpaca/network/network-alpaca.js +2 -2
  219. package/lib-es/bridge/generic-alpaca/alpaca/network/network-alpaca.js.map +1 -1
  220. package/lib-es/bridge/generic-alpaca/buildSubAccounts.d.ts +2 -3
  221. package/lib-es/bridge/generic-alpaca/buildSubAccounts.d.ts.map +1 -1
  222. package/lib-es/bridge/generic-alpaca/buildSubAccounts.js +4 -12
  223. package/lib-es/bridge/generic-alpaca/buildSubAccounts.js.map +1 -1
  224. package/lib-es/bridge/generic-alpaca/getAccountShape.d.ts.map +1 -1
  225. package/lib-es/bridge/generic-alpaca/getAccountShape.js +3 -3
  226. package/lib-es/bridge/generic-alpaca/getAccountShape.js.map +1 -1
  227. package/lib-es/bridge/generic-alpaca/getTransactionStatus.d.ts.map +1 -1
  228. package/lib-es/bridge/generic-alpaca/getTransactionStatus.js +0 -1
  229. package/lib-es/bridge/generic-alpaca/getTransactionStatus.js.map +1 -1
  230. package/lib-es/bridge/generic-alpaca/prepareTransaction.d.ts +14 -3
  231. package/lib-es/bridge/generic-alpaca/prepareTransaction.d.ts.map +1 -1
  232. package/lib-es/bridge/generic-alpaca/prepareTransaction.js +21 -5
  233. package/lib-es/bridge/generic-alpaca/prepareTransaction.js.map +1 -1
  234. package/lib-es/bridge/generic-alpaca/signOperation.js +1 -1
  235. package/lib-es/bridge/generic-alpaca/signOperation.js.map +1 -1
  236. package/lib-es/bridge/generic-alpaca/utils.d.ts.map +1 -1
  237. package/lib-es/bridge/generic-alpaca/utils.js +6 -5
  238. package/lib-es/bridge/generic-alpaca/utils.js.map +1 -1
  239. package/lib-es/bridge/generic-alpaca/utils.test.d.ts.map +1 -0
  240. package/lib-es/bridge/generic-alpaca/utils.test.js +118 -0
  241. package/lib-es/bridge/generic-alpaca/utils.test.js.map +1 -0
  242. package/lib-es/e2e/enum/DeviceLabels.d.ts +9 -6
  243. package/lib-es/e2e/enum/DeviceLabels.d.ts.map +1 -1
  244. package/lib-es/e2e/enum/DeviceLabels.js +8 -5
  245. package/lib-es/e2e/enum/DeviceLabels.js.map +1 -1
  246. package/lib-es/e2e/families/tezos.d.ts.map +1 -1
  247. package/lib-es/e2e/families/tezos.js +2 -0
  248. package/lib-es/e2e/families/tezos.js.map +1 -1
  249. package/lib-es/e2e/index.d.ts +7 -6
  250. package/lib-es/e2e/index.d.ts.map +1 -1
  251. package/lib-es/e2e/speculos.d.ts +2 -1
  252. package/lib-es/e2e/speculos.d.ts.map +1 -1
  253. package/lib-es/e2e/speculos.js +23 -16
  254. package/lib-es/e2e/speculos.js.map +1 -1
  255. package/lib-es/env.react.d.ts +1 -1
  256. package/lib-es/env.react.d.ts.map +1 -1
  257. package/lib-es/exchange/platform/transfer/completeExchange.d.ts.map +1 -1
  258. package/lib-es/exchange/platform/transfer/completeExchange.js +3 -2
  259. package/lib-es/exchange/platform/transfer/completeExchange.js.map +1 -1
  260. package/lib-es/exchange/swap/completeExchange.d.ts.map +1 -1
  261. package/lib-es/exchange/swap/completeExchange.js +5 -2
  262. package/lib-es/exchange/swap/completeExchange.js.map +1 -1
  263. package/lib-es/exchange/swap/initSwap.d.ts.map +1 -1
  264. package/lib-es/exchange/swap/initSwap.js +5 -2
  265. package/lib-es/exchange/swap/initSwap.js.map +1 -1
  266. package/lib-es/families/canton/config.d.ts.map +1 -1
  267. package/lib-es/families/canton/config.js +4 -0
  268. package/lib-es/families/canton/config.js.map +1 -1
  269. package/lib-es/families/solana/setup.d.ts.map +1 -1
  270. package/lib-es/families/solana/setup.js +9 -0
  271. package/lib-es/families/solana/setup.js.map +1 -1
  272. package/lib-es/featureFlags/defaultFeatures.d.ts.map +1 -1
  273. package/lib-es/featureFlags/defaultFeatures.js +1 -2
  274. package/lib-es/featureFlags/defaultFeatures.js.map +1 -1
  275. package/lib-es/featureFlags/useFeature.d.ts +1 -1
  276. package/lib-es/featureFlags/useFeature.d.ts.map +1 -1
  277. package/lib-es/modularDrawer/__mocks__/dada.mock.d.ts +3336 -0
  278. package/lib-es/modularDrawer/__mocks__/dada.mock.d.ts.map +1 -0
  279. package/lib-es/modularDrawer/__mocks__/dada.mock.js +3876 -0
  280. package/lib-es/modularDrawer/__mocks__/dada.mock.js.map +1 -0
  281. package/lib-es/modularDrawer/data/entities/interestRateSelectors.d.ts +16 -0
  282. package/lib-es/modularDrawer/data/entities/interestRateSelectors.d.ts.map +1 -0
  283. package/lib-es/modularDrawer/data/entities/interestRateSelectors.js +18 -0
  284. package/lib-es/modularDrawer/data/entities/interestRateSelectors.js.map +1 -0
  285. package/lib-es/modularDrawer/data/state-manager/api.d.ts +727 -37
  286. package/lib-es/modularDrawer/data/state-manager/api.d.ts.map +1 -1
  287. package/lib-es/modularDrawer/data/state-manager/api.js +35 -14
  288. package/lib-es/modularDrawer/data/state-manager/api.js.map +1 -1
  289. package/lib-es/modularDrawer/data/state-manager/types.d.ts +24 -0
  290. package/lib-es/modularDrawer/data/state-manager/types.d.ts.map +1 -0
  291. package/lib-es/modularDrawer/data/state-manager/types.js +10 -0
  292. package/lib-es/modularDrawer/data/state-manager/types.js.map +1 -0
  293. package/lib-es/modularDrawer/hooks/__test__/useAssetsData.test.js +135 -79
  294. package/lib-es/modularDrawer/hooks/__test__/useAssetsData.test.js.map +1 -1
  295. package/lib-es/modularDrawer/hooks/__test__/useModularDrawerConfiguration.test.d.ts +2 -0
  296. package/lib-es/modularDrawer/hooks/__test__/useModularDrawerConfiguration.test.d.ts.map +1 -0
  297. package/lib-es/modularDrawer/hooks/__test__/useModularDrawerConfiguration.test.js +204 -0
  298. package/lib-es/modularDrawer/hooks/__test__/useModularDrawerConfiguration.test.js.map +1 -0
  299. package/lib-es/modularDrawer/hooks/modules/useLeftApyModule.d.ts +3 -3
  300. package/lib-es/modularDrawer/hooks/modules/useLeftApyModule.d.ts.map +1 -1
  301. package/lib-es/modularDrawer/hooks/modules/useLeftApyModule.js +21 -8
  302. package/lib-es/modularDrawer/hooks/modules/useLeftApyModule.js.map +1 -1
  303. package/lib-es/modularDrawer/hooks/{modules/useAssetAccountCounts.d.ts → useAssetAccountCounts.d.ts} +1 -1
  304. package/lib-es/modularDrawer/hooks/useAssetAccountCounts.d.ts.map +1 -0
  305. package/lib-es/modularDrawer/hooks/{modules/useAssetAccountCounts.js → useAssetAccountCounts.js} +1 -1
  306. package/lib-es/modularDrawer/hooks/useAssetAccountCounts.js.map +1 -0
  307. package/lib-es/modularDrawer/hooks/useAssetsData.d.ts +10 -6
  308. package/lib-es/modularDrawer/hooks/useAssetsData.d.ts.map +1 -1
  309. package/lib-es/modularDrawer/hooks/useAssetsData.js +42 -19
  310. package/lib-es/modularDrawer/hooks/useAssetsData.js.map +1 -1
  311. package/lib-es/modularDrawer/hooks/useInterestRatesByCurrencies.d.ts +3 -0
  312. package/lib-es/modularDrawer/hooks/useInterestRatesByCurrencies.d.ts.map +1 -0
  313. package/lib-es/modularDrawer/hooks/useInterestRatesByCurrencies.js +19 -0
  314. package/lib-es/modularDrawer/hooks/useInterestRatesByCurrencies.js.map +1 -0
  315. package/lib-es/modularDrawer/hooks/useLeftAccounts.d.ts +13 -0
  316. package/lib-es/modularDrawer/hooks/useLeftAccounts.d.ts.map +1 -0
  317. package/lib-es/modularDrawer/hooks/useLeftAccounts.js +11 -0
  318. package/lib-es/modularDrawer/hooks/useLeftAccounts.js.map +1 -0
  319. package/lib-es/modularDrawer/hooks/useLeftAccountsApy.d.ts +4 -0
  320. package/lib-es/modularDrawer/hooks/useLeftAccountsApy.d.ts.map +1 -0
  321. package/lib-es/modularDrawer/hooks/useLeftAccountsApy.js +26 -0
  322. package/lib-es/modularDrawer/hooks/useLeftAccountsApy.js.map +1 -0
  323. package/lib-es/modularDrawer/hooks/useModularDrawerConfiguration.d.ts +13 -0
  324. package/lib-es/modularDrawer/hooks/useModularDrawerConfiguration.d.ts.map +1 -0
  325. package/lib-es/modularDrawer/hooks/useModularDrawerConfiguration.js +25 -0
  326. package/lib-es/modularDrawer/hooks/useModularDrawerConfiguration.js.map +1 -0
  327. package/lib-es/modularDrawer/hooks/useRightBalanceAsset.d.ts +57 -0
  328. package/lib-es/modularDrawer/hooks/useRightBalanceAsset.d.ts.map +1 -0
  329. package/lib-es/modularDrawer/hooks/useRightBalanceAsset.js +83 -0
  330. package/lib-es/modularDrawer/hooks/useRightBalanceAsset.js.map +1 -0
  331. package/lib-es/modularDrawer/hooks/useRightBalanceNetwork.d.ts +63 -0
  332. package/lib-es/modularDrawer/hooks/useRightBalanceNetwork.d.ts.map +1 -0
  333. package/lib-es/modularDrawer/hooks/useRightBalanceNetwork.js +62 -0
  334. package/lib-es/modularDrawer/hooks/useRightBalanceNetwork.js.map +1 -0
  335. package/lib-es/modularDrawer/modules/createAssetConfiguration.d.ts +4 -0
  336. package/lib-es/modularDrawer/modules/createAssetConfiguration.d.ts.map +1 -0
  337. package/lib-es/modularDrawer/modules/createAssetConfiguration.js +39 -0
  338. package/lib-es/modularDrawer/modules/createAssetConfiguration.js.map +1 -0
  339. package/lib-es/modularDrawer/modules/createNetworkConfiguration.d.ts +6 -0
  340. package/lib-es/modularDrawer/modules/createNetworkConfiguration.d.ts.map +1 -0
  341. package/lib-es/modularDrawer/modules/createNetworkConfiguration.js +48 -0
  342. package/lib-es/modularDrawer/modules/createNetworkConfiguration.js.map +1 -0
  343. package/lib-es/modularDrawer/utils/__tests__/getInterestRateForAsset.test.d.ts +2 -0
  344. package/lib-es/modularDrawer/utils/__tests__/getInterestRateForAsset.test.d.ts.map +1 -0
  345. package/lib-es/modularDrawer/utils/__tests__/getInterestRateForAsset.test.js +34 -0
  346. package/lib-es/modularDrawer/utils/__tests__/getInterestRateForAsset.test.js.map +1 -0
  347. package/lib-es/modularDrawer/utils/buildProviderCurrenciesMap.d.ts +9 -0
  348. package/lib-es/modularDrawer/utils/buildProviderCurrenciesMap.d.ts.map +1 -0
  349. package/lib-es/modularDrawer/utils/buildProviderCurrenciesMap.js +13 -0
  350. package/lib-es/modularDrawer/utils/buildProviderCurrenciesMap.js.map +1 -0
  351. package/lib-es/modularDrawer/utils/getInterestRateForAsset.d.ts +13 -0
  352. package/lib-es/modularDrawer/utils/getInterestRateForAsset.d.ts.map +1 -0
  353. package/lib-es/modularDrawer/utils/getInterestRateForAsset.js +16 -0
  354. package/lib-es/modularDrawer/utils/getInterestRateForAsset.js.map +1 -0
  355. package/lib-es/modularDrawer/utils/getLoadingStatus.d.ts +9 -0
  356. package/lib-es/modularDrawer/utils/getLoadingStatus.d.ts.map +1 -0
  357. package/lib-es/modularDrawer/utils/getLoadingStatus.js +14 -0
  358. package/lib-es/modularDrawer/utils/getLoadingStatus.js.map +1 -0
  359. package/lib-es/modularDrawer/utils/sortByBalance.d.ts +6 -0
  360. package/lib-es/modularDrawer/utils/sortByBalance.d.ts.map +1 -0
  361. package/lib-es/modularDrawer/utils/sortByBalance.js +25 -0
  362. package/lib-es/modularDrawer/utils/sortByBalance.js.map +1 -0
  363. package/lib-es/modularDrawer/utils/type.d.ts +90 -1
  364. package/lib-es/modularDrawer/utils/type.d.ts.map +1 -1
  365. package/lib-es/wallet-api/Exchange/server.js +2 -2
  366. package/lib-es/wallet-api/Exchange/server.js.map +1 -1
  367. package/lib-es/wallet-api/ModularDrawer/types.d.ts +6 -6
  368. package/lib-es/wallet-api/ModularDrawer/types.d.ts.map +1 -1
  369. package/lib-es/wallet-api/ModularDrawer/types.js +1 -1
  370. package/lib-es/wallet-api/ModularDrawer/types.js.map +1 -1
  371. package/lib-es/wallet-api/react.d.ts +2 -0
  372. package/lib-es/wallet-api/react.d.ts.map +1 -1
  373. package/lib-es/wallet-api/react.js +3 -1
  374. package/lib-es/wallet-api/react.js.map +1 -1
  375. package/package.json +51 -51
  376. package/src/bridge/crypto-assets/cal-integration.test.ts +53 -0
  377. package/src/bridge/crypto-assets/cal-integration.ts +23 -0
  378. package/src/bridge/crypto-assets/cal-store.test.ts +93 -0
  379. package/src/bridge/crypto-assets/cal-store.ts +63 -0
  380. package/src/bridge/crypto-assets/index.test.ts +47 -0
  381. package/src/bridge/crypto-assets/index.ts +5 -0
  382. package/src/bridge/generic-alpaca/alpaca/index.ts +14 -1
  383. package/src/bridge/generic-alpaca/alpaca/index.unit.test.ts +78 -0
  384. package/src/bridge/generic-alpaca/alpaca/network/network-alpaca.ts +5 -4
  385. package/src/bridge/generic-alpaca/buildSubAccounts.ts +5 -14
  386. package/src/bridge/generic-alpaca/getAccountShape.ts +3 -4
  387. package/src/bridge/generic-alpaca/getTransactionStatus.ts +0 -1
  388. package/src/bridge/generic-alpaca/prepareTransaction.ts +44 -17
  389. package/src/bridge/generic-alpaca/signOperation.ts +1 -1
  390. package/src/bridge/generic-alpaca/utils.test.ts +133 -0
  391. package/src/bridge/generic-alpaca/utils.ts +7 -5
  392. package/src/e2e/enum/DeviceLabels.ts +8 -5
  393. package/src/e2e/families/tezos.ts +2 -0
  394. package/src/e2e/speculos.ts +24 -17
  395. package/src/exchange/platform/transfer/completeExchange.ts +3 -2
  396. package/src/exchange/swap/completeExchange.ts +5 -2
  397. package/src/exchange/swap/initSwap.ts +5 -4
  398. package/src/families/canton/config.ts +5 -0
  399. package/src/families/hedera/__snapshots__/bridge.integration.test.ts.snap +27 -7
  400. package/src/families/solana/setup.ts +9 -0
  401. package/src/featureFlags/defaultFeatures.ts +1 -2
  402. package/src/modularDrawer/__mocks__/dada.mock.ts +3890 -0
  403. package/src/modularDrawer/data/entities/interestRateSelectors.ts +39 -0
  404. package/src/modularDrawer/data/state-manager/api.ts +42 -27
  405. package/src/modularDrawer/data/state-manager/types.ts +28 -0
  406. package/src/modularDrawer/hooks/__test__/useAssetsData.test.ts +141 -80
  407. package/src/modularDrawer/hooks/__test__/useModularDrawerConfiguration.test.ts +251 -0
  408. package/src/modularDrawer/hooks/modules/useLeftApyModule.tsx +27 -9
  409. package/src/modularDrawer/hooks/{modules/useAssetAccountCounts.tsx → useAssetAccountCounts.tsx} +2 -2
  410. package/src/modularDrawer/hooks/useAssetsData.ts +59 -22
  411. package/src/modularDrawer/hooks/useInterestRatesByCurrencies.ts +23 -0
  412. package/src/modularDrawer/hooks/useLeftAccounts.tsx +23 -0
  413. package/src/modularDrawer/hooks/useLeftAccountsApy.tsx +44 -0
  414. package/src/modularDrawer/hooks/useModularDrawerConfiguration.ts +33 -0
  415. package/src/modularDrawer/hooks/useRightBalanceAsset.tsx +140 -0
  416. package/src/modularDrawer/hooks/useRightBalanceNetwork.tsx +116 -0
  417. package/src/modularDrawer/modules/createAssetConfiguration.ts +62 -0
  418. package/src/modularDrawer/modules/createNetworkConfiguration.ts +87 -0
  419. package/src/modularDrawer/utils/__tests__/getInterestRateForAsset.test.ts +58 -0
  420. package/src/modularDrawer/utils/buildProviderCurrenciesMap.tsx +25 -0
  421. package/src/modularDrawer/utils/getInterestRateForAsset.ts +32 -0
  422. package/src/modularDrawer/utils/getLoadingStatus.ts +24 -0
  423. package/src/modularDrawer/utils/sortByBalance.tsx +32 -0
  424. package/src/modularDrawer/utils/type.ts +98 -0
  425. package/src/wallet-api/Exchange/server.ts +2 -2
  426. package/src/wallet-api/ModularDrawer/types.ts +1 -1
  427. package/src/wallet-api/react.ts +5 -1
  428. package/lib/bridge/generic-alpaca/tests/utils.test.d.ts.map +0 -1
  429. package/lib/bridge/generic-alpaca/tests/utils.test.js +0 -20
  430. package/lib/bridge/generic-alpaca/tests/utils.test.js.map +0 -1
  431. package/lib/modularDrawer/hooks/modules/useAssetAccountCounts.d.ts.map +0 -1
  432. package/lib/modularDrawer/hooks/modules/useAssetAccountCounts.js.map +0 -1
  433. package/lib/modularDrawer/types.d.ts +0 -2
  434. package/lib/modularDrawer/types.d.ts.map +0 -1
  435. package/lib/modularDrawer/types.js +0 -3
  436. package/lib/modularDrawer/types.js.map +0 -1
  437. package/lib-es/bridge/generic-alpaca/tests/utils.test.d.ts.map +0 -1
  438. package/lib-es/bridge/generic-alpaca/tests/utils.test.js +0 -18
  439. package/lib-es/bridge/generic-alpaca/tests/utils.test.js.map +0 -1
  440. package/lib-es/modularDrawer/hooks/modules/useAssetAccountCounts.d.ts.map +0 -1
  441. package/lib-es/modularDrawer/hooks/modules/useAssetAccountCounts.js.map +0 -1
  442. package/lib-es/modularDrawer/types.d.ts +0 -2
  443. package/lib-es/modularDrawer/types.d.ts.map +0 -1
  444. package/lib-es/modularDrawer/types.js +0 -2
  445. package/lib-es/modularDrawer/types.js.map +0 -1
  446. package/src/bridge/generic-alpaca/tests/utils.test.ts +0 -19
  447. package/src/modularDrawer/types.ts +0 -1
  448. /package/lib/bridge/generic-alpaca/{tests/utils.test.d.ts → utils.test.d.ts} +0 -0
  449. /package/lib-es/bridge/generic-alpaca/{tests/utils.test.d.ts → utils.test.d.ts} +0 -0
@@ -0,0 +1,63 @@
1
+ import type { CryptoAssetsStore } from "@ledgerhq/types-live";
2
+ import { TokenCurrency } from "@ledgerhq/types-cryptoassets";
3
+
4
+ // Coins with case-sensitive addresses (b58, ...)
5
+ const CASE_SENSITIVE_COINS = ["solana"];
6
+
7
+ export class CALStore implements CryptoAssetsStore {
8
+ private tokenCache = new Map<string, TokenCurrency>();
9
+ private addressCache = new Map<string, TokenCurrency>();
10
+ private tickerCache = new Map<string, TokenCurrency>();
11
+
12
+ addTokens(tokens: TokenCurrency[]) {
13
+ tokens.forEach(token => {
14
+ this.tokenCache.set(token.id, token);
15
+ if (token.contractAddress) {
16
+ const isCaseSensitive = CASE_SENSITIVE_COINS.includes(token.parentCurrency.id);
17
+ const normalizedAddress = isCaseSensitive
18
+ ? token.contractAddress
19
+ : token.contractAddress.toLowerCase();
20
+ this.addressCache.set(normalizedAddress, token);
21
+ }
22
+ this.tickerCache.set(token.ticker, token);
23
+ });
24
+ }
25
+
26
+ findTokenByAddress(address: string): TokenCurrency | undefined {
27
+ const exactMatch = this.addressCache.get(address);
28
+ if (exactMatch) return exactMatch;
29
+
30
+ const lowercaseMatch = this.addressCache.get(address.toLowerCase());
31
+ return lowercaseMatch;
32
+ }
33
+
34
+ getTokenById(id: string): TokenCurrency {
35
+ const token = this.tokenCache.get(id);
36
+ if (!token) {
37
+ throw new Error(`Token not found: ${id}`);
38
+ }
39
+ return token;
40
+ }
41
+
42
+ findTokenById(id: string): TokenCurrency | undefined {
43
+ return this.tokenCache.get(id);
44
+ }
45
+
46
+ findTokenByAddressInCurrency(address: string, currencyId: string): TokenCurrency | undefined {
47
+ const isCaseSensitive = CASE_SENSITIVE_COINS.includes(currencyId);
48
+
49
+ if (isCaseSensitive) {
50
+ const token = this.addressCache.get(address);
51
+ if (token && token.parentCurrency.id === currencyId) return token;
52
+ return undefined;
53
+ }
54
+
55
+ const token = this.addressCache.get(address.toLowerCase());
56
+ if (token && token.parentCurrency.id === currencyId) return token;
57
+ return undefined;
58
+ }
59
+
60
+ findTokenByTicker(ticker: string): TokenCurrency | undefined {
61
+ return this.tickerCache.get(ticker);
62
+ }
63
+ }
@@ -2,8 +2,22 @@ import { LiveConfig } from "@ledgerhq/live-config/LiveConfig";
2
2
  import { getCryptoAssetsStore, setCryptoAssetsStore } from ".";
3
3
  import * as legacy from "@ledgerhq/cryptoassets/tokens";
4
4
  import type { CryptoAssetsStore } from "@ledgerhq/types-live";
5
+ import * as calIntegration from "./cal-integration";
5
6
 
6
7
  describe("Testing CryptoAssetStore", () => {
8
+ let isCALIntegrationEnabledSpy: jest.SpyInstance;
9
+ let getCALStoreSpy: jest.SpyInstance;
10
+
11
+ beforeEach(() => {
12
+ isCALIntegrationEnabledSpy = jest
13
+ .spyOn(calIntegration, "isCALIntegrationEnabled")
14
+ .mockReturnValue(false);
15
+ getCALStoreSpy = jest.spyOn(calIntegration, "getCALStore");
16
+ });
17
+
18
+ afterEach(() => {
19
+ jest.restoreAllMocks();
20
+ });
7
21
  it("should return the default methods from cryptoassets libs when feature flag does not exists", () => {
8
22
  LiveConfig.setConfig({
9
23
  some_other_feature: {
@@ -68,4 +82,37 @@ describe("Testing CryptoAssetStore", () => {
68
82
  const store = getCryptoAssetsStore();
69
83
  expect(store).toBe(newStore);
70
84
  });
85
+
86
+ it("should return CAL store when CAL integration is enabled", () => {
87
+ isCALIntegrationEnabledSpy.mockReturnValue(true);
88
+
89
+ const mockCALStore = {} as unknown as CryptoAssetsStore;
90
+ getCALStoreSpy.mockReturnValue(mockCALStore);
91
+
92
+ const store = getCryptoAssetsStore();
93
+
94
+ expect(isCALIntegrationEnabledSpy).toHaveBeenCalled();
95
+ expect(getCALStoreSpy).toHaveBeenCalled();
96
+ expect(store).toBe(mockCALStore);
97
+ });
98
+
99
+ it("should prioritize CAL integration over feature flags", () => {
100
+ isCALIntegrationEnabledSpy.mockReturnValue(true);
101
+
102
+ LiveConfig.setConfig({
103
+ feature_cal_lazy_loading: {
104
+ type: "boolean",
105
+ default: true,
106
+ },
107
+ });
108
+
109
+ const mockCALStore = {} as unknown as CryptoAssetsStore;
110
+ getCALStoreSpy.mockReturnValue(mockCALStore);
111
+
112
+ const store = getCryptoAssetsStore();
113
+
114
+ expect(store).toBe(mockCALStore);
115
+ expect(isCALIntegrationEnabledSpy).toHaveBeenCalled();
116
+ expect(getCALStoreSpy).toHaveBeenCalled();
117
+ });
71
118
  });
@@ -1,6 +1,7 @@
1
1
  import { LiveConfig } from "@ledgerhq/live-config/LiveConfig";
2
2
  import * as legacy from "@ledgerhq/cryptoassets/tokens";
3
3
  import type { CryptoAssetsStore } from "@ledgerhq/types-live";
4
+ import { isCALIntegrationEnabled, getCALStore } from "./cal-integration";
4
5
 
5
6
  const legacyStore: CryptoAssetsStore = {
6
7
  findTokenByAddress: legacy.findTokenByAddress,
@@ -17,6 +18,10 @@ export function setCryptoAssetsStore(store: CryptoAssetsStore) {
17
18
  }
18
19
 
19
20
  export function getCryptoAssetsStore(): CryptoAssetsStore {
21
+ if (isCALIntegrationEnabled()) {
22
+ return getCALStore();
23
+ }
24
+
20
25
  const featureEnabled =
21
26
  LiveConfig.isConfigSet() && LiveConfig.getValueByKey("feature_cal_lazy_loading");
22
27
  if (!featureEnabled) {
@@ -1,16 +1,19 @@
1
1
  import { createApi as createXrpApi } from "@ledgerhq/coin-xrp/api/index";
2
2
  import { createApi as createStellarApi } from "@ledgerhq/coin-stellar/api/index";
3
+ import { createApi as createCantonApi } from "@ledgerhq/coin-canton/api/index";
4
+ import { createApi as createTronApi } from "@ledgerhq/coin-tron/api/index";
3
5
  import { getCurrencyConfiguration } from "../../../config";
4
6
  import { getCryptoCurrencyById } from "@ledgerhq/cryptoassets/currencies";
5
7
  import { getNetworkAlpacaApi } from "./network/network-alpaca";
6
8
  import { Api } from "@ledgerhq/coin-framework/api/types";
7
9
  import { XrpCoinConfig } from "@ledgerhq/coin-xrp/config";
8
10
  import { StellarCoinConfig } from "@ledgerhq/coin-stellar/config";
11
+ import { CantonCoinConfig } from "@ledgerhq/coin-canton/config";
12
+ import { TronCoinConfig } from "@ledgerhq/coin-tron/config";
9
13
 
10
14
  export function getAlpacaApi(network, kind): Api<any> {
11
15
  if (kind === "local") {
12
16
  switch (network) {
13
- case "ripple":
14
17
  case "xrp":
15
18
  return createXrpApi(
16
19
  getCurrencyConfiguration<XrpCoinConfig>(getCryptoCurrencyById("ripple")),
@@ -19,6 +22,16 @@ export function getAlpacaApi(network, kind): Api<any> {
19
22
  return createStellarApi(
20
23
  getCurrencyConfiguration<StellarCoinConfig>(getCryptoCurrencyById("stellar")),
21
24
  ) as Api<any>;
25
+ case "canton":
26
+ return createCantonApi(
27
+ getCurrencyConfiguration<CantonCoinConfig>(
28
+ getCryptoCurrencyById("canton_network_devnet"),
29
+ ),
30
+ ) as Api<any>;
31
+ case "tron":
32
+ return createTronApi(
33
+ getCurrencyConfiguration<TronCoinConfig>(getCryptoCurrencyById("tron")),
34
+ ) as Api<any>;
22
35
  }
23
36
  }
24
37
  return getNetworkAlpacaApi(network) satisfies Partial<Api<any>> as Api<any>;
@@ -0,0 +1,78 @@
1
+ import { getAlpacaApi } from "./index";
2
+ import * as xrpModule from "@ledgerhq/coin-xrp/api/index";
3
+ import * as stellarModule from "@ledgerhq/coin-stellar/api/index";
4
+ import * as cantonModule from "@ledgerhq/coin-canton/api/index";
5
+ import * as tronModule from "@ledgerhq/coin-tron/api/index";
6
+ import * as config from "../../../config";
7
+ import * as networkApi from "./network/network-alpaca";
8
+ import * as cryptoAssets from "@ledgerhq/cryptoassets/currencies";
9
+
10
+ const mockApiInstance = { mock: "api" };
11
+
12
+ jest.mock("@ledgerhq/cryptoassets/currencies", () => ({
13
+ getCryptoCurrencyById: jest.fn(),
14
+ }));
15
+
16
+ jest.mock("../../../config", () => ({
17
+ getCurrencyConfiguration: jest.fn(),
18
+ }));
19
+
20
+ jest.mock("@ledgerhq/coin-xrp/api/index", () => ({
21
+ createApi: jest.fn(),
22
+ }));
23
+
24
+ jest.mock("@ledgerhq/coin-stellar/api/index", () => ({
25
+ createApi: jest.fn(),
26
+ }));
27
+
28
+ jest.mock("@ledgerhq/coin-canton/api/index", () => ({
29
+ createApi: jest.fn(),
30
+ }));
31
+
32
+ jest.mock("@ledgerhq/coin-tron/api/index", () => ({
33
+ createApi: jest.fn(),
34
+ }));
35
+
36
+ jest.mock("./network/network-alpaca", () => ({
37
+ getNetworkAlpacaApi: jest.fn(),
38
+ }));
39
+
40
+ describe("getAlpacaApi", () => {
41
+ const mockCurrency = { id: "mock-currency" };
42
+
43
+ beforeEach(() => {
44
+ jest.clearAllMocks();
45
+
46
+ // Common mocks
47
+ (cryptoAssets.getCryptoCurrencyById as jest.Mock).mockReturnValue(mockCurrency);
48
+ (config.getCurrencyConfiguration as jest.Mock).mockReturnValue({ config: true });
49
+
50
+ // API mocks
51
+ jest.spyOn(xrpModule, "createApi").mockReturnValue(mockApiInstance as any);
52
+ jest.spyOn(stellarModule, "createApi").mockReturnValue(mockApiInstance as any);
53
+ jest.spyOn(cantonModule, "createApi").mockReturnValue(mockApiInstance as any);
54
+ jest.spyOn(tronModule, "createApi").mockReturnValue(mockApiInstance as any);
55
+ jest.spyOn(networkApi, "getNetworkAlpacaApi").mockReturnValue(mockApiInstance as any);
56
+ });
57
+
58
+ const testCases = [
59
+ { network: "xrp", module: xrpModule, label: "XRP" },
60
+ { network: "stellar", module: stellarModule, label: "Stellar" },
61
+ { network: "tron", module: tronModule, label: "Tron" },
62
+ { network: "canton", module: cantonModule, label: "Canton" },
63
+ ];
64
+
65
+ testCases.forEach(({ network, module, label }) => {
66
+ it(`should return ${label} API for network "${network}" and kind "local"`, () => {
67
+ const result = getAlpacaApi(network, "local");
68
+ expect(result).toEqual(mockApiInstance);
69
+ expect(module.createApi).toHaveBeenCalledWith({ config: true });
70
+ });
71
+ });
72
+
73
+ it("should return network API for kind !== 'local'", () => {
74
+ const result = getAlpacaApi("xrp", "remote");
75
+ expect(networkApi.getNetworkAlpacaApi).toHaveBeenCalledWith("xrp");
76
+ expect(result).toEqual(mockApiInstance);
77
+ });
78
+ });
@@ -13,6 +13,7 @@ import type {
13
13
  Page,
14
14
  Stake,
15
15
  Reward,
16
+ CraftedTransaction,
16
17
  } from "@ledgerhq/coin-framework/api/index";
17
18
  import network from "@ledgerhq/live-network";
18
19
 
@@ -134,7 +135,7 @@ const buildGetSequence = (networkFamily: string) =>
134
135
  const buildListOperations = networkFamily =>
135
136
  async function listOperations(
136
137
  address: string,
137
- pagination: Pagination = { minHeight: 0 },
138
+ pagination: Pagination = { minHeight: 0, order: "asc" },
138
139
  ): Promise<[Operation<any>[], string]> {
139
140
  const { data } = await network<{ operations: Operation<any>[] }, unknown>({
140
141
  method: "GET",
@@ -160,8 +161,8 @@ const buildLastBlock = networkFamily =>
160
161
  };
161
162
 
162
163
  const buildCraftTransaction = networkFamily =>
163
- async function craftTransaction(intent: TransactionIntent<any>): Promise<string> {
164
- const { data } = await network<any, unknown>({
164
+ async function craftTransaction(intent: TransactionIntent<any>): Promise<CraftedTransaction> {
165
+ const { data } = await network<CraftedTransaction, unknown>({
165
166
  method: "POST",
166
167
  url: `${ALPACA_URL}/${networkFamily}/transaction/encode`,
167
168
  data: {
@@ -171,7 +172,7 @@ const buildCraftTransaction = networkFamily =>
171
172
  },
172
173
  },
173
174
  });
174
- return data.rawTransaction;
175
+ return data;
175
176
  };
176
177
 
177
178
  export const getNetworkAlpacaApi = (networkFamily: string) =>
@@ -1,11 +1,10 @@
1
1
  import BigNumber from "bignumber.js";
2
- import { emptyHistoryCache } from "@ledgerhq/coin-framework/account/index";
2
+ import { emptyHistoryCache, encodeTokenAccountId } from "@ledgerhq/coin-framework/account/index";
3
3
  import type { CryptoCurrency, TokenCurrency } from "@ledgerhq/types-cryptoassets";
4
4
  import type { Operation, SyncConfig, TokenAccount } from "@ledgerhq/types-live";
5
5
  import { encodeOperationId } from "@ledgerhq/coin-framework/operation";
6
6
  import { listTokensForCryptoCurrency } from "@ledgerhq/cryptoassets";
7
7
  import { AssetInfo, Balance } from "@ledgerhq/coin-framework/api/types";
8
- import { findTokenById } from "@ledgerhq/cryptoassets/tokens";
9
8
 
10
9
  export interface OperationCommon extends Operation {
11
10
  extra: Record<string, any>;
@@ -13,11 +12,6 @@ export interface OperationCommon extends Operation {
13
12
 
14
13
  export const getAssetIdFromTokenId = (tokenId: string): string => tokenId.split("/")[2];
15
14
 
16
- export const getAssetIdFromAsset = (asset: AssetInfo) =>
17
- asset.type !== "native" && "assetReference" in asset && "assetOwner" in asset
18
- ? `${asset.assetReference}:${asset.assetOwner}`
19
- : "";
20
-
21
15
  function buildTokenAccount({
22
16
  parentAccountId,
23
17
  assetBalance,
@@ -29,8 +23,7 @@ function buildTokenAccount({
29
23
  token: TokenCurrency;
30
24
  operations: OperationCommon[];
31
25
  }): TokenAccount {
32
- const assetId = getAssetIdFromTokenId(token.id);
33
- const id = `${parentAccountId}+${assetId}`;
26
+ const id = encodeTokenAccountId(parentAccountId, token);
34
27
  const balance = new BigNumber(assetBalance.value.toString() || "0");
35
28
 
36
29
  // TODO: recheck this logic
@@ -68,12 +61,14 @@ export function buildSubAccounts({
68
61
  assetsBalance,
69
62
  syncConfig,
70
63
  operations,
64
+ getTokenFromAsset,
71
65
  }: {
72
66
  currency: CryptoCurrency;
73
67
  accountId: string;
74
68
  assetsBalance: Balance[];
75
69
  syncConfig: SyncConfig;
76
70
  operations: OperationCommon[];
71
+ getTokenFromAsset?: (asset: AssetInfo) => TokenCurrency | undefined;
77
72
  }): TokenAccount[] | undefined {
78
73
  const { blacklistedTokenIds = [] } = syncConfig;
79
74
  const allTokens = listTokensForCryptoCurrency(currency);
@@ -85,7 +80,7 @@ export function buildSubAccounts({
85
80
  assetsBalance
86
81
  .filter(b => b.asset.type !== "native") // NOTE: this could be removed, keeping here while fixing things up
87
82
  .map(balance => {
88
- const token = findToken(currency, balance);
83
+ const token = getTokenFromAsset && getTokenFromAsset(balance.asset);
89
84
  // NOTE: for future tokens, will need to check over currencyName/standard(erc20,trc10,trc20, etc)/id
90
85
  if (token && !blacklistedTokenIds.includes(token.id)) {
91
86
  tokenAccounts.push(
@@ -104,7 +99,3 @@ export function buildSubAccounts({
104
99
  });
105
100
  return tokenAccounts;
106
101
  }
107
-
108
- export function findToken(currency: CryptoCurrency, balance: Balance): TokenCurrency | undefined {
109
- return findTokenById(`${currency.family}/asset/${getAssetIdFromAsset(balance.asset)}`);
110
- }
@@ -4,7 +4,6 @@ import BigNumber from "bignumber.js";
4
4
  import { getAlpacaApi } from "./alpaca";
5
5
  import { adaptCoreOperationToLiveOperation, extractBalance } from "./utils";
6
6
  import { inferSubOperations } from "@ledgerhq/coin-framework/serialization";
7
- import { findToken } from "./buildSubAccounts";
8
7
  import { buildSubAccounts, OperationCommon } from "./buildSubAccounts";
9
8
 
10
9
  export function genericGetAccountShape(network: string, kind: string): GetAccountShape {
@@ -33,8 +32,7 @@ export function genericGetAccountShape(network: string, kind: string): GetAccoun
33
32
 
34
33
  const assetsBalance = balanceRes
35
34
  .filter(b => b.asset.type !== "native")
36
- .filter(b => findToken(currency, b));
37
-
35
+ .filter(b => alpacaApi.getTokenFromAsset && alpacaApi.getTokenFromAsset(b.asset));
38
36
  const nativeBalance = BigInt(nativeAsset?.value ?? "0");
39
37
 
40
38
  const spendableBalance = BigInt(nativeBalance - BigInt(nativeAsset?.locked ?? "0"));
@@ -43,7 +41,7 @@ export function genericGetAccountShape(network: string, kind: string): GetAccoun
43
41
  const lastPagingToken = oldOps[0]?.extra?.pagingToken || "";
44
42
 
45
43
  const blockHeight = oldOps.length ? (oldOps[0].blockHeight ?? 0) + 1 : 0;
46
- const paginationParams: any = { minHeight: blockHeight };
44
+ const paginationParams: any = { minHeight: blockHeight, order: "asc" };
47
45
  if (lastPagingToken) {
48
46
  paginationParams.lastPagingToken = lastPagingToken;
49
47
  }
@@ -72,6 +70,7 @@ export function genericGetAccountShape(network: string, kind: string): GetAccoun
72
70
  assetsBalance,
73
71
  syncConfig,
74
72
  operations: assetOperations,
73
+ getTokenFromAsset: alpacaApi.getTokenFromAsset,
75
74
  }) || [];
76
75
 
77
76
  const operationsWithSubs = mergedOps.map(op => {
@@ -3,7 +3,6 @@ import { AccountAwaitingSendPendingOperations } from "@ledgerhq/errors";
3
3
  import BigNumber from "bignumber.js";
4
4
  import { getAlpacaApi } from "./alpaca";
5
5
  import { transactionToIntent } from "./utils";
6
- // import { FeeEstimation } from "@ledgerhq/coin-framework/api/types";
7
6
 
8
7
  // => alpaca validateIntent
9
8
  export function genericGetTransactionStatus(
@@ -2,27 +2,41 @@ import { Account, AccountBridge, TransactionCommon } from "@ledgerhq/types-live"
2
2
  import { getAlpacaApi } from "./alpaca";
3
3
  import { transactionToIntent } from "./utils";
4
4
  import BigNumber from "bignumber.js";
5
- import { FeeEstimation } from "@ledgerhq/coin-framework/api/types";
5
+ import { AssetInfo, FeeEstimation } from "@ledgerhq/coin-framework/api/types";
6
+ import { decodeTokenAccountId } from "@ledgerhq/coin-framework/account/index";
7
+ import { TokenCurrency } from "@ledgerhq/types-cryptoassets";
6
8
 
7
9
  function bnEq(a: BigNumber | null | undefined, b: BigNumber | null | undefined): boolean {
8
10
  return !a && !b ? true : !a || !b ? false : a.eq(b);
9
11
  }
10
12
 
13
+ type TransactionParam = TransactionCommon & {
14
+ fees: BigNumber | null | undefined;
15
+ customFees?: FeeEstimation;
16
+ assetReference?: string;
17
+ assetOwner?: string;
18
+ subAccountId?: string;
19
+ };
20
+
21
+ function assetInfosFallback(transaction: TransactionParam): {
22
+ assetReference: string;
23
+ assetOwner: string;
24
+ } {
25
+ return {
26
+ assetReference: transaction.assetReference ?? "",
27
+ assetOwner: transaction.assetOwner ?? "",
28
+ };
29
+ }
30
+
11
31
  export function genericPrepareTransaction(
12
32
  network: string,
13
33
  kind,
14
34
  ): AccountBridge<TransactionCommon, Account, any, any>["prepareTransaction"] {
15
- return async (
16
- account,
17
- transaction: TransactionCommon & {
18
- fees: BigNumber | null | undefined;
19
- customFees?: FeeEstimation;
20
- assetReference?: string;
21
- assetOwner?: string;
22
- subAccountId?: string;
23
- },
24
- ) => {
25
- const [assetReference, assetOwner] = getAssetInfos(transaction);
35
+ return async (account, transaction: TransactionParam) => {
36
+ const { getAssetFromToken } = getAlpacaApi(network, kind);
37
+ const { assetReference, assetOwner } = getAssetFromToken
38
+ ? getAssetInfos(transaction, account.freshAddress, getAssetFromToken)
39
+ : assetInfosFallback(transaction);
26
40
 
27
41
  let fees = transaction.customFees?.parameters?.fees || null;
28
42
  if (fees === null) {
@@ -54,11 +68,24 @@ export function genericPrepareTransaction(
54
68
  }
55
69
 
56
70
  export function getAssetInfos(
57
- tr: TransactionCommon & { assetReference?: string; assetOwner?: string },
58
- ): string[] {
71
+ tr: TransactionParam,
72
+ owner: string,
73
+ getAssetFromToken: (token: TokenCurrency, owner: string) => AssetInfo,
74
+ ): {
75
+ assetReference: string;
76
+ assetOwner: string;
77
+ } {
59
78
  if (tr.subAccountId) {
60
- const assetString = tr.subAccountId.split("+")[1];
61
- return assetString.split(":");
79
+ const { token } = decodeTokenAccountId(tr.subAccountId);
80
+
81
+ if (!token) return assetInfosFallback(tr);
82
+
83
+ const asset = getAssetFromToken(token, owner);
84
+
85
+ return {
86
+ assetOwner: ("assetOwner" in asset && asset.assetOwner) || "",
87
+ assetReference: ("assetReference" in asset && asset.assetReference) || "",
88
+ };
62
89
  }
63
- return [tr.assetReference || "", tr.assetOwner || ""];
90
+ return assetInfosFallback(tr);
64
91
  }
@@ -123,7 +123,7 @@ export const genericSignOperation =
123
123
  transactionIntent.sequence = sequenceNumber;
124
124
 
125
125
  /* Craft unsigned blob via Alpaca */
126
- const unsigned: string = await getAlpacaApi(network, kind).craftTransaction(
126
+ const { transaction: unsigned } = await getAlpacaApi(network, kind).craftTransaction(
127
127
  transactionIntent,
128
128
  { value: fees },
129
129
  );
@@ -0,0 +1,133 @@
1
+ import { adaptCoreOperationToLiveOperation, extractBalance } from "./utils";
2
+ import BigNumber from "bignumber.js";
3
+ import { Operation as CoreOperation } from "@ledgerhq/coin-framework/api/types";
4
+
5
+ describe("Alpaca utils", () => {
6
+ describe("extractBalance", () => {
7
+ it("extracts an existing balance", () => {
8
+ expect(extractBalance([{ value: 4n, asset: { type: "type1" } }], "type1")).toEqual({
9
+ value: 4n,
10
+ asset: { type: "type1" },
11
+ });
12
+ });
13
+
14
+ it("generates an empty balance for a missing type", () => {
15
+ expect(extractBalance([{ value: 4n, asset: { type: "type1" } }], "type2")).toEqual({
16
+ value: 0n,
17
+ asset: { type: "type2" },
18
+ });
19
+ });
20
+ });
21
+
22
+ jest.mock("@ledgerhq/coin-framework/operation", () => ({
23
+ encodeOperationId: jest.fn((accountId, txHash, opType) => `${accountId}-${txHash}-${opType}`),
24
+ }));
25
+
26
+ describe("adaptCoreOperationToLiveOperation", () => {
27
+ const accountId = "acc_123";
28
+ const baseOp: CoreOperation = {
29
+ id: "op_123",
30
+ asset: { type: "native" },
31
+ type: "OUT",
32
+ value: BigInt(100),
33
+ tx: {
34
+ hash: "txhash123",
35
+ fees: BigInt(10),
36
+ block: {
37
+ hash: "blockhash123",
38
+ height: 123456,
39
+ },
40
+ date: new Date("2025-08-29T12:00:00Z"),
41
+ },
42
+ senders: ["sender1"],
43
+ recipients: ["recipient1"],
44
+ };
45
+
46
+ it("does not include fees in non native asset value", () => {
47
+ expect(
48
+ adaptCoreOperationToLiveOperation("account", {
49
+ id: "operation",
50
+ asset: { type: "token", assetOwner: "owner", assetReference: "reference" },
51
+ type: "OUT",
52
+ value: BigInt(100),
53
+ tx: {
54
+ hash: "hash",
55
+ fees: BigInt(10),
56
+ block: {
57
+ hash: "block_hash",
58
+ height: 123456,
59
+ },
60
+ date: new Date("2025-08-29T12:00:00Z"),
61
+ },
62
+ senders: ["sender"],
63
+ recipients: ["recipient"],
64
+ }),
65
+ ).toEqual({
66
+ id: "account-hash-OUT",
67
+ hash: "hash",
68
+ accountId: "account",
69
+ type: "OUT",
70
+ value: new BigNumber(100), // value only
71
+ fee: new BigNumber(10),
72
+ extra: {
73
+ assetOwner: "owner",
74
+ assetReference: "reference",
75
+ },
76
+ blockHash: "block_hash",
77
+ blockHeight: 123456,
78
+ senders: ["sender"],
79
+ recipients: ["recipient"],
80
+ date: new Date("2025-08-29T12:00:00Z"),
81
+ transactionSequenceNumber: undefined,
82
+ hasFailed: false,
83
+ });
84
+ });
85
+
86
+ it("adapts a basic OUT operation", () => {
87
+ const result = adaptCoreOperationToLiveOperation(accountId, baseOp);
88
+
89
+ expect(result).toEqual({
90
+ id: "acc_123-txhash123-OUT",
91
+ hash: "txhash123",
92
+ accountId,
93
+ type: "OUT",
94
+ value: new BigNumber(110), // value + fee
95
+ fee: new BigNumber(10),
96
+ blockHash: "blockhash123",
97
+ blockHeight: 123456,
98
+ senders: ["sender1"],
99
+ recipients: ["recipient1"],
100
+ date: new Date("2025-08-29T12:00:00Z"),
101
+ transactionSequenceNumber: undefined,
102
+ hasFailed: false,
103
+ extra: {},
104
+ });
105
+ });
106
+
107
+ it("handles FEES operation where value = value + fees", () => {
108
+ const op = {
109
+ ...baseOp,
110
+ type: "FEES",
111
+ value: BigInt(5),
112
+ tx: { ...baseOp.tx, fees: BigInt(2) },
113
+ };
114
+
115
+ const result = adaptCoreOperationToLiveOperation(accountId, op);
116
+
117
+ expect(result.value.toString()).toEqual("7");
118
+ });
119
+
120
+ it("handles non-FEES/OUT operation where value = value only", () => {
121
+ const op = {
122
+ ...baseOp,
123
+ type: "IN",
124
+ value: BigInt(50),
125
+ tx: { ...baseOp.tx, fees: BigInt(2) },
126
+ };
127
+
128
+ const result = adaptCoreOperationToLiveOperation(accountId, op);
129
+
130
+ expect(result.value.toString()).toEqual("50");
131
+ });
132
+ });
133
+ });
@@ -44,15 +44,17 @@ export function adaptCoreOperationToLiveOperation(accountId: string, op: CoreOpe
44
44
  if (op.details?.memo) {
45
45
  extra.memo = op.details.memo as string;
46
46
  }
47
+ const bnFees = new BigNumber(op.tx.fees.toString());
47
48
  const res = {
48
- id: extra.ledgerOpType
49
- ? encodeOperationId(accountId, op.tx.hash, extra.ledgerOpType)
50
- : encodeOperationId(accountId, op.tx.hash, op.type),
49
+ id: encodeOperationId(accountId, op.tx.hash, op.type),
51
50
  hash: op.tx.hash,
52
51
  accountId,
53
52
  type: opType,
54
- value: new BigNumber(op.value.toString()),
55
- fee: new BigNumber(op.tx.fees.toString()),
53
+ value:
54
+ op.asset.type === "native" && ["OUT", "FEES"].includes(opType)
55
+ ? new BigNumber(op.value.toString()).plus(bnFees)
56
+ : new BigNumber(op.value.toString()),
57
+ fee: bnFees,
56
58
  blockHash: op.tx.block.hash,
57
59
  blockHeight: op.tx.block.height,
58
60
  senders: op.senders,