@onekeyfe/hd-web-sdk 0.1.59 → 0.2.0
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/build/iframe.html +1 -1
- package/build/js/iframe.99845140d999e0775b6a.js +3 -0
- package/build/js/{iframe.36966284354c2b9823e0.js.LICENSE.txt → iframe.99845140d999e0775b6a.js.LICENSE.txt} +0 -0
- package/build/js/iframe.99845140d999e0775b6a.js.map +1 -0
- package/build/onekey-js-sdk.js +27 -5
- package/build/onekey-js-sdk.js.map +1 -1
- package/build/onekey-js-sdk.min.js +1 -1
- package/build/onekey-js-sdk.min.js.map +1 -1
- package/package.json +6 -6
- package/build/js/iframe.36966284354c2b9823e0.js +0 -3
- package/build/js/iframe.36966284354c2b9823e0.js.map +0 -1
package/build/onekey-js-sdk.js
CHANGED
|
@@ -23510,6 +23510,26 @@ function initDeviceForBle(method) {
|
|
|
23510
23510
|
return device;
|
|
23511
23511
|
}
|
|
23512
23512
|
|
|
23513
|
+
let bleTimeoutRetry = 0;
|
|
23514
|
+
|
|
23515
|
+
function connectDeviceForBle(method, device) {
|
|
23516
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
23517
|
+
try {
|
|
23518
|
+
yield device.acquire();
|
|
23519
|
+
yield device.initialize(parseInitOptions(method));
|
|
23520
|
+
} catch (err) {
|
|
23521
|
+
if (err.errorCode === hdShared.HardwareErrorCode.BleTimeoutError && bleTimeoutRetry <= 5) {
|
|
23522
|
+
bleTimeoutRetry += 1;
|
|
23523
|
+
Log.debug(`Bletooth connect timeout and will retry, retry count: ${bleTimeoutRetry}`);
|
|
23524
|
+
yield wait(3000);
|
|
23525
|
+
yield connectDeviceForBle(method, device);
|
|
23526
|
+
} else {
|
|
23527
|
+
throw err;
|
|
23528
|
+
}
|
|
23529
|
+
}
|
|
23530
|
+
});
|
|
23531
|
+
}
|
|
23532
|
+
|
|
23513
23533
|
const ensureConnected = (method, pollingId) => __awaiter(void 0, void 0, void 0, function* () {
|
|
23514
23534
|
let tryCount = 0;
|
|
23515
23535
|
const MAX_RETRY_COUNT = method.payload && method.payload.retryCount || 5;
|
|
@@ -23568,8 +23588,8 @@ const ensureConnected = (method, pollingId) => __awaiter(void 0, void 0, void 0,
|
|
|
23568
23588
|
}
|
|
23569
23589
|
|
|
23570
23590
|
if (env === 'react-native') {
|
|
23571
|
-
|
|
23572
|
-
yield
|
|
23591
|
+
bleTimeoutRetry = 0;
|
|
23592
|
+
yield connectDeviceForBle(method, device);
|
|
23573
23593
|
}
|
|
23574
23594
|
|
|
23575
23595
|
resolve(device);
|
|
@@ -23578,7 +23598,7 @@ const ensureConnected = (method, pollingId) => __awaiter(void 0, void 0, void 0,
|
|
|
23578
23598
|
} catch (error) {
|
|
23579
23599
|
Log.debug('device error: ', error);
|
|
23580
23600
|
|
|
23581
|
-
if ([hdShared.HardwareErrorCode.BlePermissionError, hdShared.HardwareErrorCode.BleLocationError, hdShared.HardwareErrorCode.BleLocationServicesDisabled, hdShared.HardwareErrorCode.BleDeviceNotBonded, hdShared.HardwareErrorCode.BleCharacteristicNotifyError, hdShared.HardwareErrorCode.BleWriteCharacteristicError, hdShared.HardwareErrorCode.BleAlreadyConnected, hdShared.HardwareErrorCode.FirmwareUpdateLimitOneDevice].includes(error.errorCode)) {
|
|
23601
|
+
if ([hdShared.HardwareErrorCode.BlePermissionError, hdShared.HardwareErrorCode.BleLocationError, hdShared.HardwareErrorCode.BleLocationServicesDisabled, hdShared.HardwareErrorCode.BleDeviceNotBonded, hdShared.HardwareErrorCode.BleCharacteristicNotifyError, hdShared.HardwareErrorCode.BleTimeoutError, hdShared.HardwareErrorCode.BleWriteCharacteristicError, hdShared.HardwareErrorCode.BleAlreadyConnected, hdShared.HardwareErrorCode.FirmwareUpdateLimitOneDevice].includes(error.errorCode)) {
|
|
23582
23602
|
reject(error);
|
|
23583
23603
|
return;
|
|
23584
23604
|
}
|
|
@@ -25210,6 +25230,7 @@ const HardwareErrorCode = {
|
|
|
25210
25230
|
BleWriteCharacteristicError: 710,
|
|
25211
25231
|
BleAlreadyConnected: 711,
|
|
25212
25232
|
BleLocationServicesDisabled: 712,
|
|
25233
|
+
BleTimeoutError: 713,
|
|
25213
25234
|
RuntimeError: 800,
|
|
25214
25235
|
PinInvalid: 801,
|
|
25215
25236
|
PinCancelled: 802,
|
|
@@ -25274,6 +25295,7 @@ const HardwareErrorCodeMessage = {
|
|
|
25274
25295
|
[HardwareErrorCode.BleWriteCharacteristicError]: 'Write Characteristic Error',
|
|
25275
25296
|
[HardwareErrorCode.BleAlreadyConnected]: 'Already connected to device',
|
|
25276
25297
|
[HardwareErrorCode.BleLocationServicesDisabled]: 'Location Services disabled',
|
|
25298
|
+
[HardwareErrorCode.BleTimeoutError]: 'The connection has timed out unexpectedly.',
|
|
25277
25299
|
[HardwareErrorCode.RuntimeError]: 'Runtime error',
|
|
25278
25300
|
[HardwareErrorCode.PinInvalid]: 'Pin invalid',
|
|
25279
25301
|
[HardwareErrorCode.PinCancelled]: 'Pin cancelled',
|
|
@@ -47795,7 +47817,7 @@ try {
|
|
|
47795
47817
|
/***/ ((module) => {
|
|
47796
47818
|
|
|
47797
47819
|
"use strict";
|
|
47798
|
-
module.exports = JSON.parse('{"name":"@onekeyfe/hd-core","version":"0.
|
|
47820
|
+
module.exports = JSON.parse('{"name":"@onekeyfe/hd-core","version":"0.2.0","description":"> TODO: description","author":"OneKey","homepage":"https://github.com/OneKeyHQ/hardware-js-sdk#readme","license":"ISC","main":"dist/index.js","types":"dist/index.d.ts","repository":{"type":"git","url":"git+https://github.com/OneKeyHQ/hardware-js-sdk.git"},"publishConfig":{"access":"public"},"scripts":{"dev":"rimraf dist && rollup -c ../../build/rollup.config.js -w","build":"rimraf dist && rollup -c ../../build/rollup.config.js","lint":"eslint .","lint:fix":"eslint . --fix"},"bugs":{"url":"https://github.com/OneKeyHQ/hardware-js-sdk/issues"},"dependencies":{"@onekeyfe/hd-shared":"^0.2.0","@onekeyfe/hd-transport":"^0.2.0","axios":"^0.27.2","bignumber.js":"^9.0.2","jszip":"^3.10.1","parse-uri":"^1.0.7","semver":"^7.3.7"},"peerDependencies":{"@noble/hashes":"^1.1.3"},"devDependencies":{"@noble/hashes":"^1.1.3","@types/parse-uri":"^1.0.0","@types/semver":"^7.3.9"}}');
|
|
47799
47821
|
|
|
47800
47822
|
/***/ })
|
|
47801
47823
|
|
|
@@ -50322,7 +50344,7 @@ const src_init = async settings => {
|
|
|
50322
50344
|
|
|
50323
50345
|
try {
|
|
50324
50346
|
await init({ ..._settings,
|
|
50325
|
-
version: "0.
|
|
50347
|
+
version: "0.2.0"
|
|
50326
50348
|
});
|
|
50327
50349
|
return true;
|
|
50328
50350
|
} catch (e) {
|