@onekeyfe/hd-core 1.0.0-alpha.11 → 1.0.0-alpha.12

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":"DeviceUpdateBootloader.d.ts","sourceRoot":"","sources":["../../../src/api/device/DeviceUpdateBootloader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAA6B,MAAM,qBAAqB,CAAC;AAE1E,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAS3C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,KAAK,EAAE,QAAQ,EAAe,MAAM,aAAa,CAAC;AAEzD,MAAM,CAAC,OAAO,OAAO,sBAAuB,SAAQ,UAAU;IAC5D,YAAY,EAAE,QAAQ,CAAC,GAAG,CAAC,GAAG,IAAI,CAAQ;IAE1C,IAAI;IAOJ,cAAc,YAAa,MAAM,UAS/B;IAEI,qBAAqB,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,QAAQ;IAmCzD,GAAG;CAWV"}
1
+ {"version":3,"file":"DeviceUpdateBootloader.d.ts","sourceRoot":"","sources":["../../../src/api/device/DeviceUpdateBootloader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAA6B,MAAM,qBAAqB,CAAC;AAE1E,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAS3C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,KAAK,EAAE,QAAQ,EAAe,MAAM,aAAa,CAAC;AAEzD,MAAM,CAAC,OAAO,OAAO,sBAAuB,SAAQ,UAAU;IAC5D,YAAY,EAAE,QAAQ,CAAC,GAAG,CAAC,GAAG,IAAI,CAAQ;IAE1C,IAAI;IAOJ,cAAc,YAAa,MAAM,UAS/B;IAEI,qBAAqB,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,QAAQ;IA+BzD,GAAG;CAWV"}
package/dist/index.js CHANGED
@@ -26599,30 +26599,26 @@ class DeviceUpdateBootloader extends BaseMethod {
26599
26599
  this.skipForceUpdateCheck = true;
26600
26600
  }
26601
26601
  updateTouchBootloader(device, features) {
26602
- var _a;
26603
26602
  return __awaiter(this, void 0, void 0, function* () {
26604
26603
  if (features && !features.bootloader_mode) {
26605
- const existsBootRes = ((_a = this.payload) === null || _a === void 0 ? void 0 : _a.binary) != null;
26606
- if (features && existsBootRes) {
26607
- let { binary } = this.payload;
26608
- if (!binary) {
26609
- this.postTipMessage('CheckLatestUiResource');
26610
- const resourceUrl = DataManager.getBootloaderResource(features);
26611
- if (resourceUrl) {
26612
- this.postTipMessage('DownloadLatestBootloaderResource');
26613
- const resource = yield getSysResourceBinary(resourceUrl);
26614
- this.postTipMessage('DownloadLatestBootloaderResourceSuccess');
26615
- if (resource) {
26616
- binary = resource.binary;
26617
- }
26604
+ let { binary } = this.payload;
26605
+ if (!binary) {
26606
+ this.postTipMessage('CheckLatestUiResource');
26607
+ const resourceUrl = DataManager.getBootloaderResource(features);
26608
+ if (resourceUrl) {
26609
+ this.postTipMessage('DownloadLatestBootloaderResource');
26610
+ const resource = yield getSysResourceBinary(resourceUrl);
26611
+ this.postTipMessage('DownloadLatestBootloaderResourceSuccess');
26612
+ if (resource) {
26613
+ binary = resource.binary;
26618
26614
  }
26619
26615
  }
26620
- if (!checkBootloaderLength(binary)) {
26621
- throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.CheckDownloadFileError);
26622
- }
26623
- yield updateBootloader(this.device.getCommands().typedCall.bind(this.device.getCommands()), this.postMessage, device, binary);
26624
- return Promise.resolve(true);
26625
26616
  }
26617
+ if (!checkBootloaderLength(binary)) {
26618
+ throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.CheckDownloadFileError);
26619
+ }
26620
+ yield updateBootloader(this.device.getCommands().typedCall.bind(this.device.getCommands()), this.postMessage, device, binary);
26621
+ return Promise.resolve(true);
26626
26622
  }
26627
26623
  return Promise.resolve(true);
26628
26624
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onekeyfe/hd-core",
3
- "version": "1.0.0-alpha.11",
3
+ "version": "1.0.0-alpha.12",
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.0-alpha.11",
29
- "@onekeyfe/hd-transport": "^1.0.0-alpha.11",
28
+ "@onekeyfe/hd-shared": "^1.0.0-alpha.12",
29
+ "@onekeyfe/hd-transport": "^1.0.0-alpha.12",
30
30
  "axios": "^0.27.2",
31
31
  "bignumber.js": "^9.0.2",
32
32
  "bytebuffer": "^5.0.1",
@@ -44,5 +44,5 @@
44
44
  "@types/semver": "^7.3.9",
45
45
  "ripple-keypairs": "^1.1.4"
46
46
  },
47
- "gitHead": "3942305455c5a5fdf2a112870f522200d9f46675"
47
+ "gitHead": "6d0a628ca0e177cdb2052b8c141cb94cf0875d7a"
48
48
  }
@@ -35,34 +35,30 @@ export default class DeviceUpdateBootloader extends BaseMethod {
35
35
 
36
36
  async updateTouchBootloader(device: Device, features?: Features) {
37
37
  if (features && !features.bootloader_mode) {
38
- const existsBootRes = this.payload?.binary != null;
39
-
40
- if (features && existsBootRes) {
41
- let { binary } = this.payload;
42
- if (!binary) {
43
- this.postTipMessage('CheckLatestUiResource');
44
- const resourceUrl = DataManager.getBootloaderResource(features);
45
- if (resourceUrl) {
46
- this.postTipMessage('DownloadLatestBootloaderResource');
47
- const resource = await getSysResourceBinary(resourceUrl);
48
- this.postTipMessage('DownloadLatestBootloaderResourceSuccess');
49
- if (resource) {
50
- binary = resource.binary;
51
- }
38
+ let { binary } = this.payload;
39
+ if (!binary) {
40
+ this.postTipMessage('CheckLatestUiResource');
41
+ const resourceUrl = DataManager.getBootloaderResource(features);
42
+ if (resourceUrl) {
43
+ this.postTipMessage('DownloadLatestBootloaderResource');
44
+ const resource = await getSysResourceBinary(resourceUrl);
45
+ this.postTipMessage('DownloadLatestBootloaderResourceSuccess');
46
+ if (resource) {
47
+ binary = resource.binary;
52
48
  }
53
49
  }
50
+ }
54
51
 
55
- if (!checkBootloaderLength(binary)) {
56
- throw ERRORS.TypedError(HardwareErrorCode.CheckDownloadFileError);
57
- }
58
- await updateBootloader(
59
- this.device.getCommands().typedCall.bind(this.device.getCommands()),
60
- this.postMessage,
61
- device,
62
- binary
63
- );
64
- return Promise.resolve(true);
52
+ if (!checkBootloaderLength(binary)) {
53
+ throw ERRORS.TypedError(HardwareErrorCode.CheckDownloadFileError);
65
54
  }
55
+ await updateBootloader(
56
+ this.device.getCommands().typedCall.bind(this.device.getCommands()),
57
+ this.postMessage,
58
+ device,
59
+ binary
60
+ );
61
+ return Promise.resolve(true);
66
62
  }
67
63
 
68
64
  return Promise.resolve(true);