@onekeyfe/hd-core 1.2.0-alpha.50 → 1.2.0-alpha.52

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 (238) hide show
  1. package/__tests__/AllNetworkGetAddressBase.tracing.test.ts +0 -78
  2. package/__tests__/DeviceEventRegistration.test.ts +0 -6
  3. package/__tests__/check-all-firmware-release-protocol-v2.test.ts +3 -111
  4. package/__tests__/connectSettings.test.ts +47 -5
  5. package/__tests__/device-initialize-timeout.test.ts +56 -0
  6. package/__tests__/device-lifecycle-events.test.ts +3 -105
  7. package/__tests__/firmware-update/check-all-firmware-release.test.ts +175 -0
  8. package/__tests__/firmware-update/firmware-artifact-source.test.ts +119 -0
  9. package/__tests__/firmware-update/firmware-host-binding.test.ts +70 -0
  10. package/__tests__/firmware-update/firmware-preparation-error.test.ts +27 -0
  11. package/__tests__/firmware-update/firmware-update-bootloader-poll.test.ts +200 -0
  12. package/__tests__/firmware-update/firmware-update-capabilities.test.ts +13 -0
  13. package/__tests__/firmware-update/firmware-update-plan-bootloader-identity.test.ts +294 -0
  14. package/__tests__/firmware-update/firmware-update-plan.test.ts +593 -0
  15. package/__tests__/firmware-update/firmware-update-prepared-plan.test.ts +213 -0
  16. package/__tests__/firmware-update/firmware-update-v2-download-before-boot.test.ts +59 -31
  17. package/__tests__/firmware-update/firmware-update-v3-reconnect.test.ts +58 -0
  18. package/__tests__/firmware-update/firmware-upload-source.test.ts +70 -0
  19. package/__tests__/get-device-state.test.ts +12 -132
  20. package/__tests__/homescreen.test.ts +1 -41
  21. package/__tests__/logBlockEvent.test.ts +1 -1
  22. package/__tests__/method-protocol-support.test.ts +0 -19
  23. package/__tests__/open-wallet-session.test.ts +33 -446
  24. package/__tests__/protocol-v2-unlock-policy.test.ts +35 -196
  25. package/__tests__/protocol-v2.test.ts +1032 -1056
  26. package/__tests__/protocolV2UiInteraction.test.ts +0 -63
  27. package/__tests__/public-pro2-api-boundary.test.ts +0 -1
  28. package/__tests__/search-devices.test.ts +3 -12
  29. package/dist/api/BaseMethod.d.ts +1 -3
  30. package/dist/api/BaseMethod.d.ts.map +1 -1
  31. package/dist/api/CheckAllFirmwareRelease.d.ts.map +1 -1
  32. package/dist/api/FirmwareUpdate.d.ts.map +1 -1
  33. package/dist/api/FirmwareUpdateV2.d.ts +11 -0
  34. package/dist/api/FirmwareUpdateV2.d.ts.map +1 -1
  35. package/dist/api/FirmwareUpdateV3.d.ts +7 -3
  36. package/dist/api/FirmwareUpdateV3.d.ts.map +1 -1
  37. package/dist/api/FirmwareUpdateV4.d.ts +25 -9
  38. package/dist/api/FirmwareUpdateV4.d.ts.map +1 -1
  39. package/dist/api/GetPassphraseState.d.ts.map +1 -1
  40. package/dist/api/OpenWalletSession.d.ts.map +1 -1
  41. package/dist/api/SearchDevices.d.ts.map +1 -1
  42. package/dist/api/allnetwork/AllNetworkGetAddressBase.d.ts.map +1 -1
  43. package/dist/api/device/DeviceUpdateBootloader.d.ts +5 -1
  44. package/dist/api/device/DeviceUpdateBootloader.d.ts.map +1 -1
  45. package/dist/api/firmware/FirmwareArtifactSource.d.ts +25 -0
  46. package/dist/api/firmware/FirmwareArtifactSource.d.ts.map +1 -0
  47. package/dist/api/firmware/FirmwareHostBinding.d.ts +6 -0
  48. package/dist/api/firmware/FirmwareHostBinding.d.ts.map +1 -0
  49. package/dist/api/firmware/FirmwarePreparationError.d.ts +3 -0
  50. package/dist/api/firmware/FirmwarePreparationError.d.ts.map +1 -0
  51. package/dist/api/firmware/FirmwareUpdateBaseMethod.d.ts +9 -0
  52. package/dist/api/firmware/FirmwareUpdateBaseMethod.d.ts.map +1 -1
  53. package/dist/api/firmware/FirmwareUpdateCapabilities.d.ts +3 -0
  54. package/dist/api/firmware/FirmwareUpdateCapabilities.d.ts.map +1 -0
  55. package/dist/api/firmware/FirmwareUpdatePlan.d.ts +25 -0
  56. package/dist/api/firmware/FirmwareUpdatePlan.d.ts.map +1 -0
  57. package/dist/api/firmware/FirmwareUpdatePreparedPlan.d.ts +32 -0
  58. package/dist/api/firmware/FirmwareUpdatePreparedPlan.d.ts.map +1 -0
  59. package/dist/api/firmware/getBinary.d.ts +7 -0
  60. package/dist/api/firmware/getBinary.d.ts.map +1 -1
  61. package/dist/api/firmware/progressThrottle.d.ts +3 -0
  62. package/dist/api/firmware/progressThrottle.d.ts.map +1 -0
  63. package/dist/api/firmware/updateBootloader.d.ts +2 -0
  64. package/dist/api/firmware/updateBootloader.d.ts.map +1 -1
  65. package/dist/api/firmware/uploadFirmware.d.ts +9 -1
  66. package/dist/api/firmware/uploadFirmware.d.ts.map +1 -1
  67. package/dist/api/helpers/protocolV2FileWrite.d.ts +0 -2
  68. package/dist/api/helpers/protocolV2FileWrite.d.ts.map +1 -1
  69. package/dist/api/index.d.ts +0 -2
  70. package/dist/api/index.d.ts.map +1 -1
  71. package/dist/api/protocol-v2/ProtocolInfoRequest.d.ts.map +1 -1
  72. package/dist/api/stellar/StellarSignTransaction.d.ts +1 -1
  73. package/dist/core/deviceEventRegistration.d.ts +0 -2
  74. package/dist/core/deviceEventRegistration.d.ts.map +1 -1
  75. package/dist/core/index.d.ts.map +1 -1
  76. package/dist/data-manager/DataManager.d.ts +2 -4
  77. package/dist/data-manager/DataManager.d.ts.map +1 -1
  78. package/dist/data-manager/connectSettings.d.ts.map +1 -1
  79. package/dist/device/Device.d.ts +6 -29
  80. package/dist/device/Device.d.ts.map +1 -1
  81. package/dist/device/DeviceCommands.d.ts +4 -4
  82. package/dist/device/DevicePool.d.ts.map +1 -1
  83. package/dist/events/device.d.ts +0 -4
  84. package/dist/events/device.d.ts.map +1 -1
  85. package/dist/events/logBlockEvent.d.ts.map +1 -1
  86. package/dist/events/ui-promise.d.ts +2 -4
  87. package/dist/events/ui-promise.d.ts.map +1 -1
  88. package/dist/events/ui-request.d.ts +2 -31
  89. package/dist/events/ui-request.d.ts.map +1 -1
  90. package/dist/events/ui-response.d.ts +2 -10
  91. package/dist/events/ui-response.d.ts.map +1 -1
  92. package/dist/index.d.ts +230 -203
  93. package/dist/index.d.ts.map +1 -1
  94. package/dist/index.js +3469 -2419
  95. package/dist/inject.d.ts +1 -6
  96. package/dist/inject.d.ts.map +1 -1
  97. package/dist/lowLevelInject.d.ts.map +1 -1
  98. package/dist/protocols/protocol-v2/features.d.ts.map +1 -1
  99. package/dist/protocols/protocol-v2/lockedError.d.ts +2 -0
  100. package/dist/protocols/protocol-v2/lockedError.d.ts.map +1 -0
  101. package/dist/protocols/protocol-v2/uiInteraction.d.ts +4 -7
  102. package/dist/protocols/protocol-v2/uiInteraction.d.ts.map +1 -1
  103. package/dist/protocols/protocol-v2/unlockPolicy.d.ts +3 -1
  104. package/dist/protocols/protocol-v2/unlockPolicy.d.ts.map +1 -1
  105. package/dist/protocols/protocol-v2/unlockRetry.d.ts +10 -0
  106. package/dist/protocols/protocol-v2/unlockRetry.d.ts.map +1 -0
  107. package/dist/protocols/protocol-v2/walletSession.d.ts +1 -4
  108. package/dist/protocols/protocol-v2/walletSession.d.ts.map +1 -1
  109. package/dist/topLevelInject.d.ts.map +1 -1
  110. package/dist/types/api/checkAllFirmwareRelease.d.ts +4 -1
  111. package/dist/types/api/checkAllFirmwareRelease.d.ts.map +1 -1
  112. package/dist/types/api/deviceUpdateBootloader.d.ts +6 -0
  113. package/dist/types/api/deviceUpdateBootloader.d.ts.map +1 -1
  114. package/dist/types/api/export.d.ts +4 -1
  115. package/dist/types/api/export.d.ts.map +1 -1
  116. package/dist/types/api/firmwareUpdate.d.ts +70 -2
  117. package/dist/types/api/firmwareUpdate.d.ts.map +1 -1
  118. package/dist/types/api/firmwareUpdateCapabilities.d.ts +9 -0
  119. package/dist/types/api/firmwareUpdateCapabilities.d.ts.map +1 -0
  120. package/dist/types/api/firmwareUpdatePlan.d.ts +28 -0
  121. package/dist/types/api/firmwareUpdatePlan.d.ts.map +1 -0
  122. package/dist/types/api/firmwareUpdatePreparedPlan.d.ts +42 -0
  123. package/dist/types/api/firmwareUpdatePreparedPlan.d.ts.map +1 -0
  124. package/dist/types/api/index.d.ts +10 -7
  125. package/dist/types/api/index.d.ts.map +1 -1
  126. package/dist/types/api/protocolV2.d.ts +0 -3
  127. package/dist/types/api/protocolV2.d.ts.map +1 -1
  128. package/dist/types/params.d.ts +0 -1
  129. package/dist/types/params.d.ts.map +1 -1
  130. package/dist/types/settings.d.ts +13 -22
  131. package/dist/types/settings.d.ts.map +1 -1
  132. package/dist/utils/deviceFeaturesCompat.d.ts +1 -0
  133. package/dist/utils/deviceFeaturesCompat.d.ts.map +1 -1
  134. package/dist/utils/deviceFeaturesUtils.d.ts +0 -2
  135. package/dist/utils/deviceFeaturesUtils.d.ts.map +1 -1
  136. package/dist/utils/homescreen.d.ts +0 -4
  137. package/dist/utils/homescreen.d.ts.map +1 -1
  138. package/dist/utils/index.d.ts +1 -1
  139. package/dist/utils/index.d.ts.map +1 -1
  140. package/dist/utils/patch.d.ts +1 -1
  141. package/dist/utils/patch.d.ts.map +1 -1
  142. package/dist/utils/pro2Wallpaper.d.ts +0 -10
  143. package/dist/utils/pro2Wallpaper.d.ts.map +1 -1
  144. package/package.json +4 -4
  145. package/src/api/BaseMethod.ts +10 -8
  146. package/src/api/CheckAllFirmwareRelease.ts +53 -41
  147. package/src/api/FirmwareUpdate.ts +15 -7
  148. package/src/api/FirmwareUpdateV2.ts +316 -126
  149. package/src/api/FirmwareUpdateV3.ts +265 -63
  150. package/src/api/FirmwareUpdateV4.ts +937 -430
  151. package/src/api/GetPassphraseState.ts +1 -7
  152. package/src/api/OpenWalletSession.ts +17 -54
  153. package/src/api/SearchDevices.ts +1 -3
  154. package/src/api/allnetwork/AllNetworkGetAddressBase.ts +11 -32
  155. package/src/api/device/DeviceUnlock.ts +1 -1
  156. package/src/api/device/DeviceUpdateBootloader.ts +122 -6
  157. package/src/api/firmware/FirmwareArtifactSource.ts +278 -0
  158. package/src/api/firmware/FirmwareHostBinding.ts +100 -0
  159. package/src/api/firmware/FirmwarePreparationError.ts +12 -0
  160. package/src/api/firmware/FirmwareUpdateBaseMethod.ts +83 -16
  161. package/src/api/firmware/FirmwareUpdateCapabilities.ts +9 -0
  162. package/src/api/firmware/FirmwareUpdatePlan.ts +772 -0
  163. package/src/api/firmware/FirmwareUpdatePreparedPlan.ts +415 -0
  164. package/src/api/firmware/progressThrottle.ts +44 -0
  165. package/src/api/firmware/updateBootloader.ts +19 -4
  166. package/src/api/firmware/uploadFirmware.ts +144 -39
  167. package/src/api/helpers/protocolV2FileWrite.ts +4 -11
  168. package/src/api/index.ts +0 -2
  169. package/src/api/protocol-v2/ProtocolInfoRequest.ts +1 -3
  170. package/src/core/deviceEventRegistration.ts +0 -4
  171. package/src/core/index.ts +83 -167
  172. package/src/data/messages/messages-protocol-v2.json +0 -25
  173. package/src/data-manager/DataManager.ts +38 -67
  174. package/src/data-manager/connectSettings.ts +11 -0
  175. package/src/device/Device.ts +42 -257
  176. package/src/device/DevicePool.ts +2 -7
  177. package/src/events/device.ts +0 -4
  178. package/src/events/logBlockEvent.ts +0 -1
  179. package/src/events/ui-promise.ts +2 -4
  180. package/src/events/ui-request.ts +2 -36
  181. package/src/events/ui-response.ts +2 -12
  182. package/src/index.ts +5 -0
  183. package/src/inject.ts +24 -60
  184. package/src/lowLevelInject.ts +8 -7
  185. package/src/protocols/protocol-v2/features.ts +2 -9
  186. package/src/protocols/protocol-v2/lockedError.ts +10 -0
  187. package/src/protocols/protocol-v2/uiInteraction.ts +6 -46
  188. package/src/protocols/protocol-v2/unlockPolicy.ts +105 -1
  189. package/src/protocols/protocol-v2/unlockRetry.ts +109 -0
  190. package/src/protocols/protocol-v2/walletSession.ts +30 -169
  191. package/src/topLevelInject.ts +8 -7
  192. package/src/types/api/checkAllFirmwareRelease.ts +4 -1
  193. package/src/types/api/deviceUpdateBootloader.ts +6 -0
  194. package/src/types/api/export.ts +18 -0
  195. package/src/types/api/firmwareUpdate.ts +76 -3
  196. package/src/types/api/firmwareUpdateCapabilities.ts +9 -0
  197. package/src/types/api/firmwareUpdatePlan.ts +38 -0
  198. package/src/types/api/firmwareUpdatePreparedPlan.ts +53 -0
  199. package/src/types/api/index.ts +14 -13
  200. package/src/types/api/protocolV2.ts +0 -13
  201. package/src/types/params.ts +1 -7
  202. package/src/types/settings.ts +13 -42
  203. package/src/utils/deviceFeaturesCompat.ts +6 -0
  204. package/src/utils/deviceFeaturesUtils.ts +0 -4
  205. package/src/utils/homescreen.ts +6 -32
  206. package/src/utils/index.ts +1 -6
  207. package/src/utils/pro2Wallpaper.ts +8 -35
  208. package/__tests__/deviceUploadNft.test.ts +0 -293
  209. package/__tests__/pro2Nft.test.ts +0 -108
  210. package/__tests__/protocol-binding.test.ts +0 -89
  211. package/__tests__/protocol-v2-resources.test.ts +0 -284
  212. package/__tests__/protocol-v2-ui-lifecycle.test.ts +0 -91
  213. package/__tests__/uiProgressThrottle.test.ts +0 -74
  214. package/__tests__/uiPromiseRegistry.test.ts +0 -86
  215. package/dist/api/DetectDeviceConnectProtocol.d.ts +0 -7
  216. package/dist/api/DetectDeviceConnectProtocol.d.ts.map +0 -1
  217. package/dist/api/protocol-v2/DeviceUploadNft.d.ts +0 -31
  218. package/dist/api/protocol-v2/DeviceUploadNft.d.ts.map +0 -1
  219. package/dist/core/uiPromiseRegistry.d.ts +0 -4
  220. package/dist/core/uiPromiseRegistry.d.ts.map +0 -1
  221. package/dist/protocols/protocol-v2/resources.d.ts +0 -30
  222. package/dist/protocols/protocol-v2/resources.d.ts.map +0 -1
  223. package/dist/protocols/protocol-v2/unlockPolicyRunner.d.ts +0 -22
  224. package/dist/protocols/protocol-v2/unlockPolicyRunner.d.ts.map +0 -1
  225. package/dist/types/api/detectDeviceConnectProtocol.d.ts +0 -4
  226. package/dist/types/api/detectDeviceConnectProtocol.d.ts.map +0 -1
  227. package/dist/utils/pro2Nft.d.ts +0 -31
  228. package/dist/utils/pro2Nft.d.ts.map +0 -1
  229. package/dist/utils/uiProgressThrottle.d.ts +0 -3
  230. package/dist/utils/uiProgressThrottle.d.ts.map +0 -1
  231. package/src/api/DetectDeviceConnectProtocol.ts +0 -18
  232. package/src/api/protocol-v2/DeviceUploadNft.ts +0 -189
  233. package/src/core/uiPromiseRegistry.ts +0 -41
  234. package/src/protocols/protocol-v2/resources.ts +0 -359
  235. package/src/protocols/protocol-v2/unlockPolicyRunner.ts +0 -124
  236. package/src/types/api/detectDeviceConnectProtocol.ts +0 -7
  237. package/src/utils/pro2Nft.ts +0 -142
  238. package/src/utils/uiProgressThrottle.ts +0 -63
