@onekeyfe/hd-core 1.1.34-alpha.1 → 1.1.34-alpha.3
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__/AllNetworkGetAddressBase.tracing.test.ts +75 -0
- package/__tests__/DeviceCommands.test.ts +217 -0
- package/__tests__/RequestQueue.test.ts +140 -0
- package/__tests__/UploadPortfolio.test.ts +46 -0
- package/__tests__/connectSettings.test.ts +61 -0
- package/__tests__/device-lifecycle-events.test.ts +117 -0
- package/__tests__/device-pool-state.test.ts +132 -0
- package/__tests__/device-settings.test.ts +286 -0
- package/__tests__/device-state-mapper.test.ts +229 -0
- package/__tests__/device-utils.test.ts +106 -0
- package/__tests__/device-wallet-session-store.test.ts +191 -0
- package/__tests__/evmLedgerLegacySafety.test.ts +15 -4
- package/__tests__/evmSignTransaction.test.ts +1 -1
- package/__tests__/evmSignTypedData.test.ts +1 -1
- package/__tests__/filesystemValidation.test.ts +53 -0
- package/__tests__/firmware-update/firmware-artifact-source.test.ts +119 -0
- package/__tests__/firmware-update/firmware-checkpoint.test.ts +105 -0
- package/__tests__/firmware-update/firmware-host-binding.test.ts +73 -0
- package/__tests__/firmware-update/firmware-update-capabilities.test.ts +17 -0
- package/__tests__/firmware-update/firmware-update-plan.test.ts +358 -0
- package/__tests__/firmware-update/firmware-update-prepared-plan.test.ts +200 -0
- package/__tests__/firmware-update/firmware-update-recovery.test.ts +81 -0
- package/__tests__/firmware-update/firmware-update-v2-download-before-boot.test.ts +48 -31
- package/__tests__/firmware-update/firmware-upload-source.test.ts +70 -0
- package/__tests__/get-device-state.test.ts +403 -0
- package/__tests__/logBlockEvent.test.ts +61 -0
- package/__tests__/logger.test.ts +34 -0
- package/__tests__/open-wallet-session.test.ts +565 -0
- package/__tests__/preInitialize.test.ts +33 -0
- package/__tests__/pro2Wallpaper.test.ts +39 -0
- package/__tests__/protocol-v2-bootloader-mode.test.ts +37 -0
- package/__tests__/protocol-v2-firmware-targets.test.ts +19 -0
- package/__tests__/protocol-v2.test.ts +6008 -0
- package/__tests__/protocolV2FileWrite.test.ts +67 -0
- package/__tests__/public-pro2-api-boundary.test.ts +66 -0
- package/__tests__/search-devices.test.ts +136 -0
- package/dist/api/BaseMethod.d.ts +12 -0
- package/dist/api/BaseMethod.d.ts.map +1 -1
- package/dist/api/CheckAllFirmwareRelease.d.ts.map +1 -1
- package/dist/api/CheckBootloaderRelease.d.ts.map +1 -1
- package/dist/api/CheckFirmwareRelease.d.ts.map +1 -1
- package/dist/api/ClearSessionCache.d.ts +9 -0
- package/dist/api/ClearSessionCache.d.ts.map +1 -0
- 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 +25 -0
- package/dist/api/FileWrite.d.ts.map +1 -0
- package/dist/api/FirmwareUpdate.d.ts.map +1 -1
- package/dist/api/FirmwareUpdateV2.d.ts +14 -3
- package/dist/api/FirmwareUpdateV2.d.ts.map +1 -1
- package/dist/api/FirmwareUpdateV3.d.ts +10 -3
- package/dist/api/FirmwareUpdateV3.d.ts.map +1 -1
- package/dist/api/FirmwareUpdateV4.d.ts +75 -0
- package/dist/api/FirmwareUpdateV4.d.ts.map +1 -0
- package/dist/api/GetDeviceState.d.ts +7 -0
- package/dist/api/GetDeviceState.d.ts.map +1 -0
- package/dist/api/GetFeatures.d.ts +1 -1
- package/dist/api/GetFeatures.d.ts.map +1 -1
- package/dist/api/GetOnekeyFeatures.d.ts.map +1 -1
- package/dist/api/GetPassphraseState.d.ts.map +1 -1
- package/dist/api/OpenWalletSession.d.ts +14 -0
- package/dist/api/OpenWalletSession.d.ts.map +1 -0
- package/dist/api/PathInfo.d.ts +10 -0
- package/dist/api/PathInfo.d.ts.map +1 -0
- package/dist/api/PromptWebDeviceAccess.d.ts.map +1 -1
- package/dist/api/SearchDevices.d.ts +5 -1
- package/dist/api/SearchDevices.d.ts.map +1 -1
- package/dist/api/UploadPortfolio.d.ts +18 -0
- package/dist/api/UploadPortfolio.d.ts.map +1 -0
- 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 +5 -8
- package/dist/api/alephium/AlephiumSignTransaction.d.ts.map +1 -1
- package/dist/api/allnetwork/AllNetworkGetAddressBase.d.ts.map +1 -1
- package/dist/api/aptos/AptosGetAddress.d.ts.map +1 -1
- package/dist/api/benfen/BenfenGetAddress.d.ts +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/CardanoSignTransaction.d.ts.map +1 -1
- package/dist/api/conflux/ConfluxSignTransaction.d.ts.map +1 -1
- package/dist/api/device/DeviceCancel.d.ts.map +1 -1
- package/dist/api/device/DeviceChangePin.d.ts.map +1 -1
- package/dist/api/device/DeviceFullyUploadResource.d.ts +1 -2
- package/dist/api/device/DeviceFullyUploadResource.d.ts.map +1 -1
- package/dist/api/device/DeviceLock.d.ts.map +1 -1
- package/dist/api/device/DeviceRebootToBoardloader.d.ts +1 -1
- package/dist/api/device/DeviceRebootToBoardloader.d.ts.map +1 -1
- package/dist/api/device/DeviceRebootToBootloader.d.ts.map +1 -1
- package/dist/api/device/DeviceSettings.d.ts.map +1 -1
- package/dist/api/device/DeviceSupportFeatures.d.ts.map +1 -1
- package/dist/api/device/DeviceUnlock.d.ts +1 -1
- package/dist/api/device/DeviceUnlock.d.ts.map +1 -1
- package/dist/api/device/DeviceUpdateBootloader.d.ts +7 -1
- package/dist/api/device/DeviceUpdateBootloader.d.ts.map +1 -1
- package/dist/api/device/DeviceUploadResource.d.ts.map +1 -1
- package/dist/api/device/DeviceVerify.d.ts.map +1 -1
- package/dist/api/device/DeviceWipe.d.ts.map +1 -1
- package/dist/api/dynex/DnxGetAddress.d.ts.map +1 -1
- package/dist/api/dynex/DnxSignTransaction.d.ts.map +1 -1
- package/dist/api/evm/EVMGetPublicKey.d.ts.map +1 -1
- package/dist/api/evm/EVMSignMessageEIP712.d.ts +2 -8
- package/dist/api/evm/EVMSignMessageEIP712.d.ts.map +1 -1
- package/dist/api/evm/EVMSignTypedData.d.ts.map +1 -1
- package/dist/api/evm/latest/signTypedData.d.ts +1 -1
- package/dist/api/evm/latest/signTypedData.d.ts.map +1 -1
- package/dist/api/evm/latest/signTypedHash.d.ts.map +1 -1
- package/dist/api/evm/legacyV1/getAddress.d.ts.map +1 -1
- package/dist/api/evm/legacyV1/getPublicKey.d.ts.map +1 -1
- package/dist/api/evm/legacyV1/signMessage.d.ts.map +1 -1
- package/dist/api/evm/legacyV1/signTypedData.d.ts +1 -1
- package/dist/api/evm/legacyV1/signTypedData.d.ts.map +1 -1
- package/dist/api/evm/legacyV1/signTypedHash.d.ts.map +1 -1
- package/dist/api/evm/legacyV1/verifyMessage.d.ts.map +1 -1
- package/dist/api/firmware/FirmwareArtifactSource.d.ts +26 -0
- package/dist/api/firmware/FirmwareArtifactSource.d.ts.map +1 -0
- package/dist/api/firmware/FirmwareCheckpoint.d.ts +15 -0
- package/dist/api/firmware/FirmwareCheckpoint.d.ts.map +1 -0
- package/dist/api/firmware/FirmwareHostBinding.d.ts +6 -0
- package/dist/api/firmware/FirmwareHostBinding.d.ts.map +1 -0
- package/dist/api/firmware/FirmwareUpdateBaseMethod.d.ts +10 -1
- package/dist/api/firmware/FirmwareUpdateBaseMethod.d.ts.map +1 -1
- package/dist/api/firmware/FirmwareUpdateCapabilities.d.ts +3 -0
- package/dist/api/firmware/FirmwareUpdateCapabilities.d.ts.map +1 -0
- package/dist/api/firmware/FirmwareUpdatePlan.d.ts +29 -0
- package/dist/api/firmware/FirmwareUpdatePlan.d.ts.map +1 -0
- package/dist/api/firmware/FirmwareUpdatePreparedPlan.d.ts +25 -0
- package/dist/api/firmware/FirmwareUpdatePreparedPlan.d.ts.map +1 -0
- package/dist/api/firmware/bootloaderHelper.d.ts.map +1 -1
- package/dist/api/firmware/getBinary.d.ts +11 -0
- package/dist/api/firmware/getBinary.d.ts.map +1 -1
- package/dist/api/firmware/progressThrottle.d.ts +3 -0
- package/dist/api/firmware/progressThrottle.d.ts.map +1 -0
- package/dist/api/firmware/updateBootloader.d.ts +2 -0
- package/dist/api/firmware/updateBootloader.d.ts.map +1 -1
- package/dist/api/firmware/uploadFirmware.d.ts +9 -1
- package/dist/api/firmware/uploadFirmware.d.ts.map +1 -1
- package/dist/api/helpers/batchGetPublickeys.d.ts +3 -0
- package/dist/api/helpers/batchGetPublickeys.d.ts.map +1 -1
- package/dist/api/helpers/filesystemValidation.d.ts +10 -0
- package/dist/api/helpers/filesystemValidation.d.ts.map +1 -0
- package/dist/api/helpers/protocolV2FileWrite.d.ts +33 -0
- package/dist/api/helpers/protocolV2FileWrite.d.ts.map +1 -0
- package/dist/api/index.d.ts +29 -0
- package/dist/api/index.d.ts.map +1 -1
- package/dist/api/kaspa/KaspaSignTransaction.d.ts.map +1 -1
- package/dist/api/lightning/LnurlAuth.d.ts +4 -0
- package/dist/api/lightning/LnurlAuth.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 +9 -12
- 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/polkadot/PolkadotGetAddress.d.ts +3 -0
- package/dist/api/polkadot/PolkadotGetAddress.d.ts.map +1 -1
- package/dist/api/polkadot/networks.d.ts +3 -0
- package/dist/api/polkadot/networks.d.ts.map +1 -1
- package/dist/api/protocol-v2/DeviceFactoryInfoGet.d.ts +6 -0
- package/dist/api/protocol-v2/DeviceFactoryInfoGet.d.ts.map +1 -0
- package/dist/api/protocol-v2/DeviceFactoryInfoSet.d.ts +7 -0
- package/dist/api/protocol-v2/DeviceFactoryInfoSet.d.ts.map +1 -0
- 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/DeviceGetFirmwareUpdateStatus.d.ts +7 -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/DeviceInfoGet.d.ts +28 -0
- package/dist/api/protocol-v2/DeviceInfoGet.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/DeviceSessionOpen.d.ts +28 -0
- package/dist/api/protocol-v2/DeviceSessionOpen.d.ts.map +1 -0
- package/dist/api/protocol-v2/DeviceSettingsGet.d.ts +6 -0
- package/dist/api/protocol-v2/DeviceSettingsGet.d.ts.map +1 -0
- package/dist/api/protocol-v2/DeviceSettingsPageShow.d.ts +16 -0
- package/dist/api/protocol-v2/DeviceSettingsPageShow.d.ts.map +1 -0
- package/dist/api/protocol-v2/DeviceSettingsSet.d.ts +12 -0
- package/dist/api/protocol-v2/DeviceSettingsSet.d.ts.map +1 -0
- package/dist/api/protocol-v2/DeviceStatusGet.d.ts +6 -0
- package/dist/api/protocol-v2/DeviceStatusGet.d.ts.map +1 -0
- package/dist/api/protocol-v2/DeviceUploadWallpaper.d.ts +26 -0
- package/dist/api/protocol-v2/DeviceUploadWallpaper.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/FilesystemPermissionFix.d.ts +6 -0
- package/dist/api/protocol-v2/FilesystemPermissionFix.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/ProtocolInfoRequest.d.ts +6 -0
- package/dist/api/protocol-v2/ProtocolInfoRequest.d.ts.map +1 -0
- package/dist/api/protocol-v2/helpers.d.ts +42 -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 +1 -0
- package/dist/api/solana/SolGetAddress.d.ts.map +1 -1
- package/dist/api/solana/SolSignMessage.d.ts +3 -0
- package/dist/api/solana/SolSignMessage.d.ts.map +1 -1
- package/dist/api/solana/SolSignOffchainMessage.d.ts +3 -0
- package/dist/api/solana/SolSignOffchainMessage.d.ts.map +1 -1
- package/dist/api/solana/SolSignTransaction.d.ts +6 -0
- package/dist/api/solana/SolSignTransaction.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 +3 -2
- package/dist/api/stellar/StellarSignTransaction.d.ts.map +1 -1
- package/dist/api/sui/SuiGetAddress.d.ts +3 -0
- package/dist/api/sui/SuiGetAddress.d.ts.map +1 -1
- package/dist/api/sui/SuiGetPublicKey.d.ts +3 -0
- package/dist/api/sui/SuiGetPublicKey.d.ts.map +1 -1
- package/dist/api/sui/SuiSignMessage.d.ts +3 -0
- package/dist/api/sui/SuiSignMessage.d.ts.map +1 -1
- package/dist/api/sui/SuiSignTransaction.d.ts +5 -2
- package/dist/api/sui/SuiSignTransaction.d.ts.map +1 -1
- package/dist/api/ton/TonGetAddress.d.ts +3 -0
- package/dist/api/ton/TonGetAddress.d.ts.map +1 -1
- package/dist/api/ton/TonSignData.d.ts +1 -0
- package/dist/api/ton/TonSignData.d.ts.map +1 -1
- package/dist/api/ton/TonSignMessage.d.ts +3 -0
- package/dist/api/ton/TonSignMessage.d.ts.map +1 -1
- package/dist/api/ton/TonSignProof.d.ts +3 -0
- package/dist/api/ton/TonSignProof.d.ts.map +1 -1
- package/dist/api/tron/TronSignMessage.d.ts +3 -0
- package/dist/api/tron/TronSignMessage.d.ts.map +1 -1
- package/dist/api/tron/TronSignTransaction.d.ts +3 -0
- package/dist/api/tron/TronSignTransaction.d.ts.map +1 -1
- package/dist/api/utils.d.ts +2 -1
- package/dist/api/utils.d.ts.map +1 -1
- package/dist/constants/index.d.ts +2 -1
- package/dist/constants/index.d.ts.map +1 -1
- package/dist/core/RequestQueue.d.ts +19 -1
- package/dist/core/RequestQueue.d.ts.map +1 -1
- package/dist/core/deviceEventRegistration.d.ts +11 -0
- package/dist/core/deviceEventRegistration.d.ts.map +1 -0
- package/dist/core/index.d.ts +4 -1
- package/dist/core/index.d.ts.map +1 -1
- package/dist/data-manager/DataManager.d.ts +9 -5
- 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/data-manager/connectSettings.d.ts.map +1 -1
- package/dist/device/Device.d.ts +60 -16
- package/dist/device/Device.d.ts.map +1 -1
- package/dist/device/DeviceCommands.d.ts +16 -14
- 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/device/DeviceFeaturesState.d.ts +4 -0
- package/dist/device/DeviceFeaturesState.d.ts.map +1 -0
- package/dist/device/DevicePool.d.ts +4 -2
- package/dist/device/DevicePool.d.ts.map +1 -1
- package/dist/device/DeviceStateMapper.d.ts +13 -0
- package/dist/device/DeviceStateMapper.d.ts.map +1 -0
- package/dist/device/DeviceStateProjector.d.ts +7 -0
- package/dist/device/DeviceStateProjector.d.ts.map +1 -0
- package/dist/device/DeviceStateStore.d.ts +21 -0
- package/dist/device/DeviceStateStore.d.ts.map +1 -0
- package/dist/device/DeviceWalletSessionStore.d.ts +15 -0
- package/dist/device/DeviceWalletSessionStore.d.ts.map +1 -0
- package/dist/device/cloneDeviceState.d.ts +2 -0
- package/dist/device/cloneDeviceState.d.ts.map +1 -0
- package/dist/device/deviceIdentity.d.ts +5 -0
- package/dist/device/deviceIdentity.d.ts.map +1 -0
- package/dist/deviceProfile/buildDeviceFeatures.d.ts +12 -0
- package/dist/deviceProfile/buildDeviceFeatures.d.ts.map +1 -0
- package/dist/deviceProfile/index.d.ts +2 -0
- package/dist/deviceProfile/index.d.ts.map +1 -0
- package/dist/events/call.d.ts +7 -0
- package/dist/events/call.d.ts.map +1 -1
- package/dist/events/core.d.ts +2 -2
- package/dist/events/core.d.ts.map +1 -1
- package/dist/events/device.d.ts +11 -2
- package/dist/events/device.d.ts.map +1 -1
- package/dist/events/iframe.d.ts +1 -0
- package/dist/events/iframe.d.ts.map +1 -1
- package/dist/events/logBlockEvent.d.ts +1 -0
- package/dist/events/logBlockEvent.d.ts.map +1 -1
- package/dist/events/ui-request.d.ts +26 -2
- package/dist/events/ui-request.d.ts.map +1 -1
- package/dist/index.d.ts +1797 -451
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +26905 -5606
- package/dist/inject.d.ts +3 -2
- package/dist/inject.d.ts.map +1 -1
- package/dist/lowLevelInject.d.ts +2 -1
- package/dist/lowLevelInject.d.ts.map +1 -1
- package/dist/protocols/protocol-v2/deviceSession.d.ts +7 -0
- package/dist/protocols/protocol-v2/deviceSession.d.ts.map +1 -0
- package/dist/protocols/protocol-v2/features.d.ts +88 -0
- package/dist/protocols/protocol-v2/features.d.ts.map +1 -0
- package/dist/protocols/protocol-v2/firmware.d.ts +15 -0
- package/dist/protocols/protocol-v2/firmware.d.ts.map +1 -0
- package/dist/protocols/protocol-v2/index.d.ts +5 -0
- package/dist/protocols/protocol-v2/index.d.ts.map +1 -0
- package/dist/protocols/protocol-v2/lockedError.d.ts +2 -0
- package/dist/protocols/protocol-v2/lockedError.d.ts.map +1 -0
- package/dist/protocols/protocol-v2/settingsUnlockPolicy.d.ts +16 -0
- package/dist/protocols/protocol-v2/settingsUnlockPolicy.d.ts.map +1 -0
- package/dist/protocols/protocol-v2/uiInteraction.d.ts +39 -0
- package/dist/protocols/protocol-v2/uiInteraction.d.ts.map +1 -0
- package/dist/protocols/protocol-v2/unlockRetry.d.ts +11 -0
- package/dist/protocols/protocol-v2/unlockRetry.d.ts.map +1 -0
- package/dist/protocols/protocol-v2/walletSession.d.ts +21 -0
- package/dist/protocols/protocol-v2/walletSession.d.ts.map +1 -0
- package/dist/topLevelInject.d.ts.map +1 -1
- package/dist/types/api/checkAllFirmwareRelease.d.ts +4 -2
- package/dist/types/api/checkAllFirmwareRelease.d.ts.map +1 -1
- package/dist/types/api/deviceSettings.d.ts +9 -0
- package/dist/types/api/deviceSettings.d.ts.map +1 -1
- package/dist/types/api/deviceUnlock.d.ts +1 -1
- package/dist/types/api/deviceUnlock.d.ts.map +1 -1
- package/dist/types/api/deviceUpdateBootloader.d.ts +6 -1
- package/dist/types/api/deviceUpdateBootloader.d.ts.map +1 -1
- package/dist/types/api/export.d.ts +4 -1
- package/dist/types/api/export.d.ts.map +1 -1
- package/dist/types/api/firmwareUpdate.d.ts +114 -1
- package/dist/types/api/firmwareUpdate.d.ts.map +1 -1
- package/dist/types/api/firmwareUpdateCapabilities.d.ts +13 -0
- package/dist/types/api/firmwareUpdateCapabilities.d.ts.map +1 -0
- package/dist/types/api/firmwareUpdatePlan.d.ts +35 -0
- package/dist/types/api/firmwareUpdatePlan.d.ts.map +1 -0
- package/dist/types/api/firmwareUpdatePreparedPlan.d.ts +43 -0
- package/dist/types/api/firmwareUpdatePreparedPlan.d.ts.map +1 -0
- package/dist/types/api/getDeviceState.d.ts +12 -0
- package/dist/types/api/getDeviceState.d.ts.map +1 -0
- package/dist/types/api/getFeatures.d.ts.map +1 -1
- package/dist/types/api/getOnekeyFeatures.d.ts.map +1 -1
- package/dist/types/api/getPassphraseState.d.ts +2 -1
- package/dist/types/api/getPassphraseState.d.ts.map +1 -1
- package/dist/types/api/index.d.ts +48 -2
- package/dist/types/api/index.d.ts.map +1 -1
- package/dist/types/api/openWalletSession.d.ts +35 -0
- package/dist/types/api/openWalletSession.d.ts.map +1 -0
- package/dist/types/api/protocolV2.d.ts +113 -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/api/sessionCache.d.ts +10 -0
- package/dist/types/api/sessionCache.d.ts.map +1 -0
- package/dist/types/device.d.ts +207 -5
- package/dist/types/device.d.ts.map +1 -1
- package/dist/types/params.d.ts +3 -0
- package/dist/types/params.d.ts.map +1 -1
- package/dist/types/settings.d.ts +33 -0
- package/dist/types/settings.d.ts.map +1 -1
- package/dist/utils/capabilitieUtils.d.ts.map +1 -1
- package/dist/utils/deviceFeaturesCompat.d.ts +13 -0
- package/dist/utils/deviceFeaturesCompat.d.ts.map +1 -0
- package/dist/utils/deviceFeaturesUtils.d.ts +17 -9
- package/dist/utils/deviceFeaturesUtils.d.ts.map +1 -1
- package/dist/utils/deviceInfoUtils.d.ts +10 -8
- package/dist/utils/deviceInfoUtils.d.ts.map +1 -1
- package/dist/utils/deviceSettings.d.ts +2 -0
- package/dist/utils/deviceSettings.d.ts.map +1 -1
- package/dist/utils/deviceVersionUtils.d.ts +6 -5
- package/dist/utils/deviceVersionUtils.d.ts.map +1 -1
- package/dist/utils/findDefectiveBatchDevice.d.ts +1 -1
- package/dist/utils/homescreen.d.ts.map +1 -1
- package/dist/utils/index.d.ts +3 -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/pro2Wallpaper.d.ts +12 -0
- package/dist/utils/pro2Wallpaper.d.ts.map +1 -0
- package/dist/utils/tracing.d.ts.map +1 -1
- package/dist/utils/versionUtils.d.ts +1 -1
- package/package.json +4 -4
- package/src/api/BaseMethod.ts +60 -23
- package/src/api/CheckAllFirmwareRelease.ts +16 -3
- package/src/api/CheckBootloaderRelease.ts +1 -2
- package/src/api/CheckFirmwareRelease.ts +1 -2
- package/src/api/ClearSessionCache.ts +28 -0
- package/src/api/DirList.ts +33 -0
- package/src/api/DirMake.ts +23 -0
- package/src/api/DirRemove.ts +23 -0
- package/src/api/FileDelete.ts +23 -0
- package/src/api/FileRead.ts +183 -0
- package/src/api/FileWrite.ts +71 -0
- package/src/api/FirmwareUpdate.ts +15 -7
- package/src/api/FirmwareUpdateV2.ts +354 -148
- package/src/api/FirmwareUpdateV3.ts +376 -62
- package/src/api/FirmwareUpdateV4.ts +2279 -0
- package/src/api/GetDeviceState.ts +55 -0
- package/src/api/GetFeatures.ts +12 -4
- package/src/api/GetOnekeyFeatures.ts +15 -3
- package/src/api/GetPassphraseState.ts +9 -10
- package/src/api/OpenWalletSession.ts +211 -0
- package/src/api/PathInfo.ts +41 -0
- package/src/api/PromptWebDeviceAccess.ts +10 -1
- package/src/api/SearchDevices.ts +33 -3
- package/src/api/UploadPortfolio.ts +50 -0
- package/src/api/alephium/AlephiumGetAddress.ts +6 -2
- package/src/api/alephium/AlephiumSignMessage.ts +6 -1
- package/src/api/alephium/AlephiumSignTransaction.ts +15 -4
- package/src/api/allnetwork/AllNetworkGetAddressBase.ts +25 -21
- package/src/api/aptos/AptosGetAddress.ts +2 -3
- package/src/api/benfen/BenfenGetAddress.ts +11 -7
- package/src/api/benfen/BenfenGetPublicKey.ts +6 -2
- package/src/api/benfen/BenfenSignMessage.ts +6 -1
- package/src/api/benfen/BenfenSignTransaction.ts +6 -1
- package/src/api/btc/BTCGetPublicKey.ts +3 -2
- package/src/api/btc/BTCSignPsbt.ts +1 -2
- package/src/api/btc/helpers/versionLimit.ts +7 -1
- package/src/api/cardano/CardanoSignTransaction.ts +2 -4
- package/src/api/conflux/ConfluxSignTransaction.ts +5 -2
- package/src/api/device/DeviceCancel.ts +1 -0
- package/src/api/device/DeviceChangePin.ts +24 -0
- package/src/api/device/DeviceFullyUploadResource.ts +6 -7
- package/src/api/device/DeviceLock.ts +2 -3
- package/src/api/device/DeviceRebootToBoardloader.ts +11 -1
- package/src/api/device/DeviceRebootToBootloader.ts +11 -1
- package/src/api/device/DeviceSettings.ts +121 -0
- package/src/api/device/DeviceSupportFeatures.ts +2 -13
- package/src/api/device/DeviceUnlock.ts +9 -0
- package/src/api/device/DeviceUpdateBootloader.ts +175 -11
- package/src/api/device/DeviceUploadResource.ts +4 -5
- package/src/api/device/DeviceVerify.ts +1 -2
- package/src/api/device/DeviceWipe.ts +19 -0
- package/src/api/dynex/DnxGetAddress.ts +6 -0
- package/src/api/dynex/DnxSignTransaction.ts +6 -0
- package/src/api/evm/EVMGetAddress.ts +1 -1
- package/src/api/evm/EVMGetPublicKey.ts +3 -4
- package/src/api/evm/EVMSignMessage.ts +1 -1
- package/src/api/evm/EVMSignMessageEIP712.ts +14 -1
- package/src/api/evm/EVMSignTransaction.ts +1 -1
- package/src/api/evm/EVMSignTypedData.ts +30 -18
- package/src/api/evm/EVMVerifyMessage.ts +1 -1
- package/src/api/evm/latest/signTypedHash.ts +2 -4
- package/src/api/evm/legacyV1/getAddress.ts +5 -3
- package/src/api/evm/legacyV1/getPublicKey.ts +5 -3
- package/src/api/evm/legacyV1/signMessage.ts +5 -3
- package/src/api/evm/legacyV1/signTypedData.ts +9 -8
- package/src/api/evm/legacyV1/signTypedHash.ts +7 -7
- package/src/api/evm/legacyV1/verifyMessage.ts +5 -3
- package/src/api/firmware/FirmwareArtifactSource.ts +278 -0
- package/src/api/firmware/FirmwareCheckpoint.ts +188 -0
- package/src/api/firmware/FirmwareHostBinding.ts +108 -0
- package/src/api/firmware/FirmwareUpdateBaseMethod.ts +83 -15
- package/src/api/firmware/FirmwareUpdateCapabilities.ts +13 -0
- package/src/api/firmware/FirmwareUpdatePlan.ts +729 -0
- package/src/api/firmware/FirmwareUpdatePreparedPlan.ts +403 -0
- package/src/api/firmware/bootloaderHelper.ts +3 -2
- package/src/api/firmware/getBinary.ts +1 -1
- package/src/api/firmware/progressThrottle.ts +44 -0
- package/src/api/firmware/releaseHelper.ts +3 -3
- package/src/api/firmware/updateBootloader.ts +19 -4
- package/src/api/firmware/uploadFirmware.ts +148 -34
- package/src/api/helpers/batchGetPublickeys.ts +51 -6
- package/src/api/helpers/filesystemValidation.ts +112 -0
- package/src/api/helpers/protocolV2FileWrite.ts +193 -0
- package/src/api/index.ts +32 -0
- package/src/api/kaspa/KaspaSignTransaction.ts +2 -3
- package/src/api/lightning/LnurlAuth.ts +4 -0
- package/src/api/neo/NeoGetAddress.ts +6 -1
- package/src/api/neo/NeoSignTransaction.ts +6 -1
- package/src/api/nervos/NervosGetAddress.ts +6 -2
- package/src/api/nervos/NervosSignTransaction.ts +14 -4
- package/src/api/nexa/NexaGetAddress.ts +6 -2
- package/src/api/nexa/NexaSignTransaction.ts +11 -12
- package/src/api/polkadot/networks.ts +9 -0
- package/src/api/protocol-v2/DeviceFactoryInfoGet.ts +20 -0
- package/src/api/protocol-v2/DeviceFactoryInfoSet.ts +32 -0
- package/src/api/protocol-v2/DeviceFirmwareUpdate.ts +61 -0
- package/src/api/protocol-v2/DeviceGetFirmwareUpdateStatus.ts +55 -0
- package/src/api/protocol-v2/DeviceGetOnboardingStatus.ts +18 -0
- package/src/api/protocol-v2/DeviceInfoGet.ts +145 -0
- package/src/api/protocol-v2/DeviceReboot.ts +26 -0
- package/src/api/protocol-v2/DeviceSessionOpen.ts +102 -0
- package/src/api/protocol-v2/DeviceSettingsGet.ts +18 -0
- package/src/api/protocol-v2/DeviceSettingsPageShow.ts +70 -0
- package/src/api/protocol-v2/DeviceSettingsSet.ts +44 -0
- package/src/api/protocol-v2/DeviceStatusGet.ts +16 -0
- package/src/api/protocol-v2/DeviceUploadWallpaper.ts +131 -0
- package/src/api/protocol-v2/FilesystemFormat.ts +19 -0
- package/src/api/protocol-v2/FilesystemPermissionFix.ts +16 -0
- package/src/api/protocol-v2/Ping.ts +18 -0
- package/src/api/protocol-v2/ProtocolInfoRequest.ts +16 -0
- package/src/api/protocol-v2/helpers.ts +203 -0
- package/src/api/scdo/ScdoGetAddress.ts +6 -2
- package/src/api/scdo/ScdoSignMessage.ts +6 -1
- package/src/api/scdo/ScdoSignTransaction.ts +6 -2
- package/src/api/solana/SolGetAddress.ts +4 -0
- package/src/api/solana/SolSignMessage.ts +3 -0
- package/src/api/solana/SolSignOffchainMessage.ts +3 -0
- package/src/api/solana/SolSignTransaction.ts +6 -0
- package/src/api/stellar/StellarGetAddress.ts +10 -1
- package/src/api/stellar/StellarSignTransaction.ts +14 -1
- package/src/api/sui/SuiGetAddress.ts +5 -3
- package/src/api/sui/SuiGetPublicKey.ts +3 -0
- package/src/api/sui/SuiSignMessage.ts +3 -0
- package/src/api/sui/SuiSignTransaction.ts +14 -12
- package/src/api/ton/TonGetAddress.ts +3 -0
- package/src/api/ton/TonSignData.ts +6 -3
- package/src/api/ton/TonSignMessage.ts +6 -5
- package/src/api/ton/TonSignProof.ts +3 -0
- package/src/api/tron/TronSignMessage.ts +4 -1
- package/src/api/tron/TronSignTransaction.ts +3 -0
- package/src/api/utils.ts +7 -3
- package/src/api/xrp/XrpSignTransaction.ts +1 -1
- package/src/constants/index.ts +7 -1
- package/src/core/RequestQueue.ts +124 -4
- package/src/core/deviceEventRegistration.ts +23 -0
- package/src/core/index.ts +255 -116
- package/src/data/messages/messages-protocol-v2.json +13544 -0
- package/src/data-manager/DataManager.ts +61 -49
- package/src/data-manager/MessagesConfig.ts +14 -14
- package/src/data-manager/TransportManager.ts +38 -12
- package/src/data-manager/connectSettings.ts +15 -0
- package/src/device/Device.ts +759 -164
- package/src/device/DeviceCommands.ts +245 -36
- package/src/device/DeviceConnector.ts +29 -4
- package/src/device/DeviceFeaturesState.ts +34 -0
- package/src/device/DevicePool.ts +69 -21
- package/src/device/DeviceStateMapper.ts +348 -0
- package/src/device/DeviceStateProjector.ts +95 -0
- package/src/device/DeviceStateStore.ts +201 -0
- package/src/device/DeviceWalletSessionStore.ts +78 -0
- package/src/device/cloneDeviceState.ts +39 -0
- package/src/device/deviceIdentity.ts +18 -0
- package/src/deviceProfile/buildDeviceFeatures.ts +391 -0
- package/src/deviceProfile/index.ts +4 -0
- package/src/events/call.ts +6 -0
- package/src/events/core.ts +2 -0
- package/src/events/device.ts +17 -1
- package/src/events/iframe.ts +1 -0
- package/src/events/logBlockEvent.ts +30 -0
- package/src/events/ui-request.ts +32 -2
- package/src/index.ts +9 -0
- package/src/inject.ts +75 -3
- package/src/lowLevelInject.ts +8 -1
- package/src/protocols/protocol-v2/deviceSession.ts +24 -0
- package/src/protocols/protocol-v2/features.ts +163 -0
- package/src/protocols/protocol-v2/firmware.ts +21 -0
- package/src/protocols/protocol-v2/index.ts +18 -0
- package/src/protocols/protocol-v2/lockedError.ts +10 -0
- package/src/protocols/protocol-v2/settingsUnlockPolicy.ts +61 -0
- package/src/protocols/protocol-v2/uiInteraction.ts +210 -0
- package/src/protocols/protocol-v2/unlockRetry.ts +76 -0
- package/src/protocols/protocol-v2/walletSession.ts +202 -0
- package/src/topLevelInject.ts +7 -1
- package/src/types/api/checkAllFirmwareRelease.ts +4 -2
- package/src/types/api/deviceSettings.ts +9 -0
- package/src/types/api/deviceUnlock.ts +1 -1
- package/src/types/api/deviceUpdateBootloader.ts +10 -1
- package/src/types/api/export.ts +25 -0
- package/src/types/api/firmwareUpdate.ts +163 -1
- package/src/types/api/firmwareUpdateCapabilities.ts +13 -0
- package/src/types/api/firmwareUpdatePlan.ts +52 -0
- package/src/types/api/firmwareUpdatePreparedPlan.ts +55 -0
- package/src/types/api/getDeviceState.ts +19 -0
- package/src/types/api/getFeatures.ts +3 -0
- package/src/types/api/getOnekeyFeatures.ts +3 -0
- package/src/types/api/getPassphraseState.ts +10 -2
- package/src/types/api/index.ts +89 -2
- package/src/types/api/openWalletSession.ts +54 -0
- package/src/types/api/protocolV2.ts +244 -0
- package/src/types/api/searchDevices.ts +2 -2
- package/src/types/api/sessionCache.ts +14 -0
- package/src/types/device.ts +266 -5
- package/src/types/params.ts +11 -0
- package/src/types/settings.ts +54 -29
- package/src/utils/capabilitieUtils.ts +1 -2
- package/src/utils/deviceFeaturesCompat.ts +173 -0
- package/src/utils/deviceFeaturesUtils.ts +122 -84
- package/src/utils/deviceInfoUtils.ts +38 -87
- package/src/utils/deviceSettings.ts +48 -0
- package/src/utils/deviceVersionUtils.ts +25 -62
- package/src/utils/findDefectiveBatchDevice.ts +8 -8
- package/src/utils/homescreen.ts +10 -0
- package/src/utils/index.ts +4 -0
- package/src/utils/pro2Wallpaper.ts +109 -0
- package/src/utils/tracing.ts +3 -1
|
@@ -12,7 +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 {
|
|
15
|
+
import { isMethodVersionRangeUnsupported } from '../../utils';
|
|
16
16
|
import { UI_REQUEST } from '../../constants/ui-request';
|
|
17
17
|
import { onDeviceButtonHandler } from '../../core';
|
|
18
18
|
import {
|
|
@@ -352,6 +352,7 @@ export default abstract class AllNetworkGetAddressBase extends BaseMethod<
|
|
|
352
352
|
};
|
|
353
353
|
|
|
354
354
|
let result: AllNetworkAddress[];
|
|
355
|
+
let requestError: Error | undefined;
|
|
355
356
|
try {
|
|
356
357
|
method.init();
|
|
357
358
|
method.setDevice?.(this.device);
|
|
@@ -394,10 +395,8 @@ export default abstract class AllNetworkGetAddressBase extends BaseMethod<
|
|
|
394
395
|
rootFingerprint,
|
|
395
396
|
},
|
|
396
397
|
}));
|
|
397
|
-
if (method.requestContext) {
|
|
398
|
-
completeRequestContext(method.requestContext.responseID);
|
|
399
|
-
}
|
|
400
398
|
} catch (e: any) {
|
|
399
|
+
requestError = e instanceof Error ? e : new Error(String(e));
|
|
401
400
|
const error = handleSkippableHardwareError(e, this.device, method);
|
|
402
401
|
|
|
403
402
|
if (error) {
|
|
@@ -415,13 +414,10 @@ export default abstract class AllNetworkGetAddressBase extends BaseMethod<
|
|
|
415
414
|
} else {
|
|
416
415
|
throw e;
|
|
417
416
|
}
|
|
417
|
+
} finally {
|
|
418
418
|
if (method.requestContext) {
|
|
419
|
-
completeRequestContext(
|
|
420
|
-
method.requestContext.responseID,
|
|
421
|
-
e instanceof Error ? e : new Error(String(e))
|
|
422
|
-
);
|
|
419
|
+
completeRequestContext(method.requestContext.responseID, requestError);
|
|
423
420
|
}
|
|
424
|
-
} finally {
|
|
425
421
|
this.device.off(DEVICE.BUTTON, buttonListener);
|
|
426
422
|
this.device.off(DEVICE.PIN, onSignalAbort);
|
|
427
423
|
this.device.off(DEVICE.PASSPHRASE, onSignalAbort);
|
|
@@ -463,11 +459,12 @@ export default abstract class AllNetworkGetAddressBase extends BaseMethod<
|
|
|
463
459
|
* @param method BaseMethod
|
|
464
460
|
*/
|
|
465
461
|
function preCheckDeviceSupport(device: Device, method: BaseMethod) {
|
|
466
|
-
const versionRange =
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
)
|
|
470
|
-
|
|
462
|
+
const versionRange = device.getCurrentMethodVersionRange(type => method.getVersionRange()[type]);
|
|
463
|
+
const currentVersion = device.getCurrentFirmwareVersionString() ?? '0.0.0';
|
|
464
|
+
|
|
465
|
+
if (isMethodVersionRangeUnsupported(versionRange)) {
|
|
466
|
+
throw ERRORS.createDeviceNotSupportMethodError(method.name, device.getCurrentFirmwareType());
|
|
467
|
+
}
|
|
471
468
|
|
|
472
469
|
if (
|
|
473
470
|
versionRange &&
|
|
@@ -478,10 +475,10 @@ function preCheckDeviceSupport(device: Device, method: BaseMethod) {
|
|
|
478
475
|
currentVersion,
|
|
479
476
|
requireVersion: versionRange.min,
|
|
480
477
|
methodName: method.name,
|
|
481
|
-
firmwareType:
|
|
478
|
+
firmwareType: device.getCurrentFirmwareType(),
|
|
482
479
|
});
|
|
483
480
|
} else if (method.strictCheckDeviceSupport && !versionRange) {
|
|
484
|
-
throw ERRORS.createDeviceNotSupportMethodError(method.name,
|
|
481
|
+
throw ERRORS.createDeviceNotSupportMethodError(method.name, device.getCurrentFirmwareType());
|
|
485
482
|
}
|
|
486
483
|
}
|
|
487
484
|
|
|
@@ -503,11 +500,18 @@ function handleSkippableHardwareError(
|
|
|
503
500
|
e.message?.includes('Failure_UnexpectedMessage') ||
|
|
504
501
|
e.message?.includes('Failure_UnknownMessage')
|
|
505
502
|
) {
|
|
506
|
-
const versionRange =
|
|
507
|
-
device.features,
|
|
503
|
+
const versionRange = device.getCurrentMethodVersionRange(
|
|
508
504
|
type => method.getVersionRange()[type]
|
|
509
505
|
);
|
|
510
|
-
const currentVersion =
|
|
506
|
+
const currentVersion = device.getCurrentFirmwareVersionString() ?? '0.0.0';
|
|
507
|
+
|
|
508
|
+
if (isMethodVersionRangeUnsupported(versionRange)) {
|
|
509
|
+
error = ERRORS.createDeviceNotSupportMethodError(
|
|
510
|
+
method.name,
|
|
511
|
+
device.getCurrentFirmwareType()
|
|
512
|
+
);
|
|
513
|
+
return error;
|
|
514
|
+
}
|
|
511
515
|
|
|
512
516
|
if (
|
|
513
517
|
versionRange &&
|
|
@@ -518,12 +522,12 @@ function handleSkippableHardwareError(
|
|
|
518
522
|
currentVersion,
|
|
519
523
|
requireVersion: versionRange.min,
|
|
520
524
|
methodName: method.name,
|
|
521
|
-
firmwareType:
|
|
525
|
+
firmwareType: device.getCurrentFirmwareType(),
|
|
522
526
|
});
|
|
523
527
|
} else {
|
|
524
528
|
error = ERRORS.createDeviceNotSupportMethodError(
|
|
525
529
|
method.name,
|
|
526
|
-
|
|
530
|
+
device.getCurrentFirmwareType()
|
|
527
531
|
);
|
|
528
532
|
}
|
|
529
533
|
} else if (
|
|
@@ -5,9 +5,8 @@ import { UI_REQUEST } from '../../constants/ui-request';
|
|
|
5
5
|
import { serializedPath, validatePath } from '../helpers/pathUtils';
|
|
6
6
|
import { BaseMethod } from '../BaseMethod';
|
|
7
7
|
import { validateParams, validateResult } from '../helpers/paramsValidator';
|
|
8
|
-
import { supportBatchPublicKey } from '../../utils/deviceFeaturesUtils';
|
|
9
8
|
import { hexToBytes } from '../helpers/hexUtils';
|
|
10
|
-
import { batchGetPublickeys } from '../helpers/batchGetPublickeys';
|
|
9
|
+
import { batchGetPublickeys, supportBatchPublicKeyByDevice } from '../helpers/batchGetPublickeys';
|
|
11
10
|
|
|
12
11
|
import type { AptosAddress, AptosGetAddressParams } from '../../types';
|
|
13
12
|
import type { AptosGetAddress as HardwareAptosGetAddress } from '@onekeyfe/hd-transport';
|
|
@@ -66,7 +65,7 @@ export default class AptosGetAddress extends BaseMethod<HardwareAptosGetAddress[
|
|
|
66
65
|
}
|
|
67
66
|
|
|
68
67
|
async run() {
|
|
69
|
-
const supportsBatchPublicKey =
|
|
68
|
+
const supportsBatchPublicKey = supportBatchPublicKeyByDevice(this.device);
|
|
70
69
|
let responses: AptosAddress[] = [];
|
|
71
70
|
if (supportsBatchPublicKey) {
|
|
72
71
|
const publicKeyRes = await batchGetPublickeys(this.device, this.params, 'ed25519', 637);
|
|
@@ -3,10 +3,9 @@ import { validateParams, validateResult } from '../helpers/paramsValidator';
|
|
|
3
3
|
import { serializedPath, validatePath } from '../helpers/pathUtils';
|
|
4
4
|
import { UI_REQUEST } from '../../constants/ui-request';
|
|
5
5
|
import { hex2BfcAddress, publicKeyToAddress } from './normalize';
|
|
6
|
-
import {
|
|
7
|
-
import { batchGetPublickeys } from '../helpers/batchGetPublickeys';
|
|
6
|
+
import { batchGetPublickeys, supportBatchPublicKeyByDevice } from '../helpers/batchGetPublickeys';
|
|
8
7
|
|
|
9
|
-
import type { BenfenAddress, BenfenGetAddressParams } from '../../types';
|
|
8
|
+
import type { BenfenAddress, BenfenGetAddressParams, DeviceFirmwareRange } from '../../types';
|
|
10
9
|
import type { BenfenGetAddress as HardwareBenfenGetAddress } from '@onekeyfe/hd-transport';
|
|
11
10
|
|
|
12
11
|
export default class BenfenGetAddress extends BaseMethod<HardwareBenfenGetAddress[]> {
|
|
@@ -47,8 +46,12 @@ export default class BenfenGetAddress extends BaseMethod<HardwareBenfenGetAddres
|
|
|
47
46
|
});
|
|
48
47
|
}
|
|
49
48
|
|
|
50
|
-
getVersionRange() {
|
|
49
|
+
getVersionRange(): DeviceFirmwareRange {
|
|
51
50
|
return {
|
|
51
|
+
pro2: {
|
|
52
|
+
min: '0.0.0',
|
|
53
|
+
unsupported: true,
|
|
54
|
+
},
|
|
52
55
|
pro: {
|
|
53
56
|
min: '4.12.0',
|
|
54
57
|
},
|
|
@@ -59,7 +62,7 @@ export default class BenfenGetAddress extends BaseMethod<HardwareBenfenGetAddres
|
|
|
59
62
|
}
|
|
60
63
|
|
|
61
64
|
async run() {
|
|
62
|
-
const supportsBatchPublicKey =
|
|
65
|
+
const supportsBatchPublicKey = supportBatchPublicKeyByDevice(this.device);
|
|
63
66
|
let responses: BenfenAddress[] = [];
|
|
64
67
|
|
|
65
68
|
if (supportsBatchPublicKey) {
|
|
@@ -75,7 +78,8 @@ export default class BenfenGetAddress extends BaseMethod<HardwareBenfenGetAddres
|
|
|
75
78
|
'BenfenAddress',
|
|
76
79
|
param
|
|
77
80
|
);
|
|
78
|
-
address
|
|
81
|
+
// BenfenAddress.address is optional in proto but always present on success.
|
|
82
|
+
address = addressRes.message.address ?? '';
|
|
79
83
|
} else {
|
|
80
84
|
address = publicKeyToAddress(publicKey);
|
|
81
85
|
}
|
|
@@ -103,7 +107,7 @@ export default class BenfenGetAddress extends BaseMethod<HardwareBenfenGetAddres
|
|
|
103
107
|
);
|
|
104
108
|
const result = {
|
|
105
109
|
path: serializedPath(param.address_n),
|
|
106
|
-
address: hex2BfcAddress(res.message.address),
|
|
110
|
+
address: hex2BfcAddress(res.message.address ?? ''),
|
|
107
111
|
};
|
|
108
112
|
if (this.shouldConfirm) {
|
|
109
113
|
this.postPreviousAddressMessage(result);
|
|
@@ -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 } from '../../types';
|
|
7
|
+
import type { BenfenGetPublicKeyParams, BenfenPublicKey, DeviceFirmwareRange } from '../../types';
|
|
8
8
|
|
|
9
9
|
export default class BenfenGetPublicKey extends BaseMethod<any> {
|
|
10
10
|
hasBundle = false;
|
|
@@ -38,8 +38,12 @@ export default class BenfenGetPublicKey extends BaseMethod<any> {
|
|
|
38
38
|
});
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
getVersionRange() {
|
|
41
|
+
getVersionRange(): DeviceFirmwareRange {
|
|
42
42
|
return {
|
|
43
|
+
pro2: {
|
|
44
|
+
min: '0.0.0',
|
|
45
|
+
unsupported: true,
|
|
46
|
+
},
|
|
43
47
|
pro: {
|
|
44
48
|
min: '4.12.0',
|
|
45
49
|
},
|
|
@@ -5,6 +5,7 @@ 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';
|
|
8
9
|
|
|
9
10
|
export default class BenfenSignMessage extends BaseMethod<HardwareBenfenSignMessage> {
|
|
10
11
|
init() {
|
|
@@ -26,8 +27,12 @@ export default class BenfenSignMessage extends BaseMethod<HardwareBenfenSignMess
|
|
|
26
27
|
};
|
|
27
28
|
}
|
|
28
29
|
|
|
29
|
-
getVersionRange() {
|
|
30
|
+
getVersionRange(): DeviceFirmwareRange {
|
|
30
31
|
return {
|
|
32
|
+
pro2: {
|
|
33
|
+
min: '0.0.0',
|
|
34
|
+
unsupported: true,
|
|
35
|
+
},
|
|
31
36
|
pro: {
|
|
32
37
|
min: '4.12.0',
|
|
33
38
|
},
|
|
@@ -8,6 +8,7 @@ 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';
|
|
11
12
|
|
|
12
13
|
export default class BenfenSignTransaction extends BaseMethod<BenfenSignTx> {
|
|
13
14
|
init() {
|
|
@@ -33,8 +34,12 @@ export default class BenfenSignTransaction extends BaseMethod<BenfenSignTx> {
|
|
|
33
34
|
};
|
|
34
35
|
}
|
|
35
36
|
|
|
36
|
-
getVersionRange() {
|
|
37
|
+
getVersionRange(): DeviceFirmwareRange {
|
|
37
38
|
return {
|
|
39
|
+
pro2: {
|
|
40
|
+
min: '0.0.0',
|
|
41
|
+
unsupported: true,
|
|
42
|
+
},
|
|
38
43
|
pro: {
|
|
39
44
|
min: '4.12.0',
|
|
40
45
|
},
|
|
@@ -78,7 +78,8 @@ export default class BTCGetPublicKey extends BaseMethod<GetPublicKey[]> {
|
|
|
78
78
|
}
|
|
79
79
|
|
|
80
80
|
for (const param of this.params) {
|
|
81
|
-
|
|
81
|
+
// init() sets coin_name; keep an empty fallback for the generated optional type.
|
|
82
|
+
const versionBytes = getVersionBytes(param.coin_name ?? '', param.script_type);
|
|
82
83
|
if (!versionBytes) {
|
|
83
84
|
throw new Error(
|
|
84
85
|
`Invalid coinName, not support generate xpub for scriptType: ${param.script_type}`
|
|
@@ -101,7 +102,7 @@ export default class BTCGetPublicKey extends BaseMethod<GetPublicKey[]> {
|
|
|
101
102
|
|
|
102
103
|
const path = serializedPath(param.address_n);
|
|
103
104
|
|
|
104
|
-
const xpub = createExtendedPublicKey(node, param.coin_name, param.script_type);
|
|
105
|
+
const xpub = createExtendedPublicKey(node, param.coin_name ?? '', param.script_type);
|
|
105
106
|
|
|
106
107
|
const rootFingerprint = res.root_fingerprint;
|
|
107
108
|
|
|
@@ -5,7 +5,6 @@ import { BaseMethod } from '../BaseMethod';
|
|
|
5
5
|
import { validateParams } from '../helpers/paramsValidator';
|
|
6
6
|
import { formatAnyHex } from '../helpers/hexUtils';
|
|
7
7
|
import { getCoinInfo } from './helpers/btcParamsUtils';
|
|
8
|
-
import { getDeviceType } from '../../utils';
|
|
9
8
|
|
|
10
9
|
import type { SignPsbt } from '@onekeyfe/hd-transport';
|
|
11
10
|
|
|
@@ -50,7 +49,7 @@ export default class BTCSignPsbt extends BaseMethod<SignPsbt> {
|
|
|
50
49
|
} catch (error) {
|
|
51
50
|
const { message } = error;
|
|
52
51
|
|
|
53
|
-
const deviceType =
|
|
52
|
+
const deviceType = this.device.getCurrentDeviceType();
|
|
54
53
|
if (
|
|
55
54
|
message.includes('PSBT parse failed') &&
|
|
56
55
|
(deviceType === EDeviceType.Classic1s || deviceType === EDeviceType.ClassicPure)
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { DeviceFirmwareRange } from '../../../types';
|
|
2
|
+
|
|
1
3
|
function isCoinNameInList(coinName: string, coinNames: (string | undefined)[]) {
|
|
2
4
|
for (let i = 0; i < coinNames.length; i++) {
|
|
3
5
|
const coin_name = coinNames[i];
|
|
@@ -8,9 +10,13 @@ function isCoinNameInList(coinName: string, coinNames: (string | undefined)[]) {
|
|
|
8
10
|
return false;
|
|
9
11
|
}
|
|
10
12
|
|
|
11
|
-
export function getBitcoinForkVersionRange(params: (string | undefined)[]) {
|
|
13
|
+
export function getBitcoinForkVersionRange(params: (string | undefined)[]): DeviceFirmwareRange {
|
|
12
14
|
if (isCoinNameInList('Neurai', params)) {
|
|
13
15
|
return {
|
|
16
|
+
pro2: {
|
|
17
|
+
min: '0.0.0',
|
|
18
|
+
unsupported: true,
|
|
19
|
+
},
|
|
14
20
|
model_mini: {
|
|
15
21
|
min: '3.7.0',
|
|
16
22
|
},
|
|
@@ -19,7 +19,6 @@ import {
|
|
|
19
19
|
} from './helper/auxiliaryData';
|
|
20
20
|
import { gatherWitnessPaths } from './helper/witnesses';
|
|
21
21
|
import { validatePath } from '../helpers/pathUtils';
|
|
22
|
-
import { getDeviceFirmwareVersion, getMethodVersionRange } from '../../utils';
|
|
23
22
|
|
|
24
23
|
import type { DeviceFirmwareRange } from '../../types';
|
|
25
24
|
import type { CollateralInputWithPath, Path } from './helper/cardanoInputs';
|
|
@@ -240,10 +239,9 @@ export default class CardanoSignTransaction extends BaseMethod<any> {
|
|
|
240
239
|
return;
|
|
241
240
|
}
|
|
242
241
|
|
|
243
|
-
const firmwareVersion =
|
|
242
|
+
const firmwareVersion = this.device.getCurrentFirmwareVersionString() ?? '0.0.0';
|
|
244
243
|
|
|
245
|
-
const versionRange =
|
|
246
|
-
this.device.features,
|
|
244
|
+
const versionRange = this.device.getCurrentMethodVersionRange(
|
|
247
245
|
type => this.supportConwayVersionRange()[type]
|
|
248
246
|
);
|
|
249
247
|
|
|
@@ -35,7 +35,7 @@ export default class ConfluxSignTransaction extends BaseMethod {
|
|
|
35
35
|
|
|
36
36
|
// check if transaction is valid
|
|
37
37
|
const schema: SchemaParam[] = [
|
|
38
|
-
{ name: 'to', type: '
|
|
38
|
+
{ name: 'to', type: 'string', required: true },
|
|
39
39
|
{ name: 'value', type: 'hexString', required: true },
|
|
40
40
|
{ name: 'gasLimit', type: 'hexString', required: true },
|
|
41
41
|
{ name: 'gasPrice', type: 'hexString', required: true },
|
|
@@ -48,7 +48,10 @@ export default class ConfluxSignTransaction extends BaseMethod {
|
|
|
48
48
|
|
|
49
49
|
validateParams(tx, schema);
|
|
50
50
|
|
|
51
|
-
this.formattedTx =
|
|
51
|
+
this.formattedTx = {
|
|
52
|
+
...formatAnyHex(tx),
|
|
53
|
+
to: tx.to,
|
|
54
|
+
};
|
|
52
55
|
}
|
|
53
56
|
|
|
54
57
|
processTxRequest = async (request: ConfluxTxRequest, data: string): Promise<ConfluxSignedTx> => {
|
|
@@ -1,10 +1,14 @@
|
|
|
1
|
+
import { DeviceSettingsPage } from '@onekeyfe/hd-transport';
|
|
2
|
+
|
|
1
3
|
import { BaseMethod } from '../BaseMethod';
|
|
2
4
|
import { validateParams } from '../helpers/paramsValidator';
|
|
5
|
+
import { invalidParameter } from '../helpers/filesystemValidation';
|
|
3
6
|
|
|
4
7
|
import type { ChangePin } from '@onekeyfe/hd-transport';
|
|
5
8
|
|
|
6
9
|
export default class DeviceChangePin extends BaseMethod<ChangePin> {
|
|
7
10
|
init() {
|
|
11
|
+
this.unlockPolicy = 'retry-on-locked';
|
|
8
12
|
this.useDevicePassphraseState = false;
|
|
9
13
|
|
|
10
14
|
// check payload
|
|
@@ -13,9 +17,29 @@ export default class DeviceChangePin extends BaseMethod<ChangePin> {
|
|
|
13
17
|
this.params = {
|
|
14
18
|
remove: this.payload.remove,
|
|
15
19
|
};
|
|
20
|
+
this.protocolV2UiInteraction = {
|
|
21
|
+
request: 'button',
|
|
22
|
+
source: 'method-lifecycle',
|
|
23
|
+
reason: 'change-pin',
|
|
24
|
+
completion: 'operation-completed',
|
|
25
|
+
deviceOnly: true,
|
|
26
|
+
page: DeviceSettingsPage.DevicePinChange,
|
|
27
|
+
};
|
|
16
28
|
}
|
|
17
29
|
|
|
18
30
|
async run() {
|
|
31
|
+
if (this.device.isProtocolV2()) {
|
|
32
|
+
if (this.params.remove) {
|
|
33
|
+
throw invalidParameter(
|
|
34
|
+
'Parameter [remove=true] is not supported by the Pro2 device PIN page.'
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
const res = await this.device.commands.typedCall('DeviceSettingsPageShow', 'Success', {
|
|
38
|
+
page: DeviceSettingsPage.DevicePinChange,
|
|
39
|
+
});
|
|
40
|
+
return Promise.resolve(res.message);
|
|
41
|
+
}
|
|
42
|
+
|
|
19
43
|
const res = await this.device.commands.typedCall('ChangePin', 'Success', {
|
|
20
44
|
...this.params,
|
|
21
45
|
});
|
|
@@ -5,12 +5,11 @@ import { UI_REQUEST } from '../../constants/ui-request';
|
|
|
5
5
|
import { BaseMethod } from '../BaseMethod';
|
|
6
6
|
import { getSysResourceBinary } from '../firmware/getBinary';
|
|
7
7
|
import { updateResources } from '../firmware/uploadFirmware';
|
|
8
|
-
import { getDeviceFirmwareVersion, getDeviceType, getFirmwareType } from '../../utils';
|
|
9
8
|
import { createUiMessage } from '../../events/ui-request';
|
|
10
9
|
import { DataManager } from '../../data-manager';
|
|
11
10
|
|
|
12
11
|
import type { Deferred } from '@onekeyfe/hd-shared';
|
|
13
|
-
import type {
|
|
12
|
+
import type { KnownDevice } from '../../types';
|
|
14
13
|
import type { DeviceFullyUploadResourceParams } from '../../types/api/deviceFullyUploadResource';
|
|
15
14
|
|
|
16
15
|
export default class DeviceFullyUploadResource extends BaseMethod {
|
|
@@ -33,12 +32,12 @@ export default class DeviceFullyUploadResource extends BaseMethod {
|
|
|
33
32
|
);
|
|
34
33
|
};
|
|
35
34
|
|
|
36
|
-
isSupportResourceUpdate(
|
|
35
|
+
isSupportResourceUpdate(updateType: string) {
|
|
37
36
|
if (updateType !== 'firmware') return false;
|
|
38
37
|
|
|
39
|
-
const deviceType =
|
|
38
|
+
const deviceType = this.device.getCurrentDeviceType();
|
|
40
39
|
const isTouchMode = deviceType === EDeviceType.Touch || deviceType === EDeviceType.Pro;
|
|
41
|
-
const currentVersion =
|
|
40
|
+
const currentVersion = this.device.getCurrentFirmwareVersionString() ?? '0.0.0';
|
|
42
41
|
|
|
43
42
|
return isTouchMode && semver.gte(currentVersion, '3.4.0');
|
|
44
43
|
}
|
|
@@ -49,10 +48,10 @@ export default class DeviceFullyUploadResource extends BaseMethod {
|
|
|
49
48
|
|
|
50
49
|
const payload = this.payload as DeviceFullyUploadResourceParams;
|
|
51
50
|
|
|
52
|
-
const deviceFirmwareType =
|
|
51
|
+
const deviceFirmwareType = device.getCurrentFirmwareType();
|
|
53
52
|
const firmwareType = payload.firmwareType ?? deviceFirmwareType;
|
|
54
53
|
|
|
55
|
-
if (!
|
|
54
|
+
if (!device.isBootloader() && features) {
|
|
56
55
|
// check & upgrade firmware resource
|
|
57
56
|
if (features) {
|
|
58
57
|
let { binary } = this.payload;
|
|
@@ -5,11 +5,10 @@ import type { LockDevice } from '@onekeyfe/hd-transport';
|
|
|
5
5
|
export default class DeviceLock extends BaseMethod<LockDevice> {
|
|
6
6
|
init() {
|
|
7
7
|
this.useDevicePassphraseState = false;
|
|
8
|
+
this.unlockPolicy = 'none';
|
|
8
9
|
}
|
|
9
10
|
|
|
10
11
|
async run() {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
return Promise.resolve(res.message);
|
|
12
|
+
return this.device.lockDevice();
|
|
14
13
|
}
|
|
15
14
|
}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { DeviceRebootType } from '@onekeyfe/hd-transport';
|
|
2
|
+
|
|
1
3
|
import { BaseMethod } from '../BaseMethod';
|
|
2
4
|
|
|
3
5
|
import type { RebootToBoardloaderParams } from '../../types/api/deviceRebootToBoardloader';
|
|
@@ -21,10 +23,18 @@ export default class DeviceRebootToBoardloader extends BaseMethod<RebootToBoardl
|
|
|
21
23
|
}
|
|
22
24
|
|
|
23
25
|
async run() {
|
|
26
|
+
// Protocol V2 submodule firmware uses DeviceReboot with reboot_type enum.
|
|
27
|
+
if (this.device.isProtocolV2()) {
|
|
28
|
+
const res = await this.device.commands.typedCall('DeviceReboot', 'Success', {
|
|
29
|
+
reboot_type: DeviceRebootType.Romloader,
|
|
30
|
+
});
|
|
31
|
+
this.device.markProtocolV2Reboot(DeviceRebootType.Romloader);
|
|
32
|
+
return Promise.resolve(res.message);
|
|
33
|
+
}
|
|
34
|
+
|
|
24
35
|
// On Touch devices, messsage code 904 is RebootToBoardloader
|
|
25
36
|
// so BininOutMessageSE message code 904 is used here
|
|
26
37
|
const res = await this.device.commands.typedCall('BixinOutMessageSE', 'Success');
|
|
27
|
-
|
|
28
38
|
return Promise.resolve(res.message);
|
|
29
39
|
}
|
|
30
40
|
}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { DeviceRebootType } from '@onekeyfe/hd-transport';
|
|
2
|
+
|
|
1
3
|
import { BaseMethod } from '../BaseMethod';
|
|
2
4
|
|
|
3
5
|
import type { RebootToBootloader } from '@onekeyfe/hd-transport';
|
|
@@ -21,8 +23,16 @@ export default class DeviceRebootToBootloader extends BaseMethod<RebootToBootloa
|
|
|
21
23
|
}
|
|
22
24
|
|
|
23
25
|
async run() {
|
|
24
|
-
|
|
26
|
+
// Protocol V2 submodule firmware uses DeviceReboot with reboot_type enum.
|
|
27
|
+
if (this.device.isProtocolV2()) {
|
|
28
|
+
const res = await this.device.commands.typedCall('DeviceReboot', 'Success', {
|
|
29
|
+
reboot_type: DeviceRebootType.Bootloader,
|
|
30
|
+
});
|
|
31
|
+
this.device.markProtocolV2Reboot(DeviceRebootType.Bootloader);
|
|
32
|
+
return Promise.resolve(res.message);
|
|
33
|
+
}
|
|
25
34
|
|
|
35
|
+
const res = await this.device.commands.typedCall('RebootToBootloader', 'Success');
|
|
26
36
|
return Promise.resolve(res.message);
|
|
27
37
|
}
|
|
28
38
|
}
|