@ledgerhq/live-common 34.53.0-nightly.20251114023758 → 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 (436) hide show
  1. package/lib/__tests__/test-helpers/environment.js +2 -0
  2. package/lib/__tests__/test-helpers/environment.js.map +1 -1
  3. package/lib/currencies/helpers.d.ts +1 -3
  4. package/lib/currencies/helpers.d.ts.map +1 -1
  5. package/lib/currencies/helpers.js +1 -27
  6. package/lib/currencies/helpers.js.map +1 -1
  7. package/lib/dada-client/hooks/useAssetsData.d.ts +1 -0
  8. package/lib/dada-client/hooks/useAssetsData.d.ts.map +1 -1
  9. package/lib/dada-client/hooks/useAssetsData.js +1 -0
  10. package/lib/dada-client/hooks/useAssetsData.js.map +1 -1
  11. package/lib/deviceSDK/actions/getBatteryStatuses.d.ts +2 -1
  12. package/lib/deviceSDK/actions/getBatteryStatuses.d.ts.map +1 -1
  13. package/lib/deviceSDK/actions/getBatteryStatuses.js +2 -2
  14. package/lib/deviceSDK/actions/getBatteryStatuses.js.map +1 -1
  15. package/lib/deviceSDK/actions/getDeviceInfo.d.ts +2 -1
  16. package/lib/deviceSDK/actions/getDeviceInfo.d.ts.map +1 -1
  17. package/lib/deviceSDK/actions/getDeviceInfo.js +2 -2
  18. package/lib/deviceSDK/actions/getDeviceInfo.js.map +1 -1
  19. package/lib/deviceSDK/actions/getLatestAvailableFirmware.d.ts +2 -1
  20. package/lib/deviceSDK/actions/getLatestAvailableFirmware.d.ts.map +1 -1
  21. package/lib/deviceSDK/actions/getLatestAvailableFirmware.js +6 -3
  22. package/lib/deviceSDK/actions/getLatestAvailableFirmware.js.map +1 -1
  23. package/lib/deviceSDK/actions/toggleOnboardingEarlyCheck.d.ts +2 -1
  24. package/lib/deviceSDK/actions/toggleOnboardingEarlyCheck.d.ts.map +1 -1
  25. package/lib/deviceSDK/actions/toggleOnboardingEarlyCheck.js +2 -2
  26. package/lib/deviceSDK/actions/toggleOnboardingEarlyCheck.js.map +1 -1
  27. package/lib/deviceSDK/actions/updateFirmware.d.ts +2 -1
  28. package/lib/deviceSDK/actions/updateFirmware.d.ts.map +1 -1
  29. package/lib/deviceSDK/actions/updateFirmware.js +4 -3
  30. package/lib/deviceSDK/actions/updateFirmware.js.map +1 -1
  31. package/lib/deviceSDK/hooks/useBatteryStatuses.d.ts +2 -1
  32. package/lib/deviceSDK/hooks/useBatteryStatuses.d.ts.map +1 -1
  33. package/lib/deviceSDK/hooks/useBatteryStatuses.js +3 -2
  34. package/lib/deviceSDK/hooks/useBatteryStatuses.js.map +1 -1
  35. package/lib/deviceSDK/hooks/useGetDeviceInfo.d.ts +2 -1
  36. package/lib/deviceSDK/hooks/useGetDeviceInfo.d.ts.map +1 -1
  37. package/lib/deviceSDK/hooks/useGetDeviceInfo.js +3 -3
  38. package/lib/deviceSDK/hooks/useGetDeviceInfo.js.map +1 -1
  39. package/lib/deviceSDK/hooks/useGetLatestAvailableFirmware.d.ts +2 -1
  40. package/lib/deviceSDK/hooks/useGetLatestAvailableFirmware.d.ts.map +1 -1
  41. package/lib/deviceSDK/hooks/useGetLatestAvailableFirmware.js +2 -1
  42. package/lib/deviceSDK/hooks/useGetLatestAvailableFirmware.js.map +1 -1
  43. package/lib/deviceSDK/hooks/useToggleOnboardingEarlyChecks.d.ts +2 -1
  44. package/lib/deviceSDK/hooks/useToggleOnboardingEarlyChecks.d.ts.map +1 -1
  45. package/lib/deviceSDK/hooks/useToggleOnboardingEarlyChecks.js +3 -2
  46. package/lib/deviceSDK/hooks/useToggleOnboardingEarlyChecks.js.map +1 -1
  47. package/lib/deviceSDK/hooks/useUpdateFirmware.d.ts +2 -1
  48. package/lib/deviceSDK/hooks/useUpdateFirmware.d.ts.map +1 -1
  49. package/lib/deviceSDK/hooks/useUpdateFirmware.js +3 -2
  50. package/lib/deviceSDK/hooks/useUpdateFirmware.js.map +1 -1
  51. package/lib/deviceSDK/tasks/getBatteryStatuses.d.ts +1 -0
  52. package/lib/deviceSDK/tasks/getBatteryStatuses.d.ts.map +1 -1
  53. package/lib/deviceSDK/tasks/getBatteryStatuses.js +2 -2
  54. package/lib/deviceSDK/tasks/getBatteryStatuses.js.map +1 -1
  55. package/lib/deviceSDK/tasks/getDeviceInfo.d.ts +2 -1
  56. package/lib/deviceSDK/tasks/getDeviceInfo.d.ts.map +1 -1
  57. package/lib/deviceSDK/tasks/getDeviceInfo.js +2 -2
  58. package/lib/deviceSDK/tasks/getDeviceInfo.js.map +1 -1
  59. package/lib/deviceSDK/tasks/getLatestFirmware.d.ts +1 -0
  60. package/lib/deviceSDK/tasks/getLatestFirmware.d.ts.map +1 -1
  61. package/lib/deviceSDK/tasks/getLatestFirmware.js +2 -2
  62. package/lib/deviceSDK/tasks/getLatestFirmware.js.map +1 -1
  63. package/lib/deviceSDK/tasks/toggleOnboardingEarlyCheck.d.ts +1 -0
  64. package/lib/deviceSDK/tasks/toggleOnboardingEarlyCheck.d.ts.map +1 -1
  65. package/lib/deviceSDK/tasks/toggleOnboardingEarlyCheck.js +2 -2
  66. package/lib/deviceSDK/tasks/toggleOnboardingEarlyCheck.js.map +1 -1
  67. package/lib/deviceSDK/tasks/updateFirmware.d.ts +1 -0
  68. package/lib/deviceSDK/tasks/updateFirmware.d.ts.map +1 -1
  69. package/lib/deviceSDK/tasks/updateFirmware.js +2 -2
  70. package/lib/deviceSDK/tasks/updateFirmware.js.map +1 -1
  71. package/lib/deviceSDK/transports/core.d.ts +1 -0
  72. package/lib/deviceSDK/transports/core.d.ts.map +1 -1
  73. package/lib/deviceSDK/transports/core.js +2 -2
  74. package/lib/deviceSDK/transports/core.js.map +1 -1
  75. package/lib/e2e/index.d.ts +6 -0
  76. package/lib/e2e/index.d.ts.map +1 -1
  77. package/lib/families/evm/config.d.ts.map +1 -1
  78. package/lib/families/evm/config.js +33 -0
  79. package/lib/families/evm/config.js.map +1 -1
  80. package/lib/featureFlags/defaultFeatures.d.ts +2 -0
  81. package/lib/featureFlags/defaultFeatures.d.ts.map +1 -1
  82. package/lib/featureFlags/defaultFeatures.js +2 -0
  83. package/lib/featureFlags/defaultFeatures.js.map +1 -1
  84. package/lib/hw/actions/app.d.ts.map +1 -1
  85. package/lib/hw/actions/app.js +2 -1
  86. package/lib/hw/actions/app.js.map +1 -1
  87. package/lib/hw/actions/customLockScreenLoad.d.ts +1 -1
  88. package/lib/hw/actions/customLockScreenLoad.d.ts.map +1 -1
  89. package/lib/hw/actions/customLockScreenLoad.js +2 -0
  90. package/lib/hw/actions/customLockScreenLoad.js.map +1 -1
  91. package/lib/hw/actions/implementations.d.ts +1 -0
  92. package/lib/hw/actions/implementations.d.ts.map +1 -1
  93. package/lib/hw/actions/implementations.js +12 -2
  94. package/lib/hw/actions/implementations.js.map +1 -1
  95. package/lib/hw/connectApp.d.ts +2 -1
  96. package/lib/hw/connectApp.d.ts.map +1 -1
  97. package/lib/hw/connectApp.js +4 -4
  98. package/lib/hw/connectApp.js.map +1 -1
  99. package/lib/hw/connectManager.d.ts +2 -1
  100. package/lib/hw/connectManager.d.ts.map +1 -1
  101. package/lib/hw/connectManager.js +4 -4
  102. package/lib/hw/connectManager.js.map +1 -1
  103. package/lib/hw/customLockScreenFetch.d.ts +2 -1
  104. package/lib/hw/customLockScreenFetch.d.ts.map +1 -1
  105. package/lib/hw/customLockScreenFetch.js +2 -2
  106. package/lib/hw/customLockScreenFetch.js.map +1 -1
  107. package/lib/hw/customLockScreenLoad.d.ts +2 -1
  108. package/lib/hw/customLockScreenLoad.d.ts.map +1 -1
  109. package/lib/hw/customLockScreenLoad.js +2 -2
  110. package/lib/hw/customLockScreenLoad.js.map +1 -1
  111. package/lib/hw/deviceAccess.d.ts +3 -3
  112. package/lib/hw/deviceAccess.d.ts.map +1 -1
  113. package/lib/hw/deviceAccess.js +2 -1
  114. package/lib/hw/deviceAccess.js.map +1 -1
  115. package/lib/hw/getGenuineCheckFromDeviceId.d.ts +2 -1
  116. package/lib/hw/getGenuineCheckFromDeviceId.d.ts.map +1 -1
  117. package/lib/hw/getGenuineCheckFromDeviceId.js +2 -2
  118. package/lib/hw/getGenuineCheckFromDeviceId.js.map +1 -1
  119. package/lib/hw/getOnboardingStatePolling.d.ts +2 -1
  120. package/lib/hw/getOnboardingStatePolling.d.ts.map +1 -1
  121. package/lib/hw/getOnboardingStatePolling.js +5 -2
  122. package/lib/hw/getOnboardingStatePolling.js.map +1 -1
  123. package/lib/hw/hooks/useGenuineCheck.d.ts +2 -1
  124. package/lib/hw/hooks/useGenuineCheck.d.ts.map +1 -1
  125. package/lib/hw/hooks/useGenuineCheck.js +3 -1
  126. package/lib/hw/hooks/useGenuineCheck.js.map +1 -1
  127. package/lib/hw/index.d.ts +6 -2
  128. package/lib/hw/index.d.ts.map +1 -1
  129. package/lib/hw/index.js +6 -6
  130. package/lib/hw/index.js.map +1 -1
  131. package/lib/hw/installLanguage.d.ts +2 -1
  132. package/lib/hw/installLanguage.d.ts.map +1 -1
  133. package/lib/hw/installLanguage.js +2 -2
  134. package/lib/hw/installLanguage.js.map +1 -1
  135. package/lib/modularDrawer/hooks/useCurrenciesUnderFeatureFlag.d.ts.map +1 -1
  136. package/lib/modularDrawer/hooks/useCurrenciesUnderFeatureFlag.js +8 -0
  137. package/lib/modularDrawer/hooks/useCurrenciesUnderFeatureFlag.js.map +1 -1
  138. package/lib/modularDrawer/hooks/useNetworkAccountCounts.d.ts +1 -5
  139. package/lib/modularDrawer/hooks/useNetworkAccountCounts.d.ts.map +1 -1
  140. package/lib/modularDrawer/hooks/useNetworkAccountCounts.js +2 -2
  141. package/lib/modularDrawer/hooks/useNetworkAccountCounts.js.map +1 -1
  142. package/lib/modularDrawer/modules/createNetworkConfiguration.d.ts +1 -1
  143. package/lib/modularDrawer/modules/createNetworkConfiguration.d.ts.map +1 -1
  144. package/lib/modularDrawer/modules/createNetworkConfiguration.js +1 -2
  145. package/lib/modularDrawer/modules/createNetworkConfiguration.js.map +1 -1
  146. package/lib/modularDrawer/utils/type.d.ts +0 -5
  147. package/lib/modularDrawer/utils/type.d.ts.map +1 -1
  148. package/lib/onboarding/hooks/useOnboardingStatePolling.d.ts.map +1 -1
  149. package/lib/onboarding/hooks/useOnboardingStatePolling.js +1 -0
  150. package/lib/onboarding/hooks/useOnboardingStatePolling.js.map +1 -1
  151. package/lib/platform/filters.d.ts +1 -2
  152. package/lib/platform/filters.d.ts.map +1 -1
  153. package/lib/platform/filters.js +1 -17
  154. package/lib/platform/filters.js.map +1 -1
  155. package/lib/platform/helpers.d.ts +1 -5
  156. package/lib/platform/helpers.d.ts.map +1 -1
  157. package/lib/platform/helpers.js +1 -33
  158. package/lib/platform/helpers.js.map +1 -1
  159. package/lib/platform/react.d.ts +2 -3
  160. package/lib/platform/react.d.ts.map +1 -1
  161. package/lib/platform/react.js +66 -16
  162. package/lib/platform/react.js.map +1 -1
  163. package/lib/platform/types.d.ts +3 -3
  164. package/lib/platform/types.d.ts.map +1 -1
  165. package/lib/utils/getAccountTuplesForCurrency.d.ts +1 -1
  166. package/lib/utils/getAccountTuplesForCurrency.d.ts.map +1 -1
  167. package/lib/utils/getAccountTuplesForCurrency.js +2 -3
  168. package/lib/utils/getAccountTuplesForCurrency.js.map +1 -1
  169. package/lib/wallet-api/Exchange/server.d.ts.map +1 -1
  170. package/lib/wallet-api/Exchange/server.js +5 -4
  171. package/lib/wallet-api/Exchange/server.js.map +1 -1
  172. package/lib/wallet-api/converters.d.ts +1 -0
  173. package/lib/wallet-api/converters.d.ts.map +1 -1
  174. package/lib/wallet-api/converters.js +7 -2
  175. package/lib/wallet-api/converters.js.map +1 -1
  176. package/lib/wallet-api/react.d.ts +6 -11
  177. package/lib/wallet-api/react.d.ts.map +1 -1
  178. package/lib/wallet-api/react.js +291 -135
  179. package/lib/wallet-api/react.js.map +1 -1
  180. package/lib/wallet-api/tracking.d.ts +6 -0
  181. package/lib/wallet-api/tracking.d.ts.map +1 -1
  182. package/lib/wallet-api/tracking.js +20 -0
  183. package/lib/wallet-api/tracking.js.map +1 -1
  184. package/lib/wallet-api/useDappLogic.d.ts.map +1 -1
  185. package/lib/wallet-api/useDappLogic.js +65 -80
  186. package/lib/wallet-api/useDappLogic.js.map +1 -1
  187. package/lib-es/__tests__/test-helpers/environment.js +2 -0
  188. package/lib-es/__tests__/test-helpers/environment.js.map +1 -1
  189. package/lib-es/currencies/helpers.d.ts +1 -3
  190. package/lib-es/currencies/helpers.d.ts.map +1 -1
  191. package/lib-es/currencies/helpers.js +0 -24
  192. package/lib-es/currencies/helpers.js.map +1 -1
  193. package/lib-es/dada-client/hooks/useAssetsData.d.ts +1 -0
  194. package/lib-es/dada-client/hooks/useAssetsData.d.ts.map +1 -1
  195. package/lib-es/dada-client/hooks/useAssetsData.js +1 -0
  196. package/lib-es/dada-client/hooks/useAssetsData.js.map +1 -1
  197. package/lib-es/deviceSDK/actions/getBatteryStatuses.d.ts +2 -1
  198. package/lib-es/deviceSDK/actions/getBatteryStatuses.d.ts.map +1 -1
  199. package/lib-es/deviceSDK/actions/getBatteryStatuses.js +2 -2
  200. package/lib-es/deviceSDK/actions/getBatteryStatuses.js.map +1 -1
  201. package/lib-es/deviceSDK/actions/getDeviceInfo.d.ts +2 -1
  202. package/lib-es/deviceSDK/actions/getDeviceInfo.d.ts.map +1 -1
  203. package/lib-es/deviceSDK/actions/getDeviceInfo.js +2 -2
  204. package/lib-es/deviceSDK/actions/getDeviceInfo.js.map +1 -1
  205. package/lib-es/deviceSDK/actions/getLatestAvailableFirmware.d.ts +2 -1
  206. package/lib-es/deviceSDK/actions/getLatestAvailableFirmware.d.ts.map +1 -1
  207. package/lib-es/deviceSDK/actions/getLatestAvailableFirmware.js +6 -3
  208. package/lib-es/deviceSDK/actions/getLatestAvailableFirmware.js.map +1 -1
  209. package/lib-es/deviceSDK/actions/toggleOnboardingEarlyCheck.d.ts +2 -1
  210. package/lib-es/deviceSDK/actions/toggleOnboardingEarlyCheck.d.ts.map +1 -1
  211. package/lib-es/deviceSDK/actions/toggleOnboardingEarlyCheck.js +2 -2
  212. package/lib-es/deviceSDK/actions/toggleOnboardingEarlyCheck.js.map +1 -1
  213. package/lib-es/deviceSDK/actions/updateFirmware.d.ts +2 -1
  214. package/lib-es/deviceSDK/actions/updateFirmware.d.ts.map +1 -1
  215. package/lib-es/deviceSDK/actions/updateFirmware.js +4 -3
  216. package/lib-es/deviceSDK/actions/updateFirmware.js.map +1 -1
  217. package/lib-es/deviceSDK/hooks/useBatteryStatuses.d.ts +2 -1
  218. package/lib-es/deviceSDK/hooks/useBatteryStatuses.d.ts.map +1 -1
  219. package/lib-es/deviceSDK/hooks/useBatteryStatuses.js +3 -2
  220. package/lib-es/deviceSDK/hooks/useBatteryStatuses.js.map +1 -1
  221. package/lib-es/deviceSDK/hooks/useGetDeviceInfo.d.ts +2 -1
  222. package/lib-es/deviceSDK/hooks/useGetDeviceInfo.d.ts.map +1 -1
  223. package/lib-es/deviceSDK/hooks/useGetDeviceInfo.js +3 -3
  224. package/lib-es/deviceSDK/hooks/useGetDeviceInfo.js.map +1 -1
  225. package/lib-es/deviceSDK/hooks/useGetLatestAvailableFirmware.d.ts +2 -1
  226. package/lib-es/deviceSDK/hooks/useGetLatestAvailableFirmware.d.ts.map +1 -1
  227. package/lib-es/deviceSDK/hooks/useGetLatestAvailableFirmware.js +2 -1
  228. package/lib-es/deviceSDK/hooks/useGetLatestAvailableFirmware.js.map +1 -1
  229. package/lib-es/deviceSDK/hooks/useToggleOnboardingEarlyChecks.d.ts +2 -1
  230. package/lib-es/deviceSDK/hooks/useToggleOnboardingEarlyChecks.d.ts.map +1 -1
  231. package/lib-es/deviceSDK/hooks/useToggleOnboardingEarlyChecks.js +3 -2
  232. package/lib-es/deviceSDK/hooks/useToggleOnboardingEarlyChecks.js.map +1 -1
  233. package/lib-es/deviceSDK/hooks/useUpdateFirmware.d.ts +2 -1
  234. package/lib-es/deviceSDK/hooks/useUpdateFirmware.d.ts.map +1 -1
  235. package/lib-es/deviceSDK/hooks/useUpdateFirmware.js +3 -2
  236. package/lib-es/deviceSDK/hooks/useUpdateFirmware.js.map +1 -1
  237. package/lib-es/deviceSDK/tasks/getBatteryStatuses.d.ts +1 -0
  238. package/lib-es/deviceSDK/tasks/getBatteryStatuses.d.ts.map +1 -1
  239. package/lib-es/deviceSDK/tasks/getBatteryStatuses.js +2 -2
  240. package/lib-es/deviceSDK/tasks/getBatteryStatuses.js.map +1 -1
  241. package/lib-es/deviceSDK/tasks/getDeviceInfo.d.ts +2 -1
  242. package/lib-es/deviceSDK/tasks/getDeviceInfo.d.ts.map +1 -1
  243. package/lib-es/deviceSDK/tasks/getDeviceInfo.js +2 -2
  244. package/lib-es/deviceSDK/tasks/getDeviceInfo.js.map +1 -1
  245. package/lib-es/deviceSDK/tasks/getLatestFirmware.d.ts +1 -0
  246. package/lib-es/deviceSDK/tasks/getLatestFirmware.d.ts.map +1 -1
  247. package/lib-es/deviceSDK/tasks/getLatestFirmware.js +2 -2
  248. package/lib-es/deviceSDK/tasks/getLatestFirmware.js.map +1 -1
  249. package/lib-es/deviceSDK/tasks/toggleOnboardingEarlyCheck.d.ts +1 -0
  250. package/lib-es/deviceSDK/tasks/toggleOnboardingEarlyCheck.d.ts.map +1 -1
  251. package/lib-es/deviceSDK/tasks/toggleOnboardingEarlyCheck.js +2 -2
  252. package/lib-es/deviceSDK/tasks/toggleOnboardingEarlyCheck.js.map +1 -1
  253. package/lib-es/deviceSDK/tasks/updateFirmware.d.ts +1 -0
  254. package/lib-es/deviceSDK/tasks/updateFirmware.d.ts.map +1 -1
  255. package/lib-es/deviceSDK/tasks/updateFirmware.js +2 -2
  256. package/lib-es/deviceSDK/tasks/updateFirmware.js.map +1 -1
  257. package/lib-es/deviceSDK/transports/core.d.ts +1 -0
  258. package/lib-es/deviceSDK/transports/core.d.ts.map +1 -1
  259. package/lib-es/deviceSDK/transports/core.js +2 -2
  260. package/lib-es/deviceSDK/transports/core.js.map +1 -1
  261. package/lib-es/e2e/index.d.ts +6 -0
  262. package/lib-es/e2e/index.d.ts.map +1 -1
  263. package/lib-es/families/evm/config.d.ts.map +1 -1
  264. package/lib-es/families/evm/config.js +33 -0
  265. package/lib-es/families/evm/config.js.map +1 -1
  266. package/lib-es/featureFlags/defaultFeatures.d.ts +2 -0
  267. package/lib-es/featureFlags/defaultFeatures.d.ts.map +1 -1
  268. package/lib-es/featureFlags/defaultFeatures.js +2 -0
  269. package/lib-es/featureFlags/defaultFeatures.js.map +1 -1
  270. package/lib-es/hw/actions/app.d.ts.map +1 -1
  271. package/lib-es/hw/actions/app.js +2 -1
  272. package/lib-es/hw/actions/app.js.map +1 -1
  273. package/lib-es/hw/actions/customLockScreenLoad.d.ts +1 -1
  274. package/lib-es/hw/actions/customLockScreenLoad.d.ts.map +1 -1
  275. package/lib-es/hw/actions/customLockScreenLoad.js +2 -0
  276. package/lib-es/hw/actions/customLockScreenLoad.js.map +1 -1
  277. package/lib-es/hw/actions/implementations.d.ts +1 -0
  278. package/lib-es/hw/actions/implementations.d.ts.map +1 -1
  279. package/lib-es/hw/actions/implementations.js +12 -2
  280. package/lib-es/hw/actions/implementations.js.map +1 -1
  281. package/lib-es/hw/connectApp.d.ts +2 -1
  282. package/lib-es/hw/connectApp.d.ts.map +1 -1
  283. package/lib-es/hw/connectApp.js +4 -4
  284. package/lib-es/hw/connectApp.js.map +1 -1
  285. package/lib-es/hw/connectManager.d.ts +2 -1
  286. package/lib-es/hw/connectManager.d.ts.map +1 -1
  287. package/lib-es/hw/connectManager.js +4 -4
  288. package/lib-es/hw/connectManager.js.map +1 -1
  289. package/lib-es/hw/customLockScreenFetch.d.ts +2 -1
  290. package/lib-es/hw/customLockScreenFetch.d.ts.map +1 -1
  291. package/lib-es/hw/customLockScreenFetch.js +2 -2
  292. package/lib-es/hw/customLockScreenFetch.js.map +1 -1
  293. package/lib-es/hw/customLockScreenLoad.d.ts +2 -1
  294. package/lib-es/hw/customLockScreenLoad.d.ts.map +1 -1
  295. package/lib-es/hw/customLockScreenLoad.js +2 -2
  296. package/lib-es/hw/customLockScreenLoad.js.map +1 -1
  297. package/lib-es/hw/deviceAccess.d.ts +3 -3
  298. package/lib-es/hw/deviceAccess.d.ts.map +1 -1
  299. package/lib-es/hw/deviceAccess.js +2 -1
  300. package/lib-es/hw/deviceAccess.js.map +1 -1
  301. package/lib-es/hw/getGenuineCheckFromDeviceId.d.ts +2 -1
  302. package/lib-es/hw/getGenuineCheckFromDeviceId.d.ts.map +1 -1
  303. package/lib-es/hw/getGenuineCheckFromDeviceId.js +2 -2
  304. package/lib-es/hw/getGenuineCheckFromDeviceId.js.map +1 -1
  305. package/lib-es/hw/getOnboardingStatePolling.d.ts +2 -1
  306. package/lib-es/hw/getOnboardingStatePolling.d.ts.map +1 -1
  307. package/lib-es/hw/getOnboardingStatePolling.js +5 -2
  308. package/lib-es/hw/getOnboardingStatePolling.js.map +1 -1
  309. package/lib-es/hw/hooks/useGenuineCheck.d.ts +2 -1
  310. package/lib-es/hw/hooks/useGenuineCheck.d.ts.map +1 -1
  311. package/lib-es/hw/hooks/useGenuineCheck.js +3 -1
  312. package/lib-es/hw/hooks/useGenuineCheck.js.map +1 -1
  313. package/lib-es/hw/index.d.ts +6 -2
  314. package/lib-es/hw/index.d.ts.map +1 -1
  315. package/lib-es/hw/index.js +6 -6
  316. package/lib-es/hw/index.js.map +1 -1
  317. package/lib-es/hw/installLanguage.d.ts +2 -1
  318. package/lib-es/hw/installLanguage.d.ts.map +1 -1
  319. package/lib-es/hw/installLanguage.js +2 -2
  320. package/lib-es/hw/installLanguage.js.map +1 -1
  321. package/lib-es/modularDrawer/hooks/useCurrenciesUnderFeatureFlag.d.ts.map +1 -1
  322. package/lib-es/modularDrawer/hooks/useCurrenciesUnderFeatureFlag.js +8 -0
  323. package/lib-es/modularDrawer/hooks/useCurrenciesUnderFeatureFlag.js.map +1 -1
  324. package/lib-es/modularDrawer/hooks/useNetworkAccountCounts.d.ts +1 -5
  325. package/lib-es/modularDrawer/hooks/useNetworkAccountCounts.d.ts.map +1 -1
  326. package/lib-es/modularDrawer/hooks/useNetworkAccountCounts.js +2 -2
  327. package/lib-es/modularDrawer/hooks/useNetworkAccountCounts.js.map +1 -1
  328. package/lib-es/modularDrawer/modules/createNetworkConfiguration.d.ts +1 -1
  329. package/lib-es/modularDrawer/modules/createNetworkConfiguration.d.ts.map +1 -1
  330. package/lib-es/modularDrawer/modules/createNetworkConfiguration.js +1 -2
  331. package/lib-es/modularDrawer/modules/createNetworkConfiguration.js.map +1 -1
  332. package/lib-es/modularDrawer/utils/type.d.ts +0 -5
  333. package/lib-es/modularDrawer/utils/type.d.ts.map +1 -1
  334. package/lib-es/onboarding/hooks/useOnboardingStatePolling.d.ts.map +1 -1
  335. package/lib-es/onboarding/hooks/useOnboardingStatePolling.js +1 -0
  336. package/lib-es/onboarding/hooks/useOnboardingStatePolling.js.map +1 -1
  337. package/lib-es/platform/filters.d.ts +1 -2
  338. package/lib-es/platform/filters.d.ts.map +1 -1
  339. package/lib-es/platform/filters.js +0 -15
  340. package/lib-es/platform/filters.js.map +1 -1
  341. package/lib-es/platform/helpers.d.ts +1 -5
  342. package/lib-es/platform/helpers.d.ts.map +1 -1
  343. package/lib-es/platform/helpers.js +1 -30
  344. package/lib-es/platform/helpers.js.map +1 -1
  345. package/lib-es/platform/react.d.ts +2 -3
  346. package/lib-es/platform/react.d.ts.map +1 -1
  347. package/lib-es/platform/react.js +67 -16
  348. package/lib-es/platform/react.js.map +1 -1
  349. package/lib-es/platform/types.d.ts +3 -3
  350. package/lib-es/platform/types.d.ts.map +1 -1
  351. package/lib-es/utils/getAccountTuplesForCurrency.d.ts +1 -1
  352. package/lib-es/utils/getAccountTuplesForCurrency.d.ts.map +1 -1
  353. package/lib-es/utils/getAccountTuplesForCurrency.js +2 -3
  354. package/lib-es/utils/getAccountTuplesForCurrency.js.map +1 -1
  355. package/lib-es/wallet-api/Exchange/server.d.ts.map +1 -1
  356. package/lib-es/wallet-api/Exchange/server.js +5 -4
  357. package/lib-es/wallet-api/Exchange/server.js.map +1 -1
  358. package/lib-es/wallet-api/converters.d.ts +1 -0
  359. package/lib-es/wallet-api/converters.d.ts.map +1 -1
  360. package/lib-es/wallet-api/converters.js +5 -1
  361. package/lib-es/wallet-api/converters.js.map +1 -1
  362. package/lib-es/wallet-api/react.d.ts +6 -11
  363. package/lib-es/wallet-api/react.d.ts.map +1 -1
  364. package/lib-es/wallet-api/react.js +289 -131
  365. package/lib-es/wallet-api/react.js.map +1 -1
  366. package/lib-es/wallet-api/tracking.d.ts +6 -0
  367. package/lib-es/wallet-api/tracking.d.ts.map +1 -1
  368. package/lib-es/wallet-api/tracking.js +20 -0
  369. package/lib-es/wallet-api/tracking.js.map +1 -1
  370. package/lib-es/wallet-api/useDappLogic.d.ts.map +1 -1
  371. package/lib-es/wallet-api/useDappLogic.js +62 -77
  372. package/lib-es/wallet-api/useDappLogic.js.map +1 -1
  373. package/package.json +59 -59
  374. package/src/__tests__/migration/account-migration.ts +2 -0
  375. package/src/__tests__/test-helpers/environment.ts +2 -0
  376. package/src/currencies/helpers.ts +1 -42
  377. package/src/dada-client/hooks/useAssetsData.ts +1 -0
  378. package/src/deviceSDK/actions/getBatteryStatuses.ts +3 -1
  379. package/src/deviceSDK/actions/getDeviceInfo.ts +3 -2
  380. package/src/deviceSDK/actions/getLatestAvailableFirmware.test.ts +31 -0
  381. package/src/deviceSDK/actions/getLatestAvailableFirmware.ts +7 -2
  382. package/src/deviceSDK/actions/toggleOnboardingEarlyCheck.ts +3 -1
  383. package/src/deviceSDK/actions/updateFirmware.ts +5 -2
  384. package/src/deviceSDK/hooks/useBatteryStatuses.test.ts +3 -1
  385. package/src/deviceSDK/hooks/useBatteryStatuses.ts +4 -1
  386. package/src/deviceSDK/hooks/useGetDeviceInfo.ts +4 -2
  387. package/src/deviceSDK/hooks/useGetLatestAvailableFirmware.ts +3 -0
  388. package/src/deviceSDK/hooks/useToggleOnboardingEarlyChecks.test.ts +2 -0
  389. package/src/deviceSDK/hooks/useToggleOnboardingEarlyChecks.ts +4 -1
  390. package/src/deviceSDK/hooks/useUpdateFirmware.ts +4 -1
  391. package/src/deviceSDK/tasks/getBatteryStatuses.ts +6 -1
  392. package/src/deviceSDK/tasks/getDeviceInfo.ts +6 -2
  393. package/src/deviceSDK/tasks/getLatestFirmware.ts +6 -1
  394. package/src/deviceSDK/tasks/toggleOnboardingEarlyCheck.test.ts +3 -0
  395. package/src/deviceSDK/tasks/toggleOnboardingEarlyCheck.ts +6 -1
  396. package/src/deviceSDK/tasks/updateFirmware.ts +6 -1
  397. package/src/deviceSDK/transports/core.ts +6 -3
  398. package/src/families/evm/config.ts +33 -0
  399. package/src/featureFlags/defaultFeatures.ts +2 -0
  400. package/src/hw/actions/app.ts +2 -1
  401. package/src/hw/actions/customLockScreenLoad.ts +6 -2
  402. package/src/hw/actions/implementations.ts +17 -3
  403. package/src/hw/connectApp.ts +12 -5
  404. package/src/hw/connectManager.ts +13 -6
  405. package/src/hw/customLockScreenFetch.ts +10 -2
  406. package/src/hw/customLockScreenLoad.test.ts +28 -3
  407. package/src/hw/customLockScreenLoad.ts +10 -2
  408. package/src/hw/deviceAccess.ts +4 -3
  409. package/src/hw/getGenuineCheckFromDeviceId.test.ts +4 -0
  410. package/src/hw/getGenuineCheckFromDeviceId.ts +6 -1
  411. package/src/hw/getOnboardingStatePolling.test.ts +34 -0
  412. package/src/hw/getOnboardingStatePolling.ts +6 -3
  413. package/src/hw/hooks/useGenuineCheck.test.ts +37 -0
  414. package/src/hw/hooks/useGenuineCheck.ts +4 -0
  415. package/src/hw/index.test.ts +27 -6
  416. package/src/hw/index.ts +15 -8
  417. package/src/hw/installLanguage.ts +6 -1
  418. package/src/modularDrawer/hooks/__test__/useAssetAccountCounts.test.ts +0 -5
  419. package/src/modularDrawer/hooks/useCurrenciesUnderFeatureFlag.ts +8 -0
  420. package/src/modularDrawer/hooks/useNetworkAccountCounts.tsx +1 -6
  421. package/src/modularDrawer/modules/createNetworkConfiguration.ts +1 -2
  422. package/src/modularDrawer/utils/type.ts +0 -5
  423. package/src/onboarding/hooks/useOnboardingStatePolling.ts +1 -0
  424. package/src/platform/filters.ts +1 -23
  425. package/src/platform/helpers.ts +2 -49
  426. package/src/platform/react.ts +86 -22
  427. package/src/platform/types.ts +1 -1
  428. package/src/utils/__tests__/getAccountTuplesForCurrency.test.ts +0 -30
  429. package/src/utils/getAccountTuplesForCurrency.ts +1 -6
  430. package/src/wallet-api/Exchange/server.test.ts +0 -5
  431. package/src/wallet-api/Exchange/server.ts +7 -6
  432. package/src/wallet-api/converters.ts +6 -1
  433. package/src/wallet-api/react.ts +310 -137
  434. package/src/wallet-api/tracking.ts +22 -0
  435. package/src/wallet-api/useDappLogic.ts +91 -106
  436. package/src/currencies/helpers.test.ts +0 -20
