@ledgerhq/live-common 34.53.0-nightly.20251115023630 → 34.53.0-nightly.20251118023800

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