@onekeyfe/hd-core 1.1.34-alpha.1 → 1.1.34-alpha.2

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":"index.d.ts","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":";AACA,OAAO,YAAY,MAAM,QAAQ,CAAC;AAwClC,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAkB1C,OAAO,eAAe,MAAM,2BAA2B,CAAC;AAIxD,OAAO,KAAK,EAAE,eAAe,EAAe,MAAM,UAAU,CAAC;AAC7D,OAAO,KAAK,EAAE,WAAW,EAAmD,MAAM,WAAW,CAAC;AAI9F,OAAO,KAAK,EAEV,6BAA6B,EAE9B,MAAM,wBAAwB,CAAC;AAWhC,MAAM,MAAM,WAAW,GAAG,UAAU,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC,CAAC;AA6D7D,eAAO,MAAM,OAAO,YAAmB,WAAW,WAAW,WAAW,iBA6EvE,CAAC;AAixBF,eAAO,MAAM,MAAM,YAAa,WAAW,cAAc,MAAM,SAkF9D,CAAC;AAuEF,eAAO,MAAM,qBAAqB,gFAejC,CAAC;AA0GF,MAAM,CAAC,OAAO,OAAO,IAAK,SAAQ,YAAY;IAC5C,OAAO,CAAC,cAAc,CAAoB;IAE1C,SAAgB,aAAa,EAAE,MAAM,CAAC;IAEtC,OAAO,CAAC,YAAY,CAAsB;IAG1C,OAAO,CAAC,qBAAqB,CAA4B;IAEzD,OAAO,CAAC,iBAAiB,CAAoB;;IAS7C,OAAO,CAAC,cAAc;IAoBhB,aAAa,CAAC,OAAO,EAAE,WAAW;IA2DxC,OAAO;CASR;AAED,eAAO,MAAM,QAAQ,YAGpB,CAAC;AAEF,eAAO,MAAM,aAAa,uBAIzB,CAAC;AAMF,eAAO,MAAM,IAAI,aACL,eAAe,aACd,GAAG,WACL,6BAA6B,8BAoBvC,CAAC;AAEF,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,CAAC"}
package/dist/index.js CHANGED
@@ -41900,6 +41900,11 @@ function connectDeviceForBle(method, device, retryCount = 0) {
41900
41900
  }
41901
41901
  }
41902
41902
  catch (err) {
41903
+ if (hdShared.ERROR_CODES_REQUIRE_DISCONNECT.includes(err.errorCode) &&
41904
+ device.mainId &&
41905
+ device.deviceConnector) {
41906
+ yield device.deviceConnector.disconnect(device.mainId).catch(() => undefined);
41907
+ }
41903
41908
  if (err.errorCode === hdShared.HardwareErrorCode.BleTimeoutError && retryCount < 6) {
41904
41909
  const nextRetry = retryCount + 1;
41905
41910
  Log.debug(`Bluetooth connect timeout and will retry, retry count: ${nextRetry}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onekeyfe/hd-core",
3
- "version": "1.1.34-alpha.1",
3
+ "version": "1.1.34-alpha.2",
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.34-alpha.1",
29
- "@onekeyfe/hd-transport": "1.1.34-alpha.1",
28
+ "@onekeyfe/hd-shared": "1.1.34-alpha.2",
29
+ "@onekeyfe/hd-transport": "1.1.34-alpha.2",
30
30
  "axios": "1.15.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": "e017f56235eae6eab82f1c687699a4204f3173f9"
47
+ "gitHead": "dee167c35d191f3f4e02c4cb6228e1f926f929ec"
48
48
  }
package/src/core/index.ts CHANGED
@@ -2,6 +2,7 @@ import semver from 'semver';
2
2
  import EventEmitter from 'events';
3
3
  import {
4
4
  ERRORS,
5
+ ERROR_CODES_REQUIRE_DISCONNECT,
5
6
  ERROR_CODES_REQUIRE_RELEASE,
6
7
  HardwareError,
7
8
  HardwareErrorCode,
@@ -832,6 +833,16 @@ async function connectDeviceForBle(method: BaseMethod, device: Device, retryCoun
832
833
  });
833
834
  }
834
835
  } catch (err) {
836
+ // Device.run()'s REQUIRE_DISCONNECT handling never sees acquire/initialize
837
+ // failures — drop the wedged link here so retries cold-connect instead of
838
+ // reusing it forever.
839
+ if (
840
+ ERROR_CODES_REQUIRE_DISCONNECT.includes(err.errorCode) &&
841
+ device.mainId &&
842
+ device.deviceConnector
843
+ ) {
844
+ await device.deviceConnector.disconnect(device.mainId).catch(() => undefined);
845
+ }
835
846
  if (err.errorCode === HardwareErrorCode.BleTimeoutError && retryCount < 6) {
836
847
  const nextRetry = retryCount + 1;
837
848
  Log.debug(`Bluetooth connect timeout and will retry, retry count: ${nextRetry}`);