@onekeyfe/hd-core 1.2.0-alpha.64 → 1.2.0-alpha.66

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 (314) hide show
  1. package/__tests__/AllNetworkGetAddressBase.tracing.test.ts +313 -0
  2. package/__tests__/DeviceCommands.test.ts +59 -13
  3. package/__tests__/DeviceEventRegistration.test.ts +6 -0
  4. package/__tests__/check-all-firmware-release-protocol-v2.test.ts +198 -3
  5. package/__tests__/connectSettings.test.ts +5 -47
  6. package/__tests__/core-initialization.test.ts +23 -0
  7. package/__tests__/device-connector-protocol.test.ts +81 -0
  8. package/__tests__/device-lifecycle-events.test.ts +105 -3
  9. package/__tests__/device-pool-state.test.ts +22 -0
  10. package/__tests__/device-settings.test.ts +39 -18
  11. package/__tests__/device-state-contract.test.ts +1 -0
  12. package/__tests__/device-state-mapper.test.ts +13 -1
  13. package/__tests__/device-utils.test.ts +48 -1
  14. package/__tests__/deviceSettings.test.ts +11 -1
  15. package/__tests__/deviceUploadNft.test.ts +316 -0
  16. package/__tests__/firmware-update/firmware-update-v2-download-before-boot.test.ts +31 -59
  17. package/__tests__/get-device-state.test.ts +132 -12
  18. package/__tests__/homescreen.test.ts +41 -1
  19. package/__tests__/kaspa-use-tweak-pro2.test.ts +2 -2
  20. package/__tests__/kaspaSignTransaction.test.ts +3 -26
  21. package/__tests__/logBlockEvent.test.ts +1 -1
  22. package/__tests__/method-protocol-support.test.ts +19 -0
  23. package/__tests__/open-wallet-session.test.ts +568 -37
  24. package/__tests__/pro2Nft.test.ts +108 -0
  25. package/__tests__/protocol-binding.test.ts +89 -0
  26. package/__tests__/protocol-v2-resources.test.ts +340 -0
  27. package/__tests__/protocol-v2-ui-lifecycle.test.ts +91 -0
  28. package/__tests__/protocol-v2-unlock-policy.test.ts +300 -37
  29. package/__tests__/protocol-v2.test.ts +1506 -1097
  30. package/__tests__/protocolV2FileWrite.test.ts +152 -0
  31. package/__tests__/protocolV2UiInteraction.test.ts +63 -0
  32. package/__tests__/public-pro2-api-boundary.test.ts +1 -0
  33. package/__tests__/search-devices.test.ts +12 -3
  34. package/__tests__/tron-sign-message-init.test.ts +2 -2
  35. package/__tests__/uiProgressThrottle.test.ts +74 -0
  36. package/__tests__/uiPromiseRegistry.test.ts +115 -0
  37. package/dist/api/BaseMethod.d.ts +3 -1
  38. package/dist/api/BaseMethod.d.ts.map +1 -1
  39. package/dist/api/CheckAllFirmwareRelease.d.ts +2 -1
  40. package/dist/api/CheckAllFirmwareRelease.d.ts.map +1 -1
  41. package/dist/api/DetectDeviceConnectProtocol.d.ts +7 -0
  42. package/dist/api/DetectDeviceConnectProtocol.d.ts.map +1 -0
  43. package/dist/api/FirmwareUpdate.d.ts.map +1 -1
  44. package/dist/api/FirmwareUpdateV2.d.ts +0 -11
  45. package/dist/api/FirmwareUpdateV2.d.ts.map +1 -1
  46. package/dist/api/FirmwareUpdateV3.d.ts +3 -7
  47. package/dist/api/FirmwareUpdateV3.d.ts.map +1 -1
  48. package/dist/api/FirmwareUpdateV4.d.ts +13 -27
  49. package/dist/api/FirmwareUpdateV4.d.ts.map +1 -1
  50. package/dist/api/GetPassphraseState.d.ts.map +1 -1
  51. package/dist/api/OpenWalletSession.d.ts.map +1 -1
  52. package/dist/api/SearchDevices.d.ts.map +1 -1
  53. package/dist/api/allnetwork/AllNetworkGetAddressBase.d.ts.map +1 -1
  54. package/dist/api/device/DeviceSettings.d.ts.map +1 -1
  55. package/dist/api/device/DeviceUnlock.d.ts +2 -2
  56. package/dist/api/device/DeviceUnlock.d.ts.map +1 -1
  57. package/dist/api/device/DeviceUpdateBootloader.d.ts +1 -5
  58. package/dist/api/device/DeviceUpdateBootloader.d.ts.map +1 -1
  59. package/dist/api/firmware/FirmwareUpdateBaseMethod.d.ts +4 -11
  60. package/dist/api/firmware/FirmwareUpdateBaseMethod.d.ts.map +1 -1
  61. package/dist/api/firmware/getBinary.d.ts +0 -7
  62. package/dist/api/firmware/getBinary.d.ts.map +1 -1
  63. package/dist/api/firmware/updateBootloader.d.ts +0 -2
  64. package/dist/api/firmware/updateBootloader.d.ts.map +1 -1
  65. package/dist/api/firmware/uploadFirmware.d.ts +1 -9
  66. package/dist/api/firmware/uploadFirmware.d.ts.map +1 -1
  67. package/dist/api/helpers/protocolV2FileWrite.d.ts +9 -0
  68. package/dist/api/helpers/protocolV2FileWrite.d.ts.map +1 -1
  69. package/dist/api/index.d.ts +2 -0
  70. package/dist/api/index.d.ts.map +1 -1
  71. package/dist/api/kaspa/KaspaGetAddress.d.ts +1 -1
  72. package/dist/api/kaspa/KaspaSignTransaction.d.ts +1 -1
  73. package/dist/api/kaspa/KaspaSignTransaction.d.ts.map +1 -1
  74. package/dist/api/polkadot/PolkadotGetAddress.d.ts +1 -1
  75. package/dist/api/polkadot/networks.d.ts +1 -1
  76. package/dist/api/protocol-v2/DeviceUploadNft.d.ts +31 -0
  77. package/dist/api/protocol-v2/DeviceUploadNft.d.ts.map +1 -0
  78. package/dist/api/protocol-v2/ProtocolInfoRequest.d.ts.map +1 -1
  79. package/dist/api/protocol-v2/helpers.d.ts.map +1 -1
  80. package/dist/api/solana/SolSignMessage.d.ts +1 -1
  81. package/dist/api/solana/SolSignOffchainMessage.d.ts +1 -1
  82. package/dist/api/solana/SolSignTransaction.d.ts +2 -2
  83. package/dist/api/stellar/StellarSignTransaction.d.ts +1 -1
  84. package/dist/api/sui/SuiGetAddress.d.ts +1 -1
  85. package/dist/api/sui/SuiGetPublicKey.d.ts +1 -1
  86. package/dist/api/sui/SuiSignMessage.d.ts +1 -1
  87. package/dist/api/sui/SuiSignTransaction.d.ts +1 -1
  88. package/dist/api/ton/TonGetAddress.d.ts +1 -1
  89. package/dist/api/ton/TonSignMessage.d.ts +1 -1
  90. package/dist/api/ton/TonSignProof.d.ts +1 -1
  91. package/dist/api/tron/TronSignMessage.d.ts +2 -2
  92. package/dist/api/tron/TronSignTransaction.d.ts +1 -1
  93. package/dist/core/deviceEventRegistration.d.ts +2 -0
  94. package/dist/core/deviceEventRegistration.d.ts.map +1 -1
  95. package/dist/core/index.d.ts.map +1 -1
  96. package/dist/core/uiPromiseRegistry.d.ts +6 -0
  97. package/dist/core/uiPromiseRegistry.d.ts.map +1 -0
  98. package/dist/data-manager/DataManager.d.ts +9 -4
  99. package/dist/data-manager/DataManager.d.ts.map +1 -1
  100. package/dist/data-manager/TransportManager.d.ts.map +1 -1
  101. package/dist/data-manager/connectSettings.d.ts.map +1 -1
  102. package/dist/device/Device.d.ts +29 -6
  103. package/dist/device/Device.d.ts.map +1 -1
  104. package/dist/device/DeviceCommands.d.ts +4 -4
  105. package/dist/device/DeviceCommands.d.ts.map +1 -1
  106. package/dist/device/DeviceConnector.d.ts +2 -1
  107. package/dist/device/DeviceConnector.d.ts.map +1 -1
  108. package/dist/device/DevicePool.d.ts.map +1 -1
  109. package/dist/deviceProfile/protocolV2DeviceIdentity.d.ts.map +1 -1
  110. package/dist/events/device.d.ts +4 -0
  111. package/dist/events/device.d.ts.map +1 -1
  112. package/dist/events/logBlockEvent.d.ts.map +1 -1
  113. package/dist/events/ui-promise.d.ts +4 -2
  114. package/dist/events/ui-promise.d.ts.map +1 -1
  115. package/dist/events/ui-request.d.ts +31 -2
  116. package/dist/events/ui-request.d.ts.map +1 -1
  117. package/dist/events/ui-response.d.ts +10 -2
  118. package/dist/events/ui-response.d.ts.map +1 -1
  119. package/dist/index.d.ts +243 -248
  120. package/dist/index.d.ts.map +1 -1
  121. package/dist/index.js +3051 -3774
  122. package/dist/inject.d.ts +6 -1
  123. package/dist/inject.d.ts.map +1 -1
  124. package/dist/lowLevelInject.d.ts.map +1 -1
  125. package/dist/protocols/protocol-v2/features.d.ts +0 -4
  126. package/dist/protocols/protocol-v2/features.d.ts.map +1 -1
  127. package/dist/protocols/protocol-v2/firmware.d.ts.map +1 -1
  128. package/dist/protocols/protocol-v2/resources.d.ts +30 -0
  129. package/dist/protocols/protocol-v2/resources.d.ts.map +1 -0
  130. package/dist/protocols/protocol-v2/uiInteraction.d.ts +7 -4
  131. package/dist/protocols/protocol-v2/uiInteraction.d.ts.map +1 -1
  132. package/dist/protocols/protocol-v2/unlockPolicy.d.ts +1 -3
  133. package/dist/protocols/protocol-v2/unlockPolicy.d.ts.map +1 -1
  134. package/dist/protocols/protocol-v2/unlockPolicyRunner.d.ts +22 -0
  135. package/dist/protocols/protocol-v2/unlockPolicyRunner.d.ts.map +1 -0
  136. package/dist/protocols/protocol-v2/walletSession.d.ts +6 -1
  137. package/dist/protocols/protocol-v2/walletSession.d.ts.map +1 -1
  138. package/dist/topLevelInject.d.ts.map +1 -1
  139. package/dist/types/api/checkAllFirmwareRelease.d.ts +3 -5
  140. package/dist/types/api/checkAllFirmwareRelease.d.ts.map +1 -1
  141. package/dist/types/api/detectDeviceConnectProtocol.d.ts +4 -0
  142. package/dist/types/api/detectDeviceConnectProtocol.d.ts.map +1 -0
  143. package/dist/types/api/deviceUnlock.d.ts +5 -1
  144. package/dist/types/api/deviceUnlock.d.ts.map +1 -1
  145. package/dist/types/api/deviceUpdateBootloader.d.ts +0 -6
  146. package/dist/types/api/deviceUpdateBootloader.d.ts.map +1 -1
  147. package/dist/types/api/export.d.ts +2 -4
  148. package/dist/types/api/export.d.ts.map +1 -1
  149. package/dist/types/api/firmwareUpdate.d.ts +4 -71
  150. package/dist/types/api/firmwareUpdate.d.ts.map +1 -1
  151. package/dist/types/api/index.d.ts +7 -10
  152. package/dist/types/api/index.d.ts.map +1 -1
  153. package/dist/types/api/protocolV2.d.ts +3 -0
  154. package/dist/types/api/protocolV2.d.ts.map +1 -1
  155. package/dist/types/device.d.ts +2 -2
  156. package/dist/types/device.d.ts.map +1 -1
  157. package/dist/types/params.d.ts +1 -0
  158. package/dist/types/params.d.ts.map +1 -1
  159. package/dist/types/settings.d.ts +38 -21
  160. package/dist/types/settings.d.ts.map +1 -1
  161. package/dist/utils/deviceFeaturesCompat.d.ts +0 -1
  162. package/dist/utils/deviceFeaturesCompat.d.ts.map +1 -1
  163. package/dist/utils/deviceFeaturesUtils.d.ts +4 -0
  164. package/dist/utils/deviceFeaturesUtils.d.ts.map +1 -1
  165. package/dist/utils/deviceInfoUtils.d.ts.map +1 -1
  166. package/dist/utils/deviceSettings.d.ts.map +1 -1
  167. package/dist/utils/homescreen.d.ts +4 -0
  168. package/dist/utils/homescreen.d.ts.map +1 -1
  169. package/dist/utils/index.d.ts +1 -1
  170. package/dist/utils/index.d.ts.map +1 -1
  171. package/dist/utils/patch.d.ts +1 -1
  172. package/dist/utils/patch.d.ts.map +1 -1
  173. package/dist/utils/pro2Nft.d.ts +31 -0
  174. package/dist/utils/pro2Nft.d.ts.map +1 -0
  175. package/dist/utils/pro2Wallpaper.d.ts +10 -0
  176. package/dist/utils/pro2Wallpaper.d.ts.map +1 -1
  177. package/dist/utils/uiProgressThrottle.d.ts +3 -0
  178. package/dist/utils/uiProgressThrottle.d.ts.map +1 -0
  179. package/package.json +4 -4
  180. package/src/api/BaseMethod.ts +8 -10
  181. package/src/api/CheckAllFirmwareRelease.ts +59 -60
  182. package/src/api/DetectDeviceConnectProtocol.ts +18 -0
  183. package/src/api/FirmwareUpdate.ts +7 -15
  184. package/src/api/FirmwareUpdateV2.ts +126 -316
  185. package/src/api/FirmwareUpdateV3.ts +63 -265
  186. package/src/api/FirmwareUpdateV4.ts +597 -1005
  187. package/src/api/GetPassphraseState.ts +7 -1
  188. package/src/api/OpenWalletSession.ts +71 -17
  189. package/src/api/SearchDevices.ts +3 -1
  190. package/src/api/allnetwork/AllNetworkGetAddress.ts +21 -21
  191. package/src/api/allnetwork/AllNetworkGetAddressBase.ts +36 -11
  192. package/src/api/device/DeviceSettings.ts +5 -4
  193. package/src/api/device/DeviceUnlock.ts +8 -3
  194. package/src/api/device/DeviceUpdateBootloader.ts +6 -125
  195. package/src/api/firmware/FirmwareUpdateBaseMethod.ts +27 -83
  196. package/src/api/firmware/updateBootloader.ts +4 -19
  197. package/src/api/firmware/uploadFirmware.ts +39 -144
  198. package/src/api/helpers/protocolV2FileWrite.ts +202 -63
  199. package/src/api/index.ts +2 -0
  200. package/src/api/kaspa/KaspaGetAddress.ts +1 -1
  201. package/src/api/kaspa/KaspaSignTransaction.ts +2 -13
  202. package/src/api/polkadot/networks.ts +3 -3
  203. package/src/api/protocol-v2/DeviceUploadNft.ts +197 -0
  204. package/src/api/protocol-v2/ProtocolInfoRequest.ts +3 -1
  205. package/src/api/protocol-v2/helpers.ts +1 -1
  206. package/src/api/solana/SolSignMessage.ts +1 -1
  207. package/src/api/solana/SolSignOffchainMessage.ts +1 -1
  208. package/src/api/solana/SolSignTransaction.ts +2 -2
  209. package/src/api/sui/SuiGetAddress.ts +1 -1
  210. package/src/api/sui/SuiGetPublicKey.ts +1 -1
  211. package/src/api/sui/SuiSignMessage.ts +1 -1
  212. package/src/api/sui/SuiSignTransaction.ts +1 -1
  213. package/src/api/ton/TonGetAddress.ts +1 -1
  214. package/src/api/ton/TonSignMessage.ts +1 -1
  215. package/src/api/ton/TonSignProof.ts +1 -1
  216. package/src/api/tron/TronSignMessage.ts +2 -2
  217. package/src/api/tron/TronSignTransaction.ts +1 -1
  218. package/src/core/deviceEventRegistration.ts +4 -0
  219. package/src/core/index.ts +213 -111
  220. package/src/core/uiPromiseRegistry.ts +63 -0
  221. package/src/data/messages/messages-protocol-v2.json +25 -0
  222. package/src/data-manager/DataManager.ts +113 -41
  223. package/src/data-manager/TransportManager.ts +6 -0
  224. package/src/data-manager/connectSettings.ts +0 -11
  225. package/src/device/Device.ts +274 -49
  226. package/src/device/DeviceCommands.ts +31 -4
  227. package/src/device/DeviceConnector.ts +33 -13
  228. package/src/device/DevicePool.ts +21 -7
  229. package/src/deviceProfile/buildDeviceFeatures.ts +2 -2
  230. package/src/deviceProfile/protocolV2DeviceIdentity.ts +3 -0
  231. package/src/events/device.ts +4 -0
  232. package/src/events/logBlockEvent.ts +1 -0
  233. package/src/events/ui-promise.ts +4 -2
  234. package/src/events/ui-request.ts +36 -2
  235. package/src/events/ui-response.ts +12 -2
  236. package/src/index.ts +0 -5
  237. package/src/inject.ts +60 -24
  238. package/src/lowLevelInject.ts +7 -8
  239. package/src/protocols/protocol-v2/features.ts +10 -7
  240. package/src/protocols/protocol-v2/firmware.ts +2 -0
  241. package/src/protocols/protocol-v2/resources.ts +390 -0
  242. package/src/protocols/protocol-v2/uiInteraction.ts +46 -6
  243. package/src/protocols/protocol-v2/unlockPolicy.ts +1 -105
  244. package/src/protocols/protocol-v2/unlockPolicyRunner.ts +131 -0
  245. package/src/protocols/protocol-v2/walletSession.ts +214 -36
  246. package/src/topLevelInject.ts +7 -8
  247. package/src/types/api/checkAllFirmwareRelease.ts +3 -5
  248. package/src/types/api/detectDeviceConnectProtocol.ts +6 -0
  249. package/src/types/api/deviceUnlock.ts +12 -1
  250. package/src/types/api/deviceUpdateBootloader.ts +0 -6
  251. package/src/types/api/export.ts +1 -18
  252. package/src/types/api/firmwareUpdate.ts +6 -79
  253. package/src/types/api/index.ts +13 -14
  254. package/src/types/api/protocolV2.ts +13 -0
  255. package/src/types/device.ts +15 -3
  256. package/src/types/params.ts +7 -1
  257. package/src/types/settings.ts +60 -22
  258. package/src/utils/deviceFeaturesCompat.ts +5 -6
  259. package/src/utils/deviceFeaturesUtils.ts +14 -3
  260. package/src/utils/deviceInfoUtils.ts +2 -0
  261. package/src/utils/deviceSettings.ts +3 -0
  262. package/src/utils/homescreen.ts +32 -6
  263. package/src/utils/index.ts +6 -1
  264. package/src/utils/pro2Nft.ts +142 -0
  265. package/src/utils/pro2Wallpaper.ts +35 -8
  266. package/src/utils/uiProgressThrottle.ts +63 -0
  267. package/__tests__/device-initialize-timeout.test.ts +0 -56
  268. package/__tests__/firmware-update/check-all-firmware-release.test.ts +0 -175
  269. package/__tests__/firmware-update/firmware-artifact-source.test.ts +0 -119
  270. package/__tests__/firmware-update/firmware-host-binding.test.ts +0 -70
  271. package/__tests__/firmware-update/firmware-preparation-error.test.ts +0 -27
  272. package/__tests__/firmware-update/firmware-update-bootloader-poll.test.ts +0 -200
  273. package/__tests__/firmware-update/firmware-update-capabilities.test.ts +0 -13
  274. package/__tests__/firmware-update/firmware-update-plan-bootloader-identity.test.ts +0 -394
  275. package/__tests__/firmware-update/firmware-update-plan.test.ts +0 -593
  276. package/__tests__/firmware-update/firmware-update-prepared-plan.test.ts +0 -213
  277. package/__tests__/firmware-update/firmware-update-v3-reconnect.test.ts +0 -58
  278. package/__tests__/firmware-update/firmware-upload-source.test.ts +0 -70
  279. package/dist/api/firmware/FirmwareArtifactSource.d.ts +0 -25
  280. package/dist/api/firmware/FirmwareArtifactSource.d.ts.map +0 -1
  281. package/dist/api/firmware/FirmwareHostBinding.d.ts +0 -6
  282. package/dist/api/firmware/FirmwareHostBinding.d.ts.map +0 -1
  283. package/dist/api/firmware/FirmwarePreparationError.d.ts +0 -3
  284. package/dist/api/firmware/FirmwarePreparationError.d.ts.map +0 -1
  285. package/dist/api/firmware/FirmwareUpdateCapabilities.d.ts +0 -3
  286. package/dist/api/firmware/FirmwareUpdateCapabilities.d.ts.map +0 -1
  287. package/dist/api/firmware/FirmwareUpdatePlan.d.ts +0 -25
  288. package/dist/api/firmware/FirmwareUpdatePlan.d.ts.map +0 -1
  289. package/dist/api/firmware/FirmwareUpdatePreparedPlan.d.ts +0 -32
  290. package/dist/api/firmware/FirmwareUpdatePreparedPlan.d.ts.map +0 -1
  291. package/dist/api/firmware/progressThrottle.d.ts +0 -3
  292. package/dist/api/firmware/progressThrottle.d.ts.map +0 -1
  293. package/dist/protocols/protocol-v2/lockedError.d.ts +0 -2
  294. package/dist/protocols/protocol-v2/lockedError.d.ts.map +0 -1
  295. package/dist/protocols/protocol-v2/unlockRetry.d.ts +0 -10
  296. package/dist/protocols/protocol-v2/unlockRetry.d.ts.map +0 -1
  297. package/dist/types/api/firmwareUpdateCapabilities.d.ts +0 -9
  298. package/dist/types/api/firmwareUpdateCapabilities.d.ts.map +0 -1
  299. package/dist/types/api/firmwareUpdatePlan.d.ts +0 -28
  300. package/dist/types/api/firmwareUpdatePlan.d.ts.map +0 -1
  301. package/dist/types/api/firmwareUpdatePreparedPlan.d.ts +0 -42
  302. package/dist/types/api/firmwareUpdatePreparedPlan.d.ts.map +0 -1
  303. package/src/api/firmware/FirmwareArtifactSource.ts +0 -278
  304. package/src/api/firmware/FirmwareHostBinding.ts +0 -100
  305. package/src/api/firmware/FirmwarePreparationError.ts +0 -12
  306. package/src/api/firmware/FirmwareUpdateCapabilities.ts +0 -9
  307. package/src/api/firmware/FirmwareUpdatePlan.ts +0 -772
  308. package/src/api/firmware/FirmwareUpdatePreparedPlan.ts +0 -449
  309. package/src/api/firmware/progressThrottle.ts +0 -44
  310. package/src/protocols/protocol-v2/lockedError.ts +0 -10
  311. package/src/protocols/protocol-v2/unlockRetry.ts +0 -109
  312. package/src/types/api/firmwareUpdateCapabilities.ts +0 -9
  313. package/src/types/api/firmwareUpdatePlan.ts +0 -38
  314. package/src/types/api/firmwareUpdatePreparedPlan.ts +0 -53
