@onekeyfe/hd-web-sdk 0.1.20 → 0.1.23

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.
@@ -14531,9 +14531,7 @@ class DeviceCommands {
14531
14531
  }
14532
14532
 
14533
14533
  if (res.type === 'PassphraseRequest') {
14534
- return this._commonCall('PassphraseAck', {
14535
- passphrase: ''
14536
- });
14534
+ return Promise.reject(hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.DeviceNotSupportPassphrase));
14537
14535
  }
14538
14536
 
14539
14537
  if (res.type === 'Deprecated_PassphraseStateRequest') ;
@@ -14917,20 +14915,24 @@ class Device extends events.exports {
14917
14915
  _runInner(fn, options) {
14918
14916
  return __awaiter(this, void 0, void 0, function* () {
14919
14917
  if (!this.isUsedHere() || this.commands.disposed) {
14920
- yield this.acquire();
14918
+ const env = DataManager.getSettings('env');
14921
14919
 
14922
- try {
14923
- if (fn) {
14924
- yield this.initialize();
14925
- }
14926
- } catch (error) {
14927
- this.runPromise = null;
14920
+ if (env !== 'react-native') {
14921
+ yield this.acquire();
14928
14922
 
14929
- if (error instanceof hdShared.HardwareError) {
14930
- return Promise.reject(error);
14931
- }
14923
+ try {
14924
+ if (fn) {
14925
+ yield this.initialize();
14926
+ }
14927
+ } catch (error) {
14928
+ this.runPromise = null;
14932
14929
 
14933
- return Promise.reject(hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.DeviceInitializeFailed, `Initialize failed: ${error.message}, code: ${error.code}`));
14930
+ if (error instanceof hdShared.HardwareError) {
14931
+ return Promise.reject(error);
14932
+ }
14933
+
14934
+ return Promise.reject(hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.DeviceInitializeFailed, `Initialize failed: ${error.message}, code: ${error.code}`));
14935
+ }
14934
14936
  }
14935
14937
  }
14936
14938
 
@@ -19161,7 +19163,7 @@ const callAPI = message => __awaiter(void 0, void 0, void 0, function* () {
19161
19163
  callApiQueue.push(method);
19162
19164
 
19163
19165
  if (callApiQueue.length > 1) {
19164
- Log.debug('should cancel the previous method execution: ', callApiQueue);
19166
+ Log.debug('should cancel the previous method execution: ', callApiQueue.map(m => m.name));
19165
19167
  }
19166
19168
 
19167
19169
  if (pollingState[pollingId]) {
@@ -19272,11 +19274,11 @@ const callAPI = message => __awaiter(void 0, void 0, void 0, function* () {
19272
19274
  }
19273
19275
  }
19274
19276
 
19275
- const index = messageResponse && messageResponse.id ? callApiQueue.findIndex(m => m.responseID === messageResponse.id) : -1;
19277
+ const index = method.responseID ? callApiQueue.findIndex(m => m.responseID === method.responseID) : -1;
19276
19278
 
19277
19279
  if (index > -1) {
19278
19280
  callApiQueue.splice(index, 1);
19279
- Log.debug('Remove the finished method from the queue: ', callApiQueue);
19281
+ Log.debug('Remove the finished method from the queue: ', callApiQueue.map(m => m.name));
19280
19282
  }
19281
19283
 
19282
19284
  closePopup();
@@ -19421,7 +19423,7 @@ const ensureConnected = (method, pollingId) => __awaiter(void 0, void 0, void 0,
19421
19423
  } catch (error) {
19422
19424
  Log.debug('device error: ', error);
19423
19425
 
19424
- if (error.errorCode === hdShared.HardwareErrorCode.BlePermissionError) {
19426
+ if ([hdShared.HardwareErrorCode.BlePermissionError, hdShared.HardwareErrorCode.BleLocationError, hdShared.HardwareErrorCode.BleDeviceNotBonded, hdShared.HardwareErrorCode.BleCharacteristicNotifyError, hdShared.HardwareErrorCode.BleWriteCharacteristicError].includes(error.errorCode)) {
19425
19427
  reject(error);
19426
19428
  return;
19427
19429
  }
@@ -20841,6 +20843,7 @@ const HardwareErrorCode = {
20841
20843
  DeviceUnexpectedBootloaderMode: 108,
20842
20844
  DeviceInterruptedFromUser: 109,
20843
20845
  DeviceCheckDeviceIdError: 110,
20846
+ DeviceNotSupportPassphrase: 111,
20844
20847
  NotInitialized: 200,
20845
20848
  IFrameNotInitialized: 300,
20846
20849
  IFrameAleradyInitialized: 301,
@@ -20866,6 +20869,7 @@ const HardwareErrorCode = {
20866
20869
  BleCharacteristicNotFound: 707,
20867
20870
  BleMonitorError: 708,
20868
20871
  BleCharacteristicNotifyError: 709,
20872
+ BleWriteCharacteristicError: 710,
20869
20873
  RuntimeError: 800,
20870
20874
  PinInvalid: 801,
20871
20875
  PinCancelled: 802,
@@ -20890,6 +20894,7 @@ const HardwareErrorCodeMessage = {
20890
20894
  [HardwareErrorCode.DeviceInterruptedFromUser]: 'Device interrupted',
20891
20895
  [HardwareErrorCode.DeviceUnexpectedBootloaderMode]: 'Device should be in bootloader mode',
20892
20896
  [HardwareErrorCode.DeviceCheckDeviceIdError]: 'Device Id in the features is not same.',
20897
+ [HardwareErrorCode.DeviceNotSupportPassphrase]: 'Device not support passphrase',
20893
20898
  [HardwareErrorCode.NotInitialized]: 'Not initialized',
20894
20899
  [HardwareErrorCode.IFrameNotInitialized]: 'IFrame not initialized',
20895
20900
  [HardwareErrorCode.IFrameAleradyInitialized]: 'IFrame alerady initialized',
@@ -20915,6 +20920,7 @@ const HardwareErrorCodeMessage = {
20915
20920
  [HardwareErrorCode.BleCharacteristicNotFound]: 'BLEServiceNotFound: service not found',
20916
20921
  [HardwareErrorCode.BleMonitorError]: 'Monitor Error: characteristic not found',
20917
20922
  [HardwareErrorCode.BleCharacteristicNotifyError]: 'Characteristic Notify Error',
20923
+ [HardwareErrorCode.BleWriteCharacteristicError]: 'Write Characteristic Error',
20918
20924
  [HardwareErrorCode.RuntimeError]: 'Runtime error',
20919
20925
  [HardwareErrorCode.PinInvalid]: 'Pin invalid',
20920
20926
  [HardwareErrorCode.PinCancelled]: 'Pin cancelled',
@@ -46156,7 +46162,7 @@ const src_init = async settings => {
46156
46162
 
46157
46163
  try {
46158
46164
  await init({ ..._settings,
46159
- version: "0.1.20"
46165
+ version: "0.1.23"
46160
46166
  });
46161
46167
  return true;
46162
46168
  } catch (e) {