@ledgerhq/live-common 34.53.0-nightly.20251119110540 → 34.53.0

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 (397) hide show
  1. package/lib/__tests__/test-helpers/bridge.d.ts.map +1 -1
  2. package/lib/__tests__/test-helpers/bridge.js +4 -0
  3. package/lib/__tests__/test-helpers/bridge.js.map +1 -1
  4. package/lib/__tests__/test-helpers/environment.js +0 -3
  5. package/lib/__tests__/test-helpers/environment.js.map +1 -1
  6. package/lib/bridge/generic-alpaca/getAccountShape.d.ts.map +1 -1
  7. package/lib/bridge/generic-alpaca/getAccountShape.js +10 -12
  8. package/lib/bridge/generic-alpaca/getAccountShape.js.map +1 -1
  9. package/lib/currencies/helpers.d.ts +3 -1
  10. package/lib/currencies/helpers.d.ts.map +1 -1
  11. package/lib/currencies/helpers.js +27 -1
  12. package/lib/currencies/helpers.js.map +1 -1
  13. package/lib/dada-client/hooks/useAssetsData.d.ts +0 -1
  14. package/lib/dada-client/hooks/useAssetsData.d.ts.map +1 -1
  15. package/lib/dada-client/hooks/useAssetsData.js +0 -1
  16. package/lib/dada-client/hooks/useAssetsData.js.map +1 -1
  17. package/lib/deposit/helper.d.ts +8 -0
  18. package/lib/deposit/helper.d.ts.map +1 -0
  19. package/lib/deposit/helper.js +125 -0
  20. package/lib/deposit/helper.js.map +1 -0
  21. package/lib/deposit/index.d.ts +3 -0
  22. package/lib/deposit/index.d.ts.map +1 -0
  23. package/lib/deposit/index.js +6 -0
  24. package/lib/deposit/index.js.map +1 -0
  25. package/lib/deposit/mock.d.ts +75 -0
  26. package/lib/deposit/mock.d.ts.map +1 -0
  27. package/lib/deposit/mock.js +15111 -0
  28. package/lib/deposit/mock.js.map +1 -0
  29. package/lib/deposit/type.d.ts +17 -0
  30. package/lib/deposit/type.d.ts.map +1 -1
  31. package/lib/deposit/type.js.map +1 -1
  32. package/lib/deposit/useGroupedCurrenciesByProvider.hook.d.ts +3 -0
  33. package/lib/deposit/useGroupedCurrenciesByProvider.hook.d.ts.map +1 -0
  34. package/lib/deposit/useGroupedCurrenciesByProvider.hook.js +40 -0
  35. package/lib/deposit/useGroupedCurrenciesByProvider.hook.js.map +1 -0
  36. package/lib/deviceSDK/hooks/useBatteryStatuses.d.ts +1 -2
  37. package/lib/deviceSDK/hooks/useBatteryStatuses.d.ts.map +1 -1
  38. package/lib/deviceSDK/hooks/useBatteryStatuses.js +2 -4
  39. package/lib/deviceSDK/hooks/useBatteryStatuses.js.map +1 -1
  40. package/lib/deviceSDK/tasks/core.d.ts +1 -1
  41. package/lib/deviceSDK/tasks/core.d.ts.map +1 -1
  42. package/lib/deviceSDK/tasks/core.js +1 -1
  43. package/lib/deviceSDK/tasks/core.js.map +1 -1
  44. package/lib/deviceSDK/tasks/getDeviceInfo.d.ts.map +1 -1
  45. package/lib/deviceSDK/tasks/getDeviceInfo.js +0 -2
  46. package/lib/deviceSDK/tasks/getDeviceInfo.js.map +1 -1
  47. package/lib/deviceSDK/tasks/getLatestFirmware.d.ts.map +1 -1
  48. package/lib/deviceSDK/tasks/getLatestFirmware.js +2 -2
  49. package/lib/deviceSDK/tasks/getLatestFirmware.js.map +1 -1
  50. package/lib/deviceSDK/tasks/updateFirmware.d.ts.map +1 -1
  51. package/lib/deviceSDK/tasks/updateFirmware.js +0 -1
  52. package/lib/deviceSDK/tasks/updateFirmware.js.map +1 -1
  53. package/lib/e2e/enum/Account.d.ts +1 -0
  54. package/lib/e2e/enum/Account.d.ts.map +1 -1
  55. package/lib/e2e/enum/Account.js +1 -0
  56. package/lib/e2e/enum/Account.js.map +1 -1
  57. package/lib/e2e/enum/Currency.d.ts +1 -0
  58. package/lib/e2e/enum/Currency.d.ts.map +1 -1
  59. package/lib/e2e/enum/Currency.js +6 -2
  60. package/lib/e2e/enum/Currency.js.map +1 -1
  61. package/lib/e2e/index.d.ts +0 -9
  62. package/lib/e2e/index.d.ts.map +1 -1
  63. package/lib/exchange/providers/swap.d.ts +0 -1
  64. package/lib/exchange/providers/swap.d.ts.map +1 -1
  65. package/lib/exchange/providers/swap.js +1 -5
  66. package/lib/exchange/providers/swap.js.map +1 -1
  67. package/lib/exchange/swap/hooks/v5/useFetchCurrencyAll.d.ts.map +1 -1
  68. package/lib/exchange/swap/hooks/v5/useFetchCurrencyAll.js +3 -2
  69. package/lib/exchange/swap/hooks/v5/useFetchCurrencyAll.js.map +1 -1
  70. package/lib/exchange/swap/hooks/v5/useFilteredProviders.d.ts.map +1 -1
  71. package/lib/exchange/swap/hooks/v5/useFilteredProviders.js +10 -15
  72. package/lib/exchange/swap/hooks/v5/useFilteredProviders.js.map +1 -1
  73. package/lib/families/evm/config.d.ts.map +1 -1
  74. package/lib/families/evm/config.js +0 -49
  75. package/lib/families/evm/config.js.map +1 -1
  76. package/lib/featureFlags/defaultFeatures.d.ts +0 -3
  77. package/lib/featureFlags/defaultFeatures.d.ts.map +1 -1
  78. package/lib/featureFlags/defaultFeatures.js +0 -4
  79. package/lib/featureFlags/defaultFeatures.js.map +1 -1
  80. package/lib/market/hooks/useMarketDataProvider.js +0 -1
  81. package/lib/market/hooks/useMarketDataProvider.js.map +1 -1
  82. package/lib/market/utils/types.d.ts +0 -1
  83. package/lib/market/utils/types.d.ts.map +1 -1
  84. package/lib/market/utils/types.js.map +1 -1
  85. package/lib/modularDrawer/__mocks__/useGroupedCurrenciesByProvider.mock.d.ts +22 -0
  86. package/lib/modularDrawer/__mocks__/useGroupedCurrenciesByProvider.mock.d.ts.map +1 -0
  87. package/lib/modularDrawer/__mocks__/useGroupedCurrenciesByProvider.mock.js +41 -0
  88. package/lib/modularDrawer/__mocks__/useGroupedCurrenciesByProvider.mock.js.map +1 -0
  89. package/lib/modularDrawer/hooks/useCurrenciesUnderFeatureFlag.d.ts.map +1 -1
  90. package/lib/modularDrawer/hooks/useCurrenciesUnderFeatureFlag.js +0 -11
  91. package/lib/modularDrawer/hooks/useCurrenciesUnderFeatureFlag.js.map +1 -1
  92. package/lib/modularDrawer/hooks/useNetworkAccountCounts.d.ts +5 -1
  93. package/lib/modularDrawer/hooks/useNetworkAccountCounts.d.ts.map +1 -1
  94. package/lib/modularDrawer/hooks/useNetworkAccountCounts.js +2 -2
  95. package/lib/modularDrawer/hooks/useNetworkAccountCounts.js.map +1 -1
  96. package/lib/modularDrawer/modules/createNetworkConfiguration.d.ts +1 -1
  97. package/lib/modularDrawer/modules/createNetworkConfiguration.d.ts.map +1 -1
  98. package/lib/modularDrawer/modules/createNetworkConfiguration.js +2 -1
  99. package/lib/modularDrawer/modules/createNetworkConfiguration.js.map +1 -1
  100. package/lib/modularDrawer/utils/currencyUtils.d.ts +10 -0
  101. package/lib/modularDrawer/utils/currencyUtils.d.ts.map +1 -0
  102. package/lib/modularDrawer/utils/currencyUtils.js +74 -0
  103. package/lib/modularDrawer/utils/currencyUtils.js.map +1 -0
  104. package/lib/modularDrawer/utils/{groupCurrenciesByAsset.d.ts → groupCurrenciesByProvider.d.ts} +2 -2
  105. package/lib/modularDrawer/utils/groupCurrenciesByProvider.d.ts.map +1 -0
  106. package/lib/modularDrawer/utils/groupCurrenciesByProvider.js +21 -0
  107. package/lib/modularDrawer/utils/groupCurrenciesByProvider.js.map +1 -0
  108. package/lib/modularDrawer/utils/index.d.ts +1 -1
  109. package/lib/modularDrawer/utils/index.d.ts.map +1 -1
  110. package/lib/modularDrawer/utils/index.js +3 -3
  111. package/lib/modularDrawer/utils/index.js.map +1 -1
  112. package/lib/modularDrawer/utils/type.d.ts +5 -0
  113. package/lib/modularDrawer/utils/type.d.ts.map +1 -1
  114. package/lib/platform/filters.d.ts +2 -1
  115. package/lib/platform/filters.d.ts.map +1 -1
  116. package/lib/platform/filters.js +17 -1
  117. package/lib/platform/filters.js.map +1 -1
  118. package/lib/platform/helpers.d.ts +5 -1
  119. package/lib/platform/helpers.d.ts.map +1 -1
  120. package/lib/platform/helpers.js +33 -1
  121. package/lib/platform/helpers.js.map +1 -1
  122. package/lib/platform/react.d.ts +3 -2
  123. package/lib/platform/react.d.ts.map +1 -1
  124. package/lib/platform/react.js +16 -66
  125. package/lib/platform/react.js.map +1 -1
  126. package/lib/platform/types.d.ts +3 -3
  127. package/lib/platform/types.d.ts.map +1 -1
  128. package/lib/postOnboarding/reducer.d.ts +0 -2
  129. package/lib/postOnboarding/reducer.d.ts.map +1 -1
  130. package/lib/utils/getAccountTuplesForCurrency.d.ts +1 -1
  131. package/lib/utils/getAccountTuplesForCurrency.d.ts.map +1 -1
  132. package/lib/utils/getAccountTuplesForCurrency.js +3 -2
  133. package/lib/utils/getAccountTuplesForCurrency.js.map +1 -1
  134. package/lib/wallet-api/Exchange/server.d.ts.map +1 -1
  135. package/lib/wallet-api/Exchange/server.js +4 -5
  136. package/lib/wallet-api/Exchange/server.js.map +1 -1
  137. package/lib/wallet-api/converters.d.ts +0 -1
  138. package/lib/wallet-api/converters.d.ts.map +1 -1
  139. package/lib/wallet-api/converters.js +2 -7
  140. package/lib/wallet-api/converters.js.map +1 -1
  141. package/lib/wallet-api/react.d.ts +11 -6
  142. package/lib/wallet-api/react.d.ts.map +1 -1
  143. package/lib/wallet-api/react.js +135 -291
  144. package/lib/wallet-api/react.js.map +1 -1
  145. package/lib/wallet-api/tracking.d.ts +0 -6
  146. package/lib/wallet-api/tracking.d.ts.map +1 -1
  147. package/lib/wallet-api/tracking.js +0 -20
  148. package/lib/wallet-api/tracking.js.map +1 -1
  149. package/lib/wallet-api/types.d.ts +0 -3
  150. package/lib/wallet-api/types.d.ts.map +1 -1
  151. package/lib/wallet-api/useDappLogic.d.ts.map +1 -1
  152. package/lib/wallet-api/useDappLogic.js +80 -65
  153. package/lib/wallet-api/useDappLogic.js.map +1 -1
  154. package/lib/wallet-api/utils/deriveAccountIdForManifest.d.ts +0 -6
  155. package/lib/wallet-api/utils/deriveAccountIdForManifest.d.ts.map +1 -1
  156. package/lib/wallet-api/utils/deriveAccountIdForManifest.js +3 -13
  157. package/lib/wallet-api/utils/deriveAccountIdForManifest.js.map +1 -1
  158. package/lib-es/__tests__/test-helpers/bridge.d.ts.map +1 -1
  159. package/lib-es/__tests__/test-helpers/bridge.js +4 -0
  160. package/lib-es/__tests__/test-helpers/bridge.js.map +1 -1
  161. package/lib-es/__tests__/test-helpers/environment.js +0 -3
  162. package/lib-es/__tests__/test-helpers/environment.js.map +1 -1
  163. package/lib-es/bridge/generic-alpaca/getAccountShape.d.ts.map +1 -1
  164. package/lib-es/bridge/generic-alpaca/getAccountShape.js +11 -13
  165. package/lib-es/bridge/generic-alpaca/getAccountShape.js.map +1 -1
  166. package/lib-es/currencies/helpers.d.ts +3 -1
  167. package/lib-es/currencies/helpers.d.ts.map +1 -1
  168. package/lib-es/currencies/helpers.js +24 -0
  169. package/lib-es/currencies/helpers.js.map +1 -1
  170. package/lib-es/dada-client/hooks/useAssetsData.d.ts +0 -1
  171. package/lib-es/dada-client/hooks/useAssetsData.d.ts.map +1 -1
  172. package/lib-es/dada-client/hooks/useAssetsData.js +0 -1
  173. package/lib-es/dada-client/hooks/useAssetsData.js.map +1 -1
  174. package/lib-es/deposit/helper.d.ts +8 -0
  175. package/lib-es/deposit/helper.d.ts.map +1 -0
  176. package/lib-es/deposit/helper.js +117 -0
  177. package/lib-es/deposit/helper.js.map +1 -0
  178. package/lib-es/deposit/index.d.ts +3 -0
  179. package/lib-es/deposit/index.d.ts.map +1 -0
  180. package/lib-es/deposit/index.js +3 -0
  181. package/lib-es/deposit/index.js.map +1 -0
  182. package/lib-es/deposit/mock.d.ts +75 -0
  183. package/lib-es/deposit/mock.d.ts.map +1 -0
  184. package/lib-es/deposit/mock.js +15108 -0
  185. package/lib-es/deposit/mock.js.map +1 -0
  186. package/lib-es/deposit/type.d.ts +17 -0
  187. package/lib-es/deposit/type.d.ts.map +1 -1
  188. package/lib-es/deposit/type.js.map +1 -1
  189. package/lib-es/deposit/useGroupedCurrenciesByProvider.hook.d.ts +3 -0
  190. package/lib-es/deposit/useGroupedCurrenciesByProvider.hook.d.ts.map +1 -0
  191. package/lib-es/deposit/useGroupedCurrenciesByProvider.hook.js +36 -0
  192. package/lib-es/deposit/useGroupedCurrenciesByProvider.hook.js.map +1 -0
  193. package/lib-es/deviceSDK/hooks/useBatteryStatuses.d.ts +1 -2
  194. package/lib-es/deviceSDK/hooks/useBatteryStatuses.d.ts.map +1 -1
  195. package/lib-es/deviceSDK/hooks/useBatteryStatuses.js +2 -4
  196. package/lib-es/deviceSDK/hooks/useBatteryStatuses.js.map +1 -1
  197. package/lib-es/deviceSDK/tasks/core.d.ts +1 -1
  198. package/lib-es/deviceSDK/tasks/core.d.ts.map +1 -1
  199. package/lib-es/deviceSDK/tasks/core.js +1 -1
  200. package/lib-es/deviceSDK/tasks/core.js.map +1 -1
  201. package/lib-es/deviceSDK/tasks/getDeviceInfo.d.ts.map +1 -1
  202. package/lib-es/deviceSDK/tasks/getDeviceInfo.js +0 -2
  203. package/lib-es/deviceSDK/tasks/getDeviceInfo.js.map +1 -1
  204. package/lib-es/deviceSDK/tasks/getLatestFirmware.d.ts.map +1 -1
  205. package/lib-es/deviceSDK/tasks/getLatestFirmware.js +2 -2
  206. package/lib-es/deviceSDK/tasks/getLatestFirmware.js.map +1 -1
  207. package/lib-es/deviceSDK/tasks/updateFirmware.d.ts.map +1 -1
  208. package/lib-es/deviceSDK/tasks/updateFirmware.js +1 -2
  209. package/lib-es/deviceSDK/tasks/updateFirmware.js.map +1 -1
  210. package/lib-es/e2e/enum/Account.d.ts +1 -0
  211. package/lib-es/e2e/enum/Account.d.ts.map +1 -1
  212. package/lib-es/e2e/enum/Account.js +1 -0
  213. package/lib-es/e2e/enum/Account.js.map +1 -1
  214. package/lib-es/e2e/enum/Currency.d.ts +1 -0
  215. package/lib-es/e2e/enum/Currency.d.ts.map +1 -1
  216. package/lib-es/e2e/enum/Currency.js +6 -2
  217. package/lib-es/e2e/enum/Currency.js.map +1 -1
  218. package/lib-es/e2e/index.d.ts +0 -9
  219. package/lib-es/e2e/index.d.ts.map +1 -1
  220. package/lib-es/exchange/providers/swap.d.ts +0 -1
  221. package/lib-es/exchange/providers/swap.d.ts.map +1 -1
  222. package/lib-es/exchange/providers/swap.js +0 -3
  223. package/lib-es/exchange/providers/swap.js.map +1 -1
  224. package/lib-es/exchange/swap/hooks/v5/useFetchCurrencyAll.d.ts.map +1 -1
  225. package/lib-es/exchange/swap/hooks/v5/useFetchCurrencyAll.js +3 -2
  226. package/lib-es/exchange/swap/hooks/v5/useFetchCurrencyAll.js.map +1 -1
  227. package/lib-es/exchange/swap/hooks/v5/useFilteredProviders.d.ts.map +1 -1
  228. package/lib-es/exchange/swap/hooks/v5/useFilteredProviders.js +12 -17
  229. package/lib-es/exchange/swap/hooks/v5/useFilteredProviders.js.map +1 -1
  230. package/lib-es/families/evm/config.d.ts.map +1 -1
  231. package/lib-es/families/evm/config.js +0 -49
  232. package/lib-es/families/evm/config.js.map +1 -1
  233. package/lib-es/featureFlags/defaultFeatures.d.ts +0 -3
  234. package/lib-es/featureFlags/defaultFeatures.d.ts.map +1 -1
  235. package/lib-es/featureFlags/defaultFeatures.js +0 -4
  236. package/lib-es/featureFlags/defaultFeatures.js.map +1 -1
  237. package/lib-es/market/hooks/useMarketDataProvider.js +0 -1
  238. package/lib-es/market/hooks/useMarketDataProvider.js.map +1 -1
  239. package/lib-es/market/utils/types.d.ts +0 -1
  240. package/lib-es/market/utils/types.d.ts.map +1 -1
  241. package/lib-es/market/utils/types.js.map +1 -1
  242. package/lib-es/modularDrawer/__mocks__/useGroupedCurrenciesByProvider.mock.d.ts +22 -0
  243. package/lib-es/modularDrawer/__mocks__/useGroupedCurrenciesByProvider.mock.d.ts.map +1 -0
  244. package/lib-es/modularDrawer/__mocks__/useGroupedCurrenciesByProvider.mock.js +38 -0
  245. package/lib-es/modularDrawer/__mocks__/useGroupedCurrenciesByProvider.mock.js.map +1 -0
  246. package/lib-es/modularDrawer/hooks/useCurrenciesUnderFeatureFlag.d.ts.map +1 -1
  247. package/lib-es/modularDrawer/hooks/useCurrenciesUnderFeatureFlag.js +0 -11
  248. package/lib-es/modularDrawer/hooks/useCurrenciesUnderFeatureFlag.js.map +1 -1
  249. package/lib-es/modularDrawer/hooks/useNetworkAccountCounts.d.ts +5 -1
  250. package/lib-es/modularDrawer/hooks/useNetworkAccountCounts.d.ts.map +1 -1
  251. package/lib-es/modularDrawer/hooks/useNetworkAccountCounts.js +2 -2
  252. package/lib-es/modularDrawer/hooks/useNetworkAccountCounts.js.map +1 -1
  253. package/lib-es/modularDrawer/modules/createNetworkConfiguration.d.ts +1 -1
  254. package/lib-es/modularDrawer/modules/createNetworkConfiguration.d.ts.map +1 -1
  255. package/lib-es/modularDrawer/modules/createNetworkConfiguration.js +2 -1
  256. package/lib-es/modularDrawer/modules/createNetworkConfiguration.js.map +1 -1
  257. package/lib-es/modularDrawer/utils/currencyUtils.d.ts +10 -0
  258. package/lib-es/modularDrawer/utils/currencyUtils.d.ts.map +1 -0
  259. package/lib-es/modularDrawer/utils/currencyUtils.js +65 -0
  260. package/lib-es/modularDrawer/utils/currencyUtils.js.map +1 -0
  261. package/lib-es/modularDrawer/utils/{groupCurrenciesByAsset.d.ts → groupCurrenciesByProvider.d.ts} +2 -2
  262. package/lib-es/modularDrawer/utils/groupCurrenciesByProvider.d.ts.map +1 -0
  263. package/lib-es/modularDrawer/utils/{groupCurrenciesByAsset.js → groupCurrenciesByProvider.js} +6 -6
  264. package/lib-es/modularDrawer/utils/groupCurrenciesByProvider.js.map +1 -0
  265. package/lib-es/modularDrawer/utils/index.d.ts +1 -1
  266. package/lib-es/modularDrawer/utils/index.d.ts.map +1 -1
  267. package/lib-es/modularDrawer/utils/index.js +1 -1
  268. package/lib-es/modularDrawer/utils/index.js.map +1 -1
  269. package/lib-es/modularDrawer/utils/type.d.ts +5 -0
  270. package/lib-es/modularDrawer/utils/type.d.ts.map +1 -1
  271. package/lib-es/platform/filters.d.ts +2 -1
  272. package/lib-es/platform/filters.d.ts.map +1 -1
  273. package/lib-es/platform/filters.js +15 -0
  274. package/lib-es/platform/filters.js.map +1 -1
  275. package/lib-es/platform/helpers.d.ts +5 -1
  276. package/lib-es/platform/helpers.d.ts.map +1 -1
  277. package/lib-es/platform/helpers.js +30 -1
  278. package/lib-es/platform/helpers.js.map +1 -1
  279. package/lib-es/platform/react.d.ts +3 -2
  280. package/lib-es/platform/react.d.ts.map +1 -1
  281. package/lib-es/platform/react.js +16 -67
  282. package/lib-es/platform/react.js.map +1 -1
  283. package/lib-es/platform/types.d.ts +3 -3
  284. package/lib-es/platform/types.d.ts.map +1 -1
  285. package/lib-es/postOnboarding/reducer.d.ts +0 -2
  286. package/lib-es/postOnboarding/reducer.d.ts.map +1 -1
  287. package/lib-es/utils/getAccountTuplesForCurrency.d.ts +1 -1
  288. package/lib-es/utils/getAccountTuplesForCurrency.d.ts.map +1 -1
  289. package/lib-es/utils/getAccountTuplesForCurrency.js +3 -2
  290. package/lib-es/utils/getAccountTuplesForCurrency.js.map +1 -1
  291. package/lib-es/wallet-api/Exchange/server.d.ts.map +1 -1
  292. package/lib-es/wallet-api/Exchange/server.js +4 -5
  293. package/lib-es/wallet-api/Exchange/server.js.map +1 -1
  294. package/lib-es/wallet-api/converters.d.ts +0 -1
  295. package/lib-es/wallet-api/converters.d.ts.map +1 -1
  296. package/lib-es/wallet-api/converters.js +1 -5
  297. package/lib-es/wallet-api/converters.js.map +1 -1
  298. package/lib-es/wallet-api/react.d.ts +11 -6
  299. package/lib-es/wallet-api/react.d.ts.map +1 -1
  300. package/lib-es/wallet-api/react.js +131 -289
  301. package/lib-es/wallet-api/react.js.map +1 -1
  302. package/lib-es/wallet-api/tracking.d.ts +0 -6
  303. package/lib-es/wallet-api/tracking.d.ts.map +1 -1
  304. package/lib-es/wallet-api/tracking.js +0 -20
  305. package/lib-es/wallet-api/tracking.js.map +1 -1
  306. package/lib-es/wallet-api/types.d.ts +0 -3
  307. package/lib-es/wallet-api/types.d.ts.map +1 -1
  308. package/lib-es/wallet-api/useDappLogic.d.ts.map +1 -1
  309. package/lib-es/wallet-api/useDappLogic.js +77 -62
  310. package/lib-es/wallet-api/useDappLogic.js.map +1 -1
  311. package/lib-es/wallet-api/utils/deriveAccountIdForManifest.d.ts +0 -6
  312. package/lib-es/wallet-api/utils/deriveAccountIdForManifest.d.ts.map +1 -1
  313. package/lib-es/wallet-api/utils/deriveAccountIdForManifest.js +2 -11
  314. package/lib-es/wallet-api/utils/deriveAccountIdForManifest.js.map +1 -1
  315. package/package.json +57 -57
  316. package/src/__tests__/migration/account-migration.ts +0 -3
  317. package/src/__tests__/test-helpers/bridge.ts +2 -0
  318. package/src/__tests__/test-helpers/environment.ts +0 -3
  319. package/src/bridge/generic-alpaca/getAccountShape.ts +12 -15
  320. package/src/bridge/generic-alpaca/tests/getAccountShape.test.ts +101 -142
  321. package/src/currencies/helpers.test.ts +20 -0
  322. package/src/currencies/helpers.ts +42 -1
  323. package/src/dada-client/hooks/useAssetsData.ts +0 -1
  324. package/src/deposit/deposit.integration.test.ts +88 -0
  325. package/src/deposit/deposit.test.ts +684 -0
  326. package/src/deposit/helper.ts +143 -0
  327. package/src/deposit/index.ts +3 -0
  328. package/src/deposit/mock.ts +15112 -0
  329. package/src/deposit/type.ts +21 -0
  330. package/src/deposit/useGroupedCurrenciesByProvider.hook.ts +46 -0
  331. package/src/deviceSDK/hooks/useBatteryStatuses.test.ts +1 -3
  332. package/src/deviceSDK/hooks/useBatteryStatuses.ts +1 -4
  333. package/src/deviceSDK/tasks/core.test.ts +0 -20
  334. package/src/deviceSDK/tasks/core.ts +1 -2
  335. package/src/deviceSDK/tasks/getDeviceInfo.ts +0 -2
  336. package/src/deviceSDK/tasks/getLatestFirmware.ts +4 -4
  337. package/src/deviceSDK/tasks/updateFirmware.ts +0 -2
  338. package/src/e2e/enum/Account.ts +6 -0
  339. package/src/e2e/enum/Currency.ts +6 -2
  340. package/src/exchange/providers/swap.ts +0 -4
  341. package/src/exchange/swap/hooks/v5/useFetchCurrencyAll.ts +3 -2
  342. package/src/exchange/swap/hooks/v5/useFilteredProviders.ts +12 -37
  343. package/src/families/evm/config.ts +0 -49
  344. package/src/families/stellar/__snapshots__/bridge.integration.test.ts.snap +12 -84
  345. package/src/featureFlags/defaultFeatures.ts +0 -4
  346. package/src/market/hooks/useMarketDataProvider.ts +0 -1
  347. package/src/market/utils/types.ts +0 -1
  348. package/src/modularDrawer/__mocks__/useGroupedCurrenciesByProvider.mock.ts +49 -0
  349. package/src/modularDrawer/hooks/__test__/useAssetAccountCounts.test.ts +5 -0
  350. package/src/modularDrawer/hooks/useCurrenciesUnderFeatureFlag.ts +0 -11
  351. package/src/modularDrawer/hooks/useNetworkAccountCounts.tsx +6 -1
  352. package/src/modularDrawer/modules/__test__/createAssetConfiguration.test.tsx +2 -2
  353. package/src/modularDrawer/modules/__test__/createNetworkConfiguration.test.ts +342 -0
  354. package/src/modularDrawer/modules/createNetworkConfiguration.ts +2 -1
  355. package/src/modularDrawer/utils/__tests__/currencyUtils.test.ts +126 -0
  356. package/src/modularDrawer/utils/currencyUtils.ts +95 -0
  357. package/src/modularDrawer/utils/{groupCurrenciesByAsset.ts → groupCurrenciesByProvider.ts} +5 -5
  358. package/src/modularDrawer/utils/index.ts +1 -1
  359. package/src/modularDrawer/utils/type.ts +5 -0
  360. package/src/platform/filters.ts +23 -1
  361. package/src/platform/helpers.ts +49 -2
  362. package/src/platform/react.ts +22 -86
  363. package/src/platform/types.ts +1 -1
  364. package/src/utils/__tests__/getAccountTuplesForCurrency.test.ts +30 -0
  365. package/src/utils/getAccountTuplesForCurrency.ts +6 -1
  366. package/src/wallet-api/Exchange/server.test.ts +5 -0
  367. package/src/wallet-api/Exchange/server.ts +6 -7
  368. package/src/wallet-api/converters.ts +1 -6
  369. package/src/wallet-api/react.ts +137 -310
  370. package/src/wallet-api/tracking.ts +0 -22
  371. package/src/wallet-api/types.ts +0 -5
  372. package/src/wallet-api/useDappLogic.ts +106 -91
  373. package/src/wallet-api/utils/deriveAccountIdForManifest.ts +2 -14
  374. package/lib/device/use-cases/getDeviceHasBattery.d.ts +0 -2
  375. package/lib/device/use-cases/getDeviceHasBattery.d.ts.map +0 -1
  376. package/lib/device/use-cases/getDeviceHasBattery.js +0 -6
  377. package/lib/device/use-cases/getDeviceHasBattery.js.map +0 -1
  378. package/lib/e2e/enum/ReceiveFundsOptions.d.ts +0 -6
  379. package/lib/e2e/enum/ReceiveFundsOptions.d.ts.map +0 -1
  380. package/lib/e2e/enum/ReceiveFundsOptions.js +0 -8
  381. package/lib/e2e/enum/ReceiveFundsOptions.js.map +0 -1
  382. package/lib/modularDrawer/utils/groupCurrenciesByAsset.d.ts.map +0 -1
  383. package/lib/modularDrawer/utils/groupCurrenciesByAsset.js +0 -21
  384. package/lib/modularDrawer/utils/groupCurrenciesByAsset.js.map +0 -1
  385. package/lib-es/device/use-cases/getDeviceHasBattery.d.ts +0 -2
  386. package/lib-es/device/use-cases/getDeviceHasBattery.d.ts.map +0 -1
  387. package/lib-es/device/use-cases/getDeviceHasBattery.js +0 -2
  388. package/lib-es/device/use-cases/getDeviceHasBattery.js.map +0 -1
  389. package/lib-es/e2e/enum/ReceiveFundsOptions.d.ts +0 -6
  390. package/lib-es/e2e/enum/ReceiveFundsOptions.d.ts.map +0 -1
  391. package/lib-es/e2e/enum/ReceiveFundsOptions.js +0 -5
  392. package/lib-es/e2e/enum/ReceiveFundsOptions.js.map +0 -1
  393. package/lib-es/modularDrawer/utils/groupCurrenciesByAsset.d.ts.map +0 -1
  394. package/lib-es/modularDrawer/utils/groupCurrenciesByAsset.js.map +0 -1
  395. package/src/device/use-cases/getDeviceHasBattery.ts +0 -1
  396. package/src/e2e/enum/ReceiveFundsOptions.ts +0 -7
  397. package/src/modularDrawer/utils/__tests__/groupCurrenciesByAsset.test.ts +0 -88
