@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
@@ -11,6 +11,7 @@ import {
11
11
  JSONRPCResponseError,
12
12
  NoIPHeaderError,
13
13
  NotImplementedError,
14
+ SwapGenericAPIError,
14
15
  TradeMethodNotSupportedError,
15
16
  UnexpectedError,
16
17
  ValidationError,
@@ -36,6 +37,19 @@ export const isSwapOperationPending: (status: string) => boolean = (status) =>
36
37
 
37
38
  const getSwapAPIBaseURL: () => string = () => getEnv("SWAP_API_BASE");
38
39
 
40
+ const SWAP_API_BASE_PATTERN = /.*\/v(?<version>\d+)\/*$/;
41
+ const getSwapAPIVersion: () => number = () => {
42
+ const version = Number(
43
+ getSwapAPIBaseURL().match(SWAP_API_BASE_PATTERN)?.groups?.version
44
+ );
45
+ if (version == null || isNaN(version)) {
46
+ throw new SwapGenericAPIError(
47
+ "Configured swap API base URL is invalid, should end with /v<number>"
48
+ );
49
+ }
50
+ return version;
51
+ };
52
+
39
53
  const ftx = {
40
54
  nameAndPubkey: Buffer.concat([
41
55
  Buffer.from([3]),
@@ -179,6 +193,7 @@ export const getSwapAPIError = (errorCode: number, errorMessage?: string) => {
179
193
 
180
194
  export {
181
195
  getSwapAPIBaseURL,
196
+ getSwapAPIVersion,
182
197
  getProviderConfig,
183
198
  getProviders,
184
199
  getExchangeRates,
@@ -7,7 +7,7 @@ import {
7
7
  SwapExchangeRateAmountTooHigh,
8
8
  SwapExchangeRateAmountTooLow,
9
9
  } from "../../errors";
10
- import { getSwapAPIBaseURL } from "./";
10
+ import { getSwapAPIVersion } from "./";
11
11
  import type {
12
12
  CheckQuote,
13
13
  Exchange,
@@ -129,7 +129,7 @@ export const mockInitSwap = (
129
129
  export const mockGetProviders: GetProviders = async () => {
130
130
  //Fake delay to show loading UI
131
131
  await new Promise((r) => setTimeout(r, 800));
132
- const usesV3 = getSwapAPIBaseURL().endsWith("v3");
132
+ const usesV3 = getSwapAPIVersion() >= 3;
133
133
 
134
134
  return usesV3
135
135
  ? [
@@ -83,6 +83,17 @@ export type AvailableProviderV3 = {
83
83
  pairs: Array<{ from: string; to: string; tradeMethod: string }>;
84
84
  };
85
85
 
86
+ type TradeMethodGroup = {
87
+ methods: TradeMethod[];
88
+ pairs: {
89
+ [currencyIndex: number]: number[];
90
+ };
91
+ };
92
+ export type ProvidersResponseV4 = {
93
+ currencies: { [currencyIndex: number]: string };
94
+ providers: { [providerName: string]: TradeMethodGroup[] };
95
+ };
96
+
86
97
  type CheckQuoteOkStatus = {
87
98
  codeName: "RATE_VALID";
88
99
  };
@@ -10,6 +10,7 @@ import { genAccount } from "../../../mock/account";
10
10
  import {
11
11
  getAccountTuplesForCurrency,
12
12
  getAvailableAccountsById,
13
+ isRegistrationRequired,
13
14
  getProviderName,
14
15
  KYCStatus,
15
16
  shouldShowKYCBanner,
@@ -303,6 +304,24 @@ describe("swap/utils/shouldShowKYCBanner", () => {
303
304
  });
304
305
  });
305
306
 
307
+ describe("swap/utils/isRegistrationRequired", () => {
308
+ test("should return registration is required for ftx", () => {
309
+ const expectedResult = true;
310
+
311
+ const result = isRegistrationRequired("ftx");
312
+
313
+ expect(result).toBe(expectedResult);
314
+ });
315
+
316
+ test("should return registration is not required for changelly", () => {
317
+ const expectedResult = false;
318
+
319
+ const result = isRegistrationRequired("changelly");
320
+
321
+ expect(result).toBe(expectedResult);
322
+ });
323
+ });
324
+
306
325
  describe("swap/utils/getProviderName", () => {
307
326
  test("should return uppercase provider name for ftx", () => {
308
327
  const expectedResult = "FTX";
@@ -172,6 +172,11 @@ export const shouldShowKYCBanner = ({
172
172
  return kycStatus !== KYC_STATUS.approved;
173
173
  };
174
174
 
175
+ export const isRegistrationRequired = (provider: string): boolean => {
176
+ const { needsBearerToken, needsKYC } = getProviderConfig(provider);
177
+ return needsBearerToken || needsKYC;
178
+ };
179
+
175
180
  export const getProviderName = (provider: string): string => {
176
181
  switch (provider) {
177
182
  case "ftx":
@@ -3,7 +3,7 @@ import invariant from "invariant";
3
3
  import type { AlgorandAccount, AlgorandTransaction } from "./types";
4
4
  import { getCryptoCurrencyById, parseCurrencyUnit } from "../../currencies";
5
5
  import { isAccountEmpty } from "../../account";
6
- import { botTest, pickSiblings } from "../../bot/specs";
6
+ import { botTest, genericTestDestination, pickSiblings } from "../../bot/specs";
7
7
  import type { AppSpec } from "../../bot/types";
8
8
  import { BigNumber } from "bignumber.js";
9
9
  import sample from "lodash/sample";
@@ -79,6 +79,7 @@ const algorand: AppSpec<AlgorandTransaction> = {
79
79
  {
80
80
  name: "move ~50%",
81
81
  maxRun: 2,
82
+ testDestination: genericTestDestination,
82
83
  transaction: ({ account, siblings, bridge, maxSpendable }) => {
83
84
  invariant(maxSpendable.gt(0), "Spendable balance is too low");
84
85
  const sibling = pickSiblings(siblings, 4);
@@ -115,6 +116,7 @@ const algorand: AppSpec<AlgorandTransaction> = {
115
116
  {
116
117
  name: "send max",
117
118
  maxRun: 1,
119
+ testDestination: genericTestDestination,
118
120
  transaction: ({ account, siblings, bridge, maxSpendable }) => {
119
121
  invariant(maxSpendable.gt(0), "Spendable balance is too low");
120
122
  const sibling = pickSiblings(siblings, 4);
@@ -1,26 +1,10 @@
1
1
  import type { DeviceAction } from "../../bot/types";
2
2
  import type { AlgorandTransaction } from "./types";
3
- import { formatCurrencyUnit, findTokenById } from "../../currencies";
4
- import { deviceActionFlow } from "../../bot/specs";
3
+ import { findTokenById } from "../../currencies";
4
+ import { deviceActionFlow, formatDeviceAmount } from "../../bot/specs";
5
5
  import { extractTokenId, addPrefixToken } from "./tokens";
6
6
  import { displayTokenValue } from "./deviceTransactionConfig";
7
7
 
8
- // Will be useful when unit is gonna be algo
9
- const expectedAmount = ({ account, status }) =>
10
- formatCurrencyUnit(
11
- {
12
- ...account.unit,
13
- code: account.currency.deviceTicker || account.unit.code,
14
- prefixCode: true,
15
- },
16
- status.amount,
17
- {
18
- showCode: true,
19
- disableRounding: true,
20
- joinFragmentsSeparator: " ",
21
- }
22
- );
23
-
24
8
  export const acceptTransaction: DeviceAction<AlgorandTransaction, any> =
25
9
  deviceActionFlow({
26
10
  steps: [
@@ -42,19 +26,7 @@ export const acceptTransaction: DeviceAction<AlgorandTransaction, any> =
42
26
  title: "Fee",
43
27
  button: "Rr",
44
28
  expectedValue: ({ account, status }) =>
45
- formatCurrencyUnit(
46
- {
47
- ...account.unit,
48
- code: account.currency.deviceTicker || account.unit.code,
49
- prefixCode: true,
50
- },
51
- status.estimatedFees,
52
- {
53
- showCode: true,
54
- disableRounding: true,
55
- joinFragmentsSeparator: " ",
56
- }
57
- ),
29
+ formatDeviceAmount(account.currency, status.estimatedFees),
58
30
  },
59
31
  {
60
32
  title: "Asset ID",
@@ -95,10 +67,7 @@ export const acceptTransaction: DeviceAction<AlgorandTransaction, any> =
95
67
  expectedValue: ({ account, status, transaction }) =>
96
68
  transaction.mode === "claimReward"
97
69
  ? "0"
98
- : expectedAmount({
99
- account,
100
- status,
101
- }),
70
+ : formatDeviceAmount(account.currency, status.amount),
102
71
  },
103
72
  {
104
73
  title: "APPROVE",
@@ -11,7 +11,7 @@ import type {
11
11
  Transaction,
12
12
  } from "./types";
13
13
  import { getCryptoCurrencyById, parseCurrencyUnit } from "../../currencies";
14
- import { botTest, pickSiblings } from "../../bot/specs";
14
+ import { botTest, genericTestDestination, pickSiblings } from "../../bot/specs";
15
15
  import { bitcoinPickingStrategy } from "./types";
16
16
  import type { MutationSpec, AppSpec } from "../../bot/types";
17
17
  import { LowerThanMinimumRelayFee } from "../../errors";
@@ -123,8 +123,12 @@ const genericTest = ({
123
123
  );
124
124
  };
125
125
 
126
+ const testDestination = genericTestDestination;
127
+
128
+ const genericMinimalAmount = new BigNumber(10000);
129
+
126
130
  const bitcoinLikeMutations = ({
127
- minimalAmount = new BigNumber("10000"),
131
+ minimalAmount = genericMinimalAmount,
128
132
  targetAccountSize = 3,
129
133
  recipientVariation = (recipient) => recipient,
130
134
  }: Arg = {}): MutationSpec<Transaction>[] => [
@@ -155,8 +159,10 @@ const bitcoinLikeMutations = ({
155
159
  return {
156
160
  transaction,
157
161
  updates,
162
+ destination: sibling,
158
163
  };
159
164
  },
165
+ testDestination,
160
166
  recoverBadTransactionStatus,
161
167
  },
162
168
  {
@@ -183,8 +189,10 @@ const bitcoinLikeMutations = ({
183
189
  return {
184
190
  transaction,
185
191
  updates,
192
+ destination: sibling,
186
193
  };
187
194
  },
195
+ testDestination,
188
196
  recoverBadTransactionStatus,
189
197
  },
190
198
  {
@@ -223,9 +231,11 @@ const bitcoinLikeMutations = ({
223
231
  useAllAmount: true,
224
232
  },
225
233
  ],
234
+ destination: sibling,
226
235
  };
227
236
  },
228
237
  recoverBadTransactionStatus,
238
+ testDestination,
229
239
  test: ({ accountBeforeTransaction, account, operation, transaction }) => {
230
240
  const utxo = (
231
241
  (accountBeforeTransaction as BitcoinAccount).bitcoinResources?.utxos ||
@@ -280,9 +290,11 @@ const bitcoinLikeMutations = ({
280
290
  useAllAmount: true,
281
291
  },
282
292
  ],
293
+ destination: sibling,
283
294
  };
284
295
  },
285
296
  recoverBadTransactionStatus,
297
+ testDestination,
286
298
  test: ({ account }) => {
287
299
  botTest("total of utxos is zero", () =>
288
300
  expect(
@@ -308,9 +320,9 @@ const bitcoin: AppSpec<Transaction> = {
308
320
  genericDeviceAction: acceptTransaction,
309
321
  test: genericTest,
310
322
  mutations: bitcoinLikeMutations(),
323
+ minViableAmount: genericMinimalAmount,
311
324
  };
312
325
  const bitcoinTestnet: AppSpec<Transaction> = {
313
- multipleRuns: 2,
314
326
  name: "Bitcoin Testnet",
315
327
  currency: getCryptoCurrencyById("bitcoin_testnet"),
316
328
  dependency: "Bitcoin",
@@ -320,13 +332,8 @@ const bitcoinTestnet: AppSpec<Transaction> = {
320
332
  },
321
333
  genericDeviceAction: acceptTransaction,
322
334
  test: genericTest,
323
- mutations: bitcoinLikeMutations({
324
- targetAccountSize: 8,
325
- minimalAmount: parseCurrencyUnit(
326
- getCryptoCurrencyById("bitcoin_testnet").units[0],
327
- "0.0001"
328
- ),
329
- }),
335
+ mutations: bitcoinLikeMutations({ targetAccountSize: 8 }),
336
+ minViableAmount: genericMinimalAmount,
330
337
  };
331
338
  const bitcoinGold: AppSpec<Transaction> = {
332
339
  name: "Bitcoin Gold",
@@ -339,6 +346,7 @@ const bitcoinGold: AppSpec<Transaction> = {
339
346
  genericDeviceAction: acceptTransaction,
340
347
  test: genericTest,
341
348
  mutations: bitcoinLikeMutations(),
349
+ minViableAmount: genericMinimalAmount,
342
350
  };
343
351
 
344
352
  const bchToCashaddrAddressWithoutPrefix = (recipient) =>
@@ -367,6 +375,7 @@ const bitcoinCash: AppSpec<Transaction> = {
367
375
  return addr;
368
376
  },
369
377
  }),
378
+ minViableAmount: genericMinimalAmount,
370
379
  };
371
380
  const peercoin: AppSpec<Transaction> = {
372
381
  name: "Peercoin",
@@ -379,6 +388,7 @@ const peercoin: AppSpec<Transaction> = {
379
388
  genericDeviceAction: acceptTransaction,
380
389
  test: genericTest,
381
390
  mutations: bitcoinLikeMutations(),
391
+ minViableAmount: genericMinimalAmount,
382
392
  };
383
393
  const pivx: AppSpec<Transaction> = {
384
394
  name: "PivX",
@@ -391,6 +401,7 @@ const pivx: AppSpec<Transaction> = {
391
401
  genericDeviceAction: acceptTransaction,
392
402
  test: genericTest,
393
403
  mutations: bitcoinLikeMutations(),
404
+ minViableAmount: genericMinimalAmount,
394
405
  };
395
406
  const qtum: AppSpec<Transaction> = {
396
407
  name: "Qtum",
@@ -403,18 +414,7 @@ const qtum: AppSpec<Transaction> = {
403
414
  genericDeviceAction: acceptTransaction,
404
415
  test: genericTest,
405
416
  mutations: bitcoinLikeMutations(),
406
- };
407
- const stakenet: AppSpec<Transaction> = {
408
- name: "Stakenet",
409
- currency: getCryptoCurrencyById("stakenet"),
410
- dependency: "Bitcoin",
411
- appQuery: {
412
- model: DeviceModelId.nanoS,
413
- appName: "XSN",
414
- },
415
- genericDeviceAction: acceptTransaction,
416
- test: genericTest,
417
- mutations: bitcoinLikeMutations(),
417
+ minViableAmount: genericMinimalAmount,
418
418
  };
419
419
  const vertcoin: AppSpec<Transaction> = {
420
420
  name: "Vertcoin",
@@ -427,6 +427,7 @@ const vertcoin: AppSpec<Transaction> = {
427
427
  genericDeviceAction: acceptTransaction,
428
428
  test: genericTest,
429
429
  mutations: bitcoinLikeMutations(),
430
+ minViableAmount: genericMinimalAmount,
430
431
  };
431
432
  const viacoin: AppSpec<Transaction> = {
432
433
  name: "Viacoin",
@@ -439,7 +440,12 @@ const viacoin: AppSpec<Transaction> = {
439
440
  genericDeviceAction: acceptTransaction,
440
441
  test: genericTest,
441
442
  mutations: bitcoinLikeMutations(),
443
+ minViableAmount: genericMinimalAmount,
442
444
  };
445
+ const minDash = parseCurrencyUnit(
446
+ getCryptoCurrencyById("dash").units[0],
447
+ "0.001"
448
+ );
443
449
  const dash: AppSpec<Transaction> = {
444
450
  name: "Dash",
445
451
  currency: getCryptoCurrencyById("dash"),
@@ -452,12 +458,14 @@ const dash: AppSpec<Transaction> = {
452
458
  test: genericTest,
453
459
  mutations: bitcoinLikeMutations({
454
460
  targetAccountSize: 5,
455
- minimalAmount: parseCurrencyUnit(
456
- getCryptoCurrencyById("dash").units[0],
457
- "0.001"
458
- ),
461
+ minimalAmount: minDash,
459
462
  }),
463
+ minViableAmount: minDash,
460
464
  };
465
+ const minDoge = parseCurrencyUnit(
466
+ getCryptoCurrencyById("dogecoin").units[0],
467
+ "1"
468
+ );
461
469
  const dogecoin: AppSpec<Transaction> = {
462
470
  name: "DogeCoin",
463
471
  currency: getCryptoCurrencyById("dogecoin"),
@@ -470,16 +478,17 @@ const dogecoin: AppSpec<Transaction> = {
470
478
  test: genericTest,
471
479
  mutations: bitcoinLikeMutations({
472
480
  targetAccountSize: 5,
473
- minimalAmount: parseCurrencyUnit(
474
- getCryptoCurrencyById("dogecoin").units[0],
475
- "1"
476
- ),
481
+ minimalAmount: minDoge,
477
482
  }),
483
+ minViableAmount: minDoge,
478
484
  };
485
+ const minZcash = parseCurrencyUnit(
486
+ getCryptoCurrencyById("zcash").units[0],
487
+ "0.0002"
488
+ );
479
489
  const zcash: AppSpec<Transaction> = {
480
490
  name: "ZCash",
481
491
  currency: getCryptoCurrencyById("zcash"),
482
- dependency: "Bitcoin",
483
492
  appQuery: {
484
493
  model: DeviceModelId.nanoS,
485
494
  appName: "Zcash",
@@ -487,12 +496,14 @@ const zcash: AppSpec<Transaction> = {
487
496
  genericDeviceAction: acceptTransaction,
488
497
  test: genericTest,
489
498
  mutations: bitcoinLikeMutations({
490
- minimalAmount: parseCurrencyUnit(
491
- getCryptoCurrencyById("zcash").units[0],
492
- "0.0002"
493
- ),
499
+ minimalAmount: minZcash,
494
500
  }),
501
+ minViableAmount: minZcash,
495
502
  };
503
+ const minHorizen = parseCurrencyUnit(
504
+ getCryptoCurrencyById("zencash").units[0],
505
+ "0.01"
506
+ );
496
507
  const zencash: AppSpec<Transaction> = {
497
508
  name: "Horizen",
498
509
  currency: getCryptoCurrencyById("zencash"),
@@ -504,12 +515,14 @@ const zencash: AppSpec<Transaction> = {
504
515
  genericDeviceAction: acceptTransaction,
505
516
  test: genericTest,
506
517
  mutations: bitcoinLikeMutations({
507
- minimalAmount: parseCurrencyUnit(
508
- getCryptoCurrencyById("zencash").units[0],
509
- "0.01"
510
- ),
518
+ minimalAmount: minHorizen,
511
519
  }),
520
+ minViableAmount: minHorizen,
512
521
  };
522
+ const minDigibyte = parseCurrencyUnit(
523
+ getCryptoCurrencyById("digibyte").units[0],
524
+ "0.1"
525
+ );
513
526
  const digibyte: AppSpec<Transaction> = {
514
527
  name: "Digibyte",
515
528
  currency: getCryptoCurrencyById("digibyte"),
@@ -522,12 +535,14 @@ const digibyte: AppSpec<Transaction> = {
522
535
  test: genericTest,
523
536
  mutations: bitcoinLikeMutations({
524
537
  targetAccountSize: 5,
525
- minimalAmount: parseCurrencyUnit(
526
- getCryptoCurrencyById("digibyte").units[0],
527
- "0.1"
528
- ),
538
+ minimalAmount: minDigibyte,
529
539
  }),
540
+ minViableAmount: minDigibyte,
530
541
  };
542
+ const minKomodo = parseCurrencyUnit(
543
+ getCryptoCurrencyById("komodo").units[0],
544
+ "0.1"
545
+ );
531
546
  const komodo: AppSpec<Transaction> = {
532
547
  name: "Komodo",
533
548
  currency: getCryptoCurrencyById("komodo"),
@@ -539,12 +554,14 @@ const komodo: AppSpec<Transaction> = {
539
554
  genericDeviceAction: acceptTransaction,
540
555
  test: genericTest,
541
556
  mutations: bitcoinLikeMutations({
542
- minimalAmount: parseCurrencyUnit(
543
- getCryptoCurrencyById("komodo").units[0],
544
- "0.1"
545
- ),
557
+ minimalAmount: minKomodo,
546
558
  }),
559
+ minViableAmount: minKomodo,
547
560
  };
561
+ const minDecred = parseCurrencyUnit(
562
+ getCryptoCurrencyById("decred").units[0],
563
+ "0.0001"
564
+ );
548
565
  const decred: AppSpec<Transaction> = {
549
566
  name: "Decred",
550
567
  currency: getCryptoCurrencyById("decred"),
@@ -555,12 +572,14 @@ const decred: AppSpec<Transaction> = {
555
572
  genericDeviceAction: acceptTransaction,
556
573
  test: genericTest,
557
574
  mutations: bitcoinLikeMutations({
558
- minimalAmount: parseCurrencyUnit(
559
- getCryptoCurrencyById("decred").units[0],
560
- "0.0001"
561
- ),
575
+ minimalAmount: minDecred,
562
576
  }),
577
+ minViableAmount: minDecred,
563
578
  };
579
+ const minLitecoin = parseCurrencyUnit(
580
+ getCryptoCurrencyById("litecoin").units[0],
581
+ "0.001"
582
+ );
564
583
  const litecoin: AppSpec<Transaction> = {
565
584
  name: "Litecoin",
566
585
  currency: getCryptoCurrencyById("litecoin"),
@@ -573,11 +592,9 @@ const litecoin: AppSpec<Transaction> = {
573
592
  test: genericTest,
574
593
  mutations: bitcoinLikeMutations({
575
594
  targetAccountSize: 5,
576
- minimalAmount: parseCurrencyUnit(
577
- getCryptoCurrencyById("litecoin").units[0],
578
- "0.001"
579
- ),
595
+ minimalAmount: minLitecoin,
580
596
  }),
597
+ minViableAmount: minLitecoin,
581
598
  };
582
599
 
583
600
  export default {
@@ -593,7 +610,6 @@ export default {
593
610
  peercoin,
594
611
  pivx,
595
612
  qtum,
596
- stakenet,
597
613
  vertcoin,
598
614
  viacoin,
599
615
  zcash,
@@ -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 { perCoinLogic } from "./logic";
6
5
 
7
6
  export const acceptTransaction: DeviceAction<Transaction, any> =
@@ -11,37 +10,15 @@ export const acceptTransaction: DeviceAction<Transaction, any> =
11
10
  title: "Amount",
12
11
  button: "Rr",
13
12
  ignoreAssertionFailure: true,
14
- // https://ledgerhq.atlassian.net/browse/LLC-676
15
13
  expectedValue: ({ account, status }) =>
16
- formatCurrencyUnit(
17
- {
18
- ...account.unit,
19
- code: account.currency.deviceTicker || account.unit.code,
20
- },
21
- status.amount,
22
- {
23
- showCode: true,
24
- disableRounding: true,
25
- }
26
- ).replace(/\s/g, " "),
14
+ formatDeviceAmount(account.currency, status.amount),
27
15
  },
28
16
  {
29
17
  title: "Fees",
30
18
  button: "Rr",
31
19
  ignoreAssertionFailure: true,
32
- // https://ledgerhq.atlassian.net/browse/LLC-676
33
20
  expectedValue: ({ account, status }) =>
34
- formatCurrencyUnit(
35
- {
36
- ...account.unit,
37
- code: account.currency.deviceTicker || account.unit.code,
38
- },
39
- status.estimatedFees,
40
- {
41
- showCode: true,
42
- disableRounding: true,
43
- }
44
- ).replace(/\s/g, " "),
21
+ formatDeviceAmount(account.currency, status.estimatedFees),
45
22
  },
46
23
  {
47
24
  title: "Address",
@@ -1,7 +1,7 @@
1
1
  import expect from "expect";
2
2
  import type { AppSpec } from "../../bot/types";
3
3
  import type { CardanoAccount, CardanoResources, Transaction } from "./types";
4
- import { botTest, pickSiblings } from "../../bot/specs";
4
+ import { botTest, genericTestDestination, pickSiblings } from "../../bot/specs";
5
5
  import { getCryptoCurrencyById } from "@ledgerhq/cryptoassets";
6
6
  import { DeviceModelId } from "@ledgerhq/devices";
7
7
  import BigNumber from "bignumber.js";
@@ -12,6 +12,7 @@ import { parseCurrencyUnit } from "../../currencies";
12
12
  import { SubAccount } from "@ledgerhq/types-live";
13
13
  import { acceptTransaction } from "./speculos-deviceActions";
14
14
 
15
+ const maxAccounts = 5;
15
16
  const currency = getCryptoCurrencyById("cardano");
16
17
  const minBalanceRequired = parseCurrencyUnit(currency.units[0], "2.2");
17
18
  const minBalanceRequiredForMaxSend = parseCurrencyUnit(currency.units[0], "1");
@@ -26,16 +27,19 @@ const cardano: AppSpec<Transaction> = {
26
27
  appQuery: {
27
28
  model: DeviceModelId.nanoS,
28
29
  appName: "CardanoADA",
30
+ appVersion: "4",
29
31
  },
32
+ minViableAmount: minBalanceRequired,
30
33
  genericDeviceAction: acceptTransaction,
31
34
  testTimeout: 2 * 60 * 1000,
32
35
  mutations: [
33
36
  {
37
+ testDestination: genericTestDestination,
34
38
  name: "move ~50%",
35
39
  maxRun: 1,
36
40
  transaction: ({ account, siblings, bridge, maxSpendable }) => {
37
41
  invariant(maxSpendable.gt(minBalanceRequired), "balance is too low");
38
- const sibling = pickSiblings(siblings, 3);
42
+ const sibling = pickSiblings(siblings, maxAccounts);
39
43
  const recipient = sibling.freshAddress;
40
44
  const transaction = bridge.createTransaction(account);
41
45
 
@@ -72,12 +76,13 @@ const cardano: AppSpec<Transaction> = {
72
76
  {
73
77
  name: "send max",
74
78
  maxRun: 1,
79
+ testDestination: genericTestDestination,
75
80
  transaction: ({ account, siblings, bridge, maxSpendable }) => {
76
81
  invariant(
77
82
  maxSpendable.gt(minBalanceRequiredForMaxSend),
78
83
  "balance is too low"
79
84
  );
80
- const sibling = pickSiblings(siblings, 3);
85
+ const sibling = pickSiblings(siblings, maxAccounts);
81
86
  const recipient = sibling.freshAddress;
82
87
  const transaction = bridge.createTransaction(account);
83
88
 
@@ -117,7 +122,7 @@ const cardano: AppSpec<Transaction> = {
117
122
  maxSpendable.gte(minSpendableRequiredForTokenTx),
118
123
  "balance is too low"
119
124
  );
120
- const sibling = pickSiblings(siblings, 3);
125
+ const sibling = pickSiblings(siblings, maxAccounts);
121
126
  const recipient = sibling.freshAddress;
122
127
  const transaction = bridge.createTransaction(account);
123
128
 
@@ -1,17 +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";
5
- import type { Unit } from "@ledgerhq/types-cryptoassets";
6
- import BigNumber from "bignumber.js";
7
-
8
- function expectedValue(unit: Unit, value: BigNumber) {
9
- return formatCurrencyUnit(unit, value, {
10
- showCode: true,
11
- disableRounding: true,
12
- showAllDigits: true,
13
- });
14
- }
3
+ import { deviceActionFlow, formatDeviceAmount } from "../../bot/specs";
15
4
 
16
5
  export const acceptTransaction: DeviceAction<Transaction, any> =
17
6
  deviceActionFlow({
@@ -38,7 +27,7 @@ export const acceptTransaction: DeviceAction<Transaction, any> =
38
27
  button: "LRlr",
39
28
  ignoreAssertionFailure: true,
40
29
  expectedValue: ({ account, status }) =>
41
- expectedValue(account.unit, status.amount),
30
+ formatDeviceAmount(account.currency, status.amount),
42
31
  },
43
32
  {
44
33
  title: "Asset fingerprint",
@@ -60,7 +49,7 @@ export const acceptTransaction: DeviceAction<Transaction, any> =
60
49
  button: "LRlr",
61
50
  ignoreAssertionFailure: true,
62
51
  expectedValue: ({ account, status }) =>
63
- expectedValue(account.unit, status.estimatedFees),
52
+ formatDeviceAmount(account.currency, status.estimatedFees),
64
53
  },
65
54
  {
66
55
  title: "Transaction TTL",