@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,48 @@
1
+ import { Address, SmartContractQuery, SmartContractQueryResponse, Token, Transaction, TransactionOnNetwork, TransactionStatus } from "../core";
2
+ import { AccountOnNetwork, AccountStorage, AccountStorageEntry } from "./accounts";
3
+ import { BlockOnNetwork } from "./blocks";
4
+ import { INetworkProvider, IPagination } from "./interface";
5
+ import { NetworkConfig } from "./networkConfig";
6
+ import { NetworkProviderConfig } from "./networkProviderConfig";
7
+ import { NetworkStatus } from "./networkStatus";
8
+ import { AwaitingOptions, TransactionCostResponse } from "./resources";
9
+ import { DefinitionOfFungibleTokenOnNetwork, DefinitionOfTokenCollectionOnNetwork } from "./tokenDefinitions";
10
+ import { TokenAmountOnNetwork } from "./tokens";
11
+ export declare class ApiNetworkProvider implements INetworkProvider {
12
+ private url;
13
+ private config;
14
+ private backingProxyNetworkProvider;
15
+ private userAgentPrefix;
16
+ private axios;
17
+ constructor(url: string, config?: NetworkProviderConfig);
18
+ private getProxyConfig;
19
+ getNetworkConfig(): Promise<NetworkConfig>;
20
+ getNetworkStatus(shard?: number): Promise<NetworkStatus>;
21
+ getBlock(blockHash: string): Promise<BlockOnNetwork>;
22
+ getLatestBlock(): Promise<BlockOnNetwork>;
23
+ getAccount(address: Address): Promise<AccountOnNetwork>;
24
+ getAccountStorage(address: Address): Promise<AccountStorage>;
25
+ getAccountStorageEntry(address: Address, entryKey: string): Promise<AccountStorageEntry>;
26
+ awaitAccountOnCondition(address: Address, condition: (account: AccountOnNetwork) => boolean, options?: AwaitingOptions): Promise<AccountOnNetwork>;
27
+ sendTransaction(tx: Transaction): Promise<string>;
28
+ simulateTransaction(tx: Transaction, checkSignature?: boolean): Promise<any>;
29
+ estimateTransactionCost(tx: Transaction): Promise<TransactionCostResponse>;
30
+ sendTransactions(txs: Transaction[]): Promise<[number, string[]]>;
31
+ getTransaction(txHash: string): Promise<TransactionOnNetwork>;
32
+ getTransactions(address: Address): Promise<TransactionOnNetwork[]>;
33
+ getTransactionStatus(txHash: string): Promise<TransactionStatus>;
34
+ awaitTransactionOnCondition(transactionHash: string, condition: (account: TransactionOnNetwork) => boolean, options?: AwaitingOptions): Promise<TransactionOnNetwork>;
35
+ awaitTransactionCompleted(transactionHash: string, options?: AwaitingOptions): Promise<TransactionOnNetwork>;
36
+ getTokenOfAccount(address: Address, token: Token): Promise<TokenAmountOnNetwork>;
37
+ getFungibleTokensOfAccount(address: Address, pagination?: IPagination): Promise<TokenAmountOnNetwork[]>;
38
+ getNonFungibleTokensOfAccount(address: Address, pagination?: IPagination): Promise<TokenAmountOnNetwork[]>;
39
+ getDefinitionOfFungibleToken(tokenIdentifier: string): Promise<DefinitionOfFungibleTokenOnNetwork>;
40
+ getDefinitionOfTokenCollection(collection: string): Promise<DefinitionOfTokenCollectionOnNetwork>;
41
+ queryContract(query: SmartContractQuery): Promise<SmartContractQueryResponse>;
42
+ doGetGeneric(resourceUrl: string): Promise<any>;
43
+ doPostGeneric(resourceUrl: string, payload: any): Promise<any>;
44
+ private buildPaginationParams;
45
+ private doGet;
46
+ private doPost;
47
+ private handleApiError;
48
+ }
@@ -0,0 +1,235 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ApiNetworkProvider = void 0;
4
+ const core_1 = require("../core");
5
+ const constants_1 = require("../core/constants");
6
+ const accountAwaiter_1 = require("./accountAwaiter");
7
+ const accounts_1 = require("./accounts");
8
+ const blocks_1 = require("./blocks");
9
+ const config_1 = require("./config");
10
+ const constants_2 = require("./constants");
11
+ const contractQueryRequest_1 = require("./contractQueryRequest");
12
+ const proxyNetworkProvider_1 = require("./proxyNetworkProvider");
13
+ const resources_1 = require("./resources");
14
+ const tokenDefinitions_1 = require("./tokenDefinitions");
15
+ const tokens_1 = require("./tokens");
16
+ const userAgent_1 = require("./userAgent");
17
+ // TODO: Find & remove duplicate code between "ProxyNetworkProvider" and "ApiNetworkProvider".
18
+ class ApiNetworkProvider {
19
+ constructor(url, config) {
20
+ this.userAgentPrefix = `${constants_2.BaseUserAgent}/api`;
21
+ this.url = url;
22
+ const proxyConfig = this.getProxyConfig(config);
23
+ this.config = { ...config_1.defaultAxiosConfig, ...config };
24
+ this.backingProxyNetworkProvider = new proxyNetworkProvider_1.ProxyNetworkProvider(url, proxyConfig);
25
+ this.axios = core_1.getAxios();
26
+ userAgent_1.extendUserAgentIfBackend(this.userAgentPrefix, this.config);
27
+ }
28
+ getProxyConfig(config) {
29
+ let proxyConfig = JSON.parse(JSON.stringify(config || {}));
30
+ proxyConfig = { ...config_1.defaultAxiosConfig, ...proxyConfig };
31
+ return proxyConfig;
32
+ }
33
+ async getNetworkConfig() {
34
+ return await this.backingProxyNetworkProvider.getNetworkConfig();
35
+ }
36
+ async getNetworkStatus(shard = constants_1.METACHAIN_ID) {
37
+ return await this.backingProxyNetworkProvider.getNetworkStatus(shard);
38
+ }
39
+ async getBlock(blockHash) {
40
+ const response = await this.doGetGeneric(`blocks/${blockHash}`);
41
+ return blocks_1.BlockOnNetwork.fromHttpResponse(response);
42
+ }
43
+ async getLatestBlock() {
44
+ const response = await this.doGetGeneric("blocks/latest");
45
+ return blocks_1.BlockOnNetwork.fromHttpResponse(response);
46
+ }
47
+ async getAccount(address) {
48
+ const response = await this.doGetGeneric(`accounts/${address.toBech32()}`);
49
+ const account = accounts_1.AccountOnNetwork.fromApiHttpResponse(response);
50
+ return account;
51
+ }
52
+ async getAccountStorage(address) {
53
+ const response = await this.doGetGeneric(`address/${address.toBech32()}/keys`);
54
+ const account = accounts_1.AccountStorage.fromHttpResponse(response.data);
55
+ return account;
56
+ }
57
+ async getAccountStorageEntry(address, entryKey) {
58
+ const keyAsHex = Buffer.from(entryKey).toString("hex");
59
+ const response = await this.doGetGeneric(`address/${address.toBech32()}/key/${keyAsHex}`);
60
+ const account = accounts_1.AccountStorageEntry.fromHttpResponse(response.data, entryKey);
61
+ return account;
62
+ }
63
+ async awaitAccountOnCondition(address, condition, options) {
64
+ if (!options) {
65
+ options = new resources_1.AwaitingOptions();
66
+ }
67
+ const awaiter = new accountAwaiter_1.AccountAwaiter({
68
+ fetcher: this,
69
+ patienceTimeInMilliseconds: options.patienceInMilliseconds,
70
+ pollingIntervalInMilliseconds: options.pollingIntervalInMilliseconds,
71
+ timeoutIntervalInMilliseconds: options.timeoutInMilliseconds,
72
+ });
73
+ return await awaiter.awaitOnCondition(address, condition);
74
+ }
75
+ async sendTransaction(tx) {
76
+ const transaction = core_1.prepareTransactionForBroadcasting(tx);
77
+ const response = await this.doPostGeneric("transactions", transaction);
78
+ return response.txHash;
79
+ }
80
+ async simulateTransaction(tx, checkSignature = false) {
81
+ const transaction = core_1.prepareTransactionForBroadcasting(tx);
82
+ let url = "transaction/simulate?checkSignature=false";
83
+ if (checkSignature) {
84
+ url = "transaction/simulate";
85
+ }
86
+ const response = await this.doPostGeneric(url, transaction);
87
+ const data = response["data"] ?? {};
88
+ return core_1.TransactionOnNetwork.fromSimulateResponse(transaction, data["result"] ?? {});
89
+ }
90
+ async estimateTransactionCost(tx) {
91
+ const transaction = core_1.prepareTransactionForBroadcasting(tx);
92
+ const response = await this.doPostGeneric("transaction/cost", transaction);
93
+ return resources_1.TransactionCostResponse.fromHttpResponse(response.data);
94
+ }
95
+ async sendTransactions(txs) {
96
+ const data = txs.map((tx) => core_1.prepareTransactionForBroadcasting(tx));
97
+ const response = await this.doPostGeneric("transaction/send-multiple", data);
98
+ const numSent = Number(response.data["numOfSentTxs"] ?? 0);
99
+ const hashes = Array(txs.length).fill(null);
100
+ for (let i = 0; i < txs.length; i++) {
101
+ hashes[i] = response.data.txsHashes[i.toString()] || null;
102
+ }
103
+ return [numSent, hashes];
104
+ }
105
+ async getTransaction(txHash) {
106
+ const response = await this.doGetGeneric(`transactions/${txHash}`);
107
+ const transaction = core_1.TransactionOnNetwork.fromApiHttpResponse(txHash, response);
108
+ return transaction;
109
+ }
110
+ async getTransactions(address) {
111
+ const response = await this.doGetGeneric(`accounts/${address.toBech32()}/transactions`);
112
+ const transactions = response.map((item) => core_1.TransactionOnNetwork.fromApiHttpResponse(item.txHash, item));
113
+ return transactions;
114
+ }
115
+ async getTransactionStatus(txHash) {
116
+ const response = await this.doGetGeneric(`transactions/${txHash}?fields=status`);
117
+ const status = new core_1.TransactionStatus(response.status);
118
+ return status;
119
+ }
120
+ async awaitTransactionOnCondition(transactionHash, condition, options) {
121
+ if (!options) {
122
+ options = new resources_1.AwaitingOptions();
123
+ }
124
+ const awaiter = new core_1.TransactionWatcher(this, {
125
+ patienceMilliseconds: options.patienceInMilliseconds,
126
+ pollingIntervalMilliseconds: options.pollingIntervalInMilliseconds,
127
+ timeoutMilliseconds: options.timeoutInMilliseconds,
128
+ });
129
+ return await awaiter.awaitOnCondition(transactionHash, condition);
130
+ }
131
+ async awaitTransactionCompleted(transactionHash, options) {
132
+ if (!options) {
133
+ options = new resources_1.AwaitingOptions();
134
+ }
135
+ const awaiter = new core_1.TransactionWatcher(this, {
136
+ patienceMilliseconds: options.patienceInMilliseconds,
137
+ pollingIntervalMilliseconds: options.pollingIntervalInMilliseconds,
138
+ timeoutMilliseconds: options.timeoutInMilliseconds,
139
+ });
140
+ return await awaiter.awaitCompleted(transactionHash);
141
+ }
142
+ async getTokenOfAccount(address, token) {
143
+ let response;
144
+ if (token.nonce === 0n) {
145
+ response = await this.doGetGeneric(`accounts/${address.toBech32()}/tokens/${token.identifier}`);
146
+ }
147
+ else {
148
+ const identifier = new core_1.TokenComputer().computeExtendedIdentifier(token);
149
+ response = await this.doGetGeneric(`accounts/${address.toBech32()}/nfts/${identifier}`);
150
+ }
151
+ return tokens_1.TokenAmountOnNetwork.fromApiResponse(response);
152
+ }
153
+ async getFungibleTokensOfAccount(address, pagination) {
154
+ pagination = pagination || config_1.defaultPagination;
155
+ const url = `accounts/${address.toBech32()}/tokens?${this.buildPaginationParams(pagination)}`;
156
+ const response = await this.doGetGeneric(url);
157
+ const tokens = response.map((item) => tokens_1.TokenAmountOnNetwork.fromApiResponse(item));
158
+ return tokens;
159
+ }
160
+ async getNonFungibleTokensOfAccount(address, pagination) {
161
+ pagination = pagination || config_1.defaultPagination;
162
+ const url = `accounts/${address.toBech32()}/nfts?${this.buildPaginationParams(pagination)}`;
163
+ const response = await this.doGetGeneric(url);
164
+ const tokens = response.map((item) => tokens_1.TokenAmountOnNetwork.fromApiResponse(item));
165
+ return tokens;
166
+ }
167
+ async getDefinitionOfFungibleToken(tokenIdentifier) {
168
+ const response = await this.doGetGeneric(`tokens/${tokenIdentifier}`);
169
+ const definition = tokenDefinitions_1.DefinitionOfFungibleTokenOnNetwork.fromApiHttpResponse(response);
170
+ return definition;
171
+ }
172
+ async getDefinitionOfTokenCollection(collection) {
173
+ const response = await this.doGetGeneric(`collections/${collection}`);
174
+ const definition = tokenDefinitions_1.DefinitionOfTokenCollectionOnNetwork.fromApiHttpResponse(response);
175
+ return definition;
176
+ }
177
+ async queryContract(query) {
178
+ try {
179
+ const request = new contractQueryRequest_1.ContractQueryRequest(query).toHttpRequest();
180
+ const response = await this.doPostGeneric("query", request);
181
+ return core_1.SmartContractQueryResponse.fromHttpResponse(response, query.function);
182
+ }
183
+ catch (error) {
184
+ throw new core_1.ErrContractQuery(error);
185
+ }
186
+ }
187
+ async doGetGeneric(resourceUrl) {
188
+ const response = await this.doGet(resourceUrl);
189
+ return response;
190
+ }
191
+ async doPostGeneric(resourceUrl, payload) {
192
+ const response = await this.doPost(resourceUrl, payload);
193
+ return response;
194
+ }
195
+ buildPaginationParams(pagination) {
196
+ return `from=${pagination.from}&size=${pagination.size}`;
197
+ }
198
+ async doGet(resourceUrl) {
199
+ const url = `${this.url}/${resourceUrl}`;
200
+ try {
201
+ const response = await this.axios.default.get(url, this.config);
202
+ return response.data;
203
+ }
204
+ catch (error) {
205
+ this.handleApiError(error, resourceUrl);
206
+ }
207
+ }
208
+ async doPost(resourceUrl, payload) {
209
+ const url = `${this.url}/${resourceUrl}`;
210
+ try {
211
+ const response = await this.axios.default.post(url, payload, {
212
+ ...this.config,
213
+ headers: {
214
+ "Content-Type": "application/json",
215
+ ...this.config.headers,
216
+ },
217
+ });
218
+ const responsePayload = response.data;
219
+ return responsePayload;
220
+ }
221
+ catch (error) {
222
+ this.handleApiError(error, resourceUrl);
223
+ }
224
+ }
225
+ handleApiError(error, resourceUrl) {
226
+ if (!error.response) {
227
+ throw new core_1.ErrNetworkProvider(resourceUrl, error.toString(), error);
228
+ }
229
+ const errorData = error.response.data;
230
+ const originalErrorMessage = errorData.message || errorData.error || JSON.stringify(errorData);
231
+ throw new core_1.ErrNetworkProvider(resourceUrl, originalErrorMessage, error);
232
+ }
233
+ }
234
+ exports.ApiNetworkProvider = ApiNetworkProvider;
235
+ //# sourceMappingURL=apiNetworkProvider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"apiNetworkProvider.js","sourceRoot":"","sources":["../../src/networkProviders/apiNetworkProvider.ts"],"names":[],"mappings":";;;AAAA,kCAciB;AACjB,iDAAiD;AACjD,qDAAkD;AAClD,yCAAmF;AACnF,qCAA0C;AAC1C,qCAAiE;AACjE,2CAA4C;AAC5C,iEAA8D;AAK9D,iEA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AAmB;QAClD,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE;YACjB,MAAM,IAAI,yBAAkB,CAAC,WAAW,EAAE,KAAK,CAAC,QAAQ,EAAE,EAAE,KAAK,CAAC,CAAC;SACtE;QAED,MAAM,SAAS,GAAG,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC;QACtC,MAAM,oBAAoB,GAAG,SAAS,CAAC,OAAO,IAAI,SAAS,CAAC,KAAK,IAAI,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;QAC/F,MAAM,IAAI,yBAAkB,CAAC,WAAW,EAAE,oBAAoB,EAAE,KAAK,CAAC,CAAC;IAC3E,CAAC;CACJ;AAvQD,gDAuQC"}
@@ -0,0 +1,48 @@
1
+ /**
2
+ * An object holding network status configuration parameters.
3
+ */
4
+ export declare class BlockOnNetwork {
5
+ /**
6
+ * The raw data return by provider.
7
+ */
8
+ raw: Record<string, any>;
9
+ /**
10
+ * The shard number.
11
+ */
12
+ shard: number;
13
+ /**
14
+ * The shard nonce.
15
+ */
16
+ nonce: bigint;
17
+ /**
18
+ * The block hash.
19
+ */
20
+ hash: string;
21
+ /**
22
+ * The block previous hash.
23
+ */
24
+ previousHash: string;
25
+ /**
26
+ * The block timestamp.
27
+ */
28
+ timestamp: number;
29
+ /**
30
+ * The block timestamp.
31
+ */
32
+ round: number;
33
+ /**
34
+ * The block timestamp.
35
+ */
36
+ epoch: number;
37
+ /**
38
+ * Constructs a configuration object from a HTTP response (as returned by the provider).
39
+ */
40
+ static fromHttpResponse(payload: any): BlockOnNetwork;
41
+ }
42
+ export declare class BlockCoordinates {
43
+ nonce: bigint;
44
+ hash: string;
45
+ rootHash: string;
46
+ constructor(init?: Partial<BlockCoordinates>);
47
+ static fromHttpResponse(payload: any): BlockCoordinates;
48
+ }
@@ -0,0 +1,76 @@
1
+ "use strict";
2
+ /**
3
+ * An object holding network status configuration parameters.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.BlockCoordinates = exports.BlockOnNetwork = void 0;
7
+ class BlockOnNetwork {
8
+ constructor() {
9
+ /**
10
+ * The raw data return by provider.
11
+ */
12
+ this.raw = {};
13
+ /**
14
+ * The shard number.
15
+ */
16
+ this.shard = 0;
17
+ /**
18
+ * The shard nonce.
19
+ */
20
+ this.nonce = 0n;
21
+ /**
22
+ * The block hash.
23
+ */
24
+ this.hash = "";
25
+ /**
26
+ * The block previous hash.
27
+ */
28
+ this.previousHash = "";
29
+ /**
30
+ * The block timestamp.
31
+ */
32
+ this.timestamp = 0;
33
+ /**
34
+ * The block timestamp.
35
+ */
36
+ this.round = 0;
37
+ /**
38
+ * The block timestamp.
39
+ */
40
+ this.epoch = 0;
41
+ }
42
+ /**
43
+ * Constructs a configuration object from a HTTP response (as returned by the provider).
44
+ */
45
+ static fromHttpResponse(payload) {
46
+ let blockOnNetwork = new BlockOnNetwork();
47
+ blockOnNetwork.raw = payload;
48
+ blockOnNetwork.shard = Number(payload["shard"]) ?? 0;
49
+ blockOnNetwork.nonce = BigInt(payload["nonce"] ?? 0);
50
+ blockOnNetwork.hash = payload["hash"] ?? "";
51
+ blockOnNetwork.previousHash = payload["prevBlockHash"] ?? payload["prevHash"] ?? "";
52
+ blockOnNetwork.timestamp = Number(payload["timestamp"] ?? 0);
53
+ blockOnNetwork.round = Number(payload["round"] ?? 0);
54
+ blockOnNetwork.epoch = Number(payload["epoch"] ?? 0);
55
+ return blockOnNetwork;
56
+ }
57
+ }
58
+ exports.BlockOnNetwork = BlockOnNetwork;
59
+ class BlockCoordinates {
60
+ constructor(init) {
61
+ this.nonce = 0n;
62
+ this.hash = "";
63
+ this.rootHash = "";
64
+ Object.assign(this, init);
65
+ }
66
+ static fromHttpResponse(payload) {
67
+ const result = new BlockCoordinates();
68
+ const value = payload["blockInfo"] || {};
69
+ result.nonce = value["nonce"] || 0n;
70
+ result.hash = value["hash"] || "";
71
+ result.rootHash = value["rootHash"] || "";
72
+ return result;
73
+ }
74
+ }
75
+ exports.BlockCoordinates = BlockCoordinates;
76
+ //# sourceMappingURL=blocks.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"blocks.js","sourceRoot":"","sources":["../../src/networkProviders/blocks.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAEH,MAAa,cAAc;IAA3B;QACI;;WAEG;QACI,QAAG,GAAwB,EAAE,CAAC;QAErC;;WAEG;QACI,UAAK,GAAW,CAAC,CAAC;QAEzB;;WAEG;QACI,UAAK,GAAW,EAAE,CAAC;QAE1B;;WAEG;QACI,SAAI,GAAW,EAAE,CAAC;QAEzB;;WAEG;QACI,iBAAY,GAAW,EAAE,CAAC;QAEjC;;WAEG;QACI,cAAS,GAAW,CAAC,CAAC;QAE7B;;WAEG;QACI,UAAK,GAAW,CAAC,CAAC;QAEzB;;WAEG;QACI,UAAK,GAAW,CAAC,CAAC;IAmB7B,CAAC;IAjBG;;OAEG;IACH,MAAM,CAAC,gBAAgB,CAAC,OAAY;QAChC,IAAI,cAAc,GAAG,IAAI,cAAc,EAAE,CAAC;QAE1C,cAAc,CAAC,GAAG,GAAG,OAAO,CAAC;QAC7B,cAAc,CAAC,KAAK,GAAG,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC;QACrD,cAAc,CAAC,KAAK,GAAG,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;QACrD,cAAc,CAAC,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;QAC5C,cAAc,CAAC,YAAY,GAAG,OAAO,CAAC,eAAe,CAAC,IAAI,OAAO,CAAC,UAAU,CAAC,IAAI,EAAE,CAAC;QACpF,cAAc,CAAC,SAAS,GAAG,MAAM,CAAC,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC;QAC7D,cAAc,CAAC,KAAK,GAAG,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;QACrD,cAAc,CAAC,KAAK,GAAG,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;QAErD,OAAO,cAAc,CAAC;IAC1B,CAAC;CACJ;AA1DD,wCA0DC;AAED,MAAa,gBAAgB;IAIzB,YAAY,IAAgC;QAH5C,UAAK,GAAW,EAAE,CAAC;QACnB,SAAI,GAAW,EAAE,CAAC;QAClB,aAAQ,GAAW,EAAE,CAAC;QAElB,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IAC9B,CAAC;IACD,MAAM,CAAC,gBAAgB,CAAC,OAAY;QAChC,MAAM,MAAM,GAAG,IAAI,gBAAgB,EAAE,CAAC;QACtC,MAAM,KAAK,GAAG,OAAO,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC;QAEzC,MAAM,CAAC,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;QACpC,MAAM,CAAC,IAAI,GAAG,KAAK,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;QAClC,MAAM,CAAC,QAAQ,GAAG,KAAK,CAAC,UAAU,CAAC,IAAI,EAAE,CAAC;QAE1C,OAAO,MAAM,CAAC;IAClB,CAAC;CACJ;AAjBD,4CAiBC"}
@@ -0,0 +1,6 @@
1
+ import { IPagination } from "./interface";
2
+ export declare const defaultAxiosConfig: {
3
+ timeout: number;
4
+ transformResponse: ((data: any) => any)[];
5
+ };
6
+ export declare const defaultPagination: IPagination;
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.defaultPagination = exports.defaultAxiosConfig = void 0;
4
+ const JSONbig = require("json-bigint")({ constructorAction: "ignore" });
5
+ exports.defaultAxiosConfig = {
6
+ timeout: 5000,
7
+ // See: https://github.com/axios/axios/issues/983 regarding transformResponse
8
+ transformResponse: [
9
+ function (data) {
10
+ return JSONbig.parse(data);
11
+ },
12
+ ],
13
+ };
14
+ exports.defaultPagination = {
15
+ from: 0,
16
+ size: 100,
17
+ };
18
+ //# sourceMappingURL=config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/networkProviders/config.ts"],"names":[],"mappings":";;;AAEA,MAAM,OAAO,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC,EAAE,iBAAiB,EAAE,QAAQ,EAAE,CAAC,CAAC;AAE3D,QAAA,kBAAkB,GAAG;IAC9B,OAAO,EAAE,IAAI;IACb,6EAA6E;IAC7E,iBAAiB,EAAE;QACf,UAAU,IAAS;YACf,OAAO,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAC/B,CAAC;KACJ;CACJ,CAAC;AAEW,QAAA,iBAAiB,GAAgB;IAC1C,IAAI,EAAE,CAAC;IACP,IAAI,EAAE,GAAG;CACZ,CAAC"}
@@ -0,0 +1,9 @@
1
+ import BigNumber from "bignumber.js";
2
+ import { Address } from "../core/address";
3
+ export declare const MaxUint64AsBigNumber: BigNumber;
4
+ export declare const DcdtContractAddress: Address;
5
+ export declare const BaseUserAgent = "dharitri-sdk";
6
+ export declare const UnknownClientName = "unknown";
7
+ export declare const DEFAULT_ACCOUNT_AWAITING_POLLING_TIMEOUT_IN_MILLISECONDS = 6000;
8
+ export declare const DEFAULT_ACCOUNT_AWAITING_TIMEOUT_IN_MILLISECONDS: number;
9
+ export declare const DEFAULT_ACCOUNT_AWAITING_PATIENCE_IN_MILLISECONDS = 0;
@@ -0,0 +1,16 @@
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.DEFAULT_ACCOUNT_AWAITING_PATIENCE_IN_MILLISECONDS = exports.DEFAULT_ACCOUNT_AWAITING_TIMEOUT_IN_MILLISECONDS = exports.DEFAULT_ACCOUNT_AWAITING_POLLING_TIMEOUT_IN_MILLISECONDS = exports.UnknownClientName = exports.BaseUserAgent = exports.DcdtContractAddress = exports.MaxUint64AsBigNumber = void 0;
7
+ const bignumber_js_1 = __importDefault(require("bignumber.js"));
8
+ const address_1 = require("../core/address");
9
+ exports.MaxUint64AsBigNumber = new bignumber_js_1.default("18446744073709551615");
10
+ exports.DcdtContractAddress = new address_1.Address("drt1qqqqqqqqqqqqqqqpqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzllls6prdez");
11
+ exports.BaseUserAgent = "dharitri-sdk";
12
+ exports.UnknownClientName = "unknown";
13
+ exports.DEFAULT_ACCOUNT_AWAITING_POLLING_TIMEOUT_IN_MILLISECONDS = 6000;
14
+ exports.DEFAULT_ACCOUNT_AWAITING_TIMEOUT_IN_MILLISECONDS = 15 * exports.DEFAULT_ACCOUNT_AWAITING_POLLING_TIMEOUT_IN_MILLISECONDS;
15
+ exports.DEFAULT_ACCOUNT_AWAITING_PATIENCE_IN_MILLISECONDS = 0;
16
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/networkProviders/constants.ts"],"names":[],"mappings":";;;;;;AAAA,gEAAqC;AACrC,6CAA0C;AAE7B,QAAA,oBAAoB,GAAG,IAAI,sBAAS,CAAC,sBAAsB,CAAC,CAAC;AAC7D,QAAA,mBAAmB,GAAG,IAAI,iBAAO,CAAC,gEAAgE,CAAC,CAAC;AACpG,QAAA,aAAa,GAAG,cAAc,CAAC;AAC/B,QAAA,iBAAiB,GAAG,SAAS,CAAC;AAE9B,QAAA,wDAAwD,GAAG,IAAI,CAAC;AAChE,QAAA,gDAAgD,GACzD,EAAE,GAAG,gEAAwD,CAAC;AACrD,QAAA,iDAAiD,GAAG,CAAC,CAAC"}
@@ -0,0 +1,6 @@
1
+ import { SmartContractQuery } from "../core/smartContractQuery";
2
+ export declare class ContractQueryRequest {
3
+ private readonly query;
4
+ constructor(query: SmartContractQuery);
5
+ toHttpRequest(): any;
6
+ }
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ContractQueryRequest = void 0;
4
+ class ContractQueryRequest {
5
+ constructor(query) {
6
+ this.query = query;
7
+ }
8
+ toHttpRequest() {
9
+ let request = {};
10
+ let query = this.query;
11
+ request.scAddress = query.contract.toBech32();
12
+ request.caller = query.caller?.toBech32() ? query.caller.toBech32() : undefined;
13
+ request.funcName = query.function;
14
+ request.value = query.value ? query.value.toString() : undefined;
15
+ request.args = query.arguments?.map((x) => Buffer.from(x).toString("hex"));
16
+ return request;
17
+ }
18
+ }
19
+ exports.ContractQueryRequest = ContractQueryRequest;
20
+ //# sourceMappingURL=contractQueryRequest.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contractQueryRequest.js","sourceRoot":"","sources":["../../src/networkProviders/contractQueryRequest.ts"],"names":[],"mappings":";;;AAEA,MAAa,oBAAoB;IAG7B,YAAY,KAAyB;QACjC,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACvB,CAAC;IAED,aAAa;QACT,IAAI,OAAO,GAAQ,EAAE,CAAC;QACtB,IAAI,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;QACvB,OAAO,CAAC,SAAS,GAAG,KAAK,CAAC,QAAQ,CAAC,QAAQ,EAAE,CAAC;QAC9C,OAAO,CAAC,MAAM,GAAG,KAAK,CAAC,MAAM,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;QAChF,OAAO,CAAC,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC;QAClC,OAAO,CAAC,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;QACjE,OAAO,CAAC,IAAI,GAAG,KAAK,CAAC,SAAS,EAAE,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC;QAC3E,OAAO,OAAO,CAAC;IACnB,CAAC;CACJ;AAjBD,oDAiBC"}
@@ -0,0 +1,11 @@
1
+ export { ApiNetworkProvider } from "./apiNetworkProvider";
2
+ export * from "./interface";
3
+ export { ProxyNetworkProvider } from "./proxyNetworkProvider";
4
+ export * from "./accounts";
5
+ export * from "./blocks";
6
+ export { NetworkConfig } from "./networkConfig";
7
+ export { NetworkProviderConfig } from "./networkProviderConfig";
8
+ export { NetworkStatus } from "./networkStatus";
9
+ export * from "./resources";
10
+ export * from "./tokenDefinitions";
11
+ export * from "./tokens";
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
11
+ };
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ exports.NetworkStatus = exports.NetworkConfig = exports.ProxyNetworkProvider = exports.ApiNetworkProvider = void 0;
14
+ var apiNetworkProvider_1 = require("./apiNetworkProvider");
15
+ Object.defineProperty(exports, "ApiNetworkProvider", { enumerable: true, get: function () { return apiNetworkProvider_1.ApiNetworkProvider; } });
16
+ __exportStar(require("./interface"), exports);
17
+ var proxyNetworkProvider_1 = require("./proxyNetworkProvider");
18
+ Object.defineProperty(exports, "ProxyNetworkProvider", { enumerable: true, get: function () { return proxyNetworkProvider_1.ProxyNetworkProvider; } });
19
+ __exportStar(require("./accounts"), exports);
20
+ __exportStar(require("./blocks"), exports);
21
+ var networkConfig_1 = require("./networkConfig");
22
+ Object.defineProperty(exports, "NetworkConfig", { enumerable: true, get: function () { return networkConfig_1.NetworkConfig; } });
23
+ var networkStatus_1 = require("./networkStatus");
24
+ Object.defineProperty(exports, "NetworkStatus", { enumerable: true, get: function () { return networkStatus_1.NetworkStatus; } });
25
+ __exportStar(require("./resources"), exports);
26
+ __exportStar(require("./tokenDefinitions"), exports);
27
+ __exportStar(require("./tokens"), exports);
28
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/networkProviders/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,2DAA0D;AAAjD,wHAAA,kBAAkB,OAAA;AAC3B,8CAA4B;AAC5B,+DAA8D;AAArD,4HAAA,oBAAoB,OAAA;AAE7B,6CAA2B;AAC3B,2CAAyB;AACzB,iDAAgD;AAAvC,8GAAA,aAAa,OAAA;AAEtB,iDAAgD;AAAvC,8GAAA,aAAa,OAAA;AACtB,8CAA4B;AAC5B,qDAAmC;AACnC,2CAAyB"}