@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
package/LICENSE ADDED
@@ -0,0 +1,11 @@
1
+ ## License
2
+
3
+ The MIT License (MIT)
4
+
5
+ Copyright (c) DharitrI
6
+
7
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
8
+
9
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
10
+
11
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,94 @@
1
+ # DharitrI SDK for JavaScript and TypeScript
2
+
3
+ DharitrI SDK for JavaScript and TypeScript (written in TypeScript).
4
+
5
+ ## Documentation
6
+
7
+ - [Cookbook](https://docs.dharitri.org/sdk-and-tools/sdk-js/sdk-js-cookbook/)
8
+ - [Auto-generated documentation](https://terradharitri.github.io/drt-js-sdk-core/)
9
+
10
+ ## Distribution
11
+
12
+ [npm](https://www.npmjs.com/package/@sravankumar02/sdk-core)
13
+
14
+ ## Installation
15
+
16
+ `sdk-core` is delivered via **npm** and it can be installed as follows:
17
+
18
+ ```
19
+ npm install @sravankumar02/sdk-core
20
+ ```
21
+
22
+ ## Development
23
+
24
+ Feel free to skip this section if you are not a contributor.
25
+
26
+ ### Prerequisites
27
+
28
+ `browserify` and `esmify` are required to compile the browser-friendly versions of `sdk-core`. They can be installed as follows:
29
+
30
+ ```
31
+ npm install --global browserify
32
+ npm install esmify --no-save
33
+ ```
34
+
35
+ ## Optional Dependencies
36
+
37
+ ### axios
38
+
39
+ This package can make HTTP requests using `axios`, which is not bundled by default. If you plan to use the API network provider or Proxy network provider, make sure to install `axios`:
40
+
41
+ ```bash
42
+ npm install axios
43
+ ```
44
+
45
+ ### @terradharitri/sdk-bls-wasm
46
+
47
+ This package requires `@terradharitri/sdk-bls-wasm` for BLS (Boneh-Lynn-Shacham) cryptographic functions, which is not bundled by default. If you plan to use BLS functionality, make sure to install this optional dependency:
48
+
49
+ ```bash
50
+ npm install @terradharitri/sdk-bls-wasm
51
+ ```
52
+
53
+ ### bip39
54
+
55
+ This package provides mnemonic and seed generation functionality using `bip39`, but it is not bundled by default. If you plan to use mnemonic-related features, make sure to install this optional dependency:
56
+
57
+ ```bash
58
+ npm install bip39
59
+ ```
60
+
61
+ ### Building the library
62
+
63
+ In order to compile the library, run the following:
64
+
65
+ ```
66
+ npm install
67
+ npm run compile
68
+ npm run compile-browser
69
+ ```
70
+
71
+ ### Running the tests
72
+
73
+ In order to run the tests **on NodeJS**, do as follows:
74
+
75
+ ```
76
+ npm run tests-unit
77
+ npm run tests-localnet
78
+ npm run tests-devnet
79
+ npm run tests-testnet
80
+ ```
81
+
82
+ Before running the tests **in the browser**, make sure you have the package `http-server` installed globally.
83
+
84
+ ```
85
+ npm install --global http-server
86
+ ```
87
+
88
+ In order to run the tests **in the browser**, do as follows:
89
+
90
+ ```
91
+ make clean && npm run browser-tests
92
+ ```
93
+
94
+ For the `localnet` tests, make sure you have a _local testnet_ up & running. In order to start a _local testnet_, follow [this](https://docs.dharitri.org/developers/setup-local-testnet/).
@@ -0,0 +1,45 @@
1
+ /// <reference types="node" />
2
+ import { Type, TypedValue } from "./typesystem";
3
+ interface IArgSerializerOptions {
4
+ codec: ICodec;
5
+ }
6
+ interface ICodec {
7
+ decodeTopLevel(buffer: Buffer, type: Type): TypedValue;
8
+ encodeTopLevel(typedValue: TypedValue): Buffer;
9
+ }
10
+ interface IParameterDefinition {
11
+ type: Type;
12
+ }
13
+ export declare class ArgSerializer {
14
+ codec: ICodec;
15
+ constructor(options?: IArgSerializerOptions);
16
+ /**
17
+ * Reads typed values from an arguments string (e.g. aa@bb@@cc), given parameter definitions.
18
+ */
19
+ stringToValues(joinedString: string, parameters: IParameterDefinition[]): TypedValue[];
20
+ /**
21
+ * Reads raw buffers from an arguments string (e.g. aa@bb@@cc).
22
+ */
23
+ stringToBuffers(joinedString: string): Buffer[];
24
+ /**
25
+ * Decodes a set of buffers into a set of typed values, given parameter definitions.
26
+ */
27
+ buffersToValues(buffers: Buffer[], parameters: IParameterDefinition[]): TypedValue[];
28
+ /**
29
+ * Serializes a set of typed values into an arguments string (e.g. aa@bb@@cc).
30
+ */
31
+ valuesToString(values: TypedValue[]): {
32
+ argumentsString: string;
33
+ count: number;
34
+ };
35
+ /**
36
+ * Serializes a set of typed values into a set of strings.
37
+ */
38
+ valuesToStrings(values: TypedValue[]): string[];
39
+ /**
40
+ * Serializes a set of typed values into a set of strings buffers.
41
+ * Variadic types and composite types might result into none, one or more buffers.
42
+ */
43
+ valuesToBuffers(values: TypedValue[]): Buffer[];
44
+ }
45
+ export {};
@@ -0,0 +1,171 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ArgSerializer = void 0;
4
+ const constants_1 = require("../core/constants");
5
+ const codec_1 = require("./codec");
6
+ const typesystem_1 = require("./typesystem");
7
+ const algebraic_1 = require("./typesystem/algebraic");
8
+ const composite_1 = require("./typesystem/composite");
9
+ const variadic_1 = require("./typesystem/variadic");
10
+ // TODO: perhaps move default construction options to a factory (ArgSerializerFactory), instead of referencing them in the constructor
11
+ // (postpone as much as possible, breaking change)
12
+ const defaultArgSerializerOptions = {
13
+ codec: new codec_1.BinaryCodec(),
14
+ };
15
+ class ArgSerializer {
16
+ constructor(options) {
17
+ options = { ...defaultArgSerializerOptions, ...options };
18
+ this.codec = options.codec;
19
+ }
20
+ /**
21
+ * Reads typed values from an arguments string (e.g. aa@bb@@cc), given parameter definitions.
22
+ */
23
+ stringToValues(joinedString, parameters) {
24
+ let buffers = this.stringToBuffers(joinedString);
25
+ let values = this.buffersToValues(buffers, parameters);
26
+ return values;
27
+ }
28
+ /**
29
+ * Reads raw buffers from an arguments string (e.g. aa@bb@@cc).
30
+ */
31
+ stringToBuffers(joinedString) {
32
+ // We also keep the zero-length buffers (they could encode missing options, Option<T>).
33
+ return joinedString.split(constants_1.ARGUMENTS_SEPARATOR).map((item) => Buffer.from(item, "hex"));
34
+ }
35
+ /**
36
+ * Decodes a set of buffers into a set of typed values, given parameter definitions.
37
+ */
38
+ buffersToValues(buffers, parameters) {
39
+ // TODO: Refactor, split (function is quite complex).
40
+ // eslint-disable-next-line @typescript-eslint/no-this-alias
41
+ const self = this;
42
+ buffers = buffers || [];
43
+ let values = [];
44
+ let bufferIndex = 0;
45
+ let numBuffers = buffers.length;
46
+ for (let i = 0; i < parameters.length; i++) {
47
+ let parameter = parameters[i];
48
+ let type = parameter.type;
49
+ let value = readValue(type);
50
+ values.push(value);
51
+ }
52
+ // This is a recursive function.
53
+ function readValue(type) {
54
+ if (type.hasExactClass(algebraic_1.OptionalType.ClassName)) {
55
+ const typedValue = readValue(type.getFirstTypeParameter());
56
+ return new algebraic_1.OptionalValue(type, typedValue);
57
+ }
58
+ if (type.hasExactClass(variadic_1.VariadicType.ClassName)) {
59
+ return readVariadicValue(type);
60
+ }
61
+ if (type.hasExactClass(composite_1.CompositeType.ClassName)) {
62
+ const typedValues = [];
63
+ for (const typeParameter of type.getTypeParameters()) {
64
+ typedValues.push(readValue(typeParameter));
65
+ }
66
+ return new composite_1.CompositeValue(type, typedValues);
67
+ }
68
+ // Non-composite (singular), non-variadic (fixed) type.
69
+ // The only branching without a recursive call.
70
+ const typedValue = decodeNextBuffer(type);
71
+ // TODO: Handle the case (maybe throw error) when "typedValue" is, actually, null.
72
+ return typedValue;
73
+ }
74
+ function readVariadicValue(type) {
75
+ const variadicType = type;
76
+ const typedValues = [];
77
+ if (variadicType.isCounted) {
78
+ const count = readValue(new typesystem_1.U32Type()).valueOf().toNumber();
79
+ for (let i = 0; i < count; i++) {
80
+ typedValues.push(readValue(type.getFirstTypeParameter()));
81
+ }
82
+ }
83
+ else {
84
+ while (!hasReachedTheEnd()) {
85
+ typedValues.push(readValue(type.getFirstTypeParameter()));
86
+ }
87
+ }
88
+ return new variadic_1.VariadicValue(variadicType, typedValues);
89
+ }
90
+ function decodeNextBuffer(type) {
91
+ if (hasReachedTheEnd()) {
92
+ return null;
93
+ }
94
+ let buffer = buffers[bufferIndex++];
95
+ let decodedValue = self.codec.decodeTopLevel(buffer, type);
96
+ return decodedValue;
97
+ }
98
+ function hasReachedTheEnd() {
99
+ return bufferIndex >= numBuffers;
100
+ }
101
+ return values;
102
+ }
103
+ /**
104
+ * Serializes a set of typed values into an arguments string (e.g. aa@bb@@cc).
105
+ */
106
+ valuesToString(values) {
107
+ let strings = this.valuesToStrings(values);
108
+ let argumentsString = strings.join(constants_1.ARGUMENTS_SEPARATOR);
109
+ let count = strings.length;
110
+ return { argumentsString, count };
111
+ }
112
+ /**
113
+ * Serializes a set of typed values into a set of strings.
114
+ */
115
+ valuesToStrings(values) {
116
+ let buffers = this.valuesToBuffers(values);
117
+ let strings = buffers.map((buffer) => buffer.toString("hex"));
118
+ return strings;
119
+ }
120
+ /**
121
+ * Serializes a set of typed values into a set of strings buffers.
122
+ * Variadic types and composite types might result into none, one or more buffers.
123
+ */
124
+ valuesToBuffers(values) {
125
+ // TODO: Refactor, split (function is quite complex).
126
+ // eslint-disable-next-line @typescript-eslint/no-this-alias
127
+ const self = this;
128
+ const buffers = [];
129
+ for (const value of values) {
130
+ handleValue(value);
131
+ }
132
+ // This is a recursive function. It appends to the "buffers" variable.
133
+ function handleValue(value) {
134
+ if (value.hasExactClass(algebraic_1.OptionalValue.ClassName)) {
135
+ const valueAsOptional = value;
136
+ if (valueAsOptional.isSet()) {
137
+ handleValue(valueAsOptional.getTypedValue());
138
+ }
139
+ return;
140
+ }
141
+ if (value.hasExactClass(variadic_1.VariadicValue.ClassName)) {
142
+ handleVariadicValue(value);
143
+ return;
144
+ }
145
+ if (value.hasExactClass(composite_1.CompositeValue.ClassName)) {
146
+ const valueAsComposite = value;
147
+ for (const item of valueAsComposite.getItems()) {
148
+ handleValue(item);
149
+ }
150
+ return;
151
+ }
152
+ // Non-composite (singular), non-variadic (fixed) type.
153
+ // The only branching without a recursive call.
154
+ const buffer = self.codec.encodeTopLevel(value);
155
+ buffers.push(buffer);
156
+ }
157
+ function handleVariadicValue(value) {
158
+ const variadicType = value.getType();
159
+ if (variadicType.isCounted) {
160
+ const countValue = new typesystem_1.U32Value(value.getItems().length);
161
+ buffers.push(self.codec.encodeTopLevel(countValue));
162
+ }
163
+ for (const item of value.getItems()) {
164
+ handleValue(item);
165
+ }
166
+ }
167
+ return buffers;
168
+ }
169
+ }
170
+ exports.ArgSerializer = ArgSerializer;
171
+ //# sourceMappingURL=argSerializer.js.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AC,MAAM,CAAC,CAAC;QACzB,CAAC;QAED,SAAS,mBAAmB,CAAC,KAAoB;YAC7C,MAAM,YAAY,GAAiB,KAAK,CAAC,OAAO,EAAE,CAAC;YAEnD,IAAI,YAAY,CAAC,SAAS,EAAE;gBACxB,MAAM,UAAU,GAAG,IAAI,qBAAQ,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,MAAM,CAAC,CAAC;gBACzD,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC,CAAC;aACvD;YAED,KAAK,MAAM,IAAI,IAAI,KAAK,CAAC,QAAQ,EAAE,EAAE;gBACjC,WAAW,CAAC,IAAI,CAAC,CAAC;aACrB;QACL,CAAC;QAED,OAAO,OAAO,CAAC;IACnB,CAAC;CACJ;AAjMD,sCAiMC"}
@@ -0,0 +1,12 @@
1
+ import { EndpointParameterDefinition, Type } from "./typesystem";
2
+ export declare class ArgumentErrorContext {
3
+ endpointName: string;
4
+ argumentIndex: number;
5
+ parameterDefinition: EndpointParameterDefinition;
6
+ constructor(endpointName: string, argumentIndex: number, parameterDefinition: EndpointParameterDefinition);
7
+ throwError(specificError: string): never;
8
+ convertError(native: any, typeName: string): never;
9
+ unhandledType(functionName: string, type: Type): never;
10
+ guardSameLength<T>(native: any[], valueTypes: T[]): void;
11
+ guardHasField(native: any, fieldName: string): void;
12
+ }
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ArgumentErrorContext = void 0;
4
+ const errors_1 = require("../core/errors");
5
+ class ArgumentErrorContext {
6
+ constructor(endpointName, argumentIndex, parameterDefinition) {
7
+ this.endpointName = endpointName;
8
+ this.argumentIndex = argumentIndex;
9
+ this.parameterDefinition = parameterDefinition;
10
+ }
11
+ throwError(specificError) {
12
+ throw new errors_1.ErrInvalidArgument(`Error when converting arguments for endpoint (endpoint name: ${this.endpointName}, argument index: ${this.argumentIndex}, name: ${this.parameterDefinition.name}, type: ${this.parameterDefinition.type})\nNested error: ${specificError}`);
13
+ }
14
+ convertError(native, typeName) {
15
+ this.throwError(`Can't convert argument (argument: ${native}, type ${typeof native}), wanted type: ${typeName})`);
16
+ }
17
+ unhandledType(functionName, type) {
18
+ this.throwError(`Unhandled type (function: ${functionName}, type: ${type})`);
19
+ }
20
+ guardSameLength(native, valueTypes) {
21
+ native = native || [];
22
+ if (native.length != valueTypes.length) {
23
+ this.throwError(`Incorrect composite type length: have ${native.length}, expected ${valueTypes.length} (argument: ${native})`);
24
+ }
25
+ }
26
+ guardHasField(native, fieldName) {
27
+ native = native || {};
28
+ if (!(fieldName in native)) {
29
+ this.throwError(`Struct argument does not contain a field named "${fieldName}" (argument: ${JSON.stringify(native)})`);
30
+ }
31
+ }
32
+ }
33
+ exports.ArgumentErrorContext = ArgumentErrorContext;
34
+ //# sourceMappingURL=argumentErrorContext.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"argumentErrorContext.js","sourceRoot":"","sources":["../../src/abi/argumentErrorContext.ts"],"names":[],"mappings":";;;AAAA,2CAAoD;AAGpD,MAAa,oBAAoB;IAK7B,YAAY,YAAoB,EAAE,aAAqB,EAAE,mBAAgD;QACrG,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QACjC,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;QACnC,IAAI,CAAC,mBAAmB,GAAG,mBAAmB,CAAC;IACnD,CAAC;IAED,UAAU,CAAC,aAAqB;QAC5B,MAAM,IAAI,2BAAkB,CACxB,gEAAgE,IAAI,CAAC,YAAY,qBAAqB,IAAI,CAAC,aAAa,WAAW,IAAI,CAAC,mBAAmB,CAAC,IAAI,WAAW,IAAI,CAAC,mBAAmB,CAAC,IAAI,oBAAoB,aAAa,EAAE,CAC9O,CAAC;IACN,CAAC;IAED,YAAY,CAAC,MAAW,EAAE,QAAgB;QACtC,IAAI,CAAC,UAAU,CACX,qCAAqC,MAAM,UAAU,OAAO,MAAM,mBAAmB,QAAQ,GAAG,CACnG,CAAC;IACN,CAAC;IAED,aAAa,CAAC,YAAoB,EAAE,IAAU;QAC1C,IAAI,CAAC,UAAU,CAAC,6BAA6B,YAAY,WAAW,IAAI,GAAG,CAAC,CAAC;IACjF,CAAC;IAED,eAAe,CAAI,MAAa,EAAE,UAAe;QAC7C,MAAM,GAAG,MAAM,IAAI,EAAE,CAAC;QACtB,IAAI,MAAM,CAAC,MAAM,IAAI,UAAU,CAAC,MAAM,EAAE;YACpC,IAAI,CAAC,UAAU,CACX,yCAAyC,MAAM,CAAC,MAAM,cAAc,UAAU,CAAC,MAAM,eAAe,MAAM,GAAG,CAChH,CAAC;SACL;IACL,CAAC;IAED,aAAa,CAAC,MAAW,EAAE,SAAiB;QACxC,MAAM,GAAG,MAAM,IAAI,EAAE,CAAC;QACtB,IAAI,CAAC,CAAC,SAAS,IAAI,MAAM,CAAC,EAAE;YACxB,IAAI,CAAC,UAAU,CACX,mDAAmD,SAAS,gBAAgB,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,GAAG,CACxG,CAAC;SACL;IACL,CAAC;CACJ;AA5CD,oDA4CC"}
@@ -0,0 +1,23 @@
1
+ /// <reference types="node" />
2
+ /**
3
+ * * @deprecated Use the bytecode directly
4
+ * Bytecode of a Smart Contract, as an abstraction.
5
+ */
6
+ export declare class Code {
7
+ private readonly hex;
8
+ private constructor();
9
+ /**
10
+ * Creates a Code object from a buffer (sequence of bytes).
11
+ */
12
+ static fromBuffer(code: Buffer): Code;
13
+ /**
14
+ * Creates a Code object from a hex-encoded string.
15
+ */
16
+ static fromHex(hex: string): Code;
17
+ /**
18
+ * Returns the bytecode as a hex-encoded string.
19
+ */
20
+ toString(): string;
21
+ valueOf(): Buffer;
22
+ computeHash(): Buffer;
23
+ }
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Code = void 0;
4
+ const createHasher = require("blake2b");
5
+ const CODE_HASH_LENGTH = 32;
6
+ /**
7
+ * * @deprecated Use the bytecode directly
8
+ * Bytecode of a Smart Contract, as an abstraction.
9
+ */
10
+ class Code {
11
+ constructor(hex) {
12
+ this.hex = hex;
13
+ }
14
+ /**
15
+ * Creates a Code object from a buffer (sequence of bytes).
16
+ */
17
+ static fromBuffer(code) {
18
+ return new Code(code.toString("hex"));
19
+ }
20
+ /**
21
+ * Creates a Code object from a hex-encoded string.
22
+ */
23
+ static fromHex(hex) {
24
+ return new Code(hex);
25
+ }
26
+ /**
27
+ * Returns the bytecode as a hex-encoded string.
28
+ */
29
+ toString() {
30
+ return this.hex;
31
+ }
32
+ valueOf() {
33
+ return Buffer.from(this.hex, "hex");
34
+ }
35
+ computeHash() {
36
+ const hash = createHasher(CODE_HASH_LENGTH).update(this.valueOf()).digest();
37
+ return Buffer.from(hash);
38
+ }
39
+ }
40
+ exports.Code = Code;
41
+ //# sourceMappingURL=code.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"code.js","sourceRoot":"","sources":["../../src/abi/code.ts"],"names":[],"mappings":";;;AAAA,MAAM,YAAY,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC;AACxC,MAAM,gBAAgB,GAAG,EAAE,CAAC;AAE5B;;;GAGG;AACH,MAAa,IAAI;IAGb,YAAoB,GAAW;QAC3B,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;IACnB,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,UAAU,CAAC,IAAY;QAC1B,OAAO,IAAI,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC;IAC1C,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,OAAO,CAAC,GAAW;QACtB,OAAO,IAAI,IAAI,CAAC,GAAG,CAAC,CAAC;IACzB,CAAC;IAED;;OAEG;IACH,QAAQ;QACJ,OAAO,IAAI,CAAC,GAAG,CAAC;IACpB,CAAC;IAED,OAAO;QACH,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;IACxC,CAAC;IAED,WAAW;QACP,MAAM,IAAI,GAAG,YAAY,CAAC,gBAAgB,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC;QAE5E,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC7B,CAAC;CACJ;AArCD,oBAqCC"}
@@ -0,0 +1,24 @@
1
+ /// <reference types="node" />
2
+ import { AddressValue } from "../typesystem";
3
+ export declare class AddressBinaryCodec {
4
+ /**
5
+ * Reads and decodes an AddressValue from a given buffer.
6
+ *
7
+ * @param buffer the input buffer
8
+ */
9
+ decodeNested(buffer: Buffer): [AddressValue, number];
10
+ /**
11
+ * Reads and decodes an AddressValue from a given buffer.
12
+ *
13
+ * @param buffer the input buffer
14
+ */
15
+ decodeTopLevel(buffer: Buffer): AddressValue;
16
+ /**
17
+ * Encodes an AddressValue to a buffer.
18
+ */
19
+ encodeNested(primitive: AddressValue): Buffer;
20
+ /**
21
+ * Encodes an AddressValue to a buffer.
22
+ */
23
+ encodeTopLevel(primitive: AddressValue): Buffer;
24
+ }
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AddressBinaryCodec = void 0;
4
+ const address_1 = require("../../core/address");
5
+ const typesystem_1 = require("../typesystem");
6
+ class AddressBinaryCodec {
7
+ /**
8
+ * Reads and decodes an AddressValue from a given buffer.
9
+ *
10
+ * @param buffer the input buffer
11
+ */
12
+ decodeNested(buffer) {
13
+ // We don't check the size of the buffer, we just read 32 bytes.
14
+ let slice = buffer.slice(0, 32);
15
+ let value = new address_1.Address(slice);
16
+ return [new typesystem_1.AddressValue(value), 32];
17
+ }
18
+ /**
19
+ * Reads and decodes an AddressValue from a given buffer.
20
+ *
21
+ * @param buffer the input buffer
22
+ */
23
+ decodeTopLevel(buffer) {
24
+ let [decoded, _length] = this.decodeNested(buffer);
25
+ return decoded;
26
+ }
27
+ /**
28
+ * Encodes an AddressValue to a buffer.
29
+ */
30
+ encodeNested(primitive) {
31
+ return primitive.valueOf().getPublicKey();
32
+ }
33
+ /**
34
+ * Encodes an AddressValue to a buffer.
35
+ */
36
+ encodeTopLevel(primitive) {
37
+ return primitive.valueOf().getPublicKey();
38
+ }
39
+ }
40
+ exports.AddressBinaryCodec = AddressBinaryCodec;
41
+ //# sourceMappingURL=address.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"address.js","sourceRoot":"","sources":["../../../src/abi/codec/address.ts"],"names":[],"mappings":";;;AAAA,gDAA6C;AAC7C,8CAA6C;AAE7C,MAAa,kBAAkB;IAC3B;;;;OAIG;IACH,YAAY,CAAC,MAAc;QACvB,gEAAgE;QAEhE,IAAI,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QAChC,IAAI,KAAK,GAAG,IAAI,iBAAO,CAAC,KAAK,CAAC,CAAC;QAC/B,OAAO,CAAC,IAAI,yBAAY,CAAC,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC;IACzC,CAAC;IAED;;;;OAIG;IACH,cAAc,CAAC,MAAc;QACzB,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;QACnD,OAAO,OAAO,CAAC;IACnB,CAAC;IAED;;OAEG;IACH,YAAY,CAAC,SAAuB;QAChC,OAAO,SAAS,CAAC,OAAO,EAAE,CAAC,YAAY,EAAE,CAAC;IAC9C,CAAC;IAED;;OAEG;IACH,cAAc,CAAC,SAAuB;QAClC,OAAO,SAAS,CAAC,OAAO,EAAE,CAAC,YAAY,EAAE,CAAC;IAC9C,CAAC;CACJ;AArCD,gDAqCC"}
@@ -0,0 +1,11 @@
1
+ /// <reference types="node" />
2
+ import { ArrayVec, ArrayVecType } from "../typesystem";
3
+ import { BinaryCodec } from "./binary";
4
+ export declare class ArrayVecBinaryCodec {
5
+ private readonly binaryCodec;
6
+ constructor(binaryCodec: BinaryCodec);
7
+ decodeNested(buffer: Buffer, type: ArrayVecType): [ArrayVec, number];
8
+ decodeTopLevel(buffer: Buffer, type: ArrayVecType): ArrayVec;
9
+ encodeNested(array: ArrayVec): Buffer;
10
+ encodeTopLevel(array: ArrayVec): Buffer;
11
+ }
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ArrayVecBinaryCodec = void 0;
4
+ const typesystem_1 = require("../typesystem");
5
+ class ArrayVecBinaryCodec {
6
+ constructor(binaryCodec) {
7
+ this.binaryCodec = binaryCodec;
8
+ }
9
+ decodeNested(buffer, type) {
10
+ let arrayLength = type.length;
11
+ let typeParameter = type.getFirstTypeParameter();
12
+ let result = [];
13
+ let totalLength = 0;
14
+ for (let i = 0; i < arrayLength; i++) {
15
+ let [decoded, decodedLength] = this.binaryCodec.decodeNested(buffer, typeParameter);
16
+ result.push(decoded);
17
+ totalLength += decodedLength;
18
+ buffer = buffer.slice(decodedLength);
19
+ }
20
+ return [new typesystem_1.ArrayVec(type, result), totalLength];
21
+ }
22
+ decodeTopLevel(buffer, type) {
23
+ let [result, _] = this.decodeNested(buffer, type);
24
+ return result;
25
+ }
26
+ encodeNested(array) {
27
+ let itemsBuffers = [];
28
+ for (const item of array.getItems()) {
29
+ let itemBuffer = this.binaryCodec.encodeNested(item);
30
+ itemsBuffers.push(itemBuffer);
31
+ }
32
+ return Buffer.concat(itemsBuffers);
33
+ }
34
+ encodeTopLevel(array) {
35
+ return this.encodeNested(array);
36
+ }
37
+ }
38
+ exports.ArrayVecBinaryCodec = ArrayVecBinaryCodec;
39
+ //# sourceMappingURL=arrayVec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"arrayVec.js","sourceRoot":"","sources":["../../../src/abi/codec/arrayVec.ts"],"names":[],"mappings":";;;AAAA,8CAAmE;AAGnE,MAAa,mBAAmB;IAG5B,YAAY,WAAwB;QA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C1B,OAAO,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;IACpC,CAAC;CACJ;AA1CD,kDA0CC"}
@@ -0,0 +1,30 @@
1
+ /// <reference types="node" />
2
+ import { Type, TypedValue } from "../typesystem";
3
+ export declare class BinaryCodec {
4
+ readonly constraints: BinaryCodecConstraints;
5
+ private readonly optionCodec;
6
+ private readonly listCodec;
7
+ private readonly arrayCodec;
8
+ private readonly primitiveCodec;
9
+ private readonly structCodec;
10
+ private readonly tupleCodec;
11
+ private readonly enumCodec;
12
+ private readonly explicitEnumCodec;
13
+ private readonly managedDecimalCodec;
14
+ private readonly managedDecimalSignedCodec;
15
+ constructor(constraints?: BinaryCodecConstraints | null);
16
+ decodeTopLevel<TResult extends TypedValue = TypedValue>(buffer: Buffer, type: Type): TResult;
17
+ decodeNested<TResult extends TypedValue = TypedValue>(buffer: Buffer, type: Type): [TResult, number];
18
+ encodeNested(typedValue: TypedValue): Buffer;
19
+ encodeTopLevel(typedValue: TypedValue): Buffer;
20
+ }
21
+ export declare class BinaryCodecConstraints {
22
+ maxBufferLength: number;
23
+ maxListLength: number;
24
+ constructor(init?: Partial<BinaryCodecConstraints>);
25
+ checkBufferLength(buffer: Buffer): void;
26
+ /**
27
+ * This constraint avoids computer-freezing decode bugs (e.g. due to invalid ABI or struct definitions).
28
+ */
29
+ checkListLength(length: number): void;
30
+ }