@trezor/connect 10.0.0-alpha.1 → 10.0.0-beta.2

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 (432) hide show
  1. package/CHANGELOG.md +159 -63
  2. package/README.md +5 -3
  3. package/lib/exports.d.ts +1 -0
  4. package/lib/exports.js +1 -0
  5. package/lib/impl/core-in-module-native.d.ts +7 -0
  6. package/lib/impl/core-in-module-native.js +11 -0
  7. package/lib/impl/core-in-module-node.d.ts +8 -0
  8. package/lib/impl/core-in-module-node.js +12 -0
  9. package/lib/impl/core-in-module-web.d.ts +9 -0
  10. package/lib/impl/core-in-module-web.js +26 -0
  11. package/lib/index.browser.d.ts +7 -0
  12. package/lib/index.browser.js +10 -0
  13. package/lib/index.d.ts +4 -0
  14. package/lib/index.js +5 -0
  15. package/lib/index.native.d.ts +4 -0
  16. package/lib/index.native.js +5 -0
  17. package/package.json +30 -83
  18. package/libESM/api/applyFlags.d.mts +0 -20
  19. package/libESM/api/applyFlags.mjs +0 -36
  20. package/libESM/api/applySettings.d.mts +0 -20
  21. package/libESM/api/applySettings.mjs +0 -55
  22. package/libESM/api/authenticateDevice.d.mts +0 -9
  23. package/libESM/api/authenticateDevice.mjs +0 -108
  24. package/libESM/api/authorizeCoinjoin.d.mts +0 -11
  25. package/libESM/api/authorizeCoinjoin.mjs +0 -44
  26. package/libESM/api/backupDevice.d.mts +0 -19
  27. package/libESM/api/backupDevice.mjs +0 -36
  28. package/libESM/api/bitcoin/TransactionComposer.d.mts +0 -46
  29. package/libESM/api/bitcoin/TransactionComposer.mjs +0 -139
  30. package/libESM/api/bitcoin/createPendingTx.d.mts +0 -33
  31. package/libESM/api/bitcoin/createPendingTx.mjs +0 -54
  32. package/libESM/api/bitcoin/enhanceSignTx.d.mts +0 -2
  33. package/libESM/api/bitcoin/enhanceSignTx.mjs +0 -23
  34. package/libESM/api/bitcoin/index.d.mts +0 -9
  35. package/libESM/api/bitcoin/index.mjs +0 -9
  36. package/libESM/api/bitcoin/inputs.d.mts +0 -6
  37. package/libESM/api/bitcoin/inputs.mjs +0 -75
  38. package/libESM/api/bitcoin/outputs.d.mts +0 -5
  39. package/libESM/api/bitcoin/outputs.mjs +0 -128
  40. package/libESM/api/bitcoin/refTx.d.mts +0 -17
  41. package/libESM/api/bitcoin/refTx.mjs +0 -252
  42. package/libESM/api/bitcoin/signtx.d.mts +0 -22
  43. package/libESM/api/bitcoin/signtx.mjs +0 -213
  44. package/libESM/api/bitcoin/signtxLegacy.d.mts +0 -3
  45. package/libESM/api/bitcoin/signtxLegacy.mjs +0 -179
  46. package/libESM/api/bitcoin/signtxVerify.d.mts +0 -12
  47. package/libESM/api/bitcoin/signtxVerify.mjs +0 -86
  48. package/libESM/api/bitcoin/transactionBytes.d.mts +0 -3
  49. package/libESM/api/bitcoin/transactionBytes.mjs +0 -65
  50. package/libESM/api/bleUnpair.d.mts +0 -11
  51. package/libESM/api/bleUnpair.mjs +0 -35
  52. package/libESM/api/blockchainDisconnect.d.mts +0 -16
  53. package/libESM/api/blockchainDisconnect.mjs +0 -39
  54. package/libESM/api/blockchainEstimateFee.d.mts +0 -14
  55. package/libESM/api/blockchainEstimateFee.mjs +0 -106
  56. package/libESM/api/blockchainEvmRpcCall.d.mts +0 -17
  57. package/libESM/api/blockchainEvmRpcCall.mjs +0 -61
  58. package/libESM/api/blockchainGetAccountBalanceHistory.d.mts +0 -14
  59. package/libESM/api/blockchainGetAccountBalanceHistory.mjs +0 -64
  60. package/libESM/api/blockchainGetContractInfo.d.mts +0 -14
  61. package/libESM/api/blockchainGetContractInfo.mjs +0 -50
  62. package/libESM/api/blockchainGetCurrentFiatRates.d.mts +0 -18
  63. package/libESM/api/blockchainGetCurrentFiatRates.mjs +0 -53
  64. package/libESM/api/blockchainGetFiatRatesForTimestamps.d.mts +0 -21
  65. package/libESM/api/blockchainGetFiatRatesForTimestamps.mjs +0 -59
  66. package/libESM/api/blockchainGetInfo.d.mts +0 -13
  67. package/libESM/api/blockchainGetInfo.mjs +0 -41
  68. package/libESM/api/blockchainGetTransactions.d.mts +0 -15
  69. package/libESM/api/blockchainGetTransactions.mjs +0 -47
  70. package/libESM/api/blockchainSetCustomBackend.d.mts +0 -13
  71. package/libESM/api/blockchainSetCustomBackend.mjs +0 -41
  72. package/libESM/api/blockchainSubscribe.d.mts +0 -17
  73. package/libESM/api/blockchainSubscribe.mjs +0 -68
  74. package/libESM/api/blockchainSubscribeFiatRates.d.mts +0 -17
  75. package/libESM/api/blockchainSubscribeFiatRates.mjs +0 -47
  76. package/libESM/api/blockchainUnsubscribe.d.mts +0 -17
  77. package/libESM/api/blockchainUnsubscribe.mjs +0 -68
  78. package/libESM/api/blockchainUnsubscribeFiatRates.d.mts +0 -15
  79. package/libESM/api/blockchainUnsubscribeFiatRates.mjs +0 -41
  80. package/libESM/api/blockchainValidateEvmRpcUrl.d.mts +0 -17
  81. package/libESM/api/blockchainValidateEvmRpcUrl.mjs +0 -54
  82. package/libESM/api/cancelCoinjoinAuthorization.d.mts +0 -11
  83. package/libESM/api/cancelCoinjoinAuthorization.mjs +0 -31
  84. package/libESM/api/cardano/api/cardanoComposeTransaction.d.mts +0 -10
  85. package/libESM/api/cardano/api/cardanoComposeTransaction.mjs +0 -79
  86. package/libESM/api/cardano/api/cardanoGetAddress.d.mts +0 -30
  87. package/libESM/api/cardano/api/cardanoGetAddress.mjs +0 -116
  88. package/libESM/api/cardano/api/cardanoGetNativeScriptHash.d.mts +0 -12
  89. package/libESM/api/cardano/api/cardanoGetNativeScriptHash.mjs +0 -66
  90. package/libESM/api/cardano/api/cardanoGetPublicKey.d.mts +0 -20
  91. package/libESM/api/cardano/api/cardanoGetPublicKey.mjs +0 -72
  92. package/libESM/api/cardano/api/cardanoSignMessage.d.mts +0 -27
  93. package/libESM/api/cardano/api/cardanoSignMessage.mjs +0 -96
  94. package/libESM/api/cardano/api/cardanoSignTransaction.d.mts +0 -81
  95. package/libESM/api/cardano/api/cardanoSignTransaction.mjs +0 -298
  96. package/libESM/api/cardano/api/index.d.mts +0 -6
  97. package/libESM/api/cardano/api/index.mjs +0 -6
  98. package/libESM/api/cardano/cardanoAddressParameters.d.mts +0 -6
  99. package/libESM/api/cardano/cardanoAddressParameters.mjs +0 -79
  100. package/libESM/api/cardano/cardanoAuxiliaryData.d.mts +0 -4
  101. package/libESM/api/cardano/cardanoAuxiliaryData.mjs +0 -74
  102. package/libESM/api/cardano/cardanoCertificate.d.mts +0 -13
  103. package/libESM/api/cardano/cardanoCertificate.mjs +0 -142
  104. package/libESM/api/cardano/cardanoInputs.d.mts +0 -25
  105. package/libESM/api/cardano/cardanoInputs.mjs +0 -39
  106. package/libESM/api/cardano/cardanoOutputs.d.mts +0 -40
  107. package/libESM/api/cardano/cardanoOutputs.mjs +0 -70
  108. package/libESM/api/cardano/cardanoTokenBundle.d.mts +0 -12
  109. package/libESM/api/cardano/cardanoTokenBundle.mjs +0 -21
  110. package/libESM/api/cardano/cardanoUtils.d.mts +0 -9
  111. package/libESM/api/cardano/cardanoUtils.mjs +0 -101
  112. package/libESM/api/cardano/cardanoWitnesses.d.mts +0 -4
  113. package/libESM/api/cardano/cardanoWitnesses.mjs +0 -47
  114. package/libESM/api/changeLanguage.d.mts +0 -18
  115. package/libESM/api/changeLanguage.mjs +0 -47
  116. package/libESM/api/changePin.d.mts +0 -11
  117. package/libESM/api/changePin.mjs +0 -25
  118. package/libESM/api/changeWipeCode.d.mts +0 -11
  119. package/libESM/api/changeWipeCode.mjs +0 -27
  120. package/libESM/api/cipherKeyValue.d.mts +0 -15
  121. package/libESM/api/cipherKeyValue.mjs +0 -51
  122. package/libESM/api/common/AbstractMiscGetAddress.d.mts +0 -35
  123. package/libESM/api/common/AbstractMiscGetAddress.mjs +0 -102
  124. package/libESM/api/common/Discovery.d.mts +0 -33
  125. package/libESM/api/common/Discovery.mjs +0 -116
  126. package/libESM/api/common/paramsValidator.d.mts +0 -23
  127. package/libESM/api/common/paramsValidator.mjs +0 -134
  128. package/libESM/api/common/requestExistingAccounts.d.mts +0 -9
  129. package/libESM/api/common/requestExistingAccounts.mjs +0 -20
  130. package/libESM/api/composeTransaction.d.mts +0 -36
  131. package/libESM/api/composeTransaction.mjs +0 -386
  132. package/libESM/api/discoverAccounts.d.mts +0 -38
  133. package/libESM/api/discoverAccounts.mjs +0 -363
  134. package/libESM/api/ethereum/api/ethereumGetAddress.d.mts +0 -28
  135. package/libESM/api/ethereum/api/ethereumGetAddress.mjs +0 -135
  136. package/libESM/api/ethereum/api/ethereumGetPublicKey.d.mts +0 -48
  137. package/libESM/api/ethereum/api/ethereumGetPublicKey.mjs +0 -90
  138. package/libESM/api/ethereum/api/ethereumSignMessage.d.mts +0 -27
  139. package/libESM/api/ethereum/api/ethereumSignMessage.mjs +0 -64
  140. package/libESM/api/ethereum/api/ethereumSignTransaction.d.mts +0 -83
  141. package/libESM/api/ethereum/api/ethereumSignTransaction.mjs +0 -148
  142. package/libESM/api/ethereum/api/ethereumSignTypedData.d.mts +0 -116
  143. package/libESM/api/ethereum/api/ethereumSignTypedData.mjs +0 -202
  144. package/libESM/api/ethereum/api/ethereumVerifyMessage.d.mts +0 -12
  145. package/libESM/api/ethereum/api/ethereumVerifyMessage.mjs +0 -33
  146. package/libESM/api/ethereum/api/index.d.mts +0 -6
  147. package/libESM/api/ethereum/api/index.mjs +0 -6
  148. package/libESM/api/ethereum/ethereumDefinitions.d.mts +0 -46
  149. package/libESM/api/ethereum/ethereumDefinitions.mjs +0 -103
  150. package/libESM/api/ethereum/ethereumSignTx.d.mts +0 -20
  151. package/libESM/api/ethereum/ethereumSignTx.mjs +0 -131
  152. package/libESM/api/ethereum/ethereumSignTypedData.d.mts +0 -32
  153. package/libESM/api/ethereum/ethereumSignTypedData.mjs +0 -169
  154. package/libESM/api/evoluGetDelegatedIdentityKey.d.mts +0 -14
  155. package/libESM/api/evoluGetDelegatedIdentityKey.mjs +0 -26
  156. package/libESM/api/evoluGetNode.d.mts +0 -13
  157. package/libESM/api/evoluGetNode.mjs +0 -27
  158. package/libESM/api/evoluSignRegistrationRequest.d.mts +0 -15
  159. package/libESM/api/evoluSignRegistrationRequest.mjs +0 -31
  160. package/libESM/api/firmware/calculateFirmwareHash.d.mts +0 -13
  161. package/libESM/api/firmware/calculateFirmwareHash.mjs +0 -56
  162. package/libESM/api/firmware/calculateXPubHash.d.mts +0 -10
  163. package/libESM/api/firmware/calculateXPubHash.mjs +0 -14
  164. package/libESM/api/firmware/getBinary.d.mts +0 -10
  165. package/libESM/api/firmware/getBinary.mjs +0 -33
  166. package/libESM/api/firmware/index.d.mts +0 -6
  167. package/libESM/api/firmware/index.mjs +0 -6
  168. package/libESM/api/firmware/modifyFirmware.d.mts +0 -3
  169. package/libESM/api/firmware/modifyFirmware.mjs +0 -13
  170. package/libESM/api/firmware/parseFirmwareHeaders.d.mts +0 -4
  171. package/libESM/api/firmware/parseFirmwareHeaders.mjs +0 -26
  172. package/libESM/api/firmware/uploadFirmware.d.mts +0 -19
  173. package/libESM/api/firmware/uploadFirmware.mjs +0 -99
  174. package/libESM/api/firmware/verifyEntropy.d.mts +0 -18
  175. package/libESM/api/firmware/verifyEntropy.mjs +0 -107
  176. package/libESM/api/getAccountInfo.d.mts +0 -94
  177. package/libESM/api/getAccountInfo.mjs +0 -385
  178. package/libESM/api/getAddress.d.mts +0 -39
  179. package/libESM/api/getAddress.mjs +0 -142
  180. package/libESM/api/getCoinInfo.d.mts +0 -148
  181. package/libESM/api/getCoinInfo.mjs +0 -29
  182. package/libESM/api/getDeviceState.d.mts +0 -8
  183. package/libESM/api/getDeviceState.mjs +0 -16
  184. package/libESM/api/getFeatures.d.mts +0 -70
  185. package/libESM/api/getFeatures.mjs +0 -20
  186. package/libESM/api/getFirmwareHash.d.mts +0 -11
  187. package/libESM/api/getFirmwareHash.mjs +0 -27
  188. package/libESM/api/getNonce.d.mts +0 -10
  189. package/libESM/api/getNonce.mjs +0 -16
  190. package/libESM/api/getOwnershipId.d.mts +0 -15
  191. package/libESM/api/getOwnershipId.mjs +0 -79
  192. package/libESM/api/getOwnershipProof.d.mts +0 -15
  193. package/libESM/api/getOwnershipProof.mjs +0 -86
  194. package/libESM/api/getPublicKey.d.mts +0 -50
  195. package/libESM/api/getPublicKey.mjs +0 -88
  196. package/libESM/api/getSettings.d.mts +0 -8
  197. package/libESM/api/getSettings.mjs +0 -15
  198. package/libESM/api/index.d.mts +0 -59
  199. package/libESM/api/index.mjs +0 -59
  200. package/libESM/api/loadDevice.d.mts +0 -16
  201. package/libESM/api/loadDevice.mjs +0 -44
  202. package/libESM/api/monero/api/index.d.mts +0 -4
  203. package/libESM/api/monero/api/index.mjs +0 -4
  204. package/libESM/api/monero/api/moneroGetAddress.d.mts +0 -30
  205. package/libESM/api/monero/api/moneroGetAddress.mjs +0 -109
  206. package/libESM/api/monero/api/moneroGetWatchKey.d.mts +0 -14
  207. package/libESM/api/monero/api/moneroGetWatchKey.mjs +0 -44
  208. package/libESM/api/monero/api/moneroKeyImageSync.d.mts +0 -17
  209. package/libESM/api/monero/api/moneroKeyImageSync.mjs +0 -127
  210. package/libESM/api/monero/api/moneroSignTransaction.d.mts +0 -17
  211. package/libESM/api/monero/api/moneroSignTransaction.mjs +0 -202
  212. package/libESM/api/pingDevice.d.mts +0 -11
  213. package/libESM/api/pingDevice.mjs +0 -27
  214. package/libESM/api/pushTransaction.d.mts +0 -17
  215. package/libESM/api/pushTransaction.mjs +0 -42
  216. package/libESM/api/recoveryDevice.d.mts +0 -20
  217. package/libESM/api/recoveryDevice.mjs +0 -50
  218. package/libESM/api/requestLogin.d.mts +0 -14
  219. package/libESM/api/requestLogin.mjs +0 -48
  220. package/libESM/api/resetDevice.d.mts +0 -22
  221. package/libESM/api/resetDevice.mjs +0 -131
  222. package/libESM/api/ripple/api/index.d.mts +0 -2
  223. package/libESM/api/ripple/api/index.mjs +0 -2
  224. package/libESM/api/ripple/api/rippleGetAddress.d.mts +0 -15
  225. package/libESM/api/ripple/api/rippleGetAddress.mjs +0 -22
  226. package/libESM/api/ripple/api/rippleSignTransaction.d.mts +0 -13
  227. package/libESM/api/ripple/api/rippleSignTransaction.mjs +0 -52
  228. package/libESM/api/setBrightness.d.mts +0 -12
  229. package/libESM/api/setBrightness.mjs +0 -26
  230. package/libESM/api/setBusy.d.mts +0 -11
  231. package/libESM/api/setBusy.mjs +0 -32
  232. package/libESM/api/showDeviceTutorial.d.mts +0 -11
  233. package/libESM/api/showDeviceTutorial.mjs +0 -21
  234. package/libESM/api/signMessage.d.mts +0 -25
  235. package/libESM/api/signMessage.mjs +0 -71
  236. package/libESM/api/signTransaction.d.mts +0 -197
  237. package/libESM/api/signTransaction.mjs +0 -334
  238. package/libESM/api/solana/api/index.d.mts +0 -4
  239. package/libESM/api/solana/api/index.mjs +0 -4
  240. package/libESM/api/solana/api/solanaComposeTransaction.d.mts +0 -31
  241. package/libESM/api/solana/api/solanaComposeTransaction.mjs +0 -76
  242. package/libESM/api/solana/api/solanaGetAddress.d.mts +0 -15
  243. package/libESM/api/solana/api/solanaGetAddress.mjs +0 -22
  244. package/libESM/api/solana/api/solanaGetPublicKey.d.mts +0 -28
  245. package/libESM/api/solana/api/solanaGetPublicKey.mjs +0 -67
  246. package/libESM/api/solana/api/solanaSignTransaction.d.mts +0 -41
  247. package/libESM/api/solana/api/solanaSignTransaction.mjs +0 -203
  248. package/libESM/api/solana/solanaDefinitions.d.mts +0 -7
  249. package/libESM/api/solana/solanaDefinitions.mjs +0 -33
  250. package/libESM/api/stellar/api/index.d.mts +0 -2
  251. package/libESM/api/stellar/api/index.mjs +0 -2
  252. package/libESM/api/stellar/api/stellarGetAddress.d.mts +0 -15
  253. package/libESM/api/stellar/api/stellarGetAddress.mjs +0 -22
  254. package/libESM/api/stellar/api/stellarSignTransaction.d.mts +0 -26
  255. package/libESM/api/stellar/api/stellarSignTransaction.mjs +0 -66
  256. package/libESM/api/stellar/stellarSignTx.d.mts +0 -7
  257. package/libESM/api/stellar/stellarSignTx.mjs +0 -191
  258. package/libESM/api/telemetryGet.d.mts +0 -14
  259. package/libESM/api/telemetryGet.mjs +0 -24
  260. package/libESM/api/tezos/api/index.d.mts +0 -3
  261. package/libESM/api/tezos/api/index.mjs +0 -3
  262. package/libESM/api/tezos/api/tezosGetAddress.d.mts +0 -15
  263. package/libESM/api/tezos/api/tezosGetAddress.mjs +0 -22
  264. package/libESM/api/tezos/api/tezosGetPublicKey.d.mts +0 -24
  265. package/libESM/api/tezos/api/tezosGetPublicKey.mjs +0 -66
  266. package/libESM/api/tezos/api/tezosSignTransaction.d.mts +0 -14
  267. package/libESM/api/tezos/api/tezosSignTransaction.mjs +0 -30
  268. package/libESM/api/tezos/tezosSignTx.d.mts +0 -71
  269. package/libESM/api/tezos/tezosSignTx.mjs +0 -204
  270. package/libESM/api/thpGetCredentials.d.mts +0 -13
  271. package/libESM/api/thpGetCredentials.mjs +0 -28
  272. package/libESM/api/thpRemoveCredentials.d.mts +0 -15
  273. package/libESM/api/thpRemoveCredentials.mjs +0 -42
  274. package/libESM/api/tron/api/index.d.mts +0 -3
  275. package/libESM/api/tron/api/index.mjs +0 -3
  276. package/libESM/api/tron/api/tronComposeTransaction.d.mts +0 -17
  277. package/libESM/api/tron/api/tronComposeTransaction.mjs +0 -51
  278. package/libESM/api/tron/api/tronGetAddress.d.mts +0 -15
  279. package/libESM/api/tron/api/tronGetAddress.mjs +0 -20
  280. package/libESM/api/tron/api/tronSignTransaction.d.mts +0 -19
  281. package/libESM/api/tron/api/tronSignTransaction.mjs +0 -129
  282. package/libESM/api/tron/tronEncode.d.mts +0 -12
  283. package/libESM/api/tron/tronEncode.mjs +0 -77
  284. package/libESM/api/tron/tronProtobuf.d.mts +0 -5
  285. package/libESM/api/tron/tronProtobuf.mjs +0 -28
  286. package/libESM/api/unlockPath.d.mts +0 -12
  287. package/libESM/api/unlockPath.mjs +0 -31
  288. package/libESM/api/verifyMessage.d.mts +0 -16
  289. package/libESM/api/verifyMessage.mjs +0 -46
  290. package/libESM/api/wipeDevice.d.mts +0 -21
  291. package/libESM/api/wipeDevice.mjs +0 -47
  292. package/libESM/backend/BackendManager.d.mts +0 -24
  293. package/libESM/backend/BackendManager.mjs +0 -137
  294. package/libESM/backend/Blockchain.d.mts +0 -81
  295. package/libESM/backend/Blockchain.mjs +0 -232
  296. package/libESM/backend/BlockchainLink.d.mts +0 -9
  297. package/libESM/backend/BlockchainLink.mjs +0 -13
  298. package/libESM/backend/fees/BitcoinFeeLevels.d.mts +0 -19
  299. package/libESM/backend/fees/BitcoinFeeLevels.mjs +0 -43
  300. package/libESM/backend/fees/EthereumFeeLevels.d.mts +0 -17
  301. package/libESM/backend/fees/EthereumFeeLevels.mjs +0 -52
  302. package/libESM/backend/fees/MiscFeeLevels.d.mts +0 -18
  303. package/libESM/backend/fees/MiscFeeLevels.mjs +0 -25
  304. package/libESM/backend/fees/index.d.mts +0 -5
  305. package/libESM/backend/fees/index.mjs +0 -30
  306. package/libESM/core/AbstractMethod.d.mts +0 -65
  307. package/libESM/core/AbstractMethod.mjs +0 -153
  308. package/libESM/core/index.d.mts +0 -27
  309. package/libESM/core/index.mjs +0 -795
  310. package/libESM/core/method.d.mts +0 -3
  311. package/libESM/core/method.mjs +0 -19
  312. package/libESM/core/method.native.d.mts +0 -2
  313. package/libESM/core/method.native.mjs +0 -29
  314. package/libESM/core/onCallFirmwareUpdate.d.mts +0 -39
  315. package/libESM/core/onCallFirmwareUpdate.mjs +0 -436
  316. package/libESM/data/coinInfo.d.mts +0 -374
  317. package/libESM/data/coinInfo.mjs +0 -183
  318. package/libESM/data/config.d.mts +0 -8
  319. package/libESM/data/config.mjs +0 -265
  320. package/libESM/data/defaultFeeLevels.d.mts +0 -18
  321. package/libESM/data/defaultFeeLevels.mjs +0 -174
  322. package/libESM/data/firmwareInfo.d.mts +0 -41
  323. package/libESM/data/firmwareInfo.mjs +0 -411
  324. package/libESM/data/firmwareReleaseStore.d.mts +0 -10
  325. package/libESM/data/firmwareReleaseStore.mjs +0 -16
  326. package/libESM/data/localFirmwareStore.d.mts +0 -3
  327. package/libESM/data/localFirmwareStore.mjs +0 -8
  328. package/libESM/data/protobufLoader.d.mts +0 -1
  329. package/libESM/data/protobufLoader.mjs +0 -29
  330. package/libESM/data/settingsStore.d.mts +0 -6
  331. package/libESM/data/settingsStore.mjs +0 -21
  332. package/libESM/device/Device.d.mts +0 -237
  333. package/libESM/device/Device.mjs +0 -729
  334. package/libESM/device/DeviceCommands.d.mts +0 -77
  335. package/libESM/device/DeviceCommands.mjs +0 -245
  336. package/libESM/device/DeviceCurrentSession.d.mts +0 -3208
  337. package/libESM/device/DeviceCurrentSession.mjs +0 -240
  338. package/libESM/device/DeviceList.d.mts +0 -68
  339. package/libESM/device/DeviceList.mjs +0 -246
  340. package/libESM/device/TransportList.d.mts +0 -9
  341. package/libESM/device/TransportList.mjs +0 -41
  342. package/libESM/device/TransportManager.d.mts +0 -30
  343. package/libESM/device/TransportManager.mjs +0 -142
  344. package/libESM/device/calculateRevisionForDevice.d.mts +0 -7
  345. package/libESM/device/calculateRevisionForDevice.mjs +0 -19
  346. package/libESM/device/checkFirmwareRevision.d.mts +0 -12
  347. package/libESM/device/checkFirmwareRevision.mjs +0 -75
  348. package/libESM/device/resolveDescriptorForTaproot.d.mts +0 -14
  349. package/libESM/device/resolveDescriptorForTaproot.mjs +0 -25
  350. package/libESM/device/thp/handshake.d.mts +0 -3
  351. package/libESM/device/thp/handshake.mjs +0 -100
  352. package/libESM/device/thp/index.d.mts +0 -5
  353. package/libESM/device/thp/index.mjs +0 -65
  354. package/libESM/device/thp/pairing.d.mts +0 -16
  355. package/libESM/device/thp/pairing.mjs +0 -237
  356. package/libESM/device/thp/session.d.mts +0 -2
  357. package/libESM/device/thp/session.mjs +0 -27
  358. package/libESM/device/thp/thpCall.d.mts +0 -40
  359. package/libESM/device/thp/thpCall.mjs +0 -58
  360. package/libESM/device/validateMessageSize.d.mts +0 -2
  361. package/libESM/device/validateMessageSize.mjs +0 -9
  362. package/libESM/device/workflow/changeLanguage.d.mts +0 -14
  363. package/libESM/device/workflow/changeLanguage.mjs +0 -59
  364. package/libESM/device/workflow/checkFirmwareHash.d.mts +0 -9
  365. package/libESM/device/workflow/checkFirmwareHash.mjs +0 -86
  366. package/libESM/device/workflow/checkFirmwareHashWithRetries.d.mts +0 -8
  367. package/libESM/device/workflow/checkFirmwareHashWithRetries.mjs +0 -36
  368. package/libESM/device/workflow/handshake.d.mts +0 -9
  369. package/libESM/device/workflow/handshake.mjs +0 -55
  370. package/libESM/device/workflow/trezorPushNotification.d.mts +0 -2
  371. package/libESM/device/workflow/trezorPushNotification.mjs +0 -73
  372. package/libESM/device/workflow/validateState.d.mts +0 -2
  373. package/libESM/device/workflow/validateState.mjs +0 -153
  374. package/libESM/events/ui-promise.d.mts +0 -22
  375. package/libESM/events/ui-promise.mjs +0 -1
  376. package/libESM/exports.d.mts +0 -3
  377. package/libESM/exports.mjs +0 -3
  378. package/libESM/impl/core-in-module.d.mts +0 -27
  379. package/libESM/impl/core-in-module.mjs +0 -173
  380. package/libESM/index.browser.d.mts +0 -9
  381. package/libESM/index.browser.mjs +0 -50
  382. package/libESM/index.d.mts +0 -6
  383. package/libESM/index.mjs +0 -32
  384. package/libESM/index.renderer.d.mts +0 -6
  385. package/libESM/index.renderer.mjs +0 -19
  386. package/libESM/tsconfig.libESM.tsbuildinfo +0 -1
  387. package/libESM/types/idevice.d.mts +0 -109
  388. package/libESM/types/idevice.mjs +0 -1
  389. package/libESM/types/typed-call-provider.d.mts +0 -29
  390. package/libESM/types/typed-call-provider.mjs +0 -1
  391. package/libESM/types/workflow.d.mts +0 -16
  392. package/libESM/types/workflow.mjs +0 -1
  393. package/libESM/utils/accountUtils.d.mts +0 -10
  394. package/libESM/utils/accountUtils.mjs +0 -83
  395. package/libESM/utils/addressUtils.d.mts +0 -2
  396. package/libESM/utils/addressUtils.mjs +0 -24
  397. package/libESM/utils/assetUtils.d.mts +0 -13
  398. package/libESM/utils/assetUtils.mjs +0 -56
  399. package/libESM/utils/assets.browser.d.mts +0 -1
  400. package/libESM/utils/assets.browser.mjs +0 -1
  401. package/libESM/utils/assets.d.mts +0 -2
  402. package/libESM/utils/assets.mjs +0 -13
  403. package/libESM/utils/assets.native.d.mts +0 -2
  404. package/libESM/utils/assets.native.mjs +0 -23
  405. package/libESM/utils/assetsTypes.d.mts +0 -5
  406. package/libESM/utils/assetsTypes.mjs +0 -1
  407. package/libESM/utils/buildOutputDescriptor.d.mts +0 -12
  408. package/libESM/utils/buildOutputDescriptor.mjs +0 -67
  409. package/libESM/utils/deviceFeaturesUtils.d.mts +0 -7
  410. package/libESM/utils/deviceFeaturesUtils.mjs +0 -109
  411. package/libESM/utils/ethereumUtils.d.mts +0 -3
  412. package/libESM/utils/ethereumUtils.mjs +0 -7
  413. package/libESM/utils/firmwareReleaseConfigUtils.d.mts +0 -19
  414. package/libESM/utils/firmwareReleaseConfigUtils.mjs +0 -131
  415. package/libESM/utils/firmwareUtils.d.mts +0 -13
  416. package/libESM/utils/firmwareUtils.mjs +0 -54
  417. package/libESM/utils/formatUtils.d.mts +0 -15
  418. package/libESM/utils/formatUtils.mjs +0 -45
  419. package/libESM/utils/hdnodeUtils.d.mts +0 -6
  420. package/libESM/utils/hdnodeUtils.mjs +0 -62
  421. package/libESM/utils/pathUtils.d.mts +0 -17
  422. package/libESM/utils/pathUtils.mjs +0 -141
  423. package/libESM/utils/paymentRequest.d.mts +0 -8
  424. package/libESM/utils/paymentRequest.mjs +0 -25
  425. package/libESM/utils/uiPromiseManager.d.mts +0 -8
  426. package/libESM/utils/uiPromiseManager.mjs +0 -51
  427. package/libESM/workers/workers.browser.d.mts +0 -10
  428. package/libESM/workers/workers.browser.mjs +0 -16
  429. package/libESM/workers/workers.d.mts +0 -10
  430. package/libESM/workers/workers.mjs +0 -8
  431. package/libESM/workers/workers.native.d.mts +0 -7
  432. package/libESM/workers/workers.native.mjs +0 -7
