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