@onekeyfe/hd-shared 1.1.34-alpha.1 → 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.
- package/dist/HardwareError.d.ts +2 -0
- package/dist/HardwareError.d.ts.map +1 -1
- package/dist/constants.d.ts +5 -0
- package/dist/constants.d.ts.map +1 -1
- package/dist/deviceType.d.ts +2 -1
- package/dist/deviceType.d.ts.map +1 -1
- package/dist/index.d.ts +269 -2
- package/dist/index.js +11 -0
- package/package.json +2 -2
- package/src/HardwareError.ts +14 -0
- package/src/constants.ts +12 -4
- package/src/deviceType.ts +1 -0
package/dist/HardwareError.d.ts
CHANGED
|
@@ -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,CAA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AAG,MAAM,YAC5B,MAAM,WACP,GAAG,kBAMb,CAAC;AAEF,eAAO,MAAM,cAAc,YAAa,GAAG,QAe1C,CAAC;AAEF,eAAO,MAAM,oBAAoB,YAAa,MAAM,KAAG,aAOtD,CAAC;AAGF,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"}
|
package/dist/constants.d.ts
CHANGED
|
@@ -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;
|
package/dist/constants.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":";AAEA,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;IAGrD,uBAAuB,oCAAoC;IAC3D,sBAAsB,mCAAmC;IAGzD,mBAAmB,gCAAgC;IACnD,mBAAmB,gCAAgC;IACnD,oBAAoB,iCAAiC;IACrD,iBAAiB,8BAA8B;IAC/C,oBAAoB,iCAAiC;IACrD,eAAe,4BAA4B;IAC3C,mBAAmB,gCAAgC;IACnD,qBAAqB,kCAAkC;IACvD,sBAAsB,mCAAmC;IACzD,wBAAwB,qCAAqC;CAC9D;AAED,eAAO,MAAM,mBAAmB,yCAAyC,CAAC;AAC1E,eAAO,MAAM,gCAAgC,yCAAyC,CAAC;AACvF,eAAO,MAAM,iCAAiC,yCAAyC,CAAC;AAIxF,eAAO,MAAM,aAAa,UAAW,MAAM,GAAG,UAAU,KAA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C;AAC1E,eAAO,MAAM,gCAAgC,yCAAyC,CAAC;AACvF,eAAO,MAAM,iCAAiC,yCAAyC,CAAC;AAIxF,eAAO,MAAM,aAAa,UAAW,MAAM,GAAG,UAAU,KAAG,OAa1D,CAAC;AAkBF,eAAO,MAAM,cAAc,SAAU,MAAM,GAAG,IAAI,OAAO,MAAM,KAAG,OAgBjE,CAAC"}
|
package/dist/deviceType.d.ts
CHANGED
package/dist/deviceType.d.ts.map
CHANGED
|
@@ -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;
|
|
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",
|
|
@@ -71,53 +84,201 @@ declare class HardwareError extends Error {
|
|
|
71
84
|
constructor(hardwareError: IHardwareError | string);
|
|
72
85
|
}
|
|
73
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
|
+
*/
|
|
74
91
|
readonly UnknownError: 0;
|
|
92
|
+
/**
|
|
93
|
+
* Firmware version mismatch
|
|
94
|
+
*/
|
|
75
95
|
readonly DeviceFwException: 101;
|
|
96
|
+
/**
|
|
97
|
+
* Device unexpected mode
|
|
98
|
+
*/
|
|
76
99
|
readonly DeviceUnexpectedMode: 102;
|
|
100
|
+
/**
|
|
101
|
+
* Device list is not initialized
|
|
102
|
+
*/
|
|
77
103
|
readonly DeviceListNotInitialized: 103;
|
|
104
|
+
/**
|
|
105
|
+
* Please select the connected device
|
|
106
|
+
*/
|
|
78
107
|
readonly SelectDevice: 104;
|
|
108
|
+
/**
|
|
109
|
+
* Device not found
|
|
110
|
+
*/
|
|
79
111
|
readonly DeviceNotFound: 105;
|
|
112
|
+
/**
|
|
113
|
+
* Device is not initialized
|
|
114
|
+
*/
|
|
80
115
|
readonly DeviceInitializeFailed: 106;
|
|
116
|
+
/**
|
|
117
|
+
* Device interrupted from another operation
|
|
118
|
+
*/
|
|
81
119
|
readonly DeviceInterruptedFromOutside: 107;
|
|
120
|
+
/**
|
|
121
|
+
* Device should be in bootloader mode
|
|
122
|
+
*/
|
|
82
123
|
readonly RequiredButInBootloaderMode: 108;
|
|
124
|
+
/**
|
|
125
|
+
* Device interrupted from user
|
|
126
|
+
*/
|
|
83
127
|
readonly DeviceInterruptedFromUser: 109;
|
|
128
|
+
/**
|
|
129
|
+
* Check device id is same
|
|
130
|
+
*/
|
|
84
131
|
readonly DeviceCheckDeviceIdError: 110;
|
|
132
|
+
/**
|
|
133
|
+
* Do not support passphrase
|
|
134
|
+
* @params: { require: string }
|
|
135
|
+
*/
|
|
85
136
|
readonly DeviceNotSupportPassphrase: 111;
|
|
86
137
|
readonly DeviceCheckPassphraseStateError: 112;
|
|
138
|
+
/**
|
|
139
|
+
* use passphrase, but passphrase is not opened
|
|
140
|
+
*/
|
|
87
141
|
readonly DeviceNotOpenedPassphrase: 113;
|
|
142
|
+
/**
|
|
143
|
+
* not use passphrase, but passphrase is opened
|
|
144
|
+
*/
|
|
88
145
|
readonly DeviceOpenedPassphrase: 114;
|
|
146
|
+
/**
|
|
147
|
+
* Detect hardware that is in bootloader mode and return an error.
|
|
148
|
+
*/
|
|
89
149
|
readonly DeviceDetectInBootloaderMode: 115;
|
|
150
|
+
/**
|
|
151
|
+
* Device not allow in bootloader mode
|
|
152
|
+
*/
|
|
90
153
|
readonly NotAllowInBootloaderMode: 116;
|
|
154
|
+
/**
|
|
155
|
+
* Device is busy
|
|
156
|
+
*/
|
|
91
157
|
readonly DeviceBusy: 117;
|
|
158
|
+
/**
|
|
159
|
+
* Device check unlock type not match error
|
|
160
|
+
*/
|
|
92
161
|
readonly DeviceCheckUnlockTypeError: 118;
|
|
162
|
+
/**
|
|
163
|
+
* Not initialized
|
|
164
|
+
*/
|
|
93
165
|
readonly NotInitialized: 200;
|
|
166
|
+
/**
|
|
167
|
+
* Iframe not initialized
|
|
168
|
+
*/
|
|
94
169
|
readonly IFrameNotInitialized: 300;
|
|
170
|
+
/**
|
|
171
|
+
* iframe repeat initialization
|
|
172
|
+
*/
|
|
95
173
|
readonly IFrameAleradyInitialized: 301;
|
|
174
|
+
/**
|
|
175
|
+
* iframe load failure
|
|
176
|
+
*/
|
|
96
177
|
readonly IFrameLoadFail: 302;
|
|
178
|
+
/**
|
|
179
|
+
* init iframe time out
|
|
180
|
+
*/
|
|
97
181
|
readonly IframeTimeout: 303;
|
|
182
|
+
/**
|
|
183
|
+
* iframe blocked
|
|
184
|
+
*/
|
|
98
185
|
readonly IframeBlocked: 304;
|
|
186
|
+
/**
|
|
187
|
+
* iframe host not trust
|
|
188
|
+
*/
|
|
99
189
|
readonly IframeDistrust: 305;
|
|
190
|
+
/**
|
|
191
|
+
* Runtime errors during method execution
|
|
192
|
+
*/
|
|
100
193
|
readonly CallMethodError: 400;
|
|
194
|
+
/**
|
|
195
|
+
* Method does not responding
|
|
196
|
+
*/
|
|
101
197
|
readonly CallMethodNotResponse: 404;
|
|
198
|
+
/**
|
|
199
|
+
* Call method invalid parameter
|
|
200
|
+
*/
|
|
102
201
|
readonly CallMethodInvalidParameter: 405;
|
|
202
|
+
/**
|
|
203
|
+
* firmware update download failed
|
|
204
|
+
*/
|
|
103
205
|
readonly FirmwareUpdateDownloadFailed: 406;
|
|
206
|
+
/**
|
|
207
|
+
* Call method not supported, need update firmware
|
|
208
|
+
* @params: { current: string, require: string }
|
|
209
|
+
*/
|
|
104
210
|
readonly CallMethodNeedUpgradeFirmware: 407;
|
|
211
|
+
/**
|
|
212
|
+
* Call method not supported, is deprecated
|
|
213
|
+
* @params: { current: string, deprecated: string }
|
|
214
|
+
*/
|
|
105
215
|
readonly CallMethodDeprecated: 408;
|
|
216
|
+
/**
|
|
217
|
+
* Only one device can be connected during firmware upgrade
|
|
218
|
+
*/
|
|
106
219
|
readonly FirmwareUpdateLimitOneDevice: 409;
|
|
220
|
+
/**
|
|
221
|
+
* You need to manually enter boot
|
|
222
|
+
*/
|
|
107
223
|
readonly FirmwareUpdateManuallyEnterBoot: 410;
|
|
224
|
+
/**
|
|
225
|
+
* Manual entry fails. You must manually enter the boot
|
|
226
|
+
*/
|
|
108
227
|
readonly FirmwareUpdateAutoEnterBootFailure: 411;
|
|
228
|
+
/**
|
|
229
|
+
* The new firmware has not been released yet
|
|
230
|
+
*/
|
|
109
231
|
readonly NewFirmwareUnRelease: 412;
|
|
232
|
+
/**
|
|
233
|
+
* use OneKey desktop client to update the firmware
|
|
234
|
+
* because need copy resource file to Touch
|
|
235
|
+
*/
|
|
110
236
|
readonly UseDesktopToUpdateFirmware: 413;
|
|
237
|
+
/**
|
|
238
|
+
* Mandatory firmware update
|
|
239
|
+
* @params:{ connectId: string? , deviceId: string? }
|
|
240
|
+
*/
|
|
111
241
|
readonly NewFirmwareForceUpdate: 414;
|
|
242
|
+
/**
|
|
243
|
+
* Device not support this method
|
|
244
|
+
*/
|
|
112
245
|
readonly DeviceNotSupportMethod: 415;
|
|
246
|
+
/**
|
|
247
|
+
* Forbidden key path
|
|
248
|
+
*/
|
|
113
249
|
readonly ForbiddenKeyPath: 416;
|
|
250
|
+
/**
|
|
251
|
+
* Repeat unlocking
|
|
252
|
+
* all network get address by loop need repeat unlocking
|
|
253
|
+
*/
|
|
114
254
|
readonly RepeatUnlocking: 417;
|
|
255
|
+
/**
|
|
256
|
+
* Defective firmware detected
|
|
257
|
+
*/
|
|
115
258
|
readonly DefectiveFirmware: 418;
|
|
259
|
+
/**
|
|
260
|
+
* Netword request error
|
|
261
|
+
*/
|
|
116
262
|
readonly NetworkError: 500;
|
|
263
|
+
/**
|
|
264
|
+
* Transport not configured
|
|
265
|
+
*/
|
|
117
266
|
readonly TransportNotConfigured: 600;
|
|
267
|
+
/**
|
|
268
|
+
* Transport call in progress
|
|
269
|
+
*/
|
|
118
270
|
readonly TransportCallInProgress: 601;
|
|
271
|
+
/**
|
|
272
|
+
* Transport not found
|
|
273
|
+
*/
|
|
119
274
|
readonly TransportNotFound: 602;
|
|
275
|
+
/**
|
|
276
|
+
* Transport invalid protobuf
|
|
277
|
+
*/
|
|
120
278
|
readonly TransportInvalidProtobuf: 603;
|
|
279
|
+
/**
|
|
280
|
+
* Bluetooth error code
|
|
281
|
+
*/
|
|
121
282
|
readonly BleScanError: 700;
|
|
122
283
|
readonly BlePermissionError: 701;
|
|
123
284
|
readonly BleLocationError: 702;
|
|
@@ -141,38 +302,143 @@ declare const HardwareErrorCode: {
|
|
|
141
302
|
readonly BleDeviceDisconnected: 720;
|
|
142
303
|
readonly BlePoweredOff: 721;
|
|
143
304
|
readonly BleUnsupported: 722;
|
|
305
|
+
/**
|
|
306
|
+
* Hardware runtiome errors
|
|
307
|
+
*/
|
|
144
308
|
readonly RuntimeError: 800;
|
|
309
|
+
/**
|
|
310
|
+
* invalid pin
|
|
311
|
+
*/
|
|
145
312
|
readonly PinInvalid: 801;
|
|
313
|
+
/**
|
|
314
|
+
* pin cancelled by user
|
|
315
|
+
*/
|
|
146
316
|
readonly PinCancelled: 802;
|
|
317
|
+
/**
|
|
318
|
+
* Action cancelled by user
|
|
319
|
+
*/
|
|
147
320
|
readonly ActionCancelled: 803;
|
|
321
|
+
/**
|
|
322
|
+
* Firmware installation failed
|
|
323
|
+
*/
|
|
148
324
|
readonly FirmwareError: 804;
|
|
325
|
+
/**
|
|
326
|
+
* transport response unexpect error
|
|
327
|
+
*/
|
|
149
328
|
readonly ResponseUnexpectTypeError: 805;
|
|
329
|
+
/**
|
|
330
|
+
* bridge network error
|
|
331
|
+
*/
|
|
150
332
|
readonly BridgeNetworkError: 806;
|
|
333
|
+
/**
|
|
334
|
+
* Bridge network timeout
|
|
335
|
+
*/
|
|
151
336
|
readonly BridgeTimeoutError: 807;
|
|
337
|
+
/**
|
|
338
|
+
* Bridge not installed
|
|
339
|
+
*/
|
|
152
340
|
readonly BridgeNotInstalled: 808;
|
|
341
|
+
/**
|
|
342
|
+
* ensure connect timeout
|
|
343
|
+
*/
|
|
153
344
|
readonly PollingTimeout: 809;
|
|
345
|
+
/**
|
|
346
|
+
* ensure connect stop polling
|
|
347
|
+
*/
|
|
154
348
|
readonly PollingStop: 810;
|
|
349
|
+
/**
|
|
350
|
+
* Device does not open blid sign
|
|
351
|
+
*/
|
|
155
352
|
readonly BlindSignDisabled: 811;
|
|
156
353
|
readonly UnexpectPassphrase: 812;
|
|
354
|
+
/**
|
|
355
|
+
* NFT file already exists
|
|
356
|
+
*/
|
|
157
357
|
readonly FileAlreadyExists: 813;
|
|
358
|
+
/**
|
|
359
|
+
* check file length error
|
|
360
|
+
*/
|
|
158
361
|
readonly CheckDownloadFileError: 814;
|
|
362
|
+
/**
|
|
363
|
+
* not in signing mode
|
|
364
|
+
*/
|
|
159
365
|
readonly NotInSigningMode: 815;
|
|
366
|
+
/**
|
|
367
|
+
* not in signing mode
|
|
368
|
+
*/
|
|
160
369
|
readonly DataOverload: 816;
|
|
370
|
+
/**
|
|
371
|
+
* device disconnected during action
|
|
372
|
+
*/
|
|
161
373
|
readonly BridgeDeviceDisconnected: 817;
|
|
374
|
+
/**
|
|
375
|
+
* BTC PSBT too many utxos
|
|
376
|
+
* @params:{ count: number }
|
|
377
|
+
*/
|
|
162
378
|
readonly BTCPsbtTooManyUtxos: 818;
|
|
379
|
+
/**
|
|
380
|
+
* EMMC file write firmware error
|
|
381
|
+
*/
|
|
163
382
|
readonly EmmcFileWriteFirmwareError: 819;
|
|
383
|
+
/**
|
|
384
|
+
* Firmware verification failed (e.g., bootloader file verify failed)
|
|
385
|
+
*/
|
|
164
386
|
readonly FirmwareVerificationFailed: 820;
|
|
387
|
+
/**
|
|
388
|
+
* Web bridge coonect needs permission
|
|
389
|
+
*/
|
|
165
390
|
readonly BridgeNeedsPermission: 821;
|
|
166
391
|
readonly CallQueueActionCancelled: 822;
|
|
392
|
+
/**
|
|
393
|
+
* Firmware downgrade not allowed
|
|
394
|
+
*/
|
|
167
395
|
readonly FirmwareDowngradeNotAllowed: 823;
|
|
396
|
+
/**
|
|
397
|
+
* Cosmos invalid JSON message, Only support Amino msgs.
|
|
398
|
+
*/
|
|
168
399
|
readonly CosmosInvalidJsonMessage: 824;
|
|
400
|
+
/**
|
|
401
|
+
* No setting provided
|
|
402
|
+
*/
|
|
169
403
|
readonly DeviceSettingsNotProvided: 825;
|
|
404
|
+
/**
|
|
405
|
+
* Language not supported
|
|
406
|
+
*/
|
|
170
407
|
readonly DeviceSettingsLanguageNotSupport: 826;
|
|
408
|
+
/**
|
|
409
|
+
* Too many inputs
|
|
410
|
+
* @params: { count?: string }
|
|
411
|
+
*/
|
|
171
412
|
readonly TooManyInputs: 827;
|
|
413
|
+
/**
|
|
414
|
+
* The two PIN entries did not match while setting/changing PIN on device
|
|
415
|
+
*/
|
|
172
416
|
readonly PinMismatch: 828;
|
|
417
|
+
/**
|
|
418
|
+
* Device refused to sign: refTxs don't match the spent input's outpoint
|
|
419
|
+
*/
|
|
173
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
|
+
*/
|
|
174
434
|
readonly LowlevelTrasnportConnectError: 900;
|
|
435
|
+
/**
|
|
436
|
+
* Web USB or Web Bluetooth device not found or needs permission
|
|
437
|
+
*/
|
|
175
438
|
readonly WebDeviceNotFoundOrNeedsPermission: 901;
|
|
439
|
+
/**
|
|
440
|
+
* Web USB or Web Bluetooth device prompt access error
|
|
441
|
+
*/
|
|
176
442
|
readonly WebDevicePromptAccessError: 902;
|
|
177
443
|
};
|
|
178
444
|
declare const HardwareErrorCodeMessage: HardwareErrorCodeMessageMapping;
|
|
@@ -243,7 +509,8 @@ declare enum EDeviceType {
|
|
|
243
509
|
ClassicPure = "classicpure",
|
|
244
510
|
Mini = "mini",
|
|
245
511
|
Touch = "touch",
|
|
246
|
-
Pro = "pro"
|
|
512
|
+
Pro = "pro",
|
|
513
|
+
Pro2 = "pro2"
|
|
247
514
|
}
|
|
248
515
|
|
|
249
|
-
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) => {
|
|
@@ -555,6 +564,7 @@ exports.EDeviceType = void 0;
|
|
|
555
564
|
EDeviceType["Mini"] = "mini";
|
|
556
565
|
EDeviceType["Touch"] = "touch";
|
|
557
566
|
EDeviceType["Pro"] = "pro";
|
|
567
|
+
EDeviceType["Pro2"] = "pro2";
|
|
558
568
|
})(exports.EDeviceType || (exports.EDeviceType = {}));
|
|
559
569
|
|
|
560
570
|
exports.CreateErrorByMessage = CreateErrorByMessage;
|
|
@@ -562,6 +572,7 @@ exports.CreateHardwareErrorByBridgeError = CreateHardwareErrorByBridgeError;
|
|
|
562
572
|
exports.ERRORS = HardwareError$1;
|
|
563
573
|
exports.ERROR_CODES_REQUIRE_DISCONNECT = ERROR_CODES_REQUIRE_DISCONNECT;
|
|
564
574
|
exports.ERROR_CODES_REQUIRE_RELEASE = ERROR_CODES_REQUIRE_RELEASE;
|
|
575
|
+
exports.HARDWARE_CONNECT_PROTOCOL = HARDWARE_CONNECT_PROTOCOL;
|
|
565
576
|
exports.HardwareError = HardwareError;
|
|
566
577
|
exports.HardwareErrorCode = HardwareErrorCode;
|
|
567
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.
|
|
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": "
|
|
28
|
+
"gitHead": "3688bc8495eeb2ffd5616270d13fa29e8967623a"
|
|
29
29
|
}
|
package/src/HardwareError.ts
CHANGED
|
@@ -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
|
|
6
|
-
{ vendorId: 0x1209, productId: 0x4f4a }, // Pro
|
|
7
|
-
{ vendorId: 0x1209, productId: 0x4f4b }, // Pro
|
|
8
|
-
|
|
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
|
|