@onekeyfe/hd-core 1.1.27-alpha.41 → 1.1.27-alpha.6

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 (359) hide show
  1. package/__tests__/DeviceCommands.test.ts +99 -0
  2. package/__tests__/evmLedgerLegacySafety.test.ts +261 -0
  3. package/__tests__/evmSignTransaction.test.ts +1 -1
  4. package/__tests__/evmSignTypedData.test.ts +1 -1
  5. package/__tests__/preInitialize.test.ts +22 -0
  6. package/dist/api/BaseMethod.d.ts +7 -1
  7. package/dist/api/BaseMethod.d.ts.map +1 -1
  8. package/dist/api/FirmwareUpdateV3.d.ts +0 -1
  9. package/dist/api/FirmwareUpdateV3.d.ts.map +1 -1
  10. package/dist/api/GetFeatures.d.ts +1 -1
  11. package/dist/api/GetOnekeyFeatures.d.ts.map +1 -1
  12. package/dist/api/GetPassphraseState.d.ts +1 -6
  13. package/dist/api/GetPassphraseState.d.ts.map +1 -1
  14. package/dist/api/SearchDevices.d.ts +1 -2
  15. package/dist/api/SearchDevices.d.ts.map +1 -1
  16. package/dist/api/alephium/AlephiumGetAddress.d.ts +6 -2
  17. package/dist/api/alephium/AlephiumGetAddress.d.ts.map +1 -1
  18. package/dist/api/alephium/AlephiumSignMessage.d.ts +5 -2
  19. package/dist/api/alephium/AlephiumSignMessage.d.ts.map +1 -1
  20. package/dist/api/alephium/AlephiumSignTransaction.d.ts +5 -2
  21. package/dist/api/alephium/AlephiumSignTransaction.d.ts.map +1 -1
  22. package/dist/api/algo/AlgoSignTransaction.d.ts.map +1 -1
  23. package/dist/api/allnetwork/AllNetworkGetAddressBase.d.ts.map +1 -1
  24. package/dist/api/aptos/AptosSignInMessage.d.ts.map +1 -1
  25. package/dist/api/aptos/AptosSignMessage.d.ts.map +1 -1
  26. package/dist/api/aptos/AptosSignTransaction.d.ts.map +1 -1
  27. package/dist/api/benfen/BenfenGetAddress.d.ts +9 -2
  28. package/dist/api/benfen/BenfenGetAddress.d.ts.map +1 -1
  29. package/dist/api/benfen/BenfenGetPublicKey.d.ts +9 -2
  30. package/dist/api/benfen/BenfenGetPublicKey.d.ts.map +1 -1
  31. package/dist/api/benfen/BenfenSignMessage.d.ts +8 -2
  32. package/dist/api/benfen/BenfenSignMessage.d.ts.map +1 -1
  33. package/dist/api/benfen/BenfenSignTransaction.d.ts +8 -2
  34. package/dist/api/benfen/BenfenSignTransaction.d.ts.map +1 -1
  35. package/dist/api/btc/BTCGetAddress.d.ts +11 -1
  36. package/dist/api/btc/BTCGetAddress.d.ts.map +1 -1
  37. package/dist/api/btc/BTCGetPublicKey.d.ts +11 -1
  38. package/dist/api/btc/BTCGetPublicKey.d.ts.map +1 -1
  39. package/dist/api/btc/BTCSignMessage.d.ts +15 -1
  40. package/dist/api/btc/BTCSignMessage.d.ts.map +1 -1
  41. package/dist/api/btc/BTCSignPsbt.d.ts.map +1 -1
  42. package/dist/api/btc/BTCSignTransaction.d.ts +11 -1
  43. package/dist/api/btc/BTCSignTransaction.d.ts.map +1 -1
  44. package/dist/api/btc/BTCVerifyMessage.d.ts +11 -1
  45. package/dist/api/btc/BTCVerifyMessage.d.ts.map +1 -1
  46. package/dist/api/btc/helpers/versionLimit.d.ts +11 -2
  47. package/dist/api/btc/helpers/versionLimit.d.ts.map +1 -1
  48. package/dist/api/cardano/CardanoSignMessage.d.ts.map +1 -1
  49. package/dist/api/cardano/CardanoSignTransaction.d.ts.map +1 -1
  50. package/dist/api/conflux/ConfluxSignMessage.d.ts.map +1 -1
  51. package/dist/api/conflux/ConfluxSignMessageCIP23.d.ts.map +1 -1
  52. package/dist/api/conflux/ConfluxSignTransaction.d.ts.map +1 -1
  53. package/dist/api/cosmos/CosmosSignTransaction.d.ts.map +1 -1
  54. package/dist/api/device/DeviceRebootToBoardloader.d.ts +1 -1
  55. package/dist/api/device/DeviceRebootToBoardloader.d.ts.map +1 -1
  56. package/dist/api/device/DeviceRebootToBootloader.d.ts.map +1 -1
  57. package/dist/api/device/PreInitialize.d.ts +6 -0
  58. package/dist/api/device/PreInitialize.d.ts.map +1 -0
  59. package/dist/api/dynex/DnxGetAddress.d.ts.map +1 -1
  60. package/dist/api/dynex/DnxSignTransaction.d.ts.map +1 -1
  61. package/dist/api/evm/EVMSignMessage.d.ts.map +1 -1
  62. package/dist/api/evm/EVMSignMessageEIP712.d.ts +8 -2
  63. package/dist/api/evm/EVMSignMessageEIP712.d.ts.map +1 -1
  64. package/dist/api/evm/EVMSignTransaction.d.ts.map +1 -1
  65. package/dist/api/evm/EVMSignTypedData.d.ts.map +1 -1
  66. package/dist/api/evm/latest/signTypedData.d.ts +1 -1
  67. package/dist/api/evm/latest/signTypedData.d.ts.map +1 -1
  68. package/dist/api/evm/legacyV1/signTypedData.d.ts +1 -1
  69. package/dist/api/evm/legacyV1/signTypedData.d.ts.map +1 -1
  70. package/dist/api/filecoin/FilecoinSignTransaction.d.ts.map +1 -1
  71. package/dist/api/firmware/FirmwareUpdateBaseMethod.d.ts +2 -10
  72. package/dist/api/firmware/FirmwareUpdateBaseMethod.d.ts.map +1 -1
  73. package/dist/api/index.d.ts +1 -28
  74. package/dist/api/index.d.ts.map +1 -1
  75. package/dist/api/kaspa/KaspaSignTransaction.d.ts.map +1 -1
  76. package/dist/api/near/NearSignTransaction.d.ts.map +1 -1
  77. package/dist/api/nem/NEMSignTransaction.d.ts.map +1 -1
  78. package/dist/api/neo/NeoGetAddress.d.ts +8 -2
  79. package/dist/api/neo/NeoGetAddress.d.ts.map +1 -1
  80. package/dist/api/neo/NeoSignTransaction.d.ts +8 -2
  81. package/dist/api/neo/NeoSignTransaction.d.ts.map +1 -1
  82. package/dist/api/nervos/NervosGetAddress.d.ts +9 -2
  83. package/dist/api/nervos/NervosGetAddress.d.ts.map +1 -1
  84. package/dist/api/nervos/NervosSignTransaction.d.ts +9 -2
  85. package/dist/api/nervos/NervosSignTransaction.d.ts.map +1 -1
  86. package/dist/api/nexa/NexaGetAddress.d.ts +8 -2
  87. package/dist/api/nexa/NexaGetAddress.d.ts.map +1 -1
  88. package/dist/api/nexa/NexaSignTransaction.d.ts +9 -2
  89. package/dist/api/nexa/NexaSignTransaction.d.ts.map +1 -1
  90. package/dist/api/nostr/NostrSignEvent.d.ts.map +1 -1
  91. package/dist/api/nostr/NostrSignSchnorr.d.ts.map +1 -1
  92. package/dist/api/polkadot/PolkadotSignTransaction.d.ts.map +1 -1
  93. package/dist/api/scdo/ScdoGetAddress.d.ts +6 -2
  94. package/dist/api/scdo/ScdoGetAddress.d.ts.map +1 -1
  95. package/dist/api/scdo/ScdoSignMessage.d.ts +5 -2
  96. package/dist/api/scdo/ScdoSignMessage.d.ts.map +1 -1
  97. package/dist/api/scdo/ScdoSignTransaction.d.ts +5 -2
  98. package/dist/api/scdo/ScdoSignTransaction.d.ts.map +1 -1
  99. package/dist/api/solana/SolGetAddress.d.ts +0 -1
  100. package/dist/api/solana/SolGetAddress.d.ts.map +1 -1
  101. package/dist/api/solana/SolSignMessage.d.ts +0 -4
  102. package/dist/api/solana/SolSignMessage.d.ts.map +1 -1
  103. package/dist/api/solana/SolSignOffchainMessage.d.ts +0 -4
  104. package/dist/api/solana/SolSignOffchainMessage.d.ts.map +1 -1
  105. package/dist/api/solana/SolSignTransaction.d.ts +0 -8
  106. package/dist/api/solana/SolSignTransaction.d.ts.map +1 -1
  107. package/dist/api/starcoin/StarcoinSignMessage.d.ts.map +1 -1
  108. package/dist/api/starcoin/StarcoinSignTransaction.d.ts.map +1 -1
  109. package/dist/api/stellar/StellarGetAddress.d.ts +1 -2
  110. package/dist/api/stellar/StellarGetAddress.d.ts.map +1 -1
  111. package/dist/api/stellar/StellarSignTransaction.d.ts +1 -2
  112. package/dist/api/stellar/StellarSignTransaction.d.ts.map +1 -1
  113. package/dist/api/sui/SuiSignMessage.d.ts.map +1 -1
  114. package/dist/api/sui/SuiSignTransaction.d.ts +2 -2
  115. package/dist/api/sui/SuiSignTransaction.d.ts.map +1 -1
  116. package/dist/api/ton/TonSignData.d.ts.map +1 -1
  117. package/dist/api/ton/TonSignMessage.d.ts.map +1 -1
  118. package/dist/api/ton/TonSignProof.d.ts.map +1 -1
  119. package/dist/api/tron/TronSignMessage.d.ts +0 -4
  120. package/dist/api/tron/TronSignMessage.d.ts.map +1 -1
  121. package/dist/api/tron/TronSignTransaction.d.ts +0 -4
  122. package/dist/api/tron/TronSignTransaction.d.ts.map +1 -1
  123. package/dist/api/xrp/XrpSignTransaction.d.ts.map +1 -1
  124. package/dist/core/PollingStateManager.d.ts +8 -0
  125. package/dist/core/PollingStateManager.d.ts.map +1 -0
  126. package/dist/core/RequestQueue.d.ts +1 -1
  127. package/dist/core/RequestQueue.d.ts.map +1 -1
  128. package/dist/core/index.d.ts.map +1 -1
  129. package/dist/data-manager/DataManager.d.ts +4 -7
  130. package/dist/data-manager/DataManager.d.ts.map +1 -1
  131. package/dist/data-manager/MessagesConfig.d.ts +2 -2
  132. package/dist/data-manager/MessagesConfig.d.ts.map +1 -1
  133. package/dist/data-manager/TransportManager.d.ts +4 -5
  134. package/dist/data-manager/TransportManager.d.ts.map +1 -1
  135. package/dist/device/Device.d.ts +18 -5
  136. package/dist/device/Device.d.ts.map +1 -1
  137. package/dist/device/DeviceCommands.d.ts +8 -8
  138. package/dist/device/DeviceCommands.d.ts.map +1 -1
  139. package/dist/device/DeviceConnector.d.ts +1 -2
  140. package/dist/device/DeviceConnector.d.ts.map +1 -1
  141. package/dist/events/ui-request.d.ts +0 -8
  142. package/dist/events/ui-request.d.ts.map +1 -1
  143. package/dist/index.d.ts +43 -292
  144. package/dist/index.js +1009 -16201
  145. package/dist/inject.d.ts.map +1 -1
  146. package/dist/types/api/export.d.ts +1 -1
  147. package/dist/types/api/export.d.ts.map +1 -1
  148. package/dist/types/api/firmwareUpdate.d.ts +0 -7
  149. package/dist/types/api/firmwareUpdate.d.ts.map +1 -1
  150. package/dist/types/api/getPassphraseState.d.ts +1 -10
  151. package/dist/types/api/getPassphraseState.d.ts.map +1 -1
  152. package/dist/types/api/index.d.ts +3 -33
  153. package/dist/types/api/index.d.ts.map +1 -1
  154. package/dist/types/api/preInitialize.d.ts +3 -0
  155. package/dist/types/api/preInitialize.d.ts.map +1 -0
  156. package/dist/types/api/searchDevices.d.ts +2 -2
  157. package/dist/types/api/searchDevices.d.ts.map +1 -1
  158. package/dist/types/device.d.ts +2 -6
  159. package/dist/types/device.d.ts.map +1 -1
  160. package/dist/types/params.d.ts +1 -2
  161. package/dist/types/params.d.ts.map +1 -1
  162. package/dist/types/settings.d.ts +1 -1
  163. package/dist/types/settings.d.ts.map +1 -1
  164. package/dist/utils/deviceFeaturesUtils.d.ts +3 -5
  165. package/dist/utils/deviceFeaturesUtils.d.ts.map +1 -1
  166. package/dist/utils/deviceInfoUtils.d.ts +0 -1
  167. package/dist/utils/deviceInfoUtils.d.ts.map +1 -1
  168. package/dist/utils/index.d.ts +1 -1
  169. package/dist/utils/index.d.ts.map +1 -1
  170. package/dist/utils/patch.d.ts +1 -1
  171. package/dist/utils/patch.d.ts.map +1 -1
  172. package/dist/utils/versionUtils.d.ts +1 -1
  173. package/package.json +4 -4
  174. package/src/api/BaseMethod.ts +82 -7
  175. package/src/api/FirmwareUpdateV3.ts +4 -21
  176. package/src/api/GetOnekeyFeatures.ts +3 -75
  177. package/src/api/GetPassphraseState.ts +7 -16
  178. package/src/api/SearchDevices.ts +2 -7
  179. package/src/api/alephium/AlephiumGetAddress.ts +2 -6
  180. package/src/api/alephium/AlephiumSignMessage.ts +2 -6
  181. package/src/api/alephium/AlephiumSignTransaction.ts +3 -6
  182. package/src/api/algo/AlgoSignTransaction.ts +1 -0
  183. package/src/api/allnetwork/AllNetworkGetAddressBase.ts +9 -18
  184. package/src/api/aptos/AptosSignInMessage.ts +1 -0
  185. package/src/api/aptos/AptosSignMessage.ts +1 -0
  186. package/src/api/aptos/AptosSignTransaction.ts +1 -0
  187. package/src/api/benfen/BenfenGetAddress.ts +2 -6
  188. package/src/api/benfen/BenfenGetPublicKey.ts +2 -6
  189. package/src/api/benfen/BenfenSignMessage.ts +2 -6
  190. package/src/api/benfen/BenfenSignTransaction.ts +2 -6
  191. package/src/api/btc/BTCSignMessage.ts +1 -0
  192. package/src/api/btc/BTCSignPsbt.ts +1 -0
  193. package/src/api/btc/BTCSignTransaction.ts +1 -0
  194. package/src/api/btc/helpers/versionLimit.ts +1 -7
  195. package/src/api/cardano/CardanoSignMessage.ts +1 -0
  196. package/src/api/cardano/CardanoSignTransaction.ts +1 -0
  197. package/src/api/conflux/ConfluxSignMessage.ts +1 -0
  198. package/src/api/conflux/ConfluxSignMessageCIP23.ts +1 -0
  199. package/src/api/conflux/ConfluxSignTransaction.ts +3 -5
  200. package/src/api/cosmos/CosmosSignTransaction.ts +1 -0
  201. package/src/api/device/DeviceRebootToBoardloader.ts +1 -10
  202. package/src/api/device/DeviceRebootToBootloader.ts +1 -10
  203. package/src/api/device/PreInitialize.ts +41 -0
  204. package/src/api/dynex/DnxGetAddress.ts +0 -7
  205. package/src/api/dynex/DnxSignTransaction.ts +1 -7
  206. package/src/api/evm/EVMGetAddress.ts +1 -1
  207. package/src/api/evm/EVMGetPublicKey.ts +1 -1
  208. package/src/api/evm/EVMSignMessage.ts +3 -1
  209. package/src/api/evm/EVMSignMessageEIP712.ts +2 -14
  210. package/src/api/evm/EVMSignTransaction.ts +3 -1
  211. package/src/api/evm/EVMSignTypedData.ts +8 -6
  212. package/src/api/evm/EVMVerifyMessage.ts +1 -1
  213. package/src/api/filecoin/FilecoinSignTransaction.ts +1 -0
  214. package/src/api/firmware/FirmwareUpdateBaseMethod.ts +4 -27
  215. package/src/api/index.ts +1 -30
  216. package/src/api/kaspa/KaspaSignTransaction.ts +1 -0
  217. package/src/api/near/NearSignTransaction.ts +1 -0
  218. package/src/api/nem/NEMSignTransaction.ts +1 -0
  219. package/src/api/neo/NeoGetAddress.ts +1 -6
  220. package/src/api/neo/NeoSignTransaction.ts +2 -6
  221. package/src/api/nervos/NervosGetAddress.ts +2 -6
  222. package/src/api/nervos/NervosSignTransaction.ts +3 -6
  223. package/src/api/nexa/NexaGetAddress.ts +2 -6
  224. package/src/api/nexa/NexaSignTransaction.ts +4 -6
  225. package/src/api/nostr/NostrSignEvent.ts +1 -0
  226. package/src/api/nostr/NostrSignSchnorr.ts +1 -0
  227. package/src/api/polkadot/PolkadotSignTransaction.ts +1 -0
  228. package/src/api/scdo/ScdoGetAddress.ts +2 -6
  229. package/src/api/scdo/ScdoSignMessage.ts +2 -6
  230. package/src/api/scdo/ScdoSignTransaction.ts +3 -6
  231. package/src/api/solana/SolGetAddress.ts +0 -4
  232. package/src/api/solana/SolSignMessage.ts +1 -4
  233. package/src/api/solana/SolSignOffchainMessage.ts +1 -4
  234. package/src/api/solana/SolSignTransaction.ts +1 -8
  235. package/src/api/starcoin/StarcoinSignMessage.ts +1 -0
  236. package/src/api/starcoin/StarcoinSignTransaction.ts +1 -0
  237. package/src/api/stellar/StellarGetAddress.ts +1 -10
  238. package/src/api/stellar/StellarSignTransaction.ts +2 -14
  239. package/src/api/sui/SuiSignMessage.ts +1 -0
  240. package/src/api/sui/SuiSignTransaction.ts +10 -12
  241. package/src/api/ton/TonSignData.ts +1 -0
  242. package/src/api/ton/TonSignMessage.ts +1 -0
  243. package/src/api/ton/TonSignProof.ts +1 -0
  244. package/src/api/tron/TronSignMessage.ts +2 -5
  245. package/src/api/tron/TronSignTransaction.ts +1 -4
  246. package/src/api/xrp/XrpSignTransaction.ts +2 -1
  247. package/src/core/PollingStateManager.ts +47 -0
  248. package/src/core/RequestQueue.ts +10 -3
  249. package/src/core/index.ts +153 -62
  250. package/src/data-manager/DataManager.ts +7 -12
  251. package/src/data-manager/MessagesConfig.ts +14 -14
  252. package/src/data-manager/TransportManager.ts +12 -38
  253. package/src/device/Device.ts +82 -98
  254. package/src/device/DeviceCommands.ts +26 -166
  255. package/src/device/DeviceConnector.ts +4 -29
  256. package/src/device/DevicePool.ts +1 -1
  257. package/src/events/ui-request.ts +0 -8
  258. package/src/inject.ts +2 -46
  259. package/src/types/api/export.ts +0 -1
  260. package/src/types/api/firmwareUpdate.ts +0 -12
  261. package/src/types/api/getPassphraseState.ts +2 -13
  262. package/src/types/api/index.ts +3 -80
  263. package/src/types/api/preInitialize.ts +3 -0
  264. package/src/types/api/searchDevices.ts +2 -2
  265. package/src/types/device.ts +2 -33
  266. package/src/types/params.ts +2 -4
  267. package/src/types/settings.ts +1 -1
  268. package/src/utils/deviceFeaturesUtils.ts +21 -62
  269. package/src/utils/deviceInfoUtils.ts +8 -15
  270. package/src/utils/index.ts +0 -1
  271. package/__tests__/protocol-v2.test.ts +0 -1688
  272. package/dist/api/DirList.d.ts +0 -10
  273. package/dist/api/DirList.d.ts.map +0 -1
  274. package/dist/api/DirMake.d.ts +0 -9
  275. package/dist/api/DirMake.d.ts.map +0 -1
  276. package/dist/api/DirRemove.d.ts +0 -9
  277. package/dist/api/DirRemove.d.ts.map +0 -1
  278. package/dist/api/FileDelete.d.ts +0 -9
  279. package/dist/api/FileDelete.d.ts.map +0 -1
  280. package/dist/api/FileRead.d.ts +0 -19
  281. package/dist/api/FileRead.d.ts.map +0 -1
  282. package/dist/api/FileWrite.d.ts +0 -23
  283. package/dist/api/FileWrite.d.ts.map +0 -1
  284. package/dist/api/FirmwareUpdateV4.d.ts +0 -32
  285. package/dist/api/FirmwareUpdateV4.d.ts.map +0 -1
  286. package/dist/api/GetDeviceInfo.d.ts +0 -9
  287. package/dist/api/GetDeviceInfo.d.ts.map +0 -1
  288. package/dist/api/PathInfo.d.ts +0 -9
  289. package/dist/api/PathInfo.d.ts.map +0 -1
  290. package/dist/api/helpers/deviceInfo.d.ts +0 -15
  291. package/dist/api/helpers/deviceInfo.d.ts.map +0 -1
  292. package/dist/api/helpers/filesystemValidation.d.ts +0 -7
  293. package/dist/api/helpers/filesystemValidation.d.ts.map +0 -1
  294. package/dist/api/protocol-v2/DeviceFirmwareUpdate.d.ts +0 -7
  295. package/dist/api/protocol-v2/DeviceFirmwareUpdate.d.ts.map +0 -1
  296. package/dist/api/protocol-v2/DeviceGetDeviceInfo.d.ts +0 -7
  297. package/dist/api/protocol-v2/DeviceGetDeviceInfo.d.ts.map +0 -1
  298. package/dist/api/protocol-v2/DeviceGetFirmwareUpdateStatus.d.ts +0 -6
  299. package/dist/api/protocol-v2/DeviceGetFirmwareUpdateStatus.d.ts.map +0 -1
  300. package/dist/api/protocol-v2/DeviceGetOnboardingStatus.d.ts +0 -6
  301. package/dist/api/protocol-v2/DeviceGetOnboardingStatus.d.ts.map +0 -1
  302. package/dist/api/protocol-v2/DeviceReboot.d.ts +0 -7
  303. package/dist/api/protocol-v2/DeviceReboot.d.ts.map +0 -1
  304. package/dist/api/protocol-v2/FactoryDeviceInfoSettings.d.ts +0 -7
  305. package/dist/api/protocol-v2/FactoryDeviceInfoSettings.d.ts.map +0 -1
  306. package/dist/api/protocol-v2/FactoryGetDeviceInfo.d.ts +0 -6
  307. package/dist/api/protocol-v2/FactoryGetDeviceInfo.d.ts.map +0 -1
  308. package/dist/api/protocol-v2/FilesystemDiskControl.d.ts +0 -10
  309. package/dist/api/protocol-v2/FilesystemDiskControl.d.ts.map +0 -1
  310. package/dist/api/protocol-v2/FilesystemFixPermission.d.ts +0 -6
  311. package/dist/api/protocol-v2/FilesystemFixPermission.d.ts.map +0 -1
  312. package/dist/api/protocol-v2/FilesystemFormat.d.ts +0 -6
  313. package/dist/api/protocol-v2/FilesystemFormat.d.ts.map +0 -1
  314. package/dist/api/protocol-v2/GetProtoVersion.d.ts +0 -6
  315. package/dist/api/protocol-v2/GetProtoVersion.d.ts.map +0 -1
  316. package/dist/api/protocol-v2/Ping.d.ts +0 -8
  317. package/dist/api/protocol-v2/Ping.d.ts.map +0 -1
  318. package/dist/api/protocol-v2/helpers.d.ts +0 -49
  319. package/dist/api/protocol-v2/helpers.d.ts.map +0 -1
  320. package/dist/protocols/protocol-v2/features.d.ts +0 -104
  321. package/dist/protocols/protocol-v2/features.d.ts.map +0 -1
  322. package/dist/protocols/protocol-v2/firmware.d.ts +0 -12
  323. package/dist/protocols/protocol-v2/firmware.d.ts.map +0 -1
  324. package/dist/protocols/protocol-v2/index.d.ts +0 -3
  325. package/dist/protocols/protocol-v2/index.d.ts.map +0 -1
  326. package/dist/types/api/getDeviceInfo.d.ts +0 -84
  327. package/dist/types/api/getDeviceInfo.d.ts.map +0 -1
  328. package/dist/types/api/protocolV2.d.ts +0 -127
  329. package/dist/types/api/protocolV2.d.ts.map +0 -1
  330. package/src/api/DirList.ts +0 -29
  331. package/src/api/DirMake.ts +0 -21
  332. package/src/api/DirRemove.ts +0 -21
  333. package/src/api/FileDelete.ts +0 -21
  334. package/src/api/FileRead.ts +0 -165
  335. package/src/api/FileWrite.ts +0 -203
  336. package/src/api/FirmwareUpdateV4.ts +0 -810
  337. package/src/api/GetDeviceInfo.ts +0 -161
  338. package/src/api/PathInfo.ts +0 -25
  339. package/src/api/helpers/deviceInfo.ts +0 -205
  340. package/src/api/helpers/filesystemValidation.ts +0 -51
  341. package/src/api/protocol-v2/DeviceFirmwareUpdate.ts +0 -50
  342. package/src/api/protocol-v2/DeviceGetDeviceInfo.ts +0 -35
  343. package/src/api/protocol-v2/DeviceGetFirmwareUpdateStatus.ts +0 -18
  344. package/src/api/protocol-v2/DeviceGetOnboardingStatus.ts +0 -18
  345. package/src/api/protocol-v2/DeviceReboot.ts +0 -22
  346. package/src/api/protocol-v2/FactoryDeviceInfoSettings.ts +0 -27
  347. package/src/api/protocol-v2/FactoryGetDeviceInfo.ts +0 -18
  348. package/src/api/protocol-v2/FilesystemDiskControl.ts +0 -34
  349. package/src/api/protocol-v2/FilesystemFixPermission.ts +0 -14
  350. package/src/api/protocol-v2/FilesystemFormat.ts +0 -14
  351. package/src/api/protocol-v2/GetProtoVersion.ts +0 -14
  352. package/src/api/protocol-v2/Ping.ts +0 -16
  353. package/src/api/protocol-v2/helpers.ts +0 -161
  354. package/src/data/messages/messages-protocol-v2.json +0 -13128
  355. package/src/protocols/protocol-v2/features.ts +0 -287
  356. package/src/protocols/protocol-v2/firmware.ts +0 -26
  357. package/src/protocols/protocol-v2/index.ts +0 -2
  358. package/src/types/api/getDeviceInfo.ts +0 -97
  359. package/src/types/api/protocolV2.ts +0 -226
