@onekeyfe/hd-core 1.1.27 → 1.2.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (377) hide show
  1. package/__tests__/evmLedgerLegacySafety.test.ts +15 -4
  2. package/__tests__/evmSignTransaction.test.ts +1 -1
  3. package/__tests__/evmSignTypedData.test.ts +1 -1
  4. package/__tests__/logBlockEvent.test.ts +37 -0
  5. package/__tests__/protocol-v2.test.ts +3025 -0
  6. package/dist/api/BaseMethod.d.ts +1 -0
  7. package/dist/api/BaseMethod.d.ts.map +1 -1
  8. package/dist/api/DirList.d.ts +10 -0
  9. package/dist/api/DirList.d.ts.map +1 -0
  10. package/dist/api/DirMake.d.ts +9 -0
  11. package/dist/api/DirMake.d.ts.map +1 -0
  12. package/dist/api/DirRemove.d.ts +9 -0
  13. package/dist/api/DirRemove.d.ts.map +1 -0
  14. package/dist/api/FileDelete.d.ts +9 -0
  15. package/dist/api/FileDelete.d.ts.map +1 -0
  16. package/dist/api/FileRead.d.ts +19 -0
  17. package/dist/api/FileRead.d.ts.map +1 -0
  18. package/dist/api/FileWrite.d.ts +24 -0
  19. package/dist/api/FileWrite.d.ts.map +1 -0
  20. package/dist/api/FirmwareUpdate.d.ts.map +1 -1
  21. package/dist/api/FirmwareUpdateV2.d.ts.map +1 -1
  22. package/dist/api/FirmwareUpdateV3.d.ts +1 -0
  23. package/dist/api/FirmwareUpdateV3.d.ts.map +1 -1
  24. package/dist/api/FirmwareUpdateV4.d.ts +35 -0
  25. package/dist/api/FirmwareUpdateV4.d.ts.map +1 -0
  26. package/dist/api/GetDeviceInfo.d.ts +9 -0
  27. package/dist/api/GetDeviceInfo.d.ts.map +1 -0
  28. package/dist/api/GetFeatures.d.ts.map +1 -1
  29. package/dist/api/GetOnekeyFeatures.d.ts.map +1 -1
  30. package/dist/api/GetPassphraseState.d.ts +6 -1
  31. package/dist/api/GetPassphraseState.d.ts.map +1 -1
  32. package/dist/api/PathInfo.d.ts +10 -0
  33. package/dist/api/PathInfo.d.ts.map +1 -0
  34. package/dist/api/PromptWebDeviceAccess.d.ts.map +1 -1
  35. package/dist/api/SearchDevices.d.ts +2 -1
  36. package/dist/api/SearchDevices.d.ts.map +1 -1
  37. package/dist/api/alephium/AlephiumGetAddress.d.ts +2 -6
  38. package/dist/api/alephium/AlephiumGetAddress.d.ts.map +1 -1
  39. package/dist/api/alephium/AlephiumSignMessage.d.ts +2 -5
  40. package/dist/api/alephium/AlephiumSignMessage.d.ts.map +1 -1
  41. package/dist/api/alephium/AlephiumSignTransaction.d.ts +5 -8
  42. package/dist/api/alephium/AlephiumSignTransaction.d.ts.map +1 -1
  43. package/dist/api/aptos/AptosGetAddress.d.ts.map +1 -1
  44. package/dist/api/benfen/BenfenGetAddress.d.ts +2 -9
  45. package/dist/api/benfen/BenfenGetAddress.d.ts.map +1 -1
  46. package/dist/api/benfen/BenfenGetPublicKey.d.ts +2 -9
  47. package/dist/api/benfen/BenfenGetPublicKey.d.ts.map +1 -1
  48. package/dist/api/benfen/BenfenSignMessage.d.ts +2 -8
  49. package/dist/api/benfen/BenfenSignMessage.d.ts.map +1 -1
  50. package/dist/api/benfen/BenfenSignTransaction.d.ts +2 -8
  51. package/dist/api/benfen/BenfenSignTransaction.d.ts.map +1 -1
  52. package/dist/api/btc/BTCGetAddress.d.ts +1 -11
  53. package/dist/api/btc/BTCGetAddress.d.ts.map +1 -1
  54. package/dist/api/btc/BTCGetPublicKey.d.ts +1 -11
  55. package/dist/api/btc/BTCGetPublicKey.d.ts.map +1 -1
  56. package/dist/api/btc/BTCSignMessage.d.ts +1 -15
  57. package/dist/api/btc/BTCSignMessage.d.ts.map +1 -1
  58. package/dist/api/btc/BTCSignPsbt.d.ts.map +1 -1
  59. package/dist/api/btc/BTCSignTransaction.d.ts +1 -11
  60. package/dist/api/btc/BTCSignTransaction.d.ts.map +1 -1
  61. package/dist/api/btc/BTCVerifyMessage.d.ts +1 -11
  62. package/dist/api/btc/BTCVerifyMessage.d.ts.map +1 -1
  63. package/dist/api/btc/helpers/versionLimit.d.ts +2 -11
  64. package/dist/api/btc/helpers/versionLimit.d.ts.map +1 -1
  65. package/dist/api/cardano/CardanoSignTransaction.d.ts.map +1 -1
  66. package/dist/api/conflux/ConfluxSignTransaction.d.ts.map +1 -1
  67. package/dist/api/device/DeviceLock.d.ts.map +1 -1
  68. package/dist/api/device/DeviceRebootToBoardloader.d.ts +1 -1
  69. package/dist/api/device/DeviceRebootToBoardloader.d.ts.map +1 -1
  70. package/dist/api/device/DeviceRebootToBootloader.d.ts.map +1 -1
  71. package/dist/api/device/DeviceSupportFeatures.d.ts.map +1 -1
  72. package/dist/api/device/DeviceUploadResource.d.ts.map +1 -1
  73. package/dist/api/device/DeviceVerify.d.ts.map +1 -1
  74. package/dist/api/dynex/DnxGetAddress.d.ts.map +1 -1
  75. package/dist/api/dynex/DnxSignTransaction.d.ts.map +1 -1
  76. package/dist/api/evm/EVMGetPublicKey.d.ts.map +1 -1
  77. package/dist/api/evm/EVMSignMessageEIP712.d.ts +2 -8
  78. package/dist/api/evm/EVMSignMessageEIP712.d.ts.map +1 -1
  79. package/dist/api/evm/EVMSignTypedData.d.ts.map +1 -1
  80. package/dist/api/evm/latest/signTypedData.d.ts +1 -1
  81. package/dist/api/evm/latest/signTypedData.d.ts.map +1 -1
  82. package/dist/api/evm/latest/signTypedHash.d.ts.map +1 -1
  83. package/dist/api/evm/legacyV1/getAddress.d.ts.map +1 -1
  84. package/dist/api/evm/legacyV1/getPublicKey.d.ts.map +1 -1
  85. package/dist/api/evm/legacyV1/signMessage.d.ts.map +1 -1
  86. package/dist/api/evm/legacyV1/signTypedData.d.ts +1 -1
  87. package/dist/api/evm/legacyV1/signTypedData.d.ts.map +1 -1
  88. package/dist/api/evm/legacyV1/signTypedHash.d.ts.map +1 -1
  89. package/dist/api/evm/legacyV1/verifyMessage.d.ts.map +1 -1
  90. package/dist/api/firmware/uploadFirmware.d.ts.map +1 -1
  91. package/dist/api/helpers/batchGetPublickeys.d.ts +3 -0
  92. package/dist/api/helpers/batchGetPublickeys.d.ts.map +1 -1
  93. package/dist/api/helpers/filesystemValidation.d.ts +7 -0
  94. package/dist/api/helpers/filesystemValidation.d.ts.map +1 -0
  95. package/dist/api/index.d.ts +32 -0
  96. package/dist/api/index.d.ts.map +1 -1
  97. package/dist/api/kaspa/KaspaSignTransaction.d.ts.map +1 -1
  98. package/dist/api/lightning/LnurlAuth.d.ts +4 -0
  99. package/dist/api/lightning/LnurlAuth.d.ts.map +1 -1
  100. package/dist/api/neo/NeoGetAddress.d.ts +2 -8
  101. package/dist/api/neo/NeoGetAddress.d.ts.map +1 -1
  102. package/dist/api/neo/NeoSignTransaction.d.ts +2 -8
  103. package/dist/api/neo/NeoSignTransaction.d.ts.map +1 -1
  104. package/dist/api/nervos/NervosGetAddress.d.ts +2 -9
  105. package/dist/api/nervos/NervosGetAddress.d.ts.map +1 -1
  106. package/dist/api/nervos/NervosSignTransaction.d.ts +9 -12
  107. package/dist/api/nervos/NervosSignTransaction.d.ts.map +1 -1
  108. package/dist/api/nexa/NexaGetAddress.d.ts +2 -8
  109. package/dist/api/nexa/NexaGetAddress.d.ts.map +1 -1
  110. package/dist/api/nexa/NexaSignTransaction.d.ts +2 -9
  111. package/dist/api/nexa/NexaSignTransaction.d.ts.map +1 -1
  112. package/dist/api/polkadot/PolkadotGetAddress.d.ts +3 -0
  113. package/dist/api/polkadot/PolkadotGetAddress.d.ts.map +1 -1
  114. package/dist/api/polkadot/networks.d.ts +3 -0
  115. package/dist/api/polkadot/networks.d.ts.map +1 -1
  116. package/dist/api/protocol-v2/DevReboot.d.ts +7 -0
  117. package/dist/api/protocol-v2/DevReboot.d.ts.map +1 -0
  118. package/dist/api/protocol-v2/DeviceFirmwareUpdate.d.ts +7 -0
  119. package/dist/api/protocol-v2/DeviceFirmwareUpdate.d.ts.map +1 -0
  120. package/dist/api/protocol-v2/DeviceGetDeviceInfo.d.ts +29 -0
  121. package/dist/api/protocol-v2/DeviceGetDeviceInfo.d.ts.map +1 -0
  122. package/dist/api/protocol-v2/DeviceGetFirmwareUpdateStatus.d.ts +6 -0
  123. package/dist/api/protocol-v2/DeviceGetFirmwareUpdateStatus.d.ts.map +1 -0
  124. package/dist/api/protocol-v2/DeviceGetOnboardingStatus.d.ts +6 -0
  125. package/dist/api/protocol-v2/DeviceGetOnboardingStatus.d.ts.map +1 -0
  126. package/dist/api/protocol-v2/DeviceReboot.d.ts +7 -0
  127. package/dist/api/protocol-v2/DeviceReboot.d.ts.map +1 -0
  128. package/dist/api/protocol-v2/FactoryDeviceInfoSettings.d.ts +7 -0
  129. package/dist/api/protocol-v2/FactoryDeviceInfoSettings.d.ts.map +1 -0
  130. package/dist/api/protocol-v2/FactoryGetDeviceInfo.d.ts +6 -0
  131. package/dist/api/protocol-v2/FactoryGetDeviceInfo.d.ts.map +1 -0
  132. package/dist/api/protocol-v2/FilesystemDiskControl.d.ts +13 -0
  133. package/dist/api/protocol-v2/FilesystemDiskControl.d.ts.map +1 -0
  134. package/dist/api/protocol-v2/FilesystemFixPermission.d.ts +6 -0
  135. package/dist/api/protocol-v2/FilesystemFixPermission.d.ts.map +1 -0
  136. package/dist/api/protocol-v2/FilesystemFormat.d.ts +6 -0
  137. package/dist/api/protocol-v2/FilesystemFormat.d.ts.map +1 -0
  138. package/dist/api/protocol-v2/GetProtoVersion.d.ts +6 -0
  139. package/dist/api/protocol-v2/GetProtoVersion.d.ts.map +1 -0
  140. package/dist/api/protocol-v2/Ping.d.ts +8 -0
  141. package/dist/api/protocol-v2/Ping.d.ts.map +1 -0
  142. package/dist/api/protocol-v2/helpers.d.ts +34 -0
  143. package/dist/api/protocol-v2/helpers.d.ts.map +1 -0
  144. package/dist/api/scdo/ScdoGetAddress.d.ts +2 -6
  145. package/dist/api/scdo/ScdoGetAddress.d.ts.map +1 -1
  146. package/dist/api/scdo/ScdoSignMessage.d.ts +2 -5
  147. package/dist/api/scdo/ScdoSignMessage.d.ts.map +1 -1
  148. package/dist/api/scdo/ScdoSignTransaction.d.ts +2 -5
  149. package/dist/api/scdo/ScdoSignTransaction.d.ts.map +1 -1
  150. package/dist/api/solana/SolGetAddress.d.ts +1 -0
  151. package/dist/api/solana/SolGetAddress.d.ts.map +1 -1
  152. package/dist/api/solana/SolSignMessage.d.ts +3 -0
  153. package/dist/api/solana/SolSignMessage.d.ts.map +1 -1
  154. package/dist/api/solana/SolSignOffchainMessage.d.ts +3 -0
  155. package/dist/api/solana/SolSignOffchainMessage.d.ts.map +1 -1
  156. package/dist/api/solana/SolSignTransaction.d.ts +6 -0
  157. package/dist/api/solana/SolSignTransaction.d.ts.map +1 -1
  158. package/dist/api/stellar/StellarGetAddress.d.ts +2 -1
  159. package/dist/api/stellar/StellarGetAddress.d.ts.map +1 -1
  160. package/dist/api/stellar/StellarSignTransaction.d.ts +3 -2
  161. package/dist/api/stellar/StellarSignTransaction.d.ts.map +1 -1
  162. package/dist/api/sui/SuiGetAddress.d.ts +3 -0
  163. package/dist/api/sui/SuiGetAddress.d.ts.map +1 -1
  164. package/dist/api/sui/SuiGetPublicKey.d.ts +3 -0
  165. package/dist/api/sui/SuiGetPublicKey.d.ts.map +1 -1
  166. package/dist/api/sui/SuiSignMessage.d.ts +3 -0
  167. package/dist/api/sui/SuiSignMessage.d.ts.map +1 -1
  168. package/dist/api/sui/SuiSignTransaction.d.ts +5 -2
  169. package/dist/api/sui/SuiSignTransaction.d.ts.map +1 -1
  170. package/dist/api/ton/TonGetAddress.d.ts +3 -0
  171. package/dist/api/ton/TonGetAddress.d.ts.map +1 -1
  172. package/dist/api/ton/TonSignData.d.ts +5 -0
  173. package/dist/api/ton/TonSignData.d.ts.map +1 -1
  174. package/dist/api/ton/TonSignMessage.d.ts +3 -0
  175. package/dist/api/ton/TonSignMessage.d.ts.map +1 -1
  176. package/dist/api/ton/TonSignProof.d.ts +3 -0
  177. package/dist/api/ton/TonSignProof.d.ts.map +1 -1
  178. package/dist/api/tron/TronSignMessage.d.ts +4 -0
  179. package/dist/api/tron/TronSignMessage.d.ts.map +1 -1
  180. package/dist/api/tron/TronSignTransaction.d.ts +4 -0
  181. package/dist/api/tron/TronSignTransaction.d.ts.map +1 -1
  182. package/dist/core/index.d.ts.map +1 -1
  183. package/dist/data-manager/DataManager.d.ts +7 -4
  184. package/dist/data-manager/DataManager.d.ts.map +1 -1
  185. package/dist/data-manager/MessagesConfig.d.ts +2 -2
  186. package/dist/data-manager/MessagesConfig.d.ts.map +1 -1
  187. package/dist/data-manager/TransportManager.d.ts +5 -4
  188. package/dist/data-manager/TransportManager.d.ts.map +1 -1
  189. package/dist/device/Device.d.ts +36 -10
  190. package/dist/device/Device.d.ts.map +1 -1
  191. package/dist/device/DeviceCommands.d.ts +9 -9
  192. package/dist/device/DeviceCommands.d.ts.map +1 -1
  193. package/dist/device/DeviceConnector.d.ts +2 -1
  194. package/dist/device/DeviceConnector.d.ts.map +1 -1
  195. package/dist/deviceProfile/buildDeviceProfile.d.ts +22 -0
  196. package/dist/deviceProfile/buildDeviceProfile.d.ts.map +1 -0
  197. package/dist/deviceProfile/index.d.ts +3 -0
  198. package/dist/deviceProfile/index.d.ts.map +1 -0
  199. package/dist/deviceProfile/legacyFeaturesView.d.ts +5 -0
  200. package/dist/deviceProfile/legacyFeaturesView.d.ts.map +1 -0
  201. package/dist/events/logBlockEvent.d.ts +1 -0
  202. package/dist/events/logBlockEvent.d.ts.map +1 -1
  203. package/dist/events/ui-request.d.ts +8 -0
  204. package/dist/events/ui-request.d.ts.map +1 -1
  205. package/dist/index.d.ts +720 -382
  206. package/dist/index.js +17634 -1201
  207. package/dist/inject.d.ts.map +1 -1
  208. package/dist/protocols/protocol-v2/features.d.ts +93 -0
  209. package/dist/protocols/protocol-v2/features.d.ts.map +1 -0
  210. package/dist/protocols/protocol-v2/firmware.d.ts +13 -0
  211. package/dist/protocols/protocol-v2/firmware.d.ts.map +1 -0
  212. package/dist/protocols/protocol-v2/index.d.ts +4 -0
  213. package/dist/protocols/protocol-v2/index.d.ts.map +1 -0
  214. package/dist/types/api/export.d.ts +1 -1
  215. package/dist/types/api/export.d.ts.map +1 -1
  216. package/dist/types/api/firmwareUpdate.d.ts +27 -0
  217. package/dist/types/api/firmwareUpdate.d.ts.map +1 -1
  218. package/dist/types/api/getDeviceInfo.d.ts +85 -0
  219. package/dist/types/api/getDeviceInfo.d.ts.map +1 -0
  220. package/dist/types/api/getPassphraseState.d.ts +10 -1
  221. package/dist/types/api/getPassphraseState.d.ts.map +1 -1
  222. package/dist/types/api/index.d.ts +37 -1
  223. package/dist/types/api/index.d.ts.map +1 -1
  224. package/dist/types/api/protocolV2.d.ts +103 -0
  225. package/dist/types/api/protocolV2.d.ts.map +1 -0
  226. package/dist/types/api/searchDevices.d.ts +2 -2
  227. package/dist/types/api/searchDevices.d.ts.map +1 -1
  228. package/dist/types/device.d.ts +10 -3
  229. package/dist/types/device.d.ts.map +1 -1
  230. package/dist/types/params.d.ts +2 -0
  231. package/dist/types/params.d.ts.map +1 -1
  232. package/dist/types/settings.d.ts +1 -1
  233. package/dist/types/settings.d.ts.map +1 -1
  234. package/dist/utils/deviceFeaturesUtils.d.ts +6 -8
  235. package/dist/utils/deviceFeaturesUtils.d.ts.map +1 -1
  236. package/dist/utils/deviceInfoUtils.d.ts +1 -0
  237. package/dist/utils/deviceInfoUtils.d.ts.map +1 -1
  238. package/dist/utils/index.d.ts +1 -1
  239. package/dist/utils/index.d.ts.map +1 -1
  240. package/dist/utils/patch.d.ts +1 -1
  241. package/dist/utils/patch.d.ts.map +1 -1
  242. package/package.json +4 -4
  243. package/src/api/BaseMethod.ts +26 -22
  244. package/src/api/DirList.ts +31 -0
  245. package/src/api/DirMake.ts +23 -0
  246. package/src/api/DirRemove.ts +23 -0
  247. package/src/api/FileDelete.ts +23 -0
  248. package/src/api/FileRead.ts +167 -0
  249. package/src/api/FileWrite.ts +216 -0
  250. package/src/api/FirmwareUpdate.ts +13 -5
  251. package/src/api/FirmwareUpdateV2.ts +21 -25
  252. package/src/api/FirmwareUpdateV3.ts +17 -4
  253. package/src/api/FirmwareUpdateV4.ts +827 -0
  254. package/src/api/GetDeviceInfo.ts +152 -0
  255. package/src/api/GetFeatures.ts +5 -2
  256. package/src/api/GetOnekeyFeatures.ts +95 -3
  257. package/src/api/GetPassphraseState.ts +16 -10
  258. package/src/api/PathInfo.ts +39 -0
  259. package/src/api/PromptWebDeviceAccess.ts +11 -1
  260. package/src/api/SearchDevices.ts +7 -2
  261. package/src/api/alephium/AlephiumGetAddress.ts +6 -2
  262. package/src/api/alephium/AlephiumSignMessage.ts +6 -1
  263. package/src/api/alephium/AlephiumSignTransaction.ts +15 -4
  264. package/src/api/allnetwork/AllNetworkGetAddressBase.ts +21 -13
  265. package/src/api/aptos/AptosGetAddress.ts +2 -3
  266. package/src/api/benfen/BenfenGetAddress.ts +11 -7
  267. package/src/api/benfen/BenfenGetPublicKey.ts +6 -2
  268. package/src/api/benfen/BenfenSignMessage.ts +6 -1
  269. package/src/api/benfen/BenfenSignTransaction.ts +6 -1
  270. package/src/api/btc/BTCGetPublicKey.ts +3 -2
  271. package/src/api/btc/BTCSignPsbt.ts +1 -2
  272. package/src/api/btc/helpers/versionLimit.ts +7 -1
  273. package/src/api/cardano/CardanoSignTransaction.ts +2 -4
  274. package/src/api/conflux/ConfluxSignTransaction.ts +5 -2
  275. package/src/api/device/DeviceFullyUploadResource.ts +3 -3
  276. package/src/api/device/DeviceLock.ts +1 -3
  277. package/src/api/device/DeviceRebootToBoardloader.ts +10 -1
  278. package/src/api/device/DeviceRebootToBootloader.ts +10 -1
  279. package/src/api/device/DeviceSupportFeatures.ts +2 -13
  280. package/src/api/device/DeviceUpdateBootloader.ts +4 -4
  281. package/src/api/device/DeviceUploadResource.ts +4 -5
  282. package/src/api/device/DeviceVerify.ts +1 -2
  283. package/src/api/dynex/DnxGetAddress.ts +6 -0
  284. package/src/api/dynex/DnxSignTransaction.ts +6 -0
  285. package/src/api/evm/EVMGetAddress.ts +1 -1
  286. package/src/api/evm/EVMGetPublicKey.ts +3 -4
  287. package/src/api/evm/EVMSignMessage.ts +1 -1
  288. package/src/api/evm/EVMSignMessageEIP712.ts +14 -1
  289. package/src/api/evm/EVMSignTransaction.ts +1 -1
  290. package/src/api/evm/EVMSignTypedData.ts +32 -18
  291. package/src/api/evm/EVMVerifyMessage.ts +1 -1
  292. package/src/api/evm/latest/signTypedHash.ts +2 -4
  293. package/src/api/evm/legacyV1/getAddress.ts +5 -3
  294. package/src/api/evm/legacyV1/getPublicKey.ts +5 -3
  295. package/src/api/evm/legacyV1/signMessage.ts +5 -3
  296. package/src/api/evm/legacyV1/signTypedData.ts +9 -8
  297. package/src/api/evm/legacyV1/signTypedHash.ts +7 -7
  298. package/src/api/evm/legacyV1/verifyMessage.ts +5 -3
  299. package/src/api/firmware/FirmwareUpdateBaseMethod.ts +8 -8
  300. package/src/api/firmware/uploadFirmware.ts +3 -10
  301. package/src/api/helpers/batchGetPublickeys.ts +51 -6
  302. package/src/api/helpers/filesystemValidation.ts +51 -0
  303. package/src/api/index.ts +34 -0
  304. package/src/api/kaspa/KaspaSignTransaction.ts +4 -5
  305. package/src/api/lightning/LnurlAuth.ts +4 -0
  306. package/src/api/neo/NeoGetAddress.ts +6 -1
  307. package/src/api/neo/NeoSignTransaction.ts +6 -1
  308. package/src/api/nervos/NervosGetAddress.ts +6 -2
  309. package/src/api/nervos/NervosSignTransaction.ts +14 -4
  310. package/src/api/nexa/NexaGetAddress.ts +6 -2
  311. package/src/api/nexa/NexaSignTransaction.ts +11 -12
  312. package/src/api/polkadot/networks.ts +9 -0
  313. package/src/api/protocol-v2/DevReboot.ts +24 -0
  314. package/src/api/protocol-v2/DeviceFirmwareUpdate.ts +63 -0
  315. package/src/api/protocol-v2/DeviceGetDeviceInfo.ts +118 -0
  316. package/src/api/protocol-v2/DeviceGetFirmwareUpdateStatus.ts +20 -0
  317. package/src/api/protocol-v2/DeviceGetOnboardingStatus.ts +16 -0
  318. package/src/api/protocol-v2/DeviceReboot.ts +24 -0
  319. package/src/api/protocol-v2/FactoryDeviceInfoSettings.ts +29 -0
  320. package/src/api/protocol-v2/FactoryGetDeviceInfo.ts +20 -0
  321. package/src/api/protocol-v2/FilesystemDiskControl.ts +50 -0
  322. package/src/api/protocol-v2/FilesystemFixPermission.ts +16 -0
  323. package/src/api/protocol-v2/FilesystemFormat.ts +16 -0
  324. package/src/api/protocol-v2/GetProtoVersion.ts +16 -0
  325. package/src/api/protocol-v2/Ping.ts +18 -0
  326. package/src/api/protocol-v2/helpers.ts +207 -0
  327. package/src/api/scdo/ScdoGetAddress.ts +6 -2
  328. package/src/api/scdo/ScdoSignMessage.ts +6 -1
  329. package/src/api/scdo/ScdoSignTransaction.ts +6 -2
  330. package/src/api/solana/SolGetAddress.ts +4 -0
  331. package/src/api/solana/SolSignMessage.ts +3 -0
  332. package/src/api/solana/SolSignOffchainMessage.ts +3 -0
  333. package/src/api/solana/SolSignTransaction.ts +6 -0
  334. package/src/api/stellar/StellarGetAddress.ts +10 -1
  335. package/src/api/stellar/StellarSignTransaction.ts +14 -1
  336. package/src/api/sui/SuiGetAddress.ts +5 -3
  337. package/src/api/sui/SuiGetPublicKey.ts +3 -0
  338. package/src/api/sui/SuiSignMessage.ts +3 -0
  339. package/src/api/sui/SuiSignTransaction.ts +14 -12
  340. package/src/api/ton/TonGetAddress.ts +3 -0
  341. package/src/api/ton/TonSignData.ts +10 -3
  342. package/src/api/ton/TonSignMessage.ts +6 -5
  343. package/src/api/ton/TonSignProof.ts +3 -0
  344. package/src/api/tron/TronSignMessage.ts +5 -1
  345. package/src/api/tron/TronSignTransaction.ts +4 -0
  346. package/src/api/xrp/XrpSignTransaction.ts +1 -1
  347. package/src/core/index.ts +87 -55
  348. package/src/data/messages/messages-protocol-v2.json +13369 -0
  349. package/src/data-manager/DataManager.ts +12 -7
  350. package/src/data-manager/MessagesConfig.ts +14 -14
  351. package/src/data-manager/TransportManager.ts +38 -12
  352. package/src/device/Device.ts +538 -61
  353. package/src/device/DeviceCommands.ts +195 -29
  354. package/src/device/DeviceConnector.ts +29 -4
  355. package/src/device/DevicePool.ts +7 -7
  356. package/src/deviceProfile/buildDeviceProfile.ts +387 -0
  357. package/src/deviceProfile/index.ts +2 -0
  358. package/src/deviceProfile/legacyFeaturesView.ts +123 -0
  359. package/src/events/logBlockEvent.ts +23 -0
  360. package/src/events/ui-request.ts +8 -0
  361. package/src/inject.ts +52 -1
  362. package/src/protocols/protocol-v2/features.ts +180 -0
  363. package/src/protocols/protocol-v2/firmware.ts +43 -0
  364. package/src/protocols/protocol-v2/index.ts +16 -0
  365. package/src/types/api/export.ts +1 -0
  366. package/src/types/api/firmwareUpdate.ts +49 -0
  367. package/src/types/api/getDeviceInfo.ts +99 -0
  368. package/src/types/api/getPassphraseState.ts +13 -2
  369. package/src/types/api/index.ts +88 -1
  370. package/src/types/api/protocolV2.ts +201 -0
  371. package/src/types/api/searchDevices.ts +2 -2
  372. package/src/types/device.ts +37 -3
  373. package/src/types/params.ts +7 -0
  374. package/src/types/settings.ts +1 -1
  375. package/src/utils/deviceFeaturesUtils.ts +70 -70
  376. package/src/utils/deviceInfoUtils.ts +15 -8
  377. package/src/utils/index.ts +1 -0
