@onekeyfe/hd-core 0.2.42 → 0.2.43

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":"DeviceCommands.d.ts","sourceRoot":"","sources":["../../src/device/DeviceCommands.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAe,MAAM,wBAAwB,CAAC;AAK/E,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAGvC,aAAK,WAAW,GAAG,QAAQ,CAAC,WAAW,CAAC;AACxC,aAAK,UAAU,GAAG,MAAM,WAAW,CAAC;AACpC,oBAAY,oBAAoB,CAAC,CAAC,SAAS,UAAU,IAAI;IACvD,IAAI,EAAE,CAAC,CAAC;IACR,OAAO,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC;CACzB,CAAC;AACF,aAAK,oBAAoB,GAAG;KACzB,CAAC,IAAI,MAAM,WAAW,GAAG,oBAAoB,CAAC,CAAC,CAAC;CAClD,CAAC;AACF,oBAAY,sBAAsB,GAAG,oBAAoB,CAAC,MAAM,WAAW,CAAC,CAAC;AAE7E,oBAAY,wBAAwB,GAAG;IACrC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB,CAAC;AAcF,qBAAa,cAAc;IACzB,MAAM,EAAE,MAAM,CAAC;IAEf,SAAS,EAAE,SAAS,CAAC;IAErB,MAAM,EAAE,MAAM,CAAC;IAEf,QAAQ,EAAE,OAAO,CAAC;IAElB,WAAW,CAAC,EAAE,OAAO,CAAC,sBAAsB,CAAC,CAAC;IAE9C,kBAAkB,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE,GAAG,KAAK,IAAI,CAAC;gBAE/B,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;IAOpC,OAAO,CAAC,a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AE,CAAC,EACV,GAAG,CAAC,EAAE,WAAW,CAAC,CAAC,CAAC,GACnB,OAAO,CAAC,oBAAoB,CAAC,CAAC,CAAC,CAAC;IAuC7B,WAAW,CAAC,IAAI,EAAE,UAAU,EAAE,GAAG,CAAC,EAAE,sBAAsB,CAAC,SAAS,CAAC;IAK3E,kBAAkB,CAChB,GAAG,EAAE,sBAAsB,EAC3B,QAAQ,EAAE,UAAU,GACnB,OAAO,CAAC,sBAAsB,CAAC;IA0HlC,UAAU,CAAC,IAAI,CAAC,EAAE,QAAQ,CAAC,oBAAoB;IAwB/C,iBAAiB;CA2BlB;AAED,oBAAY,SAAS,GAAG,cAAc,CAAC,WAAW,CAAC,CAAC"}
package/dist/index.js CHANGED
@@ -11902,7 +11902,7 @@ class DeviceCommands {
11902
11902
  });
11903
11903
  }