@@ -1,38 +1,26 @@
1
1
  import { useMemo, useState, useEffect, useRef, useCallback, RefObject } from "react";
2
- import { useDispatch } from "react-redux";
3
2
  import semver from "semver";
4
3
  import { intervalToDuration } from "date-fns";
4
+
5
5
  import { Account, AccountLike, AnyMessage, Operation, SignedOperation } from "@ledgerhq/types-live";
6
- import {
7
- WalletHandlers,
8
- ServerConfig,
9
- WalletAPIServer,
10
- useWalletAPIServer as useWalletAPIServerRaw,
11
- } from "@ledgerhq/wallet-api-server";
6
+ import { CryptoOrTokenCurrency } from "@ledgerhq/types-cryptoassets";
7
+ import { WalletHandlers, ServerConfig, WalletAPIServer } from "@ledgerhq/wallet-api-server";
8
+ import { useWalletAPIServer as useWalletAPIServerRaw } from "@ledgerhq/wallet-api-server/lib/react";
12
9
  import { Transport, Permission } from "@ledgerhq/wallet-api-core";
13
- import { first } from "rxjs/operators";
14
- import { getEnv } from "@ledgerhq/live-env";
15
- import { UserRefusedOnDevice } from "@ledgerhq/errors";
16
- import { WalletState } from "@ledgerhq/live-wallet/store";
17
- import { endpoints as calEndpoints } from "@ledgerhq/cryptoassets/cal-client/state-manager/api";
18
- import { ThunkDispatch, UnknownAction } from "@reduxjs/toolkit";
19
- import { InfiniteData } from "@reduxjs/toolkit/query";
20
- import type {
21
- TokensDataWithPagination,
22
- PageParam,
23
- } from "@ledgerhq/cryptoassets/lib/cal-client/state-manager/types";
24
- import { Subject } from "rxjs";
25
10
  import { StateDB } from "../hooks/useDBRaw";
