@trezor/connect 9.0.0-beta.1

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 (495) hide show
  1. package/LICENSE.md +50 -0
  2. package/README.md +38 -0
  3. package/lib/api/applyFlags.d.ts +8 -0
  4. package/lib/api/applyFlags.js +37 -0
  5. package/lib/api/applySettings.d.ts +8 -0
  6. package/lib/api/applySettings.js +57 -0
  7. package/lib/api/authorizeCoinJoin.d.ts +7 -0
  8. package/lib/api/authorizeCoinJoin.js +45 -0
  9. package/lib/api/backupDevice.d.ts +7 -0
  10. package/lib/api/backupDevice.js +31 -0
  11. package/lib/api/binance/binanceSignTx.d.ts +6 -0
  12. package/lib/api/binance/binanceSignTx.js +91 -0
  13. package/lib/api/binanceGetAddress.d.ts +22 -0
  14. package/lib/api/binanceGetAddress.js +126 -0
  15. package/lib/api/binanceGetPublicKey.d.ts +10 -0
  16. package/lib/api/binanceGetPublicKey.js +72 -0
  17. package/lib/api/binanceSignTransaction.d.ts +12 -0
  18. package/lib/api/binanceSignTransaction.js +31 -0
  19. package/lib/api/bitcoin/Fees.d.ts +15 -0
  20. package/lib/api/bitcoin/Fees.js +175 -0
  21. package/lib/api/bitcoin/TransactionComposer.d.ts +36 -0
  22. package/lib/api/bitcoin/TransactionComposer.js +150 -0
  23. package/lib/api/bitcoin/__fixtures__/inputs.d.ts +112 -0
  24. package/lib/api/bitcoin/__fixtures__/inputs.js +102 -0
  25. package/lib/api/bitcoin/__fixtures__/signtxVerify.d.ts +147 -0
  26. package/lib/api/bitcoin/__fixtures__/signtxVerify.js +216 -0
  27. package/lib/api/bitcoin/enhanceSignTx.d.ts +4 -0
  28. package/lib/api/bitcoin/enhanceSignTx.js +63 -0
  29. package/lib/api/bitcoin/index.d.ts +10 -0
  30. package/lib/api/bitcoin/index.js +13 -0
  31. package/lib/api/bitcoin/inputs.d.ts +8 -0
  32. package/lib/api/bitcoin/inputs.js +60 -0
  33. package/lib/api/bitcoin/outputs.d.ts +8 -0
  34. package/lib/api/bitcoin/outputs.js +115 -0
  35. package/lib/api/bitcoin/refTx.d.ts +11 -0
  36. package/lib/api/bitcoin/refTx.js +220 -0
  37. package/lib/api/bitcoin/signtx.d.ts +25 -0
  38. package/lib/api/bitcoin/signtx.js +164 -0
  39. package/lib/api/bitcoin/signtxLegacy.d.ts +4 -0
  40. package/lib/api/bitcoin/signtxLegacy.js +136 -0
  41. package/lib/api/bitcoin/signtxVerify.d.ts +8 -0
  42. package/lib/api/bitcoin/signtxVerify.js +130 -0
  43. package/lib/api/blockchainDisconnect.d.ts +13 -0
  44. package/lib/api/blockchainDisconnect.js +34 -0
  45. package/lib/api/blockchainEstimateFee.d.ts +12 -0
  46. package/lib/api/blockchainEstimateFee.js +70 -0
  47. package/lib/api/blockchainGetAccountBalanceHistory.d.ts +12 -0
  48. package/lib/api/blockchainGetAccountBalanceHistory.js +41 -0
  49. package/lib/api/blockchainGetCurrentFiatRates.d.ts +15 -0
  50. package/lib/api/blockchainGetCurrentFiatRates.js +33 -0
  51. package/lib/api/blockchainGetFiatRatesForTimestamps.d.ts +17 -0
  52. package/lib/api/blockchainGetFiatRatesForTimestamps.js +33 -0
  53. package/lib/api/blockchainGetTransactions.d.ts +12 -0
  54. package/lib/api/blockchainGetTransactions.js +33 -0
  55. package/lib/api/blockchainSetCustomBackend.d.ts +11 -0
  56. package/lib/api/blockchainSetCustomBackend.js +38 -0
  57. package/lib/api/blockchainSubscribe.d.ts +14 -0
  58. package/lib/api/blockchainSubscribe.js +38 -0
  59. package/lib/api/blockchainSubscribeFiatRates.d.ts +14 -0
  60. package/lib/api/blockchainSubscribeFiatRates.js +33 -0
  61. package/lib/api/blockchainUnsubscribe.d.ts +14 -0
  62. package/lib/api/blockchainUnsubscribe.js +38 -0
  63. package/lib/api/blockchainUnsubscribeFiatRates.d.ts +13 -0
  64. package/lib/api/blockchainUnsubscribeFiatRates.js +29 -0
  65. package/lib/api/cardano/cardanoAddressParameters.d.ts +8 -0
  66. package/lib/api/cardano/cardanoAddressParameters.js +100 -0
  67. package/lib/api/cardano/cardanoAuxiliaryData.d.ts +6 -0
  68. package/lib/api/cardano/cardanoAuxiliaryData.js +51 -0
  69. package/lib/api/cardano/cardanoCertificate.d.ts +14 -0
  70. package/lib/api/cardano/cardanoCertificate.js +149 -0
  71. package/lib/api/cardano/cardanoInputs.d.ts +13 -0
  72. package/lib/api/cardano/cardanoInputs.js +34 -0
  73. package/lib/api/cardano/cardanoOutputs.d.ts +8 -0
  74. package/lib/api/cardano/cardanoOutputs.js +38 -0
  75. package/lib/api/cardano/cardanoTokenBundle.d.ts +8 -0
  76. package/lib/api/cardano/cardanoTokenBundle.js +36 -0
  77. package/lib/api/cardano/cardanoWitnesses.d.ts +5 -0
  78. package/lib/api/cardano/cardanoWitnesses.js +48 -0
  79. package/lib/api/cardanoGetAddress.d.ts +23 -0
  80. package/lib/api/cardanoGetAddress.js +158 -0
  81. package/lib/api/cardanoGetNativeScriptHash.d.ts +12 -0
  82. package/lib/api/cardanoGetNativeScriptHash.js +79 -0
  83. package/lib/api/cardanoGetPublicKey.d.ts +10 -0
  84. package/lib/api/cardanoGetPublicKey.js +78 -0
  85. package/lib/api/cardanoSignTransaction.d.ts +48 -0
  86. package/lib/api/cardanoSignTransaction.js +283 -0
  87. package/lib/api/changePin.d.ts +7 -0
  88. package/lib/api/changePin.js +22 -0
  89. package/lib/api/cipherKeyValue.d.ts +8 -0
  90. package/lib/api/cipherKeyValue.js +56 -0
  91. package/lib/api/common/Discovery.d.ts +35 -0
  92. package/lib/api/common/Discovery.js +113 -0
  93. package/lib/api/common/__fixtures__/paramsValidator.d.ts +596 -0
  94. package/lib/api/common/__fixtures__/paramsValidator.js +355 -0
  95. package/lib/api/common/paramsValidator.d.ts +14 -0
  96. package/lib/api/common/paramsValidator.js +140 -0
  97. package/lib/api/composeTransaction.d.ts +33 -0
  98. package/lib/api/composeTransaction.js +270 -0
  99. package/lib/api/customMessage.d.ts +13 -0
  100. package/lib/api/customMessage.js +56 -0
  101. package/lib/api/eos/eosSignTx.d.ts +17 -0
  102. package/lib/api/eos/eosSignTx.js +347 -0
  103. package/lib/api/eosGetPublicKey.d.ts +10 -0
  104. package/lib/api/eosGetPublicKey.js +73 -0
  105. package/lib/api/eosSignTransaction.d.ts +16 -0
  106. package/lib/api/eosSignTransaction.js +36 -0
  107. package/lib/api/ethereum/__fixtures__/ethereumSignTypedData.d.ts +225 -0
  108. package/lib/api/ethereum/__fixtures__/ethereumSignTypedData.js +341 -0
  109. package/lib/api/ethereum/ethereumSignTx.d.ts +13 -0
  110. package/lib/api/ethereum/ethereumSignTx.js +92 -0
  111. package/lib/api/ethereum/ethereumSignTypedData.d.ts +9 -0
  112. package/lib/api/ethereum/ethereumSignTypedData.js +120 -0
  113. package/lib/api/ethereumGetAddress.d.ts +28 -0
  114. package/lib/api/ethereumGetAddress.js +133 -0
  115. package/lib/api/ethereumGetPublicKey.d.ts +15 -0
  116. package/lib/api/ethereumGetPublicKey.js +79 -0
  117. package/lib/api/ethereumSignMessage.d.ts +7 -0
  118. package/lib/api/ethereumSignMessage.js +41 -0
  119. package/lib/api/ethereumSignTransaction.d.ts +20 -0
  120. package/lib/api/ethereumSignTransaction.js +82 -0
  121. package/lib/api/ethereumSignTypedData.d.ts +14 -0
  122. package/lib/api/ethereumSignTypedData.js +151 -0
  123. package/lib/api/ethereumVerifyMessage.d.ts +7 -0
  124. package/lib/api/ethereumVerifyMessage.js +34 -0
  125. package/lib/api/firmware/getBinary.d.ts +20 -0
  126. package/lib/api/firmware/getBinary.js +37 -0
  127. package/lib/api/firmware/modifyFirmware.d.ts +6 -0
  128. package/lib/api/firmware/modifyFirmware.js +18 -0
  129. package/lib/api/firmwareUpdate.d.ts +15 -0
  130. package/lib/api/firmwareUpdate.js +89 -0
  131. package/lib/api/getAccountInfo.d.ts +98 -0
  132. package/lib/api/getAccountInfo.js +326 -0
  133. package/lib/api/getAddress.d.ts +28 -0
  134. package/lib/api/getAddress.js +152 -0
  135. package/lib/api/getCoinInfo.d.ts +11 -0
  136. package/lib/api/getCoinInfo.js +27 -0
  137. package/lib/api/getDeviceState.d.ts +8 -0
  138. package/lib/api/getDeviceState.js +15 -0
  139. package/lib/api/getFeatures.d.ts +6 -0
  140. package/lib/api/getFeatures.js +18 -0
  141. package/lib/api/getOwnershipId.d.ts +10 -0
  142. package/lib/api/getOwnershipId.js +75 -0
  143. package/lib/api/getOwnershipProof.d.ts +14 -0
  144. package/lib/api/getOwnershipProof.js +86 -0
  145. package/lib/api/getPublicKey.d.ts +15 -0
  146. package/lib/api/getPublicKey.js +84 -0
  147. package/lib/api/getSettings.d.ts +6 -0
  148. package/lib/api/getSettings.js +16 -0
  149. package/lib/api/index.d.ts +64 -0
  150. package/lib/api/index.js +134 -0
  151. package/lib/api/management/uploadFirmware.d.ts +6 -0
  152. package/lib/api/management/uploadFirmware.js +49 -0
  153. package/lib/api/nem/nemSignTx.d.ts +4 -0
  154. package/lib/api/nem/nemSignTx.js +139 -0
  155. package/lib/api/nemGetAddress.d.ts +22 -0
  156. package/lib/api/nemGetAddress.js +144 -0
  157. package/lib/api/nemSignTransaction.d.ts +7 -0
  158. package/lib/api/nemSignTransaction.js +29 -0
  159. package/lib/api/pushTransaction.d.ts +14 -0
  160. package/lib/api/pushTransaction.js +40 -0
  161. package/lib/api/rebootToBootloader.d.ts +8 -0
  162. package/lib/api/rebootToBootloader.js +43 -0
  163. package/lib/api/recoveryDevice.d.ts +8 -0
  164. package/lib/api/recoveryDevice.js +57 -0
  165. package/lib/api/requestLogin.d.ts +12 -0
  166. package/lib/api/requestLogin.js +63 -0
  167. package/lib/api/resetDevice.d.ts +9 -0
  168. package/lib/api/resetDevice.js +59 -0
  169. package/lib/api/rippleGetAddress.d.ts +22 -0
  170. package/lib/api/rippleGetAddress.js +126 -0
  171. package/lib/api/rippleSignTransaction.d.ts +10 -0
  172. package/lib/api/rippleSignTransaction.js +54 -0
  173. package/lib/api/setProxy.d.ts +8 -0
  174. package/lib/api/setProxy.js +26 -0
  175. package/lib/api/signMessage.d.ts +7 -0
  176. package/lib/api/signMessage.js +51 -0
  177. package/lib/api/signTransaction.d.ts +21 -0
  178. package/lib/api/signTransaction.js +146 -0
  179. package/lib/api/stellar/stellarSignTx.d.ts +5 -0
  180. package/lib/api/stellar/stellarSignTx.js +198 -0
  181. package/lib/api/stellarGetAddress.d.ts +22 -0
  182. package/lib/api/stellarGetAddress.js +126 -0
  183. package/lib/api/stellarSignTransaction.d.ts +23 -0
  184. package/lib/api/stellarSignTransaction.js +62 -0
  185. package/lib/api/tezos/tezosSignTx.d.ts +4 -0
  186. package/lib/api/tezos/tezosSignTx.js +237 -0
  187. package/lib/api/tezosGetAddress.d.ts +22 -0
  188. package/lib/api/tezosGetAddress.js +126 -0
  189. package/lib/api/tezosGetPublicKey.d.ts +10 -0
  190. package/lib/api/tezosGetPublicKey.js +72 -0
  191. package/lib/api/tezosSignTransaction.d.ts +7 -0
  192. package/lib/api/tezosSignTransaction.js +30 -0
  193. package/lib/api/verifyMessage.d.ts +7 -0
  194. package/lib/api/verifyMessage.js +47 -0
  195. package/lib/api/wipeDevice.d.ts +8 -0
  196. package/lib/api/wipeDevice.js +41 -0
  197. package/lib/backend/BlockchainLink.d.ts +75 -0
  198. package/lib/backend/BlockchainLink.js +298 -0
  199. package/lib/constants/cardano.d.ts +9 -0
  200. package/lib/constants/cardano.js +14 -0
  201. package/lib/constants/errors.d.ts +49 -0
  202. package/lib/constants/errors.js +62 -0
  203. package/lib/constants/index.d.ts +6 -0
  204. package/lib/constants/index.js +10 -0
  205. package/lib/constants/nem.d.ts +22 -0
  206. package/lib/constants/nem.js +28 -0
  207. package/lib/constants/network.d.ts +13 -0
  208. package/lib/constants/network.js +15 -0
  209. package/lib/core/AbstractMethod.d.ts +59 -0
  210. package/lib/core/AbstractMethod.js +159 -0
  211. package/lib/core/index.d.ts +16 -0
  212. package/lib/core/index.js +671 -0
  213. package/lib/core/method.d.ts +6 -0
  214. package/lib/core/method.js +19 -0
  215. package/lib/data/DataManager.d.ts +31 -0
  216. package/lib/data/DataManager.js +98 -0
  217. package/lib/data/coinInfo.d.ts +37 -0
  218. package/lib/data/coinInfo.js +278 -0
  219. package/lib/data/config.d.ts +98 -0
  220. package/lib/data/config.js +201 -0
  221. package/lib/data/connectSettings.d.ts +6 -0
  222. package/lib/data/connectSettings.js +150 -0
  223. package/lib/data/firmwareInfo.d.ts +11 -0
  224. package/lib/data/firmwareInfo.js +148 -0
  225. package/lib/data/transportInfo.d.ts +4 -0
  226. package/lib/data/transportInfo.js +29 -0
  227. package/lib/data/udevInfo.d.ts +3 -0
  228. package/lib/data/udevInfo.js +21 -0
  229. package/lib/data/version.d.ts +3 -0
  230. package/lib/data/version.js +7 -0
  231. package/lib/device/AbortController.d.ts +21 -0
  232. package/lib/device/AbortController.js +40 -0
  233. package/lib/device/DescriptorStream.d.ts +28 -0
  234. package/lib/device/DescriptorStream.js +139 -0
  235. package/lib/device/Device.d.ts +105 -0
  236. package/lib/device/Device.js +527 -0
  237. package/lib/device/DeviceCommands.d.ts +63 -0
  238. package/lib/device/DeviceCommands.js +465 -0
  239. package/lib/device/DeviceList.d.ts +76 -0
  240. package/lib/device/DeviceList.js +411 -0
  241. package/lib/events/blockchain.d.ts +56 -0
  242. package/lib/events/blockchain.js +18 -0
  243. package/lib/events/call.d.ts +41 -0
  244. package/lib/events/call.js +14 -0
  245. package/lib/events/core.d.ts +20 -0
  246. package/lib/events/core.js +28 -0
  247. package/lib/events/device.d.ts +40 -0
  248. package/lib/events/device.js +28 -0
  249. package/lib/events/iframe.d.ts +39 -0
  250. package/lib/events/iframe.js +18 -0
  251. package/lib/events/index.d.ts +62 -0
  252. package/lib/events/index.js +21 -0
  253. package/lib/events/popup.d.ts +51 -0
  254. package/lib/events/popup.js +22 -0
  255. package/lib/events/transport.d.ts +62 -0
  256. package/lib/events/transport.js +21 -0
  257. package/lib/events/ui-promise.d.ts +12 -0
  258. package/lib/events/ui-promise.js +3 -0
  259. package/lib/events/ui-request.d.ts +180 -0
  260. package/lib/events/ui-request.js +50 -0
  261. package/lib/events/ui-response.d.ts +97 -0
  262. package/lib/events/ui-response.js +25 -0
  263. package/lib/exports.d.ts +5 -0
  264. package/lib/exports.js +10 -0
  265. package/lib/factory.d.ts +20 -0
  266. package/lib/factory.js +122 -0
  267. package/lib/index-browser.d.ts +4 -0
  268. package/lib/index-browser.js +29 -0
  269. package/lib/index.d.ts +11 -0
  270. package/lib/index.js +236 -0
  271. package/lib/types/account.d.ts +37 -0
  272. package/lib/types/account.js +3 -0
  273. package/lib/types/api/applyFlags.d.ts +4 -0
  274. package/lib/types/api/applyFlags.js +3 -0
  275. package/lib/types/api/applySettings.d.ts +4 -0
  276. package/lib/types/api/applySettings.js +3 -0
  277. package/lib/types/api/authorizeCoinJoin.d.ts +14 -0
  278. package/lib/types/api/authorizeCoinJoin.js +3 -0
  279. package/lib/types/api/backupDevice.d.ts +4 -0
  280. package/lib/types/api/backupDevice.js +3 -0
  281. package/lib/types/api/binanceGetAddress.d.ts +4 -0
  282. package/lib/types/api/binanceGetAddress.js +3 -0
  283. package/lib/types/api/binanceGetPublicKey.d.ts +4 -0
  284. package/lib/types/api/binanceGetPublicKey.js +3 -0
  285. package/lib/types/api/binanceSignTransaction.d.ts +31 -0
  286. package/lib/types/api/binanceSignTransaction.js +3 -0
  287. package/lib/types/api/blockchainDisconnect.d.ts +5 -0
  288. package/lib/types/api/blockchainDisconnect.js +3 -0
  289. package/lib/types/api/blockchainEstimateFee.d.ts +29 -0
  290. package/lib/types/api/blockchainEstimateFee.js +3 -0
  291. package/lib/types/api/blockchainGetAccountBalanceHistory.d.ts +4 -0
  292. package/lib/types/api/blockchainGetAccountBalanceHistory.js +3 -0
  293. package/lib/types/api/blockchainGetCurrentFiatRates.d.ts +4 -0
  294. package/lib/types/api/blockchainGetCurrentFiatRates.js +3 -0
  295. package/lib/types/api/blockchainGetFiatRatesForTimestamps.d.ts +4 -0
  296. package/lib/types/api/blockchainGetFiatRatesForTimestamps.js +3 -0
  297. package/lib/types/api/blockchainGetTransactions.d.ts +7 -0
  298. package/lib/types/api/blockchainGetTransactions.js +3 -0
  299. package/lib/types/api/blockchainSetCustomBackend.d.ts +7 -0
  300. package/lib/types/api/blockchainSetCustomBackend.js +3 -0
  301. package/lib/types/api/blockchainSubscribe.d.ts +7 -0
  302. package/lib/types/api/blockchainSubscribe.js +3 -0
  303. package/lib/types/api/blockchainSubscribeFiatRates.d.ts +7 -0
  304. package/lib/types/api/blockchainSubscribeFiatRates.js +3 -0
  305. package/lib/types/api/blockchainUnsubscribe.d.ts +5 -0
  306. package/lib/types/api/blockchainUnsubscribe.js +3 -0
  307. package/lib/types/api/blockchainUnsubscribeFiatRates.d.ts +5 -0
  308. package/lib/types/api/blockchainUnsubscribeFiatRates.js +3 -0
  309. package/lib/types/api/cancel.d.ts +2 -0
  310. package/lib/types/api/cancel.js +3 -0
  311. package/lib/types/api/cardanoGetAddress.d.ts +35 -0
  312. package/lib/types/api/cardanoGetAddress.js +3 -0
  313. package/lib/types/api/cardanoGetNativeScriptHash.d.ts +21 -0
  314. package/lib/types/api/cardanoGetNativeScriptHash.js +3 -0
  315. package/lib/types/api/cardanoGetPublicKey.d.ts +16 -0
  316. package/lib/types/api/cardanoGetPublicKey.js +3 -0
  317. package/lib/types/api/cardanoSignTransaction.d.ts +130 -0
  318. package/lib/types/api/cardanoSignTransaction.js +3 -0
  319. package/lib/types/api/changePin.d.ts +4 -0
  320. package/lib/types/api/changePin.js +3 -0
  321. package/lib/types/api/cipherKeyValue.d.ts +17 -0
  322. package/lib/types/api/cipherKeyValue.js +3 -0
  323. package/lib/types/api/composeTransaction.d.ts +92 -0
  324. package/lib/types/api/composeTransaction.js +3 -0
  325. package/lib/types/api/customMessage.d.ts +12 -0
  326. package/lib/types/api/customMessage.js +3 -0
  327. package/lib/types/api/disableWebUSB.d.ts +2 -0
  328. package/lib/types/api/disableWebUSB.js +3 -0
  329. package/lib/types/api/dispose.d.ts +2 -0
  330. package/lib/types/api/dispose.js +3 -0
  331. package/lib/types/api/eosGetPublicKey.d.ts +14 -0
  332. package/lib/types/api/eosGetPublicKey.js +3 -0
  333. package/lib/types/api/eosSignTransaction.d.ts +111 -0
  334. package/lib/types/api/eosSignTransaction.js +3 -0
  335. package/lib/types/api/ethereumGetAddress.d.ts +4 -0
  336. package/lib/types/api/ethereumGetAddress.js +3 -0
  337. package/lib/types/api/ethereumGetPublicKey.d.ts +5 -0
  338. package/lib/types/api/ethereumGetPublicKey.js +3 -0
  339. package/lib/types/api/ethereumSignMessage.d.ts +9 -0
  340. package/lib/types/api/ethereumSignMessage.js +3 -0
  341. package/lib/types/api/ethereumSignTransaction.d.ts +40 -0
  342. package/lib/types/api/ethereumSignTransaction.js +3 -0
  343. package/lib/types/api/ethereumSignTypedData.d.ts +42 -0
  344. package/lib/types/api/ethereumSignTypedData.js +3 -0
  345. package/lib/types/api/ethereumVerifyMessage.d.ts +10 -0
  346. package/lib/types/api/ethereumVerifyMessage.js +3 -0
  347. package/lib/types/api/firmwareUpdate.d.ts +14 -0
  348. package/lib/types/api/firmwareUpdate.js +3 -0
  349. package/lib/types/api/getAccountInfo.d.ts +14 -0
  350. package/lib/types/api/getAccountInfo.js +3 -0
  351. package/lib/types/api/getAddress.d.ts +13 -0
  352. package/lib/types/api/getAddress.js +3 -0
  353. package/lib/types/api/getCoinInfo.d.ts +4 -0
  354. package/lib/types/api/getCoinInfo.js +3 -0
  355. package/lib/types/api/getDeviceState.d.ts +6 -0
  356. package/lib/types/api/getDeviceState.js +3 -0
  357. package/lib/types/api/getFeatures.d.ts +4 -0
  358. package/lib/types/api/getFeatures.js +3 -0
  359. package/lib/types/api/getOwnershipId.d.ts +15 -0
  360. package/lib/types/api/getOwnershipId.js +3 -0
  361. package/lib/types/api/getOwnershipProof.d.ts +19 -0
  362. package/lib/types/api/getOwnershipProof.js +3 -0
  363. package/lib/types/api/getPublicKey.d.ts +19 -0
  364. package/lib/types/api/getPublicKey.js +3 -0
  365. package/lib/types/api/getSettings.d.ts +4 -0
  366. package/lib/types/api/getSettings.js +3 -0
  367. package/lib/types/api/index.d.ts +149 -0
  368. package/lib/types/api/index.js +3 -0
  369. package/lib/types/api/init.d.ts +5 -0
  370. package/lib/types/api/init.js +3 -0
  371. package/lib/types/api/manifest.d.ts +3 -0
  372. package/lib/types/api/manifest.js +3 -0
  373. package/lib/types/api/nemGetAddress.d.ts +7 -0
  374. package/lib/types/api/nemGetAddress.js +3 -0
  375. package/lib/types/api/nemSignTransaction.d.ts +92 -0
  376. package/lib/types/api/nemSignTransaction.js +3 -0
  377. package/lib/types/api/off.d.ts +11 -0
  378. package/lib/types/api/off.js +3 -0
  379. package/lib/types/api/on.d.ts +14 -0
  380. package/lib/types/api/on.js +3 -0
  381. package/lib/types/api/pushTransaction.d.ts +10 -0
  382. package/lib/types/api/pushTransaction.js +3 -0
  383. package/lib/types/api/rebootToBootloader.d.ts +4 -0
  384. package/lib/types/api/rebootToBootloader.js +3 -0
  385. package/lib/types/api/recoveryDevice.d.ts +7 -0
  386. package/lib/types/api/recoveryDevice.js +3 -0
  387. package/lib/types/api/removeAllListeners.d.ts +3 -0
  388. package/lib/types/api/removeAllListeners.js +3 -0
  389. package/lib/types/api/renderWebUSBButton.d.ts +2 -0
  390. package/lib/types/api/renderWebUSBButton.js +3 -0
  391. package/lib/types/api/requestLogin.d.ts +20 -0
  392. package/lib/types/api/requestLogin.js +3 -0
  393. package/lib/types/api/resetDevice.d.ts +16 -0
  394. package/lib/types/api/resetDevice.js +3 -0
  395. package/lib/types/api/rippleGetAddress.d.ts +4 -0
  396. package/lib/types/api/rippleGetAddress.js +3 -0
  397. package/lib/types/api/rippleSignTransaction.d.ts +23 -0
  398. package/lib/types/api/rippleSignTransaction.js +3 -0
  399. package/lib/types/api/setProxy.d.ts +9 -0
  400. package/lib/types/api/setProxy.js +3 -0
  401. package/lib/types/api/signMessage.d.ts +11 -0
  402. package/lib/types/api/signMessage.js +3 -0
  403. package/lib/types/api/signTransaction.d.ts +70 -0
  404. package/lib/types/api/signTransaction.js +3 -0
  405. package/lib/types/api/stellarGetAddress.d.ts +4 -0
  406. package/lib/types/api/stellarGetAddress.js +3 -0
  407. package/lib/types/api/stellarSignTransaction.d.ts +182 -0
  408. package/lib/types/api/stellarSignTransaction.js +3 -0
  409. package/lib/types/api/tezosGetAddress.d.ts +4 -0
  410. package/lib/types/api/tezosGetAddress.js +3 -0
  411. package/lib/types/api/tezosGetPublicKey.d.ts +4 -0
  412. package/lib/types/api/tezosGetPublicKey.js +3 -0
  413. package/lib/types/api/tezosSignTransaction.d.ts +61 -0
  414. package/lib/types/api/tezosSignTransaction.js +3 -0
  415. package/lib/types/api/uiResponse.d.ts +3 -0
  416. package/lib/types/api/uiResponse.js +3 -0
  417. package/lib/types/api/verifyMessage.d.ts +11 -0
  418. package/lib/types/api/verifyMessage.js +3 -0
  419. package/lib/types/api/wipeDevice.d.ts +4 -0
  420. package/lib/types/api/wipeDevice.js +3 -0
  421. package/lib/types/coinInfo.d.ts +79 -0
  422. package/lib/types/coinInfo.js +3 -0
  423. package/lib/types/device.d.ts +92 -0
  424. package/lib/types/device.js +3 -0
  425. package/lib/types/firmware.d.ts +36 -0
  426. package/lib/types/firmware.js +3 -0
  427. package/lib/types/index.d.ts +15 -0
  428. package/lib/types/index.js +11 -0
  429. package/lib/types/params.d.ts +56 -0
  430. package/lib/types/params.js +3 -0
  431. package/lib/types/settings.d.ts +34 -0
  432. package/lib/types/settings.js +3 -0
  433. package/lib/types/utils.d.ts +15 -0
  434. package/lib/types/utils.js +3 -0
  435. package/lib/utils/__fixtures__/accountUtils.d.ts +4 -0
  436. package/lib/utils/__fixtures__/accountUtils.js +32 -0
  437. package/lib/utils/__fixtures__/addressUtils.d.ts +10 -0
  438. package/lib/utils/__fixtures__/addressUtils.js +214 -0
  439. package/lib/utils/__fixtures__/ethereumUtils.d.ts +3 -0
  440. package/lib/utils/__fixtures__/ethereumUtils.js +20 -0
  441. package/lib/utils/__fixtures__/formatUtils.d.ts +3 -0
  442. package/lib/utils/__fixtures__/formatUtils.js +15 -0
  443. package/lib/utils/__fixtures__/hdnodeUtils.d.ts +186 -0
  444. package/lib/utils/__fixtures__/hdnodeUtils.js +206 -0
  445. package/lib/utils/accountUtils.d.ts +11 -0
  446. package/lib/utils/accountUtils.js +99 -0
  447. package/lib/utils/addressUtils.d.ts +3 -0
  448. package/lib/utils/addressUtils.js +32 -0
  449. package/lib/utils/assets-browser.d.ts +2 -0
  450. package/lib/utils/assets-browser.js +21 -0
  451. package/lib/utils/assets.d.ts +2 -0
  452. package/lib/utils/assets.js +28 -0
  453. package/lib/utils/bip39.d.ts +3 -0
  454. package/lib/utils/bip39.js +2053 -0
  455. package/lib/utils/browserUtils.d.ts +21 -0
  456. package/lib/utils/browserUtils.js +100 -0
  457. package/lib/utils/bufferUtils.d.ts +3 -0
  458. package/lib/utils/bufferUtils.js +11 -0
  459. package/lib/utils/debug.d.ts +24 -0
  460. package/lib/utils/debug.js +90 -0
  461. package/lib/utils/deferred.d.ts +18 -0
  462. package/lib/utils/deferred.js +66 -0
  463. package/lib/utils/deviceFeaturesUtils.d.ts +6 -0
  464. package/lib/utils/deviceFeaturesUtils.js +115 -0
  465. package/lib/utils/ethereumUtils.d.ts +3 -0
  466. package/lib/utils/ethereumUtils.js +12 -0
  467. package/lib/utils/firmwareUtils.d.ts +7 -0
  468. package/lib/utils/firmwareUtils.js +28 -0
  469. package/lib/utils/formatUtils.d.ts +8 -0
  470. package/lib/utils/formatUtils.js +57 -0
  471. package/lib/utils/hdnodeUtils.d.ts +8 -0
  472. package/lib/utils/hdnodeUtils.js +80 -0
  473. package/lib/utils/interactionTimeout.d.ts +10 -0
  474. package/lib/utils/interactionTimeout.js +34 -0
  475. package/lib/utils/objectUtils.d.ts +10 -0
  476. package/lib/utils/objectUtils.js +37 -0
  477. package/lib/utils/pathUtils.d.ts +20 -0
  478. package/lib/utils/pathUtils.js +159 -0
  479. package/lib/utils/promiseUtils.d.ts +2 -0
  480. package/lib/utils/promiseUtils.js +8 -0
  481. package/lib/utils/urlUtils.d.ts +5 -0
  482. package/lib/utils/urlUtils.js +27 -0
  483. package/lib/utils/versionUtils.d.ts +6 -0
  484. package/lib/utils/versionUtils.js +72 -0
  485. package/lib/utils/windowsUtils.d.ts +2 -0
  486. package/lib/utils/windowsUtils.js +6 -0
  487. package/lib/workers/RNUsbPlugin.d.ts +31 -0
  488. package/lib/workers/RNUsbPlugin.js +65 -0
  489. package/lib/workers/workers-browser.d.ts +8 -0
  490. package/lib/workers/workers-browser.js +19 -0
  491. package/lib/workers/workers-react-native.d.ts +8 -0
  492. package/lib/workers/workers-react-native.js +19 -0
  493. package/lib/workers/workers.d.ts +10 -0
  494. package/lib/workers/workers.js +17 -0
  495. package/package.json +62 -0
