@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,165 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SmartContractTransactionsFactory = void 0;
4
+ const abi_1 = require("../abi");
5
+ const core_1 = require("../core");
6
+ const constants_1 = require("../core/constants");
7
+ const errors_1 = require("../core/errors");
8
+ const logger_1 = require("../core/logger");
9
+ const tokens_1 = require("../core/tokens");
10
+ const tokenTransfersDataBuilder_1 = require("../core/tokenTransfersDataBuilder");
11
+ const transactionBuilder_1 = require("../core/transactionBuilder");
12
+ const utils_codec_1 = require("../core/utils.codec");
13
+ /**
14
+ * Use this class to create transactions to deploy, call or upgrade a smart contract.
15
+ */
16
+ class SmartContractTransactionsFactory {
17
+ constructor(options) {
18
+ this.config = options.config;
19
+ this.abi = options.abi;
20
+ this.tokenComputer = new tokens_1.TokenComputer();
21
+ this.dataArgsBuilder = new tokenTransfersDataBuilder_1.TokenTransfersDataBuilder();
22
+ this.contractDeployAddress = core_1.Address.newFromHex(constants_1.CONTRACT_DEPLOY_ADDRESS_HEX, this.config.addressHrp);
23
+ }
24
+ createTransactionForDeploy(sender, options) {
25
+ const nativeTransferAmount = options.nativeTransferAmount ?? 0n;
26
+ const isUpgradeable = options.isUpgradeable ?? true;
27
+ const isReadable = options.isReadable ?? true;
28
+ const isPayable = options.isPayable ?? false;
29
+ const isPayableBySmartContract = options.isPayableBySmartContract ?? true;
30
+ const args = options.arguments || [];
31
+ const metadata = new core_1.CodeMetadata(isUpgradeable, isReadable, isPayable, isPayableBySmartContract);
32
+ const dataParts = [utils_codec_1.byteArrayToHex(options.bytecode), utils_codec_1.byteArrayToHex(constants_1.VM_TYPE_WASM_VM), metadata.toString()];
33
+ const endpoint = this.abi?.constructorDefinition;
34
+ const preparedArgs = this.argsToDataParts(args, endpoint);
35
+ dataParts.push(...preparedArgs);
36
+ return new transactionBuilder_1.TransactionBuilder({
37
+ config: this.config,
38
+ sender: sender,
39
+ receiver: this.contractDeployAddress,
40
+ dataParts: dataParts,
41
+ gasLimit: options.gasLimit,
42
+ addDataMovementGas: false,
43
+ amount: nativeTransferAmount,
44
+ }).build();
45
+ }
46
+ createTransactionForExecute(sender, options) {
47
+ const args = options.arguments || [];
48
+ let tokenTransfers = options.tokenTransfers ? [...options.tokenTransfers] : [];
49
+ let nativeTransferAmount = options.nativeTransferAmount ?? 0n;
50
+ let numberOfTokens = tokenTransfers.length;
51
+ if (nativeTransferAmount && numberOfTokens) {
52
+ tokenTransfers.push(tokens_1.TokenTransfer.newFromNativeAmount(nativeTransferAmount));
53
+ nativeTransferAmount = 0n;
54
+ numberOfTokens++;
55
+ }
56
+ let receiver = options.contract;
57
+ let dataParts = [];
58
+ if (numberOfTokens === 1) {
59
+ const transfer = tokenTransfers[0];
60
+ if (transfer.token.identifier === constants_1.REWA_IDENTIFIER_FOR_MULTI_DCDTNFT_TRANSFER) {
61
+ dataParts = this.dataArgsBuilder.buildDataPartsForMultiDCDTNFTTransfer(receiver, tokenTransfers);
62
+ receiver = sender;
63
+ }
64
+ else if (this.tokenComputer.isFungible(transfer.token)) {
65
+ dataParts = this.dataArgsBuilder.buildDataPartsForDCDTTransfer(transfer);
66
+ }
67
+ else {
68
+ dataParts = this.dataArgsBuilder.buildDataPartsForSingleDCDTNFTTransfer(transfer, receiver);
69
+ receiver = sender;
70
+ }
71
+ }
72
+ else if (numberOfTokens > 1) {
73
+ dataParts = this.dataArgsBuilder.buildDataPartsForMultiDCDTNFTTransfer(receiver, tokenTransfers);
74
+ receiver = sender;
75
+ }
76
+ dataParts.push(dataParts.length ? utils_codec_1.utf8ToHex(options.function) : options.function);
77
+ const endpoint = this.abi?.getEndpoint(options.function);
78
+ const preparedArgs = this.argsToDataParts(args, endpoint);
79
+ dataParts.push(...preparedArgs);
80
+ return new transactionBuilder_1.TransactionBuilder({
81
+ config: this.config,
82
+ sender: sender,
83
+ receiver: receiver,
84
+ dataParts: dataParts,
85
+ gasLimit: options.gasLimit,
86
+ addDataMovementGas: false,
87
+ amount: nativeTransferAmount,
88
+ }).build();
89
+ }
90
+ createTransactionForUpgrade(sender, options) {
91
+ const nativeTransferAmount = options.nativeTransferAmount ?? 0n;
92
+ const isUpgradeable = options.isUpgradeable ?? true;
93
+ const isReadable = options.isReadable ?? true;
94
+ const isPayable = options.isPayable ?? false;
95
+ const isPayableBySmartContract = options.isPayableBySmartContract ?? true;
96
+ const args = options.arguments || [];
97
+ const metadata = new core_1.CodeMetadata(isUpgradeable, isReadable, isPayable, isPayableBySmartContract);
98
+ const dataParts = ["upgradeContract", utils_codec_1.byteArrayToHex(options.bytecode), metadata.toString()];
99
+ const endpoint = this.getEndpointForUpgrade();
100
+ const preparedArgs = this.argsToDataParts(args, endpoint);
101
+ dataParts.push(...preparedArgs);
102
+ return new transactionBuilder_1.TransactionBuilder({
103
+ config: this.config,
104
+ sender: sender,
105
+ receiver: options.contract,
106
+ dataParts: dataParts,
107
+ gasLimit: options.gasLimit,
108
+ addDataMovementGas: false,
109
+ amount: nativeTransferAmount,
110
+ }).build();
111
+ }
112
+ getEndpointForUpgrade() {
113
+ if (!this.abi) {
114
+ return undefined;
115
+ }
116
+ if (this.abi.upgradeConstructorDefinition) {
117
+ return this.abi.upgradeConstructorDefinition;
118
+ }
119
+ try {
120
+ return this.abi.getEndpoint("upgrade");
121
+ }
122
+ catch (error) {
123
+ // Contracts written using an old Rust framework and deployed prior Sirius might not describe the 'upgrade' endpoint in the ABI.
124
+ logger_1.Logger.warn("In the ABI, cannot find the 'upgrade' endpoint definition. Will use the constructor definition (fallback).");
125
+ return this.abi.constructorDefinition;
126
+ }
127
+ }
128
+ createTransactionForClaimingDeveloperRewards(options) {
129
+ const dataParts = ["ClaimDeveloperRewards"];
130
+ return new transactionBuilder_1.TransactionBuilder({
131
+ config: this.config,
132
+ sender: options.sender,
133
+ receiver: options.contract,
134
+ dataParts: dataParts,
135
+ gasLimit: this.config.gasLimitClaimDeveloperRewards,
136
+ addDataMovementGas: false,
137
+ }).build();
138
+ }
139
+ createTransactionForChangingOwnerAddress(options) {
140
+ const dataParts = ["ChangeOwnerAddress", options.newOwner.toHex()];
141
+ return new transactionBuilder_1.TransactionBuilder({
142
+ config: this.config,
143
+ sender: options.sender,
144
+ receiver: options.contract,
145
+ dataParts: dataParts,
146
+ gasLimit: this.config.gasLimitChangeOwnerAddress,
147
+ addDataMovementGas: false,
148
+ }).build();
149
+ }
150
+ argsToDataParts(args, endpoint) {
151
+ if (endpoint) {
152
+ const typedArgs = abi_1.NativeSerializer.nativeToTypedValues(args, endpoint);
153
+ return new abi_1.ArgSerializer().valuesToStrings(typedArgs);
154
+ }
155
+ if (this.areArgsOfTypedValue(args)) {
156
+ return new abi_1.ArgSerializer().valuesToStrings(args);
157
+ }
158
+ throw new errors_1.Err("Can't convert args to TypedValues");
159
+ }
160
+ areArgsOfTypedValue(args) {
161
+ return args.every((arg) => abi_1.isTyped(arg));
162
+ }
163
+ }
164
+ exports.SmartContractTransactionsFactory = SmartContractTransactionsFactory;
165
+ //# sourceMappingURL=smartContractTransactionsFactory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"smartContractTransactionsFactory.js","sourceRoot":"","sources":["../../src/smartContracts/smartContractTransactionsFactory.ts"],"names":[],"mappings":";;;AAAA,gCAA2F;AAC3F,kCAAgD;AAChD,iDAI2B;AAC3B,2CAAqC;AACrC,2CAAwC;AACxC,2CAA8D;AAC9D,iFAA8E;AAE9E,mEAAgE;AAChE,qDAAgE;AAYhE;;GAEG;AACH,MAAa,gCAAgC;IAOzC,YAAY,OAAuC;QAC/C,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;QAC7B,IAAI,CAAC,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC;QACvB,IAAI,CAAC,aAAa,GAAG,IAAI,sBAAa,EAAE,CAAC;QACzC,IAAI,CAAC,eAAe,GAAG,IAAI,qDAAyB,EAAE,CAAC;QACvD,IAAI,CAAC,qBAAqB,GAAG,cAAO,CAAC,UAAU,CAAC,uCAA2B,EAAE,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;IACzG,CAAC;IAED,0BAA0B,CAAC,MAAe,EAAE,OAAsC;QAC9E,MAAM,oBAAoB,GAAG,OAAO,CAAC,oBAAoB,IAAI,EAAE,CAAC;QAChE,MAAM,aAAa,GAAG,OAAO,CAAC,aAAa,IAAI,IAAI,CAAC;QACpD,MAAM,UAAU,GAAG,OAAO,CAAC,UAAU,IAAI,IAAI,CAAC;QAC9C,MAAM,SAAS,GAAG,OAAO,CAAC,SAAS,IAAI,KAAK,CAAC;QAC7C,MAAM,wBAAwB,GAAG,OAAO,CAAC,wBAAwB,IAAI,IAAI,CAAC;QAC1E,MAAM,IAAI,GAAG,OAAO,CAAC,SAAS,IAAI,EAAE,CAAC;QACrC,MAAM,QAAQ,GAAG,IAAI,mBAAY,CAAC,aAAa,EAAE,UAAU,EAAE,SAAS,EAAE,wBAAwB,CAAC,CAAC;QAElG,MAAM,SAAS,GAAG,CAAC,4BAAc,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,4BAAc,CAAC,2B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AE,CAAC;IACf,CAAC;IAES,eAAe,CAAC,IAAW,EAAE,QAA6B;QAChE,IAAI,QAAQ,EAAE;YACV,MAAM,SAAS,GAAG,sBAAgB,CAAC,mBAAmB,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;YACvE,OAAO,IAAI,mBAAa,EAAE,CAAC,eAAe,CAAC,SAAS,CAAC,CAAC;SACzD;QAED,IAAI,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC,EAAE;YAChC,OAAO,IAAI,mBAAa,EAAE,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;SACpD;QAED,MAAM,IAAI,YAAG,CAAC,mCAAmC,CAAC,CAAC;IACvD,CAAC;IAEO,mBAAmB,CAAC,IAAW;QACnC,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,aAAO,CAAC,GAAG,CAAC,CAAC,CAAC;IAC7C,CAAC;CACJ;AAzLD,4EAyLC"}
@@ -0,0 +1,28 @@
1
+ import { Abi } from "../abi";
2
+ import { TransactionOnNetwork } from "../core/transactionOnNetwork";
3
+ import { SmartContractCallOutcome } from "../transactionsOutcomeParsers/resources";
4
+ import * as resources from "./resources";
5
+ export declare class SmartContractTransactionsOutcomeParser {
6
+ private readonly abi?;
7
+ constructor(options?: {
8
+ abi?: Abi;
9
+ });
10
+ /**
11
+ * Parses the transaction and recovers basic information about the contract(s) deployed by the transaction.
12
+ * @param options
13
+ */
14
+ parseDeploy(options: {
15
+ transactionOnNetwork: TransactionOnNetwork;
16
+ }): resources.SmartContractDeployOutcome;
17
+ protected parseDeployGivenTransactionOnNetwork(transactionOnNetwork: TransactionOnNetwork): resources.SmartContractDeployOutcome;
18
+ private parseScDeployEvent;
19
+ parseExecute(options: {
20
+ transactionOnNetwork: TransactionOnNetwork;
21
+ function?: string;
22
+ }): resources.ParsedSmartContractCallOutcome;
23
+ protected parseExecuteGivenTransactionOnNetwork(transactionOnNetwork: TransactionOnNetwork, functionName?: string): resources.ParsedSmartContractCallOutcome;
24
+ protected findDirectSmartContractCallOutcome(transactionOnNetwork: TransactionOnNetwork): SmartContractCallOutcome;
25
+ protected findDirectSmartContractCallOutcomeWithinSmartContractResults(transactionOnNetwork: TransactionOnNetwork): SmartContractCallOutcome | null;
26
+ protected findDirectSmartContractCallOutcomeIfError(transactionOnNetwork: TransactionOnNetwork): SmartContractCallOutcome | null;
27
+ protected findDirectSmartContractCallOutcomeWithinWriteLogEvents(transactionOnNetwork: TransactionOnNetwork): SmartContractCallOutcome | null;
28
+ }
@@ -0,0 +1,189 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SmartContractTransactionsOutcomeParser = void 0;
4
+ const abi_1 = require("../abi");
5
+ const address_1 = require("../core/address");
6
+ const constants_1 = require("../core/constants");
7
+ const errors_1 = require("../core/errors");
8
+ const resources_1 = require("../transactionsOutcomeParsers/resources");
9
+ var Events;
10
+ (function (Events) {
11
+ Events["SCDeploy"] = "SCDeploy";
12
+ Events["SignalError"] = "signalError";
13
+ Events["WriteLog"] = "writeLog";
14
+ })(Events || (Events = {}));
15
+ class SmartContractTransactionsOutcomeParser {
16
+ constructor(options) {
17
+ this.abi = options?.abi;
18
+ }
19
+ /**
20
+ * Parses the transaction and recovers basic information about the contract(s) deployed by the transaction.
21
+ * @param options
22
+ */
23
+ parseDeploy(options) {
24
+ return this.parseDeployGivenTransactionOnNetwork(options.transactionOnNetwork);
25
+ }
26
+ parseDeployGivenTransactionOnNetwork(transactionOnNetwork) {
27
+ const directCallOutcome = this.findDirectSmartContractCallOutcome(transactionOnNetwork);
28
+ const events = transactionOnNetwork.logs.events
29
+ .concat(transactionOnNetwork.smartContractResults.flatMap((result) => result.logs.events))
30
+ .filter((event) => event.identifier === Events.SCDeploy);
31
+ const contracts = events.map((event) => this.parseScDeployEvent({
32
+ topics: event.topics.map((topic) => Buffer.from(topic)),
33
+ }));
34
+ return {
35
+ returnCode: directCallOutcome.returnCode,
36
+ returnMessage: directCallOutcome.returnMessage,
37
+ contracts: contracts,
38
+ };
39
+ }
40
+ parseScDeployEvent(event) {
41
+ const topicForAddress = Buffer.from(event.topics[0]).toString("hex");
42
+ const topicForOwnerAddress = Buffer.from(event.topics[1]).toString("hex");
43
+ const topicForCodeHash = Buffer.from(event.topics[2]);
44
+ const address = topicForAddress?.length ? new address_1.Address(topicForAddress) : address_1.Address.empty();
45
+ const ownerAddress = topicForOwnerAddress?.length ? new address_1.Address(topicForOwnerAddress) : address_1.Address.empty();
46
+ const codeHash = topicForCodeHash;
47
+ return {
48
+ address,
49
+ ownerAddress,
50
+ codeHash,
51
+ };
52
+ }
53
+ parseExecute(options) {
54
+ return this.parseExecuteGivenTransactionOnNetwork(options.transactionOnNetwork, options.function);
55
+ }
56
+ parseExecuteGivenTransactionOnNetwork(transactionOnNetwork, functionName) {
57
+ const directCallOutcome = this.findDirectSmartContractCallOutcome(transactionOnNetwork);
58
+ if (!this.abi) {
59
+ return {
60
+ values: directCallOutcome.returnDataParts,
61
+ returnCode: directCallOutcome.returnCode,
62
+ returnMessage: directCallOutcome.returnMessage,
63
+ };
64
+ }
65
+ functionName = functionName || directCallOutcome.function;
66
+ if (!functionName) {
67
+ throw new errors_1.Err(`Function name is not available in the transaction, thus endpoint definition (ABI) cannot be picked (for parsing). Maybe provide the "function" parameter explicitly?`);
68
+ }
69
+ const argsSerializer = new abi_1.ArgSerializer();
70
+ const endpoint = this.abi.getEndpoint(functionName);
71
+ const buffers = directCallOutcome.returnDataParts.map((part) => Buffer.from(part));
72
+ const values = argsSerializer.buffersToValues(buffers, endpoint.output);
73
+ return {
74
+ returnCode: directCallOutcome.returnCode,
75
+ returnMessage: directCallOutcome.returnMessage,
76
+ values: values.map((value) => value.valueOf()),
77
+ };
78
+ }
79
+ findDirectSmartContractCallOutcome(transactionOnNetwork) {
80
+ let outcome = this.findDirectSmartContractCallOutcomeWithinSmartContractResults(transactionOnNetwork);
81
+ if (outcome) {
82
+ return outcome;
83
+ }
84
+ outcome = this.findDirectSmartContractCallOutcomeIfError(transactionOnNetwork);
85
+ if (outcome) {
86
+ return outcome;
87
+ }
88
+ outcome = this.findDirectSmartContractCallOutcomeWithinWriteLogEvents(transactionOnNetwork);
89
+ if (outcome) {
90
+ return outcome;
91
+ }
92
+ return new resources_1.SmartContractCallOutcome({
93
+ function: transactionOnNetwork.function,
94
+ returnCode: "",
95
+ returnMessage: "",
96
+ returnDataParts: [],
97
+ });
98
+ }
99
+ findDirectSmartContractCallOutcomeWithinSmartContractResults(transactionOnNetwork) {
100
+ const argSerializer = new abi_1.ArgSerializer();
101
+ const eligibleResults = [];
102
+ for (const result of transactionOnNetwork.smartContractResults) {
103
+ const matchesCriteriaOnData = Buffer.from(result.data).toString("utf-8").startsWith(constants_1.ARGUMENTS_SEPARATOR);
104
+ const matchesCriteriaOnReceiver = result.receiver.toBech32() === transactionOnNetwork.sender.toBech32();
105
+ const matchesCriteriaOnPreviousHash = result;
106
+ const matchesCriteria = matchesCriteriaOnData && matchesCriteriaOnReceiver && matchesCriteriaOnPreviousHash;
107
+ if (matchesCriteria) {
108
+ eligibleResults.push(result);
109
+ }
110
+ }
111
+ if (eligibleResults.length === 0) {
112
+ return null;
113
+ }
114
+ if (eligibleResults.length > 1) {
115
+ throw new Error(`More than one smart contract result (holding the return data) found for transaction: ${transactionOnNetwork.hash}`);
116
+ }
117
+ const [result] = eligibleResults;
118
+ const [_ignored, returnCode, ...returnDataParts] = argSerializer.stringToBuffers(result.data.toString());
119
+ return new resources_1.SmartContractCallOutcome({
120
+ function: transactionOnNetwork.function,
121
+ returnCode: returnCode?.toString(),
122
+ returnMessage: result.raw["returnMessage"] || returnCode?.toString(),
123
+ returnDataParts: returnDataParts,
124
+ });
125
+ }
126
+ findDirectSmartContractCallOutcomeIfError(transactionOnNetwork) {
127
+ const argSerializer = new abi_1.ArgSerializer();
128
+ const eventIdentifier = Events.SignalError;
129
+ const eligibleEvents = [];
130
+ // First, look in "logs":
131
+ eligibleEvents.push(...transactionOnNetwork.logs.events.filter((event) => event.identifier === eventIdentifier));
132
+ // Then, look in "logs" of "contractResults":
133
+ for (const result of transactionOnNetwork.smartContractResults) {
134
+ if (result.raw["prevTxHash"] != transactionOnNetwork.hash) {
135
+ continue;
136
+ }
137
+ eligibleEvents.push(...result.logs.events.filter((event) => event.identifier === eventIdentifier));
138
+ }
139
+ if (eligibleEvents.length === 0) {
140
+ return null;
141
+ }
142
+ if (eligibleEvents.length > 1) {
143
+ throw new Error(`More than one "${eventIdentifier}" event found for transaction: ${transactionOnNetwork.hash}`);
144
+ }
145
+ const [event] = eligibleEvents;
146
+ const data = Buffer.from(event.data).toString();
147
+ const lastTopic = event.topics[event.topics.length - 1]?.toString();
148
+ const parts = argSerializer.stringToBuffers(data);
149
+ // Assumption: the last part is the return code.
150
+ const returnCode = parts[parts.length - 1];
151
+ return new resources_1.SmartContractCallOutcome({
152
+ function: transactionOnNetwork.function,
153
+ returnCode: returnCode?.toString() || eventIdentifier,
154
+ returnMessage: lastTopic || returnCode?.toString() || eventIdentifier,
155
+ returnDataParts: [],
156
+ });
157
+ }
158
+ findDirectSmartContractCallOutcomeWithinWriteLogEvents(transactionOnNetwork) {
159
+ const argSerializer = new abi_1.ArgSerializer();
160
+ const eventIdentifier = Events.WriteLog;
161
+ const eligibleEvents = [];
162
+ // First, look in "logs":
163
+ eligibleEvents.push(...transactionOnNetwork.logs.events.filter((event) => event.identifier === eventIdentifier));
164
+ // Then, look in "logs" of "contractResults":
165
+ for (const result of transactionOnNetwork.smartContractResults) {
166
+ if (result.raw["prevTxHash"] != transactionOnNetwork.hash) {
167
+ continue;
168
+ }
169
+ eligibleEvents.push(...result.logs.events.filter((event) => event.identifier === eventIdentifier));
170
+ }
171
+ if (eligibleEvents.length === 0) {
172
+ return null;
173
+ }
174
+ if (eligibleEvents.length > 1) {
175
+ throw new Error(`More than one "${eventIdentifier}" event found for transaction: ${transactionOnNetwork.hash}`);
176
+ }
177
+ const [event] = eligibleEvents;
178
+ const data = Buffer.from(event.data).toString();
179
+ const [_ignored, returnCode, ...returnDataParts] = argSerializer.stringToBuffers(data);
180
+ return new resources_1.SmartContractCallOutcome({
181
+ function: transactionOnNetwork.function,
182
+ returnCode: returnCode?.toString(),
183
+ returnMessage: returnCode?.toString(),
184
+ returnDataParts: returnDataParts,
185
+ });
186
+ }
187
+ }
188
+ exports.SmartContractTransactionsOutcomeParser = SmartContractTransactionsOutcomeParser;
189
+ //# sourceMappingURL=smartContractTransactionsOutcomeParser.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"smartContractTransactionsOutcomeParser.js","sourceRoot":"","sources":["../../src/smartContracts/smartContractTransactionsOutcomeParser.ts"],"names":[],"mappings":";;;AAAA,gCAA4C;AAC5C,6CAA0C;AAC1C,iDAAwD;AACxD,2CAAqC;AAGrC,uEAAwG;AAGxG,IAAK,MAIJ;AAJD,WAAK,MAAM;IACP,+BAAqB,CAAA;IACrB,qCAA2B,CAAA;IAC3B,+BAAqB,CAAA;AACzB,CAAC,EAJI,MAAM,KAAN,MAAM,QAIV;AAED,MAAa,sCAAsC;IAG/C,YAAY,OAAuB;QAC/B,IAAI,CAAC,GAAG,GAAG,OAAO,EAAE,GAAG,CAAC;IAC5B,CAAC;IAED;;;OAGG;IACH,WAAW,CAAC,OAAuD;QAC/D,OAAO,IAAI,CAAC,oCAAoC,CAAC,OAAO,CAAC,oBAAoB,CAAC,CAAC;IACnF,CAAC;IAES,oCAAoC,CAC1C,oBAA0C;QAE1C,MAAM,iBAAiB,GAAG,IAAI,CAAC,kCAAkC,CAAC,oBAAoB,CAAC,CAAC;QAExF,MAAM,MAAM,GAAG,oBAAoB,CAAC,IAAI,CAAC,MAAM;aAC1C,MAAM,CAAC,oBAAoB,CAAC,oBAAoB,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;aACzF,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC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AC7C,KAAK,MAAM,MAAM,IAAI,oBAAoB,CAAC,oBAAoB,EAAE;YAC5D,IAAI,MAAM,CAAC,GAAG,CAAC,YAAY,CAAC,IAAI,oBAAoB,CAAC,IAAI,EAAE;gBACvD,SAAS;aACZ;YAED,cAAc,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,UAAU,KAAK,eAAe,CAAC,CAAC,CAAC;SACtG;QAED,IAAI,cAAc,CAAC,MAAM,KAAK,CAAC,EAAE;YAC7B,OAAO,IAAI,CAAC;SACf;QAED,IAAI,cAAc,CAAC,MAAM,GAAG,CAAC,EAAE;YAC3B,MAAM,IAAI,KAAK,CACX,kBAAkB,eAAe,kCAAkC,oBAAoB,CAAC,IAAI,EAAE,CACjG,CAAC;SACL;QAED,MAAM,CAAC,KAAK,CAAC,GAAG,cAAc,CAAC;QAC/B,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,CAAC;QAChD,MAAM,CAAC,QAAQ,EAAE,UAAU,EAAE,GAAG,eAAe,CAAC,GAAG,aAAa,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;QAEvF,OAAO,IAAI,oCAAwB,CAAC;YAChC,QAAQ,EAAE,oBAAoB,CAAC,QAAQ;YACvC,UAAU,EAAE,UAAU,EAAE,QAAQ,EAAE;YAClC,aAAa,EAAE,UAAU,EAAE,QAAQ,EAAE;YACrC,eAAe,EAAE,eAAe;SACnC,CAAC,CAAC;IACP,CAAC;CACJ;AAtPD,wFAsPC"}
@@ -0,0 +1,4 @@
1
+ export * from "./resources";
2
+ export * from "./tokenManagementController";
3
+ export * from "./tokenManagementTransactionsFactory";
4
+ export * from "./tokenManagementTransactionsOutcomeParser";
@@ -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("./resources"), exports);
14
+ __exportStar(require("./tokenManagementController"), exports);
15
+ __exportStar(require("./tokenManagementTransactionsFactory"), exports);
16
+ __exportStar(require("./tokenManagementTransactionsOutcomeParser"), exports);
17
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tokenManagement/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,8CAA4B;AAC5B,8DAA4C;AAC5C,uEAAqD;AACrD,6EAA2D"}
@@ -0,0 +1,220 @@
1
+ import { TokenType } from "../core";
2
+ import { Address } from "../core/address";
3
+ export declare type IssueFungibleInput = IssueInput & {
4
+ initialSupply: bigint;
5
+ numDecimals: bigint;
6
+ };
7
+ export declare type IssueSemiFungibleInput = IssueNonFungibleInput;
8
+ export declare type IssueNonFungibleInput = IssueInput & {
9
+ canTransferNFTCreateRole: boolean;
10
+ };
11
+ export declare type IssueInput = {
12
+ tokenName: string;
13
+ tokenTicker: string;
14
+ canFreeze: boolean;
15
+ canWipe: boolean;
16
+ canPause: boolean;
17
+ canChangeOwner: boolean;
18
+ canUpgrade: boolean;
19
+ canAddSpecialRoles: boolean;
20
+ };
21
+ export declare type FungibleSpecialRoleInput = {
22
+ user: Address;
23
+ tokenIdentifier: string;
24
+ addRoleLocalMint: boolean;
25
+ addRoleLocalBurn: boolean;
26
+ addRoleDCDTTransferRole: boolean;
27
+ };
28
+ export declare type SemiFungibleSpecialRoleInput = {
29
+ user: Address;
30
+ tokenIdentifier: string;
31
+ addRoleNFTCreate: boolean;
32
+ addRoleNFTBurn: boolean;
33
+ addRoleNFTAddQuantity: boolean;
34
+ addRoleDCDTTransferRole: boolean;
35
+ addRoleNFTUpdate?: boolean;
36
+ addRoleDCDTModifyRoyalties?: boolean;
37
+ addRoleDCDTSetNewUri?: boolean;
38
+ addRoleDCDTModifyCreator?: boolean;
39
+ addRoleNFTRecreate?: boolean;
40
+ };
41
+ export declare type SpecialRoleInput = {
42
+ user: Address;
43
+ tokenIdentifier: string;
44
+ addRoleNFTCreate: boolean;
45
+ addRoleNFTBurn: boolean;
46
+ addRoleNFTUpdateAttributes: boolean;
47
+ addRoleNFTAddURI: boolean;
48
+ addRoleDCDTTransferRole: boolean;
49
+ addRoleDCDTModifyCreator?: boolean;
50
+ addRoleNFTRecreate?: boolean;
51
+ addRoleDCDTSetNewURI?: boolean;
52
+ addRoleDCDTModifyRoyalties?: boolean;
53
+ };
54
+ export declare type UnsetFungibleSpecialRoleInput = {
55
+ user: Address;
56
+ tokenIdentifier: string;
57
+ removeRoleLocalMint: boolean;
58
+ removeRoleLocalBurn: boolean;
59
+ removeRoleDCDTTransferRole: boolean;
60
+ };
61
+ export declare type UnsetSemiFungibleSpecialRoleInput = {
62
+ user: Address;
63
+ tokenIdentifier: string;
64
+ removeRoleNFTBurn: boolean;
65
+ removeRoleNFTAddQuantity: boolean;
66
+ removeRoleDCDTTransferRole: boolean;
67
+ removeRoleNFTUpdate?: boolean;
68
+ removeRoleDCDTModifyRoyalties?: boolean;
69
+ removeRoleDCDTSetNewUri?: boolean;
70
+ removeRoleDCDTModifyCreator?: boolean;
71
+ removeRoleNFTRecreate?: boolean;
72
+ };
73
+ export declare type UnsetSpecialRoleInput = {
74
+ user: Address;
75
+ tokenIdentifier: string;
76
+ removeRoleNFTBurn: boolean;
77
+ removeRoleNFTUpdateAttributes: boolean;
78
+ removeRoleNFTAddURI: boolean;
79
+ removeRoleDCDTTransferRole: boolean;
80
+ removeRoleDCDTModifyCreator?: boolean;
81
+ removeRoleNFTRecreate?: boolean;
82
+ removeRoleDCDTSetNewURI?: boolean;
83
+ removeRoleDCDTModifyRoyalties?: boolean;
84
+ };
85
+ export declare type MintInput = {
86
+ tokenIdentifier: string;
87
+ initialQuantity: bigint;
88
+ name: string;
89
+ royalties: number;
90
+ hash: string;
91
+ attributes: Uint8Array;
92
+ uris: string[];
93
+ };
94
+ export declare type ManagementInput = {
95
+ user: Address;
96
+ tokenIdentifier: string;
97
+ };
98
+ export declare type PausingInput = {
99
+ tokenIdentifier: string;
100
+ };
101
+ export declare type LocalBurnInput = {
102
+ tokenIdentifier: string;
103
+ supplyToBurn: bigint;
104
+ };
105
+ export declare type LocalMintInput = {
106
+ tokenIdentifier: string;
107
+ supplyToMint: bigint;
108
+ };
109
+ export declare type UpdateAttributesInput = UpdateInput & {
110
+ attributes: Uint8Array;
111
+ };
112
+ export declare type UpdateQuantityInput = UpdateInput & {
113
+ quantity: bigint;
114
+ };
115
+ export declare type UpdateInput = {
116
+ tokenIdentifier: string;
117
+ tokenNonce: bigint;
118
+ };
119
+ export declare type BurnRoleGloballyInput = {
120
+ tokenIdentifier: string;
121
+ };
122
+ export declare type UpdateTokenIDInput = {
123
+ tokenIdentifier: string;
124
+ };
125
+ export declare type ChangeTokenToDynamicInput = {
126
+ tokenIdentifier: string;
127
+ };
128
+ export declare type RegisterRolesInput = {
129
+ tokenName: string;
130
+ tokenTicker: string;
131
+ tokenType: TokenType;
132
+ numDecimals: bigint;
133
+ };
134
+ export declare type RegisterMetaDCDTInput = {
135
+ tokenName: string;
136
+ tokenTicker: string;
137
+ numDecimals: bigint;
138
+ canFreeze: boolean;
139
+ canWipe: boolean;
140
+ canPause: boolean;
141
+ canTransferNFTCreateRole: boolean;
142
+ canChangeOwner: boolean;
143
+ canUpgrade: boolean;
144
+ canAddSpecialRoles: boolean;
145
+ };
146
+ export declare type ModifyRoyaltiesInput = BaseInput & {
147
+ newRoyalties: bigint;
148
+ };
149
+ export declare type ModifyCreatorInput = BaseInput;
150
+ export declare type BaseInput = {
151
+ tokenIdentifier: string;
152
+ tokenNonce: bigint;
153
+ };
154
+ export declare type SetNewUriInput = BaseInput & {
155
+ newUris: string[];
156
+ };
157
+ export declare type ManageMetadataInput = {
158
+ tokenIdentifier: string;
159
+ tokenNonce: bigint;
160
+ newTokenName?: string;
161
+ newRoyalties?: bigint;
162
+ newHash?: string;
163
+ newAttributes?: Uint8Array;
164
+ newUris?: string[];
165
+ };
166
+ export declare type RegisteringDynamicTokenInput = {
167
+ tokenName: string;
168
+ tokenTicker: string;
169
+ tokenType: TokenType;
170
+ };
171
+ export declare type SpecialRoleOutput = {
172
+ userAddress: Address;
173
+ tokenIdentifier: string;
174
+ roles: string[];
175
+ };
176
+ export declare type MintNftOutput = {
177
+ tokenIdentifier: string;
178
+ nonce: bigint;
179
+ initialQuantity: bigint;
180
+ };
181
+ export declare type DcdtOutput = {
182
+ tokenIdentifier: string;
183
+ };
184
+ export declare type ModifyRoyaltiesOutput = {
185
+ tokenIdentifier: string;
186
+ nonce: bigint;
187
+ royalties: bigint;
188
+ };
189
+ export declare type SetNewUrisOutput = {
190
+ tokenIdentifier: string;
191
+ nonce: bigint;
192
+ uri: string;
193
+ };
194
+ export declare type ModifyingCreatorOutput = {
195
+ tokenIdentifier: string;
196
+ nonce: bigint;
197
+ };
198
+ export declare type UpdateAttibutesOutput = {
199
+ tokenIdentifier: string;
200
+ nonce: bigint;
201
+ metadata: Uint8Array;
202
+ };
203
+ export declare type ChangeToDynamicOutput = {
204
+ tokenIdentifier: string;
205
+ tokenName: string;
206
+ tickerName: string;
207
+ tokenType: string;
208
+ };
209
+ export declare type UpdateTokenIDOutput = {
210
+ caller: Address;
211
+ tokenIdentifier: string;
212
+ token: string;
213
+ };
214
+ export declare type RegisterDynamicOutput = {
215
+ tokenIdentifier: string;
216
+ tokenName: string;
217
+ tokenTicker: string;
218
+ tokenType: string;
219
+ numOfDecimals: number;
220
+ };
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=resources.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resources.js","sourceRoot":"","sources":["../../src/tokenManagement/resources.ts"],"names":[],"mappings":""}