@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.
- package/dist/api/BaseMethod.d.ts +4 -4
- package/dist/api/BaseMethod.d.ts.map +1 -1
- package/dist/api/CheckAllFirmwareRelease.d.ts +1 -1
- package/dist/api/CheckAllFirmwareRelease.d.ts.map +1 -1
- package/dist/api/CheckBootloaderRelease.d.ts.map +1 -1
- package/dist/api/CheckFirmwareRelease.d.ts.map +1 -1
- package/dist/api/FirmwareUpdate.d.ts +1 -1
- package/dist/api/FirmwareUpdate.d.ts.map +1 -1
- package/dist/api/FirmwareUpdateV2.d.ts +3 -2
- package/dist/api/FirmwareUpdateV2.d.ts.map +1 -1
- package/dist/api/FirmwareUpdateV3.d.ts +2 -2
- package/dist/api/FirmwareUpdateV3.d.ts.map +1 -1
- package/dist/api/allnetwork/AllNetworkGetAddressBase.d.ts +2 -2
- package/dist/api/allnetwork/AllNetworkGetAddressBase.d.ts.map +1 -1
- package/dist/api/device/DeviceFullyUploadResource.d.ts.map +1 -1
- package/dist/api/device/DeviceUpdateBootloader.d.ts +6 -1
- package/dist/api/device/DeviceUpdateBootloader.d.ts.map +1 -1
- package/dist/api/evm/EVMSignTypedData.d.ts.map +1 -1
- package/dist/api/firmware/getBinary.d.ts +6 -3
- package/dist/api/firmware/getBinary.d.ts.map +1 -1
- package/dist/api/firmware/releaseHelper.d.ts +7 -2
- package/dist/api/firmware/releaseHelper.d.ts.map +1 -1
- package/dist/api/firmware/updateBootloader.d.ts +7 -2
- package/dist/api/firmware/updateBootloader.d.ts.map +1 -1
- package/dist/api/sui/SuiSignTransaction.d.ts +1 -1
- package/dist/api/sui/SuiSignTransaction.d.ts.map +1 -1
- package/dist/core/index.d.ts.map +1 -1
- package/dist/data-manager/DataManager.d.ts +16 -9
- package/dist/data-manager/DataManager.d.ts.map +1 -1
- package/dist/events/device.d.ts +2 -2
- package/dist/events/device.d.ts.map +1 -1
- package/dist/index.d.ts +45 -22
- package/dist/index.js +201 -75
- package/dist/types/api/checkAllFirmwareRelease.d.ts +5 -1
- package/dist/types/api/checkAllFirmwareRelease.d.ts.map +1 -1
- package/dist/types/api/checkBootloaderRelease.d.ts +5 -2
- package/dist/types/api/checkBootloaderRelease.d.ts.map +1 -1
- package/dist/types/api/checkFirmwareRelease.d.ts +6 -2
- package/dist/types/api/checkFirmwareRelease.d.ts.map +1 -1
- package/dist/types/api/deviceFullyUploadResource.d.ts +6 -1
- package/dist/types/api/deviceFullyUploadResource.d.ts.map +1 -1
- package/dist/types/api/deviceUpdateBootloader.d.ts +6 -3
- package/dist/types/api/deviceUpdateBootloader.d.ts.map +1 -1
- package/dist/types/api/firmwareUpdate.d.ts +3 -1
- package/dist/types/api/firmwareUpdate.d.ts.map +1 -1
- package/dist/types/api/index.d.ts +128 -128
- package/dist/types/api/index.d.ts.map +1 -1
- package/dist/types/device.d.ts +1 -1
- package/dist/types/device.d.ts.map +1 -1
- package/dist/types/settings.d.ts +3 -0
- package/dist/types/settings.d.ts.map +1 -1
- package/dist/utils/deviceFeaturesUtils.d.ts +7 -5
- package/dist/utils/deviceFeaturesUtils.d.ts.map +1 -1
- package/dist/utils/release.d.ts +1 -1
- package/dist/utils/release.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/api/BaseMethod.ts +17 -7
- package/src/api/CheckAllFirmwareRelease.ts +14 -6
- package/src/api/CheckBootloaderRelease.ts +13 -2
- package/src/api/CheckFirmwareRelease.ts +9 -2
- package/src/api/FirmwareUpdate.ts +7 -5
- package/src/api/FirmwareUpdateV2.ts +26 -14
- package/src/api/FirmwareUpdateV3.ts +29 -18
- package/src/api/allnetwork/AllNetworkGetAddressBase.ts +10 -11
- package/src/api/device/DeviceFullyUploadResource.ts +8 -2
- package/src/api/device/DeviceUpdateBootloader.ts +21 -5
- package/src/api/evm/EVMSignTypedData.ts +2 -8
- package/src/api/firmware/getBinary.ts +15 -4
- package/src/api/firmware/releaseHelper.ts +22 -11
- package/src/api/firmware/updateBootloader.ts +17 -9
- package/src/api/sui/SuiSignTransaction.ts +7 -1
- package/src/core/index.ts +3 -1
- package/src/data-manager/DataManager.ts +126 -22
- package/src/events/device.ts +2 -2
- package/src/types/api/checkAllFirmwareRelease.ts +5 -1
- package/src/types/api/checkBootloaderRelease.ts +7 -3
- package/src/types/api/checkFirmwareRelease.ts +10 -2
- package/src/types/api/deviceFullyUploadResource.ts +7 -1
- package/src/types/api/deviceUpdateBootloader.ts +8 -4
- package/src/types/api/firmwareUpdate.ts +4 -1
- package/src/types/api/index.ts +128 -161
- package/src/types/device.ts +2 -1
- package/src/types/settings.ts +37 -0
- package/src/utils/deviceFeaturesUtils.ts +22 -10
- package/src/utils/release.ts +2 -1
package/src/types/api/index.ts
CHANGED
|
@@ -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 {
|
|
6
|
-
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
28
|
-
import {
|
|
29
|
-
import {
|
|
30
|
-
import {
|
|
31
|
-
import {
|
|
32
|
-
import {
|
|
33
|
-
import {
|
|
34
|
-
import {
|
|
35
|
-
import {
|
|
36
|
-
import {
|
|
37
|
-
import {
|
|
38
|
-
import {
|
|
39
|
-
import {
|
|
40
|
-
|
|
41
|
-
import {
|
|
42
|
-
import {
|
|
43
|
-
|
|
44
|
-
import {
|
|
45
|
-
|
|
46
|
-
import {
|
|
47
|
-
|
|
48
|
-
import {
|
|
49
|
-
import {
|
|
50
|
-
import {
|
|
51
|
-
import {
|
|
52
|
-
import {
|
|
53
|
-
import {
|
|
54
|
-
import {
|
|
55
|
-
|
|
56
|
-
import {
|
|
57
|
-
import {
|
|
58
|
-
import {
|
|
59
|
-
import {
|
|
60
|
-
import {
|
|
61
|
-
import {
|
|
62
|
-
|
|
63
|
-
import {
|
|
64
|
-
import {
|
|
65
|
-
import {
|
|
66
|
-
import {
|
|
67
|
-
import {
|
|
68
|
-
|
|
69
|
-
import {
|
|
70
|
-
import {
|
|
71
|
-
|
|
72
|
-
import {
|
|
73
|
-
import {
|
|
74
|
-
import {
|
|
75
|
-
import {
|
|
76
|
-
|
|
77
|
-
import {
|
|
78
|
-
import {
|
|
79
|
-
|
|
80
|
-
import {
|
|
81
|
-
import {
|
|
82
|
-
import {
|
|
83
|
-
|
|
84
|
-
import {
|
|
85
|
-
import {
|
|
86
|
-
import {
|
|
87
|
-
import {
|
|
88
|
-
|
|
89
|
-
import {
|
|
90
|
-
import {
|
|
91
|
-
|
|
92
|
-
import {
|
|
93
|
-
import {
|
|
94
|
-
import {
|
|
95
|
-
import {
|
|
96
|
-
import {
|
|
97
|
-
|
|
98
|
-
import {
|
|
99
|
-
import {
|
|
100
|
-
|
|
101
|
-
import {
|
|
102
|
-
import {
|
|
103
|
-
import {
|
|
104
|
-
|
|
105
|
-
import {
|
|
106
|
-
import {
|
|
107
|
-
|
|
108
|
-
import {
|
|
109
|
-
import {
|
|
110
|
-
import {
|
|
111
|
-
import {
|
|
112
|
-
|
|
113
|
-
import {
|
|
114
|
-
import {
|
|
115
|
-
import {
|
|
116
|
-
import {
|
|
117
|
-
|
|
118
|
-
import {
|
|
119
|
-
import {
|
|
120
|
-
|
|
121
|
-
import {
|
|
122
|
-
import {
|
|
123
|
-
|
|
124
|
-
import {
|
|
125
|
-
import {
|
|
126
|
-
|
|
127
|
-
import {
|
|
128
|
-
import {
|
|
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
|
|
package/src/types/device.ts
CHANGED
package/src/types/settings.ts
CHANGED
|
@@ -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
|
|
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
|
|
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
|
|
276
|
+
return latestFirmwareField;
|
|
265
277
|
}
|
|
266
278
|
if (deviceType === EDeviceType.Pro) {
|
|
267
|
-
return
|
|
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
|
-
): ('
|
|
291
|
+
): ('ble' | IFirmwareField)[] => {
|
|
280
292
|
const deviceType = getDeviceType(features);
|
|
281
293
|
if (updateType === 'ble') {
|
|
282
294
|
return ['ble'];
|