@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
package/src/bot/specs.ts CHANGED
@@ -4,10 +4,16 @@ import { log } from "@ledgerhq/logs";
4
4
  import expect from "expect";
5
5
  import sample from "lodash/sample";
6
6
  import { isAccountEmpty } from "../account";
7
- import type { DeviceAction, DeviceActionArg } from "./types";
7
+ import type {
8
+ DeviceAction,
9
+ DeviceActionArg,
10
+ TransactionDestinationTestInput,
11
+ } from "./types";
8
12
  import { Account } from "@ledgerhq/types-live";
9
13
  import type { Transaction } from "../generated/types";
10
14
  import { botTest } from "./bot-test-context";
15
+ import { CryptoCurrency, TokenCurrency } from "@ledgerhq/types-cryptoassets";
16
+ import BigNumber from "bignumber.js";
11
17
 
12
18
  export { botTest };
13
19
 
@@ -173,3 +179,91 @@ export function deviceActionFlow<T extends Transaction>(
173
179
  };
174
180
  };
175
181
  }
182
+
183
+ type DeviceAmountFormatOptions = {
184
+ // the ticker of the coin is AFTER the amount on the device (e.g. "600.1 USDT")
185
+ postfixCode: boolean;
186
+ // the device shows "42" as "42.0"
187
+ forceFloating: boolean;
188
+ // device don't even display the code (unit ticker)
189
+ hideCode: boolean;
190
+ // force the visibility of all digits of the amount
191
+ showAllDigits: boolean;
192
+ };
193
+ const defaultFormatOptions: DeviceAmountFormatOptions = {
194
+ postfixCode: false,
195
+ forceFloating: false,
196
+ hideCode: false,
197
+ showAllDigits: false,
198
+ };
199
+
200
+ const sep = " ";
201
+ export function formatDeviceAmount(
202
+ currency: CryptoCurrency | TokenCurrency,
203
+ value: BigNumber,
204
+ options: Partial<DeviceAmountFormatOptions> = defaultFormatOptions
205
+ ): string {
206
+ const [unit] = currency.units;
207
+ let code = unit.code;
208
+ if (currency.type === "CryptoCurrency") {
209
+ const { deviceTicker } = currency;
210
+ if (deviceTicker) code = deviceTicker;
211
+ }
212
+ const fValue = value.div(new BigNumber(10).pow(unit.magnitude));
213
+ let v = options.showAllDigits
214
+ ? fValue.toFixed(unit.magnitude)
215
+ : fValue.toString(10);
216
+ if (options.forceFloating) {
217
+ if (!v.includes(".")) {
218
+ // if the value is pure integer, in the app it will automatically add an .0
219
+ v += ".0";
220
+ }
221
+ }
222
+ if (options.hideCode) return v;
223
+ return options.postfixCode ? v + sep + code : code + sep + v;
224
+ }
225
+
226
+ // this function throw if the portion of undelegated funds is smaller than the threshold
227
+ // where threshold is a value from 0.0 to 1.0, percentage of the total amount of funds
228
+ // Usage: put these in your spec, on the mutation transaction functions that intend to do more "delegations"
229
+ export function expectSiblingsHaveSpendablePartGreaterThan(
230
+ siblings: Account[],
231
+ threshold: number
232
+ ): void {
233
+ const spendableTotal = siblings.reduce(
234
+ (acc, a) => acc.plus(a.spendableBalance),
235
+ new BigNumber(0)
236
+ );
237
+ const total = siblings.reduce(
238
+ (acc, a) => acc.plus(a.balance),
239
+ new BigNumber(0)
240
+ );
241
+ invariant(
242
+ spendableTotal.div(total).gt(threshold),
243
+ "the spendable part of accounts is sufficient (threshold: %s)",
244
+ threshold
245
+ );
246
+ }
247
+
248
+ export const genericTestDestination = <T>({
249
+ destination,
250
+ operation,
251
+ destinationBeforeTransaction,
252
+ sendingOperation,
253
+ }: TransactionDestinationTestInput<T>): void => {
254
+ const amount = sendingOperation.value.minus(sendingOperation.fee);
255
+ botTest("account balance increased with transaction amount", () =>
256
+ expect(destination.balance.toString()).toBe(
257
+ destinationBeforeTransaction.balance.plus(amount).toString()
258
+ )
259
+ );
260
+ botTest("operation amount is consistent with sendingOperation", () =>
261
+ expect({
262
+ type: operation.type,
263
+ amount: operation.value.toString(),
264
+ }).toMatchObject({
265
+ type: "IN",
266
+ amount: amount.toString(),
267
+ })
268
+ );
269
+ };
package/src/bot/types.ts CHANGED
@@ -25,6 +25,15 @@ export type TransactionTestInput<T> = {
25
25
  optimisticOperation: Operation;
26
26
  operation: Operation;
27
27
  };
