diff --git a/packages/suite/package.json b/packages/suite/package.json index 91019f76a5..a24ffc1396 100644 --- a/packages/suite/package.json +++ b/packages/suite/package.json @@ -27,6 +27,7 @@ "@suite-common/connect-init": "workspace:*", "@suite-common/connect-popup": "workspace:*", "@suite-common/delegated-identity-key": "workspace:*", + "@suite-common/device": "workspace:*", "@suite-common/device-authenticity": "workspace:*", "@suite-common/feedback": "workspace:*", "@suite-common/fiat-services": "workspace:*", diff --git a/packages/suite/src/actions/backup/backupActions.ts b/packages/suite/src/actions/backup/backupActions.ts index 0d5306241c..7ce15702bc 100644 --- a/packages/suite/src/actions/backup/backupActions.ts +++ b/packages/suite/src/actions/backup/backupActions.ts @@ -1,7 +1,7 @@ import { asTypedDesktopAnalytics, events } from '@suite/analytics'; +import { selectSelectedDevice } from '@suite-common/device'; import { ExtraDependencies } from '@suite-common/redux-utils'; import { notificationsActions } from '@suite-common/toast-notifications'; -import { selectSelectedDevice } from '@suite-common/wallet-core'; import TrezorConnect from '@trezor/connect'; import { BACKUP } from 'src/actions/backup/constants'; diff --git a/packages/suite/src/actions/bluetooth/bluetoothEraseBondsThunk.ts b/packages/suite/src/actions/bluetooth/bluetoothEraseBondsThunk.ts index ea9ee6b827..7a3cb7e298 100644 --- a/packages/suite/src/actions/bluetooth/bluetoothEraseBondsThunk.ts +++ b/packages/suite/src/actions/bluetooth/bluetoothEraseBondsThunk.ts @@ -3,13 +3,13 @@ import { ForgetBluetoothDeviceThunkParams, bluetoothActions, } from '@suite-common/bluetooth'; -import { createThunk } from '@suite-common/redux-utils'; -import { notificationsActions } from '@suite-common/toast-notifications'; import { selectDeviceBluetoothId, selectIsDeviceConnectedViaBluetooth, selectSelectedDevice, -} from '@suite-common/wallet-core'; +} from '@suite-common/device'; +import { createThunk } from '@suite-common/redux-utils'; +import { notificationsActions } from '@suite-common/toast-notifications'; import TrezorConnect, { BluetoothDeviceId } from '@trezor/connect'; import { bluetoothIpc } from '@trezor/transport-bluetooth'; diff --git a/packages/suite/src/actions/bluetooth/desktopBluetoothReducer.ts b/packages/suite/src/actions/bluetooth/desktopBluetoothReducer.ts index b1aa1ccc88..28250a0d31 100644 --- a/packages/suite/src/actions/bluetooth/desktopBluetoothReducer.ts +++ b/packages/suite/src/actions/bluetooth/desktopBluetoothReducer.ts @@ -3,8 +3,8 @@ import { prepareBluetoothReducerCreator, prepareInitialState, } from '@suite-common/bluetooth'; +import { deviceActions } from '@suite-common/device'; import { AnyAction, createSliceWithExtraDeps } from '@suite-common/redux-utils'; -import { deviceActions } from '@suite-common/wallet-core'; import { DesktopBluetoothDevice } from './DesktopBluetoothDevice'; diff --git a/packages/suite/src/actions/bluetooth/initBluetoothThunk.ts b/packages/suite/src/actions/bluetooth/initBluetoothThunk.ts index 4ba36465fd..3748ae9fd0 100644 --- a/packages/suite/src/actions/bluetooth/initBluetoothThunk.ts +++ b/packages/suite/src/actions/bluetooth/initBluetoothThunk.ts @@ -5,10 +5,10 @@ import { selectAutoConnectPolicy, selectKnownDevices, } from '@suite-common/bluetooth'; +import { selectDevices } from '@suite-common/device'; import { selectFirmware } from '@suite-common/firmware'; import { createThunk } from '@suite-common/redux-utils'; import { notificationsActions } from '@suite-common/toast-notifications'; -import { selectDevices } from '@suite-common/wallet-core'; import TrezorConnect from '@trezor/connect'; import { desktopApi } from '@trezor/suite-desktop-api'; import { BluetoothDevice, bluetoothIpc } from '@trezor/transport-bluetooth'; diff --git a/packages/suite/src/actions/device/deviceSlice.ts b/packages/suite/src/actions/device/deviceSlice.ts index 5658262ce3..a539eb0de7 100644 --- a/packages/suite/src/actions/device/deviceSlice.ts +++ b/packages/suite/src/actions/device/deviceSlice.ts @@ -1,12 +1,12 @@ import { PayloadAction, isAnyOf } from '@reduxjs/toolkit'; -import { AnyAction, createSliceWithExtraDeps } from '@suite-common/redux-utils'; import { DeviceReducerState, deviceInitialState as commonInitialState, deviceActions, prepareDeviceReducer, -} from '@suite-common/wallet-core'; +} from '@suite-common/device'; +import { AnyAction, createSliceWithExtraDeps } from '@suite-common/redux-utils'; type ConnectionMode = 'cable' | 'bluetooth'; diff --git a/packages/suite/src/actions/firmware/__tests__/firmwareActions.test.ts b/packages/suite/src/actions/firmware/__tests__/firmwareActions.test.ts index e2e3810771..8d212c66eb 100644 --- a/packages/suite/src/actions/firmware/__tests__/firmwareActions.test.ts +++ b/packages/suite/src/actions/firmware/__tests__/firmwareActions.test.ts @@ -1,6 +1,6 @@ +import type { DeviceReducerState } from '@suite-common/device'; import { prepareFirmwareReducer } from '@suite-common/firmware'; import { testMocks } from '@suite-common/test-utils'; -import { DeviceReducerState } from '@suite-common/wallet-core'; import { DeviceModelInternal } from '@trezor/device-utils'; import suiteReducer from 'src/reducers/suite/suiteReducer'; diff --git a/packages/suite/src/actions/onboarding/onboardingActions.ts b/packages/suite/src/actions/onboarding/onboardingActions.ts index f1f1ee936f..9079bf7e69 100644 --- a/packages/suite/src/actions/onboarding/onboardingActions.ts +++ b/packages/suite/src/actions/onboarding/onboardingActions.ts @@ -1,7 +1,8 @@ import { OnboardingAnalytics, asTypedDesktopAnalytics, events } from '@suite/analytics'; +import { selectSelectedDevice } from '@suite-common/device'; import { ExtraDependencies } from '@suite-common/redux-utils'; import { BackupType } from '@suite-common/suite-types'; -import { selectSelectedDevice, startDiscoveryThunk } from '@suite-common/wallet-core'; +import { startDiscoveryThunk } from '@suite-common/wallet-core'; import TrezorConnect from '@trezor/connect'; import { ONBOARDING } from 'src/actions/onboarding/constants'; diff --git a/packages/suite/src/actions/recovery/recoveryActions.ts b/packages/suite/src/actions/recovery/recoveryActions.ts index df7918da46..6245efcc41 100644 --- a/packages/suite/src/actions/recovery/recoveryActions.ts +++ b/packages/suite/src/actions/recovery/recoveryActions.ts @@ -1,6 +1,6 @@ import { asTypedDesktopAnalytics, events } from '@suite/analytics'; +import { selectSelectedDevice } from '@suite-common/device'; import { ExtraDependencies } from '@suite-common/redux-utils'; -import { selectSelectedDevice } from '@suite-common/wallet-core'; import TrezorConnect, { PROTO, RecoveryDevice, UI } from '@trezor/connect'; import { DeviceModelInternal } from '@trezor/device-utils'; diff --git a/packages/suite/src/actions/settings/__fixtures__/deviceSettingsActions.ts b/packages/suite/src/actions/settings/__fixtures__/deviceSettingsActions.ts index 5621f8facc..262b07d882 100644 --- a/packages/suite/src/actions/settings/__fixtures__/deviceSettingsActions.ts +++ b/packages/suite/src/actions/settings/__fixtures__/deviceSettingsActions.ts @@ -1,14 +1,10 @@ import assert from 'assert'; +import { deviceActions, deviceInitialState, prepareDeviceReducer } from '@suite-common/device'; import { TrezorDevice } from '@suite-common/suite-types'; import { mockSuiteDevice } from '@suite-common/suite-types/mocks'; import { notificationsActions } from '@suite-common/toast-notifications'; -import { - deviceActions, - deviceInitialState, - prepareDeviceReducer, - wipeDeviceThunk, -} from '@suite-common/wallet-core'; +import { wipeDeviceThunk } from '@suite-common/wallet-core'; import { Response } from '@trezor/connect'; import suiteReducer from 'src/reducers/suite/suiteReducer'; diff --git a/packages/suite/src/actions/settings/__tests__/deviceSettingsActions.test.ts b/packages/suite/src/actions/settings/__tests__/deviceSettingsActions.test.ts index 2c731994bc..afffad6532 100644 --- a/packages/suite/src/actions/settings/__tests__/deviceSettingsActions.test.ts +++ b/packages/suite/src/actions/settings/__tests__/deviceSettingsActions.test.ts @@ -1,5 +1,6 @@ +import { deviceActions } from '@suite-common/device'; import { mockSuiteDevice } from '@suite-common/suite-types/mocks'; -import { deviceActions, initialWalletSettingsState } from '@suite-common/wallet-core'; +import { initialWalletSettingsState } from '@suite-common/wallet-core'; import TrezorConnect from '@trezor/connect'; import suiteReducer from 'src/reducers/suite/suiteReducer'; diff --git a/packages/suite/src/actions/settings/deviceSettingsActions.ts b/packages/suite/src/actions/settings/deviceSettingsActions.ts index e5df57bff2..b580e4703e 100644 --- a/packages/suite/src/actions/settings/deviceSettingsActions.ts +++ b/packages/suite/src/actions/settings/deviceSettingsActions.ts @@ -1,12 +1,9 @@ +import { selectSelectedDevice, selectSimulatedEntropyCheckFail } from '@suite-common/device'; import { FIRMWARE_MODULE_PREFIX } from '@suite-common/firmware'; import { Feature, selectIsFeatureDisabled } from '@suite-common/message-system'; import { createThunk } from '@suite-common/redux-utils'; import { notificationsActions } from '@suite-common/toast-notifications'; -import { - processEntropyCheckResultThunk, - selectSelectedDevice, - selectSimulatedEntropyCheckFail, -} from '@suite-common/wallet-core'; +import { processEntropyCheckResultThunk } from '@suite-common/wallet-core'; import TrezorConnect from '@trezor/connect'; import { ERRORS } from '@trezor/connect-common/src/constants'; diff --git a/packages/suite/src/actions/suite/__fixtures__/suiteActions.ts b/packages/suite/src/actions/suite/__fixtures__/suiteActions.ts index b77bee152c..049a178232 100644 --- a/packages/suite/src/actions/suite/__fixtures__/suiteActions.ts +++ b/packages/suite/src/actions/suite/__fixtures__/suiteActions.ts @@ -1,6 +1,7 @@ +import { deviceActions } from '@suite-common/device'; import { mockConnectDevice, mockSuiteDevice } from '@suite-common/suite-types/mocks'; import { notificationsActions } from '@suite-common/toast-notifications'; -import { deviceActions, selectNewlyConnectedDeviceThunk } from '@suite-common/wallet-core'; +import { selectNewlyConnectedDeviceThunk } from '@suite-common/wallet-core'; import { DEVICE, Device, TRANSPORT } from '@trezor/connect'; import { SUITE } from 'src/actions/suite/constants'; diff --git a/packages/suite/src/actions/suite/__tests__/initAction.test.ts b/packages/suite/src/actions/suite/__tests__/initAction.test.ts index 3809a93d51..1e0b6cc8fb 100644 --- a/packages/suite/src/actions/suite/__tests__/initAction.test.ts +++ b/packages/suite/src/actions/suite/__tests__/initAction.test.ts @@ -2,6 +2,7 @@ import { createMemoryHistory } from 'history'; import { prepareAnalyticsReducer } from '@suite-common/analytics-redux'; import { connectInitThunk } from '@suite-common/connect-init'; +import { prepareDeviceReducer } from '@suite-common/device'; import { fetchConfigThunk, initMessageSystemThunk, @@ -25,7 +26,6 @@ import { periodicCheckStakeDataThunk, periodicFetchFiatRatesThunk, preloadFeeInfoThunk, - prepareDeviceReducer, updateMissingTxFiatRatesThunk, } from '@suite-common/wallet-core'; import { walletConnectInitThunk } from '@suite-common/walletconnect'; diff --git a/packages/suite/src/actions/suite/__tests__/storageActions.test.ts b/packages/suite/src/actions/suite/__tests__/storageActions.test.ts index c34ba7c123..8fc2bf53ff 100644 --- a/packages/suite/src/actions/suite/__tests__/storageActions.test.ts +++ b/packages/suite/src/actions/suite/__tests__/storageActions.test.ts @@ -1,5 +1,6 @@ import '@suite-common/test-utils/src/globalOverrides'; +import { deviceActions, selectDevices, selectDevicesCount } from '@suite-common/device'; import { asEncryptedHex } from '@suite-common/platform-encryption'; import { setSuiteSyncOwner } from '@suite-common/suite-sync'; import { SuiteSyncOwnerSerialized } from '@suite-common/suite-sync-storage'; @@ -7,11 +8,8 @@ import { mockSuiteDevice } from '@suite-common/suite-types/mocks'; import { testMocks } from '@suite-common/test-utils'; import { changeCoinVisibility, - deviceActions, prepareDiscoveryReducer, prepareSendFormReducer, - selectDevices, - selectDevicesCount, transactionsActions, } from '@suite-common/wallet-core'; import * as discoveryActions from '@suite-common/wallet-core'; diff --git a/packages/suite/src/actions/suite/__tests__/suiteActions.test.ts b/packages/suite/src/actions/suite/__tests__/suiteActions.test.ts index 1ac5c2699d..7afbd83f74 100644 --- a/packages/suite/src/actions/suite/__tests__/suiteActions.test.ts +++ b/packages/suite/src/actions/suite/__tests__/suiteActions.test.ts @@ -1,17 +1,16 @@ // unit test for suite actions // data provided by TrezorConnect are mocked import { connectInitThunk } from '@suite-common/connect-init'; +import { deviceActions, prepareDeviceReducer } from '@suite-common/device'; import { prepareFirmwareReducer } from '@suite-common/firmware'; import { suiteSyncReducer } from '@suite-common/suite-sync'; import { mockSuiteDevice } from '@suite-common/suite-types/mocks'; import { testMocks } from '@suite-common/test-utils'; import { acquireDevice, - deviceActions, forgetDisconnectedDevices, handleDeviceDisconnect, observeSelectedDevice, - prepareDeviceReducer, selectDeviceThunk, selectNewlyConnectedDeviceThunk, } from '@suite-common/wallet-core'; diff --git a/packages/suite/src/actions/suite/__tests__/trezorConnectActions.test.ts b/packages/suite/src/actions/suite/__tests__/trezorConnectActions.test.ts index 33317c9e7a..031a33b16f 100644 --- a/packages/suite/src/actions/suite/__tests__/trezorConnectActions.test.ts +++ b/packages/suite/src/actions/suite/__tests__/trezorConnectActions.test.ts @@ -1,7 +1,7 @@ import { connectInitThunk } from '@suite-common/connect-init'; +import { deviceReducerInitialState } from '@suite-common/device'; import { messageSystemInitialState } from '@suite-common/message-system'; import { testMocks } from '@suite-common/test-utils'; -import { deviceReducerInitialState } from '@suite-common/wallet-core'; import { BLOCKCHAIN_EVENT, DEVICE_EVENT, TRANSPORT_EVENT, UI_EVENT } from '@trezor/connect'; import { deviceSlice } from 'src/actions/device/deviceSlice'; diff --git a/packages/suite/src/actions/suite/autoEjectThunks.ts b/packages/suite/src/actions/suite/autoEjectThunks.ts index 14c33702bf..20a5b4968f 100644 --- a/packages/suite/src/actions/suite/autoEjectThunks.ts +++ b/packages/suite/src/actions/suite/autoEjectThunks.ts @@ -1,5 +1,6 @@ +import { selectDevices } from '@suite-common/device'; import { createThunk } from '@suite-common/redux-utils'; -import { selectDevices, setDeviceAutoEjectThunk } from '@suite-common/wallet-core'; +import { setDeviceAutoEjectThunk } from '@suite-common/wallet-core'; import * as storageActions from 'src/actions/suite/storageActions'; diff --git a/packages/suite/src/actions/suite/metadata/__fixtures__/metadataActions.ts b/packages/suite/src/actions/suite/metadata/__fixtures__/metadataActions.ts index 5d37142b36..0675697300 100644 --- a/packages/suite/src/actions/suite/metadata/__fixtures__/metadataActions.ts +++ b/packages/suite/src/actions/suite/metadata/__fixtures__/metadataActions.ts @@ -1,5 +1,5 @@ +import { deviceActions } from '@suite-common/device'; import { mockSuiteDevice } from '@suite-common/suite-types/mocks'; -import { deviceActions } from '@suite-common/wallet-core'; import { asAccountDescriptor } from '@suite-common/wallet-types'; import { mockWalletAccount } from '@suite-common/wallet-types/mocks'; diff --git a/packages/suite/src/actions/suite/metadata/__tests__/metadataActions.test.ts b/packages/suite/src/actions/suite/metadata/__tests__/metadataActions.test.ts index 2b7202e388..30164c0938 100644 --- a/packages/suite/src/actions/suite/metadata/__tests__/metadataActions.test.ts +++ b/packages/suite/src/actions/suite/metadata/__tests__/metadataActions.test.ts @@ -1,8 +1,9 @@ import fs from 'fs'; import path from 'path'; +import { prepareDeviceReducer } from '@suite-common/device'; import { extraDependenciesCommonMock, testMocks } from '@suite-common/test-utils'; -import { initialWalletSettingsState, prepareDeviceReducer } from '@suite-common/wallet-core'; +import { initialWalletSettingsState } from '@suite-common/wallet-core'; import { prepareSuiteMiddleware } from 'src/middlewares/suite/suiteMiddleware'; import metadataReducer from 'src/reducers/suite/metadataReducer'; diff --git a/packages/suite/src/actions/suite/metadata/metadataLabelingActions.ts b/packages/suite/src/actions/suite/metadata/metadataLabelingActions.ts index 3912007a34..f4b87655f0 100644 --- a/packages/suite/src/actions/suite/metadata/metadataLabelingActions.ts +++ b/packages/suite/src/actions/suite/metadata/metadataLabelingActions.ts @@ -1,10 +1,10 @@ import { asTypedDesktopAnalytics, events } from '@suite/analytics'; -import { ExtraDependencies } from '@suite-common/redux-utils'; import { selectDeviceByStaticSessionId, selectDevices, selectSelectedDevice, -} from '@suite-common/wallet-core'; +} from '@suite-common/device'; +import { ExtraDependencies } from '@suite-common/redux-utils'; import TrezorConnect, { StaticSessionId } from '@trezor/connect'; import { cloneObject } from '@trezor/utils'; diff --git a/packages/suite/src/actions/suite/metadata/metadataPasswordsActions.ts b/packages/suite/src/actions/suite/metadata/metadataPasswordsActions.ts index 43bfc4c76c..2b6005bef3 100644 --- a/packages/suite/src/actions/suite/metadata/metadataPasswordsActions.ts +++ b/packages/suite/src/actions/suite/metadata/metadataPasswordsActions.ts @@ -1,6 +1,6 @@ import crypto from 'crypto'; -import { selectSelectedDevice } from '@suite-common/wallet-core'; +import { selectSelectedDevice } from '@suite-common/device'; import TrezorConnect from '@trezor/connect'; import { cloneObject } from '@trezor/utils'; diff --git a/packages/suite/src/actions/suite/metadata/metadataThunks.ts b/packages/suite/src/actions/suite/metadata/metadataThunks.ts index 3a8ffd1abb..fff7f42fed 100644 --- a/packages/suite/src/actions/suite/metadata/metadataThunks.ts +++ b/packages/suite/src/actions/suite/metadata/metadataThunks.ts @@ -1,3 +1,4 @@ +import { selectDevices, selectSelectedDevice } from '@suite-common/device'; import { createThunk } from '@suite-common/redux-utils'; import { selectIsSuiteSyncEnabled, @@ -9,7 +10,7 @@ import { } from '@suite-common/suite-sync'; import { triggerWebDownloadFile } from '@suite-common/suite-utils'; import { notificationsActions } from '@suite-common/toast-notifications'; -import { selectAccounts, selectDevices, selectSelectedDevice } from '@suite-common/wallet-core'; +import { selectAccounts } from '@suite-common/wallet-core'; import { Account } from '@suite-common/wallet-types'; import { parseDeviceStaticSessionId } from '@suite-common/wallet-utils'; import { sanitizeFilename } from '@trezor/utils'; diff --git a/packages/suite/src/actions/suite/storageActions.ts b/packages/suite/src/actions/suite/storageActions.ts index 072a47d84b..1a238ffac1 100644 --- a/packages/suite/src/actions/suite/storageActions.ts +++ b/packages/suite/src/actions/suite/storageActions.ts @@ -1,4 +1,5 @@ import { selectKnownDevices } from '@suite-common/bluetooth'; +import { deviceActions, selectDevices, selectPersistentDeviceData } from '@suite-common/device'; import { MetadataState } from '@suite-common/metadata-types'; import { EncryptedHex } from '@suite-common/platform-encryption'; import { createThunk } from '@suite-common/redux-utils/'; @@ -10,11 +11,6 @@ import { DefinitionType, TokenManagementAction } from '@suite-common/token-defin import type { TradingTransaction } from '@suite-common/trading'; import type { Explorer, NetworkSymbol } from '@suite-common/wallet-config'; import { FormDraftPrefixKeyValues } from '@suite-common/wallet-constants'; -import { - deviceActions, - selectDevices, - selectPersistentDeviceData, -} from '@suite-common/wallet-core'; import type { AccountKey, FormState, diff --git a/packages/suite/src/actions/suite/suiteActions.ts b/packages/suite/src/actions/suite/suiteActions.ts index 7584531143..60777fb272 100644 --- a/packages/suite/src/actions/suite/suiteActions.ts +++ b/packages/suite/src/actions/suite/suiteActions.ts @@ -2,10 +2,10 @@ import { createAction } from '@reduxjs/toolkit'; import { asTypedDesktopAnalytics, events } from '@suite/analytics'; import type { TranslationKey } from '@suite/intl'; +import { deviceActions } from '@suite-common/device'; import { ExtraDependencies } from '@suite-common/redux-utils'; import type { Locale } from '@suite-common/suite-types'; import { notificationsActions } from '@suite-common/toast-notifications'; -import { deviceActions } from '@suite-common/wallet-core'; import { getCustomBackends } from '@suite-common/wallet-utils'; import { HandshakeElectron, desktopApi } from '@trezor/suite-desktop-api'; diff --git a/packages/suite/src/actions/wallet/__tests__/publicKeyActions.test.ts b/packages/suite/src/actions/wallet/__tests__/publicKeyActions.test.ts index 93653bd25e..c7243a512f 100644 --- a/packages/suite/src/actions/wallet/__tests__/publicKeyActions.test.ts +++ b/packages/suite/src/actions/wallet/__tests__/publicKeyActions.test.ts @@ -1,10 +1,10 @@ import { combineReducers, createReducer } from '@reduxjs/toolkit'; import { connectInitThunk } from '@suite-common/connect-init'; +import type { DeviceReducerState } from '@suite-common/device'; import { messageSystemInitialState } from '@suite-common/message-system'; import { mockSuiteDevice } from '@suite-common/suite-types/mocks'; import { configureMockStore, testMocks } from '@suite-common/test-utils'; -import { DeviceReducerState } from '@suite-common/wallet-core'; import fixtures from '../__fixtures__/publicKeyActions'; diff --git a/packages/suite/src/actions/wallet/__tests__/receiveActions.test.ts b/packages/suite/src/actions/wallet/__tests__/receiveActions.test.ts index 503e9e6769..b1cd4cd2d8 100644 --- a/packages/suite/src/actions/wallet/__tests__/receiveActions.test.ts +++ b/packages/suite/src/actions/wallet/__tests__/receiveActions.test.ts @@ -1,9 +1,9 @@ import { connectInitThunk } from '@suite-common/connect-init'; +import { prepareDeviceReducer } from '@suite-common/device'; import { messageSystemInitialState } from '@suite-common/message-system'; import { mockSuiteDevice } from '@suite-common/suite-types/mocks'; import { testMocks } from '@suite-common/test-utils'; import type { NetworkSymbol, NetworkType } from '@suite-common/wallet-config'; -import { prepareDeviceReducer } from '@suite-common/wallet-core'; import { AccountKey } from '@suite-common/wallet-types'; import * as receiveActions from 'src/actions/wallet/receiveActions'; diff --git a/packages/suite/src/actions/wallet/addWalletThunk.ts b/packages/suite/src/actions/wallet/addWalletThunk.ts index 72e978860d..9744122f27 100644 --- a/packages/suite/src/actions/wallet/addWalletThunk.ts +++ b/packages/suite/src/actions/wallet/addWalletThunk.ts @@ -1,5 +1,5 @@ +import { DEVICE_MODULE_PREFIX } from '@suite-common/device'; import { createThunk } from '@suite-common/redux-utils'; -import { DEVICE_MODULE_PREFIX } from '@suite-common/wallet-core'; import { asSuiteServices } from 'src/support/extraDependencies'; import { findRoute } from 'src/utils/suite/router'; diff --git a/packages/suite/src/actions/wallet/coinjoinAccountActions.ts b/packages/suite/src/actions/wallet/coinjoinAccountActions.ts index b1bae3ccf2..537bd3a893 100644 --- a/packages/suite/src/actions/wallet/coinjoinAccountActions.ts +++ b/packages/suite/src/actions/wallet/coinjoinAccountActions.ts @@ -1,11 +1,10 @@ +import { selectDevices, selectSelectedDevice } from '@suite-common/device'; import { isDevEnv } from '@suite-common/suite-utils'; import { notificationsActions } from '@suite-common/toast-notifications'; import type { Network, NetworkAccount, NetworkSymbol } from '@suite-common/wallet-config'; import { accountsActions, selectAccountByKey, - selectDevices, - selectSelectedDevice, transactionsActions, } from '@suite-common/wallet-core'; import { Account, AccountKey } from '@suite-common/wallet-types'; diff --git a/packages/suite/src/actions/wallet/coinjoinClientActions.ts b/packages/suite/src/actions/wallet/coinjoinClientActions.ts index 9b7cb107b4..27efd7e66e 100644 --- a/packages/suite/src/actions/wallet/coinjoinClientActions.ts +++ b/packages/suite/src/actions/wallet/coinjoinClientActions.ts @@ -1,7 +1,8 @@ +import { selectDevices } from '@suite-common/device'; import { Feature, selectIsFeatureDisabled } from '@suite-common/message-system'; import { getDeviceInstances } from '@suite-common/suite-utils'; import { notificationsActions } from '@suite-common/toast-notifications'; -import { selectAccountByKey, selectDevices } from '@suite-common/wallet-core'; +import { selectAccountByKey } from '@suite-common/wallet-core'; import { Account, AccountKey, AddressDisplayOptions } from '@suite-common/wallet-types'; import { getUtxoOutpoint } from '@suite-common/wallet-utils'; import { diff --git a/packages/suite/src/actions/wallet/markDeviceAsRecentlyConnectedThunk.ts b/packages/suite/src/actions/wallet/markDeviceAsRecentlyConnectedThunk.ts index 5087109628..f1eb0b50d4 100644 --- a/packages/suite/src/actions/wallet/markDeviceAsRecentlyConnectedThunk.ts +++ b/packages/suite/src/actions/wallet/markDeviceAsRecentlyConnectedThunk.ts @@ -1,5 +1,5 @@ +import { DEVICE_MODULE_PREFIX, selectSelectedDevice } from '@suite-common/device'; import { createThunk } from '@suite-common/redux-utils'; -import { DEVICE_MODULE_PREFIX, selectSelectedDevice } from '@suite-common/wallet-core'; import { Device } from '@trezor/connect'; import { selectRecentlyConnectedDevice } from 'src/selectors/suite/suiteSelectors'; diff --git a/packages/suite/src/actions/wallet/publicKeyActions.ts b/packages/suite/src/actions/wallet/publicKeyActions.ts index b2bf276ebe..80f6db366c 100644 --- a/packages/suite/src/actions/wallet/publicKeyActions.ts +++ b/packages/suite/src/actions/wallet/publicKeyActions.ts @@ -1,6 +1,7 @@ +import { selectSelectedDevice } from '@suite-common/device'; import { UserContextPayload } from '@suite-common/suite-types'; import { notificationsActions } from '@suite-common/toast-notifications'; -import { selectSelectedDevice, showXpubOnDevice } from '@suite-common/wallet-core'; +import { showXpubOnDevice } from '@suite-common/wallet-core'; import { onCancel, openModal, preserve } from 'src/actions/suite/modalActions'; import { Dispatch, GetState } from 'src/types/suite'; diff --git a/packages/suite/src/actions/wallet/receiveActions.ts b/packages/suite/src/actions/wallet/receiveActions.ts index c6c7175172..d40a6396bb 100644 --- a/packages/suite/src/actions/wallet/receiveActions.ts +++ b/packages/suite/src/actions/wallet/receiveActions.ts @@ -1,8 +1,9 @@ import { asTypedDesktopAnalytics, events } from '@suite/analytics'; +import { selectSelectedDevice } from '@suite-common/device'; import { ExtraDependencies } from '@suite-common/redux-utils'; import { UserContextPayload } from '@suite-common/suite-types'; import { notificationsActions } from '@suite-common/toast-notifications'; -import { confirmAddressOnDeviceThunk, selectSelectedDevice } from '@suite-common/wallet-core'; +import { confirmAddressOnDeviceThunk } from '@suite-common/wallet-core'; import { AddressDisplayOptions } from '@suite-common/wallet-types'; import * as modalActions from 'src/actions/suite/modalActions'; diff --git a/packages/suite/src/actions/wallet/selectedAccountActions.ts b/packages/suite/src/actions/wallet/selectedAccountActions.ts index 3950fdddd4..3973044dc5 100644 --- a/packages/suite/src/actions/wallet/selectedAccountActions.ts +++ b/packages/suite/src/actions/wallet/selectedAccountActions.ts @@ -1,14 +1,13 @@ +import { deviceActions, selectSelectedDevice } from '@suite-common/device'; import { getNetwork } from '@suite-common/wallet-config'; import { accountsActions, blockchainActions, - deviceActions, discoveryActions, feesActions, selectDeviceAccounts, selectDiscoveryForSelectedDevice, selectEnabledNetworks, - selectSelectedDevice, } from '@suite-common/wallet-core'; import { SelectedAccountStatus, WalletParams } from '@suite-common/wallet-types'; import { isChanged } from '@trezor/utils'; diff --git a/packages/suite/src/actions/wallet/send/sendFormThunks.ts b/packages/suite/src/actions/wallet/send/sendFormThunks.ts index 703a37ecf4..6c919b41cb 100644 --- a/packages/suite/src/actions/wallet/send/sendFormThunks.ts +++ b/packages/suite/src/actions/wallet/send/sendFormThunks.ts @@ -2,6 +2,7 @@ import { G } from '@mobily/ts-belt'; import { isRejected } from '@reduxjs/toolkit'; import { asTypedDesktopAnalytics, events } from '@suite/analytics'; +import { selectSelectedDevice } from '@suite-common/device'; import { MetadataAddPayload } from '@suite-common/metadata-types'; import { selectIsMevProtectionFeatureEnabled } from '@suite-common/mev'; import { createThunk } from '@suite-common/redux-utils'; @@ -13,7 +14,6 @@ import { replaceTransactionThunk, selectIsMevProtectionEnabled, selectPrecomposedSendForm, - selectSelectedDevice, selectSendFormDrafts, sendFormActions, signTransactionThunk, diff --git a/packages/suite/src/actions/wallet/signVerifyActions.ts b/packages/suite/src/actions/wallet/signVerifyActions.ts index b5b126c63d..7ef0af4962 100644 --- a/packages/suite/src/actions/wallet/signVerifyActions.ts +++ b/packages/suite/src/actions/wallet/signVerifyActions.ts @@ -1,5 +1,5 @@ +import { selectSelectedDevice } from '@suite-common/device'; import { notificationsActions } from '@suite-common/toast-notifications'; -import { selectSelectedDevice } from '@suite-common/wallet-core'; import { AddressDisplayOptions } from '@suite-common/wallet-types'; import { getAddressParameters, diff --git a/packages/suite/src/actions/wallet/stake/stakeFormCardanoActions.ts b/packages/suite/src/actions/wallet/stake/stakeFormCardanoActions.ts index 2a4099761f..de41ff695d 100644 --- a/packages/suite/src/actions/wallet/stake/stakeFormCardanoActions.ts +++ b/packages/suite/src/actions/wallet/stake/stakeFormCardanoActions.ts @@ -1,4 +1,5 @@ import { asTypedDesktopAnalytics, events } from '@suite/analytics'; +import { selectSelectedDevice } from '@suite-common/device'; import { ExtraDependencies } from '@suite-common/redux-utils'; import { calculate, @@ -12,11 +13,7 @@ import { MIN_CARDANO_BALANCE_FOR_STAKING, MIN_CARDANO_FOR_WITHDRAWALS, } from '@suite-common/wallet-constants'; -import { - VotingDelegationOption, - selectCardanoPoolsInfo, - selectSelectedDevice, -} from '@suite-common/wallet-core'; +import { VotingDelegationOption, selectCardanoPoolsInfo } from '@suite-common/wallet-core'; import { Account, CardanoAction, diff --git a/packages/suite/src/actions/wallet/stake/stakeFormEthereumActions.ts b/packages/suite/src/actions/wallet/stake/stakeFormEthereumActions.ts index 0346c68861..ada9021a2c 100644 --- a/packages/suite/src/actions/wallet/stake/stakeFormEthereumActions.ts +++ b/packages/suite/src/actions/wallet/stake/stakeFormEthereumActions.ts @@ -1,6 +1,7 @@ import { toWei } from 'web3-utils'; import { asTypedDesktopAnalytics, events } from '@suite/analytics'; +import { selectSelectedDevice } from '@suite-common/device'; import { ExtraDependencies } from '@suite-common/redux-utils'; import { getStakeTxGasLimit, @@ -20,7 +21,6 @@ import { MIN_ETH_FOR_WITHDRAWALS, UNSTAKE_INTERCHANGES, } from '@suite-common/wallet-constants'; -import { selectSelectedDevice } from '@suite-common/wallet-core'; import { ethereumGetCurrentNonceThunk } from '@suite-common/wallet-core/src/send/sendFormEthereumThunks'; import { AddressDisplayOptions, diff --git a/packages/suite/src/actions/wallet/stake/stakeFormSolanaActions.ts b/packages/suite/src/actions/wallet/stake/stakeFormSolanaActions.ts index aff4c0732e..6aae7307b1 100644 --- a/packages/suite/src/actions/wallet/stake/stakeFormSolanaActions.ts +++ b/packages/suite/src/actions/wallet/stake/stakeFormSolanaActions.ts @@ -1,6 +1,7 @@ import { address } from '@solana/kit'; import { asTypedDesktopAnalytics, events } from '@suite/analytics'; +import { selectSelectedDevice } from '@suite-common/device'; import { ExtraDependencies } from '@suite-common/redux-utils'; import { calculate, @@ -20,7 +21,6 @@ import { MIN_SOL_FOR_WITHDRAWALS, SOL_STAKING_OPERATION_FEE, } from '@suite-common/wallet-constants'; -import { selectSelectedDevice } from '@suite-common/wallet-core'; import { Account, AddressDisplayOptions, diff --git a/packages/suite/src/actions/wallet/stakeActions.ts b/packages/suite/src/actions/wallet/stakeActions.ts index e99f398a1e..b933e390e8 100644 --- a/packages/suite/src/actions/wallet/stakeActions.ts +++ b/packages/suite/src/actions/wallet/stakeActions.ts @@ -1,3 +1,4 @@ +import { selectSelectedDevice } from '@suite-common/device'; import { selectIsMevProtectionFeatureEnabled } from '@suite-common/mev'; import { EarnFlow } from '@suite-common/suite-types/src/staking'; import { notificationsActions } from '@suite-common/toast-notifications'; @@ -5,7 +6,6 @@ import { addFakePendingCardanoTxThunk, replaceTransactionThunk, selectIsMevProtectionEnabled, - selectSelectedDevice, stakeActions, syncAccountsWithBlockchainThunk, } from '@suite-common/wallet-core'; diff --git a/packages/suite/src/components/firmware/FirmwareLowBatteryModal.tsx b/packages/suite/src/components/firmware/FirmwareLowBatteryModal.tsx index cdf1e8ac17..8079d1738d 100644 --- a/packages/suite/src/components/firmware/FirmwareLowBatteryModal.tsx +++ b/packages/suite/src/components/firmware/FirmwareLowBatteryModal.tsx @@ -1,5 +1,5 @@ import { Translation } from '@suite/intl'; -import { DEVICE_LOW_BATTERY_PERCENTAGE_THRESHOLD } from '@suite-common/wallet-core'; +import { DEVICE_LOW_BATTERY_PERCENTAGE_THRESHOLD } from '@suite-common/device'; import { Card, Column, Paragraph } from '@trezor/components'; import { LowBatteryModal } from '../suite/modals/LowBatteryModal'; diff --git a/packages/suite/src/components/firmware/ReconnectDevicePrompt.tsx b/packages/suite/src/components/firmware/ReconnectDevicePrompt.tsx index 0575397cb4..afd36aeb39 100644 --- a/packages/suite/src/components/firmware/ReconnectDevicePrompt.tsx +++ b/packages/suite/src/components/firmware/ReconnectDevicePrompt.tsx @@ -1,8 +1,8 @@ import * as semver from 'semver'; import { Translation, TranslationKey } from '@suite/intl'; +import { selectSelectedDeviceLabelOrName } from '@suite-common/device'; import { TrezorDevice } from '@suite-common/suite-types'; -import { selectSelectedDeviceLabelOrName } from '@suite-common/wallet-core'; import { BulletList, Column, H2, Modal, Paragraph, Row } from '@trezor/components'; import { Device } from '@trezor/connect'; import { DeviceModelInternal, getFirmwareVersion } from '@trezor/device-utils'; diff --git a/packages/suite/src/components/guide/SupportFeedbackSelection.tsx b/packages/suite/src/components/guide/SupportFeedbackSelection.tsx index a24067f0e2..873401be0f 100644 --- a/packages/suite/src/components/guide/SupportFeedbackSelection.tsx +++ b/packages/suite/src/components/guide/SupportFeedbackSelection.tsx @@ -2,8 +2,8 @@ import styled from 'styled-components'; import { events } from '@suite/analytics'; import { Translation } from '@suite/intl'; +import { selectSelectedDevice } from '@suite-common/device'; import { isDevEnv } from '@suite-common/suite-utils'; -import { selectSelectedDevice } from '@suite-common/wallet-core'; import { Icon, Image, Link, Paragraph } from '@trezor/components'; import { getFirmwareVersion } from '@trezor/device-utils'; import { isDesktop } from '@trezor/env-utils'; diff --git a/packages/suite/src/components/onboarding/Hologram.tsx b/packages/suite/src/components/onboarding/Hologram.tsx index 8fd33cd405..94af6b1d63 100644 --- a/packages/suite/src/components/onboarding/Hologram.tsx +++ b/packages/suite/src/components/onboarding/Hologram.tsx @@ -1,9 +1,9 @@ import { useRef } from 'react'; import { Translation } from '@suite/intl'; +import { selectSelectedDevice } from '@suite-common/device'; import { DEFAULT_FLAGSHIP_MODEL } from '@suite-common/suite-constants'; import { getPackagingUrl } from '@suite-common/suite-utils'; -import { selectSelectedDevice } from '@suite-common/wallet-core'; import { Column, Image, Paragraph, Row } from '@trezor/components'; import { DeviceModelInternal } from '@trezor/device-utils'; import { DeviceAnimation } from '@trezor/product-components'; diff --git a/packages/suite/src/components/onboarding/ThpPairingStep/ThpPairingStep.tsx b/packages/suite/src/components/onboarding/ThpPairingStep/ThpPairingStep.tsx index c210ead360..c070812f1a 100644 --- a/packages/suite/src/components/onboarding/ThpPairingStep/ThpPairingStep.tsx +++ b/packages/suite/src/components/onboarding/ThpPairingStep/ThpPairingStep.tsx @@ -1,5 +1,5 @@ +import { selectSelectedDevice } from '@suite-common/device'; import { ThpStep } from '@suite-common/thp'; -import { selectSelectedDevice } from '@suite-common/wallet-core'; import { exhaustive } from '@trezor/type-utils'; import { useSelector } from 'src/hooks/suite/useSelector'; diff --git a/packages/suite/src/components/suite/Address.tsx b/packages/suite/src/components/suite/Address.tsx index 54bba0b870..1c495259ba 100644 --- a/packages/suite/src/components/suite/Address.tsx +++ b/packages/suite/src/components/suite/Address.tsx @@ -1,7 +1,7 @@ import styled, { RuleSet, css } from 'styled-components'; +import { selectSelectedDevice } from '@suite-common/device'; import { DEFAULT_FLAGSHIP_MODEL } from '@suite-common/suite-constants'; -import { selectSelectedDevice } from '@suite-common/wallet-core'; import { IconButton, Row, Text, type TextProps, Tooltip } from '@trezor/components'; import { DeviceModelInternal } from '@trezor/device-utils'; import { type TypographyStyle } from '@trezor/theme'; diff --git a/packages/suite/src/components/suite/ChangeDeviceLabelForm.tsx b/packages/suite/src/components/suite/ChangeDeviceLabelForm.tsx index 1e5ec16810..8c5e2a0e33 100644 --- a/packages/suite/src/components/suite/ChangeDeviceLabelForm.tsx +++ b/packages/suite/src/components/suite/ChangeDeviceLabelForm.tsx @@ -3,7 +3,7 @@ import { Controller, useController } from 'react-hook-form'; import styled from 'styled-components'; import { Translation } from '@suite/intl'; -import { selectDeviceName, selectSelectedDeviceLabelOrName } from '@suite-common/wallet-core'; +import { selectDeviceName, selectSelectedDeviceLabelOrName } from '@suite-common/device'; import { Button, Input, Tooltip } from '@trezor/components'; import { SCREEN_QUERY } from '@trezor/components/src/config/variables'; import { spacingsPx } from '@trezor/theme'; diff --git a/packages/suite/src/components/suite/ConnectAppBar.tsx b/packages/suite/src/components/suite/ConnectAppBar.tsx index b27761189b..6f16e127ad 100644 --- a/packages/suite/src/components/suite/ConnectAppBar.tsx +++ b/packages/suite/src/components/suite/ConnectAppBar.tsx @@ -6,7 +6,7 @@ import { connectPopupActions, selectConnectPopupCall, } from '@suite-common/connect-popup'; -import { selectSelectedDevice } from '@suite-common/wallet-core'; +import { selectSelectedDevice } from '@suite-common/device'; import { Box, Icon, Row, Text } from '@trezor/components'; import { borders, spacings } from '@trezor/theme'; diff --git a/packages/suite/src/components/suite/PrerequisitesGuide/DeviceUnreadable.tsx b/packages/suite/src/components/suite/PrerequisitesGuide/DeviceUnreadable.tsx index ef253473d5..3930d8dd28 100644 --- a/packages/suite/src/components/suite/PrerequisitesGuide/DeviceUnreadable.tsx +++ b/packages/suite/src/components/suite/PrerequisitesGuide/DeviceUnreadable.tsx @@ -1,4 +1,4 @@ -import { selectSelectedDevice } from '@suite-common/wallet-core'; +import { selectSelectedDevice } from '@suite-common/device'; import { isLinux } from '@trezor/env-utils'; import { TroubleshootingTips } from 'src/components/suite/troubleshooting/TroubleshootingTips'; diff --git a/packages/suite/src/components/suite/PrerequisitesGuide/PrerequisitesGuide.tsx b/packages/suite/src/components/suite/PrerequisitesGuide/PrerequisitesGuide.tsx index fbb1191209..03f5a88bf6 100644 --- a/packages/suite/src/components/suite/PrerequisitesGuide/PrerequisitesGuide.tsx +++ b/packages/suite/src/components/suite/PrerequisitesGuide/PrerequisitesGuide.tsx @@ -1,6 +1,7 @@ import { motion } from 'framer-motion'; import { Translation } from '@suite/intl'; +import { selectSelectedDevice } from '@suite-common/device'; import { DEFAULT_FLAGSHIP_MODEL } from '@suite-common/suite-constants'; import { TrezorDevice } from '@suite-common/suite-types'; import { @@ -9,7 +10,6 @@ import { getStatus, shouldDisplayInitialWarningIcon, } from '@suite-common/suite-utils'; -import { selectSelectedDevice } from '@suite-common/wallet-core'; import { Box, Column, Paragraph, Text, motionEasing } from '@trezor/components'; import { DeviceWithScene } from '@trezor/product-components'; diff --git a/packages/suite/src/components/suite/SecurityCheck/DeviceCompromised.tsx b/packages/suite/src/components/suite/SecurityCheck/DeviceCompromised.tsx index 9306f6dc0d..2cc15b1f7d 100644 --- a/packages/suite/src/components/suite/SecurityCheck/DeviceCompromised.tsx +++ b/packages/suite/src/components/suite/SecurityCheck/DeviceCompromised.tsx @@ -1,11 +1,11 @@ import { TranslationKey } from '@suite/intl'; -import { SkippedHashCheckError } from '@suite-common/firmware-authenticity'; import { getIsDeviceIdValid, selectIsDeviceInvariabilityCheckSuccess, selectSelectedDevice, selectWasFwHashCheckOtherErrorLastTime, -} from '@suite-common/wallet-core'; +} from '@suite-common/device'; +import { SkippedHashCheckError } from '@suite-common/firmware-authenticity'; import { Card } from '@trezor/components'; import { FirmwareHashCheckError } from '@trezor/connect'; diff --git a/packages/suite/src/components/suite/SecurityCheck/SecurityCheckLayout.tsx b/packages/suite/src/components/suite/SecurityCheck/SecurityCheckLayout.tsx index a8a5418fec..c1db8b2d51 100644 --- a/packages/suite/src/components/suite/SecurityCheck/SecurityCheckLayout.tsx +++ b/packages/suite/src/components/suite/SecurityCheck/SecurityCheckLayout.tsx @@ -1,4 +1,4 @@ -import { selectSelectedDevice } from '@suite-common/wallet-core'; +import { selectSelectedDevice } from '@suite-common/device'; import { Box, Column, Grid, Image } from '@trezor/components'; import { DeviceModelInternal, getDeviceColorVariant } from '@trezor/device-utils'; import type { ModelFor } from '@trezor/product-components'; diff --git a/packages/suite/src/components/suite/SecurityCheck/__tests__/DeviceCompromised.test.tsx b/packages/suite/src/components/suite/SecurityCheck/__tests__/DeviceCompromised.test.tsx index 26df06cd96..ae3da97dc1 100644 --- a/packages/suite/src/components/suite/SecurityCheck/__tests__/DeviceCompromised.test.tsx +++ b/packages/suite/src/components/suite/SecurityCheck/__tests__/DeviceCompromised.test.tsx @@ -1,9 +1,9 @@ import '@suite-common/test-utils/src/globalOverrides'; import { TranslationKey } from '@suite/intl'; +import { DeviceReducerState, deviceInitialState } from '@suite-common/device'; import { defaultDevicePersistentData, mockSuiteDevice } from '@suite-common/suite-types/mocks'; import * as deviceUtils from '@suite-common/suite-utils'; -import { DeviceReducerState, deviceInitialState } from '@suite-common/wallet-core'; import { DeviceModelInternal } from '@trezor/device-utils'; import { AppState } from 'src/reducers/store'; diff --git a/packages/suite/src/components/suite/SecurityCheck/deviceCompromisedCtas.tsx b/packages/suite/src/components/suite/SecurityCheck/deviceCompromisedCtas.tsx index 2516bae3b8..06dd20ca73 100644 --- a/packages/suite/src/components/suite/SecurityCheck/deviceCompromisedCtas.tsx +++ b/packages/suite/src/components/suite/SecurityCheck/deviceCompromisedCtas.tsx @@ -1,5 +1,5 @@ import { Translation } from '@suite/intl'; -import { deviceActions } from '@suite-common/wallet-core'; +import { deviceActions } from '@suite-common/device'; import { Button } from '@trezor/components'; import { HELP_CENTER_ENTROPY_CHECK_URL, diff --git a/packages/suite/src/components/suite/asset-picker/components/AssetsListEmpty/AssetsListEmpty.tsx b/packages/suite/src/components/suite/asset-picker/components/AssetsListEmpty/AssetsListEmpty.tsx index 9e3cb82052..0c49ef002b 100644 --- a/packages/suite/src/components/suite/asset-picker/components/AssetsListEmpty/AssetsListEmpty.tsx +++ b/packages/suite/src/components/suite/asset-picker/components/AssetsListEmpty/AssetsListEmpty.tsx @@ -1,9 +1,10 @@ import { ReactNode } from 'react'; import { Translation, TranslationKey } from '@suite/intl'; +import { selectSelectedDevice } from '@suite-common/device'; import { getNetworkSymbolForProtocol } from '@suite-common/suite-utils'; import { getNetworkDisplaySymbolName } from '@suite-common/wallet-config'; -import { selectHasRunningDiscovery, selectSelectedDevice } from '@suite-common/wallet-core'; +import { selectHasRunningDiscovery } from '@suite-common/wallet-core'; import { Button, Column, Paragraph } from '@trezor/components'; import { openModal } from 'src/actions/suite/modalActions'; diff --git a/packages/suite/src/components/suite/banners/SuiteBanners/FirmwareAuthenticityCheckBanner.tsx b/packages/suite/src/components/suite/banners/SuiteBanners/FirmwareAuthenticityCheckBanner.tsx index 75cb173488..00dc4e503e 100644 --- a/packages/suite/src/components/suite/banners/SuiteBanners/FirmwareAuthenticityCheckBanner.tsx +++ b/packages/suite/src/components/suite/banners/SuiteBanners/FirmwareAuthenticityCheckBanner.tsx @@ -1,9 +1,9 @@ import { Translation, TranslationKey } from '@suite/intl'; +import { selectWasFwHashCheckOtherErrorLastTime } from '@suite-common/device'; import { SkippedHashCheckError, SkippedRevisionCheckError, } from '@suite-common/firmware-authenticity'; -import { selectWasFwHashCheckOtherErrorLastTime } from '@suite-common/wallet-core'; import { Banner } from '@trezor/components'; import { FirmwareHashCheckError, FirmwareRevisionCheckError } from '@trezor/connect'; import { TREZOR_SUPPORT_FW_REVISION_CHECK_FAILED_URL } from '@trezor/urls'; diff --git a/packages/suite/src/components/suite/banners/SuiteBanners/SuiteBanners.tsx b/packages/suite/src/components/suite/banners/SuiteBanners/SuiteBanners.tsx index 3c6a5e63f3..675a9337a4 100644 --- a/packages/suite/src/components/suite/banners/SuiteBanners/SuiteBanners.tsx +++ b/packages/suite/src/components/suite/banners/SuiteBanners/SuiteBanners.tsx @@ -2,15 +2,15 @@ import { useEffect, useState } from 'react'; import styled from 'styled-components'; -import { selectBannerMessage } from '@suite-common/message-system'; -import { selectHasDeviceSuiteSyncError } from '@suite-common/suite-sync'; import { selectDeviceStaticSessionId, selectIsDeviceBackupRequired, selectIsDeviceBackupUnfinished, selectSelectedDevice, - selectVisibleDeviceAccounts, -} from '@suite-common/wallet-core'; +} from '@suite-common/device'; +import { selectBannerMessage } from '@suite-common/message-system'; +import { selectHasDeviceSuiteSyncError } from '@suite-common/suite-sync'; +import { selectVisibleDeviceAccounts } from '@suite-common/wallet-core'; import { isCardanoStakedWithFiveBinaries } from '@suite-common/wallet-utils'; import { isWeb } from '@trezor/env-utils'; import { spacingsPx } from '@trezor/theme'; diff --git a/packages/suite/src/components/suite/banners/SuiteBanners/SuiteSyncBanner.tsx b/packages/suite/src/components/suite/banners/SuiteBanners/SuiteSyncBanner.tsx index 89094443d9..30ae079aaa 100644 --- a/packages/suite/src/components/suite/banners/SuiteBanners/SuiteSyncBanner.tsx +++ b/packages/suite/src/components/suite/banners/SuiteBanners/SuiteSyncBanner.tsx @@ -1,12 +1,12 @@ import { useSelector } from 'react-redux'; import { Translation, TranslationKey } from '@suite/intl'; +import { selectIsDeviceConnected } from '@suite-common/device'; import { WithSuiteSyncAndDeviceState, selectHasDeviceSuiteSyncError, selectSuiteSyncInteraction, } from '@suite-common/suite-sync'; -import { selectIsDeviceConnected } from '@suite-common/wallet-core'; import { Banner, Tooltip } from '@trezor/components'; import { StaticSessionId } from '@trezor/connect'; diff --git a/packages/suite/src/components/suite/labeling/AccountLabeling.tsx b/packages/suite/src/components/suite/labeling/AccountLabeling.tsx index 8955c20488..e5026c5c5f 100644 --- a/packages/suite/src/components/suite/labeling/AccountLabeling.tsx +++ b/packages/suite/src/components/suite/labeling/AccountLabeling.tsx @@ -1,5 +1,5 @@ +import { selectDevices, selectSelectedDevice } from '@suite-common/device'; import { isSelectedDevice } from '@suite-common/suite-utils'; -import { selectDevices, selectSelectedDevice } from '@suite-common/wallet-core'; import { findAccountDevice } from '@suite-common/wallet-utils'; import { BadgeProps, FlexProps } from '@trezor/components'; diff --git a/packages/suite/src/components/suite/labeling/Labeling/SuiteSyncInteractionsTooltip.tsx b/packages/suite/src/components/suite/labeling/Labeling/SuiteSyncInteractionsTooltip.tsx index 3bebdc58df..35e7807316 100644 --- a/packages/suite/src/components/suite/labeling/Labeling/SuiteSyncInteractionsTooltip.tsx +++ b/packages/suite/src/components/suite/labeling/Labeling/SuiteSyncInteractionsTooltip.tsx @@ -1,11 +1,8 @@ import { ReactNode } from 'react'; import { Translation, TranslationKey } from '@suite/intl'; +import { selectDeviceByStaticSessionId, selectDeviceLabelOrNameById } from '@suite-common/device'; import { SuiteSyncInteraction } from '@suite-common/suite-sync'; -import { - selectDeviceByStaticSessionId, - selectDeviceLabelOrNameById, -} from '@suite-common/wallet-core'; import { Text, Tooltip } from '@trezor/components'; import { StaticSessionId } from '@trezor/connect'; import { exhaustive } from '@trezor/type-utils'; diff --git a/packages/suite/src/components/suite/labeling/Labeling/selectIsLabelActionEnabled.test.ts b/packages/suite/src/components/suite/labeling/Labeling/selectIsLabelActionEnabled.test.ts index c634aaf9ee..ca5de4bdcb 100644 --- a/packages/suite/src/components/suite/labeling/Labeling/selectIsLabelActionEnabled.test.ts +++ b/packages/suite/src/components/suite/labeling/Labeling/selectIsLabelActionEnabled.test.ts @@ -1,12 +1,12 @@ import { mocked } from 'jest-mock'; +import { deviceReducerInitialState } from '@suite-common/device'; import { SuiteSyncState, type WithSuiteSyncAndDeviceState, initialSuiteSyncState, } from '@suite-common/suite-sync'; import { mockSuiteDevice } from '@suite-common/suite-types/mocks'; -import { deviceReducerInitialState } from '@suite-common/wallet-core'; import { StaticSessionId, UnavailableCapabilities } from '@trezor/connect'; import { selectIsLabelActionEnabled } from './selectIsLabelActionEnabled'; diff --git a/packages/suite/src/components/suite/labeling/TurnOnSuiteSync/SuiteSyncFirmwareUpgradeNeededModal.tsx b/packages/suite/src/components/suite/labeling/TurnOnSuiteSync/SuiteSyncFirmwareUpgradeNeededModal.tsx index 69de9bdf6e..d0a860634e 100644 --- a/packages/suite/src/components/suite/labeling/TurnOnSuiteSync/SuiteSyncFirmwareUpgradeNeededModal.tsx +++ b/packages/suite/src/components/suite/labeling/TurnOnSuiteSync/SuiteSyncFirmwareUpgradeNeededModal.tsx @@ -1,8 +1,5 @@ import { Translation } from '@suite/intl'; -import { - selectDeviceByStaticSessionId, - selectDeviceLabelOrNameById, -} from '@suite-common/wallet-core'; +import { selectDeviceByStaticSessionId, selectDeviceLabelOrNameById } from '@suite-common/device'; import { Card, Modal, Paragraph } from '@trezor/components'; import { StaticSessionId } from '@trezor/connect'; diff --git a/packages/suite/src/components/suite/labeling/TurnOnSuiteSync/SuiteSyncTurnOnModal.tsx b/packages/suite/src/components/suite/labeling/TurnOnSuiteSync/SuiteSyncTurnOnModal.tsx index b3888da351..3cba80b59f 100644 --- a/packages/suite/src/components/suite/labeling/TurnOnSuiteSync/SuiteSyncTurnOnModal.tsx +++ b/packages/suite/src/components/suite/labeling/TurnOnSuiteSync/SuiteSyncTurnOnModal.tsx @@ -1,6 +1,6 @@ import { Translation } from '@suite/intl'; +import { selectDeviceByStaticSessionId } from '@suite-common/device'; import { notificationsActions } from '@suite-common/toast-notifications'; -import { selectDeviceByStaticSessionId } from '@suite-common/wallet-core'; import { Card, Column, IconCircle, List, Modal, Paragraph } from '@trezor/components'; import { StaticSessionId } from '@trezor/connect'; import { exhaustive } from '@trezor/type-utils'; diff --git a/packages/suite/src/components/suite/labeling/TurnOnSuiteSync/SuiteSyncTurnOnUnsupportedModal.tsx b/packages/suite/src/components/suite/labeling/TurnOnSuiteSync/SuiteSyncTurnOnUnsupportedModal.tsx index 9003efa88e..32ecc2f75d 100644 --- a/packages/suite/src/components/suite/labeling/TurnOnSuiteSync/SuiteSyncTurnOnUnsupportedModal.tsx +++ b/packages/suite/src/components/suite/labeling/TurnOnSuiteSync/SuiteSyncTurnOnUnsupportedModal.tsx @@ -1,8 +1,5 @@ import { Translation } from '@suite/intl'; -import { - selectDeviceByStaticSessionId, - selectDeviceLabelOrNameById, -} from '@suite-common/wallet-core'; +import { selectDeviceByStaticSessionId, selectDeviceLabelOrNameById } from '@suite-common/device'; import { Card, Modal, Paragraph } from '@trezor/components'; import { StaticSessionId } from '@trezor/connect'; import { TREZOR_URL } from '@trezor/urls'; diff --git a/packages/suite/src/components/suite/layouts/SuiteLayout/AppShortcuts.tsx b/packages/suite/src/components/suite/layouts/SuiteLayout/AppShortcuts.tsx index 588ccc8d31..83eccf0cb3 100644 --- a/packages/suite/src/components/suite/layouts/SuiteLayout/AppShortcuts.tsx +++ b/packages/suite/src/components/suite/layouts/SuiteLayout/AppShortcuts.tsx @@ -1,6 +1,7 @@ import { useEvent } from 'react-use'; -import { selectSelectedDevice, startDiscoveryThunk } from '@suite-common/wallet-core'; +import { selectSelectedDevice } from '@suite-common/device'; +import { startDiscoveryThunk } from '@suite-common/wallet-core'; import { KEYBOARD_CODE } from '@trezor/components'; import { closeModalApp, goto } from 'src/actions/suite/routerActions'; diff --git a/packages/suite/src/components/suite/layouts/SuiteLayout/CoinjoinBars/CoinjoinStatusBar.tsx b/packages/suite/src/components/suite/layouts/SuiteLayout/CoinjoinBars/CoinjoinStatusBar.tsx index 01da0eee61..dae3d677f5 100644 --- a/packages/suite/src/components/suite/layouts/SuiteLayout/CoinjoinBars/CoinjoinStatusBar.tsx +++ b/packages/suite/src/components/suite/layouts/SuiteLayout/CoinjoinBars/CoinjoinStatusBar.tsx @@ -1,12 +1,8 @@ import styled, { css } from 'styled-components'; import { Translation } from '@suite/intl'; -import { - selectAccountByKey, - selectDeviceThunk, - selectDevices, - selectSelectedDevice, -} from '@suite-common/wallet-core'; +import { selectDevices, selectSelectedDevice } from '@suite-common/device'; +import { selectAccountByKey, selectDeviceThunk } from '@suite-common/wallet-core'; import { AccountKey, WalletParams } from '@suite-common/wallet-types'; import { ProgressPie } from '@trezor/components'; import { typography } from '@trezor/theme'; diff --git a/packages/suite/src/components/suite/layouts/SuiteLayout/DeviceSelector/DeviceSelector.tsx b/packages/suite/src/components/suite/layouts/SuiteLayout/DeviceSelector/DeviceSelector.tsx index e82cee961a..cce633e645 100644 --- a/packages/suite/src/components/suite/layouts/SuiteLayout/DeviceSelector/DeviceSelector.tsx +++ b/packages/suite/src/components/suite/layouts/SuiteLayout/DeviceSelector/DeviceSelector.tsx @@ -3,7 +3,7 @@ import { useRef } from 'react'; import styled, { css } from 'styled-components'; import { Translation } from '@suite/intl'; -import { selectSelectedDevice } from '@suite-common/wallet-core'; +import { selectSelectedDevice } from '@suite-common/device'; import { Box, Icon, Tooltip } from '@trezor/components'; import { focusStyleTransition, getFocusShadowStyle } from '@trezor/components/src/utils/utils'; import { borders, spacingsPx, zIndices } from '@trezor/theme'; diff --git a/packages/suite/src/components/suite/layouts/SuiteLayout/DeviceSelector/DeviceStatus.tsx b/packages/suite/src/components/suite/layouts/SuiteLayout/DeviceSelector/DeviceStatus.tsx index 74c980459a..22c8f34a5e 100644 --- a/packages/suite/src/components/suite/layouts/SuiteLayout/DeviceSelector/DeviceStatus.tsx +++ b/packages/suite/src/components/suite/layouts/SuiteLayout/DeviceSelector/DeviceStatus.tsx @@ -1,4 +1,4 @@ -import { selectDeviceLabelOrNameById } from '@suite-common/wallet-core'; +import { selectDeviceLabelOrNameById } from '@suite-common/device'; import { Row, Tooltip } from '@trezor/components'; import { DeviceModelInternal, getDeviceColorVariant } from '@trezor/device-utils'; import { RotateDeviceImage } from '@trezor/product-components'; diff --git a/packages/suite/src/components/suite/layouts/SuiteLayout/DeviceSelector/SidebarDeviceStatus.tsx b/packages/suite/src/components/suite/layouts/SuiteLayout/DeviceSelector/SidebarDeviceStatus.tsx index b71533bd7d..2b7f472c84 100644 --- a/packages/suite/src/components/suite/layouts/SuiteLayout/DeviceSelector/SidebarDeviceStatus.tsx +++ b/packages/suite/src/components/suite/layouts/SuiteLayout/DeviceSelector/SidebarDeviceStatus.tsx @@ -1,6 +1,6 @@ +import { selectDevices, selectSelectedDevice } from '@suite-common/device'; import * as deviceUtils from '@suite-common/suite-utils'; import { getDeviceInternalModel } from '@suite-common/suite-utils'; -import { selectDevices, selectSelectedDevice } from '@suite-common/wallet-core'; import { TrezorDevice } from 'src/types/suite'; diff --git a/packages/suite/src/components/suite/layouts/SuiteLayout/PageHeader/TradeActions.tsx b/packages/suite/src/components/suite/layouts/SuiteLayout/PageHeader/TradeActions.tsx index 9b54ebe1b0..0e892dde0c 100644 --- a/packages/suite/src/components/suite/layouts/SuiteLayout/PageHeader/TradeActions.tsx +++ b/packages/suite/src/components/suite/layouts/SuiteLayout/PageHeader/TradeActions.tsx @@ -1,7 +1,7 @@ import { events } from '@suite/analytics'; import { Translation } from '@suite/intl'; +import { selectSelectedDevice } from '@suite-common/device'; import { getTradingPrefilledFromAccountData, tradingActions } from '@suite-common/trading'; -import { selectSelectedDevice } from '@suite-common/wallet-core'; import { SelectedAccountStatus } from '@suite-common/wallet-types'; import { Row } from '@trezor/components'; import { hasBitcoinOnlyFirmware } from '@trezor/device-utils'; diff --git a/packages/suite/src/components/suite/layouts/SuiteLayout/PassphraseFlow.tsx b/packages/suite/src/components/suite/layouts/SuiteLayout/PassphraseFlow.tsx index 74f6e8b302..e104e65f42 100644 --- a/packages/suite/src/components/suite/layouts/SuiteLayout/PassphraseFlow.tsx +++ b/packages/suite/src/components/suite/layouts/SuiteLayout/PassphraseFlow.tsx @@ -1,4 +1,4 @@ -import { selectSelectedDevice } from '@suite-common/wallet-core'; +import { selectSelectedDevice } from '@suite-common/device'; import { UI } from '@trezor/connect'; import { MODAL } from '../../../../actions/suite/constants'; diff --git a/packages/suite/src/components/suite/layouts/SuiteLayout/Sidebar/Navigation.tsx b/packages/suite/src/components/suite/layouts/SuiteLayout/Sidebar/Navigation.tsx index 99ebdc0792..403924fa52 100644 --- a/packages/suite/src/components/suite/layouts/SuiteLayout/Sidebar/Navigation.tsx +++ b/packages/suite/src/components/suite/layouts/SuiteLayout/Sidebar/Navigation.tsx @@ -2,11 +2,9 @@ import { FC, useMemo } from 'react'; import styled from 'styled-components'; +import { selectHasBitcoinOnlyFirmware } from '@suite-common/device'; import { Route } from '@suite-common/suite-types'; -import { - selectHasBitcoinOnlyFirmware, - selectIsAnyNonBitcoinLikeNetworkEnabled, -} from '@suite-common/wallet-core'; +import { selectIsAnyNonBitcoinLikeNetworkEnabled } from '@suite-common/wallet-core'; import { type SpacingPxValues, spacingsPx } from '@trezor/theme'; import { useSelector } from 'src/hooks/suite'; diff --git a/packages/suite/src/components/suite/layouts/SuiteLayout/Sidebar/Sidebar.tsx b/packages/suite/src/components/suite/layouts/SuiteLayout/Sidebar/Sidebar.tsx index bdc334f551..25355d8a27 100644 --- a/packages/suite/src/components/suite/layouts/SuiteLayout/Sidebar/Sidebar.tsx +++ b/packages/suite/src/components/suite/layouts/SuiteLayout/Sidebar/Sidebar.tsx @@ -3,7 +3,7 @@ import React, { useEffect, useState } from 'react'; import { AnimatePresence } from 'framer-motion'; import styled from 'styled-components'; -import { selectDevicesCount, selectSelectedDevice } from '@suite-common/wallet-core'; +import { selectDevicesCount, selectSelectedDevice } from '@suite-common/device'; import { Box, ElevationUp, Icon, ResizableBox, useElevation } from '@trezor/components'; import { isDesktop } from '@trezor/env-utils'; import { TrezorLogo } from '@trezor/product-components'; @@ -23,16 +23,16 @@ import { useResponsiveContext } from 'src/support/suite/ResponsiveContext'; import { Navigation } from './Navigation'; import { QuickActions } from './QuickActions/QuickActions'; -import { TrafficLightOffset } from '../../../TrafficLightOffset'; -import { DeviceSelector } from '../DeviceSelector/DeviceSelector'; -import { UpdateNotificationBanner } from './QuickActions/Update/UpdateNotificationBanner'; -import { useUpdateStatus } from './QuickActions/Update/useUpdateStatus'; import { SIDEBAR_AUTO_COLLAPSE_BREAKPOINT, SIDEBAR_COLLAPSED_WIDTH, SIDEBAR_MAX_WIDTH, SIDEBAR_MIN_WIDTH, } from './consts'; +import { DeviceSelector } from '../DeviceSelector/DeviceSelector'; +import { UpdateNotificationBanner } from './QuickActions/Update/UpdateNotificationBanner'; +import { TrafficLightOffset } from '../../../TrafficLightOffset'; +import { useUpdateStatus } from './QuickActions/Update/useUpdateStatus'; const Container = styled.nav<{ $elevation: Elevation }>` overflow-x: hidden; diff --git a/packages/suite/src/components/suite/modals/ModalSwitcher/DiscoveryLoader.tsx b/packages/suite/src/components/suite/modals/ModalSwitcher/DiscoveryLoader.tsx index d66ac9a11c..2adeef3a08 100644 --- a/packages/suite/src/components/suite/modals/ModalSwitcher/DiscoveryLoader.tsx +++ b/packages/suite/src/components/suite/modals/ModalSwitcher/DiscoveryLoader.tsx @@ -1,5 +1,5 @@ import { Translation } from '@suite/intl'; -import { selectSelectedDevice } from '@suite-common/wallet-core'; +import { selectSelectedDevice } from '@suite-common/device'; import { Column, H3, Spinner } from '@trezor/components'; import { spacings } from '@trezor/theme'; diff --git a/packages/suite/src/components/suite/modals/ReduxModal/ConfirmAddressModal.tsx b/packages/suite/src/components/suite/modals/ReduxModal/ConfirmAddressModal.tsx index 52eb56a6fd..efe6288c74 100644 --- a/packages/suite/src/components/suite/modals/ReduxModal/ConfirmAddressModal.tsx +++ b/packages/suite/src/components/suite/modals/ReduxModal/ConfirmAddressModal.tsx @@ -2,8 +2,8 @@ import { useCallback } from 'react'; import { Translation } from '@suite/intl'; import { selectConnectPopupCall } from '@suite-common/connect-popup'; +import { selectSelectedDevice } from '@suite-common/device'; import { getNetworkDisplaySymbol } from '@suite-common/wallet-config/src/utils'; -import { selectSelectedDevice } from '@suite-common/wallet-core'; import { hasNetworkFeatures } from '@suite-common/wallet-utils'; import { showAddress } from 'src/actions/wallet/receiveActions'; diff --git a/packages/suite/src/components/suite/modals/ReduxModal/ConfirmValueModal/ConfirmValueModal.tsx b/packages/suite/src/components/suite/modals/ReduxModal/ConfirmValueModal/ConfirmValueModal.tsx index 329aeb09ac..d0144ee995 100644 --- a/packages/suite/src/components/suite/modals/ReduxModal/ConfirmValueModal/ConfirmValueModal.tsx +++ b/packages/suite/src/components/suite/modals/ReduxModal/ConfirmValueModal/ConfirmValueModal.tsx @@ -2,11 +2,11 @@ import { ReactNode, useEffect, useState } from 'react'; import { events } from '@suite/analytics'; import { Translation, useTranslation } from '@suite/intl'; +import { selectSelectedDeviceLabelOrName } from '@suite-common/device'; import { selectIsSuiteSyncEnabled, selectSuiteSyncAddressLabels } from '@suite-common/suite-sync'; import { getDeviceInternalModel } from '@suite-common/suite-utils'; import { notificationsActions } from '@suite-common/toast-notifications'; import { getDisplaySymbol } from '@suite-common/wallet-config'; -import { selectSelectedDeviceLabelOrName } from '@suite-common/wallet-core'; import { Account } from '@suite-common/wallet-types'; import { Banner, diff --git a/packages/suite/src/components/suite/modals/ReduxModal/ConfirmXpubModal.tsx b/packages/suite/src/components/suite/modals/ReduxModal/ConfirmXpubModal.tsx index 44c3d4009b..e8f1071847 100644 --- a/packages/suite/src/components/suite/modals/ReduxModal/ConfirmXpubModal.tsx +++ b/packages/suite/src/components/suite/modals/ReduxModal/ConfirmXpubModal.tsx @@ -1,6 +1,6 @@ import { Translation } from '@suite/intl'; import { selectConnectPopupCall } from '@suite-common/connect-popup'; -import { selectSelectedDevice } from '@suite-common/wallet-core'; +import { selectSelectedDevice } from '@suite-common/device'; import { convertTaprootXpub } from '@trezor/utils'; import { showXpub } from 'src/actions/wallet/publicKeyActions'; diff --git a/packages/suite/src/components/suite/modals/ReduxModal/DeviceContextModal/ConfirmPassphraseBeforeAction.tsx b/packages/suite/src/components/suite/modals/ReduxModal/DeviceContextModal/ConfirmPassphraseBeforeAction.tsx index 3adb3b9a17..3a8b591faf 100644 --- a/packages/suite/src/components/suite/modals/ReduxModal/DeviceContextModal/ConfirmPassphraseBeforeAction.tsx +++ b/packages/suite/src/components/suite/modals/ReduxModal/DeviceContextModal/ConfirmPassphraseBeforeAction.tsx @@ -6,7 +6,7 @@ import { selectDeviceModel, selectHasDevicePassphraseEntryCapability, selectSelectedDevice, -} from '@suite-common/wallet-core'; +} from '@suite-common/device'; import { Column, H3, Paragraph } from '@trezor/components'; import TrezorConnect, { UI } from '@trezor/connect'; diff --git a/packages/suite/src/components/suite/modals/ReduxModal/DeviceContextModal/DeviceContextModal.tsx b/packages/suite/src/components/suite/modals/ReduxModal/DeviceContextModal/DeviceContextModal.tsx index e8e9511736..226a3ea9f9 100644 --- a/packages/suite/src/components/suite/modals/ReduxModal/DeviceContextModal/DeviceContextModal.tsx +++ b/packages/suite/src/components/suite/modals/ReduxModal/DeviceContextModal/DeviceContextModal.tsx @@ -1,7 +1,7 @@ import { useIntl } from 'react-intl'; import { messages } from '@suite/intl'; -import { selectSelectedDevice } from '@suite-common/wallet-core'; +import { selectSelectedDevice } from '@suite-common/device'; import TrezorConnect, { UI } from '@trezor/connect'; import { MODAL } from 'src/actions/suite/constants'; diff --git a/packages/suite/src/components/suite/modals/ReduxModal/DeviceContextModal/EnterPassphrase.tsx b/packages/suite/src/components/suite/modals/ReduxModal/DeviceContextModal/EnterPassphrase.tsx index 76aaf21494..6b2cb5f5ac 100644 --- a/packages/suite/src/components/suite/modals/ReduxModal/DeviceContextModal/EnterPassphrase.tsx +++ b/packages/suite/src/components/suite/modals/ReduxModal/DeviceContextModal/EnterPassphrase.tsx @@ -1,8 +1,8 @@ import { useState } from 'react'; import { Translation, TranslationKey } from '@suite/intl'; +import { selectDeviceModel } from '@suite-common/device'; import { TrezorDevice } from '@suite-common/suite-types'; -import { selectDeviceModel } from '@suite-common/wallet-core'; import { Card, Collapsible, Column, H3, H4, Icon, Paragraph, Row, Text } from '@trezor/components'; import { spacings } from '@trezor/theme'; import { HELP_CENTER_PASSPHRASE_URL } from '@trezor/urls'; diff --git a/packages/suite/src/components/suite/modals/ReduxModal/DeviceContextModal/PassphraseModal.tsx b/packages/suite/src/components/suite/modals/ReduxModal/DeviceContextModal/PassphraseModal.tsx index 7500319528..7f1f25ee80 100644 --- a/packages/suite/src/components/suite/modals/ReduxModal/DeviceContextModal/PassphraseModal.tsx +++ b/packages/suite/src/components/suite/modals/ReduxModal/DeviceContextModal/PassphraseModal.tsx @@ -1,10 +1,10 @@ import { useCallback } from 'react'; +import { selectHasDevicePassphraseEntryCapability } from '@suite-common/device'; import { TrezorDevice } from '@suite-common/suite-types'; import { cancelDiscoveryThunk, selectDiscoveryByDevicePath, - selectHasDevicePassphraseEntryCapability, selectIsDiscoveryStatusConfirmEmptyPassphrase, submitPassphrase, } from '@suite-common/wallet-core'; diff --git a/packages/suite/src/components/suite/modals/ReduxModal/DeviceContextModal/PassphraseOnDeviceModal.tsx b/packages/suite/src/components/suite/modals/ReduxModal/DeviceContextModal/PassphraseOnDeviceModal.tsx index e2bfe12478..95922c143d 100644 --- a/packages/suite/src/components/suite/modals/ReduxModal/DeviceContextModal/PassphraseOnDeviceModal.tsx +++ b/packages/suite/src/components/suite/modals/ReduxModal/DeviceContextModal/PassphraseOnDeviceModal.tsx @@ -3,10 +3,8 @@ import { useIntl } from 'react-intl'; import styled from 'styled-components'; import { Translation, messages } from '@suite/intl'; -import { - selectIsDiscoveryStatusConfirmEmptyPassphrase, - selectSelectedDeviceLabelOrName, -} from '@suite-common/wallet-core'; +import { selectSelectedDeviceLabelOrName } from '@suite-common/device'; +import { selectIsDiscoveryStatusConfirmEmptyPassphrase } from '@suite-common/wallet-core'; import { H2, Modal, Paragraph } from '@trezor/components'; import TrezorConnect from '@trezor/connect'; import { ConfirmOnDevicePill } from '@trezor/product-components'; diff --git a/packages/suite/src/components/suite/modals/ReduxModal/DeviceContextModal/PassphraseWalletConfirmation.tsx b/packages/suite/src/components/suite/modals/ReduxModal/DeviceContextModal/PassphraseWalletConfirmation.tsx index 0fc347c8b7..d3aeb54485 100644 --- a/packages/suite/src/components/suite/modals/ReduxModal/DeviceContextModal/PassphraseWalletConfirmation.tsx +++ b/packages/suite/src/components/suite/modals/ReduxModal/DeviceContextModal/PassphraseWalletConfirmation.tsx @@ -1,6 +1,6 @@ import { Translation } from '@suite/intl'; +import { selectDeviceModel } from '@suite-common/device'; import { TrezorDevice } from '@suite-common/suite-types'; -import { selectDeviceModel } from '@suite-common/wallet-core'; import { Banner, Column, H3 } from '@trezor/components'; import { spacings } from '@trezor/theme'; diff --git a/packages/suite/src/components/suite/modals/ReduxModal/DeviceContextModal/PinInvalidModal.tsx b/packages/suite/src/components/suite/modals/ReduxModal/DeviceContextModal/PinInvalidModal.tsx index 091ba439cf..71da20b7fc 100644 --- a/packages/suite/src/components/suite/modals/ReduxModal/DeviceContextModal/PinInvalidModal.tsx +++ b/packages/suite/src/components/suite/modals/ReduxModal/DeviceContextModal/PinInvalidModal.tsx @@ -1,5 +1,5 @@ import { Translation } from '@suite/intl'; -import { selectSelectedDeviceLabelOrName } from '@suite-common/wallet-core'; +import { selectSelectedDeviceLabelOrName } from '@suite-common/device'; import { Modal } from '@trezor/components'; import { useSelector } from 'src/hooks/suite'; diff --git a/packages/suite/src/components/suite/modals/ReduxModal/DeviceContextModal/PinModal.tsx b/packages/suite/src/components/suite/modals/ReduxModal/DeviceContextModal/PinModal.tsx index d1e146a4c8..91a9202bc9 100644 --- a/packages/suite/src/components/suite/modals/ReduxModal/DeviceContextModal/PinModal.tsx +++ b/packages/suite/src/components/suite/modals/ReduxModal/DeviceContextModal/PinModal.tsx @@ -1,5 +1,5 @@ import { Translation } from '@suite/intl'; -import { usePin } from '@suite-common/wallet-core'; +import { usePin } from '@suite-common/device'; import { Modal } from '@trezor/components'; import { ConfirmOnDevicePill } from '@trezor/product-components'; diff --git a/packages/suite/src/components/suite/modals/ReduxModal/DeviceContextModal/SignMessageModal.tsx b/packages/suite/src/components/suite/modals/ReduxModal/DeviceContextModal/SignMessageModal.tsx index 6a3088b615..96db7c79d9 100644 --- a/packages/suite/src/components/suite/modals/ReduxModal/DeviceContextModal/SignMessageModal.tsx +++ b/packages/suite/src/components/suite/modals/ReduxModal/DeviceContextModal/SignMessageModal.tsx @@ -1,11 +1,11 @@ import styled from 'styled-components'; import { Translation } from '@suite/intl'; +import type { DeviceRootState } from '@suite-common/device'; import { TrezorDevice } from '@suite-common/suite-types'; import { NetworkSymbol, getNetwork, getNetworkByEvmChainId } from '@suite-common/wallet-config'; import { AccountsRootState, - DeviceRootState, selectAddressByNetworkAndPath, selectDeviceAccounts, } from '@suite-common/wallet-core'; diff --git a/packages/suite/src/components/suite/modals/ReduxModal/TransactionReviewModal/TransactionReviewModalBody.tsx b/packages/suite/src/components/suite/modals/ReduxModal/TransactionReviewModal/TransactionReviewModalBody.tsx index adca64488e..5844471628 100644 --- a/packages/suite/src/components/suite/modals/ReduxModal/TransactionReviewModal/TransactionReviewModalBody.tsx +++ b/packages/suite/src/components/suite/modals/ReduxModal/TransactionReviewModal/TransactionReviewModalBody.tsx @@ -1,7 +1,8 @@ import { useCallback, useEffect, useState } from 'react'; import { events } from '@suite/analytics'; -import { SendState, StakeState, selectSelectedDevice } from '@suite-common/wallet-core'; +import { selectSelectedDevice } from '@suite-common/device'; +import { SendState, StakeState } from '@suite-common/wallet-core'; import { FormState } from '@suite-common/wallet-types'; import { constructTransactionReviewOutputsOptional, diff --git a/packages/suite/src/components/suite/modals/ReduxModal/TransactionReviewModal/TransactionReviewModalBodyInner.tsx b/packages/suite/src/components/suite/modals/ReduxModal/TransactionReviewModal/TransactionReviewModalBodyInner.tsx index adff38a9a2..758a186208 100644 --- a/packages/suite/src/components/suite/modals/ReduxModal/TransactionReviewModal/TransactionReviewModalBodyInner.tsx +++ b/packages/suite/src/components/suite/modals/ReduxModal/TransactionReviewModal/TransactionReviewModalBodyInner.tsx @@ -2,9 +2,9 @@ import { useEffect, useRef, useState } from 'react'; import { events } from '@suite/analytics'; import { Translation } from '@suite/intl'; +import type { DeviceRootState } from '@suite-common/device'; import { selectTradingComposedTransactionInfo } from '@suite-common/trading'; import { - DeviceRootState, SendState, SerializedTx, StakeState, diff --git a/packages/suite/src/components/suite/modals/ReduxModal/TransactionReviewModal/TransactionReviewOutputList/TransactionReviewModalConfirmOnDevice.tsx b/packages/suite/src/components/suite/modals/ReduxModal/TransactionReviewModal/TransactionReviewOutputList/TransactionReviewModalConfirmOnDevice.tsx index 2bffd72834..f498ee06fa 100644 --- a/packages/suite/src/components/suite/modals/ReduxModal/TransactionReviewModal/TransactionReviewOutputList/TransactionReviewModalConfirmOnDevice.tsx +++ b/packages/suite/src/components/suite/modals/ReduxModal/TransactionReviewModal/TransactionReviewOutputList/TransactionReviewModalConfirmOnDevice.tsx @@ -1,7 +1,8 @@ import { useSelector } from 'react-redux'; import { Translation } from '@suite/intl'; -import { SerializedTx, selectSelectedDevice } from '@suite-common/wallet-core'; +import { selectSelectedDevice } from '@suite-common/device'; +import { SerializedTx } from '@suite-common/wallet-core'; import { ReviewOutput } from '@suite-common/wallet-types'; import { ConfirmOnDevicePill } from '@trezor/product-components'; diff --git a/packages/suite/src/components/suite/modals/ReduxModal/TransactionReviewModal/TransactionReviewOutputList/TransactionReviewModalContent.tsx b/packages/suite/src/components/suite/modals/ReduxModal/TransactionReviewModal/TransactionReviewOutputList/TransactionReviewModalContent.tsx index e00daf41f0..ba94425bd1 100644 --- a/packages/suite/src/components/suite/modals/ReduxModal/TransactionReviewModal/TransactionReviewOutputList/TransactionReviewModalContent.tsx +++ b/packages/suite/src/components/suite/modals/ReduxModal/TransactionReviewModal/TransactionReviewOutputList/TransactionReviewModalContent.tsx @@ -1,11 +1,7 @@ import { useMemo } from 'react'; -import { - DeviceRootState, - SerializedTx, - selectSelectedDevice, - selectSendFormReviewButtonRequestsCount, -} from '@suite-common/wallet-core'; +import { DeviceRootState, selectSelectedDevice } from '@suite-common/device'; +import { SerializedTx, selectSendFormReviewButtonRequestsCount } from '@suite-common/wallet-core'; import { Account, FormState, GeneralPrecomposedTransactionFinal } from '@suite-common/wallet-types'; import { constructTransactionReviewOutputsOptional, @@ -19,10 +15,10 @@ import { spacings } from '@trezor/theme'; import { useSelector } from 'src/hooks/suite'; +import { TransactionReviewOutputList } from './TransactionReviewOutputList'; import { ExpiredTxValidity } from '../../UserContextModal/TxDetailModal/ExpiredTxValidity'; import { ReplaceByFeeFailedOriginalTxConfirmed } from '../../UserContextModal/TxDetailModal/ReplaceByFeeFailedOriginalTxConfirmed'; import { TransactionReviewDetails } from '../TransactionReviewDetails'; -import { TransactionReviewOutputList } from './TransactionReviewOutputList'; import { hasTxValidityExpired } from '../utils'; type TransactionReviewModalContentProps = { diff --git a/packages/suite/src/components/suite/modals/ReduxModal/TransactionReviewModal/TransactionReviewOutputList/TransactionReviewOutput.tsx b/packages/suite/src/components/suite/modals/ReduxModal/TransactionReviewModal/TransactionReviewOutputList/TransactionReviewOutput.tsx index 96f4d554d8..1cad5f5797 100644 --- a/packages/suite/src/components/suite/modals/ReduxModal/TransactionReviewModal/TransactionReviewOutputList/TransactionReviewOutput.tsx +++ b/packages/suite/src/components/suite/modals/ReduxModal/TransactionReviewModal/TransactionReviewOutputList/TransactionReviewOutput.tsx @@ -1,17 +1,17 @@ import { ReactNode } from 'react'; import { Translation, TranslationFunction, TranslationKey, useTranslation } from '@suite/intl'; +import { isApprovalFlowSupported, selectSelectedDevice } from '@suite-common/device'; import { UINT256_MAX } from '@suite-common/suite-constants'; import { TrezorDevice } from '@suite-common/suite-types'; import { NetworkType, getNetworkDisplaySymbol } from '@suite-common/wallet-config'; import { BTC_LOCKTIME_VALUE } from '@suite-common/wallet-constants'; -import { selectAccounts, selectSelectedDevice } from '@suite-common/wallet-core'; +import { selectAccounts } from '@suite-common/wallet-core'; import { EvmTransactionPurpose, ReviewOutput, StakeType } from '@suite-common/wallet-types'; import { EvmApprovalPurpose, findAccountsByAddress, getCardanoFingerprint, - isApprovalFlowSupported, isEvmApprovalTxByTextSignature, isTestnet, } from '@suite-common/wallet-utils'; diff --git a/packages/suite/src/components/suite/modals/ReduxModal/TransactionReviewModal/TransactionReviewOutputList/TransactionReviewOutputList.tsx b/packages/suite/src/components/suite/modals/ReduxModal/TransactionReviewModal/TransactionReviewOutputList/TransactionReviewOutputList.tsx index 944f1ae207..8ca54acbae 100644 --- a/packages/suite/src/components/suite/modals/ReduxModal/TransactionReviewModal/TransactionReviewOutputList/TransactionReviewOutputList.tsx +++ b/packages/suite/src/components/suite/modals/ReduxModal/TransactionReviewModal/TransactionReviewOutputList/TransactionReviewOutputList.tsx @@ -3,7 +3,8 @@ import { useEffect, useRef } from 'react'; import styled from 'styled-components'; import { Translation } from '@suite/intl'; -import { DeviceRootState, selectSendFormReviewLastButtonCode } from '@suite-common/wallet-core'; +import type { DeviceRootState } from '@suite-common/device'; +import { selectSendFormReviewLastButtonCode } from '@suite-common/wallet-core'; import type { FormState, GeneralPrecomposedTransactionFinal, diff --git a/packages/suite/src/components/suite/modals/ReduxModal/TransactionReviewModal/TransactionReviewOutputList/TransactionReviewTotalOutput.tsx b/packages/suite/src/components/suite/modals/ReduxModal/TransactionReviewModal/TransactionReviewOutputList/TransactionReviewTotalOutput.tsx index c57eec4f62..e166d4428f 100644 --- a/packages/suite/src/components/suite/modals/ReduxModal/TransactionReviewModal/TransactionReviewOutputList/TransactionReviewTotalOutput.tsx +++ b/packages/suite/src/components/suite/modals/ReduxModal/TransactionReviewModal/TransactionReviewOutputList/TransactionReviewTotalOutput.tsx @@ -1,6 +1,6 @@ import { Translation } from '@suite/intl'; +import { isApprovalFlowSupported, selectSelectedDevice } from '@suite-common/device'; import { NetworkType } from '@suite-common/wallet-config'; -import { selectSelectedDevice } from '@suite-common/wallet-core'; import { Account, FormState, @@ -11,7 +11,6 @@ import { import { getIsUpdatedEthereumSendFlow, getIsUpdatedSendFlow, - isApprovalFlowSupported, isEvmApprovalTx, isTestnet, } from '@suite-common/wallet-utils'; diff --git a/packages/suite/src/components/suite/modals/ReduxModal/UserContextModal/AddAccountModal/AddAccountButton/AddAccountButton.tsx b/packages/suite/src/components/suite/modals/ReduxModal/UserContextModal/AddAccountModal/AddAccountButton/AddAccountButton.tsx index e702469593..fec716adbf 100644 --- a/packages/suite/src/components/suite/modals/ReduxModal/UserContextModal/AddAccountModal/AddAccountButton/AddAccountButton.tsx +++ b/packages/suite/src/components/suite/modals/ReduxModal/UserContextModal/AddAccountModal/AddAccountButton/AddAccountButton.tsx @@ -2,8 +2,8 @@ import { useCallback } from 'react'; import { events } from '@suite/analytics'; import { Translation } from '@suite/intl'; +import { selectSelectedDevice } from '@suite-common/device'; import { Network, NetworkAccount } from '@suite-common/wallet-config'; -import { selectSelectedDevice } from '@suite-common/wallet-core'; import { UnavailableCapability } from '@trezor/connect'; import { useAccountSearch, useSelector } from 'src/hooks/suite'; diff --git a/packages/suite/src/components/suite/modals/ReduxModal/UserContextModal/AddAccountModal/AddAccountButton/AddCoinjoinAccountButton.tsx b/packages/suite/src/components/suite/modals/ReduxModal/UserContextModal/AddAccountModal/AddAccountButton/AddCoinjoinAccountButton.tsx index 698bec382a..fcc2e8ce69 100644 --- a/packages/suite/src/components/suite/modals/ReduxModal/UserContextModal/AddAccountModal/AddAccountButton/AddCoinjoinAccountButton.tsx +++ b/packages/suite/src/components/suite/modals/ReduxModal/UserContextModal/AddAccountModal/AddAccountButton/AddCoinjoinAccountButton.tsx @@ -1,10 +1,10 @@ import { useState } from 'react'; import { Translation } from '@suite/intl'; +import { selectSelectedDevice } from '@suite-common/device'; import { RequestEnableTorResponse } from '@suite-common/suite-config'; import { isDevEnv } from '@suite-common/suite-utils'; import { Network, NetworkAccount, NetworkSymbol } from '@suite-common/wallet-config'; -import { selectSelectedDevice } from '@suite-common/wallet-core'; import { UnavailableCapabilities } from '@trezor/connect'; import { isDesktop } from '@trezor/env-utils'; import { resolveAfter } from '@trezor/utils'; diff --git a/packages/suite/src/components/suite/modals/ReduxModal/UserContextModal/ConfirmUnverifiedModal.tsx b/packages/suite/src/components/suite/modals/ReduxModal/UserContextModal/ConfirmUnverifiedModal.tsx index 3a63aecf19..83e05571e0 100644 --- a/packages/suite/src/components/suite/modals/ReduxModal/UserContextModal/ConfirmUnverifiedModal.tsx +++ b/packages/suite/src/components/suite/modals/ReduxModal/UserContextModal/ConfirmUnverifiedModal.tsx @@ -1,8 +1,8 @@ import { useEffect } from 'react'; import { Translation, TranslationKey } from '@suite/intl'; +import { selectSelectedDeviceLabelOrName } from '@suite-common/device'; import { ExtraDependencies } from '@suite-common/redux-utils'; -import { selectSelectedDeviceLabelOrName } from '@suite-common/wallet-core'; import { H3, Modal, Paragraph, Tooltip } from '@trezor/components'; import { applySettings } from 'src/actions/settings/deviceSettingsActions'; diff --git a/packages/suite/src/components/suite/modals/ReduxModal/UserContextModal/ConnectAddressConfirmation.tsx b/packages/suite/src/components/suite/modals/ReduxModal/UserContextModal/ConnectAddressConfirmation.tsx index ed22bbdb37..ef90d7fbff 100644 --- a/packages/suite/src/components/suite/modals/ReduxModal/UserContextModal/ConnectAddressConfirmation.tsx +++ b/packages/suite/src/components/suite/modals/ReduxModal/UserContextModal/ConnectAddressConfirmation.tsx @@ -7,7 +7,7 @@ import { getPermissionDeferred, selectConnectPopupCall, } from '@suite-common/connect-popup'; -import { selectSelectedDeviceLabelOrName } from '@suite-common/wallet-core'; +import { selectSelectedDeviceLabelOrName } from '@suite-common/device'; import { Badge, Button, Card, Column, H3, Icon, Modal, Paragraph, Row } from '@trezor/components'; import { TypedError } from '@trezor/connect-common/src/constants/errors'; import { DeviceModelInternal } from '@trezor/device-utils'; diff --git a/packages/suite/src/components/suite/modals/ReduxModal/UserContextModal/ConnectErrorModal.tsx b/packages/suite/src/components/suite/modals/ReduxModal/UserContextModal/ConnectErrorModal.tsx index 24c2ca33aa..b40fcae68c 100644 --- a/packages/suite/src/components/suite/modals/ReduxModal/UserContextModal/ConnectErrorModal.tsx +++ b/packages/suite/src/components/suite/modals/ReduxModal/UserContextModal/ConnectErrorModal.tsx @@ -4,7 +4,7 @@ import { connectPopupCallThunkInner, selectConnectPopupCall, } from '@suite-common/connect-popup'; -import { selectDevices, selectSelectedDevice } from '@suite-common/wallet-core'; +import { selectDevices, selectSelectedDevice } from '@suite-common/device'; import { Card, Column, H3, Icon, Modal, Paragraph, Row } from '@trezor/components'; import { UI_REQUEST } from '@trezor/connect'; import { spacings } from '@trezor/theme'; diff --git a/packages/suite/src/components/suite/modals/ReduxModal/UserContextModal/MultiShareBackupModal/MultiShareBackupModal.tsx b/packages/suite/src/components/suite/modals/ReduxModal/UserContextModal/MultiShareBackupModal/MultiShareBackupModal.tsx index 9b8b3a14a2..146e6ce428 100644 --- a/packages/suite/src/components/suite/modals/ReduxModal/UserContextModal/MultiShareBackupModal/MultiShareBackupModal.tsx +++ b/packages/suite/src/components/suite/modals/ReduxModal/UserContextModal/MultiShareBackupModal/MultiShareBackupModal.tsx @@ -2,7 +2,7 @@ import { useState } from 'react'; import { events } from '@suite/analytics'; import { Translation } from '@suite/intl'; -import { selectSelectedDevice } from '@suite-common/wallet-core'; +import { selectSelectedDevice } from '@suite-common/device'; import { Modal, ModalProps } from '@trezor/components'; import TrezorConnect, { PROTO } from '@trezor/connect'; import { ConfirmOnDevicePill } from '@trezor/product-components'; diff --git a/packages/suite/src/components/suite/notifications/NotificationRenderer/NotificationRenderer.tsx b/packages/suite/src/components/suite/notifications/NotificationRenderer/NotificationRenderer.tsx index 826e2f3ba9..12c93d44b1 100644 --- a/packages/suite/src/components/suite/notifications/NotificationRenderer/NotificationRenderer.tsx +++ b/packages/suite/src/components/suite/notifications/NotificationRenderer/NotificationRenderer.tsx @@ -2,9 +2,9 @@ import { ComponentType, JSX } from 'react'; import { useSelector } from 'react-redux'; import { ExtendedMessageDescriptor, Translation } from '@suite/intl'; +import { selectSelectedDeviceLabelOrName } from '@suite-common/device'; import { AUTH_DEVICE, type NotificationEntry } from '@suite-common/toast-notifications'; import { getNetworkDisplaySymbol } from '@suite-common/wallet-config'; -import { selectSelectedDeviceLabelOrName } from '@suite-common/wallet-core'; import { DEVICE } from '@trezor/connect'; import { exhaustive } from '@trezor/type-utils'; diff --git a/packages/suite/src/components/suite/notifications/NotificationRenderer/TransactionRenderer.tsx b/packages/suite/src/components/suite/notifications/NotificationRenderer/TransactionRenderer.tsx index d90cf6cc41..8f67dacc41 100644 --- a/packages/suite/src/components/suite/notifications/NotificationRenderer/TransactionRenderer.tsx +++ b/packages/suite/src/components/suite/notifications/NotificationRenderer/TransactionRenderer.tsx @@ -1,10 +1,9 @@ import { Translation } from '@suite/intl'; +import { selectDevices, selectSelectedDevice } from '@suite-common/device'; import { selectAccounts, selectBlockchainState, - selectSelectedDevice as selectDeviceSelector, selectDeviceThunk, - selectDevices, selectTransactions, } from '@suite-common/wallet-core'; import { @@ -47,7 +46,7 @@ export const TransactionRenderer = ({ render: View, ...props }: TransactionRende const transactions = useSelector(selectTransactions); const blockchain = useSelector(selectBlockchainState); const devices = useSelector(selectDevices); - const currentDevice = useSelector(selectDeviceSelector); + const currentDevice = useSelector(selectSelectedDevice); const routeName = useSelector(selectRouteName); const dispatch = useDispatch(); diff --git a/packages/suite/src/components/wallet/WalletLayout/AccountsMenu/AccountsList.tsx b/packages/suite/src/components/wallet/WalletLayout/AccountsMenu/AccountsList.tsx index e50f4435f3..47c8b7f8ea 100644 --- a/packages/suite/src/components/wallet/WalletLayout/AccountsMenu/AccountsList.tsx +++ b/packages/suite/src/components/wallet/WalletLayout/AccountsMenu/AccountsList.tsx @@ -1,7 +1,8 @@ import { Translation } from '@suite/intl'; +import { selectSelectedDevice } from '@suite-common/device'; import { findSuiteSyncAccountLabel, selectSuiteSyncAccountLabels } from '@suite-common/suite-sync'; import { AccountType } from '@suite-common/wallet-config'; -import { selectAllAccountsToList, selectSelectedDevice } from '@suite-common/wallet-core'; +import { selectAllAccountsToList } from '@suite-common/wallet-core'; import { Account } from '@suite-common/wallet-types'; import { accountSearchFn, parseAccountKey } from '@suite-common/wallet-utils'; import { Column } from '@trezor/components'; diff --git a/packages/suite/src/components/wallet/WalletLayout/AccountsMenu/AccountsMenu.tsx b/packages/suite/src/components/wallet/WalletLayout/AccountsMenu/AccountsMenu.tsx index af557e0a0f..25ae06d8e9 100644 --- a/packages/suite/src/components/wallet/WalletLayout/AccountsMenu/AccountsMenu.tsx +++ b/packages/suite/src/components/wallet/WalletLayout/AccountsMenu/AccountsMenu.tsx @@ -3,7 +3,7 @@ import React from 'react'; import styled from 'styled-components'; import { Translation } from '@suite/intl'; -import { selectSelectedDevice } from '@suite-common/wallet-core'; +import { selectSelectedDevice } from '@suite-common/device'; import { useScrollShadow } from '@trezor/components'; import { useSelector } from 'src/hooks/suite'; diff --git a/packages/suite/src/components/wallet/WalletLayout/AccountsMenu/AccountsMenuHeader.tsx b/packages/suite/src/components/wallet/WalletLayout/AccountsMenu/AccountsMenuHeader.tsx index aeebe8dac1..545476b12e 100644 --- a/packages/suite/src/components/wallet/WalletLayout/AccountsMenu/AccountsMenuHeader.tsx +++ b/packages/suite/src/components/wallet/WalletLayout/AccountsMenu/AccountsMenuHeader.tsx @@ -1,7 +1,8 @@ import styled from 'styled-components'; import { Translation } from '@suite/intl'; -import { selectAllAccountsToList, selectSelectedDevice } from '@suite-common/wallet-core'; +import { selectSelectedDevice } from '@suite-common/device'; +import { selectAllAccountsToList } from '@suite-common/wallet-core'; import { Box, Column, Divider, Icon, Row, SkeletonRectangle, Tooltip } from '@trezor/components'; import { AccountSearchBox } from './AccountSearchBox'; diff --git a/packages/suite/src/components/wallet/WalletLayout/AccountsMenu/RefreshAfterDiscoveryNeeded.tsx b/packages/suite/src/components/wallet/WalletLayout/AccountsMenu/RefreshAfterDiscoveryNeeded.tsx index 28f7f67dab..adef218e91 100644 --- a/packages/suite/src/components/wallet/WalletLayout/AccountsMenu/RefreshAfterDiscoveryNeeded.tsx +++ b/packages/suite/src/components/wallet/WalletLayout/AccountsMenu/RefreshAfterDiscoveryNeeded.tsx @@ -4,8 +4,8 @@ import { AnimatePresence, MotionProps, motion } from 'framer-motion'; import styled from 'styled-components'; import { Translation } from '@suite/intl'; +import { selectSelectedDevice } from '@suite-common/device'; import { - selectSelectedDevice, selectShowRediscoverButton, startOrRestartDiscoveryThunk, } from '@suite-common/wallet-core'; diff --git a/packages/suite/src/hooks/settings/useNetworkSupport.ts b/packages/suite/src/hooks/settings/useNetworkSupport.ts index f2e755cdcd..71e6b0c34f 100644 --- a/packages/suite/src/hooks/settings/useNetworkSupport.ts +++ b/packages/suite/src/hooks/settings/useNetworkSupport.ts @@ -1,5 +1,6 @@ +import { selectSelectedDevice } from '@suite-common/device'; import { Network, getMainnets, getTestnets } from '@suite-common/wallet-config'; -import { selectDeviceSupportedNetworks, selectSelectedDevice } from '@suite-common/wallet-core'; +import { selectDeviceSupportedNetworks } from '@suite-common/wallet-core'; import { DeviceModelInternal, hasBitcoinOnlyFirmware } from '@trezor/device-utils'; import { arrayPartition } from '@trezor/utils'; diff --git a/packages/suite/src/hooks/suite/useChangeDeviceLabel.ts b/packages/suite/src/hooks/suite/useChangeDeviceLabel.ts index 678459272c..8a4690614e 100644 --- a/packages/suite/src/hooks/suite/useChangeDeviceLabel.ts +++ b/packages/suite/src/hooks/suite/useChangeDeviceLabel.ts @@ -4,8 +4,8 @@ import { yupResolver } from '@hookform/resolvers/yup'; import { TranslationFunction, useTranslation } from '@suite/intl'; import { events } from '@suite-common/analytics'; +import { selectSelectedDeviceLabelOrName } from '@suite-common/device'; import { yup } from '@suite-common/validators'; -import { selectSelectedDeviceLabelOrName } from '@suite-common/wallet-core'; import { isAscii } from '@trezor/utils'; import { applySettings } from 'src/actions/settings/deviceSettingsActions'; diff --git a/packages/suite/src/hooks/suite/useDevice.ts b/packages/suite/src/hooks/suite/useDevice.ts index d11fdd80a3..70ff56bf62 100644 --- a/packages/suite/src/hooks/suite/useDevice.ts +++ b/packages/suite/src/hooks/suite/useDevice.ts @@ -1,7 +1,7 @@ import { useCallback } from 'react'; +import { selectSelectedDevice } from '@suite-common/device'; import { TrezorDevice } from '@suite-common/suite-types'; -import { selectSelectedDevice } from '@suite-common/wallet-core'; import { selectIsDeviceOrUiLocked } from 'src/selectors/suite/suiteSelectors'; diff --git a/packages/suite/src/hooks/suite/useDiscovery.ts b/packages/suite/src/hooks/suite/useDiscovery.ts index 0fae809dee..b3ac473484 100644 --- a/packages/suite/src/hooks/suite/useDiscovery.ts +++ b/packages/suite/src/hooks/suite/useDiscovery.ts @@ -1,10 +1,7 @@ import { useCallback } from 'react'; -import { - isDiscoveryInProgress, - selectDiscoveryByDevicePath, - selectSelectedDevice, -} from '@suite-common/wallet-core'; +import { selectSelectedDevice } from '@suite-common/device'; +import { isDiscoveryInProgress, selectDiscoveryByDevicePath } from '@suite-common/wallet-core'; import { useSelector } from './useSelector'; diff --git a/packages/suite/src/hooks/suite/useDisplayMode.ts b/packages/suite/src/hooks/suite/useDisplayMode.ts index c3d36684a1..a5e44b6560 100644 --- a/packages/suite/src/hooks/suite/useDisplayMode.ts +++ b/packages/suite/src/hooks/suite/useDisplayMode.ts @@ -1,4 +1,4 @@ -import { selectDeviceUnavailableCapabilities } from '@suite-common/wallet-core'; +import { selectDeviceUnavailableCapabilities } from '@suite-common/device'; import { AddressDisplayOptions, ReviewOutput, StakeType } from '@suite-common/wallet-types'; import { selectSelectedAccount } from 'src/reducers/wallet/selectedAccountReducer'; diff --git a/packages/suite/src/hooks/suite/useFirmwareDesktopUpdate.ts b/packages/suite/src/hooks/suite/useFirmwareDesktopUpdate.ts index 044a3607d4..7022158ec7 100644 --- a/packages/suite/src/hooks/suite/useFirmwareDesktopUpdate.ts +++ b/packages/suite/src/hooks/suite/useFirmwareDesktopUpdate.ts @@ -1,11 +1,11 @@ import { useCallback, useEffect, useState } from 'react'; +import { selectIsDeviceConnectedViaBluetoothLowOnBattery } from '@suite-common/device'; import { type FirmwareUpdateProps, selectFirmware, useFirmwareInstallation, } from '@suite-common/firmware'; -import { selectIsDeviceConnectedViaBluetoothLowOnBattery } from '@suite-common/wallet-core'; import { UI } from '@trezor/connect'; import { useSelector } from './useSelector'; diff --git a/packages/suite/src/hooks/suite/useLoadingSkeleton.ts b/packages/suite/src/hooks/suite/useLoadingSkeleton.ts index 01d56b9a5a..4d34251217 100644 --- a/packages/suite/src/hooks/suite/useLoadingSkeleton.ts +++ b/packages/suite/src/hooks/suite/useLoadingSkeleton.ts @@ -1,4 +1,4 @@ -import { selectSelectedDevice } from '@suite-common/wallet-core'; +import { selectSelectedDevice } from '@suite-common/device'; import { useSelector } from 'src/hooks/suite'; diff --git a/packages/suite/src/hooks/suite/usePasswords.ts b/packages/suite/src/hooks/suite/usePasswords.ts index 07c1d5026a..269198f489 100644 --- a/packages/suite/src/hooks/suite/usePasswords.ts +++ b/packages/suite/src/hooks/suite/usePasswords.ts @@ -1,6 +1,6 @@ import { useCallback, useState } from 'react'; -import { selectSelectedDevice } from '@suite-common/wallet-core'; +import { selectSelectedDevice } from '@suite-common/device'; import * as metadataPasswordsActions from 'src/actions/suite/metadata/metadataPasswordsActions'; import * as metadataProviderActions from 'src/actions/suite/metadata/metadataProviderThunks'; diff --git a/packages/suite/src/hooks/suite/useReceiveDisabled.tsx b/packages/suite/src/hooks/suite/useReceiveDisabled.tsx index 16dcb2d235..451717d403 100644 --- a/packages/suite/src/hooks/suite/useReceiveDisabled.tsx +++ b/packages/suite/src/hooks/suite/useReceiveDisabled.tsx @@ -1,7 +1,7 @@ import { FC, PropsWithChildren, ReactNode } from 'react'; import { Translation } from '@suite/intl'; -import { selectIsDeviceBackupUnfinished } from '@suite-common/wallet-core'; +import { selectIsDeviceBackupUnfinished } from '@suite-common/device'; import { Tooltip } from '@trezor/components'; import { selectIsFirmwareAuthenticityCheckEnabledAndHardFailed } from 'src/selectors/suite/suiteAuthenticityChecksSelectors'; diff --git a/packages/suite/src/hooks/wallet/trading/form/common/useTradingComposeTransaction.ts b/packages/suite/src/hooks/wallet/trading/form/common/useTradingComposeTransaction.ts index 9bef7657fa..d957a6fc34 100644 --- a/packages/suite/src/hooks/wallet/trading/form/common/useTradingComposeTransaction.ts +++ b/packages/suite/src/hooks/wallet/trading/form/common/useTradingComposeTransaction.ts @@ -2,6 +2,7 @@ import { useEffect, useMemo, useState } from 'react'; import { UseFormReturn } from 'react-hook-form'; import { useTranslation } from '@suite/intl'; +import { selectSelectedDevice } from '@suite-common/device'; import { TRADING_FORM_OUTPUT_ADDRESS, TRADING_FORM_OUTPUT_AMOUNT, @@ -10,11 +11,7 @@ import { tradingActions, } from '@suite-common/trading'; import { COMPOSE_ERROR_TYPES } from '@suite-common/wallet-constants'; -import { - selectAccounts, - selectRawNetworkFeeInfo, - selectSelectedDevice, -} from '@suite-common/wallet-core'; +import { selectAccounts, selectRawNetworkFeeInfo } from '@suite-common/wallet-core'; import { AddressDisplayOptions } from '@suite-common/wallet-types'; import { getConvertedOrDefaultFeeInfo } from '@suite-common/wallet-utils'; diff --git a/packages/suite/src/hooks/wallet/trading/form/useTradingReceiveAddress.ts b/packages/suite/src/hooks/wallet/trading/form/useTradingReceiveAddress.ts index cb52231654..1ab5201957 100644 --- a/packages/suite/src/hooks/wallet/trading/form/useTradingReceiveAddress.ts +++ b/packages/suite/src/hooks/wallet/trading/form/useTradingReceiveAddress.ts @@ -3,6 +3,7 @@ import { useForm } from 'react-hook-form'; import { CryptoId } from 'invity-api'; +import { selectSelectedDevice } from '@suite-common/device'; import { TrezorDevice } from '@suite-common/suite-types'; import { TradingType, @@ -16,7 +17,6 @@ import { tradingBuyActions, tradingExchangeActions, } from '@suite-common/trading'; -import { selectSelectedDevice } from '@suite-common/wallet-core'; import { Account } from '@suite-common/wallet-types'; import { filterReceiveAccounts } from '@suite-common/wallet-utils'; diff --git a/packages/suite/src/hooks/wallet/trading/form/useTradingVerifyAccount.ts b/packages/suite/src/hooks/wallet/trading/form/useTradingVerifyAccount.ts index 83299db874..f11d4af331 100644 --- a/packages/suite/src/hooks/wallet/trading/form/useTradingVerifyAccount.ts +++ b/packages/suite/src/hooks/wallet/trading/form/useTradingVerifyAccount.ts @@ -1,6 +1,7 @@ import { useCallback, useEffect, useMemo, useState } from 'react'; import { useForm } from 'react-hook-form'; +import { selectSelectedDevice } from '@suite-common/device'; import { TrezorDevice } from '@suite-common/suite-types'; import { cryptoIdToSymbol, @@ -10,7 +11,6 @@ import { selectTradingBuyReceiveAccountKey, selectTradingExchangeAccountKey, } from '@suite-common/trading'; -import { selectSelectedDevice } from '@suite-common/wallet-core'; import { Account } from '@suite-common/wallet-types'; import { filterReceiveAccounts } from '@suite-common/wallet-utils'; diff --git a/packages/suite/src/hooks/wallet/useBitcoinAmountUnit.ts b/packages/suite/src/hooks/wallet/useBitcoinAmountUnit.ts index 2fcb12879d..59f1c2b897 100644 --- a/packages/suite/src/hooks/wallet/useBitcoinAmountUnit.ts +++ b/packages/suite/src/hooks/wallet/useBitcoinAmountUnit.ts @@ -1,9 +1,6 @@ +import { selectDeviceUnavailableCapabilities } from '@suite-common/device'; import { NetworkSymbol, getNetworkOptional } from '@suite-common/wallet-config'; -import { - selectDeviceUnavailableCapabilities, - setBitcoinAmountUnits, - toggleBitcoinAmountUnits, -} from '@suite-common/wallet-core'; +import { setBitcoinAmountUnits, toggleBitcoinAmountUnits } from '@suite-common/wallet-core'; import { PROTO } from '@trezor/connect'; import { useDispatch, useSelector } from 'src/hooks/suite'; diff --git a/packages/suite/src/middlewares/recovery/recoveryMiddleware.ts b/packages/suite/src/middlewares/recovery/recoveryMiddleware.ts index 9b393c2250..72e58926c7 100644 --- a/packages/suite/src/middlewares/recovery/recoveryMiddleware.ts +++ b/packages/suite/src/middlewares/recovery/recoveryMiddleware.ts @@ -1,6 +1,6 @@ import { MiddlewareAPI } from 'redux'; -import { deviceActions } from '@suite-common/wallet-core'; +import { deviceActions } from '@suite-common/device'; import { UI } from '@trezor/connect'; import * as onboardingActions from 'src/actions/onboarding/onboardingActions'; diff --git a/packages/suite/src/middlewares/suite/__tests__/buttonRequestMiddleware.test.ts b/packages/suite/src/middlewares/suite/__tests__/buttonRequestMiddleware.test.ts index f950f05706..b21a0dc960 100644 --- a/packages/suite/src/middlewares/suite/__tests__/buttonRequestMiddleware.test.ts +++ b/packages/suite/src/middlewares/suite/__tests__/buttonRequestMiddleware.test.ts @@ -1,8 +1,8 @@ import { connectInitThunk } from '@suite-common/connect-init'; +import { deviceActions } from '@suite-common/device'; import { messageSystemInitialState } from '@suite-common/message-system'; import { mockSuiteDevice } from '@suite-common/suite-types/mocks'; import { extraDependenciesCommonMock, testMocks } from '@suite-common/test-utils'; -import { deviceActions } from '@suite-common/wallet-core'; import { UI, UI_EVENT } from '@trezor/connect'; import * as deviceSettingsActions from 'src/actions/settings/deviceSettingsActions'; diff --git a/packages/suite/src/middlewares/suite/__tests__/messageSystemMiddleware.test.ts b/packages/suite/src/middlewares/suite/__tests__/messageSystemMiddleware.test.ts index 65c216c47f..335070a369 100644 --- a/packages/suite/src/middlewares/suite/__tests__/messageSystemMiddleware.test.ts +++ b/packages/suite/src/middlewares/suite/__tests__/messageSystemMiddleware.test.ts @@ -1,12 +1,12 @@ import { Reducer, combineReducers } from '@reduxjs/toolkit'; +import { prepareDeviceReducer } from '@suite-common/device'; import { geolocationReducer } from '@suite-common/geolocation'; import { messageSystemActions, prepareMessageSystemReducer } from '@suite-common/message-system'; import * as messageSystemUtils from '@suite-common/message-system/src/messageSystemUtils'; import { AnyAction } from '@suite-common/redux-utils'; import { Action } from '@suite-common/suite-types'; import { configureMockStore } from '@suite-common/test-utils'; -import { prepareDeviceReducer } from '@suite-common/wallet-core'; import { AppState } from 'src/reducers/store'; import suiteReducer from 'src/reducers/suite/suiteReducer'; diff --git a/packages/suite/src/middlewares/suite/__tests__/redirectMiddleware.test.ts b/packages/suite/src/middlewares/suite/__tests__/redirectMiddleware.test.ts index 6336594b9a..9c3f934329 100644 --- a/packages/suite/src/middlewares/suite/__tests__/redirectMiddleware.test.ts +++ b/packages/suite/src/middlewares/suite/__tests__/redirectMiddleware.test.ts @@ -1,6 +1,6 @@ +import { deviceActions, prepareDeviceReducer } from '@suite-common/device'; import { mockConnectDevice, mockSuiteDevice } from '@suite-common/suite-types/mocks'; import { extraDependenciesCommonMock } from '@suite-common/test-utils'; -import { deviceActions, prepareDeviceReducer } from '@suite-common/wallet-core'; import { DEVICE } from '@trezor/connect'; import * as routerActions from 'src/actions/suite/routerActions'; diff --git a/packages/suite/src/middlewares/suite/__tests__/suiteMiddleware.test.ts b/packages/suite/src/middlewares/suite/__tests__/suiteMiddleware.test.ts index 38b5e9c2d4..ba9702eb80 100644 --- a/packages/suite/src/middlewares/suite/__tests__/suiteMiddleware.test.ts +++ b/packages/suite/src/middlewares/suite/__tests__/suiteMiddleware.test.ts @@ -1,6 +1,6 @@ import { analyticsActions, prepareAnalyticsReducer } from '@suite-common/analytics-redux'; +import { prepareDeviceReducer } from '@suite-common/device'; import { extraDependenciesCommonMock } from '@suite-common/test-utils'; -import { prepareDeviceReducer } from '@suite-common/wallet-core'; import { ROUTER } from 'src/actions/suite/constants'; import { appChanged } from 'src/actions/suite/suiteActions'; diff --git a/packages/suite/src/middlewares/suite/analyticsMiddleware.ts b/packages/suite/src/middlewares/suite/analyticsMiddleware.ts index 6928ee5f04..a814e52f4b 100644 --- a/packages/suite/src/middlewares/suite/analyticsMiddleware.ts +++ b/packages/suite/src/middlewares/suite/analyticsMiddleware.ts @@ -1,6 +1,7 @@ import { isAnyOf } from '@reduxjs/toolkit'; import { asTypedDesktopAnalytics, events } from '@suite/analytics'; +import { deviceActions, selectDevices, selectDevicesCount } from '@suite-common/device'; import { firmwareUpdate } from '@suite-common/firmware'; import { createMiddlewareWithExtraDeps } from '@suite-common/redux-utils'; import { UNIT_ABBREVIATIONS } from '@suite-common/suite-constants'; @@ -8,13 +9,7 @@ import { getIsDeviceDescriptorApiTypeBluetooth, getPhysicalDeviceCount, } from '@suite-common/suite-utils'; -import { - WALLET_SETTINGS, - deviceActions, - discoveryActions, - selectDevices, - selectDevicesCount, -} from '@suite-common/wallet-core'; +import { WALLET_SETTINGS, discoveryActions } from '@suite-common/wallet-core'; import { AccountKey } from '@suite-common/wallet-types'; import { accumulateAccountCountBySymbolAndType, diff --git a/packages/suite/src/middlewares/suite/eventsMiddleware.ts b/packages/suite/src/middlewares/suite/eventsMiddleware.ts index c2aaa9f2a1..62d0fba3db 100644 --- a/packages/suite/src/middlewares/suite/eventsMiddleware.ts +++ b/packages/suite/src/middlewares/suite/eventsMiddleware.ts @@ -1,13 +1,9 @@ import { MiddlewareAPI } from 'redux'; +import { deviceActions, selectDevices, selectSelectedDevice } from '@suite-common/device'; import * as deviceUtils from '@suite-common/suite-utils'; import { notificationsActions, removeAccountEventsThunk } from '@suite-common/toast-notifications'; -import { - accountsActions, - deviceActions, - selectDevices, - selectSelectedDevice, -} from '@suite-common/wallet-core'; +import { accountsActions } from '@suite-common/wallet-core'; import { DEVICE } from '@trezor/connect'; import { SUITE } from 'src/actions/suite/constants'; diff --git a/packages/suite/src/middlewares/suite/messageSystemMiddleware.ts b/packages/suite/src/middlewares/suite/messageSystemMiddleware.ts index beaade1ae7..f512f23c78 100644 --- a/packages/suite/src/middlewares/suite/messageSystemMiddleware.ts +++ b/packages/suite/src/middlewares/suite/messageSystemMiddleware.ts @@ -1,3 +1,4 @@ +import { deviceActions, selectSelectedDevice } from '@suite-common/device'; import { geolocationActions, selectCountryCode } from '@suite-common/geolocation'; import { categorizeMessages, @@ -6,7 +7,7 @@ import { messageSystemActions, } from '@suite-common/message-system'; import { createMiddleware } from '@suite-common/redux-utils'; -import { changeNetworks, deviceActions, selectSelectedDevice } from '@suite-common/wallet-core'; +import { changeNetworks } from '@suite-common/wallet-core'; import { DEVICE, TRANSPORT } from '@trezor/connect'; import { SUITE } from 'src/actions/suite/constants'; diff --git a/packages/suite/src/middlewares/suite/redirectMiddleware.ts b/packages/suite/src/middlewares/suite/redirectMiddleware.ts index 0e059323e1..378dd0e092 100644 --- a/packages/suite/src/middlewares/suite/redirectMiddleware.ts +++ b/packages/suite/src/middlewares/suite/redirectMiddleware.ts @@ -1,6 +1,6 @@ import { MiddlewareAPI } from 'redux'; -import { deviceActions, selectDevices, selectSelectedDevice } from '@suite-common/wallet-core'; +import { deviceActions, selectDevices, selectSelectedDevice } from '@suite-common/device'; import * as routerActions from 'src/actions/suite/routerActions'; import { selectIsRouterLocked } from 'src/selectors/suite/suiteSelectors'; diff --git a/packages/suite/src/middlewares/suite/sentryMiddleware.ts b/packages/suite/src/middlewares/suite/sentryMiddleware.ts index e2b261a910..9bd6f8f759 100644 --- a/packages/suite/src/middlewares/suite/sentryMiddleware.ts +++ b/packages/suite/src/middlewares/suite/sentryMiddleware.ts @@ -1,12 +1,12 @@ import { MiddlewareAPI } from 'redux'; import { analyticsActions } from '@suite-common/analytics-redux'; +import { deviceActions } from '@suite-common/device'; import { WALLET_SETTINGS, accountsActions, blockchainActions, changeNetworks, - deviceActions, setBaseCurrency, } from '@suite-common/wallet-core'; import { DEVICE, TRANSPORT } from '@trezor/connect'; diff --git a/packages/suite/src/middlewares/suite/suiteMiddleware.ts b/packages/suite/src/middlewares/suite/suiteMiddleware.ts index e54de7ac7a..f9673242fa 100644 --- a/packages/suite/src/middlewares/suite/suiteMiddleware.ts +++ b/packages/suite/src/middlewares/suite/suiteMiddleware.ts @@ -1,17 +1,16 @@ import { isAnyOf } from '@reduxjs/toolkit'; +import { deviceActions, isTrezorDeviceWithState } from '@suite-common/device'; import { AnyAction, createMiddlewareWithExtraDeps } from '@suite-common/redux-utils'; import { isAnyDeviceEventAction } from '@suite-common/suite-utils'; import { notificationsActions } from '@suite-common/toast-notifications'; import { - deviceActions, forgetDisconnectedDevices, handleDeviceDisconnect, observeSelectedDevice, selectIsDeviceAutoEjectEnabled, startOrRestartDiscoveryThunk, } from '@suite-common/wallet-core'; -import { isTrezorDeviceWithState } from '@suite-common/wallet-utils'; import { DEVICE } from '@trezor/connect'; import { ROUTER, SUITE } from 'src/actions/suite/constants'; diff --git a/packages/suite/src/middlewares/wallet/discoveryMiddleware.ts b/packages/suite/src/middlewares/wallet/discoveryMiddleware.ts index db310c7970..a8e2d3e519 100644 --- a/packages/suite/src/middlewares/wallet/discoveryMiddleware.ts +++ b/packages/suite/src/middlewares/wallet/discoveryMiddleware.ts @@ -1,12 +1,11 @@ import { connectPopupCallThunkInner } from '@suite-common/connect-popup'; +import { deviceActions, selectSelectedDevice } from '@suite-common/device'; import { createMiddlewareWithExtraDeps } from '@suite-common/redux-utils'; import { isDeviceAcquired } from '@suite-common/suite-utils'; import { selectThpAutoconnectStep, thpActions } from '@suite-common/thp'; import { accountsActions, changeNetworks, - deviceActions, - selectSelectedDevice, selectShouldRediscover, startOrRestartDiscoveryThunk, } from '@suite-common/wallet-core'; diff --git a/packages/suite/src/middlewares/wallet/storageMiddleware.ts b/packages/suite/src/middlewares/wallet/storageMiddleware.ts index c21af55182..a522562b3a 100644 --- a/packages/suite/src/middlewares/wallet/storageMiddleware.ts +++ b/packages/suite/src/middlewares/wallet/storageMiddleware.ts @@ -4,6 +4,13 @@ import { MiddlewareAPI } from 'redux'; import { analyticsActions } from '@suite-common/analytics-redux'; import { bluetoothActions } from '@suite-common/bluetooth'; import { connectPopupActions } from '@suite-common/connect-popup'; +import { + deviceActions, + selectDeviceByState, + selectDeviceByStaticSessionId, + selectDevices, + selectSelectedDevice, +} from '@suite-common/device'; import { firmwareActions } from '@suite-common/firmware'; import { messageSystemActions } from '@suite-common/message-system'; import { @@ -23,16 +30,11 @@ import { accountsActions, blockchainActions, changeNetworks, - deviceActions, explorerActions, selectAccountByKey, selectAccountsByDeviceState, - selectDeviceByState, - selectDeviceByStaticSessionId, - selectDevices, selectHistoricFiatRates, selectIsDeviceAutoEjectEnabled, - selectSelectedDevice, setBaseCurrency, transactionsActions, updateTxsFiatRatesThunk, diff --git a/packages/suite/src/middlewares/wallet/walletMiddleware.ts b/packages/suite/src/middlewares/wallet/walletMiddleware.ts index 54ce23702a..923f77e0da 100644 --- a/packages/suite/src/middlewares/wallet/walletMiddleware.ts +++ b/packages/suite/src/middlewares/wallet/walletMiddleware.ts @@ -1,6 +1,7 @@ import { isAnyOf } from '@reduxjs/toolkit'; import type { MiddlewareAPI } from 'redux'; +import { deviceActions } from '@suite-common/device'; import { getTxsPerPage } from '@suite-common/suite-utils'; import { tradingActions } from '@suite-common/trading'; import { @@ -8,7 +9,6 @@ import { accountsActions, blockchainActions, convertSendFormDraftsBtcAmountUnitsThunk, - deviceActions, sendFormActions, setCustomBackendThunk, stakeActions, diff --git a/packages/suite/src/reducers/backup/backupReducer.ts b/packages/suite/src/reducers/backup/backupReducer.ts index 26d51f3f1b..25fb229426 100644 --- a/packages/suite/src/reducers/backup/backupReducer.ts +++ b/packages/suite/src/reducers/backup/backupReducer.ts @@ -1,6 +1,6 @@ import { produce } from 'immer'; -import { DeviceRootState } from '@suite-common/wallet-core'; +import type { DeviceRootState } from '@suite-common/device'; import { BackupStatus, ConfirmKey } from 'src/actions/backup/backupActions'; import { BACKUP } from 'src/actions/backup/constants'; diff --git a/packages/suite/src/reducers/suite/__fixtures__/deviceReducer.ts b/packages/suite/src/reducers/suite/__fixtures__/deviceReducer.ts index e63b60d2ac..41e82f9910 100644 --- a/packages/suite/src/reducers/suite/__fixtures__/deviceReducer.ts +++ b/packages/suite/src/reducers/suite/__fixtures__/deviceReducer.ts @@ -1,10 +1,6 @@ +import { DeviceReducerState, deviceActions, deviceReducerInitialState } from '@suite-common/device'; import { TrezorDevice } from '@suite-common/suite-types'; import { mockConnectDevice, mockSuiteDevice } from '@suite-common/suite-types/mocks'; -import { - DeviceReducerState, - deviceActions, - deviceReducerInitialState, -} from '@suite-common/wallet-core'; import { DEVICE } from '@trezor/connect'; import { DeepPartial } from '@trezor/type-utils'; diff --git a/packages/suite/src/reducers/suite/__tests__/deviceReducer.test.ts b/packages/suite/src/reducers/suite/__tests__/deviceReducer.test.ts index 2b2440b2a5..315669b7d9 100644 --- a/packages/suite/src/reducers/suite/__tests__/deviceReducer.test.ts +++ b/packages/suite/src/reducers/suite/__tests__/deviceReducer.test.ts @@ -1,4 +1,4 @@ -import { prepareDeviceReducer } from '@suite-common/wallet-core'; +import { prepareDeviceReducer } from '@suite-common/device'; import { extraDependencies } from 'src/support/extraDependencies'; diff --git a/packages/suite/src/reducers/suite/metadataReducer.ts b/packages/suite/src/reducers/suite/metadataReducer.ts index f531ff9044..eadde5d71d 100644 --- a/packages/suite/src/reducers/suite/metadataReducer.ts +++ b/packages/suite/src/reducers/suite/metadataReducer.ts @@ -1,15 +1,14 @@ import { produce } from 'immer'; -import { selectIsSuiteSyncEnabled } from '@suite-common/suite-sync'; import { - AccountsRootState, DeviceReducerState, deviceActions, - selectAccountByKey, selectDeviceByState, selectDeviceByStaticSessionId, selectSelectedDevice, -} from '@suite-common/wallet-core'; +} from '@suite-common/device'; +import { selectIsSuiteSyncEnabled } from '@suite-common/suite-sync'; +import { AccountsRootState, selectAccountByKey } from '@suite-common/wallet-core'; import { AccountKey } from '@suite-common/wallet-types'; import { DeviceState, StaticSessionId } from '@trezor/connect'; diff --git a/packages/suite/src/reducers/wallet/accountSearchReducer.ts b/packages/suite/src/reducers/wallet/accountSearchReducer.ts index f0c5c625cf..2d071fe336 100644 --- a/packages/suite/src/reducers/wallet/accountSearchReducer.ts +++ b/packages/suite/src/reducers/wallet/accountSearchReducer.ts @@ -1,7 +1,8 @@ import { PayloadAction, createSlice } from '@reduxjs/toolkit'; +import { deviceActions } from '@suite-common/device'; import { NetworkSymbol } from '@suite-common/wallet-config'; -import { changeNetworks, deviceActions } from '@suite-common/wallet-core'; +import { changeNetworks } from '@suite-common/wallet-core'; import { AppState } from 'src/types/suite'; diff --git a/packages/suite/src/reducers/wallet/coinjoinReducer.ts b/packages/suite/src/reducers/wallet/coinjoinReducer.ts index 4742233932..7b93348e10 100644 --- a/packages/suite/src/reducers/wallet/coinjoinReducer.ts +++ b/packages/suite/src/reducers/wallet/coinjoinReducer.ts @@ -1,5 +1,6 @@ import { produce } from 'immer'; +import { DeviceRootState, selectDeviceStatus } from '@suite-common/device'; import { Feature, MessageSystemRootState, @@ -7,13 +8,7 @@ import { selectIsFeatureDisabled, } from '@suite-common/message-system'; import { createWeakMapSelector } from '@suite-common/redux-utils'; -import { - AccountsRootState, - DeviceRootState, - accountsActions, - selectAccountByKey, - selectDeviceStatus, -} from '@suite-common/wallet-core'; +import { AccountsRootState, accountsActions, selectAccountByKey } from '@suite-common/wallet-core'; import { Account, AccountKey } from '@suite-common/wallet-types'; import { RoundPhase, getInputSize, getOutputSize } from '@trezor/coinjoin'; import { PartialRecord } from '@trezor/type-utils'; diff --git a/packages/suite/src/selectors/suite/suiteAuthenticityChecksSelectors.ts b/packages/suite/src/selectors/suite/suiteAuthenticityChecksSelectors.ts index a760f17dde..9e2c4189b5 100644 --- a/packages/suite/src/selectors/suite/suiteAuthenticityChecksSelectors.ts +++ b/packages/suite/src/selectors/suite/suiteAuthenticityChecksSelectors.ts @@ -1,10 +1,3 @@ -import { - isHardHashCheckError, - isHardRevisionCheckError, - isSkippedHashCheckError, - isSkippedRevisionCheckError, -} from '@suite-common/firmware-authenticity'; -import { Feature, selectIsFeatureDisabled } from '@suite-common/message-system'; import { selectFirmwareHashCheckError, selectFirmwareRevisionCheckError, @@ -12,7 +5,14 @@ import { selectIsDeviceInvariabilityCheckSuccess, selectIsEntropyCheckFailed, selectIsFirmwareAuthenticityCheckDismissed, -} from '@suite-common/wallet-core'; +} from '@suite-common/device'; +import { + isHardHashCheckError, + isHardRevisionCheckError, + isSkippedHashCheckError, + isSkippedRevisionCheckError, +} from '@suite-common/firmware-authenticity'; +import { Feature, selectIsFeatureDisabled } from '@suite-common/message-system'; import { AppState } from 'src/types/suite'; diff --git a/packages/suite/src/selectors/suite/suiteSelectors.ts b/packages/suite/src/selectors/suite/suiteSelectors.ts index c05621ec52..bee92133cd 100644 --- a/packages/suite/src/selectors/suite/suiteSelectors.ts +++ b/packages/suite/src/selectors/suite/suiteSelectors.ts @@ -1,4 +1,4 @@ -import { DeviceRootState, selectSelectedDevice } from '@suite-common/wallet-core'; +import { DeviceRootState, selectSelectedDevice } from '@suite-common/device'; import { TransportInfo } from '@trezor/connect'; import { SUITE } from 'src/actions/suite/constants'; diff --git a/packages/suite/src/support/extraDependencies.ts b/packages/suite/src/support/extraDependencies.ts index cf58c399e2..512c41e881 100644 --- a/packages/suite/src/support/extraDependencies.ts +++ b/packages/suite/src/support/extraDependencies.ts @@ -9,6 +9,7 @@ import { createSuiteSyncDesktopCompositionRoot, } from '@suite/suite-sync'; import { delegatedIdentityKeyCompositionRoot } from '@suite-common/delegated-identity-key'; +import type { DeviceReducerState } from '@suite-common/device'; import { FW_HASH_CHECK_DEFAULT_TIMEOUTS } from '@suite-common/firmware-authenticity'; import { CommonServices, @@ -24,7 +25,6 @@ import { import { isNetworkSymbol } from '@suite-common/wallet-config'; import { BlockchainState, - DeviceReducerState, ExplorerConfig, FiatRatesState, SendState, @@ -47,17 +47,17 @@ import { ensureRouterPath, getPrefixedURL, stripPrefixedURL } from 'src/utils/su import { reportSecurityCheck } from 'src/utils/suite/sentry'; import { fixLoadedCoinjoinAccount } from 'src/utils/wallet/coinjoinUtils'; -import { forgetBluetoothDeviceThunk } from '../actions/bluetooth/bluetoothEraseBondsThunk'; -import { createDisableLegacyMetadataIfNeeded } from '../actions/suite/metadata/disableLegacyMetadateIfNeeded'; -import * as suiteActions from '../actions/suite/suiteActions'; -import type { BioAuthState } from '../reducers/bioAuth'; -import { AppState, TrezorDevice } from '../types/suite'; import { HistoryDep, SuiteRouterHistory, SuiteRouterHistoryDep, SuiteRouterHistoryDeps, } from './suite/suiteRouterHistory'; +import { forgetBluetoothDeviceThunk } from '../actions/bluetooth/bluetoothEraseBondsThunk'; +import { createDisableLegacyMetadataIfNeeded } from '../actions/suite/metadata/disableLegacyMetadateIfNeeded'; +import * as suiteActions from '../actions/suite/suiteActions'; +import type { BioAuthState } from '../reducers/bioAuth'; +import { AppState, TrezorDevice } from '../types/suite'; const connectInitSettings: ConnectInitSettings = { transportReconnect: true, diff --git a/packages/suite/src/types/suite/index.ts b/packages/suite/src/types/suite/index.ts index 6561773c79..313a96c760 100644 --- a/packages/suite/src/types/suite/index.ts +++ b/packages/suite/src/types/suite/index.ts @@ -3,6 +3,7 @@ import type { ThunkAction as TAction, ThunkDispatch } from 'redux-thunk'; import { analyticsActions } from '@suite-common/analytics-redux'; import { bluetoothActions } from '@suite-common/bluetooth'; +import { deviceActions } from '@suite-common/device'; import { firmwareActions } from '@suite-common/firmware'; import { geolocationActions } from '@suite-common/geolocation'; import { addLog } from '@suite-common/logger'; @@ -15,12 +16,7 @@ import { suiteSyncQuotaManagerActions } from '@suite-common/suite-sync-quota-man import type { Route } from '@suite-common/suite-types'; import { thpActions } from '@suite-common/thp'; import { notificationsActions } from '@suite-common/toast-notifications'; -import { - deviceActions, - discoveryActions, - feesActions, - transactionsActions, -} from '@suite-common/wallet-core'; +import { discoveryActions, feesActions, transactionsActions } from '@suite-common/wallet-core'; import { BlockchainEvent, DEVICE, DeviceEvent, TransportEvent, UiEvent } from '@trezor/connect'; import { FilterOutFromUnionByTypeProperty } from '@trezor/type-utils'; diff --git a/packages/suite/src/utils/suite/analytics.ts b/packages/suite/src/utils/suite/analytics.ts index 64e6114d12..9de816ca47 100644 --- a/packages/suite/src/utils/suite/analytics.ts +++ b/packages/suite/src/utils/suite/analytics.ts @@ -1,4 +1,8 @@ import type { AppUpdateEvent, SuiteReadyPayload } from '@suite/analytics'; +import { + selectRememberedHiddenWalletsCount, + selectRememberedStandardWalletsCount, +} from '@suite-common/device'; import { formatExperimentVariantsForAnalytics, selectActiveExperimentsWithVariants, @@ -11,10 +15,6 @@ import { getCpuArch, getOsVersion, } from '@suite-common/suite-utils'; -import { - selectRememberedHiddenWalletsCount, - selectRememberedStandardWalletsCount, -} from '@suite-common/wallet-core'; import { getCustomBackends } from '@suite-common/wallet-utils'; import { getOsName, diff --git a/packages/suite/src/utils/suite/sentry.ts b/packages/suite/src/utils/suite/sentry.ts index cc44c868cd..0adbd6dbf6 100644 --- a/packages/suite/src/utils/suite/sentry.ts +++ b/packages/suite/src/utils/suite/sentry.ts @@ -1,14 +1,11 @@ import * as Sentry from '@sentry/core'; import { selectAnalyticsInstanceId } from '@suite-common/analytics-redux'; +import { selectSelectedDevice } from '@suite-common/device'; import { redactDevice, selectRedactedActionsLog } from '@suite-common/logger'; import { ALLOW_REPORT_TAG } from '@suite-common/sentry'; import { ReportSecurityCheckParams } from '@suite-common/suite-types'; -import { - selectDiscoveryForSelectedDevice, - selectEnabledNetworks, - selectSelectedDevice, -} from '@suite-common/wallet-core'; +import { selectDiscoveryForSelectedDevice, selectEnabledNetworks } from '@suite-common/wallet-core'; import { Dispatch, GetState } from 'src/types/suite'; diff --git a/packages/suite/src/utils/wallet/selectDiscoveryOverallStatus.ts b/packages/suite/src/utils/wallet/selectDiscoveryOverallStatus.ts index 92312f1f88..c16c387562 100644 --- a/packages/suite/src/utils/wallet/selectDiscoveryOverallStatus.ts +++ b/packages/suite/src/utils/wallet/selectDiscoveryOverallStatus.ts @@ -1,9 +1,9 @@ +import { selectSelectedDevice } from '@suite-common/device'; import { TrezorDevice } from '@suite-common/suite-types'; import { NetworkSymbol } from '@suite-common/wallet-config'; import { selectAccountsByDeviceState, selectDiscoveryByDevicePath, - selectSelectedDevice, } from '@suite-common/wallet-core'; import { Account, DiscoveryStatus } from '@suite-common/wallet-types'; diff --git a/packages/suite/src/views/backup/Backup.tsx b/packages/suite/src/views/backup/Backup.tsx index 977724a0c2..a568114ea8 100644 --- a/packages/suite/src/views/backup/Backup.tsx +++ b/packages/suite/src/views/backup/Backup.tsx @@ -1,8 +1,8 @@ import { ReactNode } from 'react'; import { Translation } from '@suite/intl'; +import { selectSelectedDevice } from '@suite-common/device'; import { isDeviceAcquired } from '@suite-common/suite-utils'; -import { selectSelectedDevice } from '@suite-common/wallet-core'; import { Column, Image, Modal, Text } from '@trezor/components'; import { HELP_CENTER_RECOVERY_ISSUES_URL } from '@trezor/urls'; diff --git a/packages/suite/src/views/backup/BackupStep1Initial.tsx b/packages/suite/src/views/backup/BackupStep1Initial.tsx index 53d2c678ab..01cf4926b3 100644 --- a/packages/suite/src/views/backup/BackupStep1Initial.tsx +++ b/packages/suite/src/views/backup/BackupStep1Initial.tsx @@ -1,5 +1,5 @@ import { Translation } from '@suite/intl'; -import { selectSelectedDevice } from '@suite-common/wallet-core'; +import { selectSelectedDevice } from '@suite-common/device'; import { Modal, Paragraph } from '@trezor/components'; import { spacings } from '@trezor/theme'; diff --git a/packages/suite/src/views/dashboard/DashboardFooter.tsx b/packages/suite/src/views/dashboard/DashboardFooter.tsx index bb9706e74f..a4cbc1e631 100644 --- a/packages/suite/src/views/dashboard/DashboardFooter.tsx +++ b/packages/suite/src/views/dashboard/DashboardFooter.tsx @@ -7,7 +7,7 @@ import { Translation } from '@suite/intl'; import { selectRememberedHiddenWalletsCount, selectRememberedStandardWalletsCount, -} from '@suite-common/wallet-core'; +} from '@suite-common/device'; import { Box, Button, Column, Divider, Image, Row, Tooltip } from '@trezor/components'; import { isWeb } from '@trezor/env-utils'; import { spacings } from '@trezor/theme'; diff --git a/packages/suite/src/views/dashboard/DashboardPromoBanner/DashboardPromoBanner.tsx b/packages/suite/src/views/dashboard/DashboardPromoBanner/DashboardPromoBanner.tsx index c08c2f7f55..8eab744a9e 100644 --- a/packages/suite/src/views/dashboard/DashboardPromoBanner/DashboardPromoBanner.tsx +++ b/packages/suite/src/views/dashboard/DashboardPromoBanner/DashboardPromoBanner.tsx @@ -1,10 +1,10 @@ import { useState } from 'react'; import { events } from '@suite/analytics'; +import { selectSelectedDevice } from '@suite-common/device'; import { Feature, selectFeaturesConfig } from '@suite-common/message-system'; import { Feature as MessageFeature } from '@suite-common/suite-types'; import { getDeviceInternalModel } from '@suite-common/suite-utils'; -import { selectSelectedDevice } from '@suite-common/wallet-core'; import { DeviceModelInternal } from '@trezor/device-utils'; import { useSelector } from 'src/hooks/suite'; diff --git a/packages/suite/src/views/dashboard/PortfolioCard/DashboardGraph.tsx b/packages/suite/src/views/dashboard/PortfolioCard/DashboardGraph.tsx index 6d81c548a2..1834217288 100644 --- a/packages/suite/src/views/dashboard/PortfolioCard/DashboardGraph.tsx +++ b/packages/suite/src/views/dashboard/PortfolioCard/DashboardGraph.tsx @@ -4,8 +4,9 @@ import { getUnixTime } from 'date-fns'; import styled from 'styled-components'; import { Translation } from '@suite/intl'; +import { selectSelectedDevice } from '@suite-common/device'; import { calcTicks, calcTicksFromData } from '@suite-common/suite-utils'; -import { selectBaseCurrency, selectSelectedDevice } from '@suite-common/wallet-core'; +import { selectBaseCurrency } from '@suite-common/wallet-core'; import { BASE_CURRENCY_ZERO } from '@suite-common/wallet-utils'; import { Box, Button } from '@trezor/components'; import { typography } from '@trezor/theme'; diff --git a/packages/suite/src/views/dashboard/PortfolioCard/EmptyWallet.tsx b/packages/suite/src/views/dashboard/PortfolioCard/EmptyWallet.tsx index ed0e9a1051..c05ae39193 100644 --- a/packages/suite/src/views/dashboard/PortfolioCard/EmptyWallet.tsx +++ b/packages/suite/src/views/dashboard/PortfolioCard/EmptyWallet.tsx @@ -1,5 +1,6 @@ import { Translation } from '@suite/intl'; -import { selectEnabledNetworks, selectIsDeviceUsingPassphrase } from '@suite-common/wallet-core'; +import { selectIsDeviceUsingPassphrase } from '@suite-common/device'; +import { selectEnabledNetworks } from '@suite-common/wallet-core'; import { Button, Column, H3, IconCircle, Paragraph, Row } from '@trezor/components'; import { CoinLogo } from '@trezor/product-components'; import { spacings } from '@trezor/theme'; diff --git a/packages/suite/src/views/dashboard/useNotificationForDisconnectedDevice.tsx b/packages/suite/src/views/dashboard/useNotificationForDisconnectedDevice.tsx index 9d0b5b19b7..beee1df3f0 100644 --- a/packages/suite/src/views/dashboard/useNotificationForDisconnectedDevice.tsx +++ b/packages/suite/src/views/dashboard/useNotificationForDisconnectedDevice.tsx @@ -1,7 +1,7 @@ import { useEffect } from 'react'; +import { selectSelectedDevice } from '@suite-common/device'; import { notificationsActions } from '@suite-common/toast-notifications'; -import { selectSelectedDevice } from '@suite-common/wallet-core'; import { addDeviceIdToSeenDisconnectNotification } from '../../actions/suite/suiteActions'; import { useDispatch, useSelector } from '../../hooks/suite'; diff --git a/packages/suite/src/views/firmware/FirmwareModal.tsx b/packages/suite/src/views/firmware/FirmwareModal.tsx index f0dabe09d7..ac141cc3b7 100644 --- a/packages/suite/src/views/firmware/FirmwareModal.tsx +++ b/packages/suite/src/views/firmware/FirmwareModal.tsx @@ -1,7 +1,8 @@ import { ReactNode, useState } from 'react'; +import { selectSelectedDevice } from '@suite-common/device'; import { selectThpStep } from '@suite-common/thp'; -import { acquireDevice, selectSelectedDevice } from '@suite-common/wallet-core'; +import { acquireDevice } from '@suite-common/wallet-core'; import { Modal } from '@trezor/components'; import { exhaustive } from '@trezor/type-utils'; diff --git a/packages/suite/src/views/firmware/Steps/StepCheckSeed.tsx b/packages/suite/src/views/firmware/Steps/StepCheckSeed.tsx index c4bd6ce31a..98e6b8843a 100644 --- a/packages/suite/src/views/firmware/Steps/StepCheckSeed.tsx +++ b/packages/suite/src/views/firmware/Steps/StepCheckSeed.tsx @@ -5,7 +5,7 @@ import { selectIsDeviceBackedUp, selectSelectedDevice, selectSelectedDeviceLabelOrName, -} from '@suite-common/wallet-core'; +} from '@suite-common/device'; import { Banner, Card, Checkbox, Column, H4, Modal, Paragraph } from '@trezor/components'; import { spacings } from '@trezor/theme'; diff --git a/packages/suite/src/views/firmware/Steps/StepInitial.tsx b/packages/suite/src/views/firmware/Steps/StepInitial.tsx index 812175a771..5093b3a14a 100644 --- a/packages/suite/src/views/firmware/Steps/StepInitial.tsx +++ b/packages/suite/src/views/firmware/Steps/StepInitial.tsx @@ -1,8 +1,8 @@ import { ReactNode } from 'react'; import { Translation } from '@suite/intl'; +import { selectDevices, selectSelectedDevice } from '@suite-common/device'; import { FirmwareStatus } from '@suite-common/suite-types'; -import { selectDevices, selectSelectedDevice } from '@suite-common/wallet-core'; import { Modal, Tooltip } from '@trezor/components'; import { updateAnalytics } from '../../../actions/onboarding/onboardingActions'; diff --git a/packages/suite/src/views/onboarding/UnexpectedState/DeviceDifferentStep.tsx b/packages/suite/src/views/onboarding/UnexpectedState/DeviceDifferentStep.tsx index c010acd580..2a70969a8a 100644 --- a/packages/suite/src/views/onboarding/UnexpectedState/DeviceDifferentStep.tsx +++ b/packages/suite/src/views/onboarding/UnexpectedState/DeviceDifferentStep.tsx @@ -1,6 +1,6 @@ import { Translation } from '@suite/intl'; +import { selectSelectedDevice } from '@suite-common/device'; import { DEFAULT_FLAGSHIP_MODEL } from '@suite-common/suite-constants'; -import { selectSelectedDevice } from '@suite-common/wallet-core'; import { IconName } from '@trezor/components'; import { mapTrezorModelToIcon } from '@trezor/product-components'; diff --git a/packages/suite/src/views/onboarding/UnexpectedState/ShowPinMatrixStep.tsx b/packages/suite/src/views/onboarding/UnexpectedState/ShowPinMatrixStep.tsx index 48c3355067..83b962b598 100644 --- a/packages/suite/src/views/onboarding/UnexpectedState/ShowPinMatrixStep.tsx +++ b/packages/suite/src/views/onboarding/UnexpectedState/ShowPinMatrixStep.tsx @@ -1,7 +1,7 @@ import { useState } from 'react'; import { Translation } from '@suite/intl'; -import { selectSelectedDevice } from '@suite-common/wallet-core'; +import { selectSelectedDevice } from '@suite-common/device'; import { Column } from '@trezor/components'; import TrezorConnect, { UI } from '@trezor/connect'; diff --git a/packages/suite/src/views/onboarding/UnexpectedState/index.tsx b/packages/suite/src/views/onboarding/UnexpectedState/index.tsx index d5658ff799..b1800b1a78 100644 --- a/packages/suite/src/views/onboarding/UnexpectedState/index.tsx +++ b/packages/suite/src/views/onboarding/UnexpectedState/index.tsx @@ -1,6 +1,6 @@ import { JSX } from 'react'; -import { selectSelectedDevice } from '@suite-common/wallet-core'; +import { selectSelectedDevice } from '@suite-common/device'; import { useOnboarding, useSelector } from 'src/hooks/suite'; import { selectPrerequisite } from 'src/selectors/suite/suiteSelectors'; diff --git a/packages/suite/src/views/onboarding/index.tsx b/packages/suite/src/views/onboarding/index.tsx index 246127a9ea..76c3332a8d 100644 --- a/packages/suite/src/views/onboarding/index.tsx +++ b/packages/suite/src/views/onboarding/index.tsx @@ -1,7 +1,7 @@ import { useEffect, useMemo } from 'react'; +import { selectSelectedDevice } from '@suite-common/device'; import { selectThpStep } from '@suite-common/thp'; -import { selectSelectedDevice } from '@suite-common/wallet-core'; import { exhaustive } from '@trezor/type-utils'; import { goto } from 'src/actions/suite/routerActions'; diff --git a/packages/suite/src/views/onboarding/steps/BackupStep.tsx b/packages/suite/src/views/onboarding/steps/BackupStep.tsx index 4f2b9b0e15..9c68d43548 100644 --- a/packages/suite/src/views/onboarding/steps/BackupStep.tsx +++ b/packages/suite/src/views/onboarding/steps/BackupStep.tsx @@ -1,7 +1,7 @@ import { useState } from 'react'; import { Translation } from '@suite/intl'; -import { selectSelectedDevice } from '@suite-common/wallet-core'; +import { selectSelectedDevice } from '@suite-common/device'; import { exhaustive } from '@trezor/type-utils'; import { backupDevice } from 'src/actions/backup/backupActions'; diff --git a/packages/suite/src/views/onboarding/steps/DeviceAuthenticityStep/SecurityCheck.tsx b/packages/suite/src/views/onboarding/steps/DeviceAuthenticityStep/SecurityCheck.tsx index a20de500e2..6976f54ff2 100644 --- a/packages/suite/src/views/onboarding/steps/DeviceAuthenticityStep/SecurityCheck.tsx +++ b/packages/suite/src/views/onboarding/steps/DeviceAuthenticityStep/SecurityCheck.tsx @@ -2,9 +2,9 @@ import { useEffect, useMemo, useState } from 'react'; import { events } from '@suite/analytics'; import { Translation } from '@suite/intl'; +import { deviceActions, selectDevices, selectSelectedDevice } from '@suite-common/device'; import { SUPPORTS_DEVICE_AUTHENTICITY_CHECK } from '@suite-common/suite-constants'; import { AcquiredDevice } from '@suite-common/suite-types'; -import { deviceActions, selectDevices, selectSelectedDevice } from '@suite-common/wallet-core'; import { Button, Card, diff --git a/packages/suite/src/views/onboarding/steps/DeviceAuthenticityStep/index.tsx b/packages/suite/src/views/onboarding/steps/DeviceAuthenticityStep/index.tsx index 3200146bc7..b67bdfb5bb 100644 --- a/packages/suite/src/views/onboarding/steps/DeviceAuthenticityStep/index.tsx +++ b/packages/suite/src/views/onboarding/steps/DeviceAuthenticityStep/index.tsx @@ -1,8 +1,8 @@ import { useState } from 'react'; import { Translation, TranslationKey } from '@suite/intl'; +import { selectSelectedDevice, selectSelectedDeviceAuthenticity } from '@suite-common/device'; import { checkDeviceAuthenticityThunk } from '@suite-common/device-authenticity'; -import { selectSelectedDevice, selectSelectedDeviceAuthenticity } from '@suite-common/wallet-core'; import { Card, Column, Grid, Icon, IconName, Paragraph } from '@trezor/components'; import { OnboardingCard } from 'src/components/onboarding/OnboardingCard/OnboardingCard'; diff --git a/packages/suite/src/views/onboarding/steps/DeviceTutorialStep.tsx b/packages/suite/src/views/onboarding/steps/DeviceTutorialStep.tsx index 48709b368c..c7e9434d22 100644 --- a/packages/suite/src/views/onboarding/steps/DeviceTutorialStep.tsx +++ b/packages/suite/src/views/onboarding/steps/DeviceTutorialStep.tsx @@ -2,8 +2,8 @@ import { useEffect } from 'react'; import { useIntl } from 'react-intl'; import { Translation, messages } from '@suite/intl'; +import { selectSelectedDevice } from '@suite-common/device'; import { DEFAULT_FLAGSHIP_MODEL } from '@suite-common/suite-constants'; -import { selectSelectedDevice } from '@suite-common/wallet-core'; import { IconName } from '@trezor/components'; import TrezorConnect from '@trezor/connect'; import { mapTrezorModelToIcon } from '@trezor/product-components'; diff --git a/packages/suite/src/views/onboarding/steps/FirmwareStep/FirmwareInitialStep.tsx b/packages/suite/src/views/onboarding/steps/FirmwareStep/FirmwareInitialStep.tsx index 13ce154829..ce7b75c15d 100644 --- a/packages/suite/src/views/onboarding/steps/FirmwareStep/FirmwareInitialStep.tsx +++ b/packages/suite/src/views/onboarding/steps/FirmwareStep/FirmwareInitialStep.tsx @@ -1,8 +1,8 @@ import { useState } from 'react'; import { Translation, useTranslation } from '@suite/intl'; +import { selectDevices } from '@suite-common/device'; import { AcquiredDevice } from '@suite-common/suite-types'; -import { selectDevices } from '@suite-common/wallet-core'; import { ButtonProps, Card, Column, Link, Note, Row, Tooltip } from '@trezor/components'; import { FirmwareType } from '@trezor/connect'; import { DeviceModelInternal, isBitcoinOnlyDevice } from '@trezor/device-utils'; diff --git a/packages/suite/src/views/onboarding/steps/FirmwareStep/index.tsx b/packages/suite/src/views/onboarding/steps/FirmwareStep/index.tsx index ac6275bc55..ffbae002fb 100644 --- a/packages/suite/src/views/onboarding/steps/FirmwareStep/index.tsx +++ b/packages/suite/src/views/onboarding/steps/FirmwareStep/index.tsx @@ -1,8 +1,8 @@ import { useCallback, useEffect } from 'react'; import { Translation } from '@suite/intl'; +import { selectSelectedDevice } from '@suite-common/device'; import { selectThpStep } from '@suite-common/thp'; -import { selectSelectedDevice } from '@suite-common/wallet-core'; import { Card } from '@trezor/components'; import { getFirmwareVersion } from '@trezor/device-utils'; import { exhaustive } from '@trezor/type-utils'; diff --git a/packages/suite/src/views/onboarding/steps/PinStep.tsx b/packages/suite/src/views/onboarding/steps/PinStep.tsx index 1936a900d0..f79ba35198 100644 --- a/packages/suite/src/views/onboarding/steps/PinStep.tsx +++ b/packages/suite/src/views/onboarding/steps/PinStep.tsx @@ -1,7 +1,7 @@ import { useEffect, useState } from 'react'; import { Translation } from '@suite/intl'; -import { selectSelectedDevice } from '@suite-common/wallet-core'; +import { selectSelectedDevice } from '@suite-common/device'; import { Button, Column } from '@trezor/components'; import TrezorConnect, { UI } from '@trezor/connect'; import { spacings } from '@trezor/theme'; diff --git a/packages/suite/src/views/onboarding/steps/RecoveryStep/index.tsx b/packages/suite/src/views/onboarding/steps/RecoveryStep/index.tsx index 063edf82d6..0509ba5531 100644 --- a/packages/suite/src/views/onboarding/steps/RecoveryStep/index.tsx +++ b/packages/suite/src/views/onboarding/steps/RecoveryStep/index.tsx @@ -1,6 +1,6 @@ import { Translation, TranslationKey } from '@suite/intl'; +import { selectSelectedDevice } from '@suite-common/device'; import { isDeviceWithButtonOnlyNoTouchscreen } from '@suite-common/suite-utils'; -import { selectSelectedDevice } from '@suite-common/wallet-core'; import { DeviceModelInternal } from '@trezor/device-utils'; import { HELP_CENTER_ADVANCED_RECOVERY_URL } from '@trezor/urls'; diff --git a/packages/suite/src/views/onboarding/steps/ResetDeviceStep.tsx b/packages/suite/src/views/onboarding/steps/ResetDeviceStep.tsx index aa1dc82770..b678dd2bcb 100644 --- a/packages/suite/src/views/onboarding/steps/ResetDeviceStep.tsx +++ b/packages/suite/src/views/onboarding/steps/ResetDeviceStep.tsx @@ -1,8 +1,8 @@ import { useCallback, useEffect, useState } from 'react'; import { Translation } from '@suite/intl'; +import { selectDeviceDefaultBackupType, selectSelectedDevice } from '@suite-common/device'; import { BackupType } from '@suite-common/suite-types'; -import { selectDeviceDefaultBackupType, selectSelectedDevice } from '@suite-common/wallet-core'; import { Text } from '@trezor/components'; import { DeviceModelInternal } from '@trezor/device-utils'; diff --git a/packages/suite/src/views/onboarding/steps/SelectBackupType/SelectBackupType.tsx b/packages/suite/src/views/onboarding/steps/SelectBackupType/SelectBackupType.tsx index e1c4b568d5..3e50c593df 100644 --- a/packages/suite/src/views/onboarding/steps/SelectBackupType/SelectBackupType.tsx +++ b/packages/suite/src/views/onboarding/steps/SelectBackupType/SelectBackupType.tsx @@ -15,8 +15,8 @@ import { import styled from 'styled-components'; import { Translation, TranslationKey } from '@suite/intl'; +import { selectDeviceDefaultBackupType } from '@suite-common/device'; import { BackupType } from '@suite-common/suite-types'; -import { selectDeviceDefaultBackupType } from '@suite-common/wallet-core'; import { Banner, ElevationUp, Text, useElevation } from '@trezor/components'; import { Elevation, diff --git a/packages/suite/src/views/onboarding/steps/SelectBackupType/ShamirOptions.tsx b/packages/suite/src/views/onboarding/steps/SelectBackupType/ShamirOptions.tsx index 8e372f383e..6e03d692ac 100644 --- a/packages/suite/src/views/onboarding/steps/SelectBackupType/ShamirOptions.tsx +++ b/packages/suite/src/views/onboarding/steps/SelectBackupType/ShamirOptions.tsx @@ -1,8 +1,8 @@ import { satisfies } from 'semver'; import { Translation } from '@suite/intl'; +import { selectSelectedDevice } from '@suite-common/device'; import { BackupType } from '@suite-common/suite-types'; -import { selectSelectedDevice } from '@suite-common/wallet-core'; import { Badge, Tooltip } from '@trezor/components'; import { getFirmwareVersion } from '@trezor/device-utils'; import { spacings } from '@trezor/theme'; diff --git a/packages/suite/src/views/password-manager/PasswordManager/EntryForm.tsx b/packages/suite/src/views/password-manager/PasswordManager/EntryForm.tsx index a5fec37309..542a113727 100644 --- a/packages/suite/src/views/password-manager/PasswordManager/EntryForm.tsx +++ b/packages/suite/src/views/password-manager/PasswordManager/EntryForm.tsx @@ -3,8 +3,8 @@ import React, { useState } from 'react'; import { randomBytes } from 'crypto'; import styled from 'styled-components'; +import { selectSelectedDevice } from '@suite-common/device'; import type { PasswordEntry, PasswordEntryDecoded } from '@suite-common/metadata-types'; -import { selectSelectedDevice } from '@suite-common/wallet-core'; import { Button, Checkbox, Input } from '@trezor/components'; import TrezorConnect from '@trezor/connect'; import { spacingsPx } from '@trezor/theme'; diff --git a/packages/suite/src/views/password-manager/PasswordManager/PasswordsList.tsx b/packages/suite/src/views/password-manager/PasswordManager/PasswordsList.tsx index 731fcd092f..a0d34c53b9 100644 --- a/packages/suite/src/views/password-manager/PasswordManager/PasswordsList.tsx +++ b/packages/suite/src/views/password-manager/PasswordManager/PasswordsList.tsx @@ -1,6 +1,6 @@ import styled from 'styled-components'; -import { selectSelectedDevice } from '@suite-common/wallet-core'; +import { selectSelectedDevice } from '@suite-common/device'; import { TextColumn } from 'src/components/suite'; import { useSelector } from 'src/hooks/suite'; diff --git a/packages/suite/src/views/recovery/index.tsx b/packages/suite/src/views/recovery/index.tsx index fb721cab69..9121c803a2 100644 --- a/packages/suite/src/views/recovery/index.tsx +++ b/packages/suite/src/views/recovery/index.tsx @@ -2,8 +2,8 @@ import { useState } from 'react'; import { useIntl } from 'react-intl'; import { Translation, messages } from '@suite/intl'; +import { usePin } from '@suite-common/device'; import { isDeviceAcquired } from '@suite-common/suite-utils'; -import { usePin } from '@suite-common/wallet-core'; import { Box, H2, Image, Modal, Paragraph } from '@trezor/components'; import TrezorConnect, { UI } from '@trezor/connect'; import { DeviceModelInternal } from '@trezor/device-utils'; diff --git a/packages/suite/src/views/settings/SettingsDebug/ResetThpCredentials.tsx b/packages/suite/src/views/settings/SettingsDebug/ResetThpCredentials.tsx index 0b07451e62..a822d21ea3 100644 --- a/packages/suite/src/views/settings/SettingsDebug/ResetThpCredentials.tsx +++ b/packages/suite/src/views/settings/SettingsDebug/ResetThpCredentials.tsx @@ -1,8 +1,8 @@ import { useState } from 'react'; +import { deviceActions, selectSelectedDevice } from '@suite-common/device'; import { removeThpCredentialsThunk } from '@suite-common/thp'; import { notificationsActions } from '@suite-common/toast-notifications'; -import { deviceActions, selectSelectedDevice } from '@suite-common/wallet-core'; import { ActionButton, ActionColumn, SectionItem, TextColumn } from 'src/components/suite'; diff --git a/packages/suite/src/views/settings/SettingsDevice/ForgetDevice.tsx b/packages/suite/src/views/settings/SettingsDevice/ForgetDevice.tsx index 164e887fbd..41a11a574a 100644 --- a/packages/suite/src/views/settings/SettingsDevice/ForgetDevice.tsx +++ b/packages/suite/src/views/settings/SettingsDevice/ForgetDevice.tsx @@ -2,13 +2,9 @@ import { useState } from 'react'; import { events } from '@suite/analytics'; import { Translation } from '@suite/intl'; +import { deviceActions, selectDevices, selectSelectedDevice } from '@suite-common/device'; import * as deviceUtils from '@suite-common/suite-utils'; -import { - deviceActions, - forgetSingleDevicePersistentDataThunk, - selectDevices, - selectSelectedDevice, -} from '@suite-common/wallet-core'; +import { forgetSingleDevicePersistentDataThunk } from '@suite-common/wallet-core'; import { Card, Icon, List, Modal, ModalProps, Paragraph } from '@trezor/components'; import { ActionButton, ActionColumn, SectionItem, TextColumn } from 'src/components/suite'; diff --git a/packages/suite/src/views/settings/SettingsDevice/MultiShareBackup.tsx b/packages/suite/src/views/settings/SettingsDevice/MultiShareBackup.tsx index 97db8f1ae8..93f25fb05f 100644 --- a/packages/suite/src/views/settings/SettingsDevice/MultiShareBackup.tsx +++ b/packages/suite/src/views/settings/SettingsDevice/MultiShareBackup.tsx @@ -1,7 +1,7 @@ import { events } from '@suite/analytics'; import { Translation } from '@suite/intl'; +import { selectSelectedDevice } from '@suite-common/device'; import { TrezorDevice } from '@suite-common/suite-types'; -import { selectSelectedDevice } from '@suite-common/wallet-core'; import { HELP_CENTER_MULTI_SHARE_BACKUP_URL } from '@trezor/urls'; import { ActionButton, ActionColumn, SectionItem, TextColumn } from 'src/components/suite'; diff --git a/packages/suite/src/views/settings/SettingsDevice/SettingsDevice.tsx b/packages/suite/src/views/settings/SettingsDevice/SettingsDevice.tsx index d5969dbff5..fbff309131 100644 --- a/packages/suite/src/views/settings/SettingsDevice/SettingsDevice.tsx +++ b/packages/suite/src/views/settings/SettingsDevice/SettingsDevice.tsx @@ -1,8 +1,8 @@ import { Translation } from '@suite/intl'; +import { selectIsDeviceConnectedViaBluetooth } from '@suite-common/device'; import { Context } from '@suite-common/message-system'; import { SUPPORTS_DEVICE_AUTHENTICITY_CHECK } from '@suite-common/suite-constants'; import { isDeviceRemembered } from '@suite-common/suite-utils'; -import { selectIsDeviceConnectedViaBluetooth } from '@suite-common/wallet-core'; import { isBitcoinOnlyDevice } from '@trezor/device-utils'; import { DeviceBanner } from 'src/components/settings/DeviceBanner'; diff --git a/packages/suite/src/views/settings/SettingsDevice/WipeCode.tsx b/packages/suite/src/views/settings/SettingsDevice/WipeCode.tsx index 52d43db84b..03aa081513 100644 --- a/packages/suite/src/views/settings/SettingsDevice/WipeCode.tsx +++ b/packages/suite/src/views/settings/SettingsDevice/WipeCode.tsx @@ -2,7 +2,7 @@ import { useSelector } from 'react-redux'; import { events } from '@suite/analytics'; import { Translation } from '@suite/intl'; -import { selectIsDeviceProtectedByWipeCode } from '@suite-common/wallet-core'; +import { selectIsDeviceProtectedByWipeCode } from '@suite-common/device'; import { HELP_CENTER_WIPE_CODE_URL } from '@trezor/urls'; import { changeWipeCode } from 'src/actions/settings/deviceSettingsActions'; diff --git a/packages/suite/src/views/settings/SettingsGeneral/AutoEject.tsx b/packages/suite/src/views/settings/SettingsGeneral/AutoEject.tsx index 29a0be07c7..32eebc972b 100644 --- a/packages/suite/src/views/settings/SettingsGeneral/AutoEject.tsx +++ b/packages/suite/src/views/settings/SettingsGeneral/AutoEject.tsx @@ -2,7 +2,8 @@ import { useState } from 'react'; import { events } from '@suite/analytics'; import { Translation } from '@suite/intl'; -import { selectDevices, selectIsDeviceAutoEjectEnabled } from '@suite-common/wallet-core'; +import { selectDevices } from '@suite-common/device'; +import { selectIsDeviceAutoEjectEnabled } from '@suite-common/wallet-core'; import { Modal, Switch } from '@trezor/components'; import { setAutoEjectEnabledThunk } from 'src/actions/suite/autoEjectThunks'; diff --git a/packages/suite/src/views/suite/SwitchDevice/DeviceItem/DeviceItem.tsx b/packages/suite/src/views/suite/SwitchDevice/DeviceItem/DeviceItem.tsx index b4e9a8376a..9545b7206d 100644 --- a/packages/suite/src/views/suite/SwitchDevice/DeviceItem/DeviceItem.tsx +++ b/packages/suite/src/views/suite/SwitchDevice/DeviceItem/DeviceItem.tsx @@ -1,9 +1,9 @@ import { ReactNode, useEffect, useState } from 'react'; import { Translation } from '@suite/intl'; +import { selectSelectedDevice } from '@suite-common/device'; import { DEFAULT_FLAGSHIP_MODEL } from '@suite-common/suite-constants'; import * as deviceUtils from '@suite-common/suite-utils'; -import { selectSelectedDevice } from '@suite-common/wallet-core'; import { Button, Column, Icon, IconName, List, Paragraph, Row, Tooltip } from '@trezor/components'; import { mapTrezorModelToIcon } from '@trezor/product-components'; import { spacings } from '@trezor/theme'; diff --git a/packages/suite/src/views/suite/SwitchDevice/DeviceItem/DeviceStatusTextThp.tsx b/packages/suite/src/views/suite/SwitchDevice/DeviceItem/DeviceStatusTextThp.tsx index 4a93b4a89a..8cf4967f05 100644 --- a/packages/suite/src/views/suite/SwitchDevice/DeviceItem/DeviceStatusTextThp.tsx +++ b/packages/suite/src/views/suite/SwitchDevice/DeviceItem/DeviceStatusTextThp.tsx @@ -2,8 +2,8 @@ import React, { useEffect, useState } from 'react'; import { Translation } from '@suite/intl'; import { selectKnownDeviceByDeviceId } from '@suite-common/bluetooth/src/bluetoothSelectors'; +import { selectDevices } from '@suite-common/device'; import { TrezorDevice } from '@suite-common/suite-types'; -import { selectDevices } from '@suite-common/wallet-core'; import { selectConnectingDevices } from 'src/actions/bluetooth/desktopBluetoothSelectors'; import { useSelector } from 'src/hooks/suite'; diff --git a/packages/suite/src/views/suite/SwitchDevice/DeviceItem/EjectConfirmation.tsx b/packages/suite/src/views/suite/SwitchDevice/DeviceItem/EjectConfirmation.tsx index 83a7db7f58..d4ef5280b2 100644 --- a/packages/suite/src/views/suite/SwitchDevice/DeviceItem/EjectConfirmation.tsx +++ b/packages/suite/src/views/suite/SwitchDevice/DeviceItem/EjectConfirmation.tsx @@ -2,8 +2,8 @@ import { MouseEventHandler } from 'react'; import { events } from '@suite/analytics'; import { Translation } from '@suite/intl'; +import { deviceActions } from '@suite-common/device'; import { AcquiredDevice } from '@suite-common/suite-types'; -import { deviceActions } from '@suite-common/wallet-core'; import { Box, Button, H4, Paragraph, Row } from '@trezor/components'; import { spacings } from '@trezor/theme'; diff --git a/packages/suite/src/views/suite/SwitchDevice/DeviceItem/SmallDeviceItem.tsx b/packages/suite/src/views/suite/SwitchDevice/DeviceItem/SmallDeviceItem.tsx index 6af6baa84b..010be3b124 100644 --- a/packages/suite/src/views/suite/SwitchDevice/DeviceItem/SmallDeviceItem.tsx +++ b/packages/suite/src/views/suite/SwitchDevice/DeviceItem/SmallDeviceItem.tsx @@ -1,6 +1,6 @@ import { Translation } from '@suite/intl'; +import { selectDeviceLabelOrNameById, selectSelectedDevice } from '@suite-common/device'; import { getDeviceInternalModel } from '@suite-common/suite-utils'; -import { selectDeviceLabelOrNameById, selectSelectedDevice } from '@suite-common/wallet-core'; import { Image, Row } from '@trezor/components'; import { spacings } from '@trezor/theme'; diff --git a/packages/suite/src/views/suite/SwitchDevice/DeviceItem/SuiteSyncWalletDebug.tsx b/packages/suite/src/views/suite/SwitchDevice/DeviceItem/SuiteSyncWalletDebug.tsx index e7b5855de3..3bfc829dc1 100644 --- a/packages/suite/src/views/suite/SwitchDevice/DeviceItem/SuiteSyncWalletDebug.tsx +++ b/packages/suite/src/views/suite/SwitchDevice/DeviceItem/SuiteSyncWalletDebug.tsx @@ -1,4 +1,5 @@ /* eslint-disable jsx-a11y/click-events-have-key-events */ +import { deviceActions } from '@suite-common/device'; import { isSuiteSyncSupportedByDevice, selectIsSuiteSyncDebugEnabled, @@ -7,7 +8,6 @@ import { setSuiteSyncOwner, } from '@suite-common/suite-sync'; import { AcquiredDevice } from '@suite-common/suite-types'; -import { deviceActions } from '@suite-common/wallet-core'; import { parseDeviceStaticSessionId } from '@suite-common/wallet-utils'; import { Code, Row, Text, Tooltip } from '@trezor/components'; import { spacings } from '@trezor/theme'; diff --git a/packages/suite/src/views/suite/SwitchDevice/SwitchDevice.tsx b/packages/suite/src/views/suite/SwitchDevice/SwitchDevice.tsx index 0f4c0abb59..13d4bdcca1 100644 --- a/packages/suite/src/views/suite/SwitchDevice/SwitchDevice.tsx +++ b/packages/suite/src/views/suite/SwitchDevice/SwitchDevice.tsx @@ -1,8 +1,8 @@ import { events } from '@suite/analytics'; import { Translation } from '@suite/intl'; import { bluetoothActions, selectAdapterStatus } from '@suite-common/bluetooth'; +import { selectDevices } from '@suite-common/device'; import * as deviceUtils from '@suite-common/suite-utils'; -import { selectDevices } from '@suite-common/wallet-core'; import { Box, Button, Column } from '@trezor/components'; import { setConnectionMode, toggleConnectionModal } from 'src/actions/device/deviceSlice'; diff --git a/packages/suite/src/views/wallet/receive/Receive.tsx b/packages/suite/src/views/wallet/receive/Receive.tsx index e950fbb4cd..4c6cbd3fb7 100644 --- a/packages/suite/src/views/wallet/receive/Receive.tsx +++ b/packages/suite/src/views/wallet/receive/Receive.tsx @@ -1,4 +1,5 @@ -import { selectPendingAccountAddresses, selectSelectedDevice } from '@suite-common/wallet-core'; +import { selectSelectedDevice } from '@suite-common/device'; +import { selectPendingAccountAddresses } from '@suite-common/wallet-core'; import { Column } from '@trezor/components'; import { spacings } from '@trezor/theme'; diff --git a/packages/suite/src/views/wallet/receive/components/ConnectDevicePromo.tsx b/packages/suite/src/views/wallet/receive/components/ConnectDevicePromo.tsx index a5b27f879a..547a8553bb 100644 --- a/packages/suite/src/views/wallet/receive/components/ConnectDevicePromo.tsx +++ b/packages/suite/src/views/wallet/receive/components/ConnectDevicePromo.tsx @@ -1,8 +1,8 @@ import { JSX } from 'react'; import { Translation } from '@suite/intl'; +import { selectSelectedDevice } from '@suite-common/device'; import { DEFAULT_FLAGSHIP_MODEL } from '@suite-common/suite-constants'; -import { selectSelectedDevice } from '@suite-common/wallet-core'; import { Banner } from '@trezor/components'; import { mapTrezorModelToIcon } from '@trezor/product-components'; diff --git a/packages/suite/src/views/wallet/tokens/common/TokensTable/TokenRow.tsx b/packages/suite/src/views/wallet/tokens/common/TokensTable/TokenRow.tsx index b94c394c92..9e3a9eb435 100644 --- a/packages/suite/src/views/wallet/tokens/common/TokensTable/TokenRow.tsx +++ b/packages/suite/src/views/wallet/tokens/common/TokensTable/TokenRow.tsx @@ -2,6 +2,7 @@ import { ReactNode, useState } from 'react'; import { events } from '@suite/analytics'; import { Translation } from '@suite/intl'; +import { selectSelectedDevice } from '@suite-common/device'; import { DefinitionType, EnhancedTokenInfo, @@ -18,7 +19,7 @@ import { tradingActions, } from '@suite-common/trading'; import { Explorer, Network, getCoingeckoId } from '@suite-common/wallet-config'; -import { selectExplorer, selectSelectedDevice, sendFormActions } from '@suite-common/wallet-core'; +import { selectExplorer, sendFormActions } from '@suite-common/wallet-core'; import { Account, TokenAddress } from '@suite-common/wallet-types'; import { getContractAddressForNetworkSymbol, diff --git a/packages/suite/src/views/wallet/trading/common/TradingSelectedOffer/TradingReceiveAddress/TradingReceiveAccountModal/TradingReceiveAccountAddSuiteOption.tsx b/packages/suite/src/views/wallet/trading/common/TradingSelectedOffer/TradingReceiveAddress/TradingReceiveAccountModal/TradingReceiveAccountAddSuiteOption.tsx index dff8226396..9871d0b54d 100644 --- a/packages/suite/src/views/wallet/trading/common/TradingSelectedOffer/TradingReceiveAddress/TradingReceiveAccountModal/TradingReceiveAccountAddSuiteOption.tsx +++ b/packages/suite/src/views/wallet/trading/common/TradingSelectedOffer/TradingReceiveAddress/TradingReceiveAccountModal/TradingReceiveAccountAddSuiteOption.tsx @@ -1,6 +1,6 @@ import { Translation } from '@suite/intl'; +import { selectSelectedDevice } from '@suite-common/device'; import { cryptoIdToSymbol, parseCryptoId, useTradingUtils } from '@suite-common/trading'; -import { selectSelectedDevice } from '@suite-common/wallet-core'; import { Column, Icon } from '@trezor/components'; import { openModal } from 'src/actions/suite/modalActions'; diff --git a/packages/suite/tsconfig.json b/packages/suite/tsconfig.json index d8ea475de1..525d0bcf6d 100644 --- a/packages/suite/tsconfig.json +++ b/packages/suite/tsconfig.json @@ -31,6 +31,7 @@ { "path": "../../suite-common/delegated-identity-key" }, + { "path": "../../suite-common/device" }, { "path": "../../suite-common/device-authenticity" }, diff --git a/suite-common/bluetooth/.depcheckrc.json b/suite-common/bluetooth/.depcheckrc.json deleted file mode 100644 index 00916370e8..0000000000 --- a/suite-common/bluetooth/.depcheckrc.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "ignore-patterns": ["libDev", "lib"], - "ignores": [ - "// Todo: This need so be solved. See: https://github.com/trezor/trezor-suite/issues/21551", - "@suite-common/wallet-core" - ] -} diff --git a/suite-common/bluetooth/package.json b/suite-common/bluetooth/package.json index a0b685f305..ebdf9e9805 100644 --- a/suite-common/bluetooth/package.json +++ b/suite-common/bluetooth/package.json @@ -12,6 +12,7 @@ }, "dependencies": { "@reduxjs/toolkit": "2.11.2", + "@suite-common/device": "workspace:*", "@suite-common/redux-utils": "workspace:*", "@suite-common/suite-types": "workspace:*", "@suite-common/test-utils": "workspace:*", diff --git a/suite-common/bluetooth/src/bluetoothReducer.ts b/suite-common/bluetooth/src/bluetoothReducer.ts index 66a55c7557..d05a448370 100644 --- a/suite-common/bluetooth/src/bluetoothReducer.ts +++ b/suite-common/bluetooth/src/bluetoothReducer.ts @@ -1,10 +1,7 @@ import { AnyAction, Draft } from '@reduxjs/toolkit'; +import { DeviceConnectActionPayload, deviceActions } from '@suite-common/device'; import { createReducerWithExtraDeps } from '@suite-common/redux-utils'; -import { - DeviceConnectActionPayload, - deviceActions, -} from '@suite-common/wallet-core/src/device/deviceActions'; import { BluetoothDeviceId, TrezorPushNotificationType } from '@trezor/connect'; import { bluetoothActions } from './bluetoothActions'; diff --git a/suite-common/bluetooth/tests/bluetoothReducer.test.ts b/suite-common/bluetooth/tests/bluetoothReducer.test.ts index 98ca721545..c090cc245f 100644 --- a/suite-common/bluetooth/tests/bluetoothReducer.test.ts +++ b/suite-common/bluetooth/tests/bluetoothReducer.test.ts @@ -1,8 +1,8 @@ import { combineReducers } from '@reduxjs/toolkit'; +import { deviceActions } from '@suite-common/device'; import { TrezorDevice } from '@suite-common/suite-types'; import { configureMockStore, extraDependenciesCommonMock } from '@suite-common/test-utils'; -import { deviceActions } from '@suite-common/wallet-core'; import { Device, asBluetoothDeviceId } from '@trezor/connect'; import { DeviceModelInternal } from '@trezor/device-utils'; diff --git a/suite-common/bluetooth/tsconfig.json b/suite-common/bluetooth/tsconfig.json index d7155085c6..a64cc36c09 100644 --- a/suite-common/bluetooth/tsconfig.json +++ b/suite-common/bluetooth/tsconfig.json @@ -2,6 +2,7 @@ "extends": "../../tsconfig.base.json", "compilerOptions": { "outDir": "libDev" }, "references": [ + { "path": "../device" }, { "path": "../redux-utils" }, { "path": "../suite-types" }, { "path": "../test-utils" }, diff --git a/suite-common/connect-init/package.json b/suite-common/connect-init/package.json index 21854ee214..aa06c66052 100644 --- a/suite-common/connect-init/package.json +++ b/suite-common/connect-init/package.json @@ -14,6 +14,7 @@ "dependencies": { "@reduxjs/toolkit": "2.11.2", "@suite-common/analytics": "workspace:*", + "@suite-common/device": "workspace:*", "@suite-common/firmware": "workspace:*", "@suite-common/message-system": "workspace:*", "@suite-common/redux-utils": "workspace:*", diff --git a/suite-common/connect-init/src/connectInitThunks.ts b/suite-common/connect-init/src/connectInitThunks.ts index 4362f12e6d..95ef9f0450 100644 --- a/suite-common/connect-init/src/connectInitThunks.ts +++ b/suite-common/connect-init/src/connectInitThunks.ts @@ -1,4 +1,10 @@ import { events as sharedEvents } from '@suite-common/analytics'; +import { + deviceActions, + selectDevices, + selectIsPendingTransportEvent, + selectSelectedDevice, +} from '@suite-common/device'; import { selectFirmwareChannel } from '@suite-common/firmware/src/firmwareReducer'; import { Feature, @@ -8,14 +14,7 @@ import { import { createThunk } from '@suite-common/redux-utils'; import { TrezorDevice } from '@suite-common/suite-types'; import { getBrowserName } from '@suite-common/suite-utils'; -import { - deviceActions, - deviceConnectThunks, - selectDevices, - selectEnabledNetworks, - selectIsPendingTransportEvent, - selectSelectedDevice, -} from '@suite-common/wallet-core'; +import { deviceConnectThunks, selectEnabledNetworks } from '@suite-common/wallet-core'; import TrezorConnect, { BLOCKCHAIN_EVENT, DEVICE, diff --git a/suite-common/connect-init/tsconfig.json b/suite-common/connect-init/tsconfig.json index 5cd84ae1e9..1579410b57 100644 --- a/suite-common/connect-init/tsconfig.json +++ b/suite-common/connect-init/tsconfig.json @@ -3,6 +3,7 @@ "compilerOptions": { "outDir": "libDev" }, "references": [ { "path": "../analytics" }, + { "path": "../device" }, { "path": "../firmware" }, { "path": "../message-system" }, { "path": "../redux-utils" }, diff --git a/suite-common/connect-popup/package.json b/suite-common/connect-popup/package.json index 864bda8fe6..beaffa2503 100644 --- a/suite-common/connect-popup/package.json +++ b/suite-common/connect-popup/package.json @@ -12,6 +12,7 @@ "dependencies": { "@reduxjs/toolkit": "2.11.2", "@suite-common/analytics": "workspace:*", + "@suite-common/device": "workspace:*", "@suite-common/redux-utils": "workspace:*", "@suite-common/toast-notifications": "workspace:*", "@suite-common/wallet-config": "workspace:*", diff --git a/suite-common/connect-popup/src/connectPopupThunks.ts b/suite-common/connect-popup/src/connectPopupThunks.ts index 5264a7cd07..a49290b140 100644 --- a/suite-common/connect-popup/src/connectPopupThunks.ts +++ b/suite-common/connect-popup/src/connectPopupThunks.ts @@ -1,9 +1,9 @@ import { AsyncThunkAction } from '@reduxjs/toolkit'; import { events } from '@suite-common/analytics'; +import { deviceActions, selectSelectedDevice } from '@suite-common/device'; import { CustomThunkAPI, createThunk } from '@suite-common/redux-utils'; import { notificationsActions } from '@suite-common/toast-notifications'; -import { deviceActions, selectSelectedDevice } from '@suite-common/wallet-core'; import { PrecomposedTransactionFinal } from '@suite-common/wallet-types'; import TrezorConnect, { CallMethodKeys, diff --git a/suite-common/connect-popup/src/methodHooks/ethereumSignTransaction.ts b/suite-common/connect-popup/src/methodHooks/ethereumSignTransaction.ts index 8911266ccc..416ab53139 100644 --- a/suite-common/connect-popup/src/methodHooks/ethereumSignTransaction.ts +++ b/suite-common/connect-popup/src/methodHooks/ethereumSignTransaction.ts @@ -1,8 +1,8 @@ +import { selectSelectedDevice } from '@suite-common/device'; import { Bip43Path, getNetworkByEvmChainId } from '@suite-common/wallet-config'; import { accountsActions, selectAccountForNetworkSymbolAndPath, - selectSelectedDevice, sendFormActions, } from '@suite-common/wallet-core'; import { Account, PrecomposedTransactionFinal } from '@suite-common/wallet-types'; diff --git a/suite-common/connect-popup/tsconfig.json b/suite-common/connect-popup/tsconfig.json index 7acf16d2ff..b920451ed3 100644 --- a/suite-common/connect-popup/tsconfig.json +++ b/suite-common/connect-popup/tsconfig.json @@ -3,6 +3,7 @@ "compilerOptions": { "outDir": "libDev" }, "references": [ { "path": "../analytics" }, + { "path": "../device" }, { "path": "../redux-utils" }, { "path": "../toast-notifications" }, { "path": "../wallet-config" }, diff --git a/suite-common/delegated-identity-key-types/package.json b/suite-common/delegated-identity-key-types/package.json index 01e65dbbe3..9ddc93dac8 100644 --- a/suite-common/delegated-identity-key-types/package.json +++ b/suite-common/delegated-identity-key-types/package.json @@ -11,7 +11,6 @@ }, "dependencies": { "@suite-common/suite-types": "workspace:*", - "@suite-common/wallet-types": "workspace:*", "@trezor/type-utils": "workspace:*" } } diff --git a/suite-common/delegated-identity-key-types/src/ensureDelegatedIdentityKey.ts b/suite-common/delegated-identity-key-types/src/ensureDelegatedIdentityKey.ts index d4eb4fb1bd..aa54de68c8 100644 --- a/suite-common/delegated-identity-key-types/src/ensureDelegatedIdentityKey.ts +++ b/suite-common/delegated-identity-key-types/src/ensureDelegatedIdentityKey.ts @@ -1,5 +1,9 @@ -import { DelegatedIdentityKey, TrezorDeviceWithState } from '@suite-common/suite-types'; -import type { DeviceCancelledErrType, DeviceErrorType } from '@suite-common/wallet-types'; +import type { + DelegatedIdentityKey, + DeviceCancelledErrType, + DeviceErrorType, + TrezorDeviceWithState, +} from '@suite-common/suite-types'; import { Result } from '@trezor/type-utils'; export type EnsureDelegatedIdentityKeyParams = { diff --git a/suite-common/delegated-identity-key-types/tsconfig.json b/suite-common/delegated-identity-key-types/tsconfig.json index 50743625fc..3848b28263 100644 --- a/suite-common/delegated-identity-key-types/tsconfig.json +++ b/suite-common/delegated-identity-key-types/tsconfig.json @@ -6,7 +6,6 @@ }, "references": [ { "path": "../suite-types" }, - { "path": "../wallet-types" }, { "path": "../../packages/type-utils" } ] } diff --git a/suite-common/delegated-identity-key/package.json b/suite-common/delegated-identity-key/package.json index e09b45c7d7..18db7ec7c5 100644 --- a/suite-common/delegated-identity-key/package.json +++ b/suite-common/delegated-identity-key/package.json @@ -13,10 +13,9 @@ "@noble/curves": "^2.0.1", "@reduxjs/toolkit": "2.11.2", "@suite-common/delegated-identity-key-types": "workspace:*", + "@suite-common/device": "workspace:*", "@suite-common/platform-encryption": "workspace:*", "@suite-common/suite-types": "workspace:*", - "@suite-common/wallet-core": "workspace:*", - "@suite-common/wallet-types": "workspace:*", "@trezor/connect": "workspace:*", "@trezor/type-utils": "workspace:*", "@trezor/utils": "workspace:*" diff --git a/suite-common/delegated-identity-key/src/delegatedIdentityKeyCompositionRoot.ts b/suite-common/delegated-identity-key/src/delegatedIdentityKeyCompositionRoot.ts index efbde63f85..814b4dd44a 100644 --- a/suite-common/delegated-identity-key/src/delegatedIdentityKeyCompositionRoot.ts +++ b/suite-common/delegated-identity-key/src/delegatedIdentityKeyCompositionRoot.ts @@ -1,7 +1,7 @@ import { Dispatch } from '@reduxjs/toolkit'; +import { selectDeviceDelegatedIdentityKey } from '@suite-common/device'; import { PlatformEncryptionDep } from '@suite-common/platform-encryption'; -import { selectDeviceDelegatedIdentityKey } from '@suite-common/wallet-core'; import { createEnsureDelegatedIdentityKey } from './ensureDelegatedIdentityKey'; import { createLoadDelegatedIdentityKeyFromState } from './loadDelegatedIdentityKeyFromState'; diff --git a/suite-common/delegated-identity-key/src/loadDelegatedIdentityKeyFromState.ts b/suite-common/delegated-identity-key/src/loadDelegatedIdentityKeyFromState.ts index 67d49b0da2..85668bc7bc 100644 --- a/suite-common/delegated-identity-key/src/loadDelegatedIdentityKeyFromState.ts +++ b/suite-common/delegated-identity-key/src/loadDelegatedIdentityKeyFromState.ts @@ -1,8 +1,8 @@ import { Dispatch } from '@reduxjs/toolkit'; +import { deviceActions } from '@suite-common/device'; import { EncryptedHex, PlatformEncryptionDep } from '@suite-common/platform-encryption'; import { DelegatedIdentityKey } from '@suite-common/suite-types'; -import { deviceActions } from '@suite-common/wallet-core'; import { exhaustive } from '@trezor/type-utils'; export type LoadDelegatedIdentityKeyFromStateDeps = { diff --git a/suite-common/delegated-identity-key/src/retrieveDelegatedIdentityKeyFromDevice.ts b/suite-common/delegated-identity-key/src/retrieveDelegatedIdentityKeyFromDevice.ts index 92e1612c29..4ff9e8045a 100644 --- a/suite-common/delegated-identity-key/src/retrieveDelegatedIdentityKeyFromDevice.ts +++ b/suite-common/delegated-identity-key/src/retrieveDelegatedIdentityKeyFromDevice.ts @@ -1,10 +1,11 @@ +import { DeviceCancelledErr, DeviceError, isCanceledErrorMessage } from '@suite-common/device'; import { DelegatedIdentityKey, + DeviceCancelledErrType, + DeviceErrorType, TrezorDeviceWithState, asDelegatedIdentityKey, } from '@suite-common/suite-types'; -import { DeviceCancelledErr, DeviceError, isCanceledErrorMessage } from '@suite-common/wallet-core'; -import type { DeviceCancelledErrType, DeviceErrorType } from '@suite-common/wallet-types'; import TrezorConnect from '@trezor/connect'; import { Result, err, ok } from '@trezor/type-utils'; diff --git a/suite-common/delegated-identity-key/src/saveDelegatedIdentityKey.ts b/suite-common/delegated-identity-key/src/saveDelegatedIdentityKey.ts index ad8d16fcf6..9437b38db5 100644 --- a/suite-common/delegated-identity-key/src/saveDelegatedIdentityKey.ts +++ b/suite-common/delegated-identity-key/src/saveDelegatedIdentityKey.ts @@ -1,8 +1,8 @@ import { Dispatch } from '@reduxjs/toolkit'; +import { deviceActions } from '@suite-common/device'; import { PlatformEncryptionDep } from '@suite-common/platform-encryption'; import { DelegatedIdentityKey } from '@suite-common/suite-types'; -import { deviceActions } from '@suite-common/wallet-core'; import { exhaustive } from '@trezor/type-utils'; export type SaveDelegatedIdentityKeyDeps = { diff --git a/suite-common/delegated-identity-key/tsconfig.json b/suite-common/delegated-identity-key/tsconfig.json index baa489232c..c36ea02f80 100644 --- a/suite-common/delegated-identity-key/tsconfig.json +++ b/suite-common/delegated-identity-key/tsconfig.json @@ -8,10 +8,9 @@ { "path": "../delegated-identity-key-types" }, + { "path": "../device" }, { "path": "../platform-encryption" }, { "path": "../suite-types" }, - { "path": "../wallet-core" }, - { "path": "../wallet-types" }, { "path": "../../packages/connect" }, { "path": "../../packages/type-utils" }, { "path": "../../packages/utils" } diff --git a/suite-common/device-authenticity/package.json b/suite-common/device-authenticity/package.json index 5c1ec5bf05..d12e280ea2 100644 --- a/suite-common/device-authenticity/package.json +++ b/suite-common/device-authenticity/package.json @@ -11,12 +11,12 @@ "type-check": "yarn g:tsc --build" }, "dependencies": { + "@suite-common/device": "workspace:*", "@suite-common/message-system": "workspace:*", "@suite-common/redux-utils": "workspace:*", "@suite-common/suite-types": "workspace:*", "@suite-common/test-utils": "workspace:*", "@suite-common/toast-notifications": "workspace:*", - "@suite-common/wallet-core": "workspace:*", "@trezor/connect": "workspace:*" } } diff --git a/suite-common/device-authenticity/src/checkDeviceAuthenticityThunk.ts b/suite-common/device-authenticity/src/checkDeviceAuthenticityThunk.ts index db9971d398..ffde8ec603 100644 --- a/suite-common/device-authenticity/src/checkDeviceAuthenticityThunk.ts +++ b/suite-common/device-authenticity/src/checkDeviceAuthenticityThunk.ts @@ -1,8 +1,8 @@ +import { deviceActions } from '@suite-common/device'; import { Feature, selectIsFeatureDisabled } from '@suite-common/message-system'; import { createThunk } from '@suite-common/redux-utils'; import { StoredAuthenticateDeviceResult } from '@suite-common/suite-types'; import { notificationsActions } from '@suite-common/toast-notifications'; -import { deviceActions } from '@suite-common/wallet-core'; import TrezorConnect from '@trezor/connect'; import { isDeviceAuthenticityValid } from './utils'; diff --git a/suite-common/device-authenticity/tests/deviceAuthenticityThunks.test.ts b/suite-common/device-authenticity/tests/deviceAuthenticityThunks.test.ts index 230b044ca8..45272d1afc 100644 --- a/suite-common/device-authenticity/tests/deviceAuthenticityThunks.test.ts +++ b/suite-common/device-authenticity/tests/deviceAuthenticityThunks.test.ts @@ -1,9 +1,9 @@ +import { deviceActions } from '@suite-common/device'; import { messageSystemInitialState } from '@suite-common/message-system'; import { StoredAuthenticateDeviceResult, TrezorDevice } from '@suite-common/suite-types'; import { mockSuiteDevice } from '@suite-common/suite-types/mocks'; import { configureMockStore, testMocks } from '@suite-common/test-utils'; import { ToastPayload, notificationsActions } from '@suite-common/toast-notifications'; -import { deviceActions } from '@suite-common/wallet-core'; import type { AuthenticateDeviceResult, Response, diff --git a/suite-common/device-authenticity/tsconfig.json b/suite-common/device-authenticity/tsconfig.json index a1a2fa55e0..9921682e5c 100644 --- a/suite-common/device-authenticity/tsconfig.json +++ b/suite-common/device-authenticity/tsconfig.json @@ -2,12 +2,12 @@ "extends": "../../tsconfig.base.json", "compilerOptions": { "outDir": "libDev" }, "references": [ + { "path": "../device" }, { "path": "../message-system" }, { "path": "../redux-utils" }, { "path": "../suite-types" }, { "path": "../test-utils" }, { "path": "../toast-notifications" }, - { "path": "../wallet-core" }, { "path": "../../packages/connect" } ] } diff --git a/suite-common/device/jest.config.js b/suite-common/device/jest.config.js new file mode 100644 index 0000000000..3e6fe25ad7 --- /dev/null +++ b/suite-common/device/jest.config.js @@ -0,0 +1,11 @@ +/** + * Jest configuration for web packages. + * Keeping this file next to the package.json file instead of providing configuration + * with `-c ../../jest.config.base` option in package.json scripts + * allows us to run jest tests directly from IDEs. + */ +const baseConfig = require('../../jest.config.base'); + +module.exports = { + ...baseConfig, +}; diff --git a/suite-common/device/package.json b/suite-common/device/package.json new file mode 100644 index 0000000000..6a09887b8d --- /dev/null +++ b/suite-common/device/package.json @@ -0,0 +1,27 @@ +{ + "name": "@suite-common/device", + "version": "1.0.0", + "private": true, + "license": "See LICENSE.md in repo root", + "sideEffects": false, + "main": "src/index", + "scripts": { + "test:unit": "yarn g:jest --coverage", + "depcheck": "yarn g:depcheck", + "type-check": "yarn g:tsc --build" + }, + "dependencies": { + "@mobily/ts-belt": "^3.13.1", + "@reduxjs/toolkit": "2.11.0", + "@suite-common/redux-utils": "workspace:*", + "@suite-common/suite-types": "workspace:*", + "@suite-common/suite-utils": "workspace:*", + "@trezor/connect": "workspace:*", + "@trezor/device-utils": "workspace:*", + "@trezor/env-utils": "workspace:*", + "@trezor/type-utils": "workspace:*", + "@trezor/utils": "workspace:*", + "react": "19.1.0", + "react-redux": "^9.2.0" + } +} diff --git a/suite-common/wallet-core/src/device/deviceActions.ts b/suite-common/device/src/deviceActions.ts similarity index 97% rename from suite-common/wallet-core/src/device/deviceActions.ts rename to suite-common/device/src/deviceActions.ts index 872c89fd5e..c7adc97100 100644 --- a/suite-common/wallet-core/src/device/deviceActions.ts +++ b/suite-common/device/src/deviceActions.ts @@ -1,10 +1,9 @@ import { createAction } from '@reduxjs/toolkit'; -import { EncryptedHex } from '@suite-common/platform-encryption'; -import { +import type { AcquiredDevice, ButtonRequest, - DelegatedIdentityKey, + PersistentDeviceData, StoredAuthenticateDeviceResult, ThpSuiteCredentials, TrezorDevice, @@ -140,7 +139,7 @@ const setThpCredentials = createAction( type SetDelegatedIdentityKeyParams = { deviceId: string; - delegatedKey: EncryptedHex | null; + delegatedKey: PersistentDeviceData['delegatedIdentityKey']; }; const setDelegatedIdentityKey = createAction( diff --git a/suite-common/wallet-core/src/device/deviceConstants.ts b/suite-common/device/src/deviceConstants.ts similarity index 100% rename from suite-common/wallet-core/src/device/deviceConstants.ts rename to suite-common/device/src/deviceConstants.ts diff --git a/suite-common/wallet-core/src/device/deviceReducer.ts b/suite-common/device/src/deviceReducer.ts similarity index 99% rename from suite-common/wallet-core/src/device/deviceReducer.ts rename to suite-common/device/src/deviceReducer.ts index f0c16501e9..56dc1d3a8a 100644 --- a/suite-common/wallet-core/src/device/deviceReducer.ts +++ b/suite-common/device/src/deviceReducer.ts @@ -10,12 +10,12 @@ import { } from '@suite-common/suite-types'; import * as deviceUtils from '@suite-common/suite-utils'; import { isDeviceAcquired } from '@suite-common/suite-utils'; -import { shouldDeviceBeRemembered } from '@suite-common/wallet-utils'; import { Device, DeviceState, Features, KnownDevice, Unsuccessful } from '@trezor/connect'; import { getFirmwareVersionArray } from '@trezor/device-utils'; import { DeviceStateActionPayload, deviceActions } from './deviceActions'; import { PORTFOLIO_TRACKER_DEVICE_ID } from './deviceConstants'; +import { shouldDeviceBeRemembered } from './deviceUtils'; export type DeviceReducerState = { /** diff --git a/suite-common/device/src/deviceSelectors.ts b/suite-common/device/src/deviceSelectors.ts new file mode 100644 index 0000000000..97aadab759 --- /dev/null +++ b/suite-common/device/src/deviceSelectors.ts @@ -0,0 +1,668 @@ +import { A, pipe } from '@mobily/ts-belt'; + +import { createWeakMapSelector, returnStableArrayIfEmpty } from '@suite-common/redux-utils'; +import { + BackupType, + LANGUAGES, + Locale, + TrezorDevice, + TrezorDeviceWithState, +} from '@suite-common/suite-types'; +import { + getDeviceInstances, + getDeviceInstancesGroupedByDeviceId, + getDeviceInternalModel, + getFwUpdateVersion, + getIsDeviceConnectedAndAuthorized, + getIsDeviceConnectedViaBluetooth, + getIsDeviceInitialized, + getIsThpDevice, + getSortedDevicesWithoutInstances, + getStatus, + isDeviceAcquired, +} from '@suite-common/suite-utils'; +import { Device, DeviceState, StaticSessionId } from '@trezor/connect'; +import { + DeviceModelInternal, + getFirmwareVersionArray, + hasBitcoinOnlyFirmware, +} from '@trezor/device-utils'; +import { getSuiteVersion } from '@trezor/env-utils'; +import { versionUtils } from '@trezor/utils'; + +import { + DEVICE_LOW_BATTERY_PERCENTAGE_THRESHOLD, + PORTFOLIO_TRACKER_DEVICE_ID, +} from './deviceConstants'; +import { DeviceRootState } from './deviceReducer'; +import { isTrezorDeviceWithState } from './deviceUtils'; +import { + deviceInvariabilityCheck, + rawDataToDeviceInvariabilityCheckDTO, +} from './services/deviceInvariabilityCheck'; +import { getIsDeviceIdValid } from './services/getIsDeviceIdValid'; + +const createMemoizedSelector = createWeakMapSelector.withTypes(); + +export const selectDevices = (state: DeviceRootState) => state.device?.devices; + +export const selectDevicesCount = (state: DeviceRootState) => state.device?.devices?.length; + +export const selectSelectedDevice = (state: DeviceRootState) => state.device.selectedDevice; + +export const selectPersistentDeviceData = (state: DeviceRootState) => + state.device.persistentDeviceData; + +export const selectPersistentDeviceDataById = createMemoizedSelector( + [selectPersistentDeviceData, (_state, deviceId: TrezorDevice['id']) => deviceId], + (persistentDeviceData, deviceId) => + persistentDeviceData.find(data => data.device_id === deviceId), +); + +// Use in tests only! See deviceReducer for the property definition. +export const selectSimulatedEntropyCheckFail = (state: DeviceRootState) => + state.device.simulatedEntropyCheckFail; + +// Derived selectors +export const selectIsPendingTransportEvent = createMemoizedSelector( + [selectDevices], + devices => devices.length < 1, +); + +export const selectDeviceAutoconnectCredentials = createMemoizedSelector( + [selectSelectedDevice], + device => device?.thp?.credentials.filter(cred => cred.autoconnect) ?? [], +); + +export const selectIsDeviceUnlocked = createMemoizedSelector( + [selectSelectedDevice], + device => !!device?.features?.unlocked, +); + +export const selectDeviceType = createMemoizedSelector( + [selectSelectedDevice], + device => device?.type, +); + +export const selectDevicePath = createMemoizedSelector( + [selectSelectedDevice], + device => device?.path, +); + +export const selectDeviceFeatures = createMemoizedSelector( + [selectSelectedDevice], + device => device?.features, +); + +export const selectDeviceCapabilities = createMemoizedSelector( + [selectDeviceFeatures], + features => features?.capabilities, +); + +export const selectIsDeviceLanguageConfigurable = createMemoizedSelector( + [selectDeviceCapabilities], + capabilities => !!capabilities?.includes('Capability_Translations'), +); + +export const selectIsBluetoothSupportedByDevice = createMemoizedSelector( + [selectDeviceCapabilities], + capabilities => !!capabilities?.includes('Capability_BLE'), +); + +export const selectIsDeviceProtectedByPin = createMemoizedSelector( + [selectDeviceFeatures], + features => !!features?.pin_protection, +); + +export const selectIsDeviceProtectedByPassphrase = createMemoizedSelector( + [selectDeviceFeatures], + features => !!features?.passphrase_protection, +); + +export const selectIsDeviceProtectedByWipeCode = createMemoizedSelector( + [selectDeviceFeatures], + features => !!features?.wipe_code_protection, +); + +export const selectIsDeviceBackedUp = createMemoizedSelector( + [selectDeviceFeatures], + features => features?.backup_availability !== 'Required' && !features?.unfinished_backup, +); + +export const selectIsDeviceBackupRequired = createMemoizedSelector( + [selectDeviceFeatures], + features => features?.backup_availability === 'Required', +); + +export const selectIsDeviceBackupUnfinished = createMemoizedSelector( + [selectDeviceFeatures], + features => features?.unfinished_backup === true, +); + +export const selectDeviceLanguage = createMemoizedSelector( + [selectDeviceFeatures], + features => (features?.language as Locale) ?? null, +); + +export const selectAvailableDeviceTranslations = createMemoizedSelector( + [selectSelectedDevice], + device => device?.availableTranslations ?? {}, +); + +export const selectSupportedDeviceLanguages = createMemoizedSelector( + [selectAvailableDeviceTranslations], + availableDeviceTranslations => { + const supportedDeviceLanguages = Object.entries(LANGUAGES) + .filter(([code]) => availableDeviceTranslations[code]) + .map(([code, { icon, name }]) => ({ + value: code as Locale, + icon, + label: name, + isBeta: true, // TODO: This will need tweaking in the future. + })) + .sort((a, b) => a.label.localeCompare(b.label)); + + const { icon, name } = LANGUAGES['en-US']; + supportedDeviceLanguages.unshift({ + value: 'en-US', + icon, + label: name, + isBeta: false, + }); + + return supportedDeviceLanguages; + }, +); + +export const selectDeviceButtonRequests = createMemoizedSelector( + [selectSelectedDevice], + device => device?.buttonRequests ?? [], +); + +export const selectDeviceButtonRequestsCodes = createMemoizedSelector( + [selectDeviceButtonRequests], + buttonRequests => + pipe( + buttonRequests.map(r => r.code), + returnStableArrayIfEmpty, + ), +); + +export const selectDeviceMode = createMemoizedSelector( + [selectSelectedDevice], + device => device?.mode ?? null, +); + +export const selectIsUnacquiredDevice = createMemoizedSelector( + [selectDeviceType], + deviceType => deviceType === 'unacquired', +); + +export const selectIsDeviceInBootloader = createMemoizedSelector( + [selectDeviceMode], + mode => mode === 'bootloader', +); + +export const selectIsDeviceInitialized = createMemoizedSelector( + [selectDeviceFeatures, selectDeviceMode], + (features, mode) => getIsDeviceInitialized({ deviceMode: mode, deviceFeatures: features }), +); + +export const selectIsDeviceConnected = createMemoizedSelector( + [selectSelectedDevice], + device => !!device?.connected, +); + +export const selectIsDeviceConnectedViaBluetooth = createMemoizedSelector( + [selectSelectedDevice], + device => getIsDeviceConnectedViaBluetooth(device), +); + +export const selectIsThpDevice = createMemoizedSelector( + [selectSelectedDevice], + device => device && getIsThpDevice(device), +); + +export const selectIsDeviceConnectedViaBluetoothLowOnBattery = createMemoizedSelector( + [selectIsDeviceConnectedViaBluetooth, selectDeviceFeatures], + (isDeviceConnectedViaBluetooth, features) => { + const { usb_connected, wireless_connected, soc } = features || {}; + + // If not connected via Bluetooth, then there is no low battery. + if (!isDeviceConnectedViaBluetooth) { + return false; + } + + // If it is connected via USB or wireless charger, we assume it's charging/fine, + if (usb_connected || wireless_connected) { + return false; + } + + const isBatteryDataValid = typeof soc === 'number'; + + if (!isBatteryDataValid) { + // If we cannot read battery status, we assume the worst. + return true; + } + + return soc < DEVICE_LOW_BATTERY_PERCENTAGE_THRESHOLD; + }, +); + +export const selectDeviceBluetoothId = createMemoizedSelector( + [selectSelectedDevice], + device => device?.bluetoothProps?.id, +); + +export const selectIsConnectedDeviceUninitialized = createMemoizedSelector( + [selectSelectedDevice, selectIsDeviceInitialized], + (device, isDeviceInitialized) => device && !isDeviceInitialized, +); + +export const selectDeviceState = createMemoizedSelector( + [selectSelectedDevice], + device => device?.state, +); + +export const selectIsDeviceAuthorized = createMemoizedSelector( + [selectDeviceState], + deviceState => !!deviceState, +); + +export const selectIsDeviceConnectedAndAuthorized = createMemoizedSelector( + [selectDeviceState, selectDeviceFeatures], + (deviceState, deviceFeatures) => + getIsDeviceConnectedAndAuthorized({ deviceFeatures, deviceState }), +); + +export const selectDeviceInternalModel = createMemoizedSelector( + [selectSelectedDevice], + device => device?.features?.internal_model, +); + +// Selectors with parameters should use WeakMap memoization +export const selectDeviceByState = createMemoizedSelector( + [selectDevices, (_state, deviceState: DeviceState | undefined) => deviceState], + (devices, deviceState) => + deviceState + ? devices.find(d => d.state?.staticSessionId === deviceState.staticSessionId) + : undefined, +); + +export const selectDeviceByStaticSessionId = createMemoizedSelector( + [selectDevices, (_state, staticSessionId: StaticSessionId) => staticSessionId], + (devices, staticSessionId) => + devices.find( + (d): d is TrezorDeviceWithState => + isTrezorDeviceWithState(d) && d.state?.staticSessionId === staticSessionId, + ), +); + +export const selectDeviceUnavailableCapabilities = createMemoizedSelector( + [selectSelectedDevice], + device => device?.unavailableCapabilities, +); + +export const selectHasDevicePassphraseEntryCapability = createMemoizedSelector( + [selectDeviceCapabilities], + capabilities => !!capabilities?.includes('Capability_PassphraseEntry'), +); + +export const selectDeviceStatus = createMemoizedSelector( + [selectSelectedDevice], + device => device && getStatus(device), +); + +export const selectIsDeviceThpLocked = createMemoizedSelector( + [selectDeviceStatus], + deviceStatus => deviceStatus === 'device-thp-locked', +); + +export const selectDeviceById = createMemoizedSelector( + [state => state.device.devices, (_state, deviceId: TrezorDevice['id']) => deviceId], + (devices, deviceId) => devices.find(device => device.id === deviceId), +); + +export const selectSelectedPersistentDeviceData = createMemoizedSelector( + [selectSelectedDevice, selectPersistentDeviceData], + (device, persistentDeviceData) => persistentDeviceData.find(d => d.device_id === device?.id), +); + +export const selectDeviceAuthenticity = (state: DeviceRootState) => state.device.deviceAuthenticity; + +export const selectSelectedDeviceAuthenticity = createMemoizedSelector( + [selectSelectedDevice, selectDeviceAuthenticity], + (device, deviceAuthenticity) => (device?.id ? deviceAuthenticity?.[device.id] : undefined), +); + +export const selectIsFirmwareAuthenticityCheckDismissed = createMemoizedSelector( + [selectSelectedDevice, state => state.device.dismissedSecurityChecks?.firmwareAuthenticity], + (device, dismissedChecks) => !!(device?.id && dismissedChecks?.includes(device.id)), +); + +export const selectIsEntropyCheckFailed = createMemoizedSelector( + [selectSelectedPersistentDeviceData], + persistentDeviceData => persistentDeviceData?.lastEntropyCheckResult?.success === false, +); + +export const selectWasFwHashCheckOtherErrorLastTime = createMemoizedSelector( + [state => state.device.lastConnectedAuthenticityChecks, selectIsDeviceConnected], + (lastConnectedAuthenticityChecks, isDeviceConnected) => { + if (!isDeviceConnected) return false; + const lastHashCheck = lastConnectedAuthenticityChecks?.firmwareHash; + + return lastHashCheck && !lastHashCheck.success && lastHashCheck.error === 'other-error'; + }, +); + +export const selectIsDeviceIdCheckSuccess = createMemoizedSelector( + [selectSelectedDevice], + device => getIsDeviceIdValid(device) === true, +); + +export const selectIsDeviceInvariabilityCheckSuccess = createMemoizedSelector( + [selectSelectedDevice, selectSelectedPersistentDeviceData], + (device, previousData) => { + // just a failsafe in case memoization returned wrong results + if (device && previousData && device.id !== previousData.device_id) { + console.error('Device invariability check ID mismatch'); + + return true; + } + const dto = rawDataToDeviceInvariabilityCheckDTO({ device, previousData }); + + return deviceInvariabilityCheck(dto).success; + }, +); + +export const selectIsPortfolioTrackerDevice = createMemoizedSelector( + [selectSelectedDevice], + device => device?.id === PORTFOLIO_TRACKER_DEVICE_ID, +); + +export const selectDeviceLabel = createMemoizedSelector( + [selectSelectedDevice], + device => device?.features?.label, +); + +export const selectDeviceName = createMemoizedSelector( + [selectSelectedDevice], + device => device?.name, +); + +export const selectDeviceLabelOrNameById = createMemoizedSelector( + [state => state.device.devices, (_state, id: TrezorDevice['id']) => id], + (devices, id) => { + const device = devices.find(d => d.id === id); + + return device?.features?.label || device?.name || ''; + }, +); + +export const selectSelectedDeviceLabelOrName = createMemoizedSelector( + [selectSelectedDevice], + selectedDevice => selectedDevice?.features?.label || selectedDevice?.name || '', +); + +export const selectDeviceId = createMemoizedSelector( + [selectSelectedDevice], + selectedDevice => selectedDevice?.id ?? null, +); + +export const selectDeviceModelById = createMemoizedSelector( + [state => state.device.devices, (_state, id: TrezorDevice['id']) => id], + (devices, id) => { + const device = devices.find(d => d.id === id); + + return device?.features?.internal_model ?? null; + }, +); + +export const selectDeviceModel = createMemoizedSelector([selectSelectedDevice], selectedDevice => + selectedDevice ? getDeviceInternalModel(selectedDevice) : null, +); + +export const selectFirmwareReleaseConfig = createMemoizedSelector( + [selectSelectedDevice], + device => device?.firmwareReleaseConfigInfo ?? null, +); + +export const selectIsFirmwareUpgradable = createMemoizedSelector( + [selectFirmwareReleaseConfig], + deviceReleaseInfo => deviceReleaseInfo?.isNewer ?? false, +); + +export const selectDeviceFirmwareVersionArray = createMemoizedSelector( + [selectSelectedDevice], + device => getFirmwareVersionArray(device), +); + +// Selects all wallets of all physical devices. See `selectPhysicalDevicesGrouppedById` for grouping by the same device. +export const selectPhysicalDeviceWallets = createMemoizedSelector([selectDevices], devices => + pipe( + devices, + A.filter(device => device.id !== PORTFOLIO_TRACKER_DEVICE_ID), + returnStableArrayIfEmpty, + ), +); + +export const selectIsNoPhysicalDeviceConnected = createMemoizedSelector( + [selectPhysicalDeviceWallets], + devices => devices.every(device => !device.connected), +); + +export const selectIsAnyPhysicalDeviceConnectedViaUsb = createMemoizedSelector( + [selectPhysicalDeviceWallets], + devices => devices.some(device => device.connected && device.descriptor.apiType === 'usb'), +); + +export const selectHasOnlyPortfolioDevice = createMemoizedSelector( + [selectDevices], + devices => devices.length === 1 && devices[0].id === PORTFOLIO_TRACKER_DEVICE_ID, +); + +export const selectHasDeviceFirmwareInstalled = createMemoizedSelector( + [selectSelectedDevice], + device => !!device && device.firmware !== 'none', +); + +export const selectIsDeviceRemembered = createMemoizedSelector( + [selectSelectedDevice], + device => !!device?.remember, +); + +export const selectRememberedStandardWallets = createMemoizedSelector( + [selectPhysicalDeviceWallets], + devices => + returnStableArrayIfEmpty( + devices.filter(device => device.remember && device.useEmptyPassphrase === true), + ), +); + +export const selectRememberedStandardWalletsCount = createMemoizedSelector( + [selectRememberedStandardWallets], + wallets => wallets.length, +); + +export const selectRememberedHiddenWallets = createMemoizedSelector( + [selectPhysicalDeviceWallets], + devices => + returnStableArrayIfEmpty( + devices.filter(device => device.remember && device.useEmptyPassphrase === false), + ), +); + +export const selectRememberedHiddenWalletsCount = createMemoizedSelector( + [selectRememberedHiddenWallets], + wallets => wallets.length, +); + +export const selectIsDeviceInViewOnlyMode = createMemoizedSelector( + [selectIsDeviceConnected, selectIsDeviceRemembered], + (isDeviceConnected, isDeviceRemembered) => !isDeviceConnected && isDeviceRemembered, +); + +export const selectIsDeviceUsingPassphrase = createMemoizedSelector( + [selectIsDeviceProtectedByPassphrase, selectSelectedDevice], + (isDeviceProtectedByPassphrase, device) => { + const shouldTreatAsPassphraseProtected = (device?.instance ?? 1) > 1; + + return ( + (isDeviceProtectedByPassphrase && device?.useEmptyPassphrase === false) || + shouldTreatAsPassphraseProtected + ); + }, +); + +// Selects all physical devices wallets grouped per device +export const selectPhysicalDevicesGrouppedById = createMemoizedSelector( + [selectPhysicalDeviceWallets], + devices => returnStableArrayIfEmpty(getDeviceInstancesGroupedByDeviceId(devices)), +); + +export const selectDeviceStaticSessionId = createMemoizedSelector( + [selectSelectedDevice], + device => device?.state?.staticSessionId ?? null, +); + +export const selectDeviceInstances = createMemoizedSelector( + [selectSelectedDevice, selectDevices], + (device, allDevices) => { + if (!device) { + return []; + } + + return pipe(getDeviceInstances(device, allDevices), returnStableArrayIfEmpty); + }, +); + +export const selectNumberOfDeviceInstances = createMemoizedSelector( + [selectDeviceInstances], + deviceInstances => deviceInstances.length, +); + +export const selectInstacelessUnselectedDevices = createMemoizedSelector( + [selectSelectedDevice, selectDevices], + (device, allDevices) => + pipe(getSortedDevicesWithoutInstances(allDevices, device?.id), returnStableArrayIfEmpty), +); + +export const selectHasBitcoinOnlyFirmware = createMemoizedSelector([selectSelectedDevice], device => + hasBitcoinOnlyFirmware(device), +); + +export const selectShouldOfferUpdateFirmware = createMemoizedSelector( + [selectFirmwareReleaseConfig], + firmwareReleaseConfig => { + if (!firmwareReleaseConfig) return false; + const { releaseConditions } = firmwareReleaseConfig; + const { environment } = releaseConditions; + const isValidSuiteNativeVersion = environment?.min_suite_native_version + ? versionUtils.isNewerOrEqual(getSuiteVersion(), environment?.min_suite_native_version) + : false; + + return ( + firmwareReleaseConfig?.isNewer && + isValidSuiteNativeVersion && + releaseConditions.shouldBeOffered + ); + }, +); + +export const selectDeviceUpdateFirmwareVersion = (state: DeviceRootState) => { + const device = selectSelectedDevice(state); + + return device ? getFwUpdateVersion(device) : null; +}; + +export const selectFirmwareChangelog = (state: DeviceRootState) => { + const device = selectSelectedDevice(state); + const isBitcoinOnlyFirmware = selectHasBitcoinOnlyFirmware(state); + + if (isBitcoinOnlyFirmware) { + return device?.firmwareReleaseConfigInfo?.release.changelog; + } + + return device?.firmwareReleaseConfigInfo?.release.changelog; +}; + +export const selectDeviceUnitPackaging = createMemoizedSelector( + [selectDeviceFeatures], + features => features?.unit_packaging ?? 0, +); + +const defaultBackupTypeMap: Record = { + [DeviceModelInternal.UNKNOWN]: '12-words', // just to have something + [DeviceModelInternal.T1B1]: '24-words', + [DeviceModelInternal.T2T1]: '12-words', + [DeviceModelInternal.T2B1]: 'shamir-single', + [DeviceModelInternal.T3B1]: 'shamir-single', + [DeviceModelInternal.T3T1]: 'shamir-single', + [DeviceModelInternal.T3W1]: 'shamir-single', +}; + +export const selectDeviceDefaultBackupType = createMemoizedSelector( + [selectDeviceModel, selectDeviceUnitPackaging], + (deviceModel, deviceUnitPackaging) => { + // Original package of Trezor Safe 3 has a card with just 12 words. + if (deviceModel === DeviceModelInternal.T2B1 && deviceUnitPackaging === 0) { + return '12-words'; + } + + return deviceModel ? defaultBackupTypeMap[deviceModel] : 'shamir-single'; + }, +); + +export const selectIsSameOrNewDevice = createMemoizedSelector( + [selectSelectedDevice, (_state, device: Device | TrezorDevice | undefined) => device], + (selectedDevice, device) => selectedDevice === undefined || device?.id === selectedDevice.id, +); + +/** + * Get firmware revision check error, or null if check was successful / skipped. + */ +export const selectFirmwareRevisionCheckError = (state: DeviceRootState) => { + const device = selectSelectedDevice(state); + if (!isDeviceAcquired(device) || !device.authenticityChecks) return null; + const checkResult = device.authenticityChecks.firmwareRevision; + + // null means not performed, then don't consider it failed + if (!checkResult || checkResult.success) return null; + + return checkResult.error; +}; + +/** + * Get firmware hash check error, or null if check was successful / skipped. + */ +export const selectFirmwareHashCheckError = (state: DeviceRootState) => { + const device = selectSelectedDevice(state); + if (!isDeviceAcquired(device) || !device.authenticityChecks) return null; + const checkResult = device.authenticityChecks.firmwareHash; + + // null means not performed, then don't consider it failed + if (!checkResult || checkResult.success) return null; + + return checkResult.error; +}; + +export const selectIsDevicePinLocked = createMemoizedSelector( + [selectSelectedDevice], + selectedDevice => selectedDevice && getStatus(selectedDevice) === 'device-pin-locked', +); + +export const selectAllDeviceStaticIds = createMemoizedSelector([selectDevices], devices => + devices.reduce((acc, it) => { + if (it.state?.staticSessionId !== undefined) { + acc.push(it.state?.staticSessionId); + } + + return acc; + }, []), +); + +export const selectDeviceDelegatedIdentityKey = createMemoizedSelector( + [selectPersistentDeviceData, (_state, deviceId: string) => deviceId], + (persistentDeviceData, deviceId) => + persistentDeviceData.find(d => d.device_id === deviceId)?.delegatedIdentityKey ?? null, +); diff --git a/suite-common/device/src/deviceUtils.ts b/suite-common/device/src/deviceUtils.ts new file mode 100644 index 0000000000..fe78bc4384 --- /dev/null +++ b/suite-common/device/src/deviceUtils.ts @@ -0,0 +1,45 @@ +import type { + DeviceCancelledErrType, + DeviceErrorType, + TrezorDevice, + TrezorDeviceWithState, +} from '@suite-common/suite-types'; +import { Device } from '@trezor/connect'; + +export const DeviceCancelledErr = (): DeviceCancelledErrType => ({ + type: 'DeviceCancelled' as const, +}); + +export const isCanceledErrorMessage = (errorMessage: string | null | undefined) => + Boolean(errorMessage?.toLocaleLowerCase().includes('cancelled')); + +export const DeviceError = (message: string): DeviceErrorType => ({ + type: 'DeviceError' as const, + message, +}); + +export const shouldDeviceBeRemembered = ({ + device, + isAutoEjectEnabled = false, +}: { + device: TrezorDevice | Device; + isAutoEjectEnabled?: boolean; +}) => { + if (device.mode !== 'normal') return false; + + if (device.type !== 'acquired') return false; + + return !isAutoEjectEnabled; +}; + +export const isApprovalFlowSupported = (device: TrezorDevice | undefined) => + !device?.unavailableCapabilities?.['evmApproval']; + +export const isTrezorDeviceWithState = ( + device: TrezorDevice | undefined, +): device is TrezorDeviceWithState => + device !== undefined && + device.id !== null && + device.state !== undefined && + device.state !== null && + device.state.staticSessionId !== undefined; diff --git a/suite-common/device/src/index.ts b/suite-common/device/src/index.ts new file mode 100644 index 0000000000..fa088a0bcb --- /dev/null +++ b/suite-common/device/src/index.ts @@ -0,0 +1,10 @@ +export * from './deviceActions'; +export * from './deviceConstants'; +export * from './deviceReducer'; +export * from './deviceSelectors'; +export * from './deviceUtils'; +export * from './sortDevices'; +export * from './usePinHook'; +export { getIsIgnoredEntropyCheckError } from './services/getIsIgnoredEntropyCheckError'; +export { getIsDeviceIdValid } from './services/getIsDeviceIdValid'; +export { deviceInvariabilityCheck } from './services/deviceInvariabilityCheck'; diff --git a/suite-common/wallet-core/src/device/services/deviceInvariabilityCheck.ts b/suite-common/device/src/services/deviceInvariabilityCheck.ts similarity index 100% rename from suite-common/wallet-core/src/device/services/deviceInvariabilityCheck.ts rename to suite-common/device/src/services/deviceInvariabilityCheck.ts diff --git a/suite-common/wallet-core/src/device/services/getIsDeviceIdValid.ts b/suite-common/device/src/services/getIsDeviceIdValid.ts similarity index 100% rename from suite-common/wallet-core/src/device/services/getIsDeviceIdValid.ts rename to suite-common/device/src/services/getIsDeviceIdValid.ts diff --git a/suite-common/wallet-core/src/device/services/getIsIgnoredEntropyCheckError.ts b/suite-common/device/src/services/getIsIgnoredEntropyCheckError.ts similarity index 100% rename from suite-common/wallet-core/src/device/services/getIsIgnoredEntropyCheckError.ts rename to suite-common/device/src/services/getIsIgnoredEntropyCheckError.ts diff --git a/suite-common/wallet-core/src/device/sortDevices.ts b/suite-common/device/src/sortDevices.ts similarity index 100% rename from suite-common/wallet-core/src/device/sortDevices.ts rename to suite-common/device/src/sortDevices.ts diff --git a/suite-common/wallet-core/src/device/usePinHook.ts b/suite-common/device/src/usePinHook.ts similarity index 100% rename from suite-common/wallet-core/src/device/usePinHook.ts rename to suite-common/device/src/usePinHook.ts diff --git a/suite-common/wallet-core/src/device/services/__tests__/deviceInvariabilityCheck.test.ts b/suite-common/device/tests/deviceInvariabilityCheck.test.ts similarity index 98% rename from suite-common/wallet-core/src/device/services/__tests__/deviceInvariabilityCheck.test.ts rename to suite-common/device/tests/deviceInvariabilityCheck.test.ts index aebfffd8e9..ea5c500431 100644 --- a/suite-common/wallet-core/src/device/services/__tests__/deviceInvariabilityCheck.test.ts +++ b/suite-common/device/tests/deviceInvariabilityCheck.test.ts @@ -4,7 +4,7 @@ import { DeviceModelInternal } from '@trezor/device-utils'; import { deviceInvariabilityCheck, rawDataToDeviceInvariabilityCheckDTO, -} from '../deviceInvariabilityCheck'; +} from '../src/services/deviceInvariabilityCheck'; const deviceId = 'asdf1234'; const defaultFeatures = { internal_model: DeviceModelInternal.T3B1, unit_color: 1 } as const; diff --git a/suite-common/wallet-core/src/device/services/__tests__/getIsDeviceIdValid.test.ts b/suite-common/device/tests/getIsDeviceIdValid.test.ts similarity index 94% rename from suite-common/wallet-core/src/device/services/__tests__/getIsDeviceIdValid.test.ts rename to suite-common/device/tests/getIsDeviceIdValid.test.ts index ad372e17bb..11af992793 100644 --- a/suite-common/wallet-core/src/device/services/__tests__/getIsDeviceIdValid.test.ts +++ b/suite-common/device/tests/getIsDeviceIdValid.test.ts @@ -1,7 +1,7 @@ import type { UnknownDevice } from '@suite-common/suite-types'; import { mockConnectDevice } from '@suite-common/suite-types/mocks'; -import { getIsDeviceIdValid } from '../getIsDeviceIdValid'; +import { getIsDeviceIdValid } from '../src/services/getIsDeviceIdValid'; describe(getIsDeviceIdValid.name, () => { it('returns true valid acquired device', () => { diff --git a/suite-common/wallet-core/src/device/__tests__/sortDevices.test.ts b/suite-common/device/tests/sortDevices.test.ts similarity index 95% rename from suite-common/wallet-core/src/device/__tests__/sortDevices.test.ts rename to suite-common/device/tests/sortDevices.test.ts index f30a3cde89..34cc2e4bb3 100644 --- a/suite-common/wallet-core/src/device/__tests__/sortDevices.test.ts +++ b/suite-common/device/tests/sortDevices.test.ts @@ -1,7 +1,7 @@ import type { TrezorDevice } from '@suite-common/suite-types'; -import { PORTFOLIO_TRACKER_DEVICE_ID, portfolioTrackerDevice } from '../deviceConstants'; -import { sortDevices } from '../sortDevices'; +import { PORTFOLIO_TRACKER_DEVICE_ID, portfolioTrackerDevice } from '../src/deviceConstants'; +import { sortDevices } from '../src/sortDevices'; describe(sortDevices.name, () => { const baseAcquired: TrezorDevice = { diff --git a/suite-common/device/tsconfig.json b/suite-common/device/tsconfig.json new file mode 100644 index 0000000000..e5a57f9569 --- /dev/null +++ b/suite-common/device/tsconfig.json @@ -0,0 +1,14 @@ +{ + "extends": "../../tsconfig.base.json", + "compilerOptions": { "outDir": "libDev" }, + "references": [ + { "path": "../redux-utils" }, + { "path": "../suite-types" }, + { "path": "../suite-utils" }, + { "path": "../../packages/connect" }, + { "path": "../../packages/device-utils" }, + { "path": "../../packages/env-utils" }, + { "path": "../../packages/type-utils" }, + { "path": "../../packages/utils" } + ] +} diff --git a/suite-common/firmware-authenticity/package.json b/suite-common/firmware-authenticity/package.json index 3e578bc0f3..a204b0d9f8 100644 --- a/suite-common/firmware-authenticity/package.json +++ b/suite-common/firmware-authenticity/package.json @@ -11,10 +11,10 @@ }, "dependencies": { "@reduxjs/toolkit": "2.11.2", + "@suite-common/device": "workspace:*", "@suite-common/firmware": "workspace:*", "@suite-common/redux-utils": "workspace:*", "@suite-common/suite-utils": "workspace:*", - "@suite-common/wallet-core": "workspace:*", "@trezor/connect": "workspace:*", "@trezor/device-utils": "workspace:*", "@trezor/utils": "workspace:*", diff --git a/suite-common/firmware-authenticity/src/useReportDeviceCompromised.ts b/suite-common/firmware-authenticity/src/useReportDeviceCompromised.ts index 06c8c00729..ffd0bacb3f 100644 --- a/suite-common/firmware-authenticity/src/useReportDeviceCompromised.ts +++ b/suite-common/firmware-authenticity/src/useReportDeviceCompromised.ts @@ -1,15 +1,15 @@ import { useEffect, useMemo } from 'react'; import { useDispatch, useSelector } from 'react-redux'; -import { selectFirmwareChannel } from '@suite-common/firmware'; -import { TrezorDevice } from '@suite-common/suite-types'; -import { isDeviceKnown as getIsDeviceKnown, isDeviceAcquired } from '@suite-common/suite-utils'; import { type DeviceRootState, deviceInvariabilityCheck, getIsDeviceIdValid, selectPersistentDeviceDataById, -} from '@suite-common/wallet-core'; +} from '@suite-common/device'; +import { selectFirmwareChannel } from '@suite-common/firmware'; +import { TrezorDevice } from '@suite-common/suite-types'; +import { isDeviceKnown as getIsDeviceKnown, isDeviceAcquired } from '@suite-common/suite-utils'; import { FIRMWARE } from '@trezor/connect'; import { getFirmwareVersion } from '@trezor/device-utils'; import { isArrayMember } from '@trezor/utils'; diff --git a/suite-common/firmware-authenticity/tsconfig.json b/suite-common/firmware-authenticity/tsconfig.json index 58a0af28aa..3c9b7166bb 100644 --- a/suite-common/firmware-authenticity/tsconfig.json +++ b/suite-common/firmware-authenticity/tsconfig.json @@ -2,10 +2,10 @@ "extends": "../../tsconfig.base.json", "compilerOptions": { "outDir": "libDev" }, "references": [ + { "path": "../device" }, { "path": "../firmware" }, { "path": "../redux-utils" }, { "path": "../suite-utils" }, - { "path": "../wallet-core" }, { "path": "../../packages/connect" }, { "path": "../../packages/device-utils" }, { "path": "../../packages/utils" }, diff --git a/suite-common/firmware/package.json b/suite-common/firmware/package.json index f00b15cab4..71754a43fb 100644 --- a/suite-common/firmware/package.json +++ b/suite-common/firmware/package.json @@ -11,10 +11,10 @@ }, "dependencies": { "@reduxjs/toolkit": "2.11.2", + "@suite-common/device": "workspace:*", "@suite-common/redux-utils": "workspace:*", "@suite-common/suite-types": "workspace:*", "@suite-common/thp": "workspace:*", - "@suite-common/wallet-core": "workspace:*", "@trezor/connect": "workspace:*", "@trezor/device-utils": "workspace:*", "@trezor/env-utils": "workspace:*", diff --git a/suite-common/firmware/src/firmwareThunks.ts b/suite-common/firmware/src/firmwareThunks.ts index 039b8aa76a..2cccf54f98 100644 --- a/suite-common/firmware/src/firmwareThunks.ts +++ b/suite-common/firmware/src/firmwareThunks.ts @@ -1,6 +1,6 @@ +import { selectSelectedDevice } from '@suite-common/device'; import { createThunk } from '@suite-common/redux-utils'; import { TrezorDevice } from '@suite-common/suite-types'; -import { selectSelectedDevice } from '@suite-common/wallet-core'; import TrezorConnect, { FirmwareType } from '@trezor/connect'; import { hasBitcoinOnlyFirmware, isBitcoinOnlyDevice } from '@trezor/device-utils'; diff --git a/suite-common/firmware/src/hooks/useFirmwareInstallation.ts b/suite-common/firmware/src/hooks/useFirmwareInstallation.ts index 18b43d47bf..d5218c81fd 100644 --- a/suite-common/firmware/src/hooks/useFirmwareInstallation.ts +++ b/suite-common/firmware/src/hooks/useFirmwareInstallation.ts @@ -1,9 +1,9 @@ import { useCallback, useMemo } from 'react'; import { useDispatch, useSelector } from 'react-redux'; +import { selectSelectedDevice } from '@suite-common/device'; import { ButtonRequest, FirmwareStatus, TrezorDevice } from '@suite-common/suite-types'; import { THP_BUTTON_REQUESTS_NAMES, selectIsThpInProgress, selectThpStep } from '@suite-common/thp'; -import { selectSelectedDevice } from '@suite-common/wallet-core'; import { DEVICE, type Device, DeviceButtonRequestPayload, FirmwareType, UI } from '@trezor/connect'; import { DeviceModelInternal, diff --git a/suite-common/firmware/tsconfig.json b/suite-common/firmware/tsconfig.json index 358e20dbaa..482b9d85e3 100644 --- a/suite-common/firmware/tsconfig.json +++ b/suite-common/firmware/tsconfig.json @@ -2,10 +2,10 @@ "extends": "../../tsconfig.base.json", "compilerOptions": { "outDir": "libDev" }, "references": [ + { "path": "../device" }, { "path": "../redux-utils" }, { "path": "../suite-types" }, { "path": "../thp" }, - { "path": "../wallet-core" }, { "path": "../../packages/connect" }, { "path": "../../packages/device-utils" }, { "path": "../../packages/env-utils" }, diff --git a/suite-common/graph/package.json b/suite-common/graph/package.json index 944c2c04f6..a6ac98fc03 100644 --- a/suite-common/graph/package.json +++ b/suite-common/graph/package.json @@ -13,6 +13,7 @@ "dependencies": { "@mobily/ts-belt": "^3.13.1", "@reduxjs/toolkit": "2.11.2", + "@suite-common/device": "workspace:*", "@suite-common/fiat-services": "workspace:*", "@suite-common/wallet-config": "workspace:*", "@suite-common/wallet-core": "workspace:*", diff --git a/suite-common/graph/src/hooks.ts b/suite-common/graph/src/hooks.ts index fd7d3a8c4a..7ee863f028 100644 --- a/suite-common/graph/src/hooks.ts +++ b/suite-common/graph/src/hooks.ts @@ -4,7 +4,8 @@ import { useDispatch, useSelector } from 'react-redux'; import { A } from '@mobily/ts-belt'; import { roundToNearestMinutes, subHours } from 'date-fns'; -import { selectHasRunningDiscovery, selectIsDeviceAuthorized } from '@suite-common/wallet-core'; +import { selectIsDeviceAuthorized } from '@suite-common/device'; +import { selectHasRunningDiscovery } from '@suite-common/wallet-core'; import type { BaseCurrencyCode } from '@trezor/blockchain-link-types'; import { getAccountMovementEvents } from './graphBalanceEvents'; diff --git a/suite-common/graph/tsconfig.json b/suite-common/graph/tsconfig.json index 53bd9ab57d..b217ac7f63 100644 --- a/suite-common/graph/tsconfig.json +++ b/suite-common/graph/tsconfig.json @@ -2,6 +2,7 @@ "extends": "../../tsconfig.base.json", "compilerOptions": { "outDir": "libDev" }, "references": [ + { "path": "../device" }, { "path": "../fiat-services" }, { "path": "../wallet-config" }, { "path": "../wallet-core" }, diff --git a/suite-common/logger/package.json b/suite-common/logger/package.json index e50cb0979e..9ec5c796fc 100644 --- a/suite-common/logger/package.json +++ b/suite-common/logger/package.json @@ -14,6 +14,7 @@ "@mobily/ts-belt": "^3.13.1", "@reduxjs/toolkit": "2.11.2", "@suite-common/analytics-redux": "workspace:*", + "@suite-common/device": "workspace:*", "@suite-common/redux-utils": "workspace:*", "@suite-common/suite-types": "workspace:*", "@suite-common/suite-utils": "workspace:*", diff --git a/suite-common/logger/src/logsMiddleware.ts b/suite-common/logger/src/logsMiddleware.ts index b8d617a75e..edcd2fba28 100644 --- a/suite-common/logger/src/logsMiddleware.ts +++ b/suite-common/logger/src/logsMiddleware.ts @@ -1,13 +1,13 @@ import { isAnyOf } from '@reduxjs/toolkit'; import { analyticsActions } from '@suite-common/analytics-redux'; +import { deviceActions } from '@suite-common/device'; import { createMiddleware } from '@suite-common/redux-utils'; import { WALLET_SETTINGS, accountsActions, blockchainActions, changeNetworks, - deviceActions, setBaseCurrency, } from '@suite-common/wallet-core'; import { getAccountIdentifier } from '@suite-common/wallet-utils'; diff --git a/suite-common/logger/src/logsSelectors.ts b/suite-common/logger/src/logsSelectors.ts index 9fd5546585..e5787ae48b 100644 --- a/suite-common/logger/src/logsSelectors.ts +++ b/suite-common/logger/src/logsSelectors.ts @@ -6,18 +6,20 @@ import { selectAnalyticsSessionId, selectIsAnalyticsEnabled, } from '@suite-common/analytics-redux'; +import { + DeviceRootState, + selectDevices, + selectRememberedHiddenWalletsCount, + selectRememberedStandardWalletsCount, +} from '@suite-common/device'; import { createWeakMapSelector, returnStableArrayIfEmpty } from '@suite-common/redux-utils'; import { BlockchainRootState, - DeviceRootState, WalletSettingsRootState, selectBaseCurrency, - selectDevices, selectEnabledCustomBackends, selectEnabledNetworks, selectIsDiscreteModeActive, - selectRememberedHiddenWalletsCount, - selectRememberedStandardWalletsCount, } from '@suite-common/wallet-core'; import { DeviceState } from '@trezor/connect'; import { diff --git a/suite-common/logger/src/utils.ts b/suite-common/logger/src/utils.ts index 6372f4e93a..5579d9e002 100644 --- a/suite-common/logger/src/utils.ts +++ b/suite-common/logger/src/utils.ts @@ -1,6 +1,7 @@ +import { deviceActions } from '@suite-common/device'; import { TrezorDevice } from '@suite-common/suite-types'; import { getBrowserName, getBrowserVersion, getOsVersion } from '@suite-common/suite-utils'; -import { accountsActions, deviceActions } from '@suite-common/wallet-core'; +import { accountsActions } from '@suite-common/wallet-core'; import { Account } from '@suite-common/wallet-types'; import { DEVICE } from '@trezor/connect'; import { diff --git a/suite-common/logger/tsconfig.json b/suite-common/logger/tsconfig.json index df421b4f06..51cee236a3 100644 --- a/suite-common/logger/tsconfig.json +++ b/suite-common/logger/tsconfig.json @@ -3,6 +3,7 @@ "compilerOptions": { "outDir": "libDev" }, "references": [ { "path": "../analytics-redux" }, + { "path": "../device" }, { "path": "../redux-utils" }, { "path": "../suite-types" }, { "path": "../suite-utils" }, diff --git a/suite-common/suite-sync-quota-manager/package.json b/suite-common/suite-sync-quota-manager/package.json index 1beac21943..cb4693a2ab 100644 --- a/suite-common/suite-sync-quota-manager/package.json +++ b/suite-common/suite-sync-quota-manager/package.json @@ -14,12 +14,12 @@ "dependencies": { "@reduxjs/toolkit": "2.11.2", "@suite-common/delegated-identity-key": "workspace:*", + "@suite-common/device": "workspace:*", "@suite-common/redux-utils": "workspace:*", "@suite-common/suite-sync-storage": "workspace:*", "@suite-common/suite-sync-types": "workspace:*", "@suite-common/suite-types": "workspace:*", "@suite-common/suite-utils": "workspace:*", - "@suite-common/wallet-core": "workspace:*", "@suite-common/wallet-types": "workspace:*", "@suite-common/wallet-utils": "workspace:*", "@trezor/connect": "workspace:*", diff --git a/suite-common/suite-sync-quota-manager/src/increaseOwnerQuotaThunk.ts b/suite-common/suite-sync-quota-manager/src/increaseOwnerQuotaThunk.ts index 0d5245d3d6..e3e2693de1 100644 --- a/suite-common/suite-sync-quota-manager/src/increaseOwnerQuotaThunk.ts +++ b/suite-common/suite-sync-quota-manager/src/increaseOwnerQuotaThunk.ts @@ -4,11 +4,11 @@ import { getProofOfDelegatedIdentity, getPublicIdentityKeyFromDelegatedKey, } from '@suite-common/delegated-identity-key'; +import { isTrezorDeviceWithState, selectSelectedDevice } from '@suite-common/device'; import { ExtraDependencies } from '@suite-common/redux-utils'; import { SuiteSyncOwnerId } from '@suite-common/suite-sync-storage'; import { asDelegatedIdentityKey } from '@suite-common/suite-types'; -import { selectSelectedDevice } from '@suite-common/wallet-core'; -import { isTrezorDeviceWithState, parseDeviceStaticSessionId } from '@suite-common/wallet-utils'; +import { parseDeviceStaticSessionId } from '@suite-common/wallet-utils'; import { prepareChallengeSession } from './challenge/prepareChallengeSession'; import { diff --git a/suite-common/suite-sync-quota-manager/src/storage/registerStorageThunk.ts b/suite-common/suite-sync-quota-manager/src/storage/registerStorageThunk.ts index d3e4375380..8ce91b940c 100644 --- a/suite-common/suite-sync-quota-manager/src/storage/registerStorageThunk.ts +++ b/suite-common/suite-sync-quota-manager/src/storage/registerStorageThunk.ts @@ -1,6 +1,6 @@ import { Dispatch } from '@reduxjs/toolkit'; -import { selectSelectedDevice } from '@suite-common/wallet-core'; +import { selectSelectedDevice } from '@suite-common/device'; import { err, ok } from '@trezor/type-utils'; import { quotaManagerDeviceFetched, quotaManagerFetchError } from '../quotaManagerActions'; diff --git a/suite-common/suite-sync-quota-manager/src/storage/tests/registerStorageThunk.test.ts b/suite-common/suite-sync-quota-manager/src/storage/tests/registerStorageThunk.test.ts index 5f82e63cf9..c52cd0ce55 100644 --- a/suite-common/suite-sync-quota-manager/src/storage/tests/registerStorageThunk.test.ts +++ b/suite-common/suite-sync-quota-manager/src/storage/tests/registerStorageThunk.test.ts @@ -1,7 +1,7 @@ import { mocked } from 'jest-mock'; +import { selectSelectedDevice } from '@suite-common/device'; import { mockSuiteDevice } from '@suite-common/suite-types/mocks'; -import { selectSelectedDevice } from '@suite-common/wallet-core'; import { ok } from '@trezor/type-utils'; import { quotaManagerDeviceFetched, quotaManagerFetchError } from '../../quotaManagerActions'; @@ -11,7 +11,7 @@ import { registerStorageThunk } from '../registerStorageThunk'; jest.mock('../../quotaManagerFetch'); jest.mock('../../quotaManagerSelectors'); -jest.mock('@suite-common/wallet-core'); +jest.mock('@suite-common/device'); const mockDispatch = jest.fn(); const mockGetState = jest.fn(); diff --git a/suite-common/suite-sync-quota-manager/tsconfig.json b/suite-common/suite-sync-quota-manager/tsconfig.json index d7158e5ee7..b43630df9e 100644 --- a/suite-common/suite-sync-quota-manager/tsconfig.json +++ b/suite-common/suite-sync-quota-manager/tsconfig.json @@ -6,12 +6,12 @@ }, "references": [ { "path": "../delegated-identity-key" }, + { "path": "../device" }, { "path": "../redux-utils" }, { "path": "../suite-sync-storage" }, { "path": "../suite-sync-types" }, { "path": "../suite-types" }, { "path": "../suite-utils" }, - { "path": "../wallet-core" }, { "path": "../wallet-types" }, { "path": "../wallet-utils" }, { "path": "../../packages/connect" }, diff --git a/suite-common/suite-sync-types/src/data/subscribeSuiteSyncData.ts b/suite-common/suite-sync-types/src/data/subscribeSuiteSyncData.ts index c9abca90ec..3b867fedb2 100644 --- a/suite-common/suite-sync-types/src/data/subscribeSuiteSyncData.ts +++ b/suite-common/suite-sync-types/src/data/subscribeSuiteSyncData.ts @@ -1,9 +1,6 @@ import { SuiteSyncSchema, SuiteSyncStorage } from '@suite-common/suite-sync-storage'; -import { - DeviceCancelledErrType, - DeviceErrorType, - WalletDescriptor, -} from '@suite-common/wallet-types'; +import { DeviceCancelledErrType, DeviceErrorType } from '@suite-common/suite-types'; +import { WalletDescriptor } from '@suite-common/wallet-types'; import { StaticSessionId } from '@trezor/connect'; import { Result } from '@trezor/type-utils'; diff --git a/suite-common/suite-sync-types/src/owner/ensureSuiteSyncOwner.ts b/suite-common/suite-sync-types/src/owner/ensureSuiteSyncOwner.ts index 2994828a98..c1c10e74be 100644 --- a/suite-common/suite-sync-types/src/owner/ensureSuiteSyncOwner.ts +++ b/suite-common/suite-sync-types/src/owner/ensureSuiteSyncOwner.ts @@ -1,7 +1,7 @@ import { ProofOfDelegatedSignFailedType } from '@suite-common/delegated-identity-key-types'; import { CreateSuiteSyncOwnerError, type SuiteSyncOwner } from '@suite-common/suite-sync-storage'; import { DelegatedIdentityKey, TrezorDeviceWithState } from '@suite-common/suite-types'; -import type { DeviceErrorType } from '@suite-common/wallet-types'; +import type { DeviceErrorType } from '@suite-common/suite-types'; import { Result } from '@trezor/type-utils'; export type EnsureSuiteSyncOwnerParams = { diff --git a/suite-common/suite-sync-types/src/refreshSuiteSyncKeys.ts b/suite-common/suite-sync-types/src/refreshSuiteSyncKeys.ts index ff1eea8b1a..de61da7454 100644 --- a/suite-common/suite-sync-types/src/refreshSuiteSyncKeys.ts +++ b/suite-common/suite-sync-types/src/refreshSuiteSyncKeys.ts @@ -1,6 +1,6 @@ import { SuiteSyncOwner } from '@suite-common/suite-sync-storage'; +import type { DeviceCancelledErrType, DeviceErrorType } from '@suite-common/suite-types'; import { TrezorDevice } from '@suite-common/suite-types'; -import type { DeviceCancelledErrType, DeviceErrorType } from '@suite-common/wallet-types'; import { Result } from '@trezor/type-utils'; type RefreshSuiteSyncKeysParams = { diff --git a/suite-common/suite-sync-types/src/storage/ensureWalletSuiteSyncOn.ts b/suite-common/suite-sync-types/src/storage/ensureWalletSuiteSyncOn.ts index b166af5160..123c5f69b4 100644 --- a/suite-common/suite-sync-types/src/storage/ensureWalletSuiteSyncOn.ts +++ b/suite-common/suite-sync-types/src/storage/ensureWalletSuiteSyncOn.ts @@ -1,5 +1,5 @@ import { SuiteSyncStorage } from '@suite-common/suite-sync-storage'; -import { DeviceCancelledErrType, DeviceErrorType } from '@suite-common/wallet-types'; +import { DeviceCancelledErrType, DeviceErrorType } from '@suite-common/suite-types'; import { StaticSessionId } from '@trezor/connect'; import { Result } from '@trezor/type-utils'; diff --git a/suite-common/suite-sync/package.json b/suite-common/suite-sync/package.json index ed1a51475c..c2828beef6 100644 --- a/suite-common/suite-sync/package.json +++ b/suite-common/suite-sync/package.json @@ -15,6 +15,7 @@ "@suite-common/delegated-identity-key": "workspace:*", "@suite-common/delegated-identity-key-types": "workspace:*", "@suite-common/dependency-injection": "workspace:*", + "@suite-common/device": "workspace:*", "@suite-common/metadata-types": "workspace:*", "@suite-common/platform-encryption": "workspace:*", "@suite-common/redux-utils": "workspace:*", diff --git a/suite-common/suite-sync/src/createRefreshSuiteSyncKeys.ts b/suite-common/suite-sync/src/createRefreshSuiteSyncKeys.ts index ffafbc23e9..af54bfedaa 100644 --- a/suite-common/suite-sync/src/createRefreshSuiteSyncKeys.ts +++ b/suite-common/suite-sync/src/createRefreshSuiteSyncKeys.ts @@ -1,6 +1,7 @@ import { Dispatch } from '@reduxjs/toolkit'; import { EnsureDelegatedIdentityKeyDep } from '@suite-common/delegated-identity-key-types'; +import { isTrezorDeviceWithState } from '@suite-common/device'; import { WriteModeRequiredForAllocation, ensureDeviceHasQuotaThunk, @@ -12,7 +13,7 @@ import { SuiteSyncUnavailableOnDeviceErrorType, } from '@suite-common/suite-sync-types'; import { notificationsActions } from '@suite-common/toast-notifications'; -import { isTrezorDeviceWithState, parseDeviceStaticSessionId } from '@suite-common/wallet-utils'; +import { parseDeviceStaticSessionId } from '@suite-common/wallet-utils'; import { err, exhaustive, ok } from '@trezor/type-utils'; import { GetDeviceForStaticSessionIdDep } from './getDeviceForStaticSessionId'; diff --git a/suite-common/suite-sync/src/createSuiteSyncCompositionRoot.ts b/suite-common/suite-sync/src/createSuiteSyncCompositionRoot.ts index f571206550..110001e52a 100644 --- a/suite-common/suite-sync/src/createSuiteSyncCompositionRoot.ts +++ b/suite-common/suite-sync/src/createSuiteSyncCompositionRoot.ts @@ -2,6 +2,7 @@ import { Dispatch } from '@reduxjs/toolkit'; import { EnsureDelegatedIdentityKeyDep } from '@suite-common/delegated-identity-key-types'; import { toGetter } from '@suite-common/dependency-injection'; +import { selectAllDeviceStaticIds, selectDeviceByStaticSessionId } from '@suite-common/device'; import { PlatformEncryptionDep } from '@suite-common/platform-encryption'; import { selectHasDeviceAllowance } from '@suite-common/suite-sync-quota-manager'; import { CreateSuiteStorage, CreateSuiteSyncOwnerDep } from '@suite-common/suite-sync-storage'; @@ -10,7 +11,6 @@ import { SuiteSyncAppReloaderDep, SuiteSyncErrorHandler, } from '@suite-common/suite-sync-types'; -import { selectAllDeviceStaticIds, selectDeviceByStaticSessionId } from '@suite-common/wallet-core'; import { createRefreshSuiteSync } from './createRefreshSuiteSyncKeys'; import { createSuiteSyncErrorHandler } from './createSuiteSyncErrorHandler'; diff --git a/suite-common/suite-sync/src/owner/createRetrieveSuiteSyncOwner.ts b/suite-common/suite-sync/src/owner/createRetrieveSuiteSyncOwner.ts index a7d9cb33ac..775031f94f 100644 --- a/suite-common/suite-sync/src/owner/createRetrieveSuiteSyncOwner.ts +++ b/suite-common/suite-sync/src/owner/createRetrieveSuiteSyncOwner.ts @@ -1,13 +1,16 @@ import { getProofOfDelegatedIdentity } from '@suite-common/delegated-identity-key'; import { ProofOfDelegatedSignFailedType } from '@suite-common/delegated-identity-key-types'; +import { DeviceError } from '@suite-common/device'; import { CreateSuiteSyncOwner, CreateSuiteSyncOwnerError, SuiteSyncOwner, } from '@suite-common/suite-sync-storage'; -import { DelegatedIdentityKey, TrezorDeviceWithState } from '@suite-common/suite-types'; -import { DeviceError } from '@suite-common/wallet-core'; -import { DeviceErrorType } from '@suite-common/wallet-types'; +import { + DelegatedIdentityKey, + DeviceErrorType, + TrezorDeviceWithState, +} from '@suite-common/suite-types'; import TrezorConnect from '@trezor/connect'; import { Result, err } from '@trezor/type-utils'; diff --git a/suite-common/suite-sync/src/storage/createEnsureStorage.ts b/suite-common/suite-sync/src/storage/createEnsureStorage.ts index 3f26b8a094..b4abf1c8b0 100644 --- a/suite-common/suite-sync/src/storage/createEnsureStorage.ts +++ b/suite-common/suite-sync/src/storage/createEnsureStorage.ts @@ -5,7 +5,7 @@ import { SuiteSyncUnavailableOnDeviceErrorType, } from '@suite-common/suite-sync-types'; import type { WriteModeRequiredForAllocationErrType } from '@suite-common/suite-sync-types'; -import { DeviceCancelledErrType, DeviceErrorType } from '@suite-common/wallet-types'; +import { DeviceCancelledErrType, DeviceErrorType } from '@suite-common/suite-types'; import { StaticSessionId } from '@trezor/connect'; import { Result, err, ok } from '@trezor/type-utils'; diff --git a/suite-common/suite-sync/src/storage/createEnsureWalletSuiteSyncOn.ts b/suite-common/suite-sync/src/storage/createEnsureWalletSuiteSyncOn.ts index 99f529de70..17abe7299a 100644 --- a/suite-common/suite-sync/src/storage/createEnsureWalletSuiteSyncOn.ts +++ b/suite-common/suite-sync/src/storage/createEnsureWalletSuiteSyncOn.ts @@ -1,11 +1,10 @@ +import { isTrezorDeviceWithState, selectDeviceByStaticSessionId } from '@suite-common/device'; import { EnsureWalletSuiteSyncOn, RefreshSuiteSyncKeysDep, SubscribeSuiteSyncDataDep, SubscriptionStorageDep, } from '@suite-common/suite-sync-types'; -import { selectDeviceByStaticSessionId } from '@suite-common/wallet-core'; -import { isTrezorDeviceWithState } from '@suite-common/wallet-utils'; import { err } from '@trezor/type-utils'; import { isFwUpgradeNeededForSuiteSync, isSuiteSyncSupportedByDevice } from '../suiteSyncUtils'; diff --git a/suite-common/suite-sync/src/storage/tests/createEnsureWalletSuiteSyncOn.test.ts b/suite-common/suite-sync/src/storage/tests/createEnsureWalletSuiteSyncOn.test.ts index b79d002fd3..d9ca801aec 100644 --- a/suite-common/suite-sync/src/storage/tests/createEnsureWalletSuiteSyncOn.test.ts +++ b/suite-common/suite-sync/src/storage/tests/createEnsureWalletSuiteSyncOn.test.ts @@ -1,8 +1,8 @@ import { createMockDeps } from '@suite-common/dependency-injection'; +import type { DeviceRootState } from '@suite-common/device'; +import { deviceReducerInitialState } from '@suite-common/device'; import type { TrezorDevice } from '@suite-common/suite-types'; import { mockSuiteDevice } from '@suite-common/suite-types/mocks'; -import type { DeviceRootState } from '@suite-common/wallet-core'; -import { deviceReducerInitialState } from '@suite-common/wallet-core'; import type { UnavailableCapabilities } from '@trezor/connect'; import { StaticSessionId } from '@trezor/connect'; import { err, ok } from '@trezor/type-utils'; diff --git a/suite-common/suite-sync/src/suiteSyncMiddleware.ts b/suite-common/suite-sync/src/suiteSyncMiddleware.ts index e8103c39a8..b151d6b7d3 100644 --- a/suite-common/suite-sync/src/suiteSyncMiddleware.ts +++ b/suite-common/suite-sync/src/suiteSyncMiddleware.ts @@ -1,8 +1,8 @@ import { isAnyOf } from '@reduxjs/toolkit'; +import { deviceActions, isTrezorDeviceWithState } from '@suite-common/device'; import { createMiddlewareWithExtraDeps } from '@suite-common/redux-utils'; -import { deviceActions, selectDeviceThunk } from '@suite-common/wallet-core'; -import { isTrezorDeviceWithState } from '@suite-common/wallet-utils'; +import { selectDeviceThunk } from '@suite-common/wallet-core'; import { selectHasDeviceSuiteSyncError, selectIsSuiteSyncEnabled } from './suiteSyncSelectors'; diff --git a/suite-common/suite-sync/src/suiteSyncSelectors.ts b/suite-common/suite-sync/src/suiteSyncSelectors.ts index bf4a75b493..1aaae61fe9 100644 --- a/suite-common/suite-sync/src/suiteSyncSelectors.ts +++ b/suite-common/suite-sync/src/suiteSyncSelectors.ts @@ -1,6 +1,6 @@ +import { DeviceRootState, selectDeviceByStaticSessionId } from '@suite-common/device'; import { EncryptedHex } from '@suite-common/platform-encryption'; import { SuiteSyncOwnerSerialized } from '@suite-common/suite-sync-storage'; -import { DeviceRootState, selectDeviceByStaticSessionId } from '@suite-common/wallet-core'; import { StaticSessionId } from '@trezor/connect'; import { SuiteSyncState } from './suiteSyncSlice'; diff --git a/suite-common/suite-sync/src/suiteSyncSlice.ts b/suite-common/suite-sync/src/suiteSyncSlice.ts index 4245c00af2..86a3c49a16 100644 --- a/suite-common/suite-sync/src/suiteSyncSlice.ts +++ b/suite-common/suite-sync/src/suiteSyncSlice.ts @@ -1,10 +1,10 @@ import { PayloadAction, createSlice } from '@reduxjs/toolkit'; +import { deviceActions } from '@suite-common/device'; import { EncryptedHex } from '@suite-common/platform-encryption'; import { SuiteSyncOwnerSerialized } from '@suite-common/suite-sync-storage'; import { SuiteSyncFirmwareUpgradeNeededDeviceErrorType } from '@suite-common/suite-sync-types'; -import { deviceActions } from '@suite-common/wallet-core'; -import { DeviceCancelledErrType, DeviceErrorType } from '@suite-common/wallet-types'; +import { DeviceCancelledErrType, DeviceErrorType } from '@suite-common/suite-types'; import { StaticSessionId } from '@trezor/connect'; export type SuiteSyncErrorType = diff --git a/suite-common/suite-sync/src/tests/suiteSyncSelectors.test.ts b/suite-common/suite-sync/src/tests/suiteSyncSelectors.test.ts index dbeef343e3..0638b92a97 100644 --- a/suite-common/suite-sync/src/tests/suiteSyncSelectors.test.ts +++ b/suite-common/suite-sync/src/tests/suiteSyncSelectors.test.ts @@ -1,7 +1,7 @@ +import { deviceReducerInitialState } from '@suite-common/device'; import { asEncryptedHex } from '@suite-common/platform-encryption'; import type { SuiteSyncOwnerSerialized } from '@suite-common/suite-sync-storage'; import { mockSuiteDevice } from '@suite-common/suite-types/mocks'; -import { deviceReducerInitialState } from '@suite-common/wallet-core'; import type { UnavailableCapabilities } from '@trezor/connect'; import { StaticSessionId } from '@trezor/connect'; diff --git a/suite-common/suite-sync/src/tests/suiteSyncSlice.test.ts b/suite-common/suite-sync/src/tests/suiteSyncSlice.test.ts index a24bbd03cb..0868b4c6bb 100644 --- a/suite-common/suite-sync/src/tests/suiteSyncSlice.test.ts +++ b/suite-common/suite-sync/src/tests/suiteSyncSlice.test.ts @@ -1,7 +1,7 @@ +import { deviceActions } from '@suite-common/device'; import { asEncryptedHex } from '@suite-common/platform-encryption'; import { SuiteSyncOwnerSerialized } from '@suite-common/suite-sync-storage'; import { mockSuiteDevice } from '@suite-common/suite-types/mocks'; -import { deviceActions } from '@suite-common/wallet-core'; import { StaticSessionId } from '@trezor/connect'; import { initialSuiteSyncState, suiteSyncReducer } from '../suiteSyncSlice'; diff --git a/suite-common/suite-sync/src/tests/suiteSyncUtils.test.ts b/suite-common/suite-sync/src/tests/suiteSyncUtils.test.ts index dc72090467..2bea7e1812 100644 --- a/suite-common/suite-sync/src/tests/suiteSyncUtils.test.ts +++ b/suite-common/suite-sync/src/tests/suiteSyncUtils.test.ts @@ -1,5 +1,5 @@ +import { portfolioTrackerDevice } from '@suite-common/device'; import { mockSuiteDevice } from '@suite-common/suite-types/mocks'; -import { portfolioTrackerDevice } from '@suite-common/wallet-core'; import { SuiteSyncInteraction } from '../suiteSyncTypes'; import { diff --git a/suite-common/suite-sync/tsconfig.json b/suite-common/suite-sync/tsconfig.json index d8e919dd7c..7459353e3c 100644 --- a/suite-common/suite-sync/tsconfig.json +++ b/suite-common/suite-sync/tsconfig.json @@ -10,6 +10,7 @@ "path": "../delegated-identity-key-types" }, { "path": "../dependency-injection" }, + { "path": "../device" }, { "path": "../metadata-types" }, { "path": "../platform-encryption" }, { "path": "../redux-utils" }, diff --git a/suite-common/suite-types/src/device.ts b/suite-common/suite-types/src/device.ts index 288f0fdeb6..7b4850982b 100644 --- a/suite-common/suite-types/src/device.ts +++ b/suite-common/suite-types/src/device.ts @@ -120,3 +120,20 @@ type ConnectAuthenticateDeviceResultPayload = AuthenticateDeviceResult | Unsucce export type StoredAuthenticateDeviceResult = | (ConnectAuthenticateDeviceResultPayload & { valid: boolean }) | undefined; + +/** + * This whole file is intended as a helper for wrapping connect errors to abstract them for use + * in the Suite. + * + * It would be great if Connect incorporates some of this abstraction so we can get rid of this. + */ + +/** + * Error when user cancels the operation on the Device. + */ +export type DeviceCancelledErrType = { type: 'DeviceCancelled' }; + +/** + * This is (generic) delegated error from the Device (from Firmware/Connect). + */ +export type DeviceErrorType = { type: 'DeviceError'; message: string }; diff --git a/suite-common/trading/package.json b/suite-common/trading/package.json index 7bdc2a519b..14c6f727e2 100644 --- a/suite-common/trading/package.json +++ b/suite-common/trading/package.json @@ -13,6 +13,7 @@ }, "dependencies": { "@reduxjs/toolkit": "2.11.2", + "@suite-common/device": "workspace:*", "@suite-common/geolocation": "workspace:*", "@suite-common/redux-utils": "workspace:*", "@suite-common/suite-types": "workspace:*", diff --git a/suite-common/trading/src/selectors/tradingSelectors.ts b/suite-common/trading/src/selectors/tradingSelectors.ts index 3145e759f8..821664e7ba 100644 --- a/suite-common/trading/src/selectors/tradingSelectors.ts +++ b/suite-common/trading/src/selectors/tradingSelectors.ts @@ -1,13 +1,12 @@ import { Coins, CryptoId, FiatCurrencyCode, Platforms } from 'invity-api'; +import { type DeviceRootState, selectDeviceUnavailableCapabilities } from '@suite-common/device'; import { createWeakMapSelector, returnStableArrayIfEmpty } from '@suite-common/redux-utils'; import { NetworkSymbolExtended, NetworkType } from '@suite-common/wallet-config'; import { type AccountsRootState, - type DeviceRootState, selectAccounts, selectDeviceAccounts, - selectDeviceUnavailableCapabilities, } from '@suite-common/wallet-core'; import { Account, SelectedAccountStatus } from '@suite-common/wallet-types'; import addressValidator from '@trezor/address-validator'; diff --git a/suite-common/trading/src/thunks/common/__tests__/getNonce.test.ts b/suite-common/trading/src/thunks/common/__tests__/getNonce.test.ts index e5e7f6defd..a8bf5a2610 100644 --- a/suite-common/trading/src/thunks/common/__tests__/getNonce.test.ts +++ b/suite-common/trading/src/thunks/common/__tests__/getNonce.test.ts @@ -1,7 +1,7 @@ import { combineReducers } from '@reduxjs/toolkit'; +import { selectSelectedDevice } from '@suite-common/device'; import { configureMockStore, extraDependenciesCommonMock } from '@suite-common/test-utils'; -import { selectSelectedDevice } from '@suite-common/wallet-core'; import TrezorConnect from '@trezor/connect'; import { initialState } from '../../../reducers/tradingCommonReducer'; @@ -10,8 +10,8 @@ import { getNonce } from '../getNonce'; const tradingReducer = prepareTradingReducer(extraDependenciesCommonMock); -jest.mock('@suite-common/wallet-core', () => ({ - ...jest.requireActual('@suite-common/wallet-core'), +jest.mock('@suite-common/device', () => ({ + ...jest.requireActual('@suite-common/device'), selectSelectedDevice: jest.fn(), })); diff --git a/suite-common/trading/src/thunks/common/__tests__/recomposeAndSignTxThunk.test.ts b/suite-common/trading/src/thunks/common/__tests__/recomposeAndSignTxThunk.test.ts index 73a873688b..32e9dccdf0 100644 --- a/suite-common/trading/src/thunks/common/__tests__/recomposeAndSignTxThunk.test.ts +++ b/suite-common/trading/src/thunks/common/__tests__/recomposeAndSignTxThunk.test.ts @@ -1,14 +1,11 @@ import { combineReducers, createReducer } from '@reduxjs/toolkit'; +import { DeviceReducerState, prepareDeviceReducer } from '@suite-common/device'; import { createThunk } from '@suite-common/redux-utils'; import { TrezorDevice } from '@suite-common/suite-types'; import { mockSuiteDevice } from '@suite-common/suite-types/mocks'; import { configureMockStore, extraDependenciesCommonMock } from '@suite-common/test-utils'; -import { - DeviceReducerState, - composeSendFormTransactionFeeLevelsThunk, - prepareDeviceReducer, -} from '@suite-common/wallet-core'; +import { composeSendFormTransactionFeeLevelsThunk } from '@suite-common/wallet-core'; import { Account, FeesState } from '@suite-common/wallet-types'; import { TokenInfo } from '@trezor/connect'; diff --git a/suite-common/trading/src/thunks/common/__tests__/verifyAddressThunk.test.ts b/suite-common/trading/src/thunks/common/__tests__/verifyAddressThunk.test.ts index a969c93397..0fc6a8e32f 100644 --- a/suite-common/trading/src/thunks/common/__tests__/verifyAddressThunk.test.ts +++ b/suite-common/trading/src/thunks/common/__tests__/verifyAddressThunk.test.ts @@ -1,8 +1,9 @@ import { combineReducers } from '@reduxjs/toolkit'; +import { selectSelectedDevice } from '@suite-common/device'; import { createReducerWithExtraDeps, createThunk } from '@suite-common/redux-utils'; import { configureMockStore, extraDependenciesCommonMock } from '@suite-common/test-utils'; -import { confirmAddressOnDeviceThunk, selectSelectedDevice } from '@suite-common/wallet-core'; +import { confirmAddressOnDeviceThunk } from '@suite-common/wallet-core'; import { Account, AddressDisplayOptions } from '@suite-common/wallet-types'; import { tradingThunks } from '../'; @@ -21,9 +22,13 @@ const mockedSuiteReducer = createReducerWithExtraDeps( () => {}, ); +jest.mock('@suite-common/device', () => ({ + ...jest.requireActual('@suite-common/device'), + selectSelectedDevice: jest.fn(), +})); + jest.mock('@suite-common/wallet-core', () => ({ confirmAddressOnDeviceThunk: jest.fn(), - selectSelectedDevice: jest.fn(), selectAccounts: jest.fn(), })); diff --git a/suite-common/trading/src/thunks/common/getNonce.ts b/suite-common/trading/src/thunks/common/getNonce.ts index 8e8d737390..f11f8d6279 100644 --- a/suite-common/trading/src/thunks/common/getNonce.ts +++ b/suite-common/trading/src/thunks/common/getNonce.ts @@ -1,5 +1,5 @@ +import { selectSelectedDevice } from '@suite-common/device'; import { createThunk } from '@suite-common/redux-utils'; -import { selectSelectedDevice } from '@suite-common/wallet-core'; import TrezorConnect from '@trezor/connect'; import { TRADING_THUNK_PREFIX } from '../../constants'; diff --git a/suite-common/trading/src/thunks/common/recomposeAndSignTxThunk.ts b/suite-common/trading/src/thunks/common/recomposeAndSignTxThunk.ts index ec34c56844..fce0af207c 100644 --- a/suite-common/trading/src/thunks/common/recomposeAndSignTxThunk.ts +++ b/suite-common/trading/src/thunks/common/recomposeAndSignTxThunk.ts @@ -1,17 +1,16 @@ import { isRejectedWithValue } from '@reduxjs/toolkit'; +import { isApprovalFlowSupported, selectSelectedDevice } from '@suite-common/device'; import { createThunk } from '@suite-common/redux-utils'; import { getNetwork } from '@suite-common/wallet-config'; import { DEFAULT_PAYMENT, DEFAULT_VALUES } from '@suite-common/wallet-constants'; import { composeSendFormTransactionFeeLevelsThunk, selectConvertedNetworkFeeInfo, - selectSelectedDevice, } from '@suite-common/wallet-core'; import { Account, FormOptions, FormState, FormStateTrading } from '@suite-common/wallet-types'; import { asAmountSubunit, - isApprovalFlowSupported, isEvmApprovalTx, isExchangeTradingForm, subunitsToUnits, diff --git a/suite-common/trading/src/thunks/common/verifyAddressThunk.ts b/suite-common/trading/src/thunks/common/verifyAddressThunk.ts index bc87a3b166..96154e139a 100644 --- a/suite-common/trading/src/thunks/common/verifyAddressThunk.ts +++ b/suite-common/trading/src/thunks/common/verifyAddressThunk.ts @@ -1,5 +1,6 @@ +import { selectSelectedDevice } from '@suite-common/device'; import { createThunk } from '@suite-common/redux-utils'; -import { confirmAddressOnDeviceThunk, selectSelectedDevice } from '@suite-common/wallet-core'; +import { confirmAddressOnDeviceThunk } from '@suite-common/wallet-core'; import { Account, AddressDisplayOptions } from '@suite-common/wallet-types'; import { logErrorThunk } from './logErrorThunk'; diff --git a/suite-common/trading/tsconfig.json b/suite-common/trading/tsconfig.json index a399d3554b..a0c8a16e93 100644 --- a/suite-common/trading/tsconfig.json +++ b/suite-common/trading/tsconfig.json @@ -2,6 +2,7 @@ "extends": "../../tsconfig.base.json", "compilerOptions": { "outDir": "libDev" }, "references": [ + { "path": "../device" }, { "path": "../geolocation" }, { "path": "../redux-utils" }, { "path": "../suite-types" }, diff --git a/suite-common/wallet-core/.depcheckrc.json b/suite-common/wallet-core/.depcheckrc.json deleted file mode 100644 index c9597cb6a9..0000000000 --- a/suite-common/wallet-core/.depcheckrc.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "ignore-patterns": ["libDev", "lib"], - "ignores": [ - "// Todo: This need so be solved. See: https://github.com/trezor/trezor-suite/issues/21553", - "@suite-common/firmware" - ] -} diff --git a/suite-common/wallet-core/package.json b/suite-common/wallet-core/package.json index 794e13607d..185225f2a8 100644 --- a/suite-common/wallet-core/package.json +++ b/suite-common/wallet-core/package.json @@ -15,8 +15,9 @@ "@reduxjs/toolkit": "2.11.2", "@suite-common/analytics": "workspace:*", "@suite-common/bluetooth": "workspace:*", + "@suite-common/device": "workspace:*", "@suite-common/fiat-services": "workspace:*", - "@suite-common/platform-encryption": "workspace:*", + "@suite-common/firmware": "workspace:*", "@suite-common/redux-utils": "workspace:*", "@suite-common/staking": "workspace:*", "@suite-common/suite-constants": "workspace:*", diff --git a/suite-common/wallet-core/src/accounts/accountsReducer.ts b/suite-common/wallet-core/src/accounts/accountsReducer.ts index 443bf11c9f..fbbe714d79 100644 --- a/suite-common/wallet-core/src/accounts/accountsReducer.ts +++ b/suite-common/wallet-core/src/accounts/accountsReducer.ts @@ -1,12 +1,12 @@ import { isAnyOf } from '@reduxjs/toolkit'; +import { deviceActions } from '@suite-common/device'; import { createReducerWithExtraDeps } from '@suite-common/redux-utils'; import { networks } from '@suite-common/wallet-config'; import { Account } from '@suite-common/wallet-types'; import { accountEqualTo, enhanceHistory } from '@suite-common/wallet-utils'; import { accountsActions } from './accountsActions'; -import { deviceActions } from '../device/deviceActions'; export type AccountsState = Account[]; diff --git a/suite-common/wallet-core/src/accounts/accountsSelectors.ts b/suite-common/wallet-core/src/accounts/accountsSelectors.ts index fdd31010ea..994523e5bf 100644 --- a/suite-common/wallet-core/src/accounts/accountsSelectors.ts +++ b/suite-common/wallet-core/src/accounts/accountsSelectors.ts @@ -1,5 +1,6 @@ import { A, F, G, pipe } from '@mobily/ts-belt'; +import { DeviceRootState, selectSelectedDevice } from '@suite-common/device'; import { createWeakMapSelector, returnStableArrayIfEmpty } from '@suite-common/redux-utils'; import { type AccountType, @@ -13,8 +14,6 @@ import { DeviceState, StaticSessionId } from '@trezor/connect'; import { formattedAccountTypeMap } from './accountsConstants'; import { AccountsRootState } from './accountsReducer'; -import { DeviceRootState } from '../device/deviceReducer'; -import { selectSelectedDevice } from '../device/deviceSelectors'; const createMemoizedSelector = createWeakMapSelector.withTypes< AccountsRootState & DeviceRootState diff --git a/suite-common/wallet-core/src/accounts/accountsThunks.ts b/suite-common/wallet-core/src/accounts/accountsThunks.ts index ccf4dd56e6..325afe325d 100644 --- a/suite-common/wallet-core/src/accounts/accountsThunks.ts +++ b/suite-common/wallet-core/src/accounts/accountsThunks.ts @@ -1,3 +1,4 @@ +import { selectDevices } from '@suite-common/device'; import { createThunk } from '@suite-common/redux-utils'; import { getTxsPerPage } from '@suite-common/suite-utils'; import { notificationsActions } from '@suite-common/toast-notifications'; @@ -20,7 +21,6 @@ import { accountsActions } from './accountsActions'; import { ACCOUNTS_MODULE_PREFIX } from './accountsConstants'; import { selectAccountByKey } from './accountsSelectors'; import { selectBlockchainHeightBySymbol } from '../blockchain/blockchainReducer'; -import { selectDevices } from '../device/deviceSelectors'; import { selectBitcoinAmountUnit } from '../settings/walletSettingsReducer'; import { transactionsActions } from '../transactions/transactionsActions'; import { selectTransactions } from '../transactions/transactionsSelectors'; diff --git a/suite-common/wallet-core/src/accounts/tests/accountsSelectors.test.ts b/suite-common/wallet-core/src/accounts/tests/accountsSelectors.test.ts index c617fbf8af..6131eeb37b 100644 --- a/suite-common/wallet-core/src/accounts/tests/accountsSelectors.test.ts +++ b/suite-common/wallet-core/src/accounts/tests/accountsSelectors.test.ts @@ -1,9 +1,9 @@ +import type { DeviceRootState } from '@suite-common/device'; import { TrezorDevice } from '@suite-common/suite-types'; import { mockSuiteDevice } from '@suite-common/suite-types/mocks'; import { networks } from '@suite-common/wallet-config'; import { AccountKey, asAccountDescriptor } from '@suite-common/wallet-types'; -import { DeviceRootState } from '../../device/deviceReducer'; import { AccountsRootState } from '../accountsReducer'; import { selectAddressByNetworkAndPath, diff --git a/suite-common/wallet-core/src/blockchain/blockchainThunks.ts b/suite-common/wallet-core/src/blockchain/blockchainThunks.ts index c09a6ae20a..2c9ac9ba92 100644 --- a/suite-common/wallet-core/src/blockchain/blockchainThunks.ts +++ b/suite-common/wallet-core/src/blockchain/blockchainThunks.ts @@ -1,3 +1,4 @@ +import { selectDevices } from '@suite-common/device'; import { createThunk } from '@suite-common/redux-utils'; import { notificationsActions } from '@suite-common/toast-notifications'; import { @@ -34,7 +35,6 @@ import { BLOCKCHAIN_MODULE_PREFIX, blockchainActions } from './blockchainActions import { selectBlockchainState, selectNetworkBlockchainInfo } from './blockchainReducer'; import { selectAccounts } from '../accounts/accountsSelectors'; import { fetchAndUpdateAccountThunk } from '../accounts/accountsThunks'; -import { selectDevices } from '../device/deviceSelectors'; import { preloadFeeInfoThunk } from '../fees/feesThunks'; import { selectBitcoinAmountUnit } from '../settings/walletSettingsReducer'; diff --git a/suite-common/wallet-core/src/device/__fixtures__/forgetPersistentDataPreloadedState.ts b/suite-common/wallet-core/src/device/__fixtures__/forgetPersistentDataPreloadedState.ts index 86efaff378..b69319f8dc 100644 --- a/suite-common/wallet-core/src/device/__fixtures__/forgetPersistentDataPreloadedState.ts +++ b/suite-common/wallet-core/src/device/__fixtures__/forgetPersistentDataPreloadedState.ts @@ -1,13 +1,12 @@ import { BluetoothState, prepareInitialState } from '@suite-common/bluetooth'; import { createBluetoothDeviceCommon } from '@suite-common/bluetooth/src/support/mocks'; import { BluetoothDeviceCommon } from '@suite-common/bluetooth/src/types'; +import { DeviceReducerState, deviceInitialState } from '@suite-common/device'; import { defaultDevicePersistentData, mockSuiteDevice } from '@suite-common/suite-types/mocks'; import { ThpState, initialThpState } from '@suite-common/thp'; import { createCredential, createDeviceThp } from '@suite-common/thp/src/support/mocks'; import { asBluetoothDeviceId } from '@trezor/connect'; -import { DeviceReducerState, deviceInitialState } from '../deviceReducer'; - type ForgetPersistentDataPreloadedState = { device: DeviceReducerState; bluetooth: BluetoothState; diff --git a/suite-common/wallet-core/src/device/__tests__/deviceThunks.test.ts b/suite-common/wallet-core/src/device/__tests__/deviceThunks.test.ts index 81410882ba..670d196207 100644 --- a/suite-common/wallet-core/src/device/__tests__/deviceThunks.test.ts +++ b/suite-common/wallet-core/src/device/__tests__/deviceThunks.test.ts @@ -2,11 +2,11 @@ import { combineReducers } from '@reduxjs/toolkit'; import { prepareBluetoothReducerCreator } from '@suite-common/bluetooth'; import { BluetoothDeviceCommon } from '@suite-common/bluetooth/src/types'; +import { prepareDeviceReducer } from '@suite-common/device'; import { configureMockStore, extraDependenciesCommonMock } from '@suite-common/test-utils'; import { prepareThpReducer } from '@suite-common/thp'; import { forgetPersistentDataPreloadedStateFixture } from '../__fixtures__/forgetPersistentDataPreloadedState'; -import { prepareDeviceReducer } from '../deviceReducer'; import { forgetSingleDevicePersistentDataThunk } from '../deviceThunks'; const deviceReducer = prepareDeviceReducer(extraDependenciesCommonMock); diff --git a/suite-common/wallet-core/src/device/deviceSelectors.ts b/suite-common/wallet-core/src/device/deviceSelectors.ts index a2e0dd7a78..c476395a7d 100644 --- a/suite-common/wallet-core/src/device/deviceSelectors.ts +++ b/suite-common/wallet-core/src/device/deviceSelectors.ts @@ -1,55 +1,12 @@ -import { A, pipe } from '@mobily/ts-belt'; - +import { DeviceRootState, selectSelectedDevice } from '@suite-common/device'; import { createWeakMapSelector, returnStableArrayIfEmpty } from '@suite-common/redux-utils'; -import { - BackupType, - LANGUAGES, - Locale, - TrezorDevice, - TrezorDeviceWithState, -} from '@suite-common/suite-types'; -import { - getDeviceInstances, - getDeviceInstancesGroupedByDeviceId, - getDeviceInternalModel, - getFwUpdateVersion, - getIsDeviceConnectedAndAuthorized, - getIsDeviceConnectedViaBluetooth, - getIsDeviceInitialized, - getIsThpDevice, - getSortedDevicesWithoutInstances, - getStatus, - isDeviceAcquired, -} from '@suite-common/suite-utils'; +import { TrezorDevice } from '@suite-common/suite-types'; +import { getStatus } from '@suite-common/suite-utils'; import { networkSymbolCollection } from '@suite-common/wallet-config'; -import { isTrezorDeviceWithState } from '@suite-common/wallet-utils'; -import { Device, DeviceState, StaticSessionId } from '@trezor/connect'; -import { - DeviceModelInternal, - getFirmwareVersion, - getFirmwareVersionArray, - hasBitcoinOnlyFirmware, -} from '@trezor/device-utils'; -import { getSuiteVersion } from '@trezor/env-utils'; -import { versionUtils } from '@trezor/utils'; - -import { - DEVICE_LOW_BATTERY_PERCENTAGE_THRESHOLD, - PORTFOLIO_TRACKER_DEVICE_ID, -} from './deviceConstants'; -import { DeviceRootState } from './deviceReducer'; -import { - deviceInvariabilityCheck, - rawDataToDeviceInvariabilityCheckDTO, -} from './services/deviceInvariabilityCheck'; -import { getIsDeviceIdValid } from './services/getIsDeviceIdValid'; +import { getFirmwareVersion } from '@trezor/device-utils'; const createMemoizedSelector = createWeakMapSelector.withTypes(); -export const selectDevices = (state: DeviceRootState) => state.device?.devices; -export const selectDevicesCount = (state: DeviceRootState) => state.device?.devices?.length; -export const selectSelectedDevice = (state: DeviceRootState) => state.device.selectedDevice; - /** * @deprecated This is a HACK, and it shall be refactored. See: https://github.com/trezor/trezor-suite/issues/22022 */ @@ -73,274 +30,6 @@ export const selectSelectedFirstThpDevice = (state: DeviceRootState) => { return state.device.devices.findLast(device => device.thp?.properties !== undefined); }; -export const selectPersistentDeviceData = (state: DeviceRootState) => - state.device.persistentDeviceData; - -export const selectPersistentDeviceDataById = createMemoizedSelector( - [selectPersistentDeviceData, (_state, deviceId: TrezorDevice['id']) => deviceId], - (persistentDeviceData, deviceId) => - persistentDeviceData.find(data => data.device_id === deviceId), -); - -// Use in tests only! See deviceReducer for the property definition. -export const selectSimulatedEntropyCheckFail = (state: DeviceRootState) => - state.device.simulatedEntropyCheckFail; - -// Derived selectors -export const selectIsPendingTransportEvent = createMemoizedSelector( - [selectDevices], - devices => devices.length < 1, -); - -export const selectDeviceAutoconnectCredentials = createMemoizedSelector( - [selectSelectedDevice], - device => device?.thp?.credentials.filter(cred => cred.autoconnect) ?? [], -); - -export const selectIsDeviceUnlocked = createMemoizedSelector( - [selectSelectedDevice], - device => !!device?.features?.unlocked, -); - -export const selectDeviceType = createMemoizedSelector( - [selectSelectedDevice], - device => device?.type, -); - -export const selectDevicePath = createMemoizedSelector( - [selectSelectedDevice], - device => device?.path, -); - -export const selectDeviceFeatures = createMemoizedSelector( - [selectSelectedDevice], - device => device?.features, -); - -export const selectDeviceCapabilities = createMemoizedSelector( - [selectDeviceFeatures], - features => features?.capabilities, -); - -export const selectIsDeviceLanguageConfigurable = createMemoizedSelector( - [selectDeviceCapabilities], - capabilities => !!capabilities?.includes('Capability_Translations'), -); - -export const selectIsBluetoothSupportedByDevice = createMemoizedSelector( - [selectDeviceCapabilities], - capabilities => !!capabilities?.includes('Capability_BLE'), -); - -export const selectIsDeviceProtectedByPin = createMemoizedSelector( - [selectDeviceFeatures], - features => !!features?.pin_protection, -); - -export const selectIsDeviceProtectedByPassphrase = createMemoizedSelector( - [selectDeviceFeatures], - features => !!features?.passphrase_protection, -); - -export const selectIsDeviceProtectedByWipeCode = createMemoizedSelector( - [selectDeviceFeatures], - features => !!features?.wipe_code_protection, -); - -export const selectIsDeviceBackedUp = createMemoizedSelector( - [selectDeviceFeatures], - features => features?.backup_availability !== 'Required' && !features?.unfinished_backup, -); - -export const selectIsDeviceBackupRequired = createMemoizedSelector( - [selectDeviceFeatures], - features => features?.backup_availability === 'Required', -); - -export const selectIsDeviceBackupUnfinished = createMemoizedSelector( - [selectDeviceFeatures], - features => features?.unfinished_backup === true, -); - -export const selectDeviceLanguage = createMemoizedSelector( - [selectDeviceFeatures], - features => (features?.language as Locale) ?? null, -); - -export const selectAvailableDeviceTranslations = createMemoizedSelector( - [selectSelectedDevice], - device => device?.availableTranslations ?? {}, -); - -export const selectSupportedDeviceLanguages = createMemoizedSelector( - [selectAvailableDeviceTranslations], - availableDeviceTranslations => { - const supportedDeviceLanguages = Object.entries(LANGUAGES) - .filter(([code]) => availableDeviceTranslations[code]) - .map(([code, { icon, name }]) => ({ - value: code as Locale, - icon, - label: name, - isBeta: true, // TODO: This will need tweaking in the future. - })) - .sort((a, b) => a.label.localeCompare(b.label)); - - const { icon, name } = LANGUAGES['en-US']; - supportedDeviceLanguages.unshift({ - value: 'en-US', - icon, - label: name, - isBeta: false, - }); - - return supportedDeviceLanguages; - }, -); - -export const selectDeviceButtonRequests = createMemoizedSelector( - [selectSelectedDevice], - device => device?.buttonRequests ?? [], -); - -export const selectDeviceButtonRequestsCodes = createMemoizedSelector( - [selectDeviceButtonRequests], - buttonRequests => - pipe( - buttonRequests.map(r => r.code), - returnStableArrayIfEmpty, - ), -); - -export const selectDeviceMode = createMemoizedSelector( - [selectSelectedDevice], - device => device?.mode ?? null, -); - -export const selectIsUnacquiredDevice = createMemoizedSelector( - [selectDeviceType], - deviceType => deviceType === 'unacquired', -); - -export const selectIsDeviceInBootloader = createMemoizedSelector( - [selectDeviceMode], - mode => mode === 'bootloader', -); - -export const selectIsDeviceInitialized = createMemoizedSelector( - [selectDeviceFeatures, selectDeviceMode], - (features, mode) => getIsDeviceInitialized({ deviceMode: mode, deviceFeatures: features }), -); - -export const selectIsDeviceConnected = createMemoizedSelector( - [selectSelectedDevice], - device => !!device?.connected, -); - -export const selectIsDeviceConnectedViaBluetooth = createMemoizedSelector( - [selectSelectedDevice], - device => getIsDeviceConnectedViaBluetooth(device), -); - -export const selectIsThpDevice = createMemoizedSelector( - [selectSelectedDevice], - device => device && getIsThpDevice(device), -); - -export const selectIsDeviceConnectedViaBluetoothLowOnBattery = createMemoizedSelector( - [selectIsDeviceConnectedViaBluetooth, selectDeviceFeatures], - (isDeviceConnectedViaBluetooth, features) => { - const { usb_connected, wireless_connected, soc } = features || {}; - - // If not connected via Bluetooth, then there is no low battery. - if (!isDeviceConnectedViaBluetooth) { - return false; - } - - // If it is connected via USB or wireless charger, we assume it's charging/fine, - if (usb_connected || wireless_connected) { - return false; - } - - const isBatteryDataValid = typeof soc === 'number'; - - if (!isBatteryDataValid) { - // If we cannot read battery status, we assume the worst. - return true; - } - - return soc < DEVICE_LOW_BATTERY_PERCENTAGE_THRESHOLD; - }, -); - -export const selectDeviceBluetoothId = createMemoizedSelector( - [selectSelectedDevice], - device => device?.bluetoothProps?.id, -); - -export const selectIsConnectedDeviceUninitialized = createMemoizedSelector( - [selectSelectedDevice, selectIsDeviceInitialized], - (device, isDeviceInitialized) => device && !isDeviceInitialized, -); - -export const selectDeviceState = createMemoizedSelector( - [selectSelectedDevice], - device => device?.state, -); - -export const selectIsDeviceAuthorized = createMemoizedSelector( - [selectDeviceState], - deviceState => !!deviceState, -); - -export const selectIsDeviceConnectedAndAuthorized = createMemoizedSelector( - [selectDeviceState, selectDeviceFeatures], - (deviceState, deviceFeatures) => - getIsDeviceConnectedAndAuthorized({ deviceFeatures, deviceState }), -); - -export const selectDeviceInternalModel = createMemoizedSelector( - [selectSelectedDevice], - device => device?.features?.internal_model, -); - -// Selectors with parameters should use WeakMap memoization -export const selectDeviceByState = createMemoizedSelector( - [selectDevices, (_state, deviceState: DeviceState | undefined) => deviceState], - (devices, deviceState) => - deviceState - ? devices.find(d => d.state?.staticSessionId === deviceState.staticSessionId) - : undefined, -); - -export const selectDeviceByStaticSessionId = createMemoizedSelector( - [selectDevices, (_state, staticSessionId: StaticSessionId) => staticSessionId], - (devices, staticSessionId) => - devices.find( - (d): d is TrezorDeviceWithState => - isTrezorDeviceWithState(d) && d.state?.staticSessionId === staticSessionId, - ), -); - -export const selectDeviceUnavailableCapabilities = createMemoizedSelector( - [selectSelectedDevice], - device => device?.unavailableCapabilities, -); - -export const selectHasDevicePassphraseEntryCapability = createMemoizedSelector( - [selectDeviceCapabilities], - capabilities => !!capabilities?.includes('Capability_PassphraseEntry'), -); - -export const selectDeviceStatus = createMemoizedSelector( - [selectSelectedDevice], - device => device && getStatus(device), -); - -export const selectIsDeviceThpLocked = createMemoizedSelector( - [selectDeviceStatus], - deviceStatus => deviceStatus === 'device-thp-locked', -); - export const selectSupportedNetworkByDevice = (device: TrezorDevice | undefined) => { const firmwareVersion = getFirmwareVersion(device); const result = networkSymbolCollection.filter(symbol => { @@ -367,352 +56,3 @@ export const selectDeviceSupportedNetworks = createMemoizedSelector( [selectSelectedDevice], selectSupportedNetworkByDevice, ); - -export const selectDeviceById = createMemoizedSelector( - [state => state.device.devices, (_state, deviceId: TrezorDevice['id']) => deviceId], - (devices, deviceId) => devices.find(device => device.id === deviceId), -); - -export const selectSelectedPersistentDeviceData = createMemoizedSelector( - [selectSelectedDevice, selectPersistentDeviceData], - (device, persistentDeviceData) => persistentDeviceData.find(d => d.device_id === device?.id), -); - -export const selectDeviceAuthenticity = (state: DeviceRootState) => state.device.deviceAuthenticity; - -export const selectSelectedDeviceAuthenticity = createMemoizedSelector( - [selectSelectedDevice, selectDeviceAuthenticity], - (device, deviceAuthenticity) => (device?.id ? deviceAuthenticity?.[device.id] : undefined), -); - -export const selectIsFirmwareAuthenticityCheckDismissed = createMemoizedSelector( - [selectSelectedDevice, state => state.device.dismissedSecurityChecks?.firmwareAuthenticity], - (device, dismissedChecks) => !!(device?.id && dismissedChecks?.includes(device.id)), -); - -export const selectIsEntropyCheckFailed = createMemoizedSelector( - [selectSelectedPersistentDeviceData], - persistentDeviceData => persistentDeviceData?.lastEntropyCheckResult?.success === false, -); - -export const selectWasFwHashCheckOtherErrorLastTime = createMemoizedSelector( - [state => state.device.lastConnectedAuthenticityChecks, selectIsDeviceConnected], - (lastConnectedAuthenticityChecks, isDeviceConnected) => { - if (!isDeviceConnected) return false; - const lastHashCheck = lastConnectedAuthenticityChecks?.firmwareHash; - - return lastHashCheck && !lastHashCheck.success && lastHashCheck.error === 'other-error'; - }, -); - -export const selectIsDeviceIdCheckSuccess = createMemoizedSelector( - [selectSelectedDevice], - device => getIsDeviceIdValid(device) === true, -); - -export const selectIsDeviceInvariabilityCheckSuccess = createMemoizedSelector( - [selectSelectedDevice, selectSelectedPersistentDeviceData], - (device, previousData) => { - // just a failsafe in case memoization returned wrong results - if (device && previousData && device.id !== previousData.device_id) { - console.error('Device invariability check ID mismatch'); - - return true; - } - const dto = rawDataToDeviceInvariabilityCheckDTO({ device, previousData }); - - return deviceInvariabilityCheck(dto).success; - }, -); - -export const selectIsPortfolioTrackerDevice = createMemoizedSelector( - [selectSelectedDevice], - device => device?.id === PORTFOLIO_TRACKER_DEVICE_ID, -); - -export const selectDeviceLabel = createMemoizedSelector( - [selectSelectedDevice], - device => device?.features?.label, -); - -export const selectDeviceName = createMemoizedSelector( - [selectSelectedDevice], - device => device?.name, -); - -export const selectDeviceLabelOrNameById = createMemoizedSelector( - [state => state.device.devices, (_state, id: TrezorDevice['id']) => id], - (devices, id) => { - const device = devices.find(d => d.id === id); - - return device?.features?.label || device?.name || ''; - }, -); - -export const selectSelectedDeviceLabelOrName = createMemoizedSelector( - [selectSelectedDevice], - selectedDevice => selectedDevice?.features?.label || selectedDevice?.name || '', -); - -export const selectDeviceId = createMemoizedSelector( - [selectSelectedDevice], - selectedDevice => selectedDevice?.id ?? null, -); - -export const selectDeviceModelById = createMemoizedSelector( - [state => state.device.devices, (_state, id: TrezorDevice['id']) => id], - (devices, id) => { - const device = devices.find(d => d.id === id); - - return device?.features?.internal_model ?? null; - }, -); - -export const selectDeviceModel = createMemoizedSelector([selectSelectedDevice], selectedDevice => - selectedDevice ? getDeviceInternalModel(selectedDevice) : null, -); - -export const selectFirmwareReleaseConfig = createMemoizedSelector( - [selectSelectedDevice], - device => device?.firmwareReleaseConfigInfo ?? null, -); - -export const selectIsFirmwareUpgradable = createMemoizedSelector( - [selectFirmwareReleaseConfig], - deviceReleaseInfo => deviceReleaseInfo?.isNewer ?? false, -); - -export const selectDeviceFirmwareVersionArray = createMemoizedSelector( - [selectSelectedDevice], - device => getFirmwareVersionArray(device), -); - -// Selects all wallets of all physical devices. See `selectPhysicalDevicesGrouppedById` for grouping by the same device. -export const selectPhysicalDeviceWallets = createMemoizedSelector([selectDevices], devices => - pipe( - devices, - A.filter(device => device.id !== PORTFOLIO_TRACKER_DEVICE_ID), - returnStableArrayIfEmpty, - ), -); - -export const selectIsNoPhysicalDeviceConnected = createMemoizedSelector( - [selectPhysicalDeviceWallets], - devices => devices.every(device => !device.connected), -); - -export const selectIsAnyPhysicalDeviceConnectedViaUsb = createMemoizedSelector( - [selectPhysicalDeviceWallets], - devices => devices.some(device => device.connected && device.descriptor.apiType === 'usb'), -); - -export const selectHasOnlyPortfolioDevice = createMemoizedSelector( - [selectDevices], - devices => devices.length === 1 && devices[0].id === PORTFOLIO_TRACKER_DEVICE_ID, -); - -export const selectHasDeviceFirmwareInstalled = createMemoizedSelector( - [selectSelectedDevice], - device => !!device && device.firmware !== 'none', -); - -export const selectIsDeviceRemembered = createMemoizedSelector( - [selectSelectedDevice], - device => !!device?.remember, -); - -export const selectRememberedStandardWallets = createMemoizedSelector( - [selectPhysicalDeviceWallets], - devices => - returnStableArrayIfEmpty( - devices.filter(device => device.remember && device.useEmptyPassphrase === true), - ), -); - -export const selectRememberedStandardWalletsCount = createMemoizedSelector( - [selectRememberedStandardWallets], - wallets => wallets.length, -); - -export const selectRememberedHiddenWallets = createMemoizedSelector( - [selectPhysicalDeviceWallets], - devices => - returnStableArrayIfEmpty( - devices.filter(device => device.remember && device.useEmptyPassphrase === false), - ), -); - -export const selectRememberedHiddenWalletsCount = createMemoizedSelector( - [selectRememberedHiddenWallets], - wallets => wallets.length, -); - -export const selectIsDeviceInViewOnlyMode = createMemoizedSelector( - [selectIsDeviceConnected, selectIsDeviceRemembered], - (isDeviceConnected, isDeviceRemembered) => !isDeviceConnected && isDeviceRemembered, -); - -export const selectIsDeviceUsingPassphrase = createMemoizedSelector( - [selectIsDeviceProtectedByPassphrase, selectSelectedDevice], - (isDeviceProtectedByPassphrase, device) => { - const shouldTreatAsPassphraseProtected = (device?.instance ?? 1) > 1; - - return ( - (isDeviceProtectedByPassphrase && device?.useEmptyPassphrase === false) || - shouldTreatAsPassphraseProtected - ); - }, -); - -// Selects all physical devices wallets grouped per device -export const selectPhysicalDevicesGrouppedById = createMemoizedSelector( - [selectPhysicalDeviceWallets], - devices => returnStableArrayIfEmpty(getDeviceInstancesGroupedByDeviceId(devices)), -); - -export const selectDeviceStaticSessionId = createMemoizedSelector( - [selectSelectedDevice], - device => device?.state?.staticSessionId ?? null, -); - -export const selectDeviceInstances = createMemoizedSelector( - [selectSelectedDevice, selectDevices], - (device, allDevices) => { - if (!device) { - return []; - } - - return pipe(getDeviceInstances(device, allDevices), returnStableArrayIfEmpty); - }, -); - -export const selectNumberOfDeviceInstances = createMemoizedSelector( - [selectDeviceInstances], - deviceInstances => deviceInstances.length, -); - -export const selectInstacelessUnselectedDevices = createMemoizedSelector( - [selectSelectedDevice, selectDevices], - (device, allDevices) => - pipe(getSortedDevicesWithoutInstances(allDevices, device?.id), returnStableArrayIfEmpty), -); - -export const selectHasBitcoinOnlyFirmware = createMemoizedSelector([selectSelectedDevice], device => - hasBitcoinOnlyFirmware(device), -); - -export const selectShouldOfferUpdateFirmware = createMemoizedSelector( - [selectFirmwareReleaseConfig], - firmwareReleaseConfig => { - if (!firmwareReleaseConfig) return false; - const { releaseConditions } = firmwareReleaseConfig; - const { environment } = releaseConditions; - const isValidSuiteNativeVersion = environment?.min_suite_native_version - ? versionUtils.isNewerOrEqual(getSuiteVersion(), environment?.min_suite_native_version) - : false; - - return ( - firmwareReleaseConfig?.isNewer && - isValidSuiteNativeVersion && - releaseConditions.shouldBeOffered - ); - }, -); - -export const selectDeviceUpdateFirmwareVersion = (state: DeviceRootState) => { - const device = selectSelectedDevice(state); - - return device ? getFwUpdateVersion(device) : null; -}; - -export const selectFirmwareChangelog = (state: DeviceRootState) => { - const device = selectSelectedDevice(state); - const isBitcoinOnlyFirmware = selectHasBitcoinOnlyFirmware(state); - - if (isBitcoinOnlyFirmware) { - return device?.firmwareReleaseConfigInfo?.release.changelog; - } - - return device?.firmwareReleaseConfigInfo?.release.changelog; -}; - -export const selectDeviceUnitPackaging = createMemoizedSelector( - [selectDeviceFeatures], - features => features?.unit_packaging ?? 0, -); - -const defaultBackupTypeMap: Record = { - [DeviceModelInternal.UNKNOWN]: '12-words', // just to have something - [DeviceModelInternal.T1B1]: '24-words', - [DeviceModelInternal.T2T1]: '12-words', - [DeviceModelInternal.T2B1]: 'shamir-single', - [DeviceModelInternal.T3B1]: 'shamir-single', - [DeviceModelInternal.T3T1]: 'shamir-single', - [DeviceModelInternal.T3W1]: 'shamir-single', -}; - -export const selectDeviceDefaultBackupType = createMemoizedSelector( - [selectDeviceModel, selectDeviceUnitPackaging], - (deviceModel, deviceUnitPackaging) => { - // Original package of Trezor Safe 3 has a card with just 12 words. - if (deviceModel === DeviceModelInternal.T2B1 && deviceUnitPackaging === 0) { - return '12-words'; - } - - return deviceModel ? defaultBackupTypeMap[deviceModel] : 'shamir-single'; - }, -); - -export const selectIsSameOrNewDevice = createMemoizedSelector( - [selectSelectedDevice, (_state, device: Device | TrezorDevice | undefined) => device], - (selectedDevice, device) => selectedDevice === undefined || device?.id === selectedDevice.id, -); - -/** - * Get firmware revision check error, or null if check was successful / skipped. - */ -export const selectFirmwareRevisionCheckError = (state: DeviceRootState) => { - const device = selectSelectedDevice(state); - if (!isDeviceAcquired(device) || !device.authenticityChecks) return null; - const checkResult = device.authenticityChecks.firmwareRevision; - - // null means not performed, then don't consider it failed - if (!checkResult || checkResult.success) return null; - - return checkResult.error; -}; - -/** - * Get firmware hash check error, or null if check was successful / skipped. - */ -export const selectFirmwareHashCheckError = (state: DeviceRootState) => { - const device = selectSelectedDevice(state); - if (!isDeviceAcquired(device) || !device.authenticityChecks) return null; - const checkResult = device.authenticityChecks.firmwareHash; - - // null means not performed, then don't consider it failed - if (!checkResult || checkResult.success) return null; - - return checkResult.error; -}; - -export const selectIsDevicePinLocked = createMemoizedSelector( - [selectSelectedDevice], - selectedDevice => selectedDevice && getStatus(selectedDevice) === 'device-pin-locked', -); - -export const selectAllDeviceStaticIds = createMemoizedSelector([selectDevices], devices => - devices.reduce((acc, it) => { - if (it.state?.staticSessionId !== undefined) { - acc.push(it.state?.staticSessionId); - } - - return acc; - }, []), -); - -export const selectDeviceDelegatedIdentityKey = createMemoizedSelector( - [selectPersistentDeviceData, (_state, deviceId: string) => deviceId], - (persistentDeviceData, deviceId) => - persistentDeviceData.find(d => d.device_id === deviceId)?.delegatedIdentityKey ?? null, -); diff --git a/suite-common/wallet-core/src/device/deviceThunks.ts b/suite-common/wallet-core/src/device/deviceThunks.ts index 8c22af4bc5..a9bb3e7c92 100644 --- a/suite-common/wallet-core/src/device/deviceThunks.ts +++ b/suite-common/wallet-core/src/device/deviceThunks.ts @@ -1,4 +1,18 @@ import { bluetoothActions } from '@suite-common/bluetooth'; +import { + DEVICE_MODULE_PREFIX, + PORTFOLIO_TRACKER_DEVICE_ID, + deviceActions, + getIsIgnoredEntropyCheckError, + portfolioTrackerDevice, + selectDeviceById, + selectDevices, + selectPersistentDeviceDataById, + selectPhysicalDeviceWallets, + selectSelectedDevice, + shouldDeviceBeRemembered, + sortDevices, +} from '@suite-common/device'; import { selectIsFirmwareInstallationRunning } from '@suite-common/firmware/src/firmwareReducer'; import { createThunk } from '@suite-common/redux-utils'; import { AcquiredDevice, TrezorDevice } from '@suite-common/suite-types'; @@ -19,7 +33,6 @@ import { getNetworkId, getProtocolMagic, getStakingPath, - shouldDeviceBeRemembered, } from '@suite-common/wallet-utils'; import TrezorConnect, { Address, @@ -34,22 +47,11 @@ import { getEnvironment } from '@trezor/env-utils'; import { exhaustive } from '@trezor/type-utils'; import { isChanged } from '@trezor/utils'; -import { DEVICE_MODULE_PREFIX, deviceActions } from './deviceActions'; -import { PORTFOLIO_TRACKER_DEVICE_ID, portfolioTrackerDevice } from './deviceConstants'; -import { - selectDeviceById, - selectDevices, - selectPersistentDeviceDataById, - selectPhysicalDeviceWallets, - selectSelectedDevice, -} from './deviceSelectors'; -import { sortDevices } from './sortDevices'; import { selectAccountByKey } from '../accounts/accountsSelectors'; import { startDiscoveryThunk } from '../discovery/discoveryThunks'; import { selectDeviceThunk, selectNewlyConnectedDeviceThunk } from '../discovery/selectDeviceThunk'; import { setAutoEjectEnabled } from '../settings/walletSettingsActions'; import { selectIsDeviceAutoEjectEnabled } from '../settings/walletSettingsReducer'; -import { getIsIgnoredEntropyCheckError } from './services/getIsIgnoredEntropyCheckError'; /** * Triggered by `@trezor/connect DEVICE_EVENT` diff --git a/suite-common/wallet-core/src/device/deviceUtils.ts b/suite-common/wallet-core/src/device/deviceUtils.ts deleted file mode 100644 index ba51d2ad6f..0000000000 --- a/suite-common/wallet-core/src/device/deviceUtils.ts +++ /dev/null @@ -1,13 +0,0 @@ -import type { DeviceCancelledErrType, DeviceErrorType } from '@suite-common/wallet-types'; - -export const DeviceCancelledErr = (): DeviceCancelledErrType => ({ - type: 'DeviceCancelled' as const, -}); - -export const isCanceledErrorMessage = (errorMessage: string | null | undefined) => - Boolean(errorMessage?.toLocaleLowerCase().includes('cancelled')); - -export const DeviceError = (message: string): DeviceErrorType => ({ - type: 'DeviceError' as const, - message, -}); diff --git a/suite-common/wallet-core/src/device/preparePushNotificationMiddleware.ts b/suite-common/wallet-core/src/device/preparePushNotificationMiddleware.ts index 9ce2edb11f..f21acb8c1d 100644 --- a/suite-common/wallet-core/src/device/preparePushNotificationMiddleware.ts +++ b/suite-common/wallet-core/src/device/preparePushNotificationMiddleware.ts @@ -1,7 +1,7 @@ +import { deviceActions } from '@suite-common/device'; import { createMiddlewareWithExtraDeps } from '@suite-common/redux-utils'; import { TrezorPushNotificationType } from '@trezor/connect'; -import { deviceActions } from './deviceActions'; import { deviceWipedFromDeviceThunk } from './deviceThunks'; // We need extra.thunks.forgetBluetoothDevice in forgetSingleDevicePersistentDataThunk. diff --git a/suite-common/wallet-core/src/discovery/discoverySelectors.ts b/suite-common/wallet-core/src/discovery/discoverySelectors.ts index 53899dcf61..876cfd8856 100644 --- a/suite-common/wallet-core/src/discovery/discoverySelectors.ts +++ b/suite-common/wallet-core/src/discovery/discoverySelectors.ts @@ -1,9 +1,8 @@ +import { DeviceRootState, selectSelectedDevice } from '@suite-common/device'; import { DiscoveryStatus } from '@suite-common/wallet-types'; import { DeviceUniquePath } from '@trezor/connect'; import { DiscoveryRootState } from './discoveryReducer'; -import { DeviceRootState } from '../device/deviceReducer'; -import { selectSelectedDevice } from '../device/deviceSelectors'; export const selectDiscoveryByDevicePath = (state: DiscoveryRootState, path?: DeviceUniquePath) => path !== undefined ? state.wallet.discovery[path] : undefined; diff --git a/suite-common/wallet-core/src/discovery/discoveryThunks.ts b/suite-common/wallet-core/src/discovery/discoveryThunks.ts index 308ddb6be7..9a50380152 100644 --- a/suite-common/wallet-core/src/discovery/discoveryThunks.ts +++ b/suite-common/wallet-core/src/discovery/discoveryThunks.ts @@ -1,6 +1,12 @@ import { ThunkDispatch } from '@reduxjs/toolkit'; import { events } from '@suite-common/analytics'; +import { + deviceActions, + selectDeviceByStaticSessionId, + selectDevices, + selectSelectedDevice, +} from '@suite-common/device'; import { AnyAction, ExtraDependencies, @@ -39,16 +45,10 @@ import { BigNumber } from '@trezor/utils/src/bigNumber'; import { DISCOVERY_MODULE_PREFIX, discoveryActions } from './discoveryActions'; import { isDiscoveryInProgress, selectDiscoveryByDevicePath } from './discoverySelectors'; +import { selectDeviceThunk } from './selectDeviceThunk'; import { CreateAccountActionProps, accountsActions } from '../accounts/accountsActions'; import { selectAccountsByDeviceState } from '../accounts/accountsSelectors'; -import { deviceActions } from '../device/deviceActions'; -import { - selectDeviceByStaticSessionId, - selectDevices, - selectSelectedDevice, -} from '../device/deviceSelectors'; import { selectAccountsToBeForgotten, selectDiscoveryAccountsParam } from '../selectors'; -import { selectDeviceThunk } from './selectDeviceThunk'; import { selectIsDeviceAutoEjectEnabled } from '../settings/walletSettingsReducer'; const USER_UI_CANCEL_CODE = 'USER_UI_CANCEL'; diff --git a/suite-common/wallet-core/src/discovery/selectDeviceThunk.ts b/suite-common/wallet-core/src/discovery/selectDeviceThunk.ts index c75b187a0e..79913b7050 100644 --- a/suite-common/wallet-core/src/discovery/selectDeviceThunk.ts +++ b/suite-common/wallet-core/src/discovery/selectDeviceThunk.ts @@ -1,12 +1,15 @@ +import { + DEVICE_MODULE_PREFIX, + deviceActions, + selectDevices, + selectIsSameOrNewDevice, +} from '@suite-common/device'; import { createThunk } from '@suite-common/redux-utils'; import { TrezorDevice } from '@suite-common/suite-types'; import { getSelectedDevice, sortByTimestamp } from '@suite-common/suite-utils'; import { Device } from '@trezor/connect'; import { isNative } from '@trezor/env-utils'; -import { DEVICE_MODULE_PREFIX, deviceActions } from '../device/deviceActions'; -import { selectDevices, selectIsSameOrNewDevice } from '../device/deviceSelectors'; - type SelectDeviceThunkParams = { device: Device | TrezorDevice | undefined; }; diff --git a/suite-common/wallet-core/src/fees/feesThunks.ts b/suite-common/wallet-core/src/fees/feesThunks.ts index dfe6f57235..b2834e57fe 100644 --- a/suite-common/wallet-core/src/fees/feesThunks.ts +++ b/suite-common/wallet-core/src/fees/feesThunks.ts @@ -1,3 +1,4 @@ +import { selectSelectedDevice } from '@suite-common/device'; import { createThunk } from '@suite-common/redux-utils'; import { NetworkSymbol, getNetwork, networksCollection } from '@suite-common/wallet-config'; import { FeeInfo, FeesState } from '@suite-common/wallet-types'; @@ -6,7 +7,6 @@ import TrezorConnect from '@trezor/connect'; import { FEES_MODULE_PREFIX, feesActions } from './feesActions'; import { getNewFeeInfo, sortLevels } from './feesUtils'; import { selectNetworkBlockchainInfo } from '../blockchain/blockchainReducer'; -import { selectSelectedDevice } from '../device/deviceSelectors'; import { selectEnabledNetworks } from '../settings/walletSettingsReducer'; // Conditionally subscribe to blockchain backend diff --git a/suite-common/wallet-core/src/index.ts b/suite-common/wallet-core/src/index.ts index c9bfe2d953..1f6e2a981e 100644 --- a/suite-common/wallet-core/src/index.ts +++ b/suite-common/wallet-core/src/index.ts @@ -12,15 +12,10 @@ export * from './blockchain/blockchainMiddleware'; export * from './blockchain/blockchainReducer'; export * from './blockchain/blockchainSelectors'; export * from './blockchain/blockchainThunks'; -export * from './device/deviceActions'; -export * from './device/deviceConstants'; -export * from './device/deviceReducer'; export * from './device/deviceSelectors'; export * from './device/deviceThunks'; -export * from './device/deviceUtils'; export * from './device/preparePushNotificationMiddleware'; export * from './device/publicKeyActions'; -export * from './device/usePinHook'; export * from './discovery/discoveryActions'; export * from './discovery/discoveryReducer'; export * from './discovery/discoverySelectors'; @@ -65,8 +60,5 @@ export * from './transactions/transactionsActions'; export * from './transactions/transactionsReducer'; export * from './transactions/transactionsSelectors'; export * from './transactions/transactionsThunks'; -export { getIsIgnoredEntropyCheckError } from './device/services/getIsIgnoredEntropyCheckError'; -export { getIsDeviceIdValid } from './device/services/getIsDeviceIdValid'; -export { deviceInvariabilityCheck } from './device/services/deviceInvariabilityCheck'; export * from './transactions/target/createTargets'; export * from './transactions/target/Target'; diff --git a/suite-common/wallet-core/src/selectors.ts b/suite-common/wallet-core/src/selectors.ts index 24de2a084c..9e280458c7 100644 --- a/suite-common/wallet-core/src/selectors.ts +++ b/suite-common/wallet-core/src/selectors.ts @@ -1,3 +1,8 @@ +import { + DeviceRootState, + selectHasOnlyPortfolioDevice, + selectSelectedDevice, +} from '@suite-common/device'; import { createWeakMapSelector, returnStableArrayIfEmpty } from '@suite-common/redux-utils'; import { TrezorDevice } from '@suite-common/suite-types'; import { NetworkSymbol, networks, networksCollection } from '@suite-common/wallet-config'; @@ -19,12 +24,7 @@ import { selectIsDeviceAccountless, selectVisibleDeviceAccounts, } from './accounts/accountsSelectors'; -import { DeviceRootState } from './device/deviceReducer'; -import { - selectHasOnlyPortfolioDevice, - selectSelectedDevice, - selectSupportedNetworkByDevice, -} from './device/deviceSelectors'; +import { selectSupportedNetworkByDevice } from './device/deviceSelectors'; import { DiscoveryRootState } from './discovery/discoveryReducer'; import { selectHasRunningDiscovery } from './discovery/discoverySelectors'; import { WalletSettingsRootState, selectEnabledNetworks } from './settings/walletSettingsReducer'; diff --git a/suite-common/wallet-core/src/send/sendFormBitcoinThunks.ts b/suite-common/wallet-core/src/send/sendFormBitcoinThunks.ts index 2277ec617a..11aff2f4ea 100644 --- a/suite-common/wallet-core/src/send/sendFormBitcoinThunks.ts +++ b/suite-common/wallet-core/src/send/sendFormBitcoinThunks.ts @@ -1,3 +1,4 @@ +import { selectSelectedDevice } from '@suite-common/device'; import { createThunk } from '@suite-common/redux-utils'; import { BITCOIN_ONLY_SYMBOLS, BitcoinOnlySymbolsItemType } from '@suite-common/suite-constants'; import { notificationsActions } from '@suite-common/toast-notifications'; @@ -34,7 +35,6 @@ import { SignTransactionError, SignTransactionThunkArguments, } from './sendFormTypes'; -import { selectSelectedDevice } from '../device/deviceSelectors'; import { selectAreSatsAmountUnit, selectBitcoinAmountUnit, diff --git a/suite-common/wallet-core/src/send/sendFormEthereumThunks.ts b/suite-common/wallet-core/src/send/sendFormEthereumThunks.ts index d57ca51190..2389ed706a 100644 --- a/suite-common/wallet-core/src/send/sendFormEthereumThunks.ts +++ b/suite-common/wallet-core/src/send/sendFormEthereumThunks.ts @@ -1,5 +1,6 @@ import { fromWei, toWei } from 'web3-utils'; +import { isApprovalFlowSupported, selectSelectedDevice } from '@suite-common/device'; import { createThunk } from '@suite-common/redux-utils'; import { notificationsActions } from '@suite-common/toast-notifications'; import { getNetwork, getNetworkDisplaySymbol } from '@suite-common/wallet-config'; @@ -31,7 +32,6 @@ import { getEthereumEstimateFeeParams, getExternalComposeOutput, getTxStakeNameByDataHex, - isApprovalFlowSupported, isEvmApprovalTx, isPending, isSentTransaction, @@ -49,7 +49,6 @@ import { SignTransactionError, SignTransactionThunkArguments, } from './sendFormTypes'; -import { selectSelectedDevice } from '../device/deviceSelectors'; import { selectTransactions } from '../transactions/transactionsSelectors'; export const calculate = ( diff --git a/suite-common/wallet-core/src/send/sendFormSelectors.ts b/suite-common/wallet-core/src/send/sendFormSelectors.ts index 549a802efe..6e6b36dc4f 100644 --- a/suite-common/wallet-core/src/send/sendFormSelectors.ts +++ b/suite-common/wallet-core/src/send/sendFormSelectors.ts @@ -1,12 +1,11 @@ import { G } from '@mobily/ts-belt'; +import { DeviceRootState, selectDeviceButtonRequestsCodes } from '@suite-common/device'; import { type NetworkSymbol, getNetworkType } from '@suite-common/wallet-config'; import { AccountKey, FormState, Output, TokenAddress } from '@suite-common/wallet-types'; import { getSendFormDraftKey } from '@suite-common/wallet-utils'; import { SendRootState } from './sendFormReducer'; -import { DeviceRootState } from '../device/deviceReducer'; -import { selectDeviceButtonRequestsCodes } from '../device/deviceSelectors'; export const selectSendPrecomposedTx = (state: SendRootState) => state.wallet.send.precomposedTx; export const selectSendSerializedTx = (state: SendRootState) => state.wallet.send.serializedTx; diff --git a/suite-common/wallet-core/src/send/sendFormThunks.ts b/suite-common/wallet-core/src/send/sendFormThunks.ts index b22c4f0621..01890b944d 100644 --- a/suite-common/wallet-core/src/send/sendFormThunks.ts +++ b/suite-common/wallet-core/src/send/sendFormThunks.ts @@ -1,6 +1,7 @@ import { G } from '@mobily/ts-belt'; import { isRejected } from '@reduxjs/toolkit'; +import { selectSelectedDevice } from '@suite-common/device'; import { ActionsFromAsyncThunk, createThunk } from '@suite-common/redux-utils'; import { UINT256_MAX } from '@suite-common/suite-constants'; import { notificationsActions } from '@suite-common/toast-notifications'; @@ -78,7 +79,6 @@ import { import { accountsActions } from '../accounts/accountsActions'; import { selectAccountByKey } from '../accounts/accountsSelectors'; import { syncAccountsWithBlockchainThunk } from '../blockchain/blockchainThunks'; -import { selectSelectedDevice } from '../device/deviceSelectors'; import { selectAreSatsAmountUnit, selectBitcoinAmountUnit, diff --git a/suite-common/wallet-core/src/stake/stakeThunks.ts b/suite-common/wallet-core/src/stake/stakeThunks.ts index 137bb91a3f..6fddaf9c73 100644 --- a/suite-common/wallet-core/src/stake/stakeThunks.ts +++ b/suite-common/wallet-core/src/stake/stakeThunks.ts @@ -1,3 +1,4 @@ +import { selectHasBitcoinOnlyFirmware } from '@suite-common/device'; import { createThunk } from '@suite-common/redux-utils'; import { NetworkSymbol } from '@suite-common/wallet-config'; import { @@ -23,7 +24,6 @@ import { EVERSTAKE_VALIDATOR, } from './stakeConstants'; import { selectEverstakeData } from './stakeSelectors'; -import { selectHasBitcoinOnlyFirmware } from '../device/deviceSelectors'; const STAKE_MODULE = '@common/wallet-core/stake'; diff --git a/suite-common/wallet-core/src/token/stellarTokenThunks.ts b/suite-common/wallet-core/src/token/stellarTokenThunks.ts index aef5a11346..e838c00b29 100644 --- a/suite-common/wallet-core/src/token/stellarTokenThunks.ts +++ b/suite-common/wallet-core/src/token/stellarTokenThunks.ts @@ -1,5 +1,6 @@ import { G } from '@mobily/ts-belt'; +import { selectSelectedDevice } from '@suite-common/device'; import { createThunk } from '@suite-common/redux-utils'; import { Account } from '@suite-common/wallet-types'; import { @@ -14,7 +15,6 @@ import { import TrezorConnect from '@trezor/connect'; import { StellarAssetType } from '@trezor/protobuf/src/messages'; -import { selectSelectedDevice } from '../device/deviceSelectors'; import { selectRawNetworkFeeInfo } from '../fees/feesReducer'; export interface TokenThunkPayload { diff --git a/suite-common/wallet-core/tsconfig.json b/suite-common/wallet-core/tsconfig.json index e4e51925b0..7adf5e653a 100644 --- a/suite-common/wallet-core/tsconfig.json +++ b/suite-common/wallet-core/tsconfig.json @@ -4,8 +4,9 @@ "references": [ { "path": "../analytics" }, { "path": "../bluetooth" }, + { "path": "../device" }, { "path": "../fiat-services" }, - { "path": "../platform-encryption" }, + { "path": "../firmware" }, { "path": "../redux-utils" }, { "path": "../staking" }, { "path": "../suite-constants" }, diff --git a/suite-common/wallet-types/src/device.ts b/suite-common/wallet-types/src/device.ts deleted file mode 100644 index c1a33e89ca..0000000000 --- a/suite-common/wallet-types/src/device.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * This whole file is intended as a helper for wrapping connect errors to abstract them for use - * in the Suite. - * - * It would be great if Connect incorporates some of this abstraction so we can get rid of this. - */ - -/** - * Error when user cancels the operation on the Device. - */ -export type DeviceCancelledErrType = { type: 'DeviceCancelled' }; - -/** - * This is (generic) delegated error from the Device (from Firmware/Connect). - */ -export type DeviceErrorType = { type: 'DeviceError'; message: string }; diff --git a/suite-common/wallet-types/src/index.ts b/suite-common/wallet-types/src/index.ts index c83ba6c13f..be1013a73e 100644 --- a/suite-common/wallet-types/src/index.ts +++ b/suite-common/wallet-types/src/index.ts @@ -16,7 +16,6 @@ export * from './send'; export * from './solanaStaking'; export * from './wallet'; export * from './globalSendReceive'; -export * from './device'; export * from './baseCurrency'; export * from './transactionSimulation'; export * from './stakeTypes'; diff --git a/suite-common/wallet-utils/src/deviceUtils.ts b/suite-common/wallet-utils/src/deviceUtils.ts index c904547849..35c1801cda 100644 --- a/suite-common/wallet-utils/src/deviceUtils.ts +++ b/suite-common/wallet-utils/src/deviceUtils.ts @@ -1,6 +1,6 @@ -import { TrezorDevice, TrezorDeviceWithState } from '@suite-common/suite-types'; +import { TrezorDevice } from '@suite-common/suite-types'; import { asWalletDescriptor } from '@suite-common/wallet-types'; -import { Device, StaticSessionId } from '@trezor/connect'; +import { StaticSessionId } from '@trezor/connect'; export const parseDeviceStaticSessionId = (deviceStaticSessionId: StaticSessionId) => { const [walletDescriptor, deviceId] = deviceStaticSessionId.split('@'); @@ -11,28 +11,6 @@ export const parseDeviceStaticSessionId = (deviceStaticSessionId: StaticSessionI }; }; -export const shouldDeviceBeRemembered = ({ - device, - isAutoEjectEnabled = false, -}: { - device: TrezorDevice | Device; - isAutoEjectEnabled?: boolean; -}) => { - if (device.mode !== 'normal') return false; - - if (device.type !== 'acquired') return false; - - return !isAutoEjectEnabled; -}; - +// local copy of import { isApprovalFlowSupported } from '@suite-common/device'; > reviewTransactionUtils export const isApprovalFlowSupported = (device: TrezorDevice | undefined) => !device?.unavailableCapabilities?.['evmApproval']; - -export const isTrezorDeviceWithState = ( - device: TrezorDevice | undefined, -): device is TrezorDeviceWithState => - device !== undefined && - device.id !== null && - device.state !== undefined && - device.state !== null && - device.state.staticSessionId !== undefined; diff --git a/suite-common/walletconnect/package.json b/suite-common/walletconnect/package.json index eaf4268bc9..1880aa68a5 100644 --- a/suite-common/walletconnect/package.json +++ b/suite-common/walletconnect/package.json @@ -14,6 +14,7 @@ "@reown/walletkit": "^1.2.8", "@suite-common/analytics": "workspace:*", "@suite-common/connect-popup": "workspace:*", + "@suite-common/device": "workspace:*", "@suite-common/mev": "workspace:*", "@suite-common/redux-utils": "workspace:*", "@suite-common/suite-utils": "workspace:*", diff --git a/suite-common/walletconnect/src/adapters/bitcoin.ts b/suite-common/walletconnect/src/adapters/bitcoin.ts index 10d9cd76d1..59889d7cc1 100644 --- a/suite-common/walletconnect/src/adapters/bitcoin.ts +++ b/suite-common/walletconnect/src/adapters/bitcoin.ts @@ -2,9 +2,10 @@ import { WalletKitTypes } from '@reown/walletkit'; import type { ProposalTypes } from '@walletconnect/types'; import * as trezorConnectPopupActions from '@suite-common/connect-popup'; +import { selectSelectedDevice } from '@suite-common/device'; import { createThunk } from '@suite-common/redux-utils'; import { Bip43Path, Network, getNetwork, networksCollection } from '@suite-common/wallet-config'; -import { selectAccounts, selectSelectedDevice } from '@suite-common/wallet-core'; +import { selectAccounts } from '@suite-common/wallet-core'; import { Account } from '@suite-common/wallet-types'; import { getAccountIdentity } from '@suite-common/wallet-utils'; import TrezorConnect, { CallMethodResponse, ComposeOutput } from '@trezor/connect'; diff --git a/suite-common/walletconnect/src/adapters/ethereum.ts b/suite-common/walletconnect/src/adapters/ethereum.ts index 5dfedb4428..e1aba54a5d 100644 --- a/suite-common/walletconnect/src/adapters/ethereum.ts +++ b/suite-common/walletconnect/src/adapters/ethereum.ts @@ -2,15 +2,12 @@ import { WalletKitTypes } from '@reown/walletkit'; import type { ProposalTypes } from '@walletconnect/types'; import * as trezorConnectPopupActions from '@suite-common/connect-popup'; +import { selectSelectedDevice } from '@suite-common/device'; import { selectIsMevProtectionFeatureEnabled } from '@suite-common/mev'; import { createThunk } from '@suite-common/redux-utils'; import { Network, getNetwork, networksCollection } from '@suite-common/wallet-config'; import { ETH_CONTRACT_CALL_BACKUP_GAS_LIMIT } from '@suite-common/wallet-constants'; -import { - selectAccounts, - selectIsMevProtectionEnabled, - selectSelectedDevice, -} from '@suite-common/wallet-core'; +import { selectAccounts, selectIsMevProtectionEnabled } from '@suite-common/wallet-core'; import { ethereumGetCurrentNonceThunk } from '@suite-common/wallet-core/src/send/sendFormEthereumThunks'; import { Account } from '@suite-common/wallet-types'; import { getAccountIdentity, getMevProtectedTxData, sanitizeHex } from '@suite-common/wallet-utils'; diff --git a/suite-common/walletconnect/src/adapters/solana.ts b/suite-common/walletconnect/src/adapters/solana.ts index 141ba4760c..c833d95021 100644 --- a/suite-common/walletconnect/src/adapters/solana.ts +++ b/suite-common/walletconnect/src/adapters/solana.ts @@ -3,9 +3,10 @@ import type { ProposalTypes } from '@walletconnect/types'; import bs58 from 'bs58'; import * as trezorConnectPopupActions from '@suite-common/connect-popup'; +import { selectSelectedDevice } from '@suite-common/device'; import { createThunk } from '@suite-common/redux-utils'; import { Network, getNetwork, networksCollection } from '@suite-common/wallet-config'; -import { selectAccounts, selectSelectedDevice } from '@suite-common/wallet-core'; +import { selectAccounts } from '@suite-common/wallet-core'; import { Account } from '@suite-common/wallet-types'; import TrezorConnect, { CallMethodResponse } from '@trezor/connect'; diff --git a/suite-common/walletconnect/tsconfig.json b/suite-common/walletconnect/tsconfig.json index ce2216e76e..c0ecf39049 100644 --- a/suite-common/walletconnect/tsconfig.json +++ b/suite-common/walletconnect/tsconfig.json @@ -5,6 +5,7 @@ "references": [ { "path": "../analytics" }, { "path": "../connect-popup" }, + { "path": "../device" }, { "path": "../mev" }, { "path": "../redux-utils" }, { "path": "../suite-utils" }, diff --git a/suite-native/accounts/package.json b/suite-native/accounts/package.json index 9cb2e620e4..44a335e531 100644 --- a/suite-native/accounts/package.json +++ b/suite-native/accounts/package.json @@ -14,6 +14,7 @@ "@mobily/ts-belt": "^3.13.1", "@react-navigation/native": "7.1.26", "@reduxjs/toolkit": "2.11.2", + "@suite-common/device": "workspace:*", "@suite-common/formatters": "workspace:*", "@suite-common/redux-utils": "workspace:*", "@suite-common/suite-sync": "workspace:*", diff --git a/suite-native/accounts/src/components/AccountsList/StakingBadge.tsx b/suite-native/accounts/src/components/AccountsList/StakingBadge.tsx index 9672c81d71..bd9a66d6d5 100644 --- a/suite-native/accounts/src/components/AccountsList/StakingBadge.tsx +++ b/suite-native/accounts/src/components/AccountsList/StakingBadge.tsx @@ -1,8 +1,9 @@ import { useMemo } from 'react'; import { useSelector } from 'react-redux'; +import type { DeviceRootState } from '@suite-common/device'; import { NetworkSymbol } from '@suite-common/wallet-config'; -import { AccountsRootState, DeviceRootState } from '@suite-common/wallet-core'; +import { AccountsRootState } from '@suite-common/wallet-core'; import { Account } from '@suite-common/wallet-types'; import { isCardanoStakedWithFiveBinaries } from '@suite-common/wallet-utils'; import { CompoundRoundedIcon } from '@suite-native/atoms'; diff --git a/suite-native/accounts/src/components/AddAccountsButton.tsx b/suite-native/accounts/src/components/AddAccountsButton.tsx index c159b33220..bece040f8a 100644 --- a/suite-native/accounts/src/components/AddAccountsButton.tsx +++ b/suite-native/accounts/src/components/AddAccountsButton.tsx @@ -2,11 +2,8 @@ import { useSelector } from 'react-redux'; import { useNavigation } from '@react-navigation/native'; -import { - selectHasRunningDiscovery, - selectIsDeviceInViewOnlyMode, - selectIsPortfolioTrackerDevice, -} from '@suite-common/wallet-core'; +import { selectIsDeviceInViewOnlyMode, selectIsPortfolioTrackerDevice } from '@suite-common/device'; +import { selectHasRunningDiscovery } from '@suite-common/wallet-core'; import { IconButton } from '@suite-native/atoms'; import { AccountsImportStackRoutes, diff --git a/suite-native/accounts/src/selectors.ts b/suite-native/accounts/src/selectors.ts index 6d0a08ef69..adc2016adb 100644 --- a/suite-native/accounts/src/selectors.ts +++ b/suite-native/accounts/src/selectors.ts @@ -1,5 +1,6 @@ import { A, pipe } from '@mobily/ts-belt'; +import { DeviceRootState, selectIsPortfolioTrackerDevice } from '@suite-common/device'; import { createWeakMapSelector } from '@suite-common/redux-utils'; import { SimpleTokenStructure, @@ -10,7 +11,6 @@ import { } from '@suite-common/token-definitions'; import { AccountsRootState, - DeviceRootState, FiatRatesRootState, TransactionsRootState, WalletSettingsRootState, @@ -18,7 +18,6 @@ import { selectBaseCurrency, selectCurrentFiatRates, selectIsAccountUtxoBased, - selectIsPortfolioTrackerDevice, selectPendingAccountAddresses, selectVisibleDeviceAccounts, } from '@suite-common/wallet-core'; diff --git a/suite-native/accounts/tsconfig.json b/suite-native/accounts/tsconfig.json index 2eac632e33..69d612cf7f 100644 --- a/suite-native/accounts/tsconfig.json +++ b/suite-native/accounts/tsconfig.json @@ -2,6 +2,7 @@ "extends": "../../tsconfig.base.json", "compilerOptions": { "outDir": "libDev" }, "references": [ + { "path": "../../suite-common/device" }, { "path": "../../suite-common/formatters" }, diff --git a/suite-native/app/e2e/tests/entropyCheckFailT3T1.test.ts b/suite-native/app/e2e/tests/entropyCheckFailT3T1.test.ts index 74d19c9de3..cc1e7161e3 100644 --- a/suite-native/app/e2e/tests/entropyCheckFailT3T1.test.ts +++ b/suite-native/app/e2e/tests/entropyCheckFailT3T1.test.ts @@ -1,6 +1,6 @@ import { expect as detoxExpect } from 'detox'; -import { DeviceReducerState, deviceReducerInitialState } from '@suite-common/wallet-core'; +import { DeviceReducerState, deviceReducerInitialState } from '@suite-common/device'; import { Model } from '@trezor/trezor-user-env-link'; import { deviceChecksEnabledState } from '../fixtures/deviceChecksEnabledState'; diff --git a/suite-native/app/package.json b/suite-native/app/package.json index 233d2eedad..0e3ba77afd 100644 --- a/suite-native/app/package.json +++ b/suite-native/app/package.json @@ -40,6 +40,7 @@ "@shopify/flash-list": "2.2.0", "@shopify/react-native-skia": "2.2.12", "@storybook/react-native": "^10.0.7", + "@suite-common/device": "workspace:*", "@suite-common/firmware-authenticity": "workspace:*", "@suite-common/formatters": "workspace:*", "@suite-common/react-query": "workspace:^", diff --git a/suite-native/app/src/hooks/useGlobalHooks.tsx b/suite-native/app/src/hooks/useGlobalHooks.tsx index f00c281667..f6d5f80142 100644 --- a/suite-native/app/src/hooks/useGlobalHooks.tsx +++ b/suite-native/app/src/hooks/useGlobalHooks.tsx @@ -1,7 +1,7 @@ import { useSelector } from 'react-redux'; +import { selectSelectedDevice } from '@suite-common/device'; import { useReportDeviceCompromised } from '@suite-common/firmware-authenticity'; -import { selectSelectedDevice } from '@suite-common/wallet-core'; import { useBluetoothAdapter } from '@suite-native/bluetooth'; import { useDetectDeviceError, diff --git a/suite-native/app/src/hooks/useReportAppInitToAnalytics.ts b/suite-native/app/src/hooks/useReportAppInitToAnalytics.ts index 53555aab9b..8684caa23c 100644 --- a/suite-native/app/src/hooks/useReportAppInitToAnalytics.ts +++ b/suite-native/app/src/hooks/useReportAppInitToAnalytics.ts @@ -2,15 +2,17 @@ import { useEffect, useState } from 'react'; import { Dimensions, PixelRatio, Platform } from 'react-native'; import { useSelector } from 'react-redux'; +import { + selectDeviceLanguage, + selectRememberedHiddenWalletsCount, + selectRememberedStandardWalletsCount, +} from '@suite-common/device'; import { UNIT_ABBREVIATIONS } from '@suite-common/suite-constants'; import { selectIsSuiteSyncEnabled } from '@suite-common/suite-sync'; import { selectBaseCurrency, selectBitcoinAmountUnit, - selectDeviceLanguage, selectEnabledNetworks, - selectRememberedHiddenWalletsCount, - selectRememberedStandardWalletsCount, } from '@suite-common/wallet-core'; import { events } from '@suite-native/analytics'; import { useDiscreetMode } from '@suite-native/atoms'; diff --git a/suite-native/app/tsconfig.json b/suite-native/app/tsconfig.json index 9092e9137d..5cc475c6c9 100644 --- a/suite-native/app/tsconfig.json +++ b/suite-native/app/tsconfig.json @@ -2,6 +2,7 @@ "extends": "../../tsconfig.base.json", "compilerOptions": { "outDir": "./libDev" }, "references": [ + { "path": "../../suite-common/device" }, { "path": "../../suite-common/firmware-authenticity" }, diff --git a/suite-native/assets/package.json b/suite-native/assets/package.json index 1988ac8a4b..090f2058b4 100644 --- a/suite-native/assets/package.json +++ b/suite-native/assets/package.json @@ -13,6 +13,7 @@ "@mobily/ts-belt": "^3.13.1", "@react-navigation/native": "7.1.26", "@suite-common/assets": "workspace:*", + "@suite-common/device": "workspace:*", "@suite-common/formatters": "workspace:*", "@suite-common/redux-utils": "workspace:*", "@suite-common/token-definitions": "workspace:*", diff --git a/suite-native/assets/src/assetsSelectors.ts b/suite-native/assets/src/assetsSelectors.ts index 5eead8ba01..4fc8515996 100644 --- a/suite-native/assets/src/assetsSelectors.ts +++ b/suite-native/assets/src/assetsSelectors.ts @@ -1,6 +1,7 @@ import { A, F, G, pipe } from '@mobily/ts-belt'; import { calculateAssetsPercentage } from '@suite-common/assets'; +import type { DeviceRootState } from '@suite-common/device'; import { createWeakMapSelector } from '@suite-common/redux-utils'; import { TokenDefinitionsRootState, @@ -10,7 +11,6 @@ import { import { type NetworkSymbol, networkSymbolCollection } from '@suite-common/wallet-config'; import { AccountsRootState, - DeviceRootState, FiatRatesRootState, WalletSettingsRootState, selectBaseCurrency, diff --git a/suite-native/assets/src/components/Assets.tsx b/suite-native/assets/src/components/Assets.tsx index 48ff0f393a..b6d9c0ffaf 100644 --- a/suite-native/assets/src/components/Assets.tsx +++ b/suite-native/assets/src/components/Assets.tsx @@ -4,9 +4,10 @@ import { useSelector } from 'react-redux'; import { useNavigation } from '@react-navigation/native'; +import { selectIsDeviceAuthorized } from '@suite-common/device'; import { useSelectorDeepComparison } from '@suite-common/redux-utils'; import { type NetworkSymbol } from '@suite-common/wallet-config'; -import { selectHasRunningDiscovery, selectIsDeviceAuthorized } from '@suite-common/wallet-core'; +import { selectHasRunningDiscovery } from '@suite-common/wallet-core'; import { OnSelectAccount } from '@suite-native/accounts'; import { AnimatedCard } from '@suite-native/atoms'; import { AccountsRediscoveryNeededWarning } from '@suite-native/discovery'; diff --git a/suite-native/assets/tsconfig.json b/suite-native/assets/tsconfig.json index bfbdf51354..3768956615 100644 --- a/suite-native/assets/tsconfig.json +++ b/suite-native/assets/tsconfig.json @@ -3,6 +3,7 @@ "compilerOptions": { "outDir": "libDev" }, "references": [ { "path": "../../suite-common/assets" }, + { "path": "../../suite-common/device" }, { "path": "../../suite-common/formatters" }, diff --git a/suite-native/bluetooth/package.json b/suite-native/bluetooth/package.json index c139f23de6..7acc0c0b13 100644 --- a/suite-native/bluetooth/package.json +++ b/suite-native/bluetooth/package.json @@ -14,8 +14,8 @@ "@reduxjs/toolkit": "2.11.2", "@suite-common/analytics": "workspace:*", "@suite-common/bluetooth": "workspace:*", + "@suite-common/device": "workspace:*", "@suite-common/redux-utils": "workspace:*", - "@suite-common/wallet-core": "workspace:*", "@suite-native/alerts": "workspace:*", "@suite-native/atoms": "workspace:*", "@suite-native/device-mutex": "workspace:*", diff --git a/suite-native/bluetooth/src/hooks/useBluetoothDevice.ts b/suite-native/bluetooth/src/hooks/useBluetoothDevice.ts index 981d9d9ce2..62c5145eee 100644 --- a/suite-native/bluetooth/src/hooks/useBluetoothDevice.ts +++ b/suite-native/bluetooth/src/hooks/useBluetoothDevice.ts @@ -2,7 +2,7 @@ import { useCallback } from 'react'; import { useDispatch, useSelector } from 'react-redux'; import { bluetoothActions } from '@suite-common/bluetooth'; -import { selectDeviceBluetoothId } from '@suite-common/wallet-core'; +import { selectDeviceBluetoothId } from '@suite-common/device'; import { requestPrioritizedDeviceAccess } from '@suite-native/device-mutex'; import TrezorConnect from '@trezor/connect'; import { bluetoothManager } from '@trezor/transport-native-bluetooth'; diff --git a/suite-native/bluetooth/tsconfig.json b/suite-native/bluetooth/tsconfig.json index 654d5f1c8d..f28862f14d 100644 --- a/suite-native/bluetooth/tsconfig.json +++ b/suite-native/bluetooth/tsconfig.json @@ -8,12 +8,10 @@ { "path": "../../suite-common/bluetooth" }, + { "path": "../../suite-common/device" }, { "path": "../../suite-common/redux-utils" }, - { - "path": "../../suite-common/wallet-core" - }, { "path": "../alerts" }, { "path": "../atoms" }, { "path": "../device-mutex" }, diff --git a/suite-native/coin-enabling/package.json b/suite-native/coin-enabling/package.json index ab1fa0344b..db89d41b87 100644 --- a/suite-native/coin-enabling/package.json +++ b/suite-native/coin-enabling/package.json @@ -12,6 +12,7 @@ "dependencies": { "@react-navigation/native": "7.1.26", "@reduxjs/toolkit": "2.11.2", + "@suite-common/device": "workspace:*", "@suite-common/validators": "workspace:*", "@suite-common/wallet-config": "workspace:*", "@suite-common/wallet-core": "workspace:*", diff --git a/suite-native/coin-enabling/src/components/DiscoveryCoinsFilter.tsx b/suite-native/coin-enabling/src/components/DiscoveryCoinsFilter.tsx index 53540f398e..125265bf77 100644 --- a/suite-native/coin-enabling/src/components/DiscoveryCoinsFilter.tsx +++ b/suite-native/coin-enabling/src/components/DiscoveryCoinsFilter.tsx @@ -1,7 +1,7 @@ import { useSelector } from 'react-redux'; +import { selectIsDeviceConnected } from '@suite-common/device'; import { type NetworkSymbol, getNetwork } from '@suite-common/wallet-config'; -import { selectIsDeviceConnected } from '@suite-common/wallet-core'; import { Text, VStack } from '@suite-native/atoms'; import { useFormContext } from '@suite-native/forms'; import { Icon } from '@suite-native/icons'; diff --git a/suite-native/coin-enabling/tsconfig.json b/suite-native/coin-enabling/tsconfig.json index 2887f09e3c..bbfa4ce5a6 100644 --- a/suite-native/coin-enabling/tsconfig.json +++ b/suite-native/coin-enabling/tsconfig.json @@ -2,6 +2,7 @@ "extends": "../../tsconfig.base.json", "compilerOptions": { "outDir": "libDev" }, "references": [ + { "path": "../../suite-common/device" }, { "path": "../../suite-common/validators" }, diff --git a/suite-native/device-authorization/package.json b/suite-native/device-authorization/package.json index 82f6c8e55f..4239cb6a34 100644 --- a/suite-native/device-authorization/package.json +++ b/suite-native/device-authorization/package.json @@ -13,6 +13,7 @@ "dependencies": { "@react-navigation/native": "7.1.26", "@reduxjs/toolkit": "2.11.2", + "@suite-common/device": "workspace:*", "@suite-common/suite-types": "workspace:*", "@suite-common/validators": "workspace:*", "@suite-common/wallet-core": "workspace:*", diff --git a/suite-native/device-authorization/src/screens/DeviceConnectionGuardScreen.tsx b/suite-native/device-authorization/src/screens/DeviceConnectionGuardScreen.tsx index d711019d23..84ba6fa4e9 100644 --- a/suite-native/device-authorization/src/screens/DeviceConnectionGuardScreen.tsx +++ b/suite-native/device-authorization/src/screens/DeviceConnectionGuardScreen.tsx @@ -1,6 +1,6 @@ import { useSelector } from 'react-redux'; -import { selectIsBluetoothSupportedByDevice } from '@suite-common/wallet-core'; +import { selectIsBluetoothSupportedByDevice } from '@suite-common/device'; import { selectBluetoothPermissionStatus } from '@suite-native/bluetooth'; import { ConnectAndUnlockDeviceScreenContent, diff --git a/suite-native/device-authorization/tsconfig.json b/suite-native/device-authorization/tsconfig.json index a315ec0a36..923a39782b 100644 --- a/suite-native/device-authorization/tsconfig.json +++ b/suite-native/device-authorization/tsconfig.json @@ -2,6 +2,7 @@ "extends": "../../tsconfig.base.json", "compilerOptions": { "outDir": "libDev" }, "references": [ + { "path": "../../suite-common/device" }, { "path": "../../suite-common/suite-types" }, diff --git a/suite-native/device-manager/package.json b/suite-native/device-manager/package.json index d740992b18..8f492b9e08 100644 --- a/suite-native/device-manager/package.json +++ b/suite-native/device-manager/package.json @@ -13,6 +13,7 @@ "@mobily/ts-belt": "^3.13.1", "@react-navigation/native": "7.1.26", "@reduxjs/toolkit": "2.11.2", + "@suite-common/device": "workspace:*", "@suite-common/redux-utils": "workspace:*", "@suite-common/suite-sync": "workspace:*", "@suite-common/suite-types": "workspace:*", diff --git a/suite-native/device-manager/src/components/AddHiddenWalletButton.tsx b/suite-native/device-manager/src/components/AddHiddenWalletButton.tsx index f04310d2ba..84a310b94c 100644 --- a/suite-native/device-manager/src/components/AddHiddenWalletButton.tsx +++ b/suite-native/device-manager/src/components/AddHiddenWalletButton.tsx @@ -2,11 +2,8 @@ import { useDispatch, useSelector } from 'react-redux'; import { useNavigation } from '@react-navigation/native'; -import { - runDiscoveryThunk, - selectSelectedDevice, - startDiscoveryThunk, -} from '@suite-common/wallet-core'; +import { selectSelectedDevice } from '@suite-common/device'; +import { runDiscoveryThunk, startDiscoveryThunk } from '@suite-common/wallet-core'; import { events } from '@suite-native/analytics'; import { HStack, Text } from '@suite-native/atoms'; import { Icon } from '@suite-native/icons'; diff --git a/suite-native/device-manager/src/components/BootloaderModeItemContent.tsx b/suite-native/device-manager/src/components/BootloaderModeItemContent.tsx index 10c5a0f221..666106987b 100644 --- a/suite-native/device-manager/src/components/BootloaderModeItemContent.tsx +++ b/suite-native/device-manager/src/components/BootloaderModeItemContent.tsx @@ -1,6 +1,6 @@ import { useSelector } from 'react-redux'; -import { selectSelectedDevice } from '@suite-common/wallet-core'; +import { selectSelectedDevice } from '@suite-common/device'; import { Box, HStack, Text } from '@suite-native/atoms'; import { useNativeStyles } from '@trezor/styles'; diff --git a/suite-native/device-manager/src/components/ConnectButton.tsx b/suite-native/device-manager/src/components/ConnectButton.tsx index 82b013e672..7af882677e 100644 --- a/suite-native/device-manager/src/components/ConnectButton.tsx +++ b/suite-native/device-manager/src/components/ConnectButton.tsx @@ -1,8 +1,9 @@ import { FadeInUp, FadeOutUp, LinearTransition } from 'react-native-reanimated'; import { useSelector } from 'react-redux'; +import { selectSelectedDevice } from '@suite-common/device'; import { TrezorDevice } from '@suite-common/suite-types'; -import { selectHasRunningDiscovery, selectSelectedDevice } from '@suite-common/wallet-core'; +import { selectHasRunningDiscovery } from '@suite-common/wallet-core'; import { events } from '@suite-native/analytics'; import { AnimatedBox, Button } from '@suite-native/atoms'; import { useConnectDeviceHandler } from '@suite-native/device'; diff --git a/suite-native/device-manager/src/components/DeviceItem/DeviceItemContent.tsx b/suite-native/device-manager/src/components/DeviceItem/DeviceItemContent.tsx index 71a96cad75..9bc8330b48 100644 --- a/suite-native/device-manager/src/components/DeviceItem/DeviceItemContent.tsx +++ b/suite-native/device-manager/src/components/DeviceItem/DeviceItemContent.tsx @@ -1,16 +1,16 @@ import React from 'react'; import { useSelector } from 'react-redux'; -import { useSelectorDeepComparison } from '@suite-common/redux-utils'; -import { TrezorDevice } from '@suite-common/suite-types'; import { DeviceRootState, PORTFOLIO_TRACKER_DEVICE_ID, selectDeviceByState, selectDeviceLabelOrNameById, - selectHasOnlyEmptyPortfolioTracker, selectSelectedDevice, -} from '@suite-common/wallet-core'; +} from '@suite-common/device'; +import { useSelectorDeepComparison } from '@suite-common/redux-utils'; +import { TrezorDevice } from '@suite-common/suite-types'; +import { selectHasOnlyEmptyPortfolioTracker } from '@suite-common/wallet-core'; import { ACCESSIBILITY_FONTSIZE_MULTIPLIER, Box, HStack } from '@suite-native/atoms'; import { selectShouldFactoryResetBeVisible } from '@suite-native/device'; import { Translation, useTranslate } from '@suite-native/intl'; diff --git a/suite-native/device-manager/src/components/DeviceItem/DeviceItemIcon.tsx b/suite-native/device-manager/src/components/DeviceItem/DeviceItemIcon.tsx index 4f13ed39b9..58fbc50328 100644 --- a/suite-native/device-manager/src/components/DeviceItem/DeviceItemIcon.tsx +++ b/suite-native/device-manager/src/components/DeviceItem/DeviceItemIcon.tsx @@ -1,11 +1,11 @@ import { useSelector } from 'react-redux'; -import { TrezorDevice } from '@suite-common/suite-types'; import { DeviceRootState, PORTFOLIO_TRACKER_DEVICE_ID, selectDeviceModelById, -} from '@suite-common/wallet-core'; +} from '@suite-common/device'; +import { TrezorDevice } from '@suite-common/suite-types'; import { DeviceModelIcon, Icon, IconSize } from '@suite-native/icons'; type DeviceItemIconProps = { diff --git a/suite-native/device-manager/src/components/DeviceList.tsx b/suite-native/device-manager/src/components/DeviceList.tsx index eeb7d0134e..e104b9bc12 100644 --- a/suite-native/device-manager/src/components/DeviceList.tsx +++ b/suite-native/device-manager/src/components/DeviceList.tsx @@ -1,8 +1,8 @@ import { FadeInUp, FadeOutUp } from 'react-native-reanimated'; import { useSelector } from 'react-redux'; +import { selectInstacelessUnselectedDevices } from '@suite-common/device'; import { TrezorDevice } from '@suite-common/suite-types'; -import { selectInstacelessUnselectedDevices } from '@suite-common/wallet-core'; import { AnimatedBox, Box } from '@suite-native/atoms'; import { prepareNativeStyle, useNativeStyles } from '@trezor/styles'; diff --git a/suite-native/device-manager/src/components/DeviceManagerContent.tsx b/suite-native/device-manager/src/components/DeviceManagerContent.tsx index 8ab90a3992..f024d5df9d 100644 --- a/suite-native/device-manager/src/components/DeviceManagerContent.tsx +++ b/suite-native/device-manager/src/components/DeviceManagerContent.tsx @@ -6,16 +6,15 @@ import { useDispatch, useSelector } from 'react-redux'; import { useNavigation, useRoute } from '@react-navigation/native'; -import { TrezorDevice } from '@suite-common/suite-types'; import { PORTFOLIO_TRACKER_DEVICE_ID, - selectDeviceThunk, - selectHasRunningDiscovery, selectIsDeviceInitialized, selectIsDeviceProtectedByPassphrase, selectIsPortfolioTrackerDevice, selectSelectedDevice, -} from '@suite-common/wallet-core'; +} from '@suite-common/device'; +import { TrezorDevice } from '@suite-common/suite-types'; +import { selectDeviceThunk, selectHasRunningDiscovery } from '@suite-common/wallet-core'; import { events } from '@suite-native/analytics'; import { ACCESSIBILITY_FONTSIZE_MULTIPLIER, diff --git a/suite-native/device-manager/src/components/DeviceManagerModal.tsx b/suite-native/device-manager/src/components/DeviceManagerModal.tsx index 320fc87bfc..5953b3be36 100644 --- a/suite-native/device-manager/src/components/DeviceManagerModal.tsx +++ b/suite-native/device-manager/src/components/DeviceManagerModal.tsx @@ -4,7 +4,7 @@ import Animated, { FadeIn, LinearTransition, SlideInUp } from 'react-native-rean import { EdgeInsets, useSafeAreaInsets } from 'react-native-safe-area-context'; import { useSelector } from 'react-redux'; -import { selectDeviceState } from '@suite-common/wallet-core'; +import { selectDeviceState } from '@suite-common/device'; import { Box, HStack, ScreenHeaderWrapper } from '@suite-native/atoms'; import { selectShouldFactoryResetBeVisible } from '@suite-native/device'; import { prepareNativeStyle, useNativeStyles } from '@trezor/styles'; diff --git a/suite-native/device-manager/src/components/DeviceSettingsButton.tsx b/suite-native/device-manager/src/components/DeviceSettingsButton.tsx index ce186b2e7a..f07e49259b 100644 --- a/suite-native/device-manager/src/components/DeviceSettingsButton.tsx +++ b/suite-native/device-manager/src/components/DeviceSettingsButton.tsx @@ -2,7 +2,7 @@ import { useSelector } from 'react-redux'; import { useNavigation } from '@react-navigation/native'; -import { selectSelectedDevice } from '@suite-common/wallet-core'; +import { selectSelectedDevice } from '@suite-common/device'; import { events } from '@suite-native/analytics'; import { HStack, Text } from '@suite-native/atoms'; import { Icon } from '@suite-native/icons'; diff --git a/suite-native/device-manager/src/components/DeviceSwitchContent.tsx b/suite-native/device-manager/src/components/DeviceSwitchContent.tsx index 85e5003e98..ebe8995fe3 100644 --- a/suite-native/device-manager/src/components/DeviceSwitchContent.tsx +++ b/suite-native/device-manager/src/components/DeviceSwitchContent.tsx @@ -1,6 +1,6 @@ import { useSelector } from 'react-redux'; -import { selectDeviceState, selectNumberOfDeviceInstances } from '@suite-common/wallet-core'; +import { selectDeviceState, selectNumberOfDeviceInstances } from '@suite-common/device'; import { Text } from '@suite-native/atoms'; import { selectShouldFactoryResetBeVisible } from '@suite-native/device'; import { Translation } from '@suite-native/intl'; diff --git a/suite-native/device-manager/src/components/WalletItem.tsx b/suite-native/device-manager/src/components/WalletItem.tsx index 654ff88b55..b2e31585a7 100644 --- a/suite-native/device-manager/src/components/WalletItem.tsx +++ b/suite-native/device-manager/src/components/WalletItem.tsx @@ -1,7 +1,7 @@ import { useSelector } from 'react-redux'; +import { selectSelectedDevice } from '@suite-common/device'; import { TrezorDevice } from '@suite-common/suite-types'; -import { selectSelectedDevice } from '@suite-common/wallet-core'; import { selectDeviceTotalFiatBalanceByDeviceState } from '@suite-native/device'; import { WalletItemBase } from './WalletItemBase'; diff --git a/suite-native/device-manager/src/components/WalletList.tsx b/suite-native/device-manager/src/components/WalletList.tsx index bc03d90d12..95db6f17f9 100644 --- a/suite-native/device-manager/src/components/WalletList.tsx +++ b/suite-native/device-manager/src/components/WalletList.tsx @@ -2,13 +2,13 @@ import { useDispatch, useSelector } from 'react-redux'; import { A } from '@mobily/ts-belt'; -import { TrezorDevice } from '@suite-common/suite-types'; import { selectDeviceInstances, selectIsPortfolioTrackerDevice, selectSelectedDevice, - startDiscoveryThunk, -} from '@suite-common/wallet-core'; +} from '@suite-common/device'; +import { TrezorDevice } from '@suite-common/suite-types'; +import { startDiscoveryThunk } from '@suite-common/wallet-core'; import { VStack } from '@suite-native/atoms'; import { selectHasNoDeviceWithEmptyPassphrase } from '@suite-native/device'; diff --git a/suite-native/device-manager/tsconfig.json b/suite-native/device-manager/tsconfig.json index 84b31beca1..715138b125 100644 --- a/suite-native/device-manager/tsconfig.json +++ b/suite-native/device-manager/tsconfig.json @@ -2,6 +2,7 @@ "extends": "../../tsconfig.base.json", "compilerOptions": { "outDir": "libDev" }, "references": [ + { "path": "../../suite-common/device" }, { "path": "../../suite-common/redux-utils" }, diff --git a/suite-native/device/package.json b/suite-native/device/package.json index cb92e3d0ca..a740b14b2e 100644 --- a/suite-native/device/package.json +++ b/suite-native/device/package.json @@ -16,6 +16,7 @@ "@reduxjs/toolkit": "2.11.2", "@suite-common/analytics": "workspace:*", "@suite-common/bluetooth": "workspace:*", + "@suite-common/device": "workspace:*", "@suite-common/device-authenticity": "workspace:*", "@suite-common/firmware-authenticity": "workspace:*", "@suite-common/message-system": "workspace:*", diff --git a/suite-native/device/src/__tests__/deviceConnectionFixtures.ts b/suite-native/device/src/__tests__/deviceConnectionFixtures.ts index 77d01ce49d..047ecd891e 100644 --- a/suite-native/device/src/__tests__/deviceConnectionFixtures.ts +++ b/suite-native/device/src/__tests__/deviceConnectionFixtures.ts @@ -1,14 +1,11 @@ import { UnknownAction } from '@reduxjs/toolkit'; +import { deviceActions, prepareDeviceReducer } from '@suite-common/device'; import { prepareMessageSystemReducer } from '@suite-common/message-system'; import { mockSuiteDevice } from '@suite-common/suite-types/mocks'; import { extraDependenciesCommonMock } from '@suite-common/test-utils'; import { prepareThpReducer } from '@suite-common/thp'; -import { - deviceActions, - prepareDeviceReducer, - prepareWalletSettingsReducer, -} from '@suite-common/wallet-core'; +import { prepareWalletSettingsReducer } from '@suite-common/wallet-core'; import { deviceOnboardingSlice } from '@suite-native/device-onboarding'; import { featureFlagsSlice } from '@suite-native/feature-flags'; import { NativeFirmwareState, nativeFirmwareReducer } from '@suite-native/firmware'; diff --git a/suite-native/device/src/components/ConnectorImage.tsx b/suite-native/device/src/components/ConnectorImage.tsx index ee6793ff65..69bb24c6f6 100644 --- a/suite-native/device/src/components/ConnectorImage.tsx +++ b/suite-native/device/src/components/ConnectorImage.tsx @@ -1,6 +1,6 @@ import { useSelector } from 'react-redux'; -import { selectIsDeviceConnectedViaBluetooth } from '@suite-common/wallet-core'; +import { selectIsDeviceConnectedViaBluetooth } from '@suite-common/device'; import { Box, Image } from '@suite-native/atoms'; import { prepareNativeStyle, useNativeStyles } from '@trezor/styles'; diff --git a/suite-native/device/src/components/ContinueOnTrezorScreenContent.tsx b/suite-native/device/src/components/ContinueOnTrezorScreenContent.tsx index 1172c0edc6..41a2a4ea33 100644 --- a/suite-native/device/src/components/ContinueOnTrezorScreenContent.tsx +++ b/suite-native/device/src/components/ContinueOnTrezorScreenContent.tsx @@ -2,7 +2,7 @@ import { useSelector } from 'react-redux'; import { RequireAllOrNone } from 'type-fest'; -import { selectDeviceModel } from '@suite-common/wallet-core'; +import { selectDeviceModel } from '@suite-common/device'; import { Box, Button, Text, VStack } from '@suite-native/atoms'; import { Translation, TxKeyPath } from '@suite-native/intl'; import { DeviceModelInternal } from '@trezor/device-utils'; diff --git a/suite-native/device/src/components/DeviceInteractionScreenWrapper.tsx b/suite-native/device/src/components/DeviceInteractionScreenWrapper.tsx index 6be8d330ef..22df93944b 100644 --- a/suite-native/device/src/components/DeviceInteractionScreenWrapper.tsx +++ b/suite-native/device/src/components/DeviceInteractionScreenWrapper.tsx @@ -1,7 +1,7 @@ import { ReactNode, useCallback } from 'react'; import { useSelector } from 'react-redux'; -import { selectSelectedDevice } from '@suite-common/wallet-core'; +import { selectSelectedDevice } from '@suite-common/device'; import { Screen, ScreenHeader } from '@suite-native/navigation'; import TrezorConnect from '@trezor/connect'; diff --git a/suite-native/device/src/deviceThunks.ts b/suite-native/device/src/deviceThunks.ts index 247bc0b1ea..dbc90b82bd 100644 --- a/suite-native/device/src/deviceThunks.ts +++ b/suite-native/device/src/deviceThunks.ts @@ -1,13 +1,13 @@ -import { Feature, selectIsFeatureEnabled } from '@suite-common/message-system'; -import { createThunk } from '@suite-common/redux-utils'; -import { BackupType } from '@suite-common/suite-types'; import { - processEntropyCheckResultThunk, selectDevicePath, selectIsDeviceInitialized, selectSelectedDevice, selectSimulatedEntropyCheckFail, -} from '@suite-common/wallet-core'; +} from '@suite-common/device'; +import { Feature, selectIsFeatureEnabled } from '@suite-common/message-system'; +import { createThunk } from '@suite-common/redux-utils'; +import { BackupType } from '@suite-common/suite-types'; +import { processEntropyCheckResultThunk } from '@suite-common/wallet-core'; import { requestPrioritizedDeviceAccess } from '@suite-native/device-mutex'; import TrezorConnect, { PROTO, SuccessWithDevice, Unsuccessful } from '@trezor/connect'; import { exhaustive } from '@trezor/type-utils'; diff --git a/suite-native/device/src/hooks/useCoinLabel.ts b/suite-native/device/src/hooks/useCoinLabel.ts index aa2deb52b8..b7ebc0c505 100644 --- a/suite-native/device/src/hooks/useCoinLabel.ts +++ b/suite-native/device/src/hooks/useCoinLabel.ts @@ -1,6 +1,6 @@ import { useSelector } from 'react-redux'; -import { selectHasBitcoinOnlyFirmware } from '@suite-common/wallet-core'; +import { selectHasBitcoinOnlyFirmware } from '@suite-common/device'; export const useCoinLabel = () => { const isBtcOnly = useSelector(selectHasBitcoinOnlyFirmware); diff --git a/suite-native/device/src/hooks/useConnectDeviceHandler.tsx b/suite-native/device/src/hooks/useConnectDeviceHandler.tsx index 586f6b288a..a074171c1e 100644 --- a/suite-native/device/src/hooks/useConnectDeviceHandler.tsx +++ b/suite-native/device/src/hooks/useConnectDeviceHandler.tsx @@ -6,10 +6,10 @@ import { useNavigation } from '@react-navigation/native'; import { bluetoothActions } from '@suite-common/bluetooth'; import { - acquireDevice, selectIsAnyPhysicalDeviceConnectedViaUsb, selectIsDeviceThpLocked, -} from '@suite-common/wallet-core'; +} from '@suite-common/device'; +import { acquireDevice } from '@suite-common/wallet-core'; import { AuthorizeDeviceStackRoutes, HomeStackParamList, diff --git a/suite-native/device/src/hooks/useDetectDeviceError.tsx b/suite-native/device/src/hooks/useDetectDeviceError.tsx index 82b6bb6bab..f94c093592 100644 --- a/suite-native/device/src/hooks/useDetectDeviceError.tsx +++ b/suite-native/device/src/hooks/useDetectDeviceError.tsx @@ -4,7 +4,6 @@ import { useDispatch, useSelector } from 'react-redux'; import { useNavigation } from '@react-navigation/native'; import { - acquireDevice, deviceActions, selectHasDeviceFirmwareInstalled, selectIsConnectedDeviceUninitialized, @@ -14,7 +13,8 @@ import { selectIsPortfolioTrackerDevice, selectIsUnacquiredDevice, selectSelectedDevice, -} from '@suite-common/wallet-core'; +} from '@suite-common/device'; +import { acquireDevice } from '@suite-common/wallet-core'; import { useAlert } from '@suite-native/alerts'; import { events } from '@suite-native/analytics'; import { selectIsFirmwareInstallationRunning } from '@suite-native/firmware/src/nativeFirmwareSlice'; diff --git a/suite-native/device/src/hooks/useDeviceAuthenticityCheck.ts b/suite-native/device/src/hooks/useDeviceAuthenticityCheck.ts index 92b05384d9..4a188fda3a 100644 --- a/suite-native/device/src/hooks/useDeviceAuthenticityCheck.ts +++ b/suite-native/device/src/hooks/useDeviceAuthenticityCheck.ts @@ -3,6 +3,7 @@ import { useDispatch, useSelector } from 'react-redux'; import { useNavigation } from '@react-navigation/native'; +import { deviceActions, selectSelectedDevice } from '@suite-common/device'; import { isDeviceAuthenticityValid } from '@suite-common/device-authenticity'; import { Feature, @@ -10,7 +11,6 @@ import { selectIsFeatureDisabled, } from '@suite-common/message-system'; import { StoredAuthenticateDeviceResult } from '@suite-common/suite-types'; -import { deviceActions, selectSelectedDevice } from '@suite-common/wallet-core'; import { DeviceAuthenticityCheckResult, events } from '@suite-native/analytics'; import { requestPrioritizedDeviceAccess } from '@suite-native/device-mutex'; import { FeatureFlag, useFeatureFlag } from '@suite-native/feature-flags'; diff --git a/suite-native/device/src/hooks/useDeviceLowBatteryAlert.tsx b/suite-native/device/src/hooks/useDeviceLowBatteryAlert.tsx index 8dc11d0ac6..44be024ee9 100644 --- a/suite-native/device/src/hooks/useDeviceLowBatteryAlert.tsx +++ b/suite-native/device/src/hooks/useDeviceLowBatteryAlert.tsx @@ -4,7 +4,7 @@ import { useSelector } from 'react-redux'; import { DEVICE_LOW_BATTERY_PERCENTAGE_THRESHOLD, selectIsDeviceConnectedViaBluetoothLowOnBattery, -} from '@suite-common/wallet-core'; +} from '@suite-common/device'; import { useAlert } from '@suite-native/alerts'; import { Translation } from '@suite-native/intl'; diff --git a/suite-native/device/src/hooks/usePinAction.tsx b/suite-native/device/src/hooks/usePinAction.tsx index 94864a06a7..91c0a10335 100644 --- a/suite-native/device/src/hooks/usePinAction.tsx +++ b/suite-native/device/src/hooks/usePinAction.tsx @@ -3,7 +3,7 @@ import { useSelector } from 'react-redux'; import { useFocusEffect, useNavigation } from '@react-navigation/native'; -import { selectIsDeviceConnected, selectSelectedDevice } from '@suite-common/wallet-core'; +import { selectIsDeviceConnected, selectSelectedDevice } from '@suite-common/device'; import { useAlert } from '@suite-native/alerts'; import { events } from '@suite-native/analytics'; import { requestPrioritizedDeviceAccess } from '@suite-native/device-mutex'; diff --git a/suite-native/device/src/hooks/useRenderDeviceDangerBanner.ts b/suite-native/device/src/hooks/useRenderDeviceDangerBanner.ts index 0467c6aba4..c6835e66f1 100644 --- a/suite-native/device/src/hooks/useRenderDeviceDangerBanner.ts +++ b/suite-native/device/src/hooks/useRenderDeviceDangerBanner.ts @@ -4,10 +4,7 @@ import { useSelector } from 'react-redux'; import { useNavigation } from '@react-navigation/native'; import { useSetAtom } from 'jotai'; -import { - selectIsDeviceBackupRequired, - selectIsDeviceBackupUnfinished, -} from '@suite-common/wallet-core'; +import { selectIsDeviceBackupRequired, selectIsDeviceBackupUnfinished } from '@suite-common/device'; import { AppTabsRoutes, HomeStackRoutes, diff --git a/suite-native/device/src/hooks/useWipeDevice.tsx b/suite-native/device/src/hooks/useWipeDevice.tsx index be054705a7..fe963550ed 100644 --- a/suite-native/device/src/hooks/useWipeDevice.tsx +++ b/suite-native/device/src/hooks/useWipeDevice.tsx @@ -4,7 +4,8 @@ import { useNavigation } from '@react-navigation/native'; import { isFulfilled } from '@reduxjs/toolkit'; import { events } from '@suite-common/analytics'; -import { selectSelectedDevice, wipeDeviceThunk } from '@suite-common/wallet-core'; +import { selectSelectedDevice } from '@suite-common/device'; +import { wipeDeviceThunk } from '@suite-common/wallet-core'; import { requestPrioritizedDeviceAccess } from '@suite-native/device-mutex'; import { setWasDeviceOnboardingCancelled } from '@suite-native/device-onboarding'; import { diff --git a/suite-native/device/src/middlewares/deviceConnectionMiddleware.ts b/suite-native/device/src/middlewares/deviceConnectionMiddleware.ts index 72183921b2..41b75ec1ee 100644 --- a/suite-native/device/src/middlewares/deviceConnectionMiddleware.ts +++ b/suite-native/device/src/middlewares/deviceConnectionMiddleware.ts @@ -5,18 +5,14 @@ import { createListenerMiddleware, } from '@reduxjs/toolkit'; +import { deviceActions, selectDevices, selectIsDeviceRemembered } from '@suite-common/device'; import { getDeviceInternalModel, getIsDeviceDescriptorApiTypeBluetooth, getIsDeviceInitialized, } from '@suite-common/suite-utils'; import { isThpPairingUIRequestButtonAction, selectThpAutoconnectStep } from '@suite-common/thp'; -import { - deviceActions, - selectDevices, - selectIsAnyNetworkEnabled, - selectIsDeviceRemembered, -} from '@suite-common/wallet-core'; +import { selectIsAnyNetworkEnabled } from '@suite-common/wallet-core'; import { selectWasDeviceOnboardingCancelled } from '@suite-native/device-onboarding'; import { selectIsFirmwareInstallationRunning } from '@suite-native/firmware'; import { diff --git a/suite-native/device/src/middlewares/deviceMiddleware.ts b/suite-native/device/src/middlewares/deviceMiddleware.ts index a2cf854c84..ab606980fe 100644 --- a/suite-native/device/src/middlewares/deviceMiddleware.ts +++ b/suite-native/device/src/middlewares/deviceMiddleware.ts @@ -1,17 +1,16 @@ import { AnyAction, isAnyOf } from '@reduxjs/toolkit'; +import { deviceActions, isTrezorDeviceWithState } from '@suite-common/device'; import { createMiddlewareWithExtraDeps } from '@suite-common/redux-utils'; import { isAnyDeviceEventAction } from '@suite-common/suite-utils'; import { accountsActions, - deviceActions, forgetDisconnectedDevices, handleDeviceDisconnect, observeSelectedDevice, selectAccountsByDeviceState, selectDiscoveryByDevicePath, } from '@suite-common/wallet-core'; -import { isTrezorDeviceWithState } from '@suite-common/wallet-utils'; import { asTypedNativeAnalytics } from '@suite-native/analytics'; import { clearAndUnlockDeviceAccessQueue } from '@suite-native/device-mutex'; import { reportSecurityCheck } from '@suite-native/sentry'; diff --git a/suite-native/device/src/selectors.ts b/suite-native/device/src/selectors.ts index 4ecc75c704..a1161f286c 100644 --- a/suite-native/device/src/selectors.ts +++ b/suite-native/device/src/selectors.ts @@ -1,5 +1,23 @@ import { A, pipe } from '@mobily/ts-belt'; +import { + DeviceRootState, + PORTFOLIO_TRACKER_DEVICE_ID, + selectDeviceFirmwareVersionArray, + selectDeviceInstances, + selectDeviceModel, + selectDevices, + selectFirmwareRevisionCheckError, + selectHasDeviceFirmwareInstalled, + selectIsConnectedDeviceUninitialized, + selectIsDeviceConnectedAndAuthorized, + selectIsDeviceInBootloader, + selectIsEntropyCheckFailed, + selectIsFirmwareAuthenticityCheckDismissed, + selectIsUnacquiredDevice, + selectSelectedDevice, + selectSelectedDeviceAuthenticity, +} from '@suite-common/device'; import { isHardRevisionCheckError, isSkippedRevisionCheckError, @@ -14,10 +32,8 @@ import { createWeakMapSelector, returnStableArrayIfEmpty } from '@suite-common/r import { ThpRootState } from '@suite-common/thp'; import { AccountsRootState, - DeviceRootState, DiscoveryRootState, FiatRatesRootState, - PORTFOLIO_TRACKER_DEVICE_ID, WalletSettingsRootState, getAccountsByDeviceState, selectAccounts, @@ -25,22 +41,8 @@ import { selectBaseCurrency, selectCurrentFiatRates, selectDeviceAccounts, - selectDeviceFirmwareVersionArray, - selectDeviceInstances, - selectDeviceModel, - selectDevices, - selectFirmwareRevisionCheckError, - selectHasDeviceFirmwareInstalled, selectHasRunningDiscovery, - selectIsConnectedDeviceUninitialized, - selectIsDeviceConnectedAndAuthorized, - selectIsDeviceInBootloader, selectIsDiscoveredDeviceAccountless, - selectIsEntropyCheckFailed, - selectIsFirmwareAuthenticityCheckDismissed, - selectIsUnacquiredDevice, - selectSelectedDevice, - selectSelectedDeviceAuthenticity, } from '@suite-common/wallet-core'; import { Account, diff --git a/suite-native/device/tsconfig.json b/suite-native/device/tsconfig.json index 4afe470e94..5ee883cecc 100644 --- a/suite-native/device/tsconfig.json +++ b/suite-native/device/tsconfig.json @@ -8,6 +8,7 @@ { "path": "../../suite-common/bluetooth" }, + { "path": "../../suite-common/device" }, { "path": "../../suite-common/device-authenticity" }, diff --git a/suite-native/discovery/package.json b/suite-native/discovery/package.json index 5a1ce04bad..b3587aba91 100644 --- a/suite-native/discovery/package.json +++ b/suite-native/discovery/package.json @@ -13,6 +13,7 @@ "dependencies": { "@mobily/ts-belt": "^3.13.1", "@reduxjs/toolkit": "2.11.2", + "@suite-common/device": "workspace:*", "@suite-common/redux-utils": "workspace:*", "@suite-common/suite-types": "workspace:*", "@suite-common/suite-utils": "workspace:*", diff --git a/suite-native/discovery/src/components/AccountsRediscoveryNeededWarning.tsx b/suite-native/discovery/src/components/AccountsRediscoveryNeededWarning.tsx index a453f65493..c32ad3d189 100644 --- a/suite-native/discovery/src/components/AccountsRediscoveryNeededWarning.tsx +++ b/suite-native/discovery/src/components/AccountsRediscoveryNeededWarning.tsx @@ -2,13 +2,12 @@ import { useSelector } from 'react-redux'; import { DeviceRootState, - WalletCoreCompoundRootState, selectDeviceModelById, selectIsDeviceConnected, selectIsPortfolioTrackerDevice, selectSelectedDevice, - selectShouldRediscover, -} from '@suite-common/wallet-core'; +} from '@suite-common/device'; +import { WalletCoreCompoundRootState, selectShouldRediscover } from '@suite-common/wallet-core'; import { Box, InlineAlertBox } from '@suite-native/atoms'; import { DeviceModelIcon } from '@suite-native/icons'; import { Translation } from '@suite-native/intl'; diff --git a/suite-native/discovery/src/discoveryMiddleware.ts b/suite-native/discovery/src/discoveryMiddleware.ts index f8c1f2cc4b..e1922be976 100644 --- a/suite-native/discovery/src/discoveryMiddleware.ts +++ b/suite-native/discovery/src/discoveryMiddleware.ts @@ -1,3 +1,4 @@ +import { deviceActions, selectSelectedDevice } from '@suite-common/device'; import { createMiddlewareWithExtraDeps } from '@suite-common/redux-utils'; import { isDeviceAcquired } from '@suite-common/suite-utils'; import { periodicCheckTokenDefinitionsThunk } from '@suite-common/token-definitions'; @@ -5,11 +6,9 @@ import { accountsActions, changeCoinVisibility, changeNetworks, - deviceActions, discoveryActions, selectIsAnyNetworkEnabled, selectIsBitcoinEnabled, - selectSelectedDevice, selectShouldRediscover, startOrRestartDiscoveryThunk, } from '@suite-common/wallet-core'; diff --git a/suite-native/discovery/src/discoverySelectors.ts b/suite-native/discovery/src/discoverySelectors.ts index 6b6f57bf31..00728e05b7 100644 --- a/suite-native/discovery/src/discoverySelectors.ts +++ b/suite-native/discovery/src/discoverySelectors.ts @@ -1,5 +1,6 @@ import { A, pipe } from '@mobily/ts-belt'; +import type { DeviceRootState } from '@suite-common/device'; import { createWeakMapSelector, returnStableArrayIfEmpty } from '@suite-common/redux-utils'; import { TrezorDevice } from '@suite-common/suite-types'; import { @@ -10,7 +11,6 @@ import { } from '@suite-common/wallet-config'; import { AccountsRootState, - DeviceRootState, WalletSettingsRootState, selectDeviceSupportedNetworks, selectEnabledNetworks, diff --git a/suite-native/discovery/tsconfig.json b/suite-native/discovery/tsconfig.json index dbc6a887ba..043c26c3e9 100644 --- a/suite-native/discovery/tsconfig.json +++ b/suite-native/discovery/tsconfig.json @@ -2,6 +2,7 @@ "extends": "../../tsconfig.base.json", "compilerOptions": { "outDir": "libDev" }, "references": [ + { "path": "../../suite-common/device" }, { "path": "../../suite-common/redux-utils" }, diff --git a/suite-native/firmware/package.json b/suite-native/firmware/package.json index 21ad741a06..ab0369bc18 100644 --- a/suite-native/firmware/package.json +++ b/suite-native/firmware/package.json @@ -14,6 +14,7 @@ "@react-navigation/native": "7.1.26", "@reduxjs/toolkit": "2.11.2", "@shopify/react-native-skia": "2.2.12", + "@suite-common/device": "workspace:*", "@suite-common/firmware": "workspace:*", "@suite-common/icons": "workspace:*", "@suite-common/message-system": "workspace:*", diff --git a/suite-native/firmware/src/components/FirmwareChangelog.tsx b/suite-native/firmware/src/components/FirmwareChangelog.tsx index e1b000127f..80f60b89e4 100644 --- a/suite-native/firmware/src/components/FirmwareChangelog.tsx +++ b/suite-native/firmware/src/components/FirmwareChangelog.tsx @@ -1,7 +1,7 @@ import { useMemo } from 'react'; import { useSelector } from 'react-redux'; -import { selectFirmwareChangelog } from '@suite-common/wallet-core'; +import { selectFirmwareChangelog } from '@suite-common/device'; import { BottomSheetModal, BottomSheetModalRef, Button, Text } from '@suite-native/atoms'; import { Translation } from '@suite-native/intl'; import { prepareNativeStyle, useNativeStyles } from '@trezor/styles'; diff --git a/suite-native/firmware/src/components/FirmwareInfoScreenContent.tsx b/suite-native/firmware/src/components/FirmwareInfoScreenContent.tsx index dc3a91d7bd..cdac59dd36 100644 --- a/suite-native/firmware/src/components/FirmwareInfoScreenContent.tsx +++ b/suite-native/firmware/src/components/FirmwareInfoScreenContent.tsx @@ -1,7 +1,7 @@ import React from 'react'; import { useSelector } from 'react-redux'; -import { selectHasDeviceFirmwareInstalled } from '@suite-common/wallet-core'; +import { selectHasDeviceFirmwareInstalled } from '@suite-common/device'; import { IconListTextItem, Text, VStack } from '@suite-native/atoms'; import { Translation } from '@suite-native/intl'; diff --git a/suite-native/firmware/src/components/FirmwareInfoScreenFooter.tsx b/suite-native/firmware/src/components/FirmwareInfoScreenFooter.tsx index 254fcde2f6..877f983535 100644 --- a/suite-native/firmware/src/components/FirmwareInfoScreenFooter.tsx +++ b/suite-native/firmware/src/components/FirmwareInfoScreenFooter.tsx @@ -1,9 +1,7 @@ import { useSelector } from 'react-redux'; -import { - selectHasDeviceFirmwareInstalled, - selectHasRunningDiscovery, -} from '@suite-common/wallet-core'; +import { selectHasDeviceFirmwareInstalled } from '@suite-common/device'; +import { selectHasRunningDiscovery } from '@suite-common/wallet-core'; import { Button, VStack } from '@suite-native/atoms'; import { Translation } from '@suite-native/intl'; diff --git a/suite-native/firmware/src/components/FirmwareLanguageCard.tsx b/suite-native/firmware/src/components/FirmwareLanguageCard.tsx index 1913236597..c8d99c78ae 100644 --- a/suite-native/firmware/src/components/FirmwareLanguageCard.tsx +++ b/suite-native/firmware/src/components/FirmwareLanguageCard.tsx @@ -1,12 +1,12 @@ import { useMemo } from 'react'; import { useSelector } from 'react-redux'; -import { Locale } from '@suite-common/suite-types'; import { selectDeviceLanguage, selectIsDeviceLanguageConfigurable, selectSupportedDeviceLanguages, -} from '@suite-common/wallet-core'; +} from '@suite-common/device'; +import { Locale } from '@suite-common/suite-types'; import { Badge, Card, HStack, Select, Text, VStack } from '@suite-native/atoms'; import { Icon } from '@suite-native/icons'; import { Translation } from '@suite-native/intl'; diff --git a/suite-native/firmware/src/components/FirmwareVersionCard.tsx b/suite-native/firmware/src/components/FirmwareVersionCard.tsx index 56f29a910b..74bca4d7ce 100644 --- a/suite-native/firmware/src/components/FirmwareVersionCard.tsx +++ b/suite-native/firmware/src/components/FirmwareVersionCard.tsx @@ -7,7 +7,7 @@ import { selectDeviceUpdateFirmwareVersion, selectHasBitcoinOnlyFirmware, selectIsFirmwareUpgradable, -} from '@suite-common/wallet-core'; +} from '@suite-common/device'; import { Box, Card, diff --git a/suite-native/firmware/src/firmwareThunks.ts b/suite-native/firmware/src/firmwareThunks.ts index 29d1e72725..d35872ef3b 100644 --- a/suite-native/firmware/src/firmwareThunks.ts +++ b/suite-native/firmware/src/firmwareThunks.ts @@ -1,5 +1,5 @@ +import { deviceActions, selectSelectedDevice } from '@suite-common/device'; import { createThunk } from '@suite-common/redux-utils'; -import { deviceActions, selectSelectedDevice } from '@suite-common/wallet-core'; const NATIVE_FIRMWARE_MODULE_PREFIX = 'nativeFirmware'; diff --git a/suite-native/firmware/src/hooks/useFirmware.tsx b/suite-native/firmware/src/hooks/useFirmware.tsx index cd7693e8d6..6141b03da6 100644 --- a/suite-native/firmware/src/hooks/useFirmware.tsx +++ b/suite-native/firmware/src/hooks/useFirmware.tsx @@ -1,8 +1,8 @@ import { useCallback, useEffect, useMemo, useRef, useState } from 'react'; import { useDispatch, useSelector } from 'react-redux'; +import { selectIsDeviceConnectedViaBluetooth } from '@suite-common/device'; import { FirmwareUpdateResult, useFirmwareInstallation } from '@suite-common/firmware'; -import { selectIsDeviceConnectedViaBluetooth } from '@suite-common/wallet-core'; import { TxKeyPath, useTranslate } from '@suite-native/intl'; import { setPriorityMode } from '@trezor/react-native-usb'; diff --git a/suite-native/firmware/src/hooks/useFirmwareAnalytics.ts b/suite-native/firmware/src/hooks/useFirmwareAnalytics.ts index 84f787f345..9a87380111 100644 --- a/suite-native/firmware/src/hooks/useFirmwareAnalytics.ts +++ b/suite-native/firmware/src/hooks/useFirmwareAnalytics.ts @@ -1,8 +1,8 @@ import { useCallback, useEffect, useRef } from 'react'; import { useSelector } from 'react-redux'; +import { selectDeviceUpdateFirmwareVersion } from '@suite-common/device'; import { TrezorDevice } from '@suite-common/suite-types'; -import { selectDeviceUpdateFirmwareVersion } from '@suite-common/wallet-core'; import { FirmwareUpdatePayload, FirmwareUpdateStartType, events } from '@suite-native/analytics'; import { useAnalytics } from '@suite-native/services'; import { FirmwareType } from '@trezor/connect'; diff --git a/suite-native/firmware/tsconfig.json b/suite-native/firmware/tsconfig.json index 47d2d40e49..760032a93d 100644 --- a/suite-native/firmware/tsconfig.json +++ b/suite-native/firmware/tsconfig.json @@ -2,6 +2,7 @@ "extends": "../../tsconfig.base.json", "compilerOptions": { "outDir": "libDev" }, "references": [ + { "path": "../../suite-common/device" }, { "path": "../../suite-common/firmware" }, { "path": "../../suite-common/icons" }, { diff --git a/suite-native/graph/package.json b/suite-native/graph/package.json index a5707b16d7..d192da50ff 100644 --- a/suite-native/graph/package.json +++ b/suite-native/graph/package.json @@ -16,6 +16,7 @@ "@reduxjs/toolkit": "2.11.2", "@sentry/react-native": "7.11.0", "@shopify/react-native-skia": "2.2.12", + "@suite-common/device": "workspace:*", "@suite-common/formatters": "workspace:*", "@suite-common/graph": "workspace:*", "@suite-common/redux-utils": "workspace:*", diff --git a/suite-native/graph/src/selectors.ts b/suite-native/graph/src/selectors.ts index b4af24adba..abe4c77650 100644 --- a/suite-native/graph/src/selectors.ts +++ b/suite-native/graph/src/selectors.ts @@ -1,5 +1,6 @@ import { A } from '@mobily/ts-belt'; +import type { DeviceRootState } from '@suite-common/device'; import { AccountItem } from '@suite-common/graph'; import { isIgnoredBalanceHistoryCoin } from '@suite-common/graph/src/constants'; import { createWeakMapSelector } from '@suite-common/redux-utils'; @@ -10,7 +11,6 @@ import { import { NetworkSymbol } from '@suite-common/wallet-config'; import { AccountsRootState, - DeviceRootState, selectAccountByKey, selectDeviceMainnetAccounts, } from '@suite-common/wallet-core'; diff --git a/suite-native/graph/src/slice.ts b/suite-native/graph/src/slice.ts index 375eedbcfd..5451361627 100644 --- a/suite-native/graph/src/slice.ts +++ b/suite-native/graph/src/slice.ts @@ -2,7 +2,7 @@ import { G } from '@mobily/ts-belt'; import { PayloadAction, createSlice } from '@reduxjs/toolkit'; import { createTransform } from 'redux-persist'; -import { deviceActions } from '@suite-common/wallet-core'; +import { deviceActions } from '@suite-common/device'; import { AccountKey } from '@suite-common/wallet-types'; import { filterKeysByPartialMatch, selectDeviceStatesNotRemembered } from '@suite-native/storage'; diff --git a/suite-native/graph/src/tests/selectors.test.ts b/suite-native/graph/src/tests/selectors.test.ts index d252d946cd..4e6b706cc5 100644 --- a/suite-native/graph/src/tests/selectors.test.ts +++ b/suite-native/graph/src/tests/selectors.test.ts @@ -1,10 +1,7 @@ +import type { DeviceRootState } from '@suite-common/device'; import { TokenDefinitionsRootState } from '@suite-common/token-definitions'; import { NetworkSymbol } from '@suite-common/wallet-config'; -import { - AccountsRootState, - DeviceRootState, - selectDeviceMainnetAccounts, -} from '@suite-common/wallet-core'; +import { AccountsRootState, selectDeviceMainnetAccounts } from '@suite-common/wallet-core'; import { Account } from '@suite-common/wallet-types'; import { selectDeviceHistoryIgnoredNetworkSymbols } from '../selectors'; diff --git a/suite-native/graph/tsconfig.json b/suite-native/graph/tsconfig.json index 1fe429470c..6dc0a9e007 100644 --- a/suite-native/graph/tsconfig.json +++ b/suite-native/graph/tsconfig.json @@ -2,6 +2,7 @@ "extends": "../../tsconfig.base.json", "compilerOptions": { "outDir": "libDev" }, "references": [ + { "path": "../../suite-common/device" }, { "path": "../../suite-common/formatters" }, diff --git a/suite-native/labeling/package.json b/suite-native/labeling/package.json index c631ce5ff3..14c477198d 100644 --- a/suite-native/labeling/package.json +++ b/suite-native/labeling/package.json @@ -13,6 +13,7 @@ "@gorhom/bottom-sheet": "5.2.6", "@react-navigation/native": "7.1.26", "@reduxjs/toolkit": "2.11.2", + "@suite-common/device": "workspace:*", "@suite-common/suite-sync": "workspace:*", "@suite-common/validators": "workspace:*", "@suite-common/wallet-config": "workspace:*", diff --git a/suite-native/labeling/src/hooks/useTurnOnSuiteSyncGuard.tsx b/suite-native/labeling/src/hooks/useTurnOnSuiteSyncGuard.tsx index 09e56b6c6b..b1dc801bc2 100644 --- a/suite-native/labeling/src/hooks/useTurnOnSuiteSyncGuard.tsx +++ b/suite-native/labeling/src/hooks/useTurnOnSuiteSyncGuard.tsx @@ -2,8 +2,8 @@ import { useSelector } from 'react-redux'; import { useNavigation } from '@react-navigation/native'; +import { selectDeviceStaticSessionId } from '@suite-common/device'; import { WithSuiteSyncAndDeviceState, selectSuiteSyncInteraction } from '@suite-common/suite-sync'; -import { selectDeviceStaticSessionId } from '@suite-common/wallet-core'; import { useAlert } from '@suite-native/alerts'; import { Translation } from '@suite-native/intl'; import { diff --git a/suite-native/labeling/src/selectors.ts b/suite-native/labeling/src/selectors.ts index 37043c53f7..33eda95772 100644 --- a/suite-native/labeling/src/selectors.ts +++ b/suite-native/labeling/src/selectors.ts @@ -1,3 +1,4 @@ +import { selectSelectedDevice } from '@suite-common/device'; import { SuiteSyncDataRootState, WithSuiteSyncAndDeviceState, @@ -6,11 +7,7 @@ import { } from '@suite-common/suite-sync'; import { getIsSuiteSyncLabelingActionEnabled } from '@suite-common/suite-sync/src/suiteSyncUtils'; import { NetworkSymbol } from '@suite-common/wallet-config'; -import { - AccountsRootState, - selectAccountByKey, - selectSelectedDevice, -} from '@suite-common/wallet-core'; +import { AccountsRootState, selectAccountByKey } from '@suite-common/wallet-core'; import { AccountDescriptor, createAccountKey } from '@suite-common/wallet-types'; import { parseDeviceStaticSessionId } from '@suite-common/wallet-utils'; import { SettingsSliceRootState, selectIsExperimentalFeatureEnabled } from '@suite-native/settings'; diff --git a/suite-native/labeling/tsconfig.json b/suite-native/labeling/tsconfig.json index 9ee31bcbab..f8eaee0f33 100644 --- a/suite-native/labeling/tsconfig.json +++ b/suite-native/labeling/tsconfig.json @@ -2,6 +2,7 @@ "extends": "../../tsconfig.base.json", "compilerOptions": { "outDir": "libDev" }, "references": [ + { "path": "../../suite-common/device" }, { "path": "../../suite-common/suite-sync" }, diff --git a/suite-native/message-system/package.json b/suite-native/message-system/package.json index c0b716393a..2d82d243ac 100644 --- a/suite-native/message-system/package.json +++ b/suite-native/message-system/package.json @@ -13,6 +13,7 @@ "dependencies": { "@mobily/ts-belt": "^3.13.1", "@reduxjs/toolkit": "2.11.2", + "@suite-common/device": "workspace:*", "@suite-common/geolocation": "workspace:*", "@suite-common/message-system": "workspace:*", "@suite-common/redux-utils": "workspace:*", diff --git a/suite-native/message-system/src/messageSystemMiddleware.ts b/suite-native/message-system/src/messageSystemMiddleware.ts index 8964b49078..59354a1eb8 100644 --- a/suite-native/message-system/src/messageSystemMiddleware.ts +++ b/suite-native/message-system/src/messageSystemMiddleware.ts @@ -1,5 +1,6 @@ import { isAnyOf } from '@reduxjs/toolkit'; +import { deviceActions, selectSelectedDevice } from '@suite-common/device'; import { geolocationActions, selectCountryCode } from '@suite-common/geolocation'; import { categorizeMessages, @@ -9,7 +10,7 @@ import { selectMessageSystemConfig, } from '@suite-common/message-system'; import { createMiddleware } from '@suite-common/redux-utils'; -import { changeNetworks, deviceActions, selectSelectedDevice } from '@suite-common/wallet-core'; +import { changeNetworks } from '@suite-common/wallet-core'; import { selectDeviceEnabledDiscoveryNetworkSymbols } from '@suite-native/discovery'; const isAnyOfMessageSystemAffectingActions = isAnyOf( diff --git a/suite-native/message-system/tsconfig.json b/suite-native/message-system/tsconfig.json index f3d1d99ca1..8e9a2e46f2 100644 --- a/suite-native/message-system/tsconfig.json +++ b/suite-native/message-system/tsconfig.json @@ -2,6 +2,7 @@ "extends": "../../tsconfig.base.json", "compilerOptions": { "outDir": "libDev" }, "references": [ + { "path": "../../suite-common/device" }, { "path": "../../suite-common/geolocation" }, diff --git a/suite-native/module-accounts-import/package.json b/suite-native/module-accounts-import/package.json index 028be2dfa4..701cccf6c5 100644 --- a/suite-native/module-accounts-import/package.json +++ b/suite-native/module-accounts-import/package.json @@ -17,6 +17,7 @@ "@reduxjs/toolkit": "2.11.2", "@shopify/flash-list": "2.2.0", "@shopify/react-native-skia": "2.2.12", + "@suite-common/device": "workspace:*", "@suite-common/redux-utils": "workspace:*", "@suite-common/token-definitions": "workspace:*", "@suite-common/validators": "workspace:*", diff --git a/suite-native/module-accounts-import/src/accountsImportThunks.ts b/suite-native/module-accounts-import/src/accountsImportThunks.ts index c8efdeddc7..e919b2a2f0 100644 --- a/suite-native/module-accounts-import/src/accountsImportThunks.ts +++ b/suite-native/module-accounts-import/src/accountsImportThunks.ts @@ -1,3 +1,4 @@ +import { PORTFOLIO_TRACKER_DEVICE_STATE } from '@suite-common/device'; import { createThunk } from '@suite-common/redux-utils'; import { getSupportedDefinitionTypes, @@ -8,7 +9,6 @@ import { } from '@suite-common/token-definitions'; import { type AccountType, type Bip43Path, type NetworkSymbol } from '@suite-common/wallet-config'; import { - PORTFOLIO_TRACKER_DEVICE_STATE, accountsActions, selectAccountsByNetworkAndDeviceState, updateFiatRatesThunk, diff --git a/suite-native/module-accounts-import/src/components/AccountImportConfirmFormScreen.tsx b/suite-native/module-accounts-import/src/components/AccountImportConfirmFormScreen.tsx index 0f6d48183f..ec8923e289 100644 --- a/suite-native/module-accounts-import/src/components/AccountImportConfirmFormScreen.tsx +++ b/suite-native/module-accounts-import/src/components/AccountImportConfirmFormScreen.tsx @@ -4,6 +4,7 @@ import { useDispatch, useSelector } from 'react-redux'; import { useNavigation } from '@react-navigation/native'; import { FlashList } from '@shopify/flash-list'; +import { PORTFOLIO_TRACKER_DEVICE_STATE } from '@suite-common/device'; import { TokenDefinitionsRootState, selectFilterKnownTokens, @@ -11,7 +12,6 @@ import { import { type NetworkSymbol, getNetwork } from '@suite-common/wallet-config'; import { AccountsRootState, - PORTFOLIO_TRACKER_DEVICE_STATE, selectAccountsByNetworkAndDeviceState, } from '@suite-common/wallet-core'; import { TokenAddress, TokenSymbol } from '@suite-common/wallet-types'; diff --git a/suite-native/module-accounts-import/src/screens/AccountImportSummaryScreen.tsx b/suite-native/module-accounts-import/src/screens/AccountImportSummaryScreen.tsx index 8da94d7534..c9aae35c0e 100644 --- a/suite-native/module-accounts-import/src/screens/AccountImportSummaryScreen.tsx +++ b/suite-native/module-accounts-import/src/screens/AccountImportSummaryScreen.tsx @@ -1,8 +1,8 @@ import { useSelector } from 'react-redux'; +import type { DeviceRootState } from '@suite-common/device'; import { AccountsRootState, - DeviceRootState, selectDeviceAccountByDescriptorAndNetworkSymbol, } from '@suite-common/wallet-core'; import { ErrorMessage } from '@suite-native/atoms'; diff --git a/suite-native/module-accounts-import/tsconfig.json b/suite-native/module-accounts-import/tsconfig.json index 4605d0bb16..947d293166 100644 --- a/suite-native/module-accounts-import/tsconfig.json +++ b/suite-native/module-accounts-import/tsconfig.json @@ -2,6 +2,7 @@ "extends": "../../tsconfig.base.json", "compilerOptions": { "outDir": "libDev" }, "references": [ + { "path": "../../suite-common/device" }, { "path": "../../suite-common/redux-utils" }, diff --git a/suite-native/module-accounts-management/package.json b/suite-native/module-accounts-management/package.json index 0b7ad30dc4..efe99f63a5 100644 --- a/suite-native/module-accounts-management/package.json +++ b/suite-native/module-accounts-management/package.json @@ -13,6 +13,7 @@ "@react-navigation/native": "7.1.26", "@react-navigation/native-stack": "7.9.0", "@reduxjs/toolkit": "2.11.2", + "@suite-common/device": "workspace:*", "@suite-common/fiat-services": "workspace:*", "@suite-common/graph": "workspace:*", "@suite-common/suite-sync": "workspace:*", diff --git a/suite-native/module-accounts-management/src/components/AccountDetailHeader.tsx b/suite-native/module-accounts-management/src/components/AccountDetailHeader.tsx index ed7b9e5eb3..394a0df8ad 100644 --- a/suite-native/module-accounts-management/src/components/AccountDetailHeader.tsx +++ b/suite-native/module-accounts-management/src/components/AccountDetailHeader.tsx @@ -2,11 +2,11 @@ import { useSelector } from 'react-redux'; import { useAtomValue } from 'jotai'; +import type { DeviceRootState } from '@suite-common/device'; import { TokenDefinitionsRootState } from '@suite-common/token-definitions'; import { type NetworkSymbol } from '@suite-common/wallet-config'; import { AccountsRootState, - DeviceRootState, TransactionsRootState, selectAccountByKey, selectAccountFormattedBalance, diff --git a/suite-native/module-accounts-management/src/components/AccountSettingsShowXpubButton.tsx b/suite-native/module-accounts-management/src/components/AccountSettingsShowXpubButton.tsx index 909f04ebf8..64f0b13db5 100644 --- a/suite-native/module-accounts-management/src/components/AccountSettingsShowXpubButton.tsx +++ b/suite-native/module-accounts-management/src/components/AccountSettingsShowXpubButton.tsx @@ -1,13 +1,8 @@ import { useCallback } from 'react'; import { useSelector } from 'react-redux'; -import { - AccountsRootState, - selectAccountByKey, - selectIsDeviceBackupRequired, - selectSelectedDevice, - showXpubOnDevice, -} from '@suite-common/wallet-core'; +import { selectIsDeviceBackupRequired, selectSelectedDevice } from '@suite-common/device'; +import { AccountsRootState, selectAccountByKey, showXpubOnDevice } from '@suite-common/wallet-core'; import { AccountKey } from '@suite-common/wallet-types'; import { isAddressBasedNetwork } from '@suite-common/wallet-utils'; import { useAlert } from '@suite-native/alerts'; diff --git a/suite-native/module-accounts-management/src/components/TransactionListHeader.tsx b/suite-native/module-accounts-management/src/components/TransactionListHeader.tsx index 327bd7d826..5fa9e6ddaf 100644 --- a/suite-native/module-accounts-management/src/components/TransactionListHeader.tsx +++ b/suite-native/module-accounts-management/src/components/TransactionListHeader.tsx @@ -3,11 +3,11 @@ import { useSelector } from 'react-redux'; import { useNavigation } from '@react-navigation/native'; +import { selectIsPortfolioTrackerDevice } from '@suite-common/device'; import { AccountsRootState, TransactionsRootState, selectAccountByKey, - selectIsPortfolioTrackerDevice, selectIsTestnetAccount, useDisplayBaseCurrency, } from '@suite-common/wallet-core'; diff --git a/suite-native/module-accounts-management/src/screens/AccountDetailScreen.tsx b/suite-native/module-accounts-management/src/screens/AccountDetailScreen.tsx index 554037a325..097e2530ee 100644 --- a/suite-native/module-accounts-management/src/screens/AccountDetailScreen.tsx +++ b/suite-native/module-accounts-management/src/screens/AccountDetailScreen.tsx @@ -3,9 +3,9 @@ import { useSelector } from 'react-redux'; import { RouteProp, useRoute } from '@react-navigation/native'; +import type { DeviceRootState } from '@suite-common/device'; import { AccountsRootState, - DeviceRootState, selectAccountByKey, selectDeviceAccountKeyForNetworkSymbolAndAccountTypeWithIndex, } from '@suite-common/wallet-core'; diff --git a/suite-native/module-accounts-management/src/screens/AccountSettingsScreen.tsx b/suite-native/module-accounts-management/src/screens/AccountSettingsScreen.tsx index d9ae3dc52e..2eb0f984a5 100644 --- a/suite-native/module-accounts-management/src/screens/AccountSettingsScreen.tsx +++ b/suite-native/module-accounts-management/src/screens/AccountSettingsScreen.tsx @@ -1,12 +1,12 @@ import { ReactNode } from 'react'; import { useSelector } from 'react-redux'; +import { selectIsPortfolioTrackerDevice } from '@suite-common/device'; import { NetworkSymbol, networks } from '@suite-common/wallet-config'; import { AccountsRootState, selectAccountByKey, selectFormattedAccountType, - selectIsPortfolioTrackerDevice, } from '@suite-common/wallet-core'; import { Box, Card, HStack, Text, VStack } from '@suite-native/atoms'; import { CryptoIcon } from '@suite-native/icons'; diff --git a/suite-native/module-accounts-management/tsconfig.json b/suite-native/module-accounts-management/tsconfig.json index 1b434a1e95..27be3a0092 100644 --- a/suite-native/module-accounts-management/tsconfig.json +++ b/suite-native/module-accounts-management/tsconfig.json @@ -2,6 +2,7 @@ "extends": "../../tsconfig.base.json", "compilerOptions": { "outDir": "libDev" }, "references": [ + { "path": "../../suite-common/device" }, { "path": "../../suite-common/fiat-services" }, diff --git a/suite-native/module-add-accounts/package.json b/suite-native/module-add-accounts/package.json index 17ccfe2f98..771878a30f 100644 --- a/suite-native/module-add-accounts/package.json +++ b/suite-native/module-add-accounts/package.json @@ -15,6 +15,7 @@ "@react-navigation/native": "7.1.26", "@react-navigation/native-stack": "7.9.0", "@reduxjs/toolkit": "2.11.2", + "@suite-common/device": "workspace:*", "@suite-common/wallet-config": "workspace:*", "@suite-common/wallet-core": "workspace:*", "@suite-common/wallet-types": "workspace:*", diff --git a/suite-native/module-add-accounts/src/hooks/useAddCoinAccount.ts b/suite-native/module-add-accounts/src/hooks/useAddCoinAccount.ts index 1f92c250c9..107d96c50f 100644 --- a/suite-native/module-add-accounts/src/hooks/useAddCoinAccount.ts +++ b/suite-native/module-add-accounts/src/hooks/useAddCoinAccount.ts @@ -4,6 +4,11 @@ import { useDispatch, useSelector } from 'react-redux'; import { A, pipe } from '@mobily/ts-belt'; import { CommonActions, useNavigation, useRoute } from '@react-navigation/native'; +import { + type DeviceRootState, + selectIsDeviceInViewOnlyMode, + selectSelectedDevice, +} from '@suite-common/device'; import { type AccountType, NORMAL_ACCOUNT_TYPE, @@ -13,11 +18,8 @@ import { } from '@suite-common/wallet-config'; import { AccountsRootState, - DeviceRootState, accountsActions, selectDeviceAccounts, - selectIsDeviceInViewOnlyMode, - selectSelectedDevice, } from '@suite-common/wallet-core'; import { Account } from '@suite-common/wallet-types'; import { useAccountAlerts } from '@suite-native/accounts'; diff --git a/suite-native/module-add-accounts/src/screens/AddCoinDiscoveryFinishedScreen.tsx b/suite-native/module-add-accounts/src/screens/AddCoinDiscoveryFinishedScreen.tsx index 29c4ad7cce..dd5a570fe8 100644 --- a/suite-native/module-add-accounts/src/screens/AddCoinDiscoveryFinishedScreen.tsx +++ b/suite-native/module-add-accounts/src/screens/AddCoinDiscoveryFinishedScreen.tsx @@ -1,11 +1,8 @@ import { useSelector } from 'react-redux'; +import type { DeviceRootState } from '@suite-common/device'; import { getNetwork } from '@suite-common/wallet-config'; -import { - AccountsRootState, - DeviceRootState, - selectDeviceAccountsByNetworkSymbol, -} from '@suite-common/wallet-core'; +import { AccountsRootState, selectDeviceAccountsByNetworkSymbol } from '@suite-common/wallet-core'; import { Account } from '@suite-common/wallet-types'; import { AccountsListItem } from '@suite-native/accounts'; import { Box, Button, Card, Text, TextDivider } from '@suite-native/atoms'; diff --git a/suite-native/module-add-accounts/src/screens/AddCoinDiscoveryRunningScreen.tsx b/suite-native/module-add-accounts/src/screens/AddCoinDiscoveryRunningScreen.tsx index 4538a81c56..b4ce160e48 100644 --- a/suite-native/module-add-accounts/src/screens/AddCoinDiscoveryRunningScreen.tsx +++ b/suite-native/module-add-accounts/src/screens/AddCoinDiscoveryRunningScreen.tsx @@ -3,10 +3,10 @@ import { useDispatch, useSelector } from 'react-redux'; import { useNavigation } from '@react-navigation/native'; +import type { DeviceRootState } from '@suite-common/device'; import { getNetwork } from '@suite-common/wallet-config'; import { AccountsRootState, - DeviceRootState, changeCoinVisibility, selectDeviceAccountsByNetworkSymbol, selectDiscoveryForSelectedDevice, diff --git a/suite-native/module-add-accounts/tsconfig.json b/suite-native/module-add-accounts/tsconfig.json index 262a436fae..6851b3f92b 100644 --- a/suite-native/module-add-accounts/tsconfig.json +++ b/suite-native/module-add-accounts/tsconfig.json @@ -5,6 +5,7 @@ "outDir": "libDev" }, "references": [ + { "path": "../../suite-common/device" }, { "path": "../../suite-common/wallet-config" }, diff --git a/suite-native/module-authenticity-checks/package.json b/suite-native/module-authenticity-checks/package.json index 46eb9c0e5b..d1056bd645 100644 --- a/suite-native/module-authenticity-checks/package.json +++ b/suite-native/module-authenticity-checks/package.json @@ -13,6 +13,7 @@ "dependencies": { "@react-navigation/native": "7.1.26", "@reduxjs/toolkit": "2.11.2", + "@suite-common/device": "workspace:*", "@suite-common/suite-utils": "workspace:*", "@suite-common/wallet-core": "workspace:*", "@suite-native/atoms": "workspace:*", diff --git a/suite-native/module-authenticity-checks/src/components/DeviceAuthenticityCheckFailModalContent.tsx b/suite-native/module-authenticity-checks/src/components/DeviceAuthenticityCheckFailModalContent.tsx index 0d1cde3ed8..d8166c5ad1 100644 --- a/suite-native/module-authenticity-checks/src/components/DeviceAuthenticityCheckFailModalContent.tsx +++ b/suite-native/module-authenticity-checks/src/components/DeviceAuthenticityCheckFailModalContent.tsx @@ -1,6 +1,6 @@ import { useDispatch, useSelector } from 'react-redux'; -import { deviceActions, selectSelectedDevice } from '@suite-common/wallet-core'; +import { deviceActions, selectSelectedDevice } from '@suite-common/device'; import { Translation } from '@suite-native/intl'; import { ScreenHeader, useNavigateToInitialScreen } from '@suite-native/navigation'; import { TREZOR_SUPPORT_DEVICE_AUTHENTICATION_FAILED_MOBILE_URL } from '@trezor/urls'; diff --git a/suite-native/module-authenticity-checks/src/components/FirmwareAuthenticityCheckFailModalContent.tsx b/suite-native/module-authenticity-checks/src/components/FirmwareAuthenticityCheckFailModalContent.tsx index 79005cacdc..e15939fbf7 100644 --- a/suite-native/module-authenticity-checks/src/components/FirmwareAuthenticityCheckFailModalContent.tsx +++ b/suite-native/module-authenticity-checks/src/components/FirmwareAuthenticityCheckFailModalContent.tsx @@ -2,13 +2,13 @@ import { useDispatch, useSelector } from 'react-redux'; import { useNavigation } from '@react-navigation/native'; -import { getDeviceInternalModel } from '@suite-common/suite-utils'; import { deviceActions, - selectIsAnyNetworkEnabled, selectIsDeviceInitialized, selectSelectedDevice, -} from '@suite-common/wallet-core'; +} from '@suite-common/device'; +import { getDeviceInternalModel } from '@suite-common/suite-utils'; +import { selectIsAnyNetworkEnabled } from '@suite-common/wallet-core'; import { Button } from '@suite-native/atoms'; import { selectIsDeviceSetupSupported } from '@suite-native/device'; import { Translation } from '@suite-native/intl'; diff --git a/suite-native/module-authenticity-checks/tsconfig.json b/suite-native/module-authenticity-checks/tsconfig.json index bff09b0fe4..357448c8e0 100644 --- a/suite-native/module-authenticity-checks/tsconfig.json +++ b/suite-native/module-authenticity-checks/tsconfig.json @@ -2,6 +2,7 @@ "extends": "../../tsconfig.base.json", "compilerOptions": { "outDir": "libDev" }, "references": [ + { "path": "../../suite-common/device" }, { "path": "../../suite-common/suite-utils" }, diff --git a/suite-native/module-authorize-device/package.json b/suite-native/module-authorize-device/package.json index 47c90ed691..0487e21e23 100644 --- a/suite-native/module-authorize-device/package.json +++ b/suite-native/module-authorize-device/package.json @@ -15,6 +15,7 @@ "@reduxjs/toolkit": "2.11.2", "@suite-common/analytics": "workspace:*", "@suite-common/bluetooth": "workspace:*", + "@suite-common/device": "workspace:*", "@suite-common/redux-utils": "workspace:*", "@suite-common/thp": "workspace:*", "@suite-common/wallet-core": "workspace:*", diff --git a/suite-native/module-authorize-device/src/components/connect/ConnectDeviceScreen.tsx b/suite-native/module-authorize-device/src/components/connect/ConnectDeviceScreen.tsx index e2d6ac09ec..0afcf5eeec 100644 --- a/suite-native/module-authorize-device/src/components/connect/ConnectDeviceScreen.tsx +++ b/suite-native/module-authorize-device/src/components/connect/ConnectDeviceScreen.tsx @@ -3,7 +3,7 @@ import { useSelector } from 'react-redux'; import { useFocusEffect } from '@react-navigation/native'; -import { selectIsDeviceAuthorized } from '@suite-common/wallet-core'; +import { selectIsDeviceAuthorized } from '@suite-common/device'; import { ConnectDeviceScreenHeader } from '@suite-native/device-authorization'; import { CloseActionType, Screen, useNavigateToInitialScreen } from '@suite-native/navigation'; import TrezorConnect, { DEVICE } from '@trezor/connect'; diff --git a/suite-native/module-authorize-device/src/hooks/useInitiateThpConnection.ts b/suite-native/module-authorize-device/src/hooks/useInitiateThpConnection.ts index c728e0a495..9c798715d6 100644 --- a/suite-native/module-authorize-device/src/hooks/useInitiateThpConnection.ts +++ b/suite-native/module-authorize-device/src/hooks/useInitiateThpConnection.ts @@ -3,7 +3,8 @@ import { useDispatch, useSelector } from 'react-redux'; import { useNavigation } from '@react-navigation/native'; import { NativeStackNavigationProp } from '@react-navigation/native-stack'; -import { acquireDevice, selectSelectedDevice } from '@suite-common/wallet-core'; +import { selectSelectedDevice } from '@suite-common/device'; +import { acquireDevice } from '@suite-common/wallet-core'; import { AuthorizeDeviceStackParamList, AuthorizeDeviceStackRoutes, diff --git a/suite-native/module-authorize-device/src/screens/connect/DeviceConnectionGuardScreen.tsx b/suite-native/module-authorize-device/src/screens/connect/DeviceConnectionGuardScreen.tsx index 9a395a345e..85cb46b00b 100644 --- a/suite-native/module-authorize-device/src/screens/connect/DeviceConnectionGuardScreen.tsx +++ b/suite-native/module-authorize-device/src/screens/connect/DeviceConnectionGuardScreen.tsx @@ -7,7 +7,7 @@ import { selectIsBluetoothSupportedByDevice, selectIsDeviceAuthorized, selectIsDeviceConnected, -} from '@suite-common/wallet-core'; +} from '@suite-common/device'; import { selectBluetoothPermissionStatus } from '@suite-native/bluetooth'; import { ConnectAndUnlockDeviceScreenContent, diff --git a/suite-native/module-authorize-device/src/screens/connect/PinScreen.tsx b/suite-native/module-authorize-device/src/screens/connect/PinScreen.tsx index ff20f8d587..76a99c8e29 100644 --- a/suite-native/module-authorize-device/src/screens/connect/PinScreen.tsx +++ b/suite-native/module-authorize-device/src/screens/connect/PinScreen.tsx @@ -3,7 +3,7 @@ import { useSelector } from 'react-redux'; import { useFocusEffect, useNavigation } from '@react-navigation/native'; -import { selectDeviceModel } from '@suite-common/wallet-core'; +import { selectDeviceModel } from '@suite-common/device'; import { DeviceAuthorizationStep, PinOnKeypad, diff --git a/suite-native/module-authorize-device/src/selectors.ts b/suite-native/module-authorize-device/src/selectors.ts index 6680e29460..03bbd90277 100644 --- a/suite-native/module-authorize-device/src/selectors.ts +++ b/suite-native/module-authorize-device/src/selectors.ts @@ -1,3 +1,4 @@ +import { DeviceRootState, selectIsDeviceThpLocked } from '@suite-common/device'; import { createWeakMapSelector } from '@suite-common/redux-utils'; import { ThpRootState, @@ -5,7 +6,6 @@ import { selectThpLastResult, selectThpStep, } from '@suite-common/thp'; -import { DeviceRootState, selectIsDeviceThpLocked } from '@suite-common/wallet-core'; const createMemoizedSelector = createWeakMapSelector.withTypes(); diff --git a/suite-native/module-authorize-device/tsconfig.json b/suite-native/module-authorize-device/tsconfig.json index 41b83396e1..ead7bcf330 100644 --- a/suite-native/module-authorize-device/tsconfig.json +++ b/suite-native/module-authorize-device/tsconfig.json @@ -8,6 +8,7 @@ { "path": "../../suite-common/bluetooth" }, + { "path": "../../suite-common/device" }, { "path": "../../suite-common/redux-utils" }, diff --git a/suite-native/module-check-backup/package.json b/suite-native/module-check-backup/package.json index c7f9088c18..01fe923503 100644 --- a/suite-native/module-check-backup/package.json +++ b/suite-native/module-check-backup/package.json @@ -14,8 +14,8 @@ "@react-navigation/native": "7.1.26", "@react-navigation/native-stack": "7.9.0", "@reduxjs/toolkit": "2.11.2", + "@suite-common/device": "workspace:*", "@suite-common/redux-utils": "workspace:*", - "@suite-common/wallet-core": "workspace:*", "@suite-native/alerts": "workspace:*", "@suite-native/analytics": "workspace:*", "@suite-native/atoms": "workspace:*", diff --git a/suite-native/module-check-backup/src/checkBackupThunks.ts b/suite-native/module-check-backup/src/checkBackupThunks.ts index 276d185947..576683061f 100644 --- a/suite-native/module-check-backup/src/checkBackupThunks.ts +++ b/suite-native/module-check-backup/src/checkBackupThunks.ts @@ -1,5 +1,5 @@ +import { selectSelectedDevice } from '@suite-common/device'; import { createThunk } from '@suite-common/redux-utils'; -import { selectSelectedDevice } from '@suite-common/wallet-core'; import { requestPrioritizedDeviceAccess } from '@suite-native/device-mutex'; import TrezorConnect from '@trezor/connect'; diff --git a/suite-native/module-check-backup/src/navigation/DeviceCheckBackupStackNavigator.tsx b/suite-native/module-check-backup/src/navigation/DeviceCheckBackupStackNavigator.tsx index 506b2b056e..138be61baa 100644 --- a/suite-native/module-check-backup/src/navigation/DeviceCheckBackupStackNavigator.tsx +++ b/suite-native/module-check-backup/src/navigation/DeviceCheckBackupStackNavigator.tsx @@ -2,7 +2,7 @@ import { useSelector } from 'react-redux'; import { createNativeStackNavigator } from '@react-navigation/native-stack'; -import { selectDeviceModel, selectIsDeviceConnected } from '@suite-common/wallet-core'; +import { selectDeviceModel, selectIsDeviceConnected } from '@suite-common/device'; import { DeviceConnectionGuardScreen } from '@suite-native/device-authorization'; import { DeviceCheckBackupStackParamList, diff --git a/suite-native/module-check-backup/tsconfig.json b/suite-native/module-check-backup/tsconfig.json index 6d2c852453..f40bfe6d0a 100644 --- a/suite-native/module-check-backup/tsconfig.json +++ b/suite-native/module-check-backup/tsconfig.json @@ -2,12 +2,10 @@ "extends": "../../tsconfig.base.json", "compilerOptions": { "outDir": "libDev" }, "references": [ + { "path": "../../suite-common/device" }, { "path": "../../suite-common/redux-utils" }, - { - "path": "../../suite-common/wallet-core" - }, { "path": "../alerts" }, { "path": "../analytics" }, { "path": "../atoms" }, diff --git a/suite-native/module-connect-popup/package.json b/suite-native/module-connect-popup/package.json index 542d6625b6..ef7277d9c7 100644 --- a/suite-native/module-connect-popup/package.json +++ b/suite-native/module-connect-popup/package.json @@ -13,6 +13,7 @@ "@react-navigation/native": "7.1.26", "@reduxjs/toolkit": "2.11.2", "@suite-common/connect-popup": "workspace:^", + "@suite-common/device": "workspace:*", "@suite-common/formatters": "workspace:*", "@suite-common/tx-simulation": "workspace:^", "@suite-common/wallet-config": "workspace:^", diff --git a/suite-native/module-connect-popup/src/components/AddressConfirmation.tsx b/suite-native/module-connect-popup/src/components/AddressConfirmation.tsx index f43aa45dbb..24af674b22 100644 --- a/suite-native/module-connect-popup/src/components/AddressConfirmation.tsx +++ b/suite-native/module-connect-popup/src/components/AddressConfirmation.tsx @@ -6,7 +6,7 @@ import { getPermissionDeferred, selectConnectPopupCall, } from '@suite-common/connect-popup'; -import { selectSelectedDevice, selectSelectedDeviceLabelOrName } from '@suite-common/wallet-core'; +import { selectSelectedDevice, selectSelectedDeviceLabelOrName } from '@suite-common/device'; import { Button, Card, HStack, IconButton, Text, TitleHeader, VStack } from '@suite-native/atoms'; import { Translation } from '@suite-native/intl'; diff --git a/suite-native/module-connect-popup/src/components/ButtonRequestsOverlay.tsx b/suite-native/module-connect-popup/src/components/ButtonRequestsOverlay.tsx index 2b2e6e1053..ab91ede963 100644 --- a/suite-native/module-connect-popup/src/components/ButtonRequestsOverlay.tsx +++ b/suite-native/module-connect-popup/src/components/ButtonRequestsOverlay.tsx @@ -1,6 +1,6 @@ import { useSelector } from 'react-redux'; -import { selectSelectedDevice } from '@suite-common/wallet-core'; +import { selectSelectedDevice } from '@suite-common/device'; import { Box } from '@suite-native/atoms'; import { ConfirmOnTrezorImage } from '@suite-native/confirm-on-trezor'; import { Translation } from '@suite-native/intl'; diff --git a/suite-native/module-connect-popup/src/components/ConnectErrorMessage.tsx b/suite-native/module-connect-popup/src/components/ConnectErrorMessage.tsx index 0aad7a0d93..13d678c728 100644 --- a/suite-native/module-connect-popup/src/components/ConnectErrorMessage.tsx +++ b/suite-native/module-connect-popup/src/components/ConnectErrorMessage.tsx @@ -3,7 +3,7 @@ import { useDispatch, useSelector } from 'react-redux'; import { useNavigation } from '@react-navigation/native'; import { connectPopupCallThunkInner, selectConnectPopupCall } from '@suite-common/connect-popup'; -import { selectSelectedDevice } from '@suite-common/wallet-core'; +import { selectSelectedDevice } from '@suite-common/device'; import { Box, Button, Card, PictogramTitleHeader, VStack } from '@suite-native/atoms'; import { Translation } from '@suite-native/intl'; diff --git a/suite-native/module-connect-popup/src/screens/ConnectPopupScreen.tsx b/suite-native/module-connect-popup/src/screens/ConnectPopupScreen.tsx index 0577eef2b6..4aa28a8e1c 100644 --- a/suite-native/module-connect-popup/src/screens/ConnectPopupScreen.tsx +++ b/suite-native/module-connect-popup/src/screens/ConnectPopupScreen.tsx @@ -6,10 +6,10 @@ import { useNavigation } from '@react-navigation/native'; import { connectPopupActions, selectConnectPopupCall } from '@suite-common/connect-popup'; import { ConnectPopupCall } from '@suite-common/connect-popup/src/connectPopupTypes'; import { - selectHasRunningDiscovery, selectIsDeviceConnectedAndAuthorized, selectIsPortfolioTrackerDevice, -} from '@suite-common/wallet-core'; +} from '@suite-common/device'; +import { selectHasRunningDiscovery } from '@suite-common/wallet-core'; import { Box, Loader } from '@suite-native/atoms'; import { DeviceManager } from '@suite-native/device-manager'; import { Translation } from '@suite-native/intl'; diff --git a/suite-native/module-connect-popup/tsconfig.json b/suite-native/module-connect-popup/tsconfig.json index aa16abcf2f..ae86eb6b4f 100644 --- a/suite-native/module-connect-popup/tsconfig.json +++ b/suite-native/module-connect-popup/tsconfig.json @@ -5,6 +5,7 @@ { "path": "../../suite-common/connect-popup" }, + { "path": "../../suite-common/device" }, { "path": "../../suite-common/formatters" }, diff --git a/suite-native/module-device-onboarding/package.json b/suite-native/module-device-onboarding/package.json index a4cf3d12b8..843b37b9ac 100644 --- a/suite-native/module-device-onboarding/package.json +++ b/suite-native/module-device-onboarding/package.json @@ -17,6 +17,7 @@ "@react-navigation/native-stack": "7.9.0", "@reduxjs/toolkit": "2.11.2", "@shopify/react-native-skia": "2.2.12", + "@suite-common/device": "workspace:*", "@suite-common/message-system": "workspace:*", "@suite-common/suite-constants": "workspace:*", "@suite-common/suite-types": "workspace:*", diff --git a/suite-native/module-device-onboarding/src/components/SecuritySealDescription.tsx b/suite-native/module-device-onboarding/src/components/SecuritySealDescription.tsx index 363257283b..32165aa72b 100644 --- a/suite-native/module-device-onboarding/src/components/SecuritySealDescription.tsx +++ b/suite-native/module-device-onboarding/src/components/SecuritySealDescription.tsx @@ -1,6 +1,6 @@ import { useSelector } from 'react-redux'; -import { selectDeviceModel } from '@suite-common/wallet-core'; +import { selectDeviceModel } from '@suite-common/device'; import { events } from '@suite-native/analytics'; import { BottomSheetModal, diff --git a/suite-native/module-device-onboarding/src/components/SecuritySealImages.tsx b/suite-native/module-device-onboarding/src/components/SecuritySealImages.tsx index 8e1d135801..5291b139b7 100644 --- a/suite-native/module-device-onboarding/src/components/SecuritySealImages.tsx +++ b/suite-native/module-device-onboarding/src/components/SecuritySealImages.tsx @@ -1,6 +1,6 @@ import { useSelector } from 'react-redux'; -import { selectDeviceModel } from '@suite-common/wallet-core'; +import { selectDeviceModel } from '@suite-common/device'; import { Box, HStack, Image, InlineAlertBox, VStack } from '@suite-native/atoms'; import { SetupSupportingDeviceModel } from '@suite-native/device'; import { Translation } from '@suite-native/intl'; diff --git a/suite-native/module-device-onboarding/src/hooks/useExitAlert.ts b/suite-native/module-device-onboarding/src/hooks/useExitAlert.ts index ca6e454cb4..af2db70118 100644 --- a/suite-native/module-device-onboarding/src/hooks/useExitAlert.ts +++ b/suite-native/module-device-onboarding/src/hooks/useExitAlert.ts @@ -3,7 +3,7 @@ import { useDispatch, useSelector } from 'react-redux'; import { useNavigation } from '@react-navigation/native'; -import { selectSelectedDevice } from '@suite-common/wallet-core'; +import { selectSelectedDevice } from '@suite-common/device'; import { useAlert } from '@suite-native/alerts'; import { setWasDeviceOnboardingCancelled } from '@suite-native/device-onboarding'; import { useFirmware } from '@suite-native/firmware'; diff --git a/suite-native/module-device-onboarding/src/hooks/useNavigateToNextScreenAfterFirmwareInstallation.ts b/suite-native/module-device-onboarding/src/hooks/useNavigateToNextScreenAfterFirmwareInstallation.ts index 381f53f20c..11f74be381 100644 --- a/suite-native/module-device-onboarding/src/hooks/useNavigateToNextScreenAfterFirmwareInstallation.ts +++ b/suite-native/module-device-onboarding/src/hooks/useNavigateToNextScreenAfterFirmwareInstallation.ts @@ -2,9 +2,9 @@ import { useSelector } from 'react-redux'; import { useNavigation } from '@react-navigation/native'; +import { selectDeviceModel, selectDeviceUnavailableCapabilities } from '@suite-common/device'; import { SUPPORTS_DEVICE_AUTHENTICITY_CHECK } from '@suite-common/suite-constants'; import { selectThpStep } from '@suite-common/thp'; -import { selectDeviceModel, selectDeviceUnavailableCapabilities } from '@suite-common/wallet-core'; import { DeviceOnboardingStackParamList, DeviceOnboardingStackRoutes, diff --git a/suite-native/module-device-onboarding/src/hooks/useOnDeviceOnboardingFinishedNavigation.tsx b/suite-native/module-device-onboarding/src/hooks/useOnDeviceOnboardingFinishedNavigation.tsx index 3d1b73635c..1200c5a65b 100644 --- a/suite-native/module-device-onboarding/src/hooks/useOnDeviceOnboardingFinishedNavigation.tsx +++ b/suite-native/module-device-onboarding/src/hooks/useOnDeviceOnboardingFinishedNavigation.tsx @@ -3,7 +3,8 @@ import { useSelector } from 'react-redux'; import { useNavigation } from '@react-navigation/native'; -import { selectHasBitcoinOnlyFirmware, selectIsAnyNetworkEnabled } from '@suite-common/wallet-core'; +import { selectHasBitcoinOnlyFirmware } from '@suite-common/device'; +import { selectIsAnyNetworkEnabled } from '@suite-common/wallet-core'; import { AppTabsRoutes, AuthorizeDeviceStackRoutes, diff --git a/suite-native/module-device-onboarding/src/hooks/useOnWalletRecapFinishedNavigation.tsx b/suite-native/module-device-onboarding/src/hooks/useOnWalletRecapFinishedNavigation.tsx index e5332d3e40..abc9f59c55 100644 --- a/suite-native/module-device-onboarding/src/hooks/useOnWalletRecapFinishedNavigation.tsx +++ b/suite-native/module-device-onboarding/src/hooks/useOnWalletRecapFinishedNavigation.tsx @@ -3,7 +3,7 @@ import { useSelector } from 'react-redux'; import { useNavigation } from '@react-navigation/native'; -import { selectIsDeviceProtectedByPin } from '@suite-common/wallet-core'; +import { selectIsDeviceProtectedByPin } from '@suite-common/device'; import { DeviceOnboardingStackParamList, DeviceOnboardingStackRoutes, diff --git a/suite-native/module-device-onboarding/src/hooks/useReportOnboardingSuccessAnalytics.ts b/suite-native/module-device-onboarding/src/hooks/useReportOnboardingSuccessAnalytics.ts index 79ae562644..6195ff8b4e 100644 --- a/suite-native/module-device-onboarding/src/hooks/useReportOnboardingSuccessAnalytics.ts +++ b/suite-native/module-device-onboarding/src/hooks/useReportOnboardingSuccessAnalytics.ts @@ -8,7 +8,7 @@ import { selectDeviceModel, selectIsDeviceBackupRequired, selectIsDeviceProtectedByPin, -} from '@suite-common/wallet-core'; +} from '@suite-common/device'; import { events } from '@suite-native/analytics'; import { useAnalytics } from '@suite-native/services'; diff --git a/suite-native/module-device-onboarding/src/screens/CreatePinScreen.tsx b/suite-native/module-device-onboarding/src/screens/CreatePinScreen.tsx index 5dabdd86bd..e5e3d2b40a 100644 --- a/suite-native/module-device-onboarding/src/screens/CreatePinScreen.tsx +++ b/suite-native/module-device-onboarding/src/screens/CreatePinScreen.tsx @@ -1,7 +1,7 @@ import { useCallback } from 'react'; import { useSelector } from 'react-redux'; -import { selectDeviceModel } from '@suite-common/wallet-core'; +import { selectDeviceModel } from '@suite-common/device'; import { useAlert } from '@suite-native/alerts'; import { Box, TitleHeader, VStack } from '@suite-native/atoms'; import { ConnectorImage, usePinAction } from '@suite-native/device'; diff --git a/suite-native/module-device-onboarding/src/screens/DeviceTutorialScreen.tsx b/suite-native/module-device-onboarding/src/screens/DeviceTutorialScreen.tsx index b00c70e64c..4f055d6fdb 100644 --- a/suite-native/module-device-onboarding/src/screens/DeviceTutorialScreen.tsx +++ b/suite-native/module-device-onboarding/src/screens/DeviceTutorialScreen.tsx @@ -3,7 +3,7 @@ import { useSelector } from 'react-redux'; import { useFocusEffect } from '@react-navigation/native'; -import { selectSelectedDevice } from '@suite-common/wallet-core'; +import { selectSelectedDevice } from '@suite-common/device'; import { ContinueOnTrezorScreenContent } from '@suite-native/device'; import { requestPrioritizedDeviceAccess } from '@suite-native/device-mutex'; import { diff --git a/suite-native/module-device-onboarding/src/screens/FirmwareInfoScreen.tsx b/suite-native/module-device-onboarding/src/screens/FirmwareInfoScreen.tsx index b2c9634f65..980b0865dc 100644 --- a/suite-native/module-device-onboarding/src/screens/FirmwareInfoScreen.tsx +++ b/suite-native/module-device-onboarding/src/screens/FirmwareInfoScreen.tsx @@ -3,7 +3,7 @@ import { useSelector } from 'react-redux'; import { useNavigation } from '@react-navigation/native'; import { useSetAtom } from 'jotai'; -import { selectHasDeviceFirmwareInstalled } from '@suite-common/wallet-core'; +import { selectHasDeviceFirmwareInstalled } from '@suite-common/device'; import { useDeviceLowBatteryAlert } from '@suite-native/device'; import { FirmwareInfoScreenContent, FirmwareInfoScreenFooter } from '@suite-native/firmware'; import { Translation, TxKeyPath } from '@suite-native/intl'; diff --git a/suite-native/module-device-onboarding/src/screens/SuspiciousDeviceScreen.tsx b/suite-native/module-device-onboarding/src/screens/SuspiciousDeviceScreen.tsx index 0b2da0e24c..d53646a8c5 100644 --- a/suite-native/module-device-onboarding/src/screens/SuspiciousDeviceScreen.tsx +++ b/suite-native/module-device-onboarding/src/screens/SuspiciousDeviceScreen.tsx @@ -1,6 +1,6 @@ import { useSelector } from 'react-redux'; -import { selectIsNoPhysicalDeviceConnected } from '@suite-common/wallet-core'; +import { selectIsNoPhysicalDeviceConnected } from '@suite-common/device'; import { Button, IconListTextItem, TitleHeader, VStack } from '@suite-native/atoms'; import { Translation } from '@suite-native/intl'; import { useOpenLink } from '@suite-native/link'; diff --git a/suite-native/module-device-onboarding/src/screens/UninitializedDeviceLandingScreen.tsx b/suite-native/module-device-onboarding/src/screens/UninitializedDeviceLandingScreen.tsx index 8ffa3ecb99..442e829ceb 100644 --- a/suite-native/module-device-onboarding/src/screens/UninitializedDeviceLandingScreen.tsx +++ b/suite-native/module-device-onboarding/src/screens/UninitializedDeviceLandingScreen.tsx @@ -7,7 +7,7 @@ import { useSetAtom } from 'jotai'; import { selectHasDeviceFirmwareInstalled, selectShouldOfferUpdateFirmware, -} from '@suite-common/wallet-core'; +} from '@suite-common/device'; import { events } from '@suite-native/analytics'; import { Box, Button, Text, TextButton, VStack } from '@suite-native/atoms'; import { SetupSupportingDeviceModel, useCoinLabel } from '@suite-native/device'; diff --git a/suite-native/module-device-onboarding/src/screens/WalletBackupTutorialScreen.tsx b/suite-native/module-device-onboarding/src/screens/WalletBackupTutorialScreen.tsx index 67d3ff9205..5e69b978b2 100644 --- a/suite-native/module-device-onboarding/src/screens/WalletBackupTutorialScreen.tsx +++ b/suite-native/module-device-onboarding/src/screens/WalletBackupTutorialScreen.tsx @@ -4,11 +4,8 @@ import { useSelector } from 'react-redux'; import { useNavigation } from '@react-navigation/native'; +import { selectDeviceDefaultBackupType, selectIsDeviceInitialized } from '@suite-common/device'; import { BackupType } from '@suite-common/suite-types'; -import { - selectDeviceDefaultBackupType, - selectIsDeviceInitialized, -} from '@suite-common/wallet-core'; import { DeviceOnboardingStackParamList, DeviceOnboardingStackRoutes, diff --git a/suite-native/module-device-onboarding/src/screens/WalletCreationScreen.tsx b/suite-native/module-device-onboarding/src/screens/WalletCreationScreen.tsx index 6c4d44af14..521af6f415 100644 --- a/suite-native/module-device-onboarding/src/screens/WalletCreationScreen.tsx +++ b/suite-native/module-device-onboarding/src/screens/WalletCreationScreen.tsx @@ -4,12 +4,12 @@ import { useDispatch, useSelector } from 'react-redux'; import { RouteProp, useNavigation, useRoute } from '@react-navigation/native'; import { isFulfilled } from '@reduxjs/toolkit'; +import { getIsIgnoredEntropyCheckError } from '@suite-common/device'; import { Feature, MessageSystemRootState, selectIsFeatureEnabled, } from '@suite-common/message-system'; -import { getIsIgnoredEntropyCheckError } from '@suite-common/wallet-core'; import { ContinueOnTrezorScreenContent, createAndBackupWalletThunk } from '@suite-native/device'; import { DeviceOnboardingStackParamList, diff --git a/suite-native/module-device-onboarding/tsconfig.json b/suite-native/module-device-onboarding/tsconfig.json index f4ef9ca306..ae1f43b1e3 100644 --- a/suite-native/module-device-onboarding/tsconfig.json +++ b/suite-native/module-device-onboarding/tsconfig.json @@ -2,6 +2,7 @@ "extends": "../../tsconfig.base.json", "compilerOptions": { "outDir": "libDev" }, "references": [ + { "path": "../../suite-common/device" }, { "path": "../../suite-common/message-system" }, diff --git a/suite-native/module-device-settings/package.json b/suite-native/module-device-settings/package.json index e6974ea5b0..69afe4435e 100644 --- a/suite-native/module-device-settings/package.json +++ b/suite-native/module-device-settings/package.json @@ -15,6 +15,7 @@ "@react-navigation/native-stack": "7.9.0", "@reduxjs/toolkit": "2.11.2", "@suite-common/analytics": "workspace:*", + "@suite-common/device": "workspace:*", "@suite-common/suite-constants": "workspace:*", "@suite-common/thp": "workspace:*", "@suite-common/validators": "workspace:*", diff --git a/suite-native/module-device-settings/src/components/BackupAndPassphraseCard.tsx b/suite-native/module-device-settings/src/components/BackupAndPassphraseCard.tsx index 45ebc53c2b..66721aa929 100644 --- a/suite-native/module-device-settings/src/components/BackupAndPassphraseCard.tsx +++ b/suite-native/module-device-settings/src/components/BackupAndPassphraseCard.tsx @@ -2,7 +2,7 @@ import { useSelector } from 'react-redux'; import { useNavigation } from '@react-navigation/native'; -import { selectSelectedDevice } from '@suite-common/wallet-core'; +import { selectSelectedDevice } from '@suite-common/device'; import { Translation } from '@suite-native/intl'; import { DeviceSettingsStackParamList, diff --git a/suite-native/module-device-settings/src/components/DeviceFirmwareCard.tsx b/suite-native/module-device-settings/src/components/DeviceFirmwareCard.tsx index 92606ae2e6..c568c0f266 100644 --- a/suite-native/module-device-settings/src/components/DeviceFirmwareCard.tsx +++ b/suite-native/module-device-settings/src/components/DeviceFirmwareCard.tsx @@ -5,11 +5,11 @@ import { useNavigation } from '@react-navigation/native'; import { selectDeviceModel, selectFirmwareReleaseConfig, - selectHasRunningDiscovery, selectIsDeviceBackedUp, selectIsFirmwareUpgradable, selectSelectedDevice, -} from '@suite-common/wallet-core'; +} from '@suite-common/device'; +import { selectHasRunningDiscovery } from '@suite-common/wallet-core'; import { InlineAlertBoxProps } from '@suite-native/atoms'; import { selectIsFirmwareUpdateFeatureEnabled } from '@suite-native/firmware'; import { Translation } from '@suite-native/intl'; diff --git a/suite-native/module-device-settings/src/components/DeviceInfo.tsx b/suite-native/module-device-settings/src/components/DeviceInfo.tsx index a404a07428..c2a44f90f1 100644 --- a/suite-native/module-device-settings/src/components/DeviceInfo.tsx +++ b/suite-native/module-device-settings/src/components/DeviceInfo.tsx @@ -2,7 +2,8 @@ import { useSelector } from 'react-redux'; import { useNavigation } from '@react-navigation/native'; -import { selectHasRunningDiscovery, selectIsDeviceInitialized } from '@suite-common/wallet-core'; +import { selectIsDeviceInitialized } from '@suite-common/device'; +import { selectHasRunningDiscovery } from '@suite-common/wallet-core'; import { HStack, IconButton, Text, VStack } from '@suite-native/atoms'; import { DeviceImage } from '@suite-native/device'; import { useIsMultiline } from '@suite-native/helpers'; diff --git a/suite-native/module-device-settings/src/components/DevicePinProtectionCard.tsx b/suite-native/module-device-settings/src/components/DevicePinProtectionCard.tsx index 5062948fd6..d382ce964c 100644 --- a/suite-native/module-device-settings/src/components/DevicePinProtectionCard.tsx +++ b/suite-native/module-device-settings/src/components/DevicePinProtectionCard.tsx @@ -2,11 +2,8 @@ import { useSelector } from 'react-redux'; import { useNavigation } from '@react-navigation/native'; -import { - selectHasRunningDiscovery, - selectIsDeviceProtectedByPin, - selectSelectedDevice, -} from '@suite-common/wallet-core'; +import { selectIsDeviceProtectedByPin, selectSelectedDevice } from '@suite-common/device'; +import { selectHasRunningDiscovery } from '@suite-common/wallet-core'; import { InlineAlertBoxProps } from '@suite-native/atoms'; import { Translation } from '@suite-native/intl'; import { diff --git a/suite-native/module-device-settings/src/hooks/useChangeDeviceName.ts b/suite-native/module-device-settings/src/hooks/useChangeDeviceName.ts index 1ef8442e1e..370726ba45 100644 --- a/suite-native/module-device-settings/src/hooks/useChangeDeviceName.ts +++ b/suite-native/module-device-settings/src/hooks/useChangeDeviceName.ts @@ -3,7 +3,7 @@ import { useSelector } from 'react-redux'; import { useNavigation } from '@react-navigation/native'; import { events } from '@suite-common/analytics'; -import { selectSelectedDevice } from '@suite-common/wallet-core'; +import { selectSelectedDevice } from '@suite-common/device'; import { useForm } from '@suite-native/forms'; import { useTranslate } from '@suite-native/intl'; import { diff --git a/suite-native/module-device-settings/src/hooks/useDeviceAutoConnect.ts b/suite-native/module-device-settings/src/hooks/useDeviceAutoConnect.ts index 5f8fe1da68..5894c5599e 100644 --- a/suite-native/module-device-settings/src/hooks/useDeviceAutoConnect.ts +++ b/suite-native/module-device-settings/src/hooks/useDeviceAutoConnect.ts @@ -4,11 +4,8 @@ import { useDispatch, useSelector } from 'react-redux'; import { useNavigation } from '@react-navigation/native'; import { isRejected } from '@reduxjs/toolkit'; +import { selectDeviceAutoconnectCredentials, selectIsDeviceConnected } from '@suite-common/device'; import { removeThpCredentialsThunk } from '@suite-common/thp'; -import { - selectDeviceAutoconnectCredentials, - selectIsDeviceConnected, -} from '@suite-common/wallet-core'; import { useTranslate } from '@suite-native/intl'; import { DeviceSettingsStackParamList, diff --git a/suite-native/module-device-settings/src/hooks/useDeviceChangedCheck.ts b/suite-native/module-device-settings/src/hooks/useDeviceChangedCheck.ts index f71b27aaf5..5512e5a1ee 100644 --- a/suite-native/module-device-settings/src/hooks/useDeviceChangedCheck.ts +++ b/suite-native/module-device-settings/src/hooks/useDeviceChangedCheck.ts @@ -3,7 +3,7 @@ import { useSelector } from 'react-redux'; import { useNavigation } from '@react-navigation/native'; -import { selectSelectedDevice } from '@suite-common/wallet-core'; +import { selectSelectedDevice } from '@suite-common/device'; import { AppTabsRoutes, DeviceSettingsStackParamList, diff --git a/suite-native/module-device-settings/src/navigation/DeviceAuthenticityStackNavigator.tsx b/suite-native/module-device-settings/src/navigation/DeviceAuthenticityStackNavigator.tsx index aae9a28e35..20a68fd550 100644 --- a/suite-native/module-device-settings/src/navigation/DeviceAuthenticityStackNavigator.tsx +++ b/suite-native/module-device-settings/src/navigation/DeviceAuthenticityStackNavigator.tsx @@ -4,7 +4,7 @@ import { useSelector } from 'react-redux'; import { useNavigation } from '@react-navigation/native'; import { createNativeStackNavigator } from '@react-navigation/native-stack'; -import { selectIsDeviceConnected } from '@suite-common/wallet-core'; +import { selectIsDeviceConnected } from '@suite-common/device'; import { useDeviceAuthenticityCheck } from '@suite-native/device'; import { DeviceConnectionGuardScreen } from '@suite-native/device-authorization'; import { diff --git a/suite-native/module-device-settings/src/navigation/DeviceAutoConnectStackNavigator.tsx b/suite-native/module-device-settings/src/navigation/DeviceAutoConnectStackNavigator.tsx index 652c551a57..e49b709738 100644 --- a/suite-native/module-device-settings/src/navigation/DeviceAutoConnectStackNavigator.tsx +++ b/suite-native/module-device-settings/src/navigation/DeviceAutoConnectStackNavigator.tsx @@ -2,7 +2,7 @@ import { useSelector } from 'react-redux'; import { createNativeStackNavigator } from '@react-navigation/native-stack'; -import { selectIsDeviceConnected } from '@suite-common/wallet-core'; +import { selectIsDeviceConnected } from '@suite-common/device'; import { DeviceConnectionGuardScreenWithCancel } from '@suite-native/device-authorization'; import { DeviceAutoConnectStackParamList, diff --git a/suite-native/module-device-settings/src/navigation/DeviceNameStackNavigator.tsx b/suite-native/module-device-settings/src/navigation/DeviceNameStackNavigator.tsx index 10458dbe26..a1007ee999 100644 --- a/suite-native/module-device-settings/src/navigation/DeviceNameStackNavigator.tsx +++ b/suite-native/module-device-settings/src/navigation/DeviceNameStackNavigator.tsx @@ -2,7 +2,7 @@ import { useSelector } from 'react-redux'; import { createNativeStackNavigator } from '@react-navigation/native-stack'; -import { selectIsDeviceConnected } from '@suite-common/wallet-core'; +import { selectIsDeviceConnected } from '@suite-common/device'; import { DeviceConnectionGuardScreen } from '@suite-native/device-authorization'; import { DeviceNameStackParamList, diff --git a/suite-native/module-device-settings/src/navigation/DevicePassphraseStackNavigator.tsx b/suite-native/module-device-settings/src/navigation/DevicePassphraseStackNavigator.tsx index 043ac0e035..f1270553a9 100644 --- a/suite-native/module-device-settings/src/navigation/DevicePassphraseStackNavigator.tsx +++ b/suite-native/module-device-settings/src/navigation/DevicePassphraseStackNavigator.tsx @@ -2,7 +2,7 @@ import { useSelector } from 'react-redux'; import { createNativeStackNavigator } from '@react-navigation/native-stack'; -import { selectIsDeviceConnected } from '@suite-common/wallet-core'; +import { selectIsDeviceConnected } from '@suite-common/device'; import { DeviceConnectionGuardScreenWithCancel } from '@suite-native/device-authorization'; import { DevicePassphraseStackParamList, diff --git a/suite-native/module-device-settings/src/navigation/DevicePinProtectionStackNavigator.tsx b/suite-native/module-device-settings/src/navigation/DevicePinProtectionStackNavigator.tsx index d7eecf42fb..769038666e 100644 --- a/suite-native/module-device-settings/src/navigation/DevicePinProtectionStackNavigator.tsx +++ b/suite-native/module-device-settings/src/navigation/DevicePinProtectionStackNavigator.tsx @@ -4,10 +4,7 @@ import { A } from '@mobily/ts-belt'; import { RouteProp, useNavigation, useRoute } from '@react-navigation/native'; import { createNativeStackNavigator } from '@react-navigation/native-stack'; -import { - selectDeviceButtonRequestsCodes, - selectIsDeviceConnected, -} from '@suite-common/wallet-core'; +import { selectDeviceButtonRequestsCodes, selectIsDeviceConnected } from '@suite-common/device'; import { usePinAction } from '@suite-native/device'; import { DeviceConnectionGuardScreen } from '@suite-native/device-authorization'; import { diff --git a/suite-native/module-device-settings/src/navigation/DeviceSettingsStackNavigator.tsx b/suite-native/module-device-settings/src/navigation/DeviceSettingsStackNavigator.tsx index 702dea5dfe..718492d8c6 100644 --- a/suite-native/module-device-settings/src/navigation/DeviceSettingsStackNavigator.tsx +++ b/suite-native/module-device-settings/src/navigation/DeviceSettingsStackNavigator.tsx @@ -2,7 +2,7 @@ import { useSelector } from 'react-redux'; import { createNativeStackNavigator } from '@react-navigation/native-stack'; -import { selectIsDeviceConnected } from '@suite-common/wallet-core'; +import { selectIsDeviceConnected } from '@suite-common/device'; // this import is against the rule of not importing from other modules. This specific case is OK, because the @suite-native/module-check-backup // is imported only here and nowhere else, so it is treated as a submodule of @suite-native/module-device-settings. import { DeviceConnectionGuardScreenWithCancel } from '@suite-native/device-authorization'; diff --git a/suite-native/module-device-settings/src/navigation/FirmwareLanguageStackNavigator.tsx b/suite-native/module-device-settings/src/navigation/FirmwareLanguageStackNavigator.tsx index 9c448a77b2..b84ae83f60 100644 --- a/suite-native/module-device-settings/src/navigation/FirmwareLanguageStackNavigator.tsx +++ b/suite-native/module-device-settings/src/navigation/FirmwareLanguageStackNavigator.tsx @@ -2,7 +2,7 @@ import { useSelector } from 'react-redux'; import { createNativeStackNavigator } from '@react-navigation/native-stack'; -import { selectIsDeviceConnected } from '@suite-common/wallet-core'; +import { selectIsDeviceConnected } from '@suite-common/device'; import { DeviceConnectionGuardScreenWithCancel } from '@suite-native/device-authorization'; import { FirmwareLanguageStackParamList, diff --git a/suite-native/module-device-settings/src/navigation/FirmwareUpdateStackNavigator.tsx b/suite-native/module-device-settings/src/navigation/FirmwareUpdateStackNavigator.tsx index 2bdbd25c18..eaa8d0fc0b 100644 --- a/suite-native/module-device-settings/src/navigation/FirmwareUpdateStackNavigator.tsx +++ b/suite-native/module-device-settings/src/navigation/FirmwareUpdateStackNavigator.tsx @@ -2,7 +2,7 @@ import { useSelector } from 'react-redux'; import { createNativeStackNavigator } from '@react-navigation/native-stack'; -import { selectIsDeviceConnected } from '@suite-common/wallet-core'; +import { selectIsDeviceConnected } from '@suite-common/device'; import { DeviceConnectionGuardScreen } from '@suite-native/device-authorization'; import { FirmwareUpdateStackParamList, diff --git a/suite-native/module-device-settings/src/navigation/WipeDeviceStackNavigator.tsx b/suite-native/module-device-settings/src/navigation/WipeDeviceStackNavigator.tsx index d2c28a56ab..c7a8490b67 100644 --- a/suite-native/module-device-settings/src/navigation/WipeDeviceStackNavigator.tsx +++ b/suite-native/module-device-settings/src/navigation/WipeDeviceStackNavigator.tsx @@ -2,7 +2,7 @@ import { useSelector } from 'react-redux'; import { createNativeStackNavigator } from '@react-navigation/native-stack'; -import { selectIsDeviceConnected } from '@suite-common/wallet-core'; +import { selectIsDeviceConnected } from '@suite-common/device'; import { DeviceConnectionGuardScreenWithCancel } from '@suite-native/device-authorization'; import { WipeDeviceStackParamList, diff --git a/suite-native/module-device-settings/src/screens/BackupAndPassphrase/BackupAndPassphraseScreen.tsx b/suite-native/module-device-settings/src/screens/BackupAndPassphrase/BackupAndPassphraseScreen.tsx index 85d64b232c..44fd664e0a 100644 --- a/suite-native/module-device-settings/src/screens/BackupAndPassphrase/BackupAndPassphraseScreen.tsx +++ b/suite-native/module-device-settings/src/screens/BackupAndPassphrase/BackupAndPassphraseScreen.tsx @@ -1,9 +1,6 @@ import { useSelector } from 'react-redux'; -import { - selectIsDeviceBackupUnfinished, - selectIsDeviceInitialized, -} from '@suite-common/wallet-core'; +import { selectIsDeviceBackupUnfinished, selectIsDeviceInitialized } from '@suite-common/device'; import { VStack } from '@suite-native/atoms'; import { Translation } from '@suite-native/intl'; import { DynamicScreenHeader, Screen } from '@suite-native/navigation'; diff --git a/suite-native/module-device-settings/src/screens/BackupAndPassphrase/PassphraseCard.tsx b/suite-native/module-device-settings/src/screens/BackupAndPassphrase/PassphraseCard.tsx index fc88bcb038..2abe882a97 100644 --- a/suite-native/module-device-settings/src/screens/BackupAndPassphrase/PassphraseCard.tsx +++ b/suite-native/module-device-settings/src/screens/BackupAndPassphrase/PassphraseCard.tsx @@ -2,10 +2,7 @@ import { useSelector } from 'react-redux'; import { useNavigation } from '@react-navigation/native'; -import { - selectIsDeviceProtectedByPassphrase, - selectSelectedDevice, -} from '@suite-common/wallet-core'; +import { selectIsDeviceProtectedByPassphrase, selectSelectedDevice } from '@suite-common/device'; import { TouchableSwitchRow } from '@suite-native/atoms'; import { Translation } from '@suite-native/intl'; import { diff --git a/suite-native/module-device-settings/src/screens/DeviceFirmwareScreen.tsx b/suite-native/module-device-settings/src/screens/DeviceFirmwareScreen.tsx index 3d52dd20f9..b75881f874 100644 --- a/suite-native/module-device-settings/src/screens/DeviceFirmwareScreen.tsx +++ b/suite-native/module-device-settings/src/screens/DeviceFirmwareScreen.tsx @@ -1,11 +1,8 @@ import React, { useCallback } from 'react'; import { useSelector } from 'react-redux'; -import { - selectHasRunningDiscovery, - selectIsDeviceBackupRequired, - selectIsFirmwareUpgradable, -} from '@suite-common/wallet-core'; +import { selectIsDeviceBackupRequired, selectIsFirmwareUpgradable } from '@suite-common/device'; +import { selectHasRunningDiscovery } from '@suite-common/wallet-core'; import { useAlert } from '@suite-native/alerts'; import { Button, VStack, useBottomSheetModal } from '@suite-native/atoms'; import { diff --git a/suite-native/module-device-settings/src/screens/DeviceSettingsScreen.tsx b/suite-native/module-device-settings/src/screens/DeviceSettingsScreen.tsx index 68d793ecaa..ba8e8e9acb 100644 --- a/suite-native/module-device-settings/src/screens/DeviceSettingsScreen.tsx +++ b/suite-native/module-device-settings/src/screens/DeviceSettingsScreen.tsx @@ -1,6 +1,5 @@ import { useSelector } from 'react-redux'; -import { SUPPORTS_DEVICE_AUTHENTICITY_CHECK } from '@suite-common/suite-constants'; import { selectDeviceLabel, selectDeviceModel, @@ -8,7 +7,8 @@ import { selectIsDeviceConnectedViaBluetooth, selectIsDeviceInitialized, selectIsThpDevice, -} from '@suite-common/wallet-core'; +} from '@suite-common/device'; +import { SUPPORTS_DEVICE_AUTHENTICITY_CHECK } from '@suite-common/suite-constants'; import { TitledSection, VStack } from '@suite-native/atoms'; import { Translation } from '@suite-native/intl'; import { Screen, ScreenHeader, useNavigateToInitialScreen } from '@suite-native/navigation'; diff --git a/suite-native/module-device-settings/src/screens/PinProtectionScreen.tsx b/suite-native/module-device-settings/src/screens/PinProtectionScreen.tsx index 610439b79e..e4f1a676c4 100644 --- a/suite-native/module-device-settings/src/screens/PinProtectionScreen.tsx +++ b/suite-native/module-device-settings/src/screens/PinProtectionScreen.tsx @@ -1,6 +1,6 @@ import { useSelector } from 'react-redux'; -import { selectIsDeviceProtectedByPin } from '@suite-common/wallet-core'; +import { selectIsDeviceProtectedByPin } from '@suite-common/device'; import { Card, PictogramTitleHeader, VStack } from '@suite-native/atoms'; import { Translation } from '@suite-native/intl'; import { DynamicScreenHeader, Screen } from '@suite-native/navigation'; diff --git a/suite-native/module-device-settings/src/screens/WipeDeviceContinueOnTrezorScreen.tsx b/suite-native/module-device-settings/src/screens/WipeDeviceContinueOnTrezorScreen.tsx index 5265fd831d..378776d8f6 100644 --- a/suite-native/module-device-settings/src/screens/WipeDeviceContinueOnTrezorScreen.tsx +++ b/suite-native/module-device-settings/src/screens/WipeDeviceContinueOnTrezorScreen.tsx @@ -1,7 +1,7 @@ import { useCallback } from 'react'; import { useSelector } from 'react-redux'; -import { selectSelectedDevice } from '@suite-common/wallet-core'; +import { selectSelectedDevice } from '@suite-common/device'; import { Box } from '@suite-native/atoms'; import { ContinueOnTrezorScreenContent, diff --git a/suite-native/module-device-settings/src/screens/WipeDeviceLoadingScreen.tsx b/suite-native/module-device-settings/src/screens/WipeDeviceLoadingScreen.tsx index ef591c42ca..718a40f3e4 100644 --- a/suite-native/module-device-settings/src/screens/WipeDeviceLoadingScreen.tsx +++ b/suite-native/module-device-settings/src/screens/WipeDeviceLoadingScreen.tsx @@ -2,7 +2,7 @@ import { useSelector } from 'react-redux'; import { useNavigation } from '@react-navigation/native'; -import { selectIsDeviceInBootloader } from '@suite-common/wallet-core'; +import { selectIsDeviceInBootloader } from '@suite-common/device'; import { Translation } from '@suite-native/intl'; import { AppTabsRoutes, diff --git a/suite-native/module-device-settings/tsconfig.json b/suite-native/module-device-settings/tsconfig.json index 207e47beb4..3550462fcf 100644 --- a/suite-native/module-device-settings/tsconfig.json +++ b/suite-native/module-device-settings/tsconfig.json @@ -5,6 +5,7 @@ { "path": "../../suite-common/analytics" }, + { "path": "../../suite-common/device" }, { "path": "../../suite-common/suite-constants" }, diff --git a/suite-native/module-earn/package.json b/suite-native/module-earn/package.json index 08775cd093..507f73e6e9 100644 --- a/suite-native/module-earn/package.json +++ b/suite-native/module-earn/package.json @@ -14,6 +14,7 @@ "@react-navigation/native-stack": "7.9.0", "@reduxjs/toolkit": "2.11.2", "@shopify/flash-list": "2.2.0", + "@suite-common/device": "workspace:*", "@suite-common/formatters": "workspace:*", "@suite-common/wallet-config": "workspace:*", "@suite-common/wallet-core": "workspace:*", diff --git a/suite-native/module-earn/src/components/FiveBinariesHomeBanner.tsx b/suite-native/module-earn/src/components/FiveBinariesHomeBanner.tsx index b0920f3e41..03a691aa03 100644 --- a/suite-native/module-earn/src/components/FiveBinariesHomeBanner.tsx +++ b/suite-native/module-earn/src/components/FiveBinariesHomeBanner.tsx @@ -1,6 +1,7 @@ import { useSelector } from 'react-redux'; -import { AccountsRootState, DeviceRootState } from '@suite-common/wallet-core'; +import type { DeviceRootState } from '@suite-common/device'; +import { AccountsRootState } from '@suite-common/wallet-core'; import { InlineAlertBox } from '@suite-native/atoms'; import { Translation } from '@suite-native/intl'; import { useOpenLink } from '@suite-native/link'; diff --git a/suite-native/module-earn/src/hooks/useHandleEarnNavigation.ts b/suite-native/module-earn/src/hooks/useHandleEarnNavigation.ts index b3c83be633..c7dd40c26a 100644 --- a/suite-native/module-earn/src/hooks/useHandleEarnNavigation.ts +++ b/suite-native/module-earn/src/hooks/useHandleEarnNavigation.ts @@ -2,7 +2,7 @@ import { useSelector } from 'react-redux'; import { useNavigation } from '@react-navigation/native'; -import { selectHasBitcoinOnlyFirmware } from '@suite-common/wallet-core'; +import { selectHasBitcoinOnlyFirmware } from '@suite-common/device'; import { Account } from '@suite-common/wallet-types'; import { FeatureFlag, useFeatureFlag } from '@suite-native/feature-flags'; import { diff --git a/suite-native/module-earn/tsconfig.json b/suite-native/module-earn/tsconfig.json index 7e49dbd338..851c556731 100644 --- a/suite-native/module-earn/tsconfig.json +++ b/suite-native/module-earn/tsconfig.json @@ -2,6 +2,7 @@ "extends": "../../tsconfig.base.json", "compilerOptions": { "outDir": "libDev" }, "references": [ + { "path": "../../suite-common/device" }, { "path": "../../suite-common/formatters" }, diff --git a/suite-native/module-home/package.json b/suite-native/module-home/package.json index 5dfe1e17e7..627d197815 100644 --- a/suite-native/module-home/package.json +++ b/suite-native/module-home/package.json @@ -14,6 +14,7 @@ "@react-navigation/native": "7.1.26", "@react-navigation/native-stack": "7.9.0", "@reduxjs/toolkit": "2.11.2", + "@suite-common/device": "workspace:*", "@suite-common/graph": "workspace:*", "@suite-common/message-system": "workspace:*", "@suite-common/redux-utils": "workspace:*", diff --git a/suite-native/module-home/src/screens/HomeScreen/HomeScreen.tsx b/suite-native/module-home/src/screens/HomeScreen/HomeScreen.tsx index 75f5bda2b5..368b14350b 100644 --- a/suite-native/module-home/src/screens/HomeScreen/HomeScreen.tsx +++ b/suite-native/module-home/src/screens/HomeScreen/HomeScreen.tsx @@ -7,8 +7,8 @@ import { selectIsDeviceAuthorized, selectIsDeviceInitialized, selectIsDeviceUnlocked, - selectIsDiscoveredDeviceAccountless, -} from '@suite-common/wallet-core'; +} from '@suite-common/device'; +import { selectIsDiscoveredDeviceAccountless } from '@suite-common/wallet-core'; import { selectIsBluetoothDeviceOsUnpairingRequired, useBluetoothAlerts, diff --git a/suite-native/module-home/src/screens/HomeScreen/components/AutoEjectAnimation.tsx b/suite-native/module-home/src/screens/HomeScreen/components/AutoEjectAnimation.tsx index 1b4ae85db3..72cfb608fd 100644 --- a/suite-native/module-home/src/screens/HomeScreen/components/AutoEjectAnimation.tsx +++ b/suite-native/module-home/src/screens/HomeScreen/components/AutoEjectAnimation.tsx @@ -1,7 +1,7 @@ import React from 'react'; import { useSelector } from 'react-redux'; -import { selectIsBluetoothSupportedByDevice } from '@suite-common/wallet-core'; +import { selectIsBluetoothSupportedByDevice } from '@suite-common/device'; import { LottieAnimation } from '@suite-native/atoms'; import autoEjectCableLottie from '../../../assets/auto-eject-cable-lottie.json'; diff --git a/suite-native/module-home/src/screens/HomeScreen/components/EmptyHomeRenderer.tsx b/suite-native/module-home/src/screens/HomeScreen/components/EmptyHomeRenderer.tsx index 6b39c3a9c8..5c37201548 100644 --- a/suite-native/module-home/src/screens/HomeScreen/components/EmptyHomeRenderer.tsx +++ b/suite-native/module-home/src/screens/HomeScreen/components/EmptyHomeRenderer.tsx @@ -1,13 +1,13 @@ import { useSelector } from 'react-redux'; import { - selectHasOnlyEmptyPortfolioTracker, selectIsDeviceAuthorized, selectIsDeviceConnected, selectIsDeviceInitialized, selectIsDeviceThpLocked, selectIsPortfolioTrackerDevice, -} from '@suite-common/wallet-core'; +} from '@suite-common/device'; +import { selectHasOnlyEmptyPortfolioTracker } from '@suite-common/wallet-core'; import { Box } from '@suite-native/atoms'; import { selectIsDeviceReadyToUse, selectIsDeviceSetupSupported } from '@suite-native/device'; diff --git a/suite-native/module-home/src/screens/HomeScreen/components/FirmwareUpdateAlert.tsx b/suite-native/module-home/src/screens/HomeScreen/components/FirmwareUpdateAlert.tsx index 492c348605..3054f965e3 100644 --- a/suite-native/module-home/src/screens/HomeScreen/components/FirmwareUpdateAlert.tsx +++ b/suite-native/module-home/src/screens/HomeScreen/components/FirmwareUpdateAlert.tsx @@ -5,7 +5,7 @@ import { useSelector } from 'react-redux'; import { useNavigation } from '@react-navigation/native'; import { atom, useAtomValue, useSetAtom } from 'jotai'; -import { selectDeviceId, selectDeviceUpdateFirmwareVersion } from '@suite-common/wallet-core'; +import { selectDeviceId, selectDeviceUpdateFirmwareVersion } from '@suite-common/device'; import { Box, Button, HStack, Text, VStack } from '@suite-native/atoms'; import { Icon } from '@suite-native/icons'; import { Translation } from '@suite-native/intl'; diff --git a/suite-native/module-home/src/screens/HomeScreen/components/PortfolioContent.tsx b/suite-native/module-home/src/screens/HomeScreen/components/PortfolioContent.tsx index b28b10bc7b..0d0bc9852c 100644 --- a/suite-native/module-home/src/screens/HomeScreen/components/PortfolioContent.tsx +++ b/suite-native/module-home/src/screens/HomeScreen/components/PortfolioContent.tsx @@ -4,11 +4,8 @@ import { useSelector } from 'react-redux'; import { useNavigation } from '@react-navigation/native'; -import { - selectHasRunningDiscovery, - selectIsDeviceAuthorized, - selectIsPortfolioTrackerDevice, -} from '@suite-common/wallet-core'; +import { selectIsDeviceAuthorized, selectIsPortfolioTrackerDevice } from '@suite-common/device'; +import { selectHasRunningDiscovery } from '@suite-common/wallet-core'; import { selectHasDeviceAnySendAvailableAccount } from '@suite-native/accounts'; import { Assets } from '@suite-native/assets'; import { AnimatedVStack, Button, HStack, VStack } from '@suite-native/atoms'; diff --git a/suite-native/module-home/src/screens/HomeScreen/components/SuiteSyncKeysAlert.tsx b/suite-native/module-home/src/screens/HomeScreen/components/SuiteSyncKeysAlert.tsx index ae881205db..cbb99226f0 100644 --- a/suite-native/module-home/src/screens/HomeScreen/components/SuiteSyncKeysAlert.tsx +++ b/suite-native/module-home/src/screens/HomeScreen/components/SuiteSyncKeysAlert.tsx @@ -4,7 +4,7 @@ import { useSelector } from 'react-redux'; import { useNavigation } from '@react-navigation/native'; -import { selectDeviceStaticSessionId, selectIsDeviceConnected } from '@suite-common/wallet-core'; +import { selectDeviceStaticSessionId, selectIsDeviceConnected } from '@suite-common/device'; import { Box, Button, Text, VStack } from '@suite-native/atoms'; import { Icon } from '@suite-native/icons'; import { Translation } from '@suite-native/intl'; diff --git a/suite-native/module-home/src/screens/HomeScreen/components/UninitializedConnectedDeviceState.tsx b/suite-native/module-home/src/screens/HomeScreen/components/UninitializedConnectedDeviceState.tsx index d9fff79c25..1d1662d6f8 100644 --- a/suite-native/module-home/src/screens/HomeScreen/components/UninitializedConnectedDeviceState.tsx +++ b/suite-native/module-home/src/screens/HomeScreen/components/UninitializedConnectedDeviceState.tsx @@ -2,7 +2,7 @@ import { useSelector } from 'react-redux'; import { useNavigation } from '@react-navigation/native'; -import { selectDeviceModel } from '@suite-common/wallet-core'; +import { selectDeviceModel } from '@suite-common/device'; import { Box, Button, Card, CenteredTitleHeader, VStack } from '@suite-native/atoms'; import { ConfirmOnTrezorAnimation } from '@suite-native/confirm-on-trezor'; import { Translation } from '@suite-native/intl'; diff --git a/suite-native/module-home/src/screens/HomeScreen/components/__tests__/EmptyHomeRenderer.comp.test.tsx b/suite-native/module-home/src/screens/HomeScreen/components/__tests__/EmptyHomeRenderer.comp.test.tsx index 7634d93319..b59e1dad83 100644 --- a/suite-native/module-home/src/screens/HomeScreen/components/__tests__/EmptyHomeRenderer.comp.test.tsx +++ b/suite-native/module-home/src/screens/HomeScreen/components/__tests__/EmptyHomeRenderer.comp.test.tsx @@ -1,4 +1,4 @@ -import { PORTFOLIO_TRACKER_DEVICE_ID } from '@suite-common/wallet-core'; +import { PORTFOLIO_TRACKER_DEVICE_ID } from '@suite-common/device'; import { PreloadedState, getTranslation, diff --git a/suite-native/module-home/src/screens/HomeScreen/homescreenSelectors.ts b/suite-native/module-home/src/screens/HomeScreen/homescreenSelectors.ts index 159d6acd86..ac274155e1 100644 --- a/suite-native/module-home/src/screens/HomeScreen/homescreenSelectors.ts +++ b/suite-native/module-home/src/screens/HomeScreen/homescreenSelectors.ts @@ -1,3 +1,12 @@ +import { + DeviceRootState, + selectDeviceStaticSessionId, + selectIsDeviceBackedUp, + selectIsDeviceConnected, + selectIsFirmwareUpgradable, + selectIsPortfolioTrackerDevice, + selectShouldOfferUpdateFirmware, +} from '@suite-common/device'; import { MessageSystemRootState } from '@suite-common/message-system'; import { createWeakMapSelector } from '@suite-common/redux-utils'; import { @@ -5,17 +14,7 @@ import { selectHasDeviceSuiteSyncError, selectSuiteSyncInteraction, } from '@suite-common/suite-sync'; -import { - DeviceRootState, - DiscoveryRootState, - selectDeviceStaticSessionId, - selectHasRunningDiscovery, - selectIsDeviceBackedUp, - selectIsDeviceConnected, - selectIsFirmwareUpgradable, - selectIsPortfolioTrackerDevice, - selectShouldOfferUpdateFirmware, -} from '@suite-common/wallet-core'; +import { DiscoveryRootState, selectHasRunningDiscovery } from '@suite-common/wallet-core'; import { selectIsFirmwareUpdateFeatureEnabled } from '@suite-native/firmware'; const createMemoizedSelector = createWeakMapSelector.withTypes< diff --git a/suite-native/module-home/tsconfig.json b/suite-native/module-home/tsconfig.json index fbee37534b..f7ea0db20f 100644 --- a/suite-native/module-home/tsconfig.json +++ b/suite-native/module-home/tsconfig.json @@ -2,6 +2,7 @@ "extends": "../../tsconfig.base.json", "compilerOptions": { "outDir": "libDev" }, "references": [ + { "path": "../../suite-common/device" }, { "path": "../../suite-common/graph" }, { "path": "../../suite-common/message-system" diff --git a/suite-native/module-passphrase/package.json b/suite-native/module-passphrase/package.json index 485f432600..5732f05151 100644 --- a/suite-native/module-passphrase/package.json +++ b/suite-native/module-passphrase/package.json @@ -14,6 +14,7 @@ "@react-navigation/native": "7.1.26", "@react-navigation/native-stack": "7.9.0", "@reduxjs/toolkit": "2.11.2", + "@suite-common/device": "workspace:*", "@suite-common/wallet-core": "workspace:*", "@suite-native/analytics": "workspace:*", "@suite-native/atoms": "workspace:*", diff --git a/suite-native/module-passphrase/src/PassphraseStackNavigator.tsx b/suite-native/module-passphrase/src/PassphraseStackNavigator.tsx index 6c66fbb296..4b81ccd8ed 100644 --- a/suite-native/module-passphrase/src/PassphraseStackNavigator.tsx +++ b/suite-native/module-passphrase/src/PassphraseStackNavigator.tsx @@ -2,7 +2,8 @@ import { useSelector } from 'react-redux'; import { createNativeStackNavigator } from '@react-navigation/native-stack'; -import { selectDiscoveryForSelectedDevice, selectSelectedDevice } from '@suite-common/wallet-core'; +import { selectSelectedDevice } from '@suite-common/device'; +import { selectDiscoveryForSelectedDevice } from '@suite-common/wallet-core'; import { PassphraseStackParamList, PassphraseStackRoutes, diff --git a/suite-native/module-passphrase/src/screens/PassphraseEmptyWalletScreen.tsx b/suite-native/module-passphrase/src/screens/PassphraseEmptyWalletScreen.tsx index 51c00add54..762b81e839 100644 --- a/suite-native/module-passphrase/src/screens/PassphraseEmptyWalletScreen.tsx +++ b/suite-native/module-passphrase/src/screens/PassphraseEmptyWalletScreen.tsx @@ -1,9 +1,9 @@ import { useDispatch, useSelector } from 'react-redux'; +import { selectSelectedDevice } from '@suite-common/device'; import { cancelDiscoveryThunk, runDiscoveryThunk, - selectSelectedDevice, startDiscoveryThunk, } from '@suite-common/wallet-core'; import { events } from '@suite-native/analytics'; diff --git a/suite-native/module-passphrase/src/screens/PassphraseEnterOnTrezorScreen.tsx b/suite-native/module-passphrase/src/screens/PassphraseEnterOnTrezorScreen.tsx index 2c66451504..6222bb6d4d 100644 --- a/suite-native/module-passphrase/src/screens/PassphraseEnterOnTrezorScreen.tsx +++ b/suite-native/module-passphrase/src/screens/PassphraseEnterOnTrezorScreen.tsx @@ -1,6 +1,7 @@ import { useDispatch, useSelector } from 'react-redux'; -import { cancelDiscoveryThunk, selectSelectedDevice } from '@suite-common/wallet-core'; +import { selectSelectedDevice } from '@suite-common/device'; +import { cancelDiscoveryThunk } from '@suite-common/wallet-core'; import { Text } from '@suite-native/atoms'; import { Translation } from '@suite-native/intl'; import { useNavigateToInitialScreen } from '@suite-native/navigation'; diff --git a/suite-native/module-passphrase/tsconfig.json b/suite-native/module-passphrase/tsconfig.json index 4e2b9fdb8c..a8c9da7263 100644 --- a/suite-native/module-passphrase/tsconfig.json +++ b/suite-native/module-passphrase/tsconfig.json @@ -2,6 +2,7 @@ "extends": "../../tsconfig.base.json", "compilerOptions": { "outDir": "libDev" }, "references": [ + { "path": "../../suite-common/device" }, { "path": "../../suite-common/wallet-core" }, diff --git a/suite-native/module-send/package.json b/suite-native/module-send/package.json index 0215adad60..35358c39fc 100644 --- a/suite-native/module-send/package.json +++ b/suite-native/module-send/package.json @@ -17,6 +17,7 @@ "@react-navigation/native-stack": "7.9.0", "@reduxjs/toolkit": "2.11.2", "@shopify/flash-list": "2.2.0", + "@suite-common/device": "workspace:*", "@suite-common/formatters": "workspace:*", "@suite-common/token-definitions": "workspace:*", "@suite-common/validators": "workspace:*", diff --git a/suite-native/module-send/src/components/FiatAmountInput.tsx b/suite-native/module-send/src/components/FiatAmountInput.tsx index 280eec74ac..f7e6292084 100644 --- a/suite-native/module-send/src/components/FiatAmountInput.tsx +++ b/suite-native/module-send/src/components/FiatAmountInput.tsx @@ -1,9 +1,9 @@ import { useSelector } from 'react-redux'; +import type { DeviceRootState } from '@suite-common/device'; import { TokenDefinitionsRootState } from '@suite-common/token-definitions'; import { getNetwork } from '@suite-common/wallet-config'; import { - DeviceRootState, TransactionsRootState, WalletSettingsRootState, selectBaseCurrency, diff --git a/suite-native/module-send/src/hooks/__tests__/useRequestDelayedNavigationToOutputsReview.hook.test.ts b/suite-native/module-send/src/hooks/__tests__/useRequestDelayedNavigationToOutputsReview.hook.test.ts index db8f641f09..e5cf77c746 100644 --- a/suite-native/module-send/src/hooks/__tests__/useRequestDelayedNavigationToOutputsReview.hook.test.ts +++ b/suite-native/module-send/src/hooks/__tests__/useRequestDelayedNavigationToOutputsReview.hook.test.ts @@ -6,8 +6,8 @@ import { useRequestDelayedNavigationToOutputsReview } from '../useRequestDelayed const mockSelectDeviceButtonRequestsCodes = jest.fn().mockReturnValue([]); const mockNavigate = jest.fn(); -jest.mock('@suite-common/wallet-core', () => ({ - ...jest.requireActual('@suite-common/wallet-core'), +jest.mock('@suite-common/device', () => ({ + ...jest.requireActual('@suite-common/device'), selectDeviceButtonRequestsCodes: () => mockSelectDeviceButtonRequestsCodes(), })); diff --git a/suite-native/module-send/src/hooks/useHandleOnDeviceTransactionReview.tsx b/suite-native/module-send/src/hooks/useHandleOnDeviceTransactionReview.tsx index ad555370ac..96a4ec6fcc 100644 --- a/suite-native/module-send/src/hooks/useHandleOnDeviceTransactionReview.tsx +++ b/suite-native/module-send/src/hooks/useHandleOnDeviceTransactionReview.tsx @@ -4,7 +4,8 @@ import { useDispatch, useSelector } from 'react-redux'; import { useNavigation } from '@react-navigation/native'; import { isRejected } from '@reduxjs/toolkit'; -import { selectIsDeviceRemembered, sendFormActions } from '@suite-common/wallet-core'; +import { selectIsDeviceRemembered } from '@suite-common/device'; +import { sendFormActions } from '@suite-common/wallet-core'; import { AccountKey, GeneralPrecomposedTransactionFinal, diff --git a/suite-native/module-send/src/hooks/useSendForm.ts b/suite-native/module-send/src/hooks/useSendForm.ts index 8f351fc747..4e4db2e524 100644 --- a/suite-native/module-send/src/hooks/useSendForm.ts +++ b/suite-native/module-send/src/hooks/useSendForm.ts @@ -7,6 +7,7 @@ import { D, pipe } from '@mobily/ts-belt'; import { useNavigation } from '@react-navigation/native'; import { isFulfilled } from '@reduxjs/toolkit'; +import { selectDeviceUnavailableCapabilities } from '@suite-common/device'; import { getDisplaySymbol, getNetwork } from '@suite-common/wallet-config'; import { AccountsRootState, @@ -16,7 +17,6 @@ import { composeSendFormTransactionFeeLevelsThunk, selectAccountByKey, selectConvertedNetworkFeeInfo, - selectDeviceUnavailableCapabilities, selectIsAmountInSats, selectSendFormDraftByKey, sendFormActions, diff --git a/suite-native/module-send/tsconfig.json b/suite-native/module-send/tsconfig.json index 252161b974..bc1fe77222 100644 --- a/suite-native/module-send/tsconfig.json +++ b/suite-native/module-send/tsconfig.json @@ -2,6 +2,7 @@ "extends": "../../tsconfig.base.json", "compilerOptions": { "outDir": "libDev" }, "references": [ + { "path": "../../suite-common/device" }, { "path": "../../suite-common/formatters" }, diff --git a/suite-native/module-settings/package.json b/suite-native/module-settings/package.json index 96ba48f0a7..ef7d061bd5 100644 --- a/suite-native/module-settings/package.json +++ b/suite-native/module-settings/package.json @@ -17,6 +17,7 @@ "@reduxjs/toolkit": "2.11.2", "@suite-common/analytics": "workspace:*", "@suite-common/analytics-redux": "workspace:*", + "@suite-common/device": "workspace:*", "@suite-common/logger": "workspace:*", "@suite-common/mev": "workspace:*", "@suite-common/redux-utils": "workspace:*", @@ -26,7 +27,6 @@ "@suite-common/validators": "workspace:*", "@suite-common/wallet-config": "workspace:*", "@suite-common/wallet-core": "workspace:*", - "@suite-common/wallet-utils": "workspace:*", "@suite-native/alerts": "workspace:*", "@suite-native/analytics": "workspace:*", "@suite-native/atoms": "workspace:*", diff --git a/suite-native/module-settings/src/components/ConnectionSettings.tsx b/suite-native/module-settings/src/components/ConnectionSettings.tsx index b0ee1437b0..ec24af1057 100644 --- a/suite-native/module-settings/src/components/ConnectionSettings.tsx +++ b/suite-native/module-settings/src/components/ConnectionSettings.tsx @@ -2,7 +2,7 @@ import { useSelector } from 'react-redux'; import { useNavigation } from '@react-navigation/native'; -import { selectIsPortfolioTrackerDevice } from '@suite-common/wallet-core'; +import { selectIsPortfolioTrackerDevice } from '@suite-common/device'; import { Box, Card, diff --git a/suite-native/module-settings/src/components/EjectWallets/AutoEjectSwitch.tsx b/suite-native/module-settings/src/components/EjectWallets/AutoEjectSwitch.tsx index 74dc4ae7a0..5cb105e279 100644 --- a/suite-native/module-settings/src/components/EjectWallets/AutoEjectSwitch.tsx +++ b/suite-native/module-settings/src/components/EjectWallets/AutoEjectSwitch.tsx @@ -1,10 +1,7 @@ import { useDispatch, useSelector } from 'react-redux'; -import { - selectIsDeviceAutoEjectEnabled, - selectIsNoPhysicalDeviceConnected, - toggleAutoEjectThunk, -} from '@suite-common/wallet-core'; +import { selectIsNoPhysicalDeviceConnected } from '@suite-common/device'; +import { selectIsDeviceAutoEjectEnabled, toggleAutoEjectThunk } from '@suite-common/wallet-core'; import { useAlert } from '@suite-native/alerts'; import { events } from '@suite-native/analytics'; import { TouchableSwitchRow } from '@suite-native/atoms'; diff --git a/suite-native/module-settings/src/components/EjectWallets/DevicesManagement.tsx b/suite-native/module-settings/src/components/EjectWallets/DevicesManagement.tsx index cc6cb9bdd3..7f29537157 100644 --- a/suite-native/module-settings/src/components/EjectWallets/DevicesManagement.tsx +++ b/suite-native/module-settings/src/components/EjectWallets/DevicesManagement.tsx @@ -1,7 +1,6 @@ import { useSelector } from 'react-redux'; -import { selectPhysicalDevicesGrouppedById } from '@suite-common/wallet-core'; -import { shouldDeviceBeRemembered } from '@suite-common/wallet-utils'; +import { selectPhysicalDevicesGrouppedById, shouldDeviceBeRemembered } from '@suite-common/device'; import { Box, Card, Divider, HStack, Text, VStack } from '@suite-native/atoms'; import { ConnectionDot } from '@suite-native/device-manager'; import { DeviceModelIcon } from '@suite-native/icons'; diff --git a/suite-native/module-settings/src/components/EjectWallets/WalletRememberModeIconButton.tsx b/suite-native/module-settings/src/components/EjectWallets/WalletRememberModeIconButton.tsx index 7d0614e90c..bafb840a29 100644 --- a/suite-native/module-settings/src/components/EjectWallets/WalletRememberModeIconButton.tsx +++ b/suite-native/module-settings/src/components/EjectWallets/WalletRememberModeIconButton.tsx @@ -1,8 +1,9 @@ import Animated, { FadeIn, FadeOut } from 'react-native-reanimated'; import { useDispatch, useSelector } from 'react-redux'; +import { deviceActions } from '@suite-common/device'; import { TrezorDevice } from '@suite-common/suite-types'; -import { deviceActions, selectIsDeviceAutoEjectEnabled } from '@suite-common/wallet-core'; +import { selectIsDeviceAutoEjectEnabled } from '@suite-common/wallet-core'; import { IconButton } from '@suite-native/atoms'; import { Translation } from '@suite-native/intl'; import { useToast } from '@suite-native/toasts'; diff --git a/suite-native/module-settings/src/components/ToggleSuiteSyncCard.tsx b/suite-native/module-settings/src/components/ToggleSuiteSyncCard.tsx index 077a1a471e..a59c50b745 100644 --- a/suite-native/module-settings/src/components/ToggleSuiteSyncCard.tsx +++ b/suite-native/module-settings/src/components/ToggleSuiteSyncCard.tsx @@ -2,8 +2,8 @@ import { useContext } from 'react'; import { useSelector } from 'react-redux'; import { events } from '@suite-common/analytics'; +import { selectSelectedDevice } from '@suite-common/device'; import { selectIsSuiteSyncEnabled } from '@suite-common/suite-sync'; -import { selectSelectedDevice } from '@suite-common/wallet-core'; import { useAlert } from '@suite-native/alerts'; import { TouchableSwitchRow } from '@suite-native/atoms'; import { Translation } from '@suite-native/intl'; diff --git a/suite-native/module-settings/src/screens/SettingsCoinEnablingScreen.tsx b/suite-native/module-settings/src/screens/SettingsCoinEnablingScreen.tsx index daeee9e27f..20b4d4110b 100644 --- a/suite-native/module-settings/src/screens/SettingsCoinEnablingScreen.tsx +++ b/suite-native/module-settings/src/screens/SettingsCoinEnablingScreen.tsx @@ -1,6 +1,6 @@ import { useSelector } from 'react-redux'; -import { selectHasBitcoinOnlyFirmware } from '@suite-common/wallet-core'; +import { selectHasBitcoinOnlyFirmware } from '@suite-common/device'; import { BtcOnlyCoinEnablingContent, CoinEnablingForm } from '@suite-native/coin-enabling'; import { selectDiscoveryNetworkSymbols } from '@suite-native/discovery'; import { Translation } from '@suite-native/intl'; diff --git a/suite-native/module-settings/tsconfig.json b/suite-native/module-settings/tsconfig.json index 21972e6cdb..e58ff7dca2 100644 --- a/suite-native/module-settings/tsconfig.json +++ b/suite-native/module-settings/tsconfig.json @@ -8,6 +8,7 @@ { "path": "../../suite-common/analytics-redux" }, + { "path": "../../suite-common/device" }, { "path": "../../suite-common/logger" }, { "path": "../../suite-common/mev" }, { @@ -31,9 +32,6 @@ { "path": "../../suite-common/wallet-core" }, - { - "path": "../../suite-common/wallet-utils" - }, { "path": "../alerts" }, { "path": "../analytics" }, { "path": "../atoms" }, diff --git a/suite-native/module-stellar-token-management/package.json b/suite-native/module-stellar-token-management/package.json index 52d88bbb53..b0770f50b6 100644 --- a/suite-native/module-stellar-token-management/package.json +++ b/suite-native/module-stellar-token-management/package.json @@ -15,6 +15,7 @@ "@react-navigation/native": "7.1.26", "@react-navigation/native-stack": "7.9.0", "@reduxjs/toolkit": "2.11.2", + "@suite-common/device": "workspace:*", "@suite-common/redux-utils": "workspace:*", "@suite-common/token-definitions": "workspace:*", "@suite-common/wallet-config": "workspace:*", diff --git a/suite-native/module-stellar-token-management/src/hooks/__tests__/useStellarFeeScreen.test.ts b/suite-native/module-stellar-token-management/src/hooks/__tests__/useStellarFeeScreen.test.ts index 38327f1347..9e5cc40ed1 100644 --- a/suite-native/module-stellar-token-management/src/hooks/__tests__/useStellarFeeScreen.test.ts +++ b/suite-native/module-stellar-token-management/src/hooks/__tests__/useStellarFeeScreen.test.ts @@ -86,11 +86,15 @@ jest.mock('@suite-native/atoms', () => ({ }), })); +jest.mock('@suite-common/device', () => ({ + ...jest.requireActual('@suite-common/device'), + selectDeviceButtonRequestsCodes: jest.fn(), + selectIsDeviceConnectedAndAuthorized: jest.fn(), +})); + jest.mock('@suite-common/wallet-core', () => ({ ...jest.requireActual('@suite-common/wallet-core'), selectAccountByKey: jest.fn(), - selectDeviceButtonRequestsCodes: jest.fn(), - selectIsDeviceConnectedAndAuthorized: jest.fn(), selectDeepCopyOfFormDraft: jest.fn(), fetchAndUpdateAccountThunk: jest.fn(), })); @@ -134,12 +138,10 @@ jest.mock('../../thunks', () => ({ })); const mockSelectAccountByKey = jest.requireMock('@suite-common/wallet-core').selectAccountByKey; -const mockSelectDeviceButtonRequestsCodes = jest.requireMock( - '@suite-common/wallet-core', -).selectDeviceButtonRequestsCodes; -const mockSelectIsDeviceConnectedAndAuthorized = jest.requireMock( - '@suite-common/wallet-core', -).selectIsDeviceConnectedAndAuthorized; +const mockSelectDeviceButtonRequestsCodes = + jest.requireMock('@suite-common/device').selectDeviceButtonRequestsCodes; +const mockSelectIsDeviceConnectedAndAuthorized = + jest.requireMock('@suite-common/device').selectIsDeviceConnectedAndAuthorized; const mockSelectDeepCopyOfFormDraft = jest.requireMock( '@suite-common/wallet-core', ).selectDeepCopyOfFormDraft; diff --git a/suite-native/module-stellar-token-management/src/hooks/useStellarFeeScreen.ts b/suite-native/module-stellar-token-management/src/hooks/useStellarFeeScreen.ts index 670dddbf74..d9b0ec3aa7 100644 --- a/suite-native/module-stellar-token-management/src/hooks/useStellarFeeScreen.ts +++ b/suite-native/module-stellar-token-management/src/hooks/useStellarFeeScreen.ts @@ -5,14 +5,16 @@ import { useFocusEffect, useNavigation } from '@react-navigation/native'; import { isFulfilled } from '@reduxjs/toolkit'; import { - AccountsRootState, DeviceRootState, + selectDeviceButtonRequestsCodes, + selectIsDeviceConnectedAndAuthorized, +} from '@suite-common/device'; +import { + AccountsRootState, FormDraftRootState, fetchAndUpdateAccountThunk, selectAccountByKey, selectDeepCopyOfFormDraft, - selectDeviceButtonRequestsCodes, - selectIsDeviceConnectedAndAuthorized, } from '@suite-common/wallet-core'; import { AccountKey, diff --git a/suite-native/module-stellar-token-management/tsconfig.json b/suite-native/module-stellar-token-management/tsconfig.json index 6396fcd62d..5c080f680c 100644 --- a/suite-native/module-stellar-token-management/tsconfig.json +++ b/suite-native/module-stellar-token-management/tsconfig.json @@ -2,6 +2,7 @@ "extends": "../../tsconfig.base.json", "compilerOptions": { "outDir": "libDev" }, "references": [ + { "path": "../../suite-common/device" }, { "path": "../../suite-common/redux-utils" }, diff --git a/suite-native/module-trading/package.json b/suite-native/module-trading/package.json index 6220530f9f..ec37f409c4 100644 --- a/suite-native/module-trading/package.json +++ b/suite-native/module-trading/package.json @@ -20,6 +20,7 @@ "@react-navigation/native-stack": "7.9.0", "@reduxjs/toolkit": "2.11.2", "@shopify/flash-list": "2.2.0", + "@suite-common/device": "workspace:*", "@suite-common/formatters": "workspace:*", "@suite-common/geolocation": "workspace:*", "@suite-common/message-system": "workspace:*", diff --git a/suite-native/module-trading/src/components/buy/BuyTradeableAssetPicker.tsx b/suite-native/module-trading/src/components/buy/BuyTradeableAssetPicker.tsx index 7b73cf6ee9..c4243be9c9 100644 --- a/suite-native/module-trading/src/components/buy/BuyTradeableAssetPicker.tsx +++ b/suite-native/module-trading/src/components/buy/BuyTradeableAssetPicker.tsx @@ -2,7 +2,7 @@ import { useCallback, useEffect, useMemo, useRef, useState } from 'react'; import { TextInput } from 'react-native'; import { useSelector } from 'react-redux'; -import { selectHasBitcoinOnlyFirmware } from '@suite-common/wallet-core'; +import { selectHasBitcoinOnlyFirmware } from '@suite-common/device'; import { HStack } from '@suite-native/atoms'; import { selectBuyTradeableAssets } from '@suite-native/trading-state'; import { TradeableAsset } from '@suite-native/trading-types'; diff --git a/suite-native/module-trading/src/components/exchange/ExchangeTab.tsx b/suite-native/module-trading/src/components/exchange/ExchangeTab.tsx index 28182970ba..bb99b7a1cc 100644 --- a/suite-native/module-trading/src/components/exchange/ExchangeTab.tsx +++ b/suite-native/module-trading/src/components/exchange/ExchangeTab.tsx @@ -1,9 +1,6 @@ import { useSelector } from 'react-redux'; -import { - selectHasBitcoinOnlyFirmware, - selectIsPortfolioTrackerDevice, -} from '@suite-common/wallet-core'; +import { selectHasBitcoinOnlyFirmware, selectIsPortfolioTrackerDevice } from '@suite-common/device'; import { BtcOnlyFirmwareInfo, PortfolioTrackerInfo } from '@suite-native/trading-atoms'; import { selectIsTradingExchangeEnabled } from '@suite-native/trading-state'; diff --git a/suite-native/module-trading/src/components/exchange/__tests__/ExchangeTab.comp.test.tsx b/suite-native/module-trading/src/components/exchange/__tests__/ExchangeTab.comp.test.tsx index e6bdfad054..8b7fca1483 100644 --- a/suite-native/module-trading/src/components/exchange/__tests__/ExchangeTab.comp.test.tsx +++ b/suite-native/module-trading/src/components/exchange/__tests__/ExchangeTab.comp.test.tsx @@ -7,8 +7,8 @@ let mockIsPortfolioTrackerDevice = false; let mockHasBitcoinOnlyFirmware = false; let mockIsTradingExchangeEnabled = true; -jest.mock('@suite-common/wallet-core', () => ({ - ...jest.requireActual('@suite-common/wallet-core'), +jest.mock('@suite-common/device', () => ({ + ...jest.requireActual('@suite-common/device'), selectIsDeviceInViewOnlyMode: () => mockIsDeviceInViewOnlyMode, selectIsPortfolioTrackerDevice: () => mockIsPortfolioTrackerDevice, selectHasBitcoinOnlyFirmware: () => mockHasBitcoinOnlyFirmware, diff --git a/suite-native/module-trading/src/components/general/AccountList/AccountList.tsx b/suite-native/module-trading/src/components/general/AccountList/AccountList.tsx index e3cd64bd3f..67a177f9ec 100644 --- a/suite-native/module-trading/src/components/general/AccountList/AccountList.tsx +++ b/suite-native/module-trading/src/components/general/AccountList/AccountList.tsx @@ -4,9 +4,9 @@ import { useDispatch, useSelector } from 'react-redux'; import { useNavigation } from '@react-navigation/native'; import { FlashList } from '@shopify/flash-list'; +import { selectIsDeviceInViewOnlyMode } from '@suite-common/device'; import { TradingType, tradingBuyActions, tradingExchangeActions } from '@suite-common/trading'; import { NetworkSymbol } from '@suite-common/wallet-config'; -import { selectIsDeviceInViewOnlyMode } from '@suite-common/wallet-core'; import { RootStackParamList, StackToStackCompositeNavigationProps, diff --git a/suite-native/module-trading/src/components/general/AccountList/NoAccountsComponent.tsx b/suite-native/module-trading/src/components/general/AccountList/NoAccountsComponent.tsx index 39ab7c5f83..5c0b808a5a 100644 --- a/suite-native/module-trading/src/components/general/AccountList/NoAccountsComponent.tsx +++ b/suite-native/module-trading/src/components/general/AccountList/NoAccountsComponent.tsx @@ -1,9 +1,6 @@ import { useSelector } from 'react-redux'; -import { - selectIsDeviceInViewOnlyMode, - selectIsPortfolioTrackerDevice, -} from '@suite-common/wallet-core'; +import { selectIsDeviceInViewOnlyMode, selectIsPortfolioTrackerDevice } from '@suite-common/device'; import { Text, VStack } from '@suite-native/atoms'; import { Translation, TxKeyPath } from '@suite-native/intl'; import { prepareNativeStyle, useNativeStyles } from '@trezor/styles'; diff --git a/suite-native/module-trading/src/components/general/TradingDeviceConnectionGuard.tsx b/suite-native/module-trading/src/components/general/TradingDeviceConnectionGuard.tsx index 44d7b0abbb..287a4eebab 100644 --- a/suite-native/module-trading/src/components/general/TradingDeviceConnectionGuard.tsx +++ b/suite-native/module-trading/src/components/general/TradingDeviceConnectionGuard.tsx @@ -3,7 +3,7 @@ import { useSelector } from 'react-redux'; import { useNavigation } from '@react-navigation/native'; -import { selectIsDeviceConnected } from '@suite-common/wallet-core'; +import { selectIsDeviceConnected } from '@suite-common/device'; import { DeviceConnectionGuardScreen } from '@suite-native/device-authorization'; import { type TradingStackNavigationProp } from '@suite-native/trading-types'; diff --git a/suite-native/module-trading/src/components/general/__tests__/TradingDeviceConnectionGuard.comp.test.tsx b/suite-native/module-trading/src/components/general/__tests__/TradingDeviceConnectionGuard.comp.test.tsx index ef754e2c91..f3962b8efc 100644 --- a/suite-native/module-trading/src/components/general/__tests__/TradingDeviceConnectionGuard.comp.test.tsx +++ b/suite-native/module-trading/src/components/general/__tests__/TradingDeviceConnectionGuard.comp.test.tsx @@ -22,8 +22,8 @@ jest.mock('@react-navigation/native', () => ({ let mockSelectIsDeviceConnected: boolean; -jest.mock('@suite-common/wallet-core', () => ({ - ...jest.requireActual('@suite-common/wallet-core'), +jest.mock('@suite-common/device', () => ({ + ...jest.requireActual('@suite-common/device'), selectIsDeviceConnected: () => mockSelectIsDeviceConnected, })); diff --git a/suite-native/module-trading/src/components/sell/SellTab.tsx b/suite-native/module-trading/src/components/sell/SellTab.tsx index f3d159ea09..b3b8b5ae3c 100644 --- a/suite-native/module-trading/src/components/sell/SellTab.tsx +++ b/suite-native/module-trading/src/components/sell/SellTab.tsx @@ -1,6 +1,6 @@ import { useSelector } from 'react-redux'; -import { selectIsPortfolioTrackerDevice } from '@suite-common/wallet-core'; +import { selectIsPortfolioTrackerDevice } from '@suite-common/device'; import { PortfolioTrackerInfo } from '@suite-native/trading-atoms'; import { selectIsTradingSellEnabled } from '@suite-native/trading-state'; diff --git a/suite-native/module-trading/src/components/sell/__tests__/SellTab.comp.test.tsx b/suite-native/module-trading/src/components/sell/__tests__/SellTab.comp.test.tsx index a8f7d12d0c..979226eecd 100644 --- a/suite-native/module-trading/src/components/sell/__tests__/SellTab.comp.test.tsx +++ b/suite-native/module-trading/src/components/sell/__tests__/SellTab.comp.test.tsx @@ -6,8 +6,8 @@ import { SellTab } from '../SellTab'; let mockIsDeviceInViewOnlyMode = false; let mockIsPortfolioTrackerDevice = false; -jest.mock('@suite-common/wallet-core', () => ({ - ...jest.requireActual('@suite-common/wallet-core'), +jest.mock('@suite-common/device', () => ({ + ...jest.requireActual('@suite-common/device'), selectIsDeviceInViewOnlyMode: () => mockIsDeviceInViewOnlyMode, selectIsPortfolioTrackerDevice: () => mockIsPortfolioTrackerDevice, })); diff --git a/suite-native/module-trading/src/hooks/general/form/useSendAccountAssetBalance.ts b/suite-native/module-trading/src/hooks/general/form/useSendAccountAssetBalance.ts index d8e7bddc67..e8faa34934 100644 --- a/suite-native/module-trading/src/hooks/general/form/useSendAccountAssetBalance.ts +++ b/suite-native/module-trading/src/hooks/general/form/useSendAccountAssetBalance.ts @@ -1,10 +1,10 @@ import { useEffect } from 'react'; import { useSelector } from 'react-redux'; +import type { DeviceRootState } from '@suite-common/device'; import { TokenDefinitionsRootState } from '@suite-common/token-definitions'; import { AccountsRootState, - DeviceRootState, TransactionsRootState, selectAccountFormattedBalance, } from '@suite-common/wallet-core'; diff --git a/suite-native/module-trading/src/hooks/general/useReceiveAccountsListData.ts b/suite-native/module-trading/src/hooks/general/useReceiveAccountsListData.ts index 128f59452b..c405d60055 100644 --- a/suite-native/module-trading/src/hooks/general/useReceiveAccountsListData.ts +++ b/suite-native/module-trading/src/hooks/general/useReceiveAccountsListData.ts @@ -1,8 +1,9 @@ import { useMemo } from 'react'; import { useSelector } from 'react-redux'; +import type { DeviceRootState } from '@suite-common/device'; import { NetworkSymbol } from '@suite-common/wallet-config'; -import { AccountsRootState, DeviceRootState } from '@suite-common/wallet-core'; +import { AccountsRootState } from '@suite-common/wallet-core'; import { Account } from '@suite-common/wallet-types'; import { useTranslate } from '@suite-native/intl'; import { SectionListData } from '@suite-native/trading-atoms'; diff --git a/suite-native/module-trading/src/hooks/reviewOutputs/__tests__/useDelayedReviewOutputListDisplayFlag.hook.test.ts b/suite-native/module-trading/src/hooks/reviewOutputs/__tests__/useDelayedReviewOutputListDisplayFlag.hook.test.ts index fa7b21cc01..30ed510de4 100644 --- a/suite-native/module-trading/src/hooks/reviewOutputs/__tests__/useDelayedReviewOutputListDisplayFlag.hook.test.ts +++ b/suite-native/module-trading/src/hooks/reviewOutputs/__tests__/useDelayedReviewOutputListDisplayFlag.hook.test.ts @@ -4,8 +4,8 @@ import { useDelayedReviewOutputListDisplayFlag } from '../useDelayedReviewOutput const mockSelectDeviceButtonRequestsCodes = jest.fn().mockReturnValue([]); -jest.mock('@suite-common/wallet-core', () => ({ - ...jest.requireActual('@suite-common/wallet-core'), +jest.mock('@suite-common/device', () => ({ + ...jest.requireActual('@suite-common/device'), selectDeviceButtonRequestsCodes: () => mockSelectDeviceButtonRequestsCodes(), })); diff --git a/suite-native/module-trading/src/hooks/reviewOutputs/useTradingOutputsReviewErrorAlert.ts b/suite-native/module-trading/src/hooks/reviewOutputs/useTradingOutputsReviewErrorAlert.ts index ab61b18f61..1435a40962 100644 --- a/suite-native/module-trading/src/hooks/reviewOutputs/useTradingOutputsReviewErrorAlert.ts +++ b/suite-native/module-trading/src/hooks/reviewOutputs/useTradingOutputsReviewErrorAlert.ts @@ -1,11 +1,8 @@ import { useCallback } from 'react'; import { useSelector } from 'react-redux'; -import { - AccountsRootState, - DeviceRootState, - selectAccountNetworkType, -} from '@suite-common/wallet-core'; +import type { DeviceRootState } from '@suite-common/device'; +import { AccountsRootState, selectAccountNetworkType } from '@suite-common/wallet-core'; import { AccountKey } from '@suite-common/wallet-types'; import { useAlert } from '@suite-native/alerts'; import { useTranslate } from '@suite-native/intl'; diff --git a/suite-native/module-trading/src/screens/__tests__/TradingExchangePreviewScreen.comp.test.tsx b/suite-native/module-trading/src/screens/__tests__/TradingExchangePreviewScreen.comp.test.tsx index 953300db8e..f684f4f662 100644 --- a/suite-native/module-trading/src/screens/__tests__/TradingExchangePreviewScreen.comp.test.tsx +++ b/suite-native/module-trading/src/screens/__tests__/TradingExchangePreviewScreen.comp.test.tsx @@ -43,8 +43,8 @@ jest.mock('@suite-native/services', () => { }); let mockIsDeviceConnected = true; -jest.mock('@suite-common/wallet-core', () => ({ - ...jest.requireActual('@suite-common/wallet-core'), +jest.mock('@suite-common/device', () => ({ + ...jest.requireActual('@suite-common/device'), selectIsDeviceConnected: () => mockIsDeviceConnected, })); diff --git a/suite-native/module-trading/src/screens/__tests__/TradingSellPreviewScreen.comp.test.tsx b/suite-native/module-trading/src/screens/__tests__/TradingSellPreviewScreen.comp.test.tsx index b5ed917e54..ccbdaa1d71 100644 --- a/suite-native/module-trading/src/screens/__tests__/TradingSellPreviewScreen.comp.test.tsx +++ b/suite-native/module-trading/src/screens/__tests__/TradingSellPreviewScreen.comp.test.tsx @@ -46,8 +46,8 @@ jest.mock('../../hooks/general/useWatchTrade', () => ({ })); let mockIsDeviceConnected = true; -jest.mock('@suite-common/wallet-core', () => ({ - ...jest.requireActual('@suite-common/wallet-core'), +jest.mock('@suite-common/device', () => ({ + ...jest.requireActual('@suite-common/device'), selectIsDeviceConnected: () => mockIsDeviceConnected, })); diff --git a/suite-native/module-trading/tsconfig.json b/suite-native/module-trading/tsconfig.json index 620ec2ca1d..6bb879a6db 100644 --- a/suite-native/module-trading/tsconfig.json +++ b/suite-native/module-trading/tsconfig.json @@ -2,6 +2,7 @@ "extends": "../../tsconfig.base.json", "compilerOptions": { "outDir": "libDev" }, "references": [ + { "path": "../../suite-common/device" }, { "path": "../../suite-common/formatters" }, diff --git a/suite-native/navigation/package.json b/suite-native/navigation/package.json index 2a6096a73e..163fca5149 100644 --- a/suite-native/navigation/package.json +++ b/suite-native/navigation/package.json @@ -16,11 +16,11 @@ "@react-navigation/native-stack": "7.9.0", "@react-navigation/routers": "^7.5.3", "@rozenite/react-navigation-plugin": "^1.2.0", + "@suite-common/device": "workspace:*", "@suite-common/message-system": "workspace:*", "@suite-common/suite-types": "workspace:*", "@suite-common/trading": "workspace:*", "@suite-common/wallet-config": "workspace:*", - "@suite-common/wallet-core": "workspace:*", "@suite-common/wallet-types": "workspace:*", "@suite-native/analytics": "workspace:*", "@suite-native/atoms": "workspace:*", diff --git a/suite-native/navigation/src/components/TabBar.tsx b/suite-native/navigation/src/components/TabBar.tsx index 3ad105ee95..8d2d6e9976 100644 --- a/suite-native/navigation/src/components/TabBar.tsx +++ b/suite-native/navigation/src/components/TabBar.tsx @@ -3,7 +3,7 @@ import { useSelector } from 'react-redux'; import { BottomTabBarProps } from '@react-navigation/bottom-tabs'; -import { selectHasBitcoinOnlyFirmware } from '@suite-common/wallet-core'; +import { selectHasBitcoinOnlyFirmware } from '@suite-common/device'; import { Box } from '@suite-native/atoms'; import { FeatureFlag, useFeatureFlag } from '@suite-native/feature-flags'; import { TxKeyPath, useTranslate } from '@suite-native/intl'; diff --git a/suite-native/navigation/tsconfig.json b/suite-native/navigation/tsconfig.json index ed5fb16585..3a681abd7c 100644 --- a/suite-native/navigation/tsconfig.json +++ b/suite-native/navigation/tsconfig.json @@ -2,6 +2,7 @@ "extends": "../../tsconfig.base.json", "compilerOptions": { "outDir": "libDev" }, "references": [ + { "path": "../../suite-common/device" }, { "path": "../../suite-common/message-system" }, @@ -12,9 +13,6 @@ { "path": "../../suite-common/wallet-config" }, - { - "path": "../../suite-common/wallet-core" - }, { "path": "../../suite-common/wallet-types" }, diff --git a/suite-native/passphrase/package.json b/suite-native/passphrase/package.json index bb4581533e..db6c69294e 100644 --- a/suite-native/passphrase/package.json +++ b/suite-native/passphrase/package.json @@ -14,6 +14,7 @@ "@gorhom/bottom-sheet": "5.2.6", "@react-navigation/native": "7.1.26", "@reduxjs/toolkit": "2.11.2", + "@suite-common/device": "workspace:*", "@suite-common/validators": "workspace:*", "@suite-common/wallet-core": "workspace:*", "@suite-native/alerts": "workspace:*", diff --git a/suite-native/passphrase/src/components/EnterPassphraseOnTrezorButton.tsx b/suite-native/passphrase/src/components/EnterPassphraseOnTrezorButton.tsx index 76feb2e939..a87c483aab 100644 --- a/suite-native/passphrase/src/components/EnterPassphraseOnTrezorButton.tsx +++ b/suite-native/passphrase/src/components/EnterPassphraseOnTrezorButton.tsx @@ -1,10 +1,7 @@ import { useDispatch, useSelector } from 'react-redux'; -import { - selectDeviceInternalModel, - selectSelectedDevice, - submitPassphrase, -} from '@suite-common/wallet-core'; +import { selectDeviceInternalModel, selectSelectedDevice } from '@suite-common/device'; +import { submitPassphrase } from '@suite-common/wallet-core'; import { events } from '@suite-native/analytics'; import { Button } from '@suite-native/atoms'; import { DeviceModelIcon } from '@suite-native/icons'; diff --git a/suite-native/passphrase/src/components/NoPassphraseButton.tsx b/suite-native/passphrase/src/components/NoPassphraseButton.tsx index 8f2016d347..3c01a64989 100644 --- a/suite-native/passphrase/src/components/NoPassphraseButton.tsx +++ b/suite-native/passphrase/src/components/NoPassphraseButton.tsx @@ -1,6 +1,6 @@ import { useSelector } from 'react-redux'; -import { selectDeviceInternalModel } from '@suite-common/wallet-core'; +import { selectDeviceInternalModel } from '@suite-common/device'; import { Button } from '@suite-native/atoms'; import { Translation } from '@suite-native/intl'; import { useNavigateToInitialScreen } from '@suite-native/navigation'; diff --git a/suite-native/passphrase/src/components/PassphraseForm.tsx b/suite-native/passphrase/src/components/PassphraseForm.tsx index b62f0bb85e..50ab19e774 100644 --- a/suite-native/passphrase/src/components/PassphraseForm.tsx +++ b/suite-native/passphrase/src/components/PassphraseForm.tsx @@ -3,16 +3,16 @@ import { View } from 'react-native'; import Animated, { FadeIn, FadeOut } from 'react-native-reanimated'; import { useDispatch, useSelector } from 'react-redux'; +import { + selectHasDevicePassphraseEntryCapability, + selectSelectedDevice, +} from '@suite-common/device'; import { PassphraseFormValues, formInputsMaxLength, passphraseFormSchema, } from '@suite-common/validators'; -import { - selectHasDevicePassphraseEntryCapability, - selectSelectedDevice, - submitPassphrase, -} from '@suite-common/wallet-core'; +import { submitPassphrase } from '@suite-common/wallet-core'; import { events } from '@suite-native/analytics'; import { Button, Card, TextDivider, VStack } from '@suite-native/atoms'; import { Form, SecureTextInputField, useForm } from '@suite-native/forms'; diff --git a/suite-native/passphrase/src/components/PassphraseMismatchAlert.tsx b/suite-native/passphrase/src/components/PassphraseMismatchAlert.tsx index d8715971ce..48174caff6 100644 --- a/suite-native/passphrase/src/components/PassphraseMismatchAlert.tsx +++ b/suite-native/passphrase/src/components/PassphraseMismatchAlert.tsx @@ -3,10 +3,10 @@ import { useDispatch, useSelector } from 'react-redux'; import { useNavigation } from '@react-navigation/native'; +import { selectSelectedDevice } from '@suite-common/device'; import { cancelDiscoveryThunk, runDiscoveryThunk, - selectSelectedDevice, startDiscoveryThunk, } from '@suite-common/wallet-core'; import { useAlert } from '@suite-native/alerts'; diff --git a/suite-native/passphrase/src/components/PassphraseScreenHeader.tsx b/suite-native/passphrase/src/components/PassphraseScreenHeader.tsx index ed763632ac..de8998ce38 100644 --- a/suite-native/passphrase/src/components/PassphraseScreenHeader.tsx +++ b/suite-native/passphrase/src/components/PassphraseScreenHeader.tsx @@ -3,7 +3,8 @@ import { useDispatch, useSelector } from 'react-redux'; import { useNavigation, useRoute } from '@react-navigation/native'; -import { cancelDiscoveryThunk, selectSelectedDevice } from '@suite-common/wallet-core'; +import { selectSelectedDevice } from '@suite-common/device'; +import { cancelDiscoveryThunk } from '@suite-common/wallet-core'; import { useAlert } from '@suite-native/alerts'; import { events } from '@suite-native/analytics'; import { IconButton, ScreenHeaderWrapper } from '@suite-native/atoms'; diff --git a/suite-native/passphrase/src/passphraseSelectors.ts b/suite-native/passphrase/src/passphraseSelectors.ts index 077ab9e25b..74be8c9fd9 100644 --- a/suite-native/passphrase/src/passphraseSelectors.ts +++ b/suite-native/passphrase/src/passphraseSelectors.ts @@ -1,8 +1,5 @@ -import { - DeviceRootState, - DiscoveryRootState, - selectDiscoveryByDevicePath, -} from '@suite-common/wallet-core'; +import type { DeviceRootState } from '@suite-common/device'; +import { DiscoveryRootState, selectDiscoveryByDevicePath } from '@suite-common/wallet-core'; export const selectHasPassphraseMismatchError = (state: DiscoveryRootState & DeviceRootState) => { const discovery = selectDiscoveryByDevicePath(state, state.device.selectedDevice?.path); diff --git a/suite-native/passphrase/src/useRedirectOnPassphraseCompletion.ts b/suite-native/passphrase/src/useRedirectOnPassphraseCompletion.ts index 4f8d2d7476..baec40a0f9 100644 --- a/suite-native/passphrase/src/useRedirectOnPassphraseCompletion.ts +++ b/suite-native/passphrase/src/useRedirectOnPassphraseCompletion.ts @@ -3,11 +3,11 @@ import { useDispatch, useSelector, useStore } from 'react-redux'; import { useRoute } from '@react-navigation/native'; +import { selectSelectedDevice } from '@suite-common/device'; import { DiscoveryRootState, cancelDiscoveryThunk, selectDiscoveryByDevicePath, - selectSelectedDevice, } from '@suite-common/wallet-core'; import { events } from '@suite-native/analytics'; import { useNavigateToInitialScreen } from '@suite-native/navigation'; diff --git a/suite-native/passphrase/tsconfig.json b/suite-native/passphrase/tsconfig.json index 3c4fcfeb9c..c96fa84a75 100644 --- a/suite-native/passphrase/tsconfig.json +++ b/suite-native/passphrase/tsconfig.json @@ -2,6 +2,7 @@ "extends": "../../tsconfig.base.json", "compilerOptions": { "outDir": "libDev" }, "references": [ + { "path": "../../suite-common/device" }, { "path": "../../suite-common/validators" }, diff --git a/suite-native/receive/package.json b/suite-native/receive/package.json index 0c83bdc089..3ce68e22e3 100644 --- a/suite-native/receive/package.json +++ b/suite-native/receive/package.json @@ -15,6 +15,7 @@ "@react-navigation/native-stack": "7.9.0", "@reduxjs/toolkit": "2.11.2", "@shopify/react-native-skia": "2.2.12", + "@suite-common/device": "workspace:*", "@suite-common/wallet-config": "workspace:*", "@suite-common/wallet-core": "workspace:*", "@suite-common/wallet-types": "workspace:*", diff --git a/suite-native/receive/src/components/DeviceScreenContent.tsx b/suite-native/receive/src/components/DeviceScreenContent.tsx index 5dc12cb931..92736e458a 100644 --- a/suite-native/receive/src/components/DeviceScreenContent.tsx +++ b/suite-native/receive/src/components/DeviceScreenContent.tsx @@ -9,7 +9,7 @@ import { vec, } from '@shopify/react-native-skia'; -import { selectDeviceModel } from '@suite-common/wallet-core'; +import { selectDeviceModel } from '@suite-common/device'; import { DeviceModelInternal } from '@trezor/device-utils'; import { prepareNativeStyle, useNativeStyles } from '@trezor/styles'; diff --git a/suite-native/receive/src/components/ReceiveAddressCard.tsx b/suite-native/receive/src/components/ReceiveAddressCard.tsx index 305edf5a08..251c867cca 100644 --- a/suite-native/receive/src/components/ReceiveAddressCard.tsx +++ b/suite-native/receive/src/components/ReceiveAddressCard.tsx @@ -1,11 +1,8 @@ import Animated, { Layout } from 'react-native-reanimated'; import { useSelector } from 'react-redux'; +import { selectIsDeviceInViewOnlyMode, selectIsPortfolioTrackerDevice } from '@suite-common/device'; import { type NetworkSymbol, getNetwork } from '@suite-common/wallet-config'; -import { - selectIsDeviceInViewOnlyMode, - selectIsPortfolioTrackerDevice, -} from '@suite-common/wallet-core'; import { AccountDescriptor } from '@suite-common/wallet-types'; import { Box, Card, InlineAlertBoxProps } from '@suite-native/atoms'; import { Translation } from '@suite-native/intl'; diff --git a/suite-native/receive/src/components/ShowAddressButtons.tsx b/suite-native/receive/src/components/ShowAddressButtons.tsx index 76162bc764..e6a1140717 100644 --- a/suite-native/receive/src/components/ShowAddressButtons.tsx +++ b/suite-native/receive/src/components/ShowAddressButtons.tsx @@ -1,10 +1,7 @@ import React from 'react'; import { useSelector } from 'react-redux'; -import { - selectIsDeviceInViewOnlyMode, - selectIsPortfolioTrackerDevice, -} from '@suite-common/wallet-core'; +import { selectIsDeviceInViewOnlyMode, selectIsPortfolioTrackerDevice } from '@suite-common/device'; import { Button, TextButton, VStack, useBottomSheetModal } from '@suite-native/atoms'; import { Translation } from '@suite-native/intl'; import { useOpenLink } from '@suite-native/link'; diff --git a/suite-native/receive/src/components/UnverifiedAddress.tsx b/suite-native/receive/src/components/UnverifiedAddress.tsx index 53ce6e2c96..8b13c18f0d 100644 --- a/suite-native/receive/src/components/UnverifiedAddress.tsx +++ b/suite-native/receive/src/components/UnverifiedAddress.tsx @@ -1,9 +1,6 @@ import { useSelector } from 'react-redux'; -import { - selectIsDeviceInViewOnlyMode, - selectIsPortfolioTrackerDevice, -} from '@suite-common/wallet-core'; +import { selectIsDeviceInViewOnlyMode, selectIsPortfolioTrackerDevice } from '@suite-common/device'; import { VStack } from '@suite-native/atoms'; import { ShowAddressButtons } from './ShowAddressButtons'; diff --git a/suite-native/receive/src/components/UnverifiedAddressDevice.tsx b/suite-native/receive/src/components/UnverifiedAddressDevice.tsx index ab99a0df25..3c6eceaddd 100644 --- a/suite-native/receive/src/components/UnverifiedAddressDevice.tsx +++ b/suite-native/receive/src/components/UnverifiedAddressDevice.tsx @@ -8,7 +8,7 @@ import { import Animated from 'react-native-reanimated'; import { useSelector } from 'react-redux'; -import { selectDeviceModel } from '@suite-common/wallet-core'; +import { selectDeviceModel } from '@suite-common/device'; import { Box, VStack } from '@suite-native/atoms'; import { useCopyToClipboard } from '@suite-native/clipboard'; import { prepareNativeStyle, useNativeStyles } from '@trezor/styles'; diff --git a/suite-native/receive/src/components/UnverifiedAddressWarning.tsx b/suite-native/receive/src/components/UnverifiedAddressWarning.tsx index 1f7805661e..f12e6cc6b2 100644 --- a/suite-native/receive/src/components/UnverifiedAddressWarning.tsx +++ b/suite-native/receive/src/components/UnverifiedAddressWarning.tsx @@ -1,6 +1,6 @@ import { useSelector } from 'react-redux'; -import { selectIsPortfolioTrackerDevice } from '@suite-common/wallet-core'; +import { selectIsPortfolioTrackerDevice } from '@suite-common/device'; import { Box, PictogramTitleHeader, Text, TrezorSuiteHeader } from '@suite-native/atoms'; import { Translation } from '@suite-native/intl'; diff --git a/suite-native/receive/src/hooks/receiveSelectors.ts b/suite-native/receive/src/hooks/receiveSelectors.ts index f661151843..2cc44d5883 100644 --- a/suite-native/receive/src/hooks/receiveSelectors.ts +++ b/suite-native/receive/src/hooks/receiveSelectors.ts @@ -1,6 +1,6 @@ import { A, pipe } from '@mobily/ts-belt'; -import { DeviceRootState, selectDeviceButtonRequestsCodes } from '@suite-common/wallet-core'; +import { DeviceRootState, selectDeviceButtonRequestsCodes } from '@suite-common/device'; export const hasReceiveAddressButtonRequest = (state: DeviceRootState) => pipe( diff --git a/suite-native/receive/src/hooks/useAccountReceiveAddress.tsx b/suite-native/receive/src/hooks/useAccountReceiveAddress.tsx index 0d75532188..a5931f1b46 100644 --- a/suite-native/receive/src/hooks/useAccountReceiveAddress.tsx +++ b/suite-native/receive/src/hooks/useAccountReceiveAddress.tsx @@ -3,13 +3,12 @@ import { useDispatch, useSelector } from 'react-redux'; import { useNavigation } from '@react-navigation/native'; +import { selectIsDeviceInViewOnlyMode, selectIsPortfolioTrackerDevice } from '@suite-common/device'; import { AccountsRootState, TransactionsRootState, confirmAddressOnDeviceThunk, selectAccountNetworkSymbol, - selectIsDeviceInViewOnlyMode, - selectIsPortfolioTrackerDevice, } from '@suite-common/wallet-core'; import { AccountKey } from '@suite-common/wallet-types'; import { NativeAccountsRootState, selectFreshAccountAddress } from '@suite-native/accounts'; diff --git a/suite-native/receive/src/screens/ReceiveAccountScreen.tsx b/suite-native/receive/src/screens/ReceiveAccountScreen.tsx index b6f5140e04..1e4176ab6a 100644 --- a/suite-native/receive/src/screens/ReceiveAccountScreen.tsx +++ b/suite-native/receive/src/screens/ReceiveAccountScreen.tsx @@ -2,9 +2,9 @@ import { useSelector } from 'react-redux'; import { RouteProp, useRoute } from '@react-navigation/native'; +import type { DeviceRootState } from '@suite-common/device'; import { AccountsRootState, - DeviceRootState, selectDeviceAccountKeyForNetworkSymbolAndAccountTypeWithIndex, } from '@suite-common/wallet-core'; import { BoxSkeleton, Card, VStack } from '@suite-native/atoms'; diff --git a/suite-native/receive/src/screens/ReceiveAddressScreen.tsx b/suite-native/receive/src/screens/ReceiveAddressScreen.tsx index 9aa6687369..ca425c1c81 100644 --- a/suite-native/receive/src/screens/ReceiveAddressScreen.tsx +++ b/suite-native/receive/src/screens/ReceiveAddressScreen.tsx @@ -5,12 +5,9 @@ import { useSelector } from 'react-redux'; import { G } from '@mobily/ts-belt'; import { useNavigation } from '@react-navigation/native'; +import { selectIsDeviceBackupRequired } from '@suite-common/device'; import { getDisplaySymbol } from '@suite-common/wallet-config'; -import { - AccountsRootState, - selectAccountByKey, - selectIsDeviceBackupRequired, -} from '@suite-common/wallet-core'; +import { AccountsRootState, selectAccountByKey } from '@suite-common/wallet-core'; import { AccountKey, TokenAddress } from '@suite-common/wallet-types'; import { AccountDetailsCard } from '@suite-native/accounts'; import { diff --git a/suite-native/receive/tsconfig.json b/suite-native/receive/tsconfig.json index dfa6ffd273..c7edd06843 100644 --- a/suite-native/receive/tsconfig.json +++ b/suite-native/receive/tsconfig.json @@ -2,6 +2,7 @@ "extends": "../../tsconfig.base.json", "compilerOptions": { "outDir": "libDev" }, "references": [ + { "path": "../../suite-common/device" }, { "path": "../../suite-common/wallet-config" }, diff --git a/suite-native/send/package.json b/suite-native/send/package.json index 578ec99f1e..66761ffa8e 100644 --- a/suite-native/send/package.json +++ b/suite-native/send/package.json @@ -12,6 +12,7 @@ }, "dependencies": { "@reduxjs/toolkit": "2.11.2", + "@suite-common/device": "workspace:*", "@suite-common/mev": "workspace:*", "@suite-common/redux-utils": "workspace:*", "@suite-common/wallet-core": "workspace:*", diff --git a/suite-native/send/src/sendFormThunks.ts b/suite-native/send/src/sendFormThunks.ts index 57b95d277f..8ec5863c34 100644 --- a/suite-native/send/src/sendFormThunks.ts +++ b/suite-native/send/src/sendFormThunks.ts @@ -1,17 +1,16 @@ import { isRejected } from '@reduxjs/toolkit'; +import { deviceActions, selectSelectedDevice } from '@suite-common/device'; import { selectIsMevProtectionFeatureEnabled } from '@suite-common/mev'; import { createThunk } from '@suite-common/redux-utils'; import { PushTransactionError, SignTransactionError, SignTransactionTimeoutError, - deviceActions, enhancePrecomposedTransactionThunk, pushSendFormTransactionThunk, selectAccountByKey, selectIsMevProtectionEnabled, - selectSelectedDevice, selectSendFormDraftByKey, selectSendFormDrafts, sendFormActions, diff --git a/suite-native/send/tsconfig.json b/suite-native/send/tsconfig.json index 2dc10e2729..e87e252c6e 100644 --- a/suite-native/send/tsconfig.json +++ b/suite-native/send/tsconfig.json @@ -2,6 +2,7 @@ "extends": "../../tsconfig.base.json", "compilerOptions": { "outDir": "libDev" }, "references": [ + { "path": "../../suite-common/device" }, { "path": "../../suite-common/mev" }, { "path": "../../suite-common/redux-utils" diff --git a/suite-native/staking/package.json b/suite-native/staking/package.json index d00741290d..2a55050f82 100644 --- a/suite-native/staking/package.json +++ b/suite-native/staking/package.json @@ -11,6 +11,7 @@ "test:unit": "yarn g:jest" }, "dependencies": { + "@suite-common/device": "workspace:*", "@suite-common/redux-utils": "workspace:*", "@suite-common/suite-sync": "workspace:*", "@suite-common/wallet-config": "workspace:*", diff --git a/suite-native/staking/src/types.ts b/suite-native/staking/src/types.ts index 05fa6825f4..88ae11d5bf 100644 --- a/suite-native/staking/src/types.ts +++ b/suite-native/staking/src/types.ts @@ -1,6 +1,6 @@ +import type { DeviceRootState } from '@suite-common/device'; import { AccountsRootState, - DeviceRootState, StakeRootState, TransactionsRootState, } from '@suite-common/wallet-core'; diff --git a/suite-native/staking/tsconfig.json b/suite-native/staking/tsconfig.json index 015d95857a..14c1d83edd 100644 --- a/suite-native/staking/tsconfig.json +++ b/suite-native/staking/tsconfig.json @@ -2,6 +2,7 @@ "extends": "../../tsconfig.base.json", "compilerOptions": { "outDir": "libDev" }, "references": [ + { "path": "../../suite-common/device" }, { "path": "../../suite-common/redux-utils" }, diff --git a/suite-native/state/mocks/mockInitialAppState.ts b/suite-native/state/mocks/mockInitialAppState.ts index 23c0274207..9698dca34d 100644 --- a/suite-native/state/mocks/mockInitialAppState.ts +++ b/suite-native/state/mocks/mockInitialAppState.ts @@ -1,5 +1,6 @@ import { analyticsInitialState } from '@suite-common/analytics-redux'; import { connectPopupInitialState } from '@suite-common/connect-popup'; +import { deviceInitialState } from '@suite-common/device'; import { firmwareInitialState } from '@suite-common/firmware'; import { geolocationInitialState } from '@suite-common/geolocation'; import { logsSliceInitialState } from '@suite-common/logger'; @@ -12,7 +13,6 @@ import { tokenDefinitionsInitialState } from '@suite-common/token-definitions'; import { accountsInitialState, blockchainInitialState, - deviceInitialState, discoveryInitialState, explorerInitialState, feesInitialState, diff --git a/suite-native/state/package.json b/suite-native/state/package.json index ab1344057c..f6266657db 100644 --- a/suite-native/state/package.json +++ b/suite-native/state/package.json @@ -14,6 +14,7 @@ "@suite-common/analytics-redux": "workspace:*", "@suite-common/connect-popup": "workspace:*", "@suite-common/delegated-identity-key": "workspace:*", + "@suite-common/device": "workspace:*", "@suite-common/firmware": "workspace:*", "@suite-common/geolocation": "workspace:*", "@suite-common/logger": "workspace:*", diff --git a/suite-native/state/src/extraDependencies.ts b/suite-native/state/src/extraDependencies.ts index 253c12f9a1..16ad82cb36 100644 --- a/suite-native/state/src/extraDependencies.ts +++ b/suite-native/state/src/extraDependencies.ts @@ -3,6 +3,7 @@ import { Platform } from 'react-native'; import * as Device from 'expo-device'; import { delegatedIdentityKeyCompositionRoot } from '@suite-common/delegated-identity-key'; +import { selectSelectedDevice } from '@suite-common/device'; import { createNativePlatformEncryption } from '@suite-common/platform-encryption-native'; import { ExtraDependenciesStatic, @@ -15,7 +16,6 @@ import { import { createMigrateSuiteSyncLabelsForRbfTransactionCompositionRoot } from '@suite-common/suite-rbf-labels-migrations'; import { selectIsSuiteSyncEnabled } from '@suite-common/suite-sync'; import { Route } from '@suite-common/suite-types'; -import { selectSelectedDevice } from '@suite-common/wallet-core'; import { AddressDisplayOptions } from '@suite-common/wallet-types'; import { analytics } from '@suite-native/analytics'; import { forgetBluetoothDeviceThunk } from '@suite-native/bluetooth'; diff --git a/suite-native/state/src/reducers.ts b/suite-native/state/src/reducers.ts index f47cf43932..1c3bf01d5a 100644 --- a/suite-native/state/src/reducers.ts +++ b/suite-native/state/src/reducers.ts @@ -3,6 +3,7 @@ import { getStoredState } from 'redux-persist'; import { prepareAnalyticsReducer } from '@suite-common/analytics-redux'; import { prepareConnectPopupReducer } from '@suite-common/connect-popup'; +import { prepareDeviceReducer } from '@suite-common/device'; import { prepareFirmwareReducer } from '@suite-common/firmware'; import { geolocationReducer } from '@suite-common/geolocation'; import { logsSlice } from '@suite-common/logger'; @@ -20,7 +21,6 @@ import { formDraftReducer, prepareAccountsReducer, prepareBlockchainReducer, - prepareDeviceReducer, prepareDiscoveryReducer, prepareExplorerReducer, prepareFiatRatesReducer, diff --git a/suite-native/state/tsconfig.json b/suite-native/state/tsconfig.json index 56f89c08b8..dc7ee3b401 100644 --- a/suite-native/state/tsconfig.json +++ b/suite-native/state/tsconfig.json @@ -11,6 +11,7 @@ { "path": "../../suite-common/delegated-identity-key" }, + { "path": "../../suite-common/device" }, { "path": "../../suite-common/firmware" }, { "path": "../../suite-common/geolocation" diff --git a/suite-native/storage/package.json b/suite-native/storage/package.json index 16c4687e36..81ece68aed 100644 --- a/suite-native/storage/package.json +++ b/suite-native/storage/package.json @@ -14,6 +14,7 @@ "@mobily/ts-belt": "^3.13.1", "@reduxjs/toolkit": "2.11.2", "@sentry/react-native": "7.11.0", + "@suite-common/device": "workspace:*", "@suite-common/firmware-authenticity": "workspace:*", "@suite-common/suite-types": "workspace:*", "@suite-common/suite-utils": "workspace:*", diff --git a/suite-native/storage/src/migrations/device/v4.ts b/suite-native/storage/src/migrations/device/v4.ts index cdee7dd280..c7985dcacb 100644 --- a/suite-native/storage/src/migrations/device/v4.ts +++ b/suite-native/storage/src/migrations/device/v4.ts @@ -1,5 +1,5 @@ +import { PORTFOLIO_TRACKER_DEVICE_ID } from '@suite-common/device'; import { TrezorDevice } from '@suite-common/suite-types'; -import { PORTFOLIO_TRACKER_DEVICE_ID } from '@suite-common/wallet-core'; export const backfillPortfolioTrackerUnavailableCapabilities = ( devices: TrezorDevice[], diff --git a/suite-native/storage/src/tests/migrations/deviceV4.test.ts b/suite-native/storage/src/tests/migrations/deviceV4.test.ts index e87dcb7be7..88bb2c7549 100644 --- a/suite-native/storage/src/tests/migrations/deviceV4.test.ts +++ b/suite-native/storage/src/tests/migrations/deviceV4.test.ts @@ -1,5 +1,5 @@ +import { PORTFOLIO_TRACKER_DEVICE_ID } from '@suite-common/device'; import { TrezorDevice } from '@suite-common/suite-types'; -import { PORTFOLIO_TRACKER_DEVICE_ID } from '@suite-common/wallet-core'; import { backfillPortfolioTrackerUnavailableCapabilities } from '../../migrations/device/v4'; diff --git a/suite-native/storage/src/transforms/utils.ts b/suite-native/storage/src/transforms/utils.ts index 5695a9e287..cb9df1ffd7 100644 --- a/suite-native/storage/src/transforms/utils.ts +++ b/suite-native/storage/src/transforms/utils.ts @@ -1,6 +1,6 @@ import { A, D, O } from '@mobily/ts-belt'; -import { DeviceRootState } from '@suite-common/wallet-core'; +import type { DeviceRootState } from '@suite-common/device'; /** * Beware, if you want to persist some part of state outside device reducer, diff --git a/suite-native/storage/tsconfig.json b/suite-native/storage/tsconfig.json index 462e6e96eb..f922cb0599 100644 --- a/suite-native/storage/tsconfig.json +++ b/suite-native/storage/tsconfig.json @@ -2,6 +2,7 @@ "extends": "../../tsconfig.base.json", "compilerOptions": { "outDir": "libDev" }, "references": [ + { "path": "../../suite-common/device" }, { "path": "../../suite-common/firmware-authenticity" }, diff --git a/suite-native/thp/package.json b/suite-native/thp/package.json index 49c45f793a..b826d9f4d7 100644 --- a/suite-native/thp/package.json +++ b/suite-native/thp/package.json @@ -12,8 +12,8 @@ "dependencies": { "@react-navigation/native": "7.1.26", "@reduxjs/toolkit": "2.11.2", + "@suite-common/device": "workspace:*", "@suite-common/thp": "workspace:*", - "@suite-common/wallet-core": "workspace:*", "@suite-native/alerts": "workspace:*", "@suite-native/atoms": "workspace:*", "@suite-native/intl": "workspace:*", diff --git a/suite-native/thp/src/hooks/useThpAutoconnectActions.tsx b/suite-native/thp/src/hooks/useThpAutoconnectActions.tsx index 3f9e964d0a..f623df2980 100644 --- a/suite-native/thp/src/hooks/useThpAutoconnectActions.tsx +++ b/suite-native/thp/src/hooks/useThpAutoconnectActions.tsx @@ -1,8 +1,8 @@ import { useCallback } from 'react'; import { useDispatch, useSelector } from 'react-redux'; +import { selectSelectedDevice } from '@suite-common/device'; import { startThpAutoconnectThunk, thpActions } from '@suite-common/thp'; -import { selectSelectedDevice } from '@suite-common/wallet-core'; export const useThpAutoconnectActions = () => { const dispatch = useDispatch(); diff --git a/suite-native/thp/tsconfig.json b/suite-native/thp/tsconfig.json index c13b432d5b..9b5d326d31 100644 --- a/suite-native/thp/tsconfig.json +++ b/suite-native/thp/tsconfig.json @@ -2,10 +2,8 @@ "extends": "../../tsconfig.base.json", "compilerOptions": { "outDir": "libDev" }, "references": [ + { "path": "../../suite-common/device" }, { "path": "../../suite-common/thp" }, - { - "path": "../../suite-common/wallet-core" - }, { "path": "../alerts" }, { "path": "../atoms" }, { "path": "../intl" }, diff --git a/suite-native/tokens/package.json b/suite-native/tokens/package.json index e09c03417d..5b7f2adc6e 100644 --- a/suite-native/tokens/package.json +++ b/suite-native/tokens/package.json @@ -12,6 +12,7 @@ }, "dependencies": { "@mobily/ts-belt": "^3.13.1", + "@suite-common/device": "workspace:*", "@suite-common/redux-utils": "workspace:*", "@suite-common/token-definitions": "workspace:*", "@suite-common/wallet-config": "workspace:*", diff --git a/suite-native/tokens/src/tokensSelectors.ts b/suite-native/tokens/src/tokensSelectors.ts index 03283ab6a2..faabc95552 100644 --- a/suite-native/tokens/src/tokensSelectors.ts +++ b/suite-native/tokens/src/tokensSelectors.ts @@ -1,5 +1,6 @@ import { A, pipe } from '@mobily/ts-belt'; +import type { DeviceRootState } from '@suite-common/device'; import { createWeakMapSelector, returnStableArrayIfEmpty } from '@suite-common/redux-utils'; import { TokenDefinitionsRootState, @@ -11,7 +12,6 @@ import { import { NetworkSymbol } from '@suite-common/wallet-config'; import { AccountsRootState, - DeviceRootState, TransactionsRootState, selectAccountByKey, selectAccountTransactions, diff --git a/suite-native/tokens/tsconfig.json b/suite-native/tokens/tsconfig.json index 8f77b353b7..6542ae8ec1 100644 --- a/suite-native/tokens/tsconfig.json +++ b/suite-native/tokens/tsconfig.json @@ -2,6 +2,7 @@ "extends": "../../tsconfig.base.json", "compilerOptions": { "outDir": "libDev" }, "references": [ + { "path": "../../suite-common/device" }, { "path": "../../suite-common/redux-utils" }, diff --git a/suite-native/trading-state/package.json b/suite-native/trading-state/package.json index 31311f2474..e81737a1ab 100644 --- a/suite-native/trading-state/package.json +++ b/suite-native/trading-state/package.json @@ -13,6 +13,7 @@ }, "dependencies": { "@reduxjs/toolkit": "2.11.2", + "@suite-common/device": "workspace:*", "@suite-common/message-system": "workspace:*", "@suite-common/redux-utils": "workspace:*", "@suite-common/suite-sync": "workspace:*", diff --git a/suite-native/trading-state/src/middlewares/__tests__/tradingMiddleware.test.ts b/suite-native/trading-state/src/middlewares/__tests__/tradingMiddleware.test.ts index 88ddee60fb..fac369987b 100644 --- a/suite-native/trading-state/src/middlewares/__tests__/tradingMiddleware.test.ts +++ b/suite-native/trading-state/src/middlewares/__tests__/tradingMiddleware.test.ts @@ -1,6 +1,7 @@ +import { deviceActions } from '@suite-common/device'; import type { ExtraDependencies } from '@suite-common/redux-utils'; import type { TrezorDevice } from '@suite-common/suite-types'; -import { deviceActions, formDraftActions } from '@suite-common/wallet-core'; +import { formDraftActions } from '@suite-common/wallet-core'; import { buyActions, exchangeActions, sellActions, tradingActions } from '../../reducers'; import { getFormDraftKeyByTradeType } from '../../utils'; diff --git a/suite-native/trading-state/src/middlewares/tradingMiddleware.ts b/suite-native/trading-state/src/middlewares/tradingMiddleware.ts index 45915efe5a..3c1fe6dfc2 100644 --- a/suite-native/trading-state/src/middlewares/tradingMiddleware.ts +++ b/suite-native/trading-state/src/middlewares/tradingMiddleware.ts @@ -1,7 +1,8 @@ import { UnknownAction, isAnyOf } from '@reduxjs/toolkit'; +import { deviceActions, selectSelectedDevice } from '@suite-common/device'; import { createMiddlewareWithExtraDeps } from '@suite-common/redux-utils'; -import { deviceActions, formDraftActions, selectSelectedDevice } from '@suite-common/wallet-core'; +import { formDraftActions } from '@suite-common/wallet-core'; import { buyActions, exchangeActions, sellActions, tradingActions } from '../reducers'; import { getFormDraftKeyByTradeType } from '../utils'; diff --git a/suite-native/trading-state/src/selectors/__tests__/commonSelectors.test.ts b/suite-native/trading-state/src/selectors/__tests__/commonSelectors.test.ts index 4ba3e43c6e..250b76e420 100644 --- a/suite-native/trading-state/src/selectors/__tests__/commonSelectors.test.ts +++ b/suite-native/trading-state/src/selectors/__tests__/commonSelectors.test.ts @@ -1,5 +1,6 @@ import type { CryptoId } from 'invity-api'; +import { DeviceReducerState, deviceInitialState } from '@suite-common/device'; import { initialSuiteSyncDataState, initialSuiteSyncState } from '@suite-common/suite-sync'; import { Action, Feature, Message, TrezorDevice } from '@suite-common/suite-types'; import { @@ -8,11 +9,7 @@ import { TradingRootStateWithDeviceAndAccounts, selectTradingProviderMetadata, } from '@suite-common/trading'; -import { - AccountsRootState, - DeviceReducerState, - deviceInitialState, -} from '@suite-common/wallet-core'; +import { AccountsRootState } from '@suite-common/wallet-core'; import { Account, AccountKey } from '@suite-common/wallet-types'; import { FeatureFlag, featureFlagsInitialState } from '@suite-native/feature-flags'; import { appSettingsInitialState } from '@suite-native/settings'; diff --git a/suite-native/trading-state/tsconfig.json b/suite-native/trading-state/tsconfig.json index c734d8feb6..de26387638 100644 --- a/suite-native/trading-state/tsconfig.json +++ b/suite-native/trading-state/tsconfig.json @@ -2,6 +2,7 @@ "extends": "../../tsconfig.base.json", "compilerOptions": { "outDir": "libDev" }, "references": [ + { "path": "../../suite-common/device" }, { "path": "../../suite-common/message-system" }, diff --git a/suite-native/transaction-management/package.json b/suite-native/transaction-management/package.json index e336a122ec..cc01d5c81f 100644 --- a/suite-native/transaction-management/package.json +++ b/suite-native/transaction-management/package.json @@ -14,6 +14,7 @@ "dependencies": { "@mobily/ts-belt": "^3.13.1", "@reduxjs/toolkit": "2.11.2", + "@suite-common/device": "workspace:*", "@suite-common/redux-utils": "workspace:*", "@suite-common/suite-sync": "workspace:*", "@suite-common/suite-utils": "workspace:*", diff --git a/suite-native/transaction-management/src/hooks/__tests__/useWaitForButtonRequest.test.ts b/suite-native/transaction-management/src/hooks/__tests__/useWaitForButtonRequest.test.ts index d8d4d2a0cb..6670f081c3 100644 --- a/suite-native/transaction-management/src/hooks/__tests__/useWaitForButtonRequest.test.ts +++ b/suite-native/transaction-management/src/hooks/__tests__/useWaitForButtonRequest.test.ts @@ -4,8 +4,8 @@ import { useWaitForButtonRequest } from '../useWaitForButtonRequest'; const mockSelectDeviceButtonRequestsCodes = jest.fn().mockReturnValue([]); -jest.mock('@suite-common/wallet-core', () => ({ - ...jest.requireActual('@suite-common/wallet-core'), +jest.mock('@suite-common/device', () => ({ + ...jest.requireActual('@suite-common/device'), selectDeviceButtonRequestsCodes: () => mockSelectDeviceButtonRequestsCodes(), })); diff --git a/suite-native/transaction-management/src/hooks/useWaitForButtonRequest.ts b/suite-native/transaction-management/src/hooks/useWaitForButtonRequest.ts index 89378b1994..1007a26363 100644 --- a/suite-native/transaction-management/src/hooks/useWaitForButtonRequest.ts +++ b/suite-native/transaction-management/src/hooks/useWaitForButtonRequest.ts @@ -1,7 +1,7 @@ import { useCallback, useEffect, useState } from 'react'; import { useSelector } from 'react-redux'; -import { DeviceRootState, selectDeviceButtonRequestsCodes } from '@suite-common/wallet-core'; +import { DeviceRootState, selectDeviceButtonRequestsCodes } from '@suite-common/device'; export const useWaitForButtonRequest = (onButtonRequest: () => void) => { const [waitingForButtonRequests, setWaitingForButtonRequests] = useState(false); diff --git a/suite-native/transaction-management/src/selectors.ts b/suite-native/transaction-management/src/selectors.ts index 660010b48f..fc9c424cd7 100644 --- a/suite-native/transaction-management/src/selectors.ts +++ b/suite-native/transaction-management/src/selectors.ts @@ -1,13 +1,12 @@ import { A, pipe } from '@mobily/ts-belt'; +import { DeviceRootState, selectSelectedDevice } from '@suite-common/device'; import { createWeakMapSelector } from '@suite-common/redux-utils'; import { AccountsRootState, - DeviceRootState, FormDraftRootState, selectAccountByKey, selectFormDraft, - selectSelectedDevice, selectSendFormDraftByKey, selectSendFormReviewButtonRequestsCount, selectSendPrecomposedTx, diff --git a/suite-native/transaction-management/tsconfig.json b/suite-native/transaction-management/tsconfig.json index 0c9cd2456e..8bbbdafbdc 100644 --- a/suite-native/transaction-management/tsconfig.json +++ b/suite-native/transaction-management/tsconfig.json @@ -2,6 +2,7 @@ "extends": "../../tsconfig.base.json", "compilerOptions": { "outDir": "libDev" }, "references": [ + { "path": "../../suite-common/device" }, { "path": "../../suite-common/redux-utils" }, diff --git a/suite/e2e/package.json b/suite/e2e/package.json index 20f8922390..3025f44e92 100644 --- a/suite/e2e/package.json +++ b/suite/e2e/package.json @@ -29,6 +29,7 @@ "@solana/addresses": "^2.3.0", "@solana/kit": "^2.3.0", "@solana/rpc-types": "^2.3.0", + "@suite-common/device": "workspace:*", "@suite-common/feedback": "workspace:*", "@suite-common/message-system": "workspace:*", "@suite-common/suite-sync-evolu": "workspace:*", @@ -37,7 +38,6 @@ "@suite-common/trading": "workspace:*", "@suite-common/wallet-config": "workspace:*", "@suite-common/wallet-constants": "workspace:*", - "@suite-common/wallet-core": "workspace:*", "@suite-common/wallet-types": "workspace:*", "@suite-common/wallet-utils": "workspace:*", "@suite/analytics": "workspace:*", diff --git a/suite/e2e/tests/onboarding/t2t1/t2t1-entropy-check-failure.test.ts b/suite/e2e/tests/onboarding/t2t1/t2t1-entropy-check-failure.test.ts index 7c4759ed95..40b3d1c5da 100644 --- a/suite/e2e/tests/onboarding/t2t1/t2t1-entropy-check-failure.test.ts +++ b/suite/e2e/tests/onboarding/t2t1/t2t1-entropy-check-failure.test.ts @@ -1,4 +1,4 @@ -import { deviceActions } from '@suite-common/wallet-core'; +import { deviceActions } from '@suite-common/device'; import { TestCategory, TestPriority, createTestAnnotation } from '@trezor/e2e-utils'; import { expect, test } from '../../../support/fixtures'; diff --git a/suite/e2e/tsconfig.json b/suite/e2e/tsconfig.json index d4231c3e31..94c5181f8f 100644 --- a/suite/e2e/tsconfig.json +++ b/suite/e2e/tsconfig.json @@ -11,6 +11,7 @@ "scripts/**/*.ts" ], "references": [ + { "path": "../../suite-common/device" }, { "path": "../../suite-common/feedback" }, { "path": "../../suite-common/message-system" @@ -31,9 +32,6 @@ { "path": "../../suite-common/wallet-constants" }, - { - "path": "../../suite-common/wallet-core" - }, { "path": "../../suite-common/wallet-types" }, diff --git a/yarn.lock b/yarn.lock index 5865e9fcb9..122e8f5288 100644 --- a/yarn.lock +++ b/yarn.lock @@ -10924,6 +10924,7 @@ __metadata: resolution: "@suite-common/bluetooth@workspace:suite-common/bluetooth" dependencies: "@reduxjs/toolkit": "npm:2.11.2" + "@suite-common/device": "workspace:*" "@suite-common/redux-utils": "workspace:*" "@suite-common/suite-types": "workspace:*" "@suite-common/test-utils": "workspace:*" @@ -10938,6 +10939,7 @@ __metadata: dependencies: "@reduxjs/toolkit": "npm:2.11.2" "@suite-common/analytics": "workspace:*" + "@suite-common/device": "workspace:*" "@suite-common/firmware": "workspace:*" "@suite-common/message-system": "workspace:*" "@suite-common/redux-utils": "workspace:*" @@ -10958,6 +10960,7 @@ __metadata: dependencies: "@reduxjs/toolkit": "npm:2.11.2" "@suite-common/analytics": "workspace:*" + "@suite-common/device": "workspace:*" "@suite-common/redux-utils": "workspace:*" "@suite-common/toast-notifications": "workspace:*" "@suite-common/wallet-config": "workspace:*" @@ -10982,7 +10985,6 @@ __metadata: resolution: "@suite-common/delegated-identity-key-types@workspace:suite-common/delegated-identity-key-types" dependencies: "@suite-common/suite-types": "workspace:*" - "@suite-common/wallet-types": "workspace:*" "@trezor/type-utils": "workspace:*" languageName: unknown linkType: soft @@ -10994,10 +10996,9 @@ __metadata: "@noble/curves": "npm:^2.0.1" "@reduxjs/toolkit": "npm:2.11.2" "@suite-common/delegated-identity-key-types": "workspace:*" + "@suite-common/device": "workspace:*" "@suite-common/platform-encryption": "workspace:*" "@suite-common/suite-types": "workspace:*" - "@suite-common/wallet-core": "workspace:*" - "@suite-common/wallet-types": "workspace:*" "@trezor/connect": "workspace:*" "@trezor/type-utils": "workspace:*" "@trezor/utils": "workspace:*" @@ -11016,16 +11017,35 @@ __metadata: version: 0.0.0-use.local resolution: "@suite-common/device-authenticity@workspace:suite-common/device-authenticity" dependencies: + "@suite-common/device": "workspace:*" "@suite-common/message-system": "workspace:*" "@suite-common/redux-utils": "workspace:*" "@suite-common/suite-types": "workspace:*" "@suite-common/test-utils": "workspace:*" "@suite-common/toast-notifications": "workspace:*" - "@suite-common/wallet-core": "workspace:*" "@trezor/connect": "workspace:*" languageName: unknown linkType: soft +"@suite-common/device@workspace:*, @suite-common/device@workspace:suite-common/device": + version: 0.0.0-use.local + resolution: "@suite-common/device@workspace:suite-common/device" + dependencies: + "@mobily/ts-belt": "npm:^3.13.1" + "@reduxjs/toolkit": "npm:2.11.0" + "@suite-common/redux-utils": "workspace:*" + "@suite-common/suite-types": "workspace:*" + "@suite-common/suite-utils": "workspace:*" + "@trezor/connect": "workspace:*" + "@trezor/device-utils": "workspace:*" + "@trezor/env-utils": "workspace:*" + "@trezor/type-utils": "workspace:*" + "@trezor/utils": "workspace:*" + react: "npm:19.1.0" + react-redux: "npm:^9.2.0" + languageName: unknown + linkType: soft + "@suite-common/earn-api@workspace:*, @suite-common/earn-api@workspace:suite-common/earn-api": version: 0.0.0-use.local resolution: "@suite-common/earn-api@workspace:suite-common/earn-api" @@ -11067,11 +11087,11 @@ __metadata: resolution: "@suite-common/firmware-authenticity@workspace:suite-common/firmware-authenticity" dependencies: "@reduxjs/toolkit": "npm:2.11.2" + "@suite-common/device": "workspace:*" "@suite-common/firmware": "workspace:*" "@suite-common/redux-utils": "workspace:*" "@suite-common/suite-types": "workspace:*" "@suite-common/suite-utils": "workspace:*" - "@suite-common/wallet-core": "workspace:*" "@trezor/connect": "workspace:*" "@trezor/device-utils": "workspace:*" "@trezor/type-utils": "workspace:*" @@ -11086,10 +11106,10 @@ __metadata: resolution: "@suite-common/firmware@workspace:suite-common/firmware" dependencies: "@reduxjs/toolkit": "npm:2.11.2" + "@suite-common/device": "workspace:*" "@suite-common/redux-utils": "workspace:*" "@suite-common/suite-types": "workspace:*" "@suite-common/thp": "workspace:*" - "@suite-common/wallet-core": "workspace:*" "@trezor/connect": "workspace:*" "@trezor/device-utils": "workspace:*" "@trezor/env-utils": "workspace:*" @@ -11135,6 +11155,7 @@ __metadata: dependencies: "@mobily/ts-belt": "npm:^3.13.1" "@reduxjs/toolkit": "npm:2.11.2" + "@suite-common/device": "workspace:*" "@suite-common/fiat-services": "workspace:*" "@suite-common/wallet-config": "workspace:*" "@suite-common/wallet-core": "workspace:*" @@ -11169,6 +11190,7 @@ __metadata: "@mobily/ts-belt": "npm:^3.13.1" "@reduxjs/toolkit": "npm:2.11.2" "@suite-common/analytics-redux": "workspace:*" + "@suite-common/device": "workspace:*" "@suite-common/redux-utils": "workspace:*" "@suite-common/suite-types": "workspace:*" "@suite-common/suite-utils": "workspace:*" @@ -11398,12 +11420,12 @@ __metadata: dependencies: "@reduxjs/toolkit": "npm:2.11.2" "@suite-common/delegated-identity-key": "workspace:*" + "@suite-common/device": "workspace:*" "@suite-common/redux-utils": "workspace:*" "@suite-common/suite-sync-storage": "workspace:*" "@suite-common/suite-sync-types": "workspace:*" "@suite-common/suite-types": "workspace:*" "@suite-common/suite-utils": "workspace:*" - "@suite-common/wallet-core": "workspace:*" "@suite-common/wallet-types": "workspace:*" "@suite-common/wallet-utils": "workspace:*" "@trezor/connect": "workspace:*" @@ -11449,6 +11471,7 @@ __metadata: "@suite-common/delegated-identity-key": "workspace:*" "@suite-common/delegated-identity-key-types": "workspace:*" "@suite-common/dependency-injection": "workspace:*" + "@suite-common/device": "workspace:*" "@suite-common/metadata-types": "workspace:*" "@suite-common/platform-encryption": "workspace:*" "@suite-common/redux-utils": "workspace:*" @@ -11593,6 +11616,7 @@ __metadata: resolution: "@suite-common/trading@workspace:suite-common/trading" dependencies: "@reduxjs/toolkit": "npm:2.11.2" + "@suite-common/device": "workspace:*" "@suite-common/geolocation": "workspace:*" "@suite-common/redux-utils": "workspace:*" "@suite-common/suite-types": "workspace:*" @@ -11669,8 +11693,9 @@ __metadata: "@reduxjs/toolkit": "npm:2.11.2" "@suite-common/analytics": "workspace:*" "@suite-common/bluetooth": "workspace:*" + "@suite-common/device": "workspace:*" "@suite-common/fiat-services": "workspace:*" - "@suite-common/platform-encryption": "workspace:*" + "@suite-common/firmware": "workspace:*" "@suite-common/redux-utils": "workspace:*" "@suite-common/staking": "workspace:*" "@suite-common/suite-constants": "workspace:*" @@ -11759,6 +11784,7 @@ __metadata: "@reown/walletkit": "npm:^1.2.8" "@suite-common/analytics": "workspace:*" "@suite-common/connect-popup": "workspace:*" + "@suite-common/device": "workspace:*" "@suite-common/mev": "workspace:*" "@suite-common/redux-utils": "workspace:*" "@suite-common/suite-utils": "workspace:*" @@ -11786,6 +11812,7 @@ __metadata: "@mobily/ts-belt": "npm:^3.13.1" "@react-navigation/native": "npm:7.1.26" "@reduxjs/toolkit": "npm:2.11.2" + "@suite-common/device": "workspace:*" "@suite-common/formatters": "workspace:*" "@suite-common/redux-utils": "workspace:*" "@suite-common/suite-sync": "workspace:*" @@ -11919,6 +11946,7 @@ __metadata: "@shopify/flash-list": "npm:2.2.0" "@shopify/react-native-skia": "npm:2.2.12" "@storybook/react-native": "npm:^10.0.7" + "@suite-common/device": "workspace:*" "@suite-common/firmware-authenticity": "workspace:*" "@suite-common/formatters": "workspace:*" "@suite-common/react-query": "workspace:^" @@ -12077,6 +12105,7 @@ __metadata: "@mobily/ts-belt": "npm:^3.13.1" "@react-navigation/native": "npm:7.1.26" "@suite-common/assets": "workspace:*" + "@suite-common/device": "workspace:*" "@suite-common/formatters": "workspace:*" "@suite-common/redux-utils": "workspace:*" "@suite-common/token-definitions": "workspace:*" @@ -12191,8 +12220,8 @@ __metadata: "@reduxjs/toolkit": "npm:2.11.2" "@suite-common/analytics": "workspace:*" "@suite-common/bluetooth": "workspace:*" + "@suite-common/device": "workspace:*" "@suite-common/redux-utils": "workspace:*" - "@suite-common/wallet-core": "workspace:*" "@suite-native/alerts": "workspace:*" "@suite-native/atoms": "workspace:*" "@suite-native/device-mutex": "workspace:*" @@ -12228,6 +12257,7 @@ __metadata: dependencies: "@react-navigation/native": "npm:7.1.26" "@reduxjs/toolkit": "npm:2.11.2" + "@suite-common/device": "workspace:*" "@suite-common/validators": "workspace:*" "@suite-common/wallet-config": "workspace:*" "@suite-common/wallet-core": "workspace:*" @@ -12308,6 +12338,7 @@ __metadata: dependencies: "@react-navigation/native": "npm:7.1.26" "@reduxjs/toolkit": "npm:2.11.2" + "@suite-common/device": "workspace:*" "@suite-common/suite-types": "workspace:*" "@suite-common/validators": "workspace:*" "@suite-common/wallet-core": "workspace:*" @@ -12355,6 +12386,7 @@ __metadata: "@mobily/ts-belt": "npm:^3.13.1" "@react-navigation/native": "npm:7.1.26" "@reduxjs/toolkit": "npm:2.11.2" + "@suite-common/device": "workspace:*" "@suite-common/redux-utils": "workspace:*" "@suite-common/suite-sync": "workspace:*" "@suite-common/suite-types": "workspace:*" @@ -12409,6 +12441,7 @@ __metadata: "@reduxjs/toolkit": "npm:2.11.2" "@suite-common/analytics": "workspace:*" "@suite-common/bluetooth": "workspace:*" + "@suite-common/device": "workspace:*" "@suite-common/device-authenticity": "workspace:*" "@suite-common/firmware-authenticity": "workspace:*" "@suite-common/message-system": "workspace:*" @@ -12469,6 +12502,7 @@ __metadata: dependencies: "@mobily/ts-belt": "npm:^3.13.1" "@reduxjs/toolkit": "npm:2.11.2" + "@suite-common/device": "workspace:*" "@suite-common/redux-utils": "workspace:*" "@suite-common/suite-types": "workspace:*" "@suite-common/suite-utils": "workspace:*" @@ -12532,6 +12566,7 @@ __metadata: "@react-navigation/native": "npm:7.1.26" "@reduxjs/toolkit": "npm:2.11.2" "@shopify/react-native-skia": "npm:2.2.12" + "@suite-common/device": "workspace:*" "@suite-common/firmware": "workspace:*" "@suite-common/icons": "workspace:*" "@suite-common/message-system": "workspace:*" @@ -12632,6 +12667,7 @@ __metadata: "@reduxjs/toolkit": "npm:2.11.2" "@sentry/react-native": "npm:7.11.0" "@shopify/react-native-skia": "npm:2.2.12" + "@suite-common/device": "workspace:*" "@suite-common/formatters": "workspace:*" "@suite-common/graph": "workspace:*" "@suite-common/redux-utils": "workspace:*" @@ -12746,6 +12782,7 @@ __metadata: "@gorhom/bottom-sheet": "npm:5.2.6" "@react-navigation/native": "npm:7.1.26" "@reduxjs/toolkit": "npm:2.11.2" + "@suite-common/device": "workspace:*" "@suite-common/suite-sync": "workspace:*" "@suite-common/validators": "workspace:*" "@suite-common/wallet-config": "workspace:*" @@ -12789,6 +12826,7 @@ __metadata: dependencies: "@mobily/ts-belt": "npm:^3.13.1" "@reduxjs/toolkit": "npm:2.11.2" + "@suite-common/device": "workspace:*" "@suite-common/geolocation": "workspace:*" "@suite-common/message-system": "workspace:*" "@suite-common/redux-utils": "workspace:*" @@ -12819,6 +12857,7 @@ __metadata: "@reduxjs/toolkit": "npm:2.11.2" "@shopify/flash-list": "npm:2.2.0" "@shopify/react-native-skia": "npm:2.2.12" + "@suite-common/device": "workspace:*" "@suite-common/redux-utils": "workspace:*" "@suite-common/token-definitions": "workspace:*" "@suite-common/validators": "workspace:*" @@ -12864,6 +12903,7 @@ __metadata: "@react-navigation/native": "npm:7.1.26" "@react-navigation/native-stack": "npm:7.9.0" "@reduxjs/toolkit": "npm:2.11.2" + "@suite-common/device": "workspace:*" "@suite-common/fiat-services": "workspace:*" "@suite-common/graph": "workspace:*" "@suite-common/suite-sync": "workspace:*" @@ -12916,6 +12956,7 @@ __metadata: "@react-navigation/native": "npm:7.1.26" "@react-navigation/native-stack": "npm:7.9.0" "@reduxjs/toolkit": "npm:2.11.2" + "@suite-common/device": "workspace:*" "@suite-common/wallet-config": "workspace:*" "@suite-common/wallet-core": "workspace:*" "@suite-common/wallet-types": "workspace:*" @@ -12944,6 +12985,7 @@ __metadata: dependencies: "@react-navigation/native": "npm:7.1.26" "@reduxjs/toolkit": "npm:2.11.2" + "@suite-common/device": "workspace:*" "@suite-common/suite-utils": "workspace:*" "@suite-common/wallet-core": "workspace:*" "@suite-native/atoms": "workspace:*" @@ -12968,6 +13010,7 @@ __metadata: "@reduxjs/toolkit": "npm:2.11.2" "@suite-common/analytics": "workspace:*" "@suite-common/bluetooth": "workspace:*" + "@suite-common/device": "workspace:*" "@suite-common/redux-utils": "workspace:*" "@suite-common/thp": "workspace:*" "@suite-common/wallet-core": "workspace:*" @@ -13010,8 +13053,8 @@ __metadata: "@react-navigation/native": "npm:7.1.26" "@react-navigation/native-stack": "npm:7.9.0" "@reduxjs/toolkit": "npm:2.11.2" + "@suite-common/device": "workspace:*" "@suite-common/redux-utils": "workspace:*" - "@suite-common/wallet-core": "workspace:*" "@suite-native/alerts": "workspace:*" "@suite-native/analytics": "workspace:*" "@suite-native/atoms": "workspace:*" @@ -13041,6 +13084,7 @@ __metadata: "@react-navigation/native": "npm:7.1.26" "@reduxjs/toolkit": "npm:2.11.2" "@suite-common/connect-popup": "workspace:^" + "@suite-common/device": "workspace:*" "@suite-common/formatters": "workspace:*" "@suite-common/tx-simulation": "workspace:^" "@suite-common/wallet-config": "workspace:^" @@ -13152,6 +13196,7 @@ __metadata: "@react-navigation/native-stack": "npm:7.9.0" "@reduxjs/toolkit": "npm:2.11.2" "@shopify/react-native-skia": "npm:2.2.12" + "@suite-common/device": "workspace:*" "@suite-common/message-system": "workspace:*" "@suite-common/suite-constants": "workspace:*" "@suite-common/suite-types": "workspace:*" @@ -13206,6 +13251,7 @@ __metadata: "@react-navigation/native-stack": "npm:7.9.0" "@reduxjs/toolkit": "npm:2.11.2" "@suite-common/analytics": "workspace:*" + "@suite-common/device": "workspace:*" "@suite-common/suite-constants": "workspace:*" "@suite-common/thp": "workspace:*" "@suite-common/validators": "workspace:*" @@ -13241,6 +13287,7 @@ __metadata: "@react-navigation/native-stack": "npm:7.9.0" "@reduxjs/toolkit": "npm:2.11.2" "@shopify/flash-list": "npm:2.2.0" + "@suite-common/device": "workspace:*" "@suite-common/formatters": "workspace:*" "@suite-common/wallet-config": "workspace:*" "@suite-common/wallet-core": "workspace:*" @@ -13275,6 +13322,7 @@ __metadata: "@react-navigation/native": "npm:7.1.26" "@react-navigation/native-stack": "npm:7.9.0" "@reduxjs/toolkit": "npm:2.11.2" + "@suite-common/device": "workspace:*" "@suite-common/graph": "workspace:*" "@suite-common/message-system": "workspace:*" "@suite-common/redux-utils": "workspace:*" @@ -13358,6 +13406,7 @@ __metadata: "@react-navigation/native": "npm:7.1.26" "@react-navigation/native-stack": "npm:7.9.0" "@reduxjs/toolkit": "npm:2.11.2" + "@suite-common/device": "workspace:*" "@suite-common/wallet-core": "workspace:*" "@suite-native/analytics": "workspace:*" "@suite-native/atoms": "workspace:*" @@ -13387,6 +13436,7 @@ __metadata: "@react-navigation/native-stack": "npm:7.9.0" "@reduxjs/toolkit": "npm:2.11.2" "@shopify/flash-list": "npm:2.2.0" + "@suite-common/device": "workspace:*" "@suite-common/formatters": "workspace:*" "@suite-common/token-definitions": "workspace:*" "@suite-common/validators": "workspace:*" @@ -13444,6 +13494,7 @@ __metadata: "@reduxjs/toolkit": "npm:2.11.2" "@suite-common/analytics": "workspace:*" "@suite-common/analytics-redux": "workspace:*" + "@suite-common/device": "workspace:*" "@suite-common/logger": "workspace:*" "@suite-common/mev": "workspace:*" "@suite-common/redux-utils": "workspace:*" @@ -13453,7 +13504,6 @@ __metadata: "@suite-common/validators": "workspace:*" "@suite-common/wallet-config": "workspace:*" "@suite-common/wallet-core": "workspace:*" - "@suite-common/wallet-utils": "workspace:*" "@suite-native/alerts": "workspace:*" "@suite-native/analytics": "workspace:*" "@suite-native/atoms": "workspace:*" @@ -13503,6 +13553,7 @@ __metadata: "@react-navigation/native": "npm:7.1.26" "@react-navigation/native-stack": "npm:7.9.0" "@reduxjs/toolkit": "npm:2.11.2" + "@suite-common/device": "workspace:*" "@suite-common/redux-utils": "workspace:*" "@suite-common/token-definitions": "workspace:*" "@suite-common/wallet-config": "workspace:*" @@ -13541,6 +13592,7 @@ __metadata: "@react-navigation/native-stack": "npm:7.9.0" "@reduxjs/toolkit": "npm:2.11.2" "@shopify/flash-list": "npm:2.2.0" + "@suite-common/device": "workspace:*" "@suite-common/formatters": "workspace:*" "@suite-common/geolocation": "workspace:*" "@suite-common/message-system": "workspace:*" @@ -13658,11 +13710,11 @@ __metadata: "@react-navigation/native-stack": "npm:7.9.0" "@react-navigation/routers": "npm:^7.5.3" "@rozenite/react-navigation-plugin": "npm:^1.2.0" + "@suite-common/device": "workspace:*" "@suite-common/message-system": "workspace:*" "@suite-common/suite-types": "workspace:*" "@suite-common/trading": "workspace:*" "@suite-common/wallet-config": "workspace:*" - "@suite-common/wallet-core": "workspace:*" "@suite-common/wallet-types": "workspace:*" "@suite-native/analytics": "workspace:*" "@suite-native/atoms": "workspace:*" @@ -13697,6 +13749,7 @@ __metadata: "@gorhom/bottom-sheet": "npm:5.2.6" "@react-navigation/native": "npm:7.1.26" "@reduxjs/toolkit": "npm:2.11.2" + "@suite-common/device": "workspace:*" "@suite-common/validators": "workspace:*" "@suite-common/wallet-core": "workspace:*" "@suite-native/alerts": "workspace:*" @@ -13765,6 +13818,7 @@ __metadata: "@react-navigation/native-stack": "npm:7.9.0" "@reduxjs/toolkit": "npm:2.11.2" "@shopify/react-native-skia": "npm:2.2.12" + "@suite-common/device": "workspace:*" "@suite-common/wallet-config": "workspace:*" "@suite-common/wallet-core": "workspace:*" "@suite-common/wallet-types": "workspace:*" @@ -13820,6 +13874,7 @@ __metadata: resolution: "@suite-native/send@workspace:suite-native/send" dependencies: "@reduxjs/toolkit": "npm:2.11.2" + "@suite-common/device": "workspace:*" "@suite-common/mev": "workspace:*" "@suite-common/redux-utils": "workspace:*" "@suite-common/wallet-core": "workspace:*" @@ -13874,6 +13929,7 @@ __metadata: version: 0.0.0-use.local resolution: "@suite-native/staking@workspace:suite-native/staking" dependencies: + "@suite-common/device": "workspace:*" "@suite-common/redux-utils": "workspace:*" "@suite-common/suite-sync": "workspace:*" "@suite-common/suite-types": "workspace:*" @@ -13897,6 +13953,7 @@ __metadata: "@suite-common/analytics-redux": "workspace:*" "@suite-common/connect-popup": "workspace:*" "@suite-common/delegated-identity-key": "workspace:*" + "@suite-common/device": "workspace:*" "@suite-common/firmware": "workspace:*" "@suite-common/geolocation": "workspace:*" "@suite-common/logger": "workspace:*" @@ -13958,6 +14015,7 @@ __metadata: "@mobily/ts-belt": "npm:^3.13.1" "@reduxjs/toolkit": "npm:2.11.2" "@sentry/react-native": "npm:7.11.0" + "@suite-common/device": "workspace:*" "@suite-common/firmware-authenticity": "workspace:*" "@suite-common/suite-types": "workspace:*" "@suite-common/suite-utils": "workspace:*" @@ -14091,8 +14149,8 @@ __metadata: dependencies: "@react-navigation/native": "npm:7.1.26" "@reduxjs/toolkit": "npm:2.11.2" + "@suite-common/device": "workspace:*" "@suite-common/thp": "workspace:*" - "@suite-common/wallet-core": "workspace:*" "@suite-native/alerts": "workspace:*" "@suite-native/atoms": "workspace:*" "@suite-native/intl": "workspace:*" @@ -14126,6 +14184,7 @@ __metadata: resolution: "@suite-native/tokens@workspace:suite-native/tokens" dependencies: "@mobily/ts-belt": "npm:^3.13.1" + "@suite-common/device": "workspace:*" "@suite-common/redux-utils": "workspace:*" "@suite-common/token-definitions": "workspace:*" "@suite-common/wallet-config": "workspace:*" @@ -14292,6 +14351,7 @@ __metadata: resolution: "@suite-native/trading-state@workspace:suite-native/trading-state" dependencies: "@reduxjs/toolkit": "npm:2.11.2" + "@suite-common/device": "workspace:*" "@suite-common/message-system": "workspace:*" "@suite-common/redux-utils": "workspace:*" "@suite-common/suite-sync": "workspace:*" @@ -14343,6 +14403,7 @@ __metadata: dependencies: "@mobily/ts-belt": "npm:^3.13.1" "@reduxjs/toolkit": "npm:2.11.2" + "@suite-common/device": "workspace:*" "@suite-common/redux-utils": "workspace:*" "@suite-common/suite-sync": "workspace:*" "@suite-common/suite-utils": "workspace:*" @@ -15694,6 +15755,7 @@ __metadata: "@solana/addresses": "npm:^2.3.0" "@solana/kit": "npm:^2.3.0" "@solana/rpc-types": "npm:^2.3.0" + "@suite-common/device": "workspace:*" "@suite-common/feedback": "workspace:*" "@suite-common/message-system": "workspace:*" "@suite-common/suite-sync-evolu": "workspace:*" @@ -15702,7 +15764,6 @@ __metadata: "@suite-common/trading": "workspace:*" "@suite-common/wallet-config": "workspace:*" "@suite-common/wallet-constants": "workspace:*" - "@suite-common/wallet-core": "workspace:*" "@suite-common/wallet-types": "workspace:*" "@suite-common/wallet-utils": "workspace:*" "@suite/analytics": "workspace:*" @@ -15790,6 +15851,7 @@ __metadata: "@suite-common/connect-init": "workspace:*" "@suite-common/connect-popup": "workspace:*" "@suite-common/delegated-identity-key": "workspace:*" + "@suite-common/device": "workspace:*" "@suite-common/device-authenticity": "workspace:*" "@suite-common/feedback": "workspace:*" "@suite-common/fiat-services": "workspace:*"