@onekeyfe/hd-core 1.1.18-alpha.0 → 1.1.19-alpha.0

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.
Files changed (85) hide show
  1. package/dist/api/BaseMethod.d.ts +4 -4
  2. package/dist/api/BaseMethod.d.ts.map +1 -1
  3. package/dist/api/CheckAllFirmwareRelease.d.ts +1 -1
  4. package/dist/api/CheckAllFirmwareRelease.d.ts.map +1 -1
  5. package/dist/api/CheckBootloaderRelease.d.ts.map +1 -1
  6. package/dist/api/CheckFirmwareRelease.d.ts.map +1 -1
  7. package/dist/api/FirmwareUpdate.d.ts +1 -1
  8. package/dist/api/FirmwareUpdate.d.ts.map +1 -1
  9. package/dist/api/FirmwareUpdateV2.d.ts +3 -2
  10. package/dist/api/FirmwareUpdateV2.d.ts.map +1 -1
  11. package/dist/api/FirmwareUpdateV3.d.ts +2 -2
  12. package/dist/api/FirmwareUpdateV3.d.ts.map +1 -1
  13. package/dist/api/allnetwork/AllNetworkGetAddressBase.d.ts +2 -2
  14. package/dist/api/allnetwork/AllNetworkGetAddressBase.d.ts.map +1 -1
  15. package/dist/api/device/DeviceFullyUploadResource.d.ts.map +1 -1
  16. package/dist/api/device/DeviceUpdateBootloader.d.ts +6 -1
  17. package/dist/api/device/DeviceUpdateBootloader.d.ts.map +1 -1
  18. package/dist/api/evm/EVMSignTypedData.d.ts.map +1 -1
  19. package/dist/api/firmware/getBinary.d.ts +6 -3
  20. package/dist/api/firmware/getBinary.d.ts.map +1 -1
  21. package/dist/api/firmware/releaseHelper.d.ts +7 -2
  22. package/dist/api/firmware/releaseHelper.d.ts.map +1 -1
  23. package/dist/api/firmware/updateBootloader.d.ts +7 -2
  24. package/dist/api/firmware/updateBootloader.d.ts.map +1 -1
  25. package/dist/api/sui/SuiSignTransaction.d.ts +1 -1
  26. package/dist/api/sui/SuiSignTransaction.d.ts.map +1 -1
  27. package/dist/core/index.d.ts.map +1 -1
  28. package/dist/data-manager/DataManager.d.ts +16 -9
  29. package/dist/data-manager/DataManager.d.ts.map +1 -1
  30. package/dist/events/device.d.ts +2 -2
  31. package/dist/events/device.d.ts.map +1 -1
  32. package/dist/index.d.ts +45 -22
  33. package/dist/index.js +201 -75
  34. package/dist/types/api/checkAllFirmwareRelease.d.ts +5 -1
  35. package/dist/types/api/checkAllFirmwareRelease.d.ts.map +1 -1
  36. package/dist/types/api/checkBootloaderRelease.d.ts +5 -2
  37. package/dist/types/api/checkBootloaderRelease.d.ts.map +1 -1
  38. package/dist/types/api/checkFirmwareRelease.d.ts +6 -2
  39. package/dist/types/api/checkFirmwareRelease.d.ts.map +1 -1
  40. package/dist/types/api/deviceFullyUploadResource.d.ts +6 -1
  41. package/dist/types/api/deviceFullyUploadResource.d.ts.map +1 -1
  42. package/dist/types/api/deviceUpdateBootloader.d.ts +6 -3
  43. package/dist/types/api/deviceUpdateBootloader.d.ts.map +1 -1
  44. package/dist/types/api/firmwareUpdate.d.ts +3 -1
  45. package/dist/types/api/firmwareUpdate.d.ts.map +1 -1
  46. package/dist/types/api/index.d.ts +128 -128
  47. package/dist/types/api/index.d.ts.map +1 -1
  48. package/dist/types/device.d.ts +1 -1
  49. package/dist/types/device.d.ts.map +1 -1
  50. package/dist/types/settings.d.ts +3 -0
  51. package/dist/types/settings.d.ts.map +1 -1
  52. package/dist/utils/deviceFeaturesUtils.d.ts +7 -5
  53. package/dist/utils/deviceFeaturesUtils.d.ts.map +1 -1
  54. package/dist/utils/release.d.ts +1 -1
  55. package/dist/utils/release.d.ts.map +1 -1
  56. package/package.json +4 -4
  57. package/src/api/BaseMethod.ts +17 -7
  58. package/src/api/CheckAllFirmwareRelease.ts +14 -6
  59. package/src/api/CheckBootloaderRelease.ts +13 -2
  60. package/src/api/CheckFirmwareRelease.ts +9 -2
  61. package/src/api/FirmwareUpdate.ts +7 -5
  62. package/src/api/FirmwareUpdateV2.ts +26 -14
  63. package/src/api/FirmwareUpdateV3.ts +29 -18
  64. package/src/api/allnetwork/AllNetworkGetAddressBase.ts +10 -11
  65. package/src/api/device/DeviceFullyUploadResource.ts +8 -2
  66. package/src/api/device/DeviceUpdateBootloader.ts +21 -5
  67. package/src/api/evm/EVMSignTypedData.ts +2 -8
  68. package/src/api/firmware/getBinary.ts +15 -4
  69. package/src/api/firmware/releaseHelper.ts +22 -11
  70. package/src/api/firmware/updateBootloader.ts +17 -9
  71. package/src/api/sui/SuiSignTransaction.ts +7 -1
  72. package/src/core/index.ts +3 -1
  73. package/src/data-manager/DataManager.ts +126 -22
  74. package/src/events/device.ts +2 -2
  75. package/src/types/api/checkAllFirmwareRelease.ts +5 -1
  76. package/src/types/api/checkBootloaderRelease.ts +7 -3
  77. package/src/types/api/checkFirmwareRelease.ts +10 -2
  78. package/src/types/api/deviceFullyUploadResource.ts +7 -1
  79. package/src/types/api/deviceUpdateBootloader.ts +8 -4
  80. package/src/types/api/firmwareUpdate.ts +4 -1
  81. package/src/types/api/index.ts +128 -161
  82. package/src/types/device.ts +2 -1
  83. package/src/types/settings.ts +37 -0
  84. package/src/utils/deviceFeaturesUtils.ts +22 -10
  85. package/src/utils/release.ts +2 -1
package/dist/index.js CHANGED
@@ -24930,7 +24930,54 @@ const findLatestRelease = (releases) => {
24930
24930
  };
24931
24931
 
24932
24932
  var _a$1;
