@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.
- package/lib/apps/logic.test.js +1 -1
- package/lib/apps/logic.test.js.map +1 -1
- package/lib/apps/polyfill.d.ts +1 -1
- package/lib/apps/polyfill.d.ts.map +1 -1
- package/lib/apps/polyfill.js +6 -3
- package/lib/apps/polyfill.js.map +1 -1
- package/lib/apps/polyfill.test.d.ts +2 -0
- package/lib/apps/polyfill.test.d.ts.map +1 -0
- package/lib/apps/polyfill.test.js +25 -0
- package/lib/apps/polyfill.test.js.map +1 -0
- package/lib/apps/support.d.ts.map +1 -1
- package/lib/apps/support.js +3 -2
- package/lib/apps/support.js.map +1 -1
- package/lib/bot/engine.d.ts.map +1 -1
- package/lib/bot/engine.js +154 -45
- package/lib/bot/engine.js.map +1 -1
- package/lib/bot/formatters.d.ts +1 -1
- package/lib/bot/formatters.d.ts.map +1 -1
- package/lib/bot/formatters.js +9 -3
- package/lib/bot/formatters.js.map +1 -1
- package/lib/bot/index.d.ts.map +1 -1
- package/lib/bot/index.js +29 -11
- package/lib/bot/index.js.map +1 -1
- package/lib/bot/specs.d.ts +12 -1
- package/lib/bot/specs.d.ts.map +1 -1
- package/lib/bot/specs.js +75 -1
- package/lib/bot/specs.js.map +1 -1
- package/lib/bot/types.d.ts +18 -1
- package/lib/bot/types.d.ts.map +1 -1
- package/lib/currencies/sortByMarketcap.d.ts.map +1 -1
- package/lib/currencies/sortByMarketcap.js +5 -1
- package/lib/currencies/sortByMarketcap.js.map +1 -1
- package/lib/currencies/support.d.ts.map +1 -1
- package/lib/currencies/support.js +2 -1
- package/lib/currencies/support.js.map +1 -1
- package/lib/derivation.d.ts.map +1 -1
- package/lib/derivation.js +2 -4
- package/lib/derivation.js.map +1 -1
- package/lib/env.js +1 -1
- package/lib/exchange/swap/getExchangeRates.d.ts.map +1 -1
- package/lib/exchange/swap/getExchangeRates.js +6 -3
- package/lib/exchange/swap/getExchangeRates.js.map +1 -1
- package/lib/exchange/swap/getProviders.d.ts.map +1 -1
- package/lib/exchange/swap/getProviders.js +45 -5
- package/lib/exchange/swap/getProviders.js.map +1 -1
- package/lib/exchange/swap/getProviders.test.d.ts +2 -0
- package/lib/exchange/swap/getProviders.test.d.ts.map +1 -0
- package/lib/exchange/swap/getProviders.test.js +519 -0
- package/lib/exchange/swap/getProviders.test.js.map +1 -0
- package/lib/exchange/swap/hooks/useProviderRates.d.ts +1 -0
- package/lib/exchange/swap/hooks/useProviderRates.d.ts.map +1 -1
- package/lib/exchange/swap/hooks/useProviderRates.js +19 -4
- package/lib/exchange/swap/hooks/useProviderRates.js.map +1 -1
- package/lib/exchange/swap/hooks/useProviderRates.test.js +42 -0
- package/lib/exchange/swap/hooks/useProviderRates.test.js.map +1 -1
- package/lib/exchange/swap/hooks/useSwapTransaction.d.ts +1 -0
- package/lib/exchange/swap/hooks/useSwapTransaction.d.ts.map +1 -1
- package/lib/exchange/swap/hooks/useSwapTransaction.js +2 -1
- package/lib/exchange/swap/hooks/useSwapTransaction.js.map +1 -1
- package/lib/exchange/swap/index.d.ts +2 -1
- package/lib/exchange/swap/index.d.ts.map +1 -1
- package/lib/exchange/swap/index.js +11 -1
- package/lib/exchange/swap/index.js.map +1 -1
- package/lib/exchange/swap/index.test.js +22 -0
- package/lib/exchange/swap/index.test.js.map +1 -1
- package/lib/exchange/swap/mock.js +1 -1
- package/lib/exchange/swap/mock.js.map +1 -1
- package/lib/exchange/swap/types.d.ts +14 -0
- package/lib/exchange/swap/types.d.ts.map +1 -1
- package/lib/exchange/swap/utils/index.d.ts +1 -0
- package/lib/exchange/swap/utils/index.d.ts.map +1 -1
- package/lib/exchange/swap/utils/index.js +6 -1
- package/lib/exchange/swap/utils/index.js.map +1 -1
- package/lib/exchange/swap/utils/index.test.js +12 -0
- package/lib/exchange/swap/utils/index.test.js.map +1 -1
- package/lib/families/algorand/specs.d.ts.map +1 -1
- package/lib/families/algorand/specs.js +2 -0
- package/lib/families/algorand/specs.js.map +1 -1
- package/lib/families/algorand/speculos-deviceActions.d.ts.map +1 -1
- package/lib/families/algorand/speculos-deviceActions.js +2 -29
- package/lib/families/algorand/speculos-deviceActions.js.map +1 -1
- package/lib/families/bitcoin/specs.d.ts +0 -1
- package/lib/families/bitcoin/specs.d.ts.map +1 -1
- package/lib/families/bitcoin/specs.js +65 -48
- package/lib/families/bitcoin/specs.js.map +1 -1
- package/lib/families/bitcoin/speculos-deviceActions.d.ts.map +1 -1
- package/lib/families/bitcoin/speculos-deviceActions.js +2 -22
- package/lib/families/bitcoin/speculos-deviceActions.js.map +1 -1
- package/lib/families/cardano/specs.d.ts.map +1 -1
- package/lib/families/cardano/specs.js +9 -4
- package/lib/families/cardano/specs.js.map +1 -1
- package/lib/families/cardano/speculos-deviceActions.d.ts.map +1 -1
- package/lib/families/cardano/speculos-deviceActions.js +2 -10
- package/lib/families/cardano/speculos-deviceActions.js.map +1 -1
- package/lib/families/celo/specs/createSendMutation.d.ts +1 -0
- package/lib/families/celo/specs/createSendMutation.d.ts.map +1 -1
- package/lib/families/celo/specs/createSendMutation.js +7 -5
- package/lib/families/celo/specs/createSendMutation.js.map +1 -1
- package/lib/families/celo/specs.d.ts.map +1 -1
- package/lib/families/celo/specs.js +1 -0
- package/lib/families/celo/specs.js.map +1 -1
- package/lib/families/celo/speculos-deviceActions.d.ts.map +1 -1
- package/lib/families/celo/speculos-deviceActions.js +3 -10
- package/lib/families/celo/speculos-deviceActions.js.map +1 -1
- package/lib/families/cosmos/helpers.d.ts +9 -0
- package/lib/families/cosmos/helpers.d.ts.map +1 -0
- package/lib/families/cosmos/helpers.js +20 -0
- package/lib/families/cosmos/helpers.js.map +1 -0
- package/lib/families/cosmos/helpers.unit.test.d.ts +2 -0
- package/lib/families/cosmos/helpers.unit.test.d.ts.map +1 -0
- package/lib/families/cosmos/helpers.unit.test.js +56 -0
- package/lib/families/cosmos/helpers.unit.test.js.map +1 -0
- package/lib/families/cosmos/js-signOperation.d.ts.map +1 -1
- package/lib/families/cosmos/js-signOperation.js +5 -3
- package/lib/families/cosmos/js-signOperation.js.map +1 -1
- package/lib/families/cosmos/js-synchronisation.d.ts.map +1 -1
- package/lib/families/cosmos/js-synchronisation.js +99 -95
- package/lib/families/cosmos/js-synchronisation.js.map +1 -1
- package/lib/families/cosmos/specs.d.ts.map +1 -1
- package/lib/families/cosmos/specs.js +5 -1
- package/lib/families/cosmos/specs.js.map +1 -1
- package/lib/families/crypto_org/specs.d.ts.map +1 -1
- package/lib/families/crypto_org/specs.js +9 -8
- package/lib/families/crypto_org/specs.js.map +1 -1
- package/lib/families/elrond/specs.d.ts.map +1 -1
- package/lib/families/elrond/specs.js +1 -0
- package/lib/families/elrond/specs.js.map +1 -1
- package/lib/families/elrond/speculos-deviceActions.d.ts.map +1 -1
- package/lib/families/elrond/speculos-deviceActions.js +3 -8
- package/lib/families/elrond/speculos-deviceActions.js.map +1 -1
- package/lib/families/ethereum/specs.d.ts.map +1 -1
- package/lib/families/ethereum/specs.js +20 -8
- package/lib/families/ethereum/specs.js.map +1 -1
- package/lib/families/ethereum/speculos-deviceActions.d.ts.map +1 -1
- package/lib/families/ethereum/speculos-deviceActions.js +10 -33
- package/lib/families/ethereum/speculos-deviceActions.js.map +1 -1
- package/lib/families/evm/specs.d.ts.map +1 -1
- package/lib/families/evm/specs.js +20 -10
- package/lib/families/evm/specs.js.map +1 -1
- package/lib/families/evm/speculos-deviceActions.d.ts.map +1 -1
- package/lib/families/evm/speculos-deviceActions.js +5 -25
- package/lib/families/evm/speculos-deviceActions.js.map +1 -1
- package/lib/families/filecoin/specs.d.ts.map +1 -1
- package/lib/families/filecoin/specs.js +3 -0
- package/lib/families/filecoin/specs.js.map +1 -1
- package/lib/families/filecoin/speculos-deviceActions.d.ts.map +1 -1
- package/lib/families/filecoin/speculos-deviceActions.js +6 -7
- package/lib/families/filecoin/speculos-deviceActions.js.map +1 -1
- package/lib/families/hedera/specs.d.ts.map +1 -1
- package/lib/families/hedera/specs.js +2 -0
- package/lib/families/hedera/specs.js.map +1 -1
- package/lib/families/osmosis/specs.d.ts.map +1 -1
- package/lib/families/osmosis/specs.js +3 -0
- package/lib/families/osmosis/specs.js.map +1 -1
- package/lib/families/polkadot/specs.d.ts.map +1 -1
- package/lib/families/polkadot/specs.js +4 -1
- package/lib/families/polkadot/specs.js.map +1 -1
- package/lib/families/polkadot/speculos-deviceActions.d.ts.map +1 -1
- package/lib/families/polkadot/speculos-deviceActions.js +3 -10
- package/lib/families/polkadot/speculos-deviceActions.js.map +1 -1
- package/lib/families/ripple/specs.d.ts.map +1 -1
- package/lib/families/ripple/specs.js +2 -0
- package/lib/families/ripple/specs.js.map +1 -1
- package/lib/families/ripple/speculos-deviceActions.d.ts.map +1 -1
- package/lib/families/ripple/speculos-deviceActions.js +2 -22
- package/lib/families/ripple/speculos-deviceActions.js.map +1 -1
- package/lib/families/solana/specs.d.ts.map +1 -1
- package/lib/families/solana/specs.js +7 -3
- package/lib/families/solana/specs.js.map +1 -1
- package/lib/families/solana/speculos-deviceActions.d.ts.map +1 -1
- package/lib/families/solana/speculos-deviceActions.js +5 -7
- package/lib/families/solana/speculos-deviceActions.js.map +1 -1
- package/lib/families/stellar/specs.d.ts.map +1 -1
- package/lib/families/stellar/specs.js +1 -0
- package/lib/families/stellar/specs.js.map +1 -1
- package/lib/families/stellar/speculos-deviceActions.d.ts.map +1 -1
- package/lib/families/stellar/speculos-deviceActions.js +4 -8
- package/lib/families/stellar/speculos-deviceActions.js.map +1 -1
- package/lib/families/tezos/specs.d.ts.map +1 -1
- package/lib/families/tezos/specs.js +6 -1
- package/lib/families/tezos/specs.js.map +1 -1
- package/lib/families/tezos/speculos-deviceActions.d.ts.map +1 -1
- package/lib/families/tezos/speculos-deviceActions.js +6 -11
- package/lib/families/tezos/speculos-deviceActions.js.map +1 -1
- package/lib/families/tron/specs.d.ts.map +1 -1
- package/lib/families/tron/specs.js +16 -1
- package/lib/families/tron/specs.js.map +1 -1
- package/lib/families/tron/speculos-deviceActions.d.ts.map +1 -1
- package/lib/families/tron/speculos-deviceActions.js +2 -14
- package/lib/families/tron/speculos-deviceActions.js.map +1 -1
- package/lib/families/tron/synchronisation.integration.test.d.ts +2 -0
- package/lib/families/tron/synchronisation.integration.test.d.ts.map +1 -0
- package/lib/families/tron/{synchronisation.test.js → synchronisation.integration.test.js} +1 -1
- package/lib/families/tron/synchronisation.integration.test.js.map +1 -0
- package/lib/featureFlags/defaultFeatures.d.ts.map +1 -1
- package/lib/featureFlags/defaultFeatures.js +6 -0
- package/lib/featureFlags/defaultFeatures.js.map +1 -1
- package/lib/generated/specs.d.ts +0 -1
- package/lib/generated/specs.d.ts.map +1 -1
- package/lib/hw/actions/installLanguage.js +1 -1
- package/lib/hw/extractOnboardingState.d.ts +5 -1
- package/lib/hw/extractOnboardingState.d.ts.map +1 -1
- package/lib/hw/extractOnboardingState.js +17 -9
- package/lib/hw/extractOnboardingState.js.map +1 -1
- package/lib/hw/extractOnboardingState.test.js +21 -11
- package/lib/hw/extractOnboardingState.test.js.map +1 -1
- package/lib/load/speculos.d.ts.map +1 -1
- package/lib/load/speculos.js +39 -15
- package/lib/load/speculos.js.map +1 -1
- package/lib/manager/hooks.d.ts +4 -1
- package/lib/manager/hooks.d.ts.map +1 -1
- package/lib/manager/hooks.js +4 -3
- package/lib/manager/hooks.js.map +1 -1
- package/lib/manager/localization.js +2 -2
- package/lib/manager/localization.js.map +1 -1
- package/lib/mock/account.d.ts.map +1 -1
- package/lib/mock/account.js +17 -19
- package/lib/mock/account.js.map +1 -1
- package/lib/notifications/ServiceStatusProvider/index.d.ts.map +1 -1
- package/lib/notifications/ServiceStatusProvider/index.js +5 -1
- package/lib/notifications/ServiceStatusProvider/index.js.map +1 -1
- package/lib/postOnboarding/PostOnboardingProvider.d.ts +20 -0
- package/lib/postOnboarding/PostOnboardingProvider.d.ts.map +1 -0
- package/lib/postOnboarding/PostOnboardingProvider.js +33 -0
- package/lib/postOnboarding/PostOnboardingProvider.js.map +1 -0
- package/lib/postOnboarding/actions.d.ts +20 -0
- package/lib/postOnboarding/actions.d.ts.map +1 -0
- package/lib/postOnboarding/actions.js +37 -0
- package/lib/postOnboarding/actions.js.map +1 -0
- package/lib/postOnboarding/hooks/index.d.ts +6 -0
- package/lib/postOnboarding/hooks/index.d.ts.map +1 -0
- package/lib/postOnboarding/hooks/index.js +22 -0
- package/lib/postOnboarding/hooks/index.js.map +1 -0
- package/lib/postOnboarding/hooks/useAllPostOnboardingActionsCompleted.d.ts +8 -0
- package/lib/postOnboarding/hooks/useAllPostOnboardingActionsCompleted.d.ts.map +1 -0
- package/lib/postOnboarding/hooks/useAllPostOnboardingActionsCompleted.js +16 -0
- package/lib/postOnboarding/hooks/useAllPostOnboardingActionsCompleted.js.map +1 -0
- package/lib/postOnboarding/hooks/useAllPostOnboardingActionsCompleted.test.d.ts +2 -0
- package/lib/postOnboarding/hooks/useAllPostOnboardingActionsCompleted.test.d.ts.map +1 -0
- package/lib/postOnboarding/hooks/useAllPostOnboardingActionsCompleted.test.js +75 -0
- package/lib/postOnboarding/hooks/useAllPostOnboardingActionsCompleted.test.js.map +1 -0
- package/lib/postOnboarding/hooks/usePostOnboardingContext.d.ts +3 -0
- package/lib/postOnboarding/hooks/usePostOnboardingContext.d.ts.map +1 -0
- package/lib/postOnboarding/hooks/usePostOnboardingContext.js +10 -0
- package/lib/postOnboarding/hooks/usePostOnboardingContext.js.map +1 -0
- package/lib/postOnboarding/hooks/usePostOnboardingEntryPointVisibleOnWallet.d.ts +8 -0
- package/lib/postOnboarding/hooks/usePostOnboardingEntryPointVisibleOnWallet.d.ts.map +1 -0
- package/lib/postOnboarding/hooks/usePostOnboardingEntryPointVisibleOnWallet.js +20 -0
- package/lib/postOnboarding/hooks/usePostOnboardingEntryPointVisibleOnWallet.js.map +1 -0
- package/lib/postOnboarding/hooks/usePostOnboardingEntryPointVisibleOnWallet.test.d.ts +2 -0
- package/lib/postOnboarding/hooks/usePostOnboardingEntryPointVisibleOnWallet.test.d.ts.map +1 -0
- package/lib/postOnboarding/hooks/usePostOnboardingEntryPointVisibleOnWallet.test.js +64 -0
- package/lib/postOnboarding/hooks/usePostOnboardingEntryPointVisibleOnWallet.test.js.map +1 -0
- package/lib/postOnboarding/hooks/usePostOnboardingHubState.d.ts +12 -0
- package/lib/postOnboarding/hooks/usePostOnboardingHubState.d.ts.map +1 -0
- package/lib/postOnboarding/hooks/usePostOnboardingHubState.js +65 -0
- package/lib/postOnboarding/hooks/usePostOnboardingHubState.js.map +1 -0
- package/lib/postOnboarding/hooks/usePostOnboardingHubState.test.d.ts +2 -0
- package/lib/postOnboarding/hooks/usePostOnboardingHubState.test.d.ts.map +1 -0
- package/lib/postOnboarding/hooks/usePostOnboardingHubState.test.js +129 -0
- package/lib/postOnboarding/hooks/usePostOnboardingHubState.test.js.map +1 -0
- package/lib/postOnboarding/hooks/useStartPostOnboardingCallback.d.ts +13 -0
- package/lib/postOnboarding/hooks/useStartPostOnboardingCallback.d.ts.map +1 -0
- package/lib/postOnboarding/hooks/useStartPostOnboardingCallback.js +34 -0
- package/lib/postOnboarding/hooks/useStartPostOnboardingCallback.js.map +1 -0
- package/lib/postOnboarding/mock.d.ts +8 -0
- package/lib/postOnboarding/mock.d.ts.map +1 -0
- package/lib/postOnboarding/mock.js +46 -0
- package/lib/postOnboarding/mock.js.map +1 -0
- package/lib/postOnboarding/reducer.d.ts +22 -0
- package/lib/postOnboarding/reducer.d.ts.map +1 -0
- package/lib/postOnboarding/reducer.js +71 -0
- package/lib/postOnboarding/reducer.js.map +1 -0
- package/lib/postOnboarding/reducer.test.d.ts +2 -0
- package/lib/postOnboarding/reducer.test.d.ts.map +1 -0
- package/lib/postOnboarding/reducer.test.js +251 -0
- package/lib/postOnboarding/reducer.test.js.map +1 -0
- package/package.json +24 -20
- package/src/__tests__/__snapshots__/portfolio.v2.ts.snap +16 -0
- package/src/apps/__snapshots__/logic.test.ts.snap +18 -11
- package/src/apps/logic.test.ts +1 -2
- package/src/apps/polyfill.test.ts +24 -0
- package/src/apps/polyfill.ts +7 -2
- package/src/apps/support.ts +2 -1
- package/src/bot/engine.ts +178 -35
- package/src/bot/formatters.ts +15 -2
- package/src/bot/index.ts +48 -19
- package/src/bot/specs.ts +95 -1
- package/src/bot/types.ts +23 -1
- package/src/currencies/__snapshots__/sortByMarketcap.test.ts.snap +55 -6
- package/src/currencies/sortByMarketcap.ts +6 -1
- package/src/currencies/support.ts +2 -1
- package/src/derivation.ts +2 -4
- package/src/env.ts +1 -1
- package/src/exchange/swap/getExchangeRates.ts +12 -5
- package/src/exchange/swap/getProviders.test.ts +450 -0
- package/src/exchange/swap/getProviders.ts +31 -8
- package/src/exchange/swap/hooks/useProviderRates.test.ts +43 -0
- package/src/exchange/swap/hooks/useProviderRates.ts +22 -3
- package/src/exchange/swap/hooks/useSwapTransaction.ts +3 -1
- package/src/exchange/swap/index.test.ts +36 -1
- package/src/exchange/swap/index.ts +15 -0
- package/src/exchange/swap/mock.ts +2 -2
- package/src/exchange/swap/types.ts +11 -0
- package/src/exchange/swap/utils/index.test.ts +19 -0
- package/src/exchange/swap/utils/index.ts +5 -0
- package/src/families/algorand/specs.ts +3 -1
- package/src/families/algorand/speculos-deviceActions.ts +4 -35
- package/src/families/bitcoin/specs.ts +72 -56
- package/src/families/bitcoin/speculos-deviceActions.ts +3 -26
- package/src/families/cardano/specs.ts +9 -4
- package/src/families/cardano/speculos-deviceActions.ts +3 -14
- package/src/families/celo/specs/createSendMutation.ts +5 -3
- package/src/families/celo/specs.ts +2 -0
- package/src/families/celo/speculos-deviceActions.ts +6 -14
- package/src/families/cosmos/__snapshots__/bridge.integration.test.ts.snap +24 -44
- package/src/families/cosmos/helpers.ts +21 -0
- package/src/families/cosmos/helpers.unit.test.ts +63 -0
- package/src/families/cosmos/js-signOperation.ts +6 -3
- package/src/families/cosmos/js-synchronisation.ts +120 -119
- package/src/families/cosmos/specs.ts +11 -2
- package/src/families/crypto_org/specs.ts +12 -19
- package/src/families/elrond/specs.ts +1 -0
- package/src/families/elrond/speculos-deviceActions.ts +4 -9
- package/src/families/ethereum/specs.ts +34 -38
- package/src/families/ethereum/speculos-deviceActions.ts +16 -46
- package/src/families/evm/specs.ts +18 -8
- package/src/families/evm/speculos-deviceActions.ts +7 -35
- package/src/families/filecoin/specs.ts +4 -1
- package/src/families/filecoin/speculos-deviceActions.ts +7 -8
- package/src/families/hedera/specs.ts +3 -1
- package/src/families/osmosis/specs.ts +4 -1
- package/src/families/polkadot/specs.ts +11 -2
- package/src/families/polkadot/speculos-deviceActions.ts +5 -16
- package/src/families/ripple/specs.ts +3 -1
- package/src/families/ripple/speculos-deviceActions.ts +3 -28
- package/src/families/solana/specs.ts +15 -4
- package/src/families/solana/speculos-deviceActions.ts +6 -8
- package/src/families/stellar/specs.ts +1 -0
- package/src/families/stellar/speculos-deviceActions.ts +5 -11
- package/src/families/tezos/specs.ts +7 -5
- package/src/families/tezos/speculos-deviceActions.ts +9 -16
- package/src/families/tron/specs.ts +31 -3
- package/src/families/tron/speculos-deviceActions.ts +4 -12
- package/src/families/tron/{synchronisation.test.ts → synchronisation.integration.test.ts} +0 -0
- package/src/featureFlags/defaultFeatures.ts +6 -0
- package/src/hw/actions/installLanguage.ts +1 -1
- package/src/hw/extractOnboardingState.test.ts +29 -12
- package/src/hw/extractOnboardingState.ts +17 -9
- package/src/load/speculos.ts +42 -21
- package/src/manager/hooks.ts +6 -6
- package/src/manager/localization.ts +2 -2
- package/src/mock/account.ts +18 -20
- package/src/notifications/ServiceStatusProvider/index.tsx +8 -1
- package/src/postOnboarding/PostOnboardingProvider.tsx +49 -0
- package/src/postOnboarding/actions.ts +40 -0
- package/src/postOnboarding/hooks/index.ts +5 -0
- package/src/postOnboarding/hooks/useAllPostOnboardingActionsCompleted.test.ts +82 -0
- package/src/postOnboarding/hooks/useAllPostOnboardingActionsCompleted.ts +12 -0
- package/src/postOnboarding/hooks/usePostOnboardingContext.ts +9 -0
- package/src/postOnboarding/hooks/usePostOnboardingEntryPointVisibleOnWallet.test.ts +83 -0
- package/src/postOnboarding/hooks/usePostOnboardingEntryPointVisibleOnWallet.ts +22 -0
- package/src/postOnboarding/hooks/usePostOnboardingHubState.test.ts +184 -0
- package/src/postOnboarding/hooks/usePostOnboardingHubState.ts +56 -0
- package/src/postOnboarding/hooks/useStartPostOnboardingCallback.ts +38 -0
- package/src/postOnboarding/mock.ts +53 -0
- package/src/postOnboarding/reducer.test.ts +247 -0
- package/src/postOnboarding/reducer.ts +105 -0
- package/lib/families/tron/synchronisation.test.d.ts +0 -2
- package/lib/families/tron/synchronisation.test.d.ts.map +0 -1
- package/lib/families/tron/synchronisation.test.js.map +0 -1
|
@@ -9,7 +9,12 @@ import type {
|
|
|
9
9
|
Transaction,
|
|
10
10
|
} from "../../families/polkadot/types";
|
|
11
11
|
import { getCryptoCurrencyById, parseCurrencyUnit } from "../../currencies";
|
|
12
|
-
import {
|
|
12
|
+
import {
|
|
13
|
+
botTest,
|
|
14
|
+
expectSiblingsHaveSpendablePartGreaterThan,
|
|
15
|
+
genericTestDestination,
|
|
16
|
+
pickSiblings,
|
|
17
|
+
} from "../../bot/specs";
|
|
13
18
|
import type { AppSpec } from "../../bot/types";
|
|
14
19
|
import { toOperationRaw } from "../../account";
|
|
15
20
|
import {
|
|
@@ -40,6 +45,7 @@ const polkadot: AppSpec<Transaction> = {
|
|
|
40
45
|
},
|
|
41
46
|
testTimeout: 2 * 60 * 1000,
|
|
42
47
|
genericDeviceAction: acceptTransaction,
|
|
48
|
+
minViableAmount: POLKADOT_MIN_SAFE,
|
|
43
49
|
transactionCheck: ({ maxSpendable }) => {
|
|
44
50
|
invariant(maxSpendable.gt(POLKADOT_MIN_SAFE), "balance is too low");
|
|
45
51
|
},
|
|
@@ -60,6 +66,7 @@ const polkadot: AppSpec<Transaction> = {
|
|
|
60
66
|
{
|
|
61
67
|
name: "send 50%~",
|
|
62
68
|
maxRun: 4,
|
|
69
|
+
testDestination: genericTestDestination,
|
|
63
70
|
transaction: ({ account, siblings, bridge }) => {
|
|
64
71
|
invariant((account as PolkadotAccount).polkadotResources, "polkadot");
|
|
65
72
|
const sibling = pickSiblings(siblings, maxAccounts);
|
|
@@ -105,7 +112,9 @@ const polkadot: AppSpec<Transaction> = {
|
|
|
105
112
|
{
|
|
106
113
|
name: "bond - bondExtra",
|
|
107
114
|
maxRun: 1,
|
|
108
|
-
transaction: ({ account, bridge }) => {
|
|
115
|
+
transaction: ({ siblings, account, bridge }) => {
|
|
116
|
+
expectSiblingsHaveSpendablePartGreaterThan(siblings, 0.5);
|
|
117
|
+
|
|
109
118
|
invariant((account as PolkadotAccount).polkadotResources, "polkadot");
|
|
110
119
|
invariant(canBond(account), "can't bond");
|
|
111
120
|
invariant(
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { DeviceAction } from "../../bot/types";
|
|
2
2
|
import type { PolkadotAccount, Transaction } from "./types";
|
|
3
|
-
import { deviceActionFlow } from "../../bot/specs";
|
|
4
|
-
import { formatCurrencyUnit } from "../../currencies";
|
|
3
|
+
import { deviceActionFlow, formatDeviceAmount } from "../../bot/specs";
|
|
5
4
|
|
|
6
5
|
export const acceptTransaction: DeviceAction<Transaction, any> =
|
|
7
6
|
deviceActionFlow({
|
|
@@ -22,20 +21,10 @@ export const acceptTransaction: DeviceAction<Transaction, any> =
|
|
|
22
21
|
{
|
|
23
22
|
title: "Amount",
|
|
24
23
|
button: "Rr",
|
|
25
|
-
expectedValue: ({ account, transaction }) =>
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
disableRounding: true,
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
if (!formattedValue.includes(".")) {
|
|
33
|
-
// if the value is pure integer, in the app it will automatically add an .0
|
|
34
|
-
return formattedValue + ".0";
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
return formattedValue;
|
|
38
|
-
},
|
|
24
|
+
expectedValue: ({ account, transaction }) =>
|
|
25
|
+
formatDeviceAmount(account.currency, transaction.amount, {
|
|
26
|
+
forceFloating: true,
|
|
27
|
+
}),
|
|
39
28
|
},
|
|
40
29
|
{
|
|
41
30
|
title: "Chain",
|
|
@@ -2,7 +2,7 @@ import expect from "expect";
|
|
|
2
2
|
import invariant from "invariant";
|
|
3
3
|
import type { Transaction } from "./types";
|
|
4
4
|
import { getCryptoCurrencyById, parseCurrencyUnit } from "../../currencies";
|
|
5
|
-
import { botTest, pickSiblings } from "../../bot/specs";
|
|
5
|
+
import { botTest, genericTestDestination, pickSiblings } from "../../bot/specs";
|
|
6
6
|
import type { AppSpec } from "../../bot/types";
|
|
7
7
|
import { DeviceModelId } from "@ledgerhq/devices";
|
|
8
8
|
import { acceptTransaction } from "./speculos-deviceActions";
|
|
@@ -19,10 +19,12 @@ const ripple: AppSpec<Transaction> = {
|
|
|
19
19
|
appName: "XRP",
|
|
20
20
|
},
|
|
21
21
|
genericDeviceAction: acceptTransaction,
|
|
22
|
+
minViableAmount: minAmountCutoff,
|
|
22
23
|
mutations: [
|
|
23
24
|
{
|
|
24
25
|
name: "move ~50%",
|
|
25
26
|
maxRun: 2,
|
|
27
|
+
testDestination: genericTestDestination,
|
|
26
28
|
transaction: ({ account, siblings, bridge, maxSpendable }) => {
|
|
27
29
|
invariant(maxSpendable.gt(minAmountCutoff), "balance is too low");
|
|
28
30
|
const transaction = bridge.createTransaction(account);
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { DeviceAction } from "../../bot/types";
|
|
2
2
|
import type { Transaction } from "./types";
|
|
3
|
-
import {
|
|
4
|
-
import { deviceActionFlow } from "../../bot/specs";
|
|
3
|
+
import { deviceActionFlow, formatDeviceAmount } from "../../bot/specs";
|
|
5
4
|
|
|
6
5
|
export const acceptTransaction: DeviceAction<Transaction, any> =
|
|
7
6
|
deviceActionFlow({
|
|
@@ -15,37 +14,13 @@ export const acceptTransaction: DeviceAction<Transaction, any> =
|
|
|
15
14
|
title: "Amount",
|
|
16
15
|
button: "Rr",
|
|
17
16
|
expectedValue: ({ account, status }) =>
|
|
18
|
-
|
|
19
|
-
{
|
|
20
|
-
...account.unit,
|
|
21
|
-
code: account.currency.deviceTicker || account.unit.code,
|
|
22
|
-
prefixCode: true,
|
|
23
|
-
},
|
|
24
|
-
status.amount,
|
|
25
|
-
{
|
|
26
|
-
showCode: true,
|
|
27
|
-
disableRounding: true,
|
|
28
|
-
joinFragmentsSeparator: " ",
|
|
29
|
-
}
|
|
30
|
-
).replace(/\s/g, " "),
|
|
17
|
+
formatDeviceAmount(account.currency, status.amount),
|
|
31
18
|
},
|
|
32
19
|
{
|
|
33
20
|
title: "Fee",
|
|
34
21
|
button: "Rr",
|
|
35
22
|
expectedValue: ({ account, status }) =>
|
|
36
|
-
|
|
37
|
-
{
|
|
38
|
-
...account.unit,
|
|
39
|
-
code: account.currency.deviceTicker || account.unit.code,
|
|
40
|
-
prefixCode: true,
|
|
41
|
-
},
|
|
42
|
-
status.estimatedFees,
|
|
43
|
-
{
|
|
44
|
-
showCode: true,
|
|
45
|
-
disableRounding: true,
|
|
46
|
-
joinFragmentsSeparator: " ",
|
|
47
|
-
}
|
|
48
|
-
).replace(/\s/g, " "),
|
|
23
|
+
formatDeviceAmount(account.currency, status.estimatedFees),
|
|
49
24
|
},
|
|
50
25
|
{
|
|
51
26
|
title: "Destination Tag",
|
|
@@ -2,7 +2,12 @@ import invariant from "invariant";
|
|
|
2
2
|
import expect from "expect";
|
|
3
3
|
import { getCryptoCurrencyById } from "@ledgerhq/cryptoassets";
|
|
4
4
|
import { DeviceModelId } from "@ledgerhq/devices";
|
|
5
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
botTest,
|
|
7
|
+
expectSiblingsHaveSpendablePartGreaterThan,
|
|
8
|
+
genericTestDestination,
|
|
9
|
+
pickSiblings,
|
|
10
|
+
} from "../../bot/specs";
|
|
6
11
|
import { AppSpec, TransactionTestInput } from "../../bot/types";
|
|
7
12
|
import { SolanaAccount, Transaction } from "./types";
|
|
8
13
|
import {
|
|
@@ -17,6 +22,8 @@ import { getCurrentSolanaPreloadData } from "./js-preload-data";
|
|
|
17
22
|
import { sample } from "lodash/fp";
|
|
18
23
|
import BigNumber from "bignumber.js";
|
|
19
24
|
|
|
25
|
+
const maxAccount = 9;
|
|
26
|
+
|
|
20
27
|
const solana: AppSpec<Transaction> = {
|
|
21
28
|
name: "Solana",
|
|
22
29
|
appQuery: {
|
|
@@ -32,11 +39,12 @@ const solana: AppSpec<Transaction> = {
|
|
|
32
39
|
{
|
|
33
40
|
name: "Transfer ~50%",
|
|
34
41
|
maxRun: 2,
|
|
42
|
+
testDestination: genericTestDestination,
|
|
35
43
|
deviceAction: acceptTransferTransaction,
|
|
36
44
|
transaction: ({ account, siblings, bridge, maxSpendable }) => {
|
|
37
45
|
invariant(maxSpendable.gt(0), "balance is 0");
|
|
38
46
|
const transaction = bridge.createTransaction(account);
|
|
39
|
-
const sibling = pickSiblings(siblings);
|
|
47
|
+
const sibling = pickSiblings(siblings, maxAccount);
|
|
40
48
|
const recipient = sibling.freshAddress;
|
|
41
49
|
const amount = account.spendableBalance
|
|
42
50
|
.div(1.9 + 0.2 * Math.random())
|
|
@@ -54,11 +62,12 @@ const solana: AppSpec<Transaction> = {
|
|
|
54
62
|
{
|
|
55
63
|
name: "Transfer Max",
|
|
56
64
|
maxRun: 1,
|
|
65
|
+
testDestination: genericTestDestination,
|
|
57
66
|
deviceAction: acceptTransferTransaction,
|
|
58
67
|
transaction: ({ account, siblings, bridge, maxSpendable }) => {
|
|
59
68
|
invariant(maxSpendable.gt(0), "balance is 0");
|
|
60
69
|
const transaction = bridge.createTransaction(account);
|
|
61
|
-
const sibling = pickSiblings(siblings);
|
|
70
|
+
const sibling = pickSiblings(siblings, maxAccount);
|
|
62
71
|
const recipient = sibling.freshAddress;
|
|
63
72
|
return {
|
|
64
73
|
transaction,
|
|
@@ -78,7 +87,9 @@ const solana: AppSpec<Transaction> = {
|
|
|
78
87
|
name: "Delegate",
|
|
79
88
|
maxRun: 1,
|
|
80
89
|
deviceAction: acceptStakeCreateAccountTransaction,
|
|
81
|
-
transaction: ({ account, bridge }) => {
|
|
90
|
+
transaction: ({ account, bridge, siblings }) => {
|
|
91
|
+
expectSiblingsHaveSpendablePartGreaterThan(siblings, 0.5);
|
|
92
|
+
|
|
82
93
|
const { solanaResources } = account as SolanaAccount;
|
|
83
94
|
if (solanaResources === undefined) {
|
|
84
95
|
throw new Error("solana resources required");
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { DeviceAction } from "../../bot/types";
|
|
2
2
|
import type { Transaction } from "./types";
|
|
3
|
-
import {
|
|
4
|
-
import { deviceActionFlow } from "../../bot/specs";
|
|
3
|
+
import { deviceActionFlow, formatDeviceAmount } from "../../bot/specs";
|
|
5
4
|
import { getCryptoCurrencyById } from "@ledgerhq/cryptoassets";
|
|
6
5
|
import BigNumber from "bignumber.js";
|
|
7
6
|
import type { CryptoCurrency } from "@ledgerhq/types-cryptoassets";
|
|
@@ -17,12 +16,11 @@ function ellipsis(str: string) {
|
|
|
17
16
|
return `${str.slice(0, 7)}..${str.slice(-7)}`;
|
|
18
17
|
}
|
|
19
18
|
|
|
20
|
-
function formatAmount(
|
|
21
|
-
const
|
|
22
|
-
return
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}).replace(/\s/g, " ");
|
|
19
|
+
function formatAmount(c: CryptoCurrency, amount: number) {
|
|
20
|
+
const currency = getMainCurrency(c);
|
|
21
|
+
return formatDeviceAmount(currency, new BigNumber(amount), {
|
|
22
|
+
postfixCode: true,
|
|
23
|
+
});
|
|
26
24
|
}
|
|
27
25
|
|
|
28
26
|
export const acceptTransferTransaction: DeviceAction<Transaction, any> =
|
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
import type { DeviceAction } from "../../bot/types";
|
|
2
2
|
import type { Transaction } from "./types";
|
|
3
3
|
import { formatCurrencyUnit } from "../../currencies";
|
|
4
|
-
import { deviceActionFlow } from "../../bot/specs";
|
|
4
|
+
import { deviceActionFlow, formatDeviceAmount } from "../../bot/specs";
|
|
5
5
|
|
|
6
6
|
const expectedAmount = ({ account, status, transaction }) => {
|
|
7
7
|
if (transaction.assetCode && transaction.assetIssuer) {
|
|
8
|
-
const amount =
|
|
9
|
-
disableRounding: true,
|
|
10
|
-
useGrouping: false,
|
|
11
|
-
});
|
|
8
|
+
const amount = formatDeviceAmount(account.currency, status.amount);
|
|
12
9
|
|
|
13
10
|
return `${amount} ${transaction.assetCode}@${truncateAddress(
|
|
14
11
|
transaction.assetIssuer,
|
|
@@ -17,12 +14,9 @@ const expectedAmount = ({ account, status, transaction }) => {
|
|
|
17
14
|
)}`;
|
|
18
15
|
}
|
|
19
16
|
|
|
20
|
-
return (
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
useGrouping: false,
|
|
24
|
-
}) + " XLM"
|
|
25
|
-
);
|
|
17
|
+
return formatDeviceAmount(account.currency, status.amount, {
|
|
18
|
+
postfixCode: true,
|
|
19
|
+
});
|
|
26
20
|
};
|
|
27
21
|
|
|
28
22
|
const truncateAddress = (stellarAddress: string, start = 6, end = 6) =>
|
|
@@ -3,7 +3,7 @@ import sample from "lodash/sample";
|
|
|
3
3
|
import invariant from "invariant";
|
|
4
4
|
import type { Transaction } from "./types";
|
|
5
5
|
import { getCryptoCurrencyById, parseCurrencyUnit } from "../../currencies";
|
|
6
|
-
import { pickSiblings } from "../../bot/specs";
|
|
6
|
+
import { genericTestDestination, pickSiblings } from "../../bot/specs";
|
|
7
7
|
import type { AppSpec } from "../../bot/types";
|
|
8
8
|
import { DeviceModelId } from "@ledgerhq/devices";
|
|
9
9
|
import { getAccountDelegationSync, isAccountDelegating } from "./bakers";
|
|
@@ -28,6 +28,7 @@ function expectRevealed(account) {
|
|
|
28
28
|
const tezosUnit = getCryptoCurrencyById("tezos").units[0];
|
|
29
29
|
|
|
30
30
|
const safeMinimumForDestinationNotCreated = parseCurrencyUnit(tezosUnit, "0.6");
|
|
31
|
+
const strictMin = parseCurrencyUnit(tezosUnit, "0.02");
|
|
31
32
|
|
|
32
33
|
const tezos: AppSpec<Transaction> = {
|
|
33
34
|
name: "Tezos",
|
|
@@ -38,16 +39,15 @@ const tezos: AppSpec<Transaction> = {
|
|
|
38
39
|
},
|
|
39
40
|
genericDeviceAction: acceptTransaction,
|
|
40
41
|
testTimeout: 2 * 60 * 1000,
|
|
42
|
+
minViableAmount: strictMin,
|
|
41
43
|
transactionCheck: ({ maxSpendable }) => {
|
|
42
|
-
invariant(
|
|
43
|
-
maxSpendable.gt(parseCurrencyUnit(tezosUnit, "0.02")),
|
|
44
|
-
"balance is too low"
|
|
45
|
-
);
|
|
44
|
+
invariant(maxSpendable.gt(strictMin), "balance is too low");
|
|
46
45
|
},
|
|
47
46
|
mutations: [
|
|
48
47
|
{
|
|
49
48
|
name: "send unrevealed",
|
|
50
49
|
maxRun: 1,
|
|
50
|
+
testDestination: genericTestDestination,
|
|
51
51
|
transaction: ({ maxSpendable, account, siblings, bridge }) => {
|
|
52
52
|
expectUnrevealed(account);
|
|
53
53
|
const sibling = pickSiblings(siblings, maxAccount);
|
|
@@ -68,6 +68,7 @@ const tezos: AppSpec<Transaction> = {
|
|
|
68
68
|
{
|
|
69
69
|
name: "send revealed",
|
|
70
70
|
maxRun: 2,
|
|
71
|
+
testDestination: genericTestDestination,
|
|
71
72
|
transaction: ({ maxSpendable, account, siblings, bridge }) => {
|
|
72
73
|
expectRevealed(account);
|
|
73
74
|
const sibling = pickSiblings(siblings, maxAccount);
|
|
@@ -88,6 +89,7 @@ const tezos: AppSpec<Transaction> = {
|
|
|
88
89
|
{
|
|
89
90
|
name: "send max (non delegating)",
|
|
90
91
|
maxRun: 3,
|
|
92
|
+
testDestination: genericTestDestination,
|
|
91
93
|
transaction: ({ account, siblings, bridge, maxSpendable }) => {
|
|
92
94
|
invariant(
|
|
93
95
|
!isAccountDelegating(account),
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
// @flow
|
|
2
2
|
import type { DeviceAction } from "../../bot/types";
|
|
3
3
|
import type { Transaction } from "./types";
|
|
4
|
-
import {
|
|
5
|
-
import { deviceActionFlow } from "../../bot/specs";
|
|
4
|
+
import { deviceActionFlow, formatDeviceAmount } from "../../bot/specs";
|
|
6
5
|
|
|
7
6
|
export const acceptTransaction: DeviceAction<Transaction, any> =
|
|
8
7
|
deviceActionFlow({
|
|
@@ -38,24 +37,18 @@ export const acceptTransaction: DeviceAction<Transaction, any> =
|
|
|
38
37
|
{
|
|
39
38
|
title: "Amount",
|
|
40
39
|
button: "Rr",
|
|
41
|
-
expectedValue: ({ account, transaction }) =>
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
joinFragmentsSeparator: " ",
|
|
46
|
-
}).replace(/\s/g, " ");
|
|
47
|
-
},
|
|
40
|
+
expectedValue: ({ account, transaction }) =>
|
|
41
|
+
formatDeviceAmount(account.currency, transaction.amount, {
|
|
42
|
+
hideCode: true,
|
|
43
|
+
}),
|
|
48
44
|
},
|
|
49
45
|
{
|
|
50
46
|
title: "Fee",
|
|
51
47
|
button: "Rr",
|
|
52
|
-
expectedValue: ({ account, status }) =>
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
joinFragmentsSeparator: " ",
|
|
57
|
-
}).replace(/\s/g, " ");
|
|
58
|
-
},
|
|
48
|
+
expectedValue: ({ account, status }) =>
|
|
49
|
+
formatDeviceAmount(account.currency, status.estimatedFees, {
|
|
50
|
+
hideCode: true,
|
|
51
|
+
}),
|
|
59
52
|
},
|
|
60
53
|
{
|
|
61
54
|
title: "Source",
|
|
@@ -7,8 +7,12 @@ import sampleSize from "lodash/sampleSize";
|
|
|
7
7
|
import get from "lodash/get";
|
|
8
8
|
import type { Transaction, TronAccount } from "./types";
|
|
9
9
|
import { getCryptoCurrencyById, parseCurrencyUnit } from "../../currencies";
|
|
10
|
-
import {
|
|
11
|
-
|
|
10
|
+
import {
|
|
11
|
+
botTest,
|
|
12
|
+
expectSiblingsHaveSpendablePartGreaterThan,
|
|
13
|
+
pickSiblings,
|
|
14
|
+
} from "../../bot/specs";
|
|
15
|
+
import type { AppSpec, TransactionDestinationTestInput } from "../../bot/types";
|
|
12
16
|
import { getUnfreezeData, getNextRewardDate } from "./react";
|
|
13
17
|
import { DeviceModelId } from "@ledgerhq/devices";
|
|
14
18
|
import { SubAccount } from "@ledgerhq/types-live";
|
|
@@ -20,6 +24,7 @@ const maxAccount = 10;
|
|
|
20
24
|
const getDecimalPart = (value: BigNumber, magnitude: number) =>
|
|
21
25
|
value.minus(value.modulo(10 ** magnitude));
|
|
22
26
|
|
|
27
|
+
// FIXME TRON have a bug where the amounts from the API have imprecisions
|
|
23
28
|
const expectedApproximate = (
|
|
24
29
|
value: BigNumber,
|
|
25
30
|
expected: BigNumber,
|
|
@@ -30,6 +35,24 @@ const expectedApproximate = (
|
|
|
30
35
|
}
|
|
31
36
|
};
|
|
32
37
|
|
|
38
|
+
const testDestination = <T>({
|
|
39
|
+
destination,
|
|
40
|
+
operation,
|
|
41
|
+
destinationBeforeTransaction,
|
|
42
|
+
sendingOperation,
|
|
43
|
+
}: TransactionDestinationTestInput<T>): void => {
|
|
44
|
+
const amount = sendingOperation.value.minus(sendingOperation.fee);
|
|
45
|
+
botTest("account balance increased with transaction amount", () =>
|
|
46
|
+
expectedApproximate(
|
|
47
|
+
destination.balance,
|
|
48
|
+
destinationBeforeTransaction.balance.plus(amount)
|
|
49
|
+
)
|
|
50
|
+
);
|
|
51
|
+
botTest("operation amount is consistent with sendingOperation", () =>
|
|
52
|
+
expectedApproximate(operation.value, amount)
|
|
53
|
+
);
|
|
54
|
+
};
|
|
55
|
+
|
|
33
56
|
const tron: AppSpec<Transaction> = {
|
|
34
57
|
name: "Tron",
|
|
35
58
|
currency,
|
|
@@ -39,10 +62,12 @@ const tron: AppSpec<Transaction> = {
|
|
|
39
62
|
},
|
|
40
63
|
genericDeviceAction: acceptTransaction,
|
|
41
64
|
testTimeout: 2 * 60 * 1000,
|
|
65
|
+
minViableAmount: minimalAmount,
|
|
42
66
|
mutations: [
|
|
43
67
|
{
|
|
44
68
|
name: "move 50% to another account",
|
|
45
69
|
maxRun: 2,
|
|
70
|
+
testDestination,
|
|
46
71
|
transaction: ({ account, siblings, bridge, maxSpendable }) => {
|
|
47
72
|
invariant(maxSpendable.gt(minimalAmount), "balance is too low");
|
|
48
73
|
const sibling = pickSiblings(siblings, maxAccount);
|
|
@@ -72,6 +97,7 @@ const tron: AppSpec<Transaction> = {
|
|
|
72
97
|
{
|
|
73
98
|
name: "send max to another account",
|
|
74
99
|
maxRun: 1,
|
|
100
|
+
testDestination,
|
|
75
101
|
transaction: ({ account, siblings, bridge, maxSpendable }) => {
|
|
76
102
|
invariant(maxSpendable.gt(minimalAmount), "balance is too low");
|
|
77
103
|
const sibling = pickSiblings(siblings, maxAccount);
|
|
@@ -97,7 +123,9 @@ const tron: AppSpec<Transaction> = {
|
|
|
97
123
|
{
|
|
98
124
|
name: "freeze 25% to bandwidth | energy",
|
|
99
125
|
maxRun: 1,
|
|
100
|
-
transaction: ({ account, bridge, maxSpendable }) => {
|
|
126
|
+
transaction: ({ siblings, account, bridge, maxSpendable }) => {
|
|
127
|
+
expectSiblingsHaveSpendablePartGreaterThan(siblings, 0.5);
|
|
128
|
+
|
|
101
129
|
invariant(maxSpendable.gt(minimalAmount), "balance is too low");
|
|
102
130
|
let amount = getDecimalPart(
|
|
103
131
|
maxSpendable.div(4),
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { DeviceAction } from "../../bot/types";
|
|
2
|
-
import { deviceActionFlow } from "../../bot/specs";
|
|
3
|
-
import { formatCurrencyUnit } from "../../currencies";
|
|
2
|
+
import { deviceActionFlow, formatDeviceAmount } from "../../bot/specs";
|
|
4
3
|
import type { Transaction, Vote } from "./types";
|
|
5
4
|
|
|
6
5
|
function subAccount(subAccountId, account) {
|
|
@@ -40,16 +39,9 @@ export const acceptTransaction: DeviceAction<Transaction, any> =
|
|
|
40
39
|
title: "Amount",
|
|
41
40
|
button: "Rr",
|
|
42
41
|
expectedValue: ({ account, status }) =>
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
code: account.currency.deviceTicker || account.unit.code,
|
|
47
|
-
},
|
|
48
|
-
status.amount,
|
|
49
|
-
{
|
|
50
|
-
disableRounding: true,
|
|
51
|
-
}
|
|
52
|
-
),
|
|
42
|
+
formatDeviceAmount(account.currency, status.amount, {
|
|
43
|
+
hideCode: true,
|
|
44
|
+
}),
|
|
53
45
|
},
|
|
54
46
|
{
|
|
55
47
|
title: "Token",
|
|
File without changes
|
|
@@ -7,6 +7,9 @@ export const defaultFeatures: DefaultFeatures = {
|
|
|
7
7
|
pushNotifications: {
|
|
8
8
|
enabled: false,
|
|
9
9
|
},
|
|
10
|
+
deviceLocalization: {
|
|
11
|
+
enabled: false,
|
|
12
|
+
},
|
|
10
13
|
buyDeviceFromLive: {
|
|
11
14
|
enabled: false,
|
|
12
15
|
params: {
|
|
@@ -109,4 +112,7 @@ export const defaultFeatures: DefaultFeatures = {
|
|
|
109
112
|
ptxSmartRoutingMobile: {
|
|
110
113
|
enabled: false,
|
|
111
114
|
},
|
|
115
|
+
mockFeature: {
|
|
116
|
+
enabled: false,
|
|
117
|
+
},
|
|
112
118
|
};
|
|
@@ -137,7 +137,7 @@ const implementations = {
|
|
|
137
137
|
const POLLING = 2000;
|
|
138
138
|
const INIT_DEBOUNCE = 5000;
|
|
139
139
|
const DISCONNECT_DEBOUNCE = 5000;
|
|
140
|
-
const DEVICE_POLLING_TIMEOUT =
|
|
140
|
+
const DEVICE_POLLING_TIMEOUT = 30000;
|
|
141
141
|
// this pattern allows to actually support events based (like if deviceSubject emits new device changes) but inside polling paradigm
|
|
142
142
|
let pollingOnDevice;
|
|
143
143
|
const sub = deviceSubject.subscribe((d) => {
|
|
@@ -44,23 +44,40 @@ describe("@hw/extractOnboardingState", () => {
|
|
|
44
44
|
});
|
|
45
45
|
|
|
46
46
|
describe("and the user is on the welcome screen", () => {
|
|
47
|
-
|
|
47
|
+
it("should return an onboarding step that is set at the welcome screen", () => {
|
|
48
48
|
flagsBytes[3] = 0;
|
|
49
|
-
|
|
49
|
+
let onboardingState = extractOnboardingState(flagsBytes);
|
|
50
|
+
expect(onboardingState).not.toBeNull();
|
|
51
|
+
expect(onboardingState?.currentOnboardingStep).toBe(
|
|
52
|
+
OnboardingStep.WelcomeScreen1
|
|
53
|
+
);
|
|
50
54
|
|
|
51
|
-
|
|
52
|
-
|
|
55
|
+
flagsBytes[3] = 1;
|
|
56
|
+
onboardingState = extractOnboardingState(flagsBytes);
|
|
57
|
+
expect(onboardingState).not.toBeNull();
|
|
58
|
+
expect(onboardingState?.currentOnboardingStep).toBe(
|
|
59
|
+
OnboardingStep.WelcomeScreen2
|
|
60
|
+
);
|
|
61
|
+
|
|
62
|
+
flagsBytes[3] = 2;
|
|
63
|
+
onboardingState = extractOnboardingState(flagsBytes);
|
|
64
|
+
expect(onboardingState).not.toBeNull();
|
|
65
|
+
expect(onboardingState?.currentOnboardingStep).toBe(
|
|
66
|
+
OnboardingStep.WelcomeScreen3
|
|
67
|
+
);
|
|
53
68
|
|
|
69
|
+
flagsBytes[3] = 3;
|
|
70
|
+
onboardingState = extractOnboardingState(flagsBytes);
|
|
54
71
|
expect(onboardingState).not.toBeNull();
|
|
55
72
|
expect(onboardingState?.currentOnboardingStep).toBe(
|
|
56
|
-
OnboardingStep.
|
|
73
|
+
OnboardingStep.WelcomeScreen4
|
|
57
74
|
);
|
|
58
75
|
});
|
|
59
76
|
});
|
|
60
77
|
|
|
61
78
|
describe("and the user is choosing what kind of setup they want", () => {
|
|
62
79
|
beforeEach(() => {
|
|
63
|
-
flagsBytes[3] =
|
|
80
|
+
flagsBytes[3] = 5;
|
|
64
81
|
});
|
|
65
82
|
|
|
66
83
|
it("should return an onboarding step that is set at the setup choice", () => {
|
|
@@ -75,7 +92,7 @@ describe("@hw/extractOnboardingState", () => {
|
|
|
75
92
|
|
|
76
93
|
describe("and the user is setting their pin", () => {
|
|
77
94
|
beforeEach(() => {
|
|
78
|
-
flagsBytes[3] =
|
|
95
|
+
flagsBytes[3] = 6;
|
|
79
96
|
});
|
|
80
97
|
|
|
81
98
|
it("should return an onboarding step that is set at setting the pin", () => {
|
|
@@ -104,7 +121,7 @@ describe("@hw/extractOnboardingState", () => {
|
|
|
104
121
|
|
|
105
122
|
describe("and the user is writing the seed word i", () => {
|
|
106
123
|
beforeEach(() => {
|
|
107
|
-
flagsBytes[3] =
|
|
124
|
+
flagsBytes[3] = 7;
|
|
108
125
|
});
|
|
109
126
|
|
|
110
127
|
it("should return an onboarding step that is set at writting the seed phrase", () => {
|
|
@@ -131,7 +148,7 @@ describe("@hw/extractOnboardingState", () => {
|
|
|
131
148
|
|
|
132
149
|
describe("and the user is confirming the seed word i", () => {
|
|
133
150
|
beforeEach(() => {
|
|
134
|
-
flagsBytes[3] =
|
|
151
|
+
flagsBytes[3] = 8;
|
|
135
152
|
});
|
|
136
153
|
|
|
137
154
|
it("should return an onboarding step that is set at confirming the seed phrase", () => {
|
|
@@ -190,7 +207,7 @@ describe("@hw/extractOnboardingState", () => {
|
|
|
190
207
|
// 24-words seed
|
|
191
208
|
flagsBytes[2] |= 0 << 5;
|
|
192
209
|
|
|
193
|
-
flagsBytes[3] =
|
|
210
|
+
flagsBytes[3] = 9;
|
|
194
211
|
});
|
|
195
212
|
|
|
196
213
|
it("should return an onboarding step that is set at confirming the restored seed phrase", () => {
|
|
@@ -219,7 +236,7 @@ describe("@hw/extractOnboardingState", () => {
|
|
|
219
236
|
|
|
220
237
|
describe("and the user is on the safety warning screen", () => {
|
|
221
238
|
beforeEach(() => {
|
|
222
|
-
flagsBytes[3] =
|
|
239
|
+
flagsBytes[3] = 10;
|
|
223
240
|
});
|
|
224
241
|
|
|
225
242
|
it("should return an onboarding step that is set at the safety warning screen", () => {
|
|
@@ -234,7 +251,7 @@ describe("@hw/extractOnboardingState", () => {
|
|
|
234
251
|
|
|
235
252
|
describe("and the user finished the onboarding process", () => {
|
|
236
253
|
beforeEach(() => {
|
|
237
|
-
flagsBytes[3] =
|
|
254
|
+
flagsBytes[3] = 11;
|
|
238
255
|
});
|
|
239
256
|
|
|
240
257
|
it("should return an onboarding step that is set at ready", () => {
|
|
@@ -16,7 +16,11 @@ const fromBitsToSeedPhraseType = new Map<number, SeedPhraseType>([
|
|
|
16
16
|
]);
|
|
17
17
|
|
|
18
18
|
export enum OnboardingStep {
|
|
19
|
-
|
|
19
|
+
WelcomeScreen1 = "WELCOME_SCREEN_1",
|
|
20
|
+
WelcomeScreen2 = "WELCOME_SCREEN_2",
|
|
21
|
+
WelcomeScreen3 = "WELCOME_SCREEN_3",
|
|
22
|
+
WelcomeScreen4 = "WELCOME_SCREEN_4",
|
|
23
|
+
WelcomeScreenReminder = "WELCOME_SCREEN_REMINDER",
|
|
20
24
|
SetupChoice = "SETUP_CHOICE",
|
|
21
25
|
Pin = "PIN",
|
|
22
26
|
NewDevice = "NEW_DEVICE", // path "new device" & currentSeedWordIndex available
|
|
@@ -27,14 +31,18 @@ export enum OnboardingStep {
|
|
|
27
31
|
}
|
|
28
32
|
|
|
29
33
|
const fromBitsToOnboardingStep = new Map<number, OnboardingStep>([
|
|
30
|
-
[0, OnboardingStep.
|
|
31
|
-
[1, OnboardingStep.
|
|
32
|
-
[2, OnboardingStep.
|
|
33
|
-
[3, OnboardingStep.
|
|
34
|
-
[4, OnboardingStep.
|
|
35
|
-
[5, OnboardingStep.
|
|
36
|
-
[6, OnboardingStep.
|
|
37
|
-
[7, OnboardingStep.
|
|
34
|
+
[0, OnboardingStep.WelcomeScreen1],
|
|
35
|
+
[1, OnboardingStep.WelcomeScreen2],
|
|
36
|
+
[2, OnboardingStep.WelcomeScreen3],
|
|
37
|
+
[3, OnboardingStep.WelcomeScreen4],
|
|
38
|
+
[4, OnboardingStep.WelcomeScreenReminder],
|
|
39
|
+
[5, OnboardingStep.SetupChoice],
|
|
40
|
+
[6, OnboardingStep.Pin],
|
|
41
|
+
[7, OnboardingStep.NewDevice],
|
|
42
|
+
[8, OnboardingStep.NewDeviceConfirming],
|
|
43
|
+
[9, OnboardingStep.RestoreSeed],
|
|
44
|
+
[10, OnboardingStep.SafetyWarning],
|
|
45
|
+
[11, OnboardingStep.Ready],
|
|
38
46
|
]);
|
|
39
47
|
|
|
40
48
|
export type OnboardingState = {
|