@@ -1,78 +1,45 @@
1
1
  import { useMemo, useState, useEffect, useRef, useCallback } from "react";
2
+ import { useDispatch } from "react-redux";
2
3
  import semver from "semver";
3
4
  import { intervalToDuration } from "date-fns";
4
- import { useWalletAPIServer as useWalletAPIServerRaw } from "@ledgerhq/wallet-api-server/lib/react";
5
- import { firstValueFrom } from "rxjs";
5
+ import { useWalletAPIServer as useWalletAPIServerRaw, } from "@ledgerhq/wallet-api-server";
6
6
  import { first } from "rxjs/operators";
7
- import { accountToWalletAPIAccount, currencyToWalletAPICurrency, getAccountIdFromWalletAccountId, } from "./converters";
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";
8
11
  import { isWalletAPISupportedCurrency } from "./helpers";
9
12
  import { getMainAccount, getParentAccount } from "../account";
10
- import { listCurrencies, findCryptoCurrencyById, getCryptoCurrencyById } from "../currencies";
11
- import { getCryptoAssetsStore } from "../bridge/crypto-assets/index";
13
+ import { listSupportedCurrencies } from "../currencies";
14
+ import { getCryptoAssetsStore } from "../bridge/crypto-assets";
12
15
  import { bitcoinFamilyAccountGetXPubLogic, broadcastTransactionLogic, startExchangeLogic, completeExchangeLogic, receiveOnAccountLogic, signMessageLogic, signTransactionLogic, bitcoinFamilyAccountGetAddressLogic, bitcoinFamilyAccountGetPublicKeyLogic, signRawTransactionLogic, } from "./logic";
