@ledgerhq/live-common 34.38.1-hotfix.0 → 34.38.2-nightly.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (256) hide show
  1. package/lib/__tests__/hw/getLatestFirmwareForDevice.js +4 -0
  2. package/lib/__tests__/hw/getLatestFirmwareForDevice.js.map +1 -1
  3. package/lib/__tests__/test-helpers/deviceInfos.d.ts.map +1 -1
  4. package/lib/__tests__/test-helpers/deviceInfos.js +5 -0
  5. package/lib/__tests__/test-helpers/deviceInfos.js.map +1 -1
  6. package/lib/apps/mock.d.ts +2 -32
  7. package/lib/apps/mock.d.ts.map +1 -1
  8. package/lib/apps/mock.js +3 -0
  9. package/lib/apps/mock.js.map +1 -1
  10. package/lib/apps/polyfill.d.ts +4 -1
  11. package/lib/apps/polyfill.d.ts.map +1 -1
  12. package/lib/bridge/cache.d.ts.map +1 -1
  13. package/lib/bridge/cache.js +2 -2
  14. package/lib/bridge/cache.js.map +1 -1
  15. package/lib/bridge/cache.test.d.ts +2 -0
  16. package/lib/bridge/cache.test.d.ts.map +1 -0
  17. package/lib/bridge/cache.test.js +63 -0
  18. package/lib/bridge/cache.test.js.map +1 -0
  19. package/lib/deposit/deposit.test.js +418 -74
  20. package/lib/deposit/deposit.test.js.map +1 -1
  21. package/lib/deposit/helper.d.ts +1 -0
  22. package/lib/deposit/helper.d.ts.map +1 -1
  23. package/lib/deposit/helper.js +19 -6
  24. package/lib/deposit/helper.js.map +1 -1
  25. package/lib/deviceSDK/tasks/getDeviceInfo.d.ts.map +1 -1
  26. package/lib/deviceSDK/tasks/getDeviceInfo.js +3 -1
  27. package/lib/deviceSDK/tasks/getDeviceInfo.js.map +1 -1
  28. package/lib/e2e/enum/Provider.d.ts +1 -1
  29. package/lib/e2e/enum/Provider.d.ts.map +1 -1
  30. package/lib/e2e/enum/Provider.js +1 -1
  31. package/lib/e2e/enum/Provider.js.map +1 -1
  32. package/lib/e2e/index.d.ts +5 -0
  33. package/lib/e2e/index.d.ts.map +1 -1
  34. package/lib/e2e/swap.d.ts.map +1 -1
  35. package/lib/e2e/swap.js +10 -7
  36. package/lib/e2e/swap.js.map +1 -1
  37. package/lib/env.react.d.ts +1 -1
  38. package/lib/env.react.d.ts.map +1 -1
  39. package/lib/featureFlags/defaultFeatures.d.ts.map +1 -1
  40. package/lib/featureFlags/defaultFeatures.js +35 -0
  41. package/lib/featureFlags/defaultFeatures.js.map +1 -1
  42. package/lib/featureFlags/useFeature.d.ts +1 -1
  43. package/lib/featureFlags/useFeature.d.ts.map +1 -1
  44. package/lib/hooks/useAppVersionBlockCheck.d.ts +11 -0
  45. package/lib/hooks/useAppVersionBlockCheck.d.ts.map +1 -0
  46. package/lib/hooks/useAppVersionBlockCheck.js +32 -0
  47. package/lib/hooks/useAppVersionBlockCheck.js.map +1 -0
  48. package/lib/hooks/useAppVersionBlockCheck.test.d.ts +2 -0
  49. package/lib/hooks/useAppVersionBlockCheck.test.d.ts.map +1 -0
  50. package/lib/hooks/useAppVersionBlockCheck.test.js +133 -0
  51. package/lib/hooks/useAppVersionBlockCheck.test.js.map +1 -0
  52. package/lib/hw/connectAppEventMapper.d.ts.map +1 -1
  53. package/lib/hw/connectAppEventMapper.js +3 -1
  54. package/lib/hw/connectAppEventMapper.js.map +1 -1
  55. package/lib/hw/connectManager.d.ts.map +1 -1
  56. package/lib/hw/connectManager.js +9 -0
  57. package/lib/hw/connectManager.js.map +1 -1
  58. package/lib/hw/customLockScreenLoad.d.ts.map +1 -1
  59. package/lib/hw/customLockScreenLoad.js +22 -18
  60. package/lib/hw/customLockScreenLoad.js.map +1 -1
  61. package/lib/hw/customLockScreenLoad.test.d.ts +2 -0
  62. package/lib/hw/customLockScreenLoad.test.d.ts.map +1 -0
  63. package/lib/hw/customLockScreenLoad.test.js +63 -0
  64. package/lib/hw/customLockScreenLoad.test.js.map +1 -0
  65. package/lib/hw/extractOnboardingState.d.ts +15 -2
  66. package/lib/hw/extractOnboardingState.d.ts.map +1 -1
  67. package/lib/hw/extractOnboardingState.js +67 -19
  68. package/lib/hw/extractOnboardingState.js.map +1 -1
  69. package/lib/hw/extractOnboardingState.test.js +96 -1
  70. package/lib/hw/extractOnboardingState.test.js.map +1 -1
  71. package/lib/hw/getDeviceInfo.d.ts.map +1 -1
  72. package/lib/hw/getDeviceInfo.js +3 -1
  73. package/lib/hw/getDeviceInfo.js.map +1 -1
  74. package/lib/hw/getGenuineCheckFromDeviceId.test.js +1 -0
  75. package/lib/hw/getGenuineCheckFromDeviceId.test.js.map +1 -1
  76. package/lib/hw/getOnboardingStatePolling.js +1 -1
  77. package/lib/hw/getOnboardingStatePolling.js.map +1 -1
  78. package/lib/hw/getOnboardingStatePolling.test.js +2 -0
  79. package/lib/hw/getOnboardingStatePolling.test.js.map +1 -1
  80. package/lib/hw/isFirmwareUpdateVersionSupported.test.js +2 -1
  81. package/lib/hw/isFirmwareUpdateVersionSupported.test.js.map +1 -1
  82. package/lib/mock/fixtures/aDeviceInfo.d.ts.map +1 -1
  83. package/lib/mock/fixtures/aDeviceInfo.js +1 -0
  84. package/lib/mock/fixtures/aDeviceInfo.js.map +1 -1
  85. package/lib/modularDrawer/__test__/useModularDrawerVisibility.test.d.ts +2 -0
  86. package/lib/modularDrawer/__test__/useModularDrawerVisibility.test.d.ts.map +1 -0
  87. package/lib/modularDrawer/__test__/useModularDrawerVisibility.test.js +107 -0
  88. package/lib/modularDrawer/__test__/useModularDrawerVisibility.test.js.map +1 -0
  89. package/lib/modularDrawer/enums.d.ts +8 -0
  90. package/lib/modularDrawer/enums.d.ts.map +1 -0
  91. package/lib/modularDrawer/enums.js +12 -0
  92. package/lib/modularDrawer/enums.js.map +1 -0
  93. package/lib/modularDrawer/useModularDrawerVisibility.d.ts +9 -0
  94. package/lib/modularDrawer/useModularDrawerVisibility.d.ts.map +1 -0
  95. package/lib/modularDrawer/useModularDrawerVisibility.js +18 -0
  96. package/lib/modularDrawer/useModularDrawerVisibility.js.map +1 -0
  97. package/lib/onboarding/hooks/useOnboardingStatePolling.test.js +2 -0
  98. package/lib/onboarding/hooks/useOnboardingStatePolling.test.js.map +1 -1
  99. package/lib/wallet-api/types.d.ts +1 -1
  100. package/lib/wallet-api/types.d.ts.map +1 -1
  101. package/lib/wallet-api/useDappLogic.d.ts.map +1 -1
  102. package/lib/wallet-api/useDappLogic.js +3 -24
  103. package/lib/wallet-api/useDappLogic.js.map +1 -1
  104. package/lib/wallet-api/utils/txTrackingHelper.d.ts +3 -0
  105. package/lib/wallet-api/utils/txTrackingHelper.d.ts.map +1 -0
  106. package/lib/wallet-api/utils/txTrackingHelper.js +16 -0
  107. package/lib/wallet-api/utils/txTrackingHelper.js.map +1 -0
  108. package/lib/wallet-api/utils/txTrackingHelper.test.d.ts +2 -0
  109. package/lib/wallet-api/utils/txTrackingHelper.test.d.ts.map +1 -0
  110. package/lib/wallet-api/utils/txTrackingHelper.test.js +70 -0
  111. package/lib/wallet-api/utils/txTrackingHelper.test.js.map +1 -0
  112. package/lib-es/__tests__/hw/getLatestFirmwareForDevice.js +4 -0
  113. package/lib-es/__tests__/hw/getLatestFirmwareForDevice.js.map +1 -1
  114. package/lib-es/__tests__/test-helpers/deviceInfos.d.ts.map +1 -1
  115. package/lib-es/__tests__/test-helpers/deviceInfos.js +5 -0
  116. package/lib-es/__tests__/test-helpers/deviceInfos.js.map +1 -1
  117. package/lib-es/apps/mock.d.ts +2 -32
  118. package/lib-es/apps/mock.d.ts.map +1 -1
  119. package/lib-es/apps/mock.js +3 -0
  120. package/lib-es/apps/mock.js.map +1 -1
  121. package/lib-es/apps/polyfill.d.ts +4 -1
  122. package/lib-es/apps/polyfill.d.ts.map +1 -1
  123. package/lib-es/bridge/cache.d.ts.map +1 -1
  124. package/lib-es/bridge/cache.js +2 -2
  125. package/lib-es/bridge/cache.js.map +1 -1
  126. package/lib-es/bridge/cache.test.d.ts +2 -0
  127. package/lib-es/bridge/cache.test.d.ts.map +1 -0
  128. package/lib-es/bridge/cache.test.js +38 -0
  129. package/lib-es/bridge/cache.test.js.map +1 -0
  130. package/lib-es/deposit/deposit.test.js +419 -75
  131. package/lib-es/deposit/deposit.test.js.map +1 -1
  132. package/lib-es/deposit/helper.d.ts +1 -0
  133. package/lib-es/deposit/helper.d.ts.map +1 -1
  134. package/lib-es/deposit/helper.js +18 -6
  135. package/lib-es/deposit/helper.js.map +1 -1
  136. package/lib-es/deviceSDK/tasks/getDeviceInfo.d.ts.map +1 -1
  137. package/lib-es/deviceSDK/tasks/getDeviceInfo.js +3 -1
  138. package/lib-es/deviceSDK/tasks/getDeviceInfo.js.map +1 -1
  139. package/lib-es/e2e/enum/Provider.d.ts +1 -1
  140. package/lib-es/e2e/enum/Provider.d.ts.map +1 -1
  141. package/lib-es/e2e/enum/Provider.js +1 -1
  142. package/lib-es/e2e/enum/Provider.js.map +1 -1
  143. package/lib-es/e2e/index.d.ts +5 -0
  144. package/lib-es/e2e/index.d.ts.map +1 -1
  145. package/lib-es/e2e/swap.d.ts.map +1 -1
  146. package/lib-es/e2e/swap.js +10 -7
  147. package/lib-es/e2e/swap.js.map +1 -1
  148. package/lib-es/env.react.d.ts +1 -1
  149. package/lib-es/env.react.d.ts.map +1 -1
  150. package/lib-es/featureFlags/defaultFeatures.d.ts.map +1 -1
  151. package/lib-es/featureFlags/defaultFeatures.js +35 -0
  152. package/lib-es/featureFlags/defaultFeatures.js.map +1 -1
  153. package/lib-es/featureFlags/useFeature.d.ts +1 -1
  154. package/lib-es/featureFlags/useFeature.d.ts.map +1 -1
  155. package/lib-es/hooks/useAppVersionBlockCheck.d.ts +11 -0
  156. package/lib-es/hooks/useAppVersionBlockCheck.d.ts.map +1 -0
  157. package/lib-es/hooks/useAppVersionBlockCheck.js +25 -0
  158. package/lib-es/hooks/useAppVersionBlockCheck.js.map +1 -0
  159. package/lib-es/hooks/useAppVersionBlockCheck.test.d.ts +2 -0
  160. package/lib-es/hooks/useAppVersionBlockCheck.test.d.ts.map +1 -0
  161. package/lib-es/hooks/useAppVersionBlockCheck.test.js +131 -0
  162. package/lib-es/hooks/useAppVersionBlockCheck.test.js.map +1 -0
  163. package/lib-es/hw/connectAppEventMapper.d.ts.map +1 -1
  164. package/lib-es/hw/connectAppEventMapper.js +3 -1
  165. package/lib-es/hw/connectAppEventMapper.js.map +1 -1
  166. package/lib-es/hw/connectManager.d.ts.map +1 -1
  167. package/lib-es/hw/connectManager.js +9 -0
  168. package/lib-es/hw/connectManager.js.map +1 -1
  169. package/lib-es/hw/customLockScreenLoad.d.ts.map +1 -1
  170. package/lib-es/hw/customLockScreenLoad.js +22 -18
  171. package/lib-es/hw/customLockScreenLoad.js.map +1 -1
  172. package/lib-es/hw/customLockScreenLoad.test.d.ts +2 -0
  173. package/lib-es/hw/customLockScreenLoad.test.d.ts.map +1 -0
  174. package/lib-es/hw/customLockScreenLoad.test.js +58 -0
  175. package/lib-es/hw/customLockScreenLoad.test.js.map +1 -0
  176. package/lib-es/hw/extractOnboardingState.d.ts +15 -2
  177. package/lib-es/hw/extractOnboardingState.d.ts.map +1 -1
  178. package/lib-es/hw/extractOnboardingState.js +66 -18
  179. package/lib-es/hw/extractOnboardingState.js.map +1 -1
  180. package/lib-es/hw/extractOnboardingState.test.js +97 -2
  181. package/lib-es/hw/extractOnboardingState.test.js.map +1 -1
  182. package/lib-es/hw/getDeviceInfo.d.ts.map +1 -1
  183. package/lib-es/hw/getDeviceInfo.js +3 -1
  184. package/lib-es/hw/getDeviceInfo.js.map +1 -1
  185. package/lib-es/hw/getGenuineCheckFromDeviceId.test.js +1 -0
  186. package/lib-es/hw/getGenuineCheckFromDeviceId.test.js.map +1 -1
  187. package/lib-es/hw/getOnboardingStatePolling.js +1 -1
  188. package/lib-es/hw/getOnboardingStatePolling.js.map +1 -1
  189. package/lib-es/hw/getOnboardingStatePolling.test.js +2 -0
  190. package/lib-es/hw/getOnboardingStatePolling.test.js.map +1 -1
  191. package/lib-es/hw/isFirmwareUpdateVersionSupported.test.js +2 -1
  192. package/lib-es/hw/isFirmwareUpdateVersionSupported.test.js.map +1 -1
  193. package/lib-es/mock/fixtures/aDeviceInfo.d.ts.map +1 -1
  194. package/lib-es/mock/fixtures/aDeviceInfo.js +1 -0
  195. package/lib-es/mock/fixtures/aDeviceInfo.js.map +1 -1
  196. package/lib-es/modularDrawer/__test__/useModularDrawerVisibility.test.d.ts +2 -0
  197. package/lib-es/modularDrawer/__test__/useModularDrawerVisibility.test.d.ts.map +1 -0
  198. package/lib-es/modularDrawer/__test__/useModularDrawerVisibility.test.js +105 -0
  199. package/lib-es/modularDrawer/__test__/useModularDrawerVisibility.test.js.map +1 -0
  200. package/lib-es/modularDrawer/enums.d.ts +8 -0
  201. package/lib-es/modularDrawer/enums.d.ts.map +1 -0
  202. package/lib-es/modularDrawer/enums.js +9 -0
  203. package/lib-es/modularDrawer/enums.js.map +1 -0
  204. package/lib-es/modularDrawer/useModularDrawerVisibility.d.ts +9 -0
  205. package/lib-es/modularDrawer/useModularDrawerVisibility.d.ts.map +1 -0
  206. package/lib-es/modularDrawer/useModularDrawerVisibility.js +14 -0
  207. package/lib-es/modularDrawer/useModularDrawerVisibility.js.map +1 -0
  208. package/lib-es/onboarding/hooks/useOnboardingStatePolling.test.js +2 -0
  209. package/lib-es/onboarding/hooks/useOnboardingStatePolling.test.js.map +1 -1
  210. package/lib-es/wallet-api/types.d.ts +1 -1
  211. package/lib-es/wallet-api/types.d.ts.map +1 -1
  212. package/lib-es/wallet-api/useDappLogic.d.ts.map +1 -1
  213. package/lib-es/wallet-api/useDappLogic.js +3 -24
  214. package/lib-es/wallet-api/useDappLogic.js.map +1 -1
  215. package/lib-es/wallet-api/utils/txTrackingHelper.d.ts +3 -0
  216. package/lib-es/wallet-api/utils/txTrackingHelper.d.ts.map +1 -0
  217. package/lib-es/wallet-api/utils/txTrackingHelper.js +12 -0
  218. package/lib-es/wallet-api/utils/txTrackingHelper.js.map +1 -0
  219. package/lib-es/wallet-api/utils/txTrackingHelper.test.d.ts +2 -0
  220. package/lib-es/wallet-api/utils/txTrackingHelper.test.d.ts.map +1 -0
  221. package/lib-es/wallet-api/utils/txTrackingHelper.test.js +68 -0
  222. package/lib-es/wallet-api/utils/txTrackingHelper.test.js.map +1 -0
  223. package/package.json +50 -50
  224. package/src/__tests__/hw/getLatestFirmwareForDevice.ts +8 -3
  225. package/src/__tests__/test-helpers/deviceInfos.ts +5 -0
  226. package/src/apps/mock.ts +5 -2
  227. package/src/bridge/cache.test.ts +46 -0
  228. package/src/bridge/cache.ts +5 -2
  229. package/src/deposit/deposit.test.ts +611 -136
  230. package/src/deposit/helper.ts +27 -9
  231. package/src/deviceSDK/tasks/getDeviceInfo.ts +3 -0
  232. package/src/e2e/enum/Provider.ts +1 -1
  233. package/src/e2e/swap.ts +12 -7
  234. package/src/featureFlags/defaultFeatures.ts +35 -0
  235. package/src/hooks/useAppVersionBlockCheck.test.ts +134 -0
  236. package/src/hooks/useAppVersionBlockCheck.ts +65 -0
  237. package/src/hw/connectAppEventMapper.ts +3 -1
  238. package/src/hw/connectManager.ts +18 -0
  239. package/src/hw/customLockScreenLoad.test.ts +86 -0
  240. package/src/hw/customLockScreenLoad.ts +31 -17
  241. package/src/hw/extractOnboardingState.test.ts +122 -2
  242. package/src/hw/extractOnboardingState.ts +81 -18
  243. package/src/hw/getDeviceInfo.ts +4 -1
  244. package/src/hw/getGenuineCheckFromDeviceId.test.ts +2 -1
  245. package/src/hw/getOnboardingStatePolling.test.ts +2 -0
  246. package/src/hw/getOnboardingStatePolling.ts +1 -1
  247. package/src/hw/isFirmwareUpdateVersionSupported.test.ts +3 -1
  248. package/src/mock/fixtures/aDeviceInfo.ts +1 -0
  249. package/src/modularDrawer/__test__/useModularDrawerVisibility.test.ts +149 -0
  250. package/src/modularDrawer/enums.ts +7 -0
  251. package/src/modularDrawer/useModularDrawerVisibility.ts +25 -0
  252. package/src/onboarding/hooks/useOnboardingStatePolling.test.ts +2 -0
  253. package/src/wallet-api/types.ts +1 -1
  254. package/src/wallet-api/useDappLogic.ts +4 -27
  255. package/src/wallet-api/utils/txTrackingHelper.test.ts +80 -0
  256. package/src/wallet-api/utils/txTrackingHelper.ts +14 -0