11904
11904
  call(type, msg = {}) {
11905
- var _a, _b, _c, _d, _e;
11905
+ var _a, _b, _c, _d, _e, _f;
11906
11906
  return __awaiter(this, void 0, void 0, function* () {
11907
11907
  Log$6.debug('[DeviceCommands] [call] Sending', type);
11908
11908
  try {
@@ -11914,10 +11914,13 @@ class DeviceCommands {
11914
11914
  }
11915
11915
  catch (error) {
11916
11916
  Log$6.debug('[DeviceCommands] [call] Received error', error);
11917
- if (((_b = (_a = error === null || error === void 0 ? void 0 : error.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.error) === 'device disconnected during action') {
11917
+ if ((_a = error.response) === null || _a === void 0 ? void 0 : _a.data) {
11918
+ Log$6.debug('error response', error === null || error === void 0 ? void 0 : error.response.data);
11919
+ }
11920
+ if (((_c = (_b = error === null || error === void 0 ? void 0 : error.response) === null || _b === void 0 ? void 0 : _b.data) === null || _c === void 0 ? void 0 : _c.error) === 'device disconnected during action') {
11918
11921
  return { type: 'BridgeNetworkError', message: {} };
11919
11922
  }
11920
- if (((_e = (_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.error) === null || _e === void 0 ? void 0 : _e.indexOf('Request failed with status code')) !== -1) {
11923
+ if (((_f = (_e = (_d = error === null || error === void 0 ? void 0 : error.response) === null || _d === void 0 ? void 0 : _d.data) === null || _e === void 0 ? void 0 : _e.error) === null || _f === void 0 ? void 0 : _f.indexOf('Request failed with status code')) !== -1) {
11921
11924
  return { type: 'CallMethodError', message: {} };
11922
11925
  }
11923
11926
  throw error;
@@ -11989,8 +11992,13 @@ class DeviceCommands {
11989
11992
  error = hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.FileAlreadyExists);
11990
11993
  }
11991
11994
  }
11992
- if (code === 'Failure_UnexpectedMessage' && callType === 'PassphraseAck') {
11993
- error = hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.UnexpectPassphrase);
11995
+ if (code === 'Failure_UnexpectedMessage') {
11996
+ if (callType === 'PassphraseAck') {
11997
+ error = hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.UnexpectPassphrase);
11998
+ }
11999
+ if (message === 'Not in Signing mode') {
12000
+ error = hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.NotInSigningMode);
12001
+ }
11994
12002
  }
11995
12003
  if (error) {
11996
12004
  return Promise.reject(error);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onekeyfe/hd-core",
3
- "version": "0.2.42",
3
+ "version": "0.2.43",
4
4
  "description": "> TODO: description",
5
5
  "author": "OneKey",
6
6
  "homepage": "https://github.com/OneKeyHQ/hardware-js-sdk#readme",
@@ -24,8 +24,8 @@
24
24
  "url": "https://github.com/OneKeyHQ/hardware-js-sdk/issues"
25
25
  },
26
26
  "dependencies": {
27
- "@onekeyfe/hd-shared": "^0.2.42",
28
- "@onekeyfe/hd-transport": "^0.2.42",
27
+ "@onekeyfe/hd-shared": "^0.2.43",
28
+ "@onekeyfe/hd-transport": "^0.2.43",
29
29
  "axios": "^0.27.2",
30
30
  "bignumber.js": "^9.0.2",
31
31
  "bytebuffer": "^5.0.1",
@@ -43,5 +43,5 @@
43
43
  "@types/semver": "^7.3.9",
44
44
  "ripple-keypairs": "^1.1.4"
45
45
  },
46
- "gitHead": "2d770a3d42548e8e3f78aedc87582a1369c0ca59"
46
+ "gitHead": "7ba97c0f3dbf636ebb46928cc4c07c208eaf03e7"
47
47
  }
@@ -79,6 +79,9 @@ export class DeviceCommands {
79
79
  return res;
80
80
  } catch (error) {
81
81
  Log.debug('[DeviceCommands] [call] Received error', error);
82
+ if (error.response?.data) {
83
+ Log.debug('error response', error?.response.data);
84
+ }
82
85
  if (error?.response?.data?.error === 'device disconnected during action') {
83
86
  return { type: 'BridgeNetworkError', message: {} } as any;
84
87
  }
@@ -189,8 +192,13 @@ export class DeviceCommands {
189
192
  }
190
193
  }
191
194
 
192
- if (code === 'Failure_UnexpectedMessage' && callType === 'PassphraseAck') {
193
- error = ERRORS.TypedError(HardwareErrorCode.UnexpectPassphrase);
195
+ if (code === 'Failure_UnexpectedMessage') {
196
+ if (callType === 'PassphraseAck') {
197
+ error = ERRORS.TypedError(HardwareErrorCode.UnexpectPassphrase);
198
+ }
199
+ if (message === 'Not in Signing mode') {
200
+ error = ERRORS.TypedError(HardwareErrorCode.NotInSigningMode);
201
+ }
194
202
  }
195
203
 
196
204
  if (error) {