@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.
@@ -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;AAuCnF,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,qBAgDlC,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"}
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
- var _a, _b;
13414
- if (((_a = device.features) === null || _a === void 0 ? void 0 : _a.major_version) === 1) {
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 (((_b = device.features) === null || _b === void 0 ? void 0 : _b.major_version) === 2) {
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 major_version');
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: '2.12.0',
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: '2.12.0',
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: '2.12.0',
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: '2.11.0',
18308
+ min: '3.0.0',
18309
18309
  },
18310
18310
  model_touch: {
18311
- min: '4.2.0',
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: '2.11.0',
18362
+ min: '3.0.0',
18363
18363
  },
18364
18364
  model_touch: {
18365
- min: '4.2.0',
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.46",
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.46",
28
- "@onekeyfe/hd-transport": "^0.2.46",
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": "14a5773bffe764d0de7edc505e145c7670be0fcb"
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
- if (device.features?.major_version === 1) {
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 (device.features?.major_version === 2) {
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 major_version');
109
+ throw ERRORS.TypedError(HardwareErrorCode.RuntimeError, 'uploadFirmware: unknown device model');
108
110
  };
109
111
 
110
112
  const processResourceRequest = async (
@@ -45,10 +45,10 @@ export default class PolkadotGetAddress extends BaseMethod<HardwarePolkadotGetAd
45
45
  getVersionRange() {
46
46
  return {
47
47
  model_mini: {
48
- min: '2.11.0',
48
+ min: '3.0.0',
49
49
  },
50
50
  model_touch: {
51
- min: '4.2.0',
51
+ min: '4.3.0',
52
52
  },
53
53
  };
54
54
  }
@@ -33,10 +33,10 @@ export default class PolkadotSignTransaction extends BaseMethod<HardwarePolkadot
33
33
  getVersionRange() {
34
34
  return {
35
35
  model_mini: {
36
- min: '2.11.0',
36
+ min: '3.0.0',
37
37
  },
38
38
  model_touch: {
39
- min: '4.2.0',
39
+ min: '4.3.0',
40
40
  },
41
41
  };
42
42
  }
@@ -49,7 +49,7 @@ export default class SuiGetAddress extends BaseMethod<HardwareSuiGetAddress[]> {
49
49
  getVersionRange() {
50
50
  return {
51
51
  model_mini: {
52
- min: '2.12.0',
52
+ min: '3.0.0',
53
53
  },
54
54
  model_touch: {
55
55
  min: '4.3.0',
@@ -39,7 +39,7 @@ export default class SuiGetPublicKey extends BaseMethod<any> {
39
39
  getVersionRange() {
40
40
  return {
41
41
  model_mini: {
42
- min: '2.12.0',
42
+ min: '3.0.0',
43
43
  },
44
44
  model_touch: {
45
45
  min: '4.3.0',
@@ -30,7 +30,7 @@ export default class SuiSignTransaction extends BaseMethod<HardwareSuiSignTx> {
30
30
  getVersionRange() {
31
31
  return {
32
32
  model_mini: {
33
- min: '2.12.0',
33
+ min: '3.0.0',
34
34
  },
35
35
  model_touch: {
36
36
  min: '4.3.0',