@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
@@ -1,164 +1,131 @@
1
- import { off, on, removeAllListeners } from './event';
2
- import { uiResponse } from './uiResponse';
3
- import { init, updateSettings } from './init';
4
-
5
- import { testInitializeDeviceDuration } from './testInitializeDeviceDuration';
6
-
7
- import { getLogs } from './getLogs';
8
- import { checkBridgeStatus } from './checkBridgeStatus';
9
- import { checkBridgeRelease } from './checkBridgeRelease';
10
- import { checkBootloaderRelease } from './checkBootloaderRelease';
11
- import { checkAllFirmwareRelease } from './checkAllFirmwareRelease';
12
-
13
- import { searchDevices } from './searchDevices';
14
- import { getFeatures } from './getFeatures';
15
- import { getOnekeyFeatures } from './getOnekeyFeatures';
16
- import { getPassphraseState } from './getPassphraseState';
17
- import { checkFirmwareRelease } from './checkFirmwareRelease';
18
- import { checkBLEFirmwareRelease } from './checkBLEFirmwareRelease';
19
- import { firmwareUpdate, firmwareUpdateV2, firmwareUpdateV3 } from './firmwareUpdate';
20
- import { promptWebDeviceAccess } from './promptWebDeviceAccess';
21
-
22
- import { deviceReset } from './deviceReset';
23
- import { deviceRecovery } from './deviceRecovery';
24
- import { deviceVerify } from './deviceVerify';
25
- import { deviceWipe } from './deviceWipe';
26
- import { deviceRebootToBootloader } from './deviceRebootToBootloader';
27
- import { deviceRebootToBoardloader } from './deviceRebootToBoardloader';
28
- import { deviceBackup } from './deviceBackup';
29
- import { deviceChangePin } from './deviceChangePin';
30
- import { deviceSettings } from './deviceSettings';
31
- import { deviceFlags } from './deviceFlags';
32
- import { deviceUpdateReboot } from './deviceUpdateReboot';
33
- import { deviceUploadResource } from './deviceUploadResource';
34
- import { deviceSupportFeatures } from './deviceSupportFeatures';
35
- import { deviceFullyUploadResource } from './deviceFullyUploadResource';
36
- import { deviceUpdateBootloader } from './deviceUpdateBootloader';
37
- import { deviceLock } from './deviceLock';
38
- import { deviceUnlock } from './deviceUnlock';
39
- import { deviceCancel } from './deviceCancel';
40
-
41
- import { getNextU2FCounter } from './getNextU2FCounter';
42
- import { setU2FCounter } from './setU2FCounter';
43
-
44
- import { cipherKeyValue } from './cipherKeyValue';
45
-
46
- import { allNetworkGetAddress, allNetworkGetAddressByLoop } from './allNetworkGetAddress';
47
-
48
- import { evmGetAddress } from './evmGetAddress';
49
- import { evmGetPublicKey } from './evmGetPublicKey';
50
- import { evmSignMessage } from './evmSignMessage';
51
- import { evmSignMessageEIP712 } from './evmSignMessageEIP712';
52
- import { evmSignTransaction } from './evmSignTransaction';
53
- import { evmSignTypedData } from './evmSignTypedData';
54
- import { evmVerifyMessage } from './evmVerifyMessage';
55
-
56
- import { btcGetAddress } from './btcGetAddress';
57
- import { btcGetPublicKey } from './btcGetPublicKey';
58
- import { btcSignMessage } from './btcSignMessage';
59
- import { btcSignPsbt } from './btcSignPsbt';
60
- import { btcSignTransaction } from './btcSignTransaction';
61
- import { btcVerifyMessage } from './btcVerifyMessage';
62
-
63
- import { starcoinGetAddress } from './starcoinGetAddress';
64
- import { starcoinGetPublicKey } from './starcoinGetPublicKey';
65
- import { starcoinSignMessage } from './starcoinSignMessage';
66
- import { starcoinSignTransaction } from './starcoinSignTransaction';
67
- import { starcoinVerifyMessage } from './starcoinVerifyMessage';
68
-
69
- import { nemGetAddress } from './nemGetAddress';
70
- import { nemSignTransaction } from './nemSignTransaction';
71
-
72
- import { solGetAddress } from './solGetAddress';
73
- import { solSignTransaction } from './solSignTransaction';
74
- import { solSignOffchainMessage } from './solSignOffchainMessage';
75
- import { solSignMessage } from './solSignMessage';
76
-
77
- import { stellarGetAddress } from './stellarGetAddress';
78
- import { stellarSignTransaction } from './stellarSignTransaction';
79
-
80
- import { tronGetAddress } from './tronGetAddress';
81
- import { tronSignTransaction } from './tronSignTransaction';
82
- import { tronSignMessage } from './tronSignMessage';
83
-
84
- import { confluxGetAddress } from './confluxGetAddress';
85
- import { confluxSignMessage } from './confluxSignMessage';
86
- import { confluxSignMessageCIP23 } from './confluxSignMessageCIP23';
87
- import { confluxSignTransaction } from './confluxSignTransaction';
88
-
89
- import { nearGetAddress } from './nearGetAddress';
90
- import { nearSignTransaction } from './nearSignTransaction';
91
-
92
- import { aptosGetAddress } from './aptosGetAddress';
93
- import { aptosGetPublicKey } from './aptosGetPublicKey';
94
- import { aptosSignMessage } from './aptosSignMessage';
95
- import { aptosSignInMessage } from './aptosSignInMessage';
96
- import { aptosSignTransaction } from './aptosSignTransaction';
97
-
98
- import { algoGetAddress } from './algoGetAddress';
99
- import { algoSignTransaction } from './algoSignTransaction';
100
-
101
- import { cosmosGetAddress } from './cosmosGetAddress';
102
- import { cosmosGetPublicKey } from './cosmosGetPublicKey';
103
- import { cosmosSignTransaction } from './cosmosSignTransaction';
104
-
105
- import { xrpGetAddress } from './xrpGetAddress';
106
- import { xrpSignTransaction } from './xrpSignTransaction';
107
-
108
- import { suiGetAddress } from './suiGetAddress';
109
- import { suiGetPublicKey } from './suiGetPublicKey';
110
- import { suiSignMessage } from './suiSignMessage';
111
- import { suiSignTransaction } from './suiSignTransaction';
112
-
113
- import { cardanoGetAddress } from './cardanoGetAddress';
114
- import { cardanoGetPublicKey } from './cardanoGetPublicKey';
115
- import { cardanoSignTransaction } from './cardanoSignTransaction';
116
- import { cardanoSignMessage } from './cardanoSignMessage';
117
-
118
- import { filecoinGetAddress } from './filecoinGetAddress';
119
- import { filecoinSignTransaction } from './filecoinSignTransaction';
120
-
121
- import { polkadotGetAddress } from './polkadotGetAddress';
122
- import { polkadotSignTransaction } from './polkadotSignTransaction';
123
-
124
- import { kaspaGetAddress } from './kaspaGetAddress';
125
- import { kaspaSignTransaction } from './kaspaSignTransaction';
126
-
127
- import { nexaGetAddress } from './nexaGetAddress';
128
- import { nexaSignTransaction } from './nexaSignTransaction';
129
-
130
- import { nostrGetPublicKey } from './nostrGetPublicKey';
131
- import { nostrSignEvent } from './nostrSignEvent';
132
- import { nostrEncryptMessage } from './nostrEncryptMessage';
133
- import { nostrDecryptMessage } from './nostrDecryptMessage';
134
- import { nostrSignSchnorr } from './nostrSignSchnorr';
135
-
136
- import { lnurlAuth } from './lnurlAuth';
137
- import { nervosGetAddress } from './nervosGetAddress';
138
- import { nervosSignTransaction } from './nervosSignTransaction';
139
-
140
- import { dnxGetAddress } from './dnxGetAddress';
141
- import { dnxSignTransaction } from './dnxSignTransaction';
142
-
143
- import { tonGetAddress } from './tonGetAddress';
144
- import { tonSignMessage } from './tonSignMessage';
145
- import { tonSignProof } from './tonSignProof';
146
-
147
- import { scdoGetAddress } from './scdoGetAddress';
148
- import { scdoSignMessage } from './scdoSignMessage';
149
- import { scdoSignTransaction } from './scdoSignTransaction';
150
- import { alephiumGetAddress } from './alephiumGetAddress';
151
- import { alephiumSignMessage } from './alephiumSignMessage';
152
- import { alephiumSignTransaction } from './alephiumSignTransaction';
153
-
154
- import { benfenGetAddress } from './benfenGetAddress';
155
- import { benfenGetPublicKey } from './benfenGetPublicKey';
156
- import { benfenSignTransaction } from './benfenSignTransaction';
157
- import { benfenSignMessage } from './benfenSignMessage';
158
-
159
- import { neoGetAddress } from './neoGetAddress';
160
- import { neoSignTransaction } from './neoSignTransaction';
161
- import { ConnectSettings } from '../settings';
1
+ import type { off, on, removeAllListeners } from './event';
2
+ import type { uiResponse } from './uiResponse';
3
+ import type { init, updateSettings } from './init';
4
+ import type { testInitializeDeviceDuration } from './testInitializeDeviceDuration';
5
+ import type { getLogs } from './getLogs';
6
+ import type { checkBridgeStatus } from './checkBridgeStatus';
7
+ import type { checkBridgeRelease } from './checkBridgeRelease';
8
+ import type { checkBootloaderRelease } from './checkBootloaderRelease';
9
+ import type { checkAllFirmwareRelease } from './checkAllFirmwareRelease';
10
+ import type { searchDevices } from './searchDevices';
11
+ import type { getFeatures } from './getFeatures';
12
+ import type { getOnekeyFeatures } from './getOnekeyFeatures';
13
+ import type { getPassphraseState } from './getPassphraseState';
14
+ import type { checkFirmwareRelease } from './checkFirmwareRelease';
15
+ import type { checkBLEFirmwareRelease } from './checkBLEFirmwareRelease';
16
+ import type { firmwareUpdate, firmwareUpdateV2, firmwareUpdateV3 } from './firmwareUpdate';
17
+ import type { promptWebDeviceAccess } from './promptWebDeviceAccess';
18
+ import type { deviceReset } from './deviceReset';
19
+ import type { deviceRecovery } from './deviceRecovery';
20
+ import type { deviceVerify } from './deviceVerify';
21
+ import type { deviceWipe } from './deviceWipe';
22
+ import type { deviceRebootToBootloader } from './deviceRebootToBootloader';
23
+ import type { deviceRebootToBoardloader } from './deviceRebootToBoardloader';
24
+ import type { deviceBackup } from './deviceBackup';
25
+ import type { deviceChangePin } from './deviceChangePin';
26
+ import type { deviceSettings } from './deviceSettings';
27
+ import type { deviceFlags } from './deviceFlags';
28
+ import type { deviceUpdateReboot } from './deviceUpdateReboot';
29
+ import type { deviceUploadResource } from './deviceUploadResource';
30
+ import type { deviceSupportFeatures } from './deviceSupportFeatures';
31
+ import type { deviceFullyUploadResource } from './deviceFullyUploadResource';
32
+ import type { deviceUpdateBootloader } from './deviceUpdateBootloader';
33
+ import type { deviceLock } from './deviceLock';
34
+ import type { deviceUnlock } from './deviceUnlock';
35
+ import type { deviceCancel } from './deviceCancel';
36
+ import type { getNextU2FCounter } from './getNextU2FCounter';
37
+ import type { setU2FCounter } from './setU2FCounter';
38
+ import type { cipherKeyValue } from './cipherKeyValue';
39
+ import type { allNetworkGetAddress, allNetworkGetAddressByLoop } from './allNetworkGetAddress';
40
+ import type { evmGetAddress } from './evmGetAddress';
41
+ import type { evmGetPublicKey } from './evmGetPublicKey';
42
+ import type { evmSignMessage } from './evmSignMessage';
43
+ import type { evmSignMessageEIP712 } from './evmSignMessageEIP712';
44
+ import type { evmSignTransaction } from './evmSignTransaction';
45
+ import type { evmSignTypedData } from './evmSignTypedData';
46
+ import type { evmVerifyMessage } from './evmVerifyMessage';
47
+ import type { btcGetAddress } from './btcGetAddress';
48
+ import type { btcGetPublicKey } from './btcGetPublicKey';
49
+ import type { btcSignMessage } from './btcSignMessage';
50
+ import type { btcSignPsbt } from './btcSignPsbt';
51
+ import type { btcSignTransaction } from './btcSignTransaction';
52
+ import type { btcVerifyMessage } from './btcVerifyMessage';
53
+ import type { starcoinGetAddress } from './starcoinGetAddress';
54
+ import type { starcoinGetPublicKey } from './starcoinGetPublicKey';
55
+ import type { starcoinSignMessage } from './starcoinSignMessage';
56
+ import type { starcoinSignTransaction } from './starcoinSignTransaction';
57
+ import type { starcoinVerifyMessage } from './starcoinVerifyMessage';
58
+ import type { nemGetAddress } from './nemGetAddress';
59
+ import type { nemSignTransaction } from './nemSignTransaction';
60
+ import type { solGetAddress } from './solGetAddress';
61
+ import type { solSignTransaction } from './solSignTransaction';
62
+ import type { solSignOffchainMessage } from './solSignOffchainMessage';
63
+ import type { solSignMessage } from './solSignMessage';
64
+ import type { stellarGetAddress } from './stellarGetAddress';
65
+ import type { stellarSignTransaction } from './stellarSignTransaction';
66
+ import type { tronGetAddress } from './tronGetAddress';
67
+ import type { tronSignTransaction } from './tronSignTransaction';
68
+ import type { tronSignMessage } from './tronSignMessage';
69
+ import type { confluxGetAddress } from './confluxGetAddress';
70
+ import type { confluxSignMessage } from './confluxSignMessage';
71
+ import type { confluxSignMessageCIP23 } from './confluxSignMessageCIP23';
72
+ import type { confluxSignTransaction } from './confluxSignTransaction';
73
+ import type { nearGetAddress } from './nearGetAddress';
74
+ import type { nearSignTransaction } from './nearSignTransaction';
75
+ import type { aptosGetAddress } from './aptosGetAddress';
76
+ import type { aptosGetPublicKey } from './aptosGetPublicKey';
77
+ import type { aptosSignMessage } from './aptosSignMessage';
78
+ import type { aptosSignInMessage } from './aptosSignInMessage';
79
+ import type { aptosSignTransaction } from './aptosSignTransaction';
80
+ import type { algoGetAddress } from './algoGetAddress';
81
+ import type { algoSignTransaction } from './algoSignTransaction';
82
+ import type { cosmosGetAddress } from './cosmosGetAddress';
83
+ import type { cosmosGetPublicKey } from './cosmosGetPublicKey';
84
+ import type { cosmosSignTransaction } from './cosmosSignTransaction';
85
+ import type { xrpGetAddress } from './xrpGetAddress';
86
+ import type { xrpSignTransaction } from './xrpSignTransaction';
87
+ import type { suiGetAddress } from './suiGetAddress';
88
+ import type { suiGetPublicKey } from './suiGetPublicKey';
89
+ import type { suiSignMessage } from './suiSignMessage';
90
+ import type { suiSignTransaction } from './suiSignTransaction';
91
+ import type { cardanoGetAddress } from './cardanoGetAddress';
92
+ import type { cardanoGetPublicKey } from './cardanoGetPublicKey';
93
+ import type { cardanoSignTransaction } from './cardanoSignTransaction';
94
+ import type { cardanoSignMessage } from './cardanoSignMessage';
95
+ import type { filecoinGetAddress } from './filecoinGetAddress';
96
+ import type { filecoinSignTransaction } from './filecoinSignTransaction';
97
+ import type { polkadotGetAddress } from './polkadotGetAddress';
98
+ import type { polkadotSignTransaction } from './polkadotSignTransaction';
99
+ import type { kaspaGetAddress } from './kaspaGetAddress';
100
+ import type { kaspaSignTransaction } from './kaspaSignTransaction';
101
+ import type { nexaGetAddress } from './nexaGetAddress';
102
+ import type { nexaSignTransaction } from './nexaSignTransaction';
103
+ import type { nostrGetPublicKey } from './nostrGetPublicKey';
104
+ import type { nostrSignEvent } from './nostrSignEvent';
105
+ import type { nostrEncryptMessage } from './nostrEncryptMessage';
106
+ import type { nostrDecryptMessage } from './nostrDecryptMessage';
107
+ import type { nostrSignSchnorr } from './nostrSignSchnorr';
108
+ import type { lnurlAuth } from './lnurlAuth';
109
+ import type { nervosGetAddress } from './nervosGetAddress';
110
+ import type { nervosSignTransaction } from './nervosSignTransaction';
111
+ import type { dnxGetAddress } from './dnxGetAddress';
112
+ import type { dnxSignTransaction } from './dnxSignTransaction';
113
+ import type { tonGetAddress } from './tonGetAddress';
114
+ import type { tonSignMessage } from './tonSignMessage';
115
+ import type { tonSignProof } from './tonSignProof';
116
+ import type { scdoGetAddress } from './scdoGetAddress';
117
+ import type { scdoSignMessage } from './scdoSignMessage';
118
+ import type { scdoSignTransaction } from './scdoSignTransaction';
119
+ import type { alephiumGetAddress } from './alephiumGetAddress';
120
+ import type { alephiumSignMessage } from './alephiumSignMessage';
121
+ import type { alephiumSignTransaction } from './alephiumSignTransaction';
122
+ import type { benfenGetAddress } from './benfenGetAddress';
123
+ import type { benfenGetPublicKey } from './benfenGetPublicKey';
124
+ import type { benfenSignTransaction } from './benfenSignTransaction';
125
+ import type { benfenSignMessage } from './benfenSignMessage';
126
+ import type { neoGetAddress } from './neoGetAddress';
127
+ import type { neoSignTransaction } from './neoSignTransaction';
128
+ import type { ConnectSettings } from '../settings';
162
129
 