@@ -1,53 +1,14 @@
1
1
  import type { EFirmwareType } from '@onekeyfe/hd-shared';
2
2
  import type { PROTO } from '../../constants';
3
3
  import type { Params, Response } from '../params';
4
- import type { FirmwareUpdatePreparedPlan } from './firmwareUpdatePreparedPlan';
5
4
 
6
5
  type IUpdateType = 'firmware' | 'ble';
7
6
 
8
- export interface FirmwareArtifactReference {
9
- artifactRef: string;
10
- size: number;
11
- sha256: string;
12
- }
13
-
14
- export interface FirmwareArtifactReader {
15
- open(input: { artifactRef: string }): Promise<{
16
- readerId: string;
17
- size: number;
18
- }>;
19
- read(input: { readerId: string; offset: number; length: number }): Promise<{
20
- data: ArrayBuffer;
21
- bytesRead: number;
22
- eof: boolean;
23
- }>;
24
- close(input: { readerId: string }): Promise<void>;
25
- }
26
-
27
- export interface FirmwareUpdateHostBinding {
28
- artifactReader: FirmwareArtifactReader;
29
- }
30
-
31
7
  export interface FirmwareUpdateBinaryParams {
32
8
  binary: ArrayBuffer;
33
9
  updateType: IUpdateType;
34
10
  }
