@onekeyfe/hd-web-sdk 0.1.30 → 0.1.33

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.
@@ -14789,10 +14789,6 @@ class DeviceCommands {
14789
14789
  return Promise.resolve(patchFeatures(res));
14790
14790
  }
14791
14791
 
14792
- if ((_a = this.device.features) === null || _a === void 0 ? void 0 : _a.passphrase_protection) {
14793
- return Promise.reject(hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.DeviceNotSupportPassphrase));
14794
- }
14795
-
14796
14792
  if (res.type === 'ButtonRequest') {
14797
14793
  if (res.message.code === 'ButtonRequest_PassphraseEntry') {
14798
14794
  this.device.emit(DEVICE.PASSPHRASE_ON_DEVICE, this.device);
@@ -14822,6 +14818,10 @@ class DeviceCommands {
14822
14818
  }, () => this._commonCall('Cancel', {}));
14823
14819
  }
14824
14820
 
14821
+ if ((_a = this.device.features) === null || _a === void 0 ? void 0 : _a.passphrase_protection) {
14822
+ return Promise.reject(hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.DeviceNotSupportPassphrase));
14823
+ }
14824
+
14825
14825
  if (res.type === 'PassphraseRequest') {
14826
14826
  return Promise.reject(hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.DeviceNotSupportPassphrase));
14827
14827
  }
@@ -14865,7 +14865,7 @@ const UI_REQUEST = {
14865
14865
  FIRMWARE_NOT_INSTALLED: 'ui-device_firmware_not_installed',
14866
14866
  NOT_USE_ONEKEY_DEVICE: 'ui-device_please_use_onekey_device'
14867
14867
  };
14868
- const DEFAULT_DOMAIN = `https://jssdk.onekey.so/${"0.1.30"}/`;
14868
+ const DEFAULT_DOMAIN = `https://jssdk.onekey.so/${"0.1.33"}/`;
14869
14869
  const DEFAULT_PRIORITY = 2;
14870
14870
  const initialSettings = {
14871
14871
  configSrc: './data/config.json',
@@ -15138,6 +15138,22 @@ class Device extends events.exports {
15138
15138
  } = yield this.commands.typedCall('Initialize', 'Features', payload);
15139
15139
 
15140
15140
  this._updateFeatures(message);
15141
+
15142
+ if (message.passphrase_protection) {
15143
+ if (this.listenerCount(DEVICE.PIN) > 0) {
15144
+ Log$3.debug('try to close passpharse');
15145
+
15146
+ try {
15147
+ yield this.commands.typedCall('ApplySettings', 'Success', {
15148
+ use_passphrase: false
15149
+ });
15150
+ } catch (e) {
15151
+ yield this.release();
15152
+ this.runPromise = null;
15153
+ throw e;
15154
+ }
15155
+ }
15156
+ }
15141
15157
  });
15142
15158
  }
15143
15159
 
@@ -15205,6 +15221,8 @@ class Device extends events.exports {
15205
15221
  }
15206
15222
 
15207
15223
  _runInner(fn, options) {
15224
+ var _a;
15225
+
15208
15226
  return __awaiter(this, void 0, void 0, function* () {
15209
15227
  if (!this.isUsedHere() || this.commands.disposed) {
15210
15228
  const env = DataManager.getSettings('env');
@@ -15225,6 +15243,21 @@ class Device extends events.exports {
15225
15243
 
15226
15244
  return Promise.reject(hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.DeviceInitializeFailed, `Initialize failed: ${error.message}, code: ${error.code}`));
15227
15245
  }
15246
+ } else if (env === 'react-native') {
15247
+ if ((_a = this.features) === null || _a === void 0 ? void 0 : _a.passphrase_protection) {
15248
+ if (this.listenerCount(DEVICE.PIN) > 0) {
15249
+ Log$3.debug('try to close passpharse for mobile');
15250
+
15251
+ try {
15252
+ yield this.commands.typedCall('ApplySettings', 'Success', {
15253
+ use_passphrase: false
15254
+ });
15255
+ } catch (e) {
15256
+ this.runPromise = null;
15257
+ return Promise.reject(e);
15258
+ }
15259
+ }
15260
+ }
15228
15261
  }
15229
15262
  }
15230
15263
 
@@ -15233,7 +15266,16 @@ class Device extends events.exports {
15233
15266
  }
15234
15267
 
15235
15268
  if (fn) {
15236
- yield fn();
15269
+ try {
15270
+ yield fn();
15271
+ } catch (e) {
15272
+ if (this.runPromise) {
15273
+ this.runPromise.reject(e);
15274
+ }
15275
+
15276
+ this.runPromise = null;
15277
+ return;
15278
+ }
15237
15279
  }
15238
15280
 
15239
15281
  if (!this.keepSession && typeof options.keepSession !== 'boolean' || options.keepSession === false) {
@@ -17467,7 +17509,7 @@ class EVMSignTransaction extends BaseMethod {
17467
17509
  }))
17468
17510
  };
17469
17511
  const response = yield this.device.commands.typedCall('EthereumSignTxEIP1559', 'EthereumTxRequest', message);
17470
- return this.processTxRequest(response.message, rest);
17512
+ return this.processTxRequest(response.message, rest, chainId);
17471
17513
  });
17472
17514
  }
17473
17515
 
@@ -46495,7 +46537,7 @@ const src_init = async settings => {
46495
46537
 
46496
46538
  try {
46497
46539
  await init({ ..._settings,
46498
- version: "0.1.30"
46540
+ version: "0.1.33"
46499
46541
  });
46500
46542
  return true;
46501
46543
  } catch (e) {