@@ -1,7 +1,6 @@
1
1
  import type {
2
2
  deviceGetOnboardingStatus,
3
3
  deviceReboot,
4
- deviceUploadNft,
5
4
  deviceUploadWallpaper,
6
5
  testProtocolV2Ping,
7
6
  uploadPortfolio,
@@ -19,7 +18,6 @@ import type { checkBootloaderRelease } from './checkBootloaderRelease';
19
18
  import type { checkAllFirmwareRelease } from './checkAllFirmwareRelease';
20
19
  import type { checkFirmwareTypeAvailable } from './checkFirmwareTypeAvailable';
21
20
  import type { searchDevices } from './searchDevices';
22
- import type { detectDeviceConnectProtocol } from './detectDeviceConnectProtocol';
23
21
  import type { getFeatures } from './getFeatures';
24
22
  import type { getDeviceState } from './getDeviceState';
25
23
  import type { getOnekeyFeatures } from './getOnekeyFeatures';
@@ -32,7 +30,15 @@ import type {
32
30
  firmwareUpdateV2,
33
31
  firmwareUpdateV3,
34
32
  firmwareUpdateV4,
33
+ getFirmwareUpdateHostBindingGeneration,
34
+ registerFirmwareUpdateHostBinding,
35
+ unregisterFirmwareUpdateHostBinding,
35
36
  } from './firmwareUpdate';
37
+ import type { getFirmwareUpdateCapabilities } from './firmwareUpdateCapabilities';
38
+ import type {
39
+ prepareFirmwareUpdatePlan,
40
+ validateFirmwareUpdatePreparedPlan,
41
+ } from './firmwareUpdatePreparedPlan';
36
42
  import type { promptWebDeviceAccess } from './promptWebDeviceAccess';
37
43
  import type { deviceReset } from './deviceReset';
38
44
  import type { deviceRecovery } from './deviceRecovery';
@@ -146,7 +152,6 @@ import type { benfenSignMessage } from './benfenSignMessage';
146
152
  import type { neoGetAddress } from './neoGetAddress';
147
153
  import type { neoSignTransaction } from './neoSignTransaction';
148
154
  import type { ConnectSettings } from '../settings';
149
- import type { HardwareConnectProtocol } from '@onekeyfe/hd-shared';
150
155
 
151
156
  export * from './export';
152
157
  export type { DeviceStateScope, GetDeviceStateParams } from './getDeviceState';
@@ -171,14 +176,6 @@ export type CoreApi = {
171
176
  removeAllListeners: typeof removeAllListeners;
172
177
  dispose: () => void | Promise<void>;
173
178
  call: (params: any) => Promise<any>;
174
- /**
175
- * Bind a protocol that has already been verified for one transport endpoint.
176
- * Every later SDK call for the same connectId uses it as a strict expectation.
177
- */
178
- setDeviceConnectProtocol: (
179
- connectId: string,
180
- connectProtocol: HardwareConnectProtocol | undefined
181
- ) => void;
182
179
  uiResponse: typeof uiResponse;
183
180
  cancel: (connectId?: string) => void;
184
181
  updateSettings: typeof updateSettings;
@@ -206,7 +203,6 @@ export type CoreApi = {
206
203
  * Device function
207
204
  */
208
205
  searchDevices: typeof searchDevices;
209
- detectDeviceConnectProtocol: typeof detectDeviceConnectProtocol;
210
206
  promptWebDeviceAccess: typeof promptWebDeviceAccess;
211
207
  getFeatures: typeof getFeatures;
212
208
  getDeviceState: typeof getDeviceState;
@@ -239,6 +235,12 @@ export type CoreApi = {
239
235
  firmwareUpdateV2: typeof firmwareUpdateV2;
240
236
  firmwareUpdateV3: typeof firmwareUpdateV3;
241
237
  firmwareUpdateV4: typeof firmwareUpdateV4;
238
+ registerFirmwareUpdateHostBinding: typeof registerFirmwareUpdateHostBinding;
239
+ unregisterFirmwareUpdateHostBinding: typeof unregisterFirmwareUpdateHostBinding;
240
+ getFirmwareUpdateHostBindingGeneration: typeof getFirmwareUpdateHostBindingGeneration;
241
+ getFirmwareUpdateCapabilities: typeof getFirmwareUpdateCapabilities;
242
+ prepareFirmwareUpdatePlan: typeof prepareFirmwareUpdatePlan;
243
+ validateFirmwareUpdatePreparedPlan: typeof validateFirmwareUpdatePreparedPlan;
242
244
  cipherKeyValue: typeof cipherKeyValue;
243
245
 
244
246
  /**
@@ -246,7 +248,6 @@ export type CoreApi = {
246
248
  */
247
249
  deviceReboot: typeof deviceReboot;
248
250
  deviceGetOnboardingStatus: typeof deviceGetOnboardingStatus;
249
- deviceUploadNft: typeof deviceUploadNft;
250
251
  deviceUploadWallpaper: typeof deviceUploadWallpaper;
251
252
  uploadPortfolio: typeof uploadPortfolio;
252
253
 
@@ -5,10 +5,6 @@ import type {
5
5
  DeviceUploadWallpaperParams,
6
6
  DeviceUploadWallpaperResponse,
7
7
  } from '../../api/protocol-v2/DeviceUploadWallpaper';
8
- import type {
9
- DeviceUploadNftParams,
10
- DeviceUploadNftResponse,
11
- } from '../../api/protocol-v2/DeviceUploadNft';
12
8
 
13
9
  // Re-export implementation parameter types as the single source of truth.
14
10
  export type { DeviceRebootParams, RebootTypeInput } from '../../api/protocol-v2/helpers';
@@ -16,10 +12,6 @@ export type {
16
12
  DeviceUploadWallpaperParams,
17
13
  DeviceUploadWallpaperResponse,
18
14
  } from '../../api/protocol-v2/DeviceUploadWallpaper';
19
- export type {
20
- DeviceUploadNftParams,
21
- DeviceUploadNftResponse,
22
- } from '../../api/protocol-v2/DeviceUploadNft';
23
15
 
24
16
  // ── Shared response shapes (Protocol V2 file system) ────────────────────
25
17
 
@@ -60,11 +52,6 @@ export declare function deviceUploadWallpaper(
60
52
  params: CommonParams & DeviceUploadWallpaperParams
61
53
  ): Response<DeviceUploadWallpaperResponse>;
62
54
 
63
- export declare function deviceUploadNft(
64
- connectId: string,
65
- params: CommonParams & DeviceUploadNftParams
66
- ): Response<DeviceUploadNftResponse>;
67
-
68
55
  export declare function uploadPortfolio(
69
56
  connectId: string,
70
57
  params: {
@@ -61,15 +61,9 @@ export interface CommonParams {
61
61
 
62
62
  /**
63
63
  * Strictly expected transport protocol. The SDK actively verifies this value and
64
- * rejects a mismatch. After a successful probe, the cached protocol is also strict.
64
+ * rejects a mismatch. If omitted, a cached protocol only influences probe order.
65
65
  */
66
66
  connectProtocol?: HardwareConnectProtocol;
67
-
68
- /**
69
- * Ignore a previously bound protocol for this call and actively detect the
70
- * protocol again. Intended for the first verified connection or explicit recovery.
71
- */
72
- forceProtocolDetection?: boolean;
73
67
  }
74
68
 
75
69
  export type Params<T> = CommonParams & T & { bundle?: undefined };
@@ -31,6 +31,8 @@ export type ConnectSettings = {
31
31
  timestamp: number;
32
32
  isFrame?: boolean;
33
33
  preRelease?: boolean;
34
+ firmwareManifestMode?: 'sdk-managed' | 'external-only';
35
+ preloadedConfig?: RemoteConfigResponse;
34
36
  fetchConfig?: boolean;
35
37
  extension?: string;
36
38
  configFetcher?: (url: string) => Promise<RemoteConfigResponse | null>;
@@ -58,55 +60,18 @@ export type IProtocolV2FirmwareComponent = {
58
60
  fingerprint?: string;
59
61
  /** OKPP payload hash, used to detect same-version package changes. */
60
62
  payloadHash?: string;
63
+ expectedSize?: number;
61
64
  version?: IVersionArray;
62
65
  };
63
66
 
64
- export type IProtocolV2ResourceType =
65
- | 'images'
66
- | 'animation'
67
- | 'wallpaper'
68
- | 'translations'
69
- | 'roobert'
70
- | 'noto';
71
-
72
- /** Pro2 RES package descriptor. Hashes identify content without a human-managed version. */
73
- export type IProtocolV2Resource = {
74
- type: IProtocolV2ResourceType;
75
- url: string;
76
- /** Complete okpkg file size in bytes. */
77
- size: number;
78
- /** SHA-256 of the complete okpkg file. */
79
- fileHash: string;
80
- /** SHA3-512 header_hash from the signed okpkg header. */
81
- headerHash: string;
82
- };
83
-
84
- /** Optional Pro2 startup-resource CRATE installed by the bootloader updater. */
85
- export type IProtocolV2BootResources = {
86
- required: false;
87
- target: 'CRATE';
88
- url: string;
89
- /** Complete CRATE file size in bytes. */
90
- size: number;
91
- /** SHA-256 of the complete CRATE file. */
92
- fileHash: string;
93
- /** SHA3-512 payload_hash from the signed CRATE header. */
94
- payloadHash: string;
95
- /** SHA3-512 header_hash from the signed CRATE header. */
96
- headerHash: string;
97
- };
98
-
99
- export type IProtocolV2Resources = {
100
- stable: IProtocolV2Resource[];
101
- boot?: IProtocolV2BootResources;
102
- };
103
-
104
67
  /** Pro2 RESC bundle okpkg descriptor for incremental FileWrite synchronization. */
105
68
  export type IProtocolV2ResourceBundle = {
106
69
  /** Bundle name, such as images, animation, translations, or fonts_roobert. */
107
70
  name: string;
108
71
  /** Download URL. */
109
72
  url: string;
73
+ fingerprint?: string;
74
+ expectedSize?: number;
110
75
  /** Device target path, such as vol0:/bundles/images/images.okpkg. */
111
76
  devicePath: string;
112
77
  /** okpkg payload_version used to skip matching content after FileRead. */
@@ -128,10 +93,16 @@ export type IFirmwareReleaseInfo = {
128
93
  firmwareType?: EFirmwareType;
129
94
  /** Firmware UI resource */
130
95
  resource?: string;
96
+ resourceFingerprint?: string;
97
+ resourceExpectedSize?: number;
131
98
  /** Firmware full UI resource */
132
99
  fullResource?: string;
100
+ fullResourceFingerprint?: string;
101
+ fullResourceExpectedSize?: number;
133
102
  fullResourceRange?: string[];
134
103
  bootloaderResource?: string;
104
+ bootloaderFingerprint?: string;
105
+ bootloaderExpectedSize?: number;
135
106
  bootloaderVersion?: IVersionArray;
136
107
  displayBootloaderVersion?: IVersionArray;
137
108
  bootloaderRelatedFirmwareVersion?: IVersionArray;
@@ -144,6 +115,7 @@ export type IFirmwareReleaseInfo = {
144
115
  [k in ILocale]: string;
145
116
  };
146
117
  fingerprint: string;
118
+ expectedSize?: number;
147
119
  version: IVersionArray;
148
120
  changelog: {
149
121
  [k in ILocale]: string;
@@ -159,6 +131,7 @@ export type IBLEFirmwareReleaseInfo = {
159
131
  webUpdate: string;
160
132
  fingerprint: string;
161
133
  fingerprintWeb: string;
134
+ expectedSize?: number;
162
135
  version: IVersionArray;
163
136
  changelog: {
164
137
  [k in ILocale]: string;
@@ -176,8 +149,6 @@ export type DeviceTypeMap = {
176
149
  'firmware-v8'?: IFirmwareReleaseInfo[];
177
150
  'firmware-btc-v8'?: IFirmwareReleaseInfo[];
178
151
  ble: IBLEFirmwareReleaseInfo[];
179
- /** Independent Pro2 resource release configuration. */
180
- resources?: IProtocolV2Resources;
181
152
  };
182
153
  };
183
154
 
@@ -37,6 +37,12 @@ export const resolveDeviceSerialNo = (features?: DeviceFeaturesInput): string =>
37
37
  );
38
38
  };
39
39
 
40
+ export const resolveDeviceBootloaderMode = (features?: DeviceFeaturesInput): boolean => {
41
+ if (!features) return false;
42
+ const compatible = asCompatibleFeatures(features);
43
+ return (compatible.bootloaderMode ?? compatible.bootloader_mode) === true;
44
+ };
45
+
40
46
  export const resolveDeviceType = (features?: DeviceFeaturesInput): IDeviceType => {
41
47
  if (!features || typeof features !== 'object') {
42
48
  return EDeviceType.Unknown;
@@ -106,7 +106,6 @@ export const getPassphraseStateWithRefreshDeviceInfo = async (
106
106
  expectPassphraseState?: string;
107
107
  onlyMainPin?: boolean;
108
108
  initSession?: boolean;
109
- deriveCardano?: boolean;
110
109
  }
111
110
  ) => {
112
111
  if (device.isProtocolV2()) {
@@ -122,7 +121,6 @@ export const getPassphraseStateWithRefreshDeviceInfo = async (
122
121
  initSession: options?.initSession,
123
122
  expectedPassphraseState: options?.expectPassphraseState,
124
123
  onlyMainPin: options?.onlyMainPin,
125
- deriveCardano: options?.deriveCardano,
126
124
  });
127
125
  }
128
126
 
@@ -187,7 +185,6 @@ export const getPassphraseState = async (
187
185
  expectPassphraseState?: string;
188
186
  onlyMainPin?: boolean;
189
187
  initSession?: boolean;
190
- deriveCardano?: boolean;
191
188
  }
192
189
  ): Promise<{
193
190
  passphraseState: string | undefined;
@@ -208,7 +205,6 @@ export const getPassphraseState = async (
208
205
  initSession: options?.initSession,
209
206
  expectedPassphraseState: options?.expectPassphraseState,
210
207
  onlyMainPin: options?.onlyMainPin,
211
- deriveCardano: options?.deriveCardano,
212
208
  });
213
209
  }
214
210
 
@@ -4,12 +4,6 @@ import { EDeviceType } from '@onekeyfe/hd-shared';
4
4
  import { getDeviceType } from './deviceInfoUtils';
5
5
  import { getDeviceFirmwareVersion } from './deviceVersionUtils';
6
6
  import { PRO2_WALLPAPER_HEIGHT, PRO2_WALLPAPER_WIDTH } from './pro2Wallpaper';
7
- import {
8
- PRO2_NFT_IMAGE_HEIGHT,
9
- PRO2_NFT_IMAGE_WIDTH,
10
- PRO2_NFT_THUMBNAIL_HEIGHT,
11
- PRO2_NFT_THUMBNAIL_WIDTH,
12
- } from './pro2Nft';
13
7
 
14
8
  import type { Features, IDeviceType } from '../types';
15
9
 
@@ -308,31 +302,6 @@ type SizeConfig = {
308
302
  radius?: number;
309
303
  };
310
304
 
311
- export const getNftSize = ({
312
- deviceType,
313
- thumbnail,
314
- }: {
315
- deviceType: IDeviceType;
316
- thumbnail?: boolean;
317
- }): SizeConfig | undefined => {
318
- const sizes: Partial<Record<IDeviceType, { full: SizeConfig; thumbnail: SizeConfig }>> = {
319
- touch: {
320
- full: { width: 480, height: 800 },
321
- thumbnail: { width: 238, height: 238 },
322
- },
323
- pro: {
324
- full: { width: 480, height: 800 },
325
- thumbnail: { width: 226, height: 226, radius: 40 },
326
- },
327
- pro2: {
328
- full: { width: PRO2_NFT_IMAGE_WIDTH, height: PRO2_NFT_IMAGE_HEIGHT },
329
- thumbnail: { width: PRO2_NFT_THUMBNAIL_WIDTH, height: PRO2_NFT_THUMBNAIL_HEIGHT },
330
- },
331
- };
332
-
333
- return sizes[deviceType]?.[thumbnail ? 'thumbnail' : 'full'];
334
- };
335
-
336
305
  export const getHomeScreenSize = ({
337
306
  deviceType,
338
307
  homeScreenType,
@@ -343,7 +312,12 @@ export const getHomeScreenSize = ({
343
312
  thumbnail?: boolean;
344
313
  }) => {
345
314
  if (deviceType === EDeviceType.Pro2) {
346
- return thumbnail ? undefined : { width: PRO2_WALLPAPER_WIDTH, height: PRO2_WALLPAPER_HEIGHT };
315
+ return thumbnail
316
+ ? undefined
317
+ : {
318
+ width: PRO2_WALLPAPER_WIDTH,
319
+ height: PRO2_WALLPAPER_HEIGHT,
320
+ };
347
321
  }
348
322
 
349
323
  const sizes: Partial<
@@ -54,12 +54,7 @@ export { getHDPath, getScriptType, getOutputScriptType } from '../api/helpers/pa
54
54
 
55
55
  export const isBleConnect = (env: string) => env === 'react-native' || env === 'lowlevel';
56
56
 
57
- export {
58
- getHomeScreenHex,
59
- getHomeScreenDefaultList,
60
- getHomeScreenSize,
61
- getNftSize,
62
- } from './homescreen';
57
+ export { getHomeScreenHex, getHomeScreenDefaultList, getHomeScreenSize } from './homescreen';
63
58
  export { encodePro2Wallpaper, PRO2_WALLPAPER_HEIGHT, PRO2_WALLPAPER_WIDTH } from './pro2Wallpaper';
64
59
  export type { Pro2WallpaperColorFormat } from './pro2Wallpaper';
65
60
 
@@ -8,8 +8,6 @@ export const PRO2_WALLPAPER_HEIGHT = 1024;
8
8
 
9
9
  export type Pro2WallpaperColorFormat = 'RGB565' | 'RGB565A8';
10
10
 
11
- export type Pro2ImageAlphaMode = 'preserve' | 'black-background';
12
-
13
11
  const COLOR_FORMAT_RGB565 = 0x12;
14
12
  const COLOR_FORMAT_RGB565A8 = 0x14;
15
13
 
@@ -38,11 +36,10 @@ function align(value: number, boundary: number): number {
38
36
  return Math.ceil(value / boundary) * boundary;
39
37
  }
40
38
 
41
- export function encodePro2Image(options: {
39
+ export function encodePro2Wallpaper(options: {
42
40
  width: number;
43
41
  height: number;
44
42
  rgba: Uint8Array | ArrayBuffer;
45
- alphaMode?: Pro2ImageAlphaMode;
46
43
  }): { data: Uint8Array; colorFormat: Pro2WallpaperColorFormat } {
47
44
  const { width, height } = options;
48
45
  if (!Number.isInteger(width) || width <= 0 || width > 0xffff) {
@@ -60,14 +57,11 @@ export function encodePro2Image(options: {
60
57
  );
61
58
  }
62
59
 
63
- const alphaMode = options.alphaMode ?? 'preserve';
64
60
  let hasTransparency = false;
65
- if (alphaMode === 'preserve') {
66
- for (let index = 3; index < rgba.length; index += 4) {
67
- if (rgba[index] !== 0xff) {
68
- hasTransparency = true;
69
- break;
70
- }
61
+ for (let index = 3; index < rgba.length; index += 4) {
62
+ if (rgba[index] !== 0xff) {
63
+ hasTransparency = true;
64
+ break;
71
65
  }
72
66
  }
73
67
 
@@ -91,22 +85,9 @@ export function encodePro2Image(options: {
91
85
  for (let x = 0; x < width; x += 1) {
92
86
  const sourceOffset = (y * width + x) * 4;
93
87
  const thresholdIndex = ((y & 7) << 3) + (x & 7);
94
- const alpha = rgba[sourceOffset + 3];
95
- const redChannel =
96
- alphaMode === 'black-background'
97
- ? Math.round((rgba[sourceOffset] * alpha) / 0xff)
98
- : rgba[sourceOffset];
99
- const greenChannel =
100
- alphaMode === 'black-background'
101
- ? Math.round((rgba[sourceOffset + 1] * alpha) / 0xff)
102
- : rgba[sourceOffset + 1];
103
- const blueChannel =
104
- alphaMode === 'black-background'
105
- ? Math.round((rgba[sourceOffset + 2] * alpha) / 0xff)
106
- : rgba[sourceOffset + 2];
107
- const red = Math.min(redChannel + RED_THRESHOLD[thresholdIndex], 0xff) & 0xf8;
108
- const green = Math.min(greenChannel + GREEN_THRESHOLD[thresholdIndex], 0xff) & 0xfc;
109
- const blue = Math.min(blueChannel + BLUE_THRESHOLD[thresholdIndex], 0xff) & 0xf8;
88
+ const red = Math.min(rgba[sourceOffset] + RED_THRESHOLD[thresholdIndex], 0xff) & 0xf8;
89
+ const green = Math.min(rgba[sourceOffset + 1] + GREEN_THRESHOLD[thresholdIndex], 0xff) & 0xfc;
90
+ const blue = Math.min(rgba[sourceOffset + 2] + BLUE_THRESHOLD[thresholdIndex], 0xff) & 0xf8;
110
91
  const rgb565 = ((red >> 3) << 11) | ((green >> 2) << 5) | (blue >> 3);
111
92
  const rgbOffset = 12 + y * stride + x * 2;
112
93
  data[rgbOffset] = rgb565 & 0xff;
@@ -120,11 +101,3 @@ export function encodePro2Image(options: {
120
101
 
121
102
  return { data, colorFormat };
122
103
  }
123
-
124
- export function encodePro2Wallpaper(options: {
125
- width: number;
126
- height: number;
127
- rgba: Uint8Array | ArrayBuffer;
128
- }): { data: Uint8Array; colorFormat: Pro2WallpaperColorFormat } {
129
- return encodePro2Image(options);
130
- }