@@ -1,5 +1,5 @@
1
1
  import { DeviceExtractOnboardingStateError } from "@ledgerhq/errors";
2
- import { extractOnboardingState, OnboardingStep } from "./extractOnboardingState";
2
+ import { CharonStatus, extractOnboardingState, OnboardingStep } from "./extractOnboardingState";
3
3
 
4
4
  describe("@hw/extractOnboardingState", () => {
5
5
  describe("extractOnboardingState", () => {
@@ -22,6 +22,76 @@ describe("@hw/extractOnboardingState", () => {
22
22
  expect(onboardingState).not.toBeNull();
23
23
  expect(onboardingState?.isOnboarded).toBe(true);
24
24
  });
25
+
26
+ describe("and the user is on the charon backup screen", () => {
27
+ const flagsBytes = Buffer.from([1 << 2, 0, 0, 0xb]);
28
+
29
+ describe("and the device was seeded with charon", () => {
30
+ it("should return an onboarding step that is set at the charon screen", () => {
31
+ const charonState = Buffer.from([0x0]);
32
+ const onboardingState = extractOnboardingState(flagsBytes, charonState);
33
+
34
+ expect(onboardingState).not.toBeNull();
35
+ expect(onboardingState?.currentOnboardingStep).toBe(OnboardingStep.Ready);
36
+ expect(onboardingState?.charonStatus).toBeNull();
37
+ });
38
+ });
39
+
40
+ describe("and the user refuse to backup the charon", () => {
41
+ it("should return an onboarding step that is set at ready", () => {
42
+ const charonState = Buffer.from([0x1]);
43
+ const onboardingState = extractOnboardingState(flagsBytes, charonState);
44
+
45
+ expect(onboardingState).not.toBeNull();
46
+ expect(onboardingState?.currentOnboardingStep).toBe(OnboardingStep.Ready);
47
+ expect(onboardingState?.charonStatus).toBe(CharonStatus.Rejected);
48
+ });
49
+
50
+ describe("and charon backup process started but not finished", () => {
51
+ it("should return an onboarding step that is set at the charon screen", () => {
52
+ const charonState = Buffer.from([0x3]);
53
+ const onboardingState = extractOnboardingState(flagsBytes, charonState);
54
+
55
+ expect(onboardingState).not.toBeNull();
56
+ expect(onboardingState?.currentOnboardingStep).toBe(OnboardingStep.BackupCharon);
57
+ expect(onboardingState?.charonStatus).toBe(CharonStatus.Running);
58
+ });
59
+
60
+ describe("and the charon backup is done and naming not finished", () => {
61
+ it("should return an onboarding step that is set at the charon screen", () => {
62
+ const charonState = Buffer.from([0x4]);
63
+ const onboardingState = extractOnboardingState(flagsBytes, charonState);
64
+
65
+ expect(onboardingState).not.toBeNull();
66
+ expect(onboardingState?.currentOnboardingStep).toBe(OnboardingStep.BackupCharon);
67
+ expect(onboardingState?.charonStatus).toBe(CharonStatus.Naming);
68
+ });
69
+
70
+ describe("and the charon backup is done and backup-process exited", () => {
71
+ it("should return an onboarding step that is set at ready", () => {
72
+ const charonState = Buffer.from([0x5]);
73
+ const onboardingState = extractOnboardingState(flagsBytes, charonState);
74
+
75
+ expect(onboardingState).not.toBeNull();
76
+ expect(onboardingState?.currentOnboardingStep).toBe(OnboardingStep.Ready);
77
+ expect(onboardingState?.charonStatus).toBe(CharonStatus.Ready);
78
+ });
79
+ });
80
+ });
81
+ });
82
+ });
83
+
84
+ describe("and charon backup is not started and not fully refused", () => {
85
+ it("should return an onboarding step that is set at ready", () => {
86
+ const charonState = Buffer.from([0x2]);
87
+ const onboardingState = extractOnboardingState(flagsBytes, charonState);
88
+
89
+ expect(onboardingState).not.toBeNull();
90
+ expect(onboardingState?.currentOnboardingStep).toBe(OnboardingStep.BackupCharon);
91
+ expect(onboardingState?.charonStatus).toBe(CharonStatus.Choice);
92
+ });
93
+ });
94
+ });
25
95
  });
26
96
 
27
97
  describe("When the device is in recovery mode", () => {
@@ -282,9 +352,26 @@ describe("@hw/extractOnboardingState", () => {
282
352
  });
283
353
  });
284
354
 
285
- describe("and the user finished the onboarding process", () => {
355
+ describe("and the user finished the onboarding process with a device that does not support charon", () => {
286
356
  beforeEach(() => {
287
357
  flagsBytes[3] = 11;
358
+ flagsBytes[4] = 0; // recover
359
+ flagsBytes[5] = undefined as unknown as number; // charon not supported
360
+ });
361
+
362
+ it("should return an onboarding step that is set at ready", () => {
363
+ const onboardingState = extractOnboardingState(flagsBytes);
364
+
365
+ expect(onboardingState).not.toBeNull();
366
+ expect(onboardingState?.currentOnboardingStep).toBe(OnboardingStep.Ready);
367
+ });
368
+ });
369
+
370
+ describe("and the user finished the onboarding process with a device that does not support recover and charon", () => {
371
+ beforeEach(() => {
372
+ flagsBytes[3] = 11;
373
+ flagsBytes[4] = undefined as unknown as number; // recover not supported
374
+ flagsBytes[5] = undefined as unknown as number; // charon not supported
288
375
  });
289
376
 
290
377
  it("should return an onboarding step that is set at ready", () => {
@@ -309,6 +396,39 @@ describe("@hw/extractOnboardingState", () => {
309
396
  );
310
397
  });
311
398
  });
399
+
400
+ describe("and the user is on the restore charon screen", () => {
401
+ beforeEach(() => {
402
+ flagsBytes = Buffer.from([0, 0, 0, 0x10]);
403
+ });
404
+
405
+ it("should return an onboarding step that is set at the restore from charon screen", () => {
406
+ const onboardingState = extractOnboardingState(flagsBytes);
407
+
408
+ expect(onboardingState).not.toBeNull();
409
+ expect(onboardingState?.currentOnboardingStep).toBe(OnboardingStep.RestoreCharon);
410
+ });
411
+ });
412
+ });
413
+
414
+ describe("When charon flags are provided", () => {
415
+ it("should return charonSupported=true", () => {
416
+ const onboardingState = extractOnboardingState(
417
+ Buffer.from([0, 0, 0, 0]),
418
+ Buffer.from([0x0]),
419
+ );
420
+
421
+ expect(onboardingState).not.toBeNull();
422
+ expect(onboardingState?.charonSupported).toBe(true);
423
+ });
424
+ });
425
+ describe("When charon flags are not provided", () => {
426
+ it("should return charonSupported=false", () => {
427
+ const onboardingState = extractOnboardingState(Buffer.from([0, 0, 0, 0]));
428
+
429
+ expect(onboardingState).not.toBeNull();
430
+ expect(onboardingState?.charonSupported).toBe(false);
431
+ });
312
432
  });
313
433
  });
314
434
  });
