@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
|
@@ -6,7 +6,7 @@ import { BaseMethod } from '../BaseMethod';
|
|
|
6
6
|
import { validateParams } from '../helpers/paramsValidator';
|
|
7
7
|
import { formatAnyHex, stripHexStartZeroes } from '../helpers/hexUtils';
|
|
8
8
|
|
|
9
|
-
import type {
|
|
9
|
+
import type { ScdoSignTransactionParams } from '../../types';
|
|
10
10
|
import type {
|
|
11
11
|
ScdoSignTx as HardwareScdoSignTx,
|
|
12
12
|
ScdoSignedTx,
|
|
@@ -18,6 +18,7 @@ export default class ScdoSignTransaction extends BaseMethod<HardwareScdoSignTx>
|
|
|
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, [
|
|
@@ -50,12 +51,8 @@ export default class ScdoSignTransaction extends BaseMethod<HardwareScdoSignTx>
|
|
|
50
51
|
};
|
|
51
52
|
}
|
|
52
53
|
|
|
53
|
-
getVersionRange()
|
|
54
|
+
getVersionRange() {
|
|
54
55
|
return {
|
|
55
|
-
pro2: {
|
|
56
|
-
min: '0.0.0',
|
|
57
|
-
unsupported: true,
|
|
58
|
-
},
|
|
59
56
|
model_touch: {
|
|
60
57
|
min: '4.10.0',
|
|
61
58
|
},
|
|
@@ -10,6 +10,7 @@ export default class SolSignMessage extends BaseMethod<HardwareSolSignUnsafeMess
|
|
|
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 SolSignOffchainMessage extends BaseMethod<HardwareSolSignOf
|
|
|
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, [
|
|
@@ -13,6 +13,7 @@ export default class SolSignTransaction extends BaseMethod<HardwareSolanaSignTx[
|
|
|
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
|
this.hasBundle = !!this.payload?.bundle;
|
|
18
19
|
const payload = this.hasBundle ? this.payload : { bundle: [this.payload] };
|
|
@@ -10,6 +10,7 @@ export default class StarcoinSignMessage extends BaseMethod<HardwareStarcoinSign
|
|
|
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 StarcoinSignTransaction extends BaseMethod<StarcoinSignTx>
|
|
|
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, [
|
|
@@ -4,7 +4,7 @@ import { BaseMethod } from '../BaseMethod';
|
|
|
4
4
|
import { validateParams, validateResult } from '../helpers/paramsValidator';
|
|
5
5
|
|
|
6
6
|
import type { StellarGetAddress as HardwareStellarGetAddress } from '@onekeyfe/hd-transport';
|
|
7
|
-
import type {
|
|
7
|
+
import type { StellarAddress, StellarGetAddressParams } from '../../types';
|
|
8
8
|
|
|
9
9
|
export default class StellarGetAddress extends BaseMethod<HardwareStellarGetAddress[]> {
|
|
10
10
|
hasBundle = false;
|
|
@@ -38,15 +38,6 @@ export default class StellarGetAddress extends BaseMethod<HardwareStellarGetAddr
|
|
|
38
38
|
});
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
getVersionRange(): DeviceFirmwareRange {
|
|
42
|
-
return {
|
|
43
|
-
pro2: {
|
|
44
|
-
min: '0.0.0',
|
|
45
|
-
unsupported: true,
|
|
46
|
-
},
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
|
-
|
|
50
41
|
async run() {
|
|
51
42
|
const responses: StellarAddress[] = [];
|
|
52
43
|
|
|
@@ -10,11 +10,7 @@ import type {
|
|
|
10
10
|
StellarSignTx as HardwareStellarSignTx,
|
|
11
11
|
StellarSignedTx,
|
|
12
12
|
} from '@onekeyfe/hd-transport';
|
|
13
|
-
import type {
|
|
14
|
-
DeviceFirmwareRange,
|
|
15
|
-
StellarOperation,
|
|
16
|
-
StellarSignTransactionParams,
|
|
17
|
-
} from '../../types';
|
|
13
|
+
import type { StellarOperation, StellarSignTransactionParams } from '../../types';
|
|
18
14
|
|
|
19
15
|
// Firmware accepts up to 1024 bytes per chunk; 1 byte = 2 hex chars
|
|
20
16
|
const SOROBAN_CHUNK_BYTES = 1024;
|
|
@@ -32,15 +28,6 @@ export default class StellarSignTransaction extends BaseMethod<HardwareStellarSi
|
|
|
32
28
|
extSent: number;
|
|
33
29
|
};
|
|
34
30
|
|
|
35
|
-
getVersionRange(): DeviceFirmwareRange {
|
|
36
|
-
return {
|
|
37
|
-
pro2: {
|
|
38
|
-
min: '0.0.0',
|
|
39
|
-
unsupported: true,
|
|
40
|
-
},
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
|
|
44
31
|
parseOperation = (op: StellarOperation) => {
|
|
45
32
|
switch (op.type) {
|
|
46
33
|
case 'createAccount':
|
|
@@ -231,6 +218,7 @@ export default class StellarSignTransaction extends BaseMethod<HardwareStellarSi
|
|
|
231
218
|
init() {
|
|
232
219
|
this.checkDeviceId = true;
|
|
233
220
|
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
221
|
+
this.allowUsePreInitialize = true;
|
|
234
222
|
|
|
235
223
|
// check payload
|
|
236
224
|
validateParams(this.payload, [
|
|
@@ -10,6 +10,7 @@ export default class SuiSignMessage extends BaseMethod<HardwareSuiSignMessage> {
|
|
|
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, [
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import semver from 'semver';
|
|
2
2
|
import { bytesToHex } from '@noble/hashes/utils';
|
|
3
|
-
import { EDeviceType } from '@onekeyfe/hd-shared';
|
|
4
3
|
|
|
5
4
|
import { UI_REQUEST } from '../../constants/ui-request';
|
|
6
5
|
import { validatePath } from '../helpers/pathUtils';
|
|
@@ -10,8 +9,12 @@ import { formatAnyHex } from '../helpers/hexUtils';
|
|
|
10
9
|
import { getDeviceFirmwareVersion, getDeviceType } from '../../utils';
|
|
11
10
|
import { DeviceModelToTypes } from '../../types';
|
|
12
11
|
|
|
13
|
-
import type {
|
|
14
|
-
|
|
12
|
+
import type {
|
|
13
|
+
SuiSignTx as HardwareSuiSignTx,
|
|
14
|
+
SuiSignedTx,
|
|
15
|
+
TypedCall,
|
|
16
|
+
} from '@onekeyfe/hd-transport';
|
|
17
|
+
import type { TypedResponseMessage } from '../../device/DeviceCommands';
|
|
15
18
|
|
|
16
19
|
type SuiSignTx = Omit<HardwareSuiSignTx, 'data_initial_chunk' | 'data_length'> & HardwareSuiSignTx;
|
|
17
20
|
|
|
@@ -19,6 +22,7 @@ export default class SuiSignTransaction extends BaseMethod<SuiSignTx> {
|
|
|
19
22
|
init() {
|
|
20
23
|
this.checkDeviceId = true;
|
|
21
24
|
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
25
|
+
this.allowUsePreInitialize = true;
|
|
22
26
|
|
|
23
27
|
// check payload
|
|
24
28
|
validateParams(this.payload, [
|
|
@@ -49,13 +53,6 @@ export default class SuiSignTransaction extends BaseMethod<SuiSignTx> {
|
|
|
49
53
|
}
|
|
50
54
|
|
|
51
55
|
supportChunkTransfer() {
|
|
52
|
-
if (
|
|
53
|
-
this.device.originalDescriptor?.protocolType === 'V2' ||
|
|
54
|
-
getDeviceType(this.device.features) === EDeviceType.Pro2
|
|
55
|
-
) {
|
|
56
|
-
return true;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
56
|
const deviceType = getDeviceType(this.device.features);
|
|
60
57
|
const deviceFirmwareVersion = getDeviceFirmwareVersion(this.device.features).join('.');
|
|
61
58
|
|
|
@@ -88,7 +85,7 @@ export default class SuiSignTransaction extends BaseMethod<SuiSignTx> {
|
|
|
88
85
|
|
|
89
86
|
if (!data_length) {
|
|
90
87
|
// sign Done
|
|
91
|
-
return res.message
|
|
88
|
+
return res.message;
|
|
92
89
|
}
|
|
93
90
|
|
|
94
91
|
const payload = data.subarray(offset, offset + data_length);
|
|
@@ -107,7 +104,7 @@ export default class SuiSignTransaction extends BaseMethod<SuiSignTx> {
|
|
|
107
104
|
async run() {
|
|
108
105
|
const typedCall = this.device.getCommands().typedCall.bind(this.device.getCommands());
|
|
109
106
|
let offset = 0;
|
|
110
|
-
let data
|
|
107
|
+
let data: Buffer;
|
|
111
108
|
|
|
112
109
|
if (this.supportChunkTransfer()) {
|
|
113
110
|
offset = this.chunkByteSize;
|
|
@@ -124,6 +121,7 @@ export default class SuiSignTransaction extends BaseMethod<SuiSignTx> {
|
|
|
124
121
|
...this.params,
|
|
125
122
|
});
|
|
126
123
|
|
|
124
|
+
// @ts-expect-error
|
|
127
125
|
return this.processTxRequest(typedCall, res, data, offset);
|
|
128
126
|
}
|
|
129
127
|
}
|
|
@@ -15,6 +15,7 @@ export default class TonSignData extends BaseMethod<HardwareTonSignData> {
|
|
|
15
15
|
this.strictCheckDeviceSupport = false;
|
|
16
16
|
this.checkDeviceId = true;
|
|
17
17
|
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
18
|
+
this.allowUsePreInitialize = true;
|
|
18
19
|
|
|
19
20
|
validateParams(this.payload, [
|
|
20
21
|
{ name: 'path', required: true },
|
|
@@ -26,6 +26,7 @@ export default class TonSignMessage extends BaseMethod<HardwareTonSignMessage> {
|
|
|
26
26
|
this.strictCheckDeviceSupport = true;
|
|
27
27
|
this.checkDeviceId = true;
|
|
28
28
|
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
29
|
+
this.allowUsePreInitialize = true;
|
|
29
30
|
|
|
30
31
|
// init params
|
|
31
32
|
validateParams(this.payload, [
|
|
@@ -11,6 +11,7 @@ export default class TonSignProof extends BaseMethod<HardwareTonSignProof> {
|
|
|
11
11
|
this.strictCheckDeviceSupport = true;
|
|
12
12
|
this.checkDeviceId = true;
|
|
13
13
|
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
14
|
+
this.allowUsePreInitialize = true;
|
|
14
15
|
|
|
15
16
|
// init params
|
|
16
17
|
validateParams(this.payload, [
|
|
@@ -14,6 +14,7 @@ export default class TronSignMessage extends BaseMethod<HardwareTronSignMessage>
|
|
|
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
|
// check payload
|
|
19
20
|
validateParams(this.payload, [
|
|
@@ -28,7 +29,7 @@ export default class TronSignMessage extends BaseMethod<HardwareTronSignMessage>
|
|
|
28
29
|
if (this.payload.messageType === 'V1' || this.payload.messageType == null) {
|
|
29
30
|
throw createDeviceNotSupportMethodError(
|
|
30
31
|
'TronSignMessage',
|
|
31
|
-
getFirmwareType(this.device
|
|
32
|
+
getFirmwareType(this.device.features)
|
|
32
33
|
);
|
|
33
34
|
}
|
|
34
35
|
|
|
@@ -123,6 +123,7 @@ export default class TronSignTransaction extends BaseMethod<TronSignTx> {
|
|
|
123
123
|
init() {
|
|
124
124
|
this.checkDeviceId = true;
|
|
125
125
|
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
126
|
+
this.allowUsePreInitialize = true;
|
|
126
127
|
|
|
127
128
|
// check payload
|
|
128
129
|
validateParams(this.payload, [
|
|
@@ -11,6 +11,7 @@ export default class XrpGetAddress extends BaseMethod<XrpSignTransactionParams>
|
|
|
11
11
|
init() {
|
|
12
12
|
this.checkDeviceId = true;
|
|
13
13
|
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
14
|
+
this.allowUsePreInitialize = true;
|
|
14
15
|
|
|
15
16
|
const { payload } = this;
|
|
16
17
|
validateParams(payload, [
|
|
@@ -29,7 +30,7 @@ export default class XrpGetAddress extends BaseMethod<XrpSignTransactionParams>
|
|
|
29
30
|
{ name: 'payment', type: 'object' },
|
|
30
31
|
]);
|
|
31
32
|
validateParams(transaction.payment, [
|
|
32
|
-
{ name: 'amount', type: '
|
|
33
|
+
{ name: 'amount', type: 'number', required: true },
|
|
33
34
|
{ name: 'destination', type: 'string', required: true },
|
|
34
35
|
{ name: 'destinationTag', type: 'number' },
|
|
35
36
|
]);
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Manages polling state for device connection attempts.
|
|
3
|
+
*
|
|
4
|
+
* Polling is isolated by connectId (device), so:
|
|
5
|
+
* - New request for device A only stops device A's previous polling
|
|
6
|
+
* - Device B's polling is unaffected
|
|
7
|
+
*/
|
|
8
|
+
export class PollingStateManager {
|
|
9
|
+
// connectId -> current polling ID
|
|
10
|
+
private activePolls = new Map<string, number>();
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Start a new polling session for a device.
|
|
14
|
+
* Automatically stops the previous polling for the same device.
|
|
15
|
+
* @param connectId - Device identifier (use empty string for USB without connectId)
|
|
16
|
+
* @returns The new polling ID
|
|
17
|
+
*/
|
|
18
|
+
start(connectId: string): number {
|
|
19
|
+
const currentId = (this.activePolls.get(connectId) ?? 0) + 1;
|
|
20
|
+
this.activePolls.set(connectId, currentId);
|
|
21
|
+
return currentId;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Check if a polling session is still active.
|
|
26
|
+
* @param connectId - Device identifier
|
|
27
|
+
* @param pollingId - The polling ID to check
|
|
28
|
+
*/
|
|
29
|
+
isActive(connectId: string, pollingId: number): boolean {
|
|
30
|
+
return this.activePolls.get(connectId) === pollingId;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Stop polling for a specific device.
|
|
35
|
+
* @param connectId - Device identifier
|
|
36
|
+
*/
|
|
37
|
+
stop(connectId: string): void {
|
|
38
|
+
this.activePolls.delete(connectId);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Stop all active polling sessions.
|
|
43
|
+
*/
|
|
44
|
+
stopAll(): void {
|
|
45
|
+
this.activePolls.clear();
|
|
46
|
+
}
|
|
47
|
+
}
|
package/src/core/RequestQueue.ts
CHANGED
|
@@ -113,13 +113,20 @@ export default class RequestQueue {
|
|
|
113
113
|
|
|
114
114
|
callbackPromise.promise.finally(() => {
|
|
115
115
|
Log.debug(`Callback task completed for connectId: ${connectId}`);
|
|
116
|
-
this.
|
|
116
|
+
// Delete by identity so a newer task that replaced this slot isn't orphaned.
|
|
117
|
+
if (this.pendingCallbackTasks.get(connectId) === callbackPromise) {
|
|
118
|
+
this.pendingCallbackTasks.delete(connectId);
|
|
119
|
+
}
|
|
117
120
|
});
|
|
118
121
|
}
|
|
119
122
|
|
|
120
|
-
public async waitForPendingCallbackTasks(
|
|
123
|
+
public async waitForPendingCallbackTasks(
|
|
124
|
+
connectId: string,
|
|
125
|
+
exceptTask?: Deferred<void>
|
|
126
|
+
): Promise<void> {
|
|
121
127
|
const pendingTask = this.pendingCallbackTasks.get(connectId);
|
|
122
|
-
|
|
128
|
+
// Skip only the caller's own task (self-wait); a different one is still awaited.
|
|
129
|
+
if (pendingTask && pendingTask !== exceptTask) {
|
|
123
130
|
Log.debug(`Waiting for pending callback task to complete for connectId: ${connectId}`);
|
|
124
131
|
await pendingTask.promise;
|
|
125
132
|
}
|