@onekeyfe/hd-core 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.
@@ -6,7 +6,7 @@ export default class EVMSignTransaction extends BaseMethod {
6
6
  isEIP1559: boolean;
7
7
  formattedTx: EVMTransaction | EVMTransactionEIP1559 | undefined;
8
8
  init(): void;
9
- processTxRequest: (request: EthereumTxRequest, data: string, chain_id?: number | undefined) => Promise<EVMSignedTx>;
9
+ processTxRequest: (request: EthereumTxRequest, data: string, chain_id: number | undefined) => Promise<EVMSignedTx>;
10
10
  evmSignTx: (addressN: number[], tx: EVMTransaction) => Promise<EVMSignedTx>;
11
11
  evmSignTxEip1559: (addressN: number[], tx: EVMTransactionEIP1559) => Promise<EVMSignedTx>;
12
12
  getVersionRange(): {
@@ -1 +1 @@
1
- {"version":3,"file":"EVMSignTransaction.d.ts","sourceRoot":"","sources":["../../../src/api/evm/EVMSignTransaction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAyC,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAKlG,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,OAAO,EACL,WAAW,EAEX,cAAc,EACd,qBAAqB,EACtB,MAAM,oCAAoC,CAAC;AAI5C,MAAM,CAAC,OAAO,OAAO,kBAAmB,SAAQ,UAAU;IACxD,QAAQ,EAAE,MAAM,EAAE,CAAM;IAExB,SAAS,UAAS;IAElB,WAAW,EAAE,cAAc,GAAG,qBAAqB,GAAG,SAAS,CAAC;IAEhE,IAAI;IAoCJ,gBAAgB,YACL,iBAAiB,QACpB,MAAM,aACD,MAAM,GAAG,SAAS,KAC5B,QAAQ,WAAW,CAAC,CA+BrB;IAEF,SAAS,aAAoB,MAAM,EAAE,MAAM,cAAc,0BAuCvD;IAEF,gBAAgB,aAAoB,MAAM,EAAE,MAAM,qBAAqB,0BAyCrE;IAEF,eAAe;;;;;IAeT,GAAG;CASV"}
1
+ {"version":3,"file":"EVMSignTransaction.d.ts","sourceRoot":"","sources":["../../../src/api/evm/EVMSignTransaction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAyC,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAKlG,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,OAAO,EACL,WAAW,EAEX,cAAc,EACd,qBAAqB,EACtB,MAAM,oCAAoC,CAAC;AAI5C,MAAM,CAAC,OAAO,OAAO,kBAAmB,SAAQ,UAAU;IACxD,QAAQ,EAAE,MAAM,EAAE,CAAM;IAExB,SAAS,UAAS;IAElB,WAAW,EAAE,cAAc,GAAG,qBAAqB,GAAG,SAAS,CAAC;IAEhE,IAAI;IAoCJ,gBAAgB,YACL,iBAAiB,QACpB,MAAM,YACF,MAAM,GAAG,SAAS,KAC3B,QAAQ,WAAW,CAAC,CA+BrB;IAEF,SAAS,aAAoB,MAAM,EAAE,MAAM,cAAc,0BAuCvD;IAEF,gBAAgB,aAAoB,MAAM,EAAE,MAAM,qBAAqB,0BAyCrE;IAEF,eAAe;;;;;IAeT,GAAG;CASV"}
@@ -1 +1 @@
1
- {"version":3,"file":"Device.d.ts","sourceRoot":"","sources":["../../src/device/Device.ts"],"names":[],"mappings":";AAAA,OAAO,YAAY,MAAM,QAAQ,CAAC;AAClC,OAAO,EAAE,gBAAgB,IAAI,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC9E,OAAO,EAEL,QAAQ,EAIT,MAAM,qBAAqB,CAAC;AAE7B,OAAO,KAAK,eAAe,MAAM,mBAAmB,CAAC;AAErD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAUlD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,IAAI,WAAW,EAAE,uBAAuB,EAAE,MAAM,UAAU,CAAC;AACzF,OAAO,EAAE,MAAM,EAAE,0BAA0B,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;AAEtF,OAAO,EAAE,KAAK,EAAE,M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M,EAAE,MAAM;IASxB,GAAG,CAAC,EAAE,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC,EAAE,UAAU;IAYlD,SAAS,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,MAAM,OAAO,CAAC,CAAC,CAAC,CAAC,GAAG,SAAS,EAAE,OAAO,EAAE,UAAU;IAwEpE,uBAAuB;IASvB,oBAAoB;IAS1B,OAAO;IAOP,kBAAkB;IAKlB,qBAAqB;IAKrB,MAAM;IAIN,UAAU;IAQV,eAAe,IAAI,OAAO;IAI1B,YAAY;IAIZ,aAAa;IAIb,UAAU;IAIV,YAAY,IAAI,OAAO;IAIvB,iBAAiB,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE;IAsBpD,aAAa,CAAC,QAAQ,EAAE,MAAM;CAM/B;AAED,eAAe,MAAM,CAAC"}
package/dist/index.js CHANGED
@@ -10428,9 +10428,6 @@ class DeviceCommands {
10428
10428
  if (res.type === 'Features') {
10429
10429
  return Promise.resolve(patchFeatures(res));
10430
10430
  }
10431
- if ((_a = this.device.features) === null || _a === void 0 ? void 0 : _a.passphrase_protection) {
10432
- return Promise.reject(hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.DeviceNotSupportPassphrase));
10433
- }
10434
10431
  if (res.type === 'ButtonRequest') {
10435
10432
  if (res.message.code === 'ButtonRequest_PassphraseEntry') {
10436
10433
  this.device.emit(DEVICE.PASSPHRASE_ON_DEVICE, this.device);
@@ -10453,6 +10450,9 @@ class DeviceCommands {
10453
10450
  return this._commonCall('PinMatrixAck', { pin });
10454
10451
  }, () => this._commonCall('Cancel', {}));
10455
10452
  }
10453
+ if ((_a = this.device.features) === null || _a === void 0 ? void 0 : _a.passphrase_protection) {
10454
+ return Promise.reject(hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.DeviceNotSupportPassphrase));
10455
+ }
10456
10456
  if (res.type === 'PassphraseRequest') {
10457
10457
  return Promise.reject(hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.DeviceNotSupportPassphrase));
10458
10458
  }
@@ -10738,6 +10738,19 @@ class Device extends events.exports {
10738
10738
  }
10739
10739
  const { message } = yield this.commands.typedCall('Initialize', 'Features', payload);
10740
10740
  this._updateFeatures(message);
10741
+ if (message.passphrase_protection) {
10742
+ if (this.listenerCount(DEVICE.PIN) > 0) {
10743
+ Log$3.debug('try to close passpharse');
10744
+ try {
10745
+ yield this.commands.typedCall('ApplySettings', 'Success', { use_passphrase: false });
10746
+ }
10747
+ catch (e) {
10748
+ yield this.release();
10749
+ this.runPromise = null;
10750
+ throw e;
10751
+ }
10752
+ }
10753
+ }
10741
10754
  });
