@ledgerhq/live-common 31.0.0 → 31.1.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/countervalues/api/api.d.ts.map +1 -1
- package/lib/countervalues/api/api.js +12 -18
- package/lib/countervalues/api/api.js.map +1 -1
- package/lib/countervalues/helpers.d.ts +2 -0
- package/lib/countervalues/helpers.d.ts.map +1 -1
- package/lib/countervalues/helpers.js +19 -5
- package/lib/countervalues/helpers.js.map +1 -1
- package/lib/countervalues/logic.d.ts.map +1 -1
- package/lib/countervalues/logic.integration.test.js.map +1 -1
- package/lib/countervalues/logic.js +1 -0
- package/lib/countervalues/logic.js.map +1 -1
- package/lib/countervalues/react.d.ts.map +1 -1
- package/lib/countervalues/react.js +9 -7
- package/lib/countervalues/react.js.map +1 -1
- package/lib/countervalues/react.test.d.ts +2 -0
- package/lib/countervalues/react.test.d.ts.map +1 -0
- package/lib/countervalues/react.test.js +107 -0
- package/lib/countervalues/react.test.js.map +1 -0
- package/lib/data/icons/react/euroc.d.ts +8 -0
- package/lib/data/icons/react/euroc.d.ts.map +1 -0
- package/lib/data/icons/react/euroc.js +36 -0
- package/lib/data/icons/react/euroc.js.map +1 -0
- package/lib/data/icons/react/index.d.ts +1 -0
- package/lib/data/icons/react/index.d.ts.map +1 -1
- package/lib/data/icons/react/index.js +9 -7
- package/lib/data/icons/react/index.js.map +1 -1
- package/lib/data/icons/reactNative/euroc.d.ts +8 -0
- package/lib/data/icons/reactNative/euroc.d.ts.map +1 -0
- package/lib/data/icons/reactNative/euroc.js +37 -0
- package/lib/data/icons/reactNative/euroc.js.map +1 -0
- package/lib/data/icons/reactNative/index.d.ts +1 -0
- package/lib/data/icons/reactNative/index.d.ts.map +1 -1
- package/lib/data/icons/reactNative/index.js +9 -7
- package/lib/data/icons/reactNative/index.js.map +1 -1
- package/lib/deviceSDK/actions/toggleOnboardingEarlyCheck.d.ts +32 -0
- package/lib/deviceSDK/actions/toggleOnboardingEarlyCheck.d.ts.map +1 -0
- package/lib/deviceSDK/actions/toggleOnboardingEarlyCheck.js +39 -0
- package/lib/deviceSDK/actions/toggleOnboardingEarlyCheck.js.map +1 -0
- package/lib/deviceSDK/commands/toggleOnboardingEarlyCheck.d.ts +27 -0
- package/lib/deviceSDK/commands/toggleOnboardingEarlyCheck.d.ts.map +1 -0
- package/lib/deviceSDK/commands/toggleOnboardingEarlyCheck.js +37 -0
- package/lib/deviceSDK/commands/toggleOnboardingEarlyCheck.js.map +1 -0
- package/lib/deviceSDK/commands/toggleOnboardingEarlyCheck.test.d.ts +2 -0
- package/lib/deviceSDK/commands/toggleOnboardingEarlyCheck.test.d.ts.map +1 -0
- package/lib/deviceSDK/commands/toggleOnboardingEarlyCheck.test.js +81 -0
- package/lib/deviceSDK/commands/toggleOnboardingEarlyCheck.test.js.map +1 -0
- package/lib/deviceSDK/hooks/useToggleOnboardingEarlyChecks.d.ts +33 -0
- package/lib/deviceSDK/hooks/useToggleOnboardingEarlyChecks.d.ts.map +1 -0
- package/lib/deviceSDK/hooks/useToggleOnboardingEarlyChecks.js +53 -0
- package/lib/deviceSDK/hooks/useToggleOnboardingEarlyChecks.js.map +1 -0
- package/lib/deviceSDK/hooks/useToggleOnboardingEarlyChecks.test.d.ts +2 -0
- package/lib/deviceSDK/hooks/useToggleOnboardingEarlyChecks.test.d.ts.map +1 -0
- package/lib/deviceSDK/hooks/useToggleOnboardingEarlyChecks.test.js +93 -0
- package/lib/deviceSDK/hooks/useToggleOnboardingEarlyChecks.test.js.map +1 -0
- package/lib/deviceSDK/tasks/core.js.map +1 -1
- package/lib/deviceSDK/tasks/toggleOnboardingEarlyCheck.d.ts +30 -0
- package/lib/deviceSDK/tasks/toggleOnboardingEarlyCheck.d.ts.map +1 -0
- package/lib/deviceSDK/tasks/toggleOnboardingEarlyCheck.js +64 -0
- package/lib/deviceSDK/tasks/toggleOnboardingEarlyCheck.js.map +1 -0
- package/lib/deviceSDK/tasks/toggleOnboardingEarlyCheck.test.d.ts +2 -0
- package/lib/deviceSDK/tasks/toggleOnboardingEarlyCheck.test.d.ts.map +1 -0
- package/lib/deviceSDK/tasks/toggleOnboardingEarlyCheck.test.js +100 -0
- package/lib/deviceSDK/tasks/toggleOnboardingEarlyCheck.test.js.map +1 -0
- package/lib/families/bitcoin/descriptor.d.ts.map +1 -1
- package/lib/families/bitcoin/descriptor.js.map +1 -1
- package/lib/families/bitcoin/satstack.d.ts +1 -0
- package/lib/families/bitcoin/satstack.d.ts.map +1 -1
- package/lib/families/bitcoin/satstack.js.map +1 -1
- package/lib/families/bitcoin/walletApiAdapter.js +4 -4
- package/lib/families/bitcoin/walletApiAdapter.js.map +1 -1
- package/lib/families/bitcoin/walletApiAdapter.test.js +9 -2
- package/lib/families/bitcoin/walletApiAdapter.test.js.map +1 -1
- package/lib/families/cosmos/api/Cosmos.d.ts +2 -0
- package/lib/families/cosmos/api/Cosmos.d.ts.map +1 -1
- package/lib/families/cosmos/api/Cosmos.js +34 -10
- package/lib/families/cosmos/api/Cosmos.js.map +1 -1
- package/lib/families/cosmos/helpers.d.ts +2 -8
- package/lib/families/cosmos/helpers.d.ts.map +1 -1
- package/lib/families/cosmos/helpers.js.map +1 -1
- package/lib/families/cosmos/helpers.unit.test.js +8 -8
- package/lib/families/cosmos/js-synchronisation.d.ts.map +1 -1
- package/lib/families/cosmos/js-synchronisation.js +40 -22
- package/lib/families/cosmos/js-synchronisation.js.map +1 -1
- package/lib/families/cosmos/js-synchronisation.unit.test.d.ts +2 -0
- package/lib/families/cosmos/js-synchronisation.unit.test.d.ts.map +1 -0
- package/lib/families/cosmos/js-synchronisation.unit.test.js +309 -0
- package/lib/families/cosmos/js-synchronisation.unit.test.js.map +1 -0
- package/lib/families/cosmos/react.d.ts +1 -1
- package/lib/families/cosmos/react.d.ts.map +1 -1
- package/lib/families/cosmos/react.js +7 -3
- package/lib/families/cosmos/react.js.map +1 -1
- package/lib/families/cosmos/types.d.ts +9 -8
- package/lib/families/cosmos/types.d.ts.map +1 -1
- package/lib/families/ethereum/walletApiAdapter.d.ts +3 -1
- package/lib/families/ethereum/walletApiAdapter.d.ts.map +1 -1
- package/lib/families/ethereum/walletApiAdapter.js +24 -6
- package/lib/families/ethereum/walletApiAdapter.js.map +1 -1
- package/lib/families/ethereum/walletApiAdapter.test.js +10 -3
- package/lib/families/ethereum/walletApiAdapter.test.js.map +1 -1
- package/lib/families/near/api/archive-node-sdk.d.ts.map +1 -1
- package/lib/families/near/api/archive-node-sdk.js +1 -2
- package/lib/families/near/api/archive-node-sdk.js.map +1 -1
- package/lib/families/polkadot/walletApiAdapter.js +3 -3
- package/lib/families/polkadot/walletApiAdapter.js.map +1 -1
- package/lib/families/polkadot/walletApiAdapter.test.js +10 -3
- package/lib/families/polkadot/walletApiAdapter.test.js.map +1 -1
- package/lib/families/ripple/walletApiAdapter.d.ts.map +1 -1
- package/lib/families/ripple/walletApiAdapter.js +2 -5
- package/lib/families/ripple/walletApiAdapter.js.map +1 -1
- package/lib/families/ripple/walletApiAdapter.test.js +10 -3
- package/lib/families/ripple/walletApiAdapter.test.js.map +1 -1
- package/lib/families/solana/api/chain/account/stake.d.ts +0 -1
- package/lib/families/solana/api/chain/account/stake.d.ts.map +1 -1
- package/lib/families/solana/api/chain/account/token.d.ts +0 -1
- package/lib/families/solana/api/chain/account/token.d.ts.map +1 -1
- package/lib/families/solana/api/chain/account/vote.d.ts +0 -1
- package/lib/families/solana/api/chain/account/vote.d.ts.map +1 -1
- package/lib/families/solana/api/chain/index.d.ts +2 -2
- package/lib/families/solana/api/chain/index.d.ts.map +1 -1
- package/lib/families/solana/api/chain/index.js +5 -1
- package/lib/families/solana/api/chain/index.js.map +1 -1
- package/lib/families/solana/api/chain/instruction/associated-token-account/types.d.ts +0 -1
- package/lib/families/solana/api/chain/instruction/associated-token-account/types.d.ts.map +1 -1
- package/lib/families/solana/api/chain/instruction/stake/types.d.ts +0 -1
- package/lib/families/solana/api/chain/instruction/stake/types.d.ts.map +1 -1
- package/lib/families/solana/api/chain/instruction/system/types.d.ts +0 -1
- package/lib/families/solana/api/chain/instruction/system/types.d.ts.map +1 -1
- package/lib/families/solana/api/chain/instruction/token/types.d.ts +0 -1
- package/lib/families/solana/api/chain/instruction/token/types.d.ts.map +1 -1
- package/lib/families/solana/js-buildTransaction.d.ts +1 -1
- package/lib/families/solana/js-buildTransaction.d.ts.map +1 -1
- package/lib/families/solana/js-buildTransaction.js +4 -3
- package/lib/families/solana/js-buildTransaction.js.map +1 -1
- package/lib/families/solana/js-signOperation.js +2 -2
- package/lib/families/solana/js-signOperation.js.map +1 -1
- package/lib/families/solana/tx-fees.js +4 -4
- package/lib/families/solana/tx-fees.js.map +1 -1
- package/lib/generated/walletApiAdapter.d.ts +1 -1
- package/lib/hw/actions/implementations.d.ts.map +1 -1
- package/lib/hw/actions/implementations.js +16 -2
- package/lib/hw/actions/implementations.js.map +1 -1
- package/lib/hw/extractOnboardingState.d.ts +2 -1
- package/lib/hw/extractOnboardingState.d.ts.map +1 -1
- package/lib/hw/extractOnboardingState.js +3 -1
- package/lib/hw/extractOnboardingState.js.map +1 -1
- package/lib/hw/extractOnboardingState.test.js +10 -0
- package/lib/hw/extractOnboardingState.test.js.map +1 -1
- package/lib/hw/staxRemoveImage.d.ts.map +1 -1
- package/lib/hw/staxRemoveImage.js +4 -0
- package/lib/hw/staxRemoveImage.js.map +1 -1
- package/lib/hw/staxRemoveImage.test.js +5 -0
- package/lib/hw/staxRemoveImage.test.js.map +1 -1
- package/lib/mock/fixtures/cryptoCurrencies.d.ts.map +1 -1
- package/lib/mock/fixtures/cryptoCurrencies.js +0 -1
- package/lib/mock/fixtures/cryptoCurrencies.js.map +1 -1
- package/lib/platform/logic.d.ts +2 -2
- package/lib/platform/logic.d.ts.map +1 -1
- package/lib/platform/logic.js +2 -1
- package/lib/platform/logic.js.map +1 -1
- package/lib/wallet-api/converters.d.ts.map +1 -1
- package/lib/wallet-api/converters.js +7 -3
- package/lib/wallet-api/converters.js.map +1 -1
- package/lib/wallet-api/converters.test.d.ts.map +1 -1
- package/lib/wallet-api/converters.test.js +3 -2
- package/lib/wallet-api/converters.test.js.map +1 -1
- package/lib/wallet-api/helpers.d.ts.map +1 -1
- package/lib/wallet-api/helpers.js +1 -1
- package/lib/wallet-api/helpers.js.map +1 -1
- package/lib/wallet-api/logic.d.ts +1 -1
- package/lib/wallet-api/logic.d.ts.map +1 -1
- package/lib/wallet-api/logic.js +12 -3
- package/lib/wallet-api/logic.js.map +1 -1
- package/lib/wallet-api/react.js +1 -1
- package/lib/wallet-api/react.js.map +1 -1
- package/lib/wallet-api/types.d.ts +11 -3
- package/lib/wallet-api/types.d.ts.map +1 -1
- package/lib-es/countervalues/api/api.d.ts.map +1 -1
- package/lib-es/countervalues/api/api.js +13 -19
- package/lib-es/countervalues/api/api.js.map +1 -1
- package/lib-es/countervalues/helpers.d.ts +2 -0
- package/lib-es/countervalues/helpers.d.ts.map +1 -1
- package/lib-es/countervalues/helpers.js +16 -4
- package/lib-es/countervalues/helpers.js.map +1 -1
- package/lib-es/countervalues/logic.d.ts.map +1 -1
- package/lib-es/countervalues/logic.integration.test.js.map +1 -1
- package/lib-es/countervalues/logic.js +1 -0
- package/lib-es/countervalues/logic.js.map +1 -1
- package/lib-es/countervalues/react.d.ts.map +1 -1
- package/lib-es/countervalues/react.js +10 -8
- package/lib-es/countervalues/react.js.map +1 -1
- package/lib-es/countervalues/react.test.d.ts +2 -0
- package/lib-es/countervalues/react.test.d.ts.map +1 -0
- package/lib-es/countervalues/react.test.js +105 -0
- package/lib-es/countervalues/react.test.js.map +1 -0
- package/lib-es/data/icons/react/euroc.d.ts +8 -0
- package/lib-es/data/icons/react/euroc.d.ts.map +1 -0
- package/lib-es/data/icons/react/euroc.js +11 -0
- package/lib-es/data/icons/react/euroc.js.map +1 -0
- package/lib-es/data/icons/react/index.d.ts +1 -0
- package/lib-es/data/icons/react/index.d.ts.map +1 -1
- package/lib-es/data/icons/react/index.js +1 -0
- package/lib-es/data/icons/react/index.js.map +1 -1
- package/lib-es/data/icons/reactNative/euroc.d.ts +8 -0
- package/lib-es/data/icons/reactNative/euroc.d.ts.map +1 -0
- package/lib-es/data/icons/reactNative/euroc.js +12 -0
- package/lib-es/data/icons/reactNative/euroc.js.map +1 -0
- package/lib-es/data/icons/reactNative/index.d.ts +1 -0
- package/lib-es/data/icons/reactNative/index.d.ts.map +1 -1
- package/lib-es/data/icons/reactNative/index.js +1 -0
- package/lib-es/data/icons/reactNative/index.js.map +1 -1
- package/lib-es/deviceSDK/actions/toggleOnboardingEarlyCheck.d.ts +32 -0
- package/lib-es/deviceSDK/actions/toggleOnboardingEarlyCheck.d.ts.map +1 -0
- package/lib-es/deviceSDK/actions/toggleOnboardingEarlyCheck.js +35 -0
- package/lib-es/deviceSDK/actions/toggleOnboardingEarlyCheck.js.map +1 -0
- package/lib-es/deviceSDK/commands/toggleOnboardingEarlyCheck.d.ts +27 -0
- package/lib-es/deviceSDK/commands/toggleOnboardingEarlyCheck.d.ts.map +1 -0
- package/lib-es/deviceSDK/commands/toggleOnboardingEarlyCheck.js +33 -0
- package/lib-es/deviceSDK/commands/toggleOnboardingEarlyCheck.js.map +1 -0
- package/lib-es/deviceSDK/commands/toggleOnboardingEarlyCheck.test.d.ts +2 -0
- package/lib-es/deviceSDK/commands/toggleOnboardingEarlyCheck.test.d.ts.map +1 -0
- package/lib-es/deviceSDK/commands/toggleOnboardingEarlyCheck.test.js +79 -0
- package/lib-es/deviceSDK/commands/toggleOnboardingEarlyCheck.test.js.map +1 -0
- package/lib-es/deviceSDK/hooks/useToggleOnboardingEarlyChecks.d.ts +33 -0
- package/lib-es/deviceSDK/hooks/useToggleOnboardingEarlyChecks.d.ts.map +1 -0
- package/lib-es/deviceSDK/hooks/useToggleOnboardingEarlyChecks.js +49 -0
- package/lib-es/deviceSDK/hooks/useToggleOnboardingEarlyChecks.js.map +1 -0
- package/lib-es/deviceSDK/hooks/useToggleOnboardingEarlyChecks.test.d.ts +2 -0
- package/lib-es/deviceSDK/hooks/useToggleOnboardingEarlyChecks.test.d.ts.map +1 -0
- package/lib-es/deviceSDK/hooks/useToggleOnboardingEarlyChecks.test.js +91 -0
- package/lib-es/deviceSDK/hooks/useToggleOnboardingEarlyChecks.test.js.map +1 -0
- package/lib-es/deviceSDK/tasks/core.js.map +1 -1
- package/lib-es/deviceSDK/tasks/toggleOnboardingEarlyCheck.d.ts +30 -0
- package/lib-es/deviceSDK/tasks/toggleOnboardingEarlyCheck.d.ts.map +1 -0
- package/lib-es/deviceSDK/tasks/toggleOnboardingEarlyCheck.js +60 -0
- package/lib-es/deviceSDK/tasks/toggleOnboardingEarlyCheck.js.map +1 -0
- package/lib-es/deviceSDK/tasks/toggleOnboardingEarlyCheck.test.d.ts +2 -0
- package/lib-es/deviceSDK/tasks/toggleOnboardingEarlyCheck.test.d.ts.map +1 -0
- package/lib-es/deviceSDK/tasks/toggleOnboardingEarlyCheck.test.js +98 -0
- package/lib-es/deviceSDK/tasks/toggleOnboardingEarlyCheck.test.js.map +1 -0
- package/lib-es/families/bitcoin/descriptor.d.ts.map +1 -1
- package/lib-es/families/bitcoin/descriptor.js.map +1 -1
- package/lib-es/families/bitcoin/satstack.d.ts +1 -0
- package/lib-es/families/bitcoin/satstack.d.ts.map +1 -1
- package/lib-es/families/bitcoin/satstack.js.map +1 -1
- package/lib-es/families/bitcoin/walletApiAdapter.js +4 -4
- package/lib-es/families/bitcoin/walletApiAdapter.js.map +1 -1
- package/lib-es/families/bitcoin/walletApiAdapter.test.js +9 -2
- package/lib-es/families/bitcoin/walletApiAdapter.test.js.map +1 -1
- package/lib-es/families/cosmos/api/Cosmos.d.ts +2 -0
- package/lib-es/families/cosmos/api/Cosmos.d.ts.map +1 -1
- package/lib-es/families/cosmos/api/Cosmos.js +34 -10
- package/lib-es/families/cosmos/api/Cosmos.js.map +1 -1
- package/lib-es/families/cosmos/helpers.d.ts +2 -8
- package/lib-es/families/cosmos/helpers.d.ts.map +1 -1
- package/lib-es/families/cosmos/helpers.js.map +1 -1
- package/lib-es/families/cosmos/helpers.unit.test.js +8 -8
- package/lib-es/families/cosmos/js-synchronisation.d.ts.map +1 -1
- package/lib-es/families/cosmos/js-synchronisation.js +40 -22
- package/lib-es/families/cosmos/js-synchronisation.js.map +1 -1
- package/lib-es/families/cosmos/js-synchronisation.unit.test.d.ts +2 -0
- package/lib-es/families/cosmos/js-synchronisation.unit.test.d.ts.map +1 -0
- package/lib-es/families/cosmos/js-synchronisation.unit.test.js +281 -0
- package/lib-es/families/cosmos/js-synchronisation.unit.test.js.map +1 -0
- package/lib-es/families/cosmos/react.d.ts +1 -1
- package/lib-es/families/cosmos/react.d.ts.map +1 -1
- package/lib-es/families/cosmos/react.js +7 -3
- package/lib-es/families/cosmos/react.js.map +1 -1
- package/lib-es/families/cosmos/types.d.ts +9 -8
- package/lib-es/families/cosmos/types.d.ts.map +1 -1
- package/lib-es/families/ethereum/walletApiAdapter.d.ts +3 -1
- package/lib-es/families/ethereum/walletApiAdapter.d.ts.map +1 -1
- package/lib-es/families/ethereum/walletApiAdapter.js +24 -6
- package/lib-es/families/ethereum/walletApiAdapter.js.map +1 -1
- package/lib-es/families/ethereum/walletApiAdapter.test.js +10 -3
- package/lib-es/families/ethereum/walletApiAdapter.test.js.map +1 -1
- package/lib-es/families/near/api/archive-node-sdk.d.ts.map +1 -1
- package/lib-es/families/near/api/archive-node-sdk.js +1 -2
- package/lib-es/families/near/api/archive-node-sdk.js.map +1 -1
- package/lib-es/families/polkadot/walletApiAdapter.js +3 -3
- package/lib-es/families/polkadot/walletApiAdapter.js.map +1 -1
- package/lib-es/families/polkadot/walletApiAdapter.test.js +10 -3
- package/lib-es/families/polkadot/walletApiAdapter.test.js.map +1 -1
- package/lib-es/families/ripple/walletApiAdapter.d.ts.map +1 -1
- package/lib-es/families/ripple/walletApiAdapter.js +2 -5
- package/lib-es/families/ripple/walletApiAdapter.js.map +1 -1
- package/lib-es/families/ripple/walletApiAdapter.test.js +10 -3
- package/lib-es/families/ripple/walletApiAdapter.test.js.map +1 -1
- package/lib-es/families/solana/api/chain/account/stake.d.ts +0 -1
- package/lib-es/families/solana/api/chain/account/stake.d.ts.map +1 -1
- package/lib-es/families/solana/api/chain/account/token.d.ts +0 -1
- package/lib-es/families/solana/api/chain/account/token.d.ts.map +1 -1
- package/lib-es/families/solana/api/chain/account/vote.d.ts +0 -1
- package/lib-es/families/solana/api/chain/account/vote.d.ts.map +1 -1
- package/lib-es/families/solana/api/chain/index.d.ts +2 -2
- package/lib-es/families/solana/api/chain/index.d.ts.map +1 -1
- package/lib-es/families/solana/api/chain/index.js +5 -1
- package/lib-es/families/solana/api/chain/index.js.map +1 -1
- package/lib-es/families/solana/api/chain/instruction/associated-token-account/types.d.ts +0 -1
- package/lib-es/families/solana/api/chain/instruction/associated-token-account/types.d.ts.map +1 -1
- package/lib-es/families/solana/api/chain/instruction/stake/types.d.ts +0 -1
- package/lib-es/families/solana/api/chain/instruction/stake/types.d.ts.map +1 -1
- package/lib-es/families/solana/api/chain/instruction/system/types.d.ts +0 -1
- package/lib-es/families/solana/api/chain/instruction/system/types.d.ts.map +1 -1
- package/lib-es/families/solana/api/chain/instruction/token/types.d.ts +0 -1
- package/lib-es/families/solana/api/chain/instruction/token/types.d.ts.map +1 -1
- package/lib-es/families/solana/js-buildTransaction.d.ts +1 -1
- package/lib-es/families/solana/js-buildTransaction.d.ts.map +1 -1
- package/lib-es/families/solana/js-buildTransaction.js +5 -4
- package/lib-es/families/solana/js-buildTransaction.js.map +1 -1
- package/lib-es/families/solana/js-signOperation.js +2 -2
- package/lib-es/families/solana/js-signOperation.js.map +1 -1
- package/lib-es/families/solana/tx-fees.js +4 -4
- package/lib-es/families/solana/tx-fees.js.map +1 -1
- package/lib-es/generated/walletApiAdapter.d.ts +1 -1
- package/lib-es/hw/actions/implementations.d.ts.map +1 -1
- package/lib-es/hw/actions/implementations.js +18 -4
- package/lib-es/hw/actions/implementations.js.map +1 -1
- package/lib-es/hw/extractOnboardingState.d.ts +2 -1
- package/lib-es/hw/extractOnboardingState.d.ts.map +1 -1
- package/lib-es/hw/extractOnboardingState.js +3 -1
- package/lib-es/hw/extractOnboardingState.js.map +1 -1
- package/lib-es/hw/extractOnboardingState.test.js +10 -0
- package/lib-es/hw/extractOnboardingState.test.js.map +1 -1
- package/lib-es/hw/staxRemoveImage.d.ts.map +1 -1
- package/lib-es/hw/staxRemoveImage.js +4 -0
- package/lib-es/hw/staxRemoveImage.js.map +1 -1
- package/lib-es/hw/staxRemoveImage.test.js +5 -0
- package/lib-es/hw/staxRemoveImage.test.js.map +1 -1
- package/lib-es/mock/fixtures/cryptoCurrencies.d.ts.map +1 -1
- package/lib-es/mock/fixtures/cryptoCurrencies.js +0 -1
- package/lib-es/mock/fixtures/cryptoCurrencies.js.map +1 -1
- package/lib-es/platform/logic.d.ts +2 -2
- package/lib-es/platform/logic.d.ts.map +1 -1
- package/lib-es/platform/logic.js +2 -1
- package/lib-es/platform/logic.js.map +1 -1
- package/lib-es/wallet-api/converters.d.ts.map +1 -1
- package/lib-es/wallet-api/converters.js +7 -3
- package/lib-es/wallet-api/converters.js.map +1 -1
- package/lib-es/wallet-api/converters.test.d.ts.map +1 -1
- package/lib-es/wallet-api/converters.test.js +3 -2
- package/lib-es/wallet-api/converters.test.js.map +1 -1
- package/lib-es/wallet-api/helpers.d.ts.map +1 -1
- package/lib-es/wallet-api/helpers.js +1 -1
- package/lib-es/wallet-api/helpers.js.map +1 -1
- package/lib-es/wallet-api/logic.d.ts +1 -1
- package/lib-es/wallet-api/logic.d.ts.map +1 -1
- package/lib-es/wallet-api/logic.js +12 -3
- package/lib-es/wallet-api/logic.js.map +1 -1
- package/lib-es/wallet-api/react.js +1 -1
- package/lib-es/wallet-api/react.js.map +1 -1
- package/lib-es/wallet-api/types.d.ts +11 -3
- package/lib-es/wallet-api/types.d.ts.map +1 -1
- package/package.json +14 -14
- package/src/countervalues/api/api.ts +25 -23
- package/src/countervalues/helpers.ts +21 -3
- package/src/countervalues/logic.integration.test.ts +1 -0
- package/src/countervalues/logic.ts +1 -0
- package/src/countervalues/react.test.ts +120 -0
- package/src/countervalues/react.tsx +10 -13
- package/src/currencies/__snapshots__/sortByMarketcap.test.ts.snap +44 -4
- package/src/data/icons/react/euroc.tsx +12 -0
- package/src/data/icons/react/index.tsx +1 -0
- package/src/data/icons/reactNative/euroc.tsx +13 -0
- package/src/data/icons/reactNative/index.tsx +1 -0
- package/src/data/icons/svg/EUROC.svg +5 -0
- package/src/deviceSDK/actions/toggleOnboardingEarlyCheck.ts +86 -0
- package/src/deviceSDK/commands/toggleOnboardingEarlyCheck.test.ts +85 -0
- package/src/deviceSDK/commands/toggleOnboardingEarlyCheck.ts +42 -0
- package/src/deviceSDK/hooks/useToggleOnboardingEarlyChecks.test.ts +125 -0
- package/src/deviceSDK/hooks/useToggleOnboardingEarlyChecks.ts +71 -0
- package/src/deviceSDK/tasks/core.ts +1 -1
- package/src/deviceSDK/tasks/toggleOnboardingEarlyCheck.test.ts +111 -0
- package/src/deviceSDK/tasks/toggleOnboardingEarlyCheck.ts +92 -0
- package/src/families/bitcoin/descriptor.ts +5 -2
- package/src/families/bitcoin/satstack.ts +1 -0
- package/src/families/bitcoin/walletApiAdapter.test.ts +11 -2
- package/src/families/bitcoin/walletApiAdapter.ts +4 -4
- package/src/families/cosmos/__snapshots__/bridge.integration.test.ts.snap +664 -19
- package/src/families/cosmos/api/Cosmos.ts +34 -6
- package/src/families/cosmos/helpers.ts +2 -5
- package/src/families/cosmos/helpers.unit.test.ts +8 -8
- package/src/families/cosmos/js-synchronisation.ts +74 -27
- package/src/families/cosmos/js-synchronisation.unit.test.ts +339 -0
- package/src/families/cosmos/react.ts +8 -6
- package/src/families/cosmos/types.ts +6 -4
- package/src/families/ethereum/walletApiAdapter.test.ts +12 -3
- package/src/families/ethereum/walletApiAdapter.ts +44 -13
- package/src/families/near/api/archive-node-sdk.ts +2 -3
- package/src/families/polkadot/walletApiAdapter.test.ts +13 -4
- package/src/families/polkadot/walletApiAdapter.ts +3 -3
- package/src/families/ripple/walletApiAdapter.test.ts +12 -3
- package/src/families/ripple/walletApiAdapter.ts +2 -10
- package/src/families/solana/api/chain/index.ts +8 -4
- package/src/families/solana/js-buildTransaction.ts +6 -4
- package/src/families/solana/js-signOperation.ts +2 -2
- package/src/families/solana/tx-fees.ts +6 -6
- package/src/hw/actions/implementations.ts +20 -0
- package/src/hw/extractOnboardingState.test.ts +15 -0
- package/src/hw/extractOnboardingState.ts +3 -1
- package/src/hw/staxRemoveImage.test.ts +10 -0
- package/src/hw/staxRemoveImage.ts +4 -0
- package/src/mock/fixtures/cryptoCurrencies.ts +0 -1
- package/src/platform/logic.ts +5 -3
- package/src/wallet-api/converters.test.ts +5 -2
- package/src/wallet-api/converters.ts +8 -3
- package/src/wallet-api/helpers.ts +2 -1
- package/src/wallet-api/logic.ts +15 -4
- package/src/wallet-api/react.ts +1 -1
- package/src/wallet-api/types.ts +19 -3
- package/lib/countervalues/api/api.legacy.d.ts +0 -4
- package/lib/countervalues/api/api.legacy.d.ts.map +0 -1
- package/lib/countervalues/api/api.legacy.js +0 -96
- package/lib/countervalues/api/api.legacy.js.map +0 -1
- package/lib-es/countervalues/api/api.legacy.d.ts +0 -4
- package/lib-es/countervalues/api/api.legacy.d.ts.map +0 -1
- package/lib-es/countervalues/api/api.legacy.js +0 -91
- package/lib-es/countervalues/api/api.legacy.js.map +0 -1
- package/src/countervalues/api/api.legacy.ts +0 -91
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { renderHook, act } from "@testing-library/react-hooks";
|
|
2
|
+
import {
|
|
3
|
+
UseToggleOnboardingEarlyCheckArgs,
|
|
4
|
+
useToggleOnboardingEarlyCheck,
|
|
5
|
+
} from "./useToggleOnboardingEarlyChecks";
|
|
6
|
+
import { of } from "rxjs";
|
|
7
|
+
import { delay } from "rxjs/operators";
|
|
8
|
+
|
|
9
|
+
jest.useFakeTimers();
|
|
10
|
+
|
|
11
|
+
const mockedToggleOnboardingEarlyCheckAction = jest.fn();
|
|
12
|
+
|
|
13
|
+
describe("useToggleOnboardingEarlyCheck", () => {
|
|
14
|
+
beforeEach(() => {
|
|
15
|
+
mockedToggleOnboardingEarlyCheckAction.mockClear();
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
it("should return a success state when the toggle action is successful", async () => {
|
|
19
|
+
mockedToggleOnboardingEarlyCheckAction.mockReturnValue(
|
|
20
|
+
of({ toggleStatus: "success" })
|
|
21
|
+
);
|
|
22
|
+
const { result } = renderHook(() =>
|
|
23
|
+
useToggleOnboardingEarlyCheck({
|
|
24
|
+
toggleOnboardingEarlyCheckAction:
|
|
25
|
+
mockedToggleOnboardingEarlyCheckAction,
|
|
26
|
+
deviceId: "",
|
|
27
|
+
toggleType: "enter",
|
|
28
|
+
})
|
|
29
|
+
);
|
|
30
|
+
|
|
31
|
+
await act(async () => {
|
|
32
|
+
jest.advanceTimersByTime(1);
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
expect(result.current.state).toEqual({
|
|
36
|
+
toggleStatus: "success",
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
it("should return a state initialized and reset at null when successively triggering the hook", async () => {
|
|
41
|
+
const delayMs = 1000;
|
|
42
|
+
mockedToggleOnboardingEarlyCheckAction.mockReturnValue(
|
|
43
|
+
of({ toggleStatus: "success" }).pipe(delay(delayMs))
|
|
44
|
+
);
|
|
45
|
+
|
|
46
|
+
// Step 1: enter
|
|
47
|
+
let toggleType: UseToggleOnboardingEarlyCheckArgs["toggleType"] = "enter";
|
|
48
|
+
|
|
49
|
+
const { result, rerender } = renderHook(() =>
|
|
50
|
+
useToggleOnboardingEarlyCheck({
|
|
51
|
+
toggleOnboardingEarlyCheckAction:
|
|
52
|
+
mockedToggleOnboardingEarlyCheckAction,
|
|
53
|
+
deviceId: "",
|
|
54
|
+
toggleType,
|
|
55
|
+
})
|
|
56
|
+
);
|
|
57
|
+
|
|
58
|
+
// No response for now from the action -> reset to `none` value
|
|
59
|
+
expect(result.current.state).toEqual(
|
|
60
|
+
expect.objectContaining({
|
|
61
|
+
toggleStatus: "none",
|
|
62
|
+
})
|
|
63
|
+
);
|
|
64
|
+
|
|
65
|
+
await act(async () => {
|
|
66
|
+
jest.advanceTimersByTime(delayMs);
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
expect(result.current.state).toEqual({
|
|
70
|
+
toggleStatus: "success",
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
// Step 2: exit
|
|
74
|
+
toggleType = "exit";
|
|
75
|
+
rerender();
|
|
76
|
+
|
|
77
|
+
// No response for now from the action -> reset to `none` value
|
|
78
|
+
expect(result.current.state).toEqual(
|
|
79
|
+
expect.objectContaining({
|
|
80
|
+
toggleStatus: "none",
|
|
81
|
+
})
|
|
82
|
+
);
|
|
83
|
+
|
|
84
|
+
await act(async () => {
|
|
85
|
+
jest.advanceTimersByTime(delayMs);
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
expect(result.current.state).toEqual({
|
|
89
|
+
toggleStatus: "success",
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
// Step 3: consumer reset manually with a `null` value
|
|
93
|
+
toggleType = null;
|
|
94
|
+
rerender();
|
|
95
|
+
|
|
96
|
+
await act(async () => {
|
|
97
|
+
jest.advanceTimersByTime(1);
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
expect(result.current.state).toEqual(
|
|
101
|
+
expect.objectContaining({
|
|
102
|
+
toggleStatus: "none",
|
|
103
|
+
})
|
|
104
|
+
);
|
|
105
|
+
|
|
106
|
+
// Step 4: again an enter
|
|
107
|
+
toggleType = "enter";
|
|
108
|
+
rerender();
|
|
109
|
+
|
|
110
|
+
// No response for now from the action -> reset to `none` value
|
|
111
|
+
expect(result.current.state).toEqual(
|
|
112
|
+
expect.objectContaining({
|
|
113
|
+
toggleStatus: "none",
|
|
114
|
+
})
|
|
115
|
+
);
|
|
116
|
+
|
|
117
|
+
await act(async () => {
|
|
118
|
+
jest.advanceTimersByTime(delayMs);
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
expect(result.current.state).toEqual({
|
|
122
|
+
toggleStatus: "success",
|
|
123
|
+
});
|
|
124
|
+
});
|
|
125
|
+
});
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { useEffect, useState } from "react";
|
|
2
|
+
import { log } from "@ledgerhq/logs";
|
|
3
|
+
import {
|
|
4
|
+
ToggleOnboardingEarlyCheckActionArgs,
|
|
5
|
+
ToggleOnboardingEarlyCheckActionState,
|
|
6
|
+
toggleOnboardingEarlyCheckAction as defaultToggleOnboardingEarlyCheckAction,
|
|
7
|
+
initialState,
|
|
8
|
+
} from "../actions/toggleOnboardingEarlyCheck";
|
|
9
|
+
|
|
10
|
+
export type UseToggleOnboardingEarlyCheckArgs = {
|
|
11
|
+
toggleOnboardingEarlyCheckAction?: typeof defaultToggleOnboardingEarlyCheckAction;
|
|
12
|
+
deviceId: string;
|
|
13
|
+
toggleType: ToggleOnboardingEarlyCheckActionArgs["toggleType"] | null;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Hook making the device enter or exit the early security check steps, during the onboarding
|
|
18
|
+
*
|
|
19
|
+
* This hook only puts (or moves out) the device to the state/step of the early security check.
|
|
20
|
+
* It does not starts any "security checks".
|
|
21
|
+
*
|
|
22
|
+
* If the device is not in the WELCOME or WELCOME_STEP2 onboarding state, this hook will update
|
|
23
|
+
* its `toggleStatus` to `failure`.
|
|
24
|
+
*
|
|
25
|
+
* You can reset the result state by updating `toggleType` to null
|
|
26
|
+
*
|
|
27
|
+
* @param deviceId The id of the targeted device that can be
|
|
28
|
+
* @param toggleType either null, "enter" or "exit".
|
|
29
|
+
* If null, the hook does not subscribe to the underlying device action, and nothing happens.
|
|
30
|
+
* Useful to enable/disable this hook.
|
|
31
|
+
* @param toggleOnboardingEarlyCheckAction dependency injected action. A default implementation is provided.
|
|
32
|
+
* @returns an object containing the state of the onboarding early check toggling with possible error.
|
|
33
|
+
* The resulting state is reset to its initial state on each new triggering of the toggle action (when `toggleType` is updated):
|
|
34
|
+
* {
|
|
35
|
+
* toggleStatus: "none",
|
|
36
|
+
* ...initialSharedActionState,
|
|
37
|
+
* }
|
|
38
|
+
*/
|
|
39
|
+
export const useToggleOnboardingEarlyCheck = ({
|
|
40
|
+
toggleOnboardingEarlyCheckAction = defaultToggleOnboardingEarlyCheckAction,
|
|
41
|
+
deviceId,
|
|
42
|
+
toggleType,
|
|
43
|
+
}: UseToggleOnboardingEarlyCheckArgs): {
|
|
44
|
+
state: ToggleOnboardingEarlyCheckActionState;
|
|
45
|
+
} => {
|
|
46
|
+
const [state, setState] =
|
|
47
|
+
useState<ToggleOnboardingEarlyCheckActionState>(initialState);
|
|
48
|
+
|
|
49
|
+
useEffect(() => {
|
|
50
|
+
if (toggleType === null) return;
|
|
51
|
+
|
|
52
|
+
const subscription = toggleOnboardingEarlyCheckAction({
|
|
53
|
+
deviceId,
|
|
54
|
+
toggleType,
|
|
55
|
+
}).subscribe({
|
|
56
|
+
next: setState,
|
|
57
|
+
error: (error: unknown) => {
|
|
58
|
+
log("useToggleOnboardingEarlyCheck", "Unknown error", error);
|
|
59
|
+
},
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
return () => {
|
|
63
|
+
// Resets the resulting state on each new triggering
|
|
64
|
+
setState(initialState);
|
|
65
|
+
|
|
66
|
+
subscription.unsubscribe();
|
|
67
|
+
};
|
|
68
|
+
}, [deviceId, toggleOnboardingEarlyCheckAction, toggleType]);
|
|
69
|
+
|
|
70
|
+
return { state };
|
|
71
|
+
};
|
|
@@ -55,7 +55,7 @@ export function sharedLogicTaskWrapper<TaskArgsType, TaskEventsType>(
|
|
|
55
55
|
error instanceof TransportRaceCondition
|
|
56
56
|
) {
|
|
57
57
|
// Emits to the action a locked device error event so it is aware of it before retrying
|
|
58
|
-
subscriber.next({ type: "error", error });
|
|
58
|
+
subscriber.next({ type: "error" as const, error });
|
|
59
59
|
acceptedError = true;
|
|
60
60
|
}
|
|
61
61
|
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { from, of, throwError } from "rxjs";
|
|
2
|
+
import { StatusCodes, TransportStatusError } from "@ledgerhq/errors";
|
|
3
|
+
import { toggleOnboardingEarlyCheckTask } from "./toggleOnboardingEarlyCheck";
|
|
4
|
+
import { toggleOnboardingEarlyCheckCmd } from "../commands/toggleOnboardingEarlyCheck";
|
|
5
|
+
import { withTransport } from "../transports/core";
|
|
6
|
+
import { aTransportRefBuilder } from "../mocks/aTransportRef";
|
|
7
|
+
|
|
8
|
+
jest.mock("../commands/toggleOnboardingEarlyCheck");
|
|
9
|
+
const mockedToggleOnboardingEarlyCheckCmd = jest.mocked(
|
|
10
|
+
toggleOnboardingEarlyCheckCmd
|
|
11
|
+
);
|
|
12
|
+
|
|
13
|
+
jest.mock("../transports/core");
|
|
14
|
+
const mockedWithTransport = jest.mocked(withTransport);
|
|
15
|
+
|
|
16
|
+
describe("@deviceSDK/tasks/toggleOnboardingEarlyCheckTask", () => {
|
|
17
|
+
beforeAll(async () => {
|
|
18
|
+
const transportRef = await aTransportRefBuilder();
|
|
19
|
+
mockedWithTransport.mockReturnValue((job) => from(job({ transportRef })));
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
describe("When the device is in the expected onboarding state", () => {
|
|
23
|
+
it("should emit a success event after being able to enter or exit the onboarding early checks step successfully", (done) => {
|
|
24
|
+
mockedToggleOnboardingEarlyCheckCmd.mockReturnValue(
|
|
25
|
+
of({ type: "success" })
|
|
26
|
+
);
|
|
27
|
+
|
|
28
|
+
// `enter` and `exit` have the same behavior
|
|
29
|
+
toggleOnboardingEarlyCheckTask({
|
|
30
|
+
deviceId: "",
|
|
31
|
+
toggleType: "exit",
|
|
32
|
+
}).subscribe({
|
|
33
|
+
next: (event) => {
|
|
34
|
+
expect(event.type).toBe("success");
|
|
35
|
+
done();
|
|
36
|
+
},
|
|
37
|
+
error: (error: unknown) => {
|
|
38
|
+
done(`No error should have been thrown: ${JSON.stringify(error)}`);
|
|
39
|
+
},
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
describe("When the device is neither in the WELCOME and WELCOME_STEP2 onboarding state, and it returns 0x6982", () => {
|
|
45
|
+
it("should emit a task error event with the correct error type", (done) => {
|
|
46
|
+
mockedToggleOnboardingEarlyCheckCmd.mockReturnValue(
|
|
47
|
+
throwError(
|
|
48
|
+
new TransportStatusError(StatusCodes.SECURITY_STATUS_NOT_SATISFIED)
|
|
49
|
+
)
|
|
50
|
+
);
|
|
51
|
+
|
|
52
|
+
toggleOnboardingEarlyCheckTask({
|
|
53
|
+
deviceId: "",
|
|
54
|
+
toggleType: "enter",
|
|
55
|
+
}).subscribe({
|
|
56
|
+
next: (event) => {
|
|
57
|
+
try {
|
|
58
|
+
if (event.type === "taskError") {
|
|
59
|
+
expect(event.error).toBe("DeviceInInvalidState");
|
|
60
|
+
done();
|
|
61
|
+
} else {
|
|
62
|
+
done(`The event is incorrect: ${JSON.stringify(event)}`);
|
|
63
|
+
}
|
|
64
|
+
} catch (expectError) {
|
|
65
|
+
done(expectError);
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
error: (error: unknown) => {
|
|
69
|
+
done(
|
|
70
|
+
`The error should have been mapped to an event, not thrown: ${JSON.stringify(
|
|
71
|
+
error
|
|
72
|
+
)}`
|
|
73
|
+
);
|
|
74
|
+
},
|
|
75
|
+
});
|
|
76
|
+
});
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
describe("When the command is not respected the expected APDU format", () => {
|
|
80
|
+
it("should emit a task error event with the correct error type", (done) => {
|
|
81
|
+
mockedToggleOnboardingEarlyCheckCmd.mockReturnValue(
|
|
82
|
+
throwError(new TransportStatusError(StatusCodes.INCORRECT_LENGTH))
|
|
83
|
+
);
|
|
84
|
+
|
|
85
|
+
toggleOnboardingEarlyCheckTask({
|
|
86
|
+
deviceId: "",
|
|
87
|
+
toggleType: "enter",
|
|
88
|
+
}).subscribe({
|
|
89
|
+
next: (event) => {
|
|
90
|
+
try {
|
|
91
|
+
if (event.type === "taskError") {
|
|
92
|
+
expect(event.error).toBe("InternalError");
|
|
93
|
+
done();
|
|
94
|
+
} else {
|
|
95
|
+
done(`The event is incorrect: ${JSON.stringify(event)}`);
|
|
96
|
+
}
|
|
97
|
+
} catch (expectError) {
|
|
98
|
+
done(expectError);
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
error: (error: unknown) => {
|
|
102
|
+
done(
|
|
103
|
+
`The error should have been mapped to an event, not thrown: ${JSON.stringify(
|
|
104
|
+
error
|
|
105
|
+
)}`
|
|
106
|
+
);
|
|
107
|
+
},
|
|
108
|
+
});
|
|
109
|
+
});
|
|
110
|
+
});
|
|
111
|
+
});
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { Observable } from "rxjs";
|
|
2
|
+
import { log } from "@ledgerhq/logs";
|
|
3
|
+
import type { DeviceId } from "@ledgerhq/types-live";
|
|
4
|
+
import { SharedTaskEvent } from "./core";
|
|
5
|
+
import { withTransport } from "../transports/core";
|
|
6
|
+
import {
|
|
7
|
+
toggleOnboardingEarlyCheckCmd,
|
|
8
|
+
ToggleTypeP2,
|
|
9
|
+
} from "../commands/toggleOnboardingEarlyCheck";
|
|
10
|
+
import { StatusCodes, TransportStatusError } from "@ledgerhq/errors";
|
|
11
|
+
|
|
12
|
+
export type ToggleOnboardingEarlyCheckTaskError =
|
|
13
|
+
| "DeviceInInvalidState"
|
|
14
|
+
| "InternalError"
|
|
15
|
+
| "Unknown";
|
|
16
|
+
|
|
17
|
+
export type ToggleOnboardingEarlyCheckTaskErrorEvent = {
|
|
18
|
+
type: "taskError";
|
|
19
|
+
error: ToggleOnboardingEarlyCheckTaskError;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export type ToggleOnboardingEarlyCheckTaskEvent =
|
|
23
|
+
| { type: "success" }
|
|
24
|
+
| ToggleOnboardingEarlyCheckTaskErrorEvent
|
|
25
|
+
| SharedTaskEvent;
|
|
26
|
+
|
|
27
|
+
export type ToggleOnboardingEarlyCheckTaskArgs = {
|
|
28
|
+
deviceId: DeviceId;
|
|
29
|
+
toggleType: "enter" | "exit";
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* During the onboarding, makes the device enter or exit the early security check steps
|
|
34
|
+
*
|
|
35
|
+
* This task only puts (or moves out) the device to the state/step of the early security check.
|
|
36
|
+
* It does not starts any "security checks".
|
|
37
|
+
*
|
|
38
|
+
* If the device is not in the WELCOME or WELCOME_STEP2 onboarding state, this task will emit
|
|
39
|
+
* a "DeviceInInvalidState" event.
|
|
40
|
+
*
|
|
41
|
+
* @param deviceId The id of the targeted device
|
|
42
|
+
* @param toggleType either "enter" or "exit"
|
|
43
|
+
* @returns An observable that emits a success, error or shared-task event
|
|
44
|
+
*/
|
|
45
|
+
export function toggleOnboardingEarlyCheckTask({
|
|
46
|
+
deviceId,
|
|
47
|
+
toggleType,
|
|
48
|
+
}: ToggleOnboardingEarlyCheckTaskArgs): Observable<ToggleOnboardingEarlyCheckTaskEvent> {
|
|
49
|
+
const p2 =
|
|
50
|
+
toggleType === "enter"
|
|
51
|
+
? ToggleTypeP2.EnterChecking
|
|
52
|
+
: ToggleTypeP2.ExitChecking;
|
|
53
|
+
|
|
54
|
+
return new Observable((subscriber) => {
|
|
55
|
+
withTransport(deviceId)(({ transportRef }) =>
|
|
56
|
+
toggleOnboardingEarlyCheckCmd({
|
|
57
|
+
transport: transportRef.current,
|
|
58
|
+
p2,
|
|
59
|
+
})
|
|
60
|
+
).subscribe({
|
|
61
|
+
next: (_) => subscriber.next({ type: "success" }),
|
|
62
|
+
error: (error: unknown) => {
|
|
63
|
+
if (error instanceof TransportStatusError) {
|
|
64
|
+
// @ts-expect-error TransportStatusError not typed correctly
|
|
65
|
+
if (error.statusCode === StatusCodes.SECURITY_STATUS_NOT_SATISFIED) {
|
|
66
|
+
subscriber.next({
|
|
67
|
+
type: "taskError",
|
|
68
|
+
error: "DeviceInInvalidState",
|
|
69
|
+
});
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
// @ts-expect-error TransportStatusError not typed correctly
|
|
73
|
+
else if (error.statusCode === StatusCodes.INCORRECT_LENGTH) {
|
|
74
|
+
subscriber.next({
|
|
75
|
+
type: "taskError",
|
|
76
|
+
error: "InternalError",
|
|
77
|
+
});
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
// Otherwise unknown error
|
|
82
|
+
let message = "";
|
|
83
|
+
if (error instanceof Error) {
|
|
84
|
+
message = `${error.name}: ${error.message}`;
|
|
85
|
+
}
|
|
86
|
+
log("toggleOnboardingEarlyCheckTask", `Error: ${message}`);
|
|
87
|
+
subscriber.next({ type: "taskError", error: "Unknown" });
|
|
88
|
+
},
|
|
89
|
+
complete: () => subscriber.complete(),
|
|
90
|
+
});
|
|
91
|
+
});
|
|
92
|
+
}
|
|
@@ -2,7 +2,10 @@ import { Observable, from, of, EMPTY } from "rxjs";
|
|
|
2
2
|
import { concatMap } from "rxjs/operators";
|
|
3
3
|
import invariant from "invariant";
|
|
4
4
|
import bs58 from "bs58";
|
|
5
|
-
import type {
|
|
5
|
+
import type {
|
|
6
|
+
DerivationMode,
|
|
7
|
+
GetAddressOptions,
|
|
8
|
+
} from "@ledgerhq/coin-framework/derivation";
|
|
6
9
|
import type { Result } from "../../hw/getAddress/types";
|
|
7
10
|
import { hash256, hash160 } from "../../crypto";
|
|
8
11
|
import {
|
|
@@ -159,7 +162,7 @@ export function scanDescriptors(
|
|
|
159
162
|
currency: CryptoCurrency,
|
|
160
163
|
limit = 10
|
|
161
164
|
): Observable<AccountDescriptor> {
|
|
162
|
-
const derivateAddress = (opts) =>
|
|
165
|
+
const derivateAddress = (opts: GetAddressOptions) =>
|
|
163
166
|
withDevice(deviceId)((transport) => from(getAddress(transport, opts)));
|
|
164
167
|
|
|
165
168
|
function stepAddress({
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import btc from "./walletApiAdapter";
|
|
2
2
|
import { BitcoinTransaction as WalletAPITransaction } from "@ledgerhq/wallet-api-core";
|
|
3
|
+
import { Account } from "@ledgerhq/types-live";
|
|
3
4
|
import BigNumber from "bignumber.js";
|
|
4
5
|
import { Transaction } from "./types";
|
|
5
6
|
|
|
6
7
|
describe("getPlatformTransactionSignFlowInfos", () => {
|
|
8
|
+
const dummyAccount = {} as Account;
|
|
9
|
+
|
|
7
10
|
describe("should properly get infos for BTC platform tx", () => {
|
|
8
11
|
test("without fees provided", () => {
|
|
9
12
|
const btcPlatformTx: WalletAPITransaction = {
|
|
@@ -19,7 +22,10 @@ describe("getPlatformTransactionSignFlowInfos", () => {
|
|
|
19
22
|
};
|
|
20
23
|
|
|
21
24
|
const { canEditFees, hasFeesProvided, liveTx } =
|
|
22
|
-
btc.getWalletAPITransactionSignFlowInfos(
|
|
25
|
+
btc.getWalletAPITransactionSignFlowInfos({
|
|
26
|
+
tx: btcPlatformTx,
|
|
27
|
+
account: dummyAccount,
|
|
28
|
+
});
|
|
23
29
|
|
|
24
30
|
expect(canEditFees).toBe(true);
|
|
25
31
|
|
|
@@ -45,7 +51,10 @@ describe("getPlatformTransactionSignFlowInfos", () => {
|
|
|
45
51
|
};
|
|
46
52
|
|
|
47
53
|
const { canEditFees, hasFeesProvided, liveTx } =
|
|
48
|
-
btc.getWalletAPITransactionSignFlowInfos(
|
|
54
|
+
btc.getWalletAPITransactionSignFlowInfos({
|
|
55
|
+
tx: btcPlatformTx,
|
|
56
|
+
account: dummyAccount,
|
|
57
|
+
});
|
|
49
58
|
|
|
50
59
|
expect(canEditFees).toBe(true);
|
|
51
60
|
|
|
@@ -14,7 +14,7 @@ const areFeesProvided: AreFeesProvided<WalletAPIBitcoinTransaction> = (tx) =>
|
|
|
14
14
|
const convertToLiveTransaction: ConvertToLiveTransaction<
|
|
15
15
|
WalletAPIBitcoinTransaction,
|
|
16
16
|
Transaction
|
|
17
|
-
> = (tx) => {
|
|
17
|
+
> = ({ tx }) => {
|
|
18
18
|
const hasFeesProvided = areFeesProvided(tx);
|
|
19
19
|
|
|
20
20
|
const liveTx: Partial<Transaction> = {
|
|
@@ -30,11 +30,11 @@ const convertToLiveTransaction: ConvertToLiveTransaction<
|
|
|
30
30
|
const getWalletAPITransactionSignFlowInfos: GetWalletAPITransactionSignFlowInfos<
|
|
31
31
|
WalletAPIBitcoinTransaction,
|
|
32
32
|
Transaction
|
|
33
|
-
> = (
|
|
33
|
+
> = (params) => {
|
|
34
34
|
return {
|
|
35
35
|
canEditFees: CAN_EDIT_FEES,
|
|
36
|
-
liveTx: convertToLiveTransaction(
|
|
37
|
-
hasFeesProvided: areFeesProvided(tx),
|
|
36
|
+
liveTx: convertToLiveTransaction(params),
|
|
37
|
+
hasFeesProvided: areFeesProvided(params.tx),
|
|
38
38
|
};
|
|
39
39
|
};
|
|
40
40
|
|