13
16
  import { getAccountBridge } from "../bridge";
14
- import { getEnv } from "@ledgerhq/live-env";
15
17
  import openTransportAsSubject from "../hw/openTransportAsSubject";
16
- import { UserRefusedOnDevice } from "@ledgerhq/errors";
17
18
  import { DISCOVER_INITIAL_CATEGORY, INITIAL_PLATFORM_STATE, MAX_RECENTLY_USED_LENGTH, } from "./constants";
19
+ import { useCurrenciesUnderFeatureFlag } from "../modularDrawer/hooks/useCurrenciesUnderFeatureFlag";
18
20
  export function safeGetRefValue(ref) {
19
21
  if (!ref.current) {
20
22
  throw new Error("Ref objects doesn't have a current value");
21
23
  }
22
24
  return ref.current;
23
25
  }
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);
26
+ export function useSetWalletAPIAccounts(accounts) {
27
+ useEffect(() => {
28
+ accounts.forEach(account => {
29
+ setWalletApiIdForAccountId(account.id);
29
30
  });
30
- }, [walletState, accounts]);
31
+ }, [accounts]);
31
32
  }
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) {
33
+ export function useDAppManifestCurrencyIds(manifest) {
43
34
  return useMemo(() => {
44
35
  return (manifest.dapp?.networks.map(network => {
45
- return getCryptoCurrencyById(network.currency);
36
+ return network.currency;
46
37
  }) ?? []);
47
38
  }, [manifest.dapp?.networks]);
48
39
  }
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
- }
72
40
  export function usePermission(manifest) {
73
41
  return useMemo(() => ({
74
- currencyIds: manifest.currencies === "*" ? ["**"] : manifest.currencies,
75
- methodIds: manifest.permissions, // TODO remove when using the correct manifest type
42
+ methodIds: manifest.permissions,
76
43
  }), [manifest]);
77
44
  }
