@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.
Files changed (153) hide show
  1. package/__tests__/connectSettings.test.ts +19 -0
  2. package/__tests__/device-wallet-session-store.test.ts +131 -0
  3. package/__tests__/preInitialize.test.ts +33 -0
  4. package/__tests__/protocol-v2-firmware-targets.test.ts +19 -0
  5. package/__tests__/protocol-v2.test.ts +1784 -502
  6. package/dist/api/ClearSessionCache.d.ts +9 -0
  7. package/dist/api/ClearSessionCache.d.ts.map +1 -0
  8. package/dist/api/FileRead.d.ts.map +1 -1
  9. package/dist/api/FileWrite.d.ts.map +1 -1
  10. package/dist/api/FirmwareUpdateV4.d.ts +24 -3
  11. package/dist/api/FirmwareUpdateV4.d.ts.map +1 -1
  12. package/dist/api/GetPassphraseState.d.ts.map +1 -1
  13. package/dist/api/firmware/FirmwareUpdateBaseMethod.d.ts +1 -0
  14. package/dist/api/firmware/FirmwareUpdateBaseMethod.d.ts.map +1 -1
  15. package/dist/api/firmware/getBinary.d.ts +4 -0
  16. package/dist/api/firmware/getBinary.d.ts.map +1 -1
  17. package/dist/api/firmware/progressThrottle.d.ts +3 -0
  18. package/dist/api/firmware/progressThrottle.d.ts.map +1 -0
  19. package/dist/api/index.d.ts +8 -10
  20. package/dist/api/index.d.ts.map +1 -1
  21. package/dist/api/protocol-v2/DeviceFactoryInfoGet.d.ts +6 -0
  22. package/dist/api/protocol-v2/DeviceFactoryInfoGet.d.ts.map +1 -0
  23. package/dist/api/protocol-v2/DeviceFactoryInfoSet.d.ts +7 -0
  24. package/dist/api/protocol-v2/DeviceFactoryInfoSet.d.ts.map +1 -0
  25. package/dist/api/protocol-v2/DeviceFirmwareUpdate.d.ts +1 -1
  26. package/dist/api/protocol-v2/DeviceFirmwareUpdate.d.ts.map +1 -1
  27. package/dist/api/protocol-v2/DeviceGetFirmwareUpdateStatus.d.ts +3 -2
  28. package/dist/api/protocol-v2/DeviceGetFirmwareUpdateStatus.d.ts.map +1 -1
  29. package/dist/api/protocol-v2/{DeviceGetDeviceInfo.d.ts → DeviceInfoGet.d.ts} +10 -10
  30. package/dist/api/protocol-v2/DeviceInfoGet.d.ts.map +1 -0
  31. package/dist/api/protocol-v2/DeviceSessionGet.d.ts +9 -0
  32. package/dist/api/protocol-v2/DeviceSessionGet.d.ts.map +1 -0
  33. package/dist/api/protocol-v2/DeviceStatusGet.d.ts +6 -0
  34. package/dist/api/protocol-v2/DeviceStatusGet.d.ts.map +1 -0
  35. package/dist/api/protocol-v2/FilesystemFormat.d.ts.map +1 -1
  36. package/dist/api/protocol-v2/{FilesystemFixPermission.d.ts → FilesystemPermissionFix.d.ts} +2 -2
  37. package/dist/api/protocol-v2/FilesystemPermissionFix.d.ts.map +1 -0
  38. package/dist/api/protocol-v2/ProtocolInfoRequest.d.ts +6 -0
  39. package/dist/api/protocol-v2/ProtocolInfoRequest.d.ts.map +1 -0
  40. package/dist/api/protocol-v2/helpers.d.ts +27 -18
  41. package/dist/api/protocol-v2/helpers.d.ts.map +1 -1
  42. package/dist/api/ton/TonSignData.d.ts +1 -5
  43. package/dist/api/ton/TonSignData.d.ts.map +1 -1
  44. package/dist/api/tron/TronSignMessage.d.ts +0 -1
  45. package/dist/api/tron/TronSignMessage.d.ts.map +1 -1
  46. package/dist/api/tron/TronSignTransaction.d.ts +0 -1
  47. package/dist/api/tron/TronSignTransaction.d.ts.map +1 -1
  48. package/dist/core/index.d.ts.map +1 -1
  49. package/dist/data-manager/DataManager.d.ts +1 -1
  50. package/dist/data-manager/DataManager.d.ts.map +1 -1
  51. package/dist/data-manager/connectSettings.d.ts.map +1 -1
  52. package/dist/device/Device.d.ts +6 -3
  53. package/dist/device/Device.d.ts.map +1 -1
  54. package/dist/device/DeviceWalletSessionStore.d.ts +15 -0
  55. package/dist/device/DeviceWalletSessionStore.d.ts.map +1 -0
  56. package/dist/deviceProfile/buildDeviceFeatures.d.ts.map +1 -1
  57. package/dist/deviceProfile/buildDeviceProfile.d.ts.map +1 -1
  58. package/dist/index.d.ts +96 -55
  59. package/dist/index.js +2077 -1609
  60. package/dist/inject.d.ts.map +1 -1
  61. package/dist/protocols/protocol-v2/features.d.ts +12 -14
  62. package/dist/protocols/protocol-v2/features.d.ts.map +1 -1
  63. package/dist/protocols/protocol-v2/firmware.d.ts +11 -9
  64. package/dist/protocols/protocol-v2/firmware.d.ts.map +1 -1
  65. package/dist/protocols/protocol-v2/index.d.ts +1 -0
  66. package/dist/protocols/protocol-v2/index.d.ts.map +1 -1
  67. package/dist/protocols/protocol-v2/walletSession.d.ts +13 -0
  68. package/dist/protocols/protocol-v2/walletSession.d.ts.map +1 -0
  69. package/dist/types/api/firmwareUpdate.d.ts +4 -6
  70. package/dist/types/api/firmwareUpdate.d.ts.map +1 -1
  71. package/dist/types/api/getDeviceInfo.d.ts +2 -0
  72. package/dist/types/api/getDeviceInfo.d.ts.map +1 -1
  73. package/dist/types/api/index.d.ts +11 -11
  74. package/dist/types/api/index.d.ts.map +1 -1
  75. package/dist/types/api/protocolV2.d.ts +16 -17
  76. package/dist/types/api/protocolV2.d.ts.map +1 -1
  77. package/dist/types/api/sessionCache.d.ts +10 -0
  78. package/dist/types/api/sessionCache.d.ts.map +1 -0
  79. package/dist/types/device.d.ts +1 -0
  80. package/dist/types/device.d.ts.map +1 -1
  81. package/dist/types/params.d.ts +1 -0
  82. package/dist/types/params.d.ts.map +1 -1
  83. package/dist/types/settings.d.ts +21 -2
  84. package/dist/types/settings.d.ts.map +1 -1
  85. package/dist/utils/deviceFeaturesUtils.d.ts +2 -0
  86. package/dist/utils/deviceFeaturesUtils.d.ts.map +1 -1
  87. package/dist/utils/patch.d.ts +1 -1
  88. package/dist/utils/patch.d.ts.map +1 -1
  89. package/package.json +4 -4
  90. package/src/api/ClearSessionCache.ts +28 -0
  91. package/src/api/FileRead.ts +16 -3
  92. package/src/api/FileWrite.ts +14 -1
  93. package/src/api/FirmwareUpdateV4.ts +1075 -264
  94. package/src/api/GetOnekeyFeatures.ts +1 -1
  95. package/src/api/GetPassphraseState.ts +4 -1
  96. package/src/api/device/DeviceRebootToBoardloader.ts +4 -4
  97. package/src/api/device/DeviceRebootToBootloader.ts +4 -4
  98. package/src/api/firmware/FirmwareUpdateBaseMethod.ts +18 -4
  99. package/src/api/firmware/progressThrottle.ts +44 -0
  100. package/src/api/index.ts +8 -10
  101. package/src/api/protocol-v2/{FactoryGetDeviceInfo.ts → DeviceFactoryInfoGet.ts} +3 -3
  102. package/src/api/protocol-v2/DeviceFactoryInfoSet.ts +32 -0
  103. package/src/api/protocol-v2/DeviceFirmwareUpdate.ts +3 -5
  104. package/src/api/protocol-v2/DeviceGetFirmwareUpdateStatus.ts +39 -5
  105. package/src/api/protocol-v2/{DeviceGetDeviceInfo.ts → DeviceInfoGet.ts} +52 -22
  106. package/src/api/protocol-v2/DeviceReboot.ts +1 -1
  107. package/src/api/protocol-v2/DeviceSessionGet.ts +26 -0
  108. package/src/api/protocol-v2/DeviceStatusGet.ts +14 -0
  109. package/src/api/protocol-v2/FilesystemFormat.ts +4 -1
  110. package/src/api/protocol-v2/{FilesystemFixPermission.ts → FilesystemPermissionFix.ts} +2 -2
  111. package/src/api/protocol-v2/{GetProtoVersion.ts → ProtocolInfoRequest.ts} +2 -2
  112. package/src/api/protocol-v2/helpers.ts +71 -47
  113. package/src/api/ton/TonSignData.ts +1 -5
  114. package/src/api/tron/TronSignMessage.ts +0 -1
  115. package/src/api/tron/TronSignTransaction.ts +0 -1
  116. package/src/core/index.ts +19 -5
  117. package/src/data/messages/messages-protocol-v2.json +599 -1033
  118. package/src/data/messages/messages.json +8 -0
  119. package/src/data-manager/DataManager.ts +7 -0
  120. package/src/data-manager/connectSettings.ts +2 -4
  121. package/src/device/Device.ts +89 -70
  122. package/src/device/DeviceWalletSessionStore.ts +78 -0
  123. package/src/deviceProfile/buildDeviceFeatures.ts +60 -63
  124. package/src/deviceProfile/buildDeviceProfile.ts +77 -58
  125. package/src/inject.ts +13 -16
  126. package/src/protocols/protocol-v2/features.ts +26 -63
  127. package/src/protocols/protocol-v2/firmware.ts +12 -36
  128. package/src/protocols/protocol-v2/index.ts +1 -0
  129. package/src/protocols/protocol-v2/walletSession.ts +83 -0
  130. package/src/types/api/firmwareUpdate.ts +16 -20
  131. package/src/types/api/getDeviceInfo.ts +2 -0
  132. package/src/types/api/index.ts +17 -20
  133. package/src/types/api/protocolV2.ts +36 -40
  134. package/src/types/api/sessionCache.ts +14 -0
  135. package/src/types/device.ts +1 -0
  136. package/src/types/params.ts +4 -0
  137. package/src/types/settings.ts +42 -35
  138. package/src/utils/deviceFeaturesUtils.ts +44 -13
  139. package/dist/api/protocol-v2/DevReboot.d.ts +0 -7
  140. package/dist/api/protocol-v2/DevReboot.d.ts.map +0 -1
  141. package/dist/api/protocol-v2/DeviceGetDeviceInfo.d.ts.map +0 -1
  142. package/dist/api/protocol-v2/DeviceGetOnboardingStatus.d.ts +0 -6
  143. package/dist/api/protocol-v2/DeviceGetOnboardingStatus.d.ts.map +0 -1
  144. package/dist/api/protocol-v2/FactoryDeviceInfoSettings.d.ts +0 -7
  145. package/dist/api/protocol-v2/FactoryDeviceInfoSettings.d.ts.map +0 -1
  146. package/dist/api/protocol-v2/FactoryGetDeviceInfo.d.ts +0 -6
  147. package/dist/api/protocol-v2/FactoryGetDeviceInfo.d.ts.map +0 -1
  148. package/dist/api/protocol-v2/FilesystemFixPermission.d.ts.map +0 -1
  149. package/dist/api/protocol-v2/GetProtoVersion.d.ts +0 -6
  150. package/dist/api/protocol-v2/GetProtoVersion.d.ts.map +0 -1
  151. package/src/api/protocol-v2/DevReboot.ts +0 -24
  152. package/src/api/protocol-v2/DeviceGetOnboardingStatus.ts +0 -16
  153. 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 { passphraseState, newSession, unlockedAttachPin };
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
- device.isProtocolV2() ||
171
- supportAttachPinCapability ||
172
- supportProSeriesAttachPinPassphrase(deviceType, firmwareVersion);
196
+ supportAttachPinCapability || supportProSeriesAttachPinPassphrase(deviceType, firmwareVersion);
173
197
 
174
198
  if (supportGetPassphraseState) {
175
- const payload: GetPassphraseStateMessage = options?.onlyMainPin
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,6 +0,0 @@
1
- import { BaseMethod } from '../BaseMethod';
2
- export default class DeviceGetOnboardingStatus extends BaseMethod {
3
- init(): void;
4
- run(): Promise<import("packages/hd-transport/dist").OnboardingStatus>;
5
- }
6
- //# sourceMappingURL=DeviceGetOnboardingStatus.d.ts.map
@@ -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,6 +0,0 @@
1
- import { BaseMethod } from '../BaseMethod';
2
- export default class FactoryGetDeviceInfo extends BaseMethod {
3
- init(): void;
4
- run(): Promise<import("packages/hd-transport/dist").FactoryDeviceInfo>;
5
- }
6
- //# sourceMappingURL=FactoryGetDeviceInfo.d.ts.map
@@ -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,6 +0,0 @@
1
- import { BaseMethod } from '../BaseMethod';
2
- export default class GetProtoVersion extends BaseMethod {
3
- init(): void;
4
- run(): Promise<import("packages/hd-transport/dist").ProtoVersion>;
5
- }
6
- //# sourceMappingURL=GetProtoVersion.d.ts.map
@@ -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
- }