@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
@@ -3,26 +3,24 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.useDisclaimerRaw = exports.useRecentlyUsed = exports.useCacheBustedLiveApps = exports.useLocalLiveApp = exports.useCategories = exports.ExchangeType = exports.useWalletAPIServer = exports.useConfig = exports.usePermission = exports.useDAppManifestCurrencyIds = exports.useSetWalletAPIAccounts = exports.safeGetRefValue = void 0;
6
+ exports.useDisclaimerRaw = exports.useRecentlyUsed = exports.useCacheBustedLiveApps = exports.useLocalLiveApp = exports.useCategories = exports.ExchangeType = exports.useWalletAPIServer = exports.useConfig = exports.usePermission = exports.useGetAccountIds = exports.useManifestCurrencies = exports.useWalletAPICurrencies = exports.useWalletAPIAccounts = exports.safeGetRefValue = void 0;
7
7
  const react_1 = require("react");
8
- const react_redux_1 = require("react-redux");
9
8
  const semver_1 = __importDefault(require("semver"));
10
9
  const date_fns_1 = require("date-fns");
11
- const wallet_api_server_1 = require("@ledgerhq/wallet-api-server");
10
+ const react_2 = require("@ledgerhq/wallet-api-server/lib/react");
11
+ const rxjs_1 = require("rxjs");
12
12
  const operators_1 = require("rxjs/operators");
13
- const live_env_1 = require("@ledgerhq/live-env");
14
- const errors_1 = require("@ledgerhq/errors");
15
- const api_1 = require("@ledgerhq/cryptoassets/cal-client/state-manager/api");
16
13
  const converters_1 = require("./converters");
17
14
  const helpers_1 = require("./helpers");
18
15
  const account_1 = require("../account");
19
16
  const currencies_1 = require("../currencies");
20
- const crypto_assets_1 = require("../bridge/crypto-assets");
17
+ const index_1 = require("../bridge/crypto-assets/index");
21
18
  const logic_1 = require("./logic");
22
19
  const bridge_1 = require("../bridge");
20
+ const live_env_1 = require("@ledgerhq/live-env");
23
21
  const openTransportAsSubject_1 = __importDefault(require("../hw/openTransportAsSubject"));
22
+ const errors_1 = require("@ledgerhq/errors");
24
23
  const constants_1 = require("./constants");
