@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,205 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GovernanceController = void 0;
4
+ const abi_1 = require("../abi");
5
+ const core_1 = require("../core");
6
+ const constants_1 = require("../core/constants");
7
+ const smartContracts_1 = require("../smartContracts");
8
+ const governanceTransactionsFactory_1 = require("./governanceTransactionsFactory");
9
+ const governanceTransactionsOutcomeParser_1 = require("./governanceTransactionsOutcomeParser");
10
+ class GovernanceController extends core_1.BaseController {
11
+ constructor(options) {
12
+ super();
13
+ this.governanceFactory = new governanceTransactionsFactory_1.GovernanceTransactionsFactory({
14
+ config: new core_1.TransactionsFactoryConfig({ chainID: options.chainID }),
15
+ });
16
+ this.smartContractController = new smartContracts_1.SmartContractController({
17
+ chainID: options.chainID,
18
+ networkProvider: options.networkProvider,
19
+ });
20
+ this.addressHrp = options.addressHrp ?? core_1.LibraryConfig.DefaultAddressHrp;
21
+ this.parser = new governanceTransactionsOutcomeParser_1.GovernanceTransactionsOutcomeParser({ addressHrp: this.addressHrp });
22
+ this.governanceContract = core_1.Address.newFromHex(constants_1.GOVERNANCE_CONTRACT_ADDRESS_HEX, this.addressHrp);
23
+ this.transactionAwaiter = new core_1.TransactionWatcher(options.networkProvider);
24
+ this.serializer = new abi_1.ArgSerializer();
25
+ }
26
+ async createTransactionForNewProposal(sender, nonce, options) {
27
+ const transaction = this.governanceFactory.createTransactionForNewProposal(sender.address, options);
28
+ transaction.guardian = options.guardian ?? core_1.Address.empty();
29
+ transaction.relayer = options.relayer ?? core_1.Address.empty();
30
+ transaction.nonce = nonce;
31
+ this.setTransactionGasOptions(transaction, options);
32
+ this.setVersionAndOptionsForGuardian(transaction);
33
+ transaction.signature = await sender.signTransaction(transaction);
34
+ return transaction;
35
+ }
36
+ parseNewProposal(transaction) {
37
+ return this.parser.parseNewProposal(transaction);
38
+ }
39
+ async awaitCompletedProposeProposal(txHash) {
40
+ const transaction = await this.transactionAwaiter.awaitCompleted(txHash);
41
+ return this.parseNewProposal(transaction);
42
+ }
43
+ async createTransactionForVoting(sender, nonce, options) {
44
+ const transaction = this.governanceFactory.createTransactionForVoting(sender.address, options);
45
+ transaction.guardian = options.guardian ?? core_1.Address.empty();
46
+ transaction.relayer = options.relayer ?? core_1.Address.empty();
47
+ transaction.nonce = nonce;
48
+ this.setTransactionGasOptions(transaction, options);
49
+ this.setVersionAndOptionsForGuardian(transaction);
50
+ transaction.signature = await sender.signTransaction(transaction);
51
+ return transaction;
52
+ }
53
+ parseVote(transaction) {
54
+ return this.parser.parseVote(transaction);
55
+ }
56
+ async awaitCompletedVote(txHash) {
57
+ const transaction = await this.transactionAwaiter.awaitCompleted(txHash);
58
+ return this.parseVote(transaction);
59
+ }
60
+ async createTransactionForClosingProposal(sender, nonce, options) {
61
+ const transaction = this.governanceFactory.createTransactionForClosingProposal(sender.address, options);
62
+ transaction.guardian = options.guardian ?? core_1.Address.empty();
63
+ transaction.relayer = options.relayer ?? core_1.Address.empty();
64
+ transaction.nonce = nonce;
65
+ this.setTransactionGasOptions(transaction, options);
66
+ this.setVersionAndOptionsForGuardian(transaction);
67
+ transaction.signature = await sender.signTransaction(transaction);
68
+ return transaction;
69
+ }
70
+ parseCloseProposal(transaction) {
71
+ return this.parser.parseCloseProposal(transaction);
72
+ }
73
+ async awaitCompletedCloseProposal(txHash) {
74
+ const transaction = await this.transactionAwaiter.awaitCompleted(txHash);
75
+ return this.parseCloseProposal(transaction);
76
+ }
77
+ async createTransactionForClearingEndedProposals(sender, nonce, options) {
78
+ const transaction = this.governanceFactory.createTransactionForClearingEndedProposals(sender.address, options);
79
+ transaction.guardian = options.guardian ?? core_1.Address.empty();
80
+ transaction.relayer = options.relayer ?? core_1.Address.empty();
81
+ transaction.nonce = nonce;
82
+ this.setTransactionGasOptions(transaction, options);
83
+ this.setVersionAndOptionsForGuardian(transaction);
84
+ transaction.signature = await sender.signTransaction(transaction);
85
+ return transaction;
86
+ }
87
+ async createTransactionForClaimingAccumulatedFees(sender, nonce, options) {
88
+ const transaction = this.governanceFactory.createTransactionForClaimingAccumulatedFees(sender.address);
89
+ transaction.guardian = options.guardian ?? core_1.Address.empty();
90
+ transaction.relayer = options.relayer ?? core_1.Address.empty();
91
+ transaction.nonce = nonce;
92
+ this.setTransactionGasOptions(transaction, options);
93
+ this.setVersionAndOptionsForGuardian(transaction);
94
+ transaction.signature = await sender.signTransaction(transaction);
95
+ return transaction;
96
+ }
97
+ async createTransactionForChangingConfig(sender, nonce, options) {
98
+ const transaction = this.governanceFactory.createTransactionForChangingConfig(sender.address, options);
99
+ transaction.guardian = options.guardian ?? core_1.Address.empty();
100
+ transaction.relayer = options.relayer ?? core_1.Address.empty();
101
+ transaction.nonce = nonce;
102
+ this.setTransactionGasOptions(transaction, options);
103
+ this.setVersionAndOptionsForGuardian(transaction);
104
+ transaction.signature = await sender.signTransaction(transaction);
105
+ return transaction;
106
+ }
107
+ async getVotingPower(address) {
108
+ const result = await this.smartContractController.query({
109
+ contract: this.governanceContract,
110
+ function: "viewVotingPower",
111
+ arguments: [new abi_1.AddressValue(address)],
112
+ });
113
+ const votingPower = { type: new abi_1.BigUIntType() };
114
+ const data = this.serializer.buffersToValues(result, [votingPower]);
115
+ return BigInt(data[0].valueOf().toFixed());
116
+ }
117
+ async getConfig() {
118
+ const result = await this.smartContractController.query({
119
+ contract: this.governanceContract,
120
+ function: "viewConfig",
121
+ arguments: [],
122
+ });
123
+ const proposalFee = BigInt(Buffer.from(result[0]).toString());
124
+ const lostProposalFee = BigInt(Buffer.from(result[1]).toString());
125
+ const minQuorum = Number(Buffer.from(result[2]).toString());
126
+ const minVetoThreshold = Number(Buffer.from(result[3]).toString());
127
+ const minPassThreshold = Number(Buffer.from(result[4]).toString());
128
+ const lastProposalNonce = Number(Buffer.from(result[5]).toString());
129
+ return {
130
+ proposalFee,
131
+ lostProposalFee,
132
+ minQuorum,
133
+ minVetoThreshold,
134
+ minPassThreshold,
135
+ lastProposalNonce,
136
+ };
137
+ }
138
+ async getProposal(proposalNonce) {
139
+ const result = await this.smartContractController.query({
140
+ contract: this.governanceContract,
141
+ function: "viewProposal",
142
+ arguments: [new abi_1.BigUIntValue(proposalNonce)],
143
+ });
144
+ const proposalCost = { type: new abi_1.BigUIntType() };
145
+ const commitHash = { type: new abi_1.StringType() };
146
+ const nonce = { type: new abi_1.BigUIntType() };
147
+ const issuer = { type: new abi_1.AddressType() };
148
+ const startVoteEpoch = { type: new abi_1.BigUIntType() };
149
+ const endVoteEpoch = { type: new abi_1.BigUIntType() };
150
+ const quorumStake = { type: new abi_1.BigUIntType() };
151
+ const numVotesYes = { type: new abi_1.BigUIntType() };
152
+ const numVotesNo = { type: new abi_1.BigUIntType() };
153
+ const numVotesVeto = { type: new abi_1.BigUIntType() };
154
+ const numVotesAbstain = { type: new abi_1.BigUIntType() };
155
+ const data = this.serializer.buffersToValues(result.slice(0, 11), [
156
+ proposalCost,
157
+ commitHash,
158
+ nonce,
159
+ issuer,
160
+ startVoteEpoch,
161
+ endVoteEpoch,
162
+ quorumStake,
163
+ numVotesYes,
164
+ numVotesNo,
165
+ numVotesVeto,
166
+ numVotesAbstain,
167
+ ]);
168
+ const isClosed = Buffer.from(result[11]).toString() === "true";
169
+ const isPassed = Buffer.from(result[12]).toString() === "true";
170
+ return {
171
+ cost: BigInt(data[0].valueOf().toFixed()),
172
+ commitHash: data[1].valueOf(),
173
+ nonce: Number(data[2].valueOf().toString()),
174
+ issuer: data[3].valueOf(),
175
+ startVoteEpoch: Number(data[4].valueOf().toString()),
176
+ endVoteEpoch: Number(data[5].valueOf().toString()),
177
+ quorumStake: BigInt(data[6].valueOf().toFixed()),
178
+ numYesVotes: BigInt(data[7].valueOf().toFixed()),
179
+ numNoVotes: BigInt(data[8].valueOf().toFixed()),
180
+ numVetoVotes: BigInt(data[9].valueOf().toFixed()),
181
+ numAbstainVotes: BigInt(data[10].valueOf().toFixed()),
182
+ isClosed: isClosed,
183
+ isPassed: isPassed,
184
+ };
185
+ }
186
+ async getDelegatedVoteInfo() {
187
+ const result = await this.smartContractController.query({
188
+ contract: this.governanceContract,
189
+ function: "viewDelegatedVoteInfo",
190
+ arguments: [],
191
+ });
192
+ const usedStake = BigInt(Buffer.from(result[0]).toString());
193
+ const usedPower = BigInt(Buffer.from(result[1]).toString());
194
+ const totalStake = BigInt(Buffer.from(result[2]).toString());
195
+ const totalPower = BigInt(Buffer.from(result[3]).toString());
196
+ return {
197
+ usedStake,
198
+ usedPower,
199
+ totalStake,
200
+ totalPower,
201
+ };
202
+ }
203
+ }
204
+ exports.GovernanceController = GovernanceController;
205
+ //# sourceMappingURL=governanceController.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"governanceController.js","sourceRoot":"","sources":["../../src/governance/governanceController.ts"],"names":[],"mappings":";;;AAAA,gCAAyG;AACzG,kCAUiB;AACjB,iDAAoE;AAEpE,sDAA4D;AAC5D,mFAAgF;AAChF,+FAA4F;AAe5F,MAAa,oBAAqB,SAAQ,qBAAc;IASpD,YAAY,OAAoF;QAC5F,KAAK,EAAE,CAAC;QACR,IAAI,CAAC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AAM,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC;QAC5D,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC;QAC7D,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC;QAE7D,OAAO;YACH,SAAS;YACT,SAAS;YACT,UAAU;YACV,UAAU;SACb,CAAC;IACN,CAAC;CACJ;AAtQD,oDAsQC"}
@@ -0,0 +1,16 @@
1
+ import { Address, Transaction, TransactionsFactoryConfig } from "../core";
2
+ import { ChangeConfigInput, ClearEndedProposalsInput, CloseProposalInput, NewProposalInput, VoteProposalInput } from "./resources";
3
+ export declare class GovernanceTransactionsFactory {
4
+ private readonly config;
5
+ private readonly argSerializer;
6
+ private readonly governanceContract;
7
+ constructor(options: {
8
+ config: TransactionsFactoryConfig;
9
+ });
10
+ createTransactionForNewProposal(sender: Address, options: NewProposalInput): Transaction;
11
+ createTransactionForVoting(sender: Address, options: VoteProposalInput): Transaction;
12
+ createTransactionForClosingProposal(sender: Address, options: CloseProposalInput): Transaction;
13
+ createTransactionForClearingEndedProposals(sender: Address, options: ClearEndedProposalsInput): Transaction;
14
+ createTransactionForClaimingAccumulatedFees(sender: Address): Transaction;
15
+ createTransactionForChangingConfig(sender: Address, options: ChangeConfigInput): Transaction;
16
+ }
@@ -0,0 +1,99 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GovernanceTransactionsFactory = void 0;
4
+ const abi_1 = require("../abi");
5
+ const core_1 = require("../core");
6
+ const constants_1 = require("../core/constants");
7
+ const transactionBuilder_1 = require("../core/transactionBuilder");
8
+ const EXTRA_GAS_LIMIT_FOR_VOTING = 100000n;
9
+ class GovernanceTransactionsFactory {
10
+ constructor(options) {
11
+ this.config = options.config;
12
+ this.argSerializer = new abi_1.ArgSerializer();
13
+ this.governanceContract = core_1.Address.newFromHex(constants_1.GOVERNANCE_CONTRACT_ADDRESS_HEX, this.config.addressHrp);
14
+ }
15
+ createTransactionForNewProposal(sender, options) {
16
+ const args = [
17
+ new abi_1.StringValue(options.commitHash),
18
+ new abi_1.BigUIntValue(options.startVoteEpoch),
19
+ new abi_1.BigUIntValue(options.endVoteEpoch),
20
+ ];
21
+ const dataParts = ["proposal", ...this.argSerializer.valuesToStrings(args)];
22
+ return new transactionBuilder_1.TransactionBuilder({
23
+ config: this.config,
24
+ sender: sender,
25
+ receiver: this.governanceContract,
26
+ dataParts: dataParts,
27
+ gasLimit: this.config.gasLimitForProposal,
28
+ addDataMovementGas: true,
29
+ amount: options.nativeTokenAmount,
30
+ }).build();
31
+ }
32
+ createTransactionForVoting(sender, options) {
33
+ const args = [new abi_1.BigUIntValue(options.proposalNonce), new abi_1.StringValue(options.vote.valueOf())];
34
+ const dataParts = ["vote", ...this.argSerializer.valuesToStrings(args)];
35
+ return new transactionBuilder_1.TransactionBuilder({
36
+ config: this.config,
37
+ sender: sender,
38
+ receiver: this.governanceContract,
39
+ dataParts: dataParts,
40
+ gasLimit: this.config.gasLimitForVote + EXTRA_GAS_LIMIT_FOR_VOTING,
41
+ addDataMovementGas: true,
42
+ }).build();
43
+ }
44
+ createTransactionForClosingProposal(sender, options) {
45
+ const args = [new abi_1.BigUIntValue(options.proposalNonce)];
46
+ const dataParts = ["closeProposal", ...this.argSerializer.valuesToStrings(args)];
47
+ return new transactionBuilder_1.TransactionBuilder({
48
+ config: this.config,
49
+ sender: sender,
50
+ receiver: this.governanceContract,
51
+ dataParts: dataParts,
52
+ gasLimit: this.config.gasLimitForClosingProposal,
53
+ addDataMovementGas: true,
54
+ }).build();
55
+ }
56
+ createTransactionForClearingEndedProposals(sender, options) {
57
+ const dataParts = ["clearEndedProposals", ...options.proposers.map((address) => address.toHex())];
58
+ return new transactionBuilder_1.TransactionBuilder({
59
+ config: this.config,
60
+ sender: sender,
61
+ receiver: this.governanceContract,
62
+ dataParts: dataParts,
63
+ gasLimit: this.config.gasLimitForClearProposals +
64
+ BigInt(options.proposers.length) * this.config.gasLimitForClearProposals,
65
+ addDataMovementGas: true,
66
+ }).build();
67
+ }
68
+ createTransactionForClaimingAccumulatedFees(sender) {
69
+ const dataParts = ["claimAccumulatedFees"];
70
+ return new transactionBuilder_1.TransactionBuilder({
71
+ config: this.config,
72
+ sender: sender,
73
+ receiver: this.governanceContract,
74
+ dataParts: dataParts,
75
+ gasLimit: this.config.gasLimitForClaimAccumulatedFees,
76
+ addDataMovementGas: true,
77
+ }).build();
78
+ }
79
+ createTransactionForChangingConfig(sender, options) {
80
+ const args = [
81
+ new abi_1.StringValue(options.proposalFee.toString()),
82
+ new abi_1.StringValue(options.lastProposalFee.toString()),
83
+ new abi_1.StringValue(options.minQuorum.toString()),
84
+ new abi_1.StringValue(options.minVetoThreshold.toString()),
85
+ new abi_1.StringValue(options.minPassThreshold.toString()),
86
+ ];
87
+ const dataParts = ["changeConfig", ...this.argSerializer.valuesToStrings(args)];
88
+ return new transactionBuilder_1.TransactionBuilder({
89
+ config: this.config,
90
+ sender: sender,
91
+ receiver: this.governanceContract,
92
+ dataParts: dataParts,
93
+ gasLimit: this.config.gasLimitForChangeConfig,
94
+ addDataMovementGas: true,
95
+ }).build();
96
+ }
97
+ }
98
+ exports.GovernanceTransactionsFactory = GovernanceTransactionsFactory;
99
+ //# sourceMappingURL=governanceTransactionsFactory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"governanceTransactionsFactory.js","sourceRoot":"","sources":["../../src/governance/governanceTransactionsFactory.ts"],"names":[],"mappings":";;;AAAA,gCAAkE;AAClE,kCAA0E;AAC1E,iDAAoE;AACpE,mEAAgE;AAsBhE,MAAM,0BAA0B,GAAG,OAAQ,CAAC;AAE5C,MA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C,uBAAuB;YAC7C,kBAAkB,EAAE,IAAI;SAC3B,CAAC,CAAC,KAAK,EAAE,CAAC;IACf,CAAC;CACJ;AAzGD,sEAyGC"}
@@ -0,0 +1,15 @@
1
+ import { TransactionOnNetwork } from "../core";
2
+ import { CloseProposalOutcome, DelegateVoteOutcome, NewProposalOutcome, VoteOutcome } from "./resources";
3
+ export declare class GovernanceTransactionsOutcomeParser {
4
+ private addressHrp;
5
+ private serializer;
6
+ constructor(options: {
7
+ addressHrp?: string;
8
+ });
9
+ parseNewProposal(transactionOnNetwork: TransactionOnNetwork): NewProposalOutcome[];
10
+ parseVote(transactionOnNetwork: TransactionOnNetwork): VoteOutcome[];
11
+ parseDelegateVote(transactionOnNetwork: TransactionOnNetwork): DelegateVoteOutcome[];
12
+ parseCloseProposal(transactionOnNetwork: TransactionOnNetwork): CloseProposalOutcome[];
13
+ private ensureNoError;
14
+ private decodeTopicAsString;
15
+ }
@@ -0,0 +1,99 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GovernanceTransactionsOutcomeParser = void 0;
4
+ const abi_1 = require("../abi");
5
+ const core_1 = require("../core");
6
+ const transactionsOutcomeParsers_1 = require("../transactionsOutcomeParsers");
7
+ class GovernanceTransactionsOutcomeParser {
8
+ constructor(options) {
9
+ this.addressHrp = options.addressHrp ?? core_1.LibraryConfig.DefaultAddressHrp;
10
+ this.serializer = new abi_1.ArgSerializer();
11
+ }
12
+ parseNewProposal(transactionOnNetwork) {
13
+ this.ensureNoError(transactionOnNetwork.logs.events);
14
+ const events = transactionsOutcomeParsers_1.findEventsByIdentifier(transactionOnNetwork, "proposal");
15
+ const proposalNonce = { type: new abi_1.BigUIntType() };
16
+ const commitHash = { type: new abi_1.StringType() };
17
+ const startVoteEpoch = { type: new abi_1.BigUIntType() };
18
+ const endVoteEpoch = { type: new abi_1.BigUIntType() };
19
+ const outcome = [];
20
+ for (const event of events) {
21
+ const data = this.serializer.buffersToValues(event.topics.map((topic) => Buffer.from(topic)), [proposalNonce, commitHash, startVoteEpoch, endVoteEpoch]);
22
+ outcome.push({
23
+ proposalNonce: data[0].valueOf(),
24
+ commitHash: data[1].valueOf(),
25
+ startVoteEpoch: data[2].valueOf(),
26
+ endVoteEpoch: data[3].valueOf(),
27
+ });
28
+ }
29
+ return outcome;
30
+ }
31
+ parseVote(transactionOnNetwork) {
32
+ this.ensureNoError(transactionOnNetwork.logs.events);
33
+ const events = transactionsOutcomeParsers_1.findEventsByIdentifier(transactionOnNetwork, "vote");
34
+ const proposalToVote = { type: new abi_1.BigUIntType() };
35
+ const vote = { type: new abi_1.StringType() };
36
+ const totalStake = { type: new abi_1.BigUIntType() };
37
+ const votingPower = { type: new abi_1.BigUIntType() };
38
+ const outcome = [];
39
+ for (const event of events) {
40
+ const data = this.serializer.buffersToValues(event.topics.map((topic) => Buffer.from(topic)), [proposalToVote, vote, totalStake, votingPower]);
41
+ outcome.push({
42
+ proposalNonce: Number(data[0].toString()),
43
+ vote: data[1].valueOf(),
44
+ totalStake: BigInt(data[2].valueOf().toFixed()),
45
+ votingPower: BigInt(data[3].valueOf().toFixed()),
46
+ });
47
+ }
48
+ return outcome;
49
+ }
50
+ parseDelegateVote(transactionOnNetwork) {
51
+ this.ensureNoError(transactionOnNetwork.logs.events);
52
+ const events = transactionsOutcomeParsers_1.findEventsByIdentifier(transactionOnNetwork, "delegateVote");
53
+ const proposalToVote = { type: new abi_1.BigUIntType() };
54
+ const vote = { type: new abi_1.StringType() };
55
+ const voter = { type: new abi_1.AddressType() };
56
+ const userStake = { type: new abi_1.BigUIntType() };
57
+ const votingPower = { type: new abi_1.BigUIntType() };
58
+ const outcome = [];
59
+ for (const event of events) {
60
+ const data = this.serializer.buffersToValues(event.topics.map((topic) => Buffer.from(topic)), [proposalToVote, vote, voter, userStake, votingPower]);
61
+ outcome.push({
62
+ proposalNonce: Number(data[0].toString()),
63
+ vote: data[1].valueOf(),
64
+ voter: new core_1.Address(data[2].valueOf().getPublicKey(), this.addressHrp),
65
+ userStake: BigInt(data[3].valueOf().toFixed()),
66
+ votingPower: BigInt(data[4].valueOf().toFixed()),
67
+ });
68
+ }
69
+ return outcome;
70
+ }
71
+ parseCloseProposal(transactionOnNetwork) {
72
+ this.ensureNoError(transactionOnNetwork.logs.events);
73
+ const events = transactionsOutcomeParsers_1.findEventsByIdentifier(transactionOnNetwork, "closeProposal");
74
+ const outcome = [];
75
+ for (const event of events) {
76
+ const commitHash = Buffer.from(event.topics[0]).toString();
77
+ const passed = Buffer.from(event.topics[1]).toString() === "true";
78
+ outcome.push({
79
+ commitHash: commitHash,
80
+ passed: passed,
81
+ });
82
+ }
83
+ return outcome;
84
+ }
85
+ ensureNoError(transactionEvents) {
86
+ for (const event of transactionEvents) {
87
+ if (event.identifier == "signalError") {
88
+ const data = Buffer.from(event.additionalData[0]?.toString().slice(1)).toString() || "";
89
+ const message = this.decodeTopicAsString(event.topics[1]);
90
+ throw new core_1.ErrParseTransactionOutcome(`encountered signalError: ${message} (${Buffer.from(data, "hex").toString()})`);
91
+ }
92
+ }
93
+ }
94
+ decodeTopicAsString(topic) {
95
+ return Buffer.from(topic).toString();
96
+ }
97
+ }
98
+ exports.GovernanceTransactionsOutcomeParser = GovernanceTransactionsOutcomeParser;
99
+ //# sourceMappingURL=governanceTransactionsOutcomeParser.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"governanceTransactionsOutcomeParser.js","sourceRoot":"","sources":["../../src/governance/governanceTransactionsOutcomeParser.ts"],"names":[],"mappings":";;;AAAA,gCAA6E;AAC7E,kCAAqH;AACrH,8EAAuE;AAGvE,MAAa,mCAAmC;IAI5C,YAAY,OAAgC;QACxC,IAAI,CAAC,UAAU,GAAG,OAAO,CAAC,UAAU,IAAI,oBAAa,CAAC,iBAAiB,CAAC;QACxE,IAAI,CAAC,UAAU,GAAG,IAAI,mBAAa,EAAE,CAAC;IAC1C,CAAC;IAED,gBAAgB,CAAC,oBAA0C;QACvD,IAAI,CAAC,aAAa,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,CAAC,KAAiB;QACzC,OAAO,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,QAAQ,EAAE,CAAC;IACzC,CAAC;CACJ;AAlID,kFAkIC"}
@@ -0,0 +1,4 @@
1
+ export * from "./governanceController";
2
+ export * from "./governanceTransactionsFactory";
3
+ export * from "./governanceTransactionsOutcomeParser";
4
+ export * from "./resources";
@@ -0,0 +1,17 @@
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 __exportStar = (this && this.__exportStar) || function(m, exports) {
10
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
11
+ };
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ __exportStar(require("./governanceController"), exports);
14
+ __exportStar(require("./governanceTransactionsFactory"), exports);
15
+ __exportStar(require("./governanceTransactionsOutcomeParser"), exports);
16
+ __exportStar(require("./resources"), exports);
17
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/governance/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yDAAuC;AACvC,kEAAgD;AAChD,wEAAsD;AACtD,8CAA4B"}
@@ -0,0 +1,82 @@
1
+ import { Address } from "../core";
2
+ export declare type NewProposalInput = {
3
+ commitHash: string;
4
+ startVoteEpoch: number;
5
+ endVoteEpoch: number;
6
+ nativeTokenAmount: bigint;
7
+ };
8
+ export declare type VoteProposalInput = {
9
+ proposalNonce: number;
10
+ vote: Vote;
11
+ };
12
+ export declare enum Vote {
13
+ YES = "yes",
14
+ NO = "no",
15
+ ABSTAIN = "abstain",
16
+ VETO = "veto"
17
+ }
18
+ export declare type CloseProposalInput = {
19
+ proposalNonce: number;
20
+ };
21
+ export declare type ClearEndedProposalsInput = {
22
+ proposers: Address[];
23
+ };
24
+ export declare type ChangeConfigInput = {
25
+ proposalFee: bigint;
26
+ lastProposalFee: bigint;
27
+ minQuorum: number;
28
+ minVetoThreshold: number;
29
+ minPassThreshold: number;
30
+ };
31
+ export declare type NewProposalOutcome = {
32
+ proposalNonce: number;
33
+ commitHash: string;
34
+ startVoteEpoch: number;
35
+ endVoteEpoch: number;
36
+ };
37
+ export declare type VoteOutcome = {
38
+ proposalNonce: number;
39
+ vote: string;
40
+ totalStake: bigint;
41
+ votingPower: bigint;
42
+ };
43
+ export declare type DelegateVoteOutcome = {
44
+ proposalNonce: number;
45
+ vote: string;
46
+ voter: Address;
47
+ userStake: bigint;
48
+ votingPower: bigint;
49
+ };
50
+ export declare type CloseProposalOutcome = {
51
+ commitHash: string;
52
+ passed: boolean;
53
+ };
54
+ export declare type GovernanceConfig = {
55
+ proposalFee: bigint;
56
+ lostProposalFee: bigint;
57
+ minQuorum: number;
58
+ minPassThreshold: number;
59
+ minVetoThreshold: number;
60
+ lastProposalNonce: number;
61
+ };
62
+ export declare type ProposalInfo = {
63
+ cost: bigint;
64
+ commitHash: string;
65
+ nonce: number;
66
+ issuer: Address;
67
+ startVoteEpoch: number;
68
+ endVoteEpoch: number;
69
+ quorumStake: bigint;
70
+ numYesVotes: bigint;
71
+ numNoVotes: bigint;
72
+ numVetoVotes: bigint;
73
+ numAbstainVotes: bigint;
74
+ isClosed: boolean;
75
+ isPassed: boolean;
76
+ };
77
+ export declare type DelegatedVoteInfo = {
78
+ usedStake: bigint;
79
+ usedPower: bigint;
80
+ totalStake: bigint;
81
+ totalPower: bigint;
82
+ };
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Vote = void 0;
4
+ var Vote;
5
+ (function (Vote) {
6
+ Vote["YES"] = "yes";
7
+ Vote["NO"] = "no";
8
+ Vote["ABSTAIN"] = "abstain";
9
+ Vote["VETO"] = "veto";
10
+ })(Vote = exports.Vote || (exports.Vote = {}));
11
+ //# sourceMappingURL=resources.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resources.js","sourceRoot":"","sources":["../../src/governance/resources.ts"],"names":[],"mappings":";;;AAcA,IAAY,IAKX;AALD,WAAY,IAAI;IACZ,mBAAW,CAAA;IACX,iBAAS,CAAA;IACT,2BAAmB,CAAA;IACnB,qBAAa,CAAA;AACjB,CAAC,EALW,IAAI,GAAJ,YAAI,KAAJ,YAAI,QAKf"}
package/out/index.d.ts ADDED
@@ -0,0 +1,19 @@
1
+ /**
2
+ * A library for interacting with the DharitrI blockchain (in general) and Smart Contracts (in particular).
3
+ *
4
+ * @packageDocumentation
5
+ */
6
+ export * from "./abi";
7
+ export * from "./accountManagement";
8
+ export * from "./accounts";
9
+ export * from "./core";
10
+ export * from "./delegation";
11
+ export * from "./entrypoints";
12
+ export * from "./governance";
13
+ export * from "./multisig";
14
+ export * from "./networkProviders";
15
+ export * from "./smartContracts";
16
+ export * from "./tokenManagement";
17
+ export * from "./transactionsOutcomeParsers";
18
+ export * from "./transfers";
19
+ export * from "./wallet";
package/out/index.js ADDED
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ /**
3
+ * A library for interacting with the DharitrI blockchain (in general) and Smart Contracts (in particular).
4
+ *
5
+ * @packageDocumentation
6
+ */
7
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
8
+ if (k2 === undefined) k2 = k;
9
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
10
+ }) : (function(o, m, k, k2) {
11
+ if (k2 === undefined) k2 = k;
12
+ o[k2] = m[k];
13
+ }));
14
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
16
+ };
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ __exportStar(require("./abi"), exports);
19
+ __exportStar(require("./accountManagement"), exports);
20
+ __exportStar(require("./accounts"), exports);
21
+ __exportStar(require("./core"), exports);
22
+ __exportStar(require("./delegation"), exports);
23
+ __exportStar(require("./entrypoints"), exports);
24
+ __exportStar(require("./governance"), exports);
25
+ __exportStar(require("./multisig"), exports);
26
+ __exportStar(require("./networkProviders"), exports);
27
+ __exportStar(require("./smartContracts"), exports);
28
+ __exportStar(require("./tokenManagement"), exports);
29
+ __exportStar(require("./transactionsOutcomeParsers"), exports);
30
+ __exportStar(require("./transfers"), exports);
31
+ __exportStar(require("./wallet"), exports);
32
+ //# sourceMappingURL=index.js.map