163
130
  export * from './export';
164
131
 
@@ -1,6 +1,7 @@
1
1
  import { EDeviceType } from '@onekeyfe/hd-shared';
2
+
3
+ import type { IVersionArray } from './settings';
2
4
  import type { PROTO } from '../constants';
3
- import { IVersionArray } from './settings';
4
5
 
5
6
  export type DeviceStatus = 'available' | 'occupied' | 'used';
6
7
 
@@ -1,3 +1,4 @@
1
+ import type { EFirmwareType } from '@onekeyfe/hd-shared';
1
2
  import type { IDeviceType } from './device';
2
3
 
3
4
  export type transportEnv =
@@ -40,6 +41,11 @@ export type ILocale = 'zh-CN' | 'en-US';
40
41
  export type IFirmwareReleaseInfo = {
41
42
  required: boolean;
42
43
  url: string;
44
+ /**
45
+ * Firmware type (bitcoinonly or universal)
46
+ * This field is not present in the remote config, but will be inferred from the firmware field name
47
+ */
48
+ firmwareType?: EFirmwareType;
43
49
  /** Firmware UI resource */
44
50
  resource?: string;
45
51
  /** Firmware full UI resource */
@@ -75,11 +81,42 @@ export type IBLEFirmwareReleaseInfo = {
75
81
  };
76
82
 
77
83
  type IKnownDevice = Exclude<IDeviceType, 'unknown'>;
84
+
85
+ /**
86
+ * Device firmware configuration map
87
+ *
88
+ * IMPORTANT: This type is used for firmware update logic.
89
+ * - DO NOT remove existing firmware fields
90
+ * - Only ADD new optional firmware fields for new versions
91
+ * - 'firmware' field is required for backward compatibility
92
+ * - 'ble' field is required for BLE firmware updates
93
+ *
94
+ * @example
95
+ * // When adding firmware-v8:
96
+ * // {
97
+ * // firmware: IFirmwareReleaseInfo[];
98
+ * // 'firmware-v2'?: IFirmwareReleaseInfo[];
99
+ * // 'firmware-v7'?: IFirmwareReleaseInfo[];
100
+ * // 'firmware-v8'?: IFirmwareReleaseInfo[]; // New
101
+ * // 'firmware-btc-v7'?: IFirmwareReleaseInfo[];
102
+ * // 'firmware-btc-v8'?: IFirmwareReleaseInfo[]; // New
103
+ * // ble: IBLEFirmwareReleaseInfo[];
104
+ * // }
105
+ */
78
106
  export type DeviceTypeMap = {
79
107
  [k in IKnownDevice]: {
108
+ /** Base firmware field (required for backward compatibility) */
80
109
  firmware: IFirmwareReleaseInfo[];
110
+ /** Firmware v2 (Touch/Pro specific) */
81
111
  'firmware-v2'?: IFirmwareReleaseInfo[];
112
+ /** Universal firmware v7 */
82
113
  'firmware-v7'?: IFirmwareReleaseInfo[];
114
+ /** Bitcoin-only firmware v7 */
115
+ 'firmware-btc-v7'?: IFirmwareReleaseInfo[];
116
+ // Future firmware versions should be added here as optional fields:
117
+ // 'firmware-v8'?: IFirmwareReleaseInfo[];
118
+ // 'firmware-btc-v8'?: IFirmwareReleaseInfo[];
119
+ /** BLE firmware (required) */
83
120
  ble: IBLEFirmwareReleaseInfo[];
84
121
  };
85
122
  };
@@ -1,18 +1,20 @@
1
1
  import semver from 'semver';
2
2
  import { isNaN } from 'lodash';
3
- import { EDeviceType, ERRORS, HardwareErrorCode } from '@onekeyfe/hd-shared';
3
+ import { EDeviceType, type EFirmwareType, ERRORS, HardwareErrorCode } from '@onekeyfe/hd-shared';
4
4
  import { Enum_Capability } from '@onekeyfe/hd-transport';
5
+
5
6
  import { toHardened } from '../api/helpers/pathUtils';
6
- import { DeviceCommands } from '../device/DeviceCommands';
7
- import type { Features, SupportFeatureType } from '../types';
8
7
  import { DeviceModelToTypes, DeviceTypeToModels } from '../types';
9
- import DataManager, { IFirmwareField, MessageVersion } from '../data-manager/DataManager';
8
+ import DataManager, { type IFirmwareField, type MessageVersion } from '../data-manager/DataManager';
10
9
  import { PROTOBUF_MESSAGE_CONFIG } from '../data-manager/MessagesConfig';
11
- import { Device } from '../device/Device';
12
10
  import { getDeviceType } from './deviceInfoUtils';
13
11
  import { getDeviceFirmwareVersion } from './deviceVersionUtils';
14
12
  import { existCapability } from './capabilitieUtils';
15
13
 
14
+ import type { Device } from '../device/Device';
15
+ import type { DeviceCommands } from '../device/DeviceCommands';
16
+ import type { Features, SupportFeatureType } from '../types';
17
+
16
18
  export const getSupportMessageVersion = (
17
19
  features: Features | undefined
18
20
  ): { messages: JSON; messageVersion: MessageVersion } => {
@@ -231,6 +233,13 @@ export const supportModifyHomescreen = (features?: Features): SupportFeatureType
231
233
  return { support: semver.gte(currentVersion, '3.4.0') };
232
234
  };
233
235
 
236
+ const getLatestFirmwareField = (firmwareType?: EFirmwareType): IFirmwareField => {
237
+ if (firmwareType === 'bitcoinonly') {
238
+ return `firmware-btc-v7`;
239
+ }
240
+ return `firmware-v7`;
241
+ };
242
+
234
243
  /**
235
244
  * Since 3.5.0, Touch uses the firmware-v3 field to get firmware release info
236
245
  */
@@ -238,33 +247,36 @@ export const getFirmwareUpdateField = ({
238
247
  features,
239
248
  updateType,
240
249
  targetVersion,
250
+ firmwareType,
241
251
  }: {
242
252
  features: Features;
243
253
  updateType: 'firmware' | 'ble';
244
254
  targetVersion?: string;
255
+ firmwareType: EFirmwareType;
245
256
  }): 'ble' | IFirmwareField => {
246
257
  const deviceType = getDeviceType(features);
247
258
  const deviceFirmwareVersion = getDeviceFirmwareVersion(features);
248
259
  if (updateType === 'ble') {
249
260
  return 'ble';
250
261
  }
262
+ const latestFirmwareField = getLatestFirmwareField(firmwareType);
251
263
 
252
264
  if (DeviceModelToTypes.model_mini.includes(deviceType)) {
253
- return 'firmware-v7';
265
+ return latestFirmwareField;
254
266
  }
255
267
 
256
268
  if (deviceType === EDeviceType.Touch) {
257
269
  if (targetVersion) {
258
270
  if (semver.eq(targetVersion, '4.0.0')) return 'firmware-v2';
259
- if (semver.gt(targetVersion, '4.0.0')) return 'firmware-v7';
271
+ if (semver.gt(targetVersion, '4.0.0')) return latestFirmwareField;
260
272
  }
261
273
 
262
274
  if (semver.lt(deviceFirmwareVersion.join('.'), '3.4.0')) return 'firmware';
263
275
 
264
- return 'firmware-v7';
276
+ return latestFirmwareField;
265
277
  }
266
278
  if (deviceType === EDeviceType.Pro) {
267
- return 'firmware-v7';
279
+ return latestFirmwareField;
268
280
  }
269
281
  return 'firmware';
270
282
  };
@@ -276,7 +288,7 @@ export const getFirmwareUpdateField = ({
276
288
  export const getFirmwareUpdateFieldArray = (
277
289
  features: Features,
278
290
  updateType: 'firmware' | 'ble' | 'bootloader'
279
- ): ('firmware' | 'ble' | 'firmware-v2' | 'firmware-v7')[] => {
291
+ ): ('ble' | IFirmwareField)[] => {
280
292
  const deviceType = getDeviceType(features);
281
293
  if (updateType === 'ble') {
282
294
  return ['ble'];
@@ -1,5 +1,6 @@
1
1
  import semver from 'semver';
2
- import {
2
+
3
+ import type {
3
4
  IBLEFirmwareReleaseInfo,
4
5
  IDeviceFirmwareStatus,
5
6
  IFirmwareReleaseInfo,