@onekeyfe/hd-core 0.2.46 → 0.2.48
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 -11
- package/package.json +4 -4
- package/src/api/firmware/uploadFirmware.ts +5 -3
- package/src/api/polkadot/PolkadotGetAddress.ts +2 -2
- package/src/api/polkadot/PolkadotSignTransaction.ts +2 -2
- package/src/api/sui/SuiGetAddress.ts +1 -1
- package/src/api/sui/SuiGetPublicKey.ts +1 -1
- package/src/api/sui/SuiSignTransaction.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;
|
|
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,qBAiDlC,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
|
@@ -13410,8 +13410,8 @@ const waitBleInstall = (updateType) => __awaiter(void 0, void 0, void 0, functio
|
|
|
13410
13410
|
}
|
|
13411
13411
|
});
|
|
13412
13412
|
const uploadFirmware = (updateType, typedCall, postMessage, device, { payload }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
13413
|
-
|
|
13414
|
-
if (
|
|
13413
|
+
const deviceModel = getDeviceModel(device.features);
|
|
13414
|
+
if (deviceModel === 'model_mini') {
|
|
13415
13415
|
postConfirmationMessage(device);
|
|
13416
13416
|
postProgressTip(device, 'ConfirmOnDevice', postMessage);
|
|
13417
13417
|
const eraseCommand = updateType === 'firmware' ? 'FirmwareErase' : 'FirmwareErase_ex';
|
|
@@ -13425,7 +13425,7 @@ const uploadFirmware = (updateType, typedCall, postMessage, device, { payload })
|
|
|
13425
13425
|
yield waitBleInstall(updateType);
|
|
13426
13426
|
return message;
|
|
13427
13427
|
}
|
|
13428
|
-
if (
|
|
13428
|
+
if (deviceModel === 'model_touch') {
|
|
13429
13429
|
postConfirmationMessage(device);
|
|
13430
13430
|
postProgressTip(device, 'ConfirmOnDevice', postMessage);
|
|
13431
13431
|
const length = payload.byteLength;
|
|
@@ -13446,7 +13446,7 @@ const uploadFirmware = (updateType, typedCall, postMessage, device, { payload })
|
|
|
13446
13446
|
yield waitBleInstall(updateType);
|
|
13447
13447
|
return response.message;
|
|
13448
13448
|
}
|
|
13449
|
-
throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.RuntimeError, 'uploadFirmware: unknown
|
|
13449
|
+
throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.RuntimeError, 'uploadFirmware: unknown device model');
|
|
13450
13450
|
});
|
|
13451
13451
|
const processResourceRequest = (typedCall, res, data) => __awaiter(void 0, void 0, void 0, function* () {
|
|
13452
13452
|
if (res.type === 'Success') {
|
|
@@ -17155,7 +17155,7 @@ class SuiGetAddress extends BaseMethod {
|
|
|
17155
17155
|
getVersionRange() {
|
|
17156
17156
|
return {
|
|
17157
17157
|
model_mini: {
|
|
17158
|
-
min: '
|
|
17158
|
+
min: '3.0.0',
|
|
17159
17159
|
},
|
|
17160
17160
|
model_touch: {
|
|
17161
17161
|
min: '4.3.0',
|
|
@@ -17224,7 +17224,7 @@ class SuiGetPublicKey extends BaseMethod {
|
|
|
17224
17224
|
getVersionRange() {
|
|
17225
17225
|
return {
|
|
17226
17226
|
model_mini: {
|
|
17227
|
-
min: '
|
|
17227
|
+
min: '3.0.0',
|
|
17228
17228
|
},
|
|
17229
17229
|
model_touch: {
|
|
17230
17230
|
min: '4.3.0',
|
|
@@ -17264,7 +17264,7 @@ class SuiSignTransaction extends BaseMethod {
|
|
|
17264
17264
|
getVersionRange() {
|
|
17265
17265
|
return {
|
|
17266
17266
|
model_mini: {
|
|
17267
|
-
min: '
|
|
17267
|
+
min: '3.0.0',
|
|
17268
17268
|
},
|
|
17269
17269
|
model_touch: {
|
|
17270
17270
|
min: '4.3.0',
|
|
@@ -18305,10 +18305,10 @@ class PolkadotGetAddress extends BaseMethod {
|
|
|
18305
18305
|
getVersionRange() {
|
|
18306
18306
|
return {
|
|
18307
18307
|
model_mini: {
|
|
18308
|
-
min: '
|
|
18308
|
+
min: '3.0.0',
|
|
18309
18309
|
},
|
|
18310
18310
|
model_touch: {
|
|
18311
|
-
min: '4.
|
|
18311
|
+
min: '4.3.0',
|
|
18312
18312
|
},
|
|
18313
18313
|
};
|
|
18314
18314
|
}
|
|
@@ -18359,10 +18359,10 @@ class PolkadotSignTransaction extends BaseMethod {
|
|
|
18359
18359
|
getVersionRange() {
|
|
18360
18360
|
return {
|
|
18361
18361
|
model_mini: {
|
|
18362
|
-
min: '
|
|
18362
|
+
min: '3.0.0',
|
|
18363
18363
|
},
|
|
18364
18364
|
model_touch: {
|
|
18365
|
-
min: '4.
|
|
18365
|
+
min: '4.3.0',
|
|
18366
18366
|
},
|
|
18367
18367
|
};
|
|
18368
18368
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onekeyfe/hd-core",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.48",
|
|
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.48",
|
|
28
|
+
"@onekeyfe/hd-transport": "^0.2.48",
|
|
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": "dd25a5d278b46fd4da7f0833fdd8a1f5b18dedff"
|
|
47
47
|
}
|
|
@@ -9,6 +9,7 @@ import type { Device } from '../../device/Device';
|
|
|
9
9
|
import type { TypedCall, TypedResponseMessage } from '../../device/DeviceCommands';
|
|
10
10
|
import { KnownDevice } from '../../types';
|
|
11
11
|
import { bytesToHex } from '../helpers/hexUtils';
|
|
12
|
+
import { getDeviceModel } from '../../utils/deviceFeaturesUtils';
|
|
12
13
|
|
|
13
14
|
const postConfirmationMessage = (device: Device) => {
|
|
14
15
|
// only if firmware is already installed. fresh device does not require button confirmation
|
|
@@ -59,7 +60,8 @@ export const uploadFirmware = async (
|
|
|
59
60
|
device: Device,
|
|
60
61
|
{ payload }: PROTO.FirmwareUpload
|
|
61
62
|
) => {
|
|
62
|
-
|
|
63
|
+
const deviceModel = getDeviceModel(device.features);
|
|
64
|
+
if (deviceModel === 'model_mini') {
|
|
63
65
|
postConfirmationMessage(device);
|
|
64
66
|
postProgressTip(device, 'ConfirmOnDevice', postMessage);
|
|
65
67
|
const eraseCommand = updateType === 'firmware' ? 'FirmwareErase' : 'FirmwareErase_ex';
|
|
@@ -75,7 +77,7 @@ export const uploadFirmware = async (
|
|
|
75
77
|
return message;
|
|
76
78
|
}
|
|
77
79
|
|
|
78
|
-
if (
|
|
80
|
+
if (deviceModel === 'model_touch') {
|
|
79
81
|
postConfirmationMessage(device);
|
|
80
82
|
postProgressTip(device, 'ConfirmOnDevice', postMessage);
|
|
81
83
|
const length = payload.byteLength;
|
|
@@ -104,7 +106,7 @@ export const uploadFirmware = async (
|
|
|
104
106
|
return response.message;
|
|
105
107
|
}
|
|
106
108
|
|
|
107
|
-
throw ERRORS.TypedError(HardwareErrorCode.RuntimeError, 'uploadFirmware: unknown
|
|
109
|
+
throw ERRORS.TypedError(HardwareErrorCode.RuntimeError, 'uploadFirmware: unknown device model');
|
|
108
110
|
};
|
|
109
111
|
|
|
110
112
|
const processResourceRequest = async (
|