@onekeyfe/hd-shared 1.2.0-alpha.18 → 1.2.0-alpha.180

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.
@@ -86,6 +86,7 @@ export declare const HardwareErrorCode: {
86
86
  readonly BleDeviceDisconnected: 720;
87
87
  readonly BlePoweredOff: 721;
88
88
  readonly BleUnsupported: 722;
89
+ readonly BleUnavailableWhileUsbConnected: 723;
89
90
  readonly RuntimeError: 800;
90
91
  readonly PinInvalid: 801;
91
92
  readonly PinCancelled: 802;
@@ -115,8 +116,9 @@ export declare const HardwareErrorCode: {
115
116
  readonly DeviceSettingsLanguageNotSupport: 826;
116
117
  readonly TooManyInputs: 827;
117
118
  readonly PinMismatch: 828;
118
- readonly DeviceLocked: 829;
119
- readonly KaspaPrevTxIdMismatch: 830;
119
+ readonly DeviceLocked: 830;
120
+ readonly WalletSessionInvalid: 831;
121
+ readonly NftStorageLimitReached: 832;
120
122
  readonly LowlevelTrasnportConnectError: 900;
121
123
  readonly WebDeviceNotFoundOrNeedsPermission: 901;
122
124
  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,i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GF,eAAO,MAAM,gCAAgC,QAAS,MAAM,KAAG,aAQ9D,CAAC;AAEF,QAAA,MAAM,uCAAuC;oBAM3B,MAAM;oBACN,MAAM;;;mBAcvB,CAAC;AAEF,QAAA,MAAM,sCAAsC;oBAM1B,MAAM;oBACN,MAAM;;;mBAcvB,CAAC;AAEF,QAAA,MAAM,yCAAyC,cAClC,MAAM,GAAG,SAAS,YACnB,MAAM,GAAG,SAAS,iBACb,CAAC,UAAU,GAAG,KAAK,CAAC,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"}
@@ -8,6 +8,10 @@ export declare const ONEKEY_WEBUSB_FILTER: {
8
8
  vendorId: number;
9
9
  productId: number;
10
10
  }[];
11
+ export declare const ONEKEY_PROTOCOL_V2_USB_IDS: readonly [{
12
+ readonly vendorId: 4617;
13
+ readonly productId: 20300;
14
+ }];
11
15
  type WebUsbIdentityDescriptor = {
12
16
  vendorId?: number;
13
17
  productId?: number;
@@ -33,17 +37,47 @@ export declare enum EOneKeyBleMessageKeys {
33
37
  NOBLE_BLE_STOP_SCAN = "$onekey-noble-ble-stop-scan",
34
38
  NOBLE_BLE_GET_DEVICE = "$onekey-noble-ble-get-device",
35
39
  NOBLE_BLE_CONNECT = "$onekey-noble-ble-connect",
40
+ NOBLE_BLE_RELEASE = "$onekey-noble-ble-release",
36
41
  NOBLE_BLE_DISCONNECT = "$onekey-noble-ble-disconnect",
37
42
  NOBLE_BLE_WRITE = "$onekey-noble-ble-write",
38
43
  NOBLE_BLE_SUBSCRIBE = "$onekey-noble-ble-subscribe",
39
44
  NOBLE_BLE_UNSUBSCRIBE = "$onekey-noble-ble-unsubscribe",
40
45
  NOBLE_BLE_NOTIFICATION = "$onekey-noble-ble-notification",
46
+ NOBLE_BLE_MTU_CHANGED = "$onekey-noble-ble-mtu-changed",
41
47
  NOBLE_BLE_CANCEL_PAIRING = "$onekey-noble-ble-cancel-pairing"
42
48
  }
49
+ export declare enum EBleDisconnectReason {
50
+ DeviceDisconnected = "device-disconnected",
51
+ IdleKeepAlive = "idle-keep-alive"
52
+ }
43
53
  export declare const ONEKEY_SERVICE_UUID = "00000001-0000-1000-8000-00805f9b34fb";
44
54
  export declare const ONEKEY_WRITE_CHARACTERISTIC_UUID = "00000002-0000-1000-8000-00805f9b34fb";
45
55
  export declare const ONEKEY_NOTIFY_CHARACTERISTIC_UUID = "00000003-0000-1000-8000-00805f9b34fb";
46
56
  export declare const isHeaderChunk: (chunk: Buffer | Uint8Array) => boolean;
47
57
  export declare const isOnekeyDevice: (name: string | null, id?: string) => boolean;
58
+ export declare const inferProtocolHintFromUsbId: (vendorId?: number | null, productId?: number | null) => "V2" | undefined;
59
+ type UsbDevicePathInput = {
60
+ serialNumber?: string | null;
61
+ vendorId?: number;
62
+ productId?: number;
63
+ productName?: string | null;
64
+ };
65
+ export declare const resolveOneKeyUsbDevicePath: (device: UsbDevicePathInput) => string | undefined;
66
+ type BluetoothDeviceIdentity = {
67
+ id?: string;
68
+ name?: string | null;
69
+ localName?: string | null;
70
+ serviceUuids?: Array<string | null | undefined> | null;
71
+ };
72
+ export declare const normalizeBleUuid: (uuid?: string | null) => string;
73
+ export declare const createKnownBleUuidAliases: (uuid: string) => ReadonlySet<string>;
74
+ export declare const matchesKnownBleUuid: (actualUuid: string | null | undefined, aliases: ReadonlySet<string>) => boolean;
75
+ export declare const isPro2FindMyAdvertisementName: (value?: string | null) => boolean;
76
+ export declare const normalizePro2FindMyAdvertisementName: (value: string) => string;
77
+ export declare const canonicalizePro2BleAdvertisementName: (value: string) => string;
78
+ export declare const isSameOnekeyBleName: (left?: string | null, right?: string | null) => boolean;
79
+ export declare const hasOnekeyCommunicationService: (serviceUuids: Array<string | null | undefined> | null | undefined) => boolean;
80
+ export declare const isPro2FamilyBleName: (value?: string | null) => boolean;
81
+ export declare const isOnekeyBluetoothDevice: ({ id, name, localName, serviceUuids, }: BluetoothDeviceIdentity) => boolean;
48
82
  export {};
49
83
  //# sourceMappingURL=constants.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":";AAEA,eAAO,MAAM,yBAAyB;;;CAG5B,CAAC;AAEX,MAAM,MAAM,uBAAuB,GACjC,CAAC,OAAO,yBAAyB,CAAC,CAAC,MAAM,OAAO,yBAAyB,CAAC,CAAC;AAE7E,eAAO,MAAM,oBAAoB;;;GAOhC,CAAC;AAEF,KAAK,wBAAwB,GAAG;IAC9B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,gBAAgB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAClC,CAAC;AAIF,eAAO,MAAM,yBAAyB,eAAgB,wBAAwB,KAAG,OAQhF,CAAC;AAMF,eAAO,MAAM,2BAA2B,mDAS9B,CAAC;AAMX,eAAO,MAAM,8BAA8B,qBAGjC,CAAC;AAGX,oBAAY,qBAAqB;IAE/B,UAAU,uBAAuB;IACjC,iBAAiB,8BAA8B;IAC/C,aAAa,0BAA0B;IACvC,kBAAkB,+BAA+B;IACjD,cAAc,2BAA2B;IACzC,oBAAoB,iCAAiC;IAGrD,mBAAmB,gCAAgC;IACnD,oBAAoB,iCAAiC;IAGrD,aAAa,0BAA0B;IACvC,oBAAoB,iCAAiC;IA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K,uBAAuB,GAAG;IAC7B,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,YAAY,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC,GAAG,IAAI,CAAC;CACxD,CAAC;AAIF,eAAO,MAAM,gBAAgB,UAAW,MAAM,GAAG,IAAI,WACP,CAAC;AAE/C,eAAO,MAAM,yBAAyB,SAAU,MAAM,KAAG,YAAY,MAAM,CAc1E,CAAC;AAEF,eAAO,MAAM,mBAAmB,eAClB,MAAM,GAAG,IAAI,GAAG,SAAS,WAC5B,YAAY,MAAM,CAAC,YACgB,CAAC;AAmC/C,eAAO,MAAM,6BAA6B,WAAY,MAAM,GAAG,IAAI,YAWlE,CAAC;AAEF,eAAO,MAAM,oCAAoC,UAAW,MAAM,WAejE,CAAC;AAUF,eAAO,MAAM,oCAAoC,UAAW,MAAM,WAWjE,CAAC;AAEF,eAAO,MAAM,mBAAmB,UAAW,MAAM,GAAG,IAAI,UAAU,MAAM,GAAG,IAAI,YAO9E,CAAC;AAEF,eAAO,MAAM,6BAA6B,iBAC1B,MAAM,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC,GAAG,IAAI,GAAG,SAAS,YAIhE,CAAC;AAOJ,eAAO,MAAM,mBAAmB,WAAY,MAAM,GAAG,IAAI,KAAG,OAiB3D,CAAC;AAEF,eAAO,MAAM,uBAAuB,2CAKjC,uBAAuB,KAAG,OAiB5B,CAAC"}
@@ -6,6 +6,7 @@ export declare enum EDeviceType {
6
6
  Mini = "mini",
7
7
  Touch = "touch",
8
8
  Pro = "pro",
9
- Pro2 = "pro2"
9
+ Pro2 = "pro2",
10
+ Neo = "neo"
10
11
  }
11
12
  //# 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;IACX,IAAI,SAAS;CACd"}
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;IACb,GAAG,QAAQ;CACZ"}
package/dist/index.d.ts CHANGED
@@ -7,13 +7,26 @@ declare const ONEKEY_WEBUSB_FILTER: {
7
7
  vendorId: number;
8
8
  productId: number;
9
9
  }[];
10
+ /** USB IDs whose first probe should be Protocol V2. Shared Pro/Touch PIDs stay unhinted. */
11
+ declare const ONEKEY_PROTOCOL_V2_USB_IDS: readonly [{
12
+ readonly vendorId: 4617;
13
+ readonly productId: 20300;
14
+ }];
10
15
  type WebUsbIdentityDescriptor = {
11
16
  vendorId?: number;
12
17
  productId?: number;
13
18
  manufacturerName?: string | null;
14
19
  };
15
20
  declare const isKnownTrezorWebUsbDevice: (descriptor: WebUsbIdentityDescriptor) => boolean;
21
+ /**
22
+ * Error codes that require device release after occurrence
23
+ * These errors indicate the device is in an invalid state and needs to be released
24
+ */
16
25
  declare const ERROR_CODES_REQUIRE_RELEASE: readonly [106, 107, 109, 112, 805, 801, 802, 812];
26
+ /**
27
+ * Error codes that require device disconnect before release
28
+ * These errors indicate a communication failure that requires full reconnection
29
+ */
17
30
  declare const ERROR_CODES_REQUIRE_DISCONNECT: readonly [106, 805];
18
31
  declare enum EOneKeyBleMessageKeys {
19
32
  BLE_SELECT = "$onekey-ble-select",
@@ -32,18 +45,71 @@ declare enum EOneKeyBleMessageKeys {
32
45
  NOBLE_BLE_STOP_SCAN = "$onekey-noble-ble-stop-scan",
33
46
  NOBLE_BLE_GET_DEVICE = "$onekey-noble-ble-get-device",
34
47
  NOBLE_BLE_CONNECT = "$onekey-noble-ble-connect",
48
+ NOBLE_BLE_RELEASE = "$onekey-noble-ble-release",
35
49
  NOBLE_BLE_DISCONNECT = "$onekey-noble-ble-disconnect",
36
50
  NOBLE_BLE_WRITE = "$onekey-noble-ble-write",
37
51
  NOBLE_BLE_SUBSCRIBE = "$onekey-noble-ble-subscribe",
38
52
  NOBLE_BLE_UNSUBSCRIBE = "$onekey-noble-ble-unsubscribe",
39
53
  NOBLE_BLE_NOTIFICATION = "$onekey-noble-ble-notification",
54
+ NOBLE_BLE_MTU_CHANGED = "$onekey-noble-ble-mtu-changed",
40
55
  NOBLE_BLE_CANCEL_PAIRING = "$onekey-noble-ble-cancel-pairing"
41
56
  }
57
+ /**
58
+ * Why a BLE link went down, carried on BLE_DEVICE_DISCONNECTED.
59
+ *
60
+ * The main process frees an idle link on its own keep-alive timer, which is an
61
+ * internal optimisation the device knows nothing about — consumers must not
62
+ * treat it as "the device is gone". Only DeviceDisconnected means the
63
+ * peripheral actually dropped.
64
+ */
65
+ declare enum EBleDisconnectReason {
66
+ /** Unsolicited peripheral drop: powered off, out of range, cable/BLE lost. */
67
+ DeviceDisconnected = "device-disconnected",
68
+ /** Main-process keep-alive timer released an idle link; device still present. */
69
+ IdleKeepAlive = "idle-keep-alive"
70
+ }
42
71
  declare const ONEKEY_SERVICE_UUID = "00000001-0000-1000-8000-00805f9b34fb";
43
72
  declare const ONEKEY_WRITE_CHARACTERISTIC_UUID = "00000002-0000-1000-8000-00805f9b34fb";
44
73
  declare const ONEKEY_NOTIFY_CHARACTERISTIC_UUID = "00000003-0000-1000-8000-00805f9b34fb";
45
74
  declare const isHeaderChunk: (chunk: Buffer | Uint8Array) => boolean;
46
75
  declare const isOnekeyDevice: (name: string | null, id?: string) => boolean;
76
+ declare const inferProtocolHintFromUsbId: (vendorId?: number | null, productId?: number | null) => "V2" | undefined;
77
+ type UsbDevicePathInput = {
78
+ serialNumber?: string | null;
79
+ vendorId?: number;
80
+ productId?: number;
81
+ productName?: string | null;
82
+ };
83
+ declare const resolveOneKeyUsbDevicePath: (device: UsbDevicePathInput) => string | undefined;
84
+ type BluetoothDeviceIdentity = {
85
+ id?: string;
86
+ name?: string | null;
87
+ localName?: string | null;
88
+ serviceUuids?: Array<string | null | undefined> | null;
89
+ };
90
+ declare const normalizeBleUuid: (uuid?: string | null) => string;
91
+ declare const createKnownBleUuidAliases: (uuid: string) => ReadonlySet<string>;
92
+ declare const matchesKnownBleUuid: (actualUuid: string | null | undefined, aliases: ReadonlySet<string>) => boolean;
93
+ declare const isPro2FindMyAdvertisementName: (value?: string | null) => boolean;
94
+ declare const normalizePro2FindMyAdvertisementName: (value: string) => string;
95
+ /**
96
+ * Current Pro2 advertisements use "Pro 2 XXXX". Older firmware used "Pro2 XXXX".
97
+ * Discovery and DeviceInfo both go through this helper so the public BLE name
98
+ * stays on the spaced form without changing OneKey Pro / Neo names.
99
+ *
100
+ * Match the compact Pro2 form first. A leading "Pro 2" regex would also eat the
101
+ * first digit of a OneKey Pro suffix such as "Pro 22D8" or "Pro 2D8F".
102
+ */
103
+ declare const canonicalizePro2BleAdvertisementName: (value: string) => string;
104
+ declare const isSameOnekeyBleName: (left?: string | null, right?: string | null) => boolean;
105
+ declare const hasOnekeyCommunicationService: (serviceUuids: Array<string | null | undefined> | null | undefined) => boolean;
106
+ /**
107
+ * Protocol V2 family (Pro2 / Neo) by advertised BLE name. Callers use it to
108
+ * pick a connection strategy: this family also advertises under Find My names
109
+ * that carry no OneKey service UUID, so a scan cannot always see it.
110
+ */
111
+ declare const isPro2FamilyBleName: (value?: string | null) => boolean;
112
+ declare const isOnekeyBluetoothDevice: ({ id, name, localName, serviceUuids, }: BluetoothDeviceIdentity) => boolean;
47
113
 
48
114
  type Deferred<T, I = any, D = any> = {
49
115
  id?: I;
@@ -76,53 +142,201 @@ declare class HardwareError extends Error {
76
142
  constructor(hardwareError: IHardwareError | string);
77
143
  }
78
144
  declare const HardwareErrorCode: {
145
+ /**
146
+ * This error can be thrown when unexpected error occurred and in most cases it is related to implementation bug.
147
+ * Original message is available in message property.
148
+ */
79
149
  readonly UnknownError: 0;
150
+ /**
151
+ * Firmware version mismatch
152
+ */
80
153
  readonly DeviceFwException: 101;
154
+ /**
155
+ * Device unexpected mode
156
+ */
81
157
  readonly DeviceUnexpectedMode: 102;
158
+ /**
159
+ * Device list is not initialized
160
+ */
82
161
  readonly DeviceListNotInitialized: 103;
162
+ /**
163
+ * Please select the connected device
164
+ */
83
165
  readonly SelectDevice: 104;
166
+ /**
167
+ * Device not found
168
+ */
84
169
  readonly DeviceNotFound: 105;
170
+ /**
171
+ * Device is not initialized
172
+ */
85
173
  readonly DeviceInitializeFailed: 106;
174
+ /**
175
+ * Device interrupted from another operation
176
+ */
86
177
  readonly DeviceInterruptedFromOutside: 107;
178
+ /**
179
+ * Device should be in bootloader mode
180
+ */
87
181
  readonly RequiredButInBootloaderMode: 108;
182
+ /**
183
+ * Device interrupted from user
184
+ */
88
185
  readonly DeviceInterruptedFromUser: 109;
186
+ /**
187
+ * Check device id is same
188
+ */
89
189
  readonly DeviceCheckDeviceIdError: 110;
190
+ /**
191
+ * Do not support passphrase
192
+ * @params: { require: string }
193
+ */
90
194
  readonly DeviceNotSupportPassphrase: 111;
91
195
  readonly DeviceCheckPassphraseStateError: 112;
196
+ /**
197
+ * use passphrase, but passphrase is not opened
198
+ */
92
199
  readonly DeviceNotOpenedPassphrase: 113;
200
+ /**
201
+ * not use passphrase, but passphrase is opened
202
+ */
93
203
  readonly DeviceOpenedPassphrase: 114;
204
+ /**
205
+ * Detect hardware that is in bootloader mode and return an error.
206
+ */
94
207
  readonly DeviceDetectInBootloaderMode: 115;
208
+ /**
209
+ * Device not allow in bootloader mode
210
+ */
95
211
  readonly NotAllowInBootloaderMode: 116;
212
+ /**
213
+ * Device is busy
214
+ */
96
215
  readonly DeviceBusy: 117;
216
+ /**
217
+ * Device check unlock type not match error
218
+ */
97
219
  readonly DeviceCheckUnlockTypeError: 118;
220
+ /**
221
+ * Not initialized
222
+ */
98
223
  readonly NotInitialized: 200;
224
+ /**
225
+ * Iframe not initialized
226
+ */
99
227
  readonly IFrameNotInitialized: 300;
228
+ /**
229
+ * iframe repeat initialization
230
+ */
100
231
  readonly IFrameAleradyInitialized: 301;
232
+ /**
233
+ * iframe load failure
234
+ */
101
235
  readonly IFrameLoadFail: 302;
236
+ /**
237
+ * init iframe time out
238
+ */
102
239
  readonly IframeTimeout: 303;
240
+ /**
241
+ * iframe blocked
242
+ */
103
243
  readonly IframeBlocked: 304;
244
+ /**
245
+ * iframe host not trust
246
+ */
104
247
  readonly IframeDistrust: 305;
248
+ /**
249
+ * Runtime errors during method execution
250
+ */
105
251
  readonly CallMethodError: 400;
252
+ /**
253
+ * Method does not responding
254
+ */
106
255
  readonly CallMethodNotResponse: 404;
256
+ /**
257
+ * Call method invalid parameter
258
+ */
107
259
  readonly CallMethodInvalidParameter: 405;
260
+ /**
261
+ * firmware update download failed
262
+ */
108
263
  readonly FirmwareUpdateDownloadFailed: 406;
264
+ /**
265
+ * Call method not supported, need update firmware
266
+ * @params: { current: string, require: string }
267
+ */
109
268
  readonly CallMethodNeedUpgradeFirmware: 407;
269
+ /**
270
+ * Call method not supported, is deprecated
271
+ * @params: { current: string, deprecated: string }
272
+ */
110
273
  readonly CallMethodDeprecated: 408;
274
+ /**
275
+ * Only one device can be connected during firmware upgrade
276
+ */
111
277
  readonly FirmwareUpdateLimitOneDevice: 409;
278
+ /**
279
+ * You need to manually enter boot
280
+ */
112
281
  readonly FirmwareUpdateManuallyEnterBoot: 410;
282
+ /**
283
+ * Manual entry fails. You must manually enter the boot
284
+ */
113
285
  readonly FirmwareUpdateAutoEnterBootFailure: 411;
286
+ /**
287
+ * The new firmware has not been released yet
288
+ */
114
289
  readonly NewFirmwareUnRelease: 412;
290
+ /**
291
+ * use OneKey desktop client to update the firmware
292
+ * because need copy resource file to Touch
293
+ */
115
294
  readonly UseDesktopToUpdateFirmware: 413;
295
+ /**
296
+ * Mandatory firmware update
297
+ * @params:{ connectId: string? , deviceId: string? }
298
+ */
116
299
  readonly NewFirmwareForceUpdate: 414;
300
+ /**
301
+ * Device not support this method
302
+ */
117
303
  readonly DeviceNotSupportMethod: 415;
304
+ /**
305
+ * Forbidden key path
306
+ */
118
307
  readonly ForbiddenKeyPath: 416;
308
+ /**
309
+ * Repeat unlocking
310
+ * all network get address by loop need repeat unlocking
311
+ */
119
312
  readonly RepeatUnlocking: 417;
313
+ /**
314
+ * Defective firmware detected
315
+ */
120
316
  readonly DefectiveFirmware: 418;
317
+ /**
318
+ * Netword request error
319
+ */
121
320
  readonly NetworkError: 500;
321
+ /**
322
+ * Transport not configured
323
+ */
122
324
  readonly TransportNotConfigured: 600;
325
+ /**
326
+ * Transport call in progress
327
+ */
123
328
  readonly TransportCallInProgress: 601;
329
+ /**
330
+ * Transport not found
331
+ */
124
332
  readonly TransportNotFound: 602;
333
+ /**
334
+ * Transport invalid protobuf
335
+ */
125
336
  readonly TransportInvalidProtobuf: 603;
337
+ /**
338
+ * Bluetooth error code
339
+ */
126
340
  readonly BleScanError: 700;
127
341
  readonly BlePermissionError: 701;
128
342
  readonly BleLocationError: 702;
@@ -146,39 +360,145 @@ declare const HardwareErrorCode: {
146
360
  readonly BleDeviceDisconnected: 720;
147
361
  readonly BlePoweredOff: 721;
148
362
  readonly BleUnsupported: 722;
363
+ readonly BleUnavailableWhileUsbConnected: 723;
364
+ /**
365
+ * Hardware runtiome errors
366
+ */
149
367
  readonly RuntimeError: 800;
368
+ /**
369
+ * invalid pin
370
+ */
150
371
  readonly PinInvalid: 801;
372
+ /**
373
+ * pin cancelled by user
374
+ */
151
375
  readonly PinCancelled: 802;
376
+ /**
377
+ * Action cancelled by user
378
+ */
152
379
  readonly ActionCancelled: 803;
380
+ /**
381
+ * Firmware installation failed
382
+ */
153
383
  readonly FirmwareError: 804;
384
+ /**
385
+ * transport response unexpect error
386
+ */
154
387
  readonly ResponseUnexpectTypeError: 805;
388
+ /**
389
+ * bridge network error
390
+ */
155
391
  readonly BridgeNetworkError: 806;
392
+ /**
393
+ * Bridge network timeout
394
+ */
156
395
  readonly BridgeTimeoutError: 807;
396
+ /**
397
+ * Bridge not installed
398
+ */
157
399
  readonly BridgeNotInstalled: 808;
400
+ /**
401
+ * ensure connect timeout
402
+ */
158
403
  readonly PollingTimeout: 809;
404
+ /**
405
+ * ensure connect stop polling
406
+ */
159
407
  readonly PollingStop: 810;
408
+ /**
409
+ * Device does not open blid sign
410
+ */
160
411
  readonly BlindSignDisabled: 811;
161
412
  readonly UnexpectPassphrase: 812;
413
+ /**
414
+ * NFT file already exists
415
+ */
162
416
  readonly FileAlreadyExists: 813;
417
+ /**
418
+ * check file length error
419
+ */
163
420
  readonly CheckDownloadFileError: 814;
421
+ /**
422
+ * not in signing mode
423
+ */
164
424
  readonly NotInSigningMode: 815;
425
+ /**
426
+ * not in signing mode
427
+ */
165
428
  readonly DataOverload: 816;
429
+ /**
430
+ * device disconnected during action
431
+ */
166
432
  readonly BridgeDeviceDisconnected: 817;
433
+ /**
434
+ * BTC PSBT too many utxos
435
+ * @params:{ count: number }
436
+ */
167
437
  readonly BTCPsbtTooManyUtxos: 818;
438
+ /**
439
+ * EMMC file write firmware error
440
+ */
168
441
  readonly EmmcFileWriteFirmwareError: 819;
442
+ /**
443
+ * Firmware verification failed (e.g., bootloader file verify failed)
444
+ */
169
445
  readonly FirmwareVerificationFailed: 820;
446
+ /**
447
+ * Web bridge coonect needs permission
448
+ */
170
449
  readonly BridgeNeedsPermission: 821;
171
450
  readonly CallQueueActionCancelled: 822;
451
+ /**
452
+ * Firmware downgrade not allowed
453
+ */
172
454
  readonly FirmwareDowngradeNotAllowed: 823;
455
+ /**
456
+ * Cosmos invalid JSON message, Only support Amino msgs.
457
+ */
173
458
  readonly CosmosInvalidJsonMessage: 824;
459
+ /**
460
+ * No setting provided
461
+ */
174
462
  readonly DeviceSettingsNotProvided: 825;
463
+ /**
464
+ * Language not supported
465
+ */
175
466
  readonly DeviceSettingsLanguageNotSupport: 826;
467
+ /**
468
+ * Too many inputs
469
+ * @params: { count?: string }
470
+ */
176
471
  readonly TooManyInputs: 827;
472
+ /**
473
+ * The two PIN entries did not match while setting/changing PIN on device
474
+ */
177
475
  readonly PinMismatch: 828;
178
- readonly DeviceLocked: 829;
179
- readonly KaspaPrevTxIdMismatch: 830;
476
+ /**
477
+ * Protocol V2 device must be unlocked before the requested operation.
478
+ * @params: { failureCode?: string; subcode?: number; firmwareMessage?: string }
479
+ */
480
+ readonly DeviceLocked: 830;
481
+ /**
482
+ * The cached wallet session is invalid or has expired.
483
+ * @params: { failureCode?: string; subcode?: number; firmwareMessage?: string }
484
+ */
485
+ readonly WalletSessionInvalid: 831;
486
+ /**
487
+ * Pro2 NFT storage has reached its item limit.
488
+ * @params: { count: number; limit: number }
489
+ */
490
+ readonly NftStorageLimitReached: 832;
491
+ /**
492
+ * Lowlevel transport connect error
493
+ */
180
494
  readonly LowlevelTrasnportConnectError: 900;
495
+ /**
496
+ * Web USB or Web Bluetooth device not found or needs permission
497
+ */
181
498
  readonly WebDeviceNotFoundOrNeedsPermission: 901;
499
+ /**
500
+ * Web USB or Web Bluetooth device prompt access error
501
+ */
182
502
  readonly WebDevicePromptAccessError: 902;
183
503
  };
184
504
  declare const HardwareErrorCodeMessage: HardwareErrorCodeMessageMapping;
@@ -250,7 +570,8 @@ declare enum EDeviceType {
250
570
  Mini = "mini",
251
571
  Touch = "touch",
252
572
  Pro = "pro",
253
- Pro2 = "pro2"
573
+ Pro2 = "pro2",
574
+ Neo = "neo"
254
575
  }
255
576
 
256
- 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 };
577
+ export { CreateErrorByMessage, CreateHardwareErrorByBridgeError, Deferred, EBleDisconnectReason, 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_PROTOCOL_V2_USB_IDS, ONEKEY_SERVICE_UUID, ONEKEY_WEBUSB_FILTER, ONEKEY_WRITE_CHARACTERISTIC_UUID, TypedError, canonicalizePro2BleAdvertisementName, createDefectiveFirmwareError, createDeferred, createDeprecatedHardwareError, createDeviceNotSupportMethodError, createKnownBleUuidAliases, createNeedUpgradeFirmwareHardwareError, createNewFirmwareForceUpdateHardwareError, createNewFirmwareUnReleaseHardwareError, hasOnekeyCommunicationService, inferProtocolHintFromUsbId, isHeaderChunk, isKnownTrezorWebUsbDevice, isOnekeyBluetoothDevice, isOnekeyDevice, isPro2FamilyBleName, isPro2FindMyAdvertisementName, isSameOnekeyBleName, matchesKnownBleUuid, normalizeBleUuid, normalizePro2FindMyAdvertisementName, resolveOneKeyUsbDevicePath, serializeError, wait };