@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,45 +1,78 @@
1
1
  import { useMemo, useState, useEffect, useRef, useCallback } from "react";
2
- import { useDispatch } from "react-redux";
3
2
  import semver from "semver";
4
3
  import { intervalToDuration } from "date-fns";
5
- import { useWalletAPIServer as useWalletAPIServerRaw, } from "@ledgerhq/wallet-api-server";
4
+ import { useWalletAPIServer as useWalletAPIServerRaw } from "@ledgerhq/wallet-api-server/lib/react";
5
+ import { firstValueFrom } from "rxjs";
6
6
  import { first } from "rxjs/operators";
7
- import { getEnv } from "@ledgerhq/live-env";
8
- import { UserRefusedOnDevice } from "@ledgerhq/errors";
9
- import { endpoints as calEndpoints } from "@ledgerhq/cryptoassets/cal-client/state-manager/api";
10
- import { accountToWalletAPIAccount, currencyToWalletAPICurrency, setWalletApiIdForAccountId, } from "./converters";
7
+ import { accountToWalletAPIAccount, currencyToWalletAPICurrency, getAccountIdFromWalletAccountId, } from "./converters";
11
8
  import { isWalletAPISupportedCurrency } from "./helpers";
12
9
  import { getMainAccount, getParentAccount } from "../account";
13
- import { listSupportedCurrencies } from "../currencies";
14
- import { getCryptoAssetsStore } from "../bridge/crypto-assets";
10
+ import { listCurrencies, findCryptoCurrencyById, getCryptoCurrencyById } from "../currencies";
11
+ import { getCryptoAssetsStore } from "../bridge/crypto-assets/index";
15
12
  import { bitcoinFamilyAccountGetXPubLogic, broadcastTransactionLogic, startExchangeLogic, completeExchangeLogic, receiveOnAccountLogic, signMessageLogic, signTransactionLogic, bitcoinFamilyAccountGetAddressLogic, bitcoinFamilyAccountGetPublicKeyLogic, signRawTransactionLogic, } from "./logic";
16
13
  import { getAccountBridge } from "../bridge";
14
+ import { getEnv } from "@ledgerhq/live-env";
17
15
  import openTransportAsSubject from "../hw/openTransportAsSubject";
16
+ import { UserRefusedOnDevice } from "@ledgerhq/errors";
18
17
  import { DISCOVER_INITIAL_CATEGORY, INITIAL_PLATFORM_STATE, MAX_RECENTLY_USED_LENGTH, } from "./constants";
19
- import { useCurrenciesUnderFeatureFlag } from "../modularDrawer/hooks/useCurrenciesUnderFeatureFlag";
20
18
  export function safeGetRefValue(ref) {
21
19
  if (!ref.current) {
22
20
  throw new Error("Ref objects doesn't have a current value");
23
21
  }
24
22
  return ref.current;
25
23
  }