@@ -1,6 +1,8 @@
1
1
  import { DeviceExtractOnboardingStateError } from "@ledgerhq/errors";
2
2
  import { SeedPhraseType } from "@ledgerhq/types-live";
3
3
 
4
+ const CHARON_STEP_BIT_MASK = 0x1000;
5
+
4
6
  const onboardingFlagsBytesLength = 4;
5
7
 
6
8
  const onboardedMask = 0x04;
@@ -38,25 +40,34 @@ export enum OnboardingStep {
38
40
  RecoverRestore = "RECOVER_RESTORE", // path "restore with Recover"
39
41
  SafetyWarning = "SAFETY WARNING",
40
42
  Ready = "READY",
43
+ BackupCharon = "BACKUP_CHARON",
44
+ RestoreCharon = "RESTORE_CHARON",
41
45
  }
42
46
 
43
47
  const fromBitsToOnboardingStep = new Map<number, OnboardingStep>([
44
- [0, OnboardingStep.WelcomeScreen1],
45
- [1, OnboardingStep.WelcomeScreen2],
46
- [2, OnboardingStep.WelcomeScreen3],
47
- [3, OnboardingStep.WelcomeScreen4],
48
- [4, OnboardingStep.WelcomeScreenReminder],
49
- [5, OnboardingStep.SetupChoice],
50
- [6, OnboardingStep.Pin],
51
- [7, OnboardingStep.NewDevice],
52
- [8, OnboardingStep.NewDeviceConfirming],
53
- [9, OnboardingStep.RestoreSeed],
54
- [10, OnboardingStep.SafetyWarning],
55
- [11, OnboardingStep.Ready],
56
- [12, OnboardingStep.ChooseName],
57
- [13, OnboardingStep.RecoverRestore],
58
- [14, OnboardingStep.SetupChoiceRestore],
59
- [15, OnboardingStep.OnboardingEarlyCheck],
48
+ [0x0, OnboardingStep.WelcomeScreen1],
49
+ [0x1, OnboardingStep.WelcomeScreen2],
50
+ [0x2, OnboardingStep.WelcomeScreen3],
51
+ [0x3, OnboardingStep.WelcomeScreen4],
52
+ [0x4, OnboardingStep.WelcomeScreenReminder],
53
+ [0x5, OnboardingStep.SetupChoice],
54
+ [0x6, OnboardingStep.Pin],
55
+ [0x7, OnboardingStep.NewDevice],
56
+ [0x8, OnboardingStep.NewDeviceConfirming],
57
+ [0x9, OnboardingStep.RestoreSeed],
58
+ [0xa, OnboardingStep.SafetyWarning],
59
+ [0xb, OnboardingStep.Ready],
60
+ [0xc, OnboardingStep.ChooseName],
61
+ [0xd, OnboardingStep.RecoverRestore],
62
+ [0xe, OnboardingStep.SetupChoiceRestore],
63
+ [0xf, OnboardingStep.OnboardingEarlyCheck],
64
+ [0x10, OnboardingStep.RestoreCharon],
65
+ [CHARON_STEP_BIT_MASK + 0x0, OnboardingStep.Ready], // default state, after boot, if no backup was pending, this is also the state right after the device is seeded (if it was seeded with Charon)
66
+ [CHARON_STEP_BIT_MASK + 0x1, OnboardingStep.Ready], // backup fully refused
67
+ [CHARON_STEP_BIT_MASK + 0x2, OnboardingStep.BackupCharon], // backup not started or fully refused, this is the state right after the device is seeded (unless it was seeded with Charon)
68
+ [CHARON_STEP_BIT_MASK + 0x3, OnboardingStep.BackupCharon], // backup process started but not finished
69
+ [CHARON_STEP_BIT_MASK + 0x4, OnboardingStep.BackupCharon], // backup done on RK and naming not finished
70
+ [CHARON_STEP_BIT_MASK + 0x5, OnboardingStep.Ready], // backup done on RK and backup-process exited
60
71
  ]);