@@ -0,0 +1,75 @@
1
+ import BlockchainLink, { ServerInfo, SubscriptionAccountInfo, BlockchainLinkParams, BlockchainLinkResponse } from '@trezor/blockchain-link';
2
+ import { ERRORS } from '../constants';
3
+ import type { CoinInfo, Proxy } from '../types';
4
+ import type { CoreMessage } from '../events';
5
+ declare type Options = {
6
+ coinInfo: CoinInfo;
7
+ postMessage: (message: CoreMessage) => void;
8
+ proxy?: Proxy;
9
+ onionDomains?: {
10
+ [domain: string]: string;
11
+ };
12
+ debug?: boolean;
13
+ };
14
+ export declare class Blockchain {
15
+ link: BlockchainLink;
16
+ serverInfo?: ServerInfo;
17
+ coinInfo: Options['coinInfo'];
18
+ onionDomains: {
19
+ [onion: string]: string;
20
+ };
21
+ postMessage: Options['postMessage'];
22
+ feeForBlock: BlockchainLinkResponse<'estimateFee'>;
23
+ feeTimestamp: number;
24
+ constructor(options: Options);
25
+ onError(error: ERRORS.TrezorError): void;
26
+ init(): Promise<void>;
27
+ getTransactions(txs: string[]): Promise<import("@trezor/blockchain-link").TypedRawTransaction[]>;
28
+ getCurrentFiatRates(params: {
29
+ currencies?: string[];
30
+ }): Promise<{
31
+ ts: number;
32
+ rates: import("@trezor/blockchain-link").FiatRates;
33
+ }>;
34
+ getFiatRatesForTimestamps(params: {
35
+ timestamps: number[];
36
+ }): Promise<{
37
+ tickers: {
38
+ ts: number;
39
+ rates: import("@trezor/blockchain-link").FiatRates;
40
+ }[];
41
+ }>;
42
+ getAccountBalanceHistory(params: BlockchainLinkParams<'getAccountBalanceHistory'>): Promise<import("@trezor/blockchain-link").AccountBalanceHistory[]>;
43
+ getNetworkInfo(): Promise<ServerInfo>;
44
+ getAccountInfo(request: BlockchainLinkParams<'getAccountInfo'>): Promise<import("@trezor/blockchain-link").AccountInfo>;
45
+ getAccountUtxo(descriptor: string): Promise<import("@trezor/blockchain-link").Utxo[]>;
46
+ estimateFee(request: {
47
+ blocks?: number[];
48
+ }): Promise<{
49
+ feePerUnit: string;
50
+ feePerTx?: string | undefined;
51
+ feeLimit?: string | undefined;
52
+ }[]>;
53
+ subscribe(accounts?: SubscriptionAccountInfo[]): Promise<{
54
+ subscribed: boolean;
55
+ }>;
56
+ subscribeFiatRates(_currency?: string): Promise<{
57
+ subscribed: boolean;
58
+ }>;
59
+ unsubscribe(accounts?: SubscriptionAccountInfo[]): Promise<{
60
+ subscribed: boolean;
61
+ }>;
62
+ unsubscribeFiatRates(): Promise<{
63
+ subscribed: boolean;
64
+ }>;
65
+ pushTransaction(tx: string): Promise<string>;
66
+ disconnect(): void;
67
+ }
68
+ export declare const findBackend: (name: string) => Blockchain | null;
69
+ export declare const setCustomBackend: (coinInfo: CoinInfo, blockchainLink: CoinInfo['blockchainLink']) => void;
70
+ export declare const isBackendSupported: (coinInfo: CoinInfo) => void;
71
+ export declare const initBlockchain: (coinInfo: CoinInfo, postMessage: Options['postMessage']) => Promise<Blockchain>;
72
+ export declare const reconnectAllBackends: () => Promise<Blockchain[]>;
73
+ export declare const dispose: () => void;
74
+ export {};
75
+ //# sourceMappingURL=BlockchainLink.d.ts.map
@@ -0,0 +1,298 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.dispose = exports.reconnectAllBackends = exports.initBlockchain = exports.isBackendSupported = exports.setCustomBackend = exports.findBackend = exports.Blockchain = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const blockchain_link_1 = (0, tslib_1.__importDefault)(require("@trezor/blockchain-link"));
6
+ const config_1 = require("../data/config");
7
+ const DataManager_1 = require("../data/DataManager");
8
+ const events_1 = require("../events");
9
+ const constants_1 = require("../constants");
10
+ const urlUtils_1 = require("../utils/urlUtils");
11
+ const workers_1 = require("../workers/workers");
12
+ const getWorker = (type) => {
13
+ switch (type) {
14
+ case 'blockbook':
15
+ return workers_1.BlockbookWorker;
16
+ case 'ripple':
17
+ return workers_1.RippleWorker;
18
+ case 'blockfrost':
19
+ return workers_1.BlockfrostWorker;
20
+ case 'electrum':
21
+ return workers_1.ElectrumWorker;
22
+ default:
23
+ return null;
24
+ }
25
+ };
26
+ class Blockchain {
27
+ constructor(options) {
28
+ this.feeForBlock = [];
29
+ this.feeTimestamp = 0;
30
+ this.coinInfo = options.coinInfo;
31
+ this.postMessage = options.postMessage;
32
+ const { blockchainLink } = options.coinInfo;
33
+ if (!blockchainLink) {
34
+ throw constants_1.ERRORS.TypedError('Backend_NotSupported');
35
+ }
36
+ const worker = getWorker(blockchainLink.type);
37
+ if (!worker) {
38
+ throw constants_1.ERRORS.TypedError('Backend_WorkerMissing', `BlockchainLink worker not found ${blockchainLink.type}`);
39
+ }
40
+ const { onionDomains } = options;
41
+ this.onionDomains = onionDomains
42
+ ? blockchainLink.url.reduce((a, url) => {
43
+ const onion = (0, urlUtils_1.getOnionDomain)(url, onionDomains);
44
+ if (onion !== url) {
45
+ a[onion] = url;
46
+ }
47
+ return a;
48
+ }, {})
49
+ : {};
50
+ const server = Object.keys(this.onionDomains).length
51
+ ? Object.keys(this.onionDomains)
52
+ : blockchainLink.url;
53
+ this.link = new blockchain_link_1.default({
54
+ name: this.coinInfo.shortcut,
55
+ worker,
56
+ server,
57
+ debug: options.debug,
58
+ proxy: options.proxy,
59
+ });
60
+ }
61
+ onError(error) {
62
+ this.link.dispose();
63
+ this.postMessage((0, events_1.createBlockchainMessage)(events_1.BLOCKCHAIN.ERROR, {
64
+ coin: this.coinInfo,
65
+ error: error.message,
66
+ code: error.code,
67
+ }));
68
+ removeBackend(this);
69
+ }
70
+ async init() {
71
+ this.link.on('connected', async () => {
72
+ const info = await this.link.getInfo();
73
+ this.serverInfo = info;
74
+ const shortcut = this.coinInfo.shortcut === 'tXRP' ? 'XRP' : this.coinInfo.shortcut;
75
+ if (info.shortcut.toLowerCase() !== shortcut.toLowerCase()) {
76
+ this.onError(constants_1.ERRORS.TypedError('Backend_Invalid'));
77
+ return;
78
+ }
79
+ const cleanUrl = this.onionDomains[info.url];
80
+ setPreferredBacked(this.coinInfo, cleanUrl || info.url);
81
+ this.postMessage((0, events_1.createBlockchainMessage)(events_1.BLOCKCHAIN.CONNECT, {
82
+ coin: this.coinInfo,
83
+ ...info,
84
+ cleanUrl,
85
+ }));
86
+ });
87
+ this.link.on('disconnected', () => {
88
+ this.onError(constants_1.ERRORS.TypedError('Backend_Disconnected'));
89
+ });
90
+ this.link.on('error', error => {
91
+ this.onError(constants_1.ERRORS.TypedError('Backend_Error', error.message));
92
+ });
93
+ try {
94
+ await this.link.connect();
95
+ }
96
+ catch (error) {
97
+ this.onError(constants_1.ERRORS.TypedError('Backend_Error', error.message));
98
+ throw error;
99
+ }
100
+ }
101
+ getTransactions(txs) {
102
+ return Promise.all(txs.map(id => this.link.getTransaction(id)));
103
+ }
104
+ getCurrentFiatRates(params) {
105
+ return this.link.getCurrentFiatRates(params);
106
+ }
107
+ getFiatRatesForTimestamps(params) {
108
+ return this.link.getFiatRatesForTimestamps(params);
109
+ }
110
+ getAccountBalanceHistory(params) {
111
+ return this.link.getAccountBalanceHistory(params);
112
+ }
113
+ getNetworkInfo() {
114
+ return this.link.getInfo();
115
+ }
116
+ getAccountInfo(request) {
117
+ return this.link.getAccountInfo(request);
118
+ }
119
+ getAccountUtxo(descriptor) {
120
+ return this.link.getAccountUtxo(descriptor);
121
+ }
122
+ async estimateFee(request) {
123
+ const { blocks } = request;
124
+ if (blocks) {
125
+ const now = Date.now();
126
+ const outdated = now - this.feeTimestamp > 20 * 60 * 1000;
127
+ const unknownBlocks = blocks.filter(() => typeof this.feeForBlock !== 'string');
128
+ if (!outdated && unknownBlocks.length < 1) {
129
+ }
130
+ const fees = await this.link.estimateFee(request);
131
+ blocks.forEach((block, index) => {
132
+ this.feeForBlock[block] = fees[index];
133
+ });
134
+ this.feeTimestamp = now;
135
+ return fees;
136
+ }
137
+ return this.link.estimateFee(request);
138
+ }
139
+ async subscribe(accounts) {
140
+ if (this.link.listenerCount('block') === 0) {
141
+ this.link.on('block', block => {
142
+ this.postMessage((0, events_1.createBlockchainMessage)(events_1.BLOCKCHAIN.BLOCK, {
143
+ coin: this.coinInfo,
144
+ ...block,
145
+ }));
146
+ });
147
+ }
148
+ if (this.link.listenerCount('notification') === 0) {
149
+ this.link.on('notification', notification => {
150
+ this.postMessage((0, events_1.createBlockchainMessage)(events_1.BLOCKCHAIN.NOTIFICATION, {
151
+ coin: this.coinInfo,
152
+ notification,
153
+ }));
154
+ });
155
+ }
156
+ const blockSubscription = await this.link.subscribe({ type: 'block' });
157
+ if (!accounts) {
158
+ return blockSubscription;
159
+ }
160
+ return this.link.subscribe({
161
+ type: 'accounts',
162
+ accounts,
163
+ });
164
+ }
165
+ subscribeFiatRates(_currency) {
166
+ if (this.link.listenerCount('fiatRates') === 0) {
167
+ this.link.on('fiatRates', ({ rates }) => {
168
+ this.postMessage((0, events_1.createBlockchainMessage)(events_1.BLOCKCHAIN.FIAT_RATES_UPDATE, {
169
+ coin: this.coinInfo,
170
+ rates,
171
+ }));
172
+ });
173
+ }
174
+ return this.link.subscribe({
175
+ type: 'fiatRates',
176
+ });
177
+ }
178
+ async unsubscribe(accounts) {
179
+ if (!accounts) {
180
+ this.link.removeAllListeners('block');
181
+ this.link.removeAllListeners('fiatRates');
182
+ this.link.removeAllListeners('notification');
183
+ await this.link.unsubscribe({ type: 'fiatRates' });
184
+ return this.link.unsubscribe({ type: 'block' });
185
+ }
186
+ return this.link.unsubscribe({ type: 'accounts', accounts });
187
+ }
188
+ unsubscribeFiatRates() {
189
+ this.link.removeAllListeners('fiatRates');
190
+ return this.link.unsubscribe({ type: 'fiatRates' });
191
+ }
192
+ pushTransaction(tx) {
193
+ return this.link.pushTransaction(tx);
194
+ }
195
+ disconnect() {
196
+ this.link.removeAllListeners();
197
+ this.link.disconnect();
198
+ this.onError(constants_1.ERRORS.TypedError('Backend_Disconnected'));
199
+ }
200
+ }
201
+ exports.Blockchain = Blockchain;
202
+ const instances = [];
203
+ const customBackends = {};
204
+ const preferredBackends = {};
205
+ const removeBackend = (backend) => {
206
+ const index = instances.indexOf(backend);
207
+ if (index >= 0) {
208
+ instances.splice(index, 1);
209
+ }
210
+ };
211
+ const findBackend = (name) => {
212
+ for (let i = 0; i < instances.length; i++) {
213
+ if (instances[i].coinInfo.name === name) {
214
+ return instances[i];
215
+ }
216
+ }
217
+ return null;
218
+ };
219
+ exports.findBackend = findBackend;
220
+ const setPreferredBacked = (coinInfo, url) => {
221
+ if (!url) {
222
+ delete preferredBackends[coinInfo.shortcut];
223
+ }
224
+ else if (coinInfo.blockchainLink) {
225
+ preferredBackends[coinInfo.shortcut] = {
226
+ ...coinInfo,
227
+ blockchainLink: {
228
+ ...coinInfo.blockchainLink,
229
+ url: [url],
230
+ },
231
+ };
232
+ }
233
+ };
234
+ const setCustomBackend = (coinInfo, blockchainLink) => {
235
+ setPreferredBacked(coinInfo);
236
+ if (!blockchainLink || blockchainLink.url.length === 0) {
237
+ delete customBackends[coinInfo.shortcut];
238
+ }
239
+ else {
240
+ customBackends[coinInfo.shortcut] = {
241
+ ...coinInfo,
242
+ blockchainLink,
243
+ };
244
+ }
245
+ };
246
+ exports.setCustomBackend = setCustomBackend;
247
+ const isBackendSupported = (coinInfo) => {
248
+ const info = customBackends[coinInfo.shortcut] || coinInfo;
249
+ if (!info.blockchainLink) {
250
+ throw constants_1.ERRORS.TypedError('Backend_NotSupported');
251
+ }
252
+ };
253
+ exports.isBackendSupported = isBackendSupported;
254
+ const initBlockchain = async (coinInfo, postMessage) => {
255
+ let backend = (0, exports.findBackend)(coinInfo.name);
256
+ if (!backend) {
257
+ backend = new Blockchain({
258
+ coinInfo: preferredBackends[coinInfo.shortcut] ||
259
+ customBackends[coinInfo.shortcut] ||
260
+ coinInfo,
261
+ postMessage,
262
+ debug: DataManager_1.DataManager.getSettings('debug'),
263
+ proxy: DataManager_1.DataManager.getSettings('proxy'),
264
+ onionDomains: DataManager_1.DataManager.getSettings('useOnionLinks') && !customBackends[coinInfo.shortcut]
265
+ ? config_1.config.onionDomains
266
+ : undefined,
267
+ });
268
+ instances.push(backend);
269
+ try {
270
+ await backend.init();
271
+ }
272
+ catch (error) {
273
+ removeBackend(backend);
274
+ setPreferredBacked(coinInfo);
275
+ throw error;
276
+ }
277
+ }
278
+ return backend;
279
+ };
280
+ exports.initBlockchain = initBlockchain;
281
+ const reconnectAllBackends = () => {
282
+ const params = instances.map(i => [
283
+ i.coinInfo,
284
+ i.postMessage,
285
+ ]);
286
+ while (instances.length > 0) {
287
+ instances[0].disconnect();
288
+ }
289
+ return Promise.all(params.map(p => (0, exports.initBlockchain)(...p)));
290
+ };
291
+ exports.reconnectAllBackends = reconnectAllBackends;
292
+ const dispose = () => {
293
+ while (instances.length > 0) {
294
+ instances[0].disconnect();
295
+ }
296
+ };
297
+ exports.dispose = dispose;
298
+ //# sourceMappingURL=BlockchainLink.js.map
@@ -0,0 +1,9 @@
1
+ export declare enum PROTOCOL_MAGICS {
2
+ mainnet = 764824073,
3
+ testnet = 1097911063
4
+ }
5
+ export declare enum NETWORK_IDS {
6
+ mainnet = 1,
7
+ testnet = 0
8
+ }
9
+ //# sourceMappingURL=cardano.d.ts.map
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.NETWORK_IDS = exports.PROTOCOL_MAGICS = void 0;
4
+ var PROTOCOL_MAGICS;
5
+ (function (PROTOCOL_MAGICS) {
6
+ PROTOCOL_MAGICS[PROTOCOL_MAGICS["mainnet"] = 764824073] = "mainnet";
7
+ PROTOCOL_MAGICS[PROTOCOL_MAGICS["testnet"] = 1097911063] = "testnet";
8
+ })(PROTOCOL_MAGICS = exports.PROTOCOL_MAGICS || (exports.PROTOCOL_MAGICS = {}));
9
+ var NETWORK_IDS;
10
+ (function (NETWORK_IDS) {
11
+ NETWORK_IDS[NETWORK_IDS["mainnet"] = 1] = "mainnet";
12
+ NETWORK_IDS[NETWORK_IDS["testnet"] = 0] = "testnet";
13
+ })(NETWORK_IDS = exports.NETWORK_IDS || (exports.NETWORK_IDS = {}));
14
+ //# sourceMappingURL=cardano.js.map
@@ -0,0 +1,49 @@
1
+ export declare const ERROR_CODES: {
2
+ Init_NotInitialized: string;
3
+ Init_AlreadyInitialized: string;
4
+ Init_IframeBlocked: string;
5
+ Init_IframeTimeout: string;
6
+ Init_ManifestMissing: string;
7
+ Popup_ConnectionMissing: string;
8
+ Transport_Missing: string;
9
+ Transport_InvalidProtobuf: string;
10
+ Method_InvalidPackage: string;
11
+ Method_InvalidParameter: string;
12
+ Method_NotAllowed: string;
13
+ Method_PermissionsNotGranted: string;
14
+ Method_Cancel: string;
15
+ Method_Interrupted: string;
16
+ Method_UnknownCoin: string;
17
+ Method_AddressNotMatch: string;
18
+ Method_FirmwareUpdate_DownloadFailed: string;
19
+ Method_CustomMessage_Callback: string;
20
+ Method_Discovery_BundleException: string;
21
+ Method_Override: string;
22
+ Method_NoResponse: string;
23
+ Backend_NotSupported: string;
24
+ Backend_WorkerMissing: string;
25
+ Backend_Disconnected: string;
26
+ Backend_Invalid: string;
27
+ Backend_Error: string;
28
+ Runtime: string;
29
+ Device_NotFound: string;
30
+ Device_InitializeFailed: string;
31
+ Device_FwException: string;
32
+ Device_ModeException: string;
33
+ Device_Disconnected: string;
34
+ Device_UsedElsewhere: string;
35
+ Device_InvalidState: string;
36
+ Device_CallInProgress: string;
37
+ };
38
+ export declare class TrezorError extends Error {
39
+ code: string;
40
+ message: string;
41
+ constructor(code: string, message: string);
42
+ }
43
+ export declare const TypedError: (id: keyof typeof ERROR_CODES, message?: string | undefined) => TrezorError;
44
+ export declare const serializeError: (payload: any) => any;
45
+ export declare const WRONG_PREVIOUS_SESSION_ERROR_MESSAGE = "wrong previous session";
46
+ export declare const INVALID_PIN_ERROR_MESSAGE = "PIN invalid";
47
+ export declare const WEBUSB_ERROR_MESSAGE = "NetworkError: Unable to claim interface.";
48
+ export declare const LIBUSB_ERROR_MESSAGE = "LIBUSB_ERROR";
49
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1,62 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.LIBUSB_ERROR_MESSAGE = exports.WEBUSB_ERROR_MESSAGE = exports.INVALID_PIN_ERROR_MESSAGE = exports.WRONG_PREVIOUS_SESSION_ERROR_MESSAGE = exports.serializeError = exports.TypedError = exports.TrezorError = exports.ERROR_CODES = void 0;
4
+ exports.ERROR_CODES = {
5
+ Init_NotInitialized: 'TrezorConnect not initialized',
6
+ Init_AlreadyInitialized: 'TrezorConnect has been already initialized',
7
+ Init_IframeBlocked: 'Iframe blocked',
8
+ Init_IframeTimeout: 'Iframe timeout',
9
+ Init_ManifestMissing: 'Manifest not set. Read more at https://github.com/trezor/connect/blob/develop/docs/index.md',
10
+ Popup_ConnectionMissing: 'Unable to establish connection with iframe',
11
+ Transport_Missing: 'Transport is missing',
12
+ Transport_InvalidProtobuf: '',
13
+ Method_InvalidPackage: 'This package is not suitable to work with browser. Use @trezor/connect-web package instead',
14
+ Method_InvalidParameter: '',
15
+ Method_NotAllowed: 'Method not allowed for this configuration',
16
+ Method_PermissionsNotGranted: 'Permissions not granted',
17
+ Method_Cancel: 'Cancelled',
18
+ Method_Interrupted: 'Popup closed',
19
+ Method_UnknownCoin: 'Coin not found',
20
+ Method_AddressNotMatch: 'Addresses do not match',
21
+ Method_FirmwareUpdate_DownloadFailed: 'Failed to download firmware binary',
22
+ Method_CustomMessage_Callback: 'Parameter "callback" is not a function',
23
+ Method_Discovery_BundleException: '',
24
+ Method_Override: 'override',
25
+ Method_NoResponse: 'Call resolved without response',
26
+ Backend_NotSupported: 'BlockchainLink settings not found in coins.json',
27
+ Backend_WorkerMissing: '',
28
+ Backend_Disconnected: 'Backend disconnected',
29
+ Backend_Invalid: 'Invalid backend',
30
+ Backend_Error: '',
31
+ Runtime: '',
32
+ Device_NotFound: 'Device not found',
33
+ Device_InitializeFailed: '',
34
+ Device_FwException: '',
35
+ Device_ModeException: '',
36
+ Device_Disconnected: 'Device disconnected',
37
+ Device_UsedElsewhere: 'Device is used in another window',
38
+ Device_InvalidState: 'Passphrase is incorrect',
39
+ Device_CallInProgress: 'Device call in progress',
40
+ };
41
+ class TrezorError extends Error {
42
+ constructor(code, message) {
43
+ super(message);
44
+ this.code = code;
45
+ this.message = message;
46
+ }
47
+ }
48
+ exports.TrezorError = TrezorError;
49
+ const TypedError = (id, message) => new TrezorError(id, message || exports.ERROR_CODES[id]);
50
+ exports.TypedError = TypedError;
51
+ const serializeError = (payload) => {
52
+ if (payload && payload.error instanceof Error) {
53
+ return { error: payload.error.message, code: payload.error.code };
54
+ }
55
+ return payload;
56
+ };
57
+ exports.serializeError = serializeError;
58
+ exports.WRONG_PREVIOUS_SESSION_ERROR_MESSAGE = 'wrong previous session';
59
+ exports.INVALID_PIN_ERROR_MESSAGE = 'PIN invalid';
60
+ exports.WEBUSB_ERROR_MESSAGE = 'NetworkError: Unable to claim interface.';
61
+ exports.LIBUSB_ERROR_MESSAGE = 'LIBUSB_ERROR';
62
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1,6 @@
1
+ export * as ERRORS from './errors';
2
+ export * as NETWORK from './network';
3
+ export * as CARDANO from './cardano';
4
+ export * as NEM from './nem';
5
+ export * as PROTO from '@trezor/transport/lib/types/messages';
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PROTO = exports.NEM = exports.CARDANO = exports.NETWORK = exports.ERRORS = void 0;
4
+ const tslib_1 = require("tslib");
5
+ exports.ERRORS = (0, tslib_1.__importStar)(require("./errors"));
6
+ exports.NETWORK = (0, tslib_1.__importStar)(require("./network"));
7
+ exports.CARDANO = (0, tslib_1.__importStar)(require("./cardano"));
8
+ exports.NEM = (0, tslib_1.__importStar)(require("./nem"));
9
+ exports.PROTO = (0, tslib_1.__importStar)(require("@trezor/transport/lib/types/messages"));
10
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,22 @@
1
+ export declare enum Networks {
2
+ mainnet = 104,
3
+ testnet = 152,
4
+ mijin = 96
5
+ }
6
+ export declare enum TxType {
7
+ TRANSFER = 257,
8
+ COSIGNING = 258,
9
+ IMPORTANCE_TRANSFER = 2049,
10
+ AGGREGATE_MODIFICATION = 4097,
11
+ MULTISIG_SIGNATURE = 4098,
12
+ MULTISIG = 4100,
13
+ PROVISION_NAMESPACE = 8193,
14
+ MOSAIC_CREATION = 16385,
15
+ SUPPLY_CHANGE = 16386
16
+ }
17
+ export declare enum TxVersion {
18
+ mainnet = 1744830464,
19
+ testnet = -1744830464,
20
+ mijin = 1610612736
21
+ }
22
+ //# sourceMappingURL=nem.d.ts.map
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TxVersion = exports.TxType = exports.Networks = void 0;
4
+ var Networks;
5
+ (function (Networks) {
6
+ Networks[Networks["mainnet"] = 104] = "mainnet";
7
+ Networks[Networks["testnet"] = 152] = "testnet";
8
+ Networks[Networks["mijin"] = 96] = "mijin";
9
+ })(Networks = exports.Networks || (exports.Networks = {}));
10
+ var TxType;
11
+ (function (TxType) {
12
+ TxType[TxType["TRANSFER"] = 257] = "TRANSFER";
13
+ TxType[TxType["COSIGNING"] = 258] = "COSIGNING";
14
+ TxType[TxType["IMPORTANCE_TRANSFER"] = 2049] = "IMPORTANCE_TRANSFER";
15
+ TxType[TxType["AGGREGATE_MODIFICATION"] = 4097] = "AGGREGATE_MODIFICATION";
16
+ TxType[TxType["MULTISIG_SIGNATURE"] = 4098] = "MULTISIG_SIGNATURE";
17
+ TxType[TxType["MULTISIG"] = 4100] = "MULTISIG";
18
+ TxType[TxType["PROVISION_NAMESPACE"] = 8193] = "PROVISION_NAMESPACE";
19
+ TxType[TxType["MOSAIC_CREATION"] = 16385] = "MOSAIC_CREATION";
20
+ TxType[TxType["SUPPLY_CHANGE"] = 16386] = "SUPPLY_CHANGE";
21
+ })(TxType = exports.TxType || (exports.TxType = {}));
22
+ var TxVersion;
23
+ (function (TxVersion) {
24
+ TxVersion[TxVersion["mainnet"] = 1744830464] = "mainnet";
25
+ TxVersion[TxVersion["testnet"] = -1744830464] = "testnet";
26
+ TxVersion[TxVersion["mijin"] = 1610612736] = "mijin";
27
+ })(TxVersion = exports.TxVersion || (exports.TxVersion = {}));
28
+ //# sourceMappingURL=nem.js.map
@@ -0,0 +1,13 @@
1
+ export declare const TYPES: {
2
+ readonly bitcoin: "Bitcoin";
3
+ readonly ethereum: "Ethereum";
4
+ readonly eos: "Eos";
5
+ readonly nem: "NEM";
6
+ readonly stellar: "Stellar";
7
+ readonly cardano: "Cardano";
8
+ readonly ripple: "Ripple";
9
+ readonly tezos: "Tezos";
10
+ readonly binance: "Binance";
11
+ };
12
+ export declare type NetworkType = keyof typeof TYPES;
13
+ //# sourceMappingURL=network.d.ts.map
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TYPES = void 0;
4
+ exports.TYPES = {
5
+ bitcoin: 'Bitcoin',
6
+ ethereum: 'Ethereum',
7
+ eos: 'Eos',
8
+ nem: 'NEM',
9
+ stellar: 'Stellar',
10
+ cardano: 'Cardano',
11
+ ripple: 'Ripple',
12
+ tezos: 'Tezos',
13
+ binance: 'Binance',
14
+ };
15
+ //# sourceMappingURL=network.js.map
@@ -0,0 +1,59 @@
1
+ import { NETWORK } from '../constants';
2
+ import { CallMethodPayload, CallMethodResponse, CoreMessage, UiRequestButtonData, UiPromise, UiPromiseResponse } from '../events';
3
+ import { Deferred } from '../utils/deferred';
4
+ import type { Device } from '../device/Device';
5
+ import type { FirmwareRange } from '../types';
6
+ export declare type Payload<M> = Extract<CallMethodPayload, {
7
+ method: M;
8
+ }> & {
9
+ override?: boolean;
10
+ };
11
+ export declare type MethodReturnType<M extends CallMethodPayload['method']> = CallMethodResponse<M>;
12
+ export declare abstract class AbstractMethod<Name extends CallMethodPayload['method'], Params = undefined> {
13
+ responseID: number;
14
+ device: Device;
15
+ params: Params;
16
+ devicePath?: string;
17
+ deviceState?: string;
18
+ hasExpectedDeviceState: boolean;
19
+ keepSession: boolean;
20
+ skipFinalReload: boolean;
21
+ skipFirmwareCheck: boolean;
22
+ overridePreviousCall: boolean;
23
+ overridden: boolean;
24
+ name: Name;
25
+ payload: Payload<Name>;
26
+ info: string;
27
+ useUi: boolean;
28
+ useDevice: boolean;
29
+ useDeviceState: boolean;
30
+ useEmptyPassphrase: boolean;
31
+ allowSeedlessDevice: boolean;
32
+ firmwareRange: FirmwareRange;
33
+ requiredPermissions: string[];
34
+ allowDeviceMode: string[];
35
+ requireDeviceMode: string[];
36
+ network: NETWORK.NetworkType;
37
+ useCardanoDerivation: boolean;
38
+ confirmation?(): Promise<boolean | undefined>;
39
+ noBackupConfirmation?(): Promise<boolean>;
40
+ getButtonRequestData?(code: string): UiRequestButtonData | undefined;
41
+ postMessage: (message: CoreMessage) => void;
42
+ getPopupPromise: () => Deferred<void>;
43
+ createUiPromise: <T extends UiPromiseResponse['type']>(promiseId: T, device?: Device) => UiPromise<T>;
44
+ removeUiPromise: (promise: Deferred<any>) => void;
45
+ constructor(message: {
46
+ id?: number;
47
+ payload: Payload<Name>;
48
+ });
49
+ setDevice(device: Device): void;
50
+ requestPermissions(): Promise<boolean>;
51
+ checkPermissions(): void;
52
+ savePermissions(temporary?: boolean): void;
53
+ checkFirmwareRange(isUsingPopup?: boolean): Promise<"ui-device_firmware_old" | "ui-device_firmware_unsupported" | "ui-device_firmware_not_compatible" | "ui-device_firmware_not_installed" | undefined>;
54
+ abstract init(): void;
55
+ abstract run(): Promise<MethodReturnType<Name>>;
56
+ getCustomMessages(): void;
57
+ dispose(): void;
58
+ }
59
+ //# sourceMappingURL=AbstractMethod.d.ts.map