25
- const useCurrenciesUnderFeatureFlag_1 = require("../modularDrawer/hooks/useCurrenciesUnderFeatureFlag");
26
24
  function safeGetRefValue(ref) {
27
25
  if (!ref.current) {
28
26
  throw new Error("Ref objects doesn't have a current value");
@@ -30,25 +28,62 @@ function safeGetRefValue(ref) {
30
28
  return ref.current;
31
29
  }
32
30
  exports.safeGetRefValue = safeGetRefValue;
33
- function useSetWalletAPIAccounts(accounts) {
34
- (0, react_1.useEffect)(() => {
35
- accounts.forEach(account => {
36
- (0, converters_1.setWalletApiIdForAccountId)(account.id);
31
+ function useWalletAPIAccounts(walletState, accounts) {
32
+ return (0, react_1.useMemo)(() => {
33
+ return accounts.map(account => {
34
+ const parentAccount = (0, account_1.getParentAccount)(account, accounts);
35
+ return (0, converters_1.accountToWalletAPIAccount)(walletState, account, parentAccount);
37
36
  });
38
- }, [accounts]);
37
+ }, [walletState, accounts]);
39
38
  }
40
- exports.useSetWalletAPIAccounts = useSetWalletAPIAccounts;
41
- function useDAppManifestCurrencyIds(manifest) {
39
+ exports.useWalletAPIAccounts = useWalletAPIAccounts;
40
+ function useWalletAPICurrencies() {
41
+ return (0, react_1.useMemo)(() => {
42
+ return (0, currencies_1.listCurrencies)(true).reduce((filtered, currency) => {
43
+ if ((0, helpers_1.isWalletAPISupportedCurrency)(currency)) {
44
+ filtered.push((0, converters_1.currencyToWalletAPICurrency)(currency));
45
+ }
46
+ return filtered;
47
+ }, []);
48
+ }, []);
49
+ }
50
+ exports.useWalletAPICurrencies = useWalletAPICurrencies;
51
+ function useManifestCurrencies(manifest) {
42
52
  return (0, react_1.useMemo)(() => {
43
53
  return (manifest.dapp?.networks.map(network => {
44
- return network.currency;
54
+ return (0, currencies_1.getCryptoCurrencyById)(network.currency);
45
55
  }) ?? []);
46
56
  }, [manifest.dapp?.networks]);
47
57
  }
48
- exports.useDAppManifestCurrencyIds = useDAppManifestCurrencyIds;
58
+ exports.useManifestCurrencies = useManifestCurrencies;
59
+ function useGetAccountIds(accounts$) {
60
+ const [accounts, setAccounts] = (0, react_1.useState)([]);
61
+ (0, react_1.useEffect)(() => {
62
+ if (!accounts$) {
63
+ return undefined;
64
+ }
65
+ const subscription = accounts$.subscribe(walletAccounts => {
66
+ setAccounts(walletAccounts);
67
+ });
68
+ return () => {
69
+ subscription.unsubscribe();
70
+ };
71
+ }, [accounts$]);
72
+ return (0, react_1.useMemo)(() => {
73
+ if (!accounts$) {
74
+ return undefined;
75
+ }
76
+ return accounts.reduce((accountIds, account) => {
77
+ accountIds.set((0, converters_1.getAccountIdFromWalletAccountId)(account.id), true);
78
+ return accountIds;
79
+ }, new Map());
80
+ }, [accounts, accounts$]);
81
+ }
82
+ exports.useGetAccountIds = useGetAccountIds;
49
83
  function usePermission(manifest) {
50
84
  return (0, react_1.useMemo)(() => ({
51
- methodIds: manifest.permissions,
85
+ currencyIds: manifest.currencies === "*" ? ["**"] : manifest.currencies,
86
+ methodIds: manifest.permissions, // TODO remove when using the correct manifest type
52
87
  }), [manifest]);
53
88
  }
54
89
  exports.usePermission = usePermission;
@@ -67,7 +102,7 @@ function useConfig({ appId, userId, tracking, wallet, mevProtected, }) {
67
102
  tracking,
68
103
  wallet,
69
104
  mevProtected,
70
- }), [appId, mevProtected, tracking, userId, wallet]);
105
+ }), [appId, tracking, userId, wallet]);
71
106
  }
72
107
  exports.useConfig = useConfig;
