@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,263 @@
1
+ /// <reference types="node" />
2
+ import { BigNumber } from "bignumber.js";
3
+ import { Address } from "./address";
4
+ import { INetworkConfig, IPlainTransactionObject } from "./interfaces";
5
+ /**
6
+ * An abstraction for creating and signing transactions.
7
+ */
8
+ export declare class Transaction {
9
+ /**
10
+ * The nonce of the transaction (the account sequence number of the sender).
11
+ */
12
+ nonce: bigint;
13
+ /**
14
+ * The value to transfer.
15
+ */
16
+ value: bigint;
17
+ /**
18
+ * The address of the sender.
19
+ */
20
+ sender: Address;
21
+ /**
22
+ * The address of the receiver.
23
+ */
24
+ receiver: Address;
25
+ /**
26
+ * The username of the sender.
27
+ */
28
+ senderUsername: string;
29
+ /**
30
+ * The username of the receiver.
31
+ */
32
+ receiverUsername: string;
33
+ /**
34
+ * The gas price to be used.
35
+ */
36
+ gasPrice: bigint;
37
+ /**
38
+ * The maximum amount of gas to be consumed when processing the transaction.
39
+ */
40
+ gasLimit: bigint;
41
+ /**
42
+ * The payload of the transaction.
43
+ */
44
+ data: Uint8Array;
45
+ /**
46
+ * The chain ID of the Network (e.g. "1" for Mainnet).
47
+ */
48
+ chainID: string;
49
+ /**
50
+ * The version, required by the Network in order to correctly interpret the contents of the transaction.
51
+ */
52
+ version: number;
53
+ /**
54
+ * The options field, useful for describing different settings available for transactions.
55
+ */
56
+ options: number;
57
+ /**
58
+ * The address of the guardian, in bech32 format.
59
+ */
60
+ guardian: Address;
61
+ /**
62
+ * The relayer address.
63
+ * Note: in the next major version, `sender`, `receiver` and `guardian` will also have the type `Address`, instead of `string`.
64
+ */
65
+ relayer: Address;
66
+ /**
67
+ * The signature.
68
+ */
69
+ signature: Uint8Array;
70
+ /**
71
+ * The signature of the guardian.
72
+ */
73
+ guardianSignature: Uint8Array;
74
+ /**
75
+ * The signature of the relayer.
76
+ */
77
+ relayerSignature: Uint8Array;
78
+ /**
79
+ * Creates a new Transaction object.
80
+ */
81
+ constructor(options: {
82
+ nonce?: bigint;
83
+ value?: bigint;
84
+ sender: Address;
85
+ receiver: Address;
86
+ senderUsername?: string;
87
+ receiverUsername?: string;
88
+ gasPrice?: bigint;
89
+ gasLimit: bigint;
90
+ data?: Uint8Array;
91
+ chainID: string;
92
+ version?: number;
93
+ options?: number;
94
+ guardian?: Address;
95
+ relayer?: Address;
96
+ signature?: Uint8Array;
97
+ guardianSignature?: Uint8Array;
98
+ relayerSignature?: Uint8Array;
99
+ });
100
+ /**
101
+ * @deprecated method, use {@link nonce} property instead.
102
+ */
103
+ getNonce(): bigint;
104
+ /**
105
+ * @deprecated method, use {@link nonce} property instead.
106
+ * Sets the account sequence number of the sender. Must be done prior signing.
107
+ */
108
+ setNonce(nonce: bigint): void;
109
+ /**
110
+ * @deprecated method, use {@link value} property instead.
111
+ */
112
+ getValue(): bigint;
113
+ /**
114
+ * @deprecated method, use {@link value} property instead.
115
+ */
116
+ setValue(value: bigint): void;
117
+ /**
118
+ * @deprecated method, use {@link sender} property instead.
119
+ */
120
+ getSender(): Address;
121
+ /**
122
+ * @deprecated method, use {@link sender} property instead.
123
+ */
124
+ setSender(sender: Address): void;
125
+ /**
126
+ * @deprecated method, use {@link receiver} property instead.
127
+ */
128
+ getReceiver(): Address;
129
+ /**
130
+ * @deprecated method, use {@link senderUsername} property instead.
131
+ */
132
+ getSenderUsername(): string;
133
+ /**
134
+ * @deprecated method, use {@link senderUsername} property instead.
135
+ */
136
+ setSenderUsername(senderUsername: string): void;
137
+ /**
138
+ * @deprecated method, use {@link receiverUsername} property instead.
139
+ */
140
+ getReceiverUsername(): string;
141
+ /**
142
+ * @deprecated method, use {@link receiverUsername} property instead.
143
+ */
144
+ setReceiverUsername(receiverUsername: string): void;
145
+ /**
146
+ * @deprecated method, use {@link guardian} property instead.
147
+ */
148
+ getGuardian(): Address;
149
+ /**
150
+ * @deprecated method, use {@link gasPrice} property instead.
151
+ */
152
+ getGasPrice(): bigint;
153
+ /**
154
+ * @deprecated method, use {@link gasPrice} property instead.
155
+ */
156
+ setGasPrice(gasPrice: bigint): void;
157
+ /**
158
+ * @deprecated method, use {@link gasLimit} property instead.
159
+ */
160
+ getGasLimit(): bigint;
161
+ /**
162
+ * @deprecated method, use {@link gasLimit} property instead.
163
+ */
164
+ setGasLimit(gasLimit: bigint): void;
165
+ /**
166
+ * @deprecated method, use {@link data} property instead.
167
+ */
168
+ getData(): Uint8Array;
169
+ /**
170
+ * @deprecated method, use {@link chainID} property instead.
171
+ */
172
+ getChainID(): string;
173
+ /**
174
+ * @deprecated method, use {@link chainID} property instead.
175
+ */
176
+ setChainID(chainID: string): void;
177
+ /**
178
+ * @deprecated method, use {@link version} property instead.
179
+ */
180
+ getVersion(): number;
181
+ /**
182
+ * @deprecated method, use {@link version} property instead.
183
+ */
184
+ setVersion(version: number): void;
185
+ /**
186
+ * @deprecated method, use {@link options} property instead.
187
+ */
188
+ getOptions(): number;
189
+ /**
190
+ * @deprecated method, use {@link options} property instead.
191
+ *
192
+ * Question for review: check how the options are set by sdk-dapp, wallet, ledger, extension.
193
+ */
194
+ setOptions(options: number): void;
195
+ /**
196
+ * @deprecated method, use{@link signature} property instead.
197
+ */
198
+ getSignature(): Buffer;
199
+ /**
200
+ * @deprecated method, use {@link guardianSignature} property instead.
201
+ */
202
+ getGuardianSignature(): Buffer;
203
+ /**
204
+ * @deprecated method, use {@link guardian} property instead.
205
+ */
206
+ setGuardian(guardian: Address): void;
207
+ /**
208
+ * @deprecated method, use "TransactionComputer.computeBytesForSigning()" instead.
209
+ * Serializes a transaction to a sequence of bytes, ready to be signed.
210
+ * This function is called internally by signers.
211
+ */
212
+ serializeForSigning(): Buffer;
213
+ /**
214
+ * Checks the integrity of the guarded transaction
215
+ */
216
+ isGuardedTransaction(): boolean;
217
+ /**
218
+ * Converts the transaction object into a ready-to-serialize, plain JavaScript object.
219
+ * This function is called internally within the signing procedure.
220
+ */
221
+ toPlainObject(): IPlainTransactionObject;
222
+ /**
223
+ * @deprecated method, use {@link toPlainObject} instead.
224
+ * Converts a plain object transaction into a Transaction Object.
225
+ *
226
+ * @param plainObjectTransaction Raw data of a transaction, usually obtained by calling toPlainObject()
227
+ */
228
+ static fromPlainObject(plainObjectTransaction: IPlainTransactionObject): Transaction;
229
+ /**
230
+ * Converts a plain object transaction into a Transaction Object.
231
+ *
232
+ * @param plainObjectTransaction Raw data of a transaction, usually obtained by calling toPlainObject()
233
+ */
234
+ static newFromPlainObject(plainObjectTransaction: IPlainTransactionObject): Transaction;
235
+ /**
236
+ * @deprecated method, use {@link signature} property instead.
237
+ * Applies the signature on the transaction.
238
+ *
239
+ * @param signature The signature, as computed by a signer.
240
+ */
241
+ applySignature(signature: Uint8Array): void;
242
+ /**
243
+ * @deprecated method, use {@link guardianSignature} property instead.
244
+ * Applies the guardian signature on the transaction.
245
+ *
246
+ * @param guardianSignature The signature, as computed by a signer.
247
+ */
248
+ applyGuardianSignature(guardianSignature: Uint8Array): void;
249
+ /**
250
+ * Converts a transaction to a ready-to-broadcast object.
251
+ * Called internally by the network provider.
252
+ */
253
+ toSendable(): any;
254
+ /**
255
+ * @deprecated method, use "TransactionComputer.computeTransactionFee()" instead.
256
+ *
257
+ * Computes the current transaction fee based on the {@link NetworkConfig} and transaction properties
258
+ * @param networkConfig {@link NetworkConfig}
259
+ */
260
+ computeFee(networkConfig: INetworkConfig): BigNumber;
261
+ private toBase64OrUndefined;
262
+ private toHexOrUndefined;
263
+ }
@@ -0,0 +1,323 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Transaction = void 0;
4
+ const bignumber_js_1 = require("bignumber.js");
5
+ const address_1 = require("./address");
6
+ const constants_1 = require("./constants");
7
+ const signature_1 = require("./signature");
8
+ const transactionComputer_1 = require("./transactionComputer");
9
+ /**
10
+ * An abstraction for creating and signing transactions.
11
+ */
12
+ class Transaction {
13
+ /**
14
+ * Creates a new Transaction object.
15
+ */
16
+ constructor(options) {
17
+ this.nonce = options.nonce ?? 0n;
18
+ this.value = options.value ?? 0n;
19
+ this.sender = options.sender;
20
+ this.receiver = options.receiver;
21
+ this.senderUsername = options.senderUsername || "";
22
+ this.receiverUsername = options.receiverUsername || "";
23
+ this.gasPrice = options.gasPrice ?? BigInt(constants_1.TRANSACTION_MIN_GAS_PRICE);
24
+ this.gasLimit = options.gasLimit;
25
+ this.data = options.data ?? new Uint8Array();
26
+ this.chainID = options.chainID.valueOf();
27
+ this.version = options.version ?? constants_1.TRANSACTION_VERSION_DEFAULT;
28
+ this.options = options.options ?? constants_1.TRANSACTION_OPTIONS_DEFAULT;
29
+ this.guardian = options.guardian ?? address_1.Address.empty();
30
+ this.relayer = options.relayer ? options.relayer : address_1.Address.empty();
31
+ this.signature = options.signature || Buffer.from([]);
32
+ this.guardianSignature = options.guardianSignature || Buffer.from([]);
33
+ this.relayerSignature = options.relayerSignature || Buffer.from([]);
34
+ }
35
+ /**
36
+ * @deprecated method, use {@link nonce} property instead.
37
+ */
38
+ getNonce() {
39
+ return this.nonce;
40
+ }
41
+ /**
42
+ * @deprecated method, use {@link nonce} property instead.
43
+ * Sets the account sequence number of the sender. Must be done prior signing.
44
+ */
45
+ setNonce(nonce) {
46
+ this.nonce = nonce;
47
+ }
48
+ /**
49
+ * @deprecated method, use {@link value} property instead.
50
+ */
51
+ getValue() {
52
+ return this.value;
53
+ }
54
+ /**
55
+ * @deprecated method, use {@link value} property instead.
56
+ */
57
+ setValue(value) {
58
+ this.value = value;
59
+ }
60
+ /**
61
+ * @deprecated method, use {@link sender} property instead.
62
+ */
63
+ getSender() {
64
+ return this.sender;
65
+ }
66
+ /**
67
+ * @deprecated method, use {@link sender} property instead.
68
+ */
69
+ setSender(sender) {
70
+ this.sender = sender;
71
+ }
72
+ /**
73
+ * @deprecated method, use {@link receiver} property instead.
74
+ */
75
+ getReceiver() {
76
+ return this.receiver;
77
+ }
78
+ /**
79
+ * @deprecated method, use {@link senderUsername} property instead.
80
+ */
81
+ getSenderUsername() {
82
+ return this.senderUsername;
83
+ }
84
+ /**
85
+ * @deprecated method, use {@link senderUsername} property instead.
86
+ */
87
+ setSenderUsername(senderUsername) {
88
+ this.senderUsername = senderUsername;
89
+ }
90
+ /**
91
+ * @deprecated method, use {@link receiverUsername} property instead.
92
+ */
93
+ getReceiverUsername() {
94
+ return this.receiverUsername;
95
+ }
96
+ /**
97
+ * @deprecated method, use {@link receiverUsername} property instead.
98
+ */
99
+ setReceiverUsername(receiverUsername) {
100
+ this.receiverUsername = receiverUsername;
101
+ }
102
+ /**
103
+ * @deprecated method, use {@link guardian} property instead.
104
+ */
105
+ getGuardian() {
106
+ return this.guardian;
107
+ }
108
+ /**
109
+ * @deprecated method, use {@link gasPrice} property instead.
110
+ */
111
+ getGasPrice() {
112
+ return this.gasPrice;
113
+ }
114
+ /**
115
+ * @deprecated method, use {@link gasPrice} property instead.
116
+ */
117
+ setGasPrice(gasPrice) {
118
+ this.gasPrice = gasPrice;
119
+ }
120
+ /**
121
+ * @deprecated method, use {@link gasLimit} property instead.
122
+ */
123
+ getGasLimit() {
124
+ return this.gasLimit;
125
+ }
126
+ /**
127
+ * @deprecated method, use {@link gasLimit} property instead.
128
+ */
129
+ setGasLimit(gasLimit) {
130
+ this.gasLimit = gasLimit;
131
+ }
132
+ /**
133
+ * @deprecated method, use {@link data} property instead.
134
+ */
135
+ getData() {
136
+ return this.data;
137
+ }
138
+ /**
139
+ * @deprecated method, use {@link chainID} property instead.
140
+ */
141
+ getChainID() {
142
+ return this.chainID;
143
+ }
144
+ /**
145
+ * @deprecated method, use {@link chainID} property instead.
146
+ */
147
+ setChainID(chainID) {
148
+ this.chainID = chainID;
149
+ }
150
+ /**
151
+ * @deprecated method, use {@link version} property instead.
152
+ */
153
+ getVersion() {
154
+ return this.version;
155
+ }
156
+ /**
157
+ * @deprecated method, use {@link version} property instead.
158
+ */
159
+ setVersion(version) {
160
+ this.version = version;
161
+ }
162
+ /**
163
+ * @deprecated method, use {@link options} property instead.
164
+ */
165
+ getOptions() {
166
+ return this.options;
167
+ }
168
+ /**
169
+ * @deprecated method, use {@link options} property instead.
170
+ *
171
+ * Question for review: check how the options are set by sdk-dapp, wallet, ledger, extension.
172
+ */
173
+ setOptions(options) {
174
+ this.options = options;
175
+ }
176
+ /**
177
+ * @deprecated method, use{@link signature} property instead.
178
+ */
179
+ getSignature() {
180
+ return Buffer.from(this.signature);
181
+ }
182
+ /**
183
+ * @deprecated method, use {@link guardianSignature} property instead.
184
+ */
185
+ getGuardianSignature() {
186
+ return Buffer.from(this.guardianSignature);
187
+ }
188
+ /**
189
+ * @deprecated method, use {@link guardian} property instead.
190
+ */
191
+ setGuardian(guardian) {
192
+ this.guardian = guardian;
193
+ }
194
+ /**
195
+ * @deprecated method, use "TransactionComputer.computeBytesForSigning()" instead.
196
+ * Serializes a transaction to a sequence of bytes, ready to be signed.
197
+ * This function is called internally by signers.
198
+ */
199
+ serializeForSigning() {
200
+ const computer = new transactionComputer_1.TransactionComputer();
201
+ const bytes = computer.computeBytesForSigning(this);
202
+ return Buffer.from(bytes);
203
+ }
204
+ /**
205
+ * Checks the integrity of the guarded transaction
206
+ */
207
+ isGuardedTransaction() {
208
+ const computer = new transactionComputer_1.TransactionComputer();
209
+ const hasGuardian = !this.guardian.isEmpty();
210
+ const hasGuardianSignature = this.guardianSignature.length > 0;
211
+ return computer.hasOptionsSetForGuardedTransaction(this) && hasGuardian && hasGuardianSignature;
212
+ }
213
+ /**
214
+ * Converts the transaction object into a ready-to-serialize, plain JavaScript object.
215
+ * This function is called internally within the signing procedure.
216
+ */
217
+ toPlainObject() {
218
+ const plainObject = {
219
+ nonce: Number(this.nonce),
220
+ value: this.value.toString(),
221
+ receiver: this.receiver.toBech32(),
222
+ sender: this.sender.toBech32(),
223
+ senderUsername: this.toBase64OrUndefined(this.senderUsername),
224
+ receiverUsername: this.toBase64OrUndefined(this.receiverUsername),
225
+ gasPrice: Number(this.gasPrice),
226
+ gasLimit: Number(this.gasLimit),
227
+ data: this.toBase64OrUndefined(this.data),
228
+ chainID: this.chainID.valueOf(),
229
+ version: this.version,
230
+ options: this.options == 0 ? undefined : this.options,
231
+ guardian: this.guardian.isEmpty() ? undefined : this.guardian.toBech32(),
232
+ relayer: this.relayer.isEmpty() ? undefined : this.relayer.toBech32(),
233
+ signature: this.toHexOrUndefined(this.signature),
234
+ guardianSignature: this.toHexOrUndefined(this.guardianSignature),
235
+ relayerSignature: this.toHexOrUndefined(this.relayerSignature),
236
+ };
237
+ return plainObject;
238
+ }
239
+ /**
240
+ * @deprecated method, use {@link toPlainObject} instead.
241
+ * Converts a plain object transaction into a Transaction Object.
242
+ *
243
+ * @param plainObjectTransaction Raw data of a transaction, usually obtained by calling toPlainObject()
244
+ */
245
+ static fromPlainObject(plainObjectTransaction) {
246
+ return Transaction.newFromPlainObject(plainObjectTransaction);
247
+ }
248
+ /**
249
+ * Converts a plain object transaction into a Transaction Object.
250
+ *
251
+ * @param plainObjectTransaction Raw data of a transaction, usually obtained by calling toPlainObject()
252
+ */
253
+ static newFromPlainObject(plainObjectTransaction) {
254
+ const transaction = new Transaction({
255
+ nonce: BigInt(plainObjectTransaction.nonce),
256
+ value: BigInt(plainObjectTransaction.value || ""),
257
+ receiver: address_1.Address.newFromBech32(plainObjectTransaction.receiver),
258
+ receiverUsername: Buffer.from(plainObjectTransaction.receiverUsername || "", "base64").toString(),
259
+ sender: address_1.Address.newFromBech32(plainObjectTransaction.sender),
260
+ senderUsername: Buffer.from(plainObjectTransaction.senderUsername || "", "base64").toString(),
261
+ guardian: plainObjectTransaction.guardian
262
+ ? address_1.Address.newFromBech32(plainObjectTransaction.guardian)
263
+ : address_1.Address.empty(),
264
+ relayer: plainObjectTransaction.relayer
265
+ ? address_1.Address.newFromBech32(plainObjectTransaction.relayer)
266
+ : address_1.Address.empty(),
267
+ gasPrice: BigInt(plainObjectTransaction.gasPrice),
268
+ gasLimit: BigInt(plainObjectTransaction.gasLimit),
269
+ data: Buffer.from(plainObjectTransaction.data || "", "base64"),
270
+ chainID: String(plainObjectTransaction.chainID),
271
+ version: Number(plainObjectTransaction.version),
272
+ options: plainObjectTransaction.options ? Number(plainObjectTransaction.options) : undefined,
273
+ signature: Buffer.from(plainObjectTransaction.signature || "", "hex"),
274
+ guardianSignature: Buffer.from(plainObjectTransaction.guardianSignature || "", "hex"),
275
+ relayerSignature: Buffer.from(plainObjectTransaction.relayerSignature || "", "hex"),
276
+ });
277
+ return transaction;
278
+ }
279
+ /**
280
+ * @deprecated method, use {@link signature} property instead.
281
+ * Applies the signature on the transaction.
282
+ *
283
+ * @param signature The signature, as computed by a signer.
284
+ */
285
+ applySignature(signature) {
286
+ this.signature = signature_1.interpretSignatureAsBuffer(signature);
287
+ }
288
+ /**
289
+ * @deprecated method, use {@link guardianSignature} property instead.
290
+ * Applies the guardian signature on the transaction.
291
+ *
292
+ * @param guardianSignature The signature, as computed by a signer.
293
+ */
294
+ applyGuardianSignature(guardianSignature) {
295
+ this.guardianSignature = signature_1.interpretSignatureAsBuffer(guardianSignature);
296
+ }
297
+ /**
298
+ * Converts a transaction to a ready-to-broadcast object.
299
+ * Called internally by the network provider.
300
+ */
301
+ toSendable() {
302
+ return this.toPlainObject();
303
+ }
304
+ /**
305
+ * @deprecated method, use "TransactionComputer.computeTransactionFee()" instead.
306
+ *
307
+ * Computes the current transaction fee based on the {@link NetworkConfig} and transaction properties
308
+ * @param networkConfig {@link NetworkConfig}
309
+ */
310
+ computeFee(networkConfig) {
311
+ const computer = new transactionComputer_1.TransactionComputer();
312
+ const fee = computer.computeTransactionFee(this, networkConfig);
313
+ return new bignumber_js_1.BigNumber(fee.toString());
314
+ }
315
+ toBase64OrUndefined(value) {
316
+ return value && value.length ? Buffer.from(value).toString("base64") : undefined;
317
+ }
318
+ toHexOrUndefined(value) {
319
+ return value && value.length ? Buffer.from(value).toString("hex") : undefined;
320
+ }
321
+ }
322
+ exports.Transaction = Transaction;
323
+ //# sourceMappingURL=transaction.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transaction.js","sourceRoot":"","sources":["../../src/core/transaction.ts"],"names":[],"mappings":";;;AAAA,+CAAyC;AACzC,uCAAoC;AACpC,2CAAkH;AAElH,2CAAyD;AACzD,+DAA4D;AAE5D;;GAEG;AACH,MAAa,WAAW;IAuFpB;;OAEG;IACH,YAAmB,OAkBlB;QACG,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,IAAI,EAAE,CAAC;QACjC,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,IAAI,EAAE,CAAC;QACjC,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;QAC7B,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC;QACjC,IAAI,CAAC,cAAc,GAAG,OAAO,CAAC,cAAc,IAAI,EAAE,CAAC;QACnD,IAAI,CAAC,gBAAgB,GAAG,OAAO,CAAC,gBAAgB,IAAI,EAAE,CAAC;QACvD,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,QAAQ,IAAI,MAAM,CAAC,qCAAyB,CAAC,CAAC;QACtE,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,QAAQ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CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IACrF,CAAC;IAEO,gBAAgB,CAAC,KAAkB;QACvC,OAAO,KAAK,IAAI,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IAClF,CAAC;CACJ;AArcD,kCAqcC"}
@@ -0,0 +1,32 @@
1
+ import { Address } from "./address";
2
+ import { Transaction } from "./transaction";
3
+ interface Config {
4
+ chainID: string;
5
+ minGasLimit: bigint;
6
+ gasLimitPerByte: bigint;
7
+ }
8
+ /**
9
+ * @internal
10
+ */
11
+ export declare class TransactionBuilder {
12
+ private config;
13
+ private sender;
14
+ private receiver;
15
+ private dataParts;
16
+ private providedGasLimit;
17
+ private addDataMovementGas;
18
+ private amount?;
19
+ constructor(options: {
20
+ config: Config;
21
+ sender: Address;
22
+ receiver: Address;
23
+ dataParts: string[];
24
+ gasLimit: bigint;
25
+ addDataMovementGas: boolean;
26
+ amount?: bigint;
27
+ });
28
+ private computeGasLimit;
29
+ private buildTransactionPayload;
30
+ build(): Transaction;
31
+ }
32
+ export {};
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TransactionBuilder = void 0;
4
+ const constants_1 = require("./constants");
5
+ const transaction_1 = require("./transaction");
6
+ /**
7
+ * @internal
8
+ */
9
+ class TransactionBuilder {
10
+ constructor(options) {
11
+ this.config = options.config;
12
+ this.sender = options.sender;
13
+ this.receiver = options.receiver;
14
+ this.dataParts = options.dataParts;
15
+ this.providedGasLimit = options.gasLimit;
16
+ this.addDataMovementGas = options.addDataMovementGas;
17
+ this.amount = options.amount;
18
+ }
19
+ computeGasLimit(payload) {
20
+ if (!this.addDataMovementGas) {
21
+ return this.providedGasLimit;
22
+ }
23
+ const dataMovementGas = this.config.minGasLimit + this.config.gasLimitPerByte * BigInt(payload.length);
24
+ const gasLimit = dataMovementGas + this.providedGasLimit;
25
+ return gasLimit;
26
+ }
27
+ buildTransactionPayload() {
28
+ const data = this.dataParts.join(constants_1.ARGUMENTS_SEPARATOR);
29
+ return Buffer.from(data);
30
+ }
31
+ build() {
32
+ const data = this.buildTransactionPayload();
33
+ const gasLimit = this.computeGasLimit(data);
34
+ return new transaction_1.Transaction({
35
+ sender: this.sender,
36
+ receiver: this.receiver,
37
+ gasLimit: gasLimit,
38
+ value: this.amount || 0n,
39
+ data: data.valueOf(),
40
+ chainID: this.config.chainID,
41
+ });
42
+ }
43
+ }
44
+ exports.TransactionBuilder = TransactionBuilder;
45
+ //# sourceMappingURL=transactionBuilder.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transactionBuilder.js","sourceRoot":"","sources":["../../src/core/transactionBuilder.ts"],"names":[],"mappings":";;;AACA,2CAAkD;AAClD,+CAA4C;AAQ5C;;GAEG;AACH,MAAa,kBAAkB;IAS3B,YAAY,OAQX;QACG,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;QAC7B,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;QAC7B,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC;QACjC,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC;QACnC,IAAI,CAAC,gBAAgB,GAAG,OAAO,CAAC,QAAQ,CAAC;QACzC,IAAI,CAAC,kBAAkB,GAAG,OAAO,CAAC,kBAAkB,CAAC;QACrD,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IACjC,CAAC;IAEO,eAAe,CAAC,OAAmB;QACvC,IAAI,CAAC,IAAI,CAAC,kBAAkB,EAAE;YAC1B,OAAO,IAAI,CAAC,gBAAgB,CAAC;SAChC;QAED,MAAM,eAAe,GAAG,IAAI,CAAC,MAAM,CAAC,WAAW,GAAG,IAAI,CAAC,MAAM,CAAC,eAAe,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