@onekeyfe/hd-core 0.2.54 → 0.2.55
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.
- package/dist/api/firmware/uploadFirmware.d.ts.map +1 -1
- package/dist/index.js +11 -5
- package/package.json +4 -4
- package/src/api/CheckBootloaderRelease.ts +1 -1
- package/src/api/firmware/updateBootloader.ts +1 -1
- package/src/api/firmware/uploadFirmware.ts +8 -2
- package/src/utils/deviceFeaturesUtils.ts +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"uploadFirmware.d.ts","sourceRoot":"","sources":["../../../src/api/firmware/uploadFirmware.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAEjD,OAAO,EAAU,WAAW,EAA+B,MAAM,cAAc,CAAC;AAChF,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AACxC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,KAAK,EAAE,SAAS,EAAwB,MAAM,6BAA6B,CAAC;AAwCnF,eAAO,MAAM,cAAc,eAAsB,MAAM,kBAKtD,CAAC;AAEF,eAAO,MAAM,cAAc,eACb,UAAU,GAAG,KAAK,aACnB,SAAS,yBACG,WAAW,KAAK,IAAI,UACnC,MAAM,eACD,MAAM,cAAc,
|
|
1
|
+
{"version":3,"file":"uploadFirmware.d.ts","sourceRoot":"","sources":["../../../src/api/firmware/uploadFirmware.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAEjD,OAAO,EAAU,WAAW,EAA+B,MAAM,cAAc,CAAC;AAChF,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AACxC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,KAAK,EAAE,SAAS,EAAwB,MAAM,6BAA6B,CAAC;AAwCnF,eAAO,MAAM,cAAc,eAAsB,MAAM,kBAKtD,CAAC;AAEF,eAAO,MAAM,cAAc,eACb,UAAU,GAAG,KAAK,aACnB,SAAS,yBACG,WAAW,KAAK,IAAI,UACnC,MAAM,eACD,MAAM,cAAc,qBA2DlC,CAAC;AAmCF,eAAO,MAAM,cAAc,cAAqB,SAAS,YAAY,MAAM,QAAQ,WAAW,qBAY7F,CAAC;AAEF,eAAO,MAAM,eAAe,cACf,SAAS,yBACG,WAAW,KAAK,IAAI,UACnC,MAAM,UACN,WAAW,qBAwBpB,CAAC;AAEF,eAAO,MAAM,gBAAgB,cAChB,SAAS,yBACG,WAAW,KAAK,IAAI,UACnC,MAAM,UACN,WAAW,qBAQpB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -917,7 +917,7 @@ const getFirmwareUpdateField = (features, updateType) => {
|
|
|
917
917
|
if (updateType === 'ble') {
|
|
918
918
|
return 'ble';
|
|
919
919
|
}
|
|
920
|
-
if (deviceType === 'classic'
|
|
920
|
+
if (deviceType === 'classic') {
|
|
921
921
|
return 'firmware-v2';
|
|
922
922
|
}
|
|
923
923
|
if (deviceType === 'touch') {
|
|
@@ -10997,7 +10997,7 @@ function checkNeedUpdateBootForTouch(features) {
|
|
|
10997
10997
|
}
|
|
10998
10998
|
function checkNeedUpdateBootForClassicAndMini(features, willUpdateFirmware) {
|
|
10999
10999
|
const deviceType = getDeviceType(features);
|
|
11000
|
-
if (
|
|
11000
|
+
if (deviceType !== 'classic')
|
|
11001
11001
|
return false;
|
|
11002
11002
|
if (!willUpdateFirmware)
|
|
11003
11003
|
return false;
|
|
@@ -12985,7 +12985,7 @@ class CheckBootloaderRelease extends BaseMethod {
|
|
|
12985
12985
|
const { features } = this.device;
|
|
12986
12986
|
const deviceType = getDeviceType(features);
|
|
12987
12987
|
let shouldUpdate = false;
|
|
12988
|
-
if (deviceType === 'classic'
|
|
12988
|
+
if (deviceType === 'classic') {
|
|
12989
12989
|
shouldUpdate = !!checkNeedUpdateBootForClassicAndMini(features, this.payload.willUpdateFirmwareVersion);
|
|
12990
12990
|
}
|
|
12991
12991
|
else if (deviceType === 'touch') {
|
|
@@ -13599,14 +13599,20 @@ const uploadFirmware = (updateType, typedCall, postMessage, device, { payload })
|
|
|
13599
13599
|
postConfirmationMessage(device);
|
|
13600
13600
|
postProgressTip(device, 'ConfirmOnDevice', postMessage);
|
|
13601
13601
|
const eraseCommand = updateType === 'firmware' ? 'FirmwareErase' : 'FirmwareErase_ex';
|
|
13602
|
-
yield typedCall(eraseCommand, 'Success', {});
|
|
13602
|
+
const eraseRes = yield typedCall(eraseCommand, 'Success', {});
|
|
13603
|
+
if (eraseRes.type !== 'Success') {
|
|
13604
|
+
throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.RuntimeError, 'erase firmware error');
|
|
13605
|
+
}
|
|
13603
13606
|
postProgressTip(device, 'FirmwareEraseSuccess', postMessage);
|
|
13604
13607
|
postProgressMessage(device, 0, postMessage);
|
|
13605
|
-
const { message } = yield typedCall('FirmwareUpload', 'Success', {
|
|
13608
|
+
const { message, type } = yield typedCall('FirmwareUpload', 'Success', {
|
|
13606
13609
|
payload,
|
|
13607
13610
|
});
|
|
13608
13611
|
postProgressMessage(device, 100, postMessage);
|
|
13609
13612
|
yield waitBleInstall(updateType);
|
|
13613
|
+
if (type !== 'Success') {
|
|
13614
|
+
throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.RuntimeError, 'install firmware error');
|
|
13615
|
+
}
|
|
13610
13616
|
return message;
|
|
13611
13617
|
}
|
|
13612
13618
|
if (deviceModel === 'model_touch') {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onekeyfe/hd-core",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.55",
|
|
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.2.
|
|
28
|
-
"@onekeyfe/hd-transport": "^0.2.
|
|
27
|
+
"@onekeyfe/hd-shared": "^0.2.55",
|
|
28
|
+
"@onekeyfe/hd-transport": "^0.2.55",
|
|
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": "7815dafd6d55e51fda855ff813fb9be6768ed4e9"
|
|
47
47
|
}
|
|
@@ -23,7 +23,7 @@ export default class CheckBootloaderRelease extends BaseMethod {
|
|
|
23
23
|
const { features } = this.device;
|
|
24
24
|
const deviceType = getDeviceType(features);
|
|
25
25
|
let shouldUpdate = false;
|
|
26
|
-
if (deviceType === 'classic'
|
|
26
|
+
if (deviceType === 'classic') {
|
|
27
27
|
shouldUpdate = !!checkNeedUpdateBootForClassicAndMini(
|
|
28
28
|
features,
|
|
29
29
|
this.payload.willUpdateFirmwareVersion
|
|
@@ -31,7 +31,7 @@ export function checkNeedUpdateBootForClassicAndMini(
|
|
|
31
31
|
willUpdateFirmware: string
|
|
32
32
|
) {
|
|
33
33
|
const deviceType = getDeviceType(features);
|
|
34
|
-
if (
|
|
34
|
+
if (deviceType !== 'classic') return false;
|
|
35
35
|
if (!willUpdateFirmware) return false;
|
|
36
36
|
const currentVersion = getDeviceFirmwareVersion(features).join('.');
|
|
37
37
|
const bootloaderVersion = getDeviceBootloaderVersion(features).join('.');
|
|
@@ -65,15 +65,21 @@ export const uploadFirmware = async (
|
|
|
65
65
|
postConfirmationMessage(device);
|
|
66
66
|
postProgressTip(device, 'ConfirmOnDevice', postMessage);
|
|
67
67
|
const eraseCommand = updateType === 'firmware' ? 'FirmwareErase' : 'FirmwareErase_ex';
|
|
68
|
-
await typedCall(eraseCommand as unknown as any, 'Success', {});
|
|
68
|
+
const eraseRes = await typedCall(eraseCommand as unknown as any, 'Success', {});
|
|
69
|
+
if (eraseRes.type !== 'Success') {
|
|
70
|
+
throw ERRORS.TypedError(HardwareErrorCode.RuntimeError, 'erase firmware error');
|
|
71
|
+
}
|
|
69
72
|
postProgressTip(device, 'FirmwareEraseSuccess', postMessage);
|
|
70
73
|
postProgressMessage(device, 0, postMessage);
|
|
71
|
-
const { message } = await typedCall('FirmwareUpload', 'Success', {
|
|
74
|
+
const { message, type } = await typedCall('FirmwareUpload', 'Success', {
|
|
72
75
|
payload,
|
|
73
76
|
});
|
|
74
77
|
postProgressMessage(device, 100, postMessage);
|
|
75
78
|
|
|
76
79
|
await waitBleInstall(updateType);
|
|
80
|
+
if (type !== 'Success') {
|
|
81
|
+
throw ERRORS.TypedError(HardwareErrorCode.RuntimeError, 'install firmware error');
|
|
82
|
+
}
|
|
77
83
|
return message;
|
|
78
84
|
}
|
|
79
85
|
|