@sravankumar02/sdk-core 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (561) hide show
  1. package/LICENSE +11 -0
  2. package/README.md +94 -0
  3. package/out/abi/argSerializer.d.ts +45 -0
  4. package/out/abi/argSerializer.js +171 -0
  5. package/out/abi/argSerializer.js.map +1 -0
  6. package/out/abi/argumentErrorContext.d.ts +12 -0
  7. package/out/abi/argumentErrorContext.js +34 -0
  8. package/out/abi/argumentErrorContext.js.map +1 -0
  9. package/out/abi/code.d.ts +23 -0
  10. package/out/abi/code.js +41 -0
  11. package/out/abi/code.js.map +1 -0
  12. package/out/abi/codec/address.d.ts +24 -0
  13. package/out/abi/codec/address.js +41 -0
  14. package/out/abi/codec/address.js.map +1 -0
  15. package/out/abi/codec/arrayVec.d.ts +11 -0
  16. package/out/abi/codec/arrayVec.js +39 -0
  17. package/out/abi/codec/arrayVec.js.map +1 -0
  18. package/out/abi/codec/binary.d.ts +30 -0
  19. package/out/abi/codec/binary.js +134 -0
  20. package/out/abi/codec/binary.js.map +1 -0
  21. package/out/abi/codec/binaryCodecUtils.d.ts +6 -0
  22. package/out/abi/codec/binaryCodecUtils.js +35 -0
  23. package/out/abi/codec/binaryCodecUtils.js.map +1 -0
  24. package/out/abi/codec/boolean.d.ts +13 -0
  25. package/out/abi/codec/boolean.js +57 -0
  26. package/out/abi/codec/boolean.js.map +1 -0
  27. package/out/abi/codec/bytes.d.ts +11 -0
  28. package/out/abi/codec/bytes.js +30 -0
  29. package/out/abi/codec/bytes.js.map +1 -0
  30. package/out/abi/codec/codemetadata.d.ts +8 -0
  31. package/out/abi/codec/codemetadata.js +23 -0
  32. package/out/abi/codec/codemetadata.js.map +1 -0
  33. package/out/abi/codec/constants.d.ts +1 -0
  34. package/out/abi/codec/constants.js +5 -0
  35. package/out/abi/codec/constants.js.map +1 -0
  36. package/out/abi/codec/enum.d.ts +13 -0
  37. package/out/abi/codec/enum.js +49 -0
  38. package/out/abi/codec/enum.js.map +1 -0
  39. package/out/abi/codec/explicit-enum.d.ts +10 -0
  40. package/out/abi/codec/explicit-enum.js +30 -0
  41. package/out/abi/codec/explicit-enum.js.map +1 -0
  42. package/out/abi/codec/fields.d.ts +9 -0
  43. package/out/abi/codec/fields.js +31 -0
  44. package/out/abi/codec/fields.js.map +1 -0
  45. package/out/abi/codec/h256.d.ts +24 -0
  46. package/out/abi/codec/h256.js +39 -0
  47. package/out/abi/codec/h256.js.map +1 -0
  48. package/out/abi/codec/index.d.ts +6 -0
  49. package/out/abi/codec/index.js +19 -0
  50. package/out/abi/codec/index.js.map +1 -0
  51. package/out/abi/codec/list.d.ts +14 -0
  52. package/out/abi/codec/list.js +67 -0
  53. package/out/abi/codec/list.js.map +1 -0
  54. package/out/abi/codec/managedDecimal.d.ts +11 -0
  55. package/out/abi/codec/managedDecimal.js +53 -0
  56. package/out/abi/codec/managedDecimal.js.map +1 -0
  57. package/out/abi/codec/managedDecimalSigned.d.ts +11 -0
  58. package/out/abi/codec/managedDecimalSigned.js +53 -0
  59. package/out/abi/codec/managedDecimalSigned.js.map +1 -0
  60. package/out/abi/codec/nothing.d.ts +8 -0
  61. package/out/abi/codec/nothing.js +20 -0
  62. package/out/abi/codec/nothing.js.map +1 -0
  63. package/out/abi/codec/numerical.d.ts +13 -0
  64. package/out/abi/codec/numerical.js +122 -0
  65. package/out/abi/codec/numerical.js.map +1 -0
  66. package/out/abi/codec/option.d.ts +14 -0
  67. package/out/abi/codec/option.js +66 -0
  68. package/out/abi/codec/option.js.map +1 -0
  69. package/out/abi/codec/primitive.d.ts +20 -0
  70. package/out/abi/codec/primitive.js +81 -0
  71. package/out/abi/codec/primitive.js.map +1 -0
  72. package/out/abi/codec/string.d.ts +9 -0
  73. package/out/abi/codec/string.js +28 -0
  74. package/out/abi/codec/string.js.map +1 -0
  75. package/out/abi/codec/struct.d.ts +11 -0
  76. package/out/abi/codec/struct.js +30 -0
  77. package/out/abi/codec/struct.js.map +1 -0
  78. package/out/abi/codec/tokenIdentifier.d.ts +9 -0
  79. package/out/abi/codec/tokenIdentifier.js +28 -0
  80. package/out/abi/codec/tokenIdentifier.js.map +1 -0
  81. package/out/abi/codec/tuple.d.ts +11 -0
  82. package/out/abi/codec/tuple.js +23 -0
  83. package/out/abi/codec/tuple.js.map +1 -0
  84. package/out/abi/codec/utils.d.ts +20 -0
  85. package/out/abi/codec/utils.js +69 -0
  86. package/out/abi/codec/utils.js.map +1 -0
  87. package/out/abi/function.d.ts +24 -0
  88. package/out/abi/function.js +56 -0
  89. package/out/abi/function.js.map +1 -0
  90. package/out/abi/index.d.ts +12 -0
  91. package/out/abi/index.js +25 -0
  92. package/out/abi/index.js.map +1 -0
  93. package/out/abi/interaction.d.ts +67 -0
  94. package/out/abi/interaction.js +146 -0
  95. package/out/abi/interaction.js.map +1 -0
  96. package/out/abi/interface.d.ts +85 -0
  97. package/out/abi/interface.js +3 -0
  98. package/out/abi/interface.js.map +1 -0
  99. package/out/abi/nativeSerializer.d.ts +27 -0
  100. package/out/abi/nativeSerializer.js +343 -0
  101. package/out/abi/nativeSerializer.js.map +1 -0
  102. package/out/abi/query.d.ts +18 -0
  103. package/out/abi/query.js +19 -0
  104. package/out/abi/query.js.map +1 -0
  105. package/out/abi/returnCode.d.ts +26 -0
  106. package/out/abi/returnCode.js +45 -0
  107. package/out/abi/returnCode.js.map +1 -0
  108. package/out/abi/smartContract.d.ts +74 -0
  109. package/out/abi/smartContract.js +208 -0
  110. package/out/abi/smartContract.js.map +1 -0
  111. package/out/abi/typeFormula.d.ts +7 -0
  112. package/out/abi/typeFormula.js +20 -0
  113. package/out/abi/typeFormula.js.map +1 -0
  114. package/out/abi/typeFormulaParser.d.ts +14 -0
  115. package/out/abi/typeFormulaParser.js +126 -0
  116. package/out/abi/typeFormulaParser.js.map +1 -0
  117. package/out/abi/typesystem/abi.d.ts +64 -0
  118. package/out/abi/typesystem/abi.js +208 -0
  119. package/out/abi/typesystem/abi.js.map +1 -0
  120. package/out/abi/typesystem/address.d.ts +23 -0
  121. package/out/abi/typesystem/address.js +41 -0
  122. package/out/abi/typesystem/address.js.map +1 -0
  123. package/out/abi/typesystem/algebraic.d.ts +24 -0
  124. package/out/abi/typesystem/algebraic.js +59 -0
  125. package/out/abi/typesystem/algebraic.js.map +1 -0
  126. package/out/abi/typesystem/boolean.d.ts +24 -0
  127. package/out/abi/typesystem/boolean.js +46 -0
  128. package/out/abi/typesystem/boolean.js.map +1 -0
  129. package/out/abi/typesystem/bytes.d.ts +28 -0
  130. package/out/abi/typesystem/bytes.js +58 -0
  131. package/out/abi/typesystem/bytes.js.map +1 -0
  132. package/out/abi/typesystem/codeMetadata.d.ts +11 -0
  133. package/out/abi/typesystem/codeMetadata.js +24 -0
  134. package/out/abi/typesystem/codeMetadata.js.map +1 -0
  135. package/out/abi/typesystem/collections.d.ts +9 -0
  136. package/out/abi/typesystem/collections.js +32 -0
  137. package/out/abi/typesystem/collections.js.map +1 -0
  138. package/out/abi/typesystem/composite.d.ts +16 -0
  139. package/out/abi/typesystem/composite.js +53 -0
  140. package/out/abi/typesystem/composite.js.map +1 -0
  141. package/out/abi/typesystem/endpoint.d.ts +41 -0
  142. package/out/abi/typesystem/endpoint.js +78 -0
  143. package/out/abi/typesystem/endpoint.js.map +1 -0
  144. package/out/abi/typesystem/enum.d.ts +51 -0
  145. package/out/abi/typesystem/enum.js +137 -0
  146. package/out/abi/typesystem/enum.js.map +1 -0
  147. package/out/abi/typesystem/event.d.ts +25 -0
  148. package/out/abi/typesystem/event.js +36 -0
  149. package/out/abi/typesystem/event.js.map +1 -0
  150. package/out/abi/typesystem/explicit-enum.d.ts +33 -0
  151. package/out/abi/typesystem/explicit-enum.js +63 -0
  152. package/out/abi/typesystem/explicit-enum.js.map +1 -0
  153. package/out/abi/typesystem/factory.d.ts +4 -0
  154. package/out/abi/typesystem/factory.js +19 -0
  155. package/out/abi/typesystem/factory.js.map +1 -0
  156. package/out/abi/typesystem/fields.d.ts +24 -0
  157. package/out/abi/typesystem/fields.js +90 -0
  158. package/out/abi/typesystem/fields.js.map +1 -0
  159. package/out/abi/typesystem/generic.d.ts +47 -0
  160. package/out/abi/typesystem/generic.js +120 -0
  161. package/out/abi/typesystem/generic.js.map +1 -0
  162. package/out/abi/typesystem/genericArray.d.ts +17 -0
  163. package/out/abi/typesystem/genericArray.js +44 -0
  164. package/out/abi/typesystem/genericArray.js.map +1 -0
  165. package/out/abi/typesystem/h256.d.ts +18 -0
  166. package/out/abi/typesystem/h256.js +35 -0
  167. package/out/abi/typesystem/h256.js.map +1 -0
  168. package/out/abi/typesystem/index.d.ts +33 -0
  169. package/out/abi/typesystem/index.js +46 -0
  170. package/out/abi/typesystem/index.js.map +1 -0
  171. package/out/abi/typesystem/managedDecimal.d.ts +26 -0
  172. package/out/abi/typesystem/managedDecimal.js +62 -0
  173. package/out/abi/typesystem/managedDecimal.js.map +1 -0
  174. package/out/abi/typesystem/managedDecimalSigned.d.ts +26 -0
  175. package/out/abi/typesystem/managedDecimalSigned.js +62 -0
  176. package/out/abi/typesystem/managedDecimalSigned.js.map +1 -0
  177. package/out/abi/typesystem/matchers.d.ts +51 -0
  178. package/out/abi/typesystem/matchers.js +185 -0
  179. package/out/abi/typesystem/matchers.js.map +1 -0
  180. package/out/abi/typesystem/nothing.d.ts +13 -0
  181. package/out/abi/typesystem/nothing.js +31 -0
  182. package/out/abi/typesystem/nothing.js.map +1 -0
  183. package/out/abi/typesystem/numerical.d.ts +130 -0
  184. package/out/abi/typesystem/numerical.js +286 -0
  185. package/out/abi/typesystem/numerical.js.map +1 -0
  186. package/out/abi/typesystem/string.d.ts +26 -0
  187. package/out/abi/typesystem/string.js +51 -0
  188. package/out/abi/typesystem/string.js.map +1 -0
  189. package/out/abi/typesystem/struct.d.ts +30 -0
  190. package/out/abi/typesystem/struct.js +78 -0
  191. package/out/abi/typesystem/struct.js.map +1 -0
  192. package/out/abi/typesystem/tokenIdentifier.d.ts +21 -0
  193. package/out/abi/typesystem/tokenIdentifier.js +51 -0
  194. package/out/abi/typesystem/tokenIdentifier.js.map +1 -0
  195. package/out/abi/typesystem/tuple.d.ts +16 -0
  196. package/out/abi/typesystem/tuple.js +71 -0
  197. package/out/abi/typesystem/tuple.js.map +1 -0
  198. package/out/abi/typesystem/typeExpressionParser.d.ts +8 -0
  199. package/out/abi/typesystem/typeExpressionParser.js +30 -0
  200. package/out/abi/typesystem/typeExpressionParser.js.map +1 -0
  201. package/out/abi/typesystem/typeMapper.d.ts +20 -0
  202. package/out/abi/typesystem/typeMapper.js +215 -0
  203. package/out/abi/typesystem/typeMapper.js.map +1 -0
  204. package/out/abi/typesystem/types.d.ts +129 -0
  205. package/out/abi/typesystem/types.js +285 -0
  206. package/out/abi/typesystem/types.js.map +1 -0
  207. package/out/abi/typesystem/variadic.d.ts +35 -0
  208. package/out/abi/typesystem/variadic.js +81 -0
  209. package/out/abi/typesystem/variadic.js.map +1 -0
  210. package/out/accountManagement/accountController.d.ts +18 -0
  211. package/out/accountManagement/accountController.js +54 -0
  212. package/out/accountManagement/accountController.js.map +1 -0
  213. package/out/accountManagement/accountTransactionsFactory.d.ts +27 -0
  214. package/out/accountManagement/accountTransactionsFactory.js +78 -0
  215. package/out/accountManagement/accountTransactionsFactory.js.map +1 -0
  216. package/out/accountManagement/index.d.ts +3 -0
  217. package/out/accountManagement/index.js +16 -0
  218. package/out/accountManagement/index.js.map +1 -0
  219. package/out/accountManagement/resources.d.ts +8 -0
  220. package/out/accountManagement/resources.js +3 -0
  221. package/out/accountManagement/resources.js.map +1 -0
  222. package/out/accounts/account.d.ts +94 -0
  223. package/out/accounts/account.js +154 -0
  224. package/out/accounts/account.js.map +1 -0
  225. package/out/accounts/index.d.ts +1 -0
  226. package/out/accounts/index.js +14 -0
  227. package/out/accounts/index.js.map +1 -0
  228. package/out/core/address.d.ts +105 -0
  229. package/out/core/address.js +313 -0
  230. package/out/core/address.js.map +1 -0
  231. package/out/core/asyncTimer.d.ts +27 -0
  232. package/out/core/asyncTimer.js +91 -0
  233. package/out/core/asyncTimer.js.map +1 -0
  234. package/out/core/baseController.d.ts +16 -0
  235. package/out/core/baseController.js +34 -0
  236. package/out/core/baseController.js.map +1 -0
  237. package/out/core/codeMetadata.d.ts +74 -0
  238. package/out/core/codeMetadata.js +146 -0
  239. package/out/core/codeMetadata.js.map +1 -0
  240. package/out/core/compatibility.d.ts +10 -0
  241. package/out/core/compatibility.js +22 -0
  242. package/out/core/compatibility.js.map +1 -0
  243. package/out/core/config.d.ts +15 -0
  244. package/out/core/config.js +20 -0
  245. package/out/core/config.js.map +1 -0
  246. package/out/core/constants.d.ts +28 -0
  247. package/out/core/constants.js +32 -0
  248. package/out/core/constants.js.map +1 -0
  249. package/out/core/errors.d.ts +279 -0
  250. package/out/core/errors.js +437 -0
  251. package/out/core/errors.js.map +1 -0
  252. package/out/core/globals.d.ts +0 -0
  253. package/out/core/globals.js +5 -0
  254. package/out/core/globals.js.map +1 -0
  255. package/out/core/index.d.ts +21 -0
  256. package/out/core/index.js +35 -0
  257. package/out/core/index.js.map +1 -0
  258. package/out/core/interfaces.d.ts +40 -0
  259. package/out/core/interfaces.js +3 -0
  260. package/out/core/interfaces.js.map +1 -0
  261. package/out/core/logger.d.ts +17 -0
  262. package/out/core/logger.js +50 -0
  263. package/out/core/logger.js.map +1 -0
  264. package/out/core/message.d.ts +57 -0
  265. package/out/core/message.js +71 -0
  266. package/out/core/message.js.map +1 -0
  267. package/out/core/networkParams.d.ts +57 -0
  268. package/out/core/networkParams.js +112 -0
  269. package/out/core/networkParams.js.map +1 -0
  270. package/out/core/reflection.d.ts +1 -0
  271. package/out/core/reflection.js +14 -0
  272. package/out/core/reflection.js.map +1 -0
  273. package/out/core/signature.d.ts +17 -0
  274. package/out/core/signature.js +82 -0
  275. package/out/core/signature.js.map +1 -0
  276. package/out/core/smartContractQuery.d.ts +35 -0
  277. package/out/core/smartContractQuery.js +34 -0
  278. package/out/core/smartContractQuery.js.map +1 -0
  279. package/out/core/tokenTransfersDataBuilder.d.ts +10 -0
  280. package/out/core/tokenTransfersDataBuilder.js +44 -0
  281. package/out/core/tokenTransfersDataBuilder.js.map +1 -0
  282. package/out/core/tokens.d.ts +130 -0
  283. package/out/core/tokens.js +287 -0
  284. package/out/core/tokens.js.map +1 -0
  285. package/out/core/transaction.d.ts +263 -0
  286. package/out/core/transaction.js +323 -0
  287. package/out/core/transaction.js.map +1 -0
  288. package/out/core/transactionBuilder.d.ts +32 -0
  289. package/out/core/transactionBuilder.js +45 -0
  290. package/out/core/transactionBuilder.js.map +1 -0
  291. package/out/core/transactionComputer.d.ts +51 -0
  292. package/out/core/transactionComputer.js +163 -0
  293. package/out/core/transactionComputer.js.map +1 -0
  294. package/out/core/transactionEvents.d.ts +17 -0
  295. package/out/core/transactionEvents.js +27 -0
  296. package/out/core/transactionEvents.js.map +1 -0
  297. package/out/core/transactionLogs.d.ts +11 -0
  298. package/out/core/transactionLogs.js +38 -0
  299. package/out/core/transactionLogs.js.map +1 -0
  300. package/out/core/transactionOnNetwork.d.ts +40 -0
  301. package/out/core/transactionOnNetwork.js +164 -0
  302. package/out/core/transactionOnNetwork.js.map +1 -0
  303. package/out/core/transactionStatus.d.ts +45 -0
  304. package/out/core/transactionStatus.js +71 -0
  305. package/out/core/transactionStatus.js.map +1 -0
  306. package/out/core/transactionWatcher.d.ts +48 -0
  307. package/out/core/transactionWatcher.js +148 -0
  308. package/out/core/transactionWatcher.js.map +1 -0
  309. package/out/core/transactionsFactoryConfig.d.ts +54 -0
  310. package/out/core/transactionsFactoryConfig.js +66 -0
  311. package/out/core/transactionsFactoryConfig.js.map +1 -0
  312. package/out/core/utils.codec.d.ts +8 -0
  313. package/out/core/utils.codec.js +75 -0
  314. package/out/core/utils.codec.js.map +1 -0
  315. package/out/core/utils.d.ts +20 -0
  316. package/out/core/utils.js +86 -0
  317. package/out/core/utils.js.map +1 -0
  318. package/out/delegation/delegationController.d.ts +37 -0
  319. package/out/delegation/delegationController.js +215 -0
  320. package/out/delegation/delegationController.js.map +1 -0
  321. package/out/delegation/delegationTransactionsFactory.d.ts +48 -0
  322. package/out/delegation/delegationTransactionsFactory.js +311 -0
  323. package/out/delegation/delegationTransactionsFactory.js.map +1 -0
  324. package/out/delegation/delegationTransactionsOutcomeParser.d.ts +10 -0
  325. package/out/delegation/delegationTransactionsOutcomeParser.js +35 -0
  326. package/out/delegation/delegationTransactionsOutcomeParser.js.map +1 -0
  327. package/out/delegation/index.d.ts +4 -0
  328. package/out/delegation/index.js +17 -0
  329. package/out/delegation/index.js.map +1 -0
  330. package/out/delegation/resources.d.ts +38 -0
  331. package/out/delegation/resources.js +3 -0
  332. package/out/delegation/resources.js.map +1 -0
  333. package/out/entrypoints/config.d.ts +29 -0
  334. package/out/entrypoints/config.js +36 -0
  335. package/out/entrypoints/config.js.map +1 -0
  336. package/out/entrypoints/entrypoints.d.ts +92 -0
  337. package/out/entrypoints/entrypoints.js +203 -0
  338. package/out/entrypoints/entrypoints.js.map +1 -0
  339. package/out/entrypoints/index.d.ts +2 -0
  340. package/out/entrypoints/index.js +15 -0
  341. package/out/entrypoints/index.js.map +1 -0
  342. package/out/governance/governanceController.d.ts +33 -0
  343. package/out/governance/governanceController.js +205 -0
  344. package/out/governance/governanceController.js.map +1 -0
  345. package/out/governance/governanceTransactionsFactory.d.ts +16 -0
  346. package/out/governance/governanceTransactionsFactory.js +99 -0
  347. package/out/governance/governanceTransactionsFactory.js.map +1 -0
  348. package/out/governance/governanceTransactionsOutcomeParser.d.ts +15 -0
  349. package/out/governance/governanceTransactionsOutcomeParser.js +99 -0
  350. package/out/governance/governanceTransactionsOutcomeParser.js.map +1 -0
  351. package/out/governance/index.d.ts +4 -0
  352. package/out/governance/index.js +17 -0
  353. package/out/governance/index.js.map +1 -0
  354. package/out/governance/resources.d.ts +82 -0
  355. package/out/governance/resources.js +11 -0
  356. package/out/governance/resources.js.map +1 -0
  357. package/out/index.d.ts +19 -0
  358. package/out/index.js +32 -0
  359. package/out/index.js.map +1 -0
  360. package/out/multisig/index.d.ts +3 -0
  361. package/out/multisig/index.js +16 -0
  362. package/out/multisig/index.js.map +1 -0
  363. package/out/multisig/multisigController.d.ts +221 -0
  364. package/out/multisig/multisigController.js +540 -0
  365. package/out/multisig/multisigController.js.map +1 -0
  366. package/out/multisig/multisigTransactionsFactory.d.ts +110 -0
  367. package/out/multisig/multisigTransactionsFactory.js +355 -0
  368. package/out/multisig/multisigTransactionsFactory.js.map +1 -0
  369. package/out/multisig/multisigTransactionsOutcomeParser.d.ts +31 -0
  370. package/out/multisig/multisigTransactionsOutcomeParser.js +41 -0
  371. package/out/multisig/multisigTransactionsOutcomeParser.js.map +1 -0
  372. package/out/multisig/proposeTransferExecuteContractInput.d.ts +32 -0
  373. package/out/multisig/proposeTransferExecuteContractInput.js +65 -0
  374. package/out/multisig/proposeTransferExecuteContractInput.js.map +1 -0
  375. package/out/multisig/resources.d.ts +182 -0
  376. package/out/multisig/resources.js +125 -0
  377. package/out/multisig/resources.js.map +1 -0
  378. package/out/networkProviders/accountAwaiter.d.ts +35 -0
  379. package/out/networkProviders/accountAwaiter.js +67 -0
  380. package/out/networkProviders/accountAwaiter.js.map +1 -0
  381. package/out/networkProviders/accounts.d.ts +55 -0
  382. package/out/networkProviders/accounts.js +154 -0
  383. package/out/networkProviders/accounts.js.map +1 -0
  384. package/out/networkProviders/apiNetworkProvider.d.ts +48 -0
  385. package/out/networkProviders/apiNetworkProvider.js +235 -0
  386. package/out/networkProviders/apiNetworkProvider.js.map +1 -0
  387. package/out/networkProviders/blocks.d.ts +48 -0
  388. package/out/networkProviders/blocks.js +76 -0
  389. package/out/networkProviders/blocks.js.map +1 -0
  390. package/out/networkProviders/config.d.ts +6 -0
  391. package/out/networkProviders/config.js +18 -0
  392. package/out/networkProviders/config.js.map +1 -0
  393. package/out/networkProviders/constants.d.ts +9 -0
  394. package/out/networkProviders/constants.js +16 -0
  395. package/out/networkProviders/constants.js.map +1 -0
  396. package/out/networkProviders/contractQueryRequest.d.ts +6 -0
  397. package/out/networkProviders/contractQueryRequest.js +20 -0
  398. package/out/networkProviders/contractQueryRequest.js.map +1 -0
  399. package/out/networkProviders/index.d.ts +11 -0
  400. package/out/networkProviders/index.js +28 -0
  401. package/out/networkProviders/index.js.map +1 -0
  402. package/out/networkProviders/interface.d.ts +110 -0
  403. package/out/networkProviders/interface.js +3 -0
  404. package/out/networkProviders/interface.js.map +1 -0
  405. package/out/networkProviders/networkConfig.d.ts +48 -0
  406. package/out/networkProviders/networkConfig.js +41 -0
  407. package/out/networkProviders/networkConfig.js.map +1 -0
  408. package/out/networkProviders/networkProviderConfig.d.ts +4 -0
  409. package/out/networkProviders/networkProviderConfig.js +3 -0
  410. package/out/networkProviders/networkProviderConfig.js.map +1 -0
  411. package/out/networkProviders/networkStatus.d.ts +31 -0
  412. package/out/networkProviders/networkStatus.js +31 -0
  413. package/out/networkProviders/networkStatus.js.map +1 -0
  414. package/out/networkProviders/proxyNetworkProvider.d.ts +51 -0
  415. package/out/networkProviders/proxyNetworkProvider.js +261 -0
  416. package/out/networkProviders/proxyNetworkProvider.js.map +1 -0
  417. package/out/networkProviders/resources.d.ts +12 -0
  418. package/out/networkProviders/resources.js +29 -0
  419. package/out/networkProviders/resources.js.map +1 -0
  420. package/out/networkProviders/tokenDefinitions.d.ts +49 -0
  421. package/out/networkProviders/tokenDefinitions.js +152 -0
  422. package/out/networkProviders/tokenDefinitions.js.map +1 -0
  423. package/out/networkProviders/tokens.d.ts +40 -0
  424. package/out/networkProviders/tokens.js +106 -0
  425. package/out/networkProviders/tokens.js.map +1 -0
  426. package/out/networkProviders/userAgent.d.ts +2 -0
  427. package/out/networkProviders/userAgent.js +30 -0
  428. package/out/networkProviders/userAgent.js.map +1 -0
  429. package/out/proto/compiled.d.ts +2 -0
  430. package/out/proto/compiled.js +719 -0
  431. package/out/proto/compiled.js.map +1 -0
  432. package/out/proto/index.d.ts +5 -0
  433. package/out/proto/index.js +18 -0
  434. package/out/proto/index.js.map +1 -0
  435. package/out/proto/serializer.d.ts +22 -0
  436. package/out/proto/serializer.js +114 -0
  437. package/out/proto/serializer.js.map +1 -0
  438. package/out/smartContracts/index.d.ts +4 -0
  439. package/out/smartContracts/index.js +17 -0
  440. package/out/smartContracts/index.js.map +1 -0
  441. package/out/smartContracts/resources.d.ts +38 -0
  442. package/out/smartContracts/resources.js +3 -0
  443. package/out/smartContracts/resources.js.map +1 -0
  444. package/out/smartContracts/smartContractController.d.ts +32 -0
  445. package/out/smartContracts/smartContractController.js +128 -0
  446. package/out/smartContracts/smartContractController.js.map +1 -0
  447. package/out/smartContracts/smartContractTransactionsFactory.d.ts +42 -0
  448. package/out/smartContracts/smartContractTransactionsFactory.js +165 -0
  449. package/out/smartContracts/smartContractTransactionsFactory.js.map +1 -0
  450. package/out/smartContracts/smartContractTransactionsOutcomeParser.d.ts +28 -0
  451. package/out/smartContracts/smartContractTransactionsOutcomeParser.js +189 -0
  452. package/out/smartContracts/smartContractTransactionsOutcomeParser.js.map +1 -0
  453. package/out/tokenManagement/index.d.ts +4 -0
  454. package/out/tokenManagement/index.js +17 -0
  455. package/out/tokenManagement/index.js.map +1 -0
  456. package/out/tokenManagement/resources.d.ts +220 -0
  457. package/out/tokenManagement/resources.js +3 -0
  458. package/out/tokenManagement/resources.js.map +1 -0
  459. package/out/tokenManagement/tokenManagementController.d.ts +108 -0
  460. package/out/tokenManagement/tokenManagementController.js +582 -0
  461. package/out/tokenManagement/tokenManagementController.js.map +1 -0
  462. package/out/tokenManagement/tokenManagementTransactionsFactory.d.ts +82 -0
  463. package/out/tokenManagement/tokenManagementTransactionsFactory.js +684 -0
  464. package/out/tokenManagement/tokenManagementTransactionsFactory.js.map +1 -0
  465. package/out/tokenManagement/tokenManagementTransactionsOutcomeParser.d.ts +109 -0
  466. package/out/tokenManagement/tokenManagementTransactionsOutcomeParser.js +356 -0
  467. package/out/tokenManagement/tokenManagementTransactionsOutcomeParser.js.map +1 -0
  468. package/out/tokenOperations/codec.d.ts +7 -0
  469. package/out/tokenOperations/codec.js +55 -0
  470. package/out/tokenOperations/codec.js.map +1 -0
  471. package/out/transactionsOutcomeParsers/index.d.ts +4 -0
  472. package/out/transactionsOutcomeParsers/index.js +17 -0
  473. package/out/transactionsOutcomeParsers/index.js.map +1 -0
  474. package/out/transactionsOutcomeParsers/resources.d.ts +23 -0
  475. package/out/transactionsOutcomeParsers/resources.js +48 -0
  476. package/out/transactionsOutcomeParsers/resources.js.map +1 -0
  477. package/out/transactionsOutcomeParsers/transactionEventsParser.d.ts +16 -0
  478. package/out/transactionsOutcomeParsers/transactionEventsParser.js +48 -0
  479. package/out/transactionsOutcomeParsers/transactionEventsParser.js.map +1 -0
  480. package/out/transfers/index.d.ts +3 -0
  481. package/out/transfers/index.js +16 -0
  482. package/out/transfers/index.js.map +1 -0
  483. package/out/transfers/resources.d.ts +17 -0
  484. package/out/transfers/resources.js +3 -0
  485. package/out/transfers/resources.js.map +1 -0
  486. package/out/transfers/transferTransactionsFactory.d.ts +32 -0
  487. package/out/transfers/transferTransactionsFactory.js +131 -0
  488. package/out/transfers/transferTransactionsFactory.js.map +1 -0
  489. package/out/transfers/transfersControllers.d.ts +11 -0
  490. package/out/transfers/transfersControllers.js +43 -0
  491. package/out/transfers/transfersControllers.js.map +1 -0
  492. package/out/wallet/assertions.d.ts +3 -0
  493. package/out/wallet/assertions.js +12 -0
  494. package/out/wallet/assertions.js.map +1 -0
  495. package/out/wallet/crypto/constants.d.ts +6 -0
  496. package/out/wallet/crypto/constants.js +11 -0
  497. package/out/wallet/crypto/constants.js.map +1 -0
  498. package/out/wallet/crypto/decryptor.d.ts +5 -0
  499. package/out/wallet/crypto/decryptor.js +29 -0
  500. package/out/wallet/crypto/decryptor.js.map +1 -0
  501. package/out/wallet/crypto/derivationParams.d.ts +23 -0
  502. package/out/wallet/crypto/derivationParams.js +38 -0
  503. package/out/wallet/crypto/derivationParams.js.map +1 -0
  504. package/out/wallet/crypto/encryptedData.d.ts +15 -0
  505. package/out/wallet/crypto/encryptedData.js +52 -0
  506. package/out/wallet/crypto/encryptedData.js.map +1 -0
  507. package/out/wallet/crypto/encryptor.d.ts +14 -0
  508. package/out/wallet/crypto/encryptor.js +39 -0
  509. package/out/wallet/crypto/encryptor.js.map +1 -0
  510. package/out/wallet/crypto/index.d.ts +7 -0
  511. package/out/wallet/crypto/index.js +20 -0
  512. package/out/wallet/crypto/index.js.map +1 -0
  513. package/out/wallet/crypto/pubkeyDecryptor.d.ts +6 -0
  514. package/out/wallet/crypto/pubkeyDecryptor.js +38 -0
  515. package/out/wallet/crypto/pubkeyDecryptor.js.map +1 -0
  516. package/out/wallet/crypto/pubkeyEncryptor.d.ts +6 -0
  517. package/out/wallet/crypto/pubkeyEncryptor.js +54 -0
  518. package/out/wallet/crypto/pubkeyEncryptor.js.map +1 -0
  519. package/out/wallet/crypto/randomness.d.ts +7 -0
  520. package/out/wallet/crypto/randomness.js +15 -0
  521. package/out/wallet/crypto/randomness.js.map +1 -0
  522. package/out/wallet/crypto/x25519EncryptedData.d.ts +15 -0
  523. package/out/wallet/crypto/x25519EncryptedData.js +37 -0
  524. package/out/wallet/crypto/x25519EncryptedData.js.map +1 -0
  525. package/out/wallet/index.d.ts +11 -0
  526. package/out/wallet/index.js +24 -0
  527. package/out/wallet/index.js.map +1 -0
  528. package/out/wallet/keypair.d.ts +12 -0
  529. package/out/wallet/keypair.js +32 -0
  530. package/out/wallet/keypair.js.map +1 -0
  531. package/out/wallet/mnemonic.d.ts +13 -0
  532. package/out/wallet/mnemonic.js +74 -0
  533. package/out/wallet/mnemonic.js.map +1 -0
  534. package/out/wallet/pem.d.ts +8 -0
  535. package/out/wallet/pem.js +60 -0
  536. package/out/wallet/pem.js.map +1 -0
  537. package/out/wallet/pemEntry.d.ts +10 -0
  538. package/out/wallet/pemEntry.js +73 -0
  539. package/out/wallet/pemEntry.js.map +1 -0
  540. package/out/wallet/userKeys.d.ts +23 -0
  541. package/out/wallet/userKeys.js +99 -0
  542. package/out/wallet/userKeys.js.map +1 -0
  543. package/out/wallet/userPem.d.ts +15 -0
  544. package/out/wallet/userPem.js +51 -0
  545. package/out/wallet/userPem.js.map +1 -0
  546. package/out/wallet/userSigner.d.ts +16 -0
  547. package/out/wallet/userSigner.js +41 -0
  548. package/out/wallet/userSigner.js.map +1 -0
  549. package/out/wallet/userVerifier.d.ts +18 -0
  550. package/out/wallet/userVerifier.js +27 -0
  551. package/out/wallet/userVerifier.js.map +1 -0
  552. package/out/wallet/userWallet.d.ts +54 -0
  553. package/out/wallet/userWallet.js +206 -0
  554. package/out/wallet/userWallet.js.map +1 -0
  555. package/out/wallet/validatorKeys.d.ts +26 -0
  556. package/out/wallet/validatorKeys.js +77 -0
  557. package/out/wallet/validatorKeys.js.map +1 -0
  558. package/out/wallet/validatorSigner.d.ts +10 -0
  559. package/out/wallet/validatorSigner.js +25 -0
  560. package/out/wallet/validatorSigner.js.map +1 -0
  561. package/package.json +84 -0
