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

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__/evmSignTransaction.test.ts +1 -1
  2. package/__tests__/evmSignTypedData.test.ts +1 -1
  3. package/__tests__/protocol-v2.test.ts +1688 -0
  4. package/dist/api/BaseMethod.d.ts +1 -7
  5. package/dist/api/BaseMethod.d.ts.map +1 -1
  6. package/dist/api/DirList.d.ts +10 -0
  7. package/dist/api/DirList.d.ts.map +1 -0
  8. package/dist/api/DirMake.d.ts +9 -0
  9. package/dist/api/DirMake.d.ts.map +1 -0
  10. package/dist/api/DirRemove.d.ts +9 -0
  11. package/dist/api/DirRemove.d.ts.map +1 -0
  12. package/dist/api/FileDelete.d.ts +9 -0
  13. package/dist/api/FileDelete.d.ts.map +1 -0
  14. package/dist/api/FileRead.d.ts +19 -0
  15. package/dist/api/FileRead.d.ts.map +1 -0
  16. package/dist/api/FileWrite.d.ts +23 -0
  17. package/dist/api/FileWrite.d.ts.map +1 -0
  18. package/dist/api/FirmwareUpdateV3.d.ts +1 -0
  19. package/dist/api/FirmwareUpdateV3.d.ts.map +1 -1
  20. package/dist/api/FirmwareUpdateV4.d.ts +32 -0
  21. package/dist/api/FirmwareUpdateV4.d.ts.map +1 -0
  22. package/dist/api/GetDeviceInfo.d.ts +9 -0
  23. package/dist/api/GetDeviceInfo.d.ts.map +1 -0
  24. package/dist/api/GetFeatures.d.ts +1 -1
  25. package/dist/api/GetOnekeyFeatures.d.ts.map +1 -1
  26. package/dist/api/GetPassphraseState.d.ts +6 -1
  27. package/dist/api/GetPassphraseState.d.ts.map +1 -1
  28. package/dist/api/PathInfo.d.ts +9 -0
  29. package/dist/api/PathInfo.d.ts.map +1 -0
  30. package/dist/api/SearchDevices.d.ts +2 -1
  31. package/dist/api/SearchDevices.d.ts.map +1 -1
  32. package/dist/api/alephium/AlephiumGetAddress.d.ts +2 -6
  33. package/dist/api/alephium/AlephiumGetAddress.d.ts.map +1 -1
  34. package/dist/api/alephium/AlephiumSignMessage.d.ts +2 -5
  35. package/dist/api/alephium/AlephiumSignMessage.d.ts.map +1 -1
  36. package/dist/api/alephium/AlephiumSignTransaction.d.ts +2 -5
  37. package/dist/api/alephium/AlephiumSignTransaction.d.ts.map +1 -1
  38. package/dist/api/algo/AlgoSignTransaction.d.ts.map +1 -1
  39. package/dist/api/allnetwork/AllNetworkGetAddressBase.d.ts.map +1 -1
  40. package/dist/api/aptos/AptosSignInMessage.d.ts.map +1 -1
  41. package/dist/api/aptos/AptosSignMessage.d.ts.map +1 -1
  42. package/dist/api/aptos/AptosSignTransaction.d.ts.map +1 -1
  43. package/dist/api/benfen/BenfenGetAddress.d.ts +2 -9
  44. package/dist/api/benfen/BenfenGetAddress.d.ts.map +1 -1
  45. package/dist/api/benfen/BenfenGetPublicKey.d.ts +2 -9
  46. package/dist/api/benfen/BenfenGetPublicKey.d.ts.map +1 -1
  47. package/dist/api/benfen/BenfenSignMessage.d.ts +2 -8
  48. package/dist/api/benfen/BenfenSignMessage.d.ts.map +1 -1
  49. package/dist/api/benfen/BenfenSignTransaction.d.ts +2 -8
  50. package/dist/api/benfen/BenfenSignTransaction.d.ts.map +1 -1
  51. package/dist/api/btc/BTCGetAddress.d.ts +1 -11
  52. package/dist/api/btc/BTCGetAddress.d.ts.map +1 -1
  53. package/dist/api/btc/BTCGetPublicKey.d.ts +1 -11
  54. package/dist/api/btc/BTCGetPublicKey.d.ts.map +1 -1
  55. package/dist/api/btc/BTCSignMessage.d.ts +1 -15
  56. package/dist/api/btc/BTCSignMessage.d.ts.map +1 -1
  57. package/dist/api/btc/BTCSignPsbt.d.ts.map +1 -1
  58. package/dist/api/btc/BTCSignTransaction.d.ts +1 -11
  59. package/dist/api/btc/BTCSignTransaction.d.ts.map +1 -1
  60. package/dist/api/btc/BTCVerifyMessage.d.ts +1 -11
  61. package/dist/api/btc/BTCVerifyMessage.d.ts.map +1 -1
  62. package/dist/api/btc/helpers/versionLimit.d.ts +2 -11
  63. package/dist/api/btc/helpers/versionLimit.d.ts.map +1 -1
  64. package/dist/api/cardano/CardanoSignMessage.d.ts.map +1 -1
  65. package/dist/api/cardano/CardanoSignTransaction.d.ts.map +1 -1
  66. package/dist/api/conflux/ConfluxSignMessage.d.ts.map +1 -1
  67. package/dist/api/conflux/ConfluxSignMessageCIP23.d.ts.map +1 -1
  68. package/dist/api/conflux/ConfluxSignTransaction.d.ts.map +1 -1
  69. package/dist/api/cosmos/CosmosSignTransaction.d.ts.map +1 -1
  70. package/dist/api/device/DeviceRebootToBoardloader.d.ts +1 -1
  71. package/dist/api/device/DeviceRebootToBoardloader.d.ts.map +1 -1
  72. package/dist/api/device/DeviceRebootToBootloader.d.ts.map +1 -1
  73. package/dist/api/dynex/DnxGetAddress.d.ts.map +1 -1
  74. package/dist/api/dynex/DnxSignTransaction.d.ts.map +1 -1
  75. package/dist/api/evm/EVMSignMessage.d.ts.map +1 -1
  76. package/dist/api/evm/EVMSignMessageEIP712.d.ts +2 -8
  77. package/dist/api/evm/EVMSignMessageEIP712.d.ts.map +1 -1
  78. package/dist/api/evm/EVMSignTransaction.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/legacyV1/signTypedData.d.ts +1 -1
  83. package/dist/api/evm/legacyV1/signTypedData.d.ts.map +1 -1
  84. package/dist/api/filecoin/FilecoinSignTransaction.d.ts.map +1 -1
  85. package/dist/api/firmware/FirmwareUpdateBaseMethod.d.ts +10 -2
  86. package/dist/api/firmware/FirmwareUpdateBaseMethod.d.ts.map +1 -1
  87. package/dist/api/helpers/deviceInfo.d.ts +15 -0
  88. package/dist/api/helpers/deviceInfo.d.ts.map +1 -0
  89. package/dist/api/helpers/filesystemValidation.d.ts +7 -0
  90. package/dist/api/helpers/filesystemValidation.d.ts.map +1 -0
  91. package/dist/api/index.d.ts +28 -1
  92. package/dist/api/index.d.ts.map +1 -1
  93. package/dist/api/kaspa/KaspaSignTransaction.d.ts.map +1 -1
  94. package/dist/api/near/NearSignTransaction.d.ts.map +1 -1
  95. package/dist/api/nem/NEMSignTransaction.d.ts.map +1 -1
  96. package/dist/api/neo/NeoGetAddress.d.ts +2 -8
  97. package/dist/api/neo/NeoGetAddress.d.ts.map +1 -1
  98. package/dist/api/neo/NeoSignTransaction.d.ts +2 -8
  99. package/dist/api/neo/NeoSignTransaction.d.ts.map +1 -1
  100. package/dist/api/nervos/NervosGetAddress.d.ts +2 -9
  101. package/dist/api/nervos/NervosGetAddress.d.ts.map +1 -1
  102. package/dist/api/nervos/NervosSignTransaction.d.ts +2 -9
  103. package/dist/api/nervos/NervosSignTransaction.d.ts.map +1 -1
  104. package/dist/api/nexa/NexaGetAddress.d.ts +2 -8
  105. package/dist/api/nexa/NexaGetAddress.d.ts.map +1 -1
  106. package/dist/api/nexa/NexaSignTransaction.d.ts +2 -9
  107. package/dist/api/nexa/NexaSignTransaction.d.ts.map +1 -1
  108. package/dist/api/nostr/NostrSignEvent.d.ts.map +1 -1
  109. package/dist/api/nostr/NostrSignSchnorr.d.ts.map +1 -1
  110. package/dist/api/polkadot/PolkadotSignTransaction.d.ts.map +1 -1
  111. package/dist/api/protocol-v2/DeviceFirmwareUpdate.d.ts +7 -0
  112. package/dist/api/protocol-v2/DeviceFirmwareUpdate.d.ts.map +1 -0
  113. package/dist/api/protocol-v2/DeviceGetDeviceInfo.d.ts +7 -0
  114. package/dist/api/protocol-v2/DeviceGetDeviceInfo.d.ts.map +1 -0
  115. package/dist/api/protocol-v2/DeviceGetFirmwareUpdateStatus.d.ts +6 -0
  116. package/dist/api/protocol-v2/DeviceGetFirmwareUpdateStatus.d.ts.map +1 -0
  117. package/dist/api/protocol-v2/DeviceGetOnboardingStatus.d.ts +6 -0
  118. package/dist/api/protocol-v2/DeviceGetOnboardingStatus.d.ts.map +1 -0
  119. package/dist/api/protocol-v2/DeviceReboot.d.ts +7 -0
  120. package/dist/api/protocol-v2/DeviceReboot.d.ts.map +1 -0
  121. package/dist/api/protocol-v2/FactoryDeviceInfoSettings.d.ts +7 -0
  122. package/dist/api/protocol-v2/FactoryDeviceInfoSettings.d.ts.map +1 -0
  123. package/dist/api/protocol-v2/FactoryGetDeviceInfo.d.ts +6 -0
  124. package/dist/api/protocol-v2/FactoryGetDeviceInfo.d.ts.map +1 -0
  125. package/dist/api/protocol-v2/FilesystemDiskControl.d.ts +10 -0
  126. package/dist/api/protocol-v2/FilesystemDiskControl.d.ts.map +1 -0
  127. package/dist/api/protocol-v2/FilesystemFixPermission.d.ts +6 -0
  128. package/dist/api/protocol-v2/FilesystemFixPermission.d.ts.map +1 -0
  129. package/dist/api/protocol-v2/FilesystemFormat.d.ts +6 -0
  130. package/dist/api/protocol-v2/FilesystemFormat.d.ts.map +1 -0
  131. package/dist/api/protocol-v2/GetProtoVersion.d.ts +6 -0
  132. package/dist/api/protocol-v2/GetProtoVersion.d.ts.map +1 -0
  133. package/dist/api/protocol-v2/Ping.d.ts +8 -0
  134. package/dist/api/protocol-v2/Ping.d.ts.map +1 -0
  135. package/dist/api/protocol-v2/helpers.d.ts +49 -0
  136. package/dist/api/protocol-v2/helpers.d.ts.map +1 -0
  137. package/dist/api/scdo/ScdoGetAddress.d.ts +2 -6
  138. package/dist/api/scdo/ScdoGetAddress.d.ts.map +1 -1
  139. package/dist/api/scdo/ScdoSignMessage.d.ts +2 -5
  140. package/dist/api/scdo/ScdoSignMessage.d.ts.map +1 -1
  141. package/dist/api/scdo/ScdoSignTransaction.d.ts +2 -5
  142. package/dist/api/scdo/ScdoSignTransaction.d.ts.map +1 -1
  143. package/dist/api/solana/SolGetAddress.d.ts +1 -0
  144. package/dist/api/solana/SolGetAddress.d.ts.map +1 -1
  145. package/dist/api/solana/SolSignMessage.d.ts +4 -0
  146. package/dist/api/solana/SolSignMessage.d.ts.map +1 -1
  147. package/dist/api/solana/SolSignOffchainMessage.d.ts +4 -0
  148. package/dist/api/solana/SolSignOffchainMessage.d.ts.map +1 -1
  149. package/dist/api/solana/SolSignTransaction.d.ts +8 -0
  150. package/dist/api/solana/SolSignTransaction.d.ts.map +1 -1
  151. package/dist/api/starcoin/StarcoinSignMessage.d.ts.map +1 -1
  152. package/dist/api/starcoin/StarcoinSignTransaction.d.ts.map +1 -1
  153. package/dist/api/stellar/StellarGetAddress.d.ts +2 -1
  154. package/dist/api/stellar/StellarGetAddress.d.ts.map +1 -1
  155. package/dist/api/stellar/StellarSignTransaction.d.ts +2 -1
  156. package/dist/api/stellar/StellarSignTransaction.d.ts.map +1 -1
  157. package/dist/api/sui/SuiSignMessage.d.ts.map +1 -1
  158. package/dist/api/sui/SuiSignTransaction.d.ts +2 -2
  159. package/dist/api/sui/SuiSignTransaction.d.ts.map +1 -1
  160. package/dist/api/ton/TonSignData.d.ts.map +1 -1
  161. package/dist/api/ton/TonSignMessage.d.ts.map +1 -1
  162. package/dist/api/ton/TonSignProof.d.ts.map +1 -1
  163. package/dist/api/tron/TronSignMessage.d.ts +4 -0
  164. package/dist/api/tron/TronSignMessage.d.ts.map +1 -1
  165. package/dist/api/tron/TronSignTransaction.d.ts +4 -0
  166. package/dist/api/tron/TronSignTransaction.d.ts.map +1 -1
  167. package/dist/api/xrp/XrpSignTransaction.d.ts.map +1 -1
  168. package/dist/core/RequestQueue.d.ts +1 -1
  169. package/dist/core/RequestQueue.d.ts.map +1 -1
  170. package/dist/core/index.d.ts.map +1 -1
  171. package/dist/data-manager/DataManager.d.ts +7 -4
  172. package/dist/data-manager/DataManager.d.ts.map +1 -1
  173. package/dist/data-manager/MessagesConfig.d.ts +2 -2
  174. package/dist/data-manager/MessagesConfig.d.ts.map +1 -1
  175. package/dist/data-manager/TransportManager.d.ts +5 -4
  176. package/dist/data-manager/TransportManager.d.ts.map +1 -1
  177. package/dist/device/Device.d.ts +5 -18
  178. package/dist/device/Device.d.ts.map +1 -1
  179. package/dist/device/DeviceCommands.d.ts +8 -8
  180. package/dist/device/DeviceCommands.d.ts.map +1 -1
  181. package/dist/device/DeviceConnector.d.ts +2 -1
  182. package/dist/device/DeviceConnector.d.ts.map +1 -1
  183. package/dist/events/ui-request.d.ts +8 -0
  184. package/dist/events/ui-request.d.ts.map +1 -1
  185. package/dist/index.d.ts +292 -43
  186. package/dist/index.js +16693 -1501
  187. package/dist/inject.d.ts.map +1 -1
  188. package/dist/protocols/protocol-v2/features.d.ts +104 -0
  189. package/dist/protocols/protocol-v2/features.d.ts.map +1 -0
  190. package/dist/protocols/protocol-v2/firmware.d.ts +12 -0
  191. package/dist/protocols/protocol-v2/firmware.d.ts.map +1 -0
  192. package/dist/protocols/protocol-v2/index.d.ts +3 -0
  193. package/dist/protocols/protocol-v2/index.d.ts.map +1 -0
  194. package/dist/types/api/export.d.ts +1 -1
  195. package/dist/types/api/export.d.ts.map +1 -1
  196. package/dist/types/api/firmwareUpdate.d.ts +7 -0
  197. package/dist/types/api/firmwareUpdate.d.ts.map +1 -1
  198. package/dist/types/api/getDeviceInfo.d.ts +84 -0
  199. package/dist/types/api/getDeviceInfo.d.ts.map +1 -0
  200. package/dist/types/api/getPassphraseState.d.ts +10 -1
  201. package/dist/types/api/getPassphraseState.d.ts.map +1 -1
  202. package/dist/types/api/index.d.ts +33 -3
  203. package/dist/types/api/index.d.ts.map +1 -1
  204. package/dist/types/api/protocolV2.d.ts +127 -0
  205. package/dist/types/api/protocolV2.d.ts.map +1 -0
  206. package/dist/types/api/searchDevices.d.ts +2 -2
  207. package/dist/types/api/searchDevices.d.ts.map +1 -1
  208. package/dist/types/device.d.ts +6 -2
  209. package/dist/types/device.d.ts.map +1 -1
  210. package/dist/types/params.d.ts +2 -1
  211. package/dist/types/params.d.ts.map +1 -1
  212. package/dist/types/settings.d.ts +1 -1
  213. package/dist/types/settings.d.ts.map +1 -1
  214. package/dist/utils/deviceFeaturesUtils.d.ts +5 -3
  215. package/dist/utils/deviceFeaturesUtils.d.ts.map +1 -1
  216. package/dist/utils/deviceInfoUtils.d.ts +1 -0
  217. package/dist/utils/deviceInfoUtils.d.ts.map +1 -1
  218. package/dist/utils/index.d.ts +1 -1
  219. package/dist/utils/index.d.ts.map +1 -1
  220. package/dist/utils/patch.d.ts +1 -1
  221. package/dist/utils/patch.d.ts.map +1 -1
  222. package/dist/utils/versionUtils.d.ts +1 -1
  223. package/package.json +4 -4
  224. package/src/api/BaseMethod.ts +7 -82
  225. package/src/api/DirList.ts +29 -0
  226. package/src/api/DirMake.ts +21 -0
  227. package/src/api/DirRemove.ts +21 -0
  228. package/src/api/FileDelete.ts +21 -0
  229. package/src/api/FileRead.ts +165 -0
  230. package/src/api/FileWrite.ts +203 -0
  231. package/src/api/FirmwareUpdateV3.ts +21 -4
  232. package/src/api/FirmwareUpdateV4.ts +810 -0
  233. package/src/api/GetDeviceInfo.ts +161 -0
  234. package/src/api/GetOnekeyFeatures.ts +75 -3
  235. package/src/api/GetPassphraseState.ts +16 -7
  236. package/src/api/PathInfo.ts +25 -0
  237. package/src/api/SearchDevices.ts +7 -2
  238. package/src/api/alephium/AlephiumGetAddress.ts +6 -2
  239. package/src/api/alephium/AlephiumSignMessage.ts +6 -2
  240. package/src/api/alephium/AlephiumSignTransaction.ts +6 -3
  241. package/src/api/algo/AlgoSignTransaction.ts +0 -1
  242. package/src/api/allnetwork/AllNetworkGetAddressBase.ts +18 -9
  243. package/src/api/aptos/AptosSignInMessage.ts +0 -1
  244. package/src/api/aptos/AptosSignMessage.ts +0 -1
  245. package/src/api/aptos/AptosSignTransaction.ts +0 -1
  246. package/src/api/benfen/BenfenGetAddress.ts +6 -2
  247. package/src/api/benfen/BenfenGetPublicKey.ts +6 -2
  248. package/src/api/benfen/BenfenSignMessage.ts +6 -2
  249. package/src/api/benfen/BenfenSignTransaction.ts +6 -2
  250. package/src/api/btc/BTCSignMessage.ts +0 -1
  251. package/src/api/btc/BTCSignPsbt.ts +0 -1
  252. package/src/api/btc/BTCSignTransaction.ts +0 -1
  253. package/src/api/btc/helpers/versionLimit.ts +7 -1
  254. package/src/api/cardano/CardanoSignMessage.ts +0 -1
  255. package/src/api/cardano/CardanoSignTransaction.ts +0 -1
  256. package/src/api/conflux/ConfluxSignMessage.ts +0 -1
  257. package/src/api/conflux/ConfluxSignMessageCIP23.ts +0 -1
  258. package/src/api/conflux/ConfluxSignTransaction.ts +5 -3
  259. package/src/api/cosmos/CosmosSignTransaction.ts +0 -1
  260. package/src/api/device/DeviceRebootToBoardloader.ts +10 -1
  261. package/src/api/device/DeviceRebootToBootloader.ts +10 -1
  262. package/src/api/dynex/DnxGetAddress.ts +7 -0
  263. package/src/api/dynex/DnxSignTransaction.ts +7 -1
  264. package/src/api/evm/EVMGetAddress.ts +1 -1
  265. package/src/api/evm/EVMGetPublicKey.ts +1 -1
  266. package/src/api/evm/EVMSignMessage.ts +1 -3
  267. package/src/api/evm/EVMSignMessageEIP712.ts +14 -2
  268. package/src/api/evm/EVMSignTransaction.ts +1 -3
  269. package/src/api/evm/EVMSignTypedData.ts +6 -8
  270. package/src/api/evm/EVMVerifyMessage.ts +1 -1
  271. package/src/api/filecoin/FilecoinSignTransaction.ts +0 -1
  272. package/src/api/firmware/FirmwareUpdateBaseMethod.ts +27 -4
  273. package/src/api/helpers/deviceInfo.ts +205 -0
  274. package/src/api/helpers/filesystemValidation.ts +51 -0
  275. package/src/api/index.ts +30 -1
  276. package/src/api/kaspa/KaspaSignTransaction.ts +0 -1
  277. package/src/api/near/NearSignTransaction.ts +0 -1
  278. package/src/api/nem/NEMSignTransaction.ts +0 -1
  279. package/src/api/neo/NeoGetAddress.ts +6 -1
  280. package/src/api/neo/NeoSignTransaction.ts +6 -2
  281. package/src/api/nervos/NervosGetAddress.ts +6 -2
  282. package/src/api/nervos/NervosSignTransaction.ts +6 -3
  283. package/src/api/nexa/NexaGetAddress.ts +6 -2
  284. package/src/api/nexa/NexaSignTransaction.ts +6 -4
  285. package/src/api/nostr/NostrSignEvent.ts +0 -1
  286. package/src/api/nostr/NostrSignSchnorr.ts +0 -1
  287. package/src/api/polkadot/PolkadotSignTransaction.ts +0 -1
  288. package/src/api/protocol-v2/DeviceFirmwareUpdate.ts +50 -0
  289. package/src/api/protocol-v2/DeviceGetDeviceInfo.ts +35 -0
  290. package/src/api/protocol-v2/DeviceGetFirmwareUpdateStatus.ts +18 -0
  291. package/src/api/protocol-v2/DeviceGetOnboardingStatus.ts +18 -0
  292. package/src/api/protocol-v2/DeviceReboot.ts +22 -0
  293. package/src/api/protocol-v2/FactoryDeviceInfoSettings.ts +27 -0
  294. package/src/api/protocol-v2/FactoryGetDeviceInfo.ts +18 -0
  295. package/src/api/protocol-v2/FilesystemDiskControl.ts +34 -0
  296. package/src/api/protocol-v2/FilesystemFixPermission.ts +14 -0
  297. package/src/api/protocol-v2/FilesystemFormat.ts +14 -0
  298. package/src/api/protocol-v2/GetProtoVersion.ts +14 -0
  299. package/src/api/protocol-v2/Ping.ts +16 -0
  300. package/src/api/protocol-v2/helpers.ts +161 -0
  301. package/src/api/scdo/ScdoGetAddress.ts +6 -2
  302. package/src/api/scdo/ScdoSignMessage.ts +6 -2
  303. package/src/api/scdo/ScdoSignTransaction.ts +6 -3
  304. package/src/api/solana/SolGetAddress.ts +4 -0
  305. package/src/api/solana/SolSignMessage.ts +4 -1
  306. package/src/api/solana/SolSignOffchainMessage.ts +4 -1
  307. package/src/api/solana/SolSignTransaction.ts +8 -1
  308. package/src/api/starcoin/StarcoinSignMessage.ts +0 -1
  309. package/src/api/starcoin/StarcoinSignTransaction.ts +0 -1
  310. package/src/api/stellar/StellarGetAddress.ts +10 -1
  311. package/src/api/stellar/StellarSignTransaction.ts +14 -2
  312. package/src/api/sui/SuiSignMessage.ts +0 -1
  313. package/src/api/sui/SuiSignTransaction.ts +12 -10
  314. package/src/api/ton/TonSignData.ts +0 -1
  315. package/src/api/ton/TonSignMessage.ts +0 -1
  316. package/src/api/ton/TonSignProof.ts +0 -1
  317. package/src/api/tron/TronSignMessage.ts +5 -2
  318. package/src/api/tron/TronSignTransaction.ts +4 -1
  319. package/src/api/xrp/XrpSignTransaction.ts +1 -2
  320. package/src/core/RequestQueue.ts +3 -10
  321. package/src/core/index.ts +62 -153
  322. package/src/data/messages/messages-protocol-v2.json +13128 -0
  323. package/src/data-manager/DataManager.ts +12 -7
  324. package/src/data-manager/MessagesConfig.ts +14 -14
  325. package/src/data-manager/TransportManager.ts +38 -12
  326. package/src/device/Device.ts +98 -82
  327. package/src/device/DeviceCommands.ts +166 -26
  328. package/src/device/DeviceConnector.ts +29 -4
  329. package/src/device/DevicePool.ts +1 -1
  330. package/src/events/ui-request.ts +8 -0
  331. package/src/inject.ts +46 -2
  332. package/src/protocols/protocol-v2/features.ts +287 -0
  333. package/src/protocols/protocol-v2/firmware.ts +26 -0
  334. package/src/protocols/protocol-v2/index.ts +2 -0
  335. package/src/types/api/export.ts +1 -0
  336. package/src/types/api/firmwareUpdate.ts +12 -0
  337. package/src/types/api/getDeviceInfo.ts +97 -0
  338. package/src/types/api/getPassphraseState.ts +13 -2
  339. package/src/types/api/index.ts +80 -3
  340. package/src/types/api/protocolV2.ts +226 -0
  341. package/src/types/api/searchDevices.ts +2 -2
  342. package/src/types/device.ts +33 -2
  343. package/src/types/params.ts +4 -2
  344. package/src/types/settings.ts +1 -1
  345. package/src/utils/deviceFeaturesUtils.ts +62 -21
  346. package/src/utils/deviceInfoUtils.ts +15 -8
  347. package/src/utils/index.ts +1 -0
  348. package/__tests__/DeviceCommands.test.ts +0 -99
  349. package/__tests__/evmLedgerLegacySafety.test.ts +0 -261
  350. package/__tests__/preInitialize.test.ts +0 -22
  351. package/dist/api/device/PreInitialize.d.ts +0 -6
  352. package/dist/api/device/PreInitialize.d.ts.map +0 -1
  353. package/dist/core/PollingStateManager.d.ts +0 -8
  354. package/dist/core/PollingStateManager.d.ts.map +0 -1
  355. package/dist/types/api/preInitialize.d.ts +0 -3
  356. package/dist/types/api/preInitialize.d.ts.map +0 -1
  357. package/src/api/device/PreInitialize.ts +0 -41
  358. package/src/core/PollingStateManager.ts +0 -47
  359. package/src/types/api/preInitialize.ts +0 -3
