@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
@@ -13,7 +13,12 @@ import type {
13
13
  } from "../../families/cosmos/types";
14
14
  import { getCurrentCosmosPreloadData } from "../../families/cosmos/preloadedData";
15
15
  import { getCryptoCurrencyById } from "../../currencies";
16
- import { pickSiblings, botTest } from "../../bot/specs";
16
+ import {
17
+ pickSiblings,
18
+ botTest,
19
+ expectSiblingsHaveSpendablePartGreaterThan,
20
+ genericTestDestination,
21
+ } from "../../bot/specs";
17
22
  import type { AppSpec } from "../../bot/types";
18
23
  import { toOperationRaw } from "../../account";
19
24
  import {
@@ -56,6 +61,7 @@ const cosmos: AppSpec<Transaction> = {
56
61
  },
57
62
  genericDeviceAction: acceptTransaction,
58
63
  testTimeout: 2 * 60 * 1000,
64
+ minViableAmount: minAmount,
59
65
  transactionCheck: ({ maxSpendable }) => {
60
66
  invariant(maxSpendable.gt(minAmount), "balance is too low");
61
67
  },
@@ -92,6 +98,7 @@ const cosmos: AppSpec<Transaction> = {
92
98
  mutations: [
93
99
  {
94
100
  name: "send some",
101
+ testDestination: genericTestDestination,
95
102
  test: ({ account, accountBeforeTransaction, operation }) => {
96
103
  expect(account.balance.toString()).toBe(
97
104
  accountBeforeTransaction.balance.minus(operation.value).toString()
@@ -123,6 +130,7 @@ const cosmos: AppSpec<Transaction> = {
123
130
  {
124
131
  name: "send max",
125
132
  maxRun: 1,
133
+ testDestination: genericTestDestination,
126
134
  transaction: ({ account, siblings, bridge }) => {
127
135
  return {
128
136
  transaction: bridge.createTransaction(account),
@@ -145,7 +153,8 @@ const cosmos: AppSpec<Transaction> = {
145
153
  {
146
154
  name: "delegate new validators",
147
155
  maxRun: 1,
148
- transaction: ({ account, bridge }) => {
156
+ transaction: ({ account, bridge, siblings }) => {
157
+ expectSiblingsHaveSpendablePartGreaterThan(siblings, 0.5);
149
158
  invariant(
150
159
  account.index % 2 > 0,
151
160
  "only one out of 2 accounts is not going to delegate"
@@ -6,6 +6,14 @@ import type { AppSpec } from "../../bot/types";
6
6
  import { DeviceModelId } from "@ledgerhq/devices";
7
7
  import { acceptTransaction } from "./speculos-deviceActions";
8
8
 
9
+ const minAmount = parseCurrencyUnit(
10
+ getCryptoCurrencyById("crypto_org").units[0],
11
+ "0.01"
12
+ );
13
+ const transactionCheck = ({ maxSpendable }) => {
14
+ invariant(maxSpendable.gt(minAmount), "balance is too low");
15
+ };
16
+
9
17
  const sharedMutations = ({ maxAccount }) => [
10
18
  {
11
19
  name: "move 50%",
@@ -31,17 +39,8 @@ const crypto_org_croeseid: AppSpec<Transaction> = {
31
39
  },
32
40
  genericDeviceAction: acceptTransaction,
33
41
  testTimeout: 4 * 60 * 1000,
34
- transactionCheck: ({ maxSpendable }) => {
35
- invariant(
36
- maxSpendable.gt(
37
- parseCurrencyUnit(
38
- getCryptoCurrencyById("crypto_org_croeseid").units[0],
39
- "0.01"
40
- )
41
- ),
42
- "balance is too low"
43
- );
44
- },
42
+ minViableAmount: minAmount,
43
+ transactionCheck,
45
44
  mutations: sharedMutations({ maxAccount: 5 }),
46
45
  };
47
46
 
@@ -54,14 +53,8 @@ const crypto_org: AppSpec<Transaction> = {
54
53
  },
55
54
  genericDeviceAction: acceptTransaction,
56
55
  testTimeout: 4 * 60 * 1000,
57
- transactionCheck: ({ maxSpendable }) => {
58
- invariant(
59
- maxSpendable.gt(
60
- parseCurrencyUnit(getCryptoCurrencyById("crypto_org").units[0], "0.01")
61
- ),
62
- "balance is too low"
63
- );
64
- },
56
+ minViableAmount: minAmount,
57
+ transactionCheck,
65
58
  mutations: sharedMutations({ maxAccount: 5 }),
66
59
  };
67
60
 
@@ -28,6 +28,7 @@ const elrondSpec: AppSpec<Transaction> = {
28
28
  },
29
29
  genericDeviceAction: acceptTransaction,
30
30
  testTimeout: 2 * 60 * 1000,
31
+ minViableAmount: ELROND_MIN_SAFE,
31
32
  transactionCheck: ({ maxSpendable }) => {
32
33
  invariant(maxSpendable.gt(ELROND_MIN_SAFE), "balance is too low");
33
34
  },
@@ -1,7 +1,6 @@
1
1
  import type { DeviceAction } from "../../bot/types";
2
2
  import type { 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({
@@ -15,13 +14,9 @@ export const acceptTransaction: DeviceAction<Transaction, any> =
15
14
  title: "Amount",
16
15
  button: "Rr",
17
16
  expectedValue: ({ account, transaction }) =>
18
- formatCurrencyUnit(account.unit, transaction.amount, {
19
- showCode: true,
20
- disableRounding: true,
21
- joinFragmentsSeparator: " ",
22
- })
23
- .replace(/\s+/g, " ")
24
- .replace("egld", "EGLD"), // FIXME
17
+ formatDeviceAmount(account.currency, transaction.amount, {
18
+ postfixCode: true,
19
+ }),
25
20
  },
26
21
  {
27
22
  title: "Fee",
@@ -13,7 +13,7 @@ import {
13
13
  getAccountCapabilities,
14
14
  } from "../../compound/logic";
15
15
  import { getSupplyMax } from "./modules/compound";
16
- import { botTest, pickSiblings } from "../../bot/specs";
16
+ import { botTest, genericTestDestination, pickSiblings } from "../../bot/specs";
17
17
  import type { AppSpec } from "../../bot/types";
18
18
  import { getGasLimit } from "./transaction";
19
19
  import { DeviceModelId } from "@ledgerhq/devices";
@@ -27,6 +27,7 @@ const ethereumBasicMutations = ({ maxAccount }) => [
27
27
  {
28
28
  name: "move 50%",
29
29
  maxRun: 2,
30
+ testDestination: genericTestDestination,
30
31
  transaction: ({ account, siblings, bridge, maxSpendable }) => {
31
32
  const sibling = pickSiblings(siblings, maxAccount);
32
33
  const recipient = sibling.freshAddress;
@@ -119,26 +120,28 @@ function getCompoundResult({ account, transaction, accountBeforeTransaction }) {
119
120
  };
120
121
  }
121
122
 
123
+ const minAmountETH = parseCurrencyUnit(
124
+ getCryptoCurrencyById("ethereum").units[0],
125
+ "0.01"
126
+ );
127
+
122
128
  const ethereum: AppSpec<Transaction> = {
123
129
  name: "Ethereum",
124
130
  currency: getCryptoCurrencyById("ethereum"),
125
131
  appQuery: {
126
132
  model: DeviceModelId.nanoS,
127
133
  appName: "Ethereum",
134
+ appVersion: "1.9.20-dev", // FIXME remove this line once 1.9.20 lands on coin-apps (branch ledger-live-bot)
128
135
  },
129
136
  genericDeviceAction: acceptTransaction,
130
137
  testTimeout,
138
+ minViableAmount: minAmountETH,
131
139
  transactionCheck: ({ maxSpendable }) => {
132
- invariant(
133
- maxSpendable.gt(
134
- parseCurrencyUnit(getCryptoCurrencyById("ethereum").units[0], "0.01")
135
- ),
136
- "balance is too low"
137
- );
140
+ invariant(maxSpendable.gt(minAmountETH), "balance is too low");
138
141
  },
139
142
  // @ts-expect-error seriously we have to do somehting
140
143
  mutations: ethereumBasicMutations({
141
- maxAccount: 3,
144
+ maxAccount: 7,
142
145
  }).concat([
143
146
  {
144
147
  name: "allow MAX a compound token",
@@ -371,6 +374,11 @@ const ethereum: AppSpec<Transaction> = {
371
374
  },
372
375
  ]),
373
376
  };
377
+
378
+ const minAmountETC = parseCurrencyUnit(
379
+ getCryptoCurrencyById("ethereum_classic").units[0],
380
+ "0.05"
381
+ );
374
382
  const ethereumClassic: AppSpec<Transaction> = {
375
383
  name: "Ethereum Classic",
376
384
  currency: getCryptoCurrencyById("ethereum_classic"),
@@ -381,16 +389,9 @@ const ethereumClassic: AppSpec<Transaction> = {
381
389
  genericDeviceAction: acceptTransaction,
382
390
  dependency: "Ethereum",
383
391
  testTimeout,
392
+ minViableAmount: minAmountETC,
384
393
  transactionCheck: ({ maxSpendable }) => {
385
- invariant(
386
- maxSpendable.gt(
387
- parseCurrencyUnit(
388
- getCryptoCurrencyById("ethereum_classic").units[0],
389
- "0.05"
390
- )
391
- ),
392
- "balance is too low"
393
- );
394
+ invariant(maxSpendable.gt(minAmountETC), "balance is too low");
394
395
  },
395
396
  mutations: ethereumBasicMutations({
396
397
  maxAccount: 4,
@@ -402,25 +403,23 @@ const ethereumGoerli: AppSpec<Transaction> = {
402
403
  appQuery: {
403
404
  model: DeviceModelId.nanoS,
404
405
  appName: "Ethereum",
406
+ appVersion: "1.9.20-dev", // FIXME remove this line once 1.9.20 lands on coin-apps (branch ledger-live-bot)
405
407
  },
406
408
  genericDeviceAction: acceptTransaction,
407
409
  testTimeout,
410
+ minViableAmount: minAmountETH,
408
411
  transactionCheck: ({ maxSpendable }) => {
409
- invariant(
410
- maxSpendable.gt(
411
- parseCurrencyUnit(
412
- getCryptoCurrencyById("ethereum_goerli").units[0],
413
- "0.01"
414
- )
415
- ),
416
- "balance is too low"
417
- );
412
+ invariant(maxSpendable.gt(minAmountETH), "balance is too low");
418
413
  },
419
414
  mutations: ethereumBasicMutations({
420
415
  maxAccount: 8,
421
416
  }),
422
417
  };
423
418
 
419
+ const minAmountBSC = parseCurrencyUnit(
420
+ getCryptoCurrencyById("bsc").units[0],
421
+ "0.005"
422
+ );
424
423
  const bsc: AppSpec<Transaction> = {
425
424
  name: "BSC",
426
425
  currency: getCryptoCurrencyById("bsc"),
@@ -431,13 +430,9 @@ const bsc: AppSpec<Transaction> = {
431
430
  genericDeviceAction: acceptTransaction,
432
431
  dependency: "Ethereum",
433
432
  testTimeout,
433
+ minViableAmount: minAmountBSC,
434
434
  transactionCheck: ({ maxSpendable }) => {
435
- invariant(
436
- maxSpendable.gt(
437
- parseCurrencyUnit(getCryptoCurrencyById("bsc").units[0], "0.005")
438
- ),
439
- "balance is too low"
440
- );
435
+ invariant(maxSpendable.gt(minAmountBSC), "balance is too low");
441
436
  },
442
437
  mutations: ethereumBasicMutations({ maxAccount: 8 }).concat([
443
438
  {
@@ -469,6 +464,11 @@ const bsc: AppSpec<Transaction> = {
469
464
  ]),
470
465
  };
471
466
 
467
+ const minAmountPolygon = parseCurrencyUnit(
468
+ getCryptoCurrencyById("polygon").units[0],
469
+ "0.005"
470
+ );
471
+
472
472
  const polygon: AppSpec<Transaction> = {
473
473
  name: "Polygon",
474
474
  currency: getCryptoCurrencyById("polygon"),
@@ -479,13 +479,9 @@ const polygon: AppSpec<Transaction> = {
479
479
  genericDeviceAction: acceptTransaction,
480
480
  dependency: "Ethereum",
481
481
  testTimeout,
482
+ minViableAmount: minAmountPolygon,
482
483
  transactionCheck: ({ maxSpendable }) => {
483
- invariant(
484
- maxSpendable.gt(
485
- parseCurrencyUnit(getCryptoCurrencyById("polygon").units[0], "0.005")
486
- ),
487
- "balance is too low"
488
- );
484
+ invariant(maxSpendable.gt(minAmountPolygon), "balance is too low");
489
485
  },
490
486
  mutations: ethereumBasicMutations({ maxAccount: 8 }).concat([
491
487
  {
@@ -1,7 +1,6 @@
1
1
  import type { DeviceAction } from "../../bot/types";
2
2
  import type { Transaction } from "./types";
3
- import { formatCurrencyUnit, findCompoundToken } from "../../currencies";
4
- import { deviceActionFlow } from "../../bot/specs";
3
+ import { deviceActionFlow, formatDeviceAmount } from "../../bot/specs";
5
4
 
6
5
  function subAccount(subAccountId, account) {
7
6
  const sub = (account.subAccounts || []).find((a) => a.id === subAccountId);
@@ -10,28 +9,8 @@ function subAccount(subAccountId, account) {
10
9
  return sub;
11
10
  }
12
11
 
13
- function expectedCompoundToken(t) {
14
- if (!t) {
15
- throw new Error("compound token was expected");
16
- }
17
-
18
- return t;
19
- }
20
-
21
12
  const maxFeesExpectedValue = ({ account, status }) =>
22
- formatCurrencyUnit(
23
- {
24
- ...account.unit,
25
- code: account.currency.deviceTicker || account.unit.code,
26
- prefixCode: true,
27
- },
28
- status.estimatedFees,
29
- {
30
- showCode: true,
31
- disableRounding: true,
32
- joinFragmentsSeparator: " ",
33
- }
34
- ).replace(/\s/g, " ");
13
+ formatDeviceAmount(account.currency, status.estimatedFees);
35
14
 
36
15
  export const acceptTransaction: DeviceAction<Transaction, any> =
37
16
  deviceActionFlow({
@@ -66,16 +45,6 @@ export const acceptTransaction: DeviceAction<Transaction, any> =
66
45
  return "Unlimited " + a.token.ticker;
67
46
  }
68
47
 
69
- const unit = !a
70
- ? {
71
- ...account.unit,
72
- code: account.currency.deviceTicker || account.unit.code,
73
- }
74
- : (transaction.mode === "compound.withdraw" &&
75
- transaction.useAllAmount
76
- ? expectedCompoundToken(findCompoundToken(a.token))
77
- : a.token
78
- ).units[0];
79
48
  const amount =
80
49
  a &&
81
50
  a.compoundBalance &&
@@ -83,19 +52,20 @@ export const acceptTransaction: DeviceAction<Transaction, any> =
83
52
  transaction.useAllAmount
84
53
  ? a.compoundBalance
85
54
  : status.amount;
86
- return formatCurrencyUnit(
87
- {
88
- ...unit,
89
- code: account.currency.deviceTicker || account.unit.code,
90
- prefixCode: true,
91
- },
92
- amount,
93
- {
94
- showCode: true,
95
- disableRounding: true,
96
- joinFragmentsSeparator: " ",
97
- }
98
- ).replace(/\s/g, " ");
55
+
56
+ if (
57
+ a &&
58
+ transaction.mode === "compound.withdraw" &&
59
+ transaction.useAllAmount
60
+ ) {
61
+ return formatDeviceAmount(a.compoundBalance, amount);
62
+ }
63
+
64
+ if (a) {
65
+ return formatDeviceAmount(a.token, amount);
66
+ }
67
+
68
+ return formatDeviceAmount(account.currency, amount);
99
69
  },
100
70
  },
101
71
  {
@@ -3,7 +3,7 @@ import invariant from "invariant";
3
3
  import { DeviceModelId } from "@ledgerhq/devices";
4
4
  import { getCryptoCurrencyById, parseCurrencyUnit } from "../../currencies";
5
5
  import { acceptTransaction } from "./speculos-deviceActions";
6
- import { pickSiblings } from "../../bot/specs";
6
+ import { botTest, genericTestDestination, pickSiblings } from "../../bot/specs";
7
7
  import type { AppSpec } from "../../bot/types";
8
8
  import type { Transaction } from "./types";
9
9
 
@@ -14,7 +14,7 @@ const transactionCheck =
14
14
  ({ maxSpendable }) => {
15
15
  invariant(
16
16
  maxSpendable.gt(
17
- parseCurrencyUnit(getCryptoCurrencyById(currencyId).units[0], "0.01")
17
+ parseCurrencyUnit(getCryptoCurrencyById(currencyId).units[0], "1")
18
18
  ),
19
19
  `${currencyId} balance is too low`
20
20
  );
@@ -24,6 +24,7 @@ const evmBasicMutations = ({ maxAccount }) => [
24
24
  {
25
25
  name: "move 50%",
26
26
  maxRun: 2,
27
+ testDestination: genericTestDestination,
27
28
  transaction: ({ account, siblings, bridge, maxSpendable }) => {
28
29
  const sibling = pickSiblings(siblings, maxAccount);
29
30
  const recipient = sibling.freshAddress;
@@ -45,13 +46,17 @@ const evmBasicMutations = ({ maxAccount }) => [
45
46
  "operation time to be older than 60s"
46
47
  );
47
48
  const estimatedGas = transaction.gasLimit.times(
48
- transaction.gasPrice || 0
49
+ transaction.gasPrice || transaction.maxFeePerGas || 0
49
50
  );
50
- expect(operation.fee.toNumber()).toBeLessThanOrEqual(
51
- estimatedGas.toNumber()
51
+ botTest("operation fee is not exceeding estimated gas", () =>
52
+ expect(operation.fee.toNumber()).toBeLessThanOrEqual(
53
+ estimatedGas.toNumber()
54
+ )
52
55
  );
53
- expect(account.balance.toString()).toBe(
54
- accountBeforeTransaction.balance.minus(operation.value).toString()
56
+ botTest("account balance moved with operation value", () =>
57
+ expect(account.balance.toString()).toBe(
58
+ accountBeforeTransaction.balance.minus(operation.value).toString()
59
+ )
55
60
  );
56
61
  },
57
62
  },
@@ -63,6 +68,7 @@ const cronos: AppSpec<Transaction> = {
63
68
  appQuery: {
64
69
  model: DeviceModelId.nanoS,
65
70
  appName: "Ethereum",
71
+ appVersion: "1.9.20-dev", // FIXME remove this line once 1.9.20 lands on coin-apps (branch ledger-live-bot)
66
72
  },
67
73
  testTimeout,
68
74
  transactionCheck: transactionCheck("cronos"),
@@ -78,6 +84,7 @@ const fantom: AppSpec<Transaction> = {
78
84
  appQuery: {
79
85
  model: DeviceModelId.nanoS,
80
86
  appName: "Ethereum",
87
+ appVersion: "1.9.20-dev", // FIXME remove this line once 1.9.20 lands on coin-apps (branch ledger-live-bot)
81
88
  },
82
89
  testTimeout,
83
90
  transactionCheck: transactionCheck("fantom"),
@@ -93,6 +100,7 @@ const moonbeam: AppSpec<Transaction> = {
93
100
  appQuery: {
94
101
  model: DeviceModelId.nanoS,
95
102
  appName: "Ethereum",
103
+ appVersion: "1.9.20-dev", // FIXME remove this line once 1.9.20 lands on coin-apps (branch ledger-live-bot)
96
104
  },
97
105
  testTimeout,
98
106
  transactionCheck: transactionCheck("moonbeam"),
@@ -108,6 +116,7 @@ const songbird: AppSpec<Transaction> = {
108
116
  appQuery: {
109
117
  model: DeviceModelId.nanoS,
110
118
  appName: "Ethereum",
119
+ appVersion: "1.9.20-dev", // FIXME remove this line once 1.9.20 lands on coin-apps (branch ledger-live-bot)
111
120
  },
112
121
  testTimeout,
113
122
  transactionCheck: transactionCheck("songbird"),
@@ -118,11 +127,12 @@ const songbird: AppSpec<Transaction> = {
118
127
  };
119
128
 
120
129
  const flare: AppSpec<Transaction> = {
121
- name: "Moonbeam",
130
+ name: "Flare",
122
131
  currency: getCryptoCurrencyById("flare"),
123
132
  appQuery: {
124
133
  model: DeviceModelId.nanoS,
125
134
  appName: "Ethereum",
135
+ appVersion: "1.9.20-dev", // FIXME remove this line once 1.9.20 lands on coin-apps (branch ledger-live-bot)
126
136
  },
127
137
  testTimeout,
128
138
  transactionCheck: transactionCheck("flare"),
@@ -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
  function subAccount(subAccountId, account) {
7
6
  const sub = (account.subAccounts || []).find((a) => a.id === subAccountId);
@@ -11,19 +10,7 @@ function subAccount(subAccountId, account) {
11
10
  }
12
11
 
13
12
  const maxFeesExpectedValue = ({ account, status }) =>
14
- formatCurrencyUnit(
15
- {
16
- ...account.unit,
17
- code: account.currency.deviceTicker || account.unit.code,
18
- prefixCode: true,
19
- },
20
- status.estimatedFees,
21
- {
22
- showCode: true,
23
- disableRounding: true,
24
- joinFragmentsSeparator: " ",
25
- }
26
- ).replace(/\s/g, " ");
13
+ formatDeviceAmount(account.currency, status.estimatedFees);
27
14
 
28
15
  export const acceptTransaction: DeviceAction<Transaction, any> =
29
16
  deviceActionFlow({
@@ -44,26 +31,11 @@ export const acceptTransaction: DeviceAction<Transaction, any> =
44
31
  ? subAccount(transaction.subAccountId, account)
45
32
  : null;
46
33
 
47
- const unit = !a
48
- ? {
49
- ...account.unit,
50
- code: account.currency.deviceTicker || account.unit.code,
51
- }
52
- : a.token.units[0];
53
- const amount = status.amount;
54
- return formatCurrencyUnit(
55
- {
56
- ...unit,
57
- code: account.currency.deviceTicker || account.unit.code,
58
- prefixCode: true,
59
- },
60
- amount,
61
- {
62
- showCode: true,
63
- disableRounding: true,
64
- joinFragmentsSeparator: " ",
65
- }
66
- ).replace(/\s/g, " ");
34
+ if (a) {
35
+ return formatDeviceAmount(a.token, status.amount);
36
+ }
37
+
38
+ return formatDeviceAmount(account.currency, status.amount);
67
39
  },
68
40
  },
69
41
  {
@@ -4,7 +4,7 @@ import BigNumber from "bignumber.js";
4
4
 
5
5
  import type { Transaction } from "../../families/filecoin/types";
6
6
  import { getCryptoCurrencyById } from "../../currencies";
7
- import { pickSiblings } from "../../bot/specs";
7
+ import { genericTestDestination, pickSiblings } from "../../bot/specs";
8
8
  import type { AppSpec } from "../../bot/types";
9
9
  import { acceptTransaction } from "./speculos-deviceActions";
10
10
 
@@ -20,6 +20,7 @@ const filecoinSpecs: AppSpec<Transaction> = {
20
20
  },
21
21
  genericDeviceAction: acceptTransaction,
22
22
  testTimeout: 5 * 60 * 1000,
23
+ minViableAmount: MIN_SAFE,
23
24
  transactionCheck: ({ maxSpendable }) => {
24
25
  invariant(maxSpendable.gt(MIN_SAFE), "balance is too low");
25
26
  },
@@ -27,6 +28,7 @@ const filecoinSpecs: AppSpec<Transaction> = {
27
28
  {
28
29
  name: "Send 50%~",
29
30
  maxRun: 1,
31
+ testDestination: genericTestDestination,
30
32
  transaction: ({ account, siblings, bridge }) => {
31
33
  const sibling = pickSiblings(siblings, maxAccount);
32
34
  let amount = account.spendableBalance
@@ -57,6 +59,7 @@ const filecoinSpecs: AppSpec<Transaction> = {
57
59
  {
58
60
  name: "Transfer Max",
59
61
  maxRun: 1,
62
+ testDestination: genericTestDestination,
60
63
  transaction: ({ account, siblings, bridge }) => {
61
64
  return {
62
65
  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 { 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({
@@ -25,8 +24,8 @@ export const acceptTransaction: DeviceAction<Transaction, any> =
25
24
  title: "Value",
26
25
  button: "Rr",
27
26
  expectedValue: ({ account, status }) =>
28
- formatCurrencyUnit(account.unit, status.amount, {
29
- disableRounding: true,
27
+ formatDeviceAmount(account.currency, status.amount, {
28
+ hideCode: true,
30
29
  showAllDigits: true,
31
30
  }),
32
31
  },
@@ -39,8 +38,8 @@ export const acceptTransaction: DeviceAction<Transaction, any> =
39
38
  title: "Gas Premium",
40
39
  button: "Rr",
41
40
  expectedValue: ({ account, transaction }) =>
42
- formatCurrencyUnit(account.unit, transaction.gasPremium, {
43
- disableRounding: true,
41
+ formatDeviceAmount(account.currency, transaction.gasPremium, {
42
+ hideCode: true,
44
43
  showAllDigits: true,
45
44
  }),
46
45
  },
@@ -48,8 +47,8 @@ export const acceptTransaction: DeviceAction<Transaction, any> =
48
47
  title: "Gas Fee Cap",
49
48
  button: "Rr",
50
49
  expectedValue: ({ account, transaction }) =>
51
- formatCurrencyUnit(account.unit, transaction.gasFeeCap, {
52
- disableRounding: true,
50
+ formatDeviceAmount(account.currency, transaction.gasFeeCap, {
51
+ hideCode: true,
53
52
  showAllDigits: true,
54
53
  }),
55
54
  },
@@ -9,7 +9,7 @@ import type {
9
9
  TransactionRes,
10
10
  } from "../../bot/types";
11
11
  import type { Transaction } from "./types";
12
- import { botTest, pickSiblings } from "../../bot/specs";
12
+ import { botTest, genericTestDestination, pickSiblings } from "../../bot/specs";
13
13
  import { isAccountEmpty } from "../../account";
14
14
  import { acceptTransaction } from "./speculos-deviceActions";
15
15
 
@@ -49,6 +49,7 @@ const hedera: AppSpec<Transaction> = {
49
49
  {
50
50
  name: "Send ~50%",
51
51
  maxRun: 2,
52
+ testDestination: genericTestDestination,
52
53
  transaction: ({
53
54
  account,
54
55
  siblings,
@@ -85,6 +86,7 @@ const hedera: AppSpec<Transaction> = {
85
86
  {
86
87
  name: "Send max",
87
88
  maxRun: 2,
89
+ testDestination: genericTestDestination,
88
90
  transaction: ({
89
91
  account,
90
92
  siblings,
@@ -1,7 +1,7 @@
1
1
  import invariant from "invariant";
2
2
  import type { Transaction } from "./types";
3
3
  import { getCryptoCurrencyById, parseCurrencyUnit } from "../../currencies";
4
- import { botTest, pickSiblings } from "../../bot/specs";
4
+ import { botTest, genericTestDestination, pickSiblings } from "../../bot/specs";
5
5
  import type { AppSpec } from "../../bot/types";
6
6
  import { DeviceModelId } from "@ledgerhq/devices";
7
7
  import type {
@@ -51,6 +51,7 @@ const osmosis: AppSpec<Transaction> = {
51
51
  },
52
52
  genericDeviceAction: acceptTransaction,
53
53
  testTimeout: 2 * 60 * 1000,
54
+ minViableAmount: minimalAmount,
54
55
  transactionCheck: ({ maxSpendable }) => {
55
56
  invariant(maxSpendable.gt(minimalAmount), "balance is too low");
56
57
  },
@@ -89,6 +90,7 @@ const osmosis: AppSpec<Transaction> = {
89
90
  {
90
91
  name: "move 50% to another account",
91
92
  maxRun: 2,
93
+ testDestination: genericTestDestination,
92
94
  transaction: ({ account, siblings, bridge, maxSpendable }) => {
93
95
  invariant(maxSpendable.gt(minimalAmount), "balance is too low");
94
96
  const sibling = pickSiblings(siblings, maxAccount);
@@ -111,6 +113,7 @@ const osmosis: AppSpec<Transaction> = {
111
113
  {
112
114
  name: "send max to another account",
113
115
  maxRun: 1,
116
+ testDestination: genericTestDestination,
114
117
  transaction: ({ account, siblings, bridge, maxSpendable }) => {
115
118
  invariant(maxSpendable.gt(minimalAmount), "balance is too low");
116
119
  const sibling = pickSiblings(siblings, maxAccount);