24933
+ const FIRMWARE_FIELDS = [
24934
+ 'firmware',
24935
+ 'firmware-v2',
24936
+ 'firmware-v7',
24937
+ 'firmware-btc-v7',
24938
+ ];
24939
+ const FIRMWARE_FIELD_TYPE_MAP = {
24940
+ firmware: hdShared.EFirmwareType.Universal,
24941
+ 'firmware-v2': hdShared.EFirmwareType.Universal,
24942
+ 'firmware-v7': hdShared.EFirmwareType.Universal,
24943
+ 'firmware-btc-v7': hdShared.EFirmwareType.BitcoinOnly,
24944
+ };
24945
+ function getFirmwareTypeFromField(firmwareField) {
24946
+ const firmwareType = FIRMWARE_FIELD_TYPE_MAP[firmwareField];
24947
+ if (firmwareType === undefined) {
24948
+ return hdShared.EFirmwareType.Universal;
24949
+ }
24950
+ return firmwareType;
24951
+ }
24933
24952
  class DataManager {
24953
+ static enrichFirmwareReleaseInfo(deviceData) {
24954
+ if (!deviceData || typeof deviceData !== 'object') {
24955
+ return {
24956
+ firmware: [],
24957
+ ble: [],
24958
+ };
24959
+ }
24960
+ const enrichedData = Object.assign({}, deviceData);
24961
+ FIRMWARE_FIELDS.forEach(field => {
24962
+ const releases = enrichedData[field];
24963
+ if (!releases || !Array.isArray(releases) || releases.length === 0) {
24964
+ return;
24965
+ }
24966
+ try {
24967
+ enrichedData[field] = releases.map(release => {
24968
+ if (!release || typeof release !== 'object' || !!release.firmwareType) {
24969
+ return release;
24970
+ }
24971
+ const firmwareType = getFirmwareTypeFromField(field);
24972
+ return Object.assign(Object.assign({}, release), { firmwareType });
24973
+ });
24974
+ }
24975
+ catch (error) {
24976
+ console.error(`Error enriching firmware field "${field}":`, error);
24977
+ }
24978
+ });
24979
+ return enrichedData;
24980
+ }
24934
24981
  static load(settings) {
24935
24982
  return __awaiter(this, void 0, void 0, function* () {
24936
24983
  this.settings = settings;
@@ -24945,12 +24992,12 @@ class DataManager {
24945
24992
  timeout: 7000,
24946
24993
  });
24947
24994
  this.deviceMap = {
24948
- [hdShared.EDeviceType.Classic]: data.classic,
24949
- [hdShared.EDeviceType.Classic1s]: data.classic1s,
24950
- [hdShared.EDeviceType.ClassicPure]: data.classicpure,
24951
- [hdShared.EDeviceType.Mini]: data.mini,
24952
- [hdShared.EDeviceType.Touch]: data.touch,
24953
- [hdShared.EDeviceType.Pro]: data.pro,
24995
+ [hdShared.EDeviceType.Classic]: this.enrichFirmwareReleaseInfo(data.classic),
24996
+ [hdShared.EDeviceType.Classic1s]: this.enrichFirmwareReleaseInfo(data.classic1s),
24997
+ [hdShared.EDeviceType.ClassicPure]: this.enrichFirmwareReleaseInfo(data.classicpure),
24998
+ [hdShared.EDeviceType.Mini]: this.enrichFirmwareReleaseInfo(data.mini),
24999
+ [hdShared.EDeviceType.Touch]: this.enrichFirmwareReleaseInfo(data.touch),
25000
+ [hdShared.EDeviceType.Pro]: this.enrichFirmwareReleaseInfo(data.pro),
24954
25001
  };
24955
25002
  this.assets = {
24956
25003
  bridge: data.bridge,
@@ -25021,11 +25068,12 @@ DataManager.messages = {
25021
25068
  v1: MessagesLegacyV1JSON,
25022
25069
  };
25023
25070
  DataManager.lastCheckTimestamp = 0;
25024
- DataManager.getFirmwareStatus = (features) => {
25071
+ DataManager.getFirmwareStatus = (features, firmwareType) => {
25025
25072
  var _b, _c;
25026
25073
  const deviceType = getDeviceType(features);
25027
25074
  if (deviceType === hdShared.EDeviceType.Unknown)
25028
25075
  return 'unknown';
25076
+ const deviceFirmwareType = getFirmwareType(features);
25029
25077
  const deviceFirmwareVersion = getDeviceFirmwareVersion(features);
25030
25078
  if (features.firmware_present === false) {
25031
25079
  return 'none';
@@ -25033,12 +25081,19 @@ DataManager.getFirmwareStatus = (features) => {
25033
25081
  if (DeviceModelToTypes.model_mini.includes(deviceType) && features.bootloader_mode) {
25034
25082
  return 'unknown';
25035
25083
  }
25036
- const firmwareUpdateField = getFirmwareUpdateField({ features, updateType: 'firmware' });
25084
+ const firmwareUpdateField = getFirmwareUpdateField({
25085
+ features,
25086
+ updateType: 'firmware',
25087
+ firmwareType,
25088
+ });
25037
25089
  const targetDeviceConfigList = (_c = (_b = _a$1.deviceMap[deviceType]) === null || _b === void 0 ? void 0 : _b[firmwareUpdateField]) !== null && _c !== void 0 ? _c : [];
25038
- const currentVersion = deviceFirmwareVersion.join('.');
25090
+ let currentVersion = deviceFirmwareVersion.join('.');
25091
+ if (targetDeviceConfigList.length > 0 && deviceFirmwareType !== firmwareType) {
25092
+ currentVersion = '0.0.0';
25093
+ }
25039
25094
  return getReleaseStatus(targetDeviceConfigList, currentVersion);
25040
25095
  };
25041
- DataManager.getSysResourcesLatestRelease = (features, forcedUpdateRes) => {
25096
+ DataManager.getSysResourcesLatestRelease = ({ features, forcedUpdateRes, firmwareType, }) => {
25042
25097
  var _b, _c, _d;
25043
25098
  const deviceType = getDeviceType(features);
25044
25099
  const deviceFirmwareVersion = getDeviceFirmwareVersion(features);
@@ -25047,6 +25102,7 @@ DataManager.getSysResourcesLatestRelease = (features, forcedUpdateRes) => {
25047
25102
  const firmwareUpdateField = getFirmwareUpdateField({
25048
25103
  features,
25049
25104
  updateType: 'firmware',
25105
+ firmwareType,
25050
25106
  });
25051
25107
  const targetDeviceConfigList = (_c = (_b = _a$1.deviceMap[deviceType]) === null || _b === void 0 ? void 0 : _b[firmwareUpdateField]) !== null && _c !== void 0 ? _c : [];
25052
25108
  const currentVersion = deviceFirmwareVersion.join('.');
@@ -25055,7 +25111,7 @@ DataManager.getSysResourcesLatestRelease = (features, forcedUpdateRes) => {
25055
25111
  : semver__default["default"].gt(item.version.join('.'), currentVersion) && !!item.resource);
25056
25112
  return (_d = findLatestRelease(targetDeviceConfig)) === null || _d === void 0 ? void 0 : _d.resource;
25057
25113
  };
25058
- DataManager.getSysFullResource = (features) => {
25114
+ DataManager.getSysFullResource = (features, firmwareType) => {
25059
25115
  var _b, _c, _d;
25060
25116
  const deviceType = getDeviceType(features);
25061
25117
  if (deviceType === hdShared.EDeviceType.Unknown)
@@ -25065,12 +25121,13 @@ DataManager.getSysFullResource = (features) => {
25065
25121
  const firmwareUpdateField = getFirmwareUpdateField({
25066
25122
  features,
25067
25123
  updateType: 'firmware',
25124
+ firmwareType,
25068
25125
  });
25069
25126
  const targetDeviceConfigList = (_c = (_b = _a$1.deviceMap[deviceType]) === null || _b === void 0 ? void 0 : _b[firmwareUpdateField]) !== null && _c !== void 0 ? _c : [];
25070
25127
  const targetDeviceConfig = targetDeviceConfigList.filter(item => !!item.fullResource);
25071
25128
  return (_d = findLatestRelease(targetDeviceConfig)) === null || _d === void 0 ? void 0 : _d.fullResource;
25072
25129
  };
25073
- DataManager.getBootloaderResource = (features) => {
25130
+ DataManager.getBootloaderResource = (features, firmwareType) => {
25074
25131
  var _b, _c, _d;
25075
25132
  const deviceType = getDeviceType(features);
25076
25133
  if (deviceType === hdShared.EDeviceType.Unknown)
@@ -25080,6 +25137,7 @@ DataManager.getBootloaderResource = (features) => {
25080
25137
  const firmwareUpdateField = getFirmwareUpdateField({
25081
25138
  features,
25082
25139
  updateType: 'firmware',
25140
+ firmwareType,
25083
25141
  });
25084
25142
  const targetDeviceConfigList = (_c = (_b = _a$1.deviceMap[deviceType]) === null || _b === void 0 ? void 0 : _b[firmwareUpdateField]) !== null && _c !== void 0 ? _c : [];
25085
25143
  if (targetDeviceConfigList.length === 0) {
@@ -25088,7 +25146,7 @@ DataManager.getBootloaderResource = (features) => {
25088
25146
  const targetDeviceConfig = targetDeviceConfigList.filter(item => !!item.bootloaderResource);
25089
25147
  return (_d = findLatestRelease(targetDeviceConfig)) === null || _d === void 0 ? void 0 : _d.bootloaderResource;
25090
25148
  };
25091
- DataManager.getBootloaderTargetVersion = (features) => {
25149
+ DataManager.getBootloaderTargetVersion = (features, firmwareType) => {
25092
25150
  var _b, _c, _d, _e;
25093
25151
  const deviceType = getDeviceType(features);
25094
25152
  if (deviceType === hdShared.EDeviceType.Unknown)
@@ -25096,12 +25154,13 @@ DataManager.getBootloaderTargetVersion = (features) => {
25096
25154
  const firmwareUpdateField = getFirmwareUpdateField({
25097
25155
  features,
25098
25156
  updateType: 'firmware',
25157
+ firmwareType,
25099
25158
  });
25100
25159
  const targetDeviceConfigList = (_c = (_b = _a$1.deviceMap[deviceType]) === null || _b === void 0 ? void 0 : _b[firmwareUpdateField]) !== null && _c !== void 0 ? _c : [];
25101
25160
  const targetDeviceConfig = targetDeviceConfigList.filter(item => !!item.bootloaderResource);
25102
25161
  return (_e = (_d = targetDeviceConfig === null || targetDeviceConfig === void 0 ? void 0 : targetDeviceConfig[0]) === null || _d === void 0 ? void 0 : _d.bootloaderVersion) !== null && _e !== void 0 ? _e : undefined;
25103
25162
  };
25104
- DataManager.getBootloaderRelatedFirmwareVersion = (features) => {
25163
+ DataManager.getBootloaderRelatedFirmwareVersion = (features, firmwareType) => {
25105
25164
  var _b, _c, _d, _e;
25106
25165
  const deviceType = getDeviceType(features);
25107
25166
  if (deviceType === hdShared.EDeviceType.Unknown)
@@ -25111,12 +25170,13 @@ DataManager.getBootloaderRelatedFirmwareVersion = (features) => {
25111
25170
  const firmwareUpdateField = getFirmwareUpdateField({
25112
25171
  features,
25113
25172
  updateType: 'firmware',
25173
+ firmwareType,
25114
25174
  });
25115
25175
  const targetDeviceConfigList = (_c = (_b = _a$1.deviceMap[deviceType]) === null || _b === void 0 ? void 0 : _b[firmwareUpdateField]) !== null && _c !== void 0 ? _c : [];
25116
25176
  const targetDeviceConfig = targetDeviceConfigList.filter(item => !!item.bootloaderRelatedFirmwareVersion);
25117
25177
  return (_e = (_d = targetDeviceConfig === null || targetDeviceConfig === void 0 ? void 0 : targetDeviceConfig[0]) === null || _d === void 0 ? void 0 : _d.bootloaderRelatedFirmwareVersion) !== null && _e !== void 0 ? _e : undefined;
25118
25178
  };
25119
- DataManager.getFirmwareChangelog = (features) => {
25179
+ DataManager.getFirmwareChangelog = (features, firmwareType) => {
25120
25180
  var _b, _c;
25121
25181
  const deviceType = getDeviceType(features);
25122
25182
  if (deviceType === hdShared.EDeviceType.Unknown)
@@ -25125,6 +25185,7 @@ DataManager.getFirmwareChangelog = (features) => {
25125
25185
  const firmwareUpdateField = getFirmwareUpdateField({
25126
25186
  features,
25127
25187
  updateType: 'firmware',
25188
+ firmwareType,
25128
25189
  });
25129
25190
  const targetDeviceConfigList = (_c = (_b = _a$1.deviceMap[deviceType]) === null || _b === void 0 ? void 0 : _b[firmwareUpdateField]) !== null && _c !== void 0 ? _c : [];
25130
25191
  if (features.firmware_present === false ||
@@ -25134,7 +25195,7 @@ DataManager.getFirmwareChangelog = (features) => {
25134
25195
  const currentVersion = deviceFirmwareVersion.join('.');
25135
25196
  return getReleaseChangelog(targetDeviceConfigList, currentVersion);
25136
25197
  };
25137
- DataManager.getFirmwareLatestRelease = (features) => {
25198
+ DataManager.getFirmwareLatestRelease = (features, firmwareType) => {
25138
25199
  var _b, _c;
25139
25200
  const deviceType = getDeviceType(features);
25140
25201
  if (deviceType === hdShared.EDeviceType.Unknown)
@@ -25142,13 +25203,14 @@ DataManager.getFirmwareLatestRelease = (features) => {
25142
25203
  const firmwareUpdateField = getFirmwareUpdateField({
25143
25204
  features,
25144
25205
  updateType: 'firmware',
25206
+ firmwareType,
25145
25207
  });
25146
25208
  const targetDeviceConfigList = (_c = (_b = _a$1.deviceMap[deviceType]) === null || _b === void 0 ? void 0 : _b[firmwareUpdateField]) !== null && _c !== void 0 ? _c : [];
25147
25209
  const target = findLatestRelease(targetDeviceConfigList);
25148
25210
  if (!target)
25149
25211
  return target;
25150
25212
  if (!target.resource) {
25151
- const resource = _a$1.getSysResourcesLatestRelease(features);
25213
+ const resource = _a$1.getSysResourcesLatestRelease({ features, firmwareType });
25152
25214
  return Object.assign(Object.assign({}, target), { resource });
25153
25215
  }
25154
25216
  return target;
@@ -25347,28 +25409,35 @@ const supportModifyHomescreen = (features) => {
25347
25409
  }
25348
25410
  return { support: semver__default["default"].gte(currentVersion, '3.4.0') };
25349
25411
  };
25350
- const getFirmwareUpdateField = ({ features, updateType, targetVersion, }) => {
25412
+ const getLatestFirmwareField = (firmwareType) => {
25413
+ if (firmwareType === 'bitcoinonly') {
25414
+ return `firmware-btc-v7`;
25415
+ }
25416
+ return `firmware-v7`;
25417
+ };
25418
+ const getFirmwareUpdateField = ({ features, updateType, targetVersion, firmwareType, }) => {
25351
25419
  const deviceType = getDeviceType(features);
25352
25420
  const deviceFirmwareVersion = getDeviceFirmwareVersion(features);
25353
25421
  if (updateType === 'ble') {
25354
25422
  return 'ble';
25355
25423
  }
25424
+ const latestFirmwareField = getLatestFirmwareField(firmwareType);
25356
25425
  if (DeviceModelToTypes.model_mini.includes(deviceType)) {
25357
- return 'firmware-v7';
25426
+ return latestFirmwareField;
25358
25427
  }
25359
25428
  if (deviceType === hdShared.EDeviceType.Touch) {
25360
25429
  if (targetVersion) {
25361
25430
  if (semver__default["default"].eq(targetVersion, '4.0.0'))
25362
25431
  return 'firmware-v2';
25363
25432
  if (semver__default["default"].gt(targetVersion, '4.0.0'))
25364
- return 'firmware-v7';
25433
+ return latestFirmwareField;
25365
25434
  }
25366
25435
  if (semver__default["default"].lt(deviceFirmwareVersion.join('.'), '3.4.0'))
25367
25436
  return 'firmware';
25368
- return 'firmware-v7';
25437
+ return latestFirmwareField;
25369
25438
  }
25370
25439
  if (deviceType === hdShared.EDeviceType.Pro) {
25371
- return 'firmware-v7';
25440
+ return latestFirmwareField;
25372
25441
  }
25373
25442
  return 'firmware';
25374
25443
  };
@@ -25550,20 +25619,20 @@ function isEnteredManuallyBoot(features, updateType) {
25550
25619
  return isMini || isBoot183ClassicUpBle;
25551
25620
  }
25552
25621
 
25553
- function checkNeedUpdateBootForTouch(features) {
25622
+ function checkNeedUpdateBootForTouch(features, firmwareType) {
25554
25623
  const deviceType = getDeviceType(features);
25555
25624
  if (!DeviceModelToTypes.model_touch.includes(deviceType))
25556
25625
  return false;
25557
25626
  const currentVersion = getDeviceFirmwareVersion(features).join('.');
25558
25627
  const bootloaderVersion = getDeviceBootloaderVersion(features).join('.');
25559
- const targetBootloaderVersion = DataManager.getBootloaderTargetVersion(features);
25628
+ const targetBootloaderVersion = DataManager.getBootloaderTargetVersion(features, firmwareType);
25560
25629
  if (!targetBootloaderVersion)
25561
25630
  return false;
25562
25631
  return (semver__default["default"].gte(currentVersion, '3.2.0') &&
25563
25632
  semver__default["default"].gte(currentVersion, '4.1.0') &&
25564
25633
  semver__default["default"].lte(bootloaderVersion, targetBootloaderVersion.join('.')));
25565
25634
  }
25566
- function checkNeedUpdateBootForClassicAndMini(features, willUpdateFirmware) {
25635
+ function checkNeedUpdateBootForClassicAndMini({ features, willUpdateFirmware, firmwareType, }) {
25567
25636
  const deviceType = getDeviceType(features);
25568
25637
  if (!DeviceModelToTypes.model_mini.includes(deviceType))
25569
25638
  return false;
@@ -25571,11 +25640,11 @@ function checkNeedUpdateBootForClassicAndMini(features, willUpdateFirmware) {
25571
25640
  return false;
25572
25641
  const currentVersion = getDeviceFirmwareVersion(features).join('.');
25573
25642
  const bootloaderVersion = getDeviceBootloaderVersion(features).join('.');
25574
- const targetBootloaderVersion = DataManager.getBootloaderTargetVersion(features);
25643
+ const targetBootloaderVersion = DataManager.getBootloaderTargetVersion(features, firmwareType);
25575
25644
  if (targetBootloaderVersion && semver__default["default"].gte(bootloaderVersion, targetBootloaderVersion.join('.'))) {
25576
25645
  return false;
25577
25646
  }
25578
- const bootloaderRelatedFirmwareVersion = DataManager.getBootloaderRelatedFirmwareVersion(features);
25647
+ const bootloaderRelatedFirmwareVersion = DataManager.getBootloaderRelatedFirmwareVersion(features, firmwareType);
25579
25648
  if (!bootloaderRelatedFirmwareVersion)
25580
25649
  return false;
25581
25650
  return shouldUpdateBootloaderForClassicAndMini({
@@ -27445,10 +27514,10 @@ class DeviceList extends events.exports {
27445
27514
  }
27446
27515
  }
27447
27516
 
27448
- const getFirmwareReleaseInfo = (features) => {
27449
- const firmwareStatus = DataManager.getFirmwareStatus(features);
27450
- const changelog = DataManager.getFirmwareChangelog(features);
27451
- const release = DataManager.getFirmwareLatestRelease(features);
27517
+ const getFirmwareReleaseInfo = (features, firmwareType) => {
27518
+ const firmwareStatus = DataManager.getFirmwareStatus(features, firmwareType);
27519
+ const changelog = DataManager.getFirmwareChangelog(features, firmwareType);
27520
+ const release = DataManager.getFirmwareLatestRelease(features, firmwareType);
27452
27521
  const bootloaderMode = !!features.bootloader_mode;
27453
27522
  return {
27454
27523
  status: firmwareStatus,
@@ -27469,8 +27538,8 @@ const getBleFirmwareReleaseInfo = (features) => {
27469
27538
  bootloaderMode,
27470
27539
  };
27471
27540
  };
27472
- const getBootloaderReleaseInfo = (features, willUpdateFirmwareVersion) => {
27473
- const release = DataManager.getFirmwareLatestRelease(features);
27541
+ const getBootloaderReleaseInfo = ({ features, willUpdateFirmwareVersion, firmwareType, }) => {
27542
+ const release = DataManager.getFirmwareLatestRelease(features, firmwareType);
27474
27543
  const changelog = [release === null || release === void 0 ? void 0 : release.bootloaderChangelog].filter(item => item != null &&
27475
27544
  typeof item === 'object' &&
27476
27545
  Object.prototype.hasOwnProperty.call(item, 'zh-CN') &&
@@ -27479,10 +27548,14 @@ const getBootloaderReleaseInfo = (features, willUpdateFirmwareVersion) => {
27479
27548
  let shouldUpdate = false;
27480
27549
  const deviceType = getDeviceType(features);
27481
27550
  if (DeviceModelToTypes.model_mini.includes(deviceType)) {
27482
- shouldUpdate = !!checkNeedUpdateBootForClassicAndMini(features, willUpdateFirmwareVersion);
27551
+ shouldUpdate = !!checkNeedUpdateBootForClassicAndMini({
27552
+ features,
27553
+ willUpdateFirmware: willUpdateFirmwareVersion,
27554
+ firmwareType,
27555
+ });
27483
27556
  }
27484
27557
  else if (DeviceModelToTypes.model_touch.includes(deviceType)) {
27485
- shouldUpdate = checkNeedUpdateBootForTouch(features);
27558
+ shouldUpdate = checkNeedUpdateBootForTouch(features, firmwareType);
27486
27559
  }
27487
27560
  return {
27488
27561
  status: shouldUpdate ? 'outdated' : 'valid',
@@ -27526,7 +27599,8 @@ class BaseMethod {
27526
27599
  checkFirmwareRelease() {
27527
27600
  if (!this.device || !this.device.features)
27528
27601
  return;
27529
- const releaseInfo = getFirmwareReleaseInfo(this.device.features);
27602
+ const firmwareType = getFirmwareType(this.device.features);
27603
+ const releaseInfo = getFirmwareReleaseInfo(this.device.features, firmwareType);
27530
27604
  this.postMessage(createFirmwareMessage(FIRMWARE.RELEASE_INFO, Object.assign(Object.assign({}, releaseInfo), { device: this.device.toMessageObject() })));
27531
27605
  const bleReleaseInfo = getBleFirmwareReleaseInfo(this.device.features);
27532
27606
  this.postMessage(createFirmwareMessage(FIRMWARE.BLE_RELEASE_INFO, Object.assign(Object.assign({}, bleReleaseInfo), { device: this.device.toMessageObject() })));
@@ -27726,8 +27800,12 @@ class CheckFirmwareRelease extends BaseMethod {
27726
27800
  this.skipForceUpdateCheck = true;
27727
27801
  }
27728
27802
  run() {
27803
+ var _a;
27804
+ const payload = this.payload;
27729
27805
  if (this.device.features) {
27730
- const releaseInfo = getFirmwareReleaseInfo(this.device.features);
27806
+ const deviceFirmwareType = getFirmwareType(this.device.features);
27807
+ const firmwareType = (_a = payload.firmwareType) !== null && _a !== void 0 ? _a : deviceFirmwareType;
27808
+ const releaseInfo = getFirmwareReleaseInfo(this.device.features, firmwareType);
27731
27809
  return Promise.resolve(releaseInfo);
27732
27810
  }
27733
27811
  return Promise.resolve(null);
@@ -27868,12 +27946,20 @@ class CheckBootloaderRelease extends BaseMethod {
27868
27946
  this.skipForceUpdateCheck = true;
27869
27947
  }
27870
27948
  run() {
27949
+ var _a;
27871
27950
  return __awaiter(this, void 0, void 0, function* () {
27872
27951
  if (!this.device.features) {
27873
27952
  return null;
27874
27953
  }
27875
27954
  const { features } = this.device;
27876
- const releaseInfo = getBootloaderReleaseInfo(features, this.payload.willUpdateFirmwareVersion);
27955
+ const payload = this.payload;
27956
+ const deviceFirmwareType = getFirmwareType(features);
27957
+ const firmwareType = (_a = payload.firmwareType) !== null && _a !== void 0 ? _a : deviceFirmwareType;
27958
+ const releaseInfo = getBootloaderReleaseInfo({
27959
+ features,
27960
+ willUpdateFirmwareVersion: payload.willUpdateFirmwareVersion,
27961
+ firmwareType,
27962
+ });
27877
27963
  return Promise.resolve(releaseInfo);
27878
27964
  });
27879
27965
  }
@@ -27889,11 +27975,14 @@ class CheckAllFirmwareRelease extends BaseMethod {
27889
27975
  var _a, _b;
27890
27976
  return __awaiter(this, void 0, void 0, function* () {
27891
27977
  const { features } = this.device;
27892
- const { checkBridgeRelease } = this.payload;
27978
+ const { checkBridgeRelease, firmwareType: firmwareTypeParams } = this
27979
+ .payload;
27893
27980
  if (!features) {
27894
27981
  return Promise.resolve(null);
27895
27982
  }
27896
- const firmwareRelease = getFirmwareReleaseInfo(features);
27983
+ const deviceFirmwareType = getFirmwareType(features);
27984
+ const firmwareType = firmwareTypeParams !== null && firmwareTypeParams !== void 0 ? firmwareTypeParams : deviceFirmwareType;
27985
+ const firmwareRelease = getFirmwareReleaseInfo(features, firmwareType);
27897
27986
  const currentFirmwareVersion = getDeviceFirmwareVersion(features).join('.');
27898
27987
  const willUpdateFirmwareVersion = (_b = (_a = firmwareRelease.release) === null || _a === void 0 ? void 0 : _a.version) === null || _b === void 0 ? void 0 : _b.join('.');
27899
27988
  const deviceType = getDeviceType(features);
@@ -27906,7 +27995,11 @@ class CheckAllFirmwareRelease extends BaseMethod {
27906
27995
  willUpdateFirmwareVersion,
27907
27996
  });
27908
27997
  }
27909
- const bootloaderRelease = getBootloaderReleaseInfo(features, willUpdateFirmwareVersion);
27998
+ const bootloaderRelease = getBootloaderReleaseInfo({
27999
+ features,
28000
+ willUpdateFirmwareVersion,
28001
+ firmwareType,
28002
+ });
27910
28003
  const bleFirmwareReleaseInfo = getBleFirmwareReleaseInfo(features);
27911
28004
  return {
27912
28005
  firmware: firmwareRelease,
@@ -27920,6 +28013,7 @@ class CheckAllFirmwareRelease extends BaseMethod {
27920
28013
  release: bridgeReleaseInfo.releaseVersion,
27921
28014
  }
27922
28015
  : undefined,
28016
+ features,
27923
28017
  };
27924
28018
  });
27925
28019
  }
@@ -28552,8 +28646,13 @@ class DeviceWipe extends BaseMethod {
28552
28646
  }
28553
28647
  }
28554
28648
 
28555
- const getBinary = ({ features, updateType, version, isUpdateBootloader, }) => __awaiter(void 0, void 0, void 0, function* () {
28556
- const releaseInfo = getInfo({ features, updateType, targetVersion: version === null || version === void 0 ? void 0 : version.join('.') });
28649
+ const getBinary = ({ features, updateType, version, isUpdateBootloader, firmwareType, }) => __awaiter(void 0, void 0, void 0, function* () {
28650
+ const releaseInfo = getInfo({
28651
+ features,
28652
+ updateType,
28653
+ targetVersion: version === null || version === void 0 ? void 0 : version.join('.'),
28654
+ firmwareType,
28655
+ });
28557
28656
  if (!releaseInfo) {
28558
28657
  throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.RuntimeError, 'no firmware found for this device');
28559
28658
  }
@@ -28590,7 +28689,7 @@ const getSysResourceBinary = (url) => __awaiter(void 0, void 0, void 0, function
28590
28689
  binary: fw,
28591
28690
  };
28592
28691
  });
28593
- const getInfo = ({ features, updateType, targetVersion }) => {
28692
+ const getInfo = ({ features, updateType, targetVersion, firmwareType }) => {
28594
28693
  var _a, _b;
28595
28694
  const deviceType = getDeviceType(features);
28596
28695
  if (deviceType === 'unknown') {
@@ -28601,6 +28700,7 @@ const getInfo = ({ features, updateType, targetVersion }) => {
28601
28700
  features,
28602
28701
  updateType,
28603
28702
  targetVersion,
28703
+ firmwareType,
28604
28704
  });
28605
28705
  const releaseInfo = (_b = (_a = deviceMap === null || deviceMap === void 0 ? void 0 : deviceMap[deviceType]) === null || _a === void 0 ? void 0 : _a[firmwareUpdateField]) !== null && _b !== void 0 ? _b : [];
28606
28706
  return findLatestRelease(releaseInfo);
@@ -28943,15 +29043,19 @@ class DeviceFullyUploadResource extends BaseMethod {
28943
29043
  return isTouchMode && semver__default["default"].gte(currentVersion, '3.4.0');
28944
29044
  }
28945
29045
  run() {
29046
+ var _a;
28946
29047
  return __awaiter(this, void 0, void 0, function* () {
28947
29048
  const { device } = this;
28948
29049
  const { features } = device;
29050
+ const payload = this.payload;
29051
+ const deviceFirmwareType = getFirmwareType(features);
29052
+ const firmwareType = (_a = payload.firmwareType) !== null && _a !== void 0 ? _a : deviceFirmwareType;
28949
29053
  if (!(features === null || features === void 0 ? void 0 : features.bootloader_mode) && features) {
28950
29054
  if (features) {
28951
29055
  let { binary } = this.payload;
28952
29056
  if (!binary) {
28953
29057
  this.postTipMessage('CheckLatestUiResource');
28954
- const resourceUrl = DataManager.getSysFullResource(features);
29058
+ const resourceUrl = DataManager.getSysFullResource(features, firmwareType);
28955
29059
  if (resourceUrl) {
28956
29060
  this.postTipMessage('DownloadLatestUiResource');
28957
29061
  const resource = yield getSysResourceBinary(resourceUrl);
@@ -29315,12 +29419,14 @@ class DeviceUpdateBootloader extends FirmwareUpdateBaseMethod {
29315
29419
  return true;
29316
29420
  });
29317
29421
  }
29318
- updateTouchBootloader(device, features) {
29422
+ updateTouchBootloader({ device, features, firmwareType, }) {
29319
29423
  return __awaiter(this, void 0, void 0, function* () {
29320
29424
  let { binary } = this.payload;
29321
29425
  if (!binary) {
29322
29426
  this.postTipMessage(exports.FirmwareUpdateTipMessage.CheckLatestUiResource);
29323
- const resourceUrl = features ? DataManager.getBootloaderResource(features) : null;
29427
+ const resourceUrl = features
29428
+ ? DataManager.getBootloaderResource(features, firmwareType)
29429
+ : null;
29324
29430
  if (resourceUrl) {
29325
29431
  this.postTipMessage(exports.FirmwareUpdateTipMessage.DownloadLatestBootloaderResource);
29326
29432
  const resource = yield getSysResourceBinary(resourceUrl);
@@ -29344,12 +29450,16 @@ class DeviceUpdateBootloader extends FirmwareUpdateBaseMethod {
29344
29450
  });
29345
29451
  }
29346
29452
  run() {
29453
+ var _a;
29347
29454
  return __awaiter(this, void 0, void 0, function* () {
29348
29455
  const { device } = this;
29349
29456
  const { features } = device;
29457
+ const payload = this.payload;
29350
29458
  const deviceType = getDeviceType(features);
29459
+ const deviceFirmwareType = getFirmwareType(features);
29460
+ const firmwareType = (_a = payload.firmwareType) !== null && _a !== void 0 ? _a : deviceFirmwareType;
29351
29461
  if (DeviceModelToTypes.model_touch.includes(deviceType)) {
29352
- return this.updateTouchBootloader(device, features);
29462
+ return this.updateTouchBootloader({ device, features, firmwareType });
29353
29463
  }
29354
29464
  return Promise.resolve(true);
29355
29465
  });
@@ -29541,6 +29651,7 @@ class FirmwareUpdate extends BaseMethod {
29541
29651
  features: device.features,
29542
29652
  version: params.version,
29543
29653
  updateType: params.updateType,
29654
+ firmwareType: hdShared.EFirmwareType.Universal,
29544
29655
  });
29545
29656
  binary = firmware.binary;
29546
29657
  this.postTipMessage('DownloadFirmwareSuccess');
@@ -29584,6 +29695,7 @@ class FirmwareUpdateV2 extends BaseMethod {
29584
29695
  { name: 'binary', type: 'buffer' },
29585
29696
  { name: 'forcedUpdateRes', type: 'boolean' },
29586
29697
  { name: 'platform', type: 'string', required: true },
29698
+ { name: 'firmwareType', type: 'string' },
29587
29699
  ]);
29588
29700
  if (!payload.updateType) {
29589
29701
  throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.CallMethodInvalidParameter, 'updateType is required');
@@ -29594,7 +29706,7 @@ class FirmwareUpdateV2 extends BaseMethod {
29594
29706
  isUpdateBootloader: payload.isUpdateBootloader,
29595
29707
  };
29596
29708
  if ('version' in payload) {
29597
- this.params = Object.assign(Object.assign({}, this.params), { version: payload.version });
29709
+ this.params = Object.assign(Object.assign({}, this.params), { version: payload.version, firmwareType: payload.firmwareType });
29598
29710
  }
29599
29711
  if ('binary' in payload) {
29600
29712
  this.params = Object.assign(Object.assign({}, this.params), { binary: payload.binary });
@@ -29715,7 +29827,7 @@ class FirmwareUpdateV2 extends BaseMethod {
29715
29827
  const currentVersion = getDeviceFirmwareVersion(features).join('.');
29716
29828
  return isTouchMode && semver__default["default"].gte(currentVersion, '3.2.0');
29717
29829
  }
29718
- checkVersionForCopyTouchResource(features) {
29830
+ checkVersionForCopyTouchResource(features, firmwareType) {
29719
29831
  var _a;
29720
29832
  if (!features)
29721
29833
  return;
@@ -29723,7 +29835,7 @@ class FirmwareUpdateV2 extends BaseMethod {
29723
29835
  const currentVersion = getDeviceFirmwareVersion(features).join('.');
29724
29836
  const targetVersion = (_a = this.params.version) === null || _a === void 0 ? void 0 : _a.join('.');
29725
29837
  const { updateType } = this.params;
29726
- const releaseInfo = getInfo({ features, updateType });
29838
+ const releaseInfo = getInfo({ features, updateType, firmwareType });
29727
29839
  if (!releaseInfo)
29728
29840
  return;
29729
29841
  const { fullResourceRange } = releaseInfo;
@@ -29739,12 +29851,14 @@ class FirmwareUpdateV2 extends BaseMethod {
29739
29851
  }
29740
29852
  }
29741
29853
  run() {
29742
- var _a, _b, _c, _d, _e, _f, _g, _h;
29854
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
29743
29855
  return __awaiter(this, void 0, void 0, function* () {
29744
29856
  const { device, params } = this;
29745
29857
  const { features, commands } = device;
29746
29858
  const deviceType = getDeviceType(features);
29747
- this.checkVersionForCopyTouchResource(features);
29859
+ const deviceFirmwareType = getFirmwareType(device.features);
29860
+ const firmwareType = (_a = params.firmwareType) !== null && _a !== void 0 ? _a : deviceFirmwareType;
29861
+ this.checkVersionForCopyTouchResource(features, firmwareType);
29748
29862
  if (!(features === null || features === void 0 ? void 0 : features.bootloader_mode) && features) {
29749
29863
  const uuid = getDeviceUUID(features);
29750
29864
  if (this.isEnteredManuallyBoot(features)) {
@@ -29752,7 +29866,11 @@ class FirmwareUpdateV2 extends BaseMethod {
29752
29866
  }
29753
29867
  if (features && this.isSupportResourceUpdate(features, params.updateType)) {
29754
29868
  this.postTipMessage('CheckLatestUiResource');
29755
- const resourceUrl = DataManager.getSysResourcesLatestRelease(features, params.forcedUpdateRes);
29869
+ const resourceUrl = DataManager.getSysResourcesLatestRelease({
29870
+ features,
29871
+ forcedUpdateRes: params.forcedUpdateRes,
29872
+ firmwareType,
29873
+ });
29756
29874
  if (resourceUrl) {
29757
29875
  this.postTipMessage('DownloadLatestUiResource');
29758
29876
  const resource = yield getSysResourceBinary(resourceUrl);
@@ -29762,7 +29880,7 @@ class FirmwareUpdateV2 extends BaseMethod {
29762
29880
  }
29763
29881
  }
29764
29882
  }
29765
- (_b = (_a = this.device) === null || _a === void 0 ? void 0 : _a.commands) === null || _b === void 0 ? void 0 : _b.checkDisposed();
29883
+ (_c = (_b = this.device) === null || _b === void 0 ? void 0 : _b.commands) === null || _c === void 0 ? void 0 : _c.checkDisposed();
29766
29884
  try {
29767
29885
  this.postTipMessage('AutoRebootToBootloader');
29768
29886
  const bootRes = yield commands.typedCall('DeviceBackToBoot', 'Success');
@@ -29775,9 +29893,9 @@ class FirmwareUpdateV2 extends BaseMethod {
29775
29893
  DevicePool.clearDeviceCache(uuid);
29776
29894
  }
29777
29895
  delete DevicePool.devicesCache[''];
29778
- yield ((_c = this.checkPromise) === null || _c === void 0 ? void 0 : _c.promise);
29896
+ yield ((_d = this.checkPromise) === null || _d === void 0 ? void 0 : _d.promise);
29779
29897
  this.checkPromise = null;
29780
- (_e = (_d = this.device) === null || _d === void 0 ? void 0 : _d.commands) === null || _e === void 0 ? void 0 : _e.checkDisposed();
29898
+ (_f = (_e = this.device) === null || _e === void 0 ? void 0 : _e.commands) === null || _f === void 0 ? void 0 : _f.checkDisposed();
29781
29899
  const isTouch = DeviceModelToTypes.model_touch.includes(deviceType);
29782
29900
  yield wait(isTouch ? 3000 : 1500);
29783
29901
  }
@@ -29804,15 +29922,16 @@ class FirmwareUpdateV2 extends BaseMethod {
29804
29922
  version: params.version,
29805
29923
  updateType: params.updateType,
29806
29924
  isUpdateBootloader: params.isUpdateBootloader,
29925
+ firmwareType,
29807
29926
  });
29808
29927
  binary = firmware.binary;
29809
29928
  this.postTipMessage('DownloadFirmwareSuccess');
29810
29929
  }
29811
29930
  }
29812
29931
  catch (err) {
29813
- throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.FirmwareUpdateDownloadFailed, (_f = err.message) !== null && _f !== void 0 ? _f : err);
29932
+ throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.FirmwareUpdateDownloadFailed, (_g = err.message) !== null && _g !== void 0 ? _g : err);
29814
29933
  }
29815
- (_h = (_g = this.device) === null || _g === void 0 ? void 0 : _g.commands) === null || _h === void 0 ? void 0 : _h.checkDisposed();
29934
+ (_j = (_h = this.device) === null || _h === void 0 ? void 0 : _h.commands) === null || _j === void 0 ? void 0 : _j.checkDisposed();
29816
29935
  yield this.device.acquire();
29817
29936
  const response = yield uploadFirmware(params.updateType, this.device.getCommands().typedCall.bind(this.device.getCommands()), this.postMessage, device, { payload: binary, rebootOnSuccess: true });
29818
29937
  if (this.connectId) {
@@ -29845,6 +29964,7 @@ class FirmwareUpdateV3 extends FirmwareUpdateBaseMethod {
29845
29964
  { name: 'forcedUpdateRes', type: 'boolean' },
29846
29965
  { name: 'bootloaderVersion', type: 'array' },
29847
29966
  { name: 'bootloaderBinary', type: 'buffer' },
29967
+ { name: 'firmwareType', type: 'string' },
29848
29968
  { name: 'platform', type: 'string' },
29849
29969
  ]);
29850
29970
  this.params = {
@@ -29856,11 +29976,12 @@ class FirmwareUpdateV3 extends FirmwareUpdateBaseMethod {
29856
29976
  bootloaderBinary: payload.bootloaderBinary,
29857
29977
  firmwareVersion: payload.firmwareVersion,
29858
29978
  resourceBinary: payload.resourceBinary,
29979
+ firmwareType: payload.firmwareType,
29859
29980
  platform: payload.platform,
29860
29981
  };
29861
29982
  }
29862
29983
  run() {
29863
- var _a;
29984
+ var _a, _b;
29864
29985
  return __awaiter(this, void 0, void 0, function* () {
29865
29986
  const { device } = this;
29866
29987
  const { features } = device;
@@ -29870,18 +29991,20 @@ class FirmwareUpdateV3 extends FirmwareUpdateBaseMethod {
29870
29991
  if (!features) {
29871
29992
  throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.RuntimeError, 'Device features not available');
29872
29993
  }
29994
+ const deviceFirmwareType = getFirmwareType(features);
29995
+ const firmwareType = (_a = this.params.firmwareType) !== null && _a !== void 0 ? _a : deviceFirmwareType;
29873
29996
  let resourceBinary = null;
29874
29997
  let fwBinaryMap = [];
29875
29998
  let bootloaderBinary = null;
29876
29999
  try {
29877
30000
  this.postTipMessage(exports.FirmwareUpdateTipMessage.StartDownloadFirmware);
29878
- resourceBinary = yield this.prepareResourceBinary();
29879
- fwBinaryMap = yield this.prepareFirmwareAndBleBinary();
29880
- bootloaderBinary = yield this.prepareBootloaderBinary();
30001
+ resourceBinary = yield this.prepareResourceBinary(firmwareType);
30002
+ fwBinaryMap = yield this.prepareFirmwareAndBleBinary(firmwareType);
30003
+ bootloaderBinary = yield this.prepareBootloaderBinary(firmwareType);
29881
30004
  this.postTipMessage(exports.FirmwareUpdateTipMessage.FinishDownloadFirmware);
29882
30005
  }
29883
30006
  catch (err) {
29884
- throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.FirmwareUpdateDownloadFailed, (_a = err.message) !== null && _a !== void 0 ? _a : err);
30007
+ throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.FirmwareUpdateDownloadFailed, (_b = err.message) !== null && _b !== void 0 ? _b : err);
29885
30008
  }
29886
30009
  if (!bootloaderBinary && fwBinaryMap.length === 0) {
29887
30010
  throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.FirmwareUpdateDownloadFailed, 'No firmware to update');
@@ -29906,7 +30029,7 @@ class FirmwareUpdateV3 extends FirmwareUpdateBaseMethod {
29906
30029
  throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.RuntimeError, 'bootloader version needs to be updated');
29907
30030
  }
29908
30031
  }
29909
- prepareResourceBinary() {
30032
+ prepareResourceBinary(firmwareType) {
29910
30033
  return __awaiter(this, void 0, void 0, function* () {
29911
30034
  if (this.params.resourceBinary) {
29912
30035
  return this.params.resourceBinary;
@@ -29914,7 +30037,11 @@ class FirmwareUpdateV3 extends FirmwareUpdateBaseMethod {
29914
30037
  const { features } = this.device;
29915
30038
  if (!features)
29916
30039
  return null;
29917
- const resourceUrl = DataManager.getSysResourcesLatestRelease(features, this.params.forcedUpdateRes);
30040
+ const resourceUrl = DataManager.getSysResourcesLatestRelease({
30041
+ features,
30042
+ forcedUpdateRes: this.params.forcedUpdateRes,
30043
+ firmwareType,
30044
+ });
29918
30045
  if (resourceUrl) {
29919
30046
  const resource = (yield getSysResourceBinary(resourceUrl)).binary;
29920
30047
  return resource;
@@ -29923,7 +30050,7 @@ class FirmwareUpdateV3 extends FirmwareUpdateBaseMethod {
29923
30050
  return null;
29924
30051
  });
29925
30052
  }
29926
- prepareBootloaderBinary() {
30053
+ prepareBootloaderBinary(firmwareType) {
29927
30054
  return __awaiter(this, void 0, void 0, function* () {
29928
30055
  if (this.params.bootloaderBinary) {
29929
30056
  return this.params.bootloaderBinary;
@@ -29932,7 +30059,7 @@ class FirmwareUpdateV3 extends FirmwareUpdateBaseMethod {
29932
30059
  if (!features)
29933
30060
  return null;
29934
30061
  if (this.params.bootloaderVersion) {
29935
- const bootResourceUrl = DataManager.getBootloaderResource(features);
30062
+ const bootResourceUrl = DataManager.getBootloaderResource(features, firmwareType);
29936
30063
  if (bootResourceUrl) {
29937
30064
  const bootBinary = (yield getSysResourceBinary(bootResourceUrl)).binary;
29938
30065
  return bootBinary;
@@ -29941,7 +30068,7 @@ class FirmwareUpdateV3 extends FirmwareUpdateBaseMethod {
29941
30068
  return null;
29942
30069
  });
29943
30070
  }
29944
- prepareFirmwareAndBleBinary() {
30071
+ prepareFirmwareAndBleBinary(firmwareType) {
29945
30072
  return __awaiter(this, void 0, void 0, function* () {
29946
30073
  const fwBinaryMap = [];
29947
30074
  if (this.params.firmwareBinary) {
@@ -29958,6 +30085,7 @@ class FirmwareUpdateV3 extends FirmwareUpdateBaseMethod {
29958
30085
  version: this.params.firmwareVersion,
29959
30086
  updateType: 'firmware',
29960
30087
  isUpdateBootloader: false,
30088
+ firmwareType,
29961
30089
  })).binary;
29962
30090
  fwBinaryMap.push({
29963
30091
  fileName: 'firmware.bin',
@@ -29978,6 +30106,7 @@ class FirmwareUpdateV3 extends FirmwareUpdateBaseMethod {
29978
30106
  features,
29979
30107
  version: this.params.bleVersion,
29980
30108
  updateType: 'ble',
30109
+ firmwareType,
29981
30110
  });
29982
30111
  fwBinaryMap.push({
29983
30112
  fileName: 'ble-firmware.bin',
@@ -33030,12 +33159,8 @@ class EVMSignTypedData extends BaseMethod {
33030
33159
  return false;
33031
33160
  let biggerLimit = 1024;
33032
33161
  const currentVersion = getDeviceFirmwareVersion(this.device.features).join('.');
33033
- const currentDeviceType = getDeviceType(this.device.features);
33034
33162
  const supportBiggerDataVersion = '4.4.0';
33035
- const supportBiggerData = DeviceModelToTypes.model_classic1s.includes(currentDeviceType) ||
33036
- (DeviceModelToTypes.model_touch.includes(currentDeviceType) &&
33037
- semver__default["default"].gte(currentVersion, supportBiggerDataVersion));
33038
- if (supportBiggerData) {
33163
+ if (semver__default["default"].gte(currentVersion, supportBiggerDataVersion)) {
33039
33164
  biggerLimit = 1536;
33040
33165
  }
33041
33166
  const startIndex = data.startsWith('0x') ? 2 : 0;
@@ -39337,7 +39462,8 @@ const onCallDevice = (context, message, method) => __awaiter(void 0, void 0, voi
39337
39462
  throw hdShared.createDefectiveFirmwareError(defectiveInfo.serialNo, defectiveInfo.seVersion || 'Unknown', defectiveInfo.deviceType, method.connectId, method.deviceId);
39338
39463
  }
39339
39464
  }
39340
- const newVersionStatus = DataManager.getFirmwareStatus(device.features);
39465
+ const deviceFirmwareType = getFirmwareType(device.features);
39466
+ const newVersionStatus = DataManager.getFirmwareStatus(device.features, deviceFirmwareType);
39341
39467
  const bleVersionStatus = DataManager.getBLEFirmwareStatus(device.features);
39342
39468
  const currentFirmwareVersion = getDeviceFirmwareVersion(device.features).join('.');
39343
39469
  const currentBleVersion = getDeviceBLEFirmwareVersion(device.features).join('.');