@onekeyfe/hd-core 1.2.0-alpha.1 → 1.2.0-alpha.10
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__/connectSettings.test.ts +19 -0
- package/__tests__/device-wallet-session-store.test.ts +131 -0
- package/__tests__/preInitialize.test.ts +33 -0
- package/__tests__/protocol-v2-firmware-targets.test.ts +19 -0
- package/__tests__/protocol-v2.test.ts +1784 -502
- package/dist/api/ClearSessionCache.d.ts +9 -0
- package/dist/api/ClearSessionCache.d.ts.map +1 -0
- package/dist/api/FileRead.d.ts.map +1 -1
- package/dist/api/FileWrite.d.ts.map +1 -1
- package/dist/api/FirmwareUpdateV4.d.ts +24 -3
- package/dist/api/FirmwareUpdateV4.d.ts.map +1 -1
- package/dist/api/GetPassphraseState.d.ts.map +1 -1
- package/dist/api/firmware/FirmwareUpdateBaseMethod.d.ts +1 -0
- package/dist/api/firmware/FirmwareUpdateBaseMethod.d.ts.map +1 -1
- package/dist/api/firmware/getBinary.d.ts +4 -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/index.d.ts +8 -10
- package/dist/api/index.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 +1 -1
- package/dist/api/protocol-v2/DeviceFirmwareUpdate.d.ts.map +1 -1
- package/dist/api/protocol-v2/DeviceGetFirmwareUpdateStatus.d.ts +3 -2
- package/dist/api/protocol-v2/DeviceGetFirmwareUpdateStatus.d.ts.map +1 -1
- package/dist/api/protocol-v2/{DeviceGetDeviceInfo.d.ts → DeviceInfoGet.d.ts} +10 -10
- package/dist/api/protocol-v2/DeviceInfoGet.d.ts.map +1 -0
- package/dist/api/protocol-v2/DeviceSessionGet.d.ts +9 -0
- package/dist/api/protocol-v2/DeviceSessionGet.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/FilesystemFormat.d.ts.map +1 -1
- package/dist/api/protocol-v2/{FilesystemFixPermission.d.ts → FilesystemPermissionFix.d.ts} +2 -2
- package/dist/api/protocol-v2/FilesystemPermissionFix.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 +27 -18
- package/dist/api/protocol-v2/helpers.d.ts.map +1 -1
- package/dist/api/ton/TonSignData.d.ts +1 -5
- package/dist/api/ton/TonSignData.d.ts.map +1 -1
- package/dist/api/tron/TronSignMessage.d.ts +0 -1
- package/dist/api/tron/TronSignMessage.d.ts.map +1 -1
- package/dist/api/tron/TronSignTransaction.d.ts +0 -1
- package/dist/api/tron/TronSignTransaction.d.ts.map +1 -1
- package/dist/core/index.d.ts.map +1 -1
- package/dist/data-manager/DataManager.d.ts +1 -1
- package/dist/data-manager/DataManager.d.ts.map +1 -1
- package/dist/data-manager/connectSettings.d.ts.map +1 -1
- package/dist/device/Device.d.ts +6 -3
- package/dist/device/Device.d.ts.map +1 -1
- package/dist/device/DeviceWalletSessionStore.d.ts +15 -0
- package/dist/device/DeviceWalletSessionStore.d.ts.map +1 -0
- package/dist/deviceProfile/buildDeviceFeatures.d.ts.map +1 -1
- package/dist/deviceProfile/buildDeviceProfile.d.ts.map +1 -1
- package/dist/index.d.ts +96 -55
- package/dist/index.js +2077 -1609
- package/dist/inject.d.ts.map +1 -1
- package/dist/protocols/protocol-v2/features.d.ts +12 -14
- package/dist/protocols/protocol-v2/features.d.ts.map +1 -1
- package/dist/protocols/protocol-v2/firmware.d.ts +11 -9
- package/dist/protocols/protocol-v2/firmware.d.ts.map +1 -1
- package/dist/protocols/protocol-v2/index.d.ts +1 -0
- package/dist/protocols/protocol-v2/index.d.ts.map +1 -1
- package/dist/protocols/protocol-v2/walletSession.d.ts +13 -0
- package/dist/protocols/protocol-v2/walletSession.d.ts.map +1 -0
- package/dist/types/api/firmwareUpdate.d.ts +4 -6
- package/dist/types/api/firmwareUpdate.d.ts.map +1 -1
- package/dist/types/api/getDeviceInfo.d.ts +2 -0
- package/dist/types/api/getDeviceInfo.d.ts.map +1 -1
- package/dist/types/api/index.d.ts +11 -11
- package/dist/types/api/index.d.ts.map +1 -1
- package/dist/types/api/protocolV2.d.ts +16 -17
- package/dist/types/api/protocolV2.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 +1 -0
- package/dist/types/device.d.ts.map +1 -1
- package/dist/types/params.d.ts +1 -0
- package/dist/types/params.d.ts.map +1 -1
- package/dist/types/settings.d.ts +21 -2
- package/dist/types/settings.d.ts.map +1 -1
- package/dist/utils/deviceFeaturesUtils.d.ts +2 -0
- package/dist/utils/deviceFeaturesUtils.d.ts.map +1 -1
- package/dist/utils/patch.d.ts +1 -1
- package/dist/utils/patch.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/api/ClearSessionCache.ts +28 -0
- package/src/api/FileRead.ts +16 -3
- package/src/api/FileWrite.ts +14 -1
- package/src/api/FirmwareUpdateV4.ts +1075 -264
- package/src/api/GetOnekeyFeatures.ts +1 -1
- package/src/api/GetPassphraseState.ts +4 -1
- package/src/api/device/DeviceRebootToBoardloader.ts +4 -4
- package/src/api/device/DeviceRebootToBootloader.ts +4 -4
- package/src/api/firmware/FirmwareUpdateBaseMethod.ts +18 -4
- package/src/api/firmware/progressThrottle.ts +44 -0
- package/src/api/index.ts +8 -10
- package/src/api/protocol-v2/{FactoryGetDeviceInfo.ts → DeviceFactoryInfoGet.ts} +3 -3
- package/src/api/protocol-v2/DeviceFactoryInfoSet.ts +32 -0
- package/src/api/protocol-v2/DeviceFirmwareUpdate.ts +3 -5
- package/src/api/protocol-v2/DeviceGetFirmwareUpdateStatus.ts +39 -5
- package/src/api/protocol-v2/{DeviceGetDeviceInfo.ts → DeviceInfoGet.ts} +52 -22
- package/src/api/protocol-v2/DeviceReboot.ts +1 -1
- package/src/api/protocol-v2/DeviceSessionGet.ts +26 -0
- package/src/api/protocol-v2/DeviceStatusGet.ts +14 -0
- package/src/api/protocol-v2/FilesystemFormat.ts +4 -1
- package/src/api/protocol-v2/{FilesystemFixPermission.ts → FilesystemPermissionFix.ts} +2 -2
- package/src/api/protocol-v2/{GetProtoVersion.ts → ProtocolInfoRequest.ts} +2 -2
- package/src/api/protocol-v2/helpers.ts +71 -47
- package/src/api/ton/TonSignData.ts +1 -5
- package/src/api/tron/TronSignMessage.ts +0 -1
- package/src/api/tron/TronSignTransaction.ts +0 -1
- package/src/core/index.ts +19 -5
- package/src/data/messages/messages-protocol-v2.json +599 -1033
- package/src/data/messages/messages.json +8 -0
- package/src/data-manager/DataManager.ts +7 -0
- package/src/data-manager/connectSettings.ts +2 -4
- package/src/device/Device.ts +89 -70
- package/src/device/DeviceWalletSessionStore.ts +78 -0
- package/src/deviceProfile/buildDeviceFeatures.ts +60 -63
- package/src/deviceProfile/buildDeviceProfile.ts +77 -58
- package/src/inject.ts +13 -16
- package/src/protocols/protocol-v2/features.ts +26 -63
- package/src/protocols/protocol-v2/firmware.ts +12 -36
- package/src/protocols/protocol-v2/index.ts +1 -0
- package/src/protocols/protocol-v2/walletSession.ts +83 -0
- package/src/types/api/firmwareUpdate.ts +16 -20
- package/src/types/api/getDeviceInfo.ts +2 -0
- package/src/types/api/index.ts +17 -20
- package/src/types/api/protocolV2.ts +36 -40
- package/src/types/api/sessionCache.ts +14 -0
- package/src/types/device.ts +1 -0
- package/src/types/params.ts +4 -0
- package/src/types/settings.ts +42 -35
- package/src/utils/deviceFeaturesUtils.ts +44 -13
- package/dist/api/protocol-v2/DevReboot.d.ts +0 -7
- package/dist/api/protocol-v2/DevReboot.d.ts.map +0 -1
- package/dist/api/protocol-v2/DeviceGetDeviceInfo.d.ts.map +0 -1
- package/dist/api/protocol-v2/DeviceGetOnboardingStatus.d.ts +0 -6
- package/dist/api/protocol-v2/DeviceGetOnboardingStatus.d.ts.map +0 -1
- package/dist/api/protocol-v2/FactoryDeviceInfoSettings.d.ts +0 -7
- package/dist/api/protocol-v2/FactoryDeviceInfoSettings.d.ts.map +0 -1
- package/dist/api/protocol-v2/FactoryGetDeviceInfo.d.ts +0 -6
- package/dist/api/protocol-v2/FactoryGetDeviceInfo.d.ts.map +0 -1
- package/dist/api/protocol-v2/FilesystemFixPermission.d.ts.map +0 -1
- package/dist/api/protocol-v2/GetProtoVersion.d.ts +0 -6
- package/dist/api/protocol-v2/GetProtoVersion.d.ts.map +0 -1
- package/src/api/protocol-v2/DevReboot.ts +0 -24
- package/src/api/protocol-v2/DeviceGetOnboardingStatus.ts +0 -16
- package/src/api/protocol-v2/FactoryDeviceInfoSettings.ts +0 -29
|
@@ -13,14 +13,11 @@ import { PROTOBUF_MESSAGE_CONFIG } from '../data-manager/MessagesConfig';
|
|
|
13
13
|
import { getDeviceType } from './deviceInfoUtils';
|
|
14
14
|
import { getDeviceFirmwareVersion } from './deviceVersionUtils';
|
|
15
15
|
import { existCapability } from './capabilitieUtils';
|
|
16
|
+
import { getProtocolV2WalletSession } from '../protocols/protocol-v2/walletSession';
|
|
16
17
|
|
|
17
18
|
import type { Device } from '../device/Device';
|
|
18
19
|
import type { Features, IDeviceType, SupportFeatureType } from '../types';
|
|
19
20
|
|
|
20
|
-
// 生成的 GetPassphraseState 已包含 _only_main_pin / allow_create_attach_pin,
|
|
21
|
-
// 不再需要手动扩展字段。
|
|
22
|
-
type GetPassphraseStateMessage = GetPassphraseState;
|
|
23
|
-
|
|
24
21
|
export const getSupportProtocolV1MessageSchema = (
|
|
25
22
|
features: Features | undefined
|
|
26
23
|
): { messages: JSON; protocolV1MessageSchema: ProtocolV1MessageSchema } => {
|
|
@@ -93,12 +90,32 @@ export const getPassphraseStateWithRefreshDeviceInfo = async (
|
|
|
93
90
|
expectPassphraseState?: string;
|
|
94
91
|
onlyMainPin?: boolean;
|
|
95
92
|
allowCreateAttachPin?: boolean;
|
|
93
|
+
initSession?: boolean;
|
|
96
94
|
}
|
|
97
95
|
) => {
|
|
96
|
+
if (device.isProtocolV2()) {
|
|
97
|
+
if (!device.features) {
|
|
98
|
+
return {
|
|
99
|
+
passphraseState: undefined,
|
|
100
|
+
newSession: undefined,
|
|
101
|
+
unlockedAttachPin: undefined,
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
return getProtocolV2WalletSession(device, {
|
|
106
|
+
initSession: options?.initSession,
|
|
107
|
+
expectedPassphraseState: options?.expectPassphraseState,
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
|
|
98
111
|
const { features } = device;
|
|
99
112
|
const locked = features?.unlocked === false;
|
|
100
113
|
const deviceType = device.getCurrentDeviceType();
|
|
101
114
|
|
|
115
|
+
if (options?.initSession) {
|
|
116
|
+
device.clearInternalState();
|
|
117
|
+
}
|
|
118
|
+
|
|
102
119
|
const { passphraseState, newSession, unlockedAttachPin } = await getPassphraseState(device, {
|
|
103
120
|
...options,
|
|
104
121
|
});
|
|
@@ -128,14 +145,17 @@ export const getPassphraseStateWithRefreshDeviceInfo = async (
|
|
|
128
145
|
passphraseState,
|
|
129
146
|
deviceId,
|
|
130
147
|
newSession,
|
|
131
|
-
device.features?.sessionId
|
|
148
|
+
options?.initSession ? null : device.features?.sessionId
|
|
132
149
|
);
|
|
133
150
|
|
|
134
|
-
return {
|
|
151
|
+
return {
|
|
152
|
+
passphraseState,
|
|
153
|
+
newSession,
|
|
154
|
+
unlockedAttachPin: unlockedAttachPin ?? device.features?.unlockedAttachPin,
|
|
155
|
+
};
|
|
135
156
|
};
|
|
136
157
|
|
|
137
158
|
// 仅适用于 Protocol V1 的 Pro:Pro2 走独立版本线,不能套用 4.15.0 门槛
|
|
138
|
-
// (Pro2 在 getPassphraseState 中通过 isProtocolV2 直接判定支持)。
|
|
139
159
|
const supportProSeriesAttachPinPassphrase = (deviceType: IDeviceType, firmwareVersion: string) =>
|
|
140
160
|
deviceType === EDeviceType.Pro && semver.gte(firmwareVersion, '4.15.0');
|
|
141
161
|
|
|
@@ -145,6 +165,7 @@ export const getPassphraseState = async (
|
|
|
145
165
|
expectPassphraseState?: string;
|
|
146
166
|
onlyMainPin?: boolean;
|
|
147
167
|
allowCreateAttachPin?: boolean;
|
|
168
|
+
initSession?: boolean;
|
|
148
169
|
}
|
|
149
170
|
): Promise<{
|
|
150
171
|
passphraseState: string | undefined;
|
|
@@ -160,19 +181,22 @@ export const getPassphraseState = async (
|
|
|
160
181
|
const firmwareVersion = device.getCurrentFirmwareVersionString() ?? '0.0.0';
|
|
161
182
|
const deviceType = device.getCurrentDeviceType();
|
|
162
183
|
|
|
184
|
+
if (device.isProtocolV2()) {
|
|
185
|
+
return getProtocolV2WalletSession(device, {
|
|
186
|
+
initSession: options?.initSession,
|
|
187
|
+
expectedPassphraseState: options?.expectPassphraseState,
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
|
|
163
191
|
const supportAttachPinCapability = existCapability(
|
|
164
192
|
features,
|
|
165
193
|
Enum_Capability.Capability_AttachToPin
|
|
166
194
|
);
|
|
167
|
-
// Pro2 (Protocol V2) 协议自带 GetPassphraseState(10028),固件从首个版本即支持,
|
|
168
|
-
// 不依赖 Pro 系列的 4.15.0 版本线;V2 也没有 GetAddress Testnet 探测这条 legacy 回退路径。
|
|
169
195
|
const supportGetPassphraseState =
|
|
170
|
-
|
|
171
|
-
supportAttachPinCapability ||
|
|
172
|
-
supportProSeriesAttachPinPassphrase(deviceType, firmwareVersion);
|
|
196
|
+
supportAttachPinCapability || supportProSeriesAttachPinPassphrase(deviceType, firmwareVersion);
|
|
173
197
|
|
|
174
198
|
if (supportGetPassphraseState) {
|
|
175
|
-
const payload:
|
|
199
|
+
const payload: GetPassphraseState = options?.onlyMainPin
|
|
176
200
|
? { _only_main_pin: true }
|
|
177
201
|
: { passphrase_state: options?.expectPassphraseState };
|
|
178
202
|
if (options?.allowCreateAttachPin) {
|
|
@@ -276,6 +300,9 @@ export const getFirmwareUpdateField = ({
|
|
|
276
300
|
if (deviceType === EDeviceType.Pro) {
|
|
277
301
|
return latestFirmwareField;
|
|
278
302
|
}
|
|
303
|
+
if (deviceType === EDeviceType.Pro2) {
|
|
304
|
+
return 'firmware-v1';
|
|
305
|
+
}
|
|
279
306
|
return 'firmware';
|
|
280
307
|
};
|
|
281
308
|
/**
|
|
@@ -319,6 +346,10 @@ export const getFirmwareUpdateFieldArray = (
|
|
|
319
346
|
return ['firmware-v8'];
|
|
320
347
|
}
|
|
321
348
|
|
|
349
|
+
if (deviceType === 'pro2') {
|
|
350
|
+
return ['firmware-v1'];
|
|
351
|
+
}
|
|
352
|
+
|
|
322
353
|
return ['firmware'];
|
|
323
354
|
};
|
|
324
355
|
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { BaseMethod } from '../BaseMethod';
|
|
2
|
-
import type { DeviceRebootParams } from './helpers';
|
|
3
|
-
export default class DevReboot extends BaseMethod<DeviceRebootParams> {
|
|
4
|
-
init(): void;
|
|
5
|
-
run(): Promise<import("packages/hd-transport/dist").Success>;
|
|
6
|
-
}
|
|
7
|
-
//# sourceMappingURL=DevReboot.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DevReboot.d.ts","sourceRoot":"","sources":["../../../src/api/protocol-v2/DevReboot.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAG3C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAEpD,MAAM,CAAC,OAAO,OAAO,SAAU,SAAQ,UAAU,CAAC,kBAAkB,CAAC;IACnE,IAAI;IAWE,GAAG;CAMV"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DeviceGetDeviceInfo.d.ts","sourceRoot":"","sources":["../../../src/api/protocol-v2/DeviceGetDeviceInfo.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,MAAM,MAAM,0BAA0B,GAAG;IACvC,EAAE,CAAC,EAAE,OAAO,CAAC;IACb,EAAE,CAAC,EAAE,OAAO,CAAC;IACb,EAAE,CAAC,EAAE,OAAO,CAAC;IACb,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG;IACrC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,yBAAyB,GAAG;IACtC,OAAO,CAAC,EAAE,0BAA0B,CAAC;IACrC,KAAK,CAAC,EAAE,wBAAwB,CAAC;CAClC,CAAC;AAmDF,MAAM,CAAC,OAAO,OAAO,mBAAoB,SAAQ,UAAU,CAAC;IAC1D,OAAO,EAAE,0BAA0B,CAAC;IACpC,KAAK,EAAE,wBAAwB,CAAC;CACjC,CAAC;IACA,IAAI;IAmBE,GAAG;CAgBV"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DeviceGetOnboardingStatus.d.ts","sourceRoot":"","sources":["../../../src/api/protocol-v2/DeviceGetOnboardingStatus.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,MAAM,CAAC,OAAO,OAAO,yBAA0B,SAAQ,UAAU;IAC/D,IAAI;IAQE,GAAG;CAIV"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { BaseMethod } from '../BaseMethod';
|
|
2
|
-
import type { FactoryDeviceInfoSettingsParams } from './helpers';
|
|
3
|
-
export default class FactoryDeviceInfoSettings extends BaseMethod<FactoryDeviceInfoSettingsParams> {
|
|
4
|
-
init(): void;
|
|
5
|
-
run(): Promise<import("packages/hd-transport/dist").Success>;
|
|
6
|
-
}
|
|
7
|
-
//# sourceMappingURL=FactoryDeviceInfoSettings.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"FactoryDeviceInfoSettings.d.ts","sourceRoot":"","sources":["../../../src/api/protocol-v2/FactoryDeviceInfoSettings.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,WAAW,CAAC;AAEjE,MAAM,CAAC,OAAO,OAAO,yBAA0B,SAAQ,UAAU,CAAC,+BAA+B,CAAC;IAChG,IAAI;IAeE,GAAG;CAQV"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"FactoryGetDeviceInfo.d.ts","sourceRoot":"","sources":["../../../src/api/protocol-v2/FactoryGetDeviceInfo.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,MAAM,CAAC,OAAO,OAAO,oBAAqB,SAAQ,UAAU;IAC1D,IAAI;IAQE,GAAG;CAQV"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"FilesystemFixPermission.d.ts","sourceRoot":"","sources":["../../../src/api/protocol-v2/FilesystemFixPermission.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,MAAM,CAAC,OAAO,OAAO,uBAAwB,SAAQ,UAAU;IAC7D,IAAI;IAQE,GAAG;CAIV"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"GetProtoVersion.d.ts","sourceRoot":"","sources":["../../../src/api/protocol-v2/GetProtoVersion.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,MAAM,CAAC,OAAO,OAAO,eAAgB,SAAQ,UAAU;IACrD,IAAI;IAQE,GAAG;CAIV"}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { BaseMethod } from '../BaseMethod';
|
|
2
|
-
import { normalizeRebootType } from './helpers';
|
|
3
|
-
|
|
4
|
-
import type { DeviceRebootParams } from './helpers';
|
|
5
|
-
|
|
6
|
-
export default class DevReboot extends BaseMethod<DeviceRebootParams> {
|
|
7
|
-
init() {
|
|
8
|
-
// Protocol V2 (Pro2) 专属方法,core 调度层统一做非 V2 设备守卫
|
|
9
|
-
this.requireProtocolV2 = true;
|
|
10
|
-
this.skipForceUpdateCheck = true;
|
|
11
|
-
this.useDevicePassphraseState = false;
|
|
12
|
-
this.params = {
|
|
13
|
-
rebootType: this.payload.rebootType,
|
|
14
|
-
reboot_type: this.payload.reboot_type,
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
async run() {
|
|
19
|
-
const res = await this.device.commands.typedCall('DevReboot', 'Success', {
|
|
20
|
-
reboot_type: normalizeRebootType(this.params.reboot_type ?? this.params.rebootType),
|
|
21
|
-
});
|
|
22
|
-
return Promise.resolve(res.message);
|
|
23
|
-
}
|
|
24
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { BaseMethod } from '../BaseMethod';
|
|
2
|
-
|
|
3
|
-
export default class DeviceGetOnboardingStatus extends BaseMethod {
|
|
4
|
-
init() {
|
|
5
|
-
// Protocol V2 (Pro2) 专属方法,core 调度层统一做非 V2 设备守卫
|
|
6
|
-
this.requireProtocolV2 = true;
|
|
7
|
-
this.skipForceUpdateCheck = true;
|
|
8
|
-
this.useDevicePassphraseState = false;
|
|
9
|
-
this.params = undefined;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
async run() {
|
|
13
|
-
const res = await this.device.commands.typedCall('GetOnboardingStatus', 'OnboardingStatus', {});
|
|
14
|
-
return Promise.resolve(res.message);
|
|
15
|
-
}
|
|
16
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { BaseMethod } from '../BaseMethod';
|
|
2
|
-
|
|
3
|
-
import type { FactoryDeviceInfoSettingsParams } from './helpers';
|
|
4
|
-
|
|
5
|
-
export default class FactoryDeviceInfoSettings extends BaseMethod<FactoryDeviceInfoSettingsParams> {
|
|
6
|
-
init() {
|
|
7
|
-
// Protocol V2 (Pro2) 专属方法,core 调度层统一做非 V2 设备守卫
|
|
8
|
-
this.requireProtocolV2 = true;
|
|
9
|
-
this.skipForceUpdateCheck = true;
|
|
10
|
-
this.useDevicePassphraseState = false;
|
|
11
|
-
this.params = {
|
|
12
|
-
serial_no: this.payload.serial_no,
|
|
13
|
-
serialNo: this.payload.serialNo,
|
|
14
|
-
cpu_info: this.payload.cpu_info,
|
|
15
|
-
cpuInfo: this.payload.cpuInfo,
|
|
16
|
-
pre_firmware: this.payload.pre_firmware,
|
|
17
|
-
preFirmware: this.payload.preFirmware,
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
async run() {
|
|
22
|
-
const res = await this.device.commands.typedCall('FactoryDeviceInfoSettings', 'Success', {
|
|
23
|
-
serial_no: this.params.serial_no ?? this.params.serialNo,
|
|
24
|
-
cpu_info: this.params.cpu_info ?? this.params.cpuInfo,
|
|
25
|
-
pre_firmware: this.params.pre_firmware ?? this.params.preFirmware,
|
|
26
|
-
});
|
|
27
|
-
return Promise.resolve(res.message);
|
|
28
|
-
}
|
|
29
|
-
}
|