@ledgerhq/live-common 27.2.0 → 27.3.0-next.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 (371) hide show
  1. package/lib/apps/logic.test.js +1 -1
  2. package/lib/apps/logic.test.js.map +1 -1
  3. package/lib/apps/polyfill.d.ts +1 -1
  4. package/lib/apps/polyfill.d.ts.map +1 -1
  5. package/lib/apps/polyfill.js +6 -3
  6. package/lib/apps/polyfill.js.map +1 -1
  7. package/lib/apps/polyfill.test.d.ts +2 -0
  8. package/lib/apps/polyfill.test.d.ts.map +1 -0
  9. package/lib/apps/polyfill.test.js +25 -0
  10. package/lib/apps/polyfill.test.js.map +1 -0
  11. package/lib/apps/support.d.ts.map +1 -1
  12. package/lib/apps/support.js +3 -2
  13. package/lib/apps/support.js.map +1 -1
  14. package/lib/bot/engine.d.ts.map +1 -1
  15. package/lib/bot/engine.js +154 -45
  16. package/lib/bot/engine.js.map +1 -1
  17. package/lib/bot/formatters.d.ts +1 -1
  18. package/lib/bot/formatters.d.ts.map +1 -1
  19. package/lib/bot/formatters.js +9 -3
  20. package/lib/bot/formatters.js.map +1 -1
  21. package/lib/bot/index.d.ts.map +1 -1
  22. package/lib/bot/index.js +29 -11
  23. package/lib/bot/index.js.map +1 -1
  24. package/lib/bot/specs.d.ts +12 -1
  25. package/lib/bot/specs.d.ts.map +1 -1
  26. package/lib/bot/specs.js +75 -1
  27. package/lib/bot/specs.js.map +1 -1
  28. package/lib/bot/types.d.ts +18 -1
  29. package/lib/bot/types.d.ts.map +1 -1
  30. package/lib/currencies/sortByMarketcap.d.ts.map +1 -1
  31. package/lib/currencies/sortByMarketcap.js +5 -1
  32. package/lib/currencies/sortByMarketcap.js.map +1 -1
  33. package/lib/currencies/support.d.ts.map +1 -1
  34. package/lib/currencies/support.js +2 -1
  35. package/lib/currencies/support.js.map +1 -1
  36. package/lib/derivation.d.ts.map +1 -1
  37. package/lib/derivation.js +2 -4
  38. package/lib/derivation.js.map +1 -1
  39. package/lib/env.js +1 -1
  40. package/lib/exchange/swap/getExchangeRates.d.ts.map +1 -1
  41. package/lib/exchange/swap/getExchangeRates.js +6 -3
  42. package/lib/exchange/swap/getExchangeRates.js.map +1 -1
  43. package/lib/exchange/swap/getProviders.d.ts.map +1 -1
  44. package/lib/exchange/swap/getProviders.js +45 -5
  45. package/lib/exchange/swap/getProviders.js.map +1 -1
  46. package/lib/exchange/swap/getProviders.test.d.ts +2 -0
  47. package/lib/exchange/swap/getProviders.test.d.ts.map +1 -0
  48. package/lib/exchange/swap/getProviders.test.js +519 -0
  49. package/lib/exchange/swap/getProviders.test.js.map +1 -0
  50. package/lib/exchange/swap/hooks/useProviderRates.d.ts +1 -0
  51. package/lib/exchange/swap/hooks/useProviderRates.d.ts.map +1 -1
  52. package/lib/exchange/swap/hooks/useProviderRates.js +19 -4
  53. package/lib/exchange/swap/hooks/useProviderRates.js.map +1 -1
  54. package/lib/exchange/swap/hooks/useProviderRates.test.js +42 -0
  55. package/lib/exchange/swap/hooks/useProviderRates.test.js.map +1 -1
  56. package/lib/exchange/swap/hooks/useSwapTransaction.d.ts +1 -0
  57. package/lib/exchange/swap/hooks/useSwapTransaction.d.ts.map +1 -1
  58. package/lib/exchange/swap/hooks/useSwapTransaction.js +2 -1
  59. package/lib/exchange/swap/hooks/useSwapTransaction.js.map +1 -1
  60. package/lib/exchange/swap/index.d.ts +2 -1
  61. package/lib/exchange/swap/index.d.ts.map +1 -1
  62. package/lib/exchange/swap/index.js +11 -1
  63. package/lib/exchange/swap/index.js.map +1 -1
  64. package/lib/exchange/swap/index.test.js +22 -0
  65. package/lib/exchange/swap/index.test.js.map +1 -1
  66. package/lib/exchange/swap/mock.js +1 -1
  67. package/lib/exchange/swap/mock.js.map +1 -1
  68. package/lib/exchange/swap/types.d.ts +14 -0
  69. package/lib/exchange/swap/types.d.ts.map +1 -1
  70. package/lib/exchange/swap/utils/index.d.ts +1 -0
  71. package/lib/exchange/swap/utils/index.d.ts.map +1 -1
  72. package/lib/exchange/swap/utils/index.js +6 -1
  73. package/lib/exchange/swap/utils/index.js.map +1 -1
  74. package/lib/exchange/swap/utils/index.test.js +12 -0
  75. package/lib/exchange/swap/utils/index.test.js.map +1 -1
  76. package/lib/families/algorand/specs.d.ts.map +1 -1
  77. package/lib/families/algorand/specs.js +2 -0
  78. package/lib/families/algorand/specs.js.map +1 -1
  79. package/lib/families/algorand/speculos-deviceActions.d.ts.map +1 -1
  80. package/lib/families/algorand/speculos-deviceActions.js +2 -29
  81. package/lib/families/algorand/speculos-deviceActions.js.map +1 -1
  82. package/lib/families/bitcoin/specs.d.ts +0 -1
  83. package/lib/families/bitcoin/specs.d.ts.map +1 -1
  84. package/lib/families/bitcoin/specs.js +65 -48
  85. package/lib/families/bitcoin/specs.js.map +1 -1
  86. package/lib/families/bitcoin/speculos-deviceActions.d.ts.map +1 -1
  87. package/lib/families/bitcoin/speculos-deviceActions.js +2 -22
  88. package/lib/families/bitcoin/speculos-deviceActions.js.map +1 -1
  89. package/lib/families/cardano/specs.d.ts.map +1 -1
  90. package/lib/families/cardano/specs.js +9 -4
  91. package/lib/families/cardano/specs.js.map +1 -1
  92. package/lib/families/cardano/speculos-deviceActions.d.ts.map +1 -1
  93. package/lib/families/cardano/speculos-deviceActions.js +2 -10
  94. package/lib/families/cardano/speculos-deviceActions.js.map +1 -1
  95. package/lib/families/celo/specs/createSendMutation.d.ts +1 -0
  96. package/lib/families/celo/specs/createSendMutation.d.ts.map +1 -1
  97. package/lib/families/celo/specs/createSendMutation.js +7 -5
  98. package/lib/families/celo/specs/createSendMutation.js.map +1 -1
  99. package/lib/families/celo/specs.d.ts.map +1 -1
  100. package/lib/families/celo/specs.js +1 -0
  101. package/lib/families/celo/specs.js.map +1 -1
  102. package/lib/families/celo/speculos-deviceActions.d.ts.map +1 -1
  103. package/lib/families/celo/speculos-deviceActions.js +3 -10
  104. package/lib/families/celo/speculos-deviceActions.js.map +1 -1
  105. package/lib/families/cosmos/helpers.d.ts +9 -0
  106. package/lib/families/cosmos/helpers.d.ts.map +1 -0
  107. package/lib/families/cosmos/helpers.js +20 -0
  108. package/lib/families/cosmos/helpers.js.map +1 -0
  109. package/lib/families/cosmos/helpers.unit.test.d.ts +2 -0
  110. package/lib/families/cosmos/helpers.unit.test.d.ts.map +1 -0
  111. package/lib/families/cosmos/helpers.unit.test.js +56 -0
  112. package/lib/families/cosmos/helpers.unit.test.js.map +1 -0
  113. package/lib/families/cosmos/js-signOperation.d.ts.map +1 -1
  114. package/lib/families/cosmos/js-signOperation.js +5 -3
  115. package/lib/families/cosmos/js-signOperation.js.map +1 -1
  116. package/lib/families/cosmos/js-synchronisation.d.ts.map +1 -1
  117. package/lib/families/cosmos/js-synchronisation.js +99 -95
  118. package/lib/families/cosmos/js-synchronisation.js.map +1 -1
  119. package/lib/families/cosmos/specs.d.ts.map +1 -1
  120. package/lib/families/cosmos/specs.js +5 -1
  121. package/lib/families/cosmos/specs.js.map +1 -1
  122. package/lib/families/crypto_org/specs.d.ts.map +1 -1
  123. package/lib/families/crypto_org/specs.js +9 -8
  124. package/lib/families/crypto_org/specs.js.map +1 -1
  125. package/lib/families/elrond/specs.d.ts.map +1 -1
  126. package/lib/families/elrond/specs.js +1 -0
  127. package/lib/families/elrond/specs.js.map +1 -1
  128. package/lib/families/elrond/speculos-deviceActions.d.ts.map +1 -1
  129. package/lib/families/elrond/speculos-deviceActions.js +3 -8
  130. package/lib/families/elrond/speculos-deviceActions.js.map +1 -1
  131. package/lib/families/ethereum/specs.d.ts.map +1 -1
  132. package/lib/families/ethereum/specs.js +20 -8
  133. package/lib/families/ethereum/specs.js.map +1 -1
  134. package/lib/families/ethereum/speculos-deviceActions.d.ts.map +1 -1
  135. package/lib/families/ethereum/speculos-deviceActions.js +10 -33
  136. package/lib/families/ethereum/speculos-deviceActions.js.map +1 -1
  137. package/lib/families/evm/specs.d.ts.map +1 -1
  138. package/lib/families/evm/specs.js +20 -10
  139. package/lib/families/evm/specs.js.map +1 -1
  140. package/lib/families/evm/speculos-deviceActions.d.ts.map +1 -1
  141. package/lib/families/evm/speculos-deviceActions.js +5 -25
  142. package/lib/families/evm/speculos-deviceActions.js.map +1 -1
  143. package/lib/families/filecoin/specs.d.ts.map +1 -1
  144. package/lib/families/filecoin/specs.js +3 -0
  145. package/lib/families/filecoin/specs.js.map +1 -1
  146. package/lib/families/filecoin/speculos-deviceActions.d.ts.map +1 -1
  147. package/lib/families/filecoin/speculos-deviceActions.js +6 -7
  148. package/lib/families/filecoin/speculos-deviceActions.js.map +1 -1
  149. package/lib/families/hedera/specs.d.ts.map +1 -1
  150. package/lib/families/hedera/specs.js +2 -0
  151. package/lib/families/hedera/specs.js.map +1 -1
  152. package/lib/families/osmosis/specs.d.ts.map +1 -1
  153. package/lib/families/osmosis/specs.js +3 -0
  154. package/lib/families/osmosis/specs.js.map +1 -1
  155. package/lib/families/polkadot/specs.d.ts.map +1 -1
  156. package/lib/families/polkadot/specs.js +4 -1
  157. package/lib/families/polkadot/specs.js.map +1 -1
  158. package/lib/families/polkadot/speculos-deviceActions.d.ts.map +1 -1
  159. package/lib/families/polkadot/speculos-deviceActions.js +3 -10
  160. package/lib/families/polkadot/speculos-deviceActions.js.map +1 -1
  161. package/lib/families/ripple/specs.d.ts.map +1 -1
  162. package/lib/families/ripple/specs.js +2 -0
  163. package/lib/families/ripple/specs.js.map +1 -1
  164. package/lib/families/ripple/speculos-deviceActions.d.ts.map +1 -1
  165. package/lib/families/ripple/speculos-deviceActions.js +2 -22
  166. package/lib/families/ripple/speculos-deviceActions.js.map +1 -1
  167. package/lib/families/solana/specs.d.ts.map +1 -1
  168. package/lib/families/solana/specs.js +7 -3
  169. package/lib/families/solana/specs.js.map +1 -1
  170. package/lib/families/solana/speculos-deviceActions.d.ts.map +1 -1
  171. package/lib/families/solana/speculos-deviceActions.js +5 -7
  172. package/lib/families/solana/speculos-deviceActions.js.map +1 -1
  173. package/lib/families/stellar/specs.d.ts.map +1 -1
  174. package/lib/families/stellar/specs.js +1 -0
  175. package/lib/families/stellar/specs.js.map +1 -1
  176. package/lib/families/stellar/speculos-deviceActions.d.ts.map +1 -1
  177. package/lib/families/stellar/speculos-deviceActions.js +4 -8
  178. package/lib/families/stellar/speculos-deviceActions.js.map +1 -1
  179. package/lib/families/tezos/specs.d.ts.map +1 -1
  180. package/lib/families/tezos/specs.js +6 -1
  181. package/lib/families/tezos/specs.js.map +1 -1
  182. package/lib/families/tezos/speculos-deviceActions.d.ts.map +1 -1
  183. package/lib/families/tezos/speculos-deviceActions.js +6 -11
  184. package/lib/families/tezos/speculos-deviceActions.js.map +1 -1
  185. package/lib/families/tron/specs.d.ts.map +1 -1
  186. package/lib/families/tron/specs.js +16 -1
  187. package/lib/families/tron/specs.js.map +1 -1
  188. package/lib/families/tron/speculos-deviceActions.d.ts.map +1 -1
  189. package/lib/families/tron/speculos-deviceActions.js +2 -14
  190. package/lib/families/tron/speculos-deviceActions.js.map +1 -1
  191. package/lib/families/tron/synchronisation.integration.test.d.ts +2 -0
  192. package/lib/families/tron/synchronisation.integration.test.d.ts.map +1 -0
  193. package/lib/families/tron/{synchronisation.test.js → synchronisation.integration.test.js} +1 -1
  194. package/lib/families/tron/synchronisation.integration.test.js.map +1 -0
  195. package/lib/featureFlags/defaultFeatures.d.ts.map +1 -1
  196. package/lib/featureFlags/defaultFeatures.js +6 -0
  197. package/lib/featureFlags/defaultFeatures.js.map +1 -1
  198. package/lib/generated/specs.d.ts +0 -1
  199. package/lib/generated/specs.d.ts.map +1 -1
  200. package/lib/hw/actions/installLanguage.js +1 -1
  201. package/lib/hw/extractOnboardingState.d.ts +5 -1
  202. package/lib/hw/extractOnboardingState.d.ts.map +1 -1
  203. package/lib/hw/extractOnboardingState.js +17 -9
  204. package/lib/hw/extractOnboardingState.js.map +1 -1
  205. package/lib/hw/extractOnboardingState.test.js +21 -11
  206. package/lib/hw/extractOnboardingState.test.js.map +1 -1
  207. package/lib/load/speculos.d.ts.map +1 -1
  208. package/lib/load/speculos.js +39 -15
  209. package/lib/load/speculos.js.map +1 -1
  210. package/lib/manager/hooks.d.ts +4 -1
  211. package/lib/manager/hooks.d.ts.map +1 -1
  212. package/lib/manager/hooks.js +4 -3
  213. package/lib/manager/hooks.js.map +1 -1
  214. package/lib/manager/localization.js +2 -2
  215. package/lib/manager/localization.js.map +1 -1
  216. package/lib/mock/account.d.ts.map +1 -1
  217. package/lib/mock/account.js +17 -19
  218. package/lib/mock/account.js.map +1 -1
  219. package/lib/notifications/ServiceStatusProvider/index.d.ts.map +1 -1
  220. package/lib/notifications/ServiceStatusProvider/index.js +5 -1
  221. package/lib/notifications/ServiceStatusProvider/index.js.map +1 -1
  222. package/lib/postOnboarding/PostOnboardingProvider.d.ts +20 -0
  223. package/lib/postOnboarding/PostOnboardingProvider.d.ts.map +1 -0
  224. package/lib/postOnboarding/PostOnboardingProvider.js +33 -0
  225. package/lib/postOnboarding/PostOnboardingProvider.js.map +1 -0
  226. package/lib/postOnboarding/actions.d.ts +20 -0
  227. package/lib/postOnboarding/actions.d.ts.map +1 -0
  228. package/lib/postOnboarding/actions.js +37 -0
  229. package/lib/postOnboarding/actions.js.map +1 -0
  230. package/lib/postOnboarding/hooks/index.d.ts +6 -0
  231. package/lib/postOnboarding/hooks/index.d.ts.map +1 -0
  232. package/lib/postOnboarding/hooks/index.js +22 -0
  233. package/lib/postOnboarding/hooks/index.js.map +1 -0
  234. package/lib/postOnboarding/hooks/useAllPostOnboardingActionsCompleted.d.ts +8 -0
  235. package/lib/postOnboarding/hooks/useAllPostOnboardingActionsCompleted.d.ts.map +1 -0
  236. package/lib/postOnboarding/hooks/useAllPostOnboardingActionsCompleted.js +16 -0
  237. package/lib/postOnboarding/hooks/useAllPostOnboardingActionsCompleted.js.map +1 -0
  238. package/lib/postOnboarding/hooks/useAllPostOnboardingActionsCompleted.test.d.ts +2 -0
  239. package/lib/postOnboarding/hooks/useAllPostOnboardingActionsCompleted.test.d.ts.map +1 -0
  240. package/lib/postOnboarding/hooks/useAllPostOnboardingActionsCompleted.test.js +75 -0
  241. package/lib/postOnboarding/hooks/useAllPostOnboardingActionsCompleted.test.js.map +1 -0
  242. package/lib/postOnboarding/hooks/usePostOnboardingContext.d.ts +3 -0
  243. package/lib/postOnboarding/hooks/usePostOnboardingContext.d.ts.map +1 -0
  244. package/lib/postOnboarding/hooks/usePostOnboardingContext.js +10 -0
  245. package/lib/postOnboarding/hooks/usePostOnboardingContext.js.map +1 -0
  246. package/lib/postOnboarding/hooks/usePostOnboardingEntryPointVisibleOnWallet.d.ts +8 -0
  247. package/lib/postOnboarding/hooks/usePostOnboardingEntryPointVisibleOnWallet.d.ts.map +1 -0
  248. package/lib/postOnboarding/hooks/usePostOnboardingEntryPointVisibleOnWallet.js +20 -0
  249. package/lib/postOnboarding/hooks/usePostOnboardingEntryPointVisibleOnWallet.js.map +1 -0
  250. package/lib/postOnboarding/hooks/usePostOnboardingEntryPointVisibleOnWallet.test.d.ts +2 -0
  251. package/lib/postOnboarding/hooks/usePostOnboardingEntryPointVisibleOnWallet.test.d.ts.map +1 -0
  252. package/lib/postOnboarding/hooks/usePostOnboardingEntryPointVisibleOnWallet.test.js +64 -0
  253. package/lib/postOnboarding/hooks/usePostOnboardingEntryPointVisibleOnWallet.test.js.map +1 -0
  254. package/lib/postOnboarding/hooks/usePostOnboardingHubState.d.ts +12 -0
  255. package/lib/postOnboarding/hooks/usePostOnboardingHubState.d.ts.map +1 -0
  256. package/lib/postOnboarding/hooks/usePostOnboardingHubState.js +65 -0
  257. package/lib/postOnboarding/hooks/usePostOnboardingHubState.js.map +1 -0
  258. package/lib/postOnboarding/hooks/usePostOnboardingHubState.test.d.ts +2 -0
  259. package/lib/postOnboarding/hooks/usePostOnboardingHubState.test.d.ts.map +1 -0
  260. package/lib/postOnboarding/hooks/usePostOnboardingHubState.test.js +129 -0
  261. package/lib/postOnboarding/hooks/usePostOnboardingHubState.test.js.map +1 -0
  262. package/lib/postOnboarding/hooks/useStartPostOnboardingCallback.d.ts +13 -0
  263. package/lib/postOnboarding/hooks/useStartPostOnboardingCallback.d.ts.map +1 -0
  264. package/lib/postOnboarding/hooks/useStartPostOnboardingCallback.js +34 -0
  265. package/lib/postOnboarding/hooks/useStartPostOnboardingCallback.js.map +1 -0
  266. package/lib/postOnboarding/mock.d.ts +8 -0
  267. package/lib/postOnboarding/mock.d.ts.map +1 -0
  268. package/lib/postOnboarding/mock.js +46 -0
  269. package/lib/postOnboarding/mock.js.map +1 -0
  270. package/lib/postOnboarding/reducer.d.ts +22 -0
  271. package/lib/postOnboarding/reducer.d.ts.map +1 -0
  272. package/lib/postOnboarding/reducer.js +71 -0
  273. package/lib/postOnboarding/reducer.js.map +1 -0
  274. package/lib/postOnboarding/reducer.test.d.ts +2 -0
  275. package/lib/postOnboarding/reducer.test.d.ts.map +1 -0
  276. package/lib/postOnboarding/reducer.test.js +251 -0
  277. package/lib/postOnboarding/reducer.test.js.map +1 -0
  278. package/package.json +24 -20
  279. package/src/__tests__/__snapshots__/portfolio.v2.ts.snap +16 -0
  280. package/src/apps/__snapshots__/logic.test.ts.snap +18 -11
  281. package/src/apps/logic.test.ts +1 -2
  282. package/src/apps/polyfill.test.ts +24 -0
  283. package/src/apps/polyfill.ts +7 -2
  284. package/src/apps/support.ts +2 -1
  285. package/src/bot/engine.ts +178 -35
  286. package/src/bot/formatters.ts +15 -2
  287. package/src/bot/index.ts +48 -19
  288. package/src/bot/specs.ts +95 -1
  289. package/src/bot/types.ts +23 -1
  290. package/src/currencies/__snapshots__/sortByMarketcap.test.ts.snap +55 -6
  291. package/src/currencies/sortByMarketcap.ts +6 -1
  292. package/src/currencies/support.ts +2 -1
  293. package/src/derivation.ts +2 -4
  294. package/src/env.ts +1 -1
  295. package/src/exchange/swap/getExchangeRates.ts +12 -5
  296. package/src/exchange/swap/getProviders.test.ts +450 -0
  297. package/src/exchange/swap/getProviders.ts +31 -8
  298. package/src/exchange/swap/hooks/useProviderRates.test.ts +43 -0
  299. package/src/exchange/swap/hooks/useProviderRates.ts +22 -3
  300. package/src/exchange/swap/hooks/useSwapTransaction.ts +3 -1
  301. package/src/exchange/swap/index.test.ts +36 -1
  302. package/src/exchange/swap/index.ts +15 -0
  303. package/src/exchange/swap/mock.ts +2 -2
  304. package/src/exchange/swap/types.ts +11 -0
  305. package/src/exchange/swap/utils/index.test.ts +19 -0
  306. package/src/exchange/swap/utils/index.ts +5 -0
  307. package/src/families/algorand/specs.ts +3 -1
  308. package/src/families/algorand/speculos-deviceActions.ts +4 -35
  309. package/src/families/bitcoin/specs.ts +72 -56
  310. package/src/families/bitcoin/speculos-deviceActions.ts +3 -26
  311. package/src/families/cardano/specs.ts +9 -4
  312. package/src/families/cardano/speculos-deviceActions.ts +3 -14
  313. package/src/families/celo/specs/createSendMutation.ts +5 -3
  314. package/src/families/celo/specs.ts +2 -0
  315. package/src/families/celo/speculos-deviceActions.ts +6 -14
  316. package/src/families/cosmos/__snapshots__/bridge.integration.test.ts.snap +24 -44
  317. package/src/families/cosmos/helpers.ts +21 -0
  318. package/src/families/cosmos/helpers.unit.test.ts +63 -0
  319. package/src/families/cosmos/js-signOperation.ts +6 -3
  320. package/src/families/cosmos/js-synchronisation.ts +120 -119
  321. package/src/families/cosmos/specs.ts +11 -2
  322. package/src/families/crypto_org/specs.ts +12 -19
  323. package/src/families/elrond/specs.ts +1 -0
  324. package/src/families/elrond/speculos-deviceActions.ts +4 -9
  325. package/src/families/ethereum/specs.ts +34 -38
  326. package/src/families/ethereum/speculos-deviceActions.ts +16 -46
  327. package/src/families/evm/specs.ts +18 -8
  328. package/src/families/evm/speculos-deviceActions.ts +7 -35
  329. package/src/families/filecoin/specs.ts +4 -1
  330. package/src/families/filecoin/speculos-deviceActions.ts +7 -8
  331. package/src/families/hedera/specs.ts +3 -1
  332. package/src/families/osmosis/specs.ts +4 -1
  333. package/src/families/polkadot/specs.ts +11 -2
  334. package/src/families/polkadot/speculos-deviceActions.ts +5 -16
  335. package/src/families/ripple/specs.ts +3 -1
  336. package/src/families/ripple/speculos-deviceActions.ts +3 -28
  337. package/src/families/solana/specs.ts +15 -4
  338. package/src/families/solana/speculos-deviceActions.ts +6 -8
  339. package/src/families/stellar/specs.ts +1 -0
  340. package/src/families/stellar/speculos-deviceActions.ts +5 -11
  341. package/src/families/tezos/specs.ts +7 -5
  342. package/src/families/tezos/speculos-deviceActions.ts +9 -16
  343. package/src/families/tron/specs.ts +31 -3
  344. package/src/families/tron/speculos-deviceActions.ts +4 -12
  345. package/src/families/tron/{synchronisation.test.ts → synchronisation.integration.test.ts} +0 -0
  346. package/src/featureFlags/defaultFeatures.ts +6 -0
  347. package/src/hw/actions/installLanguage.ts +1 -1
  348. package/src/hw/extractOnboardingState.test.ts +29 -12
  349. package/src/hw/extractOnboardingState.ts +17 -9
  350. package/src/load/speculos.ts +42 -21
  351. package/src/manager/hooks.ts +6 -6
  352. package/src/manager/localization.ts +2 -2
  353. package/src/mock/account.ts +18 -20
  354. package/src/notifications/ServiceStatusProvider/index.tsx +8 -1
  355. package/src/postOnboarding/PostOnboardingProvider.tsx +49 -0
  356. package/src/postOnboarding/actions.ts +40 -0
  357. package/src/postOnboarding/hooks/index.ts +5 -0
  358. package/src/postOnboarding/hooks/useAllPostOnboardingActionsCompleted.test.ts +82 -0
  359. package/src/postOnboarding/hooks/useAllPostOnboardingActionsCompleted.ts +12 -0
  360. package/src/postOnboarding/hooks/usePostOnboardingContext.ts +9 -0
  361. package/src/postOnboarding/hooks/usePostOnboardingEntryPointVisibleOnWallet.test.ts +83 -0
  362. package/src/postOnboarding/hooks/usePostOnboardingEntryPointVisibleOnWallet.ts +22 -0
  363. package/src/postOnboarding/hooks/usePostOnboardingHubState.test.ts +184 -0
  364. package/src/postOnboarding/hooks/usePostOnboardingHubState.ts +56 -0
  365. package/src/postOnboarding/hooks/useStartPostOnboardingCallback.ts +38 -0
  366. package/src/postOnboarding/mock.ts +53 -0
  367. package/src/postOnboarding/reducer.test.ts +247 -0
  368. package/src/postOnboarding/reducer.ts +105 -0
  369. package/lib/families/tron/synchronisation.test.d.ts +0 -2
  370. package/lib/families/tron/synchronisation.test.d.ts.map +0 -1
  371. package/lib/families/tron/synchronisation.test.js.map +0 -1