26
- export function useSetWalletAPIAccounts(accounts) {
27
- useEffect(() => {
28
- accounts.forEach(account => {
29
- setWalletApiIdForAccountId(account.id);
24
+ export function useWalletAPIAccounts(walletState, accounts) {
25
+ return useMemo(() => {
26
+ return accounts.map(account => {
27
+ const parentAccount = getParentAccount(account, accounts);
28
+ return accountToWalletAPIAccount(walletState, account, parentAccount);
30
29
  });
31
- }, [accounts]);
30
+ }, [walletState, accounts]);
32
31
  }
33
- export function useDAppManifestCurrencyIds(manifest) {
32
+ export function useWalletAPICurrencies() {
33
+ return useMemo(() => {
34
+ return listCurrencies(true).reduce((filtered, currency) => {
35
+ if (isWalletAPISupportedCurrency(currency)) {
36
+ filtered.push(currencyToWalletAPICurrency(currency));
37
+ }
38
+ return filtered;
39
+ }, []);
40
+ }, []);
41
+ }
42
+ export function useManifestCurrencies(manifest) {
34
43
  return useMemo(() => {
35
44
  return (manifest.dapp?.networks.map(network => {
36
- return network.currency;
45
+ return getCryptoCurrencyById(network.currency);
37
46
  }) ?? []);
38
47
  }, [manifest.dapp?.networks]);
39
48
  }
49
+ export function useGetAccountIds(accounts$) {
50
+ const [accounts, setAccounts] = useState([]);
51
+ useEffect(() => {
52
+ if (!accounts$) {
53
+ return undefined;
54
+ }
55
+ const subscription = accounts$.subscribe(walletAccounts => {
56
+ setAccounts(walletAccounts);
57
+ });
58
+ return () => {
59
+ subscription.unsubscribe();
60
+ };
61
+ }, [accounts$]);
62
+ return useMemo(() => {
63
+ if (!accounts$) {
64
+ return undefined;
65
+ }
66
+ return accounts.reduce((accountIds, account) => {
67
+ accountIds.set(getAccountIdFromWalletAccountId(account.id), true);
68
+ return accountIds;
69
+ }, new Map());
70
+ }, [accounts, accounts$]);
71
+ }
40
72
  export function usePermission(manifest) {
41
73
  return useMemo(() => ({
42
- methodIds: manifest.permissions,
74
+ currencyIds: manifest.currencies === "*" ? ["**"] : manifest.currencies,
75
+ methodIds: manifest.permissions, // TODO remove when using the correct manifest type
43
76
  }), [manifest]);
44
77
  }
45
78
  function useTransport(postMessage) {
@@ -57,7 +90,7 @@ export function useConfig({ appId, userId, tracking, wallet, mevProtected, }) {
57
90
  tracking,
58
91
  wallet,
59
92
  mevProtected,
60
- }), [appId, mevProtected, tracking, userId, wallet]);
93
+ }), [appId, tracking, userId, wallet]);
61
94
  }