78
45
  function useTransport(postMessage) {
@@ -90,7 +57,7 @@ export function useConfig({ appId, userId, tracking, wallet, mevProtected, }) {
90
57
  tracking,
91
58
  wallet,
92
59
  mevProtected,
93
- }), [appId, tracking, userId, wallet]);
60
+ }), [appId, mevProtected, tracking, userId, wallet]);
94
61
  }
95
62
  function useDeviceTransport({ manifest, tracking }) {
96
63
  const ref = useRef();
@@ -140,73 +107,257 @@ function useDeviceTransport({ manifest, tracking }) {
140
107
  return useMemo(() => ({ ref, subscribe, close, exchange }), [close, exchange, subscribe]);
141
108
  }
142
109
  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();
143
112
  const permission = usePermission(manifest);
144
113
  const transport = useTransport(webviewHook.postMessage);
145
114
  const [widgetLoaded, setWidgetLoaded] = useState(false);
146
- const walletAPIAccounts = useWalletAPIAccounts(walletState, accounts);
147
- const walletAPICurrencies = useWalletAPICurrencies();
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);
148
118
  const { server, onMessage } = useWalletAPIServerRaw({
149
119
  transport,
150
120
  config,
151
- accounts: walletAPIAccounts,
152
- currencies: walletAPICurrencies,
153
121
  permission,
154
122
  customHandlers,
155
123
  });
