@onekeyfe/hd-core 1.1.27-alpha.35 → 1.1.27-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 +99 -0
- package/__tests__/evmLedgerLegacySafety.test.ts +261 -0
- package/__tests__/evmSignTransaction.test.ts +1 -1
- package/__tests__/evmSignTypedData.test.ts +1 -1
- package/__tests__/preInitialize.test.ts +22 -0
- package/dist/api/BaseMethod.d.ts +7 -1
- package/dist/api/BaseMethod.d.ts.map +1 -1
- package/dist/api/FirmwareUpdateV3.d.ts +0 -1
- package/dist/api/FirmwareUpdateV3.d.ts.map +1 -1
- package/dist/api/GetFeatures.d.ts +1 -1
- package/dist/api/GetOnekeyFeatures.d.ts.map +1 -1
- package/dist/api/GetPassphraseState.d.ts +1 -6
- package/dist/api/GetPassphraseState.d.ts.map +1 -1
- package/dist/api/SearchDevices.d.ts +1 -2
- 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 +5 -2
- package/dist/api/alephium/AlephiumSignTransaction.d.ts.map +1 -1
- package/dist/api/algo/AlgoSignTransaction.d.ts.map +1 -1
- package/dist/api/allnetwork/AllNetworkGetAddressBase.d.ts.map +1 -1
- package/dist/api/aptos/AptosSignInMessage.d.ts.map +1 -1
- package/dist/api/aptos/AptosSignMessage.d.ts.map +1 -1
- package/dist/api/aptos/AptosSignTransaction.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/CardanoSignMessage.d.ts.map +1 -1
- package/dist/api/cardano/CardanoSignTransaction.d.ts.map +1 -1
- package/dist/api/conflux/ConfluxSignMessage.d.ts.map +1 -1
- package/dist/api/conflux/ConfluxSignMessageCIP23.d.ts.map +1 -1
- package/dist/api/conflux/ConfluxSignTransaction.d.ts.map +1 -1
- package/dist/api/cosmos/CosmosSignTransaction.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/PreInitialize.d.ts +6 -0
- package/dist/api/device/PreInitialize.d.ts.map +1 -0
- package/dist/api/dynex/DnxGetAddress.d.ts.map +1 -1
- package/dist/api/dynex/DnxSignTransaction.d.ts.map +1 -1
- package/dist/api/evm/EVMSignMessage.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/EVMSignTransaction.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/legacyV1/signTypedData.d.ts +1 -1
- package/dist/api/evm/legacyV1/signTypedData.d.ts.map +1 -1
- package/dist/api/filecoin/FilecoinSignTransaction.d.ts.map +1 -1
- package/dist/api/firmware/FirmwareUpdateBaseMethod.d.ts +2 -10
- package/dist/api/firmware/FirmwareUpdateBaseMethod.d.ts.map +1 -1
- package/dist/api/index.d.ts +1 -28
- package/dist/api/index.d.ts.map +1 -1
- package/dist/api/kaspa/KaspaSignTransaction.d.ts.map +1 -1
- package/dist/api/near/NearSignTransaction.d.ts.map +1 -1
- package/dist/api/nem/NEMSignTransaction.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 +9 -2
- 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/nostr/NostrSignEvent.d.ts.map +1 -1
- package/dist/api/nostr/NostrSignSchnorr.d.ts.map +1 -1
- package/dist/api/polkadot/PolkadotSignTransaction.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/SolSignMessage.d.ts.map +1 -1
- package/dist/api/solana/SolSignOffchainMessage.d.ts.map +1 -1
- package/dist/api/solana/SolSignTransaction.d.ts.map +1 -1
- package/dist/api/starcoin/StarcoinSignMessage.d.ts.map +1 -1
- package/dist/api/starcoin/StarcoinSignTransaction.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 +1 -2
- package/dist/api/stellar/StellarSignTransaction.d.ts.map +1 -1
- package/dist/api/sui/SuiSignMessage.d.ts.map +1 -1
- package/dist/api/sui/SuiSignTransaction.d.ts +2 -2
- package/dist/api/sui/SuiSignTransaction.d.ts.map +1 -1
- package/dist/api/ton/TonSignData.d.ts.map +1 -1
- package/dist/api/ton/TonSignMessage.d.ts.map +1 -1
- package/dist/api/ton/TonSignProof.d.ts.map +1 -1
- package/dist/api/tron/TronSignMessage.d.ts.map +1 -1
- package/dist/api/tron/TronSignTransaction.d.ts.map +1 -1
- package/dist/api/xrp/XrpSignTransaction.d.ts.map +1 -1
- package/dist/core/PollingStateManager.d.ts +8 -0
- package/dist/core/PollingStateManager.d.ts.map +1 -0
- package/dist/core/RequestQueue.d.ts +1 -1
- package/dist/core/RequestQueue.d.ts.map +1 -1
- package/dist/core/index.d.ts.map +1 -1
- package/dist/data-manager/DataManager.d.ts +4 -7
- 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/device/Device.d.ts +18 -5
- package/dist/device/Device.d.ts.map +1 -1
- package/dist/device/DeviceCommands.d.ts +8 -8
- 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/events/ui-request.d.ts +0 -8
- package/dist/events/ui-request.d.ts.map +1 -1
- package/dist/index.d.ts +43 -292
- package/dist/index.js +1002 -16133
- package/dist/inject.d.ts.map +1 -1
- package/dist/types/api/export.d.ts +1 -1
- package/dist/types/api/export.d.ts.map +1 -1
- package/dist/types/api/firmwareUpdate.d.ts +0 -7
- package/dist/types/api/firmwareUpdate.d.ts.map +1 -1
- package/dist/types/api/getPassphraseState.d.ts +1 -10
- package/dist/types/api/getPassphraseState.d.ts.map +1 -1
- package/dist/types/api/index.d.ts +3 -33
- package/dist/types/api/index.d.ts.map +1 -1
- package/dist/types/api/preInitialize.d.ts +3 -0
- package/dist/types/api/preInitialize.d.ts.map +1 -0
- 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 +2 -6
- package/dist/types/device.d.ts.map +1 -1
- package/dist/types/params.d.ts +1 -2
- package/dist/types/params.d.ts.map +1 -1
- package/dist/types/settings.d.ts +1 -1
- package/dist/types/settings.d.ts.map +1 -1
- package/dist/utils/deviceFeaturesUtils.d.ts +3 -5
- package/dist/utils/deviceFeaturesUtils.d.ts.map +1 -1
- package/dist/utils/deviceInfoUtils.d.ts +0 -1
- package/dist/utils/deviceInfoUtils.d.ts.map +1 -1
- package/dist/utils/index.d.ts +1 -1
- 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/versionUtils.d.ts +1 -1
- package/package.json +4 -4
- package/src/api/BaseMethod.ts +82 -7
- package/src/api/FirmwareUpdateV3.ts +4 -21
- package/src/api/GetOnekeyFeatures.ts +3 -75
- package/src/api/GetPassphraseState.ts +7 -16
- package/src/api/SearchDevices.ts +2 -7
- package/src/api/alephium/AlephiumGetAddress.ts +2 -6
- package/src/api/alephium/AlephiumSignMessage.ts +2 -6
- package/src/api/alephium/AlephiumSignTransaction.ts +3 -6
- package/src/api/algo/AlgoSignTransaction.ts +1 -0
- package/src/api/allnetwork/AllNetworkGetAddressBase.ts +9 -18
- package/src/api/aptos/AptosSignInMessage.ts +1 -0
- package/src/api/aptos/AptosSignMessage.ts +1 -0
- package/src/api/aptos/AptosSignTransaction.ts +1 -0
- package/src/api/benfen/BenfenGetAddress.ts +2 -6
- package/src/api/benfen/BenfenGetPublicKey.ts +2 -6
- package/src/api/benfen/BenfenSignMessage.ts +2 -6
- package/src/api/benfen/BenfenSignTransaction.ts +2 -6
- package/src/api/btc/BTCSignMessage.ts +1 -0
- package/src/api/btc/BTCSignPsbt.ts +1 -0
- package/src/api/btc/BTCSignTransaction.ts +1 -0
- package/src/api/btc/helpers/versionLimit.ts +1 -7
- package/src/api/cardano/CardanoSignMessage.ts +1 -0
- package/src/api/cardano/CardanoSignTransaction.ts +1 -0
- package/src/api/conflux/ConfluxSignMessage.ts +1 -0
- package/src/api/conflux/ConfluxSignMessageCIP23.ts +1 -0
- package/src/api/conflux/ConfluxSignTransaction.ts +3 -5
- package/src/api/cosmos/CosmosSignTransaction.ts +1 -0
- package/src/api/device/DeviceRebootToBoardloader.ts +1 -10
- package/src/api/device/DeviceRebootToBootloader.ts +1 -10
- package/src/api/device/PreInitialize.ts +41 -0
- package/src/api/dynex/DnxGetAddress.ts +0 -7
- package/src/api/dynex/DnxSignTransaction.ts +1 -7
- package/src/api/evm/EVMGetAddress.ts +1 -1
- package/src/api/evm/EVMGetPublicKey.ts +1 -1
- package/src/api/evm/EVMSignMessage.ts +3 -1
- package/src/api/evm/EVMSignMessageEIP712.ts +2 -14
- package/src/api/evm/EVMSignTransaction.ts +3 -1
- package/src/api/evm/EVMSignTypedData.ts +8 -6
- package/src/api/evm/EVMVerifyMessage.ts +1 -1
- package/src/api/filecoin/FilecoinSignTransaction.ts +1 -0
- package/src/api/firmware/FirmwareUpdateBaseMethod.ts +4 -27
- package/src/api/index.ts +1 -30
- package/src/api/kaspa/KaspaSignTransaction.ts +1 -0
- package/src/api/near/NearSignTransaction.ts +1 -0
- package/src/api/nem/NEMSignTransaction.ts +1 -0
- package/src/api/neo/NeoGetAddress.ts +1 -6
- package/src/api/neo/NeoSignTransaction.ts +2 -6
- package/src/api/nervos/NervosGetAddress.ts +2 -6
- package/src/api/nervos/NervosSignTransaction.ts +3 -6
- package/src/api/nexa/NexaGetAddress.ts +2 -6
- package/src/api/nexa/NexaSignTransaction.ts +4 -6
- package/src/api/nostr/NostrSignEvent.ts +1 -0
- package/src/api/nostr/NostrSignSchnorr.ts +1 -0
- package/src/api/polkadot/PolkadotSignTransaction.ts +1 -0
- package/src/api/scdo/ScdoGetAddress.ts +2 -6
- package/src/api/scdo/ScdoSignMessage.ts +2 -6
- package/src/api/scdo/ScdoSignTransaction.ts +3 -6
- package/src/api/solana/SolSignMessage.ts +1 -0
- package/src/api/solana/SolSignOffchainMessage.ts +1 -0
- package/src/api/solana/SolSignTransaction.ts +1 -0
- package/src/api/starcoin/StarcoinSignMessage.ts +1 -0
- package/src/api/starcoin/StarcoinSignTransaction.ts +1 -0
- package/src/api/stellar/StellarGetAddress.ts +1 -10
- package/src/api/stellar/StellarSignTransaction.ts +2 -14
- package/src/api/sui/SuiSignMessage.ts +1 -0
- package/src/api/sui/SuiSignTransaction.ts +10 -12
- package/src/api/ton/TonSignData.ts +1 -0
- package/src/api/ton/TonSignMessage.ts +1 -0
- package/src/api/ton/TonSignProof.ts +1 -0
- package/src/api/tron/TronSignMessage.ts +2 -1
- package/src/api/tron/TronSignTransaction.ts +1 -0
- package/src/api/xrp/XrpSignTransaction.ts +2 -1
- package/src/core/PollingStateManager.ts +47 -0
- package/src/core/RequestQueue.ts +10 -3
- package/src/core/index.ts +153 -62
- package/src/data-manager/DataManager.ts +7 -12
- package/src/data-manager/MessagesConfig.ts +14 -14
- package/src/data-manager/TransportManager.ts +12 -38
- package/src/device/Device.ts +75 -82
- package/src/device/DeviceCommands.ts +26 -162
- package/src/device/DeviceConnector.ts +4 -29
- package/src/device/DevicePool.ts +1 -1
- package/src/events/ui-request.ts +0 -8
- package/src/inject.ts +2 -46
- package/src/types/api/export.ts +0 -1
- package/src/types/api/firmwareUpdate.ts +0 -12
- package/src/types/api/getPassphraseState.ts +2 -13
- package/src/types/api/index.ts +3 -80
- package/src/types/api/preInitialize.ts +3 -0
- package/src/types/api/searchDevices.ts +2 -2
- package/src/types/device.ts +2 -33
- package/src/types/params.ts +2 -4
- package/src/types/settings.ts +1 -1
- package/src/utils/deviceFeaturesUtils.ts +21 -62
- package/src/utils/deviceInfoUtils.ts +8 -15
- package/src/utils/index.ts +0 -1
- package/__tests__/protocol-v2.test.ts +0 -1544
- 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 -23
- package/dist/api/FileWrite.d.ts.map +0 -1
- package/dist/api/FirmwareUpdateV4.d.ts +0 -32
- package/dist/api/FirmwareUpdateV4.d.ts.map +0 -1
- package/dist/api/GetDeviceInfo.d.ts +0 -9
- package/dist/api/GetDeviceInfo.d.ts.map +0 -1
- package/dist/api/PathInfo.d.ts +0 -9
- package/dist/api/PathInfo.d.ts.map +0 -1
- package/dist/api/helpers/deviceInfo.d.ts +0 -15
- package/dist/api/helpers/deviceInfo.d.ts.map +0 -1
- package/dist/api/helpers/filesystemValidation.d.ts +0 -7
- package/dist/api/helpers/filesystemValidation.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/DeviceGetDeviceInfo.d.ts +0 -7
- package/dist/api/protocol-v2/DeviceGetDeviceInfo.d.ts.map +0 -1
- package/dist/api/protocol-v2/DeviceGetFirmwareUpdateStatus.d.ts +0 -6
- 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/DeviceReboot.d.ts +0 -7
- package/dist/api/protocol-v2/DeviceReboot.d.ts.map +0 -1
- package/dist/api/protocol-v2/FactoryDeviceInfoSettings.d.ts +0 -7
- package/dist/api/protocol-v2/FactoryDeviceInfoSettings.d.ts.map +0 -1
- package/dist/api/protocol-v2/FactoryGetDeviceInfo.d.ts +0 -6
- package/dist/api/protocol-v2/FactoryGetDeviceInfo.d.ts.map +0 -1
- package/dist/api/protocol-v2/FilesystemDiskControl.d.ts +0 -10
- package/dist/api/protocol-v2/FilesystemDiskControl.d.ts.map +0 -1
- package/dist/api/protocol-v2/FilesystemFixPermission.d.ts +0 -6
- package/dist/api/protocol-v2/FilesystemFixPermission.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/GetProtoVersion.d.ts +0 -6
- package/dist/api/protocol-v2/GetProtoVersion.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/helpers.d.ts +0 -49
- package/dist/api/protocol-v2/helpers.d.ts.map +0 -1
- package/dist/protocols/protocol-v2/features.d.ts +0 -74
- package/dist/protocols/protocol-v2/features.d.ts.map +0 -1
- package/dist/protocols/protocol-v2/firmware.d.ts +0 -12
- package/dist/protocols/protocol-v2/firmware.d.ts.map +0 -1
- package/dist/protocols/protocol-v2/index.d.ts +0 -3
- package/dist/protocols/protocol-v2/index.d.ts.map +0 -1
- package/dist/types/api/getDeviceInfo.d.ts +0 -84
- package/dist/types/api/getDeviceInfo.d.ts.map +0 -1
- package/dist/types/api/protocolV2.d.ts +0 -127
- package/dist/types/api/protocolV2.d.ts.map +0 -1
- package/src/api/DirList.ts +0 -29
- package/src/api/DirMake.ts +0 -21
- package/src/api/DirRemove.ts +0 -21
- package/src/api/FileDelete.ts +0 -21
- package/src/api/FileRead.ts +0 -165
- package/src/api/FileWrite.ts +0 -203
- package/src/api/FirmwareUpdateV4.ts +0 -810
- package/src/api/GetDeviceInfo.ts +0 -153
- package/src/api/PathInfo.ts +0 -25
- package/src/api/helpers/deviceInfo.ts +0 -205
- package/src/api/helpers/filesystemValidation.ts +0 -51
- package/src/api/protocol-v2/DeviceFirmwareUpdate.ts +0 -50
- package/src/api/protocol-v2/DeviceGetDeviceInfo.ts +0 -35
- package/src/api/protocol-v2/DeviceGetFirmwareUpdateStatus.ts +0 -18
- package/src/api/protocol-v2/DeviceGetOnboardingStatus.ts +0 -18
- package/src/api/protocol-v2/DeviceReboot.ts +0 -22
- package/src/api/protocol-v2/FactoryDeviceInfoSettings.ts +0 -27
- package/src/api/protocol-v2/FactoryGetDeviceInfo.ts +0 -18
- package/src/api/protocol-v2/FilesystemDiskControl.ts +0 -34
- package/src/api/protocol-v2/FilesystemFixPermission.ts +0 -14
- package/src/api/protocol-v2/FilesystemFormat.ts +0 -14
- package/src/api/protocol-v2/GetProtoVersion.ts +0 -14
- package/src/api/protocol-v2/Ping.ts +0 -16
- package/src/api/protocol-v2/helpers.ts +0 -161
- package/src/data/messages/messages-protocol-v2.json +0 -13116
- package/src/protocols/protocol-v2/features.ts +0 -278
- package/src/protocols/protocol-v2/firmware.ts +0 -26
- package/src/protocols/protocol-v2/index.ts +0 -2
- package/src/types/api/getDeviceInfo.ts +0 -97
- package/src/types/api/protocolV2.ts +0 -226
|
@@ -4,76 +4,6 @@ import { UI_REQUEST } from '../constants/ui-request';
|
|
|
4
4
|
import { fixVersion } from '../utils/deviceFeaturesUtils';
|
|
5
5
|
import { BaseMethod } from './BaseMethod';
|
|
6
6
|
|
|
7
|
-
import type { OnekeyFeatures } from '../types';
|
|
8
|
-
|
|
9
|
-
const ONEKEY_FEATURE_KEYS: Array<keyof OnekeyFeatures> = [
|
|
10
|
-
'onekey_device_type',
|
|
11
|
-
'onekey_board_version',
|
|
12
|
-
'onekey_boot_version',
|
|
13
|
-
'onekey_firmware_version',
|
|
14
|
-
'onekey_board_hash',
|
|
15
|
-
'onekey_boot_hash',
|
|
16
|
-
'onekey_firmware_hash',
|
|
17
|
-
'onekey_board_build_id',
|
|
18
|
-
'onekey_boot_build_id',
|
|
19
|
-
'onekey_firmware_build_id',
|
|
20
|
-
'onekey_serial_no',
|
|
21
|
-
'onekey_ble_name',
|
|
22
|
-
'onekey_ble_version',
|
|
23
|
-
'onekey_ble_build_id',
|
|
24
|
-
'onekey_ble_hash',
|
|
25
|
-
'onekey_se_type',
|
|
26
|
-
'onekey_se01_state',
|
|
27
|
-
'onekey_se02_state',
|
|
28
|
-
'onekey_se03_state',
|
|
29
|
-
'onekey_se04_state',
|
|
30
|
-
'onekey_se01_version',
|
|
31
|
-
'onekey_se02_version',
|
|
32
|
-
'onekey_se03_version',
|
|
33
|
-
'onekey_se04_version',
|
|
34
|
-
'onekey_se01_hash',
|
|
35
|
-
'onekey_se02_hash',
|
|
36
|
-
'onekey_se03_hash',
|
|
37
|
-
'onekey_se04_hash',
|
|
38
|
-
'onekey_se01_build_id',
|
|
39
|
-
'onekey_se02_build_id',
|
|
40
|
-
'onekey_se03_build_id',
|
|
41
|
-
'onekey_se04_build_id',
|
|
42
|
-
'onekey_se01_boot_version',
|
|
43
|
-
'onekey_se02_boot_version',
|
|
44
|
-
'onekey_se03_boot_version',
|
|
45
|
-
'onekey_se04_boot_version',
|
|
46
|
-
'onekey_se01_boot_hash',
|
|
47
|
-
'onekey_se02_boot_hash',
|
|
48
|
-
'onekey_se03_boot_hash',
|
|
49
|
-
'onekey_se04_boot_hash',
|
|
50
|
-
'onekey_se01_boot_build_id',
|
|
51
|
-
'onekey_se02_boot_build_id',
|
|
52
|
-
'onekey_se03_boot_build_id',
|
|
53
|
-
'onekey_se04_boot_build_id',
|
|
54
|
-
];
|
|
55
|
-
|
|
56
|
-
function normalizeOnekeyFirmwareVersion(message: OnekeyFeatures) {
|
|
57
|
-
if (message.onekey_firmware_version && !semver.valid(message.onekey_firmware_version)) {
|
|
58
|
-
message.onekey_firmware_version = fixVersion(message.onekey_firmware_version);
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
function pickOnekeyFeatures(features?: OnekeyFeatures | null): OnekeyFeatures {
|
|
63
|
-
const message: OnekeyFeatures = {};
|
|
64
|
-
if (!features) return message;
|
|
65
|
-
|
|
66
|
-
for (const key of ONEKEY_FEATURE_KEYS) {
|
|
67
|
-
const value = features[key];
|
|
68
|
-
if (value !== undefined && value !== null) {
|
|
69
|
-
(message as Record<string, unknown>)[key] = value;
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
normalizeOnekeyFirmwareVersion(message);
|
|
74
|
-
return message;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
7
|
export default class GetOnekeyFeatures extends BaseMethod {
|
|
78
8
|
init() {
|
|
79
9
|
this.allowDeviceMode = [
|
|
@@ -86,12 +16,10 @@ export default class GetOnekeyFeatures extends BaseMethod {
|
|
|
86
16
|
}
|
|
87
17
|
|
|
88
18
|
async run() {
|
|
89
|
-
if (this.device.originalDescriptor?.protocolType === 'V2') {
|
|
90
|
-
return Promise.resolve(pickOnekeyFeatures(this.device.features as OnekeyFeatures));
|
|
91
|
-
}
|
|
92
|
-
|
|
93
19
|
const { message } = await this.device.commands.typedCall('OnekeyGetFeatures', 'OnekeyFeatures');
|
|
94
|
-
|
|
20
|
+
if (!!message.onekey_firmware_version && !semver.valid(message.onekey_firmware_version)) {
|
|
21
|
+
message.onekey_firmware_version = fixVersion(message.onekey_firmware_version);
|
|
22
|
+
}
|
|
95
23
|
return Promise.resolve(message);
|
|
96
24
|
}
|
|
97
25
|
}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ERRORS, HardwareErrorCode } from '@onekeyfe/hd-shared';
|
|
2
2
|
|
|
3
3
|
import { UI_REQUEST } from '../constants/ui-request';
|
|
4
4
|
import { getPassphraseStateWithRefreshDeviceInfo } from '../utils/deviceFeaturesUtils';
|
|
5
|
-
import { getDeviceType } from '../utils/deviceInfoUtils';
|
|
6
5
|
import { BaseMethod } from './BaseMethod';
|
|
7
6
|
|
|
8
7
|
export default class GetPassphraseState extends BaseMethod {
|
|
@@ -15,23 +14,15 @@ export default class GetPassphraseState extends BaseMethod {
|
|
|
15
14
|
if (!this.device.features)
|
|
16
15
|
return Promise.reject(ERRORS.TypedError(HardwareErrorCode.DeviceInitializeFailed));
|
|
17
16
|
|
|
18
|
-
const { passphraseState
|
|
19
|
-
await getPassphraseStateWithRefreshDeviceInfo(this.device, {
|
|
20
|
-
expectPassphraseState: this.payload.passphraseState,
|
|
21
|
-
onlyMainPin: this.payload.useEmptyPassphrase,
|
|
22
|
-
allowCreateAttachPin: this.payload.allowCreateAttachPin,
|
|
23
|
-
});
|
|
17
|
+
const { passphraseState } = await getPassphraseStateWithRefreshDeviceInfo(this.device);
|
|
24
18
|
|
|
25
19
|
const { features } = this.device;
|
|
26
|
-
const isPro2 = getDeviceType(features) === EDeviceType.Pro2;
|
|
27
|
-
const passphraseProtection = features?.passphrase_protection ?? null;
|
|
28
20
|
|
|
29
21
|
// refresh device info
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
});
|
|
22
|
+
if (features && features.passphrase_protection === true) {
|
|
23
|
+
return Promise.resolve(passphraseState);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
return Promise.resolve(undefined);
|
|
36
27
|
}
|
|
37
28
|
}
|
package/src/api/SearchDevices.ts
CHANGED
|
@@ -34,22 +34,17 @@ export default class SearchDevices extends BaseMethod {
|
|
|
34
34
|
const lowerId = device.id?.toLowerCase();
|
|
35
35
|
if (!seenIds.has(lowerId)) {
|
|
36
36
|
seenIds.add(lowerId);
|
|
37
|
-
const bleName =
|
|
38
|
-
device.name ?? (device as unknown as { localName?: string }).localName ?? '';
|
|
39
37
|
devices.push({
|
|
40
38
|
...device,
|
|
41
39
|
connectId: device.id,
|
|
42
|
-
|
|
43
|
-
deviceType: getDeviceTypeByBleName(bleName),
|
|
40
|
+
deviceType: getDeviceTypeByBleName(device.name ?? ''),
|
|
44
41
|
});
|
|
45
42
|
}
|
|
46
43
|
}
|
|
47
44
|
return devices;
|
|
48
45
|
}
|
|
49
46
|
|
|
50
|
-
const { deviceList } = await DevicePool.getDevices(devicesDescriptor
|
|
51
|
-
connectProtocol: this.payload.connectProtocol,
|
|
52
|
-
});
|
|
47
|
+
const { deviceList } = await DevicePool.getDevices(devicesDescriptor);
|
|
53
48
|
return deviceList.map(device => device.toMessageObject());
|
|
54
49
|
}
|
|
55
50
|
}
|
|
@@ -4,7 +4,7 @@ import { BaseMethod } from '../BaseMethod';
|
|
|
4
4
|
import { validateParams, validateResult } from '../helpers/paramsValidator';
|
|
5
5
|
|
|
6
6
|
import type { AlephiumGetAddress as HardwareAlephiumGetAddress } from '@onekeyfe/hd-transport';
|
|
7
|
-
import type { AlephiumAddress, AlephiumGetAddressParams
|
|
7
|
+
import type { AlephiumAddress, AlephiumGetAddressParams } from '../../types';
|
|
8
8
|
|
|
9
9
|
export default class AlephiumGetAddress extends BaseMethod<HardwareAlephiumGetAddress[]> {
|
|
10
10
|
hasBundle = false;
|
|
@@ -43,12 +43,8 @@ export default class AlephiumGetAddress extends BaseMethod<HardwareAlephiumGetAd
|
|
|
43
43
|
});
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
getVersionRange()
|
|
46
|
+
getVersionRange() {
|
|
47
47
|
return {
|
|
48
|
-
pro2: {
|
|
49
|
-
min: '0.0.0',
|
|
50
|
-
unsupported: true,
|
|
51
|
-
},
|
|
52
48
|
model_touch: {
|
|
53
49
|
min: '4.10.0',
|
|
54
50
|
},
|
|
@@ -5,12 +5,12 @@ import { validateParams } from '../helpers/paramsValidator';
|
|
|
5
5
|
import { stripHexPrefix } from '../helpers/hexUtils';
|
|
6
6
|
|
|
7
7
|
import type { AlephiumSignMessage as HardwareAlephiumSignMessage } from '@onekeyfe/hd-transport';
|
|
8
|
-
import type { DeviceFirmwareRange } from '../../types';
|
|
9
8
|
|
|
10
9
|
export default class AlephiumSignMessage extends BaseMethod<HardwareAlephiumSignMessage> {
|
|
11
10
|
init() {
|
|
12
11
|
this.checkDeviceId = true;
|
|
13
12
|
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
13
|
+
this.allowUsePreInitialize = true;
|
|
14
14
|
|
|
15
15
|
// check payload
|
|
16
16
|
validateParams(this.payload, [
|
|
@@ -30,12 +30,8 @@ export default class AlephiumSignMessage extends BaseMethod<HardwareAlephiumSign
|
|
|
30
30
|
};
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
getVersionRange()
|
|
33
|
+
getVersionRange() {
|
|
34
34
|
return {
|
|
35
|
-
pro2: {
|
|
36
|
-
min: '0.0.0',
|
|
37
|
-
unsupported: true,
|
|
38
|
-
},
|
|
39
35
|
model_touch: {
|
|
40
36
|
min: '4.10.0',
|
|
41
37
|
},
|
|
@@ -11,13 +11,14 @@ import type {
|
|
|
11
11
|
AlephiumSignTx as HardwareAlephiumSignTx,
|
|
12
12
|
TypedCall,
|
|
13
13
|
} from '@onekeyfe/hd-transport';
|
|
14
|
-
import type { AlephiumSignTransactionParams
|
|
14
|
+
import type { AlephiumSignTransactionParams } from '../../types';
|
|
15
15
|
import type { TypedResponseMessage } from '../../device/DeviceCommands';
|
|
16
16
|
|
|
17
17
|
export default class AlephiumSignTransaction extends BaseMethod<HardwareAlephiumSignTx> {
|
|
18
18
|
init() {
|
|
19
19
|
this.checkDeviceId = true;
|
|
20
20
|
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
21
|
+
this.allowUsePreInitialize = true;
|
|
21
22
|
|
|
22
23
|
// check payload
|
|
23
24
|
validateParams(this.payload, [
|
|
@@ -38,12 +39,8 @@ export default class AlephiumSignTransaction extends BaseMethod<HardwareAlephium
|
|
|
38
39
|
};
|
|
39
40
|
}
|
|
40
41
|
|
|
41
|
-
getVersionRange()
|
|
42
|
+
getVersionRange() {
|
|
42
43
|
return {
|
|
43
|
-
pro2: {
|
|
44
|
-
min: '0.0.0',
|
|
45
|
-
unsupported: true,
|
|
46
|
-
},
|
|
47
44
|
model_touch: {
|
|
48
45
|
min: '4.10.0',
|
|
49
46
|
},
|
|
@@ -12,6 +12,7 @@ export default class AlgoSignTransaction extends BaseMethod<HardwareAlgorandSign
|
|
|
12
12
|
init() {
|
|
13
13
|
this.checkDeviceId = true;
|
|
14
14
|
this.allowDeviceMode = [...this.allowDeviceMode];
|
|
15
|
+
this.allowUsePreInitialize = true;
|
|
15
16
|
|
|
16
17
|
// check payload
|
|
17
18
|
validateParams(this.payload, [
|
|
@@ -12,12 +12,7 @@ import { validateParams } from '../helpers/paramsValidator';
|
|
|
12
12
|
import { PROTO } from '../../constants';
|
|
13
13
|
import { findMethod } from '../utils';
|
|
14
14
|
import { DEVICE, IFRAME, createUiMessage } from '../../events';
|
|
15
|
-
import {
|
|
16
|
-
getDeviceFirmwareVersion,
|
|
17
|
-
getFirmwareType,
|
|
18
|
-
getMethodVersionRange,
|
|
19
|
-
isMethodVersionRangeUnsupported,
|
|
20
|
-
} from '../../utils';
|
|
15
|
+
import { getDeviceFirmwareVersion, getFirmwareType, getMethodVersionRange } from '../../utils';
|
|
21
16
|
import { UI_REQUEST } from '../../constants/ui-request';
|
|
22
17
|
import { onDeviceButtonHandler } from '../../core';
|
|
23
18
|
import {
|
|
@@ -376,6 +371,14 @@ export default abstract class AllNetworkGetAddressBase extends BaseMethod<
|
|
|
376
371
|
this.device.on(DEVICE.PASSPHRASE, onSignalAbort);
|
|
377
372
|
|
|
378
373
|
preCheckDeviceSupport(this.device, method);
|
|
374
|
+
if (this.temporarySafetyCheckPrompted) {
|
|
375
|
+
method.temporarySafetyCheckPrompted = true;
|
|
376
|
+
} else {
|
|
377
|
+
const appliedTemporarySafetyCheck = await method.checkSafetyLevelOnTestNet();
|
|
378
|
+
if (appliedTemporarySafetyCheck) {
|
|
379
|
+
this.temporarySafetyCheckPrompted = true;
|
|
380
|
+
}
|
|
381
|
+
}
|
|
379
382
|
|
|
380
383
|
const response = await method.run();
|
|
381
384
|
|
|
@@ -466,10 +469,6 @@ function preCheckDeviceSupport(device: Device, method: BaseMethod) {
|
|
|
466
469
|
);
|
|
467
470
|
const currentVersion = getDeviceFirmwareVersion(device.features).join('.');
|
|
468
471
|
|
|
469
|
-
if (isMethodVersionRangeUnsupported(versionRange)) {
|
|
470
|
-
throw ERRORS.createDeviceNotSupportMethodError(method.name, getFirmwareType(device.features));
|
|
471
|
-
}
|
|
472
|
-
|
|
473
472
|
if (
|
|
474
473
|
versionRange &&
|
|
475
474
|
semver.valid(versionRange.min) &&
|
|
@@ -510,14 +509,6 @@ function handleSkippableHardwareError(
|
|
|
510
509
|
);
|
|
511
510
|
const currentVersion = getDeviceFirmwareVersion(device.features).join('.');
|
|
512
511
|
|
|
513
|
-
if (isMethodVersionRangeUnsupported(versionRange)) {
|
|
514
|
-
error = ERRORS.createDeviceNotSupportMethodError(
|
|
515
|
-
method.name,
|
|
516
|
-
getFirmwareType(device.features)
|
|
517
|
-
);
|
|
518
|
-
return error;
|
|
519
|
-
}
|
|
520
|
-
|
|
521
512
|
if (
|
|
522
513
|
versionRange &&
|
|
523
514
|
semver.valid(versionRange.min) &&
|
|
@@ -10,6 +10,7 @@ export default class AptosSignInMessage extends BaseMethod<AptosSignSIWAMessage>
|
|
|
10
10
|
init() {
|
|
11
11
|
this.checkDeviceId = true;
|
|
12
12
|
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
13
|
+
this.allowUsePreInitialize = true;
|
|
13
14
|
|
|
14
15
|
// check payload
|
|
15
16
|
validateParams(this.payload, [
|
|
@@ -10,6 +10,7 @@ export default class AptosSignMessage extends BaseMethod<HardwareAptosSignMessag
|
|
|
10
10
|
init() {
|
|
11
11
|
this.checkDeviceId = true;
|
|
12
12
|
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
13
|
+
this.allowUsePreInitialize = true;
|
|
13
14
|
|
|
14
15
|
// check payload
|
|
15
16
|
validateParams(this.payload, [
|
|
@@ -10,6 +10,7 @@ export default class AptosSignTransaction extends BaseMethod<HardwareAptosSignTx
|
|
|
10
10
|
init() {
|
|
11
11
|
this.checkDeviceId = true;
|
|
12
12
|
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
13
|
+
this.allowUsePreInitialize = true;
|
|
13
14
|
|
|
14
15
|
// check payload
|
|
15
16
|
validateParams(this.payload, [
|
|
@@ -6,7 +6,7 @@ import { hex2BfcAddress, publicKeyToAddress } from './normalize';
|
|
|
6
6
|
import { supportBatchPublicKey } from '../../utils/deviceFeaturesUtils';
|
|
7
7
|
import { batchGetPublickeys } from '../helpers/batchGetPublickeys';
|
|
8
8
|
|
|
9
|
-
import type { BenfenAddress, BenfenGetAddressParams
|
|
9
|
+
import type { BenfenAddress, BenfenGetAddressParams } from '../../types';
|
|
10
10
|
import type { BenfenGetAddress as HardwareBenfenGetAddress } from '@onekeyfe/hd-transport';
|
|
11
11
|
|
|
12
12
|
export default class BenfenGetAddress extends BaseMethod<HardwareBenfenGetAddress[]> {
|
|
@@ -47,12 +47,8 @@ export default class BenfenGetAddress extends BaseMethod<HardwareBenfenGetAddres
|
|
|
47
47
|
});
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
-
getVersionRange()
|
|
50
|
+
getVersionRange() {
|
|
51
51
|
return {
|
|
52
|
-
pro2: {
|
|
53
|
-
min: '0.0.0',
|
|
54
|
-
unsupported: true,
|
|
55
|
-
},
|
|
56
52
|
pro: {
|
|
57
53
|
min: '4.12.0',
|
|
58
54
|
},
|
|
@@ -4,7 +4,7 @@ import { serializedPath, validatePath } from '../helpers/pathUtils';
|
|
|
4
4
|
import { UI_REQUEST } from '../../constants/ui-request';
|
|
5
5
|
import { batchGetPublickeys } from '../helpers/batchGetPublickeys';
|
|
6
6
|
|
|
7
|
-
import type { BenfenGetPublicKeyParams, BenfenPublicKey
|
|
7
|
+
import type { BenfenGetPublicKeyParams, BenfenPublicKey } from '../../types';
|
|
8
8
|
|
|
9
9
|
export default class BenfenGetPublicKey extends BaseMethod<any> {
|
|
10
10
|
hasBundle = false;
|
|
@@ -38,12 +38,8 @@ export default class BenfenGetPublicKey extends BaseMethod<any> {
|
|
|
38
38
|
});
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
getVersionRange()
|
|
41
|
+
getVersionRange() {
|
|
42
42
|
return {
|
|
43
|
-
pro2: {
|
|
44
|
-
min: '0.0.0',
|
|
45
|
-
unsupported: true,
|
|
46
|
-
},
|
|
47
43
|
pro: {
|
|
48
44
|
min: '4.12.0',
|
|
49
45
|
},
|
|
@@ -5,12 +5,12 @@ import { validateParams } from '../helpers/paramsValidator';
|
|
|
5
5
|
import { stripHexPrefix } from '../helpers/hexUtils';
|
|
6
6
|
|
|
7
7
|
import type { BenfenSignMessage as HardwareBenfenSignMessage } from '@onekeyfe/hd-transport';
|
|
8
|
-
import type { DeviceFirmwareRange } from '../../types';
|
|
9
8
|
|
|
10
9
|
export default class BenfenSignMessage extends BaseMethod<HardwareBenfenSignMessage> {
|
|
11
10
|
init() {
|
|
12
11
|
this.checkDeviceId = true;
|
|
13
12
|
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
13
|
+
this.allowUsePreInitialize = true;
|
|
14
14
|
|
|
15
15
|
validateParams(this.payload, [
|
|
16
16
|
{ name: 'path', required: true },
|
|
@@ -26,12 +26,8 @@ export default class BenfenSignMessage extends BaseMethod<HardwareBenfenSignMess
|
|
|
26
26
|
};
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
getVersionRange()
|
|
29
|
+
getVersionRange() {
|
|
30
30
|
return {
|
|
31
|
-
pro2: {
|
|
32
|
-
min: '0.0.0',
|
|
33
|
-
unsupported: true,
|
|
34
|
-
},
|
|
35
31
|
pro: {
|
|
36
32
|
min: '4.12.0',
|
|
37
33
|
},
|
|
@@ -8,12 +8,12 @@ import { formatAnyHex } from '../helpers/hexUtils';
|
|
|
8
8
|
|
|
9
9
|
import type { BenfenSignTx, BenfenSignedTx, MessageType, TypedCall } from '@onekeyfe/hd-transport';
|
|
10
10
|
import type { TypedResponseMessage } from '../../device/DeviceCommands';
|
|
11
|
-
import type { DeviceFirmwareRange } from '../../types';
|
|
12
11
|
|
|
13
12
|
export default class BenfenSignTransaction extends BaseMethod<BenfenSignTx> {
|
|
14
13
|
init() {
|
|
15
14
|
this.checkDeviceId = true;
|
|
16
15
|
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
16
|
+
this.allowUsePreInitialize = true;
|
|
17
17
|
|
|
18
18
|
validateParams(this.payload, [
|
|
19
19
|
{ name: 'path', required: true },
|
|
@@ -33,12 +33,8 @@ export default class BenfenSignTransaction extends BaseMethod<BenfenSignTx> {
|
|
|
33
33
|
};
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
getVersionRange()
|
|
36
|
+
getVersionRange() {
|
|
37
37
|
return {
|
|
38
|
-
pro2: {
|
|
39
|
-
min: '0.0.0',
|
|
40
|
-
unsupported: true,
|
|
41
|
-
},
|
|
42
38
|
pro: {
|
|
43
39
|
min: '4.12.0',
|
|
44
40
|
},
|
|
@@ -12,6 +12,7 @@ export default class BTCSignMessage extends BaseMethod<SignMessage> {
|
|
|
12
12
|
init() {
|
|
13
13
|
this.checkDeviceId = true;
|
|
14
14
|
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
15
|
+
this.allowUsePreInitialize = true;
|
|
15
16
|
|
|
16
17
|
validateParams(this.payload, [
|
|
17
18
|
{ name: 'path', required: true },
|
|
@@ -13,6 +13,7 @@ export default class BTCSignPsbt extends BaseMethod<SignPsbt> {
|
|
|
13
13
|
init() {
|
|
14
14
|
this.checkDeviceId = true;
|
|
15
15
|
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
16
|
+
this.allowUsePreInitialize = true;
|
|
16
17
|
|
|
17
18
|
validateParams(this.payload, [
|
|
18
19
|
{ name: 'psbt', type: 'hexString', required: true },
|
|
@@ -29,6 +29,7 @@ export default class BTCSignTransaction extends BaseMethod<Params> {
|
|
|
29
29
|
init() {
|
|
30
30
|
this.checkDeviceId = true;
|
|
31
31
|
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
32
|
+
this.allowUsePreInitialize = true;
|
|
32
33
|
|
|
33
34
|
validateParams(this.payload, [
|
|
34
35
|
{ name: 'coin', type: 'string', required: true },
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import type { DeviceFirmwareRange } from '../../../types';
|
|
2
|
-
|
|
3
1
|
function isCoinNameInList(coinName: string, coinNames: (string | undefined)[]) {
|
|
4
2
|
for (let i = 0; i < coinNames.length; i++) {
|
|
5
3
|
const coin_name = coinNames[i];
|
|
@@ -10,13 +8,9 @@ function isCoinNameInList(coinName: string, coinNames: (string | undefined)[]) {
|
|
|
10
8
|
return false;
|
|
11
9
|
}
|
|
12
10
|
|
|
13
|
-
export function getBitcoinForkVersionRange(params: (string | undefined)[])
|
|
11
|
+
export function getBitcoinForkVersionRange(params: (string | undefined)[]) {
|
|
14
12
|
if (isCoinNameInList('Neurai', params)) {
|
|
15
13
|
return {
|
|
16
|
-
pro2: {
|
|
17
|
-
min: '0.0.0',
|
|
18
|
-
unsupported: true,
|
|
19
|
-
},
|
|
20
14
|
model_mini: {
|
|
21
15
|
min: '3.7.0',
|
|
22
16
|
},
|
|
@@ -14,6 +14,7 @@ export default class CardanoSignMessage extends BaseMethod<CardanoSignMessagePar
|
|
|
14
14
|
init() {
|
|
15
15
|
this.checkDeviceId = true;
|
|
16
16
|
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
17
|
+
this.allowUsePreInitialize = true;
|
|
17
18
|
|
|
18
19
|
const { payload } = this;
|
|
19
20
|
validateParams(payload, [
|
|
@@ -49,6 +49,7 @@ export default class CardanoSignTransaction extends BaseMethod<any> {
|
|
|
49
49
|
init() {
|
|
50
50
|
this.checkDeviceId = true;
|
|
51
51
|
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
52
|
+
this.allowUsePreInitialize = true;
|
|
52
53
|
|
|
53
54
|
this.hasBundle = !!this.payload?.bundle;
|
|
54
55
|
|
|
@@ -9,6 +9,7 @@ import type { ConfluxSignMessage as HardwareConfluxSignMessage } from '@onekeyfe
|
|
|
9
9
|
export default class ConfluxSignMessage extends BaseMethod<HardwareConfluxSignMessage> {
|
|
10
10
|
init() {
|
|
11
11
|
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
12
|
+
this.allowUsePreInitialize = true;
|
|
12
13
|
|
|
13
14
|
// check payload
|
|
14
15
|
validateParams(this.payload, [
|
|
@@ -9,6 +9,7 @@ import type { ConfluxSignMessageCIP23 as HardwareConfluxSignMessageCIP23 } from
|
|
|
9
9
|
export default class ConfluxSignMessageCIP23 extends BaseMethod<HardwareConfluxSignMessageCIP23> {
|
|
10
10
|
init() {
|
|
11
11
|
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
12
|
+
this.allowUsePreInitialize = true;
|
|
12
13
|
|
|
13
14
|
validateParams(this.payload, [
|
|
14
15
|
{ name: 'path', required: true },
|
|
@@ -22,6 +22,7 @@ export default class ConfluxSignTransaction extends BaseMethod {
|
|
|
22
22
|
|
|
23
23
|
init() {
|
|
24
24
|
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
25
|
+
this.allowUsePreInitialize = true;
|
|
25
26
|
|
|
26
27
|
validateParams(this.payload, [
|
|
27
28
|
{ name: 'path', required: true },
|
|
@@ -34,7 +35,7 @@ export default class ConfluxSignTransaction extends BaseMethod {
|
|
|
34
35
|
|
|
35
36
|
// check if transaction is valid
|
|
36
37
|
const schema: SchemaParam[] = [
|
|
37
|
-
{ name: 'to', type: '
|
|
38
|
+
{ name: 'to', type: 'hexString', required: true },
|
|
38
39
|
{ name: 'value', type: 'hexString', required: true },
|
|
39
40
|
{ name: 'gasLimit', type: 'hexString', required: true },
|
|
40
41
|
{ name: 'gasPrice', type: 'hexString', required: true },
|
|
@@ -47,10 +48,7 @@ export default class ConfluxSignTransaction extends BaseMethod {
|
|
|
47
48
|
|
|
48
49
|
validateParams(tx, schema);
|
|
49
50
|
|
|
50
|
-
this.formattedTx =
|
|
51
|
-
...formatAnyHex(tx),
|
|
52
|
-
to: tx.to,
|
|
53
|
-
};
|
|
51
|
+
this.formattedTx = formatAnyHex(tx);
|
|
54
52
|
}
|
|
55
53
|
|
|
56
54
|
processTxRequest = async (request: ConfluxTxRequest, data: string): Promise<ConfluxSignedTx> => {
|
|
@@ -14,6 +14,7 @@ export default class CosmosSignTransaction extends BaseMethod<HardwareCosmosSign
|
|
|
14
14
|
init() {
|
|
15
15
|
this.checkDeviceId = true;
|
|
16
16
|
this.allowDeviceMode = [...this.allowDeviceMode];
|
|
17
|
+
this.allowUsePreInitialize = true;
|
|
17
18
|
|
|
18
19
|
// check payload
|
|
19
20
|
validateParams(this.payload, [
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { DeviceRebootType } from '@onekeyfe/hd-transport';
|
|
2
|
-
|
|
3
1
|
import { BaseMethod } from '../BaseMethod';
|
|
4
2
|
|
|
5
3
|
import type { RebootToBoardloaderParams } from '../../types/api/deviceRebootToBoardloader';
|
|
@@ -23,17 +21,10 @@ export default class DeviceRebootToBoardloader extends BaseMethod<RebootToBoardl
|
|
|
23
21
|
}
|
|
24
22
|
|
|
25
23
|
async run() {
|
|
26
|
-
// Protocol V2 uses DeviceReboot with reboot_type enum.
|
|
27
|
-
if (this.device.originalDescriptor?.protocolType === 'V2') {
|
|
28
|
-
const res = await this.device.commands.typedCall('DeviceReboot', 'Success', {
|
|
29
|
-
reboot_type: DeviceRebootType.Boardloader,
|
|
30
|
-
});
|
|
31
|
-
return Promise.resolve(res.message);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
24
|
// On Touch devices, messsage code 904 is RebootToBoardloader
|
|
35
25
|
// so BininOutMessageSE message code 904 is used here
|
|
36
26
|
const res = await this.device.commands.typedCall('BixinOutMessageSE', 'Success');
|
|
27
|
+
|
|
37
28
|
return Promise.resolve(res.message);
|
|
38
29
|
}
|
|
39
30
|
}
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { DeviceRebootType } from '@onekeyfe/hd-transport';
|
|
2
|
-
|
|
3
1
|
import { BaseMethod } from '../BaseMethod';
|
|
4
2
|
|
|
5
3
|
import type { RebootToBootloader } from '@onekeyfe/hd-transport';
|
|
@@ -23,15 +21,8 @@ export default class DeviceRebootToBootloader extends BaseMethod<RebootToBootloa
|
|
|
23
21
|
}
|
|
24
22
|
|
|
25
23
|
async run() {
|
|
26
|
-
// Protocol V2 uses DeviceReboot with reboot_type enum.
|
|
27
|
-
if (this.device.originalDescriptor?.protocolType === 'V2') {
|
|
28
|
-
const res = await this.device.commands.typedCall('DeviceReboot', 'Success', {
|
|
29
|
-
reboot_type: DeviceRebootType.Bootloader,
|
|
30
|
-
});
|
|
31
|
-
return Promise.resolve(res.message);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
24
|
const res = await this.device.commands.typedCall('RebootToBootloader', 'Success');
|
|
25
|
+
|
|
35
26
|
return Promise.resolve(res.message);
|
|
36
27
|
}
|
|
37
28
|
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { BaseMethod } from '../BaseMethod';
|
|
2
|
+
import { LoggerNames, getLogger } from '../../utils';
|
|
3
|
+
|
|
4
|
+
import type { InitOptions } from '../../device/Device';
|
|
5
|
+
|
|
6
|
+
// Core prefix (@onekey/hd-core) so the host app's LOG_EVENT bridge forwards
|
|
7
|
+
// this into the collected hardware log scope (like [PRE-INIT][HIT]/[MISS]).
|
|
8
|
+
const Log = getLogger(LoggerNames.Core);
|
|
9
|
+
|
|
10
|
+
const parseInitOptions = (payload?: {
|
|
11
|
+
initSession?: boolean;
|
|
12
|
+
passphraseState?: string;
|
|
13
|
+
deriveCardano?: boolean;
|
|
14
|
+
}): InitOptions => ({
|
|
15
|
+
initSession: payload?.initSession,
|
|
16
|
+
passphraseState: payload?.passphraseState,
|
|
17
|
+
deriveCardano: payload?.deriveCardano,
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
export default class PreInitialize extends BaseMethod {
|
|
21
|
+
init() {
|
|
22
|
+
this.skipForceUpdateCheck = true;
|
|
23
|
+
this.useDevicePassphraseState = false;
|
|
24
|
+
// Fire-and-forget warm-up signal (core dedups + hangs up for the next call)
|
|
25
|
+
this.isPreWarmSignal = true;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
async run() {
|
|
29
|
+
try {
|
|
30
|
+
await this.device.preInitialize(parseInitOptions(this.payload));
|
|
31
|
+
if (this.device.hasDeviceAcquire()) {
|
|
32
|
+
await this.device.release();
|
|
33
|
+
}
|
|
34
|
+
return true;
|
|
35
|
+
} catch {
|
|
36
|
+
this.device.clearPreInitialized();
|
|
37
|
+
Log.debug('[PRE-INIT][FAILED]');
|
|
38
|
+
return false;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|