@onekeyfe/hd-shared 0.1.17 → 0.1.18
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 +3 -0
- package/dist/HardwareError.d.ts.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.js +6 -0
- package/package.json +2 -2
- package/src/HardwareError.ts +15 -0
package/dist/HardwareError.d.ts
CHANGED
|
@@ -22,6 +22,8 @@ export declare const HardwareErrorCode: {
|
|
|
22
22
|
readonly DeviceInitializeFailed: 106;
|
|
23
23
|
readonly DeviceInterruptedFromOutside: 107;
|
|
24
24
|
readonly DeviceUnexpectedBootloaderMode: 108;
|
|
25
|
+
readonly DeviceInterruptedFromUser: 109;
|
|
26
|
+
readonly DeviceCheckDeviceIdError: 110;
|
|
25
27
|
readonly NotInitialized: 200;
|
|
26
28
|
readonly IFrameNotInitialized: 300;
|
|
27
29
|
readonly IFrameAleradyInitialized: 301;
|
|
@@ -55,6 +57,7 @@ export declare const HardwareErrorCode: {
|
|
|
55
57
|
readonly ResponseUnexpectTypeError: 805;
|
|
56
58
|
readonly BridgeNetworkError: 806;
|
|
57
59
|
readonly BridgeTimeoutError: 807;
|
|
60
|
+
readonly BridgeNotInstalled: 808;
|
|
58
61
|
};
|
|
59
62
|
export declare const HardwareErrorCodeMessage: HardwareErrorCodeMessageMapping;
|
|
60
63
|
export declare const TypedError: (hardwareError: ErrorCodeUnion | string, message?: string | undefined) => HardwareError;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HardwareError.d.ts","sourceRoot":"","sources":["../src/HardwareError.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,cAAc;IAC7B,SAAS,EAAE,OAAO,CAAC,OAAO,iBAAiB,CAAC,CAAC;IAC7C,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,aAAK,OAAO,CAAC,CAAC,SAAS,MAAM,IAAI,CAAC,CAAC,MAAM,CAAC,CAA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
package/dist/index.d.ts
CHANGED
|
@@ -31,6 +31,8 @@ declare const HardwareErrorCode: {
|
|
|
31
31
|
readonly DeviceInitializeFailed: 106;
|
|
32
32
|
readonly DeviceInterruptedFromOutside: 107;
|
|
33
33
|
readonly DeviceUnexpectedBootloaderMode: 108;
|
|
34
|
+
readonly DeviceInterruptedFromUser: 109;
|
|
35
|
+
readonly DeviceCheckDeviceIdError: 110;
|
|
34
36
|
readonly NotInitialized: 200;
|
|
35
37
|
readonly IFrameNotInitialized: 300;
|
|
36
38
|
readonly IFrameAleradyInitialized: 301;
|
|
@@ -64,6 +66,7 @@ declare const HardwareErrorCode: {
|
|
|
64
66
|
readonly ResponseUnexpectTypeError: 805;
|
|
65
67
|
readonly BridgeNetworkError: 806;
|
|
66
68
|
readonly BridgeTimeoutError: 807;
|
|
69
|
+
readonly BridgeNotInstalled: 808;
|
|
67
70
|
};
|
|
68
71
|
declare const HardwareErrorCodeMessage: HardwareErrorCodeMessageMapping;
|
|
69
72
|
declare const TypedError: (hardwareError: ErrorCodeUnion | string, message?: string | undefined) => HardwareError;
|
package/dist/index.js
CHANGED
|
@@ -91,6 +91,8 @@ const HardwareErrorCode = {
|
|
|
91
91
|
DeviceInitializeFailed: 106,
|
|
92
92
|
DeviceInterruptedFromOutside: 107,
|
|
93
93
|
DeviceUnexpectedBootloaderMode: 108,
|
|
94
|
+
DeviceInterruptedFromUser: 109,
|
|
95
|
+
DeviceCheckDeviceIdError: 110,
|
|
94
96
|
NotInitialized: 200,
|
|
95
97
|
IFrameNotInitialized: 300,
|
|
96
98
|
IFrameAleradyInitialized: 301,
|
|
@@ -124,6 +126,7 @@ const HardwareErrorCode = {
|
|
|
124
126
|
ResponseUnexpectTypeError: 805,
|
|
125
127
|
BridgeNetworkError: 806,
|
|
126
128
|
BridgeTimeoutError: 807,
|
|
129
|
+
BridgeNotInstalled: 808,
|
|
127
130
|
};
|
|
128
131
|
const HardwareErrorCodeMessage = {
|
|
129
132
|
[HardwareErrorCode.UnknownError]: 'Unknown error occurred. Check message property.',
|
|
@@ -134,7 +137,9 @@ const HardwareErrorCodeMessage = {
|
|
|
134
137
|
[HardwareErrorCode.DeviceNotFound]: 'Device not found',
|
|
135
138
|
[HardwareErrorCode.DeviceInitializeFailed]: 'Device initialization failed',
|
|
136
139
|
[HardwareErrorCode.DeviceInterruptedFromOutside]: 'Device interrupted',
|
|
140
|
+
[HardwareErrorCode.DeviceInterruptedFromUser]: 'Device interrupted',
|
|
137
141
|
[HardwareErrorCode.DeviceUnexpectedBootloaderMode]: 'Device should be in bootloader mode',
|
|
142
|
+
[HardwareErrorCode.DeviceCheckDeviceIdError]: 'Device Id in the features is not same.',
|
|
138
143
|
[HardwareErrorCode.NotInitialized]: 'Not initialized',
|
|
139
144
|
[HardwareErrorCode.IFrameNotInitialized]: 'IFrame not initialized',
|
|
140
145
|
[HardwareErrorCode.IFrameAleradyInitialized]: 'IFrame alerady initialized',
|
|
@@ -168,6 +173,7 @@ const HardwareErrorCodeMessage = {
|
|
|
168
173
|
[HardwareErrorCode.ResponseUnexpectTypeError]: 'Response type is not expected',
|
|
169
174
|
[HardwareErrorCode.BridgeNetworkError]: 'Bridge network error',
|
|
170
175
|
[HardwareErrorCode.BridgeTimeoutError]: 'Bridge network timeout',
|
|
176
|
+
[HardwareErrorCode.BridgeNotInstalled]: 'Bridge not installed',
|
|
171
177
|
};
|
|
172
178
|
const TypedError = (hardwareError, message) => {
|
|
173
179
|
if (typeof hardwareError === 'string') {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onekeyfe/hd-shared",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.18",
|
|
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": "eebfd1dd46b146c64a8bfda691dc4d8402fa105b"
|
|
29
29
|
}
|
package/src/HardwareError.ts
CHANGED
|
@@ -86,6 +86,13 @@ export const HardwareErrorCode = {
|
|
|
86
86
|
*/
|
|
87
87
|
DeviceUnexpectedBootloaderMode: 108,
|
|
88
88
|
|
|
89
|
+
/**
|
|
90
|
+
* Device interrupted from user
|
|
91
|
+
*/
|
|
92
|
+
DeviceInterruptedFromUser: 109,
|
|
93
|
+
|
|
94
|
+
DeviceCheckDeviceIdError: 110,
|
|
95
|
+
|
|
89
96
|
/**
|
|
90
97
|
* Not initialized
|
|
91
98
|
*/
|
|
@@ -214,6 +221,11 @@ export const HardwareErrorCode = {
|
|
|
214
221
|
* Bridge network timeout
|
|
215
222
|
*/
|
|
216
223
|
BridgeTimeoutError: 807,
|
|
224
|
+
|
|
225
|
+
/**
|
|
226
|
+
* Bridge not installed
|
|
227
|
+
*/
|
|
228
|
+
BridgeNotInstalled: 808,
|
|
217
229
|
} as const;
|
|
218
230
|
|
|
219
231
|
export const HardwareErrorCodeMessage: HardwareErrorCodeMessageMapping = {
|
|
@@ -229,7 +241,9 @@ export const HardwareErrorCodeMessage: HardwareErrorCodeMessageMapping = {
|
|
|
229
241
|
[HardwareErrorCode.DeviceNotFound]: 'Device not found',
|
|
230
242
|
[HardwareErrorCode.DeviceInitializeFailed]: 'Device initialization failed',
|
|
231
243
|
[HardwareErrorCode.DeviceInterruptedFromOutside]: 'Device interrupted',
|
|
244
|
+
[HardwareErrorCode.DeviceInterruptedFromUser]: 'Device interrupted',
|
|
232
245
|
[HardwareErrorCode.DeviceUnexpectedBootloaderMode]: 'Device should be in bootloader mode',
|
|
246
|
+
[HardwareErrorCode.DeviceCheckDeviceIdError]: 'Device Id in the features is not same.',
|
|
233
247
|
|
|
234
248
|
/**
|
|
235
249
|
* Node Errors
|
|
@@ -290,6 +304,7 @@ export const HardwareErrorCodeMessage: HardwareErrorCodeMessageMapping = {
|
|
|
290
304
|
[HardwareErrorCode.ResponseUnexpectTypeError]: 'Response type is not expected',
|
|
291
305
|
[HardwareErrorCode.BridgeNetworkError]: 'Bridge network error',
|
|
292
306
|
[HardwareErrorCode.BridgeTimeoutError]: 'Bridge network timeout',
|
|
307
|
+
[HardwareErrorCode.BridgeNotInstalled]: 'Bridge not installed',
|
|
293
308
|
} as const;
|
|
294
309
|
|
|
295
310
|
export const TypedError = (hardwareError: ErrorCodeUnion | string, message?: string) => {
|