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

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 +56 -52
  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
@@ -1,4 +1,9 @@
1
- import type { Operation, TransactionCommon } from "@ledgerhq/types-live";
1
+ import type {
2
+ Operation,
3
+ OperationRaw,
4
+ TransactionCommon,
5
+ TransactionCommonRaw,
6
+ } from "@ledgerhq/types-live";
2
7
  import BigNumber from "bignumber.js";
3
8
  import type { Unit } from "@ledgerhq/types-cryptoassets";
4
9
 
@@ -6,6 +11,34 @@ type NetworkInfo = {
6
11
  fees: BigNumber;
7
12
  };
8
13
 
14
+ type NetworkInfoRaw = {
15
+ fees: string;
16
+ };
17
+
18
+ type Strategy = "slow" | "medium" | "fast";
19
+
20
+ export type FeeData = {
21
+ maxFeePerGas: BigNumber | null;
22
+ maxPriorityFeePerGas: BigNumber | null;
23
+ gasPrice: BigNumber | null;
24
+ nextBaseFee: BigNumber | null;
25
+ };
26
+
27
+ export type FeeDataRaw = {
28
+ maxFeePerGas: string | null;
29
+ maxPriorityFeePerGas: string | null;
30
+ gasPrice: string | null;
31
+ nextBaseFee: string | null;
32
+ };
33
+
34
+ export type GasOptions = {
35
+ [key in Strategy]: FeeData;
36
+ };
37
+
38
+ export type GasOptionsRaw = {
39
+ [key in Strategy]: FeeDataRaw;
40
+ };
41
+
9
42
  export type GenericTransaction = TransactionCommon & {
10
43
  family: string;
11
44
  fees?: BigNumber | null;
@@ -14,6 +47,7 @@ export type GenericTransaction = TransactionCommon & {
14
47
  parameters: { fees?: BigNumber | null };
15
48
  };
16
49
  tag?: number | null | undefined;
50
+ nonce?: BigNumber | null | undefined;
17
51
  feeCustomUnit?: Unit | null | undefined;
18
52
  memoType?: string | null;
19
53
  memoValue?: string | null;
@@ -27,12 +61,56 @@ export type GenericTransaction = TransactionCommon & {
27
61
  | "stake"
28
62
  | "undelegate"
29
63
  | "unstake";
30
- type?: number;
64
+ type?: number | null;
31
65
  assetReference?: string;
32
66
  assetOwner?: string;
33
67
  networkInfo?: NetworkInfo | null;
68
+ chainId?: number | null;
69
+ gasLimit?: BigNumber | null;
70
+ gasPrice?: BigNumber | null;
71
+ maxFeePerGas?: BigNumber | null;
72
+ maxPriorityFeePerGas?: BigNumber | null;
73
+ gasOptions?: GasOptions;
74
+ };
75
+
76
+ export type GenericTransactionRaw = TransactionCommonRaw & {
77
+ family: string;
78
+ fees?: string | null;
79
+ storageLimit?: string | null;
80
+ customFees?: {
81
+ parameters: { fees?: string | null };
82
+ };
83
+ tag?: number | null | undefined;
84
+ nonce?: string | null | undefined;
85
+ feeCustomUnit?: Unit | null | undefined;
86
+ memoType?: string | null;
87
+ memoValue?: string | null;
88
+ data?: string;
89
+ mode?:
90
+ | "send"
91
+ | "changeTrust"
92
+ | "send-legacy"
93
+ | "send-eip1559"
94
+ | "delegate"
95
+ | "stake"
96
+ | "undelegate"
97
+ | "unstake";
98
+ type?: number | null;
99
+ assetReference?: string | null;
100
+ assetOwner?: string | null;
101
+ networkInfo?: NetworkInfoRaw | null;
102
+ chainId?: number | null;
103
+ gasLimit?: string | null;
104
+ gasPrice?: string | null;
105
+ maxFeePerGas?: string | null;
106
+ maxPriorityFeePerGas?: string | null;
107
+ gasOptions?: GasOptionsRaw;
34
108
  };
35
109
 
36
110
  export interface OperationCommon extends Operation {
37
111
  extra: Record<string, any>;
38
112
  }
113
+
114
+ export interface OperationCommonRaw extends OperationRaw {
115
+ extra: Record<string, any>;
116
+ }
@@ -22,6 +22,7 @@ describe("Alpaca utils", () => {
22
22
  parentType: "OPT_IN",
23
23
  subType: undefined,
24
24
  parentValue: new BigNumber(50),
25
+ parentRecipient: "recipient-address",
25
26
  },
26
27
  ],
27
28
  [
@@ -32,6 +33,7 @@ describe("Alpaca utils", () => {
32
33
  parentType: "DELEGATE",
33
34
  subType: undefined,
34
35
  parentValue: new BigNumber(50),
36
+ parentRecipient: "recipient-address",
35
37
  },
36
38
  ],
37
39
  [
@@ -42,6 +44,7 @@ describe("Alpaca utils", () => {
42
44
  parentType: "DELEGATE",
43
45
  subType: undefined,
44
46
  parentValue: new BigNumber(50),
47
+ parentRecipient: "recipient-address",
45
48
  },
46
49
  ],
47
50
  [
@@ -52,6 +55,7 @@ describe("Alpaca utils", () => {
52
55
  parentType: "UNDELEGATE",
53
56
  subType: undefined,
54
57
  parentValue: new BigNumber(50),
58
+ parentRecipient: "recipient-address",
55
59
  },
56
60
  ],
57
61
  [
@@ -62,6 +66,7 @@ describe("Alpaca utils", () => {
62
66
  parentType: "UNDELEGATE",
63
67
  subType: undefined,
64
68
  parentValue: new BigNumber(50),
69
+ parentRecipient: "recipient-address",
65
70
  },
66
71
  ],
67
72
  [
@@ -72,6 +77,7 @@ describe("Alpaca utils", () => {
72
77
  parentType: "OUT",
73
78
  subType: undefined,
74
79
  parentValue: new BigNumber(50),
80
+ parentRecipient: "recipient-address",
75
81
  },
76
82
  ],
77
83
  [
@@ -82,6 +88,7 @@ describe("Alpaca utils", () => {
82
88
  parentType: "FEES",
83
89
  subType: "OPT_IN",
84
90
  parentValue: new BigNumber(12),
91
+ parentRecipient: "contract-address",
85
92
  },
86
93
  ],
87
94
  [
@@ -92,6 +99,7 @@ describe("Alpaca utils", () => {
92
99
  parentType: "FEES",
93
100
  subType: "DELEGATE",
94
101
  parentValue: new BigNumber(12),
102
+ parentRecipient: "contract-address",
95
103
  },
96
104
  ],
97
105
  [
@@ -102,6 +110,7 @@ describe("Alpaca utils", () => {
102
110
  parentType: "FEES",
103
111
  subType: "DELEGATE",
104
112
  parentValue: new BigNumber(12),
113
+ parentRecipient: "contract-address",
105
114
  },
106
115
  ],
107
116
  [
@@ -112,6 +121,7 @@ describe("Alpaca utils", () => {
112
121
  parentType: "FEES",
113
122
  subType: "UNDELEGATE",
114
123
  parentValue: new BigNumber(12),
124
+ parentRecipient: "contract-address",
115
125
  },
116
126
  ],
117
127
  [
@@ -122,26 +132,38 @@ describe("Alpaca utils", () => {
122
132
  parentType: "FEES",
123
133
  subType: "UNDELEGATE",
124
134
  parentValue: new BigNumber(12),
135
+ parentRecipient: "contract-address",
125
136
  },
126
137
  ],
127
138
  [
128
139
  "token",
129
140
  "send",
130
141
  { subAccountId: "sub-account-id" },
131
- { parentType: "FEES", subType: "OUT", parentValue: new BigNumber(12) },
142
+ {
143
+ parentType: "FEES",
144
+ subType: "OUT",
145
+ parentValue: new BigNumber(12),
146
+ parentRecipient: "contract-address",
147
+ },
132
148
  ],
133
149
  ])("builds an optimistic %s operation with %s mode ", (_s, mode, params, expected) => {
134
150
  const operation = buildOptimisticOperation(
135
151
  {
136
152
  id: "parent-account-id",
137
153
  freshAddress: "account-address",
138
- subAccounts: [{ id: "sub-account-id" }],
154
+ subAccounts: [{ id: "sub-account-id", token: { contractAddress: "contract-address" } }],
139
155
  } as Account,
140
156
  {
141
157
  mode,
142
158
  amount: new BigNumber(50),
143
159
  fees: new BigNumber(12),
144
160
  recipient: "recipient-address",
161
+ recipientDomain: {
162
+ registry: "ens",
163
+ domain: "recipient.eth",
164
+ address: "recipient-address",
165
+ type: "forward",
166
+ },
145
167
  ...params,
146
168
  } as GenericTransaction,
147
169
  );
@@ -156,6 +178,17 @@ describe("Alpaca utils", () => {
156
178
  fee: new BigNumber(12),
157
179
  blockHash: null,
158
180
  blockHeight: null,
181
+ transactionRaw: {
182
+ amount: expected.subType ? "0" : expected.parentValue.toFixed(),
183
+ fees: "12",
184
+ recipient: expected.parentRecipient,
185
+ recipientDomain: {
186
+ registry: "ens",
187
+ domain: "recipient.eth",
188
+ address: "recipient-address",
189
+ type: "forward",
190
+ },
191
+ },
159
192
  ...(expected.subType
160
193
  ? {
161
194
  subOperations: [
@@ -168,6 +201,11 @@ describe("Alpaca utils", () => {
168
201
  value: new BigNumber(50),
169
202
  blockHash: null,
170
203
  blockHeight: null,
204
+ transactionRaw: {
205
+ amount: "50",
206
+ fees: "12",
207
+ recipient: "recipient-address",
208
+ },
171
209
  },
172
210
  ],
173
211
  }
@@ -420,5 +458,23 @@ describe("Alpaca utils", () => {
420
458
 
421
459
  expect(result.value.toString()).toEqual("50");
422
460
  });
461
+
462
+ it("shows fees in value when transaction has failed", () => {
463
+ const failedOp = {
464
+ ...baseOp,
465
+ type: "OUT",
466
+ value: BigInt(100),
467
+ tx: { ...baseOp.tx, fees: BigInt(25) },
468
+ details: { status: "failed" },
469
+ };
470
+
471
+ const result = adaptCoreOperationToLiveOperation(accountId, failedOp);
472
+
473
+ expect(result).toMatchObject({
474
+ hasFailed: true,
475
+ value: new BigNumber(25),
476
+ fee: new BigNumber(25),
477
+ });
478
+ });
423
479
  });
424
480
  });
@@ -9,7 +9,15 @@ import {
9
9
  } from "@ledgerhq/coin-framework/api/types";
10
10
  import { findCryptoCurrencyById } from "@ledgerhq/cryptoassets/currencies";
11
11
  import { CryptoCurrency } from "@ledgerhq/types-cryptoassets";
12
- import { GenericTransaction, OperationCommon } from "./types";
12
+ import {
13
+ FeeData,
14
+ FeeDataRaw,
15
+ GasOptions,
16
+ GasOptionsRaw,
17
+ GenericTransaction,
18
+ GenericTransactionRaw,
19
+ OperationCommon,
20
+ } from "./types";
13
21
 
14
22
  export function findCryptoCurrencyByNetwork(network: string): CryptoCurrency | undefined {
15
23
  const networksRemap = {
@@ -99,23 +107,36 @@ export function adaptCoreOperationToLiveOperation(accountId: string, op: CoreOpe
99
107
  extra.memo = op.details.memo as string;
100
108
  }
101
109
  const bnFees = new BigNumber(op.tx.fees.toString());
110
+ const hasFailed = op.details?.status === "failed";
111
+
112
+ let value: BigNumber;
113
+ if (hasFailed) {
114
+ value = bnFees;
115
+ } else if (
116
+ op.asset.type === "native" &&
117
+ ["OUT", "FEES", "DELEGATE", "UNDELEGATE"].includes(opType)
118
+ ) {
119
+ value = new BigNumber(op.value.toString()).plus(bnFees);
120
+ } else {
121
+ value = new BigNumber(op.value.toString());
122
+ }
123
+
102
124
  const res = {
103
125
  id: encodeOperationId(accountId, op.tx.hash, op.type),
104
126
  hash: op.tx.hash,
105
127
  accountId,
106
128
  type: opType,
107
- value:
108
- op.asset.type === "native" && ["OUT", "FEES", "DELEGATE", "UNDELEGATE"].includes(opType)
109
- ? new BigNumber(op.value.toString()).plus(bnFees)
110
- : new BigNumber(op.value.toString()),
129
+ value,
111
130
  fee: bnFees,
112
131
  blockHash: op.tx.block.hash,
113
132
  blockHeight: op.tx.block.height,
114
133
  senders: extra.parentSenders ?? op.senders,
115
134
  recipients: extra.parentRecipients ?? op.recipients,
116
135
  date: op.tx.date,
117
- transactionSequenceNumber: op.details?.sequence as number,
118
- hasFailed: op.details?.status === "failed",
136
+ transactionSequenceNumber: op.details?.sequence
137
+ ? new BigNumber(op.details?.sequence.toString())
138
+ : undefined,
139
+ hasFailed,
119
140
  extra,
120
141
  };
121
142
 
@@ -189,6 +210,10 @@ export function transactionToIntent(
189
210
  data: Buffer.isBuffer(transaction.data)
190
211
  ? { type: "buffer", value: transaction.data }
191
212
  : { type: "none" },
213
+ sequence:
214
+ transaction.nonce !== null && transaction.nonce !== undefined
215
+ ? BigInt(transaction.nonce.toString())
216
+ : undefined,
192
217
  };
193
218
  if (transaction.assetReference && transaction.assetOwner) {
194
219
  const { subAccountId } = transaction;
@@ -216,10 +241,114 @@ export function transactionToIntent(
216
241
  return res;
217
242
  }
218
243
 
244
+ function toFeeDataRaw(data: FeeData): FeeDataRaw {
245
+ return {
246
+ gasPrice: data.gasPrice?.toFixed() ?? null,
247
+ maxFeePerGas: data.maxFeePerGas?.toFixed() ?? null,
248
+ maxPriorityFeePerGas: data.maxPriorityFeePerGas?.toFixed() ?? null,
249
+ nextBaseFee: data.nextBaseFee?.toFixed() ?? null,
250
+ };
251
+ }
252
+
253
+ function toGasOptionRaw(options: GasOptions): GasOptionsRaw {
254
+ return {
255
+ fast: toFeeDataRaw(options.fast),
256
+ medium: toFeeDataRaw(options.medium),
257
+ slow: toFeeDataRaw(options.slow),
258
+ };
259
+ }
260
+
261
+ function toGenericTransactionRaw(transaction: GenericTransaction): GenericTransactionRaw {
262
+ const raw: GenericTransactionRaw = {
263
+ amount: transaction.amount.toString(),
264
+ recipient: transaction.recipient,
265
+ family: transaction.family,
266
+ };
267
+
268
+ if ("useAllAmount" in transaction) {
269
+ raw.useAllAmount = transaction.useAllAmount;
270
+ }
271
+
272
+ const stringFieldsToPropagate = [
273
+ "memoType",
274
+ "memoValue",
275
+ "assetReference",
276
+ "assetOwner",
277
+ ] as const;
278
+ for (const field of stringFieldsToPropagate) {
279
+ if (field in transaction) {
280
+ raw[field] = transaction[field];
281
+ }
282
+ }
283
+
284
+ const numberFieldsToPropagate = ["tag", "type", "chainId"] as const;
285
+ for (const field of numberFieldsToPropagate) {
286
+ if (field in transaction) {
287
+ raw[field] = transaction[field];
288
+ }
289
+ }
290
+
291
+ const bigNumberFieldsToPropagate = [
292
+ "fees",
293
+ "storageLimit",
294
+ "nonce",
295
+ "gasLimit",
296
+ "gasPrice",
297
+ "maxFeePerGas",
298
+ "maxPriorityFeePerGas",
299
+ ] as const;
300
+ for (const field of bigNumberFieldsToPropagate) {
301
+ if (field in transaction) {
302
+ raw[field] = transaction[field]?.toFixed();
303
+ }
304
+ }
305
+
306
+ if ("customFees" in transaction) {
307
+ raw.customFees =
308
+ transaction.customFees && "fees" in transaction.customFees.parameters
309
+ ? {
310
+ parameters: { fees: transaction.customFees.parameters.fees?.toFixed() },
311
+ }
312
+ : { parameters: {} };
313
+ }
314
+
315
+ if ("feesStrategy" in transaction) {
316
+ raw.feesStrategy = transaction.feesStrategy;
317
+ }
318
+
319
+ if ("mode" in transaction) {
320
+ raw.mode = transaction.mode;
321
+ }
322
+
323
+ if ("feeCustomUnit" in transaction) {
324
+ raw.feeCustomUnit = transaction.feeCustomUnit;
325
+ }
326
+
327
+ if ("data" in transaction) {
328
+ raw.data = transaction.data?.toString("hex");
329
+ }
330
+
331
+ if ("networkInfo" in transaction) {
332
+ raw.networkInfo = transaction.networkInfo && {
333
+ fees: transaction.networkInfo.fees.toFixed(),
334
+ };
335
+ }
336
+
337
+ if ("gasOptions" in transaction) {
338
+ raw.gasOptions = transaction.gasOptions && toGasOptionRaw(transaction.gasOptions);
339
+ }
340
+
341
+ if ("recipientDomain" in transaction) {
342
+ raw.recipientDomain = transaction.recipientDomain;
343
+ }
344
+
345
+ return raw;
346
+ }
347
+
219
348
  export const buildOptimisticOperation = (
220
349
  account: Account,
221
350
  transaction: GenericTransaction,
222
- sequenceNumber?: number,
351
+ sequenceNumber?: bigint,
223
352
  ): Operation => {
224
353
  let type: OperationType;
225
354
  switch (transaction.mode) {
@@ -242,6 +371,7 @@ export const buildOptimisticOperation = (
242
371
  const { subAccountId } = transaction;
243
372
  const { subAccounts } = account;
244
373
  const parentType = subAccountId ? "FEES" : type;
374
+ const tokenAccount = subAccountId ? subAccounts?.find(ta => ta.id === subAccountId) : null;
245
375
 
246
376
  const operation: Operation = {
247
377
  id: encodeOperationId(account.id, "", parentType),
@@ -253,9 +383,16 @@ export const buildOptimisticOperation = (
253
383
  blockHeight: null,
254
384
  senders: [account.freshAddress.toString()],
255
385
  recipients: [transaction.recipient],
256
- transactionSequenceNumber: sequenceNumber ?? 0,
386
+ transactionSequenceNumber: new BigNumber(sequenceNumber?.toString() ?? 0),
257
387
  accountId: account.id,
258
388
  date: new Date(),
389
+ transactionRaw: toGenericTransactionRaw({
390
+ ...transaction,
391
+ nonce: sequenceNumber !== undefined ? new BigNumber(sequenceNumber.toString()) : undefined,
392
+ ...(tokenAccount
393
+ ? { recipient: tokenAccount.token.contractAddress, amount: new BigNumber(0) }
394
+ : {}),
395
+ }),
259
396
  extra: {
260
397
  ledgerOpType: type,
261
398
  blockTime: new Date(),
@@ -263,7 +400,6 @@ export const buildOptimisticOperation = (
263
400
  },
264
401
  };
265
402
 
266
- const tokenAccount = subAccountId ? subAccounts?.find(ta => ta.id === subAccountId) : null;
267
403
  if (tokenAccount && subAccountId) {
268
404
  operation.subOperations = [
269
405
  {
@@ -278,6 +414,11 @@ export const buildOptimisticOperation = (
278
414
  recipients: [transaction.recipient],
279
415
  accountId: subAccountId,
280
416
  date: new Date(),
417
+ transactionRaw: toGenericTransactionRaw({
418
+ ...transaction,
419
+ nonce:
420
+ sequenceNumber !== undefined ? new BigNumber(sequenceNumber.toString()) : undefined,
421
+ }),
281
422
  extra: {
282
423
  ledgerOpType: type,
283
424
  },
@@ -2,12 +2,12 @@ import type { ScanAccountEvent, ScanAccountEventRaw } from "@ledgerhq/types-live
2
2
  import { fromAccountRaw, toAccountRaw } from "../account";
3
3
  export { getCurrencyBridge, getAccountBridge } from "./impl";
4
4
 
5
- export function fromScanAccountEventRaw(raw: ScanAccountEventRaw): ScanAccountEvent {
5
+ export async function fromScanAccountEventRaw(raw: ScanAccountEventRaw): Promise<ScanAccountEvent> {
6
6
  switch (raw.type) {
7
7
  case "discovered":
8
8
  return {
9
9
  type: raw.type,
10
- account: fromAccountRaw(raw.account),
10
+ account: await fromAccountRaw(raw.account),
11
11
  };
12
12
 
13
13
  default:
@@ -31,12 +31,15 @@ describe("useBridgeTransaction", () => {
31
31
  const mainAccount = genAccount("mocked-account-1", { currency: BTC });
32
32
  const { result } = renderHook(() => useBridgeTransaction(() => ({ account: mainAccount })));
33
33
 
34
- await waitFor(() => {
35
- expect(result.current.bridgePending).toBeFalsy();
36
- expect(result.current.bridgeError).toBeFalsy();
37
- expect(result.current.transaction).not.toBeFalsy();
38
- expect(result.current.account).not.toBeFalsy();
39
- });
34
+ await waitFor(
35
+ () => {
36
+ expect(result.current.bridgePending).toBeFalsy();
37
+ expect(result.current.bridgeError).toBeFalsy();
38
+ expect(result.current.transaction).not.toBeFalsy();
39
+ expect(result.current.account).not.toBeFalsy();
40
+ },
41
+ { timeout: 10000 },
42
+ );
40
43
  });
41
44
 
42
45
  test("bridgeError go through", async () => {
@@ -1,6 +1,12 @@
1
1
  import { getCryptoCurrencyById } from "@ledgerhq/cryptoassets/currencies";
2
+ import { initializeLegacyTokens } from "@ledgerhq/cryptoassets/legacy/legacy-data";
3
+ import { addTokens as addTokensLegacy } from "@ledgerhq/cryptoassets/legacy/legacy-utils";
2
4
  import { inferCryptoCurrencyIcon } from "./cryptoIcons";
3
- import { findTokenById } from "@ledgerhq/cryptoassets/tokens";
5
+ import { getCryptoAssetsStore } from "../bridge/crypto-assets/index";
6
+
7
+ beforeAll(() => {
8
+ initializeLegacyTokens(addTokensLegacy);
9
+ });
4
10
 
5
11
  describe("inferCryptoCurrencyIcon", () => {
6
12
  const registryMock = {
@@ -22,9 +28,8 @@ describe("inferCryptoCurrencyIcon", () => {
22
28
  expect(inferCryptoCurrencyIcon(registryMock, getCryptoCurrencyById("arbitrum"))).toBe(3);
23
29
  });
24
30
 
25
- test("USDT is inferred properly", () => {
26
- const usdt = findTokenById("ethereum/erc20/usd_tether__erc20_");
27
- if (!usdt) throw new Error("USDT token not found");
28
- expect(inferCryptoCurrencyIcon(registryMock, usdt)).toBe(4);
31
+ test("USDT is inferred properly", async () => {
32
+ const token = await getCryptoAssetsStore().findTokenById("ethereum/erc20/usd_tether__erc20_");
33
+ expect(inferCryptoCurrencyIcon(registryMock, token!)).toBe(4);
29
34
  });
30
35
  });
@@ -14,10 +14,7 @@ export {
14
14
  listTokens,
15
15
  listTokensForCryptoCurrency,
16
16
  listTokenTypesForCryptoCurrency,
17
- findTokenById,
18
- findTokenByAddressInCurrency,
19
17
  getAbandonSeedAddress,
20
- addTokens,
21
18
  } from "@ledgerhq/cryptoassets";
22
19
  export {
23
20
  encodeURIScheme,
@@ -4,9 +4,12 @@ import { getBTCValues } from "@ledgerhq/live-countervalues/mock";
4
4
  import { CURRENCIES_LIST, IDS } from "./mock";
5
5
  import { findCryptoCurrencyByTicker, findFiatCurrencyByTicker } from "@ledgerhq/cryptoassets/index";
6
6
  import { getCryptoAssetsStore } from "@ledgerhq/coin-framework/crypto-assets/index";
7
- import { legacyCryptoAssetsStore } from "@ledgerhq/cryptoassets/tokens";
7
+ import { legacyCryptoAssetsStore } from "@ledgerhq/cryptoassets/legacy/legacy-store";
8
+ import { initializeLegacyTokens } from "@ledgerhq/cryptoassets/legacy/legacy-data";
9
+ import { addTokens } from "@ledgerhq/cryptoassets/legacy/legacy-utils";
8
10
  import { setup } from "../bridge/impl";
9
11
 
12
+ initializeLegacyTokens(addTokens);
10
13
  setup(legacyCryptoAssetsStore);
11
14
 
12
15
  test("sortCurrenciesByIds snapshot", async () => {
@@ -24,6 +24,14 @@ const { data, isLoading, error } = useAssetsData({
24
24
  search: "bitcoin",
25
25
  });
26
26
 
27
+ // You can control the fetching with the skip parameter
28
+ const { data, isLoading, error } = useAssetsData({
29
+ product: "llm",
30
+ version: "1.0.0",
31
+ search: "bitcoin",
32
+ skip: true, // true: no fetch
33
+ });
34
+
27
35
  // Get interest rates for currencies
28
36
  const currencies = [bitcoinCurrency, ethereumCurrency];
29
37
  const interestRates = useInterestRatesByCurrencies(currencies);
@@ -79,6 +87,35 @@ const MarketComponent = () => {
79
87
  };
80
88
  ```
81
89
 
90
+ ### Lazy Currency Fetching
91
+
92
+ ```typescript
93
+ import { useLazyLedgerCurrency } from '@ledgerhq/live-common/dada-client/hooks/useLazyLedgerCurrency';
94
+
95
+ const CurrencyComponent = ({ currency }) => {
96
+ const { getLedgerCurrency } = useLazyLedgerCurrency(
97
+ {
98
+ product: 'lld',
99
+ version: '2.0.0',
100
+ },
101
+ currency
102
+ );
103
+
104
+ const handleFetchCurrency = async () => {
105
+ const ledgerCurrency = await getLedgerCurrency();
106
+ if (ledgerCurrency) {
107
+ console.log('Ledger currency data:', ledgerCurrency);
108
+ }
109
+ };
110
+
111
+ return (
112
+ <button onClick={handleFetchCurrency}>
113
+ Fetch Currency Data
114
+ </button>
115
+ );
116
+ };
117
+ ```
118
+
82
119
  ## API Reference
83
120
 
84
121
  ### Hooks
@@ -87,6 +124,7 @@ const MarketComponent = () => {
87
124
  - `useAssetData()` - Fetch specific asset data
88
125
  - `useInterestRatesByCurrencies()` - Get interest rates for currencies
89
126
  - `useMarketByCurrencies()` - Get market data for currencies
127
+ - `useLazyLedgerCurrency()` - Lazy hook to fetch ledger currency data on demand
90
128
 
91
129
  ## Integration
92
130