@@ -0,0 +1,207 @@
1
+ import { DevRebootType, DeviceRebootType } from '@onekeyfe/hd-transport';
2
+
3
+ import { invalidParameter, validateNonEmptyString } from '../helpers/filesystemValidation';
4
+
5
+ import type {
6
+ DevFirmwareTarget,
7
+ DevFirmwareTargetType,
8
+ TransportCallOptions,
9
+ } from '@onekeyfe/hd-transport';
10
+
11
+ export type RebootTypeInput =
12
+ | DevRebootType
13
+ | DeviceRebootType
14
+ | keyof typeof DevRebootType
15
+ | keyof typeof DeviceRebootType
16
+ | string
17
+ | number;
18
+
19
+ export type DeviceRebootParams = {
20
+ rebootType?: RebootTypeInput;
21
+ reboot_type?: RebootTypeInput;
22
+ };
23
+
24
+ export type DeviceFirmwareTargetInput =
25
+ | DevFirmwareTarget
26
+ | {
27
+ targetId?: DevFirmwareTargetType | string | number;
28
+ target_id?: DevFirmwareTargetType | string | number;
29
+ path: string;
30
+ };
31
+
32
+ export type DeviceFirmwareUpdateParams = {
33
+ targets?: DeviceFirmwareTargetInput[];
34
+ targetId?: DevFirmwareTargetType | string | number;
35
+ target_id?: DevFirmwareTargetType | string | number;
36
+ path?: string;
37
+ };
38
+
39
+ export type FactoryDeviceInfoSettingsParams = {
40
+ serial_no?: string;
41
+ serialNo?: string;
42
+ cpu_info?: string;
43
+ cpuInfo?: string;
44
+ pre_firmware?: string;
45
+ preFirmware?: string;
46
+ };
47
+
48
+ const DEV_REBOOT_TYPES: Record<string, DevRebootType> = {
49
+ Normal: DevRebootType.Normal,
50
+ normal: DevRebootType.Normal,
51
+ Romloader: DevRebootType.Boardloader,
52
+ romloader: DevRebootType.Boardloader,
53
+ Boardloader: DevRebootType.Boardloader,
54
+ boardloader: DevRebootType.Boardloader,
55
+ Bootloader: DevRebootType.Bootloader,
56
+ bootloader: DevRebootType.Bootloader,
57
+ };
58
+
59
+ const DEVICE_REBOOT_TYPES: Record<string, DeviceRebootType> = {
60
+ Normal: DeviceRebootType.Normal,
61
+ normal: DeviceRebootType.Normal,
62
+ Romloader: DeviceRebootType.Romloader,
63
+ romloader: DeviceRebootType.Romloader,
64
+ Boardloader: DeviceRebootType.Romloader,
65
+ boardloader: DeviceRebootType.Romloader,
66
+ Bootloader: DeviceRebootType.Bootloader,
67
+ bootloader: DeviceRebootType.Bootloader,
68
+ };
69
+
70
+ export const PROTOCOL_V2_FIRMWARE_UPDATE_OPTIONS: TransportCallOptions = {
71
+ intermediateTypes: ['DevFirmwareInstallProgress'],
72
+ };
73
+
74
+ export const PROTOCOL_V2_FIRMWARE_UPDATE_RESPONSE_TYPES: (
75
+ | 'Success'
76
+ | 'DevFirmwareUpdateStatus'
77
+ )[] = ['Success', 'DevFirmwareUpdateStatus'];
78
+
79
+ export const getProtocolV2UnknownErrorText = (error: unknown) => {
80
+ if (!error) {
81
+ return '';
82
+ }
83
+ if (typeof error === 'string') {
84
+ return error;
85
+ }
86
+
87
+ const parts: string[] = [];
88
+ if (error instanceof Error) {
89
+ parts.push(error.name, error.message);
90
+ }
91
+
92
+ if (typeof error === 'object') {
93
+ const record = error as Record<string, unknown>;
94
+ for (const field of ['name', 'message', 'reason', 'code', 'errorCode', 'nativeErrorCode']) {
95
+ const value = record[field];
96
+ if (value !== undefined && value !== null) {
97
+ parts.push(String(value));
98
+ }
99
+ }
100
+ }
101
+
102
+ const stringified = String(error);
103
+ if (stringified && stringified !== '[object Object]') {
104
+ parts.push(stringified);
105
+ }
106
+
107
+ return parts.filter(Boolean).join(' ');
108
+ };
109
+
110
+ export const isProtocolV2DeviceDisconnectedError = (error: unknown) => {
111
+ const message = getProtocolV2UnknownErrorText(error).toLowerCase();
112
+ const compactMessage = message.replace(/\s+/g, '');
113
+ return (
114
+ message.includes('notfounderror') ||
115
+ (message.includes("failed to execute 'open'") && message.includes('usbdevice')) ||
116
+ message.includes('device was disconnected') ||
117
+ message.includes('device disconnected') ||
118
+ message.includes('device disconnect') ||
119
+ message.includes('was disconnected') ||
120
+ message.includes('bledevicedisconnected') ||
121
+ message.includes('bleconnectederror') ||
122
+ message.includes('connected error is always runtime error') ||
123
+ message.includes('connection has timed out unexpectedly') ||
124
+ message.includes('connection error has occured') ||
125
+ message.includes('connection error has occurred') ||
126
+ message.includes('transferIn') ||
127
+ message.includes('transferin') ||
128
+ message.includes('usbdevice') ||
129
+ message.includes('multiplatformbleadapter') ||
130
+ message.includes('multipalformebleadapter') ||
131
+ compactMessage.includes('rxerrorerror6') ||
132
+ message.includes('rxerror error 6')
133
+ );
134
+ };
135
+
136
+ export function normalizeRebootType(value: RebootTypeInput | undefined): DevRebootType {
137
+ if (typeof value === 'number') return value;
138
+ if (typeof value === 'string') {
139
+ const numeric = Number(value);
140
+ if (Number.isFinite(numeric)) return numeric;
141
+ if (value in DEV_REBOOT_TYPES) return DEV_REBOOT_TYPES[value];
142
+ }
143
+ return DevRebootType.Normal;
144
+ }
145
+
146
+ export function normalizeDeviceRebootType(
147
+ value: RebootTypeInput | undefined
148
+ ): DeviceRebootType {
149
+ if (typeof value === 'number') return value;
150
+ if (typeof value === 'string') {
151
+ const numeric = Number(value);
152
+ if (Number.isFinite(numeric)) return numeric;
153
+ if (value in DEVICE_REBOOT_TYPES) return DEVICE_REBOOT_TYPES[value];
154
+ }
155
+ return DeviceRebootType.Normal;
156
+ }
157
+
158
+ // 当前 firmware-pro2 子模块的 DevFirmwareTargetType 合法值。
159
+ const VALID_FIRMWARE_TARGET_IDS = new Set<number>([0, 1, 2, 3, 4, 5, 6, 10]);
160
+
161
+ function normalizeTargetId(
162
+ value: DevFirmwareTargetType | string | number | undefined,
163
+ name: string
164
+ ): DevFirmwareTargetType {
165
+ if (value === undefined || value === null) {
166
+ throw invalidParameter(`Missing required parameter: ${name}`);
167
+ }
168
+ const numeric = typeof value === 'number' ? value : Number(value);
169
+ // 校验值域:仅接受 DevFirmwareTargetType 中定义的 target id,
170
+ // 不再放行任意非负整数。
171
+ if (Number.isSafeInteger(numeric) && VALID_FIRMWARE_TARGET_IDS.has(numeric)) {
172
+ return numeric as DevFirmwareTargetType;
173
+ }
174
+ throw invalidParameter(
175
+ `Parameter [${name}] must be a valid firmware target id (one of ${[
176
+ ...VALID_FIRMWARE_TARGET_IDS,
177
+ ].join(', ')}).`
178
+ );
179
+ }
180
+
181
+ export function normalizeFirmwareTargets(params: DeviceFirmwareUpdateParams): DevFirmwareTarget[] {
182
+ const targets =
183
+ params.targets ??
184
+ (params.path
185
+ ? [
186
+ {
187
+ target_id: params.target_id ?? params.targetId ?? 0,
188
+ path: params.path,
189
+ },
190
+ ]
191
+ : []);
192
+
193
+ if (!Array.isArray(targets) || targets.length === 0) {
194
+ throw invalidParameter('Parameter [targets] must contain at least one firmware target.');
195
+ }
196
+
197
+ return targets.map((target, index) => {
198
+ if (!target || typeof target !== 'object') {
199
+ throw invalidParameter(`Parameter [targets.${index}] must be an object.`);
200
+ }
201
+ const targetId = target.target_id ?? target.targetId;
202
+ return {
203
+ target_id: normalizeTargetId(targetId, `targets.${index}.target_id`),
204
+ path: validateNonEmptyString(target.path, `targets.${index}.path`),
205
+ };
206
+ });
207
+ }
@@ -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 { ScdoAddress, ScdoGetAddressParams } from '../../types';
7
+ import type { DeviceFirmwareRange, ScdoAddress, ScdoGetAddressParams } from '../../types';
8
8
 
