@onekeyfe/hd-core 1.2.0-alpha.66 → 1.2.0-alpha.67
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 +0 -313
- package/__tests__/DeviceCommands.test.ts +13 -59
- package/__tests__/DeviceEventRegistration.test.ts +0 -6
- package/__tests__/check-all-firmware-release-protocol-v2.test.ts +3 -198
- package/__tests__/connectSettings.test.ts +47 -5
- package/__tests__/device-initialize-timeout.test.ts +56 -0
- package/__tests__/device-lifecycle-events.test.ts +3 -105
- package/__tests__/device-pool-state.test.ts +0 -22
- package/__tests__/device-settings.test.ts +18 -39
- package/__tests__/device-state-contract.test.ts +0 -1
- package/__tests__/device-state-mapper.test.ts +1 -13
- package/__tests__/device-utils.test.ts +1 -48
- package/__tests__/deviceSettings.test.ts +1 -11
- package/__tests__/firmware-update/check-all-firmware-release.test.ts +175 -0
- package/__tests__/firmware-update/device-update-bootloader.test.ts +87 -0
- package/__tests__/firmware-update/firmware-artifact-source.test.ts +119 -0
- package/__tests__/firmware-update/firmware-host-binding.test.ts +70 -0
- package/__tests__/firmware-update/firmware-preparation-error.test.ts +27 -0
- package/__tests__/firmware-update/firmware-update-bootloader-poll.test.ts +200 -0
- package/__tests__/firmware-update/firmware-update-capabilities.test.ts +13 -0
- package/__tests__/firmware-update/firmware-update-plan-bootloader-identity.test.ts +394 -0
- package/__tests__/firmware-update/firmware-update-plan.test.ts +593 -0
- package/__tests__/firmware-update/firmware-update-prepared-plan.test.ts +231 -0
- package/__tests__/firmware-update/firmware-update-v2-download-before-boot.test.ts +59 -31
- package/__tests__/firmware-update/firmware-update-v3-reconnect.test.ts +58 -0
- package/__tests__/firmware-update/firmware-upload-source.test.ts +70 -0
- package/__tests__/get-device-state.test.ts +12 -132
- package/__tests__/homescreen.test.ts +1 -41
- package/__tests__/kaspa-use-tweak-pro2.test.ts +2 -2
- package/__tests__/kaspaSignTransaction.test.ts +26 -3
- package/__tests__/logBlockEvent.test.ts +1 -1
- package/__tests__/method-protocol-support.test.ts +0 -19
- package/__tests__/open-wallet-session.test.ts +37 -568
- package/__tests__/protocol-v2-unlock-policy.test.ts +37 -300
- package/__tests__/protocol-v2.test.ts +1153 -1458
- package/__tests__/protocolV2FileWrite.test.ts +0 -152
- package/__tests__/protocolV2UiInteraction.test.ts +0 -63
- package/__tests__/public-pro2-api-boundary.test.ts +0 -1
- package/__tests__/search-devices.test.ts +3 -12
- package/__tests__/tron-sign-message-init.test.ts +2 -2
- package/dist/api/BaseMethod.d.ts +1 -3
- package/dist/api/BaseMethod.d.ts.map +1 -1
- package/dist/api/CheckAllFirmwareRelease.d.ts +1 -2
- package/dist/api/CheckAllFirmwareRelease.d.ts.map +1 -1
- package/dist/api/FirmwareUpdate.d.ts.map +1 -1
- package/dist/api/FirmwareUpdateV2.d.ts +10 -0
- package/dist/api/FirmwareUpdateV2.d.ts.map +1 -1
- package/dist/api/FirmwareUpdateV3.d.ts +7 -3
- package/dist/api/FirmwareUpdateV3.d.ts.map +1 -1
- package/dist/api/FirmwareUpdateV4.d.ts +27 -13
- package/dist/api/FirmwareUpdateV4.d.ts.map +1 -1
- package/dist/api/GetPassphraseState.d.ts.map +1 -1
- package/dist/api/OpenWalletSession.d.ts.map +1 -1
- package/dist/api/SearchDevices.d.ts.map +1 -1
- package/dist/api/allnetwork/AllNetworkGetAddressBase.d.ts.map +1 -1
- package/dist/api/device/DeviceSettings.d.ts.map +1 -1
- package/dist/api/device/DeviceUnlock.d.ts +2 -2
- package/dist/api/device/DeviceUnlock.d.ts.map +1 -1
- package/dist/api/device/DeviceUpdateBootloader.d.ts +5 -1
- package/dist/api/device/DeviceUpdateBootloader.d.ts.map +1 -1
- package/dist/api/firmware/FirmwareArtifactSource.d.ts +25 -0
- package/dist/api/firmware/FirmwareArtifactSource.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/FirmwarePreparationError.d.ts +3 -0
- package/dist/api/firmware/FirmwarePreparationError.d.ts.map +1 -0
- package/dist/api/firmware/FirmwareUpdateBaseMethod.d.ts +11 -4
- 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 +25 -0
- package/dist/api/firmware/FirmwareUpdatePlan.d.ts.map +1 -0
- package/dist/api/firmware/FirmwareUpdatePreparedPlan.d.ts +32 -0
- package/dist/api/firmware/FirmwareUpdatePreparedPlan.d.ts.map +1 -0
- package/dist/api/firmware/getBinary.d.ts +7 -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/protocolV2FileWrite.d.ts +0 -9
- package/dist/api/helpers/protocolV2FileWrite.d.ts.map +1 -1
- package/dist/api/index.d.ts +0 -2
- package/dist/api/index.d.ts.map +1 -1
- package/dist/api/kaspa/KaspaGetAddress.d.ts +1 -1
- package/dist/api/kaspa/KaspaSignTransaction.d.ts +1 -1
- package/dist/api/kaspa/KaspaSignTransaction.d.ts.map +1 -1
- package/dist/api/polkadot/PolkadotGetAddress.d.ts +1 -1
- package/dist/api/polkadot/networks.d.ts +1 -1
- package/dist/api/protocol-v2/ProtocolInfoRequest.d.ts.map +1 -1
- package/dist/api/protocol-v2/helpers.d.ts.map +1 -1
- package/dist/api/solana/SolSignMessage.d.ts +1 -1
- package/dist/api/solana/SolSignOffchainMessage.d.ts +1 -1
- package/dist/api/solana/SolSignTransaction.d.ts +2 -2
- package/dist/api/stellar/StellarSignTransaction.d.ts +1 -1
- package/dist/api/sui/SuiGetAddress.d.ts +1 -1
- package/dist/api/sui/SuiGetPublicKey.d.ts +1 -1
- package/dist/api/sui/SuiSignMessage.d.ts +1 -1
- package/dist/api/sui/SuiSignTransaction.d.ts +1 -1
- package/dist/api/ton/TonGetAddress.d.ts +1 -1
- package/dist/api/ton/TonSignMessage.d.ts +1 -1
- package/dist/api/ton/TonSignProof.d.ts +1 -1
- package/dist/api/tron/TronSignMessage.d.ts +2 -2
- package/dist/api/tron/TronSignTransaction.d.ts +1 -1
- package/dist/core/deviceEventRegistration.d.ts +0 -2
- package/dist/core/deviceEventRegistration.d.ts.map +1 -1
- package/dist/core/index.d.ts.map +1 -1
- package/dist/data-manager/DataManager.d.ts +4 -9
- package/dist/data-manager/DataManager.d.ts.map +1 -1
- 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 +6 -29
- package/dist/device/Device.d.ts.map +1 -1
- package/dist/device/DeviceCommands.d.ts +4 -4
- package/dist/device/DeviceCommands.d.ts.map +1 -1
- package/dist/device/DeviceConnector.d.ts +1 -2
- package/dist/device/DeviceConnector.d.ts.map +1 -1
- package/dist/device/DevicePool.d.ts.map +1 -1
- package/dist/deviceProfile/protocolV2DeviceIdentity.d.ts.map +1 -1
- package/dist/events/device.d.ts +0 -4
- package/dist/events/device.d.ts.map +1 -1
- package/dist/events/logBlockEvent.d.ts.map +1 -1
- package/dist/events/ui-promise.d.ts +2 -4
- package/dist/events/ui-promise.d.ts.map +1 -1
- package/dist/events/ui-request.d.ts +2 -31
- package/dist/events/ui-request.d.ts.map +1 -1
- package/dist/events/ui-response.d.ts +2 -10
- package/dist/events/ui-response.d.ts.map +1 -1
- package/dist/index.d.ts +247 -243
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3773 -3054
- package/dist/inject.d.ts +1 -6
- package/dist/inject.d.ts.map +1 -1
- package/dist/lowLevelInject.d.ts.map +1 -1
- package/dist/protocols/protocol-v2/features.d.ts +4 -0
- package/dist/protocols/protocol-v2/features.d.ts.map +1 -1
- package/dist/protocols/protocol-v2/firmware.d.ts.map +1 -1
- 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/uiInteraction.d.ts +4 -7
- package/dist/protocols/protocol-v2/uiInteraction.d.ts.map +1 -1
- package/dist/protocols/protocol-v2/unlockPolicy.d.ts +3 -1
- package/dist/protocols/protocol-v2/unlockPolicy.d.ts.map +1 -1
- package/dist/protocols/protocol-v2/unlockRetry.d.ts +10 -0
- package/dist/protocols/protocol-v2/unlockRetry.d.ts.map +1 -0
- package/dist/protocols/protocol-v2/walletSession.d.ts +1 -6
- package/dist/protocols/protocol-v2/walletSession.d.ts.map +1 -1
- package/dist/topLevelInject.d.ts.map +1 -1
- package/dist/types/api/checkAllFirmwareRelease.d.ts +5 -3
- package/dist/types/api/checkAllFirmwareRelease.d.ts.map +1 -1
- package/dist/types/api/deviceUnlock.d.ts +1 -5
- package/dist/types/api/deviceUnlock.d.ts.map +1 -1
- package/dist/types/api/deviceUpdateBootloader.d.ts +6 -0
- package/dist/types/api/deviceUpdateBootloader.d.ts.map +1 -1
- package/dist/types/api/export.d.ts +4 -2
- package/dist/types/api/export.d.ts.map +1 -1
- package/dist/types/api/firmwareUpdate.d.ts +70 -4
- package/dist/types/api/firmwareUpdate.d.ts.map +1 -1
- package/dist/types/api/firmwareUpdateCapabilities.d.ts +9 -0
- package/dist/types/api/firmwareUpdateCapabilities.d.ts.map +1 -0
- package/dist/types/api/firmwareUpdatePlan.d.ts +28 -0
- package/dist/types/api/firmwareUpdatePlan.d.ts.map +1 -0
- package/dist/types/api/firmwareUpdatePreparedPlan.d.ts +42 -0
- package/dist/types/api/firmwareUpdatePreparedPlan.d.ts.map +1 -0
- package/dist/types/api/index.d.ts +10 -7
- package/dist/types/api/index.d.ts.map +1 -1
- package/dist/types/api/protocolV2.d.ts +0 -3
- package/dist/types/api/protocolV2.d.ts.map +1 -1
- package/dist/types/device.d.ts +2 -2
- package/dist/types/device.d.ts.map +1 -1
- package/dist/types/params.d.ts +0 -1
- package/dist/types/params.d.ts.map +1 -1
- package/dist/types/settings.d.ts +21 -38
- package/dist/types/settings.d.ts.map +1 -1
- package/dist/utils/deviceFeaturesCompat.d.ts +1 -0
- package/dist/utils/deviceFeaturesCompat.d.ts.map +1 -1
- package/dist/utils/deviceFeaturesUtils.d.ts +0 -4
- package/dist/utils/deviceFeaturesUtils.d.ts.map +1 -1
- package/dist/utils/deviceInfoUtils.d.ts.map +1 -1
- package/dist/utils/deviceSettings.d.ts.map +1 -1
- package/dist/utils/homescreen.d.ts +0 -4
- package/dist/utils/homescreen.d.ts.map +1 -1
- package/dist/utils/index.d.ts +1 -1
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/patch.d.ts +1 -1
- package/dist/utils/patch.d.ts.map +1 -1
- package/dist/utils/pro2Wallpaper.d.ts +0 -10
- package/dist/utils/pro2Wallpaper.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/api/BaseMethod.ts +10 -8
- package/src/api/CheckAllFirmwareRelease.ts +60 -59
- package/src/api/FirmwareUpdate.ts +15 -7
- package/src/api/FirmwareUpdateV2.ts +298 -126
- package/src/api/FirmwareUpdateV3.ts +265 -63
- package/src/api/FirmwareUpdateV4.ts +1017 -602
- package/src/api/GetPassphraseState.ts +1 -7
- package/src/api/OpenWalletSession.ts +17 -71
- package/src/api/SearchDevices.ts +1 -3
- package/src/api/allnetwork/AllNetworkGetAddress.ts +21 -21
- package/src/api/allnetwork/AllNetworkGetAddressBase.ts +11 -36
- package/src/api/device/DeviceSettings.ts +4 -5
- package/src/api/device/DeviceUnlock.ts +3 -8
- package/src/api/device/DeviceUpdateBootloader.ts +125 -6
- package/src/api/firmware/FirmwareArtifactSource.ts +278 -0
- package/src/api/firmware/FirmwareHostBinding.ts +100 -0
- package/src/api/firmware/FirmwarePreparationError.ts +12 -0
- package/src/api/firmware/FirmwareUpdateBaseMethod.ts +83 -27
- package/src/api/firmware/FirmwareUpdateCapabilities.ts +9 -0
- package/src/api/firmware/FirmwareUpdatePlan.ts +772 -0
- package/src/api/firmware/FirmwareUpdatePreparedPlan.ts +449 -0
- package/src/api/firmware/progressThrottle.ts +44 -0
- package/src/api/firmware/updateBootloader.ts +19 -4
- package/src/api/firmware/uploadFirmware.ts +144 -39
- package/src/api/helpers/protocolV2FileWrite.ts +63 -202
- package/src/api/index.ts +0 -2
- package/src/api/kaspa/KaspaGetAddress.ts +1 -1
- package/src/api/kaspa/KaspaSignTransaction.ts +13 -2
- package/src/api/polkadot/networks.ts +3 -3
- package/src/api/protocol-v2/ProtocolInfoRequest.ts +1 -3
- package/src/api/protocol-v2/helpers.ts +1 -1
- package/src/api/solana/SolSignMessage.ts +1 -1
- package/src/api/solana/SolSignOffchainMessage.ts +1 -1
- package/src/api/solana/SolSignTransaction.ts +2 -2
- package/src/api/sui/SuiGetAddress.ts +1 -1
- package/src/api/sui/SuiGetPublicKey.ts +1 -1
- package/src/api/sui/SuiSignMessage.ts +1 -1
- package/src/api/sui/SuiSignTransaction.ts +1 -1
- package/src/api/ton/TonGetAddress.ts +1 -1
- package/src/api/ton/TonSignMessage.ts +1 -1
- package/src/api/ton/TonSignProof.ts +1 -1
- package/src/api/tron/TronSignMessage.ts +2 -2
- package/src/api/tron/TronSignTransaction.ts +1 -1
- package/src/core/deviceEventRegistration.ts +0 -4
- package/src/core/index.ts +111 -213
- package/src/data/messages/messages-protocol-v2.json +0 -25
- package/src/data-manager/DataManager.ts +41 -113
- package/src/data-manager/TransportManager.ts +0 -6
- package/src/data-manager/connectSettings.ts +11 -0
- package/src/device/Device.ts +49 -274
- package/src/device/DeviceCommands.ts +4 -31
- package/src/device/DeviceConnector.ts +13 -33
- package/src/device/DevicePool.ts +7 -21
- package/src/deviceProfile/buildDeviceFeatures.ts +2 -2
- package/src/deviceProfile/protocolV2DeviceIdentity.ts +0 -3
- package/src/events/device.ts +0 -4
- package/src/events/logBlockEvent.ts +0 -1
- package/src/events/ui-promise.ts +2 -4
- package/src/events/ui-request.ts +2 -36
- package/src/events/ui-response.ts +2 -12
- package/src/index.ts +5 -0
- package/src/inject.ts +24 -60
- package/src/lowLevelInject.ts +8 -7
- package/src/protocols/protocol-v2/features.ts +7 -10
- package/src/protocols/protocol-v2/firmware.ts +0 -2
- package/src/protocols/protocol-v2/lockedError.ts +10 -0
- package/src/protocols/protocol-v2/uiInteraction.ts +6 -46
- package/src/protocols/protocol-v2/unlockPolicy.ts +105 -1
- package/src/protocols/protocol-v2/unlockRetry.ts +109 -0
- package/src/protocols/protocol-v2/walletSession.ts +36 -214
- package/src/topLevelInject.ts +8 -7
- package/src/types/api/checkAllFirmwareRelease.ts +5 -3
- package/src/types/api/deviceUnlock.ts +1 -12
- package/src/types/api/deviceUpdateBootloader.ts +6 -0
- package/src/types/api/export.ts +18 -1
- package/src/types/api/firmwareUpdate.ts +78 -6
- package/src/types/api/firmwareUpdateCapabilities.ts +9 -0
- package/src/types/api/firmwareUpdatePlan.ts +38 -0
- package/src/types/api/firmwareUpdatePreparedPlan.ts +53 -0
- package/src/types/api/index.ts +14 -13
- package/src/types/api/protocolV2.ts +0 -13
- package/src/types/device.ts +3 -15
- package/src/types/params.ts +1 -7
- package/src/types/settings.ts +22 -60
- package/src/utils/deviceFeaturesCompat.ts +6 -5
- package/src/utils/deviceFeaturesUtils.ts +3 -14
- package/src/utils/deviceInfoUtils.ts +0 -2
- package/src/utils/deviceSettings.ts +0 -3
- package/src/utils/homescreen.ts +6 -32
- package/src/utils/index.ts +1 -6
- package/src/utils/pro2Wallpaper.ts +8 -35
- package/__tests__/core-initialization.test.ts +0 -23
- package/__tests__/device-connector-protocol.test.ts +0 -81
- package/__tests__/deviceUploadNft.test.ts +0 -316
- package/__tests__/pro2Nft.test.ts +0 -108
- package/__tests__/protocol-binding.test.ts +0 -89
- package/__tests__/protocol-v2-resources.test.ts +0 -340
- package/__tests__/protocol-v2-ui-lifecycle.test.ts +0 -91
- package/__tests__/uiProgressThrottle.test.ts +0 -74
- package/__tests__/uiPromiseRegistry.test.ts +0 -115
- package/dist/api/DetectDeviceConnectProtocol.d.ts +0 -7
- package/dist/api/DetectDeviceConnectProtocol.d.ts.map +0 -1
- package/dist/api/protocol-v2/DeviceUploadNft.d.ts +0 -31
- package/dist/api/protocol-v2/DeviceUploadNft.d.ts.map +0 -1
- package/dist/core/uiPromiseRegistry.d.ts +0 -6
- package/dist/core/uiPromiseRegistry.d.ts.map +0 -1
- package/dist/protocols/protocol-v2/resources.d.ts +0 -30
- package/dist/protocols/protocol-v2/resources.d.ts.map +0 -1
- package/dist/protocols/protocol-v2/unlockPolicyRunner.d.ts +0 -22
- package/dist/protocols/protocol-v2/unlockPolicyRunner.d.ts.map +0 -1
- package/dist/types/api/detectDeviceConnectProtocol.d.ts +0 -4
- package/dist/types/api/detectDeviceConnectProtocol.d.ts.map +0 -1
- package/dist/utils/pro2Nft.d.ts +0 -31
- package/dist/utils/pro2Nft.d.ts.map +0 -1
- package/dist/utils/uiProgressThrottle.d.ts +0 -3
- package/dist/utils/uiProgressThrottle.d.ts.map +0 -1
- package/src/api/DetectDeviceConnectProtocol.ts +0 -18
- package/src/api/protocol-v2/DeviceUploadNft.ts +0 -197
- package/src/core/uiPromiseRegistry.ts +0 -63
- package/src/protocols/protocol-v2/resources.ts +0 -390
- package/src/protocols/protocol-v2/unlockPolicyRunner.ts +0 -131
- package/src/types/api/detectDeviceConnectProtocol.ts +0 -6
- package/src/utils/pro2Nft.ts +0 -142
- package/src/utils/uiProgressThrottle.ts +0 -63
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export interface FirmwareUpdateCapabilities {
|
|
2
|
+
planSchemaVersion: 2;
|
|
3
|
+
preparedPlanSchemaVersion: 2;
|
|
4
|
+
hostBindingProtocolVersion: 2;
|
|
5
|
+
manifestModes: Array<'external-only' | 'sdk-managed'>;
|
|
6
|
+
supportsArtifactReader: true;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export declare function getFirmwareUpdateCapabilities(): FirmwareUpdateCapabilities;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { FirmwareUpdateV4Target } from './firmwareUpdate';
|
|
2
|
+
import type { EFirmwareType } from '@onekeyfe/hd-shared';
|
|
3
|
+
|
|
4
|
+
export type FirmwareUpdatePlanArtifactRole =
|
|
5
|
+
| 'firmware'
|
|
6
|
+
| 'ble'
|
|
7
|
+
| 'bootloader'
|
|
8
|
+
| 'resource'
|
|
9
|
+
| 'component'
|
|
10
|
+
| 'resourceBundle';
|
|
11
|
+
|
|
12
|
+
export type FirmwareUpdatePlanTarget = 'firmware' | 'ble' | 'bootloader' | FirmwareUpdateV4Target;
|
|
13
|
+
|
|
14
|
+
export type FirmwareUpdatePlanForceTarget = 'firmware' | 'ble' | 'bootloader' | 'resource';
|
|
15
|
+
|
|
16
|
+
export interface FirmwareUpdatePlanArtifact {
|
|
17
|
+
artifactId: string;
|
|
18
|
+
role: FirmwareUpdatePlanArtifactRole;
|
|
19
|
+
target: FirmwareUpdatePlanTarget;
|
|
20
|
+
url: string;
|
|
21
|
+
container: 'raw' | 'zip';
|
|
22
|
+
logicalName?: string;
|
|
23
|
+
expectedSize?: number;
|
|
24
|
+
expectedSha256?: string;
|
|
25
|
+
targetVersion?: string;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export interface FirmwareUpdatePlan {
|
|
29
|
+
schemaVersion: 2;
|
|
30
|
+
planDigest: string;
|
|
31
|
+
executor: 'v2' | 'v3' | 'v4';
|
|
32
|
+
deviceIdentity: string;
|
|
33
|
+
deviceModel: string;
|
|
34
|
+
firmwareType: EFirmwareType;
|
|
35
|
+
platform: 'native' | 'desktop' | 'ext' | 'web' | 'web-embed';
|
|
36
|
+
artifacts: FirmwareUpdatePlanArtifact[];
|
|
37
|
+
targetsToUpdate: FirmwareUpdatePlanTarget[];
|
|
38
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { FirmwareArtifactReference } from './firmwareUpdate';
|
|
2
|
+
import type {
|
|
3
|
+
FirmwareUpdatePlan,
|
|
4
|
+
FirmwareUpdatePlanArtifactRole,
|
|
5
|
+
FirmwareUpdatePlanTarget,
|
|
6
|
+
} from './firmwareUpdatePlan';
|
|
7
|
+
|
|
8
|
+
export interface FirmwareUpdatePreparedEntry {
|
|
9
|
+
entryName: string;
|
|
10
|
+
artifact: FirmwareArtifactReference;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export interface FirmwareUpdatePreparedArtifactInput {
|
|
14
|
+
artifactId: string;
|
|
15
|
+
artifact: FirmwareArtifactReference;
|
|
16
|
+
materializedEntries?: FirmwareUpdatePreparedEntry[];
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export interface FirmwareUpdatePreparedArtifact {
|
|
20
|
+
artifactId: string;
|
|
21
|
+
role: FirmwareUpdatePlanArtifactRole;
|
|
22
|
+
target: FirmwareUpdatePlanTarget;
|
|
23
|
+
container: 'raw' | 'zip';
|
|
24
|
+
logicalName?: string;
|
|
25
|
+
targetVersion?: string;
|
|
26
|
+
artifact: FirmwareArtifactReference;
|
|
27
|
+
materializedEntries?: FirmwareUpdatePreparedEntry[];
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export interface FirmwareUpdatePreparedPlan {
|
|
31
|
+
schemaVersion: 2;
|
|
32
|
+
preparedPlanDigest: string;
|
|
33
|
+
planDigest: string;
|
|
34
|
+
networkPolicy: 'forbid';
|
|
35
|
+
executor: FirmwareUpdatePlan['executor'];
|
|
36
|
+
deviceIdentity: string;
|
|
37
|
+
deviceModel: string;
|
|
38
|
+
firmwareType: FirmwareUpdatePlan['firmwareType'];
|
|
39
|
+
platform: FirmwareUpdatePlan['platform'];
|
|
40
|
+
leaseRef: string;
|
|
41
|
+
artifacts: FirmwareUpdatePreparedArtifact[];
|
|
42
|
+
targetsToUpdate: FirmwareUpdatePlanTarget[];
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export declare function prepareFirmwareUpdatePlan(input: {
|
|
46
|
+
plan: FirmwareUpdatePlan;
|
|
47
|
+
leaseRef: string;
|
|
48
|
+
artifacts: FirmwareUpdatePreparedArtifactInput[];
|
|
49
|
+
}): FirmwareUpdatePreparedPlan;
|
|
50
|
+
|
|
51
|
+
export declare function validateFirmwareUpdatePreparedPlan(
|
|
52
|
+
value: unknown
|
|
53
|
+
): FirmwareUpdatePreparedPlan;
|
package/src/types/api/index.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type {
|
|
2
2
|
deviceGetOnboardingStatus,
|
|
3
3
|
deviceReboot,
|
|
4
|
-
deviceUploadNft,
|
|
5
4
|
deviceUploadWallpaper,
|
|
6
5
|
testProtocolV2Ping,
|
|
7
6
|
uploadPortfolio,
|
|
@@ -19,7 +18,6 @@ import type { checkBootloaderRelease } from './checkBootloaderRelease';
|
|
|
19
18
|
import type { checkAllFirmwareRelease } from './checkAllFirmwareRelease';
|
|
20
19
|
import type { checkFirmwareTypeAvailable } from './checkFirmwareTypeAvailable';
|
|
21
20
|
import type { searchDevices } from './searchDevices';
|
|
22
|
-
import type { detectDeviceConnectProtocol } from './detectDeviceConnectProtocol';
|
|
23
21
|
import type { getFeatures } from './getFeatures';
|
|
24
22
|
import type { getDeviceState } from './getDeviceState';
|
|
25
23
|
import type { getOnekeyFeatures } from './getOnekeyFeatures';
|
|
@@ -32,7 +30,15 @@ import type {
|
|
|
32
30
|
firmwareUpdateV2,
|
|
33
31
|
firmwareUpdateV3,
|
|
34
32
|
firmwareUpdateV4,
|
|
33
|
+
getFirmwareUpdateHostBindingGeneration,
|
|
34
|
+
registerFirmwareUpdateHostBinding,
|
|
35
|
+
unregisterFirmwareUpdateHostBinding,
|
|
35
36
|
} from './firmwareUpdate';
|
|
37
|
+
import type { getFirmwareUpdateCapabilities } from './firmwareUpdateCapabilities';
|
|
38
|
+
import type {
|
|
39
|
+
prepareFirmwareUpdatePlan,
|
|
40
|
+
validateFirmwareUpdatePreparedPlan,
|
|
41
|
+
} from './firmwareUpdatePreparedPlan';
|
|
36
42
|
import type { promptWebDeviceAccess } from './promptWebDeviceAccess';
|
|
37
43
|
import type { deviceReset } from './deviceReset';
|
|
38
44
|
import type { deviceRecovery } from './deviceRecovery';
|
|
@@ -146,7 +152,6 @@ import type { benfenSignMessage } from './benfenSignMessage';
|
|
|
146
152
|
import type { neoGetAddress } from './neoGetAddress';
|
|
147
153
|
import type { neoSignTransaction } from './neoSignTransaction';
|
|
148
154
|
import type { ConnectSettings } from '../settings';
|
|
149
|
-
import type { HardwareConnectProtocol } from '@onekeyfe/hd-shared';
|
|
150
155
|
|
|
151
156
|
export * from './export';
|
|
152
157
|
export type { DeviceStateScope, GetDeviceStateParams } from './getDeviceState';
|
|
@@ -171,14 +176,6 @@ export type CoreApi = {
|
|
|
171
176
|
removeAllListeners: typeof removeAllListeners;
|
|
172
177
|
dispose: () => void | Promise<void>;
|
|
173
178
|
call: (params: any) => Promise<any>;
|
|
174
|
-
/**
|
|
175
|
-
* Bind a protocol that has already been verified for one transport endpoint.
|
|
176
|
-
* Every later SDK call for the same connectId uses it as a strict expectation.
|
|
177
|
-
*/
|
|
178
|
-
setDeviceConnectProtocol: (
|
|
179
|
-
connectId: string,
|
|
180
|
-
connectProtocol: HardwareConnectProtocol | undefined
|
|
181
|
-
) => void;
|
|
182
179
|
uiResponse: typeof uiResponse;
|
|
183
180
|
cancel: (connectId?: string) => void;
|
|
184
181
|
updateSettings: typeof updateSettings;
|
|
@@ -206,7 +203,6 @@ export type CoreApi = {
|
|
|
206
203
|
* Device function
|
|
207
204
|
*/
|
|
208
205
|
searchDevices: typeof searchDevices;
|
|
209
|
-
detectDeviceConnectProtocol: typeof detectDeviceConnectProtocol;
|
|
210
206
|
promptWebDeviceAccess: typeof promptWebDeviceAccess;
|
|
211
207
|
getFeatures: typeof getFeatures;
|
|
212
208
|
getDeviceState: typeof getDeviceState;
|
|
@@ -239,6 +235,12 @@ export type CoreApi = {
|
|
|
239
235
|
firmwareUpdateV2: typeof firmwareUpdateV2;
|
|
240
236
|
firmwareUpdateV3: typeof firmwareUpdateV3;
|
|
241
237
|
firmwareUpdateV4: typeof firmwareUpdateV4;
|
|
238
|
+
registerFirmwareUpdateHostBinding: typeof registerFirmwareUpdateHostBinding;
|
|
239
|
+
unregisterFirmwareUpdateHostBinding: typeof unregisterFirmwareUpdateHostBinding;
|
|
240
|
+
getFirmwareUpdateHostBindingGeneration: typeof getFirmwareUpdateHostBindingGeneration;
|
|
241
|
+
getFirmwareUpdateCapabilities: typeof getFirmwareUpdateCapabilities;
|
|
242
|
+
prepareFirmwareUpdatePlan: typeof prepareFirmwareUpdatePlan;
|
|
243
|
+
validateFirmwareUpdatePreparedPlan: typeof validateFirmwareUpdatePreparedPlan;
|
|
242
244
|
cipherKeyValue: typeof cipherKeyValue;
|
|
243
245
|
|
|
244
246
|
/**
|
|
@@ -246,7 +248,6 @@ export type CoreApi = {
|
|
|
246
248
|
*/
|
|
247
249
|
deviceReboot: typeof deviceReboot;
|
|
248
250
|
deviceGetOnboardingStatus: typeof deviceGetOnboardingStatus;
|
|
249
|
-
deviceUploadNft: typeof deviceUploadNft;
|
|
250
251
|
deviceUploadWallpaper: typeof deviceUploadWallpaper;
|
|
251
252
|
uploadPortfolio: typeof uploadPortfolio;
|
|
252
253
|
|
|
@@ -5,10 +5,6 @@ import type {
|
|
|
5
5
|
DeviceUploadWallpaperParams,
|
|
6
6
|
DeviceUploadWallpaperResponse,
|
|
7
7
|
} from '../../api/protocol-v2/DeviceUploadWallpaper';
|
|
8
|
-
import type {
|
|
9
|
-
DeviceUploadNftParams,
|
|
10
|
-
DeviceUploadNftResponse,
|
|
11
|
-
} from '../../api/protocol-v2/DeviceUploadNft';
|
|
12
8
|
|
|
13
9
|
// Re-export implementation parameter types as the single source of truth.
|
|
14
10
|
export type { DeviceRebootParams, RebootTypeInput } from '../../api/protocol-v2/helpers';
|
|
@@ -16,10 +12,6 @@ export type {
|
|
|
16
12
|
DeviceUploadWallpaperParams,
|
|
17
13
|
DeviceUploadWallpaperResponse,
|
|
18
14
|
} from '../../api/protocol-v2/DeviceUploadWallpaper';
|
|
19
|
-
export type {
|
|
20
|
-
DeviceUploadNftParams,
|
|
21
|
-
DeviceUploadNftResponse,
|
|
22
|
-
} from '../../api/protocol-v2/DeviceUploadNft';
|
|
23
15
|
|
|
24
16
|
// ── Shared response shapes (Protocol V2 file system) ────────────────────
|
|
25
17
|
|
|
@@ -60,11 +52,6 @@ export declare function deviceUploadWallpaper(
|
|
|
60
52
|
params: CommonParams & DeviceUploadWallpaperParams
|
|
61
53
|
): Response<DeviceUploadWallpaperResponse>;
|
|
62
54
|
|
|
63
|
-
export declare function deviceUploadNft(
|
|
64
|
-
connectId: string,
|
|
65
|
-
params: CommonParams & DeviceUploadNftParams
|
|
66
|
-
): Response<DeviceUploadNftResponse>;
|
|
67
|
-
|
|
68
55
|
export declare function uploadPortfolio(
|
|
69
56
|
connectId: string,
|
|
70
57
|
params: {
|
package/src/types/device.ts
CHANGED
|
@@ -210,9 +210,7 @@ export type DeviceStateStatus = {
|
|
|
210
210
|
recoveryMode: boolean | null;
|
|
211
211
|
passphraseProtection: boolean | null;
|
|
212
212
|
pinProtection: boolean | null;
|
|
213
|
-
/** `attach_to_pin_enabled`:是否至少存在一个 Attach PIN 绑定。 */
|
|
214
213
|
attachToPinEnabled: boolean | null;
|
|
215
|
-
/** `unlocked_by_attach_to_pin`:本次解锁是否由 Attach PIN 完成。 */
|
|
216
214
|
unlockedAttachPin: boolean | null;
|
|
217
215
|
};
|
|
218
216
|
|
|
@@ -323,7 +321,6 @@ export type NormalizedFeatures = {
|
|
|
323
321
|
sdProtection: boolean | null;
|
|
324
322
|
wipeCodeProtection: boolean | null;
|
|
325
323
|
passphraseAlwaysOnDevice: boolean | null;
|
|
326
|
-
/** `attach_to_pin_enabled`:是否至少存在一个 Attach PIN 绑定。 */
|
|
327
324
|
attachToPinEnabled?: boolean | null;
|
|
328
325
|
safetyChecks: Enum_SafetyCheckLevel | null;
|
|
329
326
|
autoLockDelayMs: number | null;
|
|
@@ -374,21 +371,14 @@ export type IDeviceType =
|
|
|
374
371
|
| EDeviceType.Mini
|
|
375
372
|
| EDeviceType.Touch
|
|
376
373
|
| EDeviceType.Pro
|
|
377
|
-
| EDeviceType.Pro2
|
|
378
|
-
| EDeviceType.Neo;
|
|
374
|
+
| EDeviceType.Pro2;
|
|
379
375
|
|
|
380
376
|
/**
|
|
381
377
|
* model_classic: 'classic' | 'classic1s' | 'classicpure'
|
|
382
378
|
* model_mini: 'classic' | 'classic1s' | 'classicpure' | 'mini'
|
|
383
379
|
* model_touch: 'touch' | 'pro'
|
|
384
|
-
* model_pro2: 'pro2' | 'neo'
|
|
385
380
|
*/
|
|
386
|
-
export type IDeviceModel =
|
|
387
|
-
| 'model_classic'
|
|
388
|
-
| 'model_mini'
|
|
389
|
-
| 'model_touch'
|
|
390
|
-
| 'model_classic1s'
|
|
391
|
-
| 'model_pro2';
|
|
381
|
+
export type IDeviceModel = 'model_classic' | 'model_mini' | 'model_touch' | 'model_classic1s';
|
|
392
382
|
|
|
393
383
|
export const DeviceModelToTypes: { [deviceModel in IDeviceModel]: IDeviceType[] } = {
|
|
394
384
|
model_mini: [
|
|
@@ -398,7 +388,6 @@ export const DeviceModelToTypes: { [deviceModel in IDeviceModel]: IDeviceType[]
|
|
|
398
388
|
EDeviceType.Mini,
|
|
399
389
|
],
|
|
400
390
|
model_touch: [EDeviceType.Touch, EDeviceType.Pro],
|
|
401
|
-
model_pro2: [EDeviceType.Pro2, EDeviceType.Neo],
|
|
402
391
|
model_classic: [EDeviceType.Classic, EDeviceType.Classic1s, EDeviceType.ClassicPure],
|
|
403
392
|
model_classic1s: [EDeviceType.Classic1s, EDeviceType.ClassicPure],
|
|
404
393
|
};
|
|
@@ -410,8 +399,7 @@ export const DeviceTypeToModels: { [deviceType in IDeviceType]: IDeviceModel[] }
|
|
|
410
399
|
[EDeviceType.Mini]: ['model_mini'],
|
|
411
400
|
[EDeviceType.Touch]: ['model_touch'],
|
|
412
401
|
[EDeviceType.Pro]: ['model_touch'],
|
|
413
|
-
[EDeviceType.Pro2]: [
|
|
414
|
-
[EDeviceType.Neo]: ['model_pro2'],
|
|
402
|
+
[EDeviceType.Pro2]: [],
|
|
415
403
|
[EDeviceType.Unknown]: [],
|
|
416
404
|
};
|
|
417
405
|
|
package/src/types/params.ts
CHANGED
|
@@ -61,15 +61,9 @@ export interface CommonParams {
|
|
|
61
61
|
|
|
62
62
|
/**
|
|
63
63
|
* Strictly expected transport protocol. The SDK actively verifies this value and
|
|
64
|
-
* rejects a mismatch.
|
|
64
|
+
* rejects a mismatch. If omitted, a cached protocol only influences probe order.
|
|
65
65
|
*/
|
|
66
66
|
connectProtocol?: HardwareConnectProtocol;
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* Ignore a previously bound protocol for this call and actively detect the
|
|
70
|
-
* protocol again. Intended for the first verified connection or explicit recovery.
|
|
71
|
-
*/
|
|
72
|
-
forceProtocolDetection?: boolean;
|
|
73
67
|
}
|
|
74
68
|
|
|
75
69
|
export type Params<T> = CommonParams & T & { bundle?: undefined };
|
package/src/types/settings.ts
CHANGED
|
@@ -31,6 +31,8 @@ export type ConnectSettings = {
|
|
|
31
31
|
timestamp: number;
|
|
32
32
|
isFrame?: boolean;
|
|
33
33
|
preRelease?: boolean;
|
|
34
|
+
firmwareManifestMode?: 'sdk-managed' | 'external-only';
|
|
35
|
+
preloadedConfig?: RemoteConfigResponse;
|
|
34
36
|
fetchConfig?: boolean;
|
|
35
37
|
extension?: string;
|
|
36
38
|
configFetcher?: (url: string) => Promise<RemoteConfigResponse | null>;
|
|
@@ -58,58 +60,18 @@ export type IProtocolV2FirmwareComponent = {
|
|
|
58
60
|
fingerprint?: string;
|
|
59
61
|
/** OKPP payload hash, used to detect same-version package changes. */
|
|
60
62
|
payloadHash?: string;
|
|
63
|
+
expectedSize?: number;
|
|
61
64
|
version?: IVersionArray;
|
|
62
65
|
};
|
|
63
66
|
|
|
64
|
-
export type IProtocolV2ResourceType =
|
|
65
|
-
| 'images'
|
|
66
|
-
| 'animation'
|
|
67
|
-
| 'wallpaper'
|
|
68
|
-
| 'translations'
|
|
69
|
-
| 'roobert'
|
|
70
|
-
| 'noto';
|
|
71
|
-
|
|
72
|
-
/** Pro2 RES package descriptor. Hashes identify content without a human-managed version. */
|
|
73
|
-
export type IProtocolV2Resource = {
|
|
74
|
-
type: IProtocolV2ResourceType;
|
|
75
|
-
url: string;
|
|
76
|
-
/** Complete okpkg file size in bytes. */
|
|
77
|
-
size: number;
|
|
78
|
-
/** SHA-256 of the complete okpkg file. */
|
|
79
|
-
fileHash: string;
|
|
80
|
-
/** SHA3-512 header_hash from the signed okpkg header. */
|
|
81
|
-
headerHash: string;
|
|
82
|
-
};
|
|
83
|
-
|
|
84
|
-
/** A file from the Protocol V2 resource manifest, written directly with FileWrite. */
|
|
85
|
-
export type IProtocolV2ResourceFile = {
|
|
86
|
-
name?: string;
|
|
87
|
-
url: string;
|
|
88
|
-
devicePath: string;
|
|
89
|
-
size: number;
|
|
90
|
-
/** SHA-256 of the complete file. */
|
|
91
|
-
fileHash: string;
|
|
92
|
-
};
|
|
93
|
-
|
|
94
|
-
/** Optional Protocol V2 boot resources restored as individual files. */
|
|
95
|
-
export type IProtocolV2BootResources = {
|
|
96
|
-
required: false;
|
|
97
|
-
target: 'RES';
|
|
98
|
-
manifestUrl?: string;
|
|
99
|
-
files: IProtocolV2ResourceFile[];
|
|
100
|
-
};
|
|
101
|
-
|
|
102
|
-
export type IProtocolV2Resources = {
|
|
103
|
-
stable: IProtocolV2Resource[];
|
|
104
|
-
boot?: IProtocolV2BootResources;
|
|
105
|
-
};
|
|
106
|
-
|
|
107
67
|
/** Pro2 RESC bundle okpkg descriptor for incremental FileWrite synchronization. */
|
|
108
68
|
export type IProtocolV2ResourceBundle = {
|
|
109
69
|
/** Bundle name, such as images, animation, translations, or fonts_roobert. */
|
|
110
70
|
name: string;
|
|
111
71
|
/** Download URL. */
|
|
112
72
|
url: string;
|
|
73
|
+
fingerprint?: string;
|
|
74
|
+
expectedSize?: number;
|
|
113
75
|
/** Device target path, such as vol0:/bundles/images/images.okpkg. */
|
|
114
76
|
devicePath: string;
|
|
115
77
|
/** okpkg payload_version used to skip matching content after FileRead. */
|
|
@@ -131,10 +93,16 @@ export type IFirmwareReleaseInfo = {
|
|
|
131
93
|
firmwareType?: EFirmwareType;
|
|
132
94
|
/** Firmware UI resource */
|
|
133
95
|
resource?: string;
|
|
96
|
+
resourceFingerprint?: string;
|
|
97
|
+
resourceExpectedSize?: number;
|
|
134
98
|
/** Firmware full UI resource */
|
|
135
99
|
fullResource?: string;
|
|
100
|
+
fullResourceFingerprint?: string;
|
|
101
|
+
fullResourceExpectedSize?: number;
|
|
136
102
|
fullResourceRange?: string[];
|
|
137
103
|
bootloaderResource?: string;
|
|
104
|
+
bootloaderFingerprint?: string;
|
|
105
|
+
bootloaderExpectedSize?: number;
|
|
138
106
|
bootloaderVersion?: IVersionArray;
|
|
139
107
|
displayBootloaderVersion?: IVersionArray;
|
|
140
108
|
bootloaderRelatedFirmwareVersion?: IVersionArray;
|
|
@@ -147,6 +115,7 @@ export type IFirmwareReleaseInfo = {
|
|
|
147
115
|
[k in ILocale]: string;
|
|
148
116
|
};
|
|
149
117
|
fingerprint: string;
|
|
118
|
+
expectedSize?: number;
|
|
150
119
|
version: IVersionArray;
|
|
151
120
|
changelog: {
|
|
152
121
|
[k in ILocale]: string;
|
|
@@ -162,6 +131,7 @@ export type IBLEFirmwareReleaseInfo = {
|
|
|
162
131
|
webUpdate: string;
|
|
163
132
|
fingerprint: string;
|
|
164
133
|
fingerprintWeb: string;
|
|
134
|
+
expectedSize?: number;
|
|
165
135
|
version: IVersionArray;
|
|
166
136
|
changelog: {
|
|
167
137
|
[k in ILocale]: string;
|
|
@@ -169,25 +139,17 @@ export type IBLEFirmwareReleaseInfo = {
|
|
|
169
139
|
};
|
|
170
140
|
|
|
171
141
|
type IKnownDevice = Exclude<IDeviceType, 'unknown'>;
|
|
172
|
-
type ILegacyKnownDevice = Exclude<IKnownDevice, 'neo'>;
|
|
173
|
-
|
|
174
|
-
type IDeviceReleaseInfo = {
|
|
175
|
-
firmware: IFirmwareReleaseInfo[];
|
|
176
|
-
/** Protocol V2 payload package set */
|
|
177
|
-
'firmware-v1'?: IFirmwareReleaseInfo[];
|
|
178
|
-
'firmware-v2'?: IFirmwareReleaseInfo[];
|
|
179
|
-
'firmware-v8'?: IFirmwareReleaseInfo[];
|
|
180
|
-
'firmware-btc-v8'?: IFirmwareReleaseInfo[];
|
|
181
|
-
ble: IBLEFirmwareReleaseInfo[];
|
|
182
|
-
/** Independent Protocol V2 resource release configuration. */
|
|
183
|
-
resources?: IProtocolV2Resources;
|
|
184
|
-
};
|
|
185
142
|
|
|
186
143
|
export type DeviceTypeMap = {
|
|
187
|
-
[k in
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
144
|
+
[k in IKnownDevice]: {
|
|
145
|
+
firmware: IFirmwareReleaseInfo[];
|
|
146
|
+
/** Pro2 Protocol V2 payload package set */
|
|
147
|
+
'firmware-v1'?: IFirmwareReleaseInfo[];
|
|
148
|
+
'firmware-v2'?: IFirmwareReleaseInfo[];
|
|
149
|
+
'firmware-v8'?: IFirmwareReleaseInfo[];
|
|
150
|
+
'firmware-btc-v8'?: IFirmwareReleaseInfo[];
|
|
151
|
+
ble: IBLEFirmwareReleaseInfo[];
|
|
152
|
+
};
|
|
191
153
|
};
|
|
192
154
|
|
|
193
155
|
export type AssetsMap = {
|
|
@@ -37,6 +37,12 @@ export const resolveDeviceSerialNo = (features?: DeviceFeaturesInput): string =>
|
|
|
37
37
|
);
|
|
38
38
|
};
|
|
39
39
|
|
|
40
|
+
export const resolveDeviceBootloaderMode = (features?: DeviceFeaturesInput): boolean => {
|
|
41
|
+
if (!features) return false;
|
|
42
|
+
const compatible = asCompatibleFeatures(features);
|
|
43
|
+
return (compatible.bootloaderMode ?? compatible.bootloader_mode) === true;
|
|
44
|
+
};
|
|
45
|
+
|
|
40
46
|
export const resolveDeviceType = (features?: DeviceFeaturesInput): IDeviceType => {
|
|
41
47
|
if (!features || typeof features !== 'object') {
|
|
42
48
|
return EDeviceType.Unknown;
|
|
@@ -60,8 +66,6 @@ export const resolveDeviceType = (features?: DeviceFeaturesInput): IDeviceType =
|
|
|
60
66
|
return EDeviceType.Pro;
|
|
61
67
|
case 'PRO2':
|
|
62
68
|
return EDeviceType.Pro2;
|
|
63
|
-
case 'NEO':
|
|
64
|
-
return EDeviceType.Neo;
|
|
65
69
|
case 'PURE':
|
|
66
70
|
return EDeviceType.ClassicPure;
|
|
67
71
|
default:
|
|
@@ -71,9 +75,6 @@ export const resolveDeviceType = (features?: DeviceFeaturesInput): IDeviceType =
|
|
|
71
75
|
if (compatible.model?.toString().toLowerCase() === EDeviceType.Pro2) {
|
|
72
76
|
return EDeviceType.Pro2;
|
|
73
77
|
}
|
|
74
|
-
if (compatible.model?.toString().toLowerCase() === EDeviceType.Neo) {
|
|
75
|
-
return EDeviceType.Neo;
|
|
76
|
-
}
|
|
77
78
|
|
|
78
79
|
const serialNo = resolveDeviceSerialNo(features);
|
|
79
80
|
const prefix = serialNo.slice(0, 2).toLowerCase();
|
|
@@ -74,8 +74,7 @@ export const supportInputPinOnSoftware = (features?: Features): SupportFeatureTy
|
|
|
74
74
|
if (
|
|
75
75
|
deviceType === EDeviceType.Touch ||
|
|
76
76
|
deviceType === EDeviceType.Pro ||
|
|
77
|
-
deviceType === EDeviceType.Pro2
|
|
78
|
-
deviceType === EDeviceType.Neo
|
|
77
|
+
deviceType === EDeviceType.Pro2
|
|
79
78
|
) {
|
|
80
79
|
return { support: false };
|
|
81
80
|
}
|
|
@@ -91,8 +90,7 @@ export const supportNewPassphrase = (features?: Features): SupportFeatureType =>
|
|
|
91
90
|
if (
|
|
92
91
|
deviceType === EDeviceType.Touch ||
|
|
93
92
|
deviceType === EDeviceType.Pro ||
|
|
94
|
-
deviceType === EDeviceType.Pro2
|
|
95
|
-
deviceType === EDeviceType.Neo
|
|
93
|
+
deviceType === EDeviceType.Pro2
|
|
96
94
|
) {
|
|
97
95
|
return { support: true };
|
|
98
96
|
}
|
|
@@ -108,8 +106,6 @@ export const getPassphraseStateWithRefreshDeviceInfo = async (
|
|
|
108
106
|
expectPassphraseState?: string;
|
|
109
107
|
onlyMainPin?: boolean;
|
|
110
108
|
initSession?: boolean;
|
|
111
|
-
deriveCardano?: boolean;
|
|
112
|
-
rejectAttachPinForMainWallet?: boolean;
|
|
113
109
|
}
|
|
114
110
|
) => {
|
|
115
111
|
if (device.isProtocolV2()) {
|
|
@@ -125,8 +121,6 @@ export const getPassphraseStateWithRefreshDeviceInfo = async (
|
|
|
125
121
|
initSession: options?.initSession,
|
|
126
122
|
expectedPassphraseState: options?.expectPassphraseState,
|
|
127
123
|
onlyMainPin: options?.onlyMainPin,
|
|
128
|
-
deriveCardano: options?.deriveCardano,
|
|
129
|
-
rejectAttachPinForMainWallet: options?.rejectAttachPinForMainWallet,
|
|
130
124
|
});
|
|
131
125
|
}
|
|
132
126
|
|
|
@@ -145,8 +139,7 @@ export const getPassphraseStateWithRefreshDeviceInfo = async (
|
|
|
145
139
|
const isModeT =
|
|
146
140
|
deviceType === EDeviceType.Touch ||
|
|
147
141
|
deviceType === EDeviceType.Pro ||
|
|
148
|
-
deviceType === EDeviceType.Pro2
|
|
149
|
-
deviceType === EDeviceType.Neo;
|
|
142
|
+
deviceType === EDeviceType.Pro2;
|
|
150
143
|
|
|
151
144
|
// 如果可以获取到 passphraseState,但是设备 features 显示设备未开启 passphrase,需要刷新设备状态
|
|
152
145
|
// if passphraseState can be obtained, but the device features show that the device has not enabled passphrase, the device status needs to be refreshed
|
|
@@ -192,8 +185,6 @@ export const getPassphraseState = async (
|
|
|
192
185
|
expectPassphraseState?: string;
|
|
193
186
|
onlyMainPin?: boolean;
|
|
194
187
|
initSession?: boolean;
|
|
195
|
-
deriveCardano?: boolean;
|
|
196
|
-
rejectAttachPinForMainWallet?: boolean;
|
|
197
188
|
}
|
|
198
189
|
): Promise<{
|
|
199
190
|
passphraseState: string | undefined;
|
|
@@ -214,8 +205,6 @@ export const getPassphraseState = async (
|
|
|
214
205
|
initSession: options?.initSession,
|
|
215
206
|
expectedPassphraseState: options?.expectPassphraseState,
|
|
216
207
|
onlyMainPin: options?.onlyMainPin,
|
|
217
|
-
deriveCardano: options?.deriveCardano,
|
|
218
|
-
rejectAttachPinForMainWallet: options?.rejectAttachPinForMainWallet,
|
|
219
208
|
});
|
|
220
209
|
}
|
|
221
210
|
|
|
@@ -31,7 +31,6 @@ export const getDeviceTypeByBleName = (name?: string): IDeviceType => {
|
|
|
31
31
|
if (/^Touch/i.test(name)) return EDeviceType.Touch;
|
|
32
32
|
|
|
33
33
|
if (/\bPro\s*2\b/i.test(name) || /^Pro2/i.test(name)) return EDeviceType.Pro2;
|
|
34
|
-
if (/\bNeo\b/i.test(name) || /^Neo/i.test(name)) return EDeviceType.Neo;
|
|
35
34
|
if (/\bPro\b/i.test(name) || /^Pro/i.test(name)) return EDeviceType.Pro;
|
|
36
35
|
|
|
37
36
|
return EDeviceType.Unknown;
|
|
@@ -94,7 +93,6 @@ export const getMethodVersionRange = (
|
|
|
94
93
|
}
|
|
95
94
|
|
|
96
95
|
const modelFallbacks: IDeviceModel[] = [
|
|
97
|
-
'model_pro2',
|
|
98
96
|
'model_classic1s',
|
|
99
97
|
'model_classic',
|
|
100
98
|
'model_mini',
|
|
@@ -127,7 +127,6 @@ export const getLanguageConfig = (deviceType: IDeviceType): Record<string, strin
|
|
|
127
127
|
keys = Object.keys(LANGUAGE_LABELS) as LanguageKey[];
|
|
128
128
|
break;
|
|
129
129
|
case EDeviceType.Pro2:
|
|
130
|
-
case EDeviceType.Neo:
|
|
131
130
|
return PRO2_LANGUAGE_OPTIONS.map(option => ({ ...option }));
|
|
132
131
|
default:
|
|
133
132
|
keys = [];
|
|
@@ -177,7 +176,6 @@ export const getAutoLockOptions = (
|
|
|
177
176
|
case EDeviceType.Touch:
|
|
178
177
|
case EDeviceType.Pro:
|
|
179
178
|
case EDeviceType.Pro2:
|
|
180
|
-
case EDeviceType.Neo:
|
|
181
179
|
return withNever([30_000, 60_000, 120_000, 300_000, 600_000, 1_800_000], protocol);
|
|
182
180
|
default:
|
|
183
181
|
return [];
|
|
@@ -199,7 +197,6 @@ export const getAutoShutDownOptions = (
|
|
|
199
197
|
case EDeviceType.Pro:
|
|
200
198
|
return withNever([60_000, 120_000, 300_000, 600_000], protocol);
|
|
201
199
|
case EDeviceType.Pro2:
|
|
202
|
-
case EDeviceType.Neo:
|
|
203
200
|
return withNever([60_000, 120_000, 300_000, 600_000, 1_800_000], protocol);
|
|
204
201
|
default:
|
|
205
202
|
return [];
|
package/src/utils/homescreen.ts
CHANGED
|
@@ -4,12 +4,6 @@ import { EDeviceType } from '@onekeyfe/hd-shared';
|
|
|
4
4
|
import { getDeviceType } from './deviceInfoUtils';
|
|
5
5
|
import { getDeviceFirmwareVersion } from './deviceVersionUtils';
|
|
6
6
|
import { PRO2_WALLPAPER_HEIGHT, PRO2_WALLPAPER_WIDTH } from './pro2Wallpaper';
|
|
7
|
-
import {
|
|
8
|
-
PRO2_NFT_IMAGE_HEIGHT,
|
|
9
|
-
PRO2_NFT_IMAGE_WIDTH,
|
|
10
|
-
PRO2_NFT_THUMBNAIL_HEIGHT,
|
|
11
|
-
PRO2_NFT_THUMBNAIL_WIDTH,
|
|
12
|
-
} from './pro2Nft';
|
|
13
7
|
|
|
14
8
|
import type { Features, IDeviceType } from '../types';
|
|
15
9
|
|
|
@@ -308,31 +302,6 @@ type SizeConfig = {
|
|
|
308
302
|
radius?: number;
|
|
309
303
|
};
|
|
310
304
|
|
|
311
|
-
export const getNftSize = ({
|
|
312
|
-
deviceType,
|
|
313
|
-
thumbnail,
|
|
314
|
-
}: {
|
|
315
|
-
deviceType: IDeviceType;
|
|
316
|
-
thumbnail?: boolean;
|
|
317
|
-
}): SizeConfig | undefined => {
|
|
318
|
-
const sizes: Partial<Record<IDeviceType, { full: SizeConfig; thumbnail: SizeConfig }>> = {
|
|
319
|
-
touch: {
|
|
320
|
-
full: { width: 480, height: 800 },
|
|
321
|
-
thumbnail: { width: 238, height: 238 },
|
|
322
|
-
},
|
|
323
|
-
pro: {
|
|
324
|
-
full: { width: 480, height: 800 },
|
|
325
|
-
thumbnail: { width: 226, height: 226, radius: 40 },
|
|
326
|
-
},
|
|
327
|
-
pro2: {
|
|
328
|
-
full: { width: PRO2_NFT_IMAGE_WIDTH, height: PRO2_NFT_IMAGE_HEIGHT },
|
|
329
|
-
thumbnail: { width: PRO2_NFT_THUMBNAIL_WIDTH, height: PRO2_NFT_THUMBNAIL_HEIGHT },
|
|
330
|
-
},
|
|
331
|
-
};
|
|
332
|
-
|
|
333
|
-
return sizes[deviceType]?.[thumbnail ? 'thumbnail' : 'full'];
|
|
334
|
-
};
|
|
335
|
-
|
|
336
305
|
export const getHomeScreenSize = ({
|
|
337
306
|
deviceType,
|
|
338
307
|
homeScreenType,
|
|
@@ -343,7 +312,12 @@ export const getHomeScreenSize = ({
|
|
|
343
312
|
thumbnail?: boolean;
|
|
344
313
|
}) => {
|
|
345
314
|
if (deviceType === EDeviceType.Pro2) {
|
|
346
|
-
return thumbnail
|
|
315
|
+
return thumbnail
|
|
316
|
+
? undefined
|
|
317
|
+
: {
|
|
318
|
+
width: PRO2_WALLPAPER_WIDTH,
|
|
319
|
+
height: PRO2_WALLPAPER_HEIGHT,
|
|
320
|
+
};
|
|
347
321
|
}
|
|
348
322
|
|
|
349
323
|
const sizes: Partial<
|
package/src/utils/index.ts
CHANGED
|
@@ -54,12 +54,7 @@ export { getHDPath, getScriptType, getOutputScriptType } from '../api/helpers/pa
|
|
|
54
54
|
|
|
55
55
|
export const isBleConnect = (env: string) => env === 'react-native' || env === 'lowlevel';
|
|
56
56
|
|
|
57
|
-
export {
|
|
58
|
-
getHomeScreenHex,
|
|
59
|
-
getHomeScreenDefaultList,
|
|
60
|
-
getHomeScreenSize,
|
|
61
|
-
getNftSize,
|
|
62
|
-
} from './homescreen';
|
|
57
|
+
export { getHomeScreenHex, getHomeScreenDefaultList, getHomeScreenSize } from './homescreen';
|
|
63
58
|
export { encodePro2Wallpaper, PRO2_WALLPAPER_HEIGHT, PRO2_WALLPAPER_WIDTH } from './pro2Wallpaper';
|
|
64
59
|
export type { Pro2WallpaperColorFormat } from './pro2Wallpaper';
|
|
65
60
|
|