@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 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/transactionsOutcomeParsers/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2FAAyE;AACzE,8FAA4E;AAC5E,8CAA4B;AAC5B,4DAA0C"}
@@ -0,0 +1,23 @@
1
+ import { Address } from "../core/address";
2
+ import { TransactionEvent } from "../core/transactionEvents";
3
+ import { TransactionLogs } from "../core/transactionLogs";
4
+ import { TransactionOnNetwork } from "../core/transactionOnNetwork";
5
+ export declare class SmartContractResult {
6
+ raw: Record<string, any>;
7
+ sender: Address;
8
+ receiver: Address;
9
+ data: Uint8Array;
10
+ logs: TransactionLogs;
11
+ constructor(init: Partial<SmartContractResult>);
12
+ }
13
+ export declare class SmartContractCallOutcome {
14
+ function: string;
15
+ returnDataParts: Uint8Array[];
16
+ returnMessage: string;
17
+ returnCode: string;
18
+ constructor(init: Partial<SmartContractCallOutcome>);
19
+ }
20
+ export declare function findEventsByPredicate(transactionOutcome: TransactionOnNetwork, predicate: (event: TransactionEvent) => boolean): TransactionEvent[];
21
+ export declare function findEventsByIdentifier(transactionOutcome: TransactionOnNetwork, identifier: string): TransactionEvent[];
22
+ export declare function findEventsByFirstTopic(transactionOutcome: TransactionOnNetwork, topic: string): TransactionEvent[];
23
+ export declare function gatherAllEvents(transactionOutcome: TransactionOnNetwork): TransactionEvent[];
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.gatherAllEvents = exports.findEventsByFirstTopic = exports.findEventsByIdentifier = exports.findEventsByPredicate = exports.SmartContractCallOutcome = exports.SmartContractResult = void 0;
4
+ const address_1 = require("../core/address");
5
+ const transactionLogs_1 = require("../core/transactionLogs");
6
+ class SmartContractResult {
7
+ constructor(init) {
8
+ this.sender = address_1.Address.empty();
9
+ this.receiver = address_1.Address.empty();
10
+ this.data = new Uint8Array();
11
+ this.logs = new transactionLogs_1.TransactionLogs({});
12
+ this.raw = {};
13
+ Object.assign(this, init);
14
+ }
15
+ }
16
+ exports.SmartContractResult = SmartContractResult;
17
+ class SmartContractCallOutcome {
18
+ constructor(init) {
19
+ this.function = "";
20
+ this.returnDataParts = [];
21
+ this.returnMessage = "";
22
+ this.returnCode = "";
23
+ Object.assign(this, init);
24
+ }
25
+ }
26
+ exports.SmartContractCallOutcome = SmartContractCallOutcome;
27
+ function findEventsByPredicate(transactionOutcome, predicate) {
28
+ return gatherAllEvents(transactionOutcome).filter(predicate);
29
+ }
30
+ exports.findEventsByPredicate = findEventsByPredicate;
31
+ function findEventsByIdentifier(transactionOutcome, identifier) {
32
+ return findEventsByPredicate(transactionOutcome, (event) => event.identifier == identifier);
33
+ }
34
+ exports.findEventsByIdentifier = findEventsByIdentifier;
35
+ function findEventsByFirstTopic(transactionOutcome, topic) {
36
+ return findEventsByPredicate(transactionOutcome, (event) => event.topics[0]?.toString() == topic);
37
+ }
38
+ exports.findEventsByFirstTopic = findEventsByFirstTopic;
39
+ function gatherAllEvents(transactionOutcome) {
40
+ const allEvents = [];
41
+ allEvents.push(...transactionOutcome.logs.events);
42
+ for (const item of transactionOutcome.smartContractResults) {
43
+ allEvents.push(...item.logs.events);
44
+ }
45
+ return allEvents;
46
+ }
47
+ exports.gatherAllEvents = gatherAllEvents;
48
+ //# sourceMappingURL=resources.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resources.js","sourceRoot":"","sources":["../../src/transactionsOutcomeParsers/resources.ts"],"names":[],"mappings":";;;AAAA,6CAA0C;AAE1C,6DAA0D;AAG1D,MAAa,mBAAmB;IAO5B,YAAY,IAAkC;QAC1C,IAAI,CAAC,MAAM,GAAG,iBAAO,CAAC,KAAK,EAAE,CAAC;QAC9B,IAAI,CAAC,QAAQ,GAAG,iBAAO,CAAC,KAAK,EAAE,CAAC;QAChC,IAAI,CAAC,IAAI,GAAG,IAAI,UAAU,EAAE,CAAC;QAC7B,IAAI,CAAC,IAAI,GAAG,IAAI,iCAAe,CAAC,EAAE,CAAC,CAAC;QACpC,IAAI,CAAC,GAAG,GAAG,EAAE,CAAC;QAEd,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IAC9B,CAAC;CACJ;AAhBD,kDAgBC;AAED,MAAa,wBAAwB;IAMjC,YAAY,IAAuC;QAC/C,IAAI,CAAC,QAAQ,GAAG,EAAE,CAAC;QACnB,IAAI,CAAC,eAAe,GAAG,EAAE,CAAC;QAC1B,IAAI,CAAC,aAAa,GAAG,EAAE,CAAC;QACxB,IAAI,CAAC,UAAU,GAAG,EAAE,CAAC;QAErB,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IAC9B,CAAC;CACJ;AAdD,4DAcC;AAED,SAAgB,qBAAqB,CACjC,kBAAwC,EACxC,SAA+C;IAE/C,OAAO,eAAe,CAAC,kBAAkB,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;AACjE,CAAC;AALD,sDAKC;AAED,SAAgB,sBAAsB,CAClC,kBAAwC,EACxC,UAAkB;IAElB,OAAO,qBAAqB,CAAC,kBAAkB,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,UAAU,IAAI,UAAU,CAAC,CAAC;AAChG,CAAC;AALD,wDAKC;AAED,SAAgB,sBAAsB,CAAC,kBAAwC,EAAE,KAAa;IAC1F,OAAO,qBAAqB,CAAC,kBAAkB,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,IAAI,KAAK,CAAC,CAAC;AACtG,CAAC;AAFD,wDAEC;AAED,SAAgB,eAAe,CAAC,kBAAwC;IACpE,MAAM,SAAS,GAAG,EAAE,CAAC;IAErB,SAAS,CAAC,IAAI,CAAC,GAAG,kBAAkB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAElD,KAAK,MAAM,IAAI,IAAI,kBAAkB,CAAC,oBAAoB,EAAE;QACxD,SAAS,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;KACvC;IAED,OAAO,SAAS,CAAC;AACrB,CAAC;AAVD,0CAUC"}
@@ -0,0 +1,16 @@
1
+ import { Abi } from "../abi";
2
+ import { TransactionEvent } from "../core/transactionEvents";
3
+ export declare class TransactionEventsParser {
4
+ private readonly abi;
5
+ private readonly firstTopicIsIdentifier;
6
+ constructor(options: {
7
+ abi: Abi;
8
+ firstTopicIsIdentifier?: boolean;
9
+ });
10
+ parseEvents(options: {
11
+ events: TransactionEvent[];
12
+ }): any[];
13
+ parseEvent(options: {
14
+ event: TransactionEvent;
15
+ }): any;
16
+ }
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TransactionEventsParser = void 0;
4
+ const abi_1 = require("../abi");
5
+ class TransactionEventsParser {
6
+ constructor(options) {
7
+ this.abi = options.abi;
8
+ // By default, we consider that the first topic is the event identifier.
9
+ // This is true for log entries emitted by smart contracts:
10
+ // https://github.com/terradharitri/drt-go-chain-vm/blob/v1.5.27/vmhost/contexts/output.go#L270
11
+ // https://github.com/terradharitri/drt-go-chain-vm/blob/v1.5.27/vmhost/contexts/output.go#L283
12
+ this.firstTopicIsIdentifier = options.firstTopicIsIdentifier ?? true;
13
+ }
14
+ parseEvents(options) {
15
+ const results = [];
16
+ for (const event of options.events) {
17
+ const parsedEvent = this.parseEvent({ event });
18
+ results.push(parsedEvent);
19
+ }
20
+ return results;
21
+ }
22
+ parseEvent(options) {
23
+ const topics = options.event.topics.map((topic) => Buffer.from(topic));
24
+ const abiIdentifier = this.firstTopicIsIdentifier ? topics[0]?.toString() : options.event.identifier;
25
+ if (this.firstTopicIsIdentifier) {
26
+ topics.shift();
27
+ }
28
+ const dataItems = options.event.additionalData.map((dataItem) => Buffer.from(dataItem));
29
+ const eventDefinition = this.abi.getEvent(abiIdentifier);
30
+ const result = {};
31
+ const argsSerializer = new abi_1.ArgSerializer();
32
+ // "Indexed" ABI "event.inputs" correspond to "event.topics[1:]":
33
+ const indexedInputs = eventDefinition.inputs.filter((input) => input.indexed);
34
+ const decodedTopics = argsSerializer.buffersToValues(topics, indexedInputs);
35
+ for (let i = 0; i < indexedInputs.length; i++) {
36
+ result[indexedInputs[i].name] = decodedTopics[i].valueOf();
37
+ }
38
+ // "Non-indexed" ABI "event.inputs" correspond to "event.data":
39
+ const nonIndexedInputs = eventDefinition.inputs.filter((input) => !input.indexed);
40
+ const decodedDataParts = argsSerializer.buffersToValues(dataItems, nonIndexedInputs);
41
+ for (let i = 0; i < nonIndexedInputs.length; i++) {
42
+ result[nonIndexedInputs[i].name] = decodedDataParts[i]?.valueOf();
43
+ }
44
+ return result;
45
+ }
46
+ }
47
+ exports.TransactionEventsParser = TransactionEventsParser;
48
+ //# sourceMappingURL=transactionEventsParser.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transactionEventsParser.js","sourceRoot":"","sources":["../../src/transactionsOutcomeParsers/transactionEventsParser.ts"],"names":[],"mappings":";;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QACvB,MAAM,cAAc,GAAG,IAAI,mBAAa,EAAE,CAAC;QAE3C,iEAAiE;QACjE,MAAM,aAAa,GAAG,eAAe,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,KAAuB,EAAE,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QAChG,MAAM,aAAa,GAAG,cAAc,CAAC,eAAe,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;QAC5E,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,aAAa,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YAC3C,MAAM,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,aAAa,CAAC,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC;SAC9D;QAED,+DAA+D;QAC/D,MAAM,gBAAgB,GAAG,eAAe,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,KAAuB,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QACpG,MAAM,gBAAgB,GAAG,cAAc,CAAC,eAAe,CAAC,SAAS,EAAE,gBAAgB,CAAC,CAAC;QACrF,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,gBAAgB,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YAC9C,MAAM,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,gBAAgB,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC;SACrE;QAED,OAAO,MAAM,CAAC;IAClB,CAAC;CACJ;AAvDD,0DAuDC"}
@@ -0,0 +1,3 @@
1
+ export * from "./resources";
2
+ export * from "./transfersControllers";
3
+ export * from "./transferTransactionsFactory";
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
11
+ };
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ __exportStar(require("./resources"), exports);
14
+ __exportStar(require("./transfersControllers"), exports);
15
+ __exportStar(require("./transferTransactionsFactory"), exports);
16
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/transfers/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,8CAA4B;AAC5B,yDAAuC;AACvC,gEAA8C"}
@@ -0,0 +1,17 @@
1
+ import { Address } from "../core/address";
2
+ import { TokenTransfer } from "../core/tokens";
3
+ export declare type NativeTokenTransferInput = {
4
+ receiver: Address;
5
+ nativeAmount?: bigint;
6
+ data?: Uint8Array;
7
+ };
8
+ export declare type CustomTokenTransferInput = {
9
+ receiver: Address;
10
+ tokenTransfers: TokenTransfer[];
11
+ };
12
+ export declare type CreateTransferTransactionInput = {
13
+ receiver: Address;
14
+ nativeAmount?: bigint;
15
+ tokenTransfers?: TokenTransfer[];
16
+ data?: Uint8Array;
17
+ };
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=resources.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resources.js","sourceRoot":"","sources":["../../src/transfers/resources.ts"],"names":[],"mappings":""}
@@ -0,0 +1,32 @@
1
+ import { Address } from "../core/address";
2
+ import { Transaction } from "../core/transaction";
3
+ import * as resources from "./resources";
4
+ interface IConfig {
5
+ chainID: string;
6
+ minGasLimit: bigint;
7
+ gasLimitPerByte: bigint;
8
+ gasLimitDCDTTransfer: bigint;
9
+ gasLimitDCDTNFTTransfer: bigint;
10
+ gasLimitMultiDCDTNFTTransfer: bigint;
11
+ }
12
+ /**
13
+ * Use this class to create transactions for native token transfers (REWA) or custom tokens transfers (DCDT/NTF/MetaDCDT).
14
+ */
15
+ export declare class TransferTransactionsFactory {
16
+ private readonly config?;
17
+ private readonly tokenTransfersDataBuilder?;
18
+ private readonly tokenComputer?;
19
+ constructor(options: {
20
+ config: IConfig;
21
+ });
22
+ createTransactionForNativeTokenTransfer(sender: Address, options: resources.NativeTokenTransferInput): Transaction;
23
+ createTransactionForDCDTTokenTransfer(sender: Address, options: resources.CustomTokenTransferInput): Transaction;
24
+ createTransactionForTransfer(sender: Address, options: resources.CreateTransferTransactionInput): Transaction;
25
+ private createSingleDCDTTransferTransaction;
26
+ private buildTransferData;
27
+ private buildMultiDCDTNFTTransferData;
28
+ private buildDCDTTransferData;
29
+ private buildSingleDCDTNFTTransferData;
30
+ private computeGasForMoveBalance;
31
+ }
32
+ export {};
@@ -0,0 +1,131 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TransferTransactionsFactory = void 0;
4
+ const constants_1 = require("../core/constants");
5
+ const errors_1 = require("../core/errors");
6
+ const tokens_1 = require("../core/tokens");
7
+ const tokenTransfersDataBuilder_1 = require("../core/tokenTransfersDataBuilder");
8
+ const transaction_1 = require("../core/transaction");
9
+ const transactionBuilder_1 = require("../core/transactionBuilder");
10
+ const ADDITIONAL_GAS_FOR_DCDT_TRANSFER = 100000;
11
+ const ADDITIONAL_GAS_FOR_DCDT_NFT_TRANSFER = 800000;
12
+ /**
13
+ * Use this class to create transactions for native token transfers (REWA) or custom tokens transfers (DCDT/NTF/MetaDCDT).
14
+ */
15
+ class TransferTransactionsFactory {
16
+ constructor(options) {
17
+ this.config = options.config;
18
+ this.tokenComputer = new tokens_1.TokenComputer();
19
+ this.tokenTransfersDataBuilder = new tokenTransfersDataBuilder_1.TokenTransfersDataBuilder();
20
+ }
21
+ createTransactionForNativeTokenTransfer(sender, options) {
22
+ const data = options.data || new Uint8Array();
23
+ return new transaction_1.Transaction({
24
+ sender: sender,
25
+ receiver: options.receiver,
26
+ chainID: this.config.chainID,
27
+ gasLimit: this.computeGasForMoveBalance(this.config, data),
28
+ data: data,
29
+ value: options.nativeAmount ?? BigInt(0),
30
+ });
31
+ }
32
+ createTransactionForDCDTTokenTransfer(sender, options) {
33
+ const numberOfTransfers = options.tokenTransfers.length;
34
+ if (numberOfTransfers === 0) {
35
+ throw new errors_1.ErrBadUsage("No token transfer has been provided");
36
+ }
37
+ if (numberOfTransfers === 1) {
38
+ return this.createSingleDCDTTransferTransaction(sender, options);
39
+ }
40
+ const { dataParts, extraGasForTransfer } = this.buildMultiDCDTNFTTransferData(options.tokenTransfers, options.receiver);
41
+ return new transactionBuilder_1.TransactionBuilder({
42
+ config: this.config,
43
+ sender: sender,
44
+ receiver: sender,
45
+ dataParts: dataParts,
46
+ gasLimit: extraGasForTransfer,
47
+ addDataMovementGas: true,
48
+ }).build();
49
+ }
50
+ createTransactionForTransfer(sender, options) {
51
+ const nativeAmount = options.nativeAmount ?? 0n;
52
+ let tokenTransfers = options.tokenTransfers ? [...options.tokenTransfers] : [];
53
+ const numberOfTokens = tokenTransfers.length;
54
+ if (numberOfTokens && options.data?.length) {
55
+ throw new errors_1.ErrBadUsage("Can't set data field when sending dcdt tokens");
56
+ }
57
+ if ((nativeAmount && numberOfTokens === 0) || options.data) {
58
+ return this.createTransactionForNativeTokenTransfer(sender, {
59
+ receiver: options.receiver,
60
+ nativeAmount: nativeAmount,
61
+ data: options.data,
62
+ });
63
+ }
64
+ const nativeTransfer = nativeAmount ? tokens_1.TokenTransfer.newFromNativeAmount(nativeAmount) : undefined;
65
+ if (nativeTransfer) {
66
+ tokenTransfers.push(nativeTransfer);
67
+ }
68
+ return this.createTransactionForDCDTTokenTransfer(sender, {
69
+ receiver: options.receiver,
70
+ tokenTransfers: tokenTransfers,
71
+ });
72
+ }
73
+ createSingleDCDTTransferTransaction(sender, options) {
74
+ const transfer = options.tokenTransfers[0];
75
+ const { dataParts, extraGasForTransfer, receiver } = this.buildTransferData(transfer, {
76
+ sender,
77
+ receiver: options.receiver,
78
+ });
79
+ return new transactionBuilder_1.TransactionBuilder({
80
+ config: this.config,
81
+ sender: sender,
82
+ receiver: receiver,
83
+ dataParts: dataParts,
84
+ gasLimit: extraGasForTransfer,
85
+ addDataMovementGas: true,
86
+ }).build();
87
+ }
88
+ buildTransferData(transfer, options) {
89
+ let dataParts = [];
90
+ let extraGasForTransfer;
91
+ let receiver = options.receiver;
92
+ if (this.tokenComputer.isFungible(transfer.token)) {
93
+ if (transfer.token.identifier === constants_1.REWA_IDENTIFIER_FOR_MULTI_DCDTNFT_TRANSFER) {
94
+ ({ dataParts, extraGasForTransfer } = this.buildMultiDCDTNFTTransferData([transfer], receiver));
95
+ receiver = options.sender;
96
+ }
97
+ else {
98
+ ({ dataParts, extraGasForTransfer } = this.buildDCDTTransferData(transfer));
99
+ }
100
+ }
101
+ else {
102
+ ({ dataParts, extraGasForTransfer } = this.buildSingleDCDTNFTTransferData(transfer, receiver));
103
+ receiver = options.sender; // Override receiver for non-fungible tokens
104
+ }
105
+ return { dataParts, extraGasForTransfer, receiver };
106
+ }
107
+ buildMultiDCDTNFTTransferData(transfer, receiver) {
108
+ return {
109
+ dataParts: this.tokenTransfersDataBuilder.buildDataPartsForMultiDCDTNFTTransfer(receiver, transfer),
110
+ extraGasForTransfer: this.config.gasLimitMultiDCDTNFTTransfer * BigInt(transfer.length) +
111
+ BigInt(ADDITIONAL_GAS_FOR_DCDT_NFT_TRANSFER),
112
+ };
113
+ }
114
+ buildDCDTTransferData(transfer) {
115
+ return {
116
+ dataParts: this.tokenTransfersDataBuilder.buildDataPartsForDCDTTransfer(transfer),
117
+ extraGasForTransfer: this.config.gasLimitDCDTTransfer + BigInt(ADDITIONAL_GAS_FOR_DCDT_TRANSFER),
118
+ };
119
+ }
120
+ buildSingleDCDTNFTTransferData(transfer, receiver) {
121
+ return {
122
+ dataParts: this.tokenTransfersDataBuilder.buildDataPartsForSingleDCDTNFTTransfer(transfer, receiver),
123
+ extraGasForTransfer: this.config.gasLimitDCDTNFTTransfer + BigInt(ADDITIONAL_GAS_FOR_DCDT_NFT_TRANSFER),
124
+ };
125
+ }
126
+ computeGasForMoveBalance(config, data) {
127
+ return config.minGasLimit + config.gasLimitPerByte * BigInt(data.length);
128
+ }
129
+ }
130
+ exports.TransferTransactionsFactory = TransferTransactionsFactory;
131
+ //# sourceMappingURL=transferTransactionsFactory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transferTransactionsFactory.js","sourceRoot":"","sources":["../../src/transfers/transferTransactionsFactory.ts"],"names":[],"mappings":";;;AACA,iDAA+E;AAC/E,2CAA6C;AAC7C,2CAA8D;AAC9D,iFAA8E;AAC9E,qDAAkD;AAClD,mEAAgE;AAGhE,MAAM,gCAAgC,GAAG,MAAM,CAAC;AAChD,MAAM,oCAAoC,GAAG,MAAM,CAAC;AAWpD;;GAEG;AACH,MAAa,2BAA2B;IAKpC,YAAY,OAA4B;QACpC,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;QAC7B,IAAI,CAAC,aAAa,GAAG,IAAI,sBAAa,EAAE,CAAC;QACzC,IAAI,CAAC,yBAAyB,GAAG,IAAI,qDAAyB,EAAE,CAAC;IACrE,CAAC;IAED,uCAAuC,CAAC,MAAe,EAAE,OAA2C;QAChG,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,IAAI,IAAI,UAAU,EAAE,CAAC;QAE9C,OAAO,IAAI,yBAAW,CAAC;YACnB,MAAM,EAAE,MAAM;YACd,QAAQ,EAAE,OAAO,CAAC,QAAQ;YAC1B,OAAO,EAAE,IAAI,CAAC,MAAO,CAAC,OAAO;YAC7B,QAAQ,EAAE,IAAI,CAAC,wBAAwB,CAAC,IAAI,CAAC,MAAO,EAAE,IAAI,CAAC;YAC3D,IAAI,EAAE,IAAI;YACV,KAAK,EAAE,OAAO,CAAC,YAAY,IAAI,M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,EAAE,IAAI,CAAC,yBAA0B,CAAC,sCAAsC,CAAC,QAAQ,EAAE,QAAQ,CAAC;YACrG,mBAAmB,EAAE,IAAI,CAAC,MAAO,CAAC,uBAAuB,GAAG,MAAM,CAAC,oCAAoC,CAAC;SAC3G,CAAC;IACN,CAAC;IAEO,wBAAwB,CAAC,MAAe,EAAE,IAAgB;QAC9D,OAAO,MAAM,CAAC,WAAW,GAAG,MAAM,CAAC,eAAe,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAC7E,CAAC;CACJ;AAlJD,kEAkJC"}
@@ -0,0 +1,11 @@
1
+ import { BaseController, BaseControllerInput, IAccount, Transaction } from "../core";
2
+ import * as resources from "./resources";
3
+ export declare class TransfersController extends BaseController {
4
+ private factory;
5
+ constructor(options: {
6
+ chainID: string;
7
+ });
8
+ createTransactionForNativeTokenTransfer(sender: IAccount, nonce: bigint, options: resources.NativeTokenTransferInput & BaseControllerInput): Promise<Transaction>;
9
+ createTransactionForDcdtTokenTransfer(sender: IAccount, nonce: bigint, options: resources.CustomTokenTransferInput & BaseControllerInput): Promise<Transaction>;
10
+ createTransactionForTransfer(sender: IAccount, nonce: bigint, options: resources.CreateTransferTransactionInput & BaseControllerInput): Promise<Transaction>;
11
+ }
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TransfersController = void 0;
4
+ const core_1 = require("../core");
5
+ const transferTransactionsFactory_1 = require("./transferTransactionsFactory");
6
+ class TransfersController extends core_1.BaseController {
7
+ constructor(options) {
8
+ super();
9
+ this.factory = new transferTransactionsFactory_1.TransferTransactionsFactory({ config: new core_1.TransactionsFactoryConfig(options) });
10
+ }
11
+ async createTransactionForNativeTokenTransfer(sender, nonce, options) {
12
+ const transaction = this.factory.createTransactionForNativeTokenTransfer(sender.address, options);
13
+ transaction.guardian = options.guardian ?? core_1.Address.empty();
14
+ transaction.relayer = options.relayer ?? core_1.Address.empty();
15
+ transaction.nonce = nonce;
16
+ this.setTransactionGasOptions(transaction, options);
17
+ this.setVersionAndOptionsForGuardian(transaction);
18
+ transaction.signature = await sender.signTransaction(transaction);
19
+ return transaction;
20
+ }
21
+ async createTransactionForDcdtTokenTransfer(sender, nonce, options) {
22
+ const transaction = this.factory.createTransactionForDCDTTokenTransfer(sender.address, options);
23
+ transaction.guardian = options.guardian ?? core_1.Address.empty();
24
+ transaction.relayer = options.relayer ?? core_1.Address.empty();
25
+ transaction.nonce = nonce;
26
+ this.setTransactionGasOptions(transaction, options);
27
+ this.setVersionAndOptionsForGuardian(transaction);
28
+ transaction.signature = await sender.signTransaction(transaction);
29
+ return transaction;
30
+ }
31
+ async createTransactionForTransfer(sender, nonce, options) {
32
+ const transaction = this.factory.createTransactionForTransfer(sender.address, options);
33
+ transaction.guardian = options.guardian ?? core_1.Address.empty();
34
+ transaction.relayer = options.relayer ?? core_1.Address.empty();
35
+ transaction.nonce = nonce;
36
+ this.setTransactionGasOptions(transaction, options);
37
+ this.setVersionAndOptionsForGuardian(transaction);
38
+ transaction.signature = await sender.signTransaction(transaction);
39
+ return transaction;
40
+ }
41
+ }
42
+ exports.TransfersController = TransfersController;
43
+ //# sourceMappingURL=transfersControllers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transfersControllers.js","sourceRoot":"","sources":["../../src/transfers/transfersControllers.ts"],"names":[],"mappings":";;;AAAA,kCAOiB;AAEjB,+EAA4E;AAE5E,MAAa,mBAAoB,SAAQ,qBAAc;IAGnD,YAAY,OAA4B;QACpC,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,OAAO,GAAG,IAAI,yDAA2B,CAAC,EAAE,MAAM,EAAE,IAAI,gCAAyB,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;IACvG,CAAC;IAED,KAAK,CAAC,uCAAuC,CACzC,MAAgB,EAChB,KAAa,EACb,OAAiE;QAEjE,MAAM,WAAW,GAAG,IAAI,CAAC,OAAO,CAAC,uCAAuC,CAAC,MAAM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OAAO,EAAE,OAAO,CAAC,CAAC;QAEvF,WAAW,CAAC,QAAQ,GAAG,OAAO,CAAC,QAAQ,IAAI,cAAO,CAAC,KAAK,EAAE,CAAC;QAC3D,WAAW,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,IAAI,cAAO,CAAC,KAAK,EAAE,CAAC;QACzD,WAAW,CAAC,KAAK,GAAG,KAAK,CAAC;QAC1B,IAAI,CAAC,wBAAwB,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;QACpD,IAAI,CAAC,+BAA+B,CAAC,WAAW,CAAC,CAAC;QAClD,WAAW,CAAC,SAAS,GAAG,MAAM,MAAM,CAAC,eAAe,CAAC,WAAW,CAAC,CAAC;QAElE,OAAO,WAAW,CAAC;IACvB,CAAC;CACJ;AA1DD,kDA0DC"}
@@ -0,0 +1,3 @@
1
+ export declare function guardLength(withLength: {
2
+ length?: number;
3
+ }, expectedLength: number): void;
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.guardLength = void 0;
4
+ const errors_1 = require("../core/errors");
5
+ function guardLength(withLength, expectedLength) {
6
+ let actualLength = withLength.length || 0;
7
+ if (actualLength != expectedLength) {
8
+ throw new errors_1.ErrInvariantFailed(`wrong length, expected: ${expectedLength}, actual: ${actualLength}`);
9
+ }
10
+ }
11
+ exports.guardLength = guardLength;
12
+ //# sourceMappingURL=assertions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"assertions.js","sourceRoot":"","sources":["../../src/wallet/assertions.ts"],"names":[],"mappings":";;;AAAA,2CAAoD;AAEpD,SAAgB,WAAW,CAAC,UAA+B,EAAE,cAAsB;IAC/E,IAAI,YAAY,GAAG,UAAU,CAAC,MAAM,IAAI,CAAC,CAAC;IAE1C,IAAI,YAAY,IAAI,cAAc,EAAE;QAChC,MAAM,IAAI,2BAAkB,CAAC,2BAA2B,cAAc,aAAa,YAAY,EAAE,CAAC,CAAC;KACtG;AACL,CAAC;AAND,kCAMC"}
@@ -0,0 +1,6 @@
1
+ export declare const CipherAlgorithm = "aes-128-ctr";
2
+ export declare const DigestAlgorithm = "sha256";
3
+ export declare const KeyDerivationFunction = "scrypt";
4
+ export declare const PubKeyEncVersion = 1;
5
+ export declare const PubKeyEncNonceLength = 24;
6
+ export declare const PubKeyEncCipher = "x25519-xsalsa20-poly1305";
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PubKeyEncCipher = exports.PubKeyEncNonceLength = exports.PubKeyEncVersion = exports.KeyDerivationFunction = exports.DigestAlgorithm = exports.CipherAlgorithm = void 0;
4
+ exports.CipherAlgorithm = "aes-128-ctr";
5
+ exports.DigestAlgorithm = "sha256";
6
+ exports.KeyDerivationFunction = "scrypt";
7
+ // X25519 public key encryption
8
+ exports.PubKeyEncVersion = 1;
9
+ exports.PubKeyEncNonceLength = 24;
10
+ exports.PubKeyEncCipher = "x25519-xsalsa20-poly1305";
11
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/wallet/crypto/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,eAAe,GAAG,aAAa,CAAC;AAChC,QAAA,eAAe,GAAG,QAAQ,CAAC;AAC3B,QAAA,qBAAqB,GAAG,QAAQ,CAAC;AAE9C,+BAA+B;AAClB,QAAA,gBAAgB,GAAG,CAAC,CAAC;AACrB,QAAA,oBAAoB,GAAG,EAAE,CAAC;AAC1B,QAAA,eAAe,GAAG,0BAA0B,CAAC"}
@@ -0,0 +1,5 @@
1
+ /// <reference types="node" />
2
+ import { EncryptedData } from "./encryptedData";
3
+ export declare class Decryptor {
4
+ static decrypt(data: EncryptedData, password: string): Buffer;
5
+ }
@@ -0,0 +1,29 @@
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.Decryptor = void 0;
7
+ const crypto_1 = __importDefault(require("crypto"));
8
+ const errors_1 = require("../../core/errors");
9
+ const constants_1 = require("./constants");
10
+ class Decryptor {
11
+ static decrypt(data, password) {
12
+ const kdfparams = data.kdfparams;
13
+ const salt = Buffer.from(data.salt, "hex");
14
+ const iv = Buffer.from(data.iv, "hex");
15
+ const ciphertext = Buffer.from(data.ciphertext, "hex");
16
+ const derivedKey = kdfparams.generateDerivedKey(Buffer.from(password), salt);
17
+ const derivedKeyFirstHalf = derivedKey.slice(0, 16);
18
+ const derivedKeySecondHalf = derivedKey.slice(16, 32);
19
+ const computedMAC = crypto_1.default.createHmac(constants_1.DigestAlgorithm, derivedKeySecondHalf).update(ciphertext).digest();
20
+ const actualMAC = data.mac;
21
+ if (computedMAC.toString("hex") !== actualMAC) {
22
+ throw new errors_1.Err("MAC mismatch, possibly wrong password");
23
+ }
24
+ const decipher = crypto_1.default.createDecipheriv(data.cipher, derivedKeyFirstHalf, iv);
25
+ return Buffer.concat([decipher.update(ciphertext), decipher.final()]);
26
+ }
27
+ }
28
+ exports.Decryptor = Decryptor;
29
+ //# sourceMappingURL=decryptor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"decryptor.js","sourceRoot":"","sources":["../../../src/wallet/crypto/decryptor.ts"],"names":[],"mappings":";;;;;;AAAA,oDAA4B;AAC5B,8CAAwC;AACxC,2CAA8C;AAG9C,MAAa,SAAS;IAClB,MAAM,CAAC,OAAO,CAAC,IAAmB,EAAE,QAAgB;QAChD,MAAM,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC;QACjC,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;QAC3C,MAAM,EAAE,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;QACvC,MAAM,UAAU,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC;QACvD,MAAM,UAAU,GAAG,SAAS,CAAC,kBAAkB,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,IAAI,CAAC,CAAC;QAC7E,MAAM,mBAAmB,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QACpD,MAAM,oBAAoB,GAAG,UAAU,CAAC,KAAK,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;QAEtD,MAAM,WAAW,GAAG,gBAAM,CAAC,UAAU,CAAC,2BAAe,EAAE,oBAAoB,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,MAAM,EAAE,CAAC;QACzG,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,CAAC;QAE3B,IAAI,WAAW,CAAC,QAAQ,CAAC,KAAK,CAAC,KAAK,SAAS,EAAE;YAC3C,MAAM,IAAI,YAAG,CAAC,uCAAuC,CAAC,CAAC;SAC1D;QAED,MAAM,QAAQ,GAAG,gBAAM,CAAC,gBAAgB,CAAC,IAAI,CAAC,MAAM,EAAE,mBAAmB,EAAE,EAAE,CAAC,CAAC;QAE/E,OAAO,MAAM,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,UAAU,CAAC,EAAE,QAAQ,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;IAC1E,CAAC;CACJ;AArBD,8BAqBC"}
@@ -0,0 +1,23 @@
1
+ /// <reference types="node" />
2
+ export declare class ScryptKeyDerivationParams {
3
+ /**
4
+ * numIterations
5
+ */
6
+ n: number;
7
+ /**
8
+ * memFactor
9
+ */
10
+ r: number;
11
+ /**
12
+ * pFactor
13
+ */
14
+ p: number;
15
+ dklen: number;
16
+ constructor(n?: number, r?: number, p?: number, dklen?: number);
17
+ /**
18
+ * Will take about:
19
+ * - 80-90 ms in Node.js, on a i3-8100 CPU @ 3.60GHz
20
+ * - 350-360 ms in browser (Firefox), on a i3-8100 CPU @ 3.60GHz
21
+ */
22
+ generateDerivedKey(password: Buffer, salt: Buffer): Buffer;
23
+ }
@@ -0,0 +1,38 @@
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.ScryptKeyDerivationParams = void 0;
7
+ const scryptsy_1 = __importDefault(require("scryptsy"));
8
+ class ScryptKeyDerivationParams {
9
+ constructor(n = 4096, r = 8, p = 1, dklen = 32) {
10
+ /**
11
+ * numIterations
12
+ */
13
+ this.n = 4096;
14
+ /**
15
+ * memFactor
16
+ */
17
+ this.r = 8;
18
+ /**
19
+ * pFactor
20
+ */
21
+ this.p = 1;
22
+ this.dklen = 32;
23
+ this.n = n;
24
+ this.r = r;
25
+ this.p = p;
26
+ this.dklen = dklen;
27
+ }
28
+ /**
29
+ * Will take about:
30
+ * - 80-90 ms in Node.js, on a i3-8100 CPU @ 3.60GHz
31
+ * - 350-360 ms in browser (Firefox), on a i3-8100 CPU @ 3.60GHz
32
+ */
33
+ generateDerivedKey(password, salt) {
34
+ return scryptsy_1.default(password, salt, this.n, this.r, this.p, this.dklen);
35
+ }
36
+ }
37
+ exports.ScryptKeyDerivationParams = ScryptKeyDerivationParams;
38
+ //# sourceMappingURL=derivationParams.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"derivationParams.js","sourceRoot":"","sources":["../../../src/wallet/crypto/derivationParams.ts"],"names":[],"mappings":";;;;;;AAAA,wDAAgC;AAEhC,MAAa,yBAAyB;IAkBpC,YAAY,CAAC,GAAG,IAAI,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,KAAK,GAAG,EAAE;QAjB9C;;WAEG;QACH,MAAC,GAAG,IAAI,CAAC;QAET;;WAEG;QACH,MAAC,GAAG,CAAC,CAAC;QAEN;;WAEG;QACH,MAAC,GAAG,CAAC,CAAC;QAEN,UAAK,GAAG,EAAE,CAAC;QAGT,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;QACX,IAAI,CAAE,CAAC,GAAG,CAAC,CAAC;QACZ,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;QACX,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;IAED;;;;OAIG;IACI,kBAAkB,CAAC,QAAgB,EAAE,IAAY;QACtD,OAAO,kBAAQ,CAAC,QAAQ,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;IACtE,CAAC;CACF;AAjCD,8DAiCC"}
@@ -0,0 +1,15 @@
1
+ import { ScryptKeyDerivationParams } from "./derivationParams";
2
+ export declare class EncryptedData {
3
+ id: string;
4
+ version: number;
5
+ cipher: string;
6
+ ciphertext: string;
7
+ iv: string;
8
+ kdf: string;
9
+ kdfparams: ScryptKeyDerivationParams;
10
+ salt: string;
11
+ mac: string;
12
+ constructor(data: Omit<EncryptedData, "toJSON">);
13
+ toJSON(): any;
14
+ static fromJSON(data: any): EncryptedData;
15
+ }