@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,85 @@
1
+ /// <reference types="node" />
2
+ import { Address } from "../core/address";
3
+ import { Transaction } from "../core/transaction";
4
+ import { ReturnCode } from "./returnCode";
5
+ import { TypedValue } from "./typesystem";
6
+ /**
7
+ * ISmartContract defines a general interface for operating with {@link SmartContract} objects.
8
+ */
9
+ export interface ISmartContract {
10
+ /**
11
+ * Gets the address of the Smart Contract.
12
+ */
13
+ getAddress(): Address;
14
+ /**
15
+ * Creates a {@link Transaction} for deploying the Smart Contract to the Network.
16
+ */
17
+ deploy({ deployer, code, codeMetadata, initArguments, value, gasLimit }: DeployArguments): Transaction;
18
+ /**
19
+ * Creates a {@link Transaction} for upgrading the Smart Contract on the Network.
20
+ */
21
+ upgrade({ caller, code, codeMetadata, initArguments, value, gasLimit }: UpgradeArguments): Transaction;
22
+ /**
23
+ * Creates a {@link Transaction} for calling (a function of) the Smart Contract.
24
+ */
25
+ call({ caller, func, args, value, gasLimit }: CallArguments): Transaction;
26
+ }
27
+ export interface DeployArguments {
28
+ code: ICode;
29
+ codeMetadata?: ICodeMetadata;
30
+ initArguments?: any[];
31
+ value?: bigint;
32
+ gasLimit: bigint;
33
+ gasPrice?: bigint;
34
+ chainID: string;
35
+ deployer: Address;
36
+ }
37
+ export interface UpgradeArguments {
38
+ code: ICode;
39
+ codeMetadata?: ICodeMetadata;
40
+ initArguments?: any[];
41
+ value?: bigint;
42
+ gasLimit: bigint;
43
+ gasPrice?: bigint;
44
+ chainID: string;
45
+ caller: Address;
46
+ }
47
+ export interface CallArguments {
48
+ func: IContractFunction;
49
+ args?: any[];
50
+ value?: bigint;
51
+ gasLimit: bigint;
52
+ receiver?: Address;
53
+ gasPrice?: bigint;
54
+ chainID: string;
55
+ caller: Address;
56
+ }
57
+ export interface QueryArguments {
58
+ func: IContractFunction;
59
+ args?: TypedValue[];
60
+ value?: bigint;
61
+ caller?: Address;
62
+ }
63
+ export interface TypedOutcomeBundle {
64
+ returnCode: ReturnCode;
65
+ returnMessage: string;
66
+ values: TypedValue[];
67
+ firstValue?: TypedValue;
68
+ secondValue?: TypedValue;
69
+ thirdValue?: TypedValue;
70
+ lastValue?: TypedValue;
71
+ }
72
+ export interface UntypedOutcomeBundle {
73
+ returnCode: ReturnCode;
74
+ returnMessage: string;
75
+ values: Buffer[];
76
+ }
77
+ export interface ICode {
78
+ toString(): string;
79
+ }
80
+ export interface ICodeMetadata {
81
+ toString(): string;
82
+ }
83
+ export interface IContractFunction {
84
+ toString(): string;
85
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=interface.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"interface.js","sourceRoot":"","sources":["../../src/abi/interface.ts"],"names":[],"mappings":""}
@@ -0,0 +1,27 @@
1
+ /// <reference types="node" />
2
+ import BigNumber from "bignumber.js";
3
+ import { Address } from "../core/address";
4
+ import { ArgumentErrorContext } from "./argumentErrorContext";
5
+ import { EndpointDefinition, EndpointParameterDefinition, TypedValue } from "./typesystem";
6
+ export declare namespace NativeTypes {
7
+ type NativeBuffer = Buffer | string;
8
+ type NativeBytes = Buffer | {
9
+ valueOf(): Buffer;
10
+ } | string;
11
+ type NativeAddress = string | Buffer | Address | {
12
+ getAddress(): Address;
13
+ };
14
+ type NativeBigNumber = BigNumber.Value | bigint;
15
+ }
16
+ export declare namespace NativeSerializer {
17
+ /**
18
+ * Interprets a set of native javascript values into a set of typed values, given parameter definitions.
19
+ */
20
+ function nativeToTypedValues(args: any[], endpoint: EndpointDefinition): TypedValue[];
21
+ function getArgumentsCardinality(parameters: EndpointParameterDefinition[]): {
22
+ min: number;
23
+ max: number;
24
+ variadic: boolean;
25
+ };
26
+ function convertNativeToAddress(native: NativeTypes.NativeAddress, errorContext: ArgumentErrorContext): Address;
27
+ }
@@ -0,0 +1,343 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.NativeSerializer = void 0;
7
+ /* eslint-disable @typescript-eslint/no-namespace */
8
+ const bignumber_js_1 = __importDefault(require("bignumber.js"));
9
+ const address_1 = require("../core/address");
10
+ const errors_1 = require("../core/errors");
11
+ const utils_codec_1 = require("../core/utils.codec");
12
+ const argumentErrorContext_1 = require("./argumentErrorContext");
13
+ const typesystem_1 = require("./typesystem");
14
+ var NativeSerializer;
15
+ (function (NativeSerializer) {
16
+ /**
17
+ * Interprets a set of native javascript values into a set of typed values, given parameter definitions.
18
+ */
19
+ function nativeToTypedValues(args, endpoint) {
20
+ args = args || [];
21
+ checkArgumentsCardinality(args, endpoint);
22
+ if (hasNonCountedVariadicParameter(endpoint)) {
23
+ args = repackNonCountedVariadicParameters(args, endpoint);
24
+ }
25
+ else {
26
+ // Repacking makes sense (it's possible) only for regular, non-counted variadic parameters.
27
+ }
28
+ let parameters = endpoint.input;
29
+ let values = [];
30
+ for (let i = 0; i < parameters.length; i++) {
31
+ let parameter = parameters[i];
32
+ let errorContext = new argumentErrorContext_1.ArgumentErrorContext(endpoint.name, i, parameter);
33
+ let value = convertToTypedValue(args[i], parameter.type, errorContext);
34
+ values.push(value);
35
+ }
36
+ return values;
37
+ }
38
+ NativeSerializer.nativeToTypedValues = nativeToTypedValues;
39
+ function checkArgumentsCardinality(args, endpoint) {
40
+ // With respect to the notes of "repackNonCountedVariadicParameters", "getArgumentsCardinality" will not be needed anymore.
41
+ // Currently, it is used only for a arguments count check, which will become redundant.
42
+ const { min, max } = getArgumentsCardinality(endpoint.input);
43
+ if (!(min <= args.length && args.length <= max)) {
44
+ throw new errors_1.ErrInvalidArgument(`Wrong number of arguments for endpoint ${endpoint.name}: expected between ${min} and ${max} arguments, have ${args.length}`);
45
+ }
46
+ }
47
+ function hasNonCountedVariadicParameter(endpoint) {
48
+ const lastParameter = endpoint.input[endpoint.input.length - 1];
49
+ return lastParameter?.type instanceof typesystem_1.VariadicType && !lastParameter.type.isCounted;
50
+ }
51
+ // In a future version of the type inference system, re-packing logic will be removed.
52
+ // The client code will be responsible for passing the correctly packed arguments (variadic arguments explicitly packed as arrays).
53
+ // For developers, calling `foo(["drt1", 42, [1, 2, 3]])` will be less ambiguous than `foo(["drt1", 42, 1, 2, 3])`.
54
+ // Furthermore, multiple counted-variadic arguments cannot be expressed in the current variant.
55
+ // E.g. now, it's unreasonable to decide that `foo([1, 2, 3, "a", "b", "c"])` calls `foo(counted-variadic<int>, counted-variadic<string>)`.
56
+ function repackNonCountedVariadicParameters(args, endpoint) {
57
+ const lastEndpointParamIndex = endpoint.input.length - 1;
58
+ const argAtIndex = args[lastEndpointParamIndex];
59
+ if (argAtIndex?.belongsToTypesystem) {
60
+ const isVariadicValue = argAtIndex.hasClassOrSuperclass(typesystem_1.VariadicValue.ClassName);
61
+ if (!isVariadicValue) {
62
+ throw new errors_1.ErrInvalidArgument(`Wrong argument type for endpoint ${endpoint.name}: typed value provided; expected variadic type, have ${argAtIndex.getClassName()}`);
63
+ }
64
+ // Do not repack.
65
+ }
66
+ else {
67
+ args[lastEndpointParamIndex] = args.slice(lastEndpointParamIndex);
68
+ }
69
+ return args;
70
+ }
71
+ // A function may have one of the following formats:
72
+ // f(arg1, arg2, optional<arg3>, optional<arg4>) returns { min: 2, max: 4, variadic: false }
73
+ // f(arg1, variadic<bytes>) returns { min: 1, max: Infinity, variadic: true }
74
+ // f(arg1, arg2, optional<arg3>, arg4, optional<arg5>, variadic<bytes>) returns { min: 2, max: Infinity, variadic: true }
75
+ function getArgumentsCardinality(parameters) {
76
+ let reversed = [...parameters].reverse(); // keep the original unchanged
77
+ let min = parameters.length;
78
+ let max = parameters.length;
79
+ let variadic = false;
80
+ if (reversed.length > 0 && reversed[0].type.getCardinality().isComposite()) {
81
+ max = Infinity;
82
+ variadic = true;
83
+ }
84
+ for (let parameter of reversed) {
85
+ // It's a single-value, not a multi-value parameter. Thus, cardinality isn't affected.
86
+ if (parameter.type.getCardinality().isSingular()) {
87
+ break;
88
+ }
89
+ // It's a multi-value parameter: optional, variadic etc.
90
+ min -= 1;
91
+ }
92
+ return { min, max, variadic };
93
+ }
94
+ NativeSerializer.getArgumentsCardinality = getArgumentsCardinality;
95
+ function convertToTypedValue(value, type, errorContext) {
96
+ if (value && typesystem_1.isTyped(value)) {
97
+ // Value is already typed, no need to convert it.
98
+ return value;
99
+ }
100
+ if (type instanceof typesystem_1.OptionType) {
101
+ return toOptionValue(value, type, errorContext);
102
+ }
103
+ if (type instanceof typesystem_1.OptionalType) {
104
+ return toOptionalValue(value, type, errorContext);
105
+ }
106
+ if (type instanceof typesystem_1.VariadicType) {
107
+ return toVariadicValue(value, type, errorContext);
108
+ }
109
+ if (type instanceof typesystem_1.CompositeType) {
110
+ return toCompositeValue(value, type, errorContext);
111
+ }
112
+ if (type instanceof typesystem_1.TupleType) {
113
+ return toTupleValue(value, type, errorContext);
114
+ }
115
+ if (type instanceof typesystem_1.StructType) {
116
+ return toStructValue(value, type, errorContext);
117
+ }
118
+ if (type instanceof typesystem_1.ListType) {
119
+ return toListValue(value, type, errorContext);
120
+ }
121
+ if (type instanceof typesystem_1.PrimitiveType) {
122
+ return toPrimitive(value, type, errorContext);
123
+ }
124
+ if (type instanceof typesystem_1.EnumType) {
125
+ return toEnumValue(value, type, errorContext);
126
+ }
127
+ if (type instanceof typesystem_1.ExplicitEnumType) {
128
+ return toExplicitEnumValue(value, type, errorContext);
129
+ }
130
+ if (type instanceof typesystem_1.ManagedDecimalType) {
131
+ return toManagedDecimal(value, type, errorContext);
132
+ }
133
+ errorContext.throwError(`convertToTypedValue: unhandled type ${type}`);
134
+ }
135
+ function toOptionValue(native, type, errorContext) {
136
+ if (native == null) {
137
+ return typesystem_1.OptionValue.newMissing();
138
+ }
139
+ let converted = convertToTypedValue(native, type.getFirstTypeParameter(), errorContext);
140
+ return typesystem_1.OptionValue.newProvided(converted);
141
+ }
142
+ function toOptionalValue(native, type, errorContext) {
143
+ if (native == null) {
144
+ return new typesystem_1.OptionalValue(type);
145
+ }
146
+ let converted = convertToTypedValue(native, type.getFirstTypeParameter(), errorContext);
147
+ return new typesystem_1.OptionalValue(type, converted);
148
+ }
149
+ function toVariadicValue(native, type, errorContext) {
150
+ if (type.isCounted) {
151
+ throw new errors_1.ErrInvalidArgument(`Counted variadic arguments must be explicitly typed. E.g. use "VariadicValue.fromItemsCounted()" or "new VariadicValue()"`);
152
+ }
153
+ if (native == null) {
154
+ native = [];
155
+ }
156
+ if (native.map === undefined) {
157
+ errorContext.convertError(native, "Variadic");
158
+ }
159
+ let converted = native.map(function (item) {
160
+ return convertToTypedValue(item, type.getFirstTypeParameter(), errorContext);
161
+ });
162
+ return new typesystem_1.VariadicValue(type, converted);
163
+ }
164
+ function toListValue(native, type, errorContext) {
165
+ if (native.map === undefined) {
166
+ errorContext.convertError(native, "List");
167
+ }
168
+ let converted = native.map(function (item) {
169
+ return convertToTypedValue(item, type.getFirstTypeParameter(), errorContext);
170
+ });
171
+ return new typesystem_1.List(type, converted);
172
+ }
173
+ function toCompositeValue(native, type, errorContext) {
174
+ let typedValues = [];
175
+ let typeParameters = type.getTypeParameters();
176
+ errorContext.guardSameLength(native, typeParameters);
177
+ for (let i = 0; i < typeParameters.length; i++) {
178
+ typedValues.push(convertToTypedValue(native[i], typeParameters[i], errorContext));
179
+ }
180
+ return new typesystem_1.CompositeValue(type, typedValues);
181
+ }
182
+ function toTupleValue(native, type, errorContext) {
183
+ let typedValues = [];
184
+ const fields = type.getFieldsDefinitions();
185
+ errorContext.guardSameLength(native, fields);
186
+ for (let i = 0; i < fields.length; i++) {
187
+ typedValues.push(convertToTypedValue(native[i], fields[i].type, errorContext));
188
+ }
189
+ return typesystem_1.Tuple.fromItems(typedValues);
190
+ }
191
+ function toStructValue(native, type, errorContext) {
192
+ let structFieldValues = [];
193
+ const fields = type.getFieldsDefinitions();
194
+ for (let i = 0; i < fields.length; i++) {
195
+ const fieldName = fields[i].name;
196
+ errorContext.guardHasField(native, fieldName);
197
+ const fieldNativeValue = native[fieldName];
198
+ const fieldTypedValue = convertToTypedValue(fieldNativeValue, fields[i].type, errorContext);
199
+ structFieldValues.push(new typesystem_1.Field(fieldTypedValue, fieldName));
200
+ }
201
+ return new typesystem_1.Struct(type, structFieldValues);
202
+ }
203
+ function toPrimitive(native, type, errorContext) {
204
+ if (type instanceof typesystem_1.NumericalType) {
205
+ const number = new bignumber_js_1.default(native);
206
+ return convertNumericalType(number, type, errorContext);
207
+ }
208
+ if (type instanceof typesystem_1.BytesType) {
209
+ return convertNativeToBytesValue(native, errorContext);
210
+ }
211
+ if (type instanceof typesystem_1.AddressType) {
212
+ return new typesystem_1.AddressValue(convertNativeToAddress(native, errorContext));
213
+ }
214
+ if (type instanceof typesystem_1.BooleanType) {
215
+ const boolValue = native.toString().toLowerCase() === "true" || native.toString() === "1";
216
+ return new typesystem_1.BooleanValue(boolValue);
217
+ }
218
+ if (type instanceof typesystem_1.TokenIdentifierType) {
219
+ return new typesystem_1.TokenIdentifierValue(convertNativeToString(native, errorContext));
220
+ }
221
+ errorContext.throwError(`(function: toPrimitive) unsupported type ${type}`);
222
+ }
223
+ function toEnumValue(native, type, errorContext) {
224
+ if (typeof native === "number") {
225
+ return typesystem_1.EnumValue.fromDiscriminant(type, native);
226
+ }
227
+ if (typeof native === "string") {
228
+ return typesystem_1.EnumValue.fromName(type, native);
229
+ }
230
+ if (typeof native === "object") {
231
+ errorContext.guardHasField(native, "name");
232
+ const variant = type.getVariantByName(native.name);
233
+ errorContext.guardHasField(native, "fields");
234
+ const nativeFields = native.fields;
235
+ const fieldValues = [];
236
+ const fields = variant.getFieldsDefinitions();
237
+ for (let i = 0; i < fields.length; i++) {
238
+ const fieldName = fields[i].name;
239
+ errorContext.guardHasField(nativeFields, fieldName);
240
+ const fieldNativeValue = nativeFields[fieldName];
241
+ const fieldTypedValue = convertToTypedValue(fieldNativeValue, fields[i].type, errorContext);
242
+ fieldValues.push(new typesystem_1.Field(fieldTypedValue, fieldName));
243
+ }
244
+ return new typesystem_1.EnumValue(type, variant, fieldValues);
245
+ }
246
+ errorContext.throwError(`(function: toEnumValue) unsupported native type ${typeof native}`);
247
+ }
248
+ function toExplicitEnumValue(native, type, errorContext) {
249
+ if (typeof native === "string") {
250
+ return typesystem_1.ExplicitEnumValue.fromName(type, native);
251
+ }
252
+ if (typeof native === "object") {
253
+ errorContext.guardHasField(native, "name");
254
+ const variant = type.getVariantByName(native.name);
255
+ return new typesystem_1.ExplicitEnumValue(type, variant);
256
+ }
257
+ errorContext.throwError(`(function: toExplicitEnumValue) unsupported native type ${typeof native}`);
258
+ }
259
+ function toManagedDecimal(native, type, errorContext) {
260
+ if (typeof native === "object") {
261
+ return new typesystem_1.ManagedDecimalValue(native[0], native[1], type.isVariable());
262
+ }
263
+ errorContext.throwError(`(function: toManagedDecimal) unsupported native type ${typeof native}`);
264
+ }
265
+ // TODO: move logic to typesystem/bytes.ts
266
+ function convertNativeToBytesValue(native, errorContext) {
267
+ const innerValue = native.valueOf();
268
+ if (native === undefined) {
269
+ errorContext.convertError(native, "BytesValue");
270
+ }
271
+ if (native instanceof Buffer) {
272
+ return new typesystem_1.BytesValue(native);
273
+ }
274
+ if (typeof native === "string") {
275
+ return typesystem_1.BytesValue.fromUTF8(native);
276
+ }
277
+ if (innerValue instanceof Buffer) {
278
+ return new typesystem_1.BytesValue(innerValue);
279
+ }
280
+ if (typeof innerValue === "number") {
281
+ return typesystem_1.BytesValue.fromHex(utils_codec_1.numberToPaddedHex(innerValue));
282
+ }
283
+ errorContext.convertError(native, "BytesValue");
284
+ }
285
+ // TODO: move logic to typesystem/string.ts
286
+ function convertNativeToString(native, errorContext) {
287
+ if (native === undefined) {
288
+ errorContext.convertError(native, "Buffer");
289
+ }
290
+ if (native instanceof Buffer) {
291
+ return native.toString();
292
+ }
293
+ if (typeof native === "string") {
294
+ return native;
295
+ }
296
+ errorContext.convertError(native, "Buffer");
297
+ }
298
+ // TODO: move logic to typesystem/address.ts
299
+ function convertNativeToAddress(native, errorContext) {
300
+ if (native.bech32) {
301
+ return native;
302
+ }
303
+ if (native.getAddress) {
304
+ return native.getAddress();
305
+ }
306
+ switch (native.constructor) {
307
+ case Buffer:
308
+ case String:
309
+ return new address_1.Address(native);
310
+ default:
311
+ errorContext.convertError(native, "Address");
312
+ }
313
+ }
314
+ NativeSerializer.convertNativeToAddress = convertNativeToAddress;
315
+ // TODO: move logic to typesystem/numerical.ts
316
+ function convertNumericalType(number, type, errorContext) {
317
+ switch (type.constructor) {
318
+ case typesystem_1.U8Type:
319
+ return new typesystem_1.U8Value(number);
320
+ case typesystem_1.I8Type:
321
+ return new typesystem_1.I8Value(number);
322
+ case typesystem_1.U16Type:
323
+ return new typesystem_1.U16Value(number);
324
+ case typesystem_1.I16Type:
325
+ return new typesystem_1.I16Value(number);
326
+ case typesystem_1.U32Type:
327
+ return new typesystem_1.U32Value(number);
328
+ case typesystem_1.I32Type:
329
+ return new typesystem_1.I32Value(number);
330
+ case typesystem_1.U64Type:
331
+ return new typesystem_1.U64Value(number);
332
+ case typesystem_1.I64Type:
333
+ return new typesystem_1.I64Value(number);
334
+ case typesystem_1.BigUIntType:
335
+ return new typesystem_1.BigUIntValue(number);
336
+ case typesystem_1.BigIntType:
337
+ return new typesystem_1.BigIntValue(number);
338
+ default:
339
+ errorContext.unhandledType("convertNumericalType", type);
340
+ }
341
+ }
342
+ })(NativeSerializer = exports.NativeSerializer || (exports.NativeSerializer = {}));
343
+ //# sourceMappingURL=nativeSerializer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nativeSerializer.js","sourceRoot":"","sources":["../../src/abi/nativeSerializer.ts"],"names":[],"mappings":";;;;;;AAAA,oDAAoD;AACpD,gEAAqC;AACrC,6CAA0C;AAC1C,2CAAoD;AACpD,qDAAwD;AACxD,iEAA8D;AAC9D,6CAyDsB;AAStB,IAAiB,gBAAgB,CA4XhC;AA5XD,WAAiB,gBAAgB;IAC7B;;OAEG;IACH,SAAgB,mBAAmB,CAAC,IAAW,EAAE,QAA4B;QACzE,IAAI,GAAG,IAAI,IAAI,EAAE,CAAC;QAElB,yBAAyB,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;QAE1C,IAAI,8BAA8B,CAAC,QAAQ,CAAC,EAAE;YAC1C,IAAI,GAAG,kCAAkC,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;SAC7D;aAAM;YACH,2FAA2F;SAC9F;QAED,IAAI,UAAU,GAAG,QAAQ,CAAC,KAAK,CAAC;QAChC,IAAI,MAAM,GAAiB,EAAE,CAAC;QAE9B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,UAAU,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YACxC,IAAI,SAAS,GAAG,UAAU,CAAC,CAAC,CAAC,CAAC;YAC9B,IAAI,YAAY,GAAG,IAAI,2CAAoB,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC,EAAE,SAAS,CAAC,CAAC;YACzE,IAAI,KAAK,GAAG,mBAAmB,CAAC,IAAI,CAAC,CA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AI,qBAAQ,CAAC,MAAM,CAAC,CAAC;YAChC,KAAK,oBAAO;gBACR,OAAO,IAAI,qBAAQ,CAAC,MAAM,CAAC,CAAC;YAChC,KAAK,wBAAW;gBACZ,OAAO,IAAI,yBAAY,CAAC,MAAM,CAAC,CAAC;YACpC,KAAK,uBAAU;gBACX,OAAO,IAAI,wBAAW,CAAC,MAAM,CAAC,CAAC;YACnC;gBACI,YAAY,CAAC,aAAa,CAAC,sBAAsB,EAAE,IAAI,CAAC,CAAC;SAChE;IACL,CAAC;AACL,CAAC,EA5XgB,gBAAgB,GAAhB,wBAAgB,KAAhB,wBAAgB,QA4XhC"}
@@ -0,0 +1,18 @@
1
+ import { Address } from "../core/address";
2
+ import { IContractFunction } from "./interface";
3
+ import { TypedValue } from "./typesystem";
4
+ export declare class Query {
5
+ caller: Address;
6
+ address: Address;
7
+ func: IContractFunction;
8
+ args: TypedValue[];
9
+ value: bigint;
10
+ constructor(obj: {
11
+ caller?: Address;
12
+ address: Address;
13
+ func: IContractFunction;
14
+ args?: TypedValue[];
15
+ value?: bigint;
16
+ });
17
+ getEncodedArguments(): string[];
18
+ }
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Query = void 0;
4
+ const address_1 = require("../core/address");
5
+ const argSerializer_1 = require("./argSerializer");
6
+ class Query {
7
+ constructor(obj) {
8
+ this.caller = obj.caller || address_1.Address.empty();
9
+ this.address = obj.address;
10
+ this.func = obj.func;
11
+ this.args = obj.args || [];
12
+ this.value = obj.value || 0n;
13
+ }
14
+ getEncodedArguments() {
15
+ return new argSerializer_1.ArgSerializer().valuesToStrings(this.args);
16
+ }
17
+ }
18
+ exports.Query = Query;
19
+ //# sourceMappingURL=query.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"query.js","sourceRoot":"","sources":["../../src/abi/query.ts"],"names":[],"mappings":";;;AAAA,6CAA0C;AAC1C,mDAAgD;AAIhD,MAAa,KAAK;IAOd,YAAY,GAMX;QACG,IAAI,CAAC,MAAM,GAAG,GAAG,CAAC,MAAM,IAAI,iBAAO,CAAC,KAAK,EAAE,CAAC;QAC5C,IAAI,CAAC,OAAO,GAAG,GAAG,CAAC,OAAO,CAAC;QAC3B,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC,IAAI,CAAC;QACrB,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC,IAAI,IAAI,EAAE,CAAC;QAC3B,IAAI,CAAC,KAAK,GAAG,GAAG,CAAC,KAAK,IAAI,EAAE,CAAC;IACjC,CAAC;IAED,mBAAmB;QACf,OAAO,IAAI,6BAAa,EAAE,CAAC,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC1D,CAAC;CACJ;AAxBD,sBAwBC"}
@@ -0,0 +1,26 @@
1
+ /// <reference types="node" />
2
+ /**
3
+ * Also see: https://github.com/terradharitri/drt-go-chain-vm-common/blob/master/returnCodes.go
4
+ */
5
+ export declare class ReturnCode {
6
+ static None: ReturnCode;
7
+ static Ok: ReturnCode;
8
+ static FunctionNotFound: ReturnCode;
9
+ static FunctionWrongSignature: ReturnCode;
10
+ static ContractNotFound: ReturnCode;
11
+ static UserError: ReturnCode;
12
+ static OutOfGas: ReturnCode;
13
+ static AccountCollision: ReturnCode;
14
+ static OutOfFunds: ReturnCode;
15
+ static CallStackOverFlow: ReturnCode;
16
+ static ContractInvalid: ReturnCode;
17
+ static ExecutionFailed: ReturnCode;
18
+ static Unknown: ReturnCode;
19
+ private readonly text;
20
+ constructor(text: string);
21
+ static fromBuffer(buffer: Buffer): ReturnCode;
22
+ toString(): string;
23
+ valueOf(): string;
24
+ equals(other: ReturnCode): boolean;
25
+ isSuccess(): boolean;
26
+ }
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ReturnCode = void 0;
4
+ /**
5
+ * Also see: https://github.com/terradharitri/drt-go-chain-vm-common/blob/master/returnCodes.go
6
+ */
7
+ class ReturnCode {
8
+ constructor(text) {
9
+ this.text = text;
10
+ }
11
+ static fromBuffer(buffer) {
12
+ let text = buffer.toString();
13
+ return new ReturnCode(text);
14
+ }
15
+ toString() {
16
+ return this.text;
17
+ }
18
+ valueOf() {
19
+ return this.text;
20
+ }
21
+ equals(other) {
22
+ if (!other) {
23
+ return false;
24
+ }
25
+ return this.text == other.text;
26
+ }
27
+ isSuccess() {
28
+ return this.equals(ReturnCode.Ok) || this.equals(ReturnCode.None);
29
+ }
30
+ }
31
+ exports.ReturnCode = ReturnCode;
32
+ ReturnCode.None = new ReturnCode("");
33
+ ReturnCode.Ok = new ReturnCode("ok");
34
+ ReturnCode.FunctionNotFound = new ReturnCode("function not found");
35
+ ReturnCode.FunctionWrongSignature = new ReturnCode("wrong signature for function");
36
+ ReturnCode.ContractNotFound = new ReturnCode("contract not found");
37
+ ReturnCode.UserError = new ReturnCode("user error");
38
+ ReturnCode.OutOfGas = new ReturnCode("out of gas");
39
+ ReturnCode.AccountCollision = new ReturnCode("account collision");
40
+ ReturnCode.OutOfFunds = new ReturnCode("out of funds");
41
+ ReturnCode.CallStackOverFlow = new ReturnCode("call stack overflow");
42
+ ReturnCode.ContractInvalid = new ReturnCode("contract invalid");
43
+ ReturnCode.ExecutionFailed = new ReturnCode("execution failed");
44
+ ReturnCode.Unknown = new ReturnCode("unknown");
45
+ //# sourceMappingURL=returnCode.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"returnCode.js","sourceRoot":"","sources":["../../src/abi/returnCode.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,MAAa,UAAU;IAiBnB,YAAY,IAAY;QACpB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACrB,CAAC;IAED,MAAM,CAAC,UAAU,CAAC,MAAc;QAC5B,IAAI,IAAI,GAAG,MAAM,CAAC,QAAQ,EAAE,CAAC;QAC7B,OAAO,IAAI,UAAU,CAAC,IAAI,CAAC,CAAC;IAChC,CAAC;IAED,QAAQ;Q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