156
124
  useEffect(() => {
157
125
  tracking.load(manifest);
158
126
  }, [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]);
159
321
  useEffect(() => {
160
322
  if (!uiAccountRequest)
161
323
  return;
162
- server.setHandler("account.request", async ({ accounts$, currencies$, drawerConfiguration, areCurrenciesFiltered, useCase }) => {
324
+ server.setHandler("account.request", async ({ currencyIds, drawerConfiguration, areCurrenciesFiltered, useCase }) => {
163
325
  tracking.requestAccountRequested(manifest);
164
- const currencies = await firstValueFrom(currencies$);
165
326
  return new Promise((resolve, reject) => {
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
- })();
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
+ }
203
354
  });
204
355
  });
205
356
  }, [walletState, manifest, server, tracking, uiAccountRequest]);
206
357
  useEffect(() => {
207
358
  if (!uiAccountReceive)
208
359
  return;
209
- server.setHandler("account.receive", ({ account, tokenCurrency }) => receiveOnAccountLogic(walletState, { manifest, accounts, tracking }, account.id, (account, parentAccount, accountAddress) => new Promise((resolve, reject) => {
360
+ server.setHandler("account.receive", ({ accountId, tokenCurrency }) => receiveOnAccountLogic(walletState, { manifest, accounts, tracking }, accountId, (account, parentAccount, accountAddress) => new Promise((resolve, reject) => {
210
361
  let done = false;
211
362
  return uiAccountReceive({
212
363
  account,
@@ -239,7 +390,7 @@ export function useWalletAPIServer({ walletState, manifest, accounts, tracking,
239
390
  useEffect(() => {
240
391
  if (!uiMessageSign)
241
392
  return;
242
- server.setHandler("message.sign", ({ account, message, options }) => signMessageLogic({ manifest, accounts, tracking }, account.id, message.toString("hex"), (account, message) => new Promise((resolve, reject) => {
393
+ server.setHandler("message.sign", ({ accountId, message, options }) => signMessageLogic({ manifest, accounts, tracking }, accountId, message.toString("hex"), (account, message) => new Promise((resolve, reject) => {
243
394
  let done = false;
244
395
  return uiMessageSign({
245
396
  account,
@@ -284,31 +435,38 @@ export function useWalletAPIServer({ walletState, manifest, accounts, tracking,
284
435
  useEffect(() => {
285
436
  if (!uiTxSign)
286
437
  return;
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
- },
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
+ });
309
467
  });
310
- }), tokenCurrency);
311
- return account.currency === "solana"
468
+ }, tokenCurrency);
469
+ return currency === "solana"
312
470
  ? Buffer.from(signedOperation.signature, "hex")
313
471
  : Buffer.from(signedOperation.signature);
314
472
  });
@@ -316,8 +474,8 @@ export function useWalletAPIServer({ walletState, manifest, accounts, tracking,
316
474
  useEffect(() => {
317
475
  if (!uiTxSignRaw)
318
476
  return;
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) => {
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) => {
321
479
  let done = false;
322
480
  return uiTxSignRaw({
323
481
  account,
@@ -342,7 +500,7 @@ export function useWalletAPIServer({ walletState, manifest, accounts, tracking,
342
500
  }));
343
501
  let hash;
344
502
  if (broadcast) {
345
- hash = await broadcastTransactionLogic({ manifest, accounts, tracking }, account.id, signedOperation, async (account, parentAccount, signedOperation) => {
503
+ hash = await broadcastTransactionLogic({ manifest, accounts, tracking }, accountId, signedOperation, async (account, parentAccount, signedOperation) => {
346
504
  const bridge = getAccountBridge(account, parentAccount);
347
505
  const mainAccount = getMainAccount(account, parentAccount);
348
506
  let optimisticOperation = signedOperation.operation;
@@ -374,9 +532,9 @@ export function useWalletAPIServer({ walletState, manifest, accounts, tracking,
374
532
  useEffect(() => {
375
533
  if (!uiTxSign)
376
534
  return;
377
- server.setHandler("transaction.signAndBroadcast", async ({ account, tokenCurrency, transaction, options }) => {
535
+ server.setHandler("transaction.signAndBroadcast", async ({ accountId, tokenCurrency, transaction, options }) => {
378
536
  const sponsored = transaction.family === "ethereum" && transaction.sponsored;
379
- const signedTransaction = await signTransactionLogic({ manifest, accounts, tracking }, account.id, transaction, (account, parentAccount, signFlowInfos) => new Promise((resolve, reject) => {
537
+ const signedTransaction = await signTransactionLogic({ manifest, accounts, tracking }, accountId, transaction, (account, parentAccount, signFlowInfos) => new Promise((resolve, reject) => {
380
538
  let done = false;
381
539
  return uiTxSign({
382
540
  account,
@@ -399,7 +557,7 @@ export function useWalletAPIServer({ walletState, manifest, accounts, tracking,
399
557
  },
400
558
  });
401
559
  }), tokenCurrency);
402
- return broadcastTransactionLogic({ manifest, accounts, tracking }, account.id, signedTransaction, async (account, parentAccount, signedOperation) => {
560
+ return broadcastTransactionLogic({ manifest, accounts, tracking }, accountId, signedTransaction, async (account, parentAccount, signedOperation) => {
403
561
  const bridge = getAccountBridge(account, parentAccount);
404
562
  const mainAccount = getMainAccount(account, parentAccount);
405
563
  let optimisticOperation = signedOperation.operation;
@@ -605,8 +763,8 @@ export function useWalletAPIServer({ walletState, manifest, accounts, tracking,
605
763
  // retrofit of the exchange params to fit the old platform spec
606
764
  const request = {
607
765
  provider: params.provider,
608
- fromAccountId: params.fromAccount.id,
609
- toAccountId: params.exchangeType === "SWAP" ? params.toAccount.id : undefined,
766
+ fromAccountId: params.fromAccountId,
767
+ toAccountId: params.exchangeType === "SWAP" ? params.toAccountId : undefined,
610
768
  transaction: params.transaction,
611
769
  binaryPayload: params.binaryPayload.toString("hex"),
612
770
  signature: params.signature.toString("hex"),
@@ -639,7 +797,7 @@ export function useWalletAPIServer({ walletState, manifest, accounts, tracking,
639
797
  });
640
798
  }, [uiExchangeComplete, accounts, manifest, server, tracking]);
641
799
  return {
642
- widgetLoaded,
800
+ widgetLoaded: widgetLoaded,
643
801
  onMessage,
644
802
  onLoad,
645
803
  onReload,
@@ -759,9 +917,9 @@ export function useRecentlyUsed(manifests, [recentlyUsedManifestsDb, setState])
759
917
  ...res,
760
918
  usedAt: calculateTimeDiff(recentlyUsed.usedAt),
761
919
  }
762
- : res;
920
+ : undefined;
763
921
  })
764
- .filter(manifest => manifest !== undefined), [recentlyUsedManifestsDb, manifests]);
922
+ .filter((manifest) => manifest !== undefined), [recentlyUsedManifestsDb, manifests]);
765
923
  const append = useCallback((manifest) => {
766
924
  setState(state => {
767
925
  const index = state.recentlyUsed.findIndex(({ id }) => id === manifest.id);