@onekeyfe/hd-core 1.0.25-alpha.7 → 1.0.25-alpha.8

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 CHANGED
@@ -27918,9 +27918,9 @@ const newTouchUpdateProcess = (updateType, postMessage, device, { payload }, reb
27918
27918
  return response;
27919
27919
  });
27920
27920
  const emmcFileWriteWithRetry = (device, filePath, chunkLength, offset, chunk, overwrite, progress) => __awaiter(void 0, void 0, void 0, function* () {
27921
- var _a, _b, _c, _d, _e, _f;
27921
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
27922
27922
  const writeFunc = () => __awaiter(void 0, void 0, void 0, function* () {
27923
- var _g;
27923
+ var _k;
27924
27924
  const typedCall = device.getCommands().typedCall.bind(device.getCommands());
27925
27925
  const writeRes = yield typedCall('EmmcFileWrite', 'EmmcFile', {
27926
27926
  file: {
@@ -27935,7 +27935,7 @@ const emmcFileWriteWithRetry = (device, filePath, chunkLength, offset, chunk, ov
27935
27935
  });
27936
27936
  if (writeRes.type !== 'EmmcFile') {
27937
27937
  if (writeRes.type === 'CallMethodError') {
27938
- if (((_g = writeRes.message.error) !== null && _g !== void 0 ? _g : '').indexOf(SESSION_ERROR$1) > -1) {
27938
+ if (((_k = writeRes.message.error) !== null && _k !== void 0 ? _k : '').indexOf(SESSION_ERROR$1) > -1) {
27939
27939
  throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.RuntimeError, SESSION_ERROR$1);
27940
27940
  }
27941
27941
  }
@@ -27961,15 +27961,15 @@ const emmcFileWriteWithRetry = (device, filePath, chunkLength, offset, chunk, ov
27961
27961
  yield ((_a = device.deviceConnector) === null || _a === void 0 ? void 0 : _a.acquire(device.originalDescriptor.id, null, true));
27962
27962
  yield device.initialize();
27963
27963
  }
27964
- else if (error.message.indexOf(SESSION_ERROR$1) > -1 ||
27965
- error.response.data.indexOf(SESSION_ERROR$1) > -1) {
27966
- const deviceDiff = yield ((_b = device.deviceConnector) === null || _b === void 0 ? void 0 : _b.enumerate());
27967
- const devicesDescriptor = (_c = deviceDiff === null || deviceDiff === void 0 ? void 0 : deviceDiff.descriptors) !== null && _c !== void 0 ? _c : [];
27964
+ else if (((_b = error === null || error === void 0 ? void 0 : error.message) === null || _b === void 0 ? void 0 : _b.indexOf(SESSION_ERROR$1)) > -1 ||
27965
+ ((_d = (_c = error === null || error === void 0 ? void 0 : error.response) === null || _c === void 0 ? void 0 : _c.data) === null || _d === void 0 ? void 0 : _d.indexOf(SESSION_ERROR$1)) > -1) {
27966
+ const deviceDiff = yield ((_e = device.deviceConnector) === null || _e === void 0 ? void 0 : _e.enumerate());
27967
+ const devicesDescriptor = (_f = deviceDiff === null || deviceDiff === void 0 ? void 0 : deviceDiff.descriptors) !== null && _f !== void 0 ? _f : [];
27968
27968
  const { deviceList } = yield DevicePool.getDevices(devicesDescriptor, undefined);
27969
- if (deviceList.length === 1 && ((_e = (_d = deviceList[0]) === null || _d === void 0 ? void 0 : _d.features) === null || _e === void 0 ? void 0 : _e.bootloader_mode)) {
27969
+ if (deviceList.length === 1 && ((_h = (_g = deviceList[0]) === null || _g === void 0 ? void 0 : _g.features) === null || _h === void 0 ? void 0 : _h.bootloader_mode)) {
27970
27970
  device.updateFromCache(deviceList[0]);
27971
27971
  yield device.acquire();
27972
- device.getCommands().mainId = (_f = device.mainId) !== null && _f !== void 0 ? _f : '';
27972
+ device.getCommands().mainId = (_j = device.mainId) !== null && _j !== void 0 ? _j : '';
27973
27973
  }
27974
27974
  }
27975
27975
  yield wait(3000);
@@ -28816,10 +28816,10 @@ class FirmwareUpdateBaseMethod extends BaseMethod {
28816
28816
  });
28817
28817
  }
28818
28818
  emmcFileWriteWithRetry(filePath, chunkLength, offset, chunk, overwrite, progress) {
28819
- var _a, _b, _c, _d, _e, _f;
28819
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
28820
28820
  return __awaiter(this, void 0, void 0, function* () {
28821
28821
  const writeFunc = () => __awaiter(this, void 0, void 0, function* () {
28822
- var _g;
28822
+ var _k;
28823
28823
  const typedCall = this.device.getCommands().typedCall.bind(this.device.getCommands());
28824
28824
  const writeRes = yield typedCall('EmmcFileWrite', 'EmmcFile', {
28825
28825
  file: {
@@ -28834,7 +28834,7 @@ class FirmwareUpdateBaseMethod extends BaseMethod {
28834
28834
  });
28835
28835
  if (writeRes.type !== 'EmmcFile') {
28836
28836
  if (writeRes.type === 'CallMethodError') {
28837
- if (((_g = writeRes.message.error) !== null && _g !== void 0 ? _g : '').indexOf(SESSION_ERROR) > -1) {
28837
+ if (((_k = writeRes.message.error) !== null && _k !== void 0 ? _k : '').indexOf(SESSION_ERROR) > -1) {
28838
28838
  throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.RuntimeError, SESSION_ERROR);
28839
28839
  }
28840
28840
  }
@@ -28860,15 +28860,15 @@ class FirmwareUpdateBaseMethod extends BaseMethod {
28860
28860
  yield ((_a = this.device.deviceConnector) === null || _a === void 0 ? void 0 : _a.acquire(this.device.originalDescriptor.id, null, true));
28861
28861
  yield this.device.initialize();
28862
28862
  }
28863
- else if (error.message.indexOf(SESSION_ERROR) > -1 ||
28864
- error.response.data.indexOf(SESSION_ERROR) > -1) {
28865
- const deviceDiff = yield ((_b = this.device.deviceConnector) === null || _b === void 0 ? void 0 : _b.enumerate());
28866
- const devicesDescriptor = (_c = deviceDiff === null || deviceDiff === void 0 ? void 0 : deviceDiff.descriptors) !== null && _c !== void 0 ? _c : [];
28863
+ else if (((_b = error === null || error === void 0 ? void 0 : error.message) === null || _b === void 0 ? void 0 : _b.indexOf(SESSION_ERROR)) > -1 ||
28864
+ ((_d = (_c = error === null || error === void 0 ? void 0 : error.response) === null || _c === void 0 ? void 0 : _c.data) === null || _d === void 0 ? void 0 : _d.indexOf(SESSION_ERROR)) > -1) {
28865
+ const deviceDiff = yield ((_e = this.device.deviceConnector) === null || _e === void 0 ? void 0 : _e.enumerate());
28866
+ const devicesDescriptor = (_f = deviceDiff === null || deviceDiff === void 0 ? void 0 : deviceDiff.descriptors) !== null && _f !== void 0 ? _f : [];
28867
28867
  const { deviceList } = yield DevicePool.getDevices(devicesDescriptor, undefined);
28868
- if (deviceList.length === 1 && ((_e = (_d = deviceList[0]) === null || _d === void 0 ? void 0 : _d.features) === null || _e === void 0 ? void 0 : _e.bootloader_mode)) {
28868
+ if (deviceList.length === 1 && ((_h = (_g = deviceList[0]) === null || _g === void 0 ? void 0 : _g.features) === null || _h === void 0 ? void 0 : _h.bootloader_mode)) {
28869
28869
  this.device.updateFromCache(deviceList[0]);
28870
28870
  yield this.device.acquire();
28871
- this.device.getCommands().mainId = (_f = this.device.mainId) !== null && _f !== void 0 ? _f : '';
28871
+ this.device.getCommands().mainId = (_j = this.device.mainId) !== null && _j !== void 0 ? _j : '';
28872
28872
  }
28873
28873
  }
28874
28874
  yield wait(2000);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onekeyfe/hd-core",
3
- "version": "1.0.25-alpha.7",
3
+ "version": "1.0.25-alpha.8",
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": "^1.0.25-alpha.7",
29
- "@onekeyfe/hd-transport": "^1.0.25-alpha.7",
28
+ "@onekeyfe/hd-shared": "^1.0.25-alpha.8",
29
+ "@onekeyfe/hd-transport": "^1.0.25-alpha.8",
30
30
  "axios": "^0.27.2",
31
31
  "bignumber.js": "^9.0.2",
32
32
  "bytebuffer": "^5.0.1",
@@ -46,5 +46,5 @@
46
46
  "@types/web-bluetooth": "^0.0.21",
47
47
  "ripple-keypairs": "^1.1.4"
48
48
  },
49
- "gitHead": "9b8848c916b8d809eda1224b712ad1fe678a1a64"
49
+ "gitHead": "709d82746c745e1f205a641e1907f467cbf3cc51"
50
50
  }
@@ -385,8 +385,8 @@ export class FirmwareUpdateBaseMethod<Params> extends BaseMethod<Params> {
385
385
  await this.device.deviceConnector?.acquire(this.device.originalDescriptor.id, null, true);
386
386
  await this.device.initialize();
387
387
  } else if (
388
- error.message.indexOf(SESSION_ERROR) > -1 ||
389
- error.response.data.indexOf(SESSION_ERROR) > -1
388
+ error?.message?.indexOf(SESSION_ERROR) > -1 ||
389
+ error?.response?.data?.indexOf(SESSION_ERROR) > -1
390
390
  ) {
391
391
  const deviceDiff = await this.device.deviceConnector?.enumerate();
392
392
  const devicesDescriptor = deviceDiff?.descriptors ?? [];
@@ -278,8 +278,8 @@ const emmcFileWriteWithRetry = async (
278
278
  await device.deviceConnector?.acquire(device.originalDescriptor.id, null, true);
279
279
  await device.initialize();
280
280
  } else if (
281
- error.message.indexOf(SESSION_ERROR) > -1 ||
282
- error.response.data.indexOf(SESSION_ERROR) > -1
281
+ error?.message?.indexOf(SESSION_ERROR) > -1 ||
282
+ error?.response?.data?.indexOf(SESSION_ERROR) > -1
283
283
  ) {
284
284
  const deviceDiff = await device.deviceConnector?.enumerate();
285
285
  const devicesDescriptor = deviceDiff?.descriptors ?? [];