@onekeyfe/hd-core 1.1.19-alpha.3 → 1.1.19-alpha.5
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/index.js +9 -6
- package/package.json +4 -4
- package/src/core/index.ts +6 -6
package/dist/index.js
CHANGED
|
@@ -39962,9 +39962,6 @@ function initDevice(method) {
|
|
|
39962
39962
|
if (!device) {
|
|
39963
39963
|
const env = DataManager.getSettings('env');
|
|
39964
39964
|
if (DataManager.isWebUsbConnect(env)) {
|
|
39965
|
-
if (!method.payload.skipWebDevicePrompt) {
|
|
39966
|
-
postMessage(createUiMessage(UI_REQUEST.WEB_DEVICE_PROMPT_ACCESS_PERMISSION));
|
|
39967
|
-
}
|
|
39968
39965
|
throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.WebDeviceNotFoundOrNeedsPermission);
|
|
39969
39966
|
}
|
|
39970
39967
|
throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.DeviceNotFound);
|
|
@@ -40019,6 +40016,7 @@ const ensureConnected = (_context, method, pollingId, abortSignal) => __awaiter(
|
|
|
40019
40016
|
Log.debug(`EnsureConnected function start, MAX_RETRY_COUNT=${MAX_RETRY_COUNT}, POLL_INTERVAL_TIME=${POLL_INTERVAL_TIME} `);
|
|
40020
40017
|
const poll = (time = POLL_INTERVAL_TIME) => __awaiter(void 0, void 0, void 0, function* () {
|
|
40021
40018
|
return new Promise((resolve, reject) => __awaiter(void 0, void 0, void 0, function* () {
|
|
40019
|
+
var _k;
|
|
40022
40020
|
const abort = () => {
|
|
40023
40021
|
if (abortSignal && abortSignal.aborted) {
|
|
40024
40022
|
if (timer) {
|
|
@@ -40112,7 +40110,6 @@ const ensureConnected = (_context, method, pollingId, abortSignal) => __awaiter(
|
|
|
40112
40110
|
hdShared.HardwareErrorCode.SelectDevice,
|
|
40113
40111
|
hdShared.HardwareErrorCode.DeviceDetectInBootloaderMode,
|
|
40114
40112
|
hdShared.HardwareErrorCode.BleCharacteristicNotifyChangeFailure,
|
|
40115
|
-
hdShared.HardwareErrorCode.WebDeviceNotFoundOrNeedsPermission,
|
|
40116
40113
|
hdShared.HardwareErrorCode.BridgeNeedsPermission,
|
|
40117
40114
|
].includes(error.errorCode)) {
|
|
40118
40115
|
reject(error);
|
|
@@ -40124,7 +40121,13 @@ const ensureConnected = (_context, method, pollingId, abortSignal) => __awaiter(
|
|
|
40124
40121
|
clearTimeout(timer);
|
|
40125
40122
|
}
|
|
40126
40123
|
Log.debug('EnsureConnected get to max try count, will return: ', tryCount);
|
|
40127
|
-
|
|
40124
|
+
if (DataManager.isWebUsbConnect(env) && !((_k = method.payload) === null || _k === void 0 ? void 0 : _k.skipWebDevicePrompt)) {
|
|
40125
|
+
postMessage(createUiMessage(UI_REQUEST.WEB_DEVICE_PROMPT_ACCESS_PERMISSION));
|
|
40126
|
+
reject(hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.WebDeviceNotFoundOrNeedsPermission));
|
|
40127
|
+
}
|
|
40128
|
+
else {
|
|
40129
|
+
reject(hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.DeviceNotFound));
|
|
40130
|
+
}
|
|
40128
40131
|
return;
|
|
40129
40132
|
}
|
|
40130
40133
|
if (abort()) {
|
|
@@ -40410,7 +40413,7 @@ const init = (settings, Transport, plugin) => __awaiter(void 0, void 0, void 0,
|
|
|
40410
40413
|
yield DataManager.load(settings);
|
|
40411
40414
|
initTransport(Transport, plugin);
|
|
40412
40415
|
}
|
|
40413
|
-
catch (
|
|
40416
|
+
catch (_l) {
|
|
40414
40417
|
Log.error('DataManager.load error');
|
|
40415
40418
|
}
|
|
40416
40419
|
enableLog(DataManager.getSettings('debug'));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onekeyfe/hd-core",
|
|
3
|
-
"version": "1.1.19-alpha.
|
|
3
|
+
"version": "1.1.19-alpha.5",
|
|
4
4
|
"description": "Core processes and APIs for communicating with OneKey hardware devices.",
|
|
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": "1.1.19-alpha.
|
|
29
|
-
"@onekeyfe/hd-transport": "1.1.19-alpha.
|
|
28
|
+
"@onekeyfe/hd-shared": "1.1.19-alpha.5",
|
|
29
|
+
"@onekeyfe/hd-transport": "1.1.19-alpha.5",
|
|
30
30
|
"axios": "1.12.2",
|
|
31
31
|
"bignumber.js": "^9.0.2",
|
|
32
32
|
"bytebuffer": "^5.0.1",
|
|
@@ -44,5 +44,5 @@
|
|
|
44
44
|
"@types/w3c-web-usb": "^1.0.10",
|
|
45
45
|
"@types/web-bluetooth": "^0.0.21"
|
|
46
46
|
},
|
|
47
|
-
"gitHead": "
|
|
47
|
+
"gitHead": "f1ac0d60c1537c5f389896185647b273c0ae4543"
|
|
48
48
|
}
|
package/src/core/index.ts
CHANGED
|
@@ -644,9 +644,6 @@ function initDevice(method: BaseMethod) {
|
|
|
644
644
|
if (!device) {
|
|
645
645
|
const env = DataManager.getSettings('env');
|
|
646
646
|
if (DataManager.isWebUsbConnect(env)) {
|
|
647
|
-
if (!method.payload.skipWebDevicePrompt) {
|
|
648
|
-
postMessage(createUiMessage(UI_REQUEST.WEB_DEVICE_PROMPT_ACCESS_PERMISSION));
|
|
649
|
-
}
|
|
650
647
|
throw ERRORS.TypedError(HardwareErrorCode.WebDeviceNotFoundOrNeedsPermission);
|
|
651
648
|
}
|
|
652
649
|
throw ERRORS.TypedError(HardwareErrorCode.DeviceNotFound);
|
|
@@ -716,7 +713,6 @@ const ensureConnected = async (
|
|
|
716
713
|
const POLL_INTERVAL_TIME = (method.payload && method.payload.pollIntervalTime) || 1000;
|
|
717
714
|
const TIME_OUT = (method.payload && method.payload.timeout) || 10000;
|
|
718
715
|
let timer: ReturnType<typeof setTimeout> | null = null;
|
|
719
|
-
|
|
720
716
|
Log.debug(
|
|
721
717
|
`EnsureConnected function start, MAX_RETRY_COUNT=${MAX_RETRY_COUNT}, POLL_INTERVAL_TIME=${POLL_INTERVAL_TIME} `
|
|
722
718
|
);
|
|
@@ -830,7 +826,6 @@ const ensureConnected = async (
|
|
|
830
826
|
HardwareErrorCode.SelectDevice,
|
|
831
827
|
HardwareErrorCode.DeviceDetectInBootloaderMode,
|
|
832
828
|
HardwareErrorCode.BleCharacteristicNotifyChangeFailure,
|
|
833
|
-
HardwareErrorCode.WebDeviceNotFoundOrNeedsPermission,
|
|
834
829
|
HardwareErrorCode.BridgeNeedsPermission,
|
|
835
830
|
].includes(error.errorCode)
|
|
836
831
|
) {
|
|
@@ -844,7 +839,12 @@ const ensureConnected = async (
|
|
|
844
839
|
clearTimeout(timer);
|
|
845
840
|
}
|
|
846
841
|
Log.debug('EnsureConnected get to max try count, will return: ', tryCount);
|
|
847
|
-
|
|
842
|
+
if (DataManager.isWebUsbConnect(env) && !method.payload?.skipWebDevicePrompt) {
|
|
843
|
+
postMessage(createUiMessage(UI_REQUEST.WEB_DEVICE_PROMPT_ACCESS_PERMISSION));
|
|
844
|
+
reject(ERRORS.TypedError(HardwareErrorCode.WebDeviceNotFoundOrNeedsPermission));
|
|
845
|
+
} else {
|
|
846
|
+
reject(ERRORS.TypedError(HardwareErrorCode.DeviceNotFound));
|
|
847
|
+
}
|
|
848
848
|
return;
|
|
849
849
|
}
|
|
850
850
|
|