@@ -1,213 +0,0 @@
1
- import { ERRORS } from "@trezor/connect-common/libESM/constants/index.mjs";
2
- const requestPrevTxInfo = ({
3
- typedCall,
4
- txRequest: {
5
- request_type,
6
- details
7
- },
8
- refTxs
9
- }) => {
10
- const {
11
- tx_hash
12
- } = details;
13
- if (!tx_hash) {
14
- throw ERRORS.TypedError('Runtime', 'requestPrevTxInfo: unknown details.tx_hash');
15
- }
16
- const tx = refTxs[tx_hash.toLowerCase()];
17
- if (!tx) {
18
- throw ERRORS.TypedError('Runtime', `requestPrevTxInfo: Requested unknown tx: ${tx_hash}`);
19
- }
20
- if (request_type === 'TXINPUT') {
21
- if (!tx.bin_outputs) throw ERRORS.TypedError('Runtime', `requestPrevTxInfo: Requested unknown TXINPUT: ${tx_hash}`);
22
- return typedCall('TxAckPrevInput', 'TxRequest', {
23
- tx: {
24
- input: tx.inputs[details.request_index]
25
- }
26
- });
27
- }
28
- if (request_type === 'TXOUTPUT') {
29
- if (!tx.bin_outputs) throw ERRORS.TypedError('Runtime', `requestPrevTxInfo: Requested unknown TXOUTPUT: ${tx_hash}`);
30
- return typedCall('TxAckPrevOutput', 'TxRequest', {
31
- tx: {
32
- output: tx.bin_outputs[details.request_index]
33
- }
34
- });
35
- }
36
- if (request_type === 'TXORIGINPUT') {
37
- if (!tx.outputs) throw ERRORS.TypedError('Runtime', `requestPrevTxInfo: Requested unknown TXORIGINPUT: ${tx_hash}`);
38
- return typedCall('TxAckInput', 'TxRequest', {
39
- tx: {
40
- input: tx.inputs[details.request_index]
41
- }
42
- });
43
- }
44
- if (request_type === 'TXORIGOUTPUT') {
45
- if (!tx.outputs) throw ERRORS.TypedError('Runtime', `requestPrevTxInfo: Requested unknown TXORIGOUTPUT: ${tx_hash}`);
46
- return typedCall('TxAckOutput', 'TxRequest', {
47
- tx: {
48
- output: tx.outputs[details.request_index]
49
- }
50
- });
51
- }
52
- if (request_type === 'TXEXTRADATA') {
53
- if (typeof details.extra_data_len !== 'number') {
54
- throw ERRORS.TypedError('Runtime', 'requestPrevTxInfo: Missing extra_data_len');
55
- }
56
- if (typeof details.extra_data_offset !== 'number') {
57
- throw ERRORS.TypedError('Runtime', 'requestPrevTxInfo: Missing extra_data_offset');
58
- }
59
- if (typeof tx.extra_data !== 'string') {
60
- throw ERRORS.TypedError('Runtime', `requestPrevTxInfo: No extra data for transaction ${tx.hash}`);
61
- }
62
- const data = tx.extra_data;
63
- const dataLen = details.extra_data_len;
64
- const dataOffset = details.extra_data_offset;
65
- const extra_data_chunk = data.substring(dataOffset * 2, (dataOffset + dataLen) * 2);
66
- return typedCall('TxAckPrevExtraData', 'TxRequest', {
67
- tx: {
68
- extra_data_chunk
69
- }
70
- });
71
- }
72
- if (request_type === 'TXMETA') {
73
- const data = tx.extra_data;
74
- const meta = {
75
- version: tx.version,
76
- lock_time: tx.lock_time,
77
- inputs_count: tx.inputs.length,
78
- outputs_count: tx.outputs ? tx.outputs.length : tx.bin_outputs.length,
79
- timestamp: tx.timestamp,
80
- version_group_id: tx.version_group_id,
81
- expiry: tx.expiry,
82
- branch_id: tx.branch_id,
83
- extra_data_len: data ? data.length / 2 : undefined
84
- };
85
- return typedCall('TxAckPrevMeta', 'TxRequest', {
86
- tx: meta
87
- });
88
- }
89
- throw ERRORS.TypedError('Runtime', `requestPrevTxInfo: Unknown request type: ${request_type}`);
90
- };
91
- const requestSignedTxInfo = ({
92
- typedCall,
93
- txRequest: {
94
- request_type,
95
- details
96
- },
97
- inputs,
98
- outputs,
99
- paymentRequests
100
- }) => {
101
- if (request_type === 'TXINPUT') {
102
- return typedCall('TxAckInput', 'TxRequest', {
103
- tx: {
104
- input: inputs[details.request_index]
105
- }
106
- });
107
- }
108
- if (request_type === 'TXOUTPUT') {
109
- return typedCall('TxAckOutput', 'TxRequest', {
110
- tx: {
111
- output: outputs[details.request_index]
112
- }
113
- });
114
- }
115
- if (request_type === 'TXPAYMENTREQ') {
116
- const req = paymentRequests[details.request_index];
117
- if (!req) {
118
- throw ERRORS.TypedError('Runtime', `requestPrevTxInfo: Requested unknown payment request at ${details.request_index}`);
119
- }
120
- return typedCall('PaymentRequest', 'TxRequest', {
121
- nonce: req.nonce,
122
- recipient_name: req.recipient_name,
123
- memos: req.memos,
124
- amount: req.amount,
125
- signature: req.signature
126
- });
127
- }
128
- if (request_type === 'TXMETA') {
129
- throw ERRORS.TypedError('Runtime', 'requestSignedTxInfo: Cannot read TXMETA from signed transaction');
130
- }
131
- if (request_type === 'TXEXTRADATA') {
132
- throw ERRORS.TypedError('Runtime', 'requestSignedTxInfo: Cannot read TXEXTRADATA from signed transaction');
133
- }
134
- throw ERRORS.TypedError('Runtime', `requestSignedTxInfo: Unknown request type: ${request_type}`);
135
- };
136
- const requestTxAck = props => {
137
- const {
138
- tx_hash
139
- } = props.txRequest.details;
140
- if (tx_hash) {
141
- return requestPrevTxInfo(props);
142
- }
143
- return requestSignedTxInfo(props);
144
- };
145
- const saveTxSignatures = (txRequest, serializedTx, signatures) => {
146
- const {
147
- signature_index,
148
- signature,
149
- serialized_tx
150
- } = txRequest;
151
- if (serialized_tx) {
152
- serializedTx.push(serialized_tx);
153
- }
154
- if (typeof signature_index === 'number') {
155
- if (!signature) {
156
- throw ERRORS.TypedError('Runtime', 'saveTxSignatures: Unexpected null in trezor:TxRequestSerialized signature.');
157
- }
158
- signatures[signature_index] = signature;
159
- }
160
- };
161
- const processTxRequest = async props => {
162
- const {
163
- txRequest,
164
- serializedTx,
165
- signatures
166
- } = props;
167
- if (txRequest.serialized) saveTxSignatures(txRequest.serialized, serializedTx, signatures);
168
- if (txRequest.request_type === 'TXFINISHED') {
169
- return Promise.resolve({
170
- signatures,
171
- serializedTx: serializedTx.join('')
172
- });
173
- }
174
- const {
175
- message
176
- } = await requestTxAck(props);
177
- return processTxRequest({
178
- ...props,
179
- txRequest: message
180
- });
181
- };
182
- export const signTx = async ({
183
- typedCall,
184
- inputs,
185
- outputs,
186
- paymentRequests,
187
- refTxs,
188
- options,
189
- coinInfo
190
- }) => {
191
- const {
192
- message
193
- } = await typedCall('SignTx', 'TxRequest', {
194
- ...options,
195
- version: options.version === undefined && coinInfo.isBitcoin ? 1 : options.version,
196
- inputs_count: inputs.length,
197
- outputs_count: outputs.length,
198
- coin_name: coinInfo.name
199
- });
200
- return processTxRequest({
201
- typedCall,
202
- txRequest: message,
203
- refTxs: refTxs.reduce((record, tx) => ({
204
- ...record,
205
- [tx.hash.toLowerCase()]: tx
206
- }), {}),
207
- inputs,
208
- outputs,
209
- paymentRequests: paymentRequests || [],
210
- serializedTx: [],
211
- signatures: []
212
- });
213
- };
@@ -1,3 +0,0 @@
1
- import type { SignedTransaction } from '@trezor/connect-common';
2
- import type { SignTxHelperParams } from './signtx';
3
- export declare const signTxLegacy: ({ typedCall, inputs, outputs, refTxs, options, coinInfo, }: SignTxHelperParams) => Promise<SignedTransaction>;
@@ -1,179 +0,0 @@
1
- import { ERRORS } from "@trezor/connect-common/libESM/constants/index.mjs";
2
- const requestPrevTxInfo = ({
3
- txRequest: {
4
- request_type,
5
- details
6
- },
7
- refTxs
8
- }) => {
9
- const {
10
- tx_hash
11
- } = details;
12
- if (!tx_hash) {
13
- throw ERRORS.TypedError('Runtime', 'requestPrevTxInfo: unknown details.tx_hash');
14
- }
15
- const tx = refTxs[tx_hash.toLowerCase()];
16
- if (!tx) {
17
- throw ERRORS.TypedError('Runtime', `requestPrevTxInfo: Requested unknown tx: ${tx_hash}`);
18
- }
19
- if (!tx.bin_outputs) {
20
- throw ERRORS.TypedError('Runtime', `requestPrevTxInfo: bin_outputs not set tx: ${tx_hash}`);
21
- }
22
- if (request_type === 'TXINPUT') {
23
- return {
24
- inputs: [tx.inputs[details.request_index]]
25
- };
26
- }
27
- if (request_type === 'TXOUTPUT') {
28
- return {
29
- bin_outputs: [tx.bin_outputs[details.request_index]]
30
- };
31
- }
32
- if (request_type === 'TXEXTRADATA') {
33
- if (typeof details.extra_data_len !== 'number') {
34
- throw ERRORS.TypedError('Runtime', 'requestPrevTxInfo: Missing extra_data_len');
35
- }
36
- if (typeof details.extra_data_offset !== 'number') {
37
- throw ERRORS.TypedError('Runtime', 'requestPrevTxInfo: Missing extra_data_offset');
38
- }
39
- if (typeof tx.extra_data !== 'string') {
40
- throw ERRORS.TypedError('Runtime', `requestPrevTxInfo: No extra data for transaction ${tx.hash}`);
41
- }
42
- const data = tx.extra_data;
43
- const dataLen = details.extra_data_len;
44
- const dataOffset = details.extra_data_offset;
45
- const extra_data = data.substring(dataOffset * 2, (dataOffset + dataLen) * 2);
46
- return {
47
- extra_data
48
- };
49
- }
50
- if (request_type === 'TXMETA') {
51
- const data = tx.extra_data;
52
- const meta = {
53
- version: tx.version,
54
- lock_time: tx.lock_time,
55
- inputs_cnt: tx.inputs.length,
56
- outputs_cnt: tx.bin_outputs.length,
57
- timestamp: tx.timestamp,
58
- version_group_id: tx.version_group_id,
59
- expiry: tx.expiry,
60
- branch_id: tx.branch_id
61
- };
62
- if (typeof data === 'string' && data.length !== 0) {
63
- return {
64
- ...meta,
65
- extra_data_len: data.length / 2
66
- };
67
- }
68
- return meta;
69
- }
70
- throw ERRORS.TypedError('Runtime', `requestPrevTxInfo: Unknown request type: ${request_type}`);
71
- };
72
- const requestSignedTxInfo = ({
73
- txRequest: {
74
- request_type,
75
- details
76
- },
77
- inputs,
78
- outputs
79
- }) => {
80
- if (request_type === 'TXINPUT') {
81
- return {
82
- inputs: [inputs[details.request_index]]
83
- };
84
- }
85
- if (request_type === 'TXOUTPUT') {
86
- return {
87
- outputs: [outputs[details.request_index]]
88
- };
89
- }
90
- if (request_type === 'TXMETA') {
91
- throw ERRORS.TypedError('Runtime', 'requestSignedTxInfo: Cannot read TXMETA from signed transaction');
92
- }
93
- if (request_type === 'TXEXTRADATA') {
94
- throw ERRORS.TypedError('Runtime', 'requestSignedTxInfo: Cannot read TXEXTRADATA from signed transaction');
95
- }
96
- throw ERRORS.TypedError('Runtime', `requestSignedTxInfo: Unknown request type: ${request_type}`);
97
- };
98
- const requestTxAck = props => {
99
- const {
100
- tx_hash
101
- } = props.txRequest.details;
102
- if (tx_hash) {
103
- return requestPrevTxInfo(props);
104
- }
105
- return requestSignedTxInfo(props);
106
- };
107
- const saveTxSignatures = (txRequest, serializedTx, signatures) => {
108
- if (!txRequest) return;
109
- const {
110
- signature_index,
111
- signature,
112
- serialized_tx
113
- } = txRequest;
114
- if (serialized_tx) {
115
- serializedTx.push(serialized_tx);
116
- }
117
- if (typeof signature_index === 'number') {
118
- if (!signature) {
119
- throw ERRORS.TypedError('Runtime', 'saveTxSignatures: Unexpected null in trezor:TxRequestSerialized signature.');
120
- }
121
- signatures[signature_index] = signature;
122
- }
123
- };
124
- const processTxRequest = async props => {
125
- const {
126
- typedCall,
127
- txRequest,
128
- serializedTx,
129
- signatures
130
- } = props;
131
- if (txRequest.serialized) saveTxSignatures(txRequest.serialized, serializedTx, signatures);
132
- if (txRequest.request_type === 'TXFINISHED') {
133
- return Promise.resolve({
134
- signatures,
135
- serializedTx: serializedTx.join('')
136
- });
137
- }
138
- const txAck = requestTxAck(props);
139
- const {
140
- message
141
- } = await typedCall('TxAck', 'TxRequest', {
142
- tx: txAck
143
- });
144
- return processTxRequest({
145
- ...props,
146
- txRequest: message
147
- });
148
- };
149
- export const signTxLegacy = async ({
150
- typedCall,
151
- inputs,
152
- outputs,
153
- refTxs,
154
- options,
155
- coinInfo
156
- }) => {
157
- const {
158
- message
159
- } = await typedCall('SignTx', 'TxRequest', {
160
- ...options,
161
- version: options.version === undefined && coinInfo.isBitcoin ? 1 : options.version,
162
- inputs_count: inputs.length,
163
- outputs_count: outputs.length,
164
- coin_name: coinInfo.name
165
- });
166
- return processTxRequest({
167
- typedCall,
168
- txRequest: message,
169
- refTxs: refTxs.reduce((record, tx) => ({
170
- ...record,
171
- [tx.hash.toLowerCase()]: tx
172
- }), {}),
173
- inputs,
174
- outputs,
175
- paymentRequests: [],
176
- serializedTx: [],
177
- signatures: []
178
- });
179
- };
@@ -1,12 +0,0 @@
1
- import type { Network, PROTO } from '@trezor/connect-common';
2
- import { Transaction as BitcoinJsTransaction } from '@trezor/utxo-lib';
3
- import type { DeviceCommands } from '../../device/DeviceCommands';
4
- type GetHDNode = (address_n: number[]) => ReturnType<ReturnType<typeof DeviceCommands>['getHDNode']>;
5
- export declare const deriveOutputScript: (getHDNode: GetHDNode, output: PROTO.TxOutputType, network: Network) => Promise<Buffer<ArrayBufferLike> | undefined>;
6
- export declare const verifyTx: (serializedTx: string, params: {
7
- inputs: PROTO.TxInputType[];
8
- outputs: PROTO.TxOutputType[];
9
- outputScripts: Awaited<ReturnType<typeof deriveOutputScript>>[];
10
- network: Network;
11
- }) => BitcoinJsTransaction;
12
- export {};
@@ -1,86 +0,0 @@
1
- import { ERRORS } from "@trezor/connect-common/libESM/constants/index.mjs";
2
- import { address as BitcoinJsAddress, payments as BitcoinJsPayments, Transaction as BitcoinJsTransaction, bip32 } from "@trezor/utxo-lib";
3
- const derivePubKeyHash = async (getHDNode, address_n, network) => {
4
- if (address_n.length === 5) {
5
- const response = await getHDNode(address_n.slice(0, 4));
6
- const node = bip32.fromBase58(response.xpub, network);
7
- return node.derive(address_n[address_n.length - 1]);
8
- }
9
- const response = await getHDNode(address_n);
10
- return bip32.fromBase58(response.xpub, network);
11
- };
12
- export const deriveOutputScript = async (getHDNode, output, network) => {
13
- if ('multisig' in output) return;
14
- if ('op_return_data' in output) {
15
- return BitcoinJsPayments.embed({
16
- data: [Buffer.from(output.op_return_data, 'hex')]
17
- }).output;
18
- }
19
- if (output.address) {
20
- return BitcoinJsAddress.toOutputScript(output.address, network);
21
- }
22
- if (!output.address_n) {
23
- throw ERRORS.TypedError('Runtime', 'deriveOutputScript: Neither address or address_n is set');
24
- }
25
- const node = await derivePubKeyHash(getHDNode, output.address_n, network);
26
- const payment = {
27
- hash: node.identifier,
28
- network
29
- };
30
- if (output.script_type === 'PAYTOADDRESS') {
31
- return BitcoinJsPayments.p2pkh(payment).output;
32
- }
33
- if (output.script_type === 'PAYTOSCRIPTHASH') {
34
- return BitcoinJsPayments.p2sh(payment).output;
35
- }
36
- if (output.script_type === 'PAYTOP2SHWITNESS') {
37
- return BitcoinJsPayments.p2sh({
38
- redeem: BitcoinJsPayments.p2wpkh(payment)
39
- }).output;
40
- }
41
- if (output.script_type === 'PAYTOWITNESS') {
42
- return BitcoinJsPayments.p2wpkh(payment).output;
43
- }
44
- if (output.script_type === 'PAYTOTAPROOT') {
45
- return BitcoinJsPayments.p2tr({
46
- pubkey: node.publicKey,
47
- network
48
- }).output;
49
- }
50
- if (output.script_type === 'PAYTOMULTISIG') {
51
- throw ERRORS.TypedError('Runtime', `deriveOutputScript: script_type PAYTOMULTISIG not expected without multisig defined`);
52
- }
53
- throw ERRORS.TypedError('Runtime', `deriveOutputScript: Unknown script type ${output.script_type}`);
54
- };
55
- export const verifyTx = (serializedTx, params) => {
56
- const {
57
- inputs,
58
- outputs,
59
- outputScripts,
60
- network
61
- } = params;
62
- const bitcoinTx = BitcoinJsTransaction.fromHex(serializedTx, {
63
- network
64
- });
65
- if (inputs.length !== bitcoinTx.ins.length) {
66
- throw ERRORS.TypedError('Runtime', 'verifyTx: Signed transaction inputs invalid length');
67
- }
68
- if (outputs.length !== bitcoinTx.outs.length) {
69
- throw ERRORS.TypedError('Runtime', 'verifyTx: Signed transaction outputs invalid length');
70
- }
71
- outputs.forEach((output, i) => {
72
- if (output.amount) {
73
- if (output.amount.toString() !== bitcoinTx.outs[i].value) {
74
- throw ERRORS.TypedError('Runtime', `verifyTx: Wrong output amount at output ${i}. Requested: ${output.amount}, signed: ${bitcoinTx.outs[i].value}`);
75
- }
76
- }
77
- });
78
- for (let i = 0; i < outputs.length; i++) {
79
- const scriptB = bitcoinTx.outs[i].script;
80
- const scriptA = outputScripts[i];
81
- if (scriptA && scriptA.compare(scriptB) !== 0) {
82
- throw ERRORS.TypedError('Runtime', `verifyTx: Output ${i} scripts differ`);
83
- }
84
- }
85
- return bitcoinTx;
86
- };
@@ -1,3 +0,0 @@
1
- import type { BitcoinNetworkInfo, PROTO } from '@trezor/connect-common';
2
- export declare function mapOutputScriptToKey(script_type: string): "p2tr" | "p2wpkh" | "p2sh" | "p2pkh" | undefined;
3
- export declare const getTransactionVbytes: (inputs: PROTO.TxInputType[], outputs: PROTO.TxOutputType[], coinInfo: BitcoinNetworkInfo) => number | undefined;
@@ -1,65 +0,0 @@
1
- import { TxWeightCalculator, address as baddress } from "@trezor/utxo-lib";
2
- import { getOutputScriptType, getScriptType } from "../../utils/pathUtils.mjs";
3
- export function mapOutputScriptToKey(script_type) {
4
- switch (script_type) {
5
- case 'PAYTOADDRESS':
6
- return 'p2pkh';
7
- case 'PAYTOSCRIPTHASH':
8
- return 'p2sh';
9
- case 'PAYTOWITNESS':
10
- return 'p2wpkh';
11
- case 'PAYTOP2SHWITNESS':
12
- return 'p2sh';
13
- case 'PAYTOTAPROOT':
14
- return 'p2tr';
15
- default:
16
- return undefined;
17
- }
18
- }
19
- export const getTransactionVbytes = (inputs, outputs, coinInfo) => {
20
- const calc = new TxWeightCalculator();
21
- let cannotProcess = false;
22
- inputs.forEach(input => {
23
- const script_type = input.script_type ?? getScriptType(input.address_n);
24
- if (script_type && !input.witness) {
25
- calc.addInput({
26
- script_type,
27
- multisig: input.multisig,
28
- ownership_proof: input.ownership_proof
29
- });
30
- } else {
31
- cannotProcess = true;
32
- }
33
- });
34
- outputs.forEach(out => {
35
- if (out.script_type === 'PAYTOOPRETURN') {
36
- if (!out.op_return_data) {
37
- cannotProcess = true;
38
- return;
39
- }
40
- calc.addOutput({
41
- length: 2 + out.op_return_data.length / 2
42
- });
43
- return;
44
- } else if (out.address) {
45
- calc.addOutput({
46
- length: baddress.toOutputScript(out.address, coinInfo.network).length
47
- });
48
- return;
49
- } else if (out.address_n || out.script_type) {
50
- const script_type = out.script_type ?? getOutputScriptType(out.address_n);
51
- if (script_type) {
52
- const script_key = mapOutputScriptToKey(script_type);
53
- if (script_key) {
54
- calc.addOutputByKey(script_key);
55
- return;
56
- }
57
- }
58
- }
59
- cannotProcess = true;
60
- });
61
- if (cannotProcess) {
62
- return undefined;
63
- }
64
- return calc.getVirtualBytes();
65
- };
@@ -1,11 +0,0 @@
1
- import { type MethodPermission } from '@trezor/connect-common';
2
- import { MessagesSchema as PROTO } from '@trezor/protobuf';
3
- import type { MethodMessage } from '../core/AbstractMethod';
4
- import { AbstractMethod } from '../core/AbstractMethod';
5
- export default class BleUnpair extends AbstractMethod<'bleUnpair', PROTO.BleUnpair> {
6
- constructor(message: MethodMessage<'bleUnpair'>);
7
- get requiredPermissions(): MethodPermission[];
8
- run(): Promise<{
9
- message: string;
10
- }>;
11
- }
@@ -1,35 +0,0 @@
1
- import { UI_REQUEST } from "@trezor/connect-common";
2
- import { ERRORS } from "@trezor/connect-common/libESM/constants/index.mjs";
3
- import { MessagesSchema as PROTO } from "@trezor/protobuf";
4
- import { Assert } from "@trezor/schema-utils";
5
- import { TRANSPORT_ERROR } from "@trezor/transport";
6
- import { AbstractMethod } from "../core/AbstractMethod.mjs";
7
- export default class BleUnpair extends AbstractMethod {
8
- constructor(message) {
9
- const {
10
- payload
11
- } = message;
12
- Assert(PROTO.BleUnpair, payload);
13
- const params = {
14
- all: payload.all
15
- };
16
- super(message, params);
17
- this.allowDeviceMode = [UI_REQUEST.INITIALIZE, UI_REQUEST.SEEDLESS];
18
- this.useDeviceState = false;
19
- }
20
- get requiredPermissions() {
21
- return ['management'];
22
- }
23
- async run() {
24
- const cmd = this.getDevice().getCommands();
25
- try {
26
- const response = await cmd.typedCall('BleUnpair', 'Success', this.params);
27
- return response.message;
28
- } catch (error) {
29
- if (this.getDevice().descriptor.apiType === 'bluetooth' && error.message === TRANSPORT_ERROR.INTERFACE_DATA_TRANSFER) {
30
- throw ERRORS.TypedError('Device_Disconnected');
31
- }
32
- throw error;
33
- }
34
- }
35
- }
@@ -1,16 +0,0 @@
1
- import type { CoinInfo, MethodPermission } from '@trezor/connect-common';
2
- import type { MethodMessage } from '../core/AbstractMethod';
3
- import { AbstractMethod } from '../core/AbstractMethod';
4
- type Params = {
5
- coinInfo: CoinInfo;
6
- identity?: string;
7
- };
8
- export default class BlockchainDisconnect extends AbstractMethod<'blockchainDisconnect', Params> {
9
- constructor(message: MethodMessage<'blockchainDisconnect'>);
10
- get requiredPermissions(): MethodPermission[];
11
- get info(): string;
12
- run(): Promise<{
13
- disconnected: boolean;
14
- }>;
15
- }
16
- export {};
@@ -1,39 +0,0 @@
1
- import { CoinObj } from "@trezor/connect-common";
2
- import { ERRORS } from "@trezor/connect-common/libESM/constants/index.mjs";
3
- import { Assert } from "@trezor/schema-utils";
4
- import { findBackend, isBackendSupported } from "../backend/BlockchainLink.mjs";
5
- import { AbstractMethod } from "../core/AbstractMethod.mjs";
6
- import { getCoinInfo } from "../data/coinInfo.mjs";
7
- export default class BlockchainDisconnect extends AbstractMethod {
8
- constructor(message) {
9
- const {
10
- payload
11
- } = message;
12
- Assert(CoinObj, payload);
13
- const coinInfo = getCoinInfo(payload.coin);
14
- if (!coinInfo) {
15
- throw ERRORS.TypedError('Method_UnknownCoin');
16
- }
17
- isBackendSupported(coinInfo);
18
- const params = {
19
- coinInfo,
20
- identity: payload.identity
21
- };
22
- super(message, params);
23
- this.useDevice = false;
24
- this.useUi = false;
25
- }
26
- get requiredPermissions() {
27
- return [];
28
- }
29
- get info() {
30
- return '';
31
- }
32
- run() {
33
- const backend = findBackend(this.params.coinInfo.shortcut, this.params.identity);
34
- backend?.disconnect();
35
- return Promise.resolve({
36
- disconnected: true
37
- });
38
- }
39
- }
@@ -1,14 +0,0 @@
1
- import type { CoinInfo, MethodPermission } from '@trezor/connect-common';
2
- import type { MethodContext, MethodMessage, MethodReturnType, Payload } from '../core/AbstractMethod';
3
- import { AbstractMethod } from '../core/AbstractMethod';
4
- type Params = {
5
- coinInfo: CoinInfo;
6
- identity?: string;
7
- request: Payload<'blockchainEstimateFee'>['request'];
8
- };
9
- export default class BlockchainEstimateFee extends AbstractMethod<'blockchainEstimateFee', Params> {
10
- constructor(message: MethodMessage<'blockchainEstimateFee'>);
11
- get requiredPermissions(): MethodPermission[];
12
- run({ sendCoreMessage }: MethodContext): Promise<MethodReturnType<"blockchainEstimateFee">>;
13
- }
14
- export {};