@onekeyfe/hd-shared 1.1.34-alpha.2 → 1.1.34-alpha.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -116,6 +116,8 @@ export declare const HardwareErrorCode: {
116
116
  readonly TooManyInputs: 827;
117
117
  readonly PinMismatch: 828;
118
118
  readonly KaspaPrevTxIdMismatch: 829;
119
+ readonly DeviceLocked: 830;
120
+ readonly WalletSessionInvalid: 831;
119
121
  readonly LowlevelTrasnportConnectError: 900;
120
122
  readonly WebDeviceNotFoundOrNeedsPermission: 901;
121
123
  readonly WebDevicePromptAccessError: 902;
@@ -1 +1 @@
1
- {"version":3,"file":"HardwareError.d.ts","sourceRoot":"","sources":["../src/HardwareError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAE/C,MAAM,WAAW,cAAc;IAC7B,SAAS,EAAE,OAAO,CAAC,OAAO,iBAAiB,CAAC,CAAC;IAC7C,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,GAAG,CAAC;CACd;AAED,KAAK,OAAO,CAAC,CAAC,SAAS,MAAM,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;AAE5C,KAAK,+BAA+B,GAAG;KAAG,CAAC,IAAI,OAAO,CAAC,OAAO,iBAAiB,CAAC,GAAG,MAAM;CAAE,CAAC;AAE5F,KAAK,cAAc,GAAG,OAAO,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAsCxD,qBAAa,aAAc,SAAQ,KAAK;IACtC,SAAS,EAAE,cAAc,CAAkC;IAE3D,OAAO,SAAM;IAEb,MAAM,EAAE,GAAG,CAAM;gBAEL,aAAa,EAAE,cAAc,GAAG,MAAM;CAmBnD;AAED,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AC,EAAE,oBACnB;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,GAAG,CAAC,EAAE,MAAM,CAAC;CACd,kBAsBF,CAAC;AAEF,QAAA,MAAM,6BAA6B,mBACjB,MAAM,qBACH,MAAM,eACZ,MAAM,kBAQpB,CAAC;AAEF,QAAA,MAAM,4BAA4B,aACtB,MAAM,aACL,MAAM,cACL,MAAM,cACN,MAAM,aACP,MAAM,kBAWlB,CAAC;AAEF,QAAA,MAAM,iCAAiC,eAAgB,MAAM,gBAAgB,aAAa,kBAItF,CAAC;AAEL,OAAO,EACL,uCAAuC,EACvC,sCAAsC,EACtC,yCAAyC,EACzC,6BAA6B,EAC7B,4BAA4B,EAC5B,iCAAiC,GAClC,CAAC"}
@@ -1,4 +1,9 @@
1
1
  /// <reference types="node" />
2
+ export declare const HARDWARE_CONNECT_PROTOCOL: {
3
+ readonly V1: "V1";
4
+ readonly V2: "V2";
5
+ };
6
+ export type HardwareConnectProtocol = (typeof HARDWARE_CONNECT_PROTOCOL)[keyof typeof HARDWARE_CONNECT_PROTOCOL];
2
7
  export declare const ONEKEY_WEBUSB_FILTER: {
3
8
  vendorId: number;
4
9
  productId: number;
@@ -28,7 +33,6 @@ export declare enum EOneKeyBleMessageKeys {
28
33
  NOBLE_BLE_STOP_SCAN = "$onekey-noble-ble-stop-scan",
29
34
  NOBLE_BLE_GET_DEVICE = "$onekey-noble-ble-get-device",
30
35
  NOBLE_BLE_CONNECT = "$onekey-noble-ble-connect",
31
- NOBLE_BLE_RELEASE = "$onekey-noble-ble-release",
32
36
  NOBLE_BLE_DISCONNECT = "$onekey-noble-ble-disconnect",
33
37
  NOBLE_BLE_WRITE = "$onekey-noble-ble-write",
34
38
  NOBLE_BLE_SUBSCRIBE = "$onekey-noble-ble-subscribe",
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":";AAEA,eAAO,MAAM,oBAAoB;;;GAOhC,CAAC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I,OAAO,MAAM,KAAG,OAgBjE,CAAC"}
@@ -5,6 +5,7 @@ export declare enum EDeviceType {
5
5
  ClassicPure = "classicpure",
6
6
  Mini = "mini",
7
7
  Touch = "touch",
8
- Pro = "pro"
8
+ Pro = "pro",
9
+ Pro2 = "pro2"
9
10
  }
10
11
  //# sourceMappingURL=deviceType.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"deviceType.d.ts","sourceRoot":"","sources":["../src/deviceType.ts"],"names":[],"mappings":"AAAA,oBAAY,WAAW;IACrB,OAAO,YAAY;IACnB,OAAO,YAAY;IACnB,SAAS,cAAc;IACvB,WAAW,gBAAgB;IAC3B,IAAI,SAAS;IACb,KAAK,UAAU;IACf,GAAG,QAAQ;CACZ"}
1
+ {"version":3,"file":"deviceType.d.ts","sourceRoot":"","sources":["../src/deviceType.ts"],"names":[],"mappings":"AAAA,oBAAY,WAAW;IACrB,OAAO,YAAY;IACnB,OAAO,YAAY;IACnB,SAAS,cAAc;IACvB,WAAW,gBAAgB;IAC3B,IAAI,SAAS;IACb,KAAK,UAAU;IACf,GAAG,QAAQ;IACX,IAAI,SAAS;CACd"}
package/dist/index.d.ts CHANGED
@@ -1,3 +1,8 @@
1
+ declare const HARDWARE_CONNECT_PROTOCOL: {
2
+ readonly V1: "V1";
3
+ readonly V2: "V2";
4
+ };
5
+ type HardwareConnectProtocol = (typeof HARDWARE_CONNECT_PROTOCOL)[keyof typeof HARDWARE_CONNECT_PROTOCOL];
1
6
  declare const ONEKEY_WEBUSB_FILTER: {
2
7
  vendorId: number;
3
8
  productId: number;
@@ -8,7 +13,15 @@ type WebUsbIdentityDescriptor = {
8
13
  manufacturerName?: string | null;
9
14
  };
10
15
  declare const isKnownTrezorWebUsbDevice: (descriptor: WebUsbIdentityDescriptor) => boolean;
16
+ /**
17
+ * Error codes that require device release after occurrence
18
+ * These errors indicate the device is in an invalid state and needs to be released
19
+ */
11
20
  declare const ERROR_CODES_REQUIRE_RELEASE: readonly [106, 107, 109, 112, 805, 801, 802, 812];
21
+ /**
22
+ * Error codes that require device disconnect before release
23
+ * These errors indicate a communication failure that requires full reconnection
24
+ */
12
25
  declare const ERROR_CODES_REQUIRE_DISCONNECT: readonly [106, 805];
13
26
  declare enum EOneKeyBleMessageKeys {
14
27
  BLE_SELECT = "$onekey-ble-select",
@@ -27,7 +40,6 @@ declare enum EOneKeyBleMessageKeys {
27
40
  NOBLE_BLE_STOP_SCAN = "$onekey-noble-ble-stop-scan",
28
41
  NOBLE_BLE_GET_DEVICE = "$onekey-noble-ble-get-device",
29
42
  NOBLE_BLE_CONNECT = "$onekey-noble-ble-connect",
30
- NOBLE_BLE_RELEASE = "$onekey-noble-ble-release",
31
43
  NOBLE_BLE_DISCONNECT = "$onekey-noble-ble-disconnect",
32
44
  NOBLE_BLE_WRITE = "$onekey-noble-ble-write",
33
45
  NOBLE_BLE_SUBSCRIBE = "$onekey-noble-ble-subscribe",
@@ -72,53 +84,201 @@ declare class HardwareError extends Error {
72
84
  constructor(hardwareError: IHardwareError | string);
73
85
  }
74
86
  declare const HardwareErrorCode: {
87
+ /**
88
+ * This error can be thrown when unexpected error occurred and in most cases it is related to implementation bug.
89
+ * Original message is available in message property.
90
+ */
75
91
  readonly UnknownError: 0;
92
+ /**
93
+ * Firmware version mismatch
94
+ */
76
95
  readonly DeviceFwException: 101;
96
+ /**
97
+ * Device unexpected mode
98
+ */
77
99
  readonly DeviceUnexpectedMode: 102;
100
+ /**
101
+ * Device list is not initialized
102
+ */
78
103
  readonly DeviceListNotInitialized: 103;
104
+ /**
105
+ * Please select the connected device
106
+ */
79
107
  readonly SelectDevice: 104;
108
+ /**
109
+ * Device not found
110
+ */
80
111
  readonly DeviceNotFound: 105;
112
+ /**
113
+ * Device is not initialized
114
+ */
81
115
  readonly DeviceInitializeFailed: 106;
116
+ /**
117
+ * Device interrupted from another operation
118
+ */
82
119
  readonly DeviceInterruptedFromOutside: 107;
120
+ /**
121
+ * Device should be in bootloader mode
122
+ */
83
123
  readonly RequiredButInBootloaderMode: 108;
124
+ /**
125
+ * Device interrupted from user
126
+ */
84
127
  readonly DeviceInterruptedFromUser: 109;
128
+ /**
129
+ * Check device id is same
130
+ */
85
131
  readonly DeviceCheckDeviceIdError: 110;
132
+ /**
133
+ * Do not support passphrase
134
+ * @params: { require: string }
135
+ */
86
136
  readonly DeviceNotSupportPassphrase: 111;
87
137
  readonly DeviceCheckPassphraseStateError: 112;
138
+ /**
139
+ * use passphrase, but passphrase is not opened
140
+ */
88
141
  readonly DeviceNotOpenedPassphrase: 113;
142
+ /**
143
+ * not use passphrase, but passphrase is opened
144
+ */
89
145
  readonly DeviceOpenedPassphrase: 114;
146
+ /**
147
+ * Detect hardware that is in bootloader mode and return an error.
148
+ */
90
149
  readonly DeviceDetectInBootloaderMode: 115;
150
+ /**
151
+ * Device not allow in bootloader mode
152
+ */
91
153
  readonly NotAllowInBootloaderMode: 116;
154
+ /**
155
+ * Device is busy
156
+ */
92
157
  readonly DeviceBusy: 117;
158
+ /**
159
+ * Device check unlock type not match error
160
+ */
93
161
  readonly DeviceCheckUnlockTypeError: 118;
162
+ /**
163
+ * Not initialized
164
+ */
94
165
  readonly NotInitialized: 200;
166
+ /**
167
+ * Iframe not initialized
168
+ */
95
169
  readonly IFrameNotInitialized: 300;
170
+ /**
171
+ * iframe repeat initialization
172
+ */
96
173
  readonly IFrameAleradyInitialized: 301;
174
+ /**
175
+ * iframe load failure
176
+ */
97
177
  readonly IFrameLoadFail: 302;
178
+ /**
179
+ * init iframe time out
180
+ */
98
181
  readonly IframeTimeout: 303;
182
+ /**
183
+ * iframe blocked
184
+ */
99
185
  readonly IframeBlocked: 304;
186
+ /**
187
+ * iframe host not trust
188
+ */
100
189
  readonly IframeDistrust: 305;
190
+ /**
191
+ * Runtime errors during method execution
192
+ */
101
193
  readonly CallMethodError: 400;
194
+ /**
195
+ * Method does not responding
196
+ */
102
197
  readonly CallMethodNotResponse: 404;
198
+ /**
199
+ * Call method invalid parameter
200
+ */
103
201
  readonly CallMethodInvalidParameter: 405;
202
+ /**
203
+ * firmware update download failed
204
+ */
104
205
  readonly FirmwareUpdateDownloadFailed: 406;
206
+ /**
207
+ * Call method not supported, need update firmware
208
+ * @params: { current: string, require: string }
209
+ */
105
210
  readonly CallMethodNeedUpgradeFirmware: 407;
211
+ /**
212
+ * Call method not supported, is deprecated
213
+ * @params: { current: string, deprecated: string }
214
+ */
106
215
  readonly CallMethodDeprecated: 408;
216
+ /**
217
+ * Only one device can be connected during firmware upgrade
218
+ */
107
219
  readonly FirmwareUpdateLimitOneDevice: 409;
220
+ /**
221
+ * You need to manually enter boot
222
+ */
108
223
  readonly FirmwareUpdateManuallyEnterBoot: 410;
224
+ /**
225
+ * Manual entry fails. You must manually enter the boot
226
+ */
109
227
  readonly FirmwareUpdateAutoEnterBootFailure: 411;
228
+ /**
229
+ * The new firmware has not been released yet
230
+ */
110
231
  readonly NewFirmwareUnRelease: 412;
232
+ /**
233
+ * use OneKey desktop client to update the firmware
234
+ * because need copy resource file to Touch
235
+ */
111
236
  readonly UseDesktopToUpdateFirmware: 413;
237
+ /**
238
+ * Mandatory firmware update
239
+ * @params:{ connectId: string? , deviceId: string? }
240
+ */
112
241
  readonly NewFirmwareForceUpdate: 414;
242
+ /**
243
+ * Device not support this method
244
+ */
113
245
  readonly DeviceNotSupportMethod: 415;
246
+ /**
247
+ * Forbidden key path
248
+ */
114
249
  readonly ForbiddenKeyPath: 416;
250
+ /**
251
+ * Repeat unlocking
252
+ * all network get address by loop need repeat unlocking
253
+ */
115
254
  readonly RepeatUnlocking: 417;
255
+ /**
256
+ * Defective firmware detected
257
+ */
116
258
  readonly DefectiveFirmware: 418;
259
+ /**
260
+ * Netword request error
261
+ */
117
262
  readonly NetworkError: 500;
263
+ /**
264
+ * Transport not configured
265
+ */
118
266
  readonly TransportNotConfigured: 600;
267
+ /**
268
+ * Transport call in progress
269
+ */
119
270
  readonly TransportCallInProgress: 601;
271
+ /**
272
+ * Transport not found
273
+ */
120
274
  readonly TransportNotFound: 602;
275
+ /**
276
+ * Transport invalid protobuf
277
+ */
121
278
  readonly TransportInvalidProtobuf: 603;
279
+ /**
280
+ * Bluetooth error code
281
+ */
122
282
  readonly BleScanError: 700;
123
283
  readonly BlePermissionError: 701;
124
284
  readonly BleLocationError: 702;
@@ -142,38 +302,143 @@ declare const HardwareErrorCode: {
142
302
  readonly BleDeviceDisconnected: 720;
143
303
  readonly BlePoweredOff: 721;
144
304
  readonly BleUnsupported: 722;
305
+ /**
306
+ * Hardware runtiome errors
307
+ */
145
308
  readonly RuntimeError: 800;
309
+ /**
310
+ * invalid pin
311
+ */
146
312
  readonly PinInvalid: 801;
313
+ /**
314
+ * pin cancelled by user
315
+ */
147
316
  readonly PinCancelled: 802;
317
+ /**
318
+ * Action cancelled by user
319
+ */
148
320
  readonly ActionCancelled: 803;
321
+ /**
322
+ * Firmware installation failed
323
+ */
149
324
  readonly FirmwareError: 804;
325
+ /**
326
+ * transport response unexpect error
327
+ */
150
328
  readonly ResponseUnexpectTypeError: 805;
329
+ /**
330
+ * bridge network error
331
+ */
151
332
  readonly BridgeNetworkError: 806;
333
+ /**
334
+ * Bridge network timeout
335
+ */
152
336
  readonly BridgeTimeoutError: 807;
337
+ /**
338
+ * Bridge not installed
339
+ */
153
340
  readonly BridgeNotInstalled: 808;
341
+ /**
342
+ * ensure connect timeout
343
+ */
154
344
  readonly PollingTimeout: 809;
345
+ /**
346
+ * ensure connect stop polling
347
+ */
155
348
  readonly PollingStop: 810;
349
+ /**
350
+ * Device does not open blid sign
351
+ */
156
352
  readonly BlindSignDisabled: 811;
157
353
  readonly UnexpectPassphrase: 812;
354
+ /**
355
+ * NFT file already exists
356
+ */
158
357
  readonly FileAlreadyExists: 813;
358
+ /**
359
+ * check file length error
360
+ */
159
361
  readonly CheckDownloadFileError: 814;
362
+ /**
363
+ * not in signing mode
364
+ */
160
365
  readonly NotInSigningMode: 815;
366
+ /**
367
+ * not in signing mode
368
+ */
161
369
  readonly DataOverload: 816;
370
+ /**
371
+ * device disconnected during action
372
+ */
162
373
  readonly BridgeDeviceDisconnected: 817;
374
+ /**
375
+ * BTC PSBT too many utxos
376
+ * @params:{ count: number }
377
+ */
163
378
  readonly BTCPsbtTooManyUtxos: 818;
379
+ /**
380
+ * EMMC file write firmware error
381
+ */
164
382
  readonly EmmcFileWriteFirmwareError: 819;
383
+ /**
384
+ * Firmware verification failed (e.g., bootloader file verify failed)
385
+ */
165
386
  readonly FirmwareVerificationFailed: 820;
387
+ /**
388
+ * Web bridge coonect needs permission
389
+ */
166
390
  readonly BridgeNeedsPermission: 821;
167
391
  readonly CallQueueActionCancelled: 822;
392
+ /**
393
+ * Firmware downgrade not allowed
394
+ */
168
395
  readonly FirmwareDowngradeNotAllowed: 823;
396
+ /**
397
+ * Cosmos invalid JSON message, Only support Amino msgs.
398
+ */
169
399
  readonly CosmosInvalidJsonMessage: 824;
400
+ /**
401
+ * No setting provided
402
+ */
170
403
  readonly DeviceSettingsNotProvided: 825;
404
+ /**
405
+ * Language not supported
406
+ */
171
407
  readonly DeviceSettingsLanguageNotSupport: 826;
408
+ /**
409
+ * Too many inputs
410
+ * @params: { count?: string }
411
+ */
172
412
  readonly TooManyInputs: 827;
413
+ /**
414
+ * The two PIN entries did not match while setting/changing PIN on device
415
+ */
173
416
  readonly PinMismatch: 828;
417
+ /**
418
+ * Device refused to sign: refTxs don't match the spent input's outpoint
419
+ */
174
420
  readonly KaspaPrevTxIdMismatch: 829;
421
+ /**
422
+ * Protocol V2 device must be unlocked before the requested operation.
423
+ * @params: { failureCode?: string; subcode?: number; firmwareMessage?: string }
424
+ */
425
+ readonly DeviceLocked: 830;
426
+ /**
427
+ * The cached wallet session is invalid or has expired.
428
+ * @params: { failureCode?: string; subcode?: number; firmwareMessage?: string }
429
+ */
430
+ readonly WalletSessionInvalid: 831;
431
+ /**
432
+ * Lowlevel transport connect error
433
+ */
175
434
  readonly LowlevelTrasnportConnectError: 900;
435
+ /**
436
+ * Web USB or Web Bluetooth device not found or needs permission
437
+ */
176
438
  readonly WebDeviceNotFoundOrNeedsPermission: 901;
439
+ /**
440
+ * Web USB or Web Bluetooth device prompt access error
441
+ */
177
442
  readonly WebDevicePromptAccessError: 902;
178
443
  };
179
444
  declare const HardwareErrorCodeMessage: HardwareErrorCodeMessageMapping;
@@ -244,7 +509,8 @@ declare enum EDeviceType {
244
509
  ClassicPure = "classicpure",
245
510
  Mini = "mini",
246
511
  Touch = "touch",
247
- Pro = "pro"
512
+ Pro = "pro",
513
+ Pro2 = "pro2"
248
514
  }
249
515
 
250
- export { CreateErrorByMessage, CreateHardwareErrorByBridgeError, Deferred, EDeviceType, EFirmwareType, EOneKeyBleMessageKeys, HardwareError$1 as ERRORS, ERROR_CODES_REQUIRE_DISCONNECT, ERROR_CODES_REQUIRE_RELEASE, HardwareError, HardwareErrorCode, HardwareErrorCodeMessage, IHardwareError, ONEKEY_NOTIFY_CHARACTERISTIC_UUID, ONEKEY_SERVICE_UUID, ONEKEY_WEBUSB_FILTER, ONEKEY_WRITE_CHARACTERISTIC_UUID, TypedError, createDefectiveFirmwareError, createDeferred, createDeprecatedHardwareError, createDeviceNotSupportMethodError, createNeedUpgradeFirmwareHardwareError, createNewFirmwareForceUpdateHardwareError, createNewFirmwareUnReleaseHardwareError, isHeaderChunk, isKnownTrezorWebUsbDevice, isOnekeyDevice, serializeError, wait };
516
+ export { CreateErrorByMessage, CreateHardwareErrorByBridgeError, Deferred, EDeviceType, EFirmwareType, EOneKeyBleMessageKeys, HardwareError$1 as ERRORS, ERROR_CODES_REQUIRE_DISCONNECT, ERROR_CODES_REQUIRE_RELEASE, HARDWARE_CONNECT_PROTOCOL, HardwareConnectProtocol, HardwareError, HardwareErrorCode, HardwareErrorCodeMessage, IHardwareError, ONEKEY_NOTIFY_CHARACTERISTIC_UUID, ONEKEY_SERVICE_UUID, ONEKEY_WEBUSB_FILTER, ONEKEY_WRITE_CHARACTERISTIC_UUID, TypedError, createDefectiveFirmwareError, createDeferred, createDeprecatedHardwareError, createDeviceNotSupportMethodError, createNeedUpgradeFirmwareHardwareError, createNewFirmwareForceUpdateHardwareError, createNewFirmwareUnReleaseHardwareError, isHeaderChunk, isKnownTrezorWebUsbDevice, isOnekeyDevice, serializeError, wait };
package/dist/index.js CHANGED
@@ -165,6 +165,8 @@ const HardwareErrorCode = {
165
165
  TooManyInputs: 827,
166
166
  PinMismatch: 828,
167
167
  KaspaPrevTxIdMismatch: 829,
168
+ DeviceLocked: 830,
169
+ WalletSessionInvalid: 831,
168
170
  LowlevelTrasnportConnectError: 900,
169
171
  WebDeviceNotFoundOrNeedsPermission: 901,
170
172
  WebDevicePromptAccessError: 902,
@@ -270,6 +272,8 @@ const HardwareErrorCodeMessage = {
270
272
  [HardwareErrorCode.TooManyInputs]: 'Too many inputs',
271
273
  [HardwareErrorCode.PinMismatch]: 'PIN mismatch',
272
274
  [HardwareErrorCode.KaspaPrevTxIdMismatch]: 'Kaspa previous transaction id mismatch',
275
+ [HardwareErrorCode.DeviceLocked]: 'Device locked',
276
+ [HardwareErrorCode.WalletSessionInvalid]: 'Wallet session is invalid or expired',
273
277
  [HardwareErrorCode.LowlevelTrasnportConnectError]: 'Lowlevel transport connect error',
274
278
  [HardwareErrorCode.WebDeviceNotFoundOrNeedsPermission]: 'Web-USB or Web-Bluetooth device not found or needs permission',
275
279
  [HardwareErrorCode.WebDevicePromptAccessError]: 'Web-USB or Web-Bluetooth device prompt access error',
@@ -382,11 +386,16 @@ var HardwareError$1 = /*#__PURE__*/Object.freeze({
382
386
  createDeviceNotSupportMethodError: createDeviceNotSupportMethodError
383
387
  });
384
388
 
389
+ const HARDWARE_CONNECT_PROTOCOL = {
390
+ V1: 'V1',
391
+ V2: 'V2',
392
+ };
385
393
  const ONEKEY_WEBUSB_FILTER = [
386
394
  { vendorId: 0x1209, productId: 0x53c0 },
387
395
  { vendorId: 0x1209, productId: 0x53c1 },
388
396
  { vendorId: 0x1209, productId: 0x4f4a },
389
397
  { vendorId: 0x1209, productId: 0x4f4b },
398
+ { vendorId: 0x1209, productId: 0x4f4c },
390
399
  ];
391
400
  const TREZOR_WEBUSB_MANUFACTURER_NAMES = new Set(['trezor', 'trezor company', 'satoshilabs']);
392
401
  const isKnownTrezorWebUsbDevice = (descriptor) => {
@@ -429,7 +438,6 @@ exports.EOneKeyBleMessageKeys = void 0;
429
438
  EOneKeyBleMessageKeys["NOBLE_BLE_STOP_SCAN"] = "$onekey-noble-ble-stop-scan";
430
439
  EOneKeyBleMessageKeys["NOBLE_BLE_GET_DEVICE"] = "$onekey-noble-ble-get-device";
431
440
  EOneKeyBleMessageKeys["NOBLE_BLE_CONNECT"] = "$onekey-noble-ble-connect";
432
- EOneKeyBleMessageKeys["NOBLE_BLE_RELEASE"] = "$onekey-noble-ble-release";
433
441
  EOneKeyBleMessageKeys["NOBLE_BLE_DISCONNECT"] = "$onekey-noble-ble-disconnect";
434
442
  EOneKeyBleMessageKeys["NOBLE_BLE_WRITE"] = "$onekey-noble-ble-write";
435
443
  EOneKeyBleMessageKeys["NOBLE_BLE_SUBSCRIBE"] = "$onekey-noble-ble-subscribe";
@@ -556,6 +564,7 @@ exports.EDeviceType = void 0;
556
564
  EDeviceType["Mini"] = "mini";
557
565
  EDeviceType["Touch"] = "touch";
558
566
  EDeviceType["Pro"] = "pro";
567
+ EDeviceType["Pro2"] = "pro2";
559
568
  })(exports.EDeviceType || (exports.EDeviceType = {}));
560
569
 
561
570
  exports.CreateErrorByMessage = CreateErrorByMessage;
@@ -563,6 +572,7 @@ exports.CreateHardwareErrorByBridgeError = CreateHardwareErrorByBridgeError;
563
572
  exports.ERRORS = HardwareError$1;
564
573
  exports.ERROR_CODES_REQUIRE_DISCONNECT = ERROR_CODES_REQUIRE_DISCONNECT;
565
574
  exports.ERROR_CODES_REQUIRE_RELEASE = ERROR_CODES_REQUIRE_RELEASE;
575
+ exports.HARDWARE_CONNECT_PROTOCOL = HARDWARE_CONNECT_PROTOCOL;
566
576
  exports.HardwareError = HardwareError;
567
577
  exports.HardwareErrorCode = HardwareErrorCode;
568
578
  exports.HardwareErrorCodeMessage = HardwareErrorCodeMessage;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onekeyfe/hd-shared",
3
- "version": "1.1.34-alpha.2",
3
+ "version": "1.1.34-alpha.3",
4
4
  "description": "Hardware SDK's shared tool library",
5
5
  "keywords": [
6
6
  "Hardware-SDK",
@@ -25,5 +25,5 @@
25
25
  "lint": "eslint .",
26
26
  "lint:fix": "eslint . --fix"
27
27
  },
28
- "gitHead": "dee167c35d191f3f4e02c4cb6228e1f926f929ec"
28
+ "gitHead": "3688bc8495eeb2ffd5616270d13fa29e8967623a"
29
29
  }
@@ -489,6 +489,18 @@ export const HardwareErrorCode = {
489
489
  */
490
490
  KaspaPrevTxIdMismatch: 829,
491
491
 
492
+ /**
493
+ * Protocol V2 device must be unlocked before the requested operation.
494
+ * @params: { failureCode?: string; subcode?: number; firmwareMessage?: string }
495
+ */
496
+ DeviceLocked: 830,
497
+
498
+ /**
499
+ * The cached wallet session is invalid or has expired.
500
+ * @params: { failureCode?: string; subcode?: number; firmwareMessage?: string }
501
+ */
502
+ WalletSessionInvalid: 831,
503
+
492
504
  /**
493
505
  * Lowlevel transport connect error
494
506
  */
@@ -641,6 +653,8 @@ export const HardwareErrorCodeMessage: HardwareErrorCodeMessageMapping = {
641
653
  [HardwareErrorCode.TooManyInputs]: 'Too many inputs',
642
654
  [HardwareErrorCode.PinMismatch]: 'PIN mismatch',
643
655
  [HardwareErrorCode.KaspaPrevTxIdMismatch]: 'Kaspa previous transaction id mismatch',
656
+ [HardwareErrorCode.DeviceLocked]: 'Device locked',
657
+ [HardwareErrorCode.WalletSessionInvalid]: 'Wallet session is invalid or expired',
644
658
 
645
659
  /**
646
660
  * Lowlevel transport
package/src/constants.ts CHANGED
@@ -1,11 +1,19 @@
1
1
  import { HardwareErrorCode } from './HardwareError';
2
2
 
3
+ export const HARDWARE_CONNECT_PROTOCOL = {
4
+ V1: 'V1',
5
+ V2: 'V2',
6
+ } as const;
7
+
8
+ export type HardwareConnectProtocol =
9
+ (typeof HARDWARE_CONNECT_PROTOCOL)[keyof typeof HARDWARE_CONNECT_PROTOCOL];
10
+
3
11
  export const ONEKEY_WEBUSB_FILTER = [
4
12
  { vendorId: 0x1209, productId: 0x53c0 }, // Classic Boot、Classic1s Boot、Mini Boot
5
- { vendorId: 0x1209, productId: 0x53c1 }, // Classic Firmware、Classic1s Firmware、Mini Firmware、Pro Firmware、Touch Firmware
6
- { vendorId: 0x1209, productId: 0x4f4a }, // Pro Boot、Touch Boot
7
- { vendorId: 0x1209, productId: 0x4f4b }, // Pro Firmware、Touch Firmware(Not implemented Trezor)
8
- // { vendorId: 0x1209, productId: 0x4f4c }, // Pro Board
13
+ { vendorId: 0x1209, productId: 0x53c1 }, // Classic/Classic1s/Mini/Pro/Touch firmware and legacy Pro2; keep for existing devices
14
+ { vendorId: 0x1209, productId: 0x4f4a }, // Pro bootloader, Touch bootloader, Pro2
15
+ { vendorId: 0x1209, productId: 0x4f4b }, // Pro/Touch firmware (Trezor not implemented), Pro2
16
+ { vendorId: 0x1209, productId: 0x4f4c }, // Pro board and Pro2 with the new firmware PID
9
17
  // { vendorId: 0x1209, productId: 0x4f50 }, // Touch Board
10
18
  ];
11
19
 
@@ -78,9 +86,6 @@ export enum EOneKeyBleMessageKeys {
78
86
  NOBLE_BLE_STOP_SCAN = '$onekey-noble-ble-stop-scan',
79
87
  NOBLE_BLE_GET_DEVICE = '$onekey-noble-ble-get-device',
80
88
  NOBLE_BLE_CONNECT = '$onekey-noble-ble-connect',
81
- // Logical end-of-operation from the renderer (keep-alive): the physical link
82
- // stays up but the main process starts its idle-disconnect countdown.
83
- NOBLE_BLE_RELEASE = '$onekey-noble-ble-release',
84
89
  NOBLE_BLE_DISCONNECT = '$onekey-noble-ble-disconnect',
85
90
  NOBLE_BLE_WRITE = '$onekey-noble-ble-write',
86
91
  NOBLE_BLE_SUBSCRIBE = '$onekey-noble-ble-subscribe',
package/src/deviceType.ts CHANGED
@@ -6,4 +6,5 @@ export enum EDeviceType {
6
6
  Mini = 'mini',
7
7
  Touch = 'touch',
8
8
  Pro = 'pro',
9
+ Pro2 = 'pro2',
9
10
  }