61
72
 
62
73
  export type OnboardingState = {
@@ -69,14 +80,36 @@ export type OnboardingState = {
69
80
 
70
81
  currentOnboardingStep: OnboardingStep;
71
82
  currentSeedWordIndex: number;
83
+ charonSupported: boolean;
84
+ charonStatus: CharonStatus | null;
72
85
  };
73
86
 
87
+ export enum CharonStatus {
88
+ Rejected = 1,
89
+ Choice,
90
+ Running,
91
+ Naming,
92
+ Ready,
93
+ }
94
+
95
+ export const fromBitsToCharonStatusMap = new Map<number, CharonStatus>([
96
+ [0x1, CharonStatus.Rejected],
97
+ [0x2, CharonStatus.Choice],
98
+ [0x3, CharonStatus.Running],
99
+ [0x4, CharonStatus.Naming],
100
+ [0x5, CharonStatus.Ready],
101
+ ]);
102
+
74
103
  /**
75
104
  * Extracts the onboarding state of the device
76
105
  * @param flagsBytes Buffer of bytes of length onboardingFlagsBytesLength representing the device state flags
106
+ * @param charonStatusFlags Buffer of bytes of length charonStatusFlagsLength representing the charon status flags
77
107
  * @returns An OnboardingState
78
108
  */
79
- export const extractOnboardingState = (flagsBytes: Buffer): OnboardingState => {
109
+ export const extractOnboardingState = (
110
+ flagsBytes: Buffer,
111
+ charonState?: Buffer,
112
+ ): OnboardingState => {
80
113
  if (!flagsBytes || flagsBytes.length < onboardingFlagsBytesLength) {
81
114
  throw new DeviceExtractOnboardingStateError("Incorrect onboarding flags bytes");
82
115
  }
@@ -94,7 +127,7 @@ export const extractOnboardingState = (flagsBytes: Buffer): OnboardingState => {
94
127
  }
95
128
 
96
129
  const currentOnboardingStepBits = flagsBytes[3];
97
- const currentOnboardingStep = fromBitsToOnboardingStep.get(currentOnboardingStepBits);
130
+ let currentOnboardingStep = fromBitsToOnboardingStep.get(currentOnboardingStepBits);
98
131
 
99
132
  if (!currentOnboardingStep) {
100
133
  throw new DeviceExtractOnboardingStateError(
@@ -104,11 +137,41 @@ export const extractOnboardingState = (flagsBytes: Buffer): OnboardingState => {
104
137
 
105
138
  const currentSeedWordIndex = flagsBytes[2] & currentSeedWordIndexMask;
106
139
 
140
+ /*
141
+ * Once the device is seeded, there are some additional states for backing up with Charon (for devices that support it)
142
+ * There are 2 scenarios:
143
+ * - After the seeding of the device, the user goes through the safety warnings screens (step SafetyWarning), and then, compatible devices will display the backup screens.
144
+ * Then, the value of "currentOnboardingStep" is "Ready", and the additional information about the status of the backup is in the "charonState" buffer.
145
+ * - If the device is rebooted while the backup screens are displayed on the device, it will still display the backup screens when it is turned back on.
146
+ * Then, the value of "currentOnboardingStep" is "WelcomeScreen1", and the additional information about the status of the backup is in the "charonState" buffer.
147
+ */
148
+ if (
149
+ isOnboarded &&
150
+ [OnboardingStep.Ready, OnboardingStep.WelcomeScreen1].includes(currentOnboardingStep) &&
151
+ charonState !== undefined
152
+ ) {
153
+ currentOnboardingStep = fromBitsToOnboardingStep.get(charonState[0] + CHARON_STEP_BIT_MASK);
154
+
155
+ if (!currentOnboardingStep) {
156
+ throw new DeviceExtractOnboardingStateError(
157
+ "Incorrect onboarding bits for the current charon step",
158
+ );
159
+ }
160
+ }
161
+
162
+ const charonSupported = charonState !== undefined && charonState.length > 0;
163
+ const charonStatus =
164
+ charonSupported && fromBitsToCharonStatusMap.has(charonState[0])
165
+ ? fromBitsToCharonStatusMap.get(charonState[0])!
166
+ : null;
167
+
107
168
  return {
108
169
  isOnboarded,
109
170
  isInRecoveryMode,
110
171
  seedPhraseType,
111
172
  currentOnboardingStep,
112
173
  currentSeedWordIndex,
174
+ charonSupported,
175
+ charonStatus,
113
176
  };
114
177
  };
@@ -61,10 +61,11 @@ export default async function (transport: Transport): Promise<DeviceInfo> {
61
61
  mcuBlVersion,
62
62
  mcuVersion,
63
63
  mcuTargetId,
64
- flags,
65
64
  bootloaderVersion,
66
65
  hardwareVersion,
67
66
  languageId,
67
+ charonState,
68
+ flags,
68
69
  } = res;
69
70
  const isOSU = rawVersion.includes("-osu");
70
71
  const version = rawVersion.replace("-osu", "");
@@ -114,5 +115,7 @@ export default async function (transport: Transport): Promise<DeviceInfo> {
114
115
  bootloaderVersion,
115
116
  hardwareVersion,
116
117
  languageId,
118
+ charonState,
119
+ seFlags: flags,
117
120
  };
118
121
  }
@@ -41,7 +41,7 @@ jest.mock("./genuineCheck");
41
41
  const mockedGetDeviceInfo = jest.mocked(getDeviceInfo);
42
42
  const mockedGenuineCheck = jest.mocked(genuineCheck);
43
43
 
44
- const aDeviceInfo = {
44
+ const aDeviceInfo: DeviceInfo = {
45
45
  mcuVersion: "A_MCU_VERSION",
46
46
  version: "A_VERSION",
47
47
  majMin: "A_MAJ_MIN",
@@ -51,6 +51,7 @@ const aDeviceInfo = {
51
51
  providerName: undefined,
52
52
  managerAllowed: false,
53
53
  pinValidated: true,
54
+ seFlags: Buffer.alloc(0),
54
55
  };
55
56
 
56
57
  describe("getGenuineCheckFromDeviceId", () => {
@@ -56,6 +56,8 @@ describe("getOnboardingStatePolling", () => {
56
56
  seedPhraseType: SeedPhraseType.TwentyFour,
57
57
  currentSeedWordIndex: 0,
58
58
  currentOnboardingStep: OnboardingStep.NewDevice,
59
+ charonSupported: false,
60
+ charonStatus: null,
59
61
  };
60
62
  });
61
63
 
@@ -83,7 +83,7 @@ export const getOnboardingStatePolling = ({
83
83
  }
84
84
 
85
85
  try {
86
- onboardingState = extractOnboardingState(firmwareInfo.flags);
86
+ onboardingState = extractOnboardingState(firmwareInfo.flags, firmwareInfo.charonState);
87
87
  } catch (error: unknown) {
88
88
  if (error instanceof DeviceExtractOnboardingStateError) {
89
89
  return {
@@ -1,4 +1,5 @@
1
1
  import { DeviceModelId } from "@ledgerhq/devices";
2
+ import { DeviceInfo } from "@ledgerhq/types-live";
2
3
  import isFirmwareUpdateVersionSupported from "./isFirmwareUpdateVersionSupported";
3
4
  import { setEnv } from "@ledgerhq/live-env";
4
5
 
@@ -17,7 +18,7 @@ const badDataset: { [key in DeviceModelId]?: string[] } = {
17
18
  };
18
19
 
19
20
  describe("Firmware update version availability checks", () => {
20
- const getDeviceInfo = version => ({
21
+ const getDeviceInfo = (version): DeviceInfo => ({
21
22
  version,
22
23
  mcuVersion: "0.0",
23
24
  majMin: "0.0",
@@ -27,6 +28,7 @@ describe("Firmware update version availability checks", () => {
27
28
  isBootloader: false,
28
29
  managerAllowed: false,
29
30
  pinValidated: false,
31
+ seFlags: Buffer.alloc(0),
30
32
  });
31
33
 
32
34
  describe("Fails with bad values", () => {
@@ -11,6 +11,7 @@ export const aDeviceInfoBuilder = (props?: Partial<DeviceInfo>): DeviceInfo => {
11
11
  providerName: undefined,
12
12
  managerAllowed: false,
13
13
  pinValidated: true,
14
+ seFlags: Buffer.alloc(0),
14
15
  ...props,
15
16
  };
16
17
  };
@@ -0,0 +1,149 @@
1
+ /**
2
+ * @jest-environment jsdom
3
+ */
4
+ import { renderHook } from "@testing-library/react";
5
+ import { useModularDrawerVisibility } from "../useModularDrawerVisibility";
6
+ import { ModularDrawerLocation } from "../enums";
7
+ import {
8
+ makeMockedFeatureFlagsProviderWrapper,
9
+ makeMockedContextValue,
10
+ } from "../../featureFlags/mock";
11
+
12
+ describe("useModularDrawerVisibility", () => {
13
+ describe("lldModularDrawer", () => {
14
+ it("should return false if the feature flag is not enabled", () => {
15
+ const mockedFeatures = {
16
+ lldModularDrawer: {
17
+ enabled: false,
18
+ params: { [ModularDrawerLocation.ADD_ACCOUNT]: true },
19
+ },
20
+ };
21
+
22
+ const { result } = renderHook(
23
+ () =>
24
+ useModularDrawerVisibility({
25
+ modularDrawerFeatureFlagKey: "lldModularDrawer",
26
+ }),
27
+ {
28
+ wrapper: makeMockedFeatureFlagsProviderWrapper(makeMockedContextValue(mockedFeatures)),
29
+ },
30
+ );
31
+
32
+ expect(result.current.isModularDrawerVisible(ModularDrawerLocation.ADD_ACCOUNT)).toBe(false);
33
+ });
34
+
35
+ it("should return false if the location param is not set", () => {
36
+ const mockedFeatures = {
37
+ lldModularDrawer: { enabled: true, params: {} },
38
+ };
39
+
40
+ const { result } = renderHook(
41
+ () =>
42
+ useModularDrawerVisibility({
43
+ modularDrawerFeatureFlagKey: "lldModularDrawer",
44
+ }),
45
+ {
46
+ wrapper: makeMockedFeatureFlagsProviderWrapper(makeMockedContextValue(mockedFeatures)),
47
+ },
48
+ );
49
+
50
+ expect(result.current.isModularDrawerVisible(ModularDrawerLocation.ADD_ACCOUNT)).toBe(false);
51
+ });
52
+
53
+ it("should return the correct visibility for each location", () => {
54
+ const mockedFeatures = {
55
+ lldModularDrawer: {
56
+ enabled: true,
57
+ params: {
58
+ [ModularDrawerLocation.ADD_ACCOUNT]: true,
59
+ [ModularDrawerLocation.EARN_FLOW]: false,
60
+ },
61
+ },
62
+ };
63
+
64
+ const { result } = renderHook(
65
+ () =>
66
+ useModularDrawerVisibility({
67
+ modularDrawerFeatureFlagKey: "lldModularDrawer",
68
+ }),
69
+ {
70
+ wrapper: makeMockedFeatureFlagsProviderWrapper(makeMockedContextValue(mockedFeatures)),
71
+ },
72
+ );
73
+
74
+ expect(result.current.isModularDrawerVisible(ModularDrawerLocation.ADD_ACCOUNT)).toBe(true);
75
+ expect(result.current.isModularDrawerVisible(ModularDrawerLocation.EARN_FLOW)).toBe(false);
76
+ expect(result.current.isModularDrawerVisible(ModularDrawerLocation.LIVE_APP)).toBe(false);
77
+ });
78
+ });
79
+
80
+ describe("llmModularDrawer", () => {
81
+ it("should return false if the feature flag is not enabled", () => {
82
+ const mockedFeatures = {
83
+ llmModularDrawer: {
84
+ enabled: false,
85
+ params: { [ModularDrawerLocation.ADD_ACCOUNT]: true },
86
+ },
87
+ };
88
+
89
+ const { result } = renderHook(
90
+ () =>
91
+ useModularDrawerVisibility({
92
+ modularDrawerFeatureFlagKey: "llmModularDrawer",
93
+ }),
94
+ {
95
+ wrapper: makeMockedFeatureFlagsProviderWrapper(makeMockedContextValue(mockedFeatures)),
96
+ },
97
+ );
98
+
99
+ expect(result.current.isModularDrawerVisible(ModularDrawerLocation.ADD_ACCOUNT)).toBe(false);
100
+ });
101
+
102
+ it("should return false if the location param is not set", () => {
103
+ const mockedFeatures = {
104
+ llmModularDrawer: { enabled: true, params: {} },
105
+ };
106
+
107
+ const { result } = renderHook(
108
+ () =>
109
+ useModularDrawerVisibility({
110
+ modularDrawerFeatureFlagKey: "llmModularDrawer",
111
+ }),
112
+ {
113
+ wrapper: makeMockedFeatureFlagsProviderWrapper(makeMockedContextValue(mockedFeatures)),
114
+ },
115
+ );
116
+
117
+ expect(result.current.isModularDrawerVisible(ModularDrawerLocation.ADD_ACCOUNT)).toBe(false);
118
+ });
119
+
120
+ it("should return the correct visibility for each location", () => {
121
+ const mockedFeatures = {
122
+ llmModularDrawer: {
123
+ enabled: true,
124
+ params: {
125
+ [ModularDrawerLocation.ADD_ACCOUNT]: false,
126
+ [ModularDrawerLocation.EARN_FLOW]: true,
127
+ [ModularDrawerLocation.RECEIVE_FLOW]: true,
128
+ },
129
+ },
130
+ };
131
+
132
+ const { result } = renderHook(
133
+ () =>
134
+ useModularDrawerVisibility({
135
+ modularDrawerFeatureFlagKey: "llmModularDrawer",
136
+ }),
137
+ {
138
+ wrapper: makeMockedFeatureFlagsProviderWrapper(makeMockedContextValue(mockedFeatures)),
139
+ },
140
+ );
141
+
142
+ expect(result.current.isModularDrawerVisible(ModularDrawerLocation.ADD_ACCOUNT)).toBe(false);
143
+ expect(result.current.isModularDrawerVisible(ModularDrawerLocation.EARN_FLOW)).toBe(true);
144
+ expect(result.current.isModularDrawerVisible(ModularDrawerLocation.RECEIVE_FLOW)).toBe(true);
145
+ expect(result.current.isModularDrawerVisible(ModularDrawerLocation.LIVE_APP)).toBe(false);
146
+ expect(result.current.isModularDrawerVisible(ModularDrawerLocation.SEND_FLOW)).toBe(false);
147
+ });
148
+ });
149
+ });
@@ -0,0 +1,7 @@
1
+ export enum ModularDrawerLocation {
2
+ ADD_ACCOUNT = "add_account",
3
+ EARN_FLOW = "earn_flow",
4
+ LIVE_APP = "live_app",
5
+ RECEIVE_FLOW = "receive_flow",
6
+ SEND_FLOW = "send_flow",
7
+ }
@@ -0,0 +1,25 @@
1
+ import { useCallback } from "react";
2
+ import { useFeature } from "../featureFlags";
3
+ import { ModularDrawerLocation } from "./enums";
4
+
5
+ type ModularDrawerFeatureFlagKey = "lldModularDrawer" | "llmModularDrawer";
6
+
7
+ export function useModularDrawerVisibility({
8
+ modularDrawerFeatureFlagKey,
9
+ }: {
10
+ modularDrawerFeatureFlagKey: ModularDrawerFeatureFlagKey;
11
+ }) {
12
+ const featureModularDrawer = useFeature(modularDrawerFeatureFlagKey);
13
+
14
+ const isModularDrawerVisible = useCallback(
15
+ (location: ModularDrawerLocation) => {
16
+ if (!featureModularDrawer?.enabled) return false;
17
+ return featureModularDrawer.params?.[location] ?? false;
18
+ },
19
+ [featureModularDrawer],
20
+ );
21
+
22
+ return {
23
+ isModularDrawerVisible,
24
+ };
25
+ }
@@ -36,6 +36,8 @@ describe("useOnboardingStatePolling", () => {
36
36
  seedPhraseType: SeedPhraseType.TwentyFour,
37
37
  currentSeedWordIndex: 0,
38
38
  currentOnboardingStep: OnboardingStep.NewDevice,
39
+ charonSupported: false,
40
+ charonStatus: null,
39
41
  };
40
42
 
41
43
  aSecondOnboardingState = {
@@ -79,7 +79,7 @@ export type RecentlyUsedIdDb = {
79
79
  export type CurrentAccountHistIDb = Record<string, string>;
80
80
 
81
81
  export type DAppTrackingData = {
82
- type: "approve" | "transfer";
82
+ type: string;
83
83
  currency: string;
84
84
  network: CryptoCurrency["id"];
85
85
  };
@@ -15,8 +15,8 @@ import BigNumber from "bignumber.js";
15
15
  import { safeEncodeEIP55 } from "@ledgerhq/coin-evm/logic";
16
16
  import { SmartWebsocket } from "./SmartWebsocket";
17
17
  import { stripHexPrefix } from "./helpers";
18
- import { DeviceTransactionField, getDeviceTransactionConfig } from "../transaction";
19
- import type { Transaction } from "../generated/types";
18
+ import { getTxType } from "./utils/txTrackingHelper";
19
+ import { Transaction as EvmTransaction } from "@ledgerhq/coin-evm/types/transaction";
20
20
 
21
21
  type MessageId = number | string | null;
22
22
 
@@ -205,16 +205,6 @@ function isParentAccountPresent(
205
205
  return true;
206
206
  }
207
207
 
208
- function getTransactionType(fields: Array<DeviceTransactionField>): string {
209
- for (let i = 0; i < fields.length; i++) {
210
- const field = fields[i];
211
- if (field.type === "text" && field.label === "Type") {
212
- return field.value;
213
- }
214
- }
215
- return "";
216
- }
217
-
218
208
  export function useDappLogic({
219
209
  manifest,
220
210
  accounts,
@@ -490,20 +480,7 @@ export function useDappLogic({
490
480
  account: currentAccount,
491
481
  });
492
482
 
493
- const fields = getDeviceTransactionConfig({
494
- account: currentAccount,
495
- parentAccount: currentParentAccount,
496
- transaction: signFlowInfos.liveTx as Transaction,
497
- status: {
498
- errors: {},
499
- warnings: {},
500
- estimatedFees: new BigNumber(0),
501
- amount: new BigNumber(0),
502
- totalSpent: new BigNumber(0),
503
- },
504
- });
505
-
506
- const transactionType = getTransactionType(fields);
483
+ const transactionType = getTxType(signFlowInfos.liveTx as EvmTransaction);
507
484
 
508
485
  const token = findTokenByAddress(tx.recipient);
509
486
 
@@ -518,7 +495,7 @@ export function useDappLogic({
518
495
  : currentAccount.currency.id;
519
496
 
520
497
  trackingData = {
521
- type: transactionType === "Approve" ? "approve" : "transfer",
498
+ type: transactionType,
522
499
  currency: token ? token.name : accountCurrencyName,
523
500
  network: token ? token.parentCurrency.id : accountNetwork,
524
501
  };