@@ -12,7 +12,12 @@ import {
12
12
  } from '../utils/tracing';
13
13
 
14
14
  import type { Device } from './Device';
15
- import type { FailureType, Messages, Transport } from '@onekeyfe/hd-transport';
15
+ import type {
16
+ FailureType,
17
+ Messages,
18
+ Transport,
19
+ TransportCallOptions,
20
+ } from '@onekeyfe/hd-transport';
16
21
 
17
22
  export type PassphrasePromptResponse = {
18
23
  passphrase?: string;
@@ -22,16 +27,119 @@ export type PassphrasePromptResponse = {
22
27
  };
23
28
 
24
29
  type MessageType = Messages.MessageType;
25
- type MessageKey = keyof MessageType;
30
+ type MessageKey = Extract<keyof MessageType, string>;
26
31
  export type TypedResponseMessage<T extends MessageKey> = {
27
32
  type: T;
28
33
  message: MessageType[T];
29
34
  };
30
35
  type TypedCallResponseMap = {
31
- [K in keyof MessageType]: TypedResponseMessage<K>;
36
+ [K in MessageKey]: TypedResponseMessage<K>;
32
37
  };
33
38
  export type DefaultMessageResponse = TypedCallResponseMap[keyof MessageType];
34
39
 
40
+ const MAX_DEBUG_ARRAY_ITEMS = 20;
41
+ const MAX_DEBUG_OBJECT_KEYS = 40;
42
+ const MAX_DEBUG_STRING_LENGTH = 512;
43
+ const MAX_DEBUG_DEPTH = 4;
44
+ const HIGH_VOLUME_DEBUG_CALLS = new Set([
45
+ 'FilesystemFileRead',
46
+ 'FilesystemFileWrite',
47
+ 'FileRead',
48
+ 'FileWrite',
49
+ 'EmmcFileRead',
50
+ 'EmmcFileWrite',
51
+ 'FirmwareUpload',
52
+ 'ResourceAck',
53
+ ]);
54
+
55
+ function shouldReduceDebugForCall(type: string) {
56
+ return HIGH_VOLUME_DEBUG_CALLS.has(type);
57
+ }
58
+
59
+ function getBinaryByteLength(value: unknown): number | undefined {
60
+ if (value instanceof ArrayBuffer) {
61
+ return value.byteLength;
62
+ }
63
+
64
+ if (ArrayBuffer.isView(value)) {
65
+ return value.byteLength;
66
+ }
67
+
68
+ if (typeof Blob !== 'undefined' && value instanceof Blob) {
69
+ return value.size;
70
+ }
71
+
72
+ return undefined;
73
+ }
74
+
75
+ function summarizeRedactedData(value: unknown): string {
76
+ const byteLength = getBinaryByteLength(value);
77
+ if (byteLength !== undefined) {
78
+ return `[redacted data: ${byteLength} bytes]`;
79
+ }
80
+
81
+ if (typeof value === 'string') {
82
+ return `[redacted data: string length=${value.length}]`;
83
+ }
84
+
85
+ if (Array.isArray(value)) {
86
+ return `[redacted data: array length=${value.length}]`;
87
+ }
88
+
89
+ if (value && typeof value === 'object') {
90
+ return `[redacted data: object keys=${Object.keys(value).length}]`;
91
+ }
92
+
93
+ return `[redacted data: ${typeof value}]`;
94
+ }
95
+
96
+ function sanitizeDebugPayload(value: unknown, key = '', depth = 0): unknown {
97
+ if (key === 'data' && value !== null && value !== undefined) {
98
+ return summarizeRedactedData(value);
99
+ }
100
+
101
+ const byteLength = getBinaryByteLength(value);
102
+ if (byteLength !== undefined) {
103
+ return `[binary: ${byteLength} bytes]`;
104
+ }
105
+
106
+ if (typeof value === 'string') {
107
+ return value.length > MAX_DEBUG_STRING_LENGTH
108
+ ? `${value.slice(0, MAX_DEBUG_STRING_LENGTH)}... (len=${value.length})`
109
+ : value;
110
+ }
111
+
112
+ if (!value || typeof value !== 'object') {
113
+ return value;
114
+ }
115
+
116
+ if (depth >= MAX_DEBUG_DEPTH) {
117
+ return Array.isArray(value)
118
+ ? `[array length=${value.length}]`
119
+ : `[object keys=${Object.keys(value).length}]`;
120
+ }
121
+
122
+ if (Array.isArray(value)) {
123
+ const items = value
124
+ .slice(0, MAX_DEBUG_ARRAY_ITEMS)
125
+ .map(item => sanitizeDebugPayload(item, key, depth + 1));
126
+ if (value.length > MAX_DEBUG_ARRAY_ITEMS) {
127
+ items.push(`... (${value.length - MAX_DEBUG_ARRAY_ITEMS} more)`);
128
+ }
129
+ return items;
130
+ }
131
+
132
+ const entries = Object.entries(value).slice(0, MAX_DEBUG_OBJECT_KEYS);
133
+ const sanitized: Record<string, unknown> = {};
134
+ entries.forEach(([entryKey, entryValue]) => {
135
+ sanitized[entryKey] = sanitizeDebugPayload(entryValue, entryKey, depth + 1);
136
+ });
137
+ if (Object.keys(value).length > MAX_DEBUG_OBJECT_KEYS) {
138
+ sanitized.__truncated__ = `${Object.keys(value).length - MAX_DEBUG_OBJECT_KEYS} more keys`;
139
+ }
140
+ return sanitized;
141
+ }
142
+
35
143
  const assertType = (res: DefaultMessageResponse, resType: string | string[]) => {
36
144
  const splitResTypes = Array.isArray(resType) ? resType : resType.split('|');
37
145
  if (!splitResTypes.includes(res.type)) {
@@ -224,17 +332,21 @@ export class DeviceCommands {
224
332
  // Sends an async message to the opened device.
225
333
  async call(
226
334
  type: MessageKey,
227
- msg: DefaultMessageResponse['message'] = {}
335
+ msg?: DefaultMessageResponse['message'],
336
+ options?: TransportCallOptions
228
337
  ): Promise<DefaultMessageResponse> {
229
- Log.debug('[DeviceCommands] [call] Sending', type);
338
+ const shouldReduceDebug = shouldReduceDebugForCall(type);
339
+ if (!shouldReduceDebug) {
340
+ Log.debug('[DeviceCommands] [call] Sending', type);
341
+ }
230
342
 
231
343
  try {
232
- const promise = this.transport.call(this.mainId, type, msg) as any;
344
+ const promise = this.transport.call(this.mainId, type, msg ?? {}, options) as any;
233
345
  this.callPromise = promise;
234
346
  const res = await promise;
235
347
  if (res.type === 'Failure') {
236
348
  LogCore.debug('[DeviceCommands] [call] Received', res.type, res.message);
237
- } else {
349
+ } else if (!shouldReduceDebug) {
238
350
  LogCore.debug('[DeviceCommands] [call] Received', res.type);
239
351
  }
240
352
  return res;
@@ -283,19 +395,22 @@ export class DeviceCommands {
283
395
  typedCall<T extends MessageKey, R extends MessageKey[]>(
284
396
  type: T,
285
397
  resType: R,
286
- msg?: MessageType[T]
398
+ msg?: MessageType[T],
399
+ options?: TransportCallOptions
287
400
  ): Promise<TypedCallResponseMap[R[number]]>;
288
401
 
289
402
  typedCall<T extends MessageKey, R extends MessageKey>(
290
403
  type: T,
291
404
  resType: R,
292
- msg?: MessageType[T]
405
+ msg?: MessageType[T],
406
+ options?: TransportCallOptions
293
407
  ): Promise<TypedResponseMessage<R>>;
294
408
 
295
409
  async typedCall(
296
410
  type: MessageKey,
297
411
  resType: MessageKey | MessageKey[],
298
- msg?: DefaultMessageResponse['message']
412
+ msg?: DefaultMessageResponse['message'],
413
+ options?: TransportCallOptions
299
414
  ) {
300
415
  if (this.disposed) {
301
416
  throw ERRORS.TypedError(
@@ -312,16 +427,28 @@ export class DeviceCommands {
312
427
  'PassphraseAck',
313
428
  'Cancel',
314
429
  'BixinPinInputOnDevice',
430
+ 'FilesystemFileRead',
431
+ 'FilesystemFileWrite',
432
+ 'FileRead',
433
+ 'FileWrite',
434
+ 'EmmcFileRead',
435
+ 'EmmcFileWrite',
436
+ 'FirmwareUpload',
437
+ 'ResourceAck',
315
438
  ] as any;
316
439
  if (!skipTypes.includes(type) && msg) {
317
440
  // Use debug channel to avoid noise escalation
318
- Log.debug('[DeviceCommands] [typedCall] Sending payload', type, msg);
441
+ Log.debug('[DeviceCommands] [typedCall] Sending payload', type, sanitizeDebugPayload(msg));
319
442
  }
320
443
  } catch (e) {
321
444
  // ignore logging errors
322
445
  }
323
446
 
324
- const response = await this._commonCall(type, msg);
447
+ const expectedTypes = Array.isArray(resType) ? resType : resType.split('|');
448
+ const response = await this._commonCall(type, msg, {
449
+ ...options,
450
+ expectedTypes: options?.expectedTypes ?? expectedTypes,
451
+ });
325
452
  try {
326
453
  assertType(response, resType);
327
454
  } catch (error) {
@@ -334,6 +461,12 @@ export class DeviceCommands {
334
461
  // throw bridge network error
335
462
  if (error instanceof HardwareError) {
336
463
  if (error.errorCode === HardwareErrorCode.ResponseUnexpectTypeError) {
464
+ Log.debug('[DeviceCommands] [typedCall] Unexpected response type', {
465
+ request: type,
466
+ expected: resType,
467
+ received: response.type,
468
+ response: sanitizeDebugPayload(response.message),
469
+ });
337
470
  // Do not intercept CallMethodError
338
471
  // Do not intercept “assertType: Response of unexpected type” error
339
472
  // Blocking the above two messages will not know what the specific error message is, and the specific error should be handled by the subsequent business logic.
@@ -347,7 +480,7 @@ export class DeviceCommands {
347
480
  if (error.message.indexOf('BridgeDeviceDisconnected') > -1) {
348
481
  throw ERRORS.TypedError(HardwareErrorCode.BridgeDeviceDisconnected);
349
482
  }
350
- throw ERRORS.TypedError(HardwareErrorCode.ResponseUnexpectTypeError);
483
+ throw error;
351
484
  }
352
485
  } else {
353
486
  // throw error anyway, next call should be resolved properly// throw error anyway, next call should be resolved properly
@@ -357,20 +490,27 @@ export class DeviceCommands {
357
490
  return response;
358
491
  }
359
492
 
360
- async _commonCall(type: MessageKey, msg?: DefaultMessageResponse['message']) {
361
- const resp = await this.call(type, msg);
362
- return this._filterCommonTypes(resp, type);
493
+ async _commonCall(
494
+ type: MessageKey,
495
+ msg?: DefaultMessageResponse['message'],
496
+ options?: TransportCallOptions
497
+ ) {
498
+ const resp = await this.call(type, msg, options);
499
+ return this._filterCommonTypes(resp, type, options);
363
500
  }
364
501
 
365
502
  _filterCommonTypes(
366
503
  res: DefaultMessageResponse,
367
- callType: MessageKey
504
+ callType: MessageKey,
505
+ options?: TransportCallOptions
368
506
  ): Promise<DefaultMessageResponse> {
369
507
  try {
370
- if (DataManager.getSettings('env') === 'react-native') {
371
- Log.debug('_filterCommonTypes: ', JSON.stringify(res));
508
+ if (shouldReduceDebugForCall(callType)) {
509
+ // 高频文件写入每个 chunk 都会经过这里,避免 debug log 反向拖慢传输。
510
+ } else if (DataManager.getSettings('env') === 'react-native') {
511
+ Log.debug('_filterCommonTypes: ', JSON.stringify(sanitizeDebugPayload(res)));
372
512
  } else {
373
- Log.debug('_filterCommonTypes: ', res);
513
+ Log.debug('_filterCommonTypes: ', sanitizeDebugPayload(res));
374
514
  }
375
515
  } catch (error) {
376
516
  // ignore
@@ -472,7 +612,7 @@ export class DeviceCommands {
472
612
  } else {
473
613
  this.device.emit(DEVICE.BUTTON, this.device, res.message);
474
614
  }
475
- return this._commonCall('ButtonAck', {});
615
+ return this._commonCall('ButtonAck', {}, options);
476
616
  }
477
617
 
478
618
  if (res.type === 'EntropyRequest') {
@@ -485,11 +625,11 @@ export class DeviceCommands {
485
625
  if (pin === '@@ONEKEY_INPUT_PIN_IN_DEVICE') {
486
626
  // only classic\1s\mini\pure
487
627
  this.device.setCancelableAction(() => this.cancelDeviceOnOneKeyDevice());
488
- return this._commonCall('BixinPinInputOnDevice').finally(() => {
628
+ return this._commonCall('BixinPinInputOnDevice', {}, options).finally(() => {
489
629
  this.device.clearCancelableAction();
490
630
  });
491
631
  }
492
- return this._commonCall('PinMatrixAck', { pin });
632
+ return this._commonCall('PinMatrixAck', { pin }, options);
493
633
  },
494
634
  error => Promise.reject(error)
495
635
  );
@@ -504,12 +644,12 @@ export class DeviceCommands {
504
644
 
505
645
  // Attach PIN on device
506
646
  if (attachPinOnDevice && existsAttachPinUser) {
507
- return this._commonCall('PassphraseAck', { on_device_attach_pin: true });
647
+ return this._commonCall('PassphraseAck', { on_device_attach_pin: true }, options);
508
648
  }
509
649
 
510
650
  return !passphraseOnDevice
511
- ? this._commonCall('PassphraseAck', { passphrase })
512
- : this._commonCall('PassphraseAck', { on_device: true });
651
+ ? this._commonCall('PassphraseAck', { passphrase }, options)
652
+ : this._commonCall('PassphraseAck', { on_device: true }, options);
513
653
  });
514
654
  }
515
655
 
@@ -1,3 +1,5 @@
1
+ import { ERRORS, HardwareErrorCode } from '@onekeyfe/hd-shared';
2
+
1
3
  import { safeThrowError } from '../constants';
2
4
  import { DataManager } from '../data-manager';
3
5
  import TransportManager from '../data-manager/TransportManager';
@@ -6,6 +8,7 @@ import { resolveAfter } from '../utils/promiseUtils';
6
8
  import { LoggerNames, getLogger } from '../utils';
7
9
 
8
10
  import type { DeviceDescriptorDiff } from './DevicePool';
11
+ import type { HardwareConnectProtocol } from '@onekeyfe/hd-shared';
9
12
  import type { OneKeyDeviceInfo as DeviceDescriptor, Transport } from '@onekeyfe/hd-transport';
10
13
 
11
14
  const Log = getLogger(LoggerNames.DeviceConnector);
@@ -75,15 +78,37 @@ export default class DeviceConnector {
75
78
  this.listening = false;
76
79
  }
77
80
 
78
- async acquire(path: string, session?: string | null, forceCleanRunPromise?: boolean) {
79
- Log.debug('acquire', path, session);
81
+ async acquire(
82
+ path: string,
83
+ session?: string | null,
84
+ forceCleanRunPromise?: boolean,
85
+ connectProtocol?: HardwareConnectProtocol
86
+ ) {
87
+ Log.debug('acquire', path, session, connectProtocol);
80
88
  const env = DataManager.getSettings('env');
81
89
  try {
82
90
  let res;
83
91
  if (DataManager.isBleConnect(env)) {
84
- res = await this.transport.acquire({ uuid: path, forceCleanRunPromise });
92
+ res = await this.transport.acquire({
93
+ uuid: path,
94
+ forceCleanRunPromise,
95
+ expectedProtocol: connectProtocol,
96
+ });
85
97
  } else {
86
- res = await this.transport.acquire({ path, previous: session ?? null });
98
+ res = await this.transport.acquire({
99
+ path,
100
+ previous: session ?? null,
101
+ expectedProtocol: connectProtocol,
102
+ });
103
+ }
104
+ if (connectProtocol) {
105
+ const detectedProtocol = this.transport.getProtocolType(path);
106
+ if (detectedProtocol !== connectProtocol) {
107
+ throw ERRORS.TypedError(
108
+ HardwareErrorCode.RuntimeError,
109
+ `Device protocol mismatch: expected ${connectProtocol}, detected ${detectedProtocol}`
110
+ );
111
+ }
87
112
  }
88
113
  return res;
89
114
  } catch (error) {
@@ -150,7 +150,7 @@ export class DevicePool extends EventEmitter {
150
150
  if (!device) {
151
151
  device = Device.fromDescriptor(descriptor);
152
152
  device.deviceConnector = this.connector;
153
- await device.connect();
153
+ await device.connect(initOptions?.connectProtocol);
154
154
  await device.initialize(initOptions);
155
155
  await device.release();
156
156
  }
@@ -129,6 +129,10 @@ export interface FirmwareProgress {
129
129
  device: Device;
130
130
  progress: number;
131
131
  progressType: IFirmwareUpdateProgressType;
132
+ transferredBytes?: number;
133
+ totalBytes?: number;
134
+ rateBytesPerSecond?: number;
135
+ elapsedMs?: number;
132
136
  };
133
137
  }
134
138
 
@@ -144,6 +148,10 @@ export interface DeviceProgress {
144
148
  type: typeof UI_REQUEST.DEVICE_PROGRESS;
145
149
  payload: {
146
150
  progress?: number;
151
+ transferredBytes?: number;
152
+ totalBytes?: number;
153
+ rateBytesPerSecond?: number;
154
+ elapsedMs?: number;
147
155
  };
148
156
  }
149
157
 
package/src/inject.ts CHANGED
@@ -103,12 +103,13 @@ export const createCoreApi = (
103
103
  /**
104
104
  * 搜索设备
105
105
  */
106
- searchDevices: () => call({ method: 'searchDevices' }),
106
+ searchDevices: params => call({ ...params, method: 'searchDevices' }),
107
107
 
108
108
  /**
109
109
  * 获取设备信息
110
110
  */
111
111
  getFeatures: (connectId, params) => call({ ...params, connectId, method: 'getFeatures' }),
112
+ getDeviceInfo: (connectId, params) => call({ ...params, connectId, method: 'getDeviceInfo' }),
112
113
  getOnekeyFeatures: (connectId, params) =>
113
114
  call({ ...params, connectId, method: 'getOnekeyFeatures' }),
114
115
 
@@ -142,12 +143,53 @@ export const createCoreApi = (
142
143
 
143
144
  testInitializeDeviceDuration: (connectId, params) =>
144
145
  call({ ...params, connectId, method: 'testInitializeDeviceDuration' }),
145
- preInitialize: (connectId, params) => call({ ...params, connectId, method: 'preInitialize' }),
146
+
146
147
  deviceBackup: connectId => call({ connectId, method: 'deviceBackup' }),
147
148
  deviceChangePin: (connectId, params) => call({ ...params, connectId, method: 'deviceChangePin' }),
148
149
  deviceFlags: (connectId, params) => call({ ...params, connectId, method: 'deviceFlags' }),
149
150
  deviceRebootToBoardloader: connectId => call({ connectId, method: 'deviceRebootToBoardloader' }),
150
151
  deviceRebootToBootloader: connectId => call({ connectId, method: 'deviceRebootToBootloader' }),
152
+
153
+ // File system & device control API (Protocol V2 only)
154
+ getProtoVersion: (connectId, params) => call({ ...params, connectId, method: 'getProtoVersion' }),
155
+ ping: (connectId, params) => call({ ...params, connectId, method: 'ping' }),
156
+ deviceReboot: (connectId, params) => call({ ...params, connectId, method: 'deviceReboot' }),
157
+ deviceGetDeviceInfo: (connectId, params) =>
158
+ call({ ...params, connectId, method: 'deviceGetDeviceInfo' }),
159
+ deviceGetOnboardingStatus: (connectId, params) =>
160
+ call({ ...params, connectId, method: 'deviceGetOnboardingStatus' }),
161
+ deviceFirmwareUpdate: (connectId, params) =>
162
+ call({ ...params, connectId, method: 'deviceFirmwareUpdate' }),
163
+ deviceGetFirmwareUpdateStatus: (connectId, params) =>
164
+ call({ ...params, connectId, method: 'deviceGetFirmwareUpdateStatus' }),
165
+ factoryDeviceInfoSettings: (connectId, params) =>
166
+ call({ ...params, connectId, method: 'factoryDeviceInfoSettings' }),
167
+ factoryGetDeviceInfo: connectId => call({ connectId, method: 'factoryGetDeviceInfo' }),
168
+ filesystemFixPermission: connectId => call({ connectId, method: 'filesystemFixPermission' }),
169
+ fileRead: (connectId, params) => call({ ...params, connectId, method: 'fileRead' }),
170
+ fileWrite: (connectId, params) => call({ ...params, connectId, method: 'fileWrite' }),
171
+ fileDelete: (connectId, params) => call({ ...params, connectId, method: 'fileDelete' }),
172
+ dirList: (connectId, params) => call({ ...params, connectId, method: 'dirList' }),
173
+ dirMake: (connectId, params) => call({ ...params, connectId, method: 'dirMake' }),
174
+ dirRemove: (connectId, params) => call({ ...params, connectId, method: 'dirRemove' }),
175
+ pathInfo: (connectId, params) => call({ ...params, connectId, method: 'pathInfo' }),
176
+ filesystemFileRead: (connectId, params) =>
177
+ call({ ...params, connectId, method: 'filesystemFileRead' }),
178
+ filesystemFileWrite: (connectId, params) =>
179
+ call({ ...params, connectId, method: 'filesystemFileWrite' }),
180
+ filesystemFileDelete: (connectId, params) =>
181
+ call({ ...params, connectId, method: 'filesystemFileDelete' }),
182
+ filesystemDirList: (connectId, params) =>
183
+ call({ ...params, connectId, method: 'filesystemDirList' }),
184
+ filesystemDirMake: (connectId, params) =>
185
+ call({ ...params, connectId, method: 'filesystemDirMake' }),
186
+ filesystemDirRemove: (connectId, params) =>
187
+ call({ ...params, connectId, method: 'filesystemDirRemove' }),
188
+ filesystemPathInfoQuery: (connectId, params) =>
189
+ call({ ...params, connectId, method: 'filesystemPathInfoQuery' }),
190
+ filesystemFormat: connectId => call({ connectId, method: 'filesystemFormat' }),
191
+ filesystemDiskControl: (connectId, params) =>
192
+ call({ ...params, connectId, method: 'filesystemDiskControl' }),
151
193
  deviceRecovery: (connectId, params) => call({ ...params, connectId, method: 'deviceRecovery' }),
152
194
  deviceReset: (connectId, params) => call({ ...params, connectId, method: 'deviceReset' }),
153
195
  deviceSettings: (connectId, params) => call({ ...params, connectId, method: 'deviceSettings' }),
@@ -260,6 +302,8 @@ export const createCoreApi = (
260
302
  call({ ...params, connectId, method: 'firmwareUpdateV2' }),
261
303
  firmwareUpdateV3: (connectId, params) =>
262
304
  call({ ...params, connectId, method: 'firmwareUpdateV3' }),
305
+ firmwareUpdateV4: (connectId, params) =>
306
+ call({ ...params, connectId, method: 'firmwareUpdateV4' }),
263
307
  promptWebDeviceAccess: params => call({ ...params, method: 'promptWebDeviceAccess' }),
264
308
 
265
309
  tronGetAddress: (connectId, deviceId, params) =>