@onekeyfe/hd-core 0.1.31 → 0.1.32
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
|
|
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,
|
|
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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AE,MAAM,EAAE,CAAM;IAE7B,gBAAgB,UAAS;IAKzB,WAAW,UAAS;gBAER,UAAU,EAAE,gBAAgB;IAKxC,MAAM,CAAC,cAAc,CAAC,kBAAkB,EAAE,gBAAgB;IAM1D,eAAe,IAAI,WAAW,GAAG,IAAI;IAiCrC,OAAO;IA+BD,OAAO;IA+BP,OAAO;IA2Bb,WAAW;IAIX,gBAAgB;IAIV,UAAU;IAoBV,WAAW;IAKjB,eAAe,CAAC,IAAI,EAAE,QAAQ;IAiB9B,gBAAgB,CAAC,UAAU,EAAE,gBAAgB,EAAE,WAAW,UAAQ;IAiBlE,eAAe,CAAC,MAAM,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
|
@@ -10740,6 +10740,7 @@ class Device extends events.exports {
|
|
|
10740
10740
|
this._updateFeatures(message);
|
|
10741
10741
|
if (message.passphrase_protection) {
|
|
10742
10742
|
if (this.listenerCount(DEVICE.PIN) > 0) {
|
|
10743
|
+
Log$3.debug('try to close passpharse');
|
|
10743
10744
|
yield this.commands.typedCall('ApplySettings', 'Success', { use_passphrase: false });
|
|
10744
10745
|
}
|
|
10745
10746
|
}
|
|
@@ -10794,6 +10795,7 @@ class Device extends events.exports {
|
|
|
10794
10795
|
});
|
|
10795
10796
|
}
|
|
10796
10797
|
_runInner(fn, options) {
|
|
10798
|
+
var _a;
|
|
10797
10799
|
return __awaiter(this, void 0, void 0, function* () {
|
|
10798
10800
|
if (!this.isUsedHere() || this.commands.disposed) {
|
|
10799
10801
|
const env = DataManager.getSettings('env');
|
|
@@ -10812,12 +10814,35 @@ class Device extends events.exports {
|
|
|
10812
10814
|
return Promise.reject(hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.DeviceInitializeFailed, `Initialize failed: ${error.message}, code: ${error.code}`));
|
|
10813
10815
|
}
|
|
10814
10816
|
}
|
|
10817
|
+
else if (env === 'react-native') {
|
|
10818
|
+
if ((_a = this.features) === null || _a === void 0 ? void 0 : _a.passphrase_protection) {
|
|
10819
|
+
if (this.listenerCount(DEVICE.PIN) > 0) {
|
|
10820
|
+
Log$3.debug('try to close passpharse for mobile');
|
|
10821
|
+
try {
|
|
10822
|
+
yield this.commands.typedCall('ApplySettings', 'Success', { use_passphrase: false });
|
|
10823
|
+
}
|
|
10824
|
+
catch (e) {
|
|
10825
|
+
this.runPromise = null;
|
|
10826
|
+
return Promise.reject(e);
|
|
10827
|
+
}
|
|
10828
|
+
}
|
|
10829
|
+
}
|
|
10830
|
+
}
|
|
10815
10831
|
}
|
|
10816
10832
|
if (options.keepSession) {
|
|
10817
10833
|
this.keepSession = true;
|
|
10818
10834
|
}
|
|
10819
10835
|
if (fn) {
|
|
10820
|
-
|
|
10836
|
+
try {
|
|
10837
|
+
yield fn();
|
|
10838
|
+
}
|
|
10839
|
+
catch (e) {
|
|
10840
|
+
if (this.runPromise) {
|
|
10841
|
+
this.runPromise.reject(e);
|
|
10842
|
+
}
|
|
10843
|
+
this.runPromise = null;
|
|
10844
|
+
return;
|
|
10845
|
+
}
|
|
10821
10846
|
}
|
|
10822
10847
|
if ((!this.keepSession && typeof options.keepSession !== 'boolean') ||
|
|
10823
10848
|
options.keepSession === false) {
|
|
@@ -12457,7 +12482,7 @@ class EVMSignTransaction extends BaseMethod {
|
|
|
12457
12482
|
})),
|
|
12458
12483
|
};
|
|
12459
12484
|
const response = yield this.device.commands.typedCall('EthereumSignTxEIP1559', 'EthereumTxRequest', message);
|
|
12460
|
-
return this.processTxRequest(response.message, rest);
|
|
12485
|
+
return this.processTxRequest(response.message, rest, chainId);
|
|
12461
12486
|
});
|
|
12462
12487
|
}
|
|
12463
12488
|
init() {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onekeyfe/hd-core",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.32",
|
|
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.
|
|
29
|
-
"@onekeyfe/hd-transport": "^0.1.
|
|
28
|
+
"@onekeyfe/hd-shared": "^0.1.32",
|
|
29
|
+
"@onekeyfe/hd-transport": "^0.1.32",
|
|
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": "
|
|
40
|
+
"gitHead": "a9f9851579a20668178fdc06b594deed220cbe43"
|
|
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
|
|
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() {
|
package/src/device/Device.ts
CHANGED
|
@@ -257,6 +257,7 @@ export class Device extends EventEmitter {
|
|
|
257
257
|
this._updateFeatures(message);
|
|
258
258
|
if (message.passphrase_protection) {
|
|
259
259
|
if (this.listenerCount(DEVICE.PIN) > 0) {
|
|
260
|
+
Log.debug('try to close passpharse');
|
|
260
261
|
await this.commands.typedCall('ApplySettings', 'Success', { use_passphrase: false });
|
|
261
262
|
}
|
|
262
263
|
}
|
|
@@ -343,6 +344,21 @@ export class Device extends EventEmitter {
|
|
|
343
344
|
)
|
|
344
345
|
);
|
|
345
346
|
}
|
|
347
|
+
} else if (env === 'react-native') {
|
|
348
|
+
/**
|
|
349
|
+
* The timing of the mobile initialization is different, so it needs to be closed here
|
|
350
|
+
*/
|
|
351
|
+
if (this.features?.passphrase_protection) {
|
|
352
|
+
if (this.listenerCount(DEVICE.PIN) > 0) {
|
|
353
|
+
Log.debug('try to close passpharse for mobile');
|
|
354
|
+
try {
|
|
355
|
+
await this.commands.typedCall('ApplySettings', 'Success', { use_passphrase: false });
|
|
356
|
+
} catch (e) {
|
|
357
|
+
this.runPromise = null;
|
|
358
|
+
return Promise.reject(e);
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
}
|
|
346
362
|
}
|
|
347
363
|
}
|
|
348
364
|
|
|
@@ -351,7 +367,16 @@ export class Device extends EventEmitter {
|
|
|
351
367
|
}
|
|
352
368
|
|
|
353
369
|
if (fn) {
|
|
354
|
-
|
|
370
|
+
try {
|
|
371
|
+
await fn();
|
|
372
|
+
} catch (e) {
|
|
373
|
+
if (this.runPromise) {
|
|
374
|
+
this.runPromise.reject(e);
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
this.runPromise = null;
|
|
378
|
+
return;
|
|
379
|
+
}
|
|
355
380
|
}
|
|
356
381
|
|
|
357
382
|
if (
|