@@ -1,10 +1,7 @@
1
- import { createDeviceNotSupportMethodError } from '@onekeyfe/hd-shared';
2
-
3
1
  import { UI_REQUEST } from '../../constants/ui-request';
4
2
  import { serializedPath, validatePath } from '../helpers/pathUtils';
5
3
  import { BaseMethod } from '../BaseMethod';
6
4
  import { validateParams, validateResult } from '../helpers/paramsValidator';
7
- import { getFirmwareType } from '../../utils';
8
5
 
9
6
  import type { DnxGetAddress as HardwareDnxGetAddress } from '@onekeyfe/hd-transport';
10
7
  import type { DnxAddress, DnxGetAddressParams } from '../../types';
@@ -50,10 +47,6 @@ export default class DnxGetAddress extends BaseMethod<HardwareDnxGetAddress[]> {
50
47
  }
51
48
 
52
49
  async run() {
53
- if (this.device.originalDescriptor?.protocolType === 'V2') {
54
- throw createDeviceNotSupportMethodError(this.name, getFirmwareType(this.device.features));
55
- }
56
-
57
50
  const responses: DnxAddress[] = [];
58
51
 
59
52
  for (let i = 0; i < this.params.length; i++) {
@@ -1,11 +1,8 @@
1
- import { createDeviceNotSupportMethodError } from '@onekeyfe/hd-shared';
2
-
3
1
  import { UI_REQUEST } from '../../constants/ui-request';
4
2
  import { serializedPath, validatePath } from '../helpers/pathUtils';
5
3
  import { BaseMethod } from '../BaseMethod';
6
4
  import { validateParams } from '../helpers/paramsValidator';
7
5
  import { stripHexPrefix } from '../helpers/hexUtils';
8
- import { getFirmwareType } from '../../utils';
9
6
 
10
7
  import type { TypedResponseMessage } from '../../device/DeviceCommands';
11
8
  import type { DnxSignature } from '../../types';
@@ -17,6 +14,7 @@ export default class DnxSignTransaction extends BaseMethod<DnxSignTx> {
17
14
  init() {
18
15
  this.checkDeviceId = true;
19
16
  this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
17
+ this.allowUsePreInitialize = true;
20
18
 
21
19
  const { payload } = this;
22
20
  // init params
@@ -118,10 +116,6 @@ export default class DnxSignTransaction extends BaseMethod<DnxSignTx> {
118
116
  }
119
117
 
120
118
  async run() {
121
- if (this.device.originalDescriptor?.protocolType === 'V2') {
122
- throw createDeviceNotSupportMethodError(this.name, getFirmwareType(this.device.features));
123
- }
124
-
125
119
  const typedCall = this.device.getCommands().typedCall.bind(this.device.getCommands());
126
120
 
127
121
  const res = await this.device.commands.typedCall('DnxSignTx', 'DnxInputRequest', {
@@ -44,7 +44,7 @@ export default class EvmGetAddress extends BaseMethod<EthereumGetAddressOneKey[]
44
44
  }
45
45
 
46
46
  async getEvmAddress(param: EthereumGetAddressOneKey) {
47
- if (TransportManager.getProtocolV1MessageSchema() === 'v1LegacySchema') {
47
+ if (TransportManager.getMessageVersion() === 'v1') {
48
48
  return getAddressLegacyV1({
49
49
  typedCall: this.device.commands.typedCall.bind(this.device.commands),
50
50
  param,
@@ -57,7 +57,7 @@ export default class EVMGetPublicKey extends BaseMethod<EthereumGetPublicKeyOneK
57
57
  }
58
58
 
59
59
  getEvmPublicKey(param: EthereumGetPublicKey) {
60
- if (TransportManager.getProtocolV1MessageSchema() === 'v1LegacySchema') {
60
+ if (TransportManager.getMessageVersion() === 'v1') {
61
61
  return getPublicKeyLegacyV1({
62
62
  typedCall: this.device.commands.typedCall.bind(this.device.commands),
63
63
  param,
@@ -13,12 +13,14 @@ export default class EVMSignMessage extends BaseMethod<EthereumSignMessageOneKey
13
13
  init() {
14
14
  this.checkDeviceId = true;
15
15
  this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
16
+ this.allowUsePreInitialize = true;
16
17
 
17
18
  // check payload
18
19
  validateParams(this.payload, [
19
20
  { name: 'path', required: true },
20
21
  { name: 'messageHex', type: 'hexString', required: true },
21
22
  { name: 'chainId', type: 'number' },
23
+ { name: 'usePreInitialize', type: 'boolean' },
22
24
  ]);
23
25
 
24
26
  const { path, messageHex, chainId } = this.payload;
@@ -34,7 +36,7 @@ export default class EVMSignMessage extends BaseMethod<EthereumSignMessageOneKey
34
36
  }
35
37
 
36
38
  async run() {
37
- if (TransportManager.getProtocolV1MessageSchema() === 'v1LegacySchema') {
39
+ if (TransportManager.getMessageVersion() === 'v1') {
38
40
  return signMessageLegacyV1({
39
41
  typedCall: this.device.commands.typedCall.bind(this.device.commands),
40
42
  params: this.params,
@@ -5,7 +5,6 @@ import { validateParams } from '../helpers/paramsValidator';
5
5
  import { formatAnyHex } from '../helpers/hexUtils';
6
6
 
7
7
  import type { EthereumSignMessageEIP712 } from '@onekeyfe/hd-transport';
8
- import type { DeviceFirmwareRange } from '../../types';
9
8
 
10
9
  /**
11
10
  * @deprecated Use EVMSignTypedData instead.
@@ -14,6 +13,7 @@ export default class EVMSignMessageEIP712 extends BaseMethod<EthereumSignMessage
14
13
  init() {
15
14
  this.checkDeviceId = true;
16
15
  this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
16
+ this.allowUsePreInitialize = true;
17
17
 
18
18
  validateParams(this.payload, [
19
19
  { name: 'path', required: true },
@@ -32,12 +32,8 @@ export default class EVMSignMessageEIP712 extends BaseMethod<EthereumSignMessage
32
32
  };
33
33
  }
34
34
 
35
- getVersionRange(): DeviceFirmwareRange {
35
+ getVersionRange() {
36
36
  return {
37
- pro2: {
38
- min: '0.0.0',
39
- unsupported: true,
40
- },
41
37
  model_mini: {
42
38
  min: '2.1.9',
43
39
  },
@@ -48,14 +44,6 @@ export default class EVMSignMessageEIP712 extends BaseMethod<EthereumSignMessage
48
44
  }
49
45
 
50
46
  async run() {
51
- this.checkFeatureVersionLimit(
52
- () => true,
53
- () => this.getVersionRange(),
54
- {
55
- strictCheckDeviceSupport: true,
56
- }
57
- );
58
-
59
47
  const res = await this.device.commands.typedCall(
60
48
  'EthereumSignMessageEIP712',
61
49
  'EthereumMessageSignature',
@@ -46,10 +46,12 @@ export default class EVMSignTransaction extends BaseMethod {
46
46
  init() {
47
47
  this.checkDeviceId = true;
48
48
  this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
49
+ this.allowUsePreInitialize = true;
49
50
 
50
51
  validateParams(this.payload, [
51
52
  { name: 'path', required: true },
52
53
  { name: 'transaction', type: 'object', required: true },
54
+ { name: 'usePreInitialize', type: 'boolean' },
53
55
  ]);
54
56
  const { path, transaction } = this.payload;
55
57
  this.addressN = validatePath(path, 3);
@@ -120,7 +122,7 @@ export default class EVMSignTransaction extends BaseMethod {
120
122
 
121
123
  if (formattedTx == null) throw ERRORS.TypedError('Runtime', 'formattedTx is not set');
122
124
 
123
- if (TransportManager.getProtocolV1MessageSchema() === 'v1LegacySchema') {
125
+ if (TransportManager.getMessageVersion() === 'v1') {
124
126
  return signTransactionLegacyV1({
125
127
  typedCall: this.device.commands.typedCall.bind(this.device.commands),
126
128
  addressN,
@@ -52,6 +52,7 @@ export default class EVMSignTypedData extends BaseMethod<EVMSignTypedDataParams>
52
52
  init() {
53
53
  this.checkDeviceId = true;
54
54
  this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
55
+ this.allowUsePreInitialize = true;
55
56
 
56
57
  validateParams(this.payload, [
57
58
  { name: 'path', required: true },
@@ -60,6 +61,7 @@ export default class EVMSignTypedData extends BaseMethod<EVMSignTypedDataParams>
60
61
  { name: 'domainHash', type: 'hexString' },
61
62
  { name: 'messageHash', type: 'hexString' },
62
63
  { name: 'chainId', type: 'number' },
64
+ { name: 'usePreInitialize', type: 'boolean' },
63
65
  ]);
64
66
 
65
67
  const { path, data, metamaskV4Compat, domainHash, messageHash, chainId } = this.payload;
@@ -260,8 +262,8 @@ export default class EVMSignTypedData extends BaseMethod<EVMSignTypedDataParams>
260
262
 
261
263
  let supportTrezor = false;
262
264
  let response: MessageResponse<MessageKey>;
263
- switch (TransportManager.getProtocolV1MessageSchema()) {
264
- case 'v1LegacySchema':
265
+ switch (TransportManager.getMessageVersion()) {
266
+ case 'v1':
265
267
  supportTrezor = true;
266
268
  response = await signTypedDataLegacyV1({
267
269
  typedCall: this.device.commands.typedCall.bind(this.device.commands),
@@ -272,7 +274,7 @@ export default class EVMSignTypedData extends BaseMethod<EVMSignTypedDataParams>
272
274
  });
273
275
  break;
274
276
 
275
- case 'v1CurrentSchema':
277
+ case 'latest':
276
278
  default:
277
279
  supportTrezor = false;
278
280
  response = await signTypedData({
@@ -308,8 +310,8 @@ export default class EVMSignTypedData extends BaseMethod<EVMSignTypedDataParams>
308
310
  }) {
309
311
  if (!domainHash) throw ERRORS.TypedError('Runtime', 'domainHash is required');
310
312
 
311
- switch (TransportManager.getProtocolV1MessageSchema()) {
312
- case 'v1LegacySchema':
313
+ switch (TransportManager.getMessageVersion()) {
314
+ case 'v1':
313
315
  return signTypedHashLegacyV1({
314
316
  typedCall,
315
317
  addressN,
@@ -319,7 +321,7 @@ export default class EVMSignTypedData extends BaseMethod<EVMSignTypedDataParams>
319
321
  device: this.device,
320
322
  });
321
323
 
322
- case 'v1CurrentSchema':
324
+ case 'latest':
323
325
  default:
324
326
  return signTypedHash({
325
327
  typedCall,
@@ -31,7 +31,7 @@ export default class EVMSignMessage extends BaseMethod<EthereumVerifyMessageOneK
31
31
  }
32
32
 
33
33
  async run() {
34
- if (TransportManager.getProtocolV1MessageSchema() === 'v1LegacySchema') {
34
+ if (TransportManager.getMessageVersion() === 'v1') {
35
35
  return verifyMessageLegacyV1({
36
36
  typedCall: this.device.commands.typedCall.bind(this.device.commands),
37
37
  params: this.params,
@@ -12,6 +12,7 @@ export default class FilecoinSignTransaction extends BaseMethod<HardwareFilecoin
12
12
  init() {
13
13
  this.checkDeviceId = true;
14
14
  this.allowDeviceMode = [...this.allowDeviceMode];
15
+ this.allowUsePreInitialize = true;
15
16
 
16
17
  // check payload
17
18
  validateParams(this.payload, [
@@ -28,13 +28,6 @@ const Log = getLogger(LoggerNames.Method);
28
28
  const SESSION_ERROR = 'session not found';
29
29
  const FIRMWARE_UPDATE_CONFIRM = 'Firmware install confirmed';
30
30
 
31
- type FirmwareProgressMetadata = {
32
- transferredBytes?: number;
33
- totalBytes?: number;
34
- rateBytesPerSecond?: number;
35
- elapsedMs?: number;
36
- };
37
-
38
31
  const isDeviceDisconnectedError = (error: unknown) => {
39
32
  const message = error instanceof Error ? error.message : String(error ?? '');
40
33
  return (
@@ -89,17 +82,12 @@ export class FirmwareUpdateBaseMethod<Params> extends BaseMethod<Params> {
89
82
  * @description Post the progress message
90
83
  * @param progress Post the percentage of the progress
91
84
  */
92
- postProgressMessage = (
93
- progress: number,
94
- progressType: IFirmwareUpdateProgressType,
95
- metadata: FirmwareProgressMetadata = {}
96
- ) => {
85
+ postProgressMessage = (progress: number, progressType: IFirmwareUpdateProgressType) => {
97
86
  this.postMessage(
98
87
  createUiMessage(UI_REQUEST.FIRMWARE_PROGRESS, {
99
88
  device: this.device.toMessageObject() as KnownDevice,
100
89
  progress,
101
90
  progressType,
102
- ...metadata,
103
91
  })
104
92
  );
105
93
  };
@@ -337,12 +325,10 @@ export class FirmwareUpdateBaseMethod<Params> extends BaseMethod<Params> {
337
325
  filePath,
338
326
  processedSize,
339
327
  totalSize,
340
- transferStartTime = Date.now(),
341
328
  }: PROTO.FirmwareUpload & {
342
329
  filePath: string;
343
330
  processedSize?: number;
344
331
  totalSize?: number;
345
- transferStartTime?: number;
346
332
  }) {
347
333
  if (!filePath.startsWith('0:')) {
348
334
  throw new Error('filePath must start with 0:');
@@ -352,6 +338,7 @@ export class FirmwareUpdateBaseMethod<Params> extends BaseMethod<Params> {
352
338
  const chunkSize = 1024 * perPackageSize;
353
339
  const totalChunks = Math.ceil(payload.byteLength / chunkSize);
354
340
  let offset = 0;
341
+ let currentFileProcessed = 0;
355
342
 
356
343
  for (let i = 0; i < totalChunks; i++) {
357
344
  const chunkStart = i * chunkSize;
@@ -363,7 +350,7 @@ export class FirmwareUpdateBaseMethod<Params> extends BaseMethod<Params> {
363
350
  // Calculate progress based on whether we're tracking overall progress or single file progress
364
351
  let progress: number;
365
352
  if (totalSize !== undefined && processedSize !== undefined) {
366
- const currentFileProcessed = processedSize + chunkEnd;
353
+ currentFileProcessed = processedSize + chunkEnd;
367
354
  progress = Math.min(Math.ceil((currentFileProcessed / totalSize) * 100), 99);
368
355
  } else {
369
356
  progress = Math.min(Math.ceil(((i + 1) / totalChunks) * 100), 99);
@@ -379,17 +366,7 @@ export class FirmwareUpdateBaseMethod<Params> extends BaseMethod<Params> {
379
366
  );
380
367
  // @ts-expect-error
381
368
  offset += writeRes.message.processed_byte;
382
- const elapsedMs = Date.now() - transferStartTime;
383
- const transferredBytes =
384
- totalSize !== undefined && processedSize !== undefined ? processedSize + offset : offset;
385
- const totalBytes = totalSize ?? payload.byteLength;
386
- this.postProgressMessage(progress, 'transferData', {
387
- transferredBytes,
388
- totalBytes,
389
- rateBytesPerSecond:
390
- elapsedMs > 0 ? Math.round((transferredBytes / elapsedMs) * 1000) : undefined,
391
- elapsedMs,
392
- });
369
+ this.postProgressMessage(progress, 'transferData');
393
370
  }
394
371
 
395
372
  // Return processed size only if we're tracking overall progress
package/src/api/index.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  export { default as testInitializeDeviceDuration } from './test/TestInitializeDeviceDuration';
2
+ export { default as preInitialize } from './device/PreInitialize';
2
3
 
3
4
  export { default as searchDevices } from './SearchDevices';
4
5
  export { default as getFeatures } from './GetFeatures';
5
- export { default as getDeviceInfo } from './GetDeviceInfo';
6
6
  export { default as getOnekeyFeatures } from './GetOnekeyFeatures';
7
7
  export { default as getPassphraseState } from './GetPassphraseState';
8
8
  export { default as getLogs } from './GetLogs';
@@ -38,37 +38,8 @@ export { default as getNextU2FCounter } from './u2f/GetNextU2FCounter';
38
38
  export { default as firmwareUpdate } from './FirmwareUpdate';
39
39
  export { default as firmwareUpdateV2 } from './FirmwareUpdateV2';
40
40
  export { default as firmwareUpdateV3 } from './FirmwareUpdateV3';
41
- export { default as firmwareUpdateV4 } from './FirmwareUpdateV4';
42
41
  export { default as promptWebDeviceAccess } from './PromptWebDeviceAccess';
43
42
 
44
- // File system & device control API (Protocol V2 only)
45
- export { default as getProtoVersion } from './protocol-v2/GetProtoVersion';
46
- export { default as ping } from './protocol-v2/Ping';
47
- export { default as deviceReboot } from './protocol-v2/DeviceReboot';
48
- export { default as deviceGetDeviceInfo } from './protocol-v2/DeviceGetDeviceInfo';
49
- export { default as deviceGetOnboardingStatus } from './protocol-v2/DeviceGetOnboardingStatus';
50
- export { default as deviceFirmwareUpdate } from './protocol-v2/DeviceFirmwareUpdate';
51
- export { default as deviceGetFirmwareUpdateStatus } from './protocol-v2/DeviceGetFirmwareUpdateStatus';
52
- export { default as factoryDeviceInfoSettings } from './protocol-v2/FactoryDeviceInfoSettings';
53
- export { default as factoryGetDeviceInfo } from './protocol-v2/FactoryGetDeviceInfo';
54
- export { default as filesystemFixPermission } from './protocol-v2/FilesystemFixPermission';
55
- export { default as filesystemFormat } from './protocol-v2/FilesystemFormat';
56
- export { default as filesystemDiskControl } from './protocol-v2/FilesystemDiskControl';
57
- export { default as fileRead } from './FileRead';
58
- export { default as fileWrite } from './FileWrite';
59
- export { default as fileDelete } from './FileDelete';
60
- export { default as dirList } from './DirList';
61
- export { default as dirMake } from './DirMake';
62
- export { default as dirRemove } from './DirRemove';
63
- export { default as pathInfo } from './PathInfo';
64
- export { default as filesystemFileRead } from './FileRead';
65
- export { default as filesystemFileWrite } from './FileWrite';
66
- export { default as filesystemFileDelete } from './FileDelete';
67
- export { default as filesystemDirList } from './DirList';
68
- export { default as filesystemDirMake } from './DirMake';
69
- export { default as filesystemDirRemove } from './DirRemove';
70
- export { default as filesystemPathInfoQuery } from './PathInfo';
71
-
72
43
  export { default as cipherKeyValue } from './CipherKeyValue';
73
44
 
74
45
  export { default as allNetworkGetAddress } from './allnetwork/AllNetworkGetAddress';
@@ -22,6 +22,7 @@ export default class KaspaSignTransaction extends BaseMethod<KaspaSignTransactio
22
22
  init() {
23
23
  this.checkDeviceId = true;
24
24
  this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
25
+ this.allowUsePreInitialize = true;
25
26
 
26
27
  const payload = this.payload as KaspaSignTransactionParams;
27
28
 
@@ -10,6 +10,7 @@ export default class NearSignTransaction extends BaseMethod<HardwareNearSignTx>
10
10
  init() {
11
11
  this.checkDeviceId = true;
12
12
  this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
13
+ this.allowUsePreInitialize = true;
13
14
 
14
15
  // check payload
15
16
  validateParams(this.payload, [
@@ -230,6 +230,7 @@ export default class NEMSignTransaction extends BaseMethod<NEMSignTx> {
230
230
  init() {
231
231
  this.checkDeviceId = true;
232
232
  this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
233
+ this.allowUsePreInitialize = true;
233
234
 
234
235
  validateParams(this.payload, [
235
236
  { name: 'path', required: true },
@@ -5,7 +5,6 @@ import { UI_REQUEST } from '../../constants/ui-request';
5
5
 
6
6
  import type { NeoGetAddress as HardwareNeoGetAddress } from '@onekeyfe/hd-transport';
7
7
  import type { NeoAddress, NeoGetAddressParams } from '../../types/api/neoGetAddress';
8
- import type { DeviceFirmwareRange } from '../../types';
9
8
 
10
9
  export default class NeoGetAddress extends BaseMethod<HardwareNeoGetAddress[]> {
11
10
  hasBundle = false;
@@ -38,12 +37,8 @@ export default class NeoGetAddress extends BaseMethod<HardwareNeoGetAddress[]> {
38
37
  });
39
38
  }
40
39
 
41
- getVersionRange(): DeviceFirmwareRange {
40
+ getVersionRange() {
42
41
  return {
43
- pro2: {
44
- min: '0.0.0',
45
- unsupported: true,
46
- },
47
42
  pro: {
48
43
  min: '4.12.0',
49
44
  },
@@ -5,12 +5,12 @@ import { validateParams } from '../helpers/paramsValidator';
5
5
  import { formatAnyHex } from '../helpers/hexUtils';
6
6
 
7
7
  import type { NeoSignTx } from '@onekeyfe/hd-transport';
8
- import type { DeviceFirmwareRange } from '../../types';
9
8
 
10
9
  export default class NeoSignTransaction extends BaseMethod<NeoSignTx> {
11
10
  init() {
12
11
  this.checkDeviceId = true;
13
12
  this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
13
+ this.allowUsePreInitialize = true;
14
14
  this.strictCheckDeviceSupport = true;
15
15
 
16
16
  validateParams(this.payload, [
@@ -29,12 +29,8 @@ export default class NeoSignTransaction extends BaseMethod<NeoSignTx> {
29
29
  };
30
30
  }
31
31
 
32
- getVersionRange(): DeviceFirmwareRange {
32
+ getVersionRange() {
33
33
  return {
34
- pro2: {
35
- min: '0.0.0',
36
- unsupported: true,
37
- },
38
34
  pro: {
39
35
  min: '4.12.0',
40
36
  },
@@ -4,7 +4,7 @@ import { BaseMethod } from '../BaseMethod';
4
4
  import { validateParams, validateResult } from '../helpers/paramsValidator';
5
5
 
6
6
  import type { NervosGetAddress as HardwareNervosGetAddress } from '@onekeyfe/hd-transport';
7
- import type { DeviceFirmwareRange, NervosAddress, NervosGetAddressParams } from '../../types';
7
+ import type { NervosAddress, NervosGetAddressParams } from '../../types';
8
8
 
9
9
  export default class NervosGetAddress extends BaseMethod<HardwareNervosGetAddress[]> {
10
10
  hasBundle = false;
@@ -40,12 +40,8 @@ export default class NervosGetAddress extends BaseMethod<HardwareNervosGetAddres
40
40
  });
41
41
  }
42
42
 
43
- getVersionRange(): DeviceFirmwareRange {
43
+ getVersionRange() {
44
44
  return {
45
- pro2: {
46
- min: '0.0.0',
47
- unsupported: true,
48
- },
49
45
  model_mini: {
50
46
  min: '3.7.0',
51
47
  },
@@ -5,7 +5,7 @@ import { BaseMethod } from '../BaseMethod';
5
5
  import { validateParams } from '../helpers/paramsValidator';
6
6
  import { formatAnyHex } from '../helpers/hexUtils';
7
7
 
8
- import type { DeviceFirmwareRange, NervosSignTransactionParams, NervosSignedTx } from '../../types';
8
+ import type { NervosSignTransactionParams, NervosSignedTx } from '../../types';
9
9
  import type { NervosSignTx as HardwareNervosSignTx, TypedCall } from '@onekeyfe/hd-transport';
10
10
  import type { TypedResponseMessage } from '../../device/DeviceCommands';
11
11
 
@@ -19,6 +19,7 @@ export default class NervosSignTransaction extends BaseMethod<NervosSignTx> {
19
19
  init() {
20
20
  this.checkDeviceId = true;
21
21
  this.allowDeviceMode = [...this.allowDeviceMode];
22
+ this.allowUsePreInitialize = true;
22
23
 
23
24
  // check payload
24
25
  validateParams(this.payload, [
@@ -40,12 +41,8 @@ export default class NervosSignTransaction extends BaseMethod<NervosSignTx> {
40
41
  };
41
42
  }
42
43
 
43
- getVersionRange(): DeviceFirmwareRange {
44
+ getVersionRange() {
44
45
  return {
45
- pro2: {
46
- min: '0.0.0',
47
- unsupported: true,
48
- },
49
46
  model_mini: {
50
47
  min: '3.7.0',
51
48
  },
@@ -4,7 +4,7 @@ import { BaseMethod } from '../BaseMethod';
4
4
  import { validateParams, validateResult } from '../helpers/paramsValidator';
5
5
 
6
6
  import type { NexaGetAddress as HardwareNexaGetAddress } from '@onekeyfe/hd-transport';
7
- import type { DeviceFirmwareRange, NexaGetAddressParams } from '../../types';
7
+ import type { NexaGetAddressParams } from '../../types';
8
8
 
9
9
  export default class NexaGetAddress extends BaseMethod<HardwareNexaGetAddress[]> {
10
10
  hasBundle = false;
@@ -43,12 +43,8 @@ export default class NexaGetAddress extends BaseMethod<HardwareNexaGetAddress[]>
43
43
  });
44
44
  }
45
45
 
46
- getVersionRange(): DeviceFirmwareRange {
46
+ getVersionRange() {
47
47
  return {
48
- pro2: {
49
- min: '0.0.0',
50
- unsupported: true,
51
- },
52
48
  model_mini: {
53
49
  min: '3.2.0',
54
50
  },
@@ -6,12 +6,14 @@ import { validateParams } from '../helpers/paramsValidator';
6
6
 
7
7
  import type { TypedResponseMessage } from '../../device/DeviceCommands';
8
8
  import type { TypedCall } from '@onekeyfe/hd-transport';
9
- import type { DeviceFirmwareRange, NexaSignTransactionParams, NexaSignature } from '../../types';
9
+ import type { NexaSignTransactionParams, NexaSignature } from '../../types';
10
10
 
11
11
  export default class NexaSignTransaction extends BaseMethod<NexaSignTransactionParams> {
12
12
  hasBundle = false;
13
13
 
14
14
  init() {
15
+ this.allowUsePreInitialize = true;
16
+
15
17
  const payload = this.payload as NexaSignTransactionParams;
16
18
 
17
19
  payload.inputs.forEach(input => {
@@ -25,12 +27,8 @@ export default class NexaSignTransaction extends BaseMethod<NexaSignTransactionP
25
27
  this.params = payload;
26
28
  }
27
29
 
28
- getVersionRange(): DeviceFirmwareRange {
30
+ getVersionRange() {
29
31
  return {
30
- pro2: {
31
- min: '0.0.0',
32
- unsupported: true,
33
- },
34
32
  model_mini: {
35
33
  min: '3.2.0',
36
34
  },
@@ -15,6 +15,7 @@ export default class NostrSignEvent extends BaseMethod<SignEvent> {
15
15
  init() {
16
16
  this.checkDeviceId = true;
17
17
  this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
18
+ this.allowUsePreInitialize = true;
18
19
 
19
20
  const { payload } = this;
20
21
  if (!validateEvent(payload.event)) {
@@ -11,6 +11,7 @@ export default class NostrSignSchnorr extends BaseMethod<SignSchnorr> {
11
11
  init() {
12
12
  this.checkDeviceId = true;
13
13
  this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
14
+ this.allowUsePreInitialize = true;
14
15
 
15
16
  const { payload } = this;
16
17
  validateParams(payload, [
@@ -13,6 +13,7 @@ export default class PolkadotSignTransaction extends BaseMethod<HardwarePolkadot
13
13
  init() {
14
14
  this.checkDeviceId = true;
15
15
  this.allowDeviceMode = [...this.allowDeviceMode];
16
+ this.allowUsePreInitialize = true;
16
17
 
17
18
  // check payload
18
19
  validateParams(this.payload, [
@@ -4,7 +4,7 @@ import { BaseMethod } from '../BaseMethod';
4
4
  import { validateParams, validateResult } from '../helpers/paramsValidator';
5
5
 
6
6
  import type { ScdoGetAddress as HardwareScdoGetAddress } from '@onekeyfe/hd-transport';
7
- import type { DeviceFirmwareRange, ScdoAddress, ScdoGetAddressParams } from '../../types';
7
+ import type { ScdoAddress, ScdoGetAddressParams } from '../../types';
8
8
 
9
9
  export default class ScdoGetAddress extends BaseMethod<HardwareScdoGetAddress[]> {
10
10
  hasBundle = false;
@@ -38,12 +38,8 @@ export default class ScdoGetAddress extends BaseMethod<HardwareScdoGetAddress[]>
38
38
  });
39
39
  }
40
40
 
41
- getVersionRange(): DeviceFirmwareRange {
41
+ getVersionRange() {
42
42
  return {
43
- pro2: {
44
- min: '0.0.0',
45
- unsupported: true,
46
- },
47
43
  model_touch: {
48
44
  min: '4.10.0',
49
45
  },
@@ -5,12 +5,12 @@ import { validateParams } from '../helpers/paramsValidator';
5
5
  import { stripHexPrefix } from '../helpers/hexUtils';
6
6
 
7
7
  import type { ScdoSignMessage as HardwareScdoSignMessage } from '@onekeyfe/hd-transport';
8
- import type { DeviceFirmwareRange } from '../../types';
9
8
 
10
9
  export default class ScdoSignMessage extends BaseMethod<HardwareScdoSignMessage> {
11
10
  init() {
12
11
  this.checkDeviceId = true;
13
12
  this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
13
+ this.allowUsePreInitialize = true;
14
14
 
15
15
  // check payload
16
16
  validateParams(this.payload, [
@@ -28,12 +28,8 @@ export default class ScdoSignMessage extends BaseMethod<HardwareScdoSignMessage>
28
28
  };
29
29
  }
30
30
 
31
- getVersionRange(): DeviceFirmwareRange {
31
+ getVersionRange() {
32
32
  return {
33
- pro2: {
34
- min: '0.0.0',
35
- unsupported: true,
36
- },
37
33
  model_touch: {
38
34
  min: '4.10.0',
39
35
  },