@onekeyfe/hd-web-sdk 0.1.18 → 0.1.19

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.
@@ -14350,7 +14350,8 @@ const DEVICE = {
14350
14350
  PIN: 'pin',
14351
14351
  PASSPHRASE: 'passphrase',
14352
14352
  PASSPHRASE_ON_DEVICE: 'passphrase_on_device',
14353
- WORD: 'word'
14353
+ WORD: 'word',
14354
+ FEATURES: 'features'
14354
14355
  };
14355
14356
 
14356
14357
  const createDeviceMessage = (type, payload) => ({
@@ -14868,6 +14869,7 @@ class Device extends events.exports {
14868
14869
  feat.unlocked = feat.unlocked || true;
14869
14870
  this.features = feat;
14870
14871
  this.featuresNeedsReload = false;
14872
+ this.emit(DEVICE.FEATURES, this, feat);
14871
14873
  }
14872
14874
 
14873
14875
  updateDescriptor(descriptor, forceUpdate = false) {
@@ -19157,6 +19159,7 @@ const callAPI = message => __awaiter(void 0, void 0, void 0, function* () {
19157
19159
  device.on(DEVICE.BUTTON, (d, code) => {
19158
19160
  onDeviceButtonHandler(d, code);
19159
19161
  });
19162
+ device.on(DEVICE.FEATURES, onDeviceFeaturesHandler);
19160
19163
 
19161
19164
  try {
19162
19165
  const inner = () => __awaiter(void 0, void 0, void 0, function* () {
@@ -19337,7 +19340,7 @@ const ensureConnected = (method, pollingId) => __awaiter(void 0, void 0, void 0,
19337
19340
  return new Promise((resolve, reject) => __awaiter(void 0, void 0, void 0, function* () {
19338
19341
  if (!pollingState[pollingId]) {
19339
19342
  Log.debug('EnsureConnected function stop, polling id: ', pollingId);
19340
- reject(hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.RuntimeError, 'Polling stop'));
19343
+ reject(hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.PollingStop));
19341
19344
  return;
19342
19345
  }
19343
19346
 
@@ -19346,7 +19349,7 @@ const ensureConnected = (method, pollingId) => __awaiter(void 0, void 0, void 0,
19346
19349
  }
19347
19350
 
19348
19351
  timer = setTimeout(() => {
19349
- reject(hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.RuntimeError, 'Polling timeout'));
19352
+ reject(hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.PollingTimeout));
19350
19353
  }, TIME_OUT);
19351
19354
  tryCount += 1;
19352
19355
  Log.debug('EnsureConnected function try count: ', tryCount, ' poll interval time: ', time);
@@ -19480,6 +19483,10 @@ const onDeviceButtonHandler = (...[device, request]) => {
19480
19483
  }
19481
19484
  };
19482
19485
 
19486
+ const onDeviceFeaturesHandler = (...[_, features]) => {
19487
+ postMessage(createDeviceMessage(DEVICE.FEATURES, Object.assign({}, features)));
19488
+ };
19489
+
19483
19490
  const postMessage = message => {
19484
19491
  _core.emit(CORE_EVENT, message);
19485
19492
  };
@@ -19604,8 +19611,8 @@ __webpack_unused_export__ = ({
19604
19611
  __webpack_unused_export__ = CORE_EVENT;
19605
19612
  __webpack_unused_export__ = Core;
19606
19613
  __webpack_unused_export__ = DEFAULT_PRIORITY;
19607
- __webpack_unused_export__ = DEVICE;
19608
- __webpack_unused_export__ = DEVICE_EVENT;
19614
+ exports.Td = DEVICE;
19615
+ exports.Fd = DEVICE_EVENT;
19609
19616
  __webpack_unused_export__ = DataManager;
19610
19617
  __webpack_unused_export__ = FIRMWARE;
19611
19618
  exports.SI = FIRMWARE_EVENT;
@@ -20835,7 +20842,9 @@ const HardwareErrorCode = {
20835
20842
  ResponseUnexpectTypeError: 805,
20836
20843
  BridgeNetworkError: 806,
20837
20844
  BridgeTimeoutError: 807,
20838
- BridgeNotInstalled: 808
20845
+ BridgeNotInstalled: 808,
20846
+ PollingTimeout: 809,
20847
+ PollingStop: 810
20839
20848
  };
20840
20849
  const HardwareErrorCodeMessage = {
20841
20850
  [HardwareErrorCode.UnknownError]: 'Unknown error occurred. Check message property.',
@@ -20882,7 +20891,9 @@ const HardwareErrorCodeMessage = {
20882
20891
  [HardwareErrorCode.ResponseUnexpectTypeError]: 'Response type is not expected',
20883
20892
  [HardwareErrorCode.BridgeNetworkError]: 'Bridge network error',
20884
20893
  [HardwareErrorCode.BridgeTimeoutError]: 'Bridge network timeout',
20885
- [HardwareErrorCode.BridgeNotInstalled]: 'Bridge not installed'
20894
+ [HardwareErrorCode.BridgeNotInstalled]: 'Bridge not installed',
20895
+ [HardwareErrorCode.PollingTimeout]: 'Polling timeout',
20896
+ [HardwareErrorCode.PollingStop]: 'Polling stop'
20886
20897
  };
20887
20898
 
20888
20899
  const TypedError = (hardwareError, message) => {
@@ -46018,6 +46029,13 @@ const handleMessage = async message => {
46018
46029
  eventEmitter.emit(message.event, message);
46019
46030
  break;
46020
46031
 
46032
+ case dist/* DEVICE_EVENT */.Fd:
46033
+ if (message.type === dist/* DEVICE.FEATURES */.Td.FEATURES) {
46034
+ eventEmitter.emit(message.type, message.payload);
46035
+ }
46036
+
46037
+ break;
46038
+
46021
46039
  default:
46022
46040
  src_Log.log('No need to be captured message', message.event);
46023
46041
  }
@@ -46106,7 +46124,7 @@ const src_init = async settings => {
46106
46124
 
46107
46125
  try {
46108
46126
  await init({ ..._settings,
46109
- version: "0.1.18"
46127
+ version: "0.1.19"
46110
46128
  });
46111
46129
  return true;
46112
46130
  } catch (e) {