35
11
 
36
- export interface FirmwareUpdateArtifactParams {
37
- preparedPlan: FirmwareUpdatePreparedPlan;
38
- hostBindingGeneration: number;
39
- artifact: FirmwareArtifactReference;
40
- resourceArtifact?: FirmwareArtifactReference;
41
- resourceEntries?: Array<{
42
- entryName: string;
43
- artifact: FirmwareArtifactReference;
44
- }>;
45
- updateType: IUpdateType;
46
- forcedUpdateRes?: boolean;
47
- isUpdateBootloader?: boolean;
48
- firmwareType?: EFirmwareType;
49
- }
50
-
51
12
  export interface FirmwareUpdateParams {
52
13
  version?: number[];
53
14
  updateType: IUpdateType;
@@ -76,14 +37,8 @@ export declare function firmwareUpdateV2(
76
37
  connectId: string | undefined,
77
38
  params: Params<FirmwareUpdateBinaryParams & Platform>
78
39
  ): Response<PROTO.Success>;
79
- export declare function firmwareUpdateV2(
80
- connectId: string | undefined,
81
- params: Params<FirmwareUpdateArtifactParams & Platform>
82
- ): Response<PROTO.Success>;
83
40
 
84
41
  export interface FirmwareUpdateV3Params {
85
- preparedPlan?: FirmwareUpdatePreparedPlan;
86
- hostBindingGeneration?: number;
87
42
  bleVersion?: number[];
88
43
  bleBinary?: ArrayBuffer;
89
44
  chunkSize?: number;
@@ -100,17 +55,6 @@ export interface FirmwareUpdateV3Params {
100
55
  firmwareType?: EFirmwareType;
101
56
 
102
57
  platform: IPlatform;
103
-
104
- artifactReader?: FirmwareArtifactReader;
105
- artifacts?: {
106
- ble?: FirmwareArtifactReference;
107
- firmware?: FirmwareArtifactReference;
108
- bootloader?: FirmwareArtifactReference;
109
- resourceEntries?: Array<{
110
- entryName: string;
111
- artifact: FirmwareArtifactReference;
112
- }>;
113
- };
114
58
  }
115
59
 
116
60
  /**
@@ -119,6 +63,7 @@ export interface FirmwareUpdateV3Params {
119
63
  */
120
64
  export type FirmwareUpdateV4Target =
121
65
  | 'boot'
66
+ | 'boot_resources'
122
67
  | 'app_v1'
123
68
  | 'app_v2'
124
69
  | 'coprocessor'
@@ -129,14 +74,10 @@ export type FirmwareUpdateV4Target =
129
74
  | 'se04';
130
75
 
131
76
  export interface FirmwareUpdateV4Params {
132
- preparedPlan?: FirmwareUpdatePreparedPlan;
133
- hostBindingGeneration?: number;
134
77
  platform: IPlatform;
135
- expectedDeviceId?: string;
136
78
  chunkSize?: number;
137
79
  firmwareType?: EFirmwareType;
138
80
  targetsToUpdate?: FirmwareUpdateV4Target[];
139
- expectedTargetVersions?: Partial<Record<FirmwareUpdateV4Target, string>>;
140
81
 
141
82
  /** FW_MGMT_TARGET_ROMLOADER = 2; Pro2 cannot install it through firmwareUpdateV4. */
142
83
  romloaderBinary?: ArrayBuffer;
@@ -155,31 +96,17 @@ export interface FirmwareUpdateV4Params {
155
96
  se04Binary?: ArrayBuffer;
156
97
  forcedUpdateRes?: boolean;
157
98
  /**
158
- * RESC bundle okpkg files written directly to devicePath through FilesystemFileWrite.
159
- * Manual mode installs them without version comparison.
99
+ * Arbitrary Protocol V2 resource files written directly with FilesystemFileWrite.
100
+ * Use this for manifest-driven boot resources and other non-RESC files.
160
101
  */
161
- resourceBundleFiles?: Array<{
102
+ resourceFiles?: Array<{
162
103
  binary: ArrayBuffer;
163
104
  devicePath: string;
164
- }>;
165
- artifactReader?: FirmwareArtifactReader;
166
- componentArtifacts?: Partial<
167
- Record<Exclude<FirmwareUpdateV4Target, 'resource'>, FirmwareArtifactReference>
168
- >;
169
- resourceBundleArtifacts?: Array<{
170
- name: string;
171
- artifact: FirmwareArtifactReference;
105
+ size?: number;
106
+ fileHash?: string;
172
107
  }>;
173
108
  }
174
109
 
175
- export declare function registerFirmwareUpdateHostBinding(
176
- binding: FirmwareUpdateHostBinding
177
- ): number;
178
-
179
- export declare function unregisterFirmwareUpdateHostBinding(generation?: number): boolean;
180
-
181
- export declare function getFirmwareUpdateHostBindingGeneration(): number;
182
-
183
110
  export declare function firmwareUpdateV3(
184
111
  connectId: string | undefined,
185
112
  params: Params<FirmwareUpdateV3Params>
@@ -1,6 +1,7 @@
1
1
  import type {
2
2
  deviceGetOnboardingStatus,
3
3
  deviceReboot,
4
+ deviceUploadNft,
4
5
  deviceUploadWallpaper,
5
6
  testProtocolV2Ping,
6
7
  uploadPortfolio,
@@ -18,6 +19,7 @@ import type { checkBootloaderRelease } from './checkBootloaderRelease';
18
19
  import type { checkAllFirmwareRelease } from './checkAllFirmwareRelease';
19
20
  import type { checkFirmwareTypeAvailable } from './checkFirmwareTypeAvailable';
20
21
  import type { searchDevices } from './searchDevices';
22
+ import type { detectDeviceConnectProtocol } from './detectDeviceConnectProtocol';
21
23
  import type { getFeatures } from './getFeatures';
22
24
  import type { getDeviceState } from './getDeviceState';
23
25
  import type { getOnekeyFeatures } from './getOnekeyFeatures';
@@ -30,15 +32,7 @@ import type {
30
32
  firmwareUpdateV2,
31
33
  firmwareUpdateV3,
32
34
  firmwareUpdateV4,
33
- getFirmwareUpdateHostBindingGeneration,
34
- registerFirmwareUpdateHostBinding,
35
- unregisterFirmwareUpdateHostBinding,
36
35
  } from './firmwareUpdate';
37
- import type { getFirmwareUpdateCapabilities } from './firmwareUpdateCapabilities';
38
- import type {
39
- prepareFirmwareUpdatePlan,
40
- validateFirmwareUpdatePreparedPlan,
41
- } from './firmwareUpdatePreparedPlan';
42
36
  import type { promptWebDeviceAccess } from './promptWebDeviceAccess';
43
37
  import type { deviceReset } from './deviceReset';
44
38
  import type { deviceRecovery } from './deviceRecovery';
@@ -152,6 +146,7 @@ import type { benfenSignMessage } from './benfenSignMessage';
152
146
  import type { neoGetAddress } from './neoGetAddress';
153
147
  import type { neoSignTransaction } from './neoSignTransaction';
154
148
  import type { ConnectSettings } from '../settings';
149
+ import type { HardwareConnectProtocol } from '@onekeyfe/hd-shared';
155
150
 
156
151
  export * from './export';
157
152
  export type { DeviceStateScope, GetDeviceStateParams } from './getDeviceState';
@@ -176,6 +171,14 @@ export type CoreApi = {
176
171
  removeAllListeners: typeof removeAllListeners;
177
172
  dispose: () => void | Promise<void>;
178
173
  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;
179
182
  uiResponse: typeof uiResponse;
180
183
  cancel: (connectId?: string) => void;
181
184
  updateSettings: typeof updateSettings;
@@ -203,6 +206,7 @@ export type CoreApi = {
203
206
  * Device function
204
207
  */
205
208
  searchDevices: typeof searchDevices;
209
+ detectDeviceConnectProtocol: typeof detectDeviceConnectProtocol;
206
210
  promptWebDeviceAccess: typeof promptWebDeviceAccess;
207
211
  getFeatures: typeof getFeatures;
208
212
  getDeviceState: typeof getDeviceState;
@@ -235,12 +239,6 @@ export type CoreApi = {
235
239
  firmwareUpdateV2: typeof firmwareUpdateV2;
236
240
  firmwareUpdateV3: typeof firmwareUpdateV3;
237
241
  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;
244
242
  cipherKeyValue: typeof cipherKeyValue;
245
243
 
246
244
  /**
@@ -248,6 +246,7 @@ export type CoreApi = {
248
246
  */
249
247
  deviceReboot: typeof deviceReboot;
250
248
  deviceGetOnboardingStatus: typeof deviceGetOnboardingStatus;
249
+ deviceUploadNft: typeof deviceUploadNft;
251
250
  deviceUploadWallpaper: typeof deviceUploadWallpaper;
252
251
  uploadPortfolio: typeof uploadPortfolio;
253
252
 
@@ -5,6 +5,10 @@ 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';
8
12
 
9
13
  // Re-export implementation parameter types as the single source of truth.
10
14
  export type { DeviceRebootParams, RebootTypeInput } from '../../api/protocol-v2/helpers';
@@ -12,6 +16,10 @@ export type {
12
16
  DeviceUploadWallpaperParams,
13
17
  DeviceUploadWallpaperResponse,
14
18
  } from '../../api/protocol-v2/DeviceUploadWallpaper';
19
+ export type {
20
+ DeviceUploadNftParams,
21
+ DeviceUploadNftResponse,
22
+ } from '../../api/protocol-v2/DeviceUploadNft';
15
23
 
16
24
  // ── Shared response shapes (Protocol V2 file system) ────────────────────
17
25
 
@@ -52,6 +60,11 @@ export declare function deviceUploadWallpaper(
52
60
  params: CommonParams & DeviceUploadWallpaperParams
53
61
  ): Response<DeviceUploadWallpaperResponse>;
54
62
 
63
+ export declare function deviceUploadNft(
64
+ connectId: string,
65
+ params: CommonParams & DeviceUploadNftParams
66
+ ): Response<DeviceUploadNftResponse>;
67
+
55
68
  export declare function uploadPortfolio(
56
69
  connectId: string,
57
70
  params: {
@@ -210,7 +210,9 @@ export type DeviceStateStatus = {
210
210
  recoveryMode: boolean | null;
211
211
  passphraseProtection: boolean | null;
212
212
  pinProtection: boolean | null;
213
+ /** `attach_to_pin_enabled`:是否至少存在一个 Attach PIN 绑定。 */
213
214
  attachToPinEnabled: boolean | null;
215
+ /** `unlocked_by_attach_to_pin`:本次解锁是否由 Attach PIN 完成。 */
214
216
  unlockedAttachPin: boolean | null;
215
217
  };
216
218
 
@@ -321,6 +323,7 @@ export type NormalizedFeatures = {
321
323
  sdProtection: boolean | null;
322
324
  wipeCodeProtection: boolean | null;
323
325
  passphraseAlwaysOnDevice: boolean | null;
326
+ /** `attach_to_pin_enabled`:是否至少存在一个 Attach PIN 绑定。 */
324
327
  attachToPinEnabled?: boolean | null;
325
328
  safetyChecks: Enum_SafetyCheckLevel | null;
326
329
  autoLockDelayMs: number | null;
@@ -371,14 +374,21 @@ export type IDeviceType =
371
374
  | EDeviceType.Mini
372
375
  | EDeviceType.Touch
373
376
  | EDeviceType.Pro
374
- | EDeviceType.Pro2;
377
+ | EDeviceType.Pro2
378
+ | EDeviceType.Neo;
375
379
 
376
380
  /**
377
381
  * model_classic: 'classic' | 'classic1s' | 'classicpure'
378
382
  * model_mini: 'classic' | 'classic1s' | 'classicpure' | 'mini'
379
383
  * model_touch: 'touch' | 'pro'
384
+ * model_pro2: 'pro2' | 'neo'
380
385
  */
381
- export type IDeviceModel = 'model_classic' | 'model_mini' | 'model_touch' | 'model_classic1s';
386
+ export type IDeviceModel =
387
+ | 'model_classic'
388
+ | 'model_mini'
389
+ | 'model_touch'
390
+ | 'model_classic1s'
391
+ | 'model_pro2';
382
392
 
383
393
  export const DeviceModelToTypes: { [deviceModel in IDeviceModel]: IDeviceType[] } = {
384
394
  model_mini: [
@@ -388,6 +398,7 @@ export const DeviceModelToTypes: { [deviceModel in IDeviceModel]: IDeviceType[]
388
398
  EDeviceType.Mini,
389
399
  ],
390
400
  model_touch: [EDeviceType.Touch, EDeviceType.Pro],
401
+ model_pro2: [EDeviceType.Pro2, EDeviceType.Neo],
391
402
  model_classic: [EDeviceType.Classic, EDeviceType.Classic1s, EDeviceType.ClassicPure],
392
403
  model_classic1s: [EDeviceType.Classic1s, EDeviceType.ClassicPure],
393
404
  };
@@ -399,7 +410,8 @@ export const DeviceTypeToModels: { [deviceType in IDeviceType]: IDeviceModel[] }
399
410
  [EDeviceType.Mini]: ['model_mini'],
400
411
  [EDeviceType.Touch]: ['model_touch'],
401
412
  [EDeviceType.Pro]: ['model_touch'],
402
- [EDeviceType.Pro2]: [],
413
+ [EDeviceType.Pro2]: ['model_pro2'],
414
+ [EDeviceType.Neo]: ['model_pro2'],
403
415
  [EDeviceType.Unknown]: [],
404
416
  };
405
417
 
@@ -61,9 +61,15 @@ export interface CommonParams {
61
61
 
62
62
  /**
63
63
  * Strictly expected transport protocol. The SDK actively verifies this value and
64
- * rejects a mismatch. If omitted, a cached protocol only influences probe order.
64
+ * rejects a mismatch. After a successful probe, the cached protocol is also strict.
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;
67
73
  }
68
74
 
69
75
  export type Params<T> = CommonParams & T & { bundle?: undefined };
@@ -31,8 +31,6 @@ export type ConnectSettings = {
31
31
  timestamp: number;
32
32
  isFrame?: boolean;
33
33
  preRelease?: boolean;
34
- firmwareManifestMode?: 'sdk-managed' | 'external-only';
35
- preloadedConfig?: RemoteConfigResponse;
36
34
  fetchConfig?: boolean;
37
35
  extension?: string;
38
36
  configFetcher?: (url: string) => Promise<RemoteConfigResponse | null>;
@@ -60,18 +58,58 @@ export type IProtocolV2FirmwareComponent = {
60
58
  fingerprint?: string;
61
59
  /** OKPP payload hash, used to detect same-version package changes. */
62
60
  payloadHash?: string;
63
- expectedSize?: number;
64
61
  version?: IVersionArray;
65
62
  };
66
63
 
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
+ /** A file from the Protocol V2 resource manifest, written directly with FileWrite. */
85
+ export type IProtocolV2ResourceFile = {
86
+ name?: string;
87
+ url: string;
88
+ devicePath: string;
89
+ size: number;
90
+ /** SHA-256 of the complete file. */
91
+ fileHash: string;
92
+ };
93
+
94
+ /** Optional Protocol V2 boot resources restored as individual files. */
95
+ export type IProtocolV2BootResources = {
96
+ required: false;
97
+ target: 'RES';
98
+ manifestUrl?: string;
99
+ files: IProtocolV2ResourceFile[];
100
+ };
101
+
102
+ export type IProtocolV2Resources = {
103
+ stable: IProtocolV2Resource[];
104
+ boot?: IProtocolV2BootResources;
105
+ };
106
+
67
107
  /** Pro2 RESC bundle okpkg descriptor for incremental FileWrite synchronization. */
68
108
  export type IProtocolV2ResourceBundle = {
69
109
  /** Bundle name, such as images, animation, translations, or fonts_roobert. */
70
110
  name: string;
71
111
  /** Download URL. */
72
112
  url: string;
73
- fingerprint?: string;
74
- expectedSize?: number;
75
113
  /** Device target path, such as vol0:/bundles/images/images.okpkg. */
76
114
  devicePath: string;
77
115
  /** okpkg payload_version used to skip matching content after FileRead. */
@@ -93,16 +131,10 @@ export type IFirmwareReleaseInfo = {
93
131
  firmwareType?: EFirmwareType;
94
132
  /** Firmware UI resource */
95
133
  resource?: string;
96
- resourceFingerprint?: string;
97
- resourceExpectedSize?: number;
98
134
  /** Firmware full UI resource */
99
135
  fullResource?: string;
100
- fullResourceFingerprint?: string;
101
- fullResourceExpectedSize?: number;
102
136
  fullResourceRange?: string[];
103
137
  bootloaderResource?: string;
104
- bootloaderFingerprint?: string;
105
- bootloaderExpectedSize?: number;
106
138
  bootloaderVersion?: IVersionArray;
107
139
  displayBootloaderVersion?: IVersionArray;
108
140
  bootloaderRelatedFirmwareVersion?: IVersionArray;
@@ -115,7 +147,6 @@ export type IFirmwareReleaseInfo = {
115
147
  [k in ILocale]: string;
116
148
  };
117
149
  fingerprint: string;
118
- expectedSize?: number;
119
150
  version: IVersionArray;
120
151
  changelog: {
121
152
  [k in ILocale]: string;
@@ -131,7 +162,6 @@ export type IBLEFirmwareReleaseInfo = {
131
162
  webUpdate: string;
132
163
  fingerprint: string;
133
164
  fingerprintWeb: string;
134
- expectedSize?: number;
135
165
  version: IVersionArray;
136
166
  changelog: {
137
167
  [k in ILocale]: string;
@@ -139,17 +169,25 @@ export type IBLEFirmwareReleaseInfo = {
139
169
  };
140
170
 
141
171
  type IKnownDevice = Exclude<IDeviceType, 'unknown'>;
172
+ type ILegacyKnownDevice = Exclude<IKnownDevice, 'neo'>;
173
+
174
+ type IDeviceReleaseInfo = {
175
+ firmware: IFirmwareReleaseInfo[];
176
+ /** Protocol V2 payload package set */
177
+ 'firmware-v1'?: IFirmwareReleaseInfo[];
178
+ 'firmware-v2'?: IFirmwareReleaseInfo[];
179
+ 'firmware-v8'?: IFirmwareReleaseInfo[];
180
+ 'firmware-btc-v8'?: IFirmwareReleaseInfo[];
181
+ ble: IBLEFirmwareReleaseInfo[];
182
+ /** Independent Protocol V2 resource release configuration. */
183
+ resources?: IProtocolV2Resources;
184
+ };
142
185
 
143
186
  export type DeviceTypeMap = {
144
- [k in IKnownDevice]: {
145
- firmware: IFirmwareReleaseInfo[];
146
- /** Pro2 Protocol V2 payload package set */
147
- 'firmware-v1'?: IFirmwareReleaseInfo[];
148
- 'firmware-v2'?: IFirmwareReleaseInfo[];
149
- 'firmware-v8'?: IFirmwareReleaseInfo[];
150
- 'firmware-btc-v8'?: IFirmwareReleaseInfo[];
151
- ble: IBLEFirmwareReleaseInfo[];
152
- };
187
+ [k in ILegacyKnownDevice]: IDeviceReleaseInfo;
188
+ } & {
189
+ /** Optional until every remote-config producer publishes a Neo entry. */
190
+ neo?: IDeviceReleaseInfo;
153
191
  };
154
192
 
155
193
  export type AssetsMap = {
@@ -37,12 +37,6 @@ 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
-
46
40
  export const resolveDeviceType = (features?: DeviceFeaturesInput): IDeviceType => {
47
41
  if (!features || typeof features !== 'object') {
48
42
  return EDeviceType.Unknown;
@@ -66,6 +60,8 @@ export const resolveDeviceType = (features?: DeviceFeaturesInput): IDeviceType =
66
60
  return EDeviceType.Pro;
67
61
  case 'PRO2':
68
62
  return EDeviceType.Pro2;
63
+ case 'NEO':
64
+ return EDeviceType.Neo;
69
65
  case 'PURE':
70
66
  return EDeviceType.ClassicPure;
71
67
  default:
@@ -75,6 +71,9 @@ export const resolveDeviceType = (features?: DeviceFeaturesInput): IDeviceType =
75
71
  if (compatible.model?.toString().toLowerCase() === EDeviceType.Pro2) {
76
72
  return EDeviceType.Pro2;
77
73
  }
74
+ if (compatible.model?.toString().toLowerCase() === EDeviceType.Neo) {
75
+ return EDeviceType.Neo;
76
+ }
78
77
 
79
78
  const serialNo = resolveDeviceSerialNo(features);
80
79
  const prefix = serialNo.slice(0, 2).toLowerCase();
@@ -74,7 +74,8 @@ export const supportInputPinOnSoftware = (features?: Features): SupportFeatureTy
74
74
  if (
75
75
  deviceType === EDeviceType.Touch ||
76
76
  deviceType === EDeviceType.Pro ||
77
- deviceType === EDeviceType.Pro2
77
+ deviceType === EDeviceType.Pro2 ||
78
+ deviceType === EDeviceType.Neo
78
79
  ) {
79
80
  return { support: false };
80
81
  }
@@ -90,7 +91,8 @@ export const supportNewPassphrase = (features?: Features): SupportFeatureType =>
90
91
  if (
91
92
  deviceType === EDeviceType.Touch ||
92
93
  deviceType === EDeviceType.Pro ||
93
- deviceType === EDeviceType.Pro2
94
+ deviceType === EDeviceType.Pro2 ||
95
+ deviceType === EDeviceType.Neo
94
96
  ) {
95
97
  return { support: true };
96
98
  }
@@ -106,6 +108,8 @@ export const getPassphraseStateWithRefreshDeviceInfo = async (
106
108
  expectPassphraseState?: string;
107
109
  onlyMainPin?: boolean;
108
110
  initSession?: boolean;
111
+ deriveCardano?: boolean;
112
+ rejectAttachPinForMainWallet?: boolean;
109
113
  }
110
114
  ) => {
111
115
  if (device.isProtocolV2()) {
@@ -121,6 +125,8 @@ export const getPassphraseStateWithRefreshDeviceInfo = async (
121
125
  initSession: options?.initSession,
122
126
  expectedPassphraseState: options?.expectPassphraseState,
123
127
  onlyMainPin: options?.onlyMainPin,
128
+ deriveCardano: options?.deriveCardano,
129
+ rejectAttachPinForMainWallet: options?.rejectAttachPinForMainWallet,
124
130
  });
125
131
  }
126
132
 
@@ -139,7 +145,8 @@ export const getPassphraseStateWithRefreshDeviceInfo = async (
139
145
  const isModeT =
140
146
  deviceType === EDeviceType.Touch ||
141
147
  deviceType === EDeviceType.Pro ||
142
- deviceType === EDeviceType.Pro2;
148
+ deviceType === EDeviceType.Pro2 ||
149
+ deviceType === EDeviceType.Neo;
143
150
 
144
151
  // 如果可以获取到 passphraseState,但是设备 features 显示设备未开启 passphrase,需要刷新设备状态
145
152
  // if passphraseState can be obtained, but the device features show that the device has not enabled passphrase, the device status needs to be refreshed
@@ -185,6 +192,8 @@ export const getPassphraseState = async (
185
192
  expectPassphraseState?: string;
186
193
  onlyMainPin?: boolean;
187
194
  initSession?: boolean;
195
+ deriveCardano?: boolean;
196
+ rejectAttachPinForMainWallet?: boolean;
188
197
  }
189
198
  ): Promise<{
190
199
  passphraseState: string | undefined;
@@ -205,6 +214,8 @@ export const getPassphraseState = async (
205
214
  initSession: options?.initSession,
206
215
  expectedPassphraseState: options?.expectPassphraseState,
207
216
  onlyMainPin: options?.onlyMainPin,
217
+ deriveCardano: options?.deriveCardano,
218
+ rejectAttachPinForMainWallet: options?.rejectAttachPinForMainWallet,
208
219
  });
209
220
  }
210
221
 
@@ -31,6 +31,7 @@ export const getDeviceTypeByBleName = (name?: string): IDeviceType => {
31
31
  if (/^Touch/i.test(name)) return EDeviceType.Touch;
32
32
 
33
33
  if (/\bPro\s*2\b/i.test(name) || /^Pro2/i.test(name)) return EDeviceType.Pro2;
34
+ if (/\bNeo\b/i.test(name) || /^Neo/i.test(name)) return EDeviceType.Neo;
34
35
  if (/\bPro\b/i.test(name) || /^Pro/i.test(name)) return EDeviceType.Pro;
35
36
 
36
37
  return EDeviceType.Unknown;
@@ -93,6 +94,7 @@ export const getMethodVersionRange = (
93
94
  }
94
95
 
95
96
  const modelFallbacks: IDeviceModel[] = [
97
+ 'model_pro2',
96
98
  'model_classic1s',
97
99
  'model_classic',
98
100
  'model_mini',
@@ -127,6 +127,7 @@ export const getLanguageConfig = (deviceType: IDeviceType): Record<string, strin
127
127
  keys = Object.keys(LANGUAGE_LABELS) as LanguageKey[];
128
128
  break;
129
129
  case EDeviceType.Pro2:
130
+ case EDeviceType.Neo:
130
131
  return PRO2_LANGUAGE_OPTIONS.map(option => ({ ...option }));
131
132
  default:
132
133
  keys = [];
@@ -176,6 +177,7 @@ export const getAutoLockOptions = (
176
177
  case EDeviceType.Touch:
177
178
  case EDeviceType.Pro:
178
179
  case EDeviceType.Pro2:
180
+ case EDeviceType.Neo:
179
181
  return withNever([30_000, 60_000, 120_000, 300_000, 600_000, 1_800_000], protocol);
180
182
  default:
181
183
  return [];
@@ -197,6 +199,7 @@ export const getAutoShutDownOptions = (
197
199
  case EDeviceType.Pro:
198
200
  return withNever([60_000, 120_000, 300_000, 600_000], protocol);
199
201
  case EDeviceType.Pro2:
202
+ case EDeviceType.Neo:
200
203
  return withNever([60_000, 120_000, 300_000, 600_000, 1_800_000], protocol);
201
204
  default:
202
205
  return [];
@@ -4,6 +4,12 @@ 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';
7
13
 
8
14
  import type { Features, IDeviceType } from '../types';
9
15
 
@@ -302,6 +308,31 @@ type SizeConfig = {
302
308
  radius?: number;
303
309
  };
304
310
 
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
+
305
336
  export const getHomeScreenSize = ({
306
337
  deviceType,
307
338
  homeScreenType,
@@ -312,12 +343,7 @@ export const getHomeScreenSize = ({
312
343
  thumbnail?: boolean;
313
344
  }) => {
314
345
  if (deviceType === EDeviceType.Pro2) {
315
- return thumbnail
316
- ? undefined
317
- : {
318
- width: PRO2_WALLPAPER_WIDTH,
319
- height: PRO2_WALLPAPER_HEIGHT,
320
- };
346
+ return thumbnail ? undefined : { width: PRO2_WALLPAPER_WIDTH, height: PRO2_WALLPAPER_HEIGHT };
321
347
  }
322
348
 
323
349
  const sizes: Partial<
@@ -54,7 +54,12 @@ 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 { getHomeScreenHex, getHomeScreenDefaultList, getHomeScreenSize } from './homescreen';
57
+ export {
58
+ getHomeScreenHex,
59
+ getHomeScreenDefaultList,
60
+ getHomeScreenSize,
61
+ getNftSize,
62
+ } from './homescreen';
58
63
  export { encodePro2Wallpaper, PRO2_WALLPAPER_HEIGHT, PRO2_WALLPAPER_WIDTH } from './pro2Wallpaper';
59
64
  export type { Pro2WallpaperColorFormat } from './pro2Wallpaper';
60
65