@onekeyfe/hd-core 1.1.34-alpha.2 → 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 -5611
- 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 +253 -125
- 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
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
import { DeviceRebootType } from '@onekeyfe/hd-transport';
|
|
2
|
+
|
|
3
|
+
import { invalidParameter, validateNonEmptyString } from '../helpers/filesystemValidation';
|
|
4
|
+
import { ProtocolV2FirmwareTargetType } from '../../protocols/protocol-v2/firmware';
|
|
5
|
+
|
|
6
|
+
import type {
|
|
7
|
+
DeviceFirmwareTarget,
|
|
8
|
+
DeviceFirmwareTargetType,
|
|
9
|
+
DeviceFirmwareUpdateRecordFields,
|
|
10
|
+
TransportCallOptions,
|
|
11
|
+
} from '@onekeyfe/hd-transport';
|
|
12
|
+
|
|
13
|
+
export type RebootTypeInput = DeviceRebootType | keyof typeof DeviceRebootType | string | number;
|
|
14
|
+
|
|
15
|
+
export type DeviceRebootParams = {
|
|
16
|
+
rebootType?: RebootTypeInput;
|
|
17
|
+
reboot_type?: RebootTypeInput;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export type DeviceFirmwareTargetInput =
|
|
21
|
+
| DeviceFirmwareTarget
|
|
22
|
+
| {
|
|
23
|
+
targetId?: DeviceFirmwareTargetType | string | number;
|
|
24
|
+
target_id?: DeviceFirmwareTargetType | string | number;
|
|
25
|
+
path: string;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export type DeviceFirmwareUpdateParams = {
|
|
29
|
+
targets?: DeviceFirmwareTargetInput[];
|
|
30
|
+
targetId?: DeviceFirmwareTargetType | string | number;
|
|
31
|
+
target_id?: DeviceFirmwareTargetType | string | number;
|
|
32
|
+
path?: string;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export type DeviceFirmwareUpdateStatusGetParams = {
|
|
36
|
+
fields?: DeviceFirmwareUpdateRecordFields;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export type DeviceFactoryInfoSetParams = {
|
|
40
|
+
version?: number;
|
|
41
|
+
serial_number?: string;
|
|
42
|
+
burn_in_completed?: boolean;
|
|
43
|
+
factory_test_completed?: boolean;
|
|
44
|
+
manufacture_time?: {
|
|
45
|
+
year: number;
|
|
46
|
+
month: number;
|
|
47
|
+
day: number;
|
|
48
|
+
hour: number;
|
|
49
|
+
minute: number;
|
|
50
|
+
second: number;
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
const DEVICE_REBOOT_TYPES: Record<string, DeviceRebootType> = {
|
|
55
|
+
Normal: DeviceRebootType.Normal,
|
|
56
|
+
normal: DeviceRebootType.Normal,
|
|
57
|
+
Romloader: DeviceRebootType.Romloader,
|
|
58
|
+
romloader: DeviceRebootType.Romloader,
|
|
59
|
+
Boardloader: DeviceRebootType.Romloader,
|
|
60
|
+
boardloader: DeviceRebootType.Romloader,
|
|
61
|
+
Bootloader: DeviceRebootType.Bootloader,
|
|
62
|
+
bootloader: DeviceRebootType.Bootloader,
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
export const PROTOCOL_V2_FIRMWARE_UPDATE_OPTIONS: TransportCallOptions = {
|
|
66
|
+
intermediateTypes: ['DeviceFirmwareUpdateStatus'],
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
export const PROTOCOL_V2_FIRMWARE_UPDATE_RESPONSE_TYPES: (
|
|
70
|
+
| 'Success'
|
|
71
|
+
| 'DeviceFirmwareUpdateStatus'
|
|
72
|
+
)[] = ['Success', 'DeviceFirmwareUpdateStatus'];
|
|
73
|
+
|
|
74
|
+
export const getProtocolV2UnknownErrorText = (error: unknown) => {
|
|
75
|
+
if (!error) {
|
|
76
|
+
return '';
|
|
77
|
+
}
|
|
78
|
+
if (typeof error === 'string') {
|
|
79
|
+
return error;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
const parts: string[] = [];
|
|
83
|
+
if (error instanceof Error) {
|
|
84
|
+
parts.push(error.name, error.message);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
if (typeof error === 'object') {
|
|
88
|
+
const record = error as Record<string, unknown>;
|
|
89
|
+
for (const field of ['name', 'message', 'reason', 'code', 'errorCode', 'nativeErrorCode']) {
|
|
90
|
+
const value = record[field];
|
|
91
|
+
if (value !== undefined && value !== null) {
|
|
92
|
+
parts.push(String(value));
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
const stringified = String(error);
|
|
98
|
+
if (stringified && stringified !== '[object Object]') {
|
|
99
|
+
parts.push(stringified);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
return parts.filter(Boolean).join(' ');
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
export const isProtocolV2DeviceDisconnectedError = (error: unknown) => {
|
|
106
|
+
const message = getProtocolV2UnknownErrorText(error).toLowerCase();
|
|
107
|
+
const compactMessage = message.replace(/\s+/g, '');
|
|
108
|
+
return (
|
|
109
|
+
message.includes('notfounderror') ||
|
|
110
|
+
(message.includes("failed to execute 'open'") && message.includes('usbdevice')) ||
|
|
111
|
+
message.includes('device was disconnected') ||
|
|
112
|
+
message.includes('device disconnected') ||
|
|
113
|
+
message.includes('device disconnect') ||
|
|
114
|
+
message.includes('was disconnected') ||
|
|
115
|
+
message.includes('bledevicedisconnected') ||
|
|
116
|
+
message.includes('bleconnectederror') ||
|
|
117
|
+
message.includes('connected error is always runtime error') ||
|
|
118
|
+
message.includes('connection has timed out unexpectedly') ||
|
|
119
|
+
message.includes('connection error has occured') ||
|
|
120
|
+
message.includes('connection error has occurred') ||
|
|
121
|
+
message.includes('multiplatformbleadapter') ||
|
|
122
|
+
message.includes('multipalformebleadapter') ||
|
|
123
|
+
compactMessage.includes('rxerrorerror6') ||
|
|
124
|
+
message.includes('rxerror error 6')
|
|
125
|
+
);
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
export function normalizeRebootType(value: RebootTypeInput | undefined): DeviceRebootType {
|
|
129
|
+
if (typeof value === 'number') return value;
|
|
130
|
+
if (typeof value === 'string') {
|
|
131
|
+
const numeric = Number(value);
|
|
132
|
+
if (Number.isFinite(numeric)) return numeric;
|
|
133
|
+
if (value in DEVICE_REBOOT_TYPES) return DEVICE_REBOOT_TYPES[value];
|
|
134
|
+
}
|
|
135
|
+
return DeviceRebootType.Normal;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
// 与 firmware-pro2 的 proto_target_to_firmware_target 安装白名单保持一致。
|
|
139
|
+
const INSTALLABLE_FIRMWARE_TARGET_IDS = new Set<number>([
|
|
140
|
+
ProtocolV2FirmwareTargetType.FW_MGMT_TARGET_CRATE,
|
|
141
|
+
ProtocolV2FirmwareTargetType.FW_MGMT_TARGET_BOOTLOADER,
|
|
142
|
+
ProtocolV2FirmwareTargetType.FW_MGMT_TARGET_APPLICATION_P1,
|
|
143
|
+
ProtocolV2FirmwareTargetType.FW_MGMT_TARGET_APPLICATION_P2,
|
|
144
|
+
ProtocolV2FirmwareTargetType.FW_MGMT_TARGET_COPROCESSOR,
|
|
145
|
+
ProtocolV2FirmwareTargetType.FW_MGMT_TARGET_SE01,
|
|
146
|
+
ProtocolV2FirmwareTargetType.FW_MGMT_TARGET_SE02,
|
|
147
|
+
ProtocolV2FirmwareTargetType.FW_MGMT_TARGET_SE03,
|
|
148
|
+
ProtocolV2FirmwareTargetType.FW_MGMT_TARGET_SE04,
|
|
149
|
+
]);
|
|
150
|
+
const FIRMWARE_TARGET_ID_BY_NAME = new Map<string, DeviceFirmwareTargetType>(
|
|
151
|
+
Object.entries(ProtocolV2FirmwareTargetType).flatMap(([key, value]) =>
|
|
152
|
+
INSTALLABLE_FIRMWARE_TARGET_IDS.has(value) ? [[key, value as DeviceFirmwareTargetType]] : []
|
|
153
|
+
)
|
|
154
|
+
);
|
|
155
|
+
|
|
156
|
+
function normalizeTargetId(
|
|
157
|
+
value: DeviceFirmwareTargetType | string | number | undefined,
|
|
158
|
+
name: string
|
|
159
|
+
): DeviceFirmwareTargetType {
|
|
160
|
+
if (value === undefined || value === null) {
|
|
161
|
+
throw invalidParameter(`Missing required parameter: ${name}`);
|
|
162
|
+
}
|
|
163
|
+
const named = typeof value === 'string' ? FIRMWARE_TARGET_ID_BY_NAME.get(value) : undefined;
|
|
164
|
+
const numeric = named ?? (typeof value === 'number' ? value : Number(value));
|
|
165
|
+
if (Number.isSafeInteger(numeric) && INSTALLABLE_FIRMWARE_TARGET_IDS.has(numeric)) {
|
|
166
|
+
return numeric as DeviceFirmwareTargetType;
|
|
167
|
+
}
|
|
168
|
+
throw invalidParameter(
|
|
169
|
+
`Parameter [${name}] must be an installable firmware target id (one of ${[
|
|
170
|
+
...INSTALLABLE_FIRMWARE_TARGET_IDS,
|
|
171
|
+
].join(', ')}).`
|
|
172
|
+
);
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
export function normalizeFirmwareTargets(
|
|
176
|
+
params: DeviceFirmwareUpdateParams
|
|
177
|
+
): DeviceFirmwareTarget[] {
|
|
178
|
+
const targets =
|
|
179
|
+
params.targets ??
|
|
180
|
+
(params.path
|
|
181
|
+
? [
|
|
182
|
+
{
|
|
183
|
+
target_id: params.target_id ?? params.targetId ?? 0,
|
|
184
|
+
path: params.path,
|
|
185
|
+
},
|
|
186
|
+
]
|
|
187
|
+
: []);
|
|
188
|
+
|
|
189
|
+
if (!Array.isArray(targets) || targets.length === 0) {
|
|
190
|
+
throw invalidParameter('Parameter [targets] must contain at least one firmware target.');
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
return targets.map((target, index) => {
|
|
194
|
+
if (!target || typeof target !== 'object') {
|
|
195
|
+
throw invalidParameter(`Parameter [targets.${index}] must be an object.`);
|
|
196
|
+
}
|
|
197
|
+
const targetId = target.target_id ?? target.targetId;
|
|
198
|
+
return {
|
|
199
|
+
target_id: normalizeTargetId(targetId, `targets.${index}.target_id`),
|
|
200
|
+
path: validateNonEmptyString(target.path, `targets.${index}.path`),
|
|
201
|
+
};
|
|
202
|
+
});
|
|
203
|
+
}
|
|
@@ -4,7 +4,7 @@ import { BaseMethod } from '../BaseMethod';
|
|
|
4
4
|
import { validateParams, validateResult } from '../helpers/paramsValidator';
|
|
5
5
|
|
|
6
6
|
import type { ScdoGetAddress as HardwareScdoGetAddress } from '@onekeyfe/hd-transport';
|
|
7
|
-
import type { ScdoAddress, ScdoGetAddressParams } from '../../types';
|
|
7
|
+
import type { DeviceFirmwareRange, ScdoAddress, ScdoGetAddressParams } from '../../types';
|
|
8
8
|
|
|
9
9
|
export default class ScdoGetAddress extends BaseMethod<HardwareScdoGetAddress[]> {
|
|
10
10
|
hasBundle = false;
|
|
@@ -38,8 +38,12 @@ export default class ScdoGetAddress extends BaseMethod<HardwareScdoGetAddress[]>
|
|
|
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
|
model_touch: {
|
|
44
48
|
min: '4.10.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 { ScdoSignMessage as HardwareScdoSignMessage } from '@onekeyfe/hd-transport';
|
|
8
|
+
import type { DeviceFirmwareRange } from '../../types';
|
|
8
9
|
|
|
9
10
|
export default class ScdoSignMessage extends BaseMethod<HardwareScdoSignMessage> {
|
|
10
11
|
init() {
|
|
@@ -28,8 +29,12 @@ export default class ScdoSignMessage extends BaseMethod<HardwareScdoSignMessage>
|
|
|
28
29
|
};
|
|
29
30
|
}
|
|
30
31
|
|
|
31
|
-
getVersionRange() {
|
|
32
|
+
getVersionRange(): DeviceFirmwareRange {
|
|
32
33
|
return {
|
|
34
|
+
pro2: {
|
|
35
|
+
min: '0.0.0',
|
|
36
|
+
unsupported: true,
|
|
37
|
+
},
|
|
33
38
|
model_touch: {
|
|
34
39
|
min: '4.10.0',
|
|
35
40
|
},
|
|
@@ -6,7 +6,7 @@ import { BaseMethod } from '../BaseMethod';
|
|
|
6
6
|
import { validateParams } from '../helpers/paramsValidator';
|
|
7
7
|
import { formatAnyHex, stripHexStartZeroes } from '../helpers/hexUtils';
|
|
8
8
|
|
|
9
|
-
import type { ScdoSignTransactionParams } from '../../types';
|
|
9
|
+
import type { DeviceFirmwareRange, ScdoSignTransactionParams } from '../../types';
|
|
10
10
|
import type {
|
|
11
11
|
ScdoSignTx as HardwareScdoSignTx,
|
|
12
12
|
ScdoSignedTx,
|
|
@@ -51,8 +51,12 @@ export default class ScdoSignTransaction extends BaseMethod<HardwareScdoSignTx>
|
|
|
51
51
|
};
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
-
getVersionRange() {
|
|
54
|
+
getVersionRange(): DeviceFirmwareRange {
|
|
55
55
|
return {
|
|
56
|
+
pro2: {
|
|
57
|
+
min: '0.0.0',
|
|
58
|
+
unsupported: true,
|
|
59
|
+
},
|
|
56
60
|
model_touch: {
|
|
57
61
|
min: '4.10.0',
|
|
58
62
|
},
|
|
@@ -43,6 +43,9 @@ export default class SolSignTransaction extends BaseMethod<HardwareSolanaSignTx[
|
|
|
43
43
|
getVersionRange() {
|
|
44
44
|
if (this.existsVersionedTx()) {
|
|
45
45
|
return {
|
|
46
|
+
pro2: {
|
|
47
|
+
min: '0.0.0',
|
|
48
|
+
},
|
|
46
49
|
model_mini: {
|
|
47
50
|
min: '3.1.0',
|
|
48
51
|
},
|
|
@@ -53,6 +56,9 @@ export default class SolSignTransaction extends BaseMethod<HardwareSolanaSignTx[
|
|
|
53
56
|
}
|
|
54
57
|
|
|
55
58
|
return {
|
|
59
|
+
pro2: {
|
|
60
|
+
min: '0.0.0',
|
|
61
|
+
},
|
|
56
62
|
classic: {
|
|
57
63
|
min: '2.1.9',
|
|
58
64
|
},
|
|
@@ -4,7 +4,7 @@ import { BaseMethod } from '../BaseMethod';
|
|
|
4
4
|
import { validateParams, validateResult } from '../helpers/paramsValidator';
|
|
5
5
|
|
|
6
6
|
import type { StellarGetAddress as HardwareStellarGetAddress } from '@onekeyfe/hd-transport';
|
|
7
|
-
import type { StellarAddress, StellarGetAddressParams } from '../../types';
|
|
7
|
+
import type { DeviceFirmwareRange, StellarAddress, StellarGetAddressParams } from '../../types';
|
|
8
8
|
|
|
9
9
|
export default class StellarGetAddress extends BaseMethod<HardwareStellarGetAddress[]> {
|
|
10
10
|
hasBundle = false;
|
|
@@ -38,6 +38,15 @@ export default class StellarGetAddress extends BaseMethod<HardwareStellarGetAddr
|
|
|
38
38
|
});
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
+
getVersionRange(): DeviceFirmwareRange {
|
|
42
|
+
return {
|
|
43
|
+
pro2: {
|
|
44
|
+
min: '0.0.0',
|
|
45
|
+
unsupported: true,
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
|
|
41
50
|
async run() {
|
|
42
51
|
const responses: StellarAddress[] = [];
|
|
43
52
|
|
|
@@ -10,7 +10,11 @@ import type {
|
|
|
10
10
|
StellarSignTx as HardwareStellarSignTx,
|
|
11
11
|
StellarSignedTx,
|
|
12
12
|
} from '@onekeyfe/hd-transport';
|
|
13
|
-
import type {
|
|
13
|
+
import type {
|
|
14
|
+
DeviceFirmwareRange,
|
|
15
|
+
StellarOperation,
|
|
16
|
+
StellarSignTransactionParams,
|
|
17
|
+
} from '../../types';
|
|
14
18
|
|
|
15
19
|
// Firmware accepts up to 1024 bytes per chunk; 1 byte = 2 hex chars
|
|
16
20
|
const SOROBAN_CHUNK_BYTES = 1024;
|
|
@@ -28,6 +32,15 @@ export default class StellarSignTransaction extends BaseMethod<HardwareStellarSi
|
|
|
28
32
|
extSent: number;
|
|
29
33
|
};
|
|
30
34
|
|
|
35
|
+
getVersionRange(): DeviceFirmwareRange {
|
|
36
|
+
return {
|
|
37
|
+
pro2: {
|
|
38
|
+
min: '0.0.0',
|
|
39
|
+
unsupported: true,
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
|
|
31
44
|
parseOperation = (op: StellarOperation) => {
|
|
32
45
|
switch (op.type) {
|
|
33
46
|
case 'createAccount':
|
|
@@ -2,9 +2,8 @@ import { UI_REQUEST } from '../../constants/ui-request';
|
|
|
2
2
|
import { serializedPath, validatePath } from '../helpers/pathUtils';
|
|
3
3
|
import { BaseMethod } from '../BaseMethod';
|
|
4
4
|
import { validateParams, validateResult } from '../helpers/paramsValidator';
|
|
5
|
-
import { supportBatchPublicKey } from '../../utils/deviceFeaturesUtils';
|
|
6
5
|
import { publicKeyToAddress } from './normalize';
|
|
7
|
-
import { batchGetPublickeys } from '../helpers/batchGetPublickeys';
|
|
6
|
+
import { batchGetPublickeys, supportBatchPublicKeyByDevice } from '../helpers/batchGetPublickeys';
|
|
8
7
|
|
|
9
8
|
import type { SuiAddress, SuiGetAddressParams } from '../../types';
|
|
10
9
|
import type { SuiGetAddress as HardwareSuiGetAddress } from '@onekeyfe/hd-transport';
|
|
@@ -49,6 +48,9 @@ export default class SuiGetAddress extends BaseMethod<HardwareSuiGetAddress[]> {
|
|
|
49
48
|
|
|
50
49
|
getVersionRange() {
|
|
51
50
|
return {
|
|
51
|
+
pro2: {
|
|
52
|
+
min: '0.0.0',
|
|
53
|
+
},
|
|
52
54
|
model_mini: {
|
|
53
55
|
min: '3.0.0',
|
|
54
56
|
},
|
|
@@ -59,7 +61,7 @@ export default class SuiGetAddress extends BaseMethod<HardwareSuiGetAddress[]> {
|
|
|
59
61
|
}
|
|
60
62
|
|
|
61
63
|
async run() {
|
|
62
|
-
const supportsBatchPublicKey =
|
|
64
|
+
const supportsBatchPublicKey = supportBatchPublicKeyByDevice(this.device);
|
|
63
65
|
let responses: SuiAddress[] = [];
|
|
64
66
|
if (supportsBatchPublicKey) {
|
|
65
67
|
const publicKeyRes = await batchGetPublickeys(this.device, this.params, 'ed25519', 784);
|
|
@@ -1,20 +1,16 @@
|
|
|
1
1
|
import semver from 'semver';
|
|
2
2
|
import { bytesToHex } from '@noble/hashes/utils';
|
|
3
|
+
import { EDeviceType } from '@onekeyfe/hd-shared';
|
|
3
4
|
|
|
4
5
|
import { UI_REQUEST } from '../../constants/ui-request';
|
|
5
6
|
import { validatePath } from '../helpers/pathUtils';
|
|
6
7
|
import { BaseMethod } from '../BaseMethod';
|
|
7
8
|
import { validateParams } from '../helpers/paramsValidator';
|
|
8
9
|
import { formatAnyHex } from '../helpers/hexUtils';
|
|
9
|
-
import { getDeviceFirmwareVersion, getDeviceType } from '../../utils';
|
|
10
10
|
import { DeviceModelToTypes } from '../../types';
|
|
11
11
|
|
|
12
|
-
import type {
|
|
13
|
-
|
|
14
|
-
SuiSignedTx,
|
|
15
|
-
TypedCall,
|
|
16
|
-
} from '@onekeyfe/hd-transport';
|
|
17
|
-
import type { TypedResponseMessage } from '../../device/DeviceCommands';
|
|
12
|
+
import type { SuiSignTx as HardwareSuiSignTx, SuiSignedTx } from '@onekeyfe/hd-transport';
|
|
13
|
+
import type { TypedCall, TypedResponseMessage } from '../../device/DeviceCommands';
|
|
18
14
|
|
|
19
15
|
type SuiSignTx = Omit<HardwareSuiSignTx, 'data_initial_chunk' | 'data_length'> & HardwareSuiSignTx;
|
|
20
16
|
|
|
@@ -43,6 +39,9 @@ export default class SuiSignTransaction extends BaseMethod<SuiSignTx> {
|
|
|
43
39
|
|
|
44
40
|
getVersionRange() {
|
|
45
41
|
return {
|
|
42
|
+
pro2: {
|
|
43
|
+
min: '0.0.0',
|
|
44
|
+
},
|
|
46
45
|
model_mini: {
|
|
47
46
|
min: '3.0.0',
|
|
48
47
|
},
|
|
@@ -53,8 +52,12 @@ export default class SuiSignTransaction extends BaseMethod<SuiSignTx> {
|
|
|
53
52
|
}
|
|
54
53
|
|
|
55
54
|
supportChunkTransfer() {
|
|
56
|
-
|
|
57
|
-
|
|
55
|
+
if (this.device.isProtocolV2() || this.device.getCurrentDeviceType() === EDeviceType.Pro2) {
|
|
56
|
+
return true;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const deviceType = this.device.getCurrentDeviceType();
|
|
60
|
+
const deviceFirmwareVersion = this.device.getCurrentFirmwareVersionString() ?? '0.0.0';
|
|
58
61
|
|
|
59
62
|
if (DeviceModelToTypes.model_mini.includes(deviceType)) {
|
|
60
63
|
if (semver.valid(deviceFirmwareVersion)) {
|
|
@@ -85,7 +88,7 @@ export default class SuiSignTransaction extends BaseMethod<SuiSignTx> {
|
|
|
85
88
|
|
|
86
89
|
if (!data_length) {
|
|
87
90
|
// sign Done
|
|
88
|
-
return res.message;
|
|
91
|
+
return res.message as SuiSignedTx;
|
|
89
92
|
}
|
|
90
93
|
|
|
91
94
|
const payload = data.subarray(offset, offset + data_length);
|
|
@@ -104,7 +107,7 @@ export default class SuiSignTransaction extends BaseMethod<SuiSignTx> {
|
|
|
104
107
|
async run() {
|
|
105
108
|
const typedCall = this.device.getCommands().typedCall.bind(this.device.getCommands());
|
|
106
109
|
let offset = 0;
|
|
107
|
-
let data
|
|
110
|
+
let data = Buffer.alloc(0);
|
|
108
111
|
|
|
109
112
|
if (this.supportChunkTransfer()) {
|
|
110
113
|
offset = this.chunkByteSize;
|
|
@@ -121,7 +124,6 @@ export default class SuiSignTransaction extends BaseMethod<SuiSignTx> {
|
|
|
121
124
|
...this.params,
|
|
122
125
|
});
|
|
123
126
|
|
|
124
|
-
// @ts-expect-error
|
|
125
127
|
return this.processTxRequest(typedCall, res, data, offset);
|
|
126
128
|
}
|
|
127
129
|
}
|
|
@@ -9,9 +9,8 @@ import type { TonSignDataParams } from '../../types/api/tonSignData';
|
|
|
9
9
|
|
|
10
10
|
export default class TonSignData extends BaseMethod<HardwareTonSignData> {
|
|
11
11
|
init() {
|
|
12
|
-
// Keep strict-check off until
|
|
13
|
-
//
|
|
14
|
-
// Flip back to true and add getVersionRange() once those numbers land.
|
|
12
|
+
// Keep strict-check off for touch/classic1s until their firmware release
|
|
13
|
+
// versions are decided. Pro2 is explicitly allowed by getVersionRange().
|
|
15
14
|
this.strictCheckDeviceSupport = false;
|
|
16
15
|
this.checkDeviceId = true;
|
|
17
16
|
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
@@ -51,6 +50,10 @@ export default class TonSignData extends BaseMethod<HardwareTonSignData> {
|
|
|
51
50
|
};
|
|
52
51
|
}
|
|
53
52
|
|
|
53
|
+
getVersionRange() {
|
|
54
|
+
return {};
|
|
55
|
+
}
|
|
56
|
+
|
|
54
57
|
async run() {
|
|
55
58
|
const res = await this.device.commands.typedCall('TonSignData', 'TonSignedData', {
|
|
56
59
|
...this.params,
|
|
@@ -7,7 +7,6 @@ import { validatePath } from '../helpers/pathUtils';
|
|
|
7
7
|
import { BaseMethod } from '../BaseMethod';
|
|
8
8
|
import { validateParams } from '../helpers/paramsValidator';
|
|
9
9
|
import { DeviceModelToTypes } from '../../types';
|
|
10
|
-
import { getDeviceFirmwareVersion, getDeviceType, getMethodVersionRange } from '../../utils';
|
|
11
10
|
import { formatAnyHex, stripHexStartZeroes } from '../helpers/hexUtils';
|
|
12
11
|
import { cutString } from '../helpers/stringUtils';
|
|
13
12
|
|
|
@@ -86,6 +85,9 @@ export default class TonSignMessage extends BaseMethod<HardwareTonSignMessage> {
|
|
|
86
85
|
|
|
87
86
|
getVersionRange() {
|
|
88
87
|
return {
|
|
88
|
+
pro2: {
|
|
89
|
+
min: '0.0.0',
|
|
90
|
+
},
|
|
89
91
|
model_touch: {
|
|
90
92
|
min: '4.10.0',
|
|
91
93
|
},
|
|
@@ -107,9 +109,8 @@ export default class TonSignMessage extends BaseMethod<HardwareTonSignMessage> {
|
|
|
107
109
|
}
|
|
108
110
|
|
|
109
111
|
checkSupportJettonAmountBytes() {
|
|
110
|
-
const firmwareVersion =
|
|
111
|
-
const versionRange =
|
|
112
|
-
this.device.features,
|
|
112
|
+
const firmwareVersion = this.device.getCurrentFirmwareVersionString() ?? '0.0.0';
|
|
113
|
+
const versionRange = this.device.getCurrentMethodVersionRange(
|
|
113
114
|
type => this.getSupportJettonAmountBytesVersionRange()[type]
|
|
114
115
|
);
|
|
115
116
|
|
|
@@ -167,7 +168,7 @@ export default class TonSignMessage extends BaseMethod<HardwareTonSignMessage> {
|
|
|
167
168
|
data: string
|
|
168
169
|
): Promise<TonTxAck | TonSignedMessageResponse> => {
|
|
169
170
|
if (!request.init_data_length) {
|
|
170
|
-
const deviceType =
|
|
171
|
+
const deviceType = this.device.getCurrentDeviceType();
|
|
171
172
|
const hasClassic = DeviceModelToTypes.model_classic1s.includes(deviceType);
|
|
172
173
|
// use signing_message_repr sign, not exists signning_message, skip validate
|
|
173
174
|
const hasSigningMessageRepr = request.signning_message == null;
|
|
@@ -29,7 +29,7 @@ export default class TronSignMessage extends BaseMethod<HardwareTronSignMessage>
|
|
|
29
29
|
if (this.payload.messageType === 'V1' || this.payload.messageType == null) {
|
|
30
30
|
throw createDeviceNotSupportMethodError(
|
|
31
31
|
'TronSignMessage',
|
|
32
|
-
getFirmwareType(this.device
|
|
32
|
+
getFirmwareType(this.device?.features)
|
|
33
33
|
);
|
|
34
34
|
}
|
|
35
35
|
|
|
@@ -45,6 +45,9 @@ export default class TronSignMessage extends BaseMethod<HardwareTronSignMessage>
|
|
|
45
45
|
|
|
46
46
|
getVersionRange() {
|
|
47
47
|
return {
|
|
48
|
+
pro2: {
|
|
49
|
+
min: '0.0.0',
|
|
50
|
+
},
|
|
48
51
|
model_mini: {
|
|
49
52
|
min: '2.5.0',
|
|
50
53
|
},
|
package/src/api/utils.ts
CHANGED
|
@@ -2,16 +2,20 @@ import { ERRORS, HardwareErrorCode } from '@onekeyfe/hd-shared';
|
|
|
2
2
|
|
|
3
3
|
import * as ApiMethods from './index';
|
|
4
4
|
|
|
5
|
+
import type { BaseMethod } from './BaseMethod';
|
|
5
6
|
import type { IFrameCallMessage } from '../events';
|
|
6
7
|
|
|
7
|
-
|
|
8
|
+
type MethodConstructor = new (message: IFrameCallMessage & { id?: number }) => BaseMethod<any>;
|
|
9
|
+
|
|
10
|
+
const publicMethodRegistry = ApiMethods as unknown as Record<string, MethodConstructor>;
|
|
11
|
+
|
|
12
|
+
export function findMethod(message: IFrameCallMessage & { id?: number }): BaseMethod<any> {
|
|
8
13
|
const { method } = message.payload;
|
|
9
14
|
if (typeof method !== 'string') {
|
|
10
15
|
throw ERRORS.TypedError(HardwareErrorCode.CallMethodInvalidParameter, 'Method is not set');
|
|
11
16
|
}
|
|
12
17
|
|
|
13
|
-
|
|
14
|
-
const MethodConstructor = ApiMethods[method];
|
|
18
|
+
const MethodConstructor = publicMethodRegistry[method];
|
|
15
19
|
if (MethodConstructor) {
|
|
16
20
|
return new MethodConstructor(message);
|
|
17
21
|
}
|
|
@@ -30,7 +30,7 @@ export default class XrpGetAddress extends BaseMethod<XrpSignTransactionParams>
|
|
|
30
30
|
{ name: 'payment', type: 'object' },
|
|
31
31
|
]);
|
|
32
32
|
validateParams(transaction.payment, [
|
|
33
|
-
{ name: 'amount', type: '
|
|
33
|
+
{ name: 'amount', type: 'uint', required: true },
|
|
34
34
|
{ name: 'destination', type: 'string', required: true },
|
|
35
35
|
{ name: 'destinationTag', type: 'number' },
|
|
36
36
|
]);
|
package/src/constants/index.ts
CHANGED
|
@@ -1,2 +1,8 @@
|
|
|
1
1
|
export { safeThrowError } from './errors';
|
|
2
|
-
export {
|
|
2
|
+
export {
|
|
3
|
+
Messages as PROTO,
|
|
4
|
+
ResourceType,
|
|
5
|
+
TonSignDataType,
|
|
6
|
+
TonWalletVersion,
|
|
7
|
+
} from '@onekeyfe/hd-transport';
|
|
8
|
+
export type { HDNodeType, Success as DeviceSuccess } from '@onekeyfe/hd-transport';
|