@onekeyfe/hd-core 1.1.34-alpha.3 → 1.1.34-alpha.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/__tests__/DeviceCommands.test.ts +0 -217
- package/__tests__/evmLedgerLegacySafety.test.ts +4 -15
- package/__tests__/evmSignTransaction.test.ts +1 -1
- package/__tests__/evmSignTypedData.test.ts +1 -1
- package/__tests__/firmware-update/firmware-update-v2-download-before-boot.test.ts +31 -48
- package/__tests__/preInitialize.test.ts +0 -33
- package/dist/api/BaseMethod.d.ts +0 -12
- package/dist/api/BaseMethod.d.ts.map +1 -1
- package/dist/api/CheckAllFirmwareRelease.d.ts.map +1 -1
- package/dist/api/CheckBootloaderRelease.d.ts.map +1 -1
- package/dist/api/CheckFirmwareRelease.d.ts.map +1 -1
- package/dist/api/FirmwareUpdate.d.ts.map +1 -1
- package/dist/api/FirmwareUpdateV2.d.ts +3 -14
- package/dist/api/FirmwareUpdateV2.d.ts.map +1 -1
- package/dist/api/FirmwareUpdateV3.d.ts +3 -10
- package/dist/api/FirmwareUpdateV3.d.ts.map +1 -1
- package/dist/api/GetFeatures.d.ts +1 -1
- package/dist/api/GetFeatures.d.ts.map +1 -1
- package/dist/api/GetOnekeyFeatures.d.ts.map +1 -1
- package/dist/api/GetPassphraseState.d.ts.map +1 -1
- package/dist/api/PromptWebDeviceAccess.d.ts.map +1 -1
- package/dist/api/SearchDevices.d.ts +1 -5
- package/dist/api/SearchDevices.d.ts.map +1 -1
- package/dist/api/alephium/AlephiumGetAddress.d.ts +6 -2
- package/dist/api/alephium/AlephiumGetAddress.d.ts.map +1 -1
- package/dist/api/alephium/AlephiumSignMessage.d.ts +5 -2
- package/dist/api/alephium/AlephiumSignMessage.d.ts.map +1 -1
- package/dist/api/alephium/AlephiumSignTransaction.d.ts +8 -5
- package/dist/api/alephium/AlephiumSignTransaction.d.ts.map +1 -1
- package/dist/api/allnetwork/AllNetworkGetAddressBase.d.ts.map +1 -1
- package/dist/api/aptos/AptosGetAddress.d.ts.map +1 -1
- package/dist/api/benfen/BenfenGetAddress.d.ts +9 -2
- package/dist/api/benfen/BenfenGetAddress.d.ts.map +1 -1
- package/dist/api/benfen/BenfenGetPublicKey.d.ts +9 -2
- package/dist/api/benfen/BenfenGetPublicKey.d.ts.map +1 -1
- package/dist/api/benfen/BenfenSignMessage.d.ts +8 -2
- package/dist/api/benfen/BenfenSignMessage.d.ts.map +1 -1
- package/dist/api/benfen/BenfenSignTransaction.d.ts +8 -2
- package/dist/api/benfen/BenfenSignTransaction.d.ts.map +1 -1
- package/dist/api/btc/BTCGetAddress.d.ts +11 -1
- package/dist/api/btc/BTCGetAddress.d.ts.map +1 -1
- package/dist/api/btc/BTCGetPublicKey.d.ts +11 -1
- package/dist/api/btc/BTCGetPublicKey.d.ts.map +1 -1
- package/dist/api/btc/BTCSignMessage.d.ts +15 -1
- package/dist/api/btc/BTCSignMessage.d.ts.map +1 -1
- package/dist/api/btc/BTCSignPsbt.d.ts.map +1 -1
- package/dist/api/btc/BTCSignTransaction.d.ts +11 -1
- package/dist/api/btc/BTCSignTransaction.d.ts.map +1 -1
- package/dist/api/btc/BTCVerifyMessage.d.ts +11 -1
- package/dist/api/btc/BTCVerifyMessage.d.ts.map +1 -1
- package/dist/api/btc/helpers/versionLimit.d.ts +11 -2
- package/dist/api/btc/helpers/versionLimit.d.ts.map +1 -1
- package/dist/api/cardano/CardanoSignTransaction.d.ts.map +1 -1
- package/dist/api/conflux/ConfluxSignTransaction.d.ts.map +1 -1
- package/dist/api/device/DeviceCancel.d.ts.map +1 -1
- package/dist/api/device/DeviceChangePin.d.ts.map +1 -1
- package/dist/api/device/DeviceFullyUploadResource.d.ts +2 -1
- package/dist/api/device/DeviceFullyUploadResource.d.ts.map +1 -1
- package/dist/api/device/DeviceLock.d.ts.map +1 -1
- package/dist/api/device/DeviceRebootToBoardloader.d.ts +1 -1
- package/dist/api/device/DeviceRebootToBoardloader.d.ts.map +1 -1
- package/dist/api/device/DeviceRebootToBootloader.d.ts.map +1 -1
- package/dist/api/device/DeviceSettings.d.ts.map +1 -1
- package/dist/api/device/DeviceSupportFeatures.d.ts.map +1 -1
- package/dist/api/device/DeviceUnlock.d.ts +1 -1
- package/dist/api/device/DeviceUnlock.d.ts.map +1 -1
- package/dist/api/device/DeviceUpdateBootloader.d.ts +1 -7
- package/dist/api/device/DeviceUpdateBootloader.d.ts.map +1 -1
- package/dist/api/device/DeviceUploadResource.d.ts.map +1 -1
- package/dist/api/device/DeviceVerify.d.ts.map +1 -1
- package/dist/api/device/DeviceWipe.d.ts.map +1 -1
- package/dist/api/dynex/DnxGetAddress.d.ts.map +1 -1
- package/dist/api/dynex/DnxSignTransaction.d.ts.map +1 -1
- package/dist/api/evm/EVMGetPublicKey.d.ts.map +1 -1
- package/dist/api/evm/EVMSignMessageEIP712.d.ts +8 -2
- package/dist/api/evm/EVMSignMessageEIP712.d.ts.map +1 -1
- package/dist/api/evm/EVMSignTypedData.d.ts.map +1 -1
- package/dist/api/evm/latest/signTypedData.d.ts +1 -1
- package/dist/api/evm/latest/signTypedData.d.ts.map +1 -1
- package/dist/api/evm/latest/signTypedHash.d.ts.map +1 -1
- package/dist/api/evm/legacyV1/getAddress.d.ts.map +1 -1
- package/dist/api/evm/legacyV1/getPublicKey.d.ts.map +1 -1
- package/dist/api/evm/legacyV1/signMessage.d.ts.map +1 -1
- package/dist/api/evm/legacyV1/signTypedData.d.ts +1 -1
- package/dist/api/evm/legacyV1/signTypedData.d.ts.map +1 -1
- package/dist/api/evm/legacyV1/signTypedHash.d.ts.map +1 -1
- package/dist/api/evm/legacyV1/verifyMessage.d.ts.map +1 -1
- package/dist/api/firmware/FirmwareUpdateBaseMethod.d.ts +1 -10
- package/dist/api/firmware/FirmwareUpdateBaseMethod.d.ts.map +1 -1
- package/dist/api/firmware/bootloaderHelper.d.ts.map +1 -1
- package/dist/api/firmware/getBinary.d.ts +0 -11
- package/dist/api/firmware/getBinary.d.ts.map +1 -1
- package/dist/api/firmware/updateBootloader.d.ts +0 -2
- package/dist/api/firmware/updateBootloader.d.ts.map +1 -1
- package/dist/api/firmware/uploadFirmware.d.ts +1 -9
- package/dist/api/firmware/uploadFirmware.d.ts.map +1 -1
- package/dist/api/helpers/batchGetPublickeys.d.ts +0 -3
- package/dist/api/helpers/batchGetPublickeys.d.ts.map +1 -1
- package/dist/api/index.d.ts +0 -29
- package/dist/api/index.d.ts.map +1 -1
- package/dist/api/kaspa/KaspaSignTransaction.d.ts.map +1 -1
- package/dist/api/lightning/LnurlAuth.d.ts +0 -4
- package/dist/api/lightning/LnurlAuth.d.ts.map +1 -1
- package/dist/api/neo/NeoGetAddress.d.ts +8 -2
- package/dist/api/neo/NeoGetAddress.d.ts.map +1 -1
- package/dist/api/neo/NeoSignTransaction.d.ts +8 -2
- package/dist/api/neo/NeoSignTransaction.d.ts.map +1 -1
- package/dist/api/nervos/NervosGetAddress.d.ts +9 -2
- package/dist/api/nervos/NervosGetAddress.d.ts.map +1 -1
- package/dist/api/nervos/NervosSignTransaction.d.ts +12 -9
- package/dist/api/nervos/NervosSignTransaction.d.ts.map +1 -1
- package/dist/api/nexa/NexaGetAddress.d.ts +8 -2
- package/dist/api/nexa/NexaGetAddress.d.ts.map +1 -1
- package/dist/api/nexa/NexaSignTransaction.d.ts +9 -2
- package/dist/api/nexa/NexaSignTransaction.d.ts.map +1 -1
- package/dist/api/polkadot/PolkadotGetAddress.d.ts +0 -3
- package/dist/api/polkadot/PolkadotGetAddress.d.ts.map +1 -1
- package/dist/api/polkadot/networks.d.ts +0 -3
- package/dist/api/polkadot/networks.d.ts.map +1 -1
- package/dist/api/scdo/ScdoGetAddress.d.ts +6 -2
- package/dist/api/scdo/ScdoGetAddress.d.ts.map +1 -1
- package/dist/api/scdo/ScdoSignMessage.d.ts +5 -2
- package/dist/api/scdo/ScdoSignMessage.d.ts.map +1 -1
- package/dist/api/scdo/ScdoSignTransaction.d.ts +5 -2
- package/dist/api/scdo/ScdoSignTransaction.d.ts.map +1 -1
- package/dist/api/solana/SolGetAddress.d.ts +0 -1
- package/dist/api/solana/SolGetAddress.d.ts.map +1 -1
- package/dist/api/solana/SolSignMessage.d.ts +0 -3
- package/dist/api/solana/SolSignMessage.d.ts.map +1 -1
- package/dist/api/solana/SolSignOffchainMessage.d.ts +0 -3
- package/dist/api/solana/SolSignOffchainMessage.d.ts.map +1 -1
- package/dist/api/solana/SolSignTransaction.d.ts +0 -6
- package/dist/api/solana/SolSignTransaction.d.ts.map +1 -1
- package/dist/api/stellar/StellarGetAddress.d.ts +1 -2
- package/dist/api/stellar/StellarGetAddress.d.ts.map +1 -1
- package/dist/api/stellar/StellarSignTransaction.d.ts +2 -3
- package/dist/api/stellar/StellarSignTransaction.d.ts.map +1 -1
- package/dist/api/sui/SuiGetAddress.d.ts +0 -3
- package/dist/api/sui/SuiGetAddress.d.ts.map +1 -1
- package/dist/api/sui/SuiGetPublicKey.d.ts +0 -3
- package/dist/api/sui/SuiGetPublicKey.d.ts.map +1 -1
- package/dist/api/sui/SuiSignMessage.d.ts +0 -3
- package/dist/api/sui/SuiSignMessage.d.ts.map +1 -1
- package/dist/api/sui/SuiSignTransaction.d.ts +2 -5
- package/dist/api/sui/SuiSignTransaction.d.ts.map +1 -1
- package/dist/api/ton/TonGetAddress.d.ts +0 -3
- package/dist/api/ton/TonGetAddress.d.ts.map +1 -1
- package/dist/api/ton/TonSignData.d.ts +0 -1
- package/dist/api/ton/TonSignData.d.ts.map +1 -1
- package/dist/api/ton/TonSignMessage.d.ts +0 -3
- package/dist/api/ton/TonSignMessage.d.ts.map +1 -1
- package/dist/api/ton/TonSignProof.d.ts +0 -3
- package/dist/api/ton/TonSignProof.d.ts.map +1 -1
- package/dist/api/tron/TronSignMessage.d.ts +0 -3
- package/dist/api/tron/TronSignMessage.d.ts.map +1 -1
- package/dist/api/tron/TronSignTransaction.d.ts +0 -3
- package/dist/api/tron/TronSignTransaction.d.ts.map +1 -1
- package/dist/api/utils.d.ts +1 -2
- package/dist/api/utils.d.ts.map +1 -1
- package/dist/constants/index.d.ts +1 -2
- package/dist/constants/index.d.ts.map +1 -1
- package/dist/core/RequestQueue.d.ts +1 -19
- package/dist/core/RequestQueue.d.ts.map +1 -1
- package/dist/core/index.d.ts +1 -4
- package/dist/core/index.d.ts.map +1 -1
- package/dist/data-manager/DataManager.d.ts +5 -9
- package/dist/data-manager/DataManager.d.ts.map +1 -1
- package/dist/data-manager/MessagesConfig.d.ts +2 -2
- package/dist/data-manager/MessagesConfig.d.ts.map +1 -1
- package/dist/data-manager/TransportManager.d.ts +4 -5
- package/dist/data-manager/TransportManager.d.ts.map +1 -1
- package/dist/data-manager/connectSettings.d.ts.map +1 -1
- package/dist/device/Device.d.ts +16 -60
- package/dist/device/Device.d.ts.map +1 -1
- package/dist/device/DeviceCommands.d.ts +14 -16
- package/dist/device/DeviceCommands.d.ts.map +1 -1
- package/dist/device/DeviceConnector.d.ts +1 -2
- package/dist/device/DeviceConnector.d.ts.map +1 -1
- package/dist/device/DevicePool.d.ts +2 -4
- package/dist/device/DevicePool.d.ts.map +1 -1
- package/dist/events/call.d.ts +0 -7
- package/dist/events/call.d.ts.map +1 -1
- package/dist/events/core.d.ts +2 -2
- package/dist/events/core.d.ts.map +1 -1
- package/dist/events/device.d.ts +2 -11
- package/dist/events/device.d.ts.map +1 -1
- package/dist/events/iframe.d.ts +0 -1
- package/dist/events/iframe.d.ts.map +1 -1
- package/dist/events/logBlockEvent.d.ts +0 -1
- package/dist/events/logBlockEvent.d.ts.map +1 -1
- package/dist/events/ui-request.d.ts +2 -26
- package/dist/events/ui-request.d.ts.map +1 -1
- package/dist/index.d.ts +451 -1797
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5556 -26855
- package/dist/inject.d.ts +2 -3
- package/dist/inject.d.ts.map +1 -1
- package/dist/lowLevelInject.d.ts +1 -2
- package/dist/lowLevelInject.d.ts.map +1 -1
- package/dist/topLevelInject.d.ts.map +1 -1
- package/dist/types/api/checkAllFirmwareRelease.d.ts +2 -4
- package/dist/types/api/checkAllFirmwareRelease.d.ts.map +1 -1
- package/dist/types/api/deviceSettings.d.ts +0 -9
- package/dist/types/api/deviceSettings.d.ts.map +1 -1
- package/dist/types/api/deviceUnlock.d.ts +1 -1
- package/dist/types/api/deviceUnlock.d.ts.map +1 -1
- package/dist/types/api/deviceUpdateBootloader.d.ts +1 -6
- package/dist/types/api/deviceUpdateBootloader.d.ts.map +1 -1
- package/dist/types/api/export.d.ts +1 -4
- package/dist/types/api/export.d.ts.map +1 -1
- package/dist/types/api/firmwareUpdate.d.ts +1 -114
- package/dist/types/api/firmwareUpdate.d.ts.map +1 -1
- package/dist/types/api/getFeatures.d.ts.map +1 -1
- package/dist/types/api/getOnekeyFeatures.d.ts.map +1 -1
- package/dist/types/api/getPassphraseState.d.ts +1 -2
- package/dist/types/api/getPassphraseState.d.ts.map +1 -1
- package/dist/types/api/index.d.ts +2 -48
- package/dist/types/api/index.d.ts.map +1 -1
- package/dist/types/api/searchDevices.d.ts +2 -2
- package/dist/types/api/searchDevices.d.ts.map +1 -1
- package/dist/types/device.d.ts +5 -207
- package/dist/types/device.d.ts.map +1 -1
- package/dist/types/params.d.ts +0 -3
- package/dist/types/params.d.ts.map +1 -1
- package/dist/types/settings.d.ts +0 -33
- package/dist/types/settings.d.ts.map +1 -1
- package/dist/utils/capabilitieUtils.d.ts.map +1 -1
- package/dist/utils/deviceFeaturesUtils.d.ts +9 -17
- package/dist/utils/deviceFeaturesUtils.d.ts.map +1 -1
- package/dist/utils/deviceInfoUtils.d.ts +8 -10
- package/dist/utils/deviceInfoUtils.d.ts.map +1 -1
- package/dist/utils/deviceSettings.d.ts +0 -2
- package/dist/utils/deviceSettings.d.ts.map +1 -1
- package/dist/utils/deviceVersionUtils.d.ts +5 -6
- package/dist/utils/deviceVersionUtils.d.ts.map +1 -1
- package/dist/utils/findDefectiveBatchDevice.d.ts +1 -1
- package/dist/utils/homescreen.d.ts.map +1 -1
- package/dist/utils/index.d.ts +1 -3
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/patch.d.ts +1 -1
- package/dist/utils/patch.d.ts.map +1 -1
- package/dist/utils/tracing.d.ts.map +1 -1
- package/dist/utils/versionUtils.d.ts +1 -1
- package/package.json +4 -4
- package/src/api/BaseMethod.ts +23 -60
- package/src/api/CheckAllFirmwareRelease.ts +3 -16
- package/src/api/CheckBootloaderRelease.ts +2 -1
- package/src/api/CheckFirmwareRelease.ts +2 -1
- package/src/api/FirmwareUpdate.ts +7 -15
- package/src/api/FirmwareUpdateV2.ts +148 -354
- package/src/api/FirmwareUpdateV3.ts +62 -376
- package/src/api/GetFeatures.ts +4 -12
- package/src/api/GetOnekeyFeatures.ts +3 -15
- package/src/api/GetPassphraseState.ts +10 -9
- package/src/api/PromptWebDeviceAccess.ts +1 -10
- package/src/api/SearchDevices.ts +3 -33
- package/src/api/alephium/AlephiumGetAddress.ts +2 -6
- package/src/api/alephium/AlephiumSignMessage.ts +1 -6
- package/src/api/alephium/AlephiumSignTransaction.ts +4 -15
- package/src/api/allnetwork/AllNetworkGetAddressBase.ts +21 -25
- package/src/api/aptos/AptosGetAddress.ts +3 -2
- package/src/api/benfen/BenfenGetAddress.ts +7 -11
- package/src/api/benfen/BenfenGetPublicKey.ts +2 -6
- package/src/api/benfen/BenfenSignMessage.ts +1 -6
- package/src/api/benfen/BenfenSignTransaction.ts +1 -6
- package/src/api/btc/BTCGetPublicKey.ts +2 -3
- package/src/api/btc/BTCSignPsbt.ts +2 -1
- package/src/api/btc/helpers/versionLimit.ts +1 -7
- package/src/api/cardano/CardanoSignTransaction.ts +4 -2
- package/src/api/conflux/ConfluxSignTransaction.ts +2 -5
- package/src/api/device/DeviceCancel.ts +0 -1
- package/src/api/device/DeviceChangePin.ts +0 -24
- package/src/api/device/DeviceFullyUploadResource.ts +7 -6
- package/src/api/device/DeviceLock.ts +3 -2
- package/src/api/device/DeviceRebootToBoardloader.ts +1 -11
- package/src/api/device/DeviceRebootToBootloader.ts +1 -11
- package/src/api/device/DeviceSettings.ts +0 -121
- package/src/api/device/DeviceSupportFeatures.ts +13 -2
- package/src/api/device/DeviceUnlock.ts +0 -9
- package/src/api/device/DeviceUpdateBootloader.ts +11 -175
- package/src/api/device/DeviceUploadResource.ts +5 -4
- package/src/api/device/DeviceVerify.ts +2 -1
- package/src/api/device/DeviceWipe.ts +0 -19
- package/src/api/dynex/DnxGetAddress.ts +0 -6
- package/src/api/dynex/DnxSignTransaction.ts +0 -6
- package/src/api/evm/EVMGetAddress.ts +1 -1
- package/src/api/evm/EVMGetPublicKey.ts +4 -3
- package/src/api/evm/EVMSignMessage.ts +1 -1
- package/src/api/evm/EVMSignMessageEIP712.ts +1 -14
- package/src/api/evm/EVMSignTransaction.ts +1 -1
- package/src/api/evm/EVMSignTypedData.ts +18 -30
- package/src/api/evm/EVMVerifyMessage.ts +1 -1
- package/src/api/evm/latest/signTypedHash.ts +4 -2
- package/src/api/evm/legacyV1/getAddress.ts +3 -5
- package/src/api/evm/legacyV1/getPublicKey.ts +3 -5
- package/src/api/evm/legacyV1/signMessage.ts +3 -5
- package/src/api/evm/legacyV1/signTypedData.ts +8 -9
- package/src/api/evm/legacyV1/signTypedHash.ts +7 -7
- package/src/api/evm/legacyV1/verifyMessage.ts +3 -5
- package/src/api/firmware/FirmwareUpdateBaseMethod.ts +15 -83
- package/src/api/firmware/bootloaderHelper.ts +2 -3
- package/src/api/firmware/getBinary.ts +1 -1
- package/src/api/firmware/releaseHelper.ts +3 -3
- package/src/api/firmware/updateBootloader.ts +4 -19
- package/src/api/firmware/uploadFirmware.ts +34 -148
- package/src/api/helpers/batchGetPublickeys.ts +6 -51
- package/src/api/index.ts +0 -32
- package/src/api/kaspa/KaspaSignTransaction.ts +3 -2
- package/src/api/lightning/LnurlAuth.ts +0 -4
- package/src/api/neo/NeoGetAddress.ts +1 -6
- package/src/api/neo/NeoSignTransaction.ts +1 -6
- package/src/api/nervos/NervosGetAddress.ts +2 -6
- package/src/api/nervos/NervosSignTransaction.ts +4 -14
- package/src/api/nexa/NexaGetAddress.ts +2 -6
- package/src/api/nexa/NexaSignTransaction.ts +12 -11
- package/src/api/polkadot/networks.ts +0 -9
- package/src/api/scdo/ScdoGetAddress.ts +2 -6
- package/src/api/scdo/ScdoSignMessage.ts +1 -6
- package/src/api/scdo/ScdoSignTransaction.ts +2 -6
- package/src/api/solana/SolGetAddress.ts +0 -4
- package/src/api/solana/SolSignMessage.ts +0 -3
- package/src/api/solana/SolSignOffchainMessage.ts +0 -3
- package/src/api/solana/SolSignTransaction.ts +0 -6
- package/src/api/stellar/StellarGetAddress.ts +1 -10
- package/src/api/stellar/StellarSignTransaction.ts +1 -14
- package/src/api/sui/SuiGetAddress.ts +3 -5
- package/src/api/sui/SuiGetPublicKey.ts +0 -3
- package/src/api/sui/SuiSignMessage.ts +0 -3
- package/src/api/sui/SuiSignTransaction.ts +12 -14
- package/src/api/ton/TonGetAddress.ts +0 -3
- package/src/api/ton/TonSignData.ts +3 -6
- package/src/api/ton/TonSignMessage.ts +5 -6
- package/src/api/ton/TonSignProof.ts +0 -3
- package/src/api/tron/TronSignMessage.ts +1 -4
- package/src/api/tron/TronSignTransaction.ts +0 -3
- package/src/api/utils.ts +3 -7
- package/src/api/xrp/XrpSignTransaction.ts +1 -1
- package/src/constants/index.ts +1 -7
- package/src/core/RequestQueue.ts +4 -124
- package/src/core/index.ts +116 -255
- package/src/data-manager/DataManager.ts +49 -61
- package/src/data-manager/MessagesConfig.ts +14 -14
- package/src/data-manager/TransportManager.ts +12 -38
- package/src/data-manager/connectSettings.ts +0 -15
- package/src/device/Device.ts +164 -759
- package/src/device/DeviceCommands.ts +36 -245
- package/src/device/DeviceConnector.ts +4 -29
- package/src/device/DevicePool.ts +21 -69
- package/src/events/call.ts +0 -6
- package/src/events/core.ts +0 -2
- package/src/events/device.ts +1 -17
- package/src/events/iframe.ts +0 -1
- package/src/events/logBlockEvent.ts +0 -30
- package/src/events/ui-request.ts +2 -32
- package/src/index.ts +0 -9
- package/src/inject.ts +3 -75
- package/src/lowLevelInject.ts +1 -8
- package/src/topLevelInject.ts +1 -7
- package/src/types/api/checkAllFirmwareRelease.ts +2 -4
- package/src/types/api/deviceSettings.ts +0 -9
- package/src/types/api/deviceUnlock.ts +1 -1
- package/src/types/api/deviceUpdateBootloader.ts +1 -10
- package/src/types/api/export.ts +0 -25
- package/src/types/api/firmwareUpdate.ts +1 -163
- package/src/types/api/getFeatures.ts +0 -3
- package/src/types/api/getOnekeyFeatures.ts +0 -3
- package/src/types/api/getPassphraseState.ts +2 -10
- package/src/types/api/index.ts +2 -89
- package/src/types/api/searchDevices.ts +2 -2
- package/src/types/device.ts +5 -266
- package/src/types/params.ts +0 -11
- package/src/types/settings.ts +29 -54
- package/src/utils/capabilitieUtils.ts +2 -1
- package/src/utils/deviceFeaturesUtils.ts +84 -122
- package/src/utils/deviceInfoUtils.ts +87 -38
- package/src/utils/deviceSettings.ts +0 -48
- package/src/utils/deviceVersionUtils.ts +62 -25
- package/src/utils/findDefectiveBatchDevice.ts +8 -8
- package/src/utils/homescreen.ts +0 -10
- package/src/utils/index.ts +0 -4
- package/src/utils/tracing.ts +1 -3
- package/__tests__/AllNetworkGetAddressBase.tracing.test.ts +0 -75
- package/__tests__/RequestQueue.test.ts +0 -140
- package/__tests__/UploadPortfolio.test.ts +0 -46
- package/__tests__/connectSettings.test.ts +0 -61
- package/__tests__/device-lifecycle-events.test.ts +0 -117
- package/__tests__/device-pool-state.test.ts +0 -132
- package/__tests__/device-settings.test.ts +0 -286
- package/__tests__/device-state-mapper.test.ts +0 -229
- package/__tests__/device-utils.test.ts +0 -106
- package/__tests__/device-wallet-session-store.test.ts +0 -191
- package/__tests__/filesystemValidation.test.ts +0 -53
- package/__tests__/firmware-update/firmware-artifact-source.test.ts +0 -119
- package/__tests__/firmware-update/firmware-checkpoint.test.ts +0 -105
- package/__tests__/firmware-update/firmware-host-binding.test.ts +0 -73
- package/__tests__/firmware-update/firmware-update-capabilities.test.ts +0 -17
- package/__tests__/firmware-update/firmware-update-plan.test.ts +0 -358
- package/__tests__/firmware-update/firmware-update-prepared-plan.test.ts +0 -200
- package/__tests__/firmware-update/firmware-update-recovery.test.ts +0 -81
- package/__tests__/firmware-update/firmware-upload-source.test.ts +0 -70
- package/__tests__/get-device-state.test.ts +0 -403
- package/__tests__/logBlockEvent.test.ts +0 -61
- package/__tests__/logger.test.ts +0 -34
- package/__tests__/open-wallet-session.test.ts +0 -565
- package/__tests__/pro2Wallpaper.test.ts +0 -39
- package/__tests__/protocol-v2-bootloader-mode.test.ts +0 -37
- package/__tests__/protocol-v2-firmware-targets.test.ts +0 -19
- package/__tests__/protocol-v2.test.ts +0 -6008
- package/__tests__/protocolV2FileWrite.test.ts +0 -67
- package/__tests__/public-pro2-api-boundary.test.ts +0 -66
- package/__tests__/search-devices.test.ts +0 -136
- package/dist/api/ClearSessionCache.d.ts +0 -9
- package/dist/api/ClearSessionCache.d.ts.map +0 -1
- package/dist/api/DirList.d.ts +0 -10
- package/dist/api/DirList.d.ts.map +0 -1
- package/dist/api/DirMake.d.ts +0 -9
- package/dist/api/DirMake.d.ts.map +0 -1
- package/dist/api/DirRemove.d.ts +0 -9
- package/dist/api/DirRemove.d.ts.map +0 -1
- package/dist/api/FileDelete.d.ts +0 -9
- package/dist/api/FileDelete.d.ts.map +0 -1
- package/dist/api/FileRead.d.ts +0 -19
- package/dist/api/FileRead.d.ts.map +0 -1
- package/dist/api/FileWrite.d.ts +0 -25
- package/dist/api/FileWrite.d.ts.map +0 -1
- package/dist/api/FirmwareUpdateV4.d.ts +0 -75
- package/dist/api/FirmwareUpdateV4.d.ts.map +0 -1
- package/dist/api/GetDeviceState.d.ts +0 -7
- package/dist/api/GetDeviceState.d.ts.map +0 -1
- package/dist/api/OpenWalletSession.d.ts +0 -14
- package/dist/api/OpenWalletSession.d.ts.map +0 -1
- package/dist/api/PathInfo.d.ts +0 -10
- package/dist/api/PathInfo.d.ts.map +0 -1
- package/dist/api/UploadPortfolio.d.ts +0 -18
- package/dist/api/UploadPortfolio.d.ts.map +0 -1
- package/dist/api/firmware/FirmwareArtifactSource.d.ts +0 -26
- package/dist/api/firmware/FirmwareArtifactSource.d.ts.map +0 -1
- package/dist/api/firmware/FirmwareCheckpoint.d.ts +0 -15
- package/dist/api/firmware/FirmwareCheckpoint.d.ts.map +0 -1
- package/dist/api/firmware/FirmwareHostBinding.d.ts +0 -6
- package/dist/api/firmware/FirmwareHostBinding.d.ts.map +0 -1
- package/dist/api/firmware/FirmwareUpdateCapabilities.d.ts +0 -3
- package/dist/api/firmware/FirmwareUpdateCapabilities.d.ts.map +0 -1
- package/dist/api/firmware/FirmwareUpdatePlan.d.ts +0 -29
- package/dist/api/firmware/FirmwareUpdatePlan.d.ts.map +0 -1
- package/dist/api/firmware/FirmwareUpdatePreparedPlan.d.ts +0 -25
- package/dist/api/firmware/FirmwareUpdatePreparedPlan.d.ts.map +0 -1
- package/dist/api/firmware/progressThrottle.d.ts +0 -3
- package/dist/api/firmware/progressThrottle.d.ts.map +0 -1
- package/dist/api/helpers/filesystemValidation.d.ts +0 -10
- package/dist/api/helpers/filesystemValidation.d.ts.map +0 -1
- package/dist/api/helpers/protocolV2FileWrite.d.ts +0 -33
- package/dist/api/helpers/protocolV2FileWrite.d.ts.map +0 -1
- package/dist/api/protocol-v2/DeviceFactoryInfoGet.d.ts +0 -6
- package/dist/api/protocol-v2/DeviceFactoryInfoGet.d.ts.map +0 -1
- package/dist/api/protocol-v2/DeviceFactoryInfoSet.d.ts +0 -7
- package/dist/api/protocol-v2/DeviceFactoryInfoSet.d.ts.map +0 -1
- package/dist/api/protocol-v2/DeviceFirmwareUpdate.d.ts +0 -7
- package/dist/api/protocol-v2/DeviceFirmwareUpdate.d.ts.map +0 -1
- package/dist/api/protocol-v2/DeviceGetFirmwareUpdateStatus.d.ts +0 -7
- package/dist/api/protocol-v2/DeviceGetFirmwareUpdateStatus.d.ts.map +0 -1
- package/dist/api/protocol-v2/DeviceGetOnboardingStatus.d.ts +0 -6
- package/dist/api/protocol-v2/DeviceGetOnboardingStatus.d.ts.map +0 -1
- package/dist/api/protocol-v2/DeviceInfoGet.d.ts +0 -28
- package/dist/api/protocol-v2/DeviceInfoGet.d.ts.map +0 -1
- package/dist/api/protocol-v2/DeviceReboot.d.ts +0 -7
- package/dist/api/protocol-v2/DeviceReboot.d.ts.map +0 -1
- package/dist/api/protocol-v2/DeviceSessionOpen.d.ts +0 -28
- package/dist/api/protocol-v2/DeviceSessionOpen.d.ts.map +0 -1
- package/dist/api/protocol-v2/DeviceSettingsGet.d.ts +0 -6
- package/dist/api/protocol-v2/DeviceSettingsGet.d.ts.map +0 -1
- package/dist/api/protocol-v2/DeviceSettingsPageShow.d.ts +0 -16
- package/dist/api/protocol-v2/DeviceSettingsPageShow.d.ts.map +0 -1
- package/dist/api/protocol-v2/DeviceSettingsSet.d.ts +0 -12
- package/dist/api/protocol-v2/DeviceSettingsSet.d.ts.map +0 -1
- package/dist/api/protocol-v2/DeviceStatusGet.d.ts +0 -6
- package/dist/api/protocol-v2/DeviceStatusGet.d.ts.map +0 -1
- package/dist/api/protocol-v2/DeviceUploadWallpaper.d.ts +0 -26
- package/dist/api/protocol-v2/DeviceUploadWallpaper.d.ts.map +0 -1
- package/dist/api/protocol-v2/FilesystemFormat.d.ts +0 -6
- package/dist/api/protocol-v2/FilesystemFormat.d.ts.map +0 -1
- package/dist/api/protocol-v2/FilesystemPermissionFix.d.ts +0 -6
- package/dist/api/protocol-v2/FilesystemPermissionFix.d.ts.map +0 -1
- package/dist/api/protocol-v2/Ping.d.ts +0 -8
- package/dist/api/protocol-v2/Ping.d.ts.map +0 -1
- package/dist/api/protocol-v2/ProtocolInfoRequest.d.ts +0 -6
- package/dist/api/protocol-v2/ProtocolInfoRequest.d.ts.map +0 -1
- package/dist/api/protocol-v2/helpers.d.ts +0 -42
- package/dist/api/protocol-v2/helpers.d.ts.map +0 -1
- package/dist/core/deviceEventRegistration.d.ts +0 -11
- package/dist/core/deviceEventRegistration.d.ts.map +0 -1
- package/dist/device/DeviceFeaturesState.d.ts +0 -4
- package/dist/device/DeviceFeaturesState.d.ts.map +0 -1
- package/dist/device/DeviceStateMapper.d.ts +0 -13
- package/dist/device/DeviceStateMapper.d.ts.map +0 -1
- package/dist/device/DeviceStateProjector.d.ts +0 -7
- package/dist/device/DeviceStateProjector.d.ts.map +0 -1
- package/dist/device/DeviceStateStore.d.ts +0 -21
- package/dist/device/DeviceStateStore.d.ts.map +0 -1
- package/dist/device/DeviceWalletSessionStore.d.ts +0 -15
- package/dist/device/DeviceWalletSessionStore.d.ts.map +0 -1
- package/dist/device/cloneDeviceState.d.ts +0 -2
- package/dist/device/cloneDeviceState.d.ts.map +0 -1
- package/dist/device/deviceIdentity.d.ts +0 -5
- package/dist/device/deviceIdentity.d.ts.map +0 -1
- package/dist/deviceProfile/buildDeviceFeatures.d.ts +0 -12
- package/dist/deviceProfile/buildDeviceFeatures.d.ts.map +0 -1
- package/dist/deviceProfile/index.d.ts +0 -2
- package/dist/deviceProfile/index.d.ts.map +0 -1
- package/dist/protocols/protocol-v2/deviceSession.d.ts +0 -7
- package/dist/protocols/protocol-v2/deviceSession.d.ts.map +0 -1
- package/dist/protocols/protocol-v2/features.d.ts +0 -88
- package/dist/protocols/protocol-v2/features.d.ts.map +0 -1
- package/dist/protocols/protocol-v2/firmware.d.ts +0 -15
- package/dist/protocols/protocol-v2/firmware.d.ts.map +0 -1
- package/dist/protocols/protocol-v2/index.d.ts +0 -5
- package/dist/protocols/protocol-v2/index.d.ts.map +0 -1
- package/dist/protocols/protocol-v2/lockedError.d.ts +0 -2
- package/dist/protocols/protocol-v2/lockedError.d.ts.map +0 -1
- package/dist/protocols/protocol-v2/settingsUnlockPolicy.d.ts +0 -16
- package/dist/protocols/protocol-v2/settingsUnlockPolicy.d.ts.map +0 -1
- package/dist/protocols/protocol-v2/uiInteraction.d.ts +0 -39
- package/dist/protocols/protocol-v2/uiInteraction.d.ts.map +0 -1
- package/dist/protocols/protocol-v2/unlockRetry.d.ts +0 -11
- package/dist/protocols/protocol-v2/unlockRetry.d.ts.map +0 -1
- package/dist/protocols/protocol-v2/walletSession.d.ts +0 -21
- package/dist/protocols/protocol-v2/walletSession.d.ts.map +0 -1
- package/dist/types/api/firmwareUpdateCapabilities.d.ts +0 -13
- package/dist/types/api/firmwareUpdateCapabilities.d.ts.map +0 -1
- package/dist/types/api/firmwareUpdatePlan.d.ts +0 -35
- package/dist/types/api/firmwareUpdatePlan.d.ts.map +0 -1
- package/dist/types/api/firmwareUpdatePreparedPlan.d.ts +0 -43
- package/dist/types/api/firmwareUpdatePreparedPlan.d.ts.map +0 -1
- package/dist/types/api/getDeviceState.d.ts +0 -12
- package/dist/types/api/getDeviceState.d.ts.map +0 -1
- package/dist/types/api/openWalletSession.d.ts +0 -35
- package/dist/types/api/openWalletSession.d.ts.map +0 -1
- package/dist/types/api/protocolV2.d.ts +0 -113
- package/dist/types/api/protocolV2.d.ts.map +0 -1
- package/dist/types/api/sessionCache.d.ts +0 -10
- package/dist/types/api/sessionCache.d.ts.map +0 -1
- package/dist/utils/deviceFeaturesCompat.d.ts +0 -13
- package/dist/utils/deviceFeaturesCompat.d.ts.map +0 -1
- package/dist/utils/pro2Wallpaper.d.ts +0 -12
- package/dist/utils/pro2Wallpaper.d.ts.map +0 -1
- package/src/api/ClearSessionCache.ts +0 -28
- package/src/api/DirList.ts +0 -33
- package/src/api/DirMake.ts +0 -23
- package/src/api/DirRemove.ts +0 -23
- package/src/api/FileDelete.ts +0 -23
- package/src/api/FileRead.ts +0 -183
- package/src/api/FileWrite.ts +0 -71
- package/src/api/FirmwareUpdateV4.ts +0 -2279
- package/src/api/GetDeviceState.ts +0 -55
- package/src/api/OpenWalletSession.ts +0 -211
- package/src/api/PathInfo.ts +0 -41
- package/src/api/UploadPortfolio.ts +0 -50
- package/src/api/firmware/FirmwareArtifactSource.ts +0 -278
- package/src/api/firmware/FirmwareCheckpoint.ts +0 -188
- package/src/api/firmware/FirmwareHostBinding.ts +0 -108
- package/src/api/firmware/FirmwareUpdateCapabilities.ts +0 -13
- package/src/api/firmware/FirmwareUpdatePlan.ts +0 -729
- package/src/api/firmware/FirmwareUpdatePreparedPlan.ts +0 -403
- package/src/api/firmware/progressThrottle.ts +0 -44
- package/src/api/helpers/filesystemValidation.ts +0 -112
- package/src/api/helpers/protocolV2FileWrite.ts +0 -193
- package/src/api/protocol-v2/DeviceFactoryInfoGet.ts +0 -20
- package/src/api/protocol-v2/DeviceFactoryInfoSet.ts +0 -32
- package/src/api/protocol-v2/DeviceFirmwareUpdate.ts +0 -61
- package/src/api/protocol-v2/DeviceGetFirmwareUpdateStatus.ts +0 -55
- package/src/api/protocol-v2/DeviceGetOnboardingStatus.ts +0 -18
- package/src/api/protocol-v2/DeviceInfoGet.ts +0 -145
- package/src/api/protocol-v2/DeviceReboot.ts +0 -26
- package/src/api/protocol-v2/DeviceSessionOpen.ts +0 -102
- package/src/api/protocol-v2/DeviceSettingsGet.ts +0 -18
- package/src/api/protocol-v2/DeviceSettingsPageShow.ts +0 -70
- package/src/api/protocol-v2/DeviceSettingsSet.ts +0 -44
- package/src/api/protocol-v2/DeviceStatusGet.ts +0 -16
- package/src/api/protocol-v2/DeviceUploadWallpaper.ts +0 -131
- package/src/api/protocol-v2/FilesystemFormat.ts +0 -19
- package/src/api/protocol-v2/FilesystemPermissionFix.ts +0 -16
- package/src/api/protocol-v2/Ping.ts +0 -18
- package/src/api/protocol-v2/ProtocolInfoRequest.ts +0 -16
- package/src/api/protocol-v2/helpers.ts +0 -203
- package/src/core/deviceEventRegistration.ts +0 -23
- package/src/data/messages/messages-protocol-v2.json +0 -13544
- package/src/device/DeviceFeaturesState.ts +0 -34
- package/src/device/DeviceStateMapper.ts +0 -348
- package/src/device/DeviceStateProjector.ts +0 -95
- package/src/device/DeviceStateStore.ts +0 -201
- package/src/device/DeviceWalletSessionStore.ts +0 -78
- package/src/device/cloneDeviceState.ts +0 -39
- package/src/device/deviceIdentity.ts +0 -18
- package/src/deviceProfile/buildDeviceFeatures.ts +0 -391
- package/src/deviceProfile/index.ts +0 -4
- package/src/protocols/protocol-v2/deviceSession.ts +0 -24
- package/src/protocols/protocol-v2/features.ts +0 -163
- package/src/protocols/protocol-v2/firmware.ts +0 -21
- package/src/protocols/protocol-v2/index.ts +0 -18
- package/src/protocols/protocol-v2/lockedError.ts +0 -10
- package/src/protocols/protocol-v2/settingsUnlockPolicy.ts +0 -61
- package/src/protocols/protocol-v2/uiInteraction.ts +0 -210
- package/src/protocols/protocol-v2/unlockRetry.ts +0 -76
- package/src/protocols/protocol-v2/walletSession.ts +0 -202
- package/src/types/api/firmwareUpdateCapabilities.ts +0 -13
- package/src/types/api/firmwareUpdatePlan.ts +0 -52
- package/src/types/api/firmwareUpdatePreparedPlan.ts +0 -55
- package/src/types/api/getDeviceState.ts +0 -19
- package/src/types/api/openWalletSession.ts +0 -54
- package/src/types/api/protocolV2.ts +0 -244
- package/src/types/api/sessionCache.ts +0 -14
- package/src/utils/deviceFeaturesCompat.ts +0 -173
- package/src/utils/pro2Wallpaper.ts +0 -109
|
@@ -1,47 +1,32 @@
|
|
|
1
1
|
import semver from 'semver';
|
|
2
2
|
import { isNaN } from 'lodash';
|
|
3
3
|
import { EDeviceType, type EFirmwareType, ERRORS, HardwareErrorCode } from '@onekeyfe/hd-shared';
|
|
4
|
-
import { Enum_Capability
|
|
4
|
+
import { Enum_Capability } from '@onekeyfe/hd-transport';
|
|
5
5
|
|
|
6
6
|
import { toHardened } from '../api/helpers/pathUtils';
|
|
7
7
|
import { DeviceModelToTypes, DeviceTypeToModels } from '../types';
|
|
8
|
-
import DataManager, {
|
|
9
|
-
type IFirmwareField,
|
|
10
|
-
type ProtocolV1MessageSchema,
|
|
11
|
-
} from '../data-manager/DataManager';
|
|
8
|
+
import DataManager, { type IFirmwareField, type MessageVersion } from '../data-manager/DataManager';
|
|
12
9
|
import { PROTOBUF_MESSAGE_CONFIG } from '../data-manager/MessagesConfig';
|
|
13
10
|
import { getDeviceType } from './deviceInfoUtils';
|
|
14
11
|
import { getDeviceFirmwareVersion } from './deviceVersionUtils';
|
|
15
12
|
import { existCapability } from './capabilitieUtils';
|
|
16
|
-
import { getProtocolV2WalletSession } from '../protocols/protocol-v2/walletSession';
|
|
17
13
|
|
|
18
14
|
import type { Device } from '../device/Device';
|
|
19
|
-
import type {
|
|
15
|
+
import type { DeviceCommands } from '../device/DeviceCommands';
|
|
16
|
+
import type { Features, SupportFeatureType } from '../types';
|
|
20
17
|
|
|
21
|
-
export const
|
|
18
|
+
export const getSupportMessageVersion = (
|
|
22
19
|
features: Features | undefined
|
|
23
|
-
): { messages: JSON;
|
|
20
|
+
): { messages: JSON; messageVersion: MessageVersion } => {
|
|
24
21
|
if (!features)
|
|
25
22
|
return {
|
|
26
|
-
messages: DataManager.messages.
|
|
27
|
-
|
|
23
|
+
messages: DataManager.messages.latest,
|
|
24
|
+
messageVersion: 'latest',
|
|
28
25
|
};
|
|
29
26
|
|
|
30
27
|
const currentDeviceVersion = getDeviceFirmwareVersion(features).join('.');
|
|
31
28
|
const deviceType = getDeviceType(features);
|
|
32
29
|
|
|
33
|
-
// In bootloader mode the major/minor/patch fields carry the bootloader version, not the
|
|
34
|
-
// firmware version; normalizing them would mis-route to the legacy schema (e.g. 2.x < 3.3.0).
|
|
35
|
-
// The legacy getDeviceFirmwareVersion returned 0.0.0 here and landed on v1CurrentSchema, so
|
|
36
|
-
// force v1CurrentSchema for every bootloader device, including in-place upgrades on
|
|
37
|
-
// Classic1s/Touch/Pro where firmware is still present.
|
|
38
|
-
if (features.bootloaderMode === true) {
|
|
39
|
-
return {
|
|
40
|
-
messages: DataManager.messages.v1CurrentSchema,
|
|
41
|
-
protocolV1MessageSchema: 'v1CurrentSchema',
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
|
|
45
30
|
const deviceVersionConfigs =
|
|
46
31
|
PROTOBUF_MESSAGE_CONFIG[deviceType] ||
|
|
47
32
|
(DeviceTypeToModels[deviceType] &&
|
|
@@ -52,30 +37,26 @@ export const getSupportProtocolV1MessageSchema = (
|
|
|
52
37
|
const sortedDeviceVersionConfigs =
|
|
53
38
|
deviceVersionConfigs?.sort((a, b) => semver.compare(b.minVersion, a.minVersion)) ?? [];
|
|
54
39
|
|
|
55
|
-
for (const { minVersion,
|
|
40
|
+
for (const { minVersion, messageVersion } of sortedDeviceVersionConfigs) {
|
|
56
41
|
if (semver.gte(currentDeviceVersion, minVersion)) {
|
|
57
42
|
return {
|
|
58
|
-
messages: DataManager.messages[
|
|
59
|
-
|
|
43
|
+
messages: DataManager.messages[messageVersion],
|
|
44
|
+
messageVersion,
|
|
60
45
|
};
|
|
61
46
|
}
|
|
62
47
|
}
|
|
63
48
|
|
|
64
49
|
return {
|
|
65
|
-
messages: DataManager.messages.
|
|
66
|
-
|
|
50
|
+
messages: DataManager.messages.latest,
|
|
51
|
+
messageVersion: 'latest',
|
|
67
52
|
};
|
|
68
53
|
};
|
|
69
54
|
|
|
70
|
-
export const supportInputPinOnSoftware = (features
|
|
55
|
+
export const supportInputPinOnSoftware = (features: Features): SupportFeatureType => {
|
|
71
56
|
if (!features) return { support: false };
|
|
72
57
|
|
|
73
58
|
const deviceType = getDeviceType(features);
|
|
74
|
-
if (
|
|
75
|
-
deviceType === EDeviceType.Touch ||
|
|
76
|
-
deviceType === EDeviceType.Pro ||
|
|
77
|
-
deviceType === EDeviceType.Pro2
|
|
78
|
-
) {
|
|
59
|
+
if (deviceType === EDeviceType.Touch || deviceType === EDeviceType.Pro) {
|
|
79
60
|
return { support: false };
|
|
80
61
|
}
|
|
81
62
|
|
|
@@ -87,11 +68,7 @@ export const supportNewPassphrase = (features?: Features): SupportFeatureType =>
|
|
|
87
68
|
if (!features) return { support: false };
|
|
88
69
|
|
|
89
70
|
const deviceType = getDeviceType(features);
|
|
90
|
-
if (
|
|
91
|
-
deviceType === EDeviceType.Touch ||
|
|
92
|
-
deviceType === EDeviceType.Pro ||
|
|
93
|
-
deviceType === EDeviceType.Pro2
|
|
94
|
-
) {
|
|
71
|
+
if (deviceType === EDeviceType.Touch || deviceType === EDeviceType.Pro) {
|
|
95
72
|
return { support: true };
|
|
96
73
|
}
|
|
97
74
|
|
|
@@ -105,46 +82,25 @@ export const getPassphraseStateWithRefreshDeviceInfo = async (
|
|
|
105
82
|
options?: {
|
|
106
83
|
expectPassphraseState?: string;
|
|
107
84
|
onlyMainPin?: boolean;
|
|
108
|
-
initSession?: boolean;
|
|
109
85
|
}
|
|
110
86
|
) => {
|
|
111
|
-
|
|
112
|
-
if (!device.features) {
|
|
113
|
-
return {
|
|
114
|
-
passphraseState: undefined,
|
|
115
|
-
newSession: undefined,
|
|
116
|
-
unlockedAttachPin: undefined,
|
|
117
|
-
};
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
return getProtocolV2WalletSession(device, {
|
|
121
|
-
initSession: options?.initSession,
|
|
122
|
-
expectedPassphraseState: options?.expectPassphraseState,
|
|
123
|
-
onlyMainPin: options?.onlyMainPin,
|
|
124
|
-
});
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
const { features } = device;
|
|
87
|
+
const { features, commands } = device;
|
|
128
88
|
const locked = features?.unlocked === false;
|
|
129
|
-
const deviceType = device.getCurrentDeviceType();
|
|
130
|
-
|
|
131
|
-
if (options?.initSession) {
|
|
132
|
-
device.clearInternalState();
|
|
133
|
-
}
|
|
134
89
|
|
|
135
|
-
const { passphraseState, newSession, unlockedAttachPin } = await getPassphraseState(
|
|
136
|
-
|
|
137
|
-
|
|
90
|
+
const { passphraseState, newSession, unlockedAttachPin } = await getPassphraseState(
|
|
91
|
+
features,
|
|
92
|
+
commands,
|
|
93
|
+
{
|
|
94
|
+
...options,
|
|
95
|
+
}
|
|
96
|
+
);
|
|
138
97
|
|
|
139
98
|
const isModeT =
|
|
140
|
-
|
|
141
|
-
deviceType === EDeviceType.Pro ||
|
|
142
|
-
deviceType === EDeviceType.Pro2;
|
|
99
|
+
getDeviceType(features) === EDeviceType.Touch || getDeviceType(features) === EDeviceType.Pro;
|
|
143
100
|
|
|
144
101
|
// 如果可以获取到 passphraseState,但是设备 features 显示设备未开启 passphrase,需要刷新设备状态
|
|
145
102
|
// if passphraseState can be obtained, but the device features show that the device has not enabled passphrase, the device status needs to be refreshed
|
|
146
|
-
const needRefreshWithPassphrase =
|
|
147
|
-
passphraseState && device.getCurrentPassphraseProtection() !== true;
|
|
103
|
+
const needRefreshWithPassphrase = passphraseState && features?.passphrase_protection !== true;
|
|
148
104
|
// 如果 Touch/Pro 在之前是锁定状态,刷新设备状态
|
|
149
105
|
// if Touch/Pro was locked before, refresh the device state
|
|
150
106
|
const needRefreshWithLocked = isModeT && locked;
|
|
@@ -155,72 +111,49 @@ export const getPassphraseStateWithRefreshDeviceInfo = async (
|
|
|
155
111
|
}
|
|
156
112
|
|
|
157
113
|
// Attach to pin try to fix internal state
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
114
|
+
if (features?.device_id) {
|
|
115
|
+
device.updateInternalState(
|
|
116
|
+
device.features?.passphrase_protection ?? false,
|
|
117
|
+
passphraseState,
|
|
118
|
+
device.features?.device_id ?? '',
|
|
119
|
+
newSession,
|
|
120
|
+
device.features?.session_id
|
|
121
|
+
);
|
|
122
|
+
}
|
|
166
123
|
|
|
167
|
-
return {
|
|
168
|
-
passphraseState,
|
|
169
|
-
newSession,
|
|
170
|
-
unlockedAttachPin: unlockedAttachPin ?? device.features?.unlockedAttachPin,
|
|
171
|
-
};
|
|
124
|
+
return { passphraseState, newSession, unlockedAttachPin };
|
|
172
125
|
};
|
|
173
126
|
|
|
174
|
-
// Applies to Protocol V1 Pro only; Pro2 has an independent version line.
|
|
175
|
-
const supportProSeriesAttachPinPassphrase = (deviceType: IDeviceType, firmwareVersion: string) =>
|
|
176
|
-
deviceType === EDeviceType.Pro && semver.gte(firmwareVersion, '4.15.0');
|
|
177
|
-
|
|
178
127
|
export const getPassphraseState = async (
|
|
179
|
-
|
|
128
|
+
features: Features | undefined,
|
|
129
|
+
commands: DeviceCommands,
|
|
180
130
|
options?: {
|
|
181
131
|
expectPassphraseState?: string;
|
|
182
132
|
onlyMainPin?: boolean;
|
|
183
|
-
initSession?: boolean;
|
|
184
133
|
}
|
|
185
134
|
): Promise<{
|
|
186
135
|
passphraseState: string | undefined;
|
|
187
136
|
newSession: string | undefined;
|
|
188
137
|
unlockedAttachPin: boolean | undefined;
|
|
189
138
|
}> => {
|
|
190
|
-
const { features, commands } = device;
|
|
191
|
-
|
|
192
|
-
// Preserve legacy empty-result semantics until the device has established state.
|
|
193
139
|
if (!features)
|
|
194
140
|
return { passphraseState: undefined, newSession: undefined, unlockedAttachPin: undefined };
|
|
195
141
|
|
|
196
|
-
const firmwareVersion =
|
|
197
|
-
const deviceType =
|
|
198
|
-
|
|
199
|
-
if (device.isProtocolV2()) {
|
|
200
|
-
return getProtocolV2WalletSession(device, {
|
|
201
|
-
initSession: options?.initSession,
|
|
202
|
-
expectedPassphraseState: options?.expectPassphraseState,
|
|
203
|
-
onlyMainPin: options?.onlyMainPin,
|
|
204
|
-
});
|
|
205
|
-
}
|
|
142
|
+
const firmwareVersion = getDeviceFirmwareVersion(features);
|
|
143
|
+
const deviceType = getDeviceType(features);
|
|
206
144
|
|
|
207
145
|
const supportAttachPinCapability = existCapability(
|
|
208
146
|
features,
|
|
209
147
|
Enum_Capability.Capability_AttachToPin
|
|
210
148
|
);
|
|
211
149
|
const supportGetPassphraseState =
|
|
212
|
-
supportAttachPinCapability ||
|
|
150
|
+
supportAttachPinCapability ||
|
|
151
|
+
(deviceType === EDeviceType.Pro && semver.gte(firmwareVersion.join('.'), '4.15.0'));
|
|
213
152
|
|
|
214
153
|
if (supportGetPassphraseState) {
|
|
215
|
-
const
|
|
154
|
+
const { message, type } = await commands.typedCall('GetPassphraseState', 'PassphraseState', {
|
|
216
155
|
passphrase_state: options?.onlyMainPin ? undefined : options?.expectPassphraseState,
|
|
217
|
-
};
|
|
218
|
-
|
|
219
|
-
const { message, type } = await commands.typedCall(
|
|
220
|
-
'GetPassphraseState',
|
|
221
|
-
'PassphraseState',
|
|
222
|
-
payload
|
|
223
|
-
);
|
|
156
|
+
});
|
|
224
157
|
|
|
225
158
|
// @ts-expect-error
|
|
226
159
|
if (type === 'CallMethodError') {
|
|
@@ -253,8 +186,40 @@ export const getPassphraseState = async (
|
|
|
253
186
|
};
|
|
254
187
|
};
|
|
255
188
|
|
|
256
|
-
|
|
257
|
-
|
|
189
|
+
export const supportBatchPublicKey = (
|
|
190
|
+
features?: Features,
|
|
191
|
+
options?: {
|
|
192
|
+
includeNode?: boolean;
|
|
193
|
+
}
|
|
194
|
+
): boolean => {
|
|
195
|
+
if (!features) return false;
|
|
196
|
+
const currentVersion = getDeviceFirmwareVersion(features).join('.');
|
|
197
|
+
|
|
198
|
+
const deviceType = getDeviceType(features);
|
|
199
|
+
// btc batch get public key
|
|
200
|
+
if (!!options?.includeNode && deviceType === EDeviceType.Pro) {
|
|
201
|
+
return semver.gte(currentVersion, '4.14.0');
|
|
202
|
+
}
|
|
203
|
+
if (!!options?.includeNode && deviceType === EDeviceType.Touch) {
|
|
204
|
+
return semver.gte(currentVersion, '4.11.0');
|
|
205
|
+
}
|
|
206
|
+
if (!!options?.includeNode && DeviceModelToTypes.model_classic1s.includes(deviceType)) {
|
|
207
|
+
return semver.gte(currentVersion, '3.12.0');
|
|
208
|
+
}
|
|
209
|
+
if (!!options?.includeNode && DeviceModelToTypes.model_mini.includes(deviceType)) {
|
|
210
|
+
return semver.gte(currentVersion, '3.10.0');
|
|
211
|
+
}
|
|
212
|
+
if (options?.includeNode) {
|
|
213
|
+
return false;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
// support batch get public key
|
|
217
|
+
if (deviceType === EDeviceType.Touch || deviceType === EDeviceType.Pro) {
|
|
218
|
+
return semver.gte(currentVersion, '3.1.0');
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
return semver.gte(currentVersion, '2.6.0');
|
|
222
|
+
};
|
|
258
223
|
|
|
259
224
|
export const supportModifyHomescreen = (features?: Features): SupportFeatureType => {
|
|
260
225
|
if (!features) return { support: false };
|
|
@@ -313,9 +278,6 @@ export const getFirmwareUpdateField = ({
|
|
|
313
278
|
if (deviceType === EDeviceType.Pro) {
|
|
314
279
|
return latestFirmwareField;
|
|
315
280
|
}
|
|
316
|
-
if (deviceType === EDeviceType.Pro2) {
|
|
317
|
-
return 'firmware-v1';
|
|
318
|
-
}
|
|
319
281
|
return 'firmware';
|
|
320
282
|
};
|
|
321
283
|
/**
|
|
@@ -359,10 +321,6 @@ export const getFirmwareUpdateFieldArray = (
|
|
|
359
321
|
return ['firmware-v8'];
|
|
360
322
|
}
|
|
361
323
|
|
|
362
|
-
if (deviceType === 'pro2') {
|
|
363
|
-
return ['firmware-v1'];
|
|
364
|
-
}
|
|
365
|
-
|
|
366
324
|
return ['firmware'];
|
|
367
325
|
};
|
|
368
326
|
|
|
@@ -382,8 +340,12 @@ export const fixFeaturesFirmwareVersion = (features: Features): Features => {
|
|
|
382
340
|
// fix Touch、Pro device when bootloader version is lower than 2.5.2, the features returned do not have firmware_version error
|
|
383
341
|
const tempFeatures = { ...features };
|
|
384
342
|
|
|
385
|
-
if (tempFeatures.
|
|
386
|
-
tempFeatures.
|
|
343
|
+
if (tempFeatures.onekey_firmware_version && !semver.valid(tempFeatures.onekey_firmware_version)) {
|
|
344
|
+
tempFeatures.onekey_firmware_version = fixVersion(tempFeatures.onekey_firmware_version);
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
if (tempFeatures.onekey_version && !semver.valid(tempFeatures.onekey_version)) {
|
|
348
|
+
tempFeatures.onekey_version = fixVersion(tempFeatures.onekey_version);
|
|
387
349
|
}
|
|
388
350
|
|
|
389
351
|
return tempFeatures;
|
|
@@ -1,22 +1,65 @@
|
|
|
1
1
|
import { isEmpty } from 'lodash';
|
|
2
|
-
import { EDeviceType } from '@onekeyfe/hd-shared';
|
|
2
|
+
import { EDeviceType, EFirmwareType } from '@onekeyfe/hd-shared';
|
|
3
|
+
import { Enum_Capability } from '@onekeyfe/hd-transport';
|
|
3
4
|
|
|
4
5
|
import { DeviceModelToTypes } from '../types';
|
|
5
|
-
import {
|
|
6
|
-
resolveDeviceBleName,
|
|
7
|
-
resolveDeviceFirmwareType,
|
|
8
|
-
resolveDeviceSerialNo,
|
|
9
|
-
resolveDeviceType,
|
|
10
|
-
} from './deviceFeaturesCompat';
|
|
6
|
+
import { existCapability } from './capabilitieUtils';
|
|
11
7
|
|
|
12
|
-
import type { IDeviceModel, IDeviceType, IVersionRange } from '../types';
|
|
13
|
-
import type { DeviceFeaturesInput } from './deviceFeaturesCompat';
|
|
8
|
+
import type { Features, IDeviceModel, IDeviceType, IVersionRange } from '../types';
|
|
14
9
|
|
|
15
10
|
/**
|
|
16
11
|
* get device type by features
|
|
17
12
|
*/
|
|
18
|
-
export const getDeviceType = (features?:
|
|
19
|
-
|
|
13
|
+
export const getDeviceType = (features?: Features): IDeviceType => {
|
|
14
|
+
if (!features || typeof features !== 'object') {
|
|
15
|
+
return EDeviceType.Unknown;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
// classic1s 3.5.0 pro 4.6.0
|
|
19
|
+
switch (features.onekey_device_type) {
|
|
20
|
+
case 'CLASSIC':
|
|
21
|
+
return EDeviceType.Classic;
|
|
22
|
+
case 'CLASSIC1S':
|
|
23
|
+
return EDeviceType.Classic1s;
|
|
24
|
+
case 'MINI':
|
|
25
|
+
return EDeviceType.Mini;
|
|
26
|
+
case 'TOUCH':
|
|
27
|
+
return EDeviceType.Touch;
|
|
28
|
+
case 'PRO':
|
|
29
|
+
return EDeviceType.Pro;
|
|
30
|
+
case 'PURE':
|
|
31
|
+
return EDeviceType.ClassicPure;
|
|
32
|
+
default:
|
|
33
|
+
// future And old device onekey_device_type is empty
|
|
34
|
+
if (!isEmpty(features.onekey_serial_no)) {
|
|
35
|
+
return EDeviceType.Unknown;
|
|
36
|
+
}
|
|
37
|
+
// old device type
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// low version hardware
|
|
41
|
+
// onekey_serial_no > onekey_serial > serial_no
|
|
42
|
+
const serialNo = getDeviceUUID(features);
|
|
43
|
+
|
|
44
|
+
// not exist serialNo, bootloader mode, model 1 is classic
|
|
45
|
+
if (isEmpty(serialNo) && features.bootloader_mode === true && features.model === '1') {
|
|
46
|
+
return EDeviceType.Classic;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
if (isEmpty(serialNo)) return EDeviceType.Unknown;
|
|
50
|
+
|
|
51
|
+
const miniFlag = serialNo.slice(0, 2);
|
|
52
|
+
// By May 2021, the miniFlag is 'bixin' for all classic devices
|
|
53
|
+
if (miniFlag.toLowerCase() === 'bi') return EDeviceType.Classic;
|
|
54
|
+
if (miniFlag.toLowerCase() === 'cl') return EDeviceType.Classic;
|
|
55
|
+
if (miniFlag.toLowerCase() === 'cp') return EDeviceType.ClassicPure;
|
|
56
|
+
if (miniFlag.toLowerCase() === 'mi') return EDeviceType.Mini;
|
|
57
|
+
if (miniFlag.toLowerCase() === 'tc') return EDeviceType.Touch;
|
|
58
|
+
if (miniFlag.toLowerCase() === 'pr') return EDeviceType.Pro;
|
|
59
|
+
|
|
60
|
+
// unknown device
|
|
61
|
+
return EDeviceType.Unknown;
|
|
62
|
+
};
|
|
20
63
|
|
|
21
64
|
/**
|
|
22
65
|
* get device type by ble name
|
|
@@ -25,14 +68,13 @@ export const getDeviceType = (features?: DeviceFeaturesInput): IDeviceType =>
|
|
|
25
68
|
export const getDeviceTypeByBleName = (name?: string): IDeviceType => {
|
|
26
69
|
if (!name) return EDeviceType.Unknown;
|
|
27
70
|
|
|
28
|
-
if (
|
|
29
|
-
if (
|
|
71
|
+
if (name.startsWith('BixinKey')) return EDeviceType.Classic;
|
|
72
|
+
if (name.startsWith('K')) return EDeviceType.Classic;
|
|
30
73
|
|
|
31
|
-
if (
|
|
32
|
-
if (
|
|
74
|
+
if (name.startsWith('T')) return EDeviceType.Touch;
|
|
75
|
+
if (name.startsWith('Touch')) return EDeviceType.Touch;
|
|
33
76
|
|
|
34
|
-
if (
|
|
35
|
-
if (/\bPro\b/i.test(name) || /^Pro/i.test(name)) return EDeviceType.Pro;
|
|
77
|
+
if (name.startsWith('Pro')) return EDeviceType.Pro;
|
|
36
78
|
|
|
37
79
|
return EDeviceType.Unknown;
|
|
38
80
|
};
|
|
@@ -41,30 +83,29 @@ export const getDeviceTypeByBleName = (name?: string): IDeviceType => {
|
|
|
41
83
|
* Get Connected Device ble name by features
|
|
42
84
|
* @returns
|
|
43
85
|
*/
|
|
44
|
-
export const getDeviceBleName = (features?:
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
* Get Connected Device serial number by features
|
|
49
|
-
*/
|
|
50
|
-
export const getDeviceSerialNo = (features?: DeviceFeaturesInput): string =>
|
|
51
|
-
resolveDeviceSerialNo(features);
|
|
86
|
+
export const getDeviceBleName = (features?: Features): string | null => {
|
|
87
|
+
if (features == null) return null;
|
|
88
|
+
return features.onekey_ble_name || features.ble_name || null;
|
|
89
|
+
};
|
|
52
90
|
|
|
53
91
|
/**
|
|
54
|
-
*
|
|
92
|
+
* Get Connected Device UUID by features
|
|
55
93
|
*/
|
|
56
|
-
export const getDeviceUUID =
|
|
94
|
+
export const getDeviceUUID = (features: Features) => {
|
|
95
|
+
const serialNo = features.onekey_serial_no || features.onekey_serial || features.serial_no;
|
|
96
|
+
return serialNo ?? '';
|
|
97
|
+
};
|
|
57
98
|
|
|
58
99
|
/**
|
|
59
100
|
* Get Connected Device label by features
|
|
60
101
|
*/
|
|
61
|
-
export const getDeviceLabel = (features?:
|
|
102
|
+
export const getDeviceLabel = (features?: Features) => {
|
|
62
103
|
if (!features) return null;
|
|
63
104
|
|
|
64
105
|
const deviceType = getDeviceType(features);
|
|
65
106
|
if (deviceType == null) return null;
|
|
66
107
|
|
|
67
|
-
if (
|
|
108
|
+
if (typeof features.label === 'string' && !isEmpty(features.label)) {
|
|
68
109
|
return features.label;
|
|
69
110
|
}
|
|
70
111
|
|
|
@@ -83,12 +124,12 @@ export const getDeviceLabel = (features?: DeviceFeaturesInput) => {
|
|
|
83
124
|
* Type has a higher priority than Model
|
|
84
125
|
*/
|
|
85
126
|
export const getMethodVersionRange = (
|
|
86
|
-
features:
|
|
127
|
+
features: Features | undefined,
|
|
87
128
|
getVersionRange: (deviceModel: IDeviceType | IDeviceModel) => IVersionRange | undefined
|
|
88
129
|
): IVersionRange | undefined => {
|
|
89
130
|
const deviceType = getDeviceType(features);
|
|
131
|
+
let versionRange: IVersionRange | undefined = getVersionRange(deviceType);
|
|
90
132
|
|
|
91
|
-
const versionRange = getVersionRange(deviceType);
|
|
92
133
|
if (versionRange) {
|
|
93
134
|
return versionRange;
|
|
94
135
|
}
|
|
@@ -101,18 +142,26 @@ export const getMethodVersionRange = (
|
|
|
101
142
|
];
|
|
102
143
|
for (const model of modelFallbacks) {
|
|
103
144
|
if (DeviceModelToTypes[model].includes(deviceType)) {
|
|
104
|
-
|
|
145
|
+
versionRange = getVersionRange(model);
|
|
105
146
|
if (versionRange) {
|
|
106
147
|
return versionRange;
|
|
107
148
|
}
|
|
108
149
|
}
|
|
109
150
|
}
|
|
110
151
|
|
|
111
|
-
return
|
|
152
|
+
return versionRange;
|
|
112
153
|
};
|
|
113
154
|
|
|
114
|
-
export const
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
155
|
+
export const getFirmwareType = (features: Features | undefined) => {
|
|
156
|
+
if (!features) {
|
|
157
|
+
return EFirmwareType.Universal;
|
|
158
|
+
}
|
|
159
|
+
if (features.fw_vendor === 'OneKey Bitcoin-only') {
|
|
160
|
+
return EFirmwareType.BitcoinOnly;
|
|
161
|
+
}
|
|
162
|
+
// old firmware
|
|
163
|
+
return features?.capabilities?.length > 0 &&
|
|
164
|
+
!existCapability(features, Enum_Capability.Capability_Bitcoin_like)
|
|
165
|
+
? EFirmwareType.BitcoinOnly
|
|
166
|
+
: EFirmwareType.Universal;
|
|
167
|
+
};
|
|
@@ -19,33 +19,6 @@ export const LANGUAGE_LABELS = {
|
|
|
19
19
|
export type LanguageKey = keyof typeof LANGUAGE_LABELS;
|
|
20
20
|
export type LanguageOption = { code: LanguageKey; label: (typeof LANGUAGE_LABELS)[LanguageKey] };
|
|
21
21
|
|
|
22
|
-
export const PROTOCOL_V2_LANGUAGE_BY_KEY: Record<LanguageKey, string> = {
|
|
23
|
-
en: 'en-Latn-US',
|
|
24
|
-
zh_cn: 'zh-Hans-CN',
|
|
25
|
-
zh_hk: 'zh-Hant-HK',
|
|
26
|
-
ja: 'ja-Jpan-JP',
|
|
27
|
-
ko: 'ko-Kore-KR',
|
|
28
|
-
fr: 'fr-Latn-FR',
|
|
29
|
-
de: 'de-Latn-DE',
|
|
30
|
-
ru: 'ru-Cyrl-RU',
|
|
31
|
-
es: 'es-Latn-ES',
|
|
32
|
-
it: 'it-Latn-IT',
|
|
33
|
-
pt_br: 'pt-Latn-BR',
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
export const mapLanguageToProtocolV2 = (language?: string) =>
|
|
37
|
-
language ? PROTOCOL_V2_LANGUAGE_BY_KEY[language as LanguageKey] ?? language : undefined;
|
|
38
|
-
|
|
39
|
-
const PRO2_LANGUAGE_OPTIONS = [
|
|
40
|
-
...Object.entries(LANGUAGE_LABELS).map(([code, label]) => ({ code, label })),
|
|
41
|
-
{ code: 'zh-Hant-TW', label: '繁體中文(台灣)' },
|
|
42
|
-
{ code: 'vi-Latn-VN', label: 'Tiếng Việt' },
|
|
43
|
-
{ code: 'tr-Latn-TR', label: 'Türkçe' },
|
|
44
|
-
{ code: 'id-Latn-ID', label: 'Bahasa Indonesia' },
|
|
45
|
-
{ code: 'fil-Latn-PH', label: 'Filipino' },
|
|
46
|
-
{ code: 'uk-Cyrl-UA', label: 'Українська' },
|
|
47
|
-
] as const;
|
|
48
|
-
|
|
49
22
|
export const getLanguageConfig = (deviceType: IDeviceType): Record<string, string>[] => {
|
|
50
23
|
let keys: LanguageKey[] = [];
|
|
51
24
|
|
|
@@ -63,8 +36,6 @@ export const getLanguageConfig = (deviceType: IDeviceType): Record<string, strin
|
|
|
63
36
|
case EDeviceType.Pro:
|
|
64
37
|
keys = Object.keys(LANGUAGE_LABELS) as LanguageKey[];
|
|
65
38
|
break;
|
|
66
|
-
case EDeviceType.Pro2:
|
|
67
|
-
return PRO2_LANGUAGE_OPTIONS.map(option => ({ ...option }));
|
|
68
39
|
default:
|
|
69
40
|
keys = [];
|
|
70
41
|
break;
|
|
@@ -104,16 +75,6 @@ export const getAutoLockOptions = (_deviceType: IDeviceType): DurationParts[] =>
|
|
|
104
75
|
{ seconds: 0, minute: 30, hour: 0, day: 0 },
|
|
105
76
|
{ seconds: 0, minute: 0, hour: 0, day: 0 },
|
|
106
77
|
];
|
|
107
|
-
case EDeviceType.Pro2:
|
|
108
|
-
return [
|
|
109
|
-
{ seconds: 30, minute: 0, hour: 0, day: 0 },
|
|
110
|
-
{ seconds: 0, minute: 1, hour: 0, day: 0 },
|
|
111
|
-
{ seconds: 0, minute: 2, hour: 0, day: 0 },
|
|
112
|
-
{ seconds: 0, minute: 5, hour: 0, day: 0 },
|
|
113
|
-
{ seconds: 0, minute: 10, hour: 0, day: 0 },
|
|
114
|
-
{ seconds: 0, minute: 30, hour: 0, day: 0 },
|
|
115
|
-
{ seconds: 0, minute: 0, hour: 0, day: 0 },
|
|
116
|
-
];
|
|
117
78
|
default:
|
|
118
79
|
return [];
|
|
119
80
|
}
|
|
@@ -142,15 +103,6 @@ export const getAutoShutDownOptions = (_deviceType: IDeviceType): DurationParts[
|
|
|
142
103
|
{ seconds: 0, minute: 10, hour: 0, day: 0 },
|
|
143
104
|
{ seconds: 0, minute: 0, hour: 0, day: 0 },
|
|
144
105
|
];
|
|
145
|
-
case EDeviceType.Pro2:
|
|
146
|
-
return [
|
|
147
|
-
{ seconds: 0, minute: 1, hour: 0, day: 0 },
|
|
148
|
-
{ seconds: 0, minute: 2, hour: 0, day: 0 },
|
|
149
|
-
{ seconds: 0, minute: 5, hour: 0, day: 0 },
|
|
150
|
-
{ seconds: 0, minute: 10, hour: 0, day: 0 },
|
|
151
|
-
{ seconds: 0, minute: 30, hour: 0, day: 0 },
|
|
152
|
-
{ seconds: 0, minute: 0, hour: 0, day: 0 },
|
|
153
|
-
];
|
|
154
106
|
default:
|
|
155
107
|
return [];
|
|
156
108
|
}
|