@onekeyfe/hd-core 0.3.13 → 0.3.14
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DeviceCommands.d.ts","sourceRoot":"","sources":["../../src/device/DeviceCommands.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAe,MAAM,wBAAwB,CAAC;AAK/E,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAGvC,aAAK,WAAW,GAAG,QAAQ,CAAC,WAAW,CAAC;AACxC,aAAK,UAAU,GAAG,MAAM,WAAW,CAAC;AACpC,oBAAY,oBAAoB,CAAC,CAAC,SAAS,UAAU,IAAI;IACvD,IAAI,EAAE,CAAC,CAAC;IACR,OAAO,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC;CACzB,CAAC;AACF,aAAK,oBAAoB,GAAG;KACzB,CAAC,IAAI,MAAM,WAAW,GAAG,oBAAoB,CAAC,CAAC,CAAC;CAClD,CAAC;AACF,oBAAY,sBAAsB,GAAG,oBAAoB,CAAC,MAAM,WAAW,CAAC,CAAC;AAE7E,oBAAY,wBAAwB,GAAG;IACrC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB,CAAC;AAcF,qBAAa,cAAc;IACzB,MAAM,EAAE,MAAM,CAAC;IAEf,SAAS,EAAE,SAAS,CAAC;IAErB,MAAM,EAAE,MAAM,CAAC;IAEf,QAAQ,EAAE,OAAO,CAAC;IAElB,WAAW,CAAC,EAAE,OAAO,CAAC,sBAAsB,CAAC,CAAC;IAE9C,kBAAkB,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE,GAAG,KAAK,IAAI,CAAC;gBAE/B,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;IAOpC,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AAC,IAAI,CAAC,EAAE,QAAQ,CAAC,oBAAoB;IAwB/C,iBAAiB;CA2BlB;AAED,oBAAY,SAAS,GAAG,cAAc,CAAC,WAAW,CAAC,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -918,12 +918,15 @@ const supportNewPassphrase = (features) => {
|
|
|
918
918
|
const getPassphraseState = (features, commands) => __awaiter(void 0, void 0, void 0, function* () {
|
|
919
919
|
if (!features)
|
|
920
920
|
return false;
|
|
921
|
-
const { message } = yield commands.typedCall('GetAddress', 'Address', {
|
|
921
|
+
const { message, type } = yield commands.typedCall('GetAddress', 'Address', {
|
|
922
922
|
address_n: [toHardened(44), toHardened(1), toHardened(0), 0, 0],
|
|
923
923
|
coin_name: 'Testnet',
|
|
924
924
|
script_type: 'SPENDADDRESS',
|
|
925
925
|
show_display: false,
|
|
926
926
|
});
|
|
927
|
+
if (type === 'CallMethodError') {
|
|
928
|
+
throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.RuntimeError, 'Get the passphrase state error');
|
|
929
|
+
}
|
|
927
930
|
return message.address;
|
|
928
931
|
});
|
|
929
932
|
const supportBatchPublicKey = (features) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deviceFeaturesUtils.d.ts","sourceRoot":"","sources":["../../src/utils/deviceFeaturesUtils.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"deviceFeaturesUtils.d.ts","sourceRoot":"","sources":["../../src/utils/deviceFeaturesUtils.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,KAAK,EACV,QAAQ,EACR,aAAa,EACb,WAAW,EACX,YAAY,EACZ,kBAAkB,EACnB,MAAM,UAAU,CAAC;AAElB,eAAO,MAAM,cAAc,4EAA0B,YAcpD,CAAC;AAEF,eAAO,MAAM,aAAa,4EAA0B,WAUnD,CAAC;AAEF,eAAO,MAAM,yBAAyB,4EAA0B,WACvC,CAAC;AAE1B,eAAO,MAAM,sBAAsB,iCAAoB,WAAW,GAAG,IAKpE,CAAC;AAEF,eAAO,MAAM,uBAAuB,qCAAwB,WAQ3D,CAAC;AAEF,eAAO,MAAM,aAAa,aAAc,QAAQ,WAM/C,CAAC;AAEF,eAAO,MAAM,cAAc,aAAc,QAAQ,WAOhD,CAAC;AAKF,eAAO,MAAM,wBAAwB,aAAc,QAAQ,GAAG,SAAS,kBAOtE,CAAC;AAKF,eAAO,MAAM,2BAA2B,aAAc,QAAQ,KAAG,aAAa,GAAG,IAQhF,CAAC;AAEF,eAAO,MAAM,0BAA0B,aAAc,QAAQ,kBAW5D,CAAC;AAEF,eAAO,MAAM,yBAAyB,aAAc,QAAQ,KAAG,kBAU9D,CAAC;AAEF,eAAO,MAAM,oBAAoB,4EAA0B,kBAW1D,CAAC;AAEF,eAAO,MAAM,kBAAkB,aAAoB,QAAQ,YAAY,cAAc,4BAepF,CAAC;AAEF,eAAO,MAAM,qBAAqB,4EAA0B,OAU3D,CAAC;AAEF,eAAO,MAAM,uBAAuB,4EAA0B,kBAU7D,CAAC;AAKF,eAAO,MAAM,sBAAsB,aAAc,QAAQ,cAAc,UAAU,GAAG,KAAK,uDAgBxF,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onekeyfe/hd-core",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.14",
|
|
4
4
|
"description": "> TODO: description",
|
|
5
5
|
"author": "OneKey",
|
|
6
6
|
"homepage": "https://github.com/OneKeyHQ/hardware-js-sdk#readme",
|
|
@@ -24,8 +24,8 @@
|
|
|
24
24
|
"url": "https://github.com/OneKeyHQ/hardware-js-sdk/issues"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@onekeyfe/hd-shared": "^0.3.
|
|
28
|
-
"@onekeyfe/hd-transport": "^0.3.
|
|
27
|
+
"@onekeyfe/hd-shared": "^0.3.14",
|
|
28
|
+
"@onekeyfe/hd-transport": "^0.3.14",
|
|
29
29
|
"axios": "^0.27.2",
|
|
30
30
|
"bignumber.js": "^9.0.2",
|
|
31
31
|
"bytebuffer": "^5.0.1",
|
|
@@ -43,5 +43,5 @@
|
|
|
43
43
|
"@types/semver": "^7.3.9",
|
|
44
44
|
"ripple-keypairs": "^1.1.4"
|
|
45
45
|
},
|
|
46
|
-
"gitHead": "
|
|
46
|
+
"gitHead": "8dc9f9fa05462f4621a1bbb184b38eda1fb6bdc4"
|
|
47
47
|
}
|
|
@@ -142,6 +142,10 @@ export class DeviceCommands {
|
|
|
142
142
|
// throw bridge network error
|
|
143
143
|
if (error instanceof HardwareError) {
|
|
144
144
|
if (error.errorCode === HardwareErrorCode.ResponseUnexpectTypeError) {
|
|
145
|
+
// Do not intercept CallMethodError
|
|
146
|
+
// Do not intercept “assertType: Response of unexpected type” error
|
|
147
|
+
// Blocking the above two messages will not know what the specific error message is, and the specific error should be handled by the subsequent business logic.
|
|
148
|
+
|
|
145
149
|
if (error.message.indexOf('BridgeNetworkError') > -1) {
|
|
146
150
|
throw ERRORS.TypedError(HardwareErrorCode.BridgeNetworkError);
|
|
147
151
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import semver from 'semver';
|
|
2
|
+
import { ERRORS, HardwareErrorCode } from '@onekeyfe/hd-shared';
|
|
2
3
|
import { toHardened } from '../api/helpers/pathUtils';
|
|
3
4
|
import { DeviceCommands } from '../device/DeviceCommands';
|
|
4
5
|
import type {
|
|
@@ -139,13 +140,18 @@ export const supportNewPassphrase = (features?: Features): SupportFeatureType =>
|
|
|
139
140
|
|
|
140
141
|
export const getPassphraseState = async (features: Features, commands: DeviceCommands) => {
|
|
141
142
|
if (!features) return false;
|
|
142
|
-
const { message } = await commands.typedCall('GetAddress', 'Address', {
|
|
143
|
+
const { message, type } = await commands.typedCall('GetAddress', 'Address', {
|
|
143
144
|
address_n: [toHardened(44), toHardened(1), toHardened(0), 0, 0],
|
|
144
145
|
coin_name: 'Testnet',
|
|
145
146
|
script_type: 'SPENDADDRESS',
|
|
146
147
|
show_display: false,
|
|
147
148
|
});
|
|
148
149
|
|
|
150
|
+
// @ts-expect-error
|
|
151
|
+
if (type === 'CallMethodError') {
|
|
152
|
+
throw ERRORS.TypedError(HardwareErrorCode.RuntimeError, 'Get the passphrase state error');
|
|
153
|
+
}
|
|
154
|
+
|
|
149
155
|
return message.address;
|
|
150
156
|
};
|
|
151
157
|
|