@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
|
@@ -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 {
|
|
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 =
|
|
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 {
|
|
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
|
-
|
|
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
|
-
:
|
|
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 =
|
|
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
|
-
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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 {
|
|
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
|
-
|
|
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
|
-
|
|
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,
|
|
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,
|
|
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,
|
|
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 {
|
|
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
|
-
|
|
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
|
-
|
|
52
|
+
formatDeviceAmount(account.currency, status.estimatedFees),
|
|
64
53
|
},
|
|
65
54
|
{
|
|
66
55
|
title: "Transaction TTL",
|