62
95
  function useDeviceTransport({ manifest, tracking }) {
63
96
  const ref = useRef();
@@ -107,257 +140,73 @@ function useDeviceTransport({ manifest, tracking }) {
107
140
  return useMemo(() => ({ ref, subscribe, close, exchange }), [close, exchange, subscribe]);
108
141
  }
109
142
  export 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, }) {
110
- const dispatch = useDispatch();
111
- const { deactivatedCurrencyIds } = useCurrenciesUnderFeatureFlag();
112
143
  const permission = usePermission(manifest);
113
144
  const transport = useTransport(webviewHook.postMessage);
114
145
  const [widgetLoaded, setWidgetLoaded] = useState(false);
115
- // We need to set the wallet API account IDs mapping upfront
116
- // If we don't want the map to be empty when requesting an account
117
- useSetWalletAPIAccounts(accounts);
146
+ const walletAPIAccounts = useWalletAPIAccounts(walletState, accounts);
147
+ const walletAPICurrencies = useWalletAPICurrencies();
118
148
  const { server, onMessage } = useWalletAPIServerRaw({
119
149
  transport,
120
150
  config,
151
+ accounts: walletAPIAccounts,
152
+ currencies: walletAPICurrencies,
121
153
  permission,
122
154
  customHandlers,
123
155
  });
124
156
  useEffect(() => {
125
157
  tracking.load(manifest);
126
158
  }, [tracking, manifest]);
127
- // TODO: refactor each handler into its own logic function for clarity
128
- useEffect(() => {
129
- server.setHandler("currency.list", async ({ currencyIds }) => {
130
- tracking.currencyListRequested(manifest);
131
- try {
132
- // 1. Parse manifest currency patterns to determine what to include
133
- const manifestCurrencyIds = manifest.currencies === "*" ? ["**"] : manifest.currencies;
134
- // 2. Apply query filter early - intersect with manifest patterns
135
- const queryCurrencyIdsSet = currencyIds ? new Set(currencyIds) : undefined;
136
- let effectiveCurrencyIds = manifestCurrencyIds;
137
- if (queryCurrencyIdsSet) {
138
- // If we have a query filter, narrow down what we need to fetch
139
- effectiveCurrencyIds = manifestCurrencyIds.flatMap(manifestId => {
140
- if (manifestId === "**") {
141
- // Query can ask for anything, so use the query list
142
- return [...queryCurrencyIdsSet];
143
- }
144
- else if (manifestId.endsWith("/**")) {
145
- // Pattern like "ethereum/**" - keep tokens from query that match this family
146
- const family = manifestId.slice(0, -3);
147
- return [...queryCurrencyIdsSet].filter(qId => qId.startsWith(`${family}/`));
148
- }
149
- else if (queryCurrencyIdsSet.has(manifestId)) {
150
- // Specific currency/token that's in the query
151
- return [manifestId];
152
- }
153
- // Not in query, skip it
154
- return [];
155
- });
156
- }
157
- // 3. Parse effective currency IDs to determine what to fetch
158
- const includeAllCurrencies = effectiveCurrencyIds.includes("**");
159
- const specificCurrencies = new Set();
160
- const tokenFamilies = new Set();
161
- const specificTokenIds = new Set();
162
- for (const id of effectiveCurrencyIds) {
163
- if (id === "**") {
164
- // Already handled above
165
- continue;
166
- }
167
- else if (id.endsWith("/**")) {
168
- // Pattern like "ethereum/**" or "solana/**" - include tokens for this family
169
- const family = id.slice(0, -3);
170
- tokenFamilies.add(family);
171
- }
172
- else if (id.includes("/")) {
173
- // Specific token ID like "ethereum/erc20/usd__coin"
174
- specificTokenIds.add(id);
175
- }
176
- else {
177
- // Specific currency like "bitcoin" or "ethereum"
178
- specificCurrencies.add(id);
179
- }
180
- }
181
- // 4. Gather all supported parent currencies
182
- const allCurrencies = listSupportedCurrencies().reduce((acc, c) => {
183
- if (isWalletAPISupportedCurrency(c) && !deactivatedCurrencyIds.has(c.id))
184
- acc.push(currencyToWalletAPICurrency(c));
185
- return acc;
186
- }, []);
187
- // 5. Determine which currencies to include based on patterns
188
- let includedCurrencies = [];
189
- if (includeAllCurrencies) {
190
- includedCurrencies = allCurrencies;
191
- }
192
- else {
193
- includedCurrencies = allCurrencies.filter(c => specificCurrencies.has(c.id));
194
- }
195
- // 6. Fetch specific tokens by ID if any
196
- const specificTokens = [];
197
- if (specificTokenIds.size > 0) {
198
- const tokenPromises = [...specificTokenIds].map(async (tokenId) => {
199
- const token = await getCryptoAssetsStore().findTokenById(tokenId);
200
- return token ? currencyToWalletAPICurrency(token) : null;
201
- });
202
- const resolvedTokens = await Promise.all(tokenPromises);
203
- specificTokens.push(...resolvedTokens.filter((t) => t !== null));
204
- }
205
- // 7. Determine which token families to fetch (only if not already fetched as specific tokens)
206
- const familiesToFetch = new Set();
207
- if (includeAllCurrencies) {
208
- // Fetch tokens for all currency families
209
- allCurrencies.forEach(c => {
210
- if (c.type === "CryptoCurrency")
211
- familiesToFetch.add(c.family);
212
- });
213
- }
214
- else if (tokenFamilies.size > 0) {
215
- // Only fetch tokens for families explicitly marked with /**
216
- tokenFamilies.forEach(family => familiesToFetch.add(family));
217
- }
218
- // 8. Fetch tokens for relevant families
219
- const fetchAllPagesForFamily = async (family) => {
220
- const args = { networkFamily: family, pageSize: 1000 };
221
- let hasNextPage = true;
222
- let data;
223
- while (hasNextPage) {
224
- const querySub = dispatch(calEndpoints.getTokensData.initiate(args, data ? { direction: "forward" } : undefined));
225
- try {
226
- const result = await querySub;
227
- data = result.data;
228
- hasNextPage = result.hasNextPage;
229
- if (result.error)
230
- throw result.error;
231
- }
232
- finally {
233
- querySub.unsubscribe();
234
- }
235
- }
236
- return (data?.pages ?? []).flatMap(p => p.tokens);
237
- };
238
- const tokensByFamily = await Promise.all([...familiesToFetch].map(f => fetchAllPagesForFamily(f)));
239
- // 9. Combine all results (no additional filter needed since we pre-filtered)
240
- const result = tokensByFamily.reduce((acc, tokens) => [...acc, ...tokens.map(t => currencyToWalletAPICurrency(t))], [...includedCurrencies, ...specificTokens]);
241
- tracking.currencyListSuccess(manifest);
242
- return result;
243
- }
244
- catch (err) {
245
- tracking.currencyListFail(manifest);
246
- throw err;
247
- }
248
- });
249
- }, [walletState, manifest, server, tracking, dispatch, deactivatedCurrencyIds]);
250
- useEffect(() => {
251
- server.setHandler("account.list", ({ currencyIds }) => {
252
- tracking.accountListRequested(manifest);
253
- try {
254
- // 1. Parse manifest currency patterns to determine what to include
255
- const manifestCurrencyIds = manifest.currencies === "*" ? ["**"] : manifest.currencies;
256
- // 2. Apply query filter early - intersect with manifest patterns
257
- const queryCurrencyIdsSet = currencyIds ? new Set(currencyIds) : undefined;
258
- let effectiveCurrencyIds = manifestCurrencyIds;
259
- if (queryCurrencyIdsSet) {
260
- // If we have a query filter, narrow down what we need to check
261
- effectiveCurrencyIds = manifestCurrencyIds.flatMap(manifestId => {
262
- if (manifestId === "**") {
263
- // Query can ask for anything, so use the query list
264
- return [...queryCurrencyIdsSet];
265
- }
266
- else if (manifestId.endsWith("/**")) {
267
- // Pattern like "ethereum/**" - keep tokens from query that match this family
268
- const family = manifestId.slice(0, -3);
269
- return [...queryCurrencyIdsSet].filter(qId => qId.startsWith(`${family}/`));
270
- }
271
- else if (queryCurrencyIdsSet.has(manifestId)) {
272
- // Specific currency/token that's in the query
273
- return [manifestId];
274
- }
275
- // Not in query, skip it
276
- return [];
277
- });
278
- }
279
- // 3. Build a set of allowed currency IDs based on effective patterns
280
- const allowedCurrencyIds = new Set();
281
- const includeAllCurrencies = effectiveCurrencyIds.includes("**");
282
- const tokenFamilyPrefixes = new Set();
283
- for (const id of effectiveCurrencyIds) {
284
- if (id === "**") {
285
- // Will match all currencies
286
- continue;
287
- }
288
- else if (id.endsWith("/**")) {
289
- // Pattern like "ethereum/**" - store prefix for matching
290
- const family = id.slice(0, -3);
291
- tokenFamilyPrefixes.add(family);
292
- }
293
- else {
294
- // Specific currency/token ID
295
- allowedCurrencyIds.add(id);
296
- }
297
- }
298
- // 4. Filter accounts based on effective currency IDs
299
- const wapiAccounts = accounts.reduce((acc, account) => {
300
- const parentAccount = getParentAccount(account, accounts);
301
- const accountCurrencyId = account.type === "TokenAccount" ? account.token.id : account.currency.id;
302
- const parentCurrencyId = account.type === "TokenAccount" ? account.token.parentCurrency.id : account.currency.id;
303
- // Check if account currency ID matches the effective patterns
304
- const isAllowed = includeAllCurrencies ||
305
- allowedCurrencyIds.has(accountCurrencyId) ||
306
- tokenFamilyPrefixes.has(parentCurrencyId);
307
- if (isAllowed) {
308
- acc.push(accountToWalletAPIAccount(walletState, account, parentAccount));
309
- }
310
- return acc;
311
- }, []);
312
- tracking.accountListSuccess(manifest);
313
- return wapiAccounts;
314
- }
315
- catch (err) {
316
- tracking.accountListFail(manifest);
317
- throw err;
318
- }
319
- });
320
- }, [walletState, manifest, server, tracking, uiAccountRequest, accounts]);
321
159
  useEffect(() => {
322
160
  if (!uiAccountRequest)
323
161
  return;
324
- server.setHandler("account.request", async ({ currencyIds, drawerConfiguration, areCurrenciesFiltered, useCase }) => {
162
+ server.setHandler("account.request", async ({ accounts$, currencies$, drawerConfiguration, areCurrenciesFiltered, useCase }) => {
325
163
  tracking.requestAccountRequested(manifest);
164
+ const currencies = await firstValueFrom(currencies$);
326
165
  return new Promise((resolve, reject) => {
327
- let done = false;
328
- try {
329
- uiAccountRequest({
330
- currencyIds,
331
- drawerConfiguration,
332
- areCurrenciesFiltered,
333
- useCase,
334
- onSuccess: (account, parentAccount) => {
335
- if (done)
336
- return;
337
- done = true;
338
- tracking.requestAccountSuccess(manifest);
339
- resolve(accountToWalletAPIAccount(walletState, account, parentAccount));
340
- },
341
- onCancel: () => {
342
- if (done)
343
- return;
344
- done = true;
345
- tracking.requestAccountFail(manifest);
346
- reject(new Error("Canceled by user"));
347
- },
348
- });
349
- }
350
- catch (error) {
351
- tracking.requestAccountFail(manifest);
352
- reject(error);
353
- }
166
+ (async () => {
167
+ try {
168
+ // handle no curencies selected case
169
+ const currencyList = [];
170
+ for (const { id } of currencies) {
171
+ const currency = findCryptoCurrencyById(id) || (await getCryptoAssetsStore().findTokenById(id));
172
+ if (currency) {
173
+ currencyList.push(currency);
174
+ }
175
+ }
176
+ let done = false;
177
+ uiAccountRequest({
178
+ accounts$,
179
+ currencies: currencyList,
180
+ drawerConfiguration,
181
+ areCurrenciesFiltered,
182
+ useCase,
183
+ onSuccess: (account, parentAccount) => {
184
+ if (done)
185
+ return;
186
+ done = true;
187
+ tracking.requestAccountSuccess(manifest);
188
+ resolve(accountToWalletAPIAccount(walletState, account, parentAccount));
189
+ },
190
+ onCancel: () => {
191
+ if (done)
192
+ return;
193
+ done = true;
194
+ tracking.requestAccountFail(manifest);
195
+ reject(new Error("Canceled by user"));
196
+ },
197
+ });
198
+ }
199
+ catch (error) {
200
+ reject(error);
201
+ }
202
+ })();
354
203
  });
355
204
  });
356
205
  }, [walletState, manifest, server, tracking, uiAccountRequest]);
357
206
  useEffect(() => {
358
207
  if (!uiAccountReceive)
359
208
  return;
360
- server.setHandler("account.receive", ({ accountId, tokenCurrency }) => receiveOnAccountLogic(walletState, { manifest, accounts, tracking }, accountId, (account, parentAccount, accountAddress) => new Promise((resolve, reject) => {
209
+ server.setHandler("account.receive", ({ account, tokenCurrency }) => receiveOnAccountLogic(walletState, { manifest, accounts, tracking }, account.id, (account, parentAccount, accountAddress) => new Promise((resolve, reject) => {
361
210
  let done = false;
362
211
  return uiAccountReceive({
363
212
  account,
@@ -390,7 +239,7 @@ export function useWalletAPIServer({ walletState, manifest, accounts, tracking,
390
239
  useEffect(() => {
391
240
  if (!uiMessageSign)
392
241
  return;
393
- server.setHandler("message.sign", ({ accountId, message, options }) => signMessageLogic({ manifest, accounts, tracking }, accountId, message.toString("hex"), (account, message) => new Promise((resolve, reject) => {
242
+ server.setHandler("message.sign", ({ account, message, options }) => signMessageLogic({ manifest, accounts, tracking }, account.id, message.toString("hex"), (account, message) => new Promise((resolve, reject) => {
394
243
  let done = false;
395
244
  return uiMessageSign({
396
245
  account,
@@ -435,38 +284,31 @@ export function useWalletAPIServer({ walletState, manifest, accounts, tracking,
435
284
  useEffect(() => {
436
285
  if (!uiTxSign)
437
286
  return;
438
- server.setHandler("transaction.sign", async ({ accountId, tokenCurrency, transaction, options }) => {
439
- let currency;
440
- const signedOperation = await signTransactionLogic({ manifest, accounts, tracking }, accountId, transaction, (account, parentAccount, signFlowInfos) => {
441
- currency =
442
- account.type === "TokenAccount"
443
- ? account.token.parentCurrency.id
444
- : account.currency.id;
445
- return new Promise((resolve, reject) => {
446
- let done = false;
447
- return uiTxSign({
448
- account,
449
- parentAccount,
450
- signFlowInfos,
451
- options,
452
- onSuccess: signedOperation => {
453
- if (done)
454
- return;
455
- done = true;
456
- tracking.signTransactionSuccess(manifest);
457
- resolve(signedOperation);
458
- },
459
- onError: error => {
460
- if (done)
461
- return;
462
- done = true;
463
- tracking.signTransactionFail(manifest);
464
- reject(error);
465
- },
466
- });
287
+ server.setHandler("transaction.sign", async ({ account, tokenCurrency, transaction, options }) => {
288
+ const signedOperation = await signTransactionLogic({ manifest, accounts, tracking }, account.id, transaction, (account, parentAccount, signFlowInfos) => new Promise((resolve, reject) => {
289
+ let done = false;
290
+ return uiTxSign({
291
+ account,
292
+ parentAccount,
293
+ signFlowInfos,
294
+ options,
295
+ onSuccess: signedOperation => {
296
+ if (done)
297
+ return;
298
+ done = true;
299
+ tracking.signTransactionSuccess(manifest);
300
+ resolve(signedOperation);
301
+ },
302
+ onError: error => {
303
+ if (done)
304
+ return;
305
+ done = true;
306
+ tracking.signTransactionFail(manifest);
307
+ reject(error);
308
+ },
467
309
  });
468
- }, tokenCurrency);
469
- return currency === "solana"
310
+ }), tokenCurrency);
311
+ return account.currency === "solana"
470
312
  ? Buffer.from(signedOperation.signature, "hex")
471
313
  : Buffer.from(signedOperation.signature);
472
314
  });
@@ -474,8 +316,8 @@ export function useWalletAPIServer({ walletState, manifest, accounts, tracking,
474
316
  useEffect(() => {
475
317
  if (!uiTxSignRaw)
476
318
  return;
477
- server.setHandler("transaction.signRaw", async ({ accountId, transaction, broadcast, options }) => {
478
- const signedOperation = await signRawTransactionLogic({ manifest, accounts, tracking }, accountId, transaction, (account, parentAccount, tx) => new Promise((resolve, reject) => {
319
+ server.setHandler("transaction.signRaw", async ({ account, transaction, broadcast, options }) => {
320
+ const signedOperation = await signRawTransactionLogic({ manifest, accounts, tracking }, account.id, transaction, (account, parentAccount, tx) => new Promise((resolve, reject) => {
479
321
  let done = false;
480
322
  return uiTxSignRaw({
481
323
  account,
@@ -500,7 +342,7 @@ export function useWalletAPIServer({ walletState, manifest, accounts, tracking,
500
342
  }));
501
343
  let hash;
502
344
  if (broadcast) {
503
- hash = await broadcastTransactionLogic({ manifest, accounts, tracking }, accountId, signedOperation, async (account, parentAccount, signedOperation) => {
345
+ hash = await broadcastTransactionLogic({ manifest, accounts, tracking }, account.id, signedOperation, async (account, parentAccount, signedOperation) => {
504
346
  const bridge = getAccountBridge(account, parentAccount);
505
347
  const mainAccount = getMainAccount(account, parentAccount);
506
348
  let optimisticOperation = signedOperation.operation;
@@ -532,9 +374,9 @@ export function useWalletAPIServer({ walletState, manifest, accounts, tracking,
532
374
  useEffect(() => {
533
375
  if (!uiTxSign)
534
376
  return;
535
- server.setHandler("transaction.signAndBroadcast", async ({ accountId, tokenCurrency, transaction, options }) => {
377
+ server.setHandler("transaction.signAndBroadcast", async ({ account, tokenCurrency, transaction, options }) => {
536
378
  const sponsored = transaction.family === "ethereum" && transaction.sponsored;
537
- const signedTransaction = await signTransactionLogic({ manifest, accounts, tracking }, accountId, transaction, (account, parentAccount, signFlowInfos) => new Promise((resolve, reject) => {
379
+ const signedTransaction = await signTransactionLogic({ manifest, accounts, tracking }, account.id, transaction, (account, parentAccount, signFlowInfos) => new Promise((resolve, reject) => {
538
380
  let done = false;
539
381
  return uiTxSign({
540
382
  account,
@@ -557,7 +399,7 @@ export function useWalletAPIServer({ walletState, manifest, accounts, tracking,
557
399
  },
558
400
  });
559
401
  }), tokenCurrency);
560
- return broadcastTransactionLogic({ manifest, accounts, tracking }, accountId, signedTransaction, async (account, parentAccount, signedOperation) => {
402
+ return broadcastTransactionLogic({ manifest, accounts, tracking }, account.id, signedTransaction, async (account, parentAccount, signedOperation) => {
561
403
  const bridge = getAccountBridge(account, parentAccount);
562
404
  const mainAccount = getMainAccount(account, parentAccount);
563
405
  let optimisticOperation = signedOperation.operation;
@@ -763,8 +605,8 @@ export function useWalletAPIServer({ walletState, manifest, accounts, tracking,
763
605
  // retrofit of the exchange params to fit the old platform spec
764
606
  const request = {
765
607
  provider: params.provider,
766
- fromAccountId: params.fromAccountId,
767
- toAccountId: params.exchangeType === "SWAP" ? params.toAccountId : undefined,
608
+ fromAccountId: params.fromAccount.id,
609
+ toAccountId: params.exchangeType === "SWAP" ? params.toAccount.id : undefined,
768
610
  transaction: params.transaction,
769
611
  binaryPayload: params.binaryPayload.toString("hex"),
770
612
  signature: params.signature.toString("hex"),
@@ -797,7 +639,7 @@ export function useWalletAPIServer({ walletState, manifest, accounts, tracking,
797
639
  });
798
640
  }, [uiExchangeComplete, accounts, manifest, server, tracking]);
799
641
  return {
800
- widgetLoaded: widgetLoaded,
642
+ widgetLoaded,
801
643
  onMessage,
802
644
  onLoad,
803
645
  onReload,
@@ -917,9 +759,9 @@ export function useRecentlyUsed(manifests, [recentlyUsedManifestsDb, setState])
917
759
  ...res,
918
760
  usedAt: calculateTimeDiff(recentlyUsed.usedAt),
919
761
  }
920
- : undefined;
762
+ : res;
921
763
  })
922
- .filter((manifest) => manifest !== undefined), [recentlyUsedManifestsDb, manifests]);
764
+ .filter(manifest => manifest !== undefined), [recentlyUsedManifestsDb, manifests]);
923
765
  const append = useCallback((manifest) => {
924
766
  setState(state => {
925
767
  const index = state.recentlyUsed.findIndex(({ id }) => id === manifest.id);