@onekeyfe/hd-web-sdk 0.1.59 → 0.2.1
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.b3d08698f1332b9d17e0.js +3 -0
- package/build/js/{iframe.36966284354c2b9823e0.js.LICENSE.txt → iframe.b3d08698f1332b9d17e0.js.LICENSE.txt} +0 -0
- package/build/js/iframe.b3d08698f1332b9d17e0.js.map +1 -0
- package/build/onekey-js-sdk.js +48 -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
|
@@ -6211,6 +6211,24 @@ const supportBatchPublicKey = features => {
|
|
|
6211
6211
|
return semver__default["default"].gte(currentVersion, '2.6.0');
|
|
6212
6212
|
};
|
|
6213
6213
|
|
|
6214
|
+
const supportModifyHomescreen = features => {
|
|
6215
|
+
if (!features) return {
|
|
6216
|
+
support: false
|
|
6217
|
+
};
|
|
6218
|
+
const currentVersion = getDeviceFirmwareVersion(features).join('.');
|
|
6219
|
+
const deviceType = getDeviceType(features);
|
|
6220
|
+
|
|
6221
|
+
if (deviceType === 'classic' || deviceType === 'mini') {
|
|
6222
|
+
return {
|
|
6223
|
+
support: true
|
|
6224
|
+
};
|
|
6225
|
+
}
|
|
6226
|
+
|
|
6227
|
+
return {
|
|
6228
|
+
support: semver__default["default"].gte(currentVersion, '3.4.0')
|
|
6229
|
+
};
|
|
6230
|
+
};
|
|
6231
|
+
|
|
6214
6232
|
var nested = {
|
|
6215
6233
|
AlgorandGetAddress: {
|
|
6216
6234
|
fields: {
|
|
@@ -18331,6 +18349,7 @@ class DeviceUploadResource extends BaseMethod {
|
|
|
18331
18349
|
run() {
|
|
18332
18350
|
return __awaiter(this, void 0, void 0, function* () {
|
|
18333
18351
|
const res = yield this.device.commands.typedCall('ResourceUpload', ['ResourceRequest', 'ZoomRequest', 'Success'], this.params);
|
|
18352
|
+
this.postMessage(createUiMessage(UI_REQUEST$1.CLOSE_UI_WINDOW));
|
|
18334
18353
|
return this.processResourceRequest(res);
|
|
18335
18354
|
});
|
|
18336
18355
|
}
|
|
@@ -18345,8 +18364,10 @@ class DeviceSupportFeatures extends BaseMethod {
|
|
|
18345
18364
|
run() {
|
|
18346
18365
|
if (!this.device.features) return Promise.reject(hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.RuntimeError, 'Device not initialized'));
|
|
18347
18366
|
const inputPinOnSoftware = supportInputPinOnSoftware(this.device.features);
|
|
18367
|
+
const modifyHomescreen = supportModifyHomescreen(this.device.features);
|
|
18348
18368
|
return Promise.resolve({
|
|
18349
18369
|
inputPinOnSoftware,
|
|
18370
|
+
modifyHomescreen,
|
|
18350
18371
|
device: this.device.toMessageObject()
|
|
18351
18372
|
});
|
|
18352
18373
|
}
|
|
@@ -23510,6 +23531,26 @@ function initDeviceForBle(method) {
|
|
|
23510
23531
|
return device;
|
|
23511
23532
|
}
|
|
23512
23533
|
|
|
23534
|
+
let bleTimeoutRetry = 0;
|
|
23535
|
+
|
|
23536
|
+
function connectDeviceForBle(method, device) {
|
|
23537
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
23538
|
+
try {
|
|
23539
|
+
yield device.acquire();
|
|
23540
|
+
yield device.initialize(parseInitOptions(method));
|
|
23541
|
+
} catch (err) {
|
|
23542
|
+
if (err.errorCode === hdShared.HardwareErrorCode.BleTimeoutError && bleTimeoutRetry <= 5) {
|
|
23543
|
+
bleTimeoutRetry += 1;
|
|
23544
|
+
Log.debug(`Bletooth connect timeout and will retry, retry count: ${bleTimeoutRetry}`);
|
|
23545
|
+
yield wait(3000);
|
|
23546
|
+
yield connectDeviceForBle(method, device);
|
|
23547
|
+
} else {
|
|
23548
|
+
throw err;
|
|
23549
|
+
}
|
|
23550
|
+
}
|
|
23551
|
+
});
|
|
23552
|
+
}
|
|
23553
|
+
|
|
23513
23554
|
const ensureConnected = (method, pollingId) => __awaiter(void 0, void 0, void 0, function* () {
|
|
23514
23555
|
let tryCount = 0;
|
|
23515
23556
|
const MAX_RETRY_COUNT = method.payload && method.payload.retryCount || 5;
|
|
@@ -23568,8 +23609,8 @@ const ensureConnected = (method, pollingId) => __awaiter(void 0, void 0, void 0,
|
|
|
23568
23609
|
}
|
|
23569
23610
|
|
|
23570
23611
|
if (env === 'react-native') {
|
|
23571
|
-
|
|
23572
|
-
yield
|
|
23612
|
+
bleTimeoutRetry = 0;
|
|
23613
|
+
yield connectDeviceForBle(method, device);
|
|
23573
23614
|
}
|
|
23574
23615
|
|
|
23575
23616
|
resolve(device);
|
|
@@ -23578,7 +23619,7 @@ const ensureConnected = (method, pollingId) => __awaiter(void 0, void 0, void 0,
|
|
|
23578
23619
|
} catch (error) {
|
|
23579
23620
|
Log.debug('device error: ', error);
|
|
23580
23621
|
|
|
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)) {
|
|
23622
|
+
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
23623
|
reject(error);
|
|
23583
23624
|
return;
|
|
23584
23625
|
}
|
|
@@ -25210,6 +25251,7 @@ const HardwareErrorCode = {
|
|
|
25210
25251
|
BleWriteCharacteristicError: 710,
|
|
25211
25252
|
BleAlreadyConnected: 711,
|
|
25212
25253
|
BleLocationServicesDisabled: 712,
|
|
25254
|
+
BleTimeoutError: 713,
|
|
25213
25255
|
RuntimeError: 800,
|
|
25214
25256
|
PinInvalid: 801,
|
|
25215
25257
|
PinCancelled: 802,
|
|
@@ -25274,6 +25316,7 @@ const HardwareErrorCodeMessage = {
|
|
|
25274
25316
|
[HardwareErrorCode.BleWriteCharacteristicError]: 'Write Characteristic Error',
|
|
25275
25317
|
[HardwareErrorCode.BleAlreadyConnected]: 'Already connected to device',
|
|
25276
25318
|
[HardwareErrorCode.BleLocationServicesDisabled]: 'Location Services disabled',
|
|
25319
|
+
[HardwareErrorCode.BleTimeoutError]: 'The connection has timed out unexpectedly.',
|
|
25277
25320
|
[HardwareErrorCode.RuntimeError]: 'Runtime error',
|
|
25278
25321
|
[HardwareErrorCode.PinInvalid]: 'Pin invalid',
|
|
25279
25322
|
[HardwareErrorCode.PinCancelled]: 'Pin cancelled',
|
|
@@ -47795,7 +47838,7 @@ try {
|
|
|
47795
47838
|
/***/ ((module) => {
|
|
47796
47839
|
|
|
47797
47840
|
"use strict";
|
|
47798
|
-
module.exports = JSON.parse('{"name":"@onekeyfe/hd-core","version":"0.1
|
|
47841
|
+
module.exports = JSON.parse('{"name":"@onekeyfe/hd-core","version":"0.2.1","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.1","@onekeyfe/hd-transport":"^0.2.1","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
47842
|
|
|
47800
47843
|
/***/ })
|
|
47801
47844
|
|
|
@@ -50322,7 +50365,7 @@ const src_init = async settings => {
|
|
|
50322
50365
|
|
|
50323
50366
|
try {
|
|
50324
50367
|
await init({ ..._settings,
|
|
50325
|
-
version: "0.1
|
|
50368
|
+
version: "0.2.1"
|
|
50326
50369
|
});
|
|
50327
50370
|
return true;
|
|
50328
50371
|
} catch (e) {
|