11
+ import { Observable, firstValueFrom, Subject } from "rxjs";
12
+ import { first } from "rxjs/operators";
26
13
  import {
27
14
  accountToWalletAPIAccount,
28
15
  currencyToWalletAPICurrency,
29
- setWalletApiIdForAccountId,
16
+ getAccountIdFromWalletAccountId,
30
17
  } from "./converters";
31
18
  import { isWalletAPISupportedCurrency } from "./helpers";
32
19
  import { WalletAPICurrency, AppManifest, WalletAPIAccount, WalletAPICustomHandlers } from "./types";
20
+
33
21
  import { getMainAccount, getParentAccount } from "../account";
34
- import { listSupportedCurrencies } from "../currencies";
35
- import { getCryptoAssetsStore } from "../bridge/crypto-assets";
22
+ import { listCurrencies, findCryptoCurrencyById, getCryptoCurrencyById } from "../currencies";
23
+ import { getCryptoAssetsStore } from "../bridge/crypto-assets/index";
36
24
  import { TrackingAPI } from "./tracking";
37
25
  import {
38
26
  bitcoinFamilyAccountGetXPubLogic,
@@ -49,8 +37,10 @@ import {
49
37
  signRawTransactionLogic,
50
38
  } from "./logic";
51
39
  import { getAccountBridge } from "../bridge";
40
+ import { getEnv } from "@ledgerhq/live-env";
52
41
  import openTransportAsSubject, { BidirectionalEvent } from "../hw/openTransportAsSubject";
53
42
  import { AppResult } from "../hw/actions/app";
43
+ import { UserRefusedOnDevice } from "@ledgerhq/errors";
54
44
  import { Transaction } from "../generated/types";
55
45
  import {
56
46
  DISCOVER_INITIAL_CATEGORY,
@@ -59,8 +49,8 @@ import {
59
49
  } from "./constants";
60
50
  import { DiscoverDB } from "./types";
61
51
  import { LiveAppManifest } from "../platform/types";
52
+ import { WalletState } from "@ledgerhq/live-wallet/store";
62
53
  import { ModularDrawerConfiguration } from "./ModularDrawer/types";
63
- import { useCurrenciesUnderFeatureFlag } from "../modularDrawer/hooks/useCurrenciesUnderFeatureFlag";
64
54
 
65
55
  export function safeGetRefValue<T>(ref: RefObject<T>): NonNullable<T> {
66
56
  if (!ref.current) {
@@ -69,27 +59,75 @@ export function safeGetRefValue<T>(ref: RefObject<T>): NonNullable<T> {
69
59
  return ref.current;
70
60
  }
71
61
 
72
- export function useSetWalletAPIAccounts(accounts: AccountLike[]): void {
73
- useEffect(() => {
74
- accounts.forEach(account => {
75
- setWalletApiIdForAccountId(account.id);
62
+ export function useWalletAPIAccounts(
63
+ walletState: WalletState,
64
+ accounts: AccountLike[],
65
+ ): WalletAPIAccount[] {
66
+ return useMemo(() => {
67
+ return accounts.map(account => {
68
+ const parentAccount = getParentAccount(account, accounts);
69
+
70
+ return accountToWalletAPIAccount(walletState, account, parentAccount);
76
71
  });
77
- }, [accounts]);
72
+ }, [walletState, accounts]);
78
73
  }
79
74
 
80
- export function useDAppManifestCurrencyIds(manifest: AppManifest) {
75
+ export function useWalletAPICurrencies(): WalletAPICurrency[] {
76
+ return useMemo(() => {
77
+ return listCurrencies(true).reduce<WalletAPICurrency[]>((filtered, currency) => {
78
+ if (isWalletAPISupportedCurrency(currency)) {
79
+ filtered.push(currencyToWalletAPICurrency(currency));
80
+ }
81
+ return filtered;
82
+ }, []);
83
+ }, []);
84
+ }
85
+
86
+ export function useManifestCurrencies(manifest: AppManifest) {
81
87
  return useMemo(() => {
82
88
  return (
83
89
  manifest.dapp?.networks.map(network => {
84
- return network.currency;
90
+ return getCryptoCurrencyById(network.currency);
85
91
  }) ?? []
86
92
  );
87
93
  }, [manifest.dapp?.networks]);
88
94
  }
89
95
 
96
+ export function useGetAccountIds(
97
+ accounts$: Observable<WalletAPIAccount[]> | undefined,
98
+ ): Map<string, boolean> | undefined {
99
+ const [accounts, setAccounts] = useState<WalletAPIAccount[]>([]);
100
+
101
+ useEffect(() => {
102
+ if (!accounts$) {
103
+ return undefined;
104
+ }
105
+
106
+ const subscription = accounts$.subscribe(walletAccounts => {
107
+ setAccounts(walletAccounts);
108
+ });
109
+
110
+ return () => {
111
+ subscription.unsubscribe();
112
+ };
113
+ }, [accounts$]);
114
+
115
+ return useMemo(() => {
116
+ if (!accounts$) {
117
+ return undefined;
118
+ }
119
+
120
+ return accounts.reduce((accountIds, account) => {
121
+ accountIds.set(getAccountIdFromWalletAccountId(account.id), true);
122
+ return accountIds;
123
+ }, new Map());
124
+ }, [accounts, accounts$]);
125
+ }
126
+
90
127
  export interface UiHook {
91
128
  "account.request": (params: {
92
- currencyIds?: string[];
129
+ accounts$?: Observable<WalletAPIAccount[]>;
130
+ currencies: CryptoOrTokenCurrency[];
93
131
  areCurrenciesFiltered?: boolean;
94
132
  useCase?: string;
95
133
  drawerConfiguration?: ModularDrawerConfiguration;
@@ -162,10 +200,11 @@ export interface UiHook {
162
200
  }) => void;
163
201
  }
164
202
 
165
- export function usePermission(manifest: AppManifest): Omit<Permission, "currencyIds"> {
203
+ export function usePermission(manifest: AppManifest): Permission {
166
204
  return useMemo(
167
205
  () => ({
168
- methodIds: manifest.permissions,
206
+ currencyIds: manifest.currencies === "*" ? ["**"] : manifest.currencies,
207
+ methodIds: manifest.permissions as unknown as string[], // TODO remove when using the correct manifest type
169
208
  }),
170
209
  [manifest],
171
210
  );
@@ -195,7 +234,7 @@ export function useConfig({
195
234
  wallet,
196
235
  mevProtected,
197
236
  }),
198
- [appId, mevProtected, tracking, userId, wallet],
237
+ [appId, tracking, userId, wallet],
199
238
  );
200
239
  }
201
240
 
@@ -303,19 +342,18 @@ export function useWalletAPIServer({
303
342
  onLoadError: () => void;
304
343
  widgetLoaded: boolean;
305
344
  } {
306
- const dispatch = useDispatch<ThunkDispatch<any, any, UnknownAction>>();
307
- const { deactivatedCurrencyIds } = useCurrenciesUnderFeatureFlag();
308
345
  const permission = usePermission(manifest);
309
346
  const transport = useTransport(webviewHook.postMessage);
310
347
  const [widgetLoaded, setWidgetLoaded] = useState(false);
311
348
 
312
- // We need to set the wallet API account IDs mapping upfront
313
- // If we don't want the map to be empty when requesting an account
314
- useSetWalletAPIAccounts(accounts);
349
+ const walletAPIAccounts = useWalletAPIAccounts(walletState, accounts);
350
+ const walletAPICurrencies = useWalletAPICurrencies();
315
351
 
316
352
  const { server, onMessage } = useWalletAPIServerRaw({
317
353
  transport,
318
354
  config,
355
+ accounts: walletAPIAccounts,
356
+ currencies: walletAPICurrencies,
319
357
  permission,
320
358
  customHandlers,
321
359
  });
@@ -324,257 +362,52 @@ export function useWalletAPIServer({
324
362
  tracking.load(manifest);
325
363
  }, [tracking, manifest]);
326
364
 
327
- // TODO: refactor each handler into its own logic function for clarity
328
- useEffect(() => {
329
- server.setHandler("currency.list", async ({ currencyIds }) => {
330
- tracking.currencyListRequested(manifest);
331
-
332
- try {
333
- // 1. Parse manifest currency patterns to determine what to include
334
- const manifestCurrencyIds = manifest.currencies === "*" ? ["**"] : manifest.currencies;
335
-
336
- // 2. Apply query filter early - intersect with manifest patterns
337
- const queryCurrencyIdsSet = currencyIds ? new Set(currencyIds) : undefined;
338
- let effectiveCurrencyIds = manifestCurrencyIds;
339
-
340
- if (queryCurrencyIdsSet) {
341
- // If we have a query filter, narrow down what we need to fetch
342
- effectiveCurrencyIds = manifestCurrencyIds.flatMap(manifestId => {
343
- if (manifestId === "**") {
344
- // Query can ask for anything, so use the query list
345
- return [...queryCurrencyIdsSet];
346
- } else if (manifestId.endsWith("/**")) {
347
- // Pattern like "ethereum/**" - keep tokens from query that match this family
348
- const family = manifestId.slice(0, -3);
349
- return [...queryCurrencyIdsSet].filter(qId => qId.startsWith(`${family}/`));
350
- } else if (queryCurrencyIdsSet.has(manifestId)) {
351
- // Specific currency/token that's in the query
352
- return [manifestId];
353
- }
354
- // Not in query, skip it
355
- return [];
356
- });
357
- }
358
-
359
- // 3. Parse effective currency IDs to determine what to fetch
360
- const includeAllCurrencies = effectiveCurrencyIds.includes("**");
361
- const specificCurrencies = new Set<string>();
362
- const tokenFamilies = new Set<string>();
363
- const specificTokenIds = new Set<string>();
364
-
365
- for (const id of effectiveCurrencyIds) {
366
- if (id === "**") {
367
- // Already handled above
368
- continue;
369
- } else if (id.endsWith("/**")) {
370
- // Pattern like "ethereum/**" or "solana/**" - include tokens for this family
371
- const family = id.slice(0, -3);
372
- tokenFamilies.add(family);
373
- } else if (id.includes("/")) {
374
- // Specific token ID like "ethereum/erc20/usd__coin"
375
- specificTokenIds.add(id);
376
- } else {
377
- // Specific currency like "bitcoin" or "ethereum"
378
- specificCurrencies.add(id);
379
- }
380
- }
381
-
382
- // 4. Gather all supported parent currencies
383
- const allCurrencies = listSupportedCurrencies().reduce<WalletAPICurrency[]>((acc, c) => {
384
- if (isWalletAPISupportedCurrency(c) && !deactivatedCurrencyIds.has(c.id))
385
- acc.push(currencyToWalletAPICurrency(c));
386
- return acc;
387
- }, []);
388
-
389
- // 5. Determine which currencies to include based on patterns
390
- let includedCurrencies: WalletAPICurrency[] = [];
391
- if (includeAllCurrencies) {
392
- includedCurrencies = allCurrencies;
393
- } else {
394
- includedCurrencies = allCurrencies.filter(c => specificCurrencies.has(c.id));
395
- }
396
-
397
- // 6. Fetch specific tokens by ID if any
398
- const specificTokens: WalletAPICurrency[] = [];
399
- if (specificTokenIds.size > 0) {
400
- const tokenPromises = [...specificTokenIds].map(async tokenId => {
401
- const token = await getCryptoAssetsStore().findTokenById(tokenId);
402
- return token ? currencyToWalletAPICurrency(token) : null;
403
- });
404
- const resolvedTokens = await Promise.all(tokenPromises);
405
- specificTokens.push(...resolvedTokens.filter((t): t is WalletAPICurrency => t !== null));
406
- }
407
-
408
- // 7. Determine which token families to fetch (only if not already fetched as specific tokens)
409
- const familiesToFetch = new Set<string>();
410
- if (includeAllCurrencies) {
411
- // Fetch tokens for all currency families
412
- allCurrencies.forEach(c => {
413
- if (c.type === "CryptoCurrency") familiesToFetch.add(c.family);
414
- });
415
- } else if (tokenFamilies.size > 0) {
416
- // Only fetch tokens for families explicitly marked with /**
417
- tokenFamilies.forEach(family => familiesToFetch.add(family));
418
- }
419
-
420
- // 8. Fetch tokens for relevant families
421
- const fetchAllPagesForFamily = async (family: string) => {
422
- const args = { networkFamily: family, pageSize: 1000 };
423
- let hasNextPage = true;
424
- let data: InfiniteData<TokensDataWithPagination, PageParam> | undefined;
425
-
426
- while (hasNextPage) {
427
- const querySub = dispatch(
428
- calEndpoints.getTokensData.initiate(
429
- args,
430
- data ? { direction: "forward" } : undefined,
431
- ),
432
- );
433
-
434
- try {
435
- const result = await querySub;
436
- data = result.data;
437
- hasNextPage = result.hasNextPage;
438
- if (result.error) throw result.error;
439
- } finally {
440
- querySub.unsubscribe();
441
- }
442
- }
443
-
444
- return (data?.pages ?? []).flatMap(p => p.tokens);
445
- };
446
-
447
- const tokensByFamily = await Promise.all(
448
- [...familiesToFetch].map(f => fetchAllPagesForFamily(f)),
449
- );
450
-
451
- // 9. Combine all results (no additional filter needed since we pre-filtered)
452
- const result = tokensByFamily.reduce<WalletAPICurrency[]>(
453
- (acc, tokens) => [...acc, ...tokens.map(t => currencyToWalletAPICurrency(t))],
454
- [...includedCurrencies, ...specificTokens],
455
- );
456
-
457
- tracking.currencyListSuccess(manifest);
458
- return result;
459
- } catch (err) {
460
- tracking.currencyListFail(manifest);
461
- throw err;
462
- }
463
- });
464
- }, [walletState, manifest, server, tracking, dispatch, deactivatedCurrencyIds]);
465
-
466
- useEffect(() => {
467
- server.setHandler("account.list", ({ currencyIds }) => {
468
- tracking.accountListRequested(manifest);
469
-
470
- try {
471
- // 1. Parse manifest currency patterns to determine what to include
472
- const manifestCurrencyIds = manifest.currencies === "*" ? ["**"] : manifest.currencies;
473
-
474
- // 2. Apply query filter early - intersect with manifest patterns
475
- const queryCurrencyIdsSet = currencyIds ? new Set(currencyIds) : undefined;
476
- let effectiveCurrencyIds = manifestCurrencyIds;
477
-
478
- if (queryCurrencyIdsSet) {
479
- // If we have a query filter, narrow down what we need to check
480
- effectiveCurrencyIds = manifestCurrencyIds.flatMap(manifestId => {
481
- if (manifestId === "**") {
482
- // Query can ask for anything, so use the query list
483
- return [...queryCurrencyIdsSet];
484
- } else if (manifestId.endsWith("/**")) {
485
- // Pattern like "ethereum/**" - keep tokens from query that match this family
486
- const family = manifestId.slice(0, -3);
487
- return [...queryCurrencyIdsSet].filter(qId => qId.startsWith(`${family}/`));
488
- } else if (queryCurrencyIdsSet.has(manifestId)) {
489
- // Specific currency/token that's in the query
490
- return [manifestId];
491
- }
492
- // Not in query, skip it
493
- return [];
494
- });
495
- }
496
-
497
- // 3. Build a set of allowed currency IDs based on effective patterns
498
- const allowedCurrencyIds = new Set<string>();
499
- const includeAllCurrencies = effectiveCurrencyIds.includes("**");
500
- const tokenFamilyPrefixes = new Set<string>();
501
-
502
- for (const id of effectiveCurrencyIds) {
503
- if (id === "**") {
504
- // Will match all currencies
505
- continue;
506
- } else if (id.endsWith("/**")) {
507
- // Pattern like "ethereum/**" - store prefix for matching
508
- const family = id.slice(0, -3);
509
- tokenFamilyPrefixes.add(family);
510
- } else {
511
- // Specific currency/token ID
512
- allowedCurrencyIds.add(id);
513
- }
514
- }
515
-
516
- // 4. Filter accounts based on effective currency IDs
517
- const wapiAccounts = accounts.reduce<WalletAPIAccount[]>((acc, account) => {
518
- const parentAccount = getParentAccount(account, accounts);
519
- const accountCurrencyId =
520
- account.type === "TokenAccount" ? account.token.id : account.currency.id;
521
- const parentCurrencyId =
522
- account.type === "TokenAccount" ? account.token.parentCurrency.id : account.currency.id;
523
-
524
- // Check if account currency ID matches the effective patterns
525
- const isAllowed =
526
- includeAllCurrencies ||
527
- allowedCurrencyIds.has(accountCurrencyId) ||
528
- tokenFamilyPrefixes.has(parentCurrencyId);
529
-
530
- if (isAllowed) {
531
- acc.push(accountToWalletAPIAccount(walletState, account, parentAccount));
532
- }
533
-
534
- return acc;
535
- }, []);
536
-
537
- tracking.accountListSuccess(manifest);
538
- return wapiAccounts;
539
- } catch (err) {
540
- tracking.accountListFail(manifest);
541
- throw err;
542
- }
543
- });
544
- }, [walletState, manifest, server, tracking, uiAccountRequest, accounts]);
545
-
546
365
  useEffect(() => {
547
366
  if (!uiAccountRequest) return;
548
367
 
549
368
  server.setHandler(
550
369
  "account.request",
551
- async ({ currencyIds, drawerConfiguration, areCurrenciesFiltered, useCase }) => {
370
+ async ({ accounts$, currencies$, drawerConfiguration, areCurrenciesFiltered, useCase }) => {
552
371
  tracking.requestAccountRequested(manifest);
372
+ const currencies = await firstValueFrom(currencies$);
373
+
553
374
  return new Promise((resolve, reject) => {
554
- let done = false;
555
- try {
556
- uiAccountRequest({
557
- currencyIds,
558
- drawerConfiguration,
559
- areCurrenciesFiltered,
560
- useCase,
561
- onSuccess: (account: AccountLike, parentAccount: Account | undefined) => {
562
- if (done) return;
563
- done = true;
564
- tracking.requestAccountSuccess(manifest);
565
- resolve(accountToWalletAPIAccount(walletState, account, parentAccount));
566
- },
567
- onCancel: () => {
568
- if (done) return;
569
- done = true;
570
- tracking.requestAccountFail(manifest);
571
- reject(new Error("Canceled by user"));
572
- },
573
- });
574
- } catch (error) {
575
- tracking.requestAccountFail(manifest);
576
- reject(error);
577
- }
375
+ (async () => {
376
+ try {
377
+ // handle no curencies selected case
378
+ const currencyList: CryptoOrTokenCurrency[] = [];
379
+ for (const { id } of currencies) {
380
+ const currency =
381
+ findCryptoCurrencyById(id) || (await getCryptoAssetsStore().findTokenById(id));
382
+ if (currency) {
383
+ currencyList.push(currency);
384
+ }
385
+ }
386
+
387
+ let done = false;
388
+ uiAccountRequest({
389
+ accounts$,
390
+ currencies: currencyList,
391
+ drawerConfiguration,
392
+ areCurrenciesFiltered,
393
+ useCase,
394
+ onSuccess: (account: AccountLike, parentAccount: Account | undefined) => {
395
+ if (done) return;
396
+ done = true;
397
+ tracking.requestAccountSuccess(manifest);
398
+ resolve(accountToWalletAPIAccount(walletState, account, parentAccount));
399
+ },
400
+ onCancel: () => {
401
+ if (done) return;
402
+ done = true;
403
+ tracking.requestAccountFail(manifest);
404
+ reject(new Error("Canceled by user"));
405
+ },
406
+ });
407
+ } catch (error) {
408
+ reject(error);
409
+ }
410
+ })();
578
411
  });
579
412
  },
580
413
  );
@@ -583,11 +416,11 @@ export function useWalletAPIServer({
583
416
  useEffect(() => {
584
417
  if (!uiAccountReceive) return;
585
418
 
586
- server.setHandler("account.receive", ({ accountId, tokenCurrency }) =>
419
+ server.setHandler("account.receive", ({ account, tokenCurrency }) =>
587
420
  receiveOnAccountLogic(
588
421
  walletState,
589
422
  { manifest, accounts, tracking },
590
- accountId,
423
+ account.id,
591
424
  (account, parentAccount, accountAddress) =>
592
425
  new Promise((resolve, reject) => {
593
426
  let done = false;
@@ -623,10 +456,10 @@ export function useWalletAPIServer({
623
456
  useEffect(() => {
624
457
  if (!uiMessageSign) return;
625
458
 
626
- server.setHandler("message.sign", ({ accountId, message, options }) =>
459
+ server.setHandler("message.sign", ({ account, message, options }) =>
627
460
  signMessageLogic(
628
461
  { manifest, accounts, tracking },
629
- accountId,
462
+ account.id,
630
463
  message.toString("hex"),
631
464
  (account: AccountLike, message: AnyMessage) =>
632
465
  new Promise((resolve, reject) => {
@@ -680,18 +513,13 @@ export function useWalletAPIServer({
680
513
 
681
514
  server.setHandler(
682
515
  "transaction.sign",
683
- async ({ accountId, tokenCurrency, transaction, options }) => {
684
- let currency: string | undefined;
516
+ async ({ account, tokenCurrency, transaction, options }) => {
685
517
  const signedOperation = await signTransactionLogic(
686
518
  { manifest, accounts, tracking },
687
- accountId,
519
+ account.id,
688
520
  transaction,
689
- (account, parentAccount, signFlowInfos) => {
690
- currency =
691
- account.type === "TokenAccount"
692
- ? account.token.parentCurrency.id
693
- : account.currency.id;
694
- return new Promise((resolve, reject) => {
521
+ (account, parentAccount, signFlowInfos) =>
522
+ new Promise((resolve, reject) => {
695
523
  let done = false;
696
524
  return uiTxSign({
697
525
  account,
@@ -711,12 +539,11 @@ export function useWalletAPIServer({
711
539
  reject(error);
712
540
  },
713
541
  });
714
- });
715
- },
542
+ }),
716
543
  tokenCurrency,
717
544
  );
718
545
 
719
- return currency === "solana"
546
+ return account.currency === "solana"
720
547
  ? Buffer.from(signedOperation.signature, "hex")
721
548
  : Buffer.from(signedOperation.signature);
722
549
  },
@@ -728,10 +555,10 @@ export function useWalletAPIServer({
728
555
 
729
556
  server.setHandler(
730
557
  "transaction.signRaw",
731
- async ({ accountId, transaction, broadcast, options }) => {
558
+ async ({ account, transaction, broadcast, options }) => {
732
559
  const signedOperation = await signRawTransactionLogic(
733
560
  { manifest, accounts, tracking },
734
- accountId,
561
+ account.id,
735
562
  transaction,
736
563
  (account, parentAccount, tx) =>
737
564
  new Promise((resolve, reject) => {
@@ -761,7 +588,7 @@ export function useWalletAPIServer({
761
588
  if (broadcast) {
762
589
  hash = await broadcastTransactionLogic(
763
590
  { manifest, accounts, tracking },
764
- accountId,
591
+ account.id,
765
592
  signedOperation,
766
593
  async (account, parentAccount, signedOperation) => {
767
594
  const bridge = getAccountBridge(account, parentAccount);
@@ -804,12 +631,12 @@ export function useWalletAPIServer({
804
631
 
805
632
  server.setHandler(
806
633
  "transaction.signAndBroadcast",
807
- async ({ accountId, tokenCurrency, transaction, options }) => {
634
+ async ({ account, tokenCurrency, transaction, options }) => {
808
635
  const sponsored = transaction.family === "ethereum" && transaction.sponsored;
809
636
 
810
637
  const signedTransaction = await signTransactionLogic(
811
638
  { manifest, accounts, tracking },
812
- accountId,
639
+ account.id,
813
640
  transaction,
814
641
  (account, parentAccount, signFlowInfos) =>
815
642
  new Promise((resolve, reject) => {
@@ -838,7 +665,7 @@ export function useWalletAPIServer({
838
665
 
839
666
  return broadcastTransactionLogic(
840
667
  { manifest, accounts, tracking },
841
- accountId,
668
+ account.id,
842
669
  signedTransaction,
843
670
  async (account, parentAccount, signedOperation) => {
844
671
  const bridge = getAccountBridge(account, parentAccount);
@@ -1102,8 +929,8 @@ export function useWalletAPIServer({
1102
929
  // retrofit of the exchange params to fit the old platform spec
1103
930
  const request: CompleteExchangeRequest = {
1104
931
  provider: params.provider,
1105
- fromAccountId: params.fromAccountId,
1106
- toAccountId: params.exchangeType === "SWAP" ? params.toAccountId : undefined,
932
+ fromAccountId: params.fromAccount.id,
933
+ toAccountId: params.exchangeType === "SWAP" ? params.toAccount.id : undefined,
1107
934
  transaction: params.transaction,
1108
935
  binaryPayload: params.binaryPayload.toString("hex"),
1109
936
  signature: params.signature.toString("hex"),
@@ -1141,7 +968,7 @@ export function useWalletAPIServer({
1141
968
  }, [uiExchangeComplete, accounts, manifest, server, tracking]);
1142
969
 
1143
970
  return {
1144
- widgetLoaded: widgetLoaded,
971
+ widgetLoaded,
1145
972
  onMessage,
1146
973
  onLoad,
1147
974
  onReload,
@@ -1344,9 +1171,9 @@ export function useRecentlyUsed(
1344
1171
  ...res,
1345
1172
  usedAt: calculateTimeDiff(recentlyUsed.usedAt),
1346
1173
  }
1347
- : undefined;
1174
+ : res;
1348
1175
  })
1349
- .filter((manifest): manifest is RecentlyUsedManifest => manifest !== undefined),
1176
+ .filter(manifest => manifest !== undefined) as RecentlyUsedManifest[],
1350
1177
  [recentlyUsedManifestsDb, manifests],
1351
1178
  );
1352
1179
  const append = useCallback(
@@ -241,28 +241,6 @@ export default function trackingWrapper(trackCall: TrackWalletAPI) {
241
241
  track("WalletAPI bitcoin family account xpub success", getEventData(manifest));
242
242
  },
243
243
 
244
- // currency.list handler tracking
245
- currencyListRequested: (manifest: AppManifest) => {
246
- track("WalletAPI CurrencyList requested", getEventData(manifest));
247
- },
248
- currencyListSuccess: (manifest: AppManifest) => {
249
- track("WalletAPI CurrencyList success", getEventData(manifest));
250
- },
251
- currencyListFail: (manifest: AppManifest) => {
252
- track("WalletAPI CurrencyList fail", getEventData(manifest));
253
- },
254
-
255
- // account.list handler tracking
256
- accountListRequested: (manifest: AppManifest) => {
257
- track("WalletAPI AccountList requested", getEventData(manifest));
258
- },
259
- accountListSuccess: (manifest: AppManifest) => {
260
- track("WalletAPI AccountList success", getEventData(manifest));
261
- },
262
- accountListFail: (manifest: AppManifest) => {
263
- track("WalletAPI AccountList fail", getEventData(manifest));
264
- },
265
-
266
244
  dappSendTransactionRequested: (manifest: AppManifest, trackingData: DAppTrackingData) => {
267
245
  track("dApp SendTransaction requested", { ...getEventData(manifest), ...trackingData });
268
246
  },
@@ -83,8 +83,3 @@ export type DAppTrackingData = {
83
83
  currency: string;
84
84
  network: CryptoCurrency["id"];
85
85
  };
86
-
87
- export type AccountIdFormat = "uuid" | "encoded";
88
-
89
- /** @developer note uuid = wallet API id format, encoded = ledger wallet default format */
90
- export type AccountIdFormatsResponse = Record<string, AccountIdFormat>;