73
108
  function useDeviceTransport({ manifest, tracking }) {
@@ -118,257 +153,73 @@ function useDeviceTransport({ manifest, tracking }) {
118
153
  return (0, react_1.useMemo)(() => ({ ref, subscribe, close, exchange }), [close, exchange, subscribe]);
119
154
  }
120
155
  function useWalletAPIServer({ walletState, manifest, accounts, tracking, config, webviewHook, uiHook: { "account.request": uiAccountRequest, "account.receive": uiAccountReceive, "message.sign": uiMessageSign, "storage.get": uiStorageGet, "storage.set": uiStorageSet, "transaction.sign": uiTxSign, "transaction.signRaw": uiTxSignRaw, "transaction.broadcast": uiTxBroadcast, "device.transport": uiDeviceTransport, "device.select": uiDeviceSelect, "exchange.start": uiExchangeStart, "exchange.complete": uiExchangeComplete, }, customHandlers, }) {
121
- const dispatch = (0, react_redux_1.useDispatch)();
122
- const { deactivatedCurrencyIds } = (0, useCurrenciesUnderFeatureFlag_1.useCurrenciesUnderFeatureFlag)();
123
156
  const permission = usePermission(manifest);
124
157
  const transport = useTransport(webviewHook.postMessage);
125
158
  const [widgetLoaded, setWidgetLoaded] = (0, react_1.useState)(false);
126
- // We need to set the wallet API account IDs mapping upfront
127
- // If we don't want the map to be empty when requesting an account
128
- useSetWalletAPIAccounts(accounts);
129
- const { server, onMessage } = (0, wallet_api_server_1.useWalletAPIServer)({
159
+ const walletAPIAccounts = useWalletAPIAccounts(walletState, accounts);
160
+ const walletAPICurrencies = useWalletAPICurrencies();
161
+ const { server, onMessage } = (0, react_2.useWalletAPIServer)({
130
162
  transport,
131
163
  config,
164
+ accounts: walletAPIAccounts,
165
+ currencies: walletAPICurrencies,
132
166
  permission,
133
167
  customHandlers,
134
168
  });
135
169
  (0, react_1.useEffect)(() => {
136
170
  tracking.load(manifest);
137
171
  }, [tracking, manifest]);
138
- // TODO: refactor each handler into its own logic function for clarity
139
- (0, react_1.useEffect)(() => {
140
- server.setHandler("currency.list", async ({ currencyIds }) => {
141
- tracking.currencyListRequested(manifest);
142
- try {
143
- // 1. Parse manifest currency patterns to determine what to include
144
- const manifestCurrencyIds = manifest.currencies === "*" ? ["**"] : manifest.currencies;
145
- // 2. Apply query filter early - intersect with manifest patterns
146
- const queryCurrencyIdsSet = currencyIds ? new Set(currencyIds) : undefined;
147
- let effectiveCurrencyIds = manifestCurrencyIds;
148
- if (queryCurrencyIdsSet) {
149
- // If we have a query filter, narrow down what we need to fetch
150
- effectiveCurrencyIds = manifestCurrencyIds.flatMap(manifestId => {
151
- if (manifestId === "**") {
152
- // Query can ask for anything, so use the query list
153
- return [...queryCurrencyIdsSet];
154
- }
155
- else if (manifestId.endsWith("/**")) {
156
- // Pattern like "ethereum/**" - keep tokens from query that match this family
157
- const family = manifestId.slice(0, -3);
158
- return [...queryCurrencyIdsSet].filter(qId => qId.startsWith(`${family}/`));
159
- }
160
- else if (queryCurrencyIdsSet.has(manifestId)) {
161
- // Specific currency/token that's in the query
162
- return [manifestId];
163
- }
164
- // Not in query, skip it
165
- return [];
166
- });
167
- }
168
- // 3. Parse effective currency IDs to determine what to fetch
169
- const includeAllCurrencies = effectiveCurrencyIds.includes("**");
170
- const specificCurrencies = new Set();
171
- const tokenFamilies = new Set();
172
- const specificTokenIds = new Set();
173
- for (const id of effectiveCurrencyIds) {
174
- if (id === "**") {
175
- // Already handled above
176
- continue;
177
- }
178
- else if (id.endsWith("/**")) {
179
- // Pattern like "ethereum/**" or "solana/**" - include tokens for this family
180
- const family = id.slice(0, -3);
181
- tokenFamilies.add(family);
182
- }
183
- else if (id.includes("/")) {
184
- // Specific token ID like "ethereum/erc20/usd__coin"
185
- specificTokenIds.add(id);
186
- }
187
- else {
188
- // Specific currency like "bitcoin" or "ethereum"
189
- specificCurrencies.add(id);
190
- }
191
- }
192
- // 4. Gather all supported parent currencies
193
- const allCurrencies = (0, currencies_1.listSupportedCurrencies)().reduce((acc, c) => {
194
- if ((0, helpers_1.isWalletAPISupportedCurrency)(c) && !deactivatedCurrencyIds.has(c.id))
195
- acc.push((0, converters_1.currencyToWalletAPICurrency)(c));
196
- return acc;
197
- }, []);
198
- // 5. Determine which currencies to include based on patterns
199
- let includedCurrencies = [];
200
- if (includeAllCurrencies) {
201
- includedCurrencies = allCurrencies;
202
- }
203
- else {
204
- includedCurrencies = allCurrencies.filter(c => specificCurrencies.has(c.id));
205
- }
206
- // 6. Fetch specific tokens by ID if any
207
- const specificTokens = [];
208
- if (specificTokenIds.size > 0) {
209
- const tokenPromises = [...specificTokenIds].map(async (tokenId) => {
210
- const token = await (0, crypto_assets_1.getCryptoAssetsStore)().findTokenById(tokenId);
211
- return token ? (0, converters_1.currencyToWalletAPICurrency)(token) : null;
212
- });
213
- const resolvedTokens = await Promise.all(tokenPromises);
214
- specificTokens.push(...resolvedTokens.filter((t) => t !== null));
215
- }
216
- // 7. Determine which token families to fetch (only if not already fetched as specific tokens)
217
- const familiesToFetch = new Set();
218
- if (includeAllCurrencies) {
219
- // Fetch tokens for all currency families
220
- allCurrencies.forEach(c => {
221
- if (c.type === "CryptoCurrency")
222
- familiesToFetch.add(c.family);
223
- });
224
- }
225
- else if (tokenFamilies.size > 0) {
226
- // Only fetch tokens for families explicitly marked with /**
227
- tokenFamilies.forEach(family => familiesToFetch.add(family));
228
- }
229
- // 8. Fetch tokens for relevant families
230
- const fetchAllPagesForFamily = async (family) => {
231
- const args = { networkFamily: family, pageSize: 1000 };
232
- let hasNextPage = true;
233
- let data;
234
- while (hasNextPage) {
235
- const querySub = dispatch(api_1.endpoints.getTokensData.initiate(args, data ? { direction: "forward" } : undefined));
236
- try {
237
- const result = await querySub;
238
- data = result.data;
239
- hasNextPage = result.hasNextPage;
240
- if (result.error)
241
- throw result.error;
242
- }
243
- finally {
244
- querySub.unsubscribe();
245
- }
246
- }
247
- return (data?.pages ?? []).flatMap(p => p.tokens);
248
- };
249
- const tokensByFamily = await Promise.all([...familiesToFetch].map(f => fetchAllPagesForFamily(f)));
250
- // 9. Combine all results (no additional filter needed since we pre-filtered)
251
- const result = tokensByFamily.reduce((acc, tokens) => [...acc, ...tokens.map(t => (0, converters_1.currencyToWalletAPICurrency)(t))], [...includedCurrencies, ...specificTokens]);
252
- tracking.currencyListSuccess(manifest);
253
- return result;
254
- }
255
- catch (err) {
256
- tracking.currencyListFail(manifest);
257
- throw err;
258
- }
259
- });
260
- }, [walletState, manifest, server, tracking, dispatch, deactivatedCurrencyIds]);
261
- (0, react_1.useEffect)(() => {
262
- server.setHandler("account.list", ({ currencyIds }) => {
263
- tracking.accountListRequested(manifest);
264
- try {
265
- // 1. Parse manifest currency patterns to determine what to include
266
- const manifestCurrencyIds = manifest.currencies === "*" ? ["**"] : manifest.currencies;
267
- // 2. Apply query filter early - intersect with manifest patterns
268
- const queryCurrencyIdsSet = currencyIds ? new Set(currencyIds) : undefined;
269
- let effectiveCurrencyIds = manifestCurrencyIds;
270
- if (queryCurrencyIdsSet) {
271
- // If we have a query filter, narrow down what we need to check
272
- effectiveCurrencyIds = manifestCurrencyIds.flatMap(manifestId => {
273
- if (manifestId === "**") {
274
- // Query can ask for anything, so use the query list
275
- return [...queryCurrencyIdsSet];
276
- }
277
- else if (manifestId.endsWith("/**")) {
278
- // Pattern like "ethereum/**" - keep tokens from query that match this family
279
- const family = manifestId.slice(0, -3);
280
- return [...queryCurrencyIdsSet].filter(qId => qId.startsWith(`${family}/`));
281
- }
282
- else if (queryCurrencyIdsSet.has(manifestId)) {
283
- // Specific currency/token that's in the query
284
- return [manifestId];
285
- }
286
- // Not in query, skip it
287
- return [];
288
- });
289
- }
290
- // 3. Build a set of allowed currency IDs based on effective patterns
291
- const allowedCurrencyIds = new Set();
292
- const includeAllCurrencies = effectiveCurrencyIds.includes("**");
293
- const tokenFamilyPrefixes = new Set();
294
- for (const id of effectiveCurrencyIds) {
295
- if (id === "**") {
296
- // Will match all currencies
297
- continue;
298
- }
299
- else if (id.endsWith("/**")) {
300
- // Pattern like "ethereum/**" - store prefix for matching
301
- const family = id.slice(0, -3);
302
- tokenFamilyPrefixes.add(family);
303
- }
304
- else {
305
- // Specific currency/token ID
306
- allowedCurrencyIds.add(id);
307
- }
308
- }
309
- // 4. Filter accounts based on effective currency IDs
310
- const wapiAccounts = accounts.reduce((acc, account) => {
311
- const parentAccount = (0, account_1.getParentAccount)(account, accounts);
312
- const accountCurrencyId = account.type === "TokenAccount" ? account.token.id : account.currency.id;
313
- const parentCurrencyId = account.type === "TokenAccount" ? account.token.parentCurrency.id : account.currency.id;
314
- // Check if account currency ID matches the effective patterns
315
- const isAllowed = includeAllCurrencies ||
316
- allowedCurrencyIds.has(accountCurrencyId) ||
317
- tokenFamilyPrefixes.has(parentCurrencyId);
318
- if (isAllowed) {
319
- acc.push((0, converters_1.accountToWalletAPIAccount)(walletState, account, parentAccount));
320
- }
321
- return acc;
322
- }, []);
323
- tracking.accountListSuccess(manifest);
324
- return wapiAccounts;
325
- }
326
- catch (err) {
327
- tracking.accountListFail(manifest);
328
- throw err;
329
- }
330
- });
331
- }, [walletState, manifest, server, tracking, uiAccountRequest, accounts]);
332
172
  (0, react_1.useEffect)(() => {
333
173
  if (!uiAccountRequest)
334
174
  return;
335
- server.setHandler("account.request", async ({ currencyIds, drawerConfiguration, areCurrenciesFiltered, useCase }) => {
175
+ server.setHandler("account.request", async ({ accounts$, currencies$, drawerConfiguration, areCurrenciesFiltered, useCase }) => {
336
176
  tracking.requestAccountRequested(manifest);
177
+ const currencies = await (0, rxjs_1.firstValueFrom)(currencies$);
337
178
  return new Promise((resolve, reject) => {
338
- let done = false;
339
- try {
340
- uiAccountRequest({
341
- currencyIds,
342
- drawerConfiguration,
343
- areCurrenciesFiltered,
344
- useCase,
345
- onSuccess: (account, parentAccount) => {
346
- if (done)
347
- return;
348
- done = true;
349
- tracking.requestAccountSuccess(manifest);
350
- resolve((0, converters_1.accountToWalletAPIAccount)(walletState, account, parentAccount));
351
- },
352
- onCancel: () => {
353
- if (done)
354
- return;
355
- done = true;
356
- tracking.requestAccountFail(manifest);
357
- reject(new Error("Canceled by user"));
358
- },
359
- });
360
- }
361
- catch (error) {
362
- tracking.requestAccountFail(manifest);
363
- reject(error);
364
- }
179
+ (async () => {
180
+ try {
181
+ // handle no curencies selected case
182
+ const currencyList = [];
183
+ for (const { id } of currencies) {
184
+ const currency = (0, currencies_1.findCryptoCurrencyById)(id) || (await (0, index_1.getCryptoAssetsStore)().findTokenById(id));
185
+ if (currency) {
186
+ currencyList.push(currency);
187
+ }
188
+ }
189
+ let done = false;
190
+ uiAccountRequest({
191
+ accounts$,
192
+ currencies: currencyList,
193
+ drawerConfiguration,
194
+ areCurrenciesFiltered,
195
+ useCase,
196
+ onSuccess: (account, parentAccount) => {
197
+ if (done)
198
+ return;
199
+ done = true;
200
+ tracking.requestAccountSuccess(manifest);
201
+ resolve((0, converters_1.accountToWalletAPIAccount)(walletState, account, parentAccount));
202
+ },
203
+ onCancel: () => {
204
+ if (done)
205
+ return;
206
+ done = true;
207
+ tracking.requestAccountFail(manifest);
208
+ reject(new Error("Canceled by user"));
209
+ },
210
+ });
211
+ }
212
+ catch (error) {
213
+ reject(error);
214
+ }
215
+ })();
365
216
  });
366
217
  });
367
218
  }, [walletState, manifest, server, tracking, uiAccountRequest]);
368
219
  (0, react_1.useEffect)(() => {
369
220
  if (!uiAccountReceive)
370
221
  return;
371
- server.setHandler("account.receive", ({ accountId, tokenCurrency }) => (0, logic_1.receiveOnAccountLogic)(walletState, { manifest, accounts, tracking }, accountId, (account, parentAccount, accountAddress) => new Promise((resolve, reject) => {
222
+ server.setHandler("account.receive", ({ account, tokenCurrency }) => (0, logic_1.receiveOnAccountLogic)(walletState, { manifest, accounts, tracking }, account.id, (account, parentAccount, accountAddress) => new Promise((resolve, reject) => {
372
223
  let done = false;
373
224
  return uiAccountReceive({
374
225
  account,
@@ -401,7 +252,7 @@ function useWalletAPIServer({ walletState, manifest, accounts, tracking, config,
401
252
  (0, react_1.useEffect)(() => {
402
253
  if (!uiMessageSign)
403
254
  return;
404
- server.setHandler("message.sign", ({ accountId, message, options }) => (0, logic_1.signMessageLogic)({ manifest, accounts, tracking }, accountId, message.toString("hex"), (account, message) => new Promise((resolve, reject) => {
255
+ server.setHandler("message.sign", ({ account, message, options }) => (0, logic_1.signMessageLogic)({ manifest, accounts, tracking }, account.id, message.toString("hex"), (account, message) => new Promise((resolve, reject) => {
405
256
  let done = false;
406
257
  return uiMessageSign({
407
258
  account,
@@ -446,38 +297,31 @@ function useWalletAPIServer({ walletState, manifest, accounts, tracking, config,
446
297
  (0, react_1.useEffect)(() => {
447
298
  if (!uiTxSign)
448
299
  return;
449
- server.setHandler("transaction.sign", async ({ accountId, tokenCurrency, transaction, options }) => {
450
- let currency;
451
- const signedOperation = await (0, logic_1.signTransactionLogic)({ manifest, accounts, tracking }, accountId, transaction, (account, parentAccount, signFlowInfos) => {
452
- currency =
453
- account.type === "TokenAccount"
454
- ? account.token.parentCurrency.id
455
- : account.currency.id;
456
- return new Promise((resolve, reject) => {
457
- let done = false;
458
- return uiTxSign({
459
- account,
460
- parentAccount,
461
- signFlowInfos,
462
- options,
463
- onSuccess: signedOperation => {
464
- if (done)
465
- return;
466
- done = true;
467
- tracking.signTransactionSuccess(manifest);
468
- resolve(signedOperation);
469
- },
470
- onError: error => {
471
- if (done)
472
- return;
473
- done = true;
474
- tracking.signTransactionFail(manifest);
475
- reject(error);
476
- },
477
- });
300
+ server.setHandler("transaction.sign", async ({ account, tokenCurrency, transaction, options }) => {
301
+ const signedOperation = await (0, logic_1.signTransactionLogic)({ manifest, accounts, tracking }, account.id, transaction, (account, parentAccount, signFlowInfos) => new Promise((resolve, reject) => {
302
+ let done = false;
303
+ return uiTxSign({
304
+ account,
305
+ parentAccount,
306
+ signFlowInfos,
307
+ options,
308
+ onSuccess: signedOperation => {
309
+ if (done)
310
+ return;
311
+ done = true;
312
+ tracking.signTransactionSuccess(manifest);
313
+ resolve(signedOperation);
314
+ },
315
+ onError: error => {
316
+ if (done)
317
+ return;
318
+ done = true;
319
+ tracking.signTransactionFail(manifest);
320
+ reject(error);
321
+ },
478
322
  });
479
- }, tokenCurrency);
480
- return currency === "solana"
323
+ }), tokenCurrency);
324
+ return account.currency === "solana"
481
325
  ? Buffer.from(signedOperation.signature, "hex")
482
326
  : Buffer.from(signedOperation.signature);
483
327
  });
@@ -485,8 +329,8 @@ function useWalletAPIServer({ walletState, manifest, accounts, tracking, config,
485
329
  (0, react_1.useEffect)(() => {
486
330
  if (!uiTxSignRaw)
487
331
  return;
488
- server.setHandler("transaction.signRaw", async ({ accountId, transaction, broadcast, options }) => {
489
- const signedOperation = await (0, logic_1.signRawTransactionLogic)({ manifest, accounts, tracking }, accountId, transaction, (account, parentAccount, tx) => new Promise((resolve, reject) => {
332
+ server.setHandler("transaction.signRaw", async ({ account, transaction, broadcast, options }) => {
333
+ const signedOperation = await (0, logic_1.signRawTransactionLogic)({ manifest, accounts, tracking }, account.id, transaction, (account, parentAccount, tx) => new Promise((resolve, reject) => {
490
334
  let done = false;
491
335
  return uiTxSignRaw({
492
336
  account,
@@ -511,7 +355,7 @@ function useWalletAPIServer({ walletState, manifest, accounts, tracking, config,
511
355
  }));
512
356
  let hash;
513
357
  if (broadcast) {
514
- hash = await (0, logic_1.broadcastTransactionLogic)({ manifest, accounts, tracking }, accountId, signedOperation, async (account, parentAccount, signedOperation) => {
358
+ hash = await (0, logic_1.broadcastTransactionLogic)({ manifest, accounts, tracking }, account.id, signedOperation, async (account, parentAccount, signedOperation) => {
515
359
  const bridge = (0, bridge_1.getAccountBridge)(account, parentAccount);
516
360
  const mainAccount = (0, account_1.getMainAccount)(account, parentAccount);
517
361
  let optimisticOperation = signedOperation.operation;
@@ -543,9 +387,9 @@ function useWalletAPIServer({ walletState, manifest, accounts, tracking, config,
543
387
  (0, react_1.useEffect)(() => {
544
388
  if (!uiTxSign)
545
389
  return;
546
- server.setHandler("transaction.signAndBroadcast", async ({ accountId, tokenCurrency, transaction, options }) => {
390
+ server.setHandler("transaction.signAndBroadcast", async ({ account, tokenCurrency, transaction, options }) => {
547
391
  const sponsored = transaction.family === "ethereum" && transaction.sponsored;
548
- const signedTransaction = await (0, logic_1.signTransactionLogic)({ manifest, accounts, tracking }, accountId, transaction, (account, parentAccount, signFlowInfos) => new Promise((resolve, reject) => {
392
+ const signedTransaction = await (0, logic_1.signTransactionLogic)({ manifest, accounts, tracking }, account.id, transaction, (account, parentAccount, signFlowInfos) => new Promise((resolve, reject) => {
549
393
  let done = false;
550
394
  return uiTxSign({
551
395
  account,
@@ -568,7 +412,7 @@ function useWalletAPIServer({ walletState, manifest, accounts, tracking, config,
568
412
  },
569
413
  });
570
414
  }), tokenCurrency);
571
- return (0, logic_1.broadcastTransactionLogic)({ manifest, accounts, tracking }, accountId, signedTransaction, async (account, parentAccount, signedOperation) => {
415
+ return (0, logic_1.broadcastTransactionLogic)({ manifest, accounts, tracking }, account.id, signedTransaction, async (account, parentAccount, signedOperation) => {
572
416
  const bridge = (0, bridge_1.getAccountBridge)(account, parentAccount);
573
417
  const mainAccount = (0, account_1.getMainAccount)(account, parentAccount);
574
418
  let optimisticOperation = signedOperation.operation;
@@ -774,8 +618,8 @@ function useWalletAPIServer({ walletState, manifest, accounts, tracking, config,
774
618
  // retrofit of the exchange params to fit the old platform spec
775
619
  const request = {
776
620
  provider: params.provider,
777
- fromAccountId: params.fromAccountId,
778
- toAccountId: params.exchangeType === "SWAP" ? params.toAccountId : undefined,
621
+ fromAccountId: params.fromAccount.id,
622
+ toAccountId: params.exchangeType === "SWAP" ? params.toAccount.id : undefined,
779
623
  transaction: params.transaction,
780
624
  binaryPayload: params.binaryPayload.toString("hex"),
781
625
  signature: params.signature.toString("hex"),
@@ -808,7 +652,7 @@ function useWalletAPIServer({ walletState, manifest, accounts, tracking, config,
808
652
  });
809
653
  }, [uiExchangeComplete, accounts, manifest, server, tracking]);
810
654
  return {
811
- widgetLoaded: widgetLoaded,
655
+ widgetLoaded,
812
656
  onMessage,
813
657
  onLoad,
814
658
  onReload,
@@ -932,9 +776,9 @@ function useRecentlyUsed(manifests, [recentlyUsedManifestsDb, setState]) {
932
776
  ...res,
933
777
  usedAt: calculateTimeDiff(recentlyUsed.usedAt),
934
778
  }
935
- : undefined;
779
+ : res;
936
780
  })
937
- .filter((manifest) => manifest !== undefined), [recentlyUsedManifestsDb, manifests]);
781
+ .filter(manifest => manifest !== undefined), [recentlyUsedManifestsDb, manifests]);
938
782
  const append = (0, react_1.useCallback)((manifest) => {
939
783
  setState(state => {
940
784
  const index = state.recentlyUsed.findIndex(({ id }) => id === manifest.id);