@@ -0,0 +1,51 @@
1
+ import { Address } from "./address";
2
+ import { INetworkConfig } from "./interfaces";
3
+ import { Transaction } from "./transaction";
4
+ /**
5
+ * An utilitary class meant to work together with the {@link Transaction} class.
6
+ */
7
+ export declare class TransactionComputer {
8
+ constructor();
9
+ computeTransactionFee(transaction: {
10
+ gasPrice: bigint;
11
+ gasLimit: bigint;
12
+ data: Uint8Array;
13
+ }, networkConfig: INetworkConfig): bigint;
14
+ /**
15
+ * Compute bytes for signing the transaction
16
+ */
17
+ computeBytesForSigning(transaction: Transaction): Uint8Array;
18
+ /**
19
+ * Compute bytes for verifying the transaction signature
20
+ */
21
+ computeBytesForVerifying(transaction: Transaction): Uint8Array;
22
+ /**
23
+ * Serializes the transaction then computes the hash; used for hash signing transactions.
24
+ */
25
+ computeHashForSigning(transaction: Transaction): Uint8Array;
26
+ computeTransactionHash(transaction: Transaction): string;
27
+ /**
28
+ * Returns true if the second least significant bit is set; returns false otherwise
29
+ */
30
+ hasOptionsSetForGuardedTransaction(transaction: Transaction): boolean;
31
+ /**
32
+ * Returns true if the least significant bit is set; returns false otherwise; should also have transaction.version >= 2
33
+ */
34
+ hasOptionsSetForHashSigning(transaction: Transaction): boolean;
35
+ /**
36
+ * Sets guardian address, transaction.version = 2, sets transaction.options second least significant bit
37
+ */
38
+ applyGuardian(transaction: Transaction, guardian: Address): void;
39
+ /**
40
+ * Returns true if transaction.relayer is set; returns false otherwise;
41
+ */
42
+ isRelayedV3Transaction(transaction: Transaction): boolean;
43
+ /**
44
+ * Sets the least significant bit of the `options` field; also ensures that `version` >= 2
45
+ */
46
+ applyOptionsForHashSigning(transaction: Transaction): void;
47
+ private toPlainObject;
48
+ private toHexOrUndefined;
49
+ private toBase64OrUndefined;
50
+ private ensureValidTransactionFields;
51
+ }
@@ -0,0 +1,163 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
11
+ }) : function(o, v) {
12
+ o["default"] = v;
13
+ });
14
+ var __importStar = (this && this.__importStar) || function (mod) {
15
+ if (mod && mod.__esModule) return mod;
16
+ var result = {};
17
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
+ __setModuleDefault(result, mod);
19
+ return result;
20
+ };
21
+ var __importDefault = (this && this.__importDefault) || function (mod) {
22
+ return (mod && mod.__esModule) ? mod : { "default": mod };
23
+ };
24
+ Object.defineProperty(exports, "__esModule", { value: true });
25
+ exports.TransactionComputer = void 0;
26
+ const bignumber_js_1 = __importDefault(require("bignumber.js"));
27
+ const proto_1 = require("../proto");
28
+ const constants_1 = require("./constants");
29
+ const errors = __importStar(require("./errors"));
30
+ const createTransactionHasher = require("blake2b");
31
+ const createKeccakHash = require("keccak");
32
+ const TRANSACTION_HASH_LENGTH = 32;
33
+ /**
34
+ * An utilitary class meant to work together with the {@link Transaction} class.
35
+ */
36
+ class TransactionComputer {
37
+ constructor() { }
38
+ computeTransactionFee(transaction, networkConfig) {
39
+ const moveBalanceGas = BigInt(networkConfig.minGasLimit + BigInt(transaction.data.length) * networkConfig.gasPerDataByte);
40
+ if (moveBalanceGas > transaction.gasLimit) {
41
+ throw new errors.ErrNotEnoughGas(parseInt(transaction.gasLimit.toString(), 10));
42
+ }
43
+ const gasPrice = transaction.gasPrice;
44
+ const feeForMove = moveBalanceGas * gasPrice;
45
+ if (moveBalanceGas === transaction.gasLimit) {
46
+ return feeForMove;
47
+ }
48
+ const diff = transaction.gasLimit - moveBalanceGas;
49
+ const modifiedGasPrice = BigInt(new bignumber_js_1.default(gasPrice.toString()).multipliedBy(new bignumber_js_1.default(networkConfig.gasPriceModifier)).toFixed(0));
50
+ const processingFee = diff * modifiedGasPrice;
51
+ return feeForMove + processingFee;
52
+ }
53
+ /**
54
+ * Compute bytes for signing the transaction
55
+ */
56
+ computeBytesForSigning(transaction) {
57
+ this.ensureValidTransactionFields(transaction);
58
+ const plainTransaction = this.toPlainObject(transaction);
59
+ const serialized = JSON.stringify(plainTransaction);
60
+ return new Uint8Array(Buffer.from(serialized));
61
+ }
62
+ /**
63
+ * Compute bytes for verifying the transaction signature
64
+ */
65
+ computeBytesForVerifying(transaction) {
66
+ const isTxSignedByHash = this.hasOptionsSetForHashSigning(transaction);
67
+ if (isTxSignedByHash) {
68
+ return this.computeHashForSigning(transaction);
69
+ }
70
+ return this.computeBytesForSigning(transaction);
71
+ }
72
+ /**
73
+ * Serializes the transaction then computes the hash; used for hash signing transactions.
74
+ */
75
+ computeHashForSigning(transaction) {
76
+ const plainTransaction = this.toPlainObject(transaction);
77
+ const signable = Buffer.from(JSON.stringify(plainTransaction));
78
+ return createKeccakHash("keccak256").update(signable).digest();
79
+ }
80
+ computeTransactionHash(transaction) {
81
+ const serializer = new proto_1.ProtoSerializer();
82
+ const buffer = serializer.serializeTransaction(transaction);
83
+ const hash = createTransactionHasher(TRANSACTION_HASH_LENGTH).update(buffer).digest("hex");
84
+ return Buffer.from(hash, "hex").toString("hex");
85
+ }
86
+ /**
87
+ * Returns true if the second least significant bit is set; returns false otherwise
88
+ */
89
+ hasOptionsSetForGuardedTransaction(transaction) {
90
+ return (transaction.options & constants_1.TRANSACTION_OPTIONS_TX_GUARDED) == constants_1.TRANSACTION_OPTIONS_TX_GUARDED;
91
+ }
92
+ /**
93
+ * Returns true if the least significant bit is set; returns false otherwise; should also have transaction.version >= 2
94
+ */
95
+ hasOptionsSetForHashSigning(transaction) {
96
+ return (transaction.options & constants_1.TRANSACTION_OPTIONS_TX_HASH_SIGN) == constants_1.TRANSACTION_OPTIONS_TX_HASH_SIGN;
97
+ }
98
+ /**
99
+ * Sets guardian address, transaction.version = 2, sets transaction.options second least significant bit
100
+ */
101
+ applyGuardian(transaction, guardian) {
102
+ if (transaction.version < constants_1.MIN_TRANSACTION_VERSION_THAT_SUPPORTS_OPTIONS) {
103
+ transaction.version = constants_1.MIN_TRANSACTION_VERSION_THAT_SUPPORTS_OPTIONS;
104
+ }
105
+ transaction.options = transaction.options | constants_1.TRANSACTION_OPTIONS_TX_GUARDED;
106
+ transaction.guardian = guardian;
107
+ }
108
+ /**
109
+ * Returns true if transaction.relayer is set; returns false otherwise;
110
+ */
111
+ isRelayedV3Transaction(transaction) {
112
+ return !transaction.relayer.isEmpty();
113
+ }
114
+ /**
115
+ * Sets the least significant bit of the `options` field; also ensures that `version` >= 2
116
+ */
117
+ applyOptionsForHashSigning(transaction) {
118
+ if (transaction.version < constants_1.MIN_TRANSACTION_VERSION_THAT_SUPPORTS_OPTIONS) {
119
+ transaction.version = constants_1.MIN_TRANSACTION_VERSION_THAT_SUPPORTS_OPTIONS;
120
+ }
121
+ transaction.options = transaction.options | constants_1.TRANSACTION_OPTIONS_TX_HASH_SIGN;
122
+ }
123
+ toPlainObject(transaction, withSignature) {
124
+ let obj = {
125
+ nonce: Number(transaction.nonce),
126
+ value: transaction.value.toString(),
127
+ receiver: transaction.receiver.toBech32(),
128
+ sender: transaction.sender.toBech32(),
129
+ senderUsername: this.toBase64OrUndefined(transaction.senderUsername),
130
+ receiverUsername: this.toBase64OrUndefined(transaction.receiverUsername),
131
+ gasPrice: Number(transaction.gasPrice),
132
+ gasLimit: Number(transaction.gasLimit),
133
+ data: this.toBase64OrUndefined(transaction.data),
134
+ };
135
+ if (withSignature) {
136
+ obj.signature = this.toHexOrUndefined(transaction.signature);
137
+ }
138
+ obj.chainID = transaction.chainID;
139
+ obj.version = transaction.version;
140
+ obj.options = transaction.options ? transaction.options : undefined;
141
+ obj.guardian = transaction.guardian.isEmpty() ? undefined : transaction.guardian.toBech32();
142
+ obj.relayer = transaction.relayer?.isEmpty() ? undefined : transaction.relayer?.toBech32();
143
+ return obj;
144
+ }
145
+ toHexOrUndefined(value) {
146
+ return value && value.length ? Buffer.from(value).toString("hex") : undefined;
147
+ }
148
+ toBase64OrUndefined(value) {
149
+ return value && value.length ? Buffer.from(value).toString("base64") : undefined;
150
+ }
151
+ ensureValidTransactionFields(transaction) {
152
+ if (!transaction.chainID.length) {
153
+ throw new errors.ErrBadUsage("The `chainID` field is not set");
154
+ }
155
+ if (transaction.version < constants_1.MIN_TRANSACTION_VERSION_THAT_SUPPORTS_OPTIONS) {
156
+ if (this.hasOptionsSetForGuardedTransaction(transaction) || this.hasOptionsSetForHashSigning(transaction)) {
157
+ throw new errors.ErrBadUsage(`Non-empty transaction options requires transaction version >= ${constants_1.MIN_TRANSACTION_VERSION_THAT_SUPPORTS_OPTIONS}`);
158
+ }
159
+ }
160
+ }
161
+ }
162
+ exports.TransactionComputer = TransactionComputer;
163
+ //# sourceMappingURL=transactionComputer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transactionComputer.js","sourceR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AO,KAAK,IAAI,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IACrF,CAAC;IAEO,4BAA4B,CAAC,WAAwB;QACzD,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,MAAM,EAAE;YAC7B,MAAM,IAAI,MAAM,CAAC,WAAW,CAAC,gCAAgC,CAAC,CAAC;SAClE;QAED,IAAI,WAAW,CAAC,OAAO,GAAG,yDAA6C,EAAE;YACrE,IAAI,IAAI,CAAC,kCAAkC,CAAC,WAAW,CAAC,IAAI,IAAI,CAAC,2BAA2B,CAAC,WAAW,CAAC,EAAE;gBACvG,MAAM,IAAI,MAAM,CAAC,WAAW,CACxB,iEAAiE,yDAA6C,EAAE,CACnH,CAAC;aACL;SACJ;IACL,CAAC;CACJ;AA/JD,kDA+JC"}
@@ -0,0 +1,17 @@
1
+ import { Address } from "./address";
2
+ export declare class TransactionEvent {
3
+ raw: Record<string, any>;
4
+ address: Address;
5
+ identifier: string;
6
+ topics: Uint8Array[];
7
+ data: Uint8Array;
8
+ additionalData: Uint8Array[];
9
+ constructor(init?: Partial<TransactionEvent>);
10
+ static fromHttpResponse(responsePart: {
11
+ address: string;
12
+ identifier: string;
13
+ topics: string[];
14
+ data: string;
15
+ additionalData?: string[];
16
+ }): TransactionEvent;
17
+ }
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TransactionEvent = void 0;
4
+ const address_1 = require("./address");
5
+ class TransactionEvent {
6
+ constructor(init) {
7
+ this.raw = {};
8
+ this.address = address_1.Address.empty();
9
+ this.identifier = "";
10
+ this.topics = [];
11
+ this.data = new Uint8Array();
12
+ this.additionalData = [];
13
+ Object.assign(this, init);
14
+ }
15
+ static fromHttpResponse(responsePart) {
16
+ let result = new TransactionEvent();
17
+ result.address = new address_1.Address(responsePart.address);
18
+ result.identifier = responsePart.identifier || "";
19
+ result.topics = (responsePart.topics || []).map((topic) => Buffer.from(topic, "base64"));
20
+ result.data = Buffer.from(responsePart.data ?? "", "base64");
21
+ result.additionalData = (responsePart.additionalData || []).map((data) => Buffer.from(data, "base64"));
22
+ result.raw = responsePart;
23
+ return result;
24
+ }
25
+ }
26
+ exports.TransactionEvent = TransactionEvent;
27
+ //# sourceMappingURL=transactionEvents.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transactionEvents.js","sourceRoot":"","sources":["../../src/core/transactionEvents.ts"],"names":[],"mappings":";;;AAAA,uCAAoC;AAEpC,MAAa,gBAAgB;IASzB,YAAY,IAAgC;QAR5C,QAAG,GAAwB,EAAE,CAAC;QAC9B,YAAO,GAAY,iBAAO,CAAC,KAAK,EAAE,CAAC;QACnC,eAAU,GAAW,EAAE,CAAC;QACxB,WAAM,GAAiB,EAAE,CAAC;QAE1B,SAAI,GAAe,IAAI,UAAU,EAAE,CAAC;QACpC,mBAAc,GAAiB,EAAE,CAAC;QAG9B,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IAC9B,CAAC;IAED,MAAM,CAAC,gBAAgB,CAAC,YAMvB;QACG,IAAI,MAAM,GAAG,IAAI,gBAAgB,EAAE,CAAC;QACpC,MAAM,CAAC,OAAO,GAAG,IAAI,iBAAO,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;QACnD,MAAM,CAAC,UAAU,GAAG,YAAY,CAAC,UAAU,IAAI,EAAE,CAAC;QAClD,MAAM,CAAC,MAAM,GAAG,CAAC,YAAY,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC;QAEzF,MAAM,CAAC,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,IAAI,IAAI,EAAE,EAAE,QAAQ,CAAC,CAAC;QAC7D,MAAM,CAAC,cAAc,GAAG,CAAC,YAAY,CAAC,cAAc,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC;QACvG,MAAM,CAAC,GAAG,GAAG,YAAY,CAAC;QAE1B,OAAO,MAAM,CAAC;IAClB,CAAC;CACJ;AA/BD,4CA+BC"}
@@ -0,0 +1,11 @@
1
+ import { Address } from "./address";
2
+ import { TransactionEvent } from "./transactionEvents";
3
+ export declare class TransactionLogs {
4
+ address: Address;
5
+ events: TransactionEvent[];
6
+ constructor(init?: Partial<TransactionLogs>);
7
+ static fromHttpResponse(logs: any): TransactionLogs;
8
+ findSingleOrNoneEvent(identifier: string, predicate?: (event: TransactionEvent) => boolean): TransactionEvent | undefined;
9
+ findFirstOrNoneEvent(identifier: string, predicate?: (event: TransactionEvent) => boolean): TransactionEvent | undefined;
10
+ findEvents(identifier: string, predicate?: (event: TransactionEvent) => boolean): TransactionEvent[];
11
+ }
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TransactionLogs = void 0;
4
+ const address_1 = require("./address");
5
+ const errors_1 = require("./errors");
6
+ const transactionEvents_1 = require("./transactionEvents");
7
+ class TransactionLogs {
8
+ constructor(init) {
9
+ this.address = address_1.Address.empty();
10
+ this.events = [];
11
+ Object.assign(this, init);
12
+ }
13
+ static fromHttpResponse(logs) {
14
+ let result = new TransactionLogs();
15
+ result.address = new address_1.Address(logs.address);
16
+ result.events = (logs.events || []).map((event) => transactionEvents_1.TransactionEvent.fromHttpResponse(event));
17
+ return result;
18
+ }
19
+ findSingleOrNoneEvent(identifier, predicate) {
20
+ let events = this.findEvents(identifier, predicate);
21
+ if (events.length > 1) {
22
+ throw new errors_1.ErrUnexpectedCondition(`more than one event of type ${identifier}`);
23
+ }
24
+ return events[0];
25
+ }
26
+ findFirstOrNoneEvent(identifier, predicate) {
27
+ return this.findEvents(identifier, predicate)[0];
28
+ }
29
+ findEvents(identifier, predicate) {
30
+ let events = this.events.filter((event) => event.identifier == identifier);
31
+ if (predicate) {
32
+ events = events.filter((event) => predicate(event));
33
+ }
34
+ return events;
35
+ }
36
+ }
37
+ exports.TransactionLogs = TransactionLogs;
38
+ //# sourceMappingURL=transactionLogs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transactionLogs.js","sourceRoot":"","sources":["../../src/core/transactionLogs.ts"],"names":[],"mappings":";;;AAAA,uCAAoC;AACpC,qCAAkD;AAClD,2DAAuD;AAEvD,MAAa,eAAe;IAIxB,YAAY,IAA+B;QAH3C,YAAO,GAAY,iBAAO,CAAC,KAAK,EAAE,CAAC;QACnC,WAAM,GAAuB,EAAE,CAAC;QAG5B,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IAC9B,CAAC;IAED,MAAM,CAAC,gBAAgB,CAAC,IAAS;QAC7B,IAAI,MAAM,GAAG,IAAI,eAAe,EAAE,CAAC;QACnC,MAAM,CAAC,OAAO,GAAG,IAAI,iBAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAC3C,MAAM,CAAC,MAAM,GAAG,CAAC,IAAI,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,KAAU,EAAE,EAAE,CAAC,oCAAgB,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAC,CAAC;QAElG,OAAO,MAAM,CAAC;IAClB,CAAC;IAED,qBAAqB,CACjB,UAAkB,EAClB,SAAgD;QAEhD,IAAI,MAAM,GAAG,IAAI,CAAC,UAAU,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC;QAEpD,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE;YACnB,MAAM,IAAI,+BAAsB,CAAC,+BAA+B,UAAU,EAAE,CAAC,CAAC;SACjF;QAED,OAAO,MAAM,CAAC,CAAC,CAAC,CAAC;IACrB,CAAC;IAED,oBAAoB,CAChB,UAAkB,EAClB,SAAgD;QAEhD,OAAO,IAAI,CAAC,UAAU,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;IACrD,CAAC;IAED,UAAU,CAAC,UAAkB,EAAE,SAAgD;QAC3E,IAAI,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,UAAU,IAAI,UAAU,CAAC,CAAC;QAE3E,IAAI,SAAS,EAAE;YACX,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC;SACvD;QAED,OAAO,MAAM,CAAC;IAClB,CAAC;CACJ;AA7CD,0CA6CC"}
@@ -0,0 +1,40 @@
1
+ /// <reference types="node" />
2
+ import { SmartContractResult } from "../transactionsOutcomeParsers";
3
+ import { Address } from "./address";
4
+ import { Transaction } from "./transaction";
5
+ import { TransactionLogs } from "./transactionLogs";
6
+ import { TransactionStatus } from "./transactionStatus";
7
+ export declare function prepareTransactionForBroadcasting(transaction: Transaction): any;
8
+ export declare class TransactionOnNetwork {
9
+ raw: Record<string, any>;
10
+ isCompleted?: boolean;
11
+ hash: string;
12
+ type: string;
13
+ nonce: bigint;
14
+ round: bigint;
15
+ epoch: number;
16
+ value: bigint;
17
+ receiver: Address;
18
+ sender: Address;
19
+ senderShard: number;
20
+ receiverShard: number;
21
+ gasLimit: bigint;
22
+ gasPrice: bigint;
23
+ function: string;
24
+ data: Buffer;
25
+ version: number;
26
+ options: number;
27
+ signature: Uint8Array;
28
+ status: TransactionStatus;
29
+ timestamp: number;
30
+ miniblockHash: string;
31
+ blockHash: string;
32
+ smartContractResults: SmartContractResult[];
33
+ logs: TransactionLogs;
34
+ constructor(init?: Partial<TransactionOnNetwork>);
35
+ static fromProxyHttpResponse(txHash: string, response: any, processStatus?: TransactionStatus | undefined): TransactionOnNetwork;
36
+ static fromSimulateResponse(originalTx: Transaction, response: any): TransactionOnNetwork;
37
+ static fromApiHttpResponse(txHash: string, response: any): TransactionOnNetwork;
38
+ private static fromHttpResponse;
39
+ getDateTime(): Date;
40
+ }
@@ -0,0 +1,164 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TransactionOnNetwork = exports.prepareTransactionForBroadcasting = void 0;
4
+ const transactionsOutcomeParsers_1 = require("../transactionsOutcomeParsers");
5
+ const address_1 = require("./address");
6
+ const transactionLogs_1 = require("./transactionLogs");
7
+ const transactionStatus_1 = require("./transactionStatus");
8
+ function prepareTransactionForBroadcasting(transaction) {
9
+ return {
10
+ nonce: Number(transaction.nonce),
11
+ value: transaction.value.toString(),
12
+ receiver: transaction.receiver.toBech32(),
13
+ sender: transaction.sender.toBech32(),
14
+ senderUsername: transaction.senderUsername
15
+ ? Buffer.from(transaction.senderUsername).toString("base64")
16
+ : undefined,
17
+ receiverUsername: transaction.receiverUsername
18
+ ? Buffer.from(transaction.receiverUsername).toString("base64")
19
+ : undefined,
20
+ gasPrice: Number(transaction.gasPrice),
21
+ gasLimit: Number(transaction.gasLimit),
22
+ data: transaction.data.length === 0 ? undefined : Buffer.from(transaction.data).toString("base64"),
23
+ chainID: transaction.chainID,
24
+ version: transaction.version,
25
+ options: transaction.options,
26
+ guardian: transaction.guardian.isEmpty() ? undefined : transaction.guardian.toBech32(),
27
+ signature: Buffer.from(transaction.signature).toString("hex"),
28
+ guardianSignature: transaction.guardianSignature.length === 0
29
+ ? undefined
30
+ : Buffer.from(transaction.guardianSignature).toString("hex"),
31
+ relayer: transaction.relayer.isEmpty() ? undefined : transaction.relayer.toBech32(),
32
+ relayerSignature: transaction.relayerSignature.length === 0
33
+ ? undefined
34
+ : Buffer.from(transaction.relayerSignature).toString("hex"),
35
+ };
36
+ }
37
+ exports.prepareTransactionForBroadcasting = prepareTransactionForBroadcasting;
38
+ class TransactionOnNetwork {
39
+ constructor(init) {
40
+ this.raw = {};
41
+ this.hash = "";
42
+ this.type = "";
43
+ this.nonce = 0n;
44
+ this.round = 0n;
45
+ this.epoch = 0;
46
+ this.value = 0n;
47
+ this.receiver = address_1.Address.empty();
48
+ this.sender = address_1.Address.empty();
49
+ this.senderShard = 0;
50
+ this.receiverShard = 0;
51
+ this.gasLimit = 0n;
52
+ this.gasPrice = 0n;
53
+ this.function = "";
54
+ this.data = Buffer.from([]);
55
+ this.version = 0;
56
+ this.options = 0;
57
+ this.signature = new Uint8Array();
58
+ this.status = transactionStatus_1.TransactionStatus.createUnknown();
59
+ this.timestamp = 0;
60
+ this.miniblockHash = "";
61
+ this.blockHash = "";
62
+ this.smartContractResults = [];
63
+ this.logs = new transactionLogs_1.TransactionLogs();
64
+ Object.assign(this, init);
65
+ }
66
+ static fromProxyHttpResponse(txHash, response, processStatus) {
67
+ const result = TransactionOnNetwork.fromHttpResponse(txHash, response);
68
+ result.smartContractResults =
69
+ response.smartContractResults?.map((result) => new transactionsOutcomeParsers_1.SmartContractResult({
70
+ ...result,
71
+ receiver: result.receiver ? new address_1.Address(result.receiver) : undefined,
72
+ sender: result.sender ? new address_1.Address(result.sender) : undefined,
73
+ data: Buffer.from(result.data ?? "", "utf-8"),
74
+ raw: result,
75
+ })) ?? [];
76
+ if (processStatus) {
77
+ result.status = processStatus;
78
+ result.isCompleted = result.status.isSuccessful() || result.status.isFailed();
79
+ }
80
+ return result;
81
+ }
82
+ static fromSimulateResponse(originalTx, response) {
83
+ const status = new transactionStatus_1.TransactionStatus(response["status"]);
84
+ const txHash = response["hash"] ?? "";
85
+ const scResults = [];
86
+ const results = response["scResults"] || {};
87
+ for (const hash in results) {
88
+ const result = results[hash];
89
+ const scResult = new transactionsOutcomeParsers_1.SmartContractResult({
90
+ ...result,
91
+ receiver: result.receiver ? new address_1.Address(result.receiver) : undefined,
92
+ sender: result.sender ? new address_1.Address(result.sender) : undefined,
93
+ raw: result,
94
+ });
95
+ scResults.push(scResult);
96
+ }
97
+ let result = new TransactionOnNetwork();
98
+ result.hash = txHash;
99
+ result.type = response.type || "";
100
+ result.nonce = BigInt(originalTx.nonce || 0);
101
+ result.round = -1n;
102
+ result.epoch = -1;
103
+ result.value = BigInt((originalTx.value || 0).toString());
104
+ result.sender = new address_1.Address(originalTx.sender);
105
+ result.receiver = new address_1.Address(originalTx.receiver);
106
+ result.gasPrice = BigInt(originalTx.gasPrice) || 0n;
107
+ result.gasLimit = BigInt(originalTx.gasLimit) || 0n;
108
+ result.function = "";
109
+ result.data = originalTx.data ? Buffer.from(originalTx.data?.toString()) : Buffer.from("");
110
+ result.version = originalTx.version || 1;
111
+ result.options = originalTx.options || 0;
112
+ result.timestamp = 0;
113
+ result.miniblockHash = "";
114
+ result.blockHash = "";
115
+ result.logs = transactionLogs_1.TransactionLogs.fromHttpResponse(response.logs || {});
116
+ result.raw = response;
117
+ result.smartContractResults = scResults;
118
+ result.status = status;
119
+ result.isCompleted = status.isSuccessful() || status.isFailed();
120
+ return result;
121
+ }
122
+ static fromApiHttpResponse(txHash, response) {
123
+ const result = TransactionOnNetwork.fromHttpResponse(txHash, response);
124
+ result.smartContractResults =
125
+ response.results?.map((result) => new transactionsOutcomeParsers_1.SmartContractResult({
126
+ ...result,
127
+ receiver: result.receiver ? new address_1.Address(result.receiver) : undefined,
128
+ sender: result.sender ? new address_1.Address(result.sender) : undefined,
129
+ data: Buffer.from(result.data ?? "", "base64"),
130
+ raw: result,
131
+ })) ?? [];
132
+ result.isCompleted = !result.status.isPending();
133
+ return result;
134
+ }
135
+ static fromHttpResponse(txHash, response) {
136
+ let result = new TransactionOnNetwork();
137
+ result.hash = txHash;
138
+ result.type = response.type || "";
139
+ result.nonce = BigInt(response.nonce || 0);
140
+ result.round = BigInt(response.round || 0);
141
+ result.epoch = response.epoch || 0;
142
+ result.value = BigInt((response.value || 0).toString());
143
+ result.sender = new address_1.Address(response.sender);
144
+ result.receiver = new address_1.Address(response.receiver);
145
+ result.gasPrice = BigInt(response.gasPrice) || 0n;
146
+ result.gasLimit = BigInt(response.gasLimit) || 0n;
147
+ result.function = response.function || "";
148
+ result.version = response.version || 1;
149
+ result.options = response.options || 0;
150
+ result.data = Buffer.from(response.data || "", "base64");
151
+ result.status = new transactionStatus_1.TransactionStatus(response.status);
152
+ result.timestamp = response.timestamp || 0;
153
+ result.miniblockHash = response.miniblockHash || "";
154
+ result.blockHash = response.blockHash || "";
155
+ result.logs = transactionLogs_1.TransactionLogs.fromHttpResponse(response.logs || {});
156
+ result.raw = response;
157
+ return result;
158
+ }
159
+ getDateTime() {
160
+ return new Date(this.timestamp * 1000);
161
+ }
162
+ }
163
+ exports.TransactionOnNetwork = TransactionOnNetwork;
164
+ //# sourceMappingURL=transactionOnNetwork.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transactionOnNetwork.js","sourceRoot":"","sources":["../../src/core/transactionOnNetwork.ts"],"names":[],"mappings":";;;AAAA,8EAAoE;AACpE,uCAAoC;AAEpC,uDAAoD;AACpD,2DAAwD;AAExD,SAAgB,iCAAiC,CAAC,WAAwB;IACtE,OAAO;QACH,KAAK,EAAE,MAAM,CAAC,WAAW,CAAC,KAAK,CAAC;QAChC,KAAK,EAAE,WAAW,CAAC,KAAK,CAAC,QAAQ,EAAE;QACnC,QAAQ,EAAE,WAAW,CAAC,QAAQ,CAAC,QAAQ,EAAE;QACzC,MAAM,EAAE,WAAW,CAAC,MAAM,CAAC,QAAQ,EAAE;QACrC,cAAc,EAAE,WAAW,CAAC,cAAc;YACtC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,cAAc,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC;YAC5D,CAAC,CAAC,SAAS;QACf,gBAAgB,EAAE,WAAW,CAAC,gBAAgB;YAC1C,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,gBAAgB,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC;YAC9D,CAA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CAAC;QACvC,MAAM,CAAC,OAAO,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;QACvC,MAAM,CAAC,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,IAAI,EAAE,EAAE,QAAQ,CAAC,CAAC;QACzD,MAAM,CAAC,MAAM,GAAG,IAAI,qCAAiB,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;QACvD,MAAM,CAAC,SAAS,GAAG,QAAQ,CAAC,SAAS,IAAI,CAAC,CAAC;QAC3C,MAAM,CAAC,aAAa,GAAG,QAAQ,CAAC,aAAa,IAAI,EAAE,CAAC;QACpD,MAAM,CAAC,SAAS,GAAG,QAAQ,CAAC,SAAS,IAAI,EAAE,CAAC;QAC5C,MAAM,CAAC,IAAI,GAAG,iCAAe,CAAC,gBAAgB,CAAC,QAAQ,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC;QACpE,MAAM,CAAC,GAAG,GAAG,QAAQ,CAAC;QAEtB,OAAO,MAAM,CAAC;IAClB,CAAC;IAED,WAAW;QACP,OAAO,IAAI,IAAI,CAAC,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,CAAC;IAC3C,CAAC;CACJ;AArJD,oDAqJC"}
@@ -0,0 +1,45 @@
1
+ /**
2
+ * An abstraction for handling and interpreting the "status" field of a transaction.
3
+ */
4
+ export declare class TransactionStatus {
5
+ /**
6
+ * The raw status, as fetched from the Network.
7
+ */
8
+ readonly status: string;
9
+ /**
10
+ * Creates a new TransactionStatus object.
11
+ */
12
+ constructor(status: string);
13
+ /**
14
+ * Creates an unknown status.
15
+ */
16
+ static createUnknown(): TransactionStatus;
17
+ /**
18
+ * Returns whether the transaction is pending (e.g. in mempool).
19
+ */
20
+ isPending(): boolean;
21
+ /**
22
+ * Returns whether the transaction has been executed (not necessarily with success).
23
+ * @deprecated This will be remove next version, please use {@link isCompleted} instead.
24
+ */
25
+ isExecuted(): boolean;
26
+ /**
27
+ * Returns whether the transaction has been conpleted (not necessarily with success).
28
+ */
29
+ isCompleted(): boolean;
30
+ /**
31
+ * Returns whether the transaction has been executed successfully.
32
+ */
33
+ isSuccessful(): boolean;
34
+ /**
35
+ * Returns whether the transaction has been executed, but with a failure.
36
+ */
37
+ isFailed(): boolean;
38
+ /**
39
+ * Returns whether the transaction has been executed, but marked as invalid (e.g. due to "insufficient funds").
40
+ */
41
+ isInvalid(): boolean;
42
+ toString(): string;
43
+ valueOf(): string;
44
+ equals(other: TransactionStatus): boolean;
45
+ }