10742
10755
  }
10743
10756
  getFeatures() {
@@ -10789,6 +10802,7 @@ class Device extends events.exports {
10789
10802
  });
10790
10803
  }
10791
10804
  _runInner(fn, options) {
10805
+ var _a;
10792
10806
  return __awaiter(this, void 0, void 0, function* () {
10793
10807
  if (!this.isUsedHere() || this.commands.disposed) {
10794
10808
  const env = DataManager.getSettings('env');
@@ -10807,12 +10821,35 @@ class Device extends events.exports {
10807
10821
  return Promise.reject(hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.DeviceInitializeFailed, `Initialize failed: ${error.message}, code: ${error.code}`));
10808
10822
  }
10809
10823
  }
10824
+ else if (env === 'react-native') {
10825
+ if ((_a = this.features) === null || _a === void 0 ? void 0 : _a.passphrase_protection) {
10826
+ if (this.listenerCount(DEVICE.PIN) > 0) {
10827
+ Log$3.debug('try to close passpharse for mobile');
10828
+ try {
10829
+ yield this.commands.typedCall('ApplySettings', 'Success', { use_passphrase: false });
10830
+ }
10831
+ catch (e) {
10832
+ this.runPromise = null;
10833
+ return Promise.reject(e);
10834
+ }
10835
+ }
10836
+ }
10837
+ }
10810
10838
  }
10811
10839
  if (options.keepSession) {
10812
10840
  this.keepSession = true;
10813
10841
  }
10814
10842
  if (fn) {
10815
- yield fn();
10843
+ try {
10844
+ yield fn();
10845
+ }
10846
+ catch (e) {
10847
+ if (this.runPromise) {
10848
+ this.runPromise.reject(e);
10849
+ }
10850
+ this.runPromise = null;
10851
+ return;
10852
+ }
10816
10853
  }
10817
10854
  if ((!this.keepSession && typeof options.keepSession !== 'boolean') ||
10818
10855
  options.keepSession === false) {
@@ -12452,7 +12489,7 @@ class EVMSignTransaction extends BaseMethod {
12452
12489
  })),
12453
12490
  };
12454
12491
  const response = yield this.device.commands.typedCall('EthereumSignTxEIP1559', 'EthereumTxRequest', message);
12455
- return this.processTxRequest(response.message, rest);
12492
+ return this.processTxRequest(response.message, rest, chainId);
12456
12493
  });
12457
12494
  }
12458
12495
  init() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onekeyfe/hd-core",
3
- "version": "0.1.30",
3
+ "version": "0.1.33",
4
4
  "description": "> TODO: description",
5
5
  "author": "OneKey",
6
6
  "homepage": "https://github.com/OneKeyHQ/hardware-js-sdk#readme",
