@onekeyfe/hd-core 1.1.27-alpha.4 → 1.1.27-alpha.40
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__/evmSignTransaction.test.ts +1 -1
- package/__tests__/evmSignTypedData.test.ts +1 -1
- package/__tests__/protocol-v2.test.ts +1661 -0
- package/dist/api/BaseMethod.d.ts +1 -7
- package/dist/api/BaseMethod.d.ts.map +1 -1
- package/dist/api/DirList.d.ts +10 -0
- package/dist/api/DirList.d.ts.map +1 -0
- package/dist/api/DirMake.d.ts +9 -0
- package/dist/api/DirMake.d.ts.map +1 -0
- package/dist/api/DirRemove.d.ts +9 -0
- package/dist/api/DirRemove.d.ts.map +1 -0
- package/dist/api/FileDelete.d.ts +9 -0
- package/dist/api/FileDelete.d.ts.map +1 -0
- package/dist/api/FileRead.d.ts +19 -0
- package/dist/api/FileRead.d.ts.map +1 -0
- package/dist/api/FileWrite.d.ts +23 -0
- package/dist/api/FileWrite.d.ts.map +1 -0
- package/dist/api/FirmwareUpdateV3.d.ts +1 -0
- package/dist/api/FirmwareUpdateV3.d.ts.map +1 -1
- package/dist/api/FirmwareUpdateV4.d.ts +32 -0
- package/dist/api/FirmwareUpdateV4.d.ts.map +1 -0
- package/dist/api/GetDeviceInfo.d.ts +9 -0
- package/dist/api/GetDeviceInfo.d.ts.map +1 -0
- package/dist/api/GetFeatures.d.ts +1 -1
- package/dist/api/GetOnekeyFeatures.d.ts.map +1 -1
- package/dist/api/GetPassphraseState.d.ts +6 -1
- package/dist/api/GetPassphraseState.d.ts.map +1 -1
- package/dist/api/PathInfo.d.ts +9 -0
- package/dist/api/PathInfo.d.ts.map +1 -0
- package/dist/api/SearchDevices.d.ts +2 -1
- package/dist/api/SearchDevices.d.ts.map +1 -1
- package/dist/api/alephium/AlephiumGetAddress.d.ts +2 -6
- package/dist/api/alephium/AlephiumGetAddress.d.ts.map +1 -1
- package/dist/api/alephium/AlephiumSignMessage.d.ts +2 -5
- package/dist/api/alephium/AlephiumSignMessage.d.ts.map +1 -1
- package/dist/api/alephium/AlephiumSignTransaction.d.ts +2 -5
- 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 +2 -9
- package/dist/api/benfen/BenfenGetAddress.d.ts.map +1 -1
- package/dist/api/benfen/BenfenGetPublicKey.d.ts +2 -9
- package/dist/api/benfen/BenfenGetPublicKey.d.ts.map +1 -1
- package/dist/api/benfen/BenfenSignMessage.d.ts +2 -8
- package/dist/api/benfen/BenfenSignMessage.d.ts.map +1 -1
- package/dist/api/benfen/BenfenSignTransaction.d.ts +2 -8
- package/dist/api/benfen/BenfenSignTransaction.d.ts.map +1 -1
- package/dist/api/btc/BTCGetAddress.d.ts +1 -11
- package/dist/api/btc/BTCGetAddress.d.ts.map +1 -1
- package/dist/api/btc/BTCGetPublicKey.d.ts +1 -11
- package/dist/api/btc/BTCGetPublicKey.d.ts.map +1 -1
- package/dist/api/btc/BTCSignMessage.d.ts +1 -15
- 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 +1 -11
- package/dist/api/btc/BTCSignTransaction.d.ts.map +1 -1
- package/dist/api/btc/BTCVerifyMessage.d.ts +1 -11
- package/dist/api/btc/BTCVerifyMessage.d.ts.map +1 -1
- package/dist/api/btc/helpers/versionLimit.d.ts +2 -11
- 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/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 +2 -8
- 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 +10 -2
- package/dist/api/firmware/FirmwareUpdateBaseMethod.d.ts.map +1 -1
- package/dist/api/helpers/deviceInfo.d.ts +15 -0
- package/dist/api/helpers/deviceInfo.d.ts.map +1 -0
- package/dist/api/helpers/filesystemValidation.d.ts +7 -0
- package/dist/api/helpers/filesystemValidation.d.ts.map +1 -0
- package/dist/api/index.d.ts +28 -1
- 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 +2 -8
- package/dist/api/neo/NeoGetAddress.d.ts.map +1 -1
- package/dist/api/neo/NeoSignTransaction.d.ts +2 -8
- package/dist/api/neo/NeoSignTransaction.d.ts.map +1 -1
- package/dist/api/nervos/NervosGetAddress.d.ts +2 -9
- package/dist/api/nervos/NervosGetAddress.d.ts.map +1 -1
- package/dist/api/nervos/NervosSignTransaction.d.ts +2 -9
- package/dist/api/nervos/NervosSignTransaction.d.ts.map +1 -1
- package/dist/api/nexa/NexaGetAddress.d.ts +2 -8
- package/dist/api/nexa/NexaGetAddress.d.ts.map +1 -1
- package/dist/api/nexa/NexaSignTransaction.d.ts +2 -9
- 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/protocol-v2/DeviceFirmwareUpdate.d.ts +7 -0
- package/dist/api/protocol-v2/DeviceFirmwareUpdate.d.ts.map +1 -0
- package/dist/api/protocol-v2/DeviceGetDeviceInfo.d.ts +7 -0
- package/dist/api/protocol-v2/DeviceGetDeviceInfo.d.ts.map +1 -0
- package/dist/api/protocol-v2/DeviceGetFirmwareUpdateStatus.d.ts +6 -0
- package/dist/api/protocol-v2/DeviceGetFirmwareUpdateStatus.d.ts.map +1 -0
- package/dist/api/protocol-v2/DeviceGetOnboardingStatus.d.ts +6 -0
- package/dist/api/protocol-v2/DeviceGetOnboardingStatus.d.ts.map +1 -0
- package/dist/api/protocol-v2/DeviceReboot.d.ts +7 -0
- package/dist/api/protocol-v2/DeviceReboot.d.ts.map +1 -0
- package/dist/api/protocol-v2/FactoryDeviceInfoSettings.d.ts +7 -0
- package/dist/api/protocol-v2/FactoryDeviceInfoSettings.d.ts.map +1 -0
- package/dist/api/protocol-v2/FactoryGetDeviceInfo.d.ts +6 -0
- package/dist/api/protocol-v2/FactoryGetDeviceInfo.d.ts.map +1 -0
- package/dist/api/protocol-v2/FilesystemDiskControl.d.ts +10 -0
- package/dist/api/protocol-v2/FilesystemDiskControl.d.ts.map +1 -0
- package/dist/api/protocol-v2/FilesystemFixPermission.d.ts +6 -0
- package/dist/api/protocol-v2/FilesystemFixPermission.d.ts.map +1 -0
- package/dist/api/protocol-v2/FilesystemFormat.d.ts +6 -0
- package/dist/api/protocol-v2/FilesystemFormat.d.ts.map +1 -0
- package/dist/api/protocol-v2/GetProtoVersion.d.ts +6 -0
- package/dist/api/protocol-v2/GetProtoVersion.d.ts.map +1 -0
- package/dist/api/protocol-v2/Ping.d.ts +8 -0
- package/dist/api/protocol-v2/Ping.d.ts.map +1 -0
- package/dist/api/protocol-v2/helpers.d.ts +49 -0
- package/dist/api/protocol-v2/helpers.d.ts.map +1 -0
- package/dist/api/scdo/ScdoGetAddress.d.ts +2 -6
- package/dist/api/scdo/ScdoGetAddress.d.ts.map +1 -1
- package/dist/api/scdo/ScdoSignMessage.d.ts +2 -5
- package/dist/api/scdo/ScdoSignMessage.d.ts.map +1 -1
- package/dist/api/scdo/ScdoSignTransaction.d.ts +2 -5
- package/dist/api/scdo/ScdoSignTransaction.d.ts.map +1 -1
- package/dist/api/solana/SolGetAddress.d.ts +6 -0
- package/dist/api/solana/SolGetAddress.d.ts.map +1 -1
- package/dist/api/solana/SolSignMessage.d.ts +4 -0
- package/dist/api/solana/SolSignMessage.d.ts.map +1 -1
- package/dist/api/solana/SolSignOffchainMessage.d.ts +4 -0
- package/dist/api/solana/SolSignOffchainMessage.d.ts.map +1 -1
- package/dist/api/solana/SolSignTransaction.d.ts +8 -0
- 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 +2 -1
- package/dist/api/stellar/StellarGetAddress.d.ts.map +1 -1
- package/dist/api/stellar/StellarSignTransaction.d.ts +2 -1
- 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/TronGetAddress.d.ts +4 -0
- package/dist/api/tron/TronGetAddress.d.ts.map +1 -1
- package/dist/api/tron/TronSignMessage.d.ts +4 -0
- package/dist/api/tron/TronSignMessage.d.ts.map +1 -1
- package/dist/api/tron/TronSignTransaction.d.ts +4 -0
- package/dist/api/tron/TronSignTransaction.d.ts.map +1 -1
- package/dist/api/xrp/XrpSignTransaction.d.ts.map +1 -1
- 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 +7 -4
- 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 +5 -4
- package/dist/data-manager/TransportManager.d.ts.map +1 -1
- package/dist/device/Device.d.ts +5 -18
- 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 +2 -1
- package/dist/device/DeviceConnector.d.ts.map +1 -1
- package/dist/events/ui-request.d.ts +8 -0
- package/dist/events/ui-request.d.ts.map +1 -1
- package/dist/index.d.ts +292 -43
- package/dist/index.js +16693 -1497
- package/dist/inject.d.ts.map +1 -1
- package/dist/protocols/protocol-v2/features.d.ts +104 -0
- package/dist/protocols/protocol-v2/features.d.ts.map +1 -0
- package/dist/protocols/protocol-v2/firmware.d.ts +12 -0
- package/dist/protocols/protocol-v2/firmware.d.ts.map +1 -0
- package/dist/protocols/protocol-v2/index.d.ts +3 -0
- package/dist/protocols/protocol-v2/index.d.ts.map +1 -0
- 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 +7 -0
- package/dist/types/api/firmwareUpdate.d.ts.map +1 -1
- package/dist/types/api/getDeviceInfo.d.ts +84 -0
- package/dist/types/api/getDeviceInfo.d.ts.map +1 -0
- package/dist/types/api/getPassphraseState.d.ts +10 -1
- package/dist/types/api/getPassphraseState.d.ts.map +1 -1
- package/dist/types/api/index.d.ts +33 -3
- package/dist/types/api/index.d.ts.map +1 -1
- package/dist/types/api/protocolV2.d.ts +127 -0
- package/dist/types/api/protocolV2.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 +6 -2
- package/dist/types/device.d.ts.map +1 -1
- package/dist/types/params.d.ts +2 -1
- 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 +5 -3
- package/dist/utils/deviceFeaturesUtils.d.ts.map +1 -1
- package/dist/utils/deviceInfoUtils.d.ts +1 -0
- 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 +7 -82
- package/src/api/DirList.ts +29 -0
- package/src/api/DirMake.ts +21 -0
- package/src/api/DirRemove.ts +21 -0
- package/src/api/FileDelete.ts +21 -0
- package/src/api/FileRead.ts +165 -0
- package/src/api/FileWrite.ts +203 -0
- package/src/api/FirmwareUpdateV3.ts +21 -4
- package/src/api/FirmwareUpdateV4.ts +810 -0
- package/src/api/GetDeviceInfo.ts +161 -0
- package/src/api/GetOnekeyFeatures.ts +75 -3
- package/src/api/GetPassphraseState.ts +16 -7
- package/src/api/PathInfo.ts +25 -0
- package/src/api/SearchDevices.ts +7 -2
- package/src/api/alephium/AlephiumGetAddress.ts +6 -2
- package/src/api/alephium/AlephiumSignMessage.ts +6 -2
- package/src/api/alephium/AlephiumSignTransaction.ts +6 -3
- package/src/api/algo/AlgoSignTransaction.ts +0 -1
- package/src/api/allnetwork/AllNetworkGetAddressBase.ts +18 -9
- package/src/api/aptos/AptosSignInMessage.ts +0 -1
- package/src/api/aptos/AptosSignMessage.ts +0 -1
- package/src/api/aptos/AptosSignTransaction.ts +0 -1
- package/src/api/benfen/BenfenGetAddress.ts +6 -2
- package/src/api/benfen/BenfenGetPublicKey.ts +6 -2
- package/src/api/benfen/BenfenSignMessage.ts +6 -2
- package/src/api/benfen/BenfenSignTransaction.ts +6 -2
- package/src/api/btc/BTCSignMessage.ts +0 -1
- package/src/api/btc/BTCSignPsbt.ts +0 -1
- package/src/api/btc/BTCSignTransaction.ts +0 -1
- package/src/api/btc/helpers/versionLimit.ts +7 -1
- package/src/api/cardano/CardanoSignMessage.ts +0 -1
- package/src/api/cardano/CardanoSignTransaction.ts +0 -1
- package/src/api/conflux/ConfluxSignMessage.ts +0 -1
- package/src/api/conflux/ConfluxSignMessageCIP23.ts +0 -1
- package/src/api/conflux/ConfluxSignTransaction.ts +5 -3
- package/src/api/cosmos/CosmosSignTransaction.ts +0 -1
- package/src/api/device/DeviceRebootToBoardloader.ts +10 -1
- package/src/api/device/DeviceRebootToBootloader.ts +10 -1
- package/src/api/dynex/DnxGetAddress.ts +7 -0
- package/src/api/dynex/DnxSignTransaction.ts +7 -1
- package/src/api/evm/EVMGetAddress.ts +1 -1
- package/src/api/evm/EVMGetPublicKey.ts +1 -1
- package/src/api/evm/EVMSignMessage.ts +1 -3
- package/src/api/evm/EVMSignMessageEIP712.ts +14 -2
- package/src/api/evm/EVMSignTransaction.ts +1 -3
- package/src/api/evm/EVMSignTypedData.ts +6 -8
- package/src/api/evm/EVMVerifyMessage.ts +1 -1
- package/src/api/filecoin/FilecoinSignTransaction.ts +0 -1
- package/src/api/firmware/FirmwareUpdateBaseMethod.ts +27 -4
- package/src/api/helpers/deviceInfo.ts +205 -0
- package/src/api/helpers/filesystemValidation.ts +51 -0
- package/src/api/index.ts +30 -1
- package/src/api/kaspa/KaspaSignTransaction.ts +0 -1
- package/src/api/near/NearSignTransaction.ts +0 -1
- package/src/api/nem/NEMSignTransaction.ts +0 -1
- package/src/api/neo/NeoGetAddress.ts +6 -1
- package/src/api/neo/NeoSignTransaction.ts +6 -2
- package/src/api/nervos/NervosGetAddress.ts +6 -2
- package/src/api/nervos/NervosSignTransaction.ts +6 -3
- package/src/api/nexa/NexaGetAddress.ts +6 -2
- package/src/api/nexa/NexaSignTransaction.ts +6 -4
- package/src/api/nostr/NostrSignEvent.ts +0 -1
- package/src/api/nostr/NostrSignSchnorr.ts +0 -1
- package/src/api/polkadot/PolkadotSignTransaction.ts +0 -1
- package/src/api/protocol-v2/DeviceFirmwareUpdate.ts +50 -0
- package/src/api/protocol-v2/DeviceGetDeviceInfo.ts +35 -0
- package/src/api/protocol-v2/DeviceGetFirmwareUpdateStatus.ts +18 -0
- package/src/api/protocol-v2/DeviceGetOnboardingStatus.ts +18 -0
- package/src/api/protocol-v2/DeviceReboot.ts +22 -0
- package/src/api/protocol-v2/FactoryDeviceInfoSettings.ts +27 -0
- package/src/api/protocol-v2/FactoryGetDeviceInfo.ts +18 -0
- package/src/api/protocol-v2/FilesystemDiskControl.ts +34 -0
- package/src/api/protocol-v2/FilesystemFixPermission.ts +14 -0
- package/src/api/protocol-v2/FilesystemFormat.ts +14 -0
- package/src/api/protocol-v2/GetProtoVersion.ts +14 -0
- package/src/api/protocol-v2/Ping.ts +16 -0
- package/src/api/protocol-v2/helpers.ts +161 -0
- package/src/api/scdo/ScdoGetAddress.ts +6 -2
- package/src/api/scdo/ScdoSignMessage.ts +6 -2
- package/src/api/scdo/ScdoSignTransaction.ts +6 -3
- package/src/api/solana/SolGetAddress.ts +9 -0
- package/src/api/solana/SolSignMessage.ts +4 -1
- package/src/api/solana/SolSignOffchainMessage.ts +4 -1
- package/src/api/solana/SolSignTransaction.ts +8 -1
- package/src/api/starcoin/StarcoinSignMessage.ts +0 -1
- package/src/api/starcoin/StarcoinSignTransaction.ts +0 -1
- package/src/api/stellar/StellarGetAddress.ts +10 -1
- package/src/api/stellar/StellarSignTransaction.ts +14 -2
- package/src/api/sui/SuiSignMessage.ts +0 -1
- package/src/api/sui/SuiSignTransaction.ts +12 -10
- package/src/api/ton/TonSignData.ts +0 -1
- package/src/api/ton/TonSignMessage.ts +0 -1
- package/src/api/ton/TonSignProof.ts +0 -1
- package/src/api/tron/TronGetAddress.ts +4 -0
- package/src/api/tron/TronSignMessage.ts +5 -2
- package/src/api/tron/TronSignTransaction.ts +4 -1
- package/src/api/xrp/XrpSignTransaction.ts +1 -2
- package/src/core/RequestQueue.ts +3 -10
- package/src/core/index.ts +62 -153
- package/src/data/messages/messages-protocol-v2.json +13128 -0
- package/src/data-manager/DataManager.ts +12 -7
- package/src/data-manager/MessagesConfig.ts +14 -14
- package/src/data-manager/TransportManager.ts +38 -12
- package/src/device/Device.ts +88 -77
- package/src/device/DeviceCommands.ts +166 -26
- package/src/device/DeviceConnector.ts +29 -4
- package/src/device/DevicePool.ts +1 -1
- package/src/events/ui-request.ts +8 -0
- package/src/inject.ts +46 -2
- package/src/protocols/protocol-v2/features.ts +287 -0
- package/src/protocols/protocol-v2/firmware.ts +26 -0
- package/src/protocols/protocol-v2/index.ts +2 -0
- package/src/types/api/export.ts +1 -0
- package/src/types/api/firmwareUpdate.ts +12 -0
- package/src/types/api/getDeviceInfo.ts +97 -0
- package/src/types/api/getPassphraseState.ts +13 -2
- package/src/types/api/index.ts +80 -3
- package/src/types/api/protocolV2.ts +226 -0
- package/src/types/api/searchDevices.ts +2 -2
- package/src/types/device.ts +33 -2
- package/src/types/params.ts +4 -2
- package/src/types/settings.ts +1 -1
- package/src/utils/deviceFeaturesUtils.ts +62 -21
- package/src/utils/deviceInfoUtils.ts +15 -8
- package/src/utils/index.ts +1 -0
- package/__tests__/DeviceCommands.test.ts +0 -99
- package/__tests__/evmLedgerLegacySafety.test.ts +0 -261
- package/__tests__/preInitialize.test.ts +0 -22
- package/dist/api/device/PreInitialize.d.ts +0 -6
- package/dist/api/device/PreInitialize.d.ts.map +0 -1
- package/dist/core/PollingStateManager.d.ts +0 -8
- package/dist/core/PollingStateManager.d.ts.map +0 -1
- package/dist/types/api/preInitialize.d.ts +0 -3
- package/dist/types/api/preInitialize.d.ts.map +0 -1
- package/src/api/device/PreInitialize.ts +0 -41
- package/src/core/PollingStateManager.ts +0 -47
- package/src/types/api/preInitialize.ts +0 -3
|
@@ -12,7 +12,12 @@ import {
|
|
|
12
12
|
} from '../utils/tracing';
|
|
13
13
|
|
|
14
14
|
import type { Device } from './Device';
|
|
15
|
-
import type {
|
|
15
|
+
import type {
|
|
16
|
+
FailureType,
|
|
17
|
+
Messages,
|
|
18
|
+
Transport,
|
|
19
|
+
TransportCallOptions,
|
|
20
|
+
} from '@onekeyfe/hd-transport';
|
|
16
21
|
|
|
17
22
|
export type PassphrasePromptResponse = {
|
|
18
23
|
passphrase?: string;
|
|
@@ -22,16 +27,119 @@ export type PassphrasePromptResponse = {
|
|
|
22
27
|
};
|
|
23
28
|
|
|
24
29
|
type MessageType = Messages.MessageType;
|
|
25
|
-
type MessageKey = keyof MessageType
|
|
30
|
+
type MessageKey = Extract<keyof MessageType, string>;
|
|
26
31
|
export type TypedResponseMessage<T extends MessageKey> = {
|
|
27
32
|
type: T;
|
|
28
33
|
message: MessageType[T];
|
|
29
34
|
};
|
|
30
35
|
type TypedCallResponseMap = {
|
|
31
|
-
[K in
|
|
36
|
+
[K in MessageKey]: TypedResponseMessage<K>;
|
|
32
37
|
};
|
|
33
38
|
export type DefaultMessageResponse = TypedCallResponseMap[keyof MessageType];
|
|
34
39
|
|
|
40
|
+
const MAX_DEBUG_ARRAY_ITEMS = 20;
|
|
41
|
+
const MAX_DEBUG_OBJECT_KEYS = 40;
|
|
42
|
+
const MAX_DEBUG_STRING_LENGTH = 512;
|
|
43
|
+
const MAX_DEBUG_DEPTH = 4;
|
|
44
|
+
const HIGH_VOLUME_DEBUG_CALLS = new Set([
|
|
45
|
+
'FilesystemFileRead',
|
|
46
|
+
'FilesystemFileWrite',
|
|
47
|
+
'FileRead',
|
|
48
|
+
'FileWrite',
|
|
49
|
+
'EmmcFileRead',
|
|
50
|
+
'EmmcFileWrite',
|
|
51
|
+
'FirmwareUpload',
|
|
52
|
+
'ResourceAck',
|
|
53
|
+
]);
|
|
54
|
+
|
|
55
|
+
function shouldReduceDebugForCall(type: string) {
|
|
56
|
+
return HIGH_VOLUME_DEBUG_CALLS.has(type);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function getBinaryByteLength(value: unknown): number | undefined {
|
|
60
|
+
if (value instanceof ArrayBuffer) {
|
|
61
|
+
return value.byteLength;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
if (ArrayBuffer.isView(value)) {
|
|
65
|
+
return value.byteLength;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
if (typeof Blob !== 'undefined' && value instanceof Blob) {
|
|
69
|
+
return value.size;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
return undefined;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
function summarizeRedactedData(value: unknown): string {
|
|
76
|
+
const byteLength = getBinaryByteLength(value);
|
|
77
|
+
if (byteLength !== undefined) {
|
|
78
|
+
return `[redacted data: ${byteLength} bytes]`;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
if (typeof value === 'string') {
|
|
82
|
+
return `[redacted data: string length=${value.length}]`;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
if (Array.isArray(value)) {
|
|
86
|
+
return `[redacted data: array length=${value.length}]`;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
if (value && typeof value === 'object') {
|
|
90
|
+
return `[redacted data: object keys=${Object.keys(value).length}]`;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
return `[redacted data: ${typeof value}]`;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
function sanitizeDebugPayload(value: unknown, key = '', depth = 0): unknown {
|
|
97
|
+
if (key === 'data' && value !== null && value !== undefined) {
|
|
98
|
+
return summarizeRedactedData(value);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
const byteLength = getBinaryByteLength(value);
|
|
102
|
+
if (byteLength !== undefined) {
|
|
103
|
+
return `[binary: ${byteLength} bytes]`;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
if (typeof value === 'string') {
|
|
107
|
+
return value.length > MAX_DEBUG_STRING_LENGTH
|
|
108
|
+
? `${value.slice(0, MAX_DEBUG_STRING_LENGTH)}... (len=${value.length})`
|
|
109
|
+
: value;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
if (!value || typeof value !== 'object') {
|
|
113
|
+
return value;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
if (depth >= MAX_DEBUG_DEPTH) {
|
|
117
|
+
return Array.isArray(value)
|
|
118
|
+
? `[array length=${value.length}]`
|
|
119
|
+
: `[object keys=${Object.keys(value).length}]`;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
if (Array.isArray(value)) {
|
|
123
|
+
const items = value
|
|
124
|
+
.slice(0, MAX_DEBUG_ARRAY_ITEMS)
|
|
125
|
+
.map(item => sanitizeDebugPayload(item, key, depth + 1));
|
|
126
|
+
if (value.length > MAX_DEBUG_ARRAY_ITEMS) {
|
|
127
|
+
items.push(`... (${value.length - MAX_DEBUG_ARRAY_ITEMS} more)`);
|
|
128
|
+
}
|
|
129
|
+
return items;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
const entries = Object.entries(value).slice(0, MAX_DEBUG_OBJECT_KEYS);
|
|
133
|
+
const sanitized: Record<string, unknown> = {};
|
|
134
|
+
entries.forEach(([entryKey, entryValue]) => {
|
|
135
|
+
sanitized[entryKey] = sanitizeDebugPayload(entryValue, entryKey, depth + 1);
|
|
136
|
+
});
|
|
137
|
+
if (Object.keys(value).length > MAX_DEBUG_OBJECT_KEYS) {
|
|
138
|
+
sanitized.__truncated__ = `${Object.keys(value).length - MAX_DEBUG_OBJECT_KEYS} more keys`;
|
|
139
|
+
}
|
|
140
|
+
return sanitized;
|
|
141
|
+
}
|
|
142
|
+
|
|
35
143
|
const assertType = (res: DefaultMessageResponse, resType: string | string[]) => {
|
|
36
144
|
const splitResTypes = Array.isArray(resType) ? resType : resType.split('|');
|
|
37
145
|
if (!splitResTypes.includes(res.type)) {
|
|
@@ -224,17 +332,21 @@ export class DeviceCommands {
|
|
|
224
332
|
// Sends an async message to the opened device.
|
|
225
333
|
async call(
|
|
226
334
|
type: MessageKey,
|
|
227
|
-
msg
|
|
335
|
+
msg?: DefaultMessageResponse['message'],
|
|
336
|
+
options?: TransportCallOptions
|
|
228
337
|
): Promise<DefaultMessageResponse> {
|
|
229
|
-
|
|
338
|
+
const shouldReduceDebug = shouldReduceDebugForCall(type);
|
|
339
|
+
if (!shouldReduceDebug) {
|
|
340
|
+
Log.debug('[DeviceCommands] [call] Sending', type);
|
|
341
|
+
}
|
|
230
342
|
|
|
231
343
|
try {
|
|
232
|
-
const promise = this.transport.call(this.mainId, type, msg) as any;
|
|
344
|
+
const promise = this.transport.call(this.mainId, type, msg ?? {}, options) as any;
|
|
233
345
|
this.callPromise = promise;
|
|
234
346
|
const res = await promise;
|
|
235
347
|
if (res.type === 'Failure') {
|
|
236
348
|
LogCore.debug('[DeviceCommands] [call] Received', res.type, res.message);
|
|
237
|
-
} else {
|
|
349
|
+
} else if (!shouldReduceDebug) {
|
|
238
350
|
LogCore.debug('[DeviceCommands] [call] Received', res.type);
|
|
239
351
|
}
|
|
240
352
|
return res;
|
|
@@ -283,19 +395,22 @@ export class DeviceCommands {
|
|
|
283
395
|
typedCall<T extends MessageKey, R extends MessageKey[]>(
|
|
284
396
|
type: T,
|
|
285
397
|
resType: R,
|
|
286
|
-
msg?: MessageType[T]
|
|
398
|
+
msg?: MessageType[T],
|
|
399
|
+
options?: TransportCallOptions
|
|
287
400
|
): Promise<TypedCallResponseMap[R[number]]>;
|
|
288
401
|
|
|
289
402
|
typedCall<T extends MessageKey, R extends MessageKey>(
|
|
290
403
|
type: T,
|
|
291
404
|
resType: R,
|
|
292
|
-
msg?: MessageType[T]
|
|
405
|
+
msg?: MessageType[T],
|
|
406
|
+
options?: TransportCallOptions
|
|
293
407
|
): Promise<TypedResponseMessage<R>>;
|
|
294
408
|
|
|
295
409
|
async typedCall(
|
|
296
410
|
type: MessageKey,
|
|
297
411
|
resType: MessageKey | MessageKey[],
|
|
298
|
-
msg?: DefaultMessageResponse['message']
|
|
412
|
+
msg?: DefaultMessageResponse['message'],
|
|
413
|
+
options?: TransportCallOptions
|
|
299
414
|
) {
|
|
300
415
|
if (this.disposed) {
|
|
301
416
|
throw ERRORS.TypedError(
|
|
@@ -312,16 +427,28 @@ export class DeviceCommands {
|
|
|
312
427
|
'PassphraseAck',
|
|
313
428
|
'Cancel',
|
|
314
429
|
'BixinPinInputOnDevice',
|
|
430
|
+
'FilesystemFileRead',
|
|
431
|
+
'FilesystemFileWrite',
|
|
432
|
+
'FileRead',
|
|
433
|
+
'FileWrite',
|
|
434
|
+
'EmmcFileRead',
|
|
435
|
+
'EmmcFileWrite',
|
|
436
|
+
'FirmwareUpload',
|
|
437
|
+
'ResourceAck',
|
|
315
438
|
] as any;
|
|
316
439
|
if (!skipTypes.includes(type) && msg) {
|
|
317
440
|
// Use debug channel to avoid noise escalation
|
|
318
|
-
Log.debug('[DeviceCommands] [typedCall] Sending payload', type, msg);
|
|
441
|
+
Log.debug('[DeviceCommands] [typedCall] Sending payload', type, sanitizeDebugPayload(msg));
|
|
319
442
|
}
|
|
320
443
|
} catch (e) {
|
|
321
444
|
// ignore logging errors
|
|
322
445
|
}
|
|
323
446
|
|
|
324
|
-
const
|
|
447
|
+
const expectedTypes = Array.isArray(resType) ? resType : resType.split('|');
|
|
448
|
+
const response = await this._commonCall(type, msg, {
|
|
449
|
+
...options,
|
|
450
|
+
expectedTypes: options?.expectedTypes ?? expectedTypes,
|
|
451
|
+
});
|
|
325
452
|
try {
|
|
326
453
|
assertType(response, resType);
|
|
327
454
|
} catch (error) {
|
|
@@ -334,6 +461,12 @@ export class DeviceCommands {
|
|
|
334
461
|
// throw bridge network error
|
|
335
462
|
if (error instanceof HardwareError) {
|
|
336
463
|
if (error.errorCode === HardwareErrorCode.ResponseUnexpectTypeError) {
|
|
464
|
+
Log.debug('[DeviceCommands] [typedCall] Unexpected response type', {
|
|
465
|
+
request: type,
|
|
466
|
+
expected: resType,
|
|
467
|
+
received: response.type,
|
|
468
|
+
response: sanitizeDebugPayload(response.message),
|
|
469
|
+
});
|
|
337
470
|
// Do not intercept CallMethodError
|
|
338
471
|
// Do not intercept “assertType: Response of unexpected type” error
|
|
339
472
|
// Blocking the above two messages will not know what the specific error message is, and the specific error should be handled by the subsequent business logic.
|
|
@@ -347,7 +480,7 @@ export class DeviceCommands {
|
|
|
347
480
|
if (error.message.indexOf('BridgeDeviceDisconnected') > -1) {
|
|
348
481
|
throw ERRORS.TypedError(HardwareErrorCode.BridgeDeviceDisconnected);
|
|
349
482
|
}
|
|
350
|
-
throw
|
|
483
|
+
throw error;
|
|
351
484
|
}
|
|
352
485
|
} else {
|
|
353
486
|
// throw error anyway, next call should be resolved properly// throw error anyway, next call should be resolved properly
|
|
@@ -357,20 +490,27 @@ export class DeviceCommands {
|
|
|
357
490
|
return response;
|
|
358
491
|
}
|
|
359
492
|
|
|
360
|
-
async _commonCall(
|
|
361
|
-
|
|
362
|
-
|
|
493
|
+
async _commonCall(
|
|
494
|
+
type: MessageKey,
|
|
495
|
+
msg?: DefaultMessageResponse['message'],
|
|
496
|
+
options?: TransportCallOptions
|
|
497
|
+
) {
|
|
498
|
+
const resp = await this.call(type, msg, options);
|
|
499
|
+
return this._filterCommonTypes(resp, type, options);
|
|
363
500
|
}
|
|
364
501
|
|
|
365
502
|
_filterCommonTypes(
|
|
366
503
|
res: DefaultMessageResponse,
|
|
367
|
-
callType: MessageKey
|
|
504
|
+
callType: MessageKey,
|
|
505
|
+
options?: TransportCallOptions
|
|
368
506
|
): Promise<DefaultMessageResponse> {
|
|
369
507
|
try {
|
|
370
|
-
if (
|
|
371
|
-
|
|
508
|
+
if (shouldReduceDebugForCall(callType)) {
|
|
509
|
+
// 高频文件写入每个 chunk 都会经过这里,避免 debug log 反向拖慢传输。
|
|
510
|
+
} else if (DataManager.getSettings('env') === 'react-native') {
|
|
511
|
+
Log.debug('_filterCommonTypes: ', JSON.stringify(sanitizeDebugPayload(res)));
|
|
372
512
|
} else {
|
|
373
|
-
Log.debug('_filterCommonTypes: ', res);
|
|
513
|
+
Log.debug('_filterCommonTypes: ', sanitizeDebugPayload(res));
|
|
374
514
|
}
|
|
375
515
|
} catch (error) {
|
|
376
516
|
// ignore
|
|
@@ -472,7 +612,7 @@ export class DeviceCommands {
|
|
|
472
612
|
} else {
|
|
473
613
|
this.device.emit(DEVICE.BUTTON, this.device, res.message);
|
|
474
614
|
}
|
|
475
|
-
return this._commonCall('ButtonAck', {});
|
|
615
|
+
return this._commonCall('ButtonAck', {}, options);
|
|
476
616
|
}
|
|
477
617
|
|
|
478
618
|
if (res.type === 'EntropyRequest') {
|
|
@@ -485,11 +625,11 @@ export class DeviceCommands {
|
|
|
485
625
|
if (pin === '@@ONEKEY_INPUT_PIN_IN_DEVICE') {
|
|
486
626
|
// only classic\1s\mini\pure
|
|
487
627
|
this.device.setCancelableAction(() => this.cancelDeviceOnOneKeyDevice());
|
|
488
|
-
return this._commonCall('BixinPinInputOnDevice').finally(() => {
|
|
628
|
+
return this._commonCall('BixinPinInputOnDevice', {}, options).finally(() => {
|
|
489
629
|
this.device.clearCancelableAction();
|
|
490
630
|
});
|
|
491
631
|
}
|
|
492
|
-
return this._commonCall('PinMatrixAck', { pin });
|
|
632
|
+
return this._commonCall('PinMatrixAck', { pin }, options);
|
|
493
633
|
},
|
|
494
634
|
error => Promise.reject(error)
|
|
495
635
|
);
|
|
@@ -504,12 +644,12 @@ export class DeviceCommands {
|
|
|
504
644
|
|
|
505
645
|
// Attach PIN on device
|
|
506
646
|
if (attachPinOnDevice && existsAttachPinUser) {
|
|
507
|
-
return this._commonCall('PassphraseAck', { on_device_attach_pin: true });
|
|
647
|
+
return this._commonCall('PassphraseAck', { on_device_attach_pin: true }, options);
|
|
508
648
|
}
|
|
509
649
|
|
|
510
650
|
return !passphraseOnDevice
|
|
511
|
-
? this._commonCall('PassphraseAck', { passphrase })
|
|
512
|
-
: this._commonCall('PassphraseAck', { on_device: true });
|
|
651
|
+
? this._commonCall('PassphraseAck', { passphrase }, options)
|
|
652
|
+
: this._commonCall('PassphraseAck', { on_device: true }, options);
|
|
513
653
|
});
|
|
514
654
|
}
|
|
515
655
|
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { ERRORS, HardwareErrorCode } from '@onekeyfe/hd-shared';
|
|
2
|
+
|
|
1
3
|
import { safeThrowError } from '../constants';
|
|
2
4
|
import { DataManager } from '../data-manager';
|
|
3
5
|
import TransportManager from '../data-manager/TransportManager';
|
|
@@ -6,6 +8,7 @@ import { resolveAfter } from '../utils/promiseUtils';
|
|
|
6
8
|
import { LoggerNames, getLogger } from '../utils';
|
|
7
9
|
|
|
8
10
|
import type { DeviceDescriptorDiff } from './DevicePool';
|
|
11
|
+
import type { HardwareConnectProtocol } from '@onekeyfe/hd-shared';
|
|
9
12
|
import type { OneKeyDeviceInfo as DeviceDescriptor, Transport } from '@onekeyfe/hd-transport';
|
|
10
13
|
|
|
11
14
|
const Log = getLogger(LoggerNames.DeviceConnector);
|
|
@@ -75,15 +78,37 @@ export default class DeviceConnector {
|
|
|
75
78
|
this.listening = false;
|
|
76
79
|
}
|
|
77
80
|
|
|
78
|
-
async acquire(
|
|
79
|
-
|
|
81
|
+
async acquire(
|
|
82
|
+
path: string,
|
|
83
|
+
session?: string | null,
|
|
84
|
+
forceCleanRunPromise?: boolean,
|
|
85
|
+
connectProtocol?: HardwareConnectProtocol
|
|
86
|
+
) {
|
|
87
|
+
Log.debug('acquire', path, session, connectProtocol);
|
|
80
88
|
const env = DataManager.getSettings('env');
|
|
81
89
|
try {
|
|
82
90
|
let res;
|
|
83
91
|
if (DataManager.isBleConnect(env)) {
|
|
84
|
-
res = await this.transport.acquire({
|
|
92
|
+
res = await this.transport.acquire({
|
|
93
|
+
uuid: path,
|
|
94
|
+
forceCleanRunPromise,
|
|
95
|
+
expectedProtocol: connectProtocol,
|
|
96
|
+
});
|
|
85
97
|
} else {
|
|
86
|
-
res = await this.transport.acquire({
|
|
98
|
+
res = await this.transport.acquire({
|
|
99
|
+
path,
|
|
100
|
+
previous: session ?? null,
|
|
101
|
+
expectedProtocol: connectProtocol,
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
if (connectProtocol) {
|
|
105
|
+
const detectedProtocol = this.transport.getProtocolType(path);
|
|
106
|
+
if (detectedProtocol !== connectProtocol) {
|
|
107
|
+
throw ERRORS.TypedError(
|
|
108
|
+
HardwareErrorCode.RuntimeError,
|
|
109
|
+
`Device protocol mismatch: expected ${connectProtocol}, detected ${detectedProtocol}`
|
|
110
|
+
);
|
|
111
|
+
}
|
|
87
112
|
}
|
|
88
113
|
return res;
|
|
89
114
|
} catch (error) {
|
package/src/device/DevicePool.ts
CHANGED
|
@@ -150,7 +150,7 @@ export class DevicePool extends EventEmitter {
|
|
|
150
150
|
if (!device) {
|
|
151
151
|
device = Device.fromDescriptor(descriptor);
|
|
152
152
|
device.deviceConnector = this.connector;
|
|
153
|
-
await device.connect();
|
|
153
|
+
await device.connect(initOptions?.connectProtocol);
|
|
154
154
|
await device.initialize(initOptions);
|
|
155
155
|
await device.release();
|
|
156
156
|
}
|
package/src/events/ui-request.ts
CHANGED
|
@@ -129,6 +129,10 @@ export interface FirmwareProgress {
|
|
|
129
129
|
device: Device;
|
|
130
130
|
progress: number;
|
|
131
131
|
progressType: IFirmwareUpdateProgressType;
|
|
132
|
+
transferredBytes?: number;
|
|
133
|
+
totalBytes?: number;
|
|
134
|
+
rateBytesPerSecond?: number;
|
|
135
|
+
elapsedMs?: number;
|
|
132
136
|
};
|
|
133
137
|
}
|
|
134
138
|
|
|
@@ -144,6 +148,10 @@ export interface DeviceProgress {
|
|
|
144
148
|
type: typeof UI_REQUEST.DEVICE_PROGRESS;
|
|
145
149
|
payload: {
|
|
146
150
|
progress?: number;
|
|
151
|
+
transferredBytes?: number;
|
|
152
|
+
totalBytes?: number;
|
|
153
|
+
rateBytesPerSecond?: number;
|
|
154
|
+
elapsedMs?: number;
|
|
147
155
|
};
|
|
148
156
|
}
|
|
149
157
|
|
package/src/inject.ts
CHANGED
|
@@ -103,12 +103,13 @@ export const createCoreApi = (
|
|
|
103
103
|
/**
|
|
104
104
|
* 搜索设备
|
|
105
105
|
*/
|
|
106
|
-
searchDevices:
|
|
106
|
+
searchDevices: params => call({ ...params, method: 'searchDevices' }),
|
|
107
107
|
|
|
108
108
|
/**
|
|
109
109
|
* 获取设备信息
|
|
110
110
|
*/
|
|
111
111
|
getFeatures: (connectId, params) => call({ ...params, connectId, method: 'getFeatures' }),
|
|
112
|
+
getDeviceInfo: (connectId, params) => call({ ...params, connectId, method: 'getDeviceInfo' }),
|
|
112
113
|
getOnekeyFeatures: (connectId, params) =>
|
|
113
114
|
call({ ...params, connectId, method: 'getOnekeyFeatures' }),
|
|
114
115
|
|
|
@@ -142,12 +143,53 @@ export const createCoreApi = (
|
|
|
142
143
|
|
|
143
144
|
testInitializeDeviceDuration: (connectId, params) =>
|
|
144
145
|
call({ ...params, connectId, method: 'testInitializeDeviceDuration' }),
|
|
145
|
-
|
|
146
|
+
|
|
146
147
|
deviceBackup: connectId => call({ connectId, method: 'deviceBackup' }),
|
|
147
148
|
deviceChangePin: (connectId, params) => call({ ...params, connectId, method: 'deviceChangePin' }),
|
|
148
149
|
deviceFlags: (connectId, params) => call({ ...params, connectId, method: 'deviceFlags' }),
|
|
149
150
|
deviceRebootToBoardloader: connectId => call({ connectId, method: 'deviceRebootToBoardloader' }),
|
|
150
151
|
deviceRebootToBootloader: connectId => call({ connectId, method: 'deviceRebootToBootloader' }),
|
|
152
|
+
|
|
153
|
+
// File system & device control API (Protocol V2 only)
|
|
154
|
+
getProtoVersion: (connectId, params) => call({ ...params, connectId, method: 'getProtoVersion' }),
|
|
155
|
+
ping: (connectId, params) => call({ ...params, connectId, method: 'ping' }),
|
|
156
|
+
deviceReboot: (connectId, params) => call({ ...params, connectId, method: 'deviceReboot' }),
|
|
157
|
+
deviceGetDeviceInfo: (connectId, params) =>
|
|
158
|
+
call({ ...params, connectId, method: 'deviceGetDeviceInfo' }),
|
|
159
|
+
deviceGetOnboardingStatus: (connectId, params) =>
|
|
160
|
+
call({ ...params, connectId, method: 'deviceGetOnboardingStatus' }),
|
|
161
|
+
deviceFirmwareUpdate: (connectId, params) =>
|
|
162
|
+
call({ ...params, connectId, method: 'deviceFirmwareUpdate' }),
|
|
163
|
+
deviceGetFirmwareUpdateStatus: (connectId, params) =>
|
|
164
|
+
call({ ...params, connectId, method: 'deviceGetFirmwareUpdateStatus' }),
|
|
165
|
+
factoryDeviceInfoSettings: (connectId, params) =>
|
|
166
|
+
call({ ...params, connectId, method: 'factoryDeviceInfoSettings' }),
|
|
167
|
+
factoryGetDeviceInfo: connectId => call({ connectId, method: 'factoryGetDeviceInfo' }),
|
|
168
|
+
filesystemFixPermission: connectId => call({ connectId, method: 'filesystemFixPermission' }),
|
|
169
|
+
fileRead: (connectId, params) => call({ ...params, connectId, method: 'fileRead' }),
|
|
170
|
+
fileWrite: (connectId, params) => call({ ...params, connectId, method: 'fileWrite' }),
|
|
171
|
+
fileDelete: (connectId, params) => call({ ...params, connectId, method: 'fileDelete' }),
|
|
172
|
+
dirList: (connectId, params) => call({ ...params, connectId, method: 'dirList' }),
|
|
173
|
+
dirMake: (connectId, params) => call({ ...params, connectId, method: 'dirMake' }),
|
|
174
|
+
dirRemove: (connectId, params) => call({ ...params, connectId, method: 'dirRemove' }),
|
|
175
|
+
pathInfo: (connectId, params) => call({ ...params, connectId, method: 'pathInfo' }),
|
|
176
|
+
filesystemFileRead: (connectId, params) =>
|
|
177
|
+
call({ ...params, connectId, method: 'filesystemFileRead' }),
|
|
178
|
+
filesystemFileWrite: (connectId, params) =>
|
|
179
|
+
call({ ...params, connectId, method: 'filesystemFileWrite' }),
|
|
180
|
+
filesystemFileDelete: (connectId, params) =>
|
|
181
|
+
call({ ...params, connectId, method: 'filesystemFileDelete' }),
|
|
182
|
+
filesystemDirList: (connectId, params) =>
|
|
183
|
+
call({ ...params, connectId, method: 'filesystemDirList' }),
|
|
184
|
+
filesystemDirMake: (connectId, params) =>
|
|
185
|
+
call({ ...params, connectId, method: 'filesystemDirMake' }),
|
|
186
|
+
filesystemDirRemove: (connectId, params) =>
|
|
187
|
+
call({ ...params, connectId, method: 'filesystemDirRemove' }),
|
|
188
|
+
filesystemPathInfoQuery: (connectId, params) =>
|
|
189
|
+
call({ ...params, connectId, method: 'filesystemPathInfoQuery' }),
|
|
190
|
+
filesystemFormat: connectId => call({ connectId, method: 'filesystemFormat' }),
|
|
191
|
+
filesystemDiskControl: (connectId, params) =>
|
|
192
|
+
call({ ...params, connectId, method: 'filesystemDiskControl' }),
|
|
151
193
|
deviceRecovery: (connectId, params) => call({ ...params, connectId, method: 'deviceRecovery' }),
|
|
152
194
|
deviceReset: (connectId, params) => call({ ...params, connectId, method: 'deviceReset' }),
|
|
153
195
|
deviceSettings: (connectId, params) => call({ ...params, connectId, method: 'deviceSettings' }),
|
|
@@ -260,6 +302,8 @@ export const createCoreApi = (
|
|
|
260
302
|
call({ ...params, connectId, method: 'firmwareUpdateV2' }),
|
|
261
303
|
firmwareUpdateV3: (connectId, params) =>
|
|
262
304
|
call({ ...params, connectId, method: 'firmwareUpdateV3' }),
|
|
305
|
+
firmwareUpdateV4: (connectId, params) =>
|
|
306
|
+
call({ ...params, connectId, method: 'firmwareUpdateV4' }),
|
|
263
307
|
promptWebDeviceAccess: params => call({ ...params, method: 'promptWebDeviceAccess' }),
|
|
264
308
|
|
|
265
309
|
tronGetAddress: (connectId, deviceId, params) =>
|