@onekeyfe/hd-core 1.1.26-alpha.9 → 1.1.27-alpha.30
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__/protocol-v2.test.ts +940 -0
- package/dist/api/BaseMethod.d.ts.map +1 -1
- package/dist/api/DirList.d.ts +10 -0
- package/dist/api/DirList.d.ts.map +1 -0
- package/dist/api/DirMake.d.ts +9 -0
- package/dist/api/DirMake.d.ts.map +1 -0
- package/dist/api/DirRemove.d.ts +9 -0
- package/dist/api/DirRemove.d.ts.map +1 -0
- package/dist/api/FileDelete.d.ts +9 -0
- package/dist/api/FileDelete.d.ts.map +1 -0
- package/dist/api/FileRead.d.ts +19 -0
- package/dist/api/FileRead.d.ts.map +1 -0
- package/dist/api/FileWrite.d.ts +23 -0
- package/dist/api/FileWrite.d.ts.map +1 -0
- package/dist/api/FirmwareUpdateV3.d.ts +1 -0
- package/dist/api/FirmwareUpdateV3.d.ts.map +1 -1
- package/dist/api/FirmwareUpdateV4.d.ts +32 -0
- package/dist/api/FirmwareUpdateV4.d.ts.map +1 -0
- package/dist/api/GetOnekeyFeatures.d.ts.map +1 -1
- package/dist/api/PathInfo.d.ts +9 -0
- package/dist/api/PathInfo.d.ts.map +1 -0
- package/dist/api/SearchDevices.d.ts +2 -1
- package/dist/api/SearchDevices.d.ts.map +1 -1
- package/dist/api/alephium/AlephiumSignTransaction.d.ts +1 -1
- package/dist/api/alephium/AlephiumSignTransaction.d.ts.map +1 -1
- package/dist/api/allnetwork/AllNetworkGetAddressBase.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/firmware/FirmwareUpdateBaseMethod.d.ts +10 -2
- package/dist/api/firmware/FirmwareUpdateBaseMethod.d.ts.map +1 -1
- package/dist/api/index.d.ts +26 -0
- package/dist/api/index.d.ts.map +1 -1
- package/dist/api/protocol-v2/DevFirmwareUpdate.d.ts +7 -0
- package/dist/api/protocol-v2/DevFirmwareUpdate.d.ts.map +1 -0
- package/dist/api/protocol-v2/DevGetDeviceInfo.d.ts +7 -0
- package/dist/api/protocol-v2/DevGetDeviceInfo.d.ts.map +1 -0
- package/dist/api/protocol-v2/DevGetFirmwareUpdateStatus.d.ts +6 -0
- package/dist/api/protocol-v2/DevGetFirmwareUpdateStatus.d.ts.map +1 -0
- package/dist/api/protocol-v2/DevGetOnboardingStatus.d.ts +6 -0
- package/dist/api/protocol-v2/DevGetOnboardingStatus.d.ts.map +1 -0
- package/dist/api/protocol-v2/DevReboot.d.ts +7 -0
- package/dist/api/protocol-v2/DevReboot.d.ts.map +1 -0
- package/dist/api/protocol-v2/FactoryDeviceInfoSettings.d.ts +7 -0
- package/dist/api/protocol-v2/FactoryDeviceInfoSettings.d.ts.map +1 -0
- package/dist/api/protocol-v2/FactoryGetDeviceInfo.d.ts +6 -0
- package/dist/api/protocol-v2/FactoryGetDeviceInfo.d.ts.map +1 -0
- package/dist/api/protocol-v2/FilesystemFixPermission.d.ts +6 -0
- package/dist/api/protocol-v2/FilesystemFixPermission.d.ts.map +1 -0
- package/dist/api/protocol-v2/FilesystemFormat.d.ts +6 -0
- package/dist/api/protocol-v2/FilesystemFormat.d.ts.map +1 -0
- package/dist/api/protocol-v2/GetProtoVersion.d.ts +6 -0
- package/dist/api/protocol-v2/GetProtoVersion.d.ts.map +1 -0
- package/dist/api/protocol-v2/Ping.d.ts +8 -0
- package/dist/api/protocol-v2/Ping.d.ts.map +1 -0
- package/dist/api/protocol-v2/helpers.d.ts +49 -0
- package/dist/api/protocol-v2/helpers.d.ts.map +1 -0
- package/dist/api/ton/TonSignData.d.ts.map +1 -1
- package/dist/core/index.d.ts.map +1 -1
- package/dist/data-manager/DataManager.d.ts +4 -2
- package/dist/data-manager/DataManager.d.ts.map +1 -1
- package/dist/data-manager/TransportManager.d.ts +2 -1
- package/dist/data-manager/TransportManager.d.ts.map +1 -1
- package/dist/device/Device.d.ts +5 -3
- package/dist/device/Device.d.ts.map +1 -1
- package/dist/device/DeviceCommands.d.ts +8 -8
- package/dist/device/DeviceCommands.d.ts.map +1 -1
- package/dist/device/DeviceConnector.d.ts +2 -1
- package/dist/device/DeviceConnector.d.ts.map +1 -1
- package/dist/events/ui-request.d.ts +8 -0
- package/dist/events/ui-request.d.ts.map +1 -1
- package/dist/index.d.ts +188 -20
- package/dist/index.js +15627 -699
- package/dist/inject.d.ts.map +1 -1
- package/dist/protocols/protocol-v2/features.d.ts +56 -0
- package/dist/protocols/protocol-v2/features.d.ts.map +1 -0
- package/dist/protocols/protocol-v2/firmware.d.ts +12 -0
- package/dist/protocols/protocol-v2/firmware.d.ts.map +1 -0
- package/dist/protocols/protocol-v2/index.d.ts +3 -0
- package/dist/protocols/protocol-v2/index.d.ts.map +1 -0
- package/dist/types/api/export.d.ts +1 -1
- package/dist/types/api/export.d.ts.map +1 -1
- package/dist/types/api/firmwareUpdate.d.ts +7 -0
- package/dist/types/api/firmwareUpdate.d.ts.map +1 -1
- package/dist/types/api/index.d.ts +28 -1
- package/dist/types/api/index.d.ts.map +1 -1
- package/dist/types/api/protocolV2.d.ts +123 -0
- package/dist/types/api/protocolV2.d.ts.map +1 -0
- package/dist/types/api/searchDevices.d.ts +2 -2
- package/dist/types/api/searchDevices.d.ts.map +1 -1
- package/dist/types/device.d.ts +1 -1
- package/dist/types/device.d.ts.map +1 -1
- package/dist/types/params.d.ts +2 -0
- package/dist/types/params.d.ts.map +1 -1
- package/dist/types/settings.d.ts +1 -1
- package/dist/types/settings.d.ts.map +1 -1
- package/dist/utils/deviceInfoUtils.d.ts +1 -0
- package/dist/utils/deviceInfoUtils.d.ts.map +1 -1
- package/dist/utils/index.d.ts +1 -1
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/patch.d.ts +1 -1
- package/dist/utils/patch.d.ts.map +1 -1
- package/dist/utils/versionUtils.d.ts +1 -1
- package/package.json +5 -5
- package/src/api/BaseMethod.ts +10 -0
- package/src/api/DirList.ts +25 -0
- package/src/api/DirMake.ts +20 -0
- package/src/api/DirRemove.ts +20 -0
- package/src/api/FileDelete.ts +20 -0
- package/src/api/FileRead.ts +158 -0
- package/src/api/FileWrite.ts +191 -0
- package/src/api/FirmwareUpdateV3.ts +21 -4
- package/src/api/FirmwareUpdateV4.ts +810 -0
- package/src/api/GetOnekeyFeatures.ts +75 -3
- package/src/api/PathInfo.ts +24 -0
- package/src/api/SearchDevices.ts +7 -2
- package/src/api/alephium/AlephiumSignTransaction.ts +6 -5
- package/src/api/allnetwork/AllNetworkGetAddressBase.ts +10 -1
- package/src/api/device/DeviceRebootToBoardloader.ts +10 -1
- package/src/api/device/DeviceRebootToBootloader.ts +10 -1
- package/src/api/firmware/FirmwareUpdateBaseMethod.ts +27 -4
- package/src/api/index.ts +28 -0
- package/src/api/protocol-v2/DevFirmwareUpdate.ts +33 -0
- package/src/api/protocol-v2/DevGetDeviceInfo.ts +35 -0
- package/src/api/protocol-v2/DevGetFirmwareUpdateStatus.ts +18 -0
- package/src/api/protocol-v2/DevGetOnboardingStatus.ts +18 -0
- package/src/api/protocol-v2/DevReboot.ts +22 -0
- package/src/api/protocol-v2/FactoryDeviceInfoSettings.ts +27 -0
- package/src/api/protocol-v2/FactoryGetDeviceInfo.ts +18 -0
- package/src/api/protocol-v2/FilesystemFixPermission.ts +14 -0
- package/src/api/protocol-v2/FilesystemFormat.ts +14 -0
- package/src/api/protocol-v2/GetProtoVersion.ts +14 -0
- package/src/api/protocol-v2/Ping.ts +16 -0
- package/src/api/protocol-v2/helpers.ts +138 -0
- package/src/api/ton/TonSignData.ts +4 -1
- package/src/core/index.ts +26 -4
- package/src/data/messages/messages-pro2.json +13102 -0
- package/src/data-manager/DataManager.ts +6 -2
- package/src/data-manager/TransportManager.ts +29 -3
- package/src/device/Device.ts +68 -8
- package/src/device/DeviceCommands.ts +162 -26
- package/src/device/DeviceConnector.ts +29 -4
- package/src/device/DevicePool.ts +1 -1
- package/src/events/ui-request.ts +8 -0
- package/src/inject.ts +42 -1
- package/src/protocols/protocol-v2/features.ts +266 -0
- package/src/protocols/protocol-v2/firmware.ts +26 -0
- package/src/protocols/protocol-v2/index.ts +2 -0
- package/src/types/api/export.ts +1 -0
- package/src/types/api/firmwareUpdate.ts +12 -0
- package/src/types/api/index.ts +63 -1
- package/src/types/api/protocolV2.ts +221 -0
- package/src/types/api/searchDevices.ts +2 -2
- package/src/types/device.ts +3 -1
- package/src/types/params.ts +7 -0
- package/src/types/settings.ts +1 -1
- package/src/utils/deviceInfoUtils.ts +14 -5
- package/src/utils/index.ts +1 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { SearchDevice } from '../device';
|
|
2
|
-
import type { Response } from '../params';
|
|
2
|
+
import type { CommonParams, Response } from '../params';
|
|
3
3
|
|
|
4
|
-
export declare function searchDevices(): Response<SearchDevice[]>;
|
|
4
|
+
export declare function searchDevices(params?: CommonParams): Response<SearchDevice[]>;
|
package/src/types/device.ts
CHANGED
|
@@ -96,7 +96,8 @@ export type IDeviceType =
|
|
|
96
96
|
| EDeviceType.ClassicPure
|
|
97
97
|
| EDeviceType.Mini
|
|
98
98
|
| EDeviceType.Touch
|
|
99
|
-
| EDeviceType.Pro
|
|
99
|
+
| EDeviceType.Pro
|
|
100
|
+
| EDeviceType.Pro2;
|
|
100
101
|
|
|
101
102
|
/**
|
|
102
103
|
* model_classic: 'classic' | 'classic1s' | 'classicpure'
|
|
@@ -124,6 +125,7 @@ export const DeviceTypeToModels: { [deviceType in IDeviceType]: IDeviceModel[] }
|
|
|
124
125
|
[EDeviceType.Mini]: ['model_mini'],
|
|
125
126
|
[EDeviceType.Touch]: ['model_touch'],
|
|
126
127
|
[EDeviceType.Pro]: ['model_touch'],
|
|
128
|
+
[EDeviceType.Pro2]: [],
|
|
127
129
|
[EDeviceType.Unknown]: [],
|
|
128
130
|
};
|
|
129
131
|
|
package/src/types/params.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { HardwareConnectProtocol } from '@onekeyfe/hd-shared';
|
|
2
|
+
|
|
1
3
|
export interface CommonParams {
|
|
2
4
|
keepSession?: boolean;
|
|
3
5
|
/**
|
|
@@ -47,6 +49,11 @@ export interface CommonParams {
|
|
|
47
49
|
* Only connect device, not initialize device, only ble connect
|
|
48
50
|
*/
|
|
49
51
|
onlyConnectBleDevice?: boolean;
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Expected transport protocol. If omitted, SDK probes Protocol V1 then Protocol V2.
|
|
55
|
+
*/
|
|
56
|
+
connectProtocol?: HardwareConnectProtocol;
|
|
50
57
|
}
|
|
51
58
|
|
|
52
59
|
export type Params<T> = CommonParams & T & { bundle?: undefined };
|
package/src/types/settings.ts
CHANGED
|
@@ -27,6 +27,9 @@ export const getDeviceType = (features?: Features): IDeviceType => {
|
|
|
27
27
|
return EDeviceType.Touch;
|
|
28
28
|
case 'PRO':
|
|
29
29
|
return EDeviceType.Pro;
|
|
30
|
+
case 'PRO2':
|
|
31
|
+
case 'pro2':
|
|
32
|
+
return EDeviceType.Pro2;
|
|
30
33
|
case 'PURE':
|
|
31
34
|
return EDeviceType.ClassicPure;
|
|
32
35
|
default:
|
|
@@ -68,13 +71,14 @@ export const getDeviceType = (features?: Features): IDeviceType => {
|
|
|
68
71
|
export const getDeviceTypeByBleName = (name?: string): IDeviceType => {
|
|
69
72
|
if (!name) return EDeviceType.Unknown;
|
|
70
73
|
|
|
71
|
-
if (
|
|
72
|
-
if (
|
|
74
|
+
if (/^BixinKey/i.test(name)) return EDeviceType.Classic;
|
|
75
|
+
if (/^K/i.test(name)) return EDeviceType.Classic;
|
|
73
76
|
|
|
74
|
-
if (
|
|
75
|
-
if (
|
|
77
|
+
if (/^T/i.test(name)) return EDeviceType.Touch;
|
|
78
|
+
if (/^Touch/i.test(name)) return EDeviceType.Touch;
|
|
76
79
|
|
|
77
|
-
if (name.
|
|
80
|
+
if (/\bPro\s*2\b/i.test(name) || /^Pro2/i.test(name)) return EDeviceType.Pro2;
|
|
81
|
+
if (/\bPro\b/i.test(name) || /^Pro/i.test(name)) return EDeviceType.Pro;
|
|
78
82
|
|
|
79
83
|
return EDeviceType.Unknown;
|
|
80
84
|
};
|
|
@@ -152,6 +156,11 @@ export const getMethodVersionRange = (
|
|
|
152
156
|
return versionRange;
|
|
153
157
|
};
|
|
154
158
|
|
|
159
|
+
export const shouldSkipMethodSupportCheck = (
|
|
160
|
+
features: Features | undefined,
|
|
161
|
+
protocolType?: string
|
|
162
|
+
): boolean => protocolType === 'V2' || getDeviceType(features) === EDeviceType.Pro2;
|
|
163
|
+
|
|
155
164
|
export const getFirmwareType = (features: Features | undefined) => {
|
|
156
165
|
if (!features) {
|
|
157
166
|
return EFirmwareType.Universal;
|