@@ -25,8 +25,8 @@
25
25
  "url": "https://github.com/OneKeyHQ/hardware-js-sdk/issues"
26
26
  },
27
27
  "dependencies": {
28
- "@onekeyfe/hd-shared": "^0.1.30",
29
- "@onekeyfe/hd-transport": "^0.1.30",
28
+ "@onekeyfe/hd-shared": "^0.1.33",
29
+ "@onekeyfe/hd-transport": "^0.1.33",
30
30
  "axios": "^0.27.2",
31
31
  "bignumber.js": "^9.0.2",
32
32
  "js-sha256": "^0.9.0",
@@ -37,5 +37,5 @@
37
37
  "@types/parse-uri": "^1.0.0",
38
38
  "@types/semver": "^7.3.9"
39
39
  },
40
- "gitHead": "4a3f78fd3b62456303cabe1ea315bc7fe5bd1ccd"
40
+ "gitHead": "243a982fe1520e397f980892e3071fd53912339e"
41
41
  }
@@ -60,7 +60,7 @@ export default class EVMSignTransaction extends BaseMethod {
60
60
  processTxRequest = async (
61
61
  request: EthereumTxRequest,
62
62
  data: string,
63
- chain_id?: number | undefined
63
+ chain_id: number | undefined
64
64
  ): Promise<EVMSignedTx> => {
65
65
  if (!request.data_length) {
66
66
  let v = request.signature_v;
@@ -175,7 +175,7 @@ export default class EVMSignTransaction extends BaseMethod {
175
175
  message
176
176
  );
177
177
 
178
- return this.processTxRequest(response.message, rest);
178
+ return this.processTxRequest(response.message, rest, chainId);
179
179
  };
180
180
 
181
181
  getVersionRange() {
@@ -255,6 +255,18 @@ export class Device extends EventEmitter {
255
255
 
256
256
  const { message } = await this.commands.typedCall('Initialize', 'Features', payload);
257
257
  this._updateFeatures(message);
258
+ if (message.passphrase_protection) {
259
+ if (this.listenerCount(DEVICE.PIN) > 0) {
260
+ Log.debug('try to close passpharse');
261
+ try {
262
+ await this.commands.typedCall('ApplySettings', 'Success', { use_passphrase: false });
263
+ } catch (e) {
264
+ await this.release();
265
+ this.runPromise = null;
266
+ throw e;
267
+ }
268
+ }
269
+ }
258
270
  }
259
271
 
260
272
  async getFeatures() {
@@ -338,6 +350,21 @@ export class Device extends EventEmitter {
338
350
  )
339
351
  );
340
352
  }
353
+ } else if (env === 'react-native') {
354
+ /**
355
+ * The timing of the mobile initialization is different, so it needs to be closed here
356
+ */
357
+ if (this.features?.passphrase_protection) {
358
+ if (this.listenerCount(DEVICE.PIN) > 0) {
359
+ Log.debug('try to close passpharse for mobile');
360
+ try {
361
+ await this.commands.typedCall('ApplySettings', 'Success', { use_passphrase: false });
362
+ } catch (e) {
363
+ this.runPromise = null;
364
+ return Promise.reject(e);
365
+ }
366
+ }
367
+ }
341
368
  }
342
369
  }
343
370
 
@@ -346,7 +373,16 @@ export class Device extends EventEmitter {
346
373
  }
347
374
 
348
375
  if (fn) {
349
- await fn();
376
+ try {
377
+ await fn();
378
+ } catch (e) {
379
+ if (this.runPromise) {
380
+ this.runPromise.reject(e);
381
+ }
382
+
383
+ this.runPromise = null;
384
+ return;
385
+ }
350
386
  }
351
387
 
352
388
  if (
@@ -181,13 +181,6 @@ export class DeviceCommands {
181
181
  return Promise.resolve(patchFeatures(res));
182
182
  }
183
183
 
184
- /**
185
- * Temporary, do not support passphrase
186
- */
187
- if (this.device.features?.passphrase_protection) {
188
- return Promise.reject(ERRORS.TypedError(HardwareErrorCode.DeviceNotSupportPassphrase));
189
- }
190
-
191
184
  if (res.type === 'ButtonRequest') {
192
185
  if (res.message.code === 'ButtonRequest_PassphraseEntry') {
193
186
  this.device.emit(DEVICE.PASSPHRASE_ON_DEVICE, this.device);
@@ -221,6 +214,13 @@ export class DeviceCommands {
221
214
  );
222
215
  }
223
216
 
217
+ /**
218
+ * Temporary, do not support passphrase
219
+ */
220
+ if (this.device.features?.passphrase_protection) {
221
+ return Promise.reject(ERRORS.TypedError(HardwareErrorCode.DeviceNotSupportPassphrase));
222
+ }
223
+
224
224
  if (res.type === 'PassphraseRequest') {
225
225
  /**
226
226
  * Temporary, do not support passphrase