9
9
  export default class ScdoGetAddress extends BaseMethod<HardwareScdoGetAddress[]> {
10
10
  hasBundle = false;
@@ -38,8 +38,12 @@ export default class ScdoGetAddress extends BaseMethod<HardwareScdoGetAddress[]>
38
38
  });
39
39
  }
40
40
 
41
- getVersionRange() {
41
+ getVersionRange(): DeviceFirmwareRange {
42
42
  return {
43
+ pro2: {
44
+ min: '0.0.0',
45
+ unsupported: true,
46
+ },
43
47
  model_touch: {
44
48
  min: '4.10.0',
45
49
  },
@@ -5,6 +5,7 @@ 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';
8
9
 
9
10
  export default class ScdoSignMessage extends BaseMethod<HardwareScdoSignMessage> {
10
11
  init() {
@@ -28,8 +29,12 @@ export default class ScdoSignMessage extends BaseMethod<HardwareScdoSignMessage>
28
29
  };
29
30
  }
30
31
 
31
- getVersionRange() {
32
+ getVersionRange(): DeviceFirmwareRange {
32
33
  return {
34
+ pro2: {
35
+ min: '0.0.0',
36
+ unsupported: true,
37
+ },
33
38
  model_touch: {
34
39
  min: '4.10.0',
35
40
  },
@@ -6,7 +6,7 @@ import { BaseMethod } from '../BaseMethod';
6
6
  import { validateParams } from '../helpers/paramsValidator';
7
7
  import { formatAnyHex, stripHexStartZeroes } from '../helpers/hexUtils';
8
8
 
9
- import type { ScdoSignTransactionParams } from '../../types';
9
+ import type { DeviceFirmwareRange, ScdoSignTransactionParams } from '../../types';
10
10
  import type {
11
11
  ScdoSignTx as HardwareScdoSignTx,
12
12
  ScdoSignedTx,
@@ -51,8 +51,12 @@ export default class ScdoSignTransaction extends BaseMethod<HardwareScdoSignTx>
51
51
  };
52
52
  }
53
53
 
54
- getVersionRange() {
54
+ getVersionRange(): DeviceFirmwareRange {
55
55
  return {
56
+ pro2: {
57
+ min: '0.0.0',
58
+ unsupported: true,
59
+ },
56
60
  model_touch: {
57
61
  min: '4.10.0',
58
62
  },
@@ -38,6 +38,10 @@ export default class SolGetAddress extends BaseMethod<SolanaGetAddress[]> {
38
38
  });
39
39
  }
40
40
 
41
+ getVersionRange() {
42
+ return {};
43
+ }
44
+
41
45
  async run() {
42
46
  const responses: SolanaAddress[] = [];
43
47
 
@@ -30,6 +30,9 @@ export default class SolSignMessage extends BaseMethod<HardwareSolSignUnsafeMess
30
30
 
31
31
  getVersionRange() {
32
32
  return {
33
+ pro2: {
34
+ min: '0.0.0',
35
+ },
33
36
  pro: {
34
37
  min: '4.12.0',
35
38
  },
@@ -36,6 +36,9 @@ export default class SolSignOffchainMessage extends BaseMethod<HardwareSolSignOf
36
36
 
37
37
  getVersionRange() {
38
38
  return {
39
+ pro2: {
40
+ min: '0.0.0',
41
+ },
39
42
  pro: {
40
43
  min: '4.12.0',
41
44
  },
@@ -43,6 +43,9 @@ export default class SolSignTransaction extends BaseMethod<HardwareSolanaSignTx[
43
43
  getVersionRange() {
44
44
  if (this.existsVersionedTx()) {
45
45
  return {
46
+ pro2: {
47
+ min: '0.0.0',
48
+ },
46
49
  model_mini: {
47
50
  min: '3.1.0',
48
51
  },
@@ -53,6 +56,9 @@ export default class SolSignTransaction extends BaseMethod<HardwareSolanaSignTx[
53
56
  }
54
57
 
55
58
  return {
59
+ pro2: {
60
+ min: '0.0.0',
61
+ },
56
62
  classic: {
57
63
  min: '2.1.9',
58
64
  },
@@ -4,7 +4,7 @@ import { BaseMethod } from '../BaseMethod';
4
4
  import { validateParams, validateResult } from '../helpers/paramsValidator';
5
5
 
6
6
  import type { StellarGetAddress as HardwareStellarGetAddress } from '@onekeyfe/hd-transport';
7
- import type { StellarAddress, StellarGetAddressParams } from '../../types';
7
+ import type { DeviceFirmwareRange, StellarAddress, StellarGetAddressParams } from '../../types';
8
8
 
9
9
  export default class StellarGetAddress extends BaseMethod<HardwareStellarGetAddress[]> {
10
10
  hasBundle = false;
@@ -38,6 +38,15 @@ export default class StellarGetAddress extends BaseMethod<HardwareStellarGetAddr
38
38
  });
39
39
  }
40
40
 
41
+ getVersionRange(): DeviceFirmwareRange {
42
+ return {
43
+ pro2: {
44
+ min: '0.0.0',
45
+ unsupported: true,
46
+ },
47
+ };
48
+ }
49
+
41
50
  async run() {
42
51
  const responses: StellarAddress[] = [];
43
52
 
@@ -10,7 +10,11 @@ import type {
10
10
  StellarSignTx as HardwareStellarSignTx,
11
11
  StellarSignedTx,
12
12
  } from '@onekeyfe/hd-transport';
13
- import type { StellarOperation, StellarSignTransactionParams } from '../../types';
13
+ import type {
14
+ DeviceFirmwareRange,
15
+ StellarOperation,
16
+ StellarSignTransactionParams,
17
+ } from '../../types';
14
18
 
15
19
  // Firmware accepts up to 1024 bytes per chunk; 1 byte = 2 hex chars
16
20
  const SOROBAN_CHUNK_BYTES = 1024;
@@ -28,6 +32,15 @@ export default class StellarSignTransaction extends BaseMethod<HardwareStellarSi
28
32
  extSent: number;
29
33
  };
30
34
 
35
+ getVersionRange(): DeviceFirmwareRange {
36
+ return {
37
+ pro2: {
38
+ min: '0.0.0',
39
+ unsupported: true,
40
+ },
41
+ };
42
+ }
43
+
31
44
  parseOperation = (op: StellarOperation) => {
32
45
  switch (op.type) {
33
46
  case 'createAccount':
@@ -2,9 +2,8 @@ import { UI_REQUEST } from '../../constants/ui-request';
2
2
  import { serializedPath, validatePath } from '../helpers/pathUtils';
3
3
  import { BaseMethod } from '../BaseMethod';
4
4
  import { validateParams, validateResult } from '../helpers/paramsValidator';
5
- import { supportBatchPublicKey } from '../../utils/deviceFeaturesUtils';
6
5
  import { publicKeyToAddress } from './normalize';
7
- import { batchGetPublickeys } from '../helpers/batchGetPublickeys';
6
+ import { batchGetPublickeys, supportBatchPublicKeyByDevice } from '../helpers/batchGetPublickeys';
8
7
 
9
8
  import type { SuiAddress, SuiGetAddressParams } from '../../types';
10
9
  import type { SuiGetAddress as HardwareSuiGetAddress } from '@onekeyfe/hd-transport';
@@ -49,6 +48,9 @@ export default class SuiGetAddress extends BaseMethod<HardwareSuiGetAddress[]> {
49
48
 
50
49
  getVersionRange() {
51
50
  return {
51
+ pro2: {
52
+ min: '0.0.0',
53
+ },
52
54
  model_mini: {
53
55
  min: '3.0.0',
54
56
  },
@@ -59,7 +61,7 @@ export default class SuiGetAddress extends BaseMethod<HardwareSuiGetAddress[]> {
59
61
  }
60
62
 
61
63
  async run() {
62
- const supportsBatchPublicKey = supportBatchPublicKey(this.device?.features);
64
+ const supportsBatchPublicKey = supportBatchPublicKeyByDevice(this.device);
63
65
  let responses: SuiAddress[] = [];
64
66
  if (supportsBatchPublicKey) {
65
67
  const publicKeyRes = await batchGetPublickeys(this.device, this.params, 'ed25519', 784);
@@ -40,6 +40,9 @@ export default class SuiGetPublicKey extends BaseMethod<any> {
40
40
 
41
41
  getVersionRange() {
42
42
  return {
43
+ pro2: {
44
+ min: '0.0.0',
45
+ },
43
46
  model_mini: {
44
47
  min: '3.0.0',
45
48
  },
@@ -30,6 +30,9 @@ export default class SuiSignMessage extends BaseMethod<HardwareSuiSignMessage> {
30
30
 
31
31
  getVersionRange() {
32
32
  return {
33
+ pro2: {
34
+ min: '0.0.0',
35
+ },
33
36
  model_mini: {
34
37
  min: '3.4.0',
35
38
  },
@@ -1,20 +1,16 @@
1
1
  import semver from 'semver';
2
2
  import { bytesToHex } from '@noble/hashes/utils';
3
+ import { EDeviceType } from '@onekeyfe/hd-shared';
3
4
 
4
5
  import { UI_REQUEST } from '../../constants/ui-request';
5
6
  import { validatePath } from '../helpers/pathUtils';
6
7
  import { BaseMethod } from '../BaseMethod';
7
8
  import { validateParams } from '../helpers/paramsValidator';
8
9
  import { formatAnyHex } from '../helpers/hexUtils';
9
- import { getDeviceFirmwareVersion, getDeviceType } from '../../utils';
10
10
  import { DeviceModelToTypes } from '../../types';
11
11
 
12
- import type {
13
- SuiSignTx as HardwareSuiSignTx,
14
- SuiSignedTx,
15
- TypedCall,
16
- } from '@onekeyfe/hd-transport';
17
- import type { TypedResponseMessage } from '../../device/DeviceCommands';
12
+ import type { SuiSignTx as HardwareSuiSignTx, SuiSignedTx } from '@onekeyfe/hd-transport';
13
+ import type { TypedCall, TypedResponseMessage } from '../../device/DeviceCommands';
18
14
 
19
15
  type SuiSignTx = Omit<HardwareSuiSignTx, 'data_initial_chunk' | 'data_length'> & HardwareSuiSignTx;
20
16
 
@@ -43,6 +39,9 @@ export default class SuiSignTransaction extends BaseMethod<SuiSignTx> {
43
39
 
44
40
  getVersionRange() {
45
41
  return {
42
+ pro2: {
43
+ min: '0.0.0',
44
+ },
46
45
  model_mini: {
47
46
  min: '3.0.0',
48
47
  },
@@ -53,8 +52,12 @@ export default class SuiSignTransaction extends BaseMethod<SuiSignTx> {
53
52
  }
54
53
 
55
54
  supportChunkTransfer() {
56
- const deviceType = getDeviceType(this.device.features);
57
- const deviceFirmwareVersion = getDeviceFirmwareVersion(this.device.features).join('.');
55
+ if (this.device.isProtocolV2() || this.device.getCurrentDeviceType() === EDeviceType.Pro2) {
56
+ return true;
57
+ }
58
+
59
+ const deviceType = this.device.getCurrentDeviceType();
60
+ const deviceFirmwareVersion = this.device.getCurrentFirmwareVersionString() ?? '0.0.0';
58
61
 
59
62
  if (DeviceModelToTypes.model_mini.includes(deviceType)) {
60
63
  if (semver.valid(deviceFirmwareVersion)) {
@@ -85,7 +88,7 @@ export default class SuiSignTransaction extends BaseMethod<SuiSignTx> {
85
88
 
86
89
  if (!data_length) {
87
90
  // sign Done
88
- return res.message;
91
+ return res.message as SuiSignedTx;
89
92
  }
90
93
 
91
94
  const payload = data.subarray(offset, offset + data_length);
@@ -104,7 +107,7 @@ export default class SuiSignTransaction extends BaseMethod<SuiSignTx> {
104
107
  async run() {
105
108
  const typedCall = this.device.getCommands().typedCall.bind(this.device.getCommands());
106
109
  let offset = 0;
107
- let data: Buffer;
110
+ let data = Buffer.alloc(0);
108
111
 
109
112
  if (this.supportChunkTransfer()) {
110
113
  offset = this.chunkByteSize;
@@ -121,7 +124,6 @@ export default class SuiSignTransaction extends BaseMethod<SuiSignTx> {
121
124
  ...this.params,
122
125
  });
123
126
 
124
- // @ts-expect-error
125
127
  return this.processTxRequest(typedCall, res, data, offset);
126
128
  }
127
129
  }
@@ -57,6 +57,9 @@ export default class TonGetAddress extends BaseMethod<HardwareTonGetAddress[]> {
57
57
 
58
58
  getVersionRange() {
59
59
  return {
60
+ pro2: {
61
+ min: '0.0.0',
62
+ },
60
63
  model_touch: {
61
64
  min: '4.10.0',
62
65
  },
@@ -9,9 +9,8 @@ import type { TonSignDataParams } from '../../types/api/tonSignData';
9
9
 
10
10
  export default class TonSignData extends BaseMethod<HardwareTonSignData> {
11
11
  init() {
12
- // Keep strict-check off until the firmware release that ships TonSignData
13
- // is decided we don't yet know the min versions for touch/classic1s.
14
- // Flip back to true and add getVersionRange() once those numbers land.
12
+ // Keep strict-check off for touch/classic1s until their firmware release
13
+ // versions are decided. Pro2 is explicitly allowed by getVersionRange().
15
14
  this.strictCheckDeviceSupport = false;
16
15
  this.checkDeviceId = true;
17
16
  this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
@@ -51,6 +50,14 @@ export default class TonSignData extends BaseMethod<HardwareTonSignData> {
51
50
  };
52
51
  }
53
52
 
53
+ getVersionRange() {
54
+ return {
55
+ pro2: {
56
+ min: '0.0.0',
57
+ },
58
+ };
59
+ }
60
+
54
61
  async run() {
55
62
  const res = await this.device.commands.typedCall('TonSignData', 'TonSignedData', {
56
63
  ...this.params,
@@ -7,7 +7,6 @@ import { validatePath } from '../helpers/pathUtils';
7
7
  import { BaseMethod } from '../BaseMethod';
8
8
  import { validateParams } from '../helpers/paramsValidator';
9
9
  import { DeviceModelToTypes } from '../../types';
10
- import { getDeviceFirmwareVersion, getDeviceType, getMethodVersionRange } from '../../utils';
11
10
  import { formatAnyHex, stripHexStartZeroes } from '../helpers/hexUtils';
12
11
  import { cutString } from '../helpers/stringUtils';
13
12
 
@@ -86,6 +85,9 @@ export default class TonSignMessage extends BaseMethod<HardwareTonSignMessage> {
86
85
 
87
86
  getVersionRange() {
88
87
  return {
88
+ pro2: {
89
+ min: '0.0.0',
90
+ },
89
91
  model_touch: {
90
92
  min: '4.10.0',
91
93
  },
@@ -107,9 +109,8 @@ export default class TonSignMessage extends BaseMethod<HardwareTonSignMessage> {
107
109
  }
108
110
 
109
111
  checkSupportJettonAmountBytes() {
110
- const firmwareVersion = getDeviceFirmwareVersion(this.device.features)?.join('.');
111
- const versionRange = getMethodVersionRange(
112
- this.device.features,
112
+ const firmwareVersion = this.device.getCurrentFirmwareVersionString() ?? '0.0.0';
113
+ const versionRange = this.device.getCurrentMethodVersionRange(
113
114
  type => this.getSupportJettonAmountBytesVersionRange()[type]
114
115
  );
115
116
 
@@ -167,7 +168,7 @@ export default class TonSignMessage extends BaseMethod<HardwareTonSignMessage> {
167
168
  data: string
168
169
  ): Promise<TonTxAck | TonSignedMessageResponse> => {
169
170
  if (!request.init_data_length) {
170
- const deviceType = getDeviceType(this.device.features);
171
+ const deviceType = this.device.getCurrentDeviceType();
171
172
  const hasClassic = DeviceModelToTypes.model_classic1s.includes(deviceType);
172
173
  // use signing_message_repr sign, not exists signning_message, skip validate
173
174
  const hasSigningMessageRepr = request.signning_message == null;
@@ -44,6 +44,9 @@ export default class TonSignProof extends BaseMethod<HardwareTonSignProof> {
44
44
 
45
45
  getVersionRange() {
46
46
  return {
47
+ pro2: {
48
+ min: '0.0.0',
49
+ },
47
50
  model_touch: {
48
51
  min: '4.10.0',
49
52
  },
@@ -29,7 +29,7 @@ export default class TronSignMessage extends BaseMethod<HardwareTronSignMessage>
29
29
  if (this.payload.messageType === 'V1' || this.payload.messageType == null) {
30
30
  throw createDeviceNotSupportMethodError(
31
31
  'TronSignMessage',
32
- getFirmwareType(this.device.features)
32
+ getFirmwareType(this.device?.features)
33
33
  );
34
34
  }
35
35
 
@@ -45,6 +45,10 @@ export default class TronSignMessage extends BaseMethod<HardwareTronSignMessage>
45
45
 
46
46
  getVersionRange() {
47
47
  return {
48
+ pro2: {
49
+ min: '0.0.0',
50
+ unsupported: true,
51
+ },
48
52
  model_mini: {
49
53
  min: '2.5.0',
50
54
  },
@@ -148,6 +148,10 @@ export default class TronSignTransaction extends BaseMethod<TronSignTx> {
148
148
 
149
149
  getVersionRange() {
150
150
  return {
151
+ pro2: {
152
+ min: '0.0.0',
153
+ unsupported: true,
154
+ },
151
155
  model_mini: {
152
156
  min: '2.5.0',
153
157
  },
@@ -30,7 +30,7 @@ export default class XrpGetAddress extends BaseMethod<XrpSignTransactionParams>
30
30
  { name: 'payment', type: 'object' },
31
31
  ]);
32
32
  validateParams(transaction.payment, [
33
- { name: 'amount', type: 'number', required: true },
33
+ { name: 'amount', type: 'uint', required: true },
34
34
  { name: 'destination', type: 'string', required: true },
35
35
  { name: 'destinationTag', type: 'number' },
36
36
  ]);