@@ -9,7 +9,12 @@ import type {
9
9
  Transaction,
10
10
  } from "../../families/polkadot/types";
11
11
  import { getCryptoCurrencyById, parseCurrencyUnit } from "../../currencies";
12
- import { botTest, pickSiblings } from "../../bot/specs";
12
+ import {
13
+ botTest,
14
+ expectSiblingsHaveSpendablePartGreaterThan,
15
+ genericTestDestination,
16
+ pickSiblings,
17
+ } from "../../bot/specs";
13
18
  import type { AppSpec } from "../../bot/types";
14
19
  import { toOperationRaw } from "../../account";
15
20
  import {
@@ -40,6 +45,7 @@ const polkadot: AppSpec<Transaction> = {
40
45
  },
41
46
  testTimeout: 2 * 60 * 1000,
42
47
  genericDeviceAction: acceptTransaction,
48
+ minViableAmount: POLKADOT_MIN_SAFE,
43
49
  transactionCheck: ({ maxSpendable }) => {
44
50
  invariant(maxSpendable.gt(POLKADOT_MIN_SAFE), "balance is too low");
45
51
  },
@@ -60,6 +66,7 @@ const polkadot: AppSpec<Transaction> = {
60
66
  {
61
67
  name: "send 50%~",
62
68
  maxRun: 4,
69
+ testDestination: genericTestDestination,
63
70
  transaction: ({ account, siblings, bridge }) => {
64
71
  invariant((account as PolkadotAccount).polkadotResources, "polkadot");
65
72
  const sibling = pickSiblings(siblings, maxAccounts);
@@ -105,7 +112,9 @@ const polkadot: AppSpec<Transaction> = {
105
112
  {
106
113
  name: "bond - bondExtra",
107
114
  maxRun: 1,
108
- transaction: ({ account, bridge }) => {
115
+ transaction: ({ siblings, account, bridge }) => {
116
+ expectSiblingsHaveSpendablePartGreaterThan(siblings, 0.5);
117
+
109
118
  invariant((account as PolkadotAccount).polkadotResources, "polkadot");
110
119
  invariant(canBond(account), "can't bond");
111
120
  invariant(
@@ -1,7 +1,6 @@
1
1
  import type { DeviceAction } from "../../bot/types";
2
2
  import type { PolkadotAccount, Transaction } from "./types";
3
- import { deviceActionFlow } from "../../bot/specs";
4
- import { formatCurrencyUnit } from "../../currencies";
3
+ import { deviceActionFlow, formatDeviceAmount } from "../../bot/specs";
5
4
 
6
5
  export const acceptTransaction: DeviceAction<Transaction, any> =
7
6
  deviceActionFlow({
@@ -22,20 +21,10 @@ export const acceptTransaction: DeviceAction<Transaction, any> =
22
21
  {
23
22
  title: "Amount",
24
23
  button: "Rr",
25
- expectedValue: ({ account, transaction }) => {
26
- const formattedValue =
27
- "DOT " +
28
- formatCurrencyUnit(account.unit, transaction.amount, {
29
- disableRounding: true,
30
- });
31
-
32
- if (!formattedValue.includes(".")) {
33
- // if the value is pure integer, in the app it will automatically add an .0
34
- return formattedValue + ".0";
35
- }
36
-
37
- return formattedValue;
38
- },
24
+ expectedValue: ({ account, transaction }) =>
25
+ formatDeviceAmount(account.currency, transaction.amount, {
26
+ forceFloating: true,
27
+ }),
39
28
  },
40
29
  {
41
30
  title: "Chain",
@@ -2,7 +2,7 @@ import expect from "expect";
2
2
  import invariant from "invariant";
3
3
  import type { Transaction } from "./types";
4
4
  import { getCryptoCurrencyById, parseCurrencyUnit } from "../../currencies";
5
- import { botTest, pickSiblings } from "../../bot/specs";
5
+ import { botTest, genericTestDestination, pickSiblings } from "../../bot/specs";
6
6
  import type { AppSpec } from "../../bot/types";
7
7
  import { DeviceModelId } from "@ledgerhq/devices";
8
8
  import { acceptTransaction } from "./speculos-deviceActions";
@@ -19,10 +19,12 @@ const ripple: AppSpec<Transaction> = {
19
19
  appName: "XRP",
20
20
  },
21
21
  genericDeviceAction: acceptTransaction,
22
+ minViableAmount: minAmountCutoff,
22
23
  mutations: [
23
24
  {
24
25
  name: "move ~50%",
25
26
  maxRun: 2,
27
+ testDestination: genericTestDestination,
26
28
  transaction: ({ account, siblings, bridge, maxSpendable }) => {
27
29
  invariant(maxSpendable.gt(minAmountCutoff), "balance is too low");
28
30
  const transaction = bridge.createTransaction(account);
@@ -1,7 +1,6 @@
1
1
  import type { DeviceAction } from "../../bot/types";
2
2
  import type { Transaction } from "./types";
3
- import { formatCurrencyUnit } from "../../currencies";
4
- import { deviceActionFlow } from "../../bot/specs";
3
+ import { deviceActionFlow, formatDeviceAmount } from "../../bot/specs";
5
4
 
6
5
  export const acceptTransaction: DeviceAction<Transaction, any> =
7
6
  deviceActionFlow({
@@ -15,37 +14,13 @@ export const acceptTransaction: DeviceAction<Transaction, any> =
15
14
  title: "Amount",
16
15
  button: "Rr",
17
16
  expectedValue: ({ account, status }) =>
18
- formatCurrencyUnit(
19
- {
20
- ...account.unit,
21
- code: account.currency.deviceTicker || account.unit.code,
22
- prefixCode: true,
23
- },
24
- status.amount,
25
- {
26
- showCode: true,
27
- disableRounding: true,
28
- joinFragmentsSeparator: " ",
29
- }
30
- ).replace(/\s/g, " "),
17
+ formatDeviceAmount(account.currency, status.amount),
31
18
  },
32
19
  {
33
20
  title: "Fee",
34
21
  button: "Rr",
35
22
  expectedValue: ({ account, status }) =>
36
- formatCurrencyUnit(
37
- {
38
- ...account.unit,
39
- code: account.currency.deviceTicker || account.unit.code,
40
- prefixCode: true,
41
- },
42
- status.estimatedFees,
43
- {
44
- showCode: true,
45
- disableRounding: true,
46
- joinFragmentsSeparator: " ",
47
- }
48
- ).replace(/\s/g, " "),
23
+ formatDeviceAmount(account.currency, status.estimatedFees),
49
24
  },
50
25
  {
51
26
  title: "Destination Tag",
@@ -2,7 +2,12 @@ import invariant from "invariant";
2
2
  import expect from "expect";
3
3
  import { getCryptoCurrencyById } from "@ledgerhq/cryptoassets";
4
4
  import { DeviceModelId } from "@ledgerhq/devices";
5
- import { botTest, pickSiblings } from "../../bot/specs";
5
+ import {
6
+ botTest,
7
+ expectSiblingsHaveSpendablePartGreaterThan,
8
+ genericTestDestination,
9
+ pickSiblings,
10
+ } from "../../bot/specs";
6
11
  import { AppSpec, TransactionTestInput } from "../../bot/types";
7
12
  import { SolanaAccount, Transaction } from "./types";
8
13
  import {
@@ -17,6 +22,8 @@ import { getCurrentSolanaPreloadData } from "./js-preload-data";
17
22
  import { sample } from "lodash/fp";
18
23
  import BigNumber from "bignumber.js";
19
24
 
25
+ const maxAccount = 9;
26
+
20
27
  const solana: AppSpec<Transaction> = {
21
28
  name: "Solana",
22
29
  appQuery: {
@@ -32,11 +39,12 @@ const solana: AppSpec<Transaction> = {
32
39
  {
33
40
  name: "Transfer ~50%",
34
41
  maxRun: 2,
42
+ testDestination: genericTestDestination,
35
43
  deviceAction: acceptTransferTransaction,
36
44
  transaction: ({ account, siblings, bridge, maxSpendable }) => {
37
45
  invariant(maxSpendable.gt(0), "balance is 0");
38
46
  const transaction = bridge.createTransaction(account);
39
- const sibling = pickSiblings(siblings);
47
+ const sibling = pickSiblings(siblings, maxAccount);
40
48
  const recipient = sibling.freshAddress;
41
49
  const amount = account.spendableBalance
42
50
  .div(1.9 + 0.2 * Math.random())
@@ -54,11 +62,12 @@ const solana: AppSpec<Transaction> = {
54
62
  {
55
63
  name: "Transfer Max",
56
64
  maxRun: 1,
65
+ testDestination: genericTestDestination,
57
66
  deviceAction: acceptTransferTransaction,
58
67
  transaction: ({ account, siblings, bridge, maxSpendable }) => {
59
68
  invariant(maxSpendable.gt(0), "balance is 0");
60
69
  const transaction = bridge.createTransaction(account);
61
- const sibling = pickSiblings(siblings);
70
+ const sibling = pickSiblings(siblings, maxAccount);
62
71
  const recipient = sibling.freshAddress;
63
72
  return {
64
73
  transaction,
@@ -78,7 +87,9 @@ const solana: AppSpec<Transaction> = {
78
87
  name: "Delegate",
79
88
  maxRun: 1,
80
89
  deviceAction: acceptStakeCreateAccountTransaction,
81
- transaction: ({ account, bridge }) => {
90
+ transaction: ({ account, bridge, siblings }) => {
91
+ expectSiblingsHaveSpendablePartGreaterThan(siblings, 0.5);
92
+
82
93
  const { solanaResources } = account as SolanaAccount;
83
94
  if (solanaResources === undefined) {
84
95
  throw new Error("solana resources required");
@@ -1,7 +1,6 @@
1
1
  import type { DeviceAction } from "../../bot/types";
2
2
  import type { Transaction } from "./types";
3
- import { formatCurrencyUnit } from "../../currencies";
4
- import { deviceActionFlow } from "../../bot/specs";
3
+ import { deviceActionFlow, formatDeviceAmount } from "../../bot/specs";
5
4
  import { getCryptoCurrencyById } from "@ledgerhq/cryptoassets";
6
5
  import BigNumber from "bignumber.js";
7
6
  import type { CryptoCurrency } from "@ledgerhq/types-cryptoassets";
@@ -17,12 +16,11 @@ function ellipsis(str: string) {
17
16
  return `${str.slice(0, 7)}..${str.slice(-7)}`;
18
17
  }
19
18
 
20
- function formatAmount(currency: CryptoCurrency, amount: number) {
21
- const unit = getMainCurrency(currency).units[0];
22
- return formatCurrencyUnit(unit, new BigNumber(amount), {
23
- disableRounding: true,
24
- showCode: true,
25
- }).replace(/\s/g, " ");
19
+ function formatAmount(c: CryptoCurrency, amount: number) {
20
+ const currency = getMainCurrency(c);
21
+ return formatDeviceAmount(currency, new BigNumber(amount), {
22
+ postfixCode: true,
23
+ });
26
24
  }
27
25
 
28
26
  export const acceptTransferTransaction: DeviceAction<Transaction, any> =
@@ -36,6 +36,7 @@ const stellar: AppSpec<Transaction> = {
36
36
  },
37
37
  genericDeviceAction: acceptTransaction,
38
38
  testTimeout: 2 * 60 * 1000,
39
+ minViableAmount: minAmountCutoff,
39
40
  mutations: [
40
41
  {
41
42
  name: "move ~50% XLM",
@@ -1,14 +1,11 @@
1
1
  import type { DeviceAction } from "../../bot/types";
2
2
  import type { Transaction } from "./types";
3
3
  import { formatCurrencyUnit } from "../../currencies";
4
- import { deviceActionFlow } from "../../bot/specs";
4
+ import { deviceActionFlow, formatDeviceAmount } from "../../bot/specs";
5
5
 
6
6
  const expectedAmount = ({ account, status, transaction }) => {
7
7
  if (transaction.assetCode && transaction.assetIssuer) {
8
- const amount = formatCurrencyUnit(account.unit, status.amount, {
9
- disableRounding: true,
10
- useGrouping: false,
11
- });
8
+ const amount = formatDeviceAmount(account.currency, status.amount);
12
9
 
13
10
  return `${amount} ${transaction.assetCode}@${truncateAddress(
14
11
  transaction.assetIssuer,
@@ -17,12 +14,9 @@ const expectedAmount = ({ account, status, transaction }) => {
17
14
  )}`;
18
15
  }
19
16
 
20
- return (
21
- formatCurrencyUnit(account.unit, status.amount, {
22
- disableRounding: true,
23
- useGrouping: false,
24
- }) + " XLM"
25
- );
17
+ return formatDeviceAmount(account.currency, status.amount, {
18
+ postfixCode: true,
19
+ });
26
20
  };
27
21
 
28
22
  const truncateAddress = (stellarAddress: string, start = 6, end = 6) =>
@@ -3,7 +3,7 @@ import sample from "lodash/sample";
3
3
  import invariant from "invariant";
4
4
  import type { Transaction } from "./types";
5
5
  import { getCryptoCurrencyById, parseCurrencyUnit } from "../../currencies";
6
- import { pickSiblings } from "../../bot/specs";
6
+ import { genericTestDestination, pickSiblings } from "../../bot/specs";
7
7
  import type { AppSpec } from "../../bot/types";
8
8
  import { DeviceModelId } from "@ledgerhq/devices";
9
9
  import { getAccountDelegationSync, isAccountDelegating } from "./bakers";
@@ -28,6 +28,7 @@ function expectRevealed(account) {
28
28
  const tezosUnit = getCryptoCurrencyById("tezos").units[0];
29
29
 
30
30
  const safeMinimumForDestinationNotCreated = parseCurrencyUnit(tezosUnit, "0.6");
31
+ const strictMin = parseCurrencyUnit(tezosUnit, "0.02");
31
32
 
32
33
  const tezos: AppSpec<Transaction> = {
33
34
  name: "Tezos",
@@ -38,16 +39,15 @@ const tezos: AppSpec<Transaction> = {
38
39
  },
39
40
  genericDeviceAction: acceptTransaction,
40
41
  testTimeout: 2 * 60 * 1000,
42
+ minViableAmount: strictMin,
41
43
  transactionCheck: ({ maxSpendable }) => {
42
- invariant(
43
- maxSpendable.gt(parseCurrencyUnit(tezosUnit, "0.02")),
44
- "balance is too low"
45
- );
44
+ invariant(maxSpendable.gt(strictMin), "balance is too low");
46
45
  },
47
46
  mutations: [
48
47
  {
49
48
  name: "send unrevealed",
50
49
  maxRun: 1,
50
+ testDestination: genericTestDestination,
51
51
  transaction: ({ maxSpendable, account, siblings, bridge }) => {
52
52
  expectUnrevealed(account);
53
53
  const sibling = pickSiblings(siblings, maxAccount);
@@ -68,6 +68,7 @@ const tezos: AppSpec<Transaction> = {
68
68
  {
69
69
  name: "send revealed",
70
70
  maxRun: 2,
71
+ testDestination: genericTestDestination,
71
72
  transaction: ({ maxSpendable, account, siblings, bridge }) => {
72
73
  expectRevealed(account);
73
74
  const sibling = pickSiblings(siblings, maxAccount);
@@ -88,6 +89,7 @@ const tezos: AppSpec<Transaction> = {
88
89
  {
89
90
  name: "send max (non delegating)",
90
91
  maxRun: 3,
92
+ testDestination: genericTestDestination,
91
93
  transaction: ({ account, siblings, bridge, maxSpendable }) => {
92
94
  invariant(
93
95
  !isAccountDelegating(account),
@@ -1,8 +1,7 @@
1
1
  // @flow
2
2
  import type { DeviceAction } from "../../bot/types";
3
3
  import type { Transaction } from "./types";
4
- import { formatCurrencyUnit } from "../../currencies";
5
- import { deviceActionFlow } from "../../bot/specs";
4
+ import { deviceActionFlow, formatDeviceAmount } from "../../bot/specs";
6
5
 
7
6
  export const acceptTransaction: DeviceAction<Transaction, any> =
8
7
  deviceActionFlow({
@@ -38,24 +37,18 @@ export const acceptTransaction: DeviceAction<Transaction, any> =
38
37
  {
39
38
  title: "Amount",
40
39
  button: "Rr",
41
- expectedValue: ({ account, transaction }) => {
42
- const amount = transaction.amount;
43
- return formatCurrencyUnit(account.unit, amount, {
44
- disableRounding: true,
45
- joinFragmentsSeparator: " ",
46
- }).replace(/\s/g, " ");
47
- },
40
+ expectedValue: ({ account, transaction }) =>
41
+ formatDeviceAmount(account.currency, transaction.amount, {
42
+ hideCode: true,
43
+ }),
48
44
  },
49
45
  {
50
46
  title: "Fee",
51
47
  button: "Rr",
52
- expectedValue: ({ account, status }) => {
53
- const amount = status.estimatedFees;
54
- return formatCurrencyUnit(account.currency.units[0], amount, {
55
- disableRounding: true,
56
- joinFragmentsSeparator: " ",
57
- }).replace(/\s/g, " ");
58
- },
48
+ expectedValue: ({ account, status }) =>
49
+ formatDeviceAmount(account.currency, status.estimatedFees, {
50
+ hideCode: true,
51
+ }),
59
52
  },
60
53
  {
61
54
  title: "Source",
@@ -7,8 +7,12 @@ import sampleSize from "lodash/sampleSize";
7
7
  import get from "lodash/get";
8
8
  import type { Transaction, TronAccount } from "./types";
9
9
  import { getCryptoCurrencyById, parseCurrencyUnit } from "../../currencies";
10
- import { botTest, pickSiblings } from "../../bot/specs";
11
- import type { AppSpec } from "../../bot/types";
10
+ import {
11
+ botTest,
12
+ expectSiblingsHaveSpendablePartGreaterThan,
13
+ pickSiblings,
14
+ } from "../../bot/specs";
15
+ import type { AppSpec, TransactionDestinationTestInput } from "../../bot/types";
12
16
  import { getUnfreezeData, getNextRewardDate } from "./react";
13
17
  import { DeviceModelId } from "@ledgerhq/devices";
14
18
  import { SubAccount } from "@ledgerhq/types-live";
@@ -20,6 +24,7 @@ const maxAccount = 10;
20
24
  const getDecimalPart = (value: BigNumber, magnitude: number) =>
21
25
  value.minus(value.modulo(10 ** magnitude));
22
26
 
27
+ // FIXME TRON have a bug where the amounts from the API have imprecisions
23
28
  const expectedApproximate = (
24
29
  value: BigNumber,
25
30
  expected: BigNumber,
@@ -30,6 +35,24 @@ const expectedApproximate = (
30
35
  }
31
36
  };
32
37
 
38
+ const testDestination = <T>({
39
+ destination,
40
+ operation,
41
+ destinationBeforeTransaction,
42
+ sendingOperation,
43
+ }: TransactionDestinationTestInput<T>): void => {
44
+ const amount = sendingOperation.value.minus(sendingOperation.fee);
45
+ botTest("account balance increased with transaction amount", () =>
46
+ expectedApproximate(
47
+ destination.balance,
48
+ destinationBeforeTransaction.balance.plus(amount)
49
+ )
50
+ );
51
+ botTest("operation amount is consistent with sendingOperation", () =>
52
+ expectedApproximate(operation.value, amount)
53
+ );
54
+ };
55
+
33
56
  const tron: AppSpec<Transaction> = {
34
57
  name: "Tron",
35
58
  currency,
@@ -39,10 +62,12 @@ const tron: AppSpec<Transaction> = {
39
62
  },
40
63
  genericDeviceAction: acceptTransaction,
41
64
  testTimeout: 2 * 60 * 1000,
65
+ minViableAmount: minimalAmount,
42
66
  mutations: [
43
67
  {
44
68
  name: "move 50% to another account",
45
69
  maxRun: 2,
70
+ testDestination,
46
71
  transaction: ({ account, siblings, bridge, maxSpendable }) => {
47
72
  invariant(maxSpendable.gt(minimalAmount), "balance is too low");
48
73
  const sibling = pickSiblings(siblings, maxAccount);
@@ -72,6 +97,7 @@ const tron: AppSpec<Transaction> = {
72
97
  {
73
98
  name: "send max to another account",
74
99
  maxRun: 1,
100
+ testDestination,
75
101
  transaction: ({ account, siblings, bridge, maxSpendable }) => {
76
102
  invariant(maxSpendable.gt(minimalAmount), "balance is too low");
77
103
  const sibling = pickSiblings(siblings, maxAccount);
@@ -97,7 +123,9 @@ const tron: AppSpec<Transaction> = {
97
123
  {
98
124
  name: "freeze 25% to bandwidth | energy",
99
125
  maxRun: 1,
100
- transaction: ({ account, bridge, maxSpendable }) => {
126
+ transaction: ({ siblings, account, bridge, maxSpendable }) => {
127
+ expectSiblingsHaveSpendablePartGreaterThan(siblings, 0.5);
128
+
101
129
  invariant(maxSpendable.gt(minimalAmount), "balance is too low");
102
130
  let amount = getDecimalPart(
103
131
  maxSpendable.div(4),
@@ -1,6 +1,5 @@
1
1
  import type { DeviceAction } from "../../bot/types";
2
- import { deviceActionFlow } from "../../bot/specs";
3
- import { formatCurrencyUnit } from "../../currencies";
2
+ import { deviceActionFlow, formatDeviceAmount } from "../../bot/specs";
4
3
  import type { Transaction, Vote } from "./types";
5
4
 
6
5
  function subAccount(subAccountId, account) {
@@ -40,16 +39,9 @@ export const acceptTransaction: DeviceAction<Transaction, any> =
40
39
  title: "Amount",
41
40
  button: "Rr",
42
41
  expectedValue: ({ account, status }) =>
43
- formatCurrencyUnit(
44
- {
45
- ...account.unit,
46
- code: account.currency.deviceTicker || account.unit.code,
47
- },
48
- status.amount,
49
- {
50
- disableRounding: true,
51
- }
52
- ),
42
+ formatDeviceAmount(account.currency, status.amount, {
43
+ hideCode: true,
44
+ }),
53
45
  },
54
46
  {
55
47
  title: "Token",
@@ -7,6 +7,9 @@ export const defaultFeatures: DefaultFeatures = {
7
7
  pushNotifications: {
8
8
  enabled: false,
9
9
  },
10
+ deviceLocalization: {
11
+ enabled: false,
12
+ },
10
13
  buyDeviceFromLive: {
11
14
  enabled: false,
12
15
  params: {
@@ -109,4 +112,7 @@ export const defaultFeatures: DefaultFeatures = {
109
112
  ptxSmartRoutingMobile: {
110
113
  enabled: false,
111
114
  },
115
+ mockFeature: {
116
+ enabled: false,
117
+ },
112
118
  };
@@ -137,7 +137,7 @@ const implementations = {
137
137
  const POLLING = 2000;
138
138
  const INIT_DEBOUNCE = 5000;
139
139
  const DISCONNECT_DEBOUNCE = 5000;
140
- const DEVICE_POLLING_TIMEOUT = 20000;
140
+ const DEVICE_POLLING_TIMEOUT = 30000;
141
141
  // this pattern allows to actually support events based (like if deviceSubject emits new device changes) but inside polling paradigm
142
142
  let pollingOnDevice;
143
143
  const sub = deviceSubject.subscribe((d) => {
@@ -44,23 +44,40 @@ describe("@hw/extractOnboardingState", () => {
44
44
  });
45
45
 
46
46
  describe("and the user is on the welcome screen", () => {
47
- beforeEach(() => {
47
+ it("should return an onboarding step that is set at the welcome screen", () => {
48
48
  flagsBytes[3] = 0;
49
- });
49
+ let onboardingState = extractOnboardingState(flagsBytes);
50
+ expect(onboardingState).not.toBeNull();
51
+ expect(onboardingState?.currentOnboardingStep).toBe(
52
+ OnboardingStep.WelcomeScreen1
53
+ );
50
54
 
51
- it("should return an onboarding step that is set at the welcome screen", () => {
52
- const onboardingState = extractOnboardingState(flagsBytes);
55
+ flagsBytes[3] = 1;
56
+ onboardingState = extractOnboardingState(flagsBytes);
57
+ expect(onboardingState).not.toBeNull();
58
+ expect(onboardingState?.currentOnboardingStep).toBe(
59
+ OnboardingStep.WelcomeScreen2
60
+ );
61
+
62
+ flagsBytes[3] = 2;
63
+ onboardingState = extractOnboardingState(flagsBytes);
64
+ expect(onboardingState).not.toBeNull();
65
+ expect(onboardingState?.currentOnboardingStep).toBe(
66
+ OnboardingStep.WelcomeScreen3
67
+ );
53
68
 
69
+ flagsBytes[3] = 3;
70
+ onboardingState = extractOnboardingState(flagsBytes);
54
71
  expect(onboardingState).not.toBeNull();
55
72
  expect(onboardingState?.currentOnboardingStep).toBe(
56
- OnboardingStep.WelcomeScreen
73
+ OnboardingStep.WelcomeScreen4
57
74
  );
58
75
  });
59
76
  });
60
77
 
61
78
  describe("and the user is choosing what kind of setup they want", () => {
62
79
  beforeEach(() => {
63
- flagsBytes[3] = 1;
80
+ flagsBytes[3] = 5;
64
81
  });
65
82
 
66
83
  it("should return an onboarding step that is set at the setup choice", () => {
@@ -75,7 +92,7 @@ describe("@hw/extractOnboardingState", () => {
75
92
 
76
93
  describe("and the user is setting their pin", () => {
77
94
  beforeEach(() => {
78
- flagsBytes[3] = 2;
95
+ flagsBytes[3] = 6;
79
96
  });
80
97
 
81
98
  it("should return an onboarding step that is set at setting the pin", () => {
@@ -104,7 +121,7 @@ describe("@hw/extractOnboardingState", () => {
104
121
 
105
122
  describe("and the user is writing the seed word i", () => {
106
123
  beforeEach(() => {
107
- flagsBytes[3] = 3;
124
+ flagsBytes[3] = 7;
108
125
  });
109
126
 
110
127
  it("should return an onboarding step that is set at writting the seed phrase", () => {
@@ -131,7 +148,7 @@ describe("@hw/extractOnboardingState", () => {
131
148
 
132
149
  describe("and the user is confirming the seed word i", () => {
133
150
  beforeEach(() => {
134
- flagsBytes[3] = 4;
151
+ flagsBytes[3] = 8;
135
152
  });
136
153
 
137
154
  it("should return an onboarding step that is set at confirming the seed phrase", () => {
@@ -190,7 +207,7 @@ describe("@hw/extractOnboardingState", () => {
190
207
  // 24-words seed
191
208
  flagsBytes[2] |= 0 << 5;
192
209
 
193
- flagsBytes[3] = 5;
210
+ flagsBytes[3] = 9;
194
211
  });
195
212
 
196
213
  it("should return an onboarding step that is set at confirming the restored seed phrase", () => {
@@ -219,7 +236,7 @@ describe("@hw/extractOnboardingState", () => {
219
236
 
220
237
  describe("and the user is on the safety warning screen", () => {
221
238
  beforeEach(() => {
222
- flagsBytes[3] = 6;
239
+ flagsBytes[3] = 10;
223
240
  });
224
241
 
225
242
  it("should return an onboarding step that is set at the safety warning screen", () => {
@@ -234,7 +251,7 @@ describe("@hw/extractOnboardingState", () => {
234
251
 
235
252
  describe("and the user finished the onboarding process", () => {
236
253
  beforeEach(() => {
237
- flagsBytes[3] = 7;
254
+ flagsBytes[3] = 11;
238
255
  });
239
256
 
240
257
  it("should return an onboarding step that is set at ready", () => {
@@ -16,7 +16,11 @@ const fromBitsToSeedPhraseType = new Map<number, SeedPhraseType>([
16
16
  ]);
17
17
 
18
18
  export enum OnboardingStep {
19
- WelcomeScreen = "WELCOME_SCREEN",
19
+ WelcomeScreen1 = "WELCOME_SCREEN_1",
20
+ WelcomeScreen2 = "WELCOME_SCREEN_2",
21
+ WelcomeScreen3 = "WELCOME_SCREEN_3",
22
+ WelcomeScreen4 = "WELCOME_SCREEN_4",
23
+ WelcomeScreenReminder = "WELCOME_SCREEN_REMINDER",
20
24
  SetupChoice = "SETUP_CHOICE",
21
25
  Pin = "PIN",
22
26
  NewDevice = "NEW_DEVICE", // path "new device" & currentSeedWordIndex available
@@ -27,14 +31,18 @@ export enum OnboardingStep {
27
31
  }
28
32
 
29
33
  const fromBitsToOnboardingStep = new Map<number, OnboardingStep>([
30
- [0, OnboardingStep.WelcomeScreen],
31
- [1, OnboardingStep.SetupChoice],
32
- [2, OnboardingStep.Pin],
33
- [3, OnboardingStep.NewDevice],
34
- [4, OnboardingStep.NewDeviceConfirming],
35
- [5, OnboardingStep.RestoreSeed],
36
- [6, OnboardingStep.SafetyWarning],
37
- [7, OnboardingStep.Ready],
34
+ [0, OnboardingStep.WelcomeScreen1],
35
+ [1, OnboardingStep.WelcomeScreen2],
36
+ [2, OnboardingStep.WelcomeScreen3],
37
+ [3, OnboardingStep.WelcomeScreen4],
38
+ [4, OnboardingStep.WelcomeScreenReminder],
39
+ [5, OnboardingStep.SetupChoice],
40
+ [6, OnboardingStep.Pin],
41
+ [7, OnboardingStep.NewDevice],
42
+ [8, OnboardingStep.NewDeviceConfirming],
43
+ [9, OnboardingStep.RestoreSeed],
44
+ [10, OnboardingStep.SafetyWarning],
45
+ [11, OnboardingStep.Ready],
38
46
  ]);
39
47
 
40
48
  export type OnboardingState = {