@onekeyfe/hd-core 0.1.13 → 0.1.14
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CheckBridgeStatus.d.ts","sourceRoot":"","sources":["../../src/api/CheckBridgeStatus.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"CheckBridgeStatus.d.ts","sourceRoot":"","sources":["../../src/api/CheckBridgeStatus.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,MAAM,CAAC,OAAO,OAAO,iBAAkB,SAAQ,UAAU;IACvD,IAAI;IAIE,GAAG;CAmBV"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TransportManager.d.ts","sourceRoot":"","sources":["../../src/data-manager/TransportManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAWnD,MAAM,CAAC,OAAO,OAAO,gBAAgB;IACnC,MAAM,CAAC,SAAS,EAAE,SAAS,CAAC;IAE5B,MAAM,CAAC,eAAe,EAAE,IAAI,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAEnD,MAAM,CAAC,eAAe,EAAE,IAAI,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAEnD,MAAM,CAAC,eAAe,UAAS;IAE/B,MAAM,CAAC,IAAI;WAME,SAAS;
|
|
1
|
+
{"version":3,"file":"TransportManager.d.ts","sourceRoot":"","sources":["../../src/data-manager/TransportManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAWnD,MAAM,CAAC,OAAO,OAAO,gBAAgB;IACnC,MAAM,CAAC,SAAS,EAAE,SAAS,CAAC;IAE5B,MAAM,CAAC,eAAe,EAAE,IAAI,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAEnD,MAAM,CAAC,eAAe,EAAE,IAAI,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAEnD,MAAM,CAAC,eAAe,UAAS;IAE/B,MAAM,CAAC,IAAI;WAME,SAAS;WAyBT,WAAW,CAAC,QAAQ,CAAC,EAAE,IAAI,GAAG,MAAM,EAAE,GAAG,IAAI;IAkB1D,MAAM,CAAC,YAAY,CAAC,oBAAoB,EAAE,GAAG;IAY7C,MAAM,CAAC,YAAY;IAInB,MAAM,CAAC,kBAAkB;IAIzB,MAAM,CAAC,kBAAkB;CAG1B"}
|
package/dist/index.js
CHANGED
|
@@ -9808,6 +9808,9 @@ class TransportManager {
|
|
|
9808
9808
|
}
|
|
9809
9809
|
catch (error) {
|
|
9810
9810
|
Log$5.debug('Initializing transports error: ', error);
|
|
9811
|
+
if (error.code === 'ECONNABORTED') {
|
|
9812
|
+
throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.BridgeTimeoutError);
|
|
9813
|
+
}
|
|
9811
9814
|
}
|
|
9812
9815
|
});
|
|
9813
9816
|
}
|
|
@@ -11584,15 +11587,23 @@ class CheckBridgeStatus extends BaseMethod {
|
|
|
11584
11587
|
}
|
|
11585
11588
|
run() {
|
|
11586
11589
|
return __awaiter(this, void 0, void 0, function* () {
|
|
11587
|
-
return new Promise(resolve => {
|
|
11590
|
+
return new Promise((resolve, reject) => {
|
|
11588
11591
|
axios__default["default"]
|
|
11589
11592
|
.request({
|
|
11590
11593
|
url: 'http://localhost:21320',
|
|
11591
11594
|
method: 'POST',
|
|
11592
11595
|
withCredentials: false,
|
|
11596
|
+
timeout: 3000,
|
|
11593
11597
|
})
|
|
11594
11598
|
.then(() => resolve(true))
|
|
11595
|
-
.catch(
|
|
11599
|
+
.catch(e => {
|
|
11600
|
+
if (e.code === 'ECONNABORTED') {
|
|
11601
|
+
reject(hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.BridgeTimeoutError));
|
|
11602
|
+
}
|
|
11603
|
+
else {
|
|
11604
|
+
resolve(false);
|
|
11605
|
+
}
|
|
11606
|
+
});
|
|
11596
11607
|
});
|
|
11597
11608
|
});
|
|
11598
11609
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onekeyfe/hd-core",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.14",
|
|
4
4
|
"description": "> TODO: description",
|
|
5
5
|
"author": "OneKey",
|
|
6
6
|
"homepage": "https://github.com/OneKeyHQ/hardware-js-sdk#readme",
|
|
@@ -25,8 +25,8 @@
|
|
|
25
25
|
"url": "https://github.com/OneKeyHQ/hardware-js-sdk/issues"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@onekeyfe/hd-shared": "^0.1.
|
|
29
|
-
"@onekeyfe/hd-transport": "^0.1.
|
|
28
|
+
"@onekeyfe/hd-shared": "^0.1.14",
|
|
29
|
+
"@onekeyfe/hd-transport": "^0.1.14",
|
|
30
30
|
"axios": "^0.27.2",
|
|
31
31
|
"bignumber.js": "^9.0.2",
|
|
32
32
|
"js-sha256": "^0.9.0",
|
|
@@ -37,5 +37,5 @@
|
|
|
37
37
|
"@types/parse-uri": "^1.0.0",
|
|
38
38
|
"@types/semver": "^7.3.9"
|
|
39
39
|
},
|
|
40
|
-
"gitHead": "
|
|
40
|
+
"gitHead": "216fee1795067013da0d68f4fc25f583509bb509"
|
|
41
41
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import axios from 'axios';
|
|
2
|
+
import { ERRORS, HardwareErrorCode } from '@onekeyfe/hd-shared';
|
|
2
3
|
import { BaseMethod } from './BaseMethod';
|
|
3
4
|
|
|
4
5
|
export default class CheckBridgeStatus extends BaseMethod {
|
|
@@ -7,15 +8,22 @@ export default class CheckBridgeStatus extends BaseMethod {
|
|
|
7
8
|
}
|
|
8
9
|
|
|
9
10
|
async run() {
|
|
10
|
-
return new Promise<boolean>(resolve => {
|
|
11
|
+
return new Promise<boolean>((resolve, reject) => {
|
|
11
12
|
axios
|
|
12
13
|
.request({
|
|
13
14
|
url: 'http://localhost:21320',
|
|
14
15
|
method: 'POST',
|
|
15
16
|
withCredentials: false,
|
|
17
|
+
timeout: 3000,
|
|
16
18
|
})
|
|
17
19
|
.then(() => resolve(true))
|
|
18
|
-
.catch(
|
|
20
|
+
.catch(e => {
|
|
21
|
+
if (e.code === 'ECONNABORTED') {
|
|
22
|
+
reject(ERRORS.TypedError(HardwareErrorCode.BridgeTimeoutError));
|
|
23
|
+
} else {
|
|
24
|
+
resolve(false);
|
|
25
|
+
}
|
|
26
|
+
});
|
|
19
27
|
});
|
|
20
28
|
}
|
|
21
29
|
}
|
|
@@ -43,6 +43,9 @@ export default class TransportManager {
|
|
|
43
43
|
Log.debug('Configuring transports done');
|
|
44
44
|
} catch (error) {
|
|
45
45
|
Log.debug('Initializing transports error: ', error);
|
|
46
|
+
if (error.code === 'ECONNABORTED') {
|
|
47
|
+
throw ERRORS.TypedError(HardwareErrorCode.BridgeTimeoutError);
|
|
48
|
+
}
|
|
46
49
|
}
|
|
47
50
|
}
|
|
48
51
|
|