@onekeyfe/hd-shared 1.0.22-alpha.2 → 1.0.22
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 -0
- package/dist/index.d.ts +10 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +15 -0
- package/dist/timerUtils.d.ts +2 -0
- package/dist/timerUtils.d.ts.map +1 -0
- package/package.json +2 -2
- package/src/HardwareError.ts +14 -0
- package/src/constants.ts +4 -0
- package/src/index.ts +2 -0
- package/src/timerUtils.ts +4 -0
package/dist/HardwareError.d.ts
CHANGED
|
@@ -96,6 +96,8 @@ export declare const HardwareErrorCode: {
|
|
|
96
96
|
readonly BridgeDeviceDisconnected: 817;
|
|
97
97
|
readonly BTCPsbtTooManyUtxos: 818;
|
|
98
98
|
readonly LowlevelTrasnportConnectError: 900;
|
|
99
|
+
readonly WebDeviceNotFoundOrNeedsPermission: 901;
|
|
100
|
+
readonly WebDevicePromptAccessError: 902;
|
|
99
101
|
};
|
|
100
102
|
export declare const HardwareErrorCodeMessage: HardwareErrorCodeMessageMapping;
|
|
101
103
|
export declare const TypedError: (hardwareError: ErrorCodeUnion | string, message?: string, params?: any) => 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;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,CA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,CAAC;AAEF,eAAO,MAAM,cAAc,YAAa,GAAG,QAe1C,CAAC;AAEF,eAAO,MAAM,oBAAoB,YAAa,MAAM,KAAG,aAOtD,CAAC;AAEF,QAAA,MAAM,uCAAuC,mBAAoB,MAAM,kBAAkB,MAAM,kBAK5F,CAAC;AAEJ,QAAA,MAAM,sCAAsC,mBAAoB,MAAM,kBAAkB,MAAM,kBAK3F,CAAC;AAEJ,QAAA,MAAM,yCAAyC,cAClC,MAAM,GAAG,SAAS,YACnB,MAAM,GAAG,SAAS,kBAM3B,CAAC;AAEJ,QAAA,MAAM,6BAA6B,mBAAoB,MAAM,qBAAqB,MAAM,kBAKrF,CAAC;AAEJ,OAAO,EACL,uCAAuC,EACvC,sCAAsC,EACtC,yCAAyC,EACzC,6BAA6B,GAC9B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,oBAAoB;;;GAGhC,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
declare const ONEKEY_WEBUSB_FILTER: {
|
|
2
|
+
vendorId: number;
|
|
3
|
+
productId: number;
|
|
4
|
+
}[];
|
|
5
|
+
|
|
1
6
|
type Deferred<T, I = any, D = any> = {
|
|
2
7
|
id?: I;
|
|
3
8
|
data?: D;
|
|
@@ -105,6 +110,8 @@ declare const HardwareErrorCode: {
|
|
|
105
110
|
readonly BridgeDeviceDisconnected: 817;
|
|
106
111
|
readonly BTCPsbtTooManyUtxos: 818;
|
|
107
112
|
readonly LowlevelTrasnportConnectError: 900;
|
|
113
|
+
readonly WebDeviceNotFoundOrNeedsPermission: 901;
|
|
114
|
+
readonly WebDevicePromptAccessError: 902;
|
|
108
115
|
};
|
|
109
116
|
declare const HardwareErrorCodeMessage: HardwareErrorCodeMessageMapping;
|
|
110
117
|
declare const TypedError: (hardwareError: ErrorCodeUnion | string, message?: string, params?: any) => HardwareError;
|
|
@@ -143,4 +150,6 @@ declare namespace HardwareError$1 {
|
|
|
143
150
|
};
|
|
144
151
|
}
|
|
145
152
|
|
|
146
|
-
|
|
153
|
+
declare const wait: (ms: number) => Promise<unknown>;
|
|
154
|
+
|
|
155
|
+
export { CreateErrorByMessage, Deferred, HardwareError$1 as ERRORS, HardwareError, HardwareErrorCode, HardwareErrorCodeMessage, IHardwareError, ONEKEY_WEBUSB_FILTER, TypedError, createDeferred, createDeprecatedHardwareError, createNeedUpgradeFirmwareHardwareError, createNewFirmwareForceUpdateHardwareError, createNewFirmwareUnReleaseHardwareError, serializeError, wait };
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,iBAAiB,CAAC;AAChC,OAAO,KAAK,MAAM,MAAM,iBAAiB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,OAAO,KAAK,MAAM,MAAM,iBAAiB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -2,6 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
+
const ONEKEY_WEBUSB_FILTER = [
|
|
6
|
+
{ vendorId: 0x1209, productId: 0x53c0 },
|
|
7
|
+
{ vendorId: 0x1209, productId: 0x53c1 },
|
|
8
|
+
];
|
|
9
|
+
|
|
5
10
|
/******************************************************************************
|
|
6
11
|
Copyright (c) Microsoft Corporation.
|
|
7
12
|
|
|
@@ -170,6 +175,8 @@ const HardwareErrorCode = {
|
|
|
170
175
|
BridgeDeviceDisconnected: 817,
|
|
171
176
|
BTCPsbtTooManyUtxos: 818,
|
|
172
177
|
LowlevelTrasnportConnectError: 900,
|
|
178
|
+
WebDeviceNotFoundOrNeedsPermission: 901,
|
|
179
|
+
WebDevicePromptAccessError: 902,
|
|
173
180
|
};
|
|
174
181
|
const HardwareErrorCodeMessage = {
|
|
175
182
|
[HardwareErrorCode.UnknownError]: 'Unknown error occurred. Check message property.',
|
|
@@ -253,6 +260,8 @@ const HardwareErrorCodeMessage = {
|
|
|
253
260
|
[HardwareErrorCode.DataOverload]: 'Params data overload',
|
|
254
261
|
[HardwareErrorCode.BTCPsbtTooManyUtxos]: 'PSBT too many utxos',
|
|
255
262
|
[HardwareErrorCode.LowlevelTrasnportConnectError]: 'Lowlevel transport connect error',
|
|
263
|
+
[HardwareErrorCode.WebDeviceNotFoundOrNeedsPermission]: 'Web-USB or Web-Bluetooth device not found or needs permission',
|
|
264
|
+
[HardwareErrorCode.WebDevicePromptAccessError]: 'Web-USB or Web-Bluetooth device prompt access error',
|
|
256
265
|
};
|
|
257
266
|
const TypedError = (hardwareError, message, params) => {
|
|
258
267
|
if (typeof hardwareError === 'string') {
|
|
@@ -303,11 +312,16 @@ var HardwareError$1 = /*#__PURE__*/Object.freeze({
|
|
|
303
312
|
createDeprecatedHardwareError: createDeprecatedHardwareError
|
|
304
313
|
});
|
|
305
314
|
|
|
315
|
+
const wait = (ms) => new Promise(resolve => {
|
|
316
|
+
setTimeout(resolve, ms);
|
|
317
|
+
});
|
|
318
|
+
|
|
306
319
|
exports.CreateErrorByMessage = CreateErrorByMessage;
|
|
307
320
|
exports.ERRORS = HardwareError$1;
|
|
308
321
|
exports.HardwareError = HardwareError;
|
|
309
322
|
exports.HardwareErrorCode = HardwareErrorCode;
|
|
310
323
|
exports.HardwareErrorCodeMessage = HardwareErrorCodeMessage;
|
|
324
|
+
exports.ONEKEY_WEBUSB_FILTER = ONEKEY_WEBUSB_FILTER;
|
|
311
325
|
exports.TypedError = TypedError;
|
|
312
326
|
exports.createDeferred = createDeferred;
|
|
313
327
|
exports.createDeprecatedHardwareError = createDeprecatedHardwareError;
|
|
@@ -315,3 +329,4 @@ exports.createNeedUpgradeFirmwareHardwareError = createNeedUpgradeFirmwareHardwa
|
|
|
315
329
|
exports.createNewFirmwareForceUpdateHardwareError = createNewFirmwareForceUpdateHardwareError;
|
|
316
330
|
exports.createNewFirmwareUnReleaseHardwareError = createNewFirmwareUnReleaseHardwareError;
|
|
317
331
|
exports.serializeError = serializeError;
|
|
332
|
+
exports.wait = wait;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"timerUtils.d.ts","sourceRoot":"","sources":["../src/timerUtils.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,IAAI,OAAQ,MAAM,qBAG3B,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onekeyfe/hd-shared",
|
|
3
|
-
"version": "1.0.22
|
|
3
|
+
"version": "1.0.22",
|
|
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": "91124a7846f8366bb1c2294fc3d983c6e2adf535"
|
|
29
29
|
}
|
package/src/HardwareError.ts
CHANGED
|
@@ -384,6 +384,16 @@ export const HardwareErrorCode = {
|
|
|
384
384
|
* Lowlevel transport connect error
|
|
385
385
|
*/
|
|
386
386
|
LowlevelTrasnportConnectError: 900,
|
|
387
|
+
|
|
388
|
+
/**
|
|
389
|
+
* Web USB or Web Bluetooth device not found or needs permission
|
|
390
|
+
*/
|
|
391
|
+
WebDeviceNotFoundOrNeedsPermission: 901,
|
|
392
|
+
|
|
393
|
+
/**
|
|
394
|
+
* Web USB or Web Bluetooth device prompt access error
|
|
395
|
+
*/
|
|
396
|
+
WebDevicePromptAccessError: 902,
|
|
387
397
|
} as const;
|
|
388
398
|
|
|
389
399
|
export const HardwareErrorCodeMessage: HardwareErrorCodeMessageMapping = {
|
|
@@ -506,6 +516,10 @@ export const HardwareErrorCodeMessage: HardwareErrorCodeMessageMapping = {
|
|
|
506
516
|
* Lowlevel transport
|
|
507
517
|
*/
|
|
508
518
|
[HardwareErrorCode.LowlevelTrasnportConnectError]: 'Lowlevel transport connect error',
|
|
519
|
+
[HardwareErrorCode.WebDeviceNotFoundOrNeedsPermission]:
|
|
520
|
+
'Web-USB or Web-Bluetooth device not found or needs permission',
|
|
521
|
+
[HardwareErrorCode.WebDevicePromptAccessError]:
|
|
522
|
+
'Web-USB or Web-Bluetooth device prompt access error',
|
|
509
523
|
} as const;
|
|
510
524
|
|
|
511
525
|
export const TypedError = (
|
package/src/constants.ts
ADDED
package/src/index.ts
CHANGED