28
+ export type TransactionDestinationTestInput<T> = {
29
+ sendingAccount: Account;
30
+ sendingOperation: Operation;
31
+ destinationBeforeTransaction: Account;
32
+ operation: Operation;
33
+ destination: Account;
34
+ transaction: T;
35
+ status: TransactionStatus;
36
+ };
28
37
  export type DeviceActionArg<T extends Transaction, S> = {
29
38
  appCandidate: AppCandidate;
30
39
  account: Account;
@@ -50,6 +59,7 @@ export type TransactionArg<T extends Transaction> = {
50
59
  export type TransactionRes<T extends Transaction> = {
51
60
  transaction: T;
52
61
  updates: Array<Partial<T> | null | undefined>;
62
+ destination?: Account;
53
63
  };
54
64
  export type MutationSpec<T extends Transaction> = {
55
65
  // Name what this mutation is doing
@@ -71,7 +81,9 @@ export type MutationSpec<T extends Transaction> = {
71
81
  // how much time to wait in maximum to reach the final state
72
82
  testTimeout?: number;
73
83
  // Implement a test that runs after the operation is applied to the account
74
- test?: (arg0: TransactionTestInput<T>) => void;
84
+ test?: (input: TransactionTestInput<T>) => void;
85
+ // Implement a second test that allows to test the effect of the transaction on the DESTINATION account (matched by recipient)
86
+ testDestination?: (input: TransactionDestinationTestInput<T>) => void;
75
87
  };
76
88
 
77
89
  export type AppSpec<T extends Transaction> = {
@@ -101,9 +113,13 @@ export type AppSpec<T extends Transaction> = {
101
113
  // can implement generic invariants for a mutation transaction to be possible
102
114
  transactionCheck?: (arg: TransactionArg<T>) => void;
103
115
  // Implement a test that also runs on each mutation after the operation is applied to the account
116
+ // this allows to verify the effect of the transaction is correctly applied on the account
104
117
  test?: (arg0: TransactionTestInput<T>) => void;
105
118
  // Express the device actions to do (buttons,..) and validate the device screen
106
119
  genericDeviceAction: DeviceAction<T, any>;
120
+ // indicates to the engine what's the generally minimal amount we use to opt out from doing a transaction
121
+ // NB: at the moment it's purely informative and help inferring good "hints", but we could eventually automate it
122
+ minViableAmount?: BigNumber;
107
123
  };
108
124
  export type SpecReport<T extends Transaction> = {
109
125
  spec: AppSpec<T>;
@@ -114,6 +130,8 @@ export type SpecReport<T extends Transaction> = {
114
130
  accountsAfter?: Account[];
115
131
  mutations?: MutationReport<T>[];
116
132
  fatalError?: Error;
133
+ // express hints for the spec developers on things that could be improved
134
+ hintWarnings: string[];
117
135
  };
118
136
  export type MutationReport<T extends Transaction> = {
119
137
  resyncAccountsDuration: number;
@@ -144,5 +162,9 @@ export type MutationReport<T extends Transaction> = {
144
162
  confirmedTime?: number;
145
163
  finalAccount?: Account;
146
164
  testDuration?: number;
165
+ destinationConfirmedTime?: number;
166
+ finalDestination?: Account;
167
+ finalDestinationOperation?: Operation;
168
+ testDestinationDuration?: number;
147
169
  error?: Error;
148
170
  };
@@ -184,7 +184,7 @@ Array [
184
184
  "ethereum/erc20/dtr",
185
185
  "ethereum/erc20/crypto20",
186
186
  "ethereum/erc20/karatbank_coin",
187
- "ethereum/erc20/ecoreal_estate",
187
+ "ethereum/erc20/ecoreal",
188
188
  "ethereum/erc20/bz",
189
189
  "ethereum/erc20/edcoin",
190
190
  "ethereum/erc20/btu_protocol",
@@ -1354,26 +1354,26 @@ Array [
1354
1354
  "ethereum/erc20/holotoken",
1355
1355
  "ethereum/erc20/etoro_euro",
1356
1356
  "near",
1357
- "arbitrum",
1358
1357
  "avalanche",
1359
1358
  "banano",
1360
1359
  "celo",
1361
- "cronos",
1362
1360
  "dexon",
1363
1361
  "elrond",
1364
1362
  "fic",
1365
- "flare",
1366
1363
  "flow",
1367
1364
  "icp",
1368
1365
  "LBRY",
1369
- "moonbeam",
1370
1366
  "moonriver",
1371
1367
  "musicoin",
1372
- "songbird",
1373
1368
  "reosc",
1374
1369
  "resistance",
1375
1370
  "osmo",
1376
1371
  "shyft",
1372
+ "arbitrum",
1373
+ "cronos",
1374
+ "flare",
1375
+ "songbird",
1376
+ "moonbeam",
1377
1377
  "ethereum/erc20/$aapl",
1378
1378
  "ethereum/erc20/$based",
1379
1379
  "ethereum/erc20/$die",
@@ -2338,7 +2338,10 @@ Array [
2338
2338
  "ethereum/erc20/curio_governance_token",
2339
2339
  "ethereum/erc20/current",
2340
2340
  "ethereum/erc20/curryswap",
2341
+ "ethereum/erc20/curve_crv-eth",
2342
+ "ethereum/erc20/curve_cvx-eth",
2341
2343
  "ethereum/erc20/curve_dao_token",
2344
+ "ethereum/erc20/curve_eurt-3crv",
2342
2345
  "ethereum/erc20/curve_fi",
2343
2346
  "ethereum/erc20/curve_fi_daiusdcusdt",
2344
2347
  "ethereum/erc20/curve_fi_daiusdcusdtsusd",
@@ -2348,6 +2351,33 @@ Array [
2348
2351
  "ethereum/erc20/curve_fi_renbtcwbtcsbtc",
2349
2352
  "ethereum/erc20/curve_fi_usd-btc-eth",
2350
2353
  "ethereum/erc20/curve_fi_usdk_3crv",
2354
+ "ethereum/erc20/curvefi_cydaicyusdccyusdt",
2355
+ "ethereum/erc20/curvefi_dusd3crv",
2356
+ "ethereum/erc20/curvefi_ethaeth",
2357
+ "ethereum/erc20/curvefi_ethsteth",
2358
+ "ethereum/erc20/curvefi_factory_crypto_pool_yfieth",
2359
+ "ethereum/erc20/curvefi_factory_plain_pool_3eurpool",
2360
+ "ethereum/erc20/curvefi_factory_plain_pool_cvxcrv",
2361
+ "ethereum/erc20/curvefi_factory_plain_pool_ibchfschf",
2362
+ "ethereum/erc20/curvefi_factory_plain_pool_ibeurseur",
2363
+ "ethereum/erc20/curvefi_factory_plain_pool_ibgbpsgbp",
2364
+ "ethereum/erc20/curvefi_factory_plain_pool_ibkrwskrw",
2365
+ "ethereum/erc20/curvefi_factory_plain_pool_neutrino_eur",
2366
+ "ethereum/erc20/curvefi_factory_pool_aleth",
2367
+ "ethereum/erc20/curvefi_factory_usd_metapool_alchemix_usd",
2368
+ "ethereum/erc20/curvefi_factory_usd_metapool_binance_usd",
2369
+ "ethereum/erc20/curvefi_factory_usd_metapool_dola-3pool_curve_lp",
2370
+ "ethereum/erc20/curvefi_factory_usd_metapool_liquity",
2371
+ "ethereum/erc20/curvefi_factory_usd_metapool_magic_internet_mone",
2372
+ "ethereum/erc20/curvefi_factory_usd_metapool_origin_dollar",
2373
+ "ethereum/erc20/curvefi_factory_usd_metapool_trueusd",
2374
+ "ethereum/erc20/curvefi_gusd3crv",
2375
+ "ethereum/erc20/curvefi_hbtcwbtc",
2376
+ "ethereum/erc20/curvefi_musd3crv",
2377
+ "ethereum/erc20/curvefi_obtcsbtccrv",
2378
+ "ethereum/erc20/curvefi_tbtcsbtccrv",
2379
+ "ethereum/erc20/curvefi_usd-btc-eth",
2380
+ "ethereum/erc20/curvefi_usdn3crv",
2351
2381
  "ethereum/erc20/cute_coin",
2352
2382
  "ethereum/erc20/cvault_finance",
2353
2383
  "ethereum/erc20/cvtoken",
@@ -2649,6 +2679,7 @@ Array [
2649
2679
  "ethereum/erc20/eco_token",
2650
2680
  "ethereum/erc20/eco_value_coin",
2651
2681
  "ethereum/erc20/ecofi_token",
2682
+ "ethereum/erc20/ecoreal_estate_old",
2652
2683
  "ethereum/erc20/ecoscu",
2653
2684
  "ethereum/erc20/ecpn_token",
2654
2685
  "ethereum/erc20/edda",
@@ -3113,6 +3144,7 @@ Array [
3113
3144
  "ethereum/erc20/green_metaverse_token",
3114
3145
  "ethereum/erc20/green_token",
3115
3146
  "ethereum/erc20/greenmed",
3147
+ "ethereum/erc20/greenmetaversetoken",
3116
3148
  "ethereum/erc20/grey_token",
3117
3149
  "ethereum/erc20/gridzone_io",
3118
3150
  "ethereum/erc20/grind_token",
@@ -3130,6 +3162,7 @@ Array [
3130
3162
  "ethereum/erc20/guarded_ether",
3131
3163
  "ethereum/erc20/guarded_ether_old",
3132
3164
  "ethereum/erc20/guild_of_guardians",
3165
+ "ethereum/erc20/guildfi_token",
3133
3166
  "ethereum/erc20/guld_erc20",
3134
3167
  "ethereum/erc20/gunthy",
3135
3168
  "ethereum/erc20/guss_one",
@@ -3420,6 +3453,7 @@ Array [
3420
3453
  "ethereum/erc20/keytango_token",
3421
3454
  "ethereum/erc20/khipu_token",
3422
3455
  "ethereum/erc20/ki",
3456
+ "ethereum/erc20/kiba_inu",
3423
3457
  "ethereum/erc20/kids_cash",
3424
3458
  "ethereum/erc20/kiloample",
3425
3459
  "ethereum/erc20/kimchi_finance",
@@ -4276,9 +4310,11 @@ Array [
4276
4310
  "ethereum/erc20/racing_pigeon_coin",
4277
4311
  "ethereum/erc20/radar",
4278
4312
  "ethereum/erc20/radicle",
4313
+ "ethereum/erc20/radio_caca_v2",
4279
4314
  "ethereum/erc20/radioyo",
4280
4315
  "ethereum/erc20/ragetoken",
4281
4316
  "ethereum/erc20/rai",
4317
+ "ethereum/erc20/rai3crv",
4282
4318
  "ethereum/erc20/rai_finance",
4283
4319
  "ethereum/erc20/rai_reflex_index",
4284
4320
  "ethereum/erc20/raid_guild_token_âš”ï¸_x008f_",
@@ -4539,6 +4575,7 @@ Array [
4539
4575
  "ethereum/erc20/shinigami_inu",
4540
4576
  "ethereum/erc20/shipit_pro",
4541
4577
  "ethereum/erc20/shiryo-inu",
4578
+ "ethereum/erc20/shita-kiri_suzume",
4542
4579
  "ethereum/erc20/shitcoin",
4543
4580
  "ethereum/erc20/shopping_io",
4544
4581
  "ethereum/erc20/showcase_token",
@@ -4552,6 +4589,7 @@ Array [
4552
4589
  "ethereum/erc20/siacashcoin",
4553
4590
  "ethereum/erc20/siambitcoin",
4554
4591
  "ethereum/erc20/siberian_husky",
4592
+ "ethereum/erc20/sid_token",
4555
4593
  "ethereum/erc20/sideshift_token",
4556
4594
  "ethereum/erc20/sienna_(erc20)",
4557
4595
  "ethereum/erc20/sift",
@@ -5227,6 +5265,7 @@ Array [
5227
5265
  "ethereum/erc20/vision_network",
5228
5266
  "ethereum/erc20/vision_token",
5229
5267
  "ethereum/erc20/visor",
5268
+ "ethereum/erc20/vita_inu",
5230
5269
  "ethereum/erc20/vitadao_token",
5231
5270
  "ethereum/erc20/viu",
5232
5271
  "ethereum/erc20/vixco",
@@ -5724,6 +5763,7 @@ Array [
5724
5763
  "polygon/erc20/dfyn_token_(pos)",
5725
5764
  "polygon/erc20/dhedge_dao_token",
5726
5765
  "polygon/erc20/dogelon",
5766
+ "polygon/erc20/dominium",
5727
5767
  "polygon/erc20/dovu",
5728
5768
  "polygon/erc20/dragon_quick",
5729
5769
  "polygon/erc20/dsla",
@@ -5824,6 +5864,7 @@ Array [
5824
5864
  "polygon/erc20/mimatic",
5825
5865
  "polygon/erc20/minerva_wallet_supertoken",
5826
5866
  "polygon/erc20/moo_curve_atricrypto3",
5867
+ "polygon/erc20/moo_curve_stmatic-matic",
5827
5868
  "polygon/erc20/moo_mai_usdc-mimatic",
5828
5869
  "polygon/erc20/moonwolf_io",
5829
5870
  "polygon/erc20/mover",
@@ -5832,6 +5873,7 @@ Array [
5832
5873
  "polygon/erc20/mysterium_(pos)",
5833
5874
  "polygon/erc20/nakamoto.games",
5834
5875
  "polygon/erc20/napoleonx",
5876
+ "polygon/erc20/nash_exchange_token_(pos)",
5835
5877
  "polygon/erc20/neighbourhoods_token",
5836
5878
  "polygon/erc20/neos_credits_(pos)",
5837
5879
  "polygon/erc20/nexo",
@@ -5910,6 +5952,7 @@ Array [
5910
5952
  "polygon/erc20/stake_dao_curve_amdaiamusdcamusdt",
5911
5953
  "polygon/erc20/stake_dao_token_(pos)",
5912
5954
  "polygon/erc20/staked_abi",
5955
+ "polygon/erc20/staked_dominium",
5913
5956
  "polygon/erc20/staked_matic_(pos)",
5914
5957
  "polygon/erc20/stakewise",
5915
5958
  "polygon/erc20/stasis_eurs_token",
@@ -6003,6 +6046,7 @@ Array [
6003
6046
  "bsc/bep20/2030floki",
6004
6047
  "bsc/bep20/accel_bnb_pre_sale",
6005
6048
  "bsc/bep20/acryptos",
6049
+ "bsc/bep20/acts_token",
6006
6050
  "bsc/bep20/adex_network",
6007
6051
  "bsc/bep20/aleph.im_v2",
6008
6052
  "bsc/bep20/alice",
@@ -6041,6 +6085,7 @@ Array [
6041
6085
  "bsc/bep20/bakerytoken",
6042
6086
  "bsc/bep20/bat_true_dollar",
6043
6087
  "bsc/bep20/bat_true_share",
6088
+ "bsc/bep20/battleinfinity",
6044
6089
  "bsc/bep20/bb_verse",
6045
6090
  "bsc/bep20/bdollar",
6046
6091
  "bsc/bep20/bdollar_share",
@@ -6246,6 +6291,7 @@ Array [
6246
6291
  "bsc/bep20/gforce",
6247
6292
  "bsc/bep20/gg_token",
6248
6293
  "bsc/bep20/gomining_token",
6294
+ "bsc/bep20/good_games_guild",
6249
6295
  "bsc/bep20/goose_coin",
6250
6296
  "bsc/bep20/goose_golden_egg",
6251
6297
  "bsc/bep20/gorilladiamond",
@@ -6338,6 +6384,7 @@ Array [
6338
6384
  "bsc/bep20/movez.me",
6339
6385
  "bsc/bep20/mtlx-erc20",
6340
6386
  "bsc/bep20/multiplier",
6387
+ "bsc/bep20/musicverse",
6341
6388
  "bsc/bep20/muuinu",
6342
6389
  "bsc/bep20/mx_token",
6343
6390
  "bsc/bep20/my_defi_pet_token",
@@ -6480,6 +6527,7 @@ Array [
6480
6527
  "bsc/bep20/tft_on_bsc",
6481
6528
  "bsc/bep20/the_force_token",
6482
6529
  "bsc/bep20/the_sandbox",
6530
+ "bsc/bep20/thetan_gem",
6483
6531
  "bsc/bep20/thugs",
6484
6532
  "bsc/bep20/tiki",
6485
6533
  "bsc/bep20/titano",
@@ -6516,6 +6564,7 @@ Array [
6516
6564
  "bsc/bep20/vai_stablecoin",
6517
6565
  "bsc/bep20/vallhund_inu",
6518
6566
  "bsc/bep20/vanci.finance",
6567
+ "bsc/bep20/veed",
6519
6568
  "bsc/bep20/venus",
6520
6569
  "bsc/bep20/venus_ada",
6521
6570
  "bsc/bep20/venus_bch",
@@ -20,7 +20,12 @@ function lazyLoadTickerMap() {
20
20
  }
21
21
  });
22
22
  listCryptoCurrencies().forEach((c) => {
23
- if (!c.disableCountervalue) {
23
+ if (
24
+ !c.disableCountervalue &&
25
+ // FIXME Avoid duplicates & override if the already set currency is a token
26
+ // E.g. 'Binance-Peg Ethereum Token' has an 'ETH' ticker
27
+ (!m.has(c.ticker) || m.get(c.ticker)?.type !== "CryptoCurrency")
28
+ ) {
24
29
  m.set(c.ticker, c);
25
30
  }
26
31
  });
@@ -75,7 +75,8 @@ export function listSupportedFiats(): FiatCurrency[] {
75
75
  return userSupportedFiats;
76
76
  }
77
77
  export function setSupportedCurrencies(ids: CryptoCurrencyIds[]) {
78
- userSupportedCurrencies = ids.map((id) => getCryptoCurrencyById(id));
78
+ userSupportedCurrencies = Array.from(new Set(ids)) // Make sure to remove duplicates
79
+ .map((id) => getCryptoCurrencyById(id));
79
80
  }
80
81
 
81
82
  function getExperimentalSupports() {
package/src/derivation.ts CHANGED
@@ -156,16 +156,14 @@ const modes = Object.freeze({
156
156
  polkadotbip44: {
157
157
  overridesDerivation: "44'/354'/<account>'/0'/<address>'",
158
158
  },
159
- // glif legacy derivation
160
159
  gliflegacy: {
161
160
  overridesDerivation: "44'/1'/0'/0/<account>",
162
- tag: "glif-legacy",
161
+ tag: "legacy",
163
162
  },
164
- // glif normal derivation
165
163
  glif: {
166
164
  overridesDerivation: "44'/461'/0'/0/<account>",
167
165
  startsAt: 1,
168
- tag: "glif",
166
+ tag: "third-party",
169
167
  },
170
168
  solanaMain: {
171
169
  isNonIterable: true,
package/src/env.ts CHANGED
@@ -500,7 +500,7 @@ const envDefinitions = {
500
500
  desc: "dev flag to skip onboarding flow",
501
501
  },
502
502
  SWAP_API_BASE: {
503
- def: "https://swap.ledger.com/v3",
503
+ def: "https://swap.ledger.com/v4",
504
504
  parser: stringParser,
505
505
  desc: "Swap API base",
506
506
  },
@@ -13,7 +13,12 @@ import {
13
13
  } from "../../errors";
14
14
  import network from "../../network";
15
15
  import type { Transaction } from "../../generated/types";
16
- import { getAvailableProviders, getSwapAPIBaseURL, getSwapAPIError } from "./";
16
+ import {
17
+ getAvailableProviders,
18
+ getSwapAPIBaseURL,
19
+ getSwapAPIError,
20
+ getSwapAPIVersion,
21
+ } from "./";
17
22
  import { mockGetExchangeRates } from "./mock";
18
23
  import type { CustomMinOrMaxError, Exchange, GetExchangeRates } from "./types";
19
24
 
@@ -26,8 +31,7 @@ const getExchangeRates: GetExchangeRates = async (
26
31
  if (getEnv("MOCK"))
27
32
  return mockGetExchangeRates(exchange, transaction, currencyTo);
28
33
 
29
- // Rely on the api base to determine the version logic
30
- const usesV3 = getSwapAPIBaseURL().endsWith("v3");
34
+ const usesV3 = getSwapAPIVersion() >= 3;
31
35
  const from = getAccountCurrency(exchange.fromAccount).id;
32
36
  const unitFrom = getAccountUnit(exchange.fromAccount);
33
37
  const unitTo =
@@ -135,8 +139,11 @@ const inferError = (
135
139
  }
136
140
 
137
141
  // For out of range errors we will have a min/max pairing
138
- if (minAmountFrom) {
139
- const isTooSmall = new BigNumber(apiAmount).lte(minAmountFrom);
142
+ const hasAmountLimit = minAmountFrom || maxAmountFrom;
143
+ if (hasAmountLimit) {
144
+ const isTooSmall = minAmountFrom
145
+ ? new BigNumber(apiAmount).lte(minAmountFrom)
146
+ : false;
140
147
 
141
148
  const MinOrMaxError = isTooSmall
142
149
  ? SwapExchangeRateAmountTooLow