@onekeyfe/hd-web-sdk 0.1.28 → 0.1.31

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.28"}/`;
14868
+ const DEFAULT_DOMAIN = `https://jssdk.onekey.so/${"0.1.31"}/`;
14869
14869
  const DEFAULT_PRIORITY = 2;
14870
14870
  const initialSettings = {
14871
14871
  configSrc: './data/config.json',
@@ -15138,6 +15138,14 @@ 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
+ yield this.commands.typedCall('ApplySettings', 'Success', {
15145
+ use_passphrase: false
15146
+ });
15147
+ }
15148
+ }
15141
15149
  });
15142
15150
  }
15143
15151
 
@@ -17467,7 +17475,7 @@ class EVMSignTransaction extends BaseMethod {
17467
17475
  }))
17468
17476
  };
17469
17477
  const response = yield this.device.commands.typedCall('EthereumSignTxEIP1559', 'EthereumTxRequest', message);
17470
- return this.processTxRequest(response.message, rest, chainId);
17478
+ return this.processTxRequest(response.message, rest);
17471
17479
  });
17472
17480
  }
17473
17481
 
@@ -19120,26 +19128,16 @@ class RequestWebUsbDevice extends BaseMethod {
19120
19128
  return Promise.reject(hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.RuntimeError, 'Not webusb environment'));
19121
19129
  }
19122
19130
 
19123
- const transport = TransportManager.getTransport();
19124
-
19125
19131
  try {
19126
- const device = yield transport.requestDevice();
19127
-
19128
- if (!device) {
19129
- return yield Promise.reject(hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.RuntimeError, 'Please select the device to connect'));
19130
- }
19131
-
19132
19132
  const deviceDiff = yield (_a = this.connector) === null || _a === void 0 ? void 0 : _a.enumerate();
19133
19133
  const devicesDescriptor = (_b = deviceDiff === null || deviceDiff === void 0 ? void 0 : deviceDiff.descriptors) !== null && _b !== void 0 ? _b : [];
19134
19134
  const {
19135
19135
  deviceList
19136
19136
  } = yield DevicePool.getDevices(devicesDescriptor);
19137
19137
 
19138
- const _device = deviceList.find(d => d.originalDescriptor.path === device.serialNumber);
19139
-
19140
- if (_device) {
19138
+ if (deviceList.length > 0) {
19141
19139
  return {
19142
- device: _device.toMessageObject()
19140
+ device: deviceList[0].toMessageObject()
19143
19141
  };
19144
19142
  }
19145
19143
 
@@ -44104,6 +44102,10 @@ const init = async settings => {
44104
44102
  instance.style.width = '0px';
44105
44103
  instance.style.height = '0px';
44106
44104
  instance.id = 'onekey-connect';
44105
+
44106
+ if (settings.env === 'webusb') {
44107
+ instance.allow = 'usb';
44108
+ }
44107
44109
  }
44108
44110
 
44109
44111
  const manifest = `version=${settings.version}`;
@@ -46501,7 +46503,7 @@ const src_init = async settings => {
46501
46503
 
46502
46504
  try {
46503
46505
  await init({ ..._settings,
46504
- version: "0.1.28"
46506
+ version: "0.1.31"
46505
46507
  });
46506
46508
  return true;
46507
46509
  } catch (e) {