@aptos-labs/ts-sdk 1.29.1 → 1.30.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 (689) hide show
  1. package/README.md +2 -2
  2. package/dist/common/{accountAddress-DUCC2ffJ.d.ts → accountAddress-DnSqjhSl.d.ts} +700 -245
  3. package/dist/common/{chunk-HBPH2AD3.js → chunk-7IYTZDXV.js} +1 -1
  4. package/dist/common/chunk-7IYTZDXV.js.map +1 -0
  5. package/dist/common/cli/index.d.ts +123 -126
  6. package/dist/common/cli/index.js +1 -1
  7. package/dist/common/cli/index.js.map +1 -1
  8. package/dist/common/index.d.ts +5916 -1627
  9. package/dist/common/index.js +8 -8
  10. package/dist/common/index.js.map +1 -1
  11. package/dist/esm/Ed25519Account-DpH9qAcg.d.mts +470 -0
  12. package/dist/esm/account/AbstractKeylessAccount.d.mts +5 -5
  13. package/dist/esm/account/AbstractKeylessAccount.mjs +1 -1
  14. package/dist/esm/account/Account.d.mts +2 -2
  15. package/dist/esm/account/Account.mjs +1 -1
  16. package/dist/esm/account/Ed25519Account.d.mts +2 -2
  17. package/dist/esm/account/Ed25519Account.mjs +1 -1
  18. package/dist/esm/account/EphemeralKeyPair.d.mts +49 -14
  19. package/dist/esm/account/EphemeralKeyPair.mjs +1 -1
  20. package/dist/esm/account/FederatedKeylessAccount.d.mts +3 -3
  21. package/dist/esm/account/FederatedKeylessAccount.mjs +1 -1
  22. package/dist/esm/account/KeylessAccount.d.mts +37 -3
  23. package/dist/esm/account/KeylessAccount.mjs +1 -1
  24. package/dist/esm/account/MultiKeyAccount.d.mts +54 -34
  25. package/dist/esm/account/MultiKeyAccount.mjs +1 -1
  26. package/dist/esm/account/SingleKeyAccount.d.mts +2 -2
  27. package/dist/esm/account/SingleKeyAccount.mjs +1 -1
  28. package/dist/esm/account/index.d.mts +2 -2
  29. package/dist/esm/account/index.mjs +1 -1
  30. package/dist/esm/api/account.d.mts +445 -160
  31. package/dist/esm/api/account.mjs +1 -1
  32. package/dist/esm/api/ans.d.mts +369 -122
  33. package/dist/esm/api/ans.mjs +1 -1
  34. package/dist/esm/api/aptos.d.mts +40 -7
  35. package/dist/esm/api/aptos.mjs +1 -1
  36. package/dist/esm/api/aptosConfig.d.mts +102 -14
  37. package/dist/esm/api/aptosConfig.mjs +1 -1
  38. package/dist/esm/api/coin.d.mts +50 -13
  39. package/dist/esm/api/coin.mjs +1 -1
  40. package/dist/esm/api/digitalAsset.d.mts +708 -298
  41. package/dist/esm/api/digitalAsset.mjs +1 -1
  42. package/dist/esm/api/event.d.mts +128 -25
  43. package/dist/esm/api/event.mjs +1 -1
  44. package/dist/esm/api/faucet.d.mts +44 -7
  45. package/dist/esm/api/faucet.mjs +1 -1
  46. package/dist/esm/api/fungibleAsset.d.mts +151 -48
  47. package/dist/esm/api/fungibleAsset.mjs +1 -1
  48. package/dist/esm/api/general.d.mts +169 -53
  49. package/dist/esm/api/general.mjs +1 -1
  50. package/dist/esm/api/index.d.mts +2 -2
  51. package/dist/esm/api/index.mjs +1 -1
  52. package/dist/esm/api/keyless.d.mts +81 -10
  53. package/dist/esm/api/keyless.mjs +1 -1
  54. package/dist/esm/api/object.d.mts +49 -5
  55. package/dist/esm/api/object.mjs +1 -1
  56. package/dist/esm/api/staking.d.mts +84 -15
  57. package/dist/esm/api/staking.mjs +1 -1
  58. package/dist/esm/api/table.d.mts +117 -37
  59. package/dist/esm/api/table.mjs +1 -1
  60. package/dist/esm/api/transaction.d.mts +440 -109
  61. package/dist/esm/api/transaction.mjs +1 -1
  62. package/dist/esm/api/transactionSubmission/build.d.mts +99 -13
  63. package/dist/esm/api/transactionSubmission/build.mjs +1 -1
  64. package/dist/esm/api/transactionSubmission/helpers.d.mts +79 -0
  65. package/dist/esm/api/transactionSubmission/helpers.mjs +1 -1
  66. package/dist/esm/api/transactionSubmission/management.d.mts +111 -12
  67. package/dist/esm/api/transactionSubmission/management.mjs +1 -1
  68. package/dist/esm/api/transactionSubmission/sign.d.mts +97 -3
  69. package/dist/esm/api/transactionSubmission/sign.mjs +1 -1
  70. package/dist/esm/api/transactionSubmission/sign.mjs.map +1 -1
  71. package/dist/esm/api/transactionSubmission/simulate.d.mts +140 -15
  72. package/dist/esm/api/transactionSubmission/simulate.mjs +1 -1
  73. package/dist/esm/api/transactionSubmission/submit.d.mts +104 -13
  74. package/dist/esm/api/transactionSubmission/submit.mjs +1 -1
  75. package/dist/esm/api/utils.d.mts +26 -3
  76. package/dist/esm/api/utils.mjs +1 -1
  77. package/dist/esm/bcs/consts.mjs +1 -1
  78. package/dist/esm/bcs/deserializer.d.mts +82 -32
  79. package/dist/esm/bcs/deserializer.mjs +1 -1
  80. package/dist/esm/bcs/index.mjs +1 -1
  81. package/dist/esm/bcs/serializable/entryFunctionBytes.d.mts +25 -6
  82. package/dist/esm/bcs/serializable/entryFunctionBytes.mjs +1 -1
  83. package/dist/esm/bcs/serializable/fixedBytes.d.mts +51 -21
  84. package/dist/esm/bcs/serializable/fixedBytes.mjs +1 -1
  85. package/dist/esm/bcs/serializable/movePrimitives.d.mts +79 -0
  86. package/dist/esm/bcs/serializable/movePrimitives.mjs +1 -1
  87. package/dist/esm/bcs/serializable/moveStructs.d.mts +119 -32
  88. package/dist/esm/bcs/serializable/moveStructs.mjs +1 -1
  89. package/dist/esm/bcs/serializer.d.mts +111 -76
  90. package/dist/esm/bcs/serializer.mjs +1 -1
  91. package/dist/esm/{chunk-U6Z4FNB7.mjs → chunk-2CJC43CV.mjs} +1 -1
  92. package/dist/esm/chunk-2CJC43CV.mjs.map +1 -0
  93. package/dist/esm/{chunk-WWZ3METZ.mjs → chunk-2I56E4T2.mjs} +2 -2
  94. package/dist/esm/chunk-2I56E4T2.mjs.map +1 -0
  95. package/dist/esm/{chunk-HSPBA2TZ.mjs → chunk-2QRWGJJA.mjs} +2 -2
  96. package/dist/esm/chunk-2QRWGJJA.mjs.map +1 -0
  97. package/dist/esm/chunk-37UZKMJI.mjs +2 -0
  98. package/dist/esm/chunk-37UZKMJI.mjs.map +1 -0
  99. package/dist/esm/chunk-4CDDWSKZ.mjs +2 -0
  100. package/dist/esm/chunk-4CDDWSKZ.mjs.map +1 -0
  101. package/dist/esm/chunk-4OV7QU2U.mjs +2 -0
  102. package/dist/esm/chunk-4OV7QU2U.mjs.map +1 -0
  103. package/dist/esm/{chunk-RNTXQYJQ.mjs → chunk-5AAFF2PV.mjs} +2 -2
  104. package/dist/esm/chunk-5AAFF2PV.mjs.map +1 -0
  105. package/dist/esm/chunk-5CCHECTE.mjs +2 -0
  106. package/dist/esm/chunk-5CCHECTE.mjs.map +1 -0
  107. package/dist/esm/{chunk-CPPBQDHB.mjs → chunk-5XXIIWG7.mjs} +2 -2
  108. package/dist/esm/chunk-5XXIIWG7.mjs.map +1 -0
  109. package/dist/esm/{chunk-K2O24YLZ.mjs → chunk-5ZBHIUWG.mjs} +2 -2
  110. package/dist/esm/chunk-5ZBHIUWG.mjs.map +1 -0
  111. package/dist/esm/chunk-6AGTDRNM.mjs +2 -0
  112. package/dist/esm/chunk-6AGTDRNM.mjs.map +1 -0
  113. package/dist/esm/chunk-6FLHGOKP.mjs +2 -0
  114. package/dist/esm/chunk-6FLHGOKP.mjs.map +1 -0
  115. package/dist/esm/{chunk-LG7RJQ57.mjs → chunk-6Q2O5G3J.mjs} +1 -1
  116. package/dist/esm/chunk-6Q2O5G3J.mjs.map +1 -0
  117. package/dist/esm/chunk-7D3RY73L.mjs +2 -0
  118. package/dist/esm/chunk-7D3RY73L.mjs.map +1 -0
  119. package/dist/esm/{chunk-5655UVIK.mjs → chunk-7PVIWKGT.mjs} +2 -2
  120. package/dist/esm/chunk-7PVIWKGT.mjs.map +1 -0
  121. package/dist/esm/chunk-7V6RL27I.mjs +2 -0
  122. package/dist/esm/chunk-7V6RL27I.mjs.map +1 -0
  123. package/dist/esm/{chunk-44GYWUSH.mjs → chunk-7XS45O6M.mjs} +1 -1
  124. package/dist/esm/chunk-7XS45O6M.mjs.map +1 -0
  125. package/dist/esm/{chunk-E37YRKWK.mjs → chunk-AGBA3Y7A.mjs} +2 -2
  126. package/dist/esm/chunk-AGBA3Y7A.mjs.map +1 -0
  127. package/dist/esm/{chunk-ECWOLU5T.mjs → chunk-BQXVHY7J.mjs} +2 -2
  128. package/dist/esm/chunk-BQXVHY7J.mjs.map +1 -0
  129. package/dist/esm/{chunk-PUZ25PTD.mjs → chunk-CRL4WGOH.mjs} +2 -2
  130. package/dist/esm/chunk-CRL4WGOH.mjs.map +1 -0
  131. package/dist/esm/{chunk-SWHLSREF.mjs → chunk-D3KBNFZR.mjs} +2 -2
  132. package/dist/esm/chunk-D3KBNFZR.mjs.map +1 -0
  133. package/dist/esm/{chunk-SCHZ67F3.mjs → chunk-D3OEQLUE.mjs} +1 -1
  134. package/dist/esm/{chunk-SCHZ67F3.mjs.map → chunk-D3OEQLUE.mjs.map} +1 -1
  135. package/dist/esm/{chunk-MO4IZXLK.mjs → chunk-DCUVV3VY.mjs} +2 -2
  136. package/dist/esm/chunk-DCUVV3VY.mjs.map +1 -0
  137. package/dist/esm/{chunk-AFOPNDOJ.mjs → chunk-DXQT55L3.mjs} +2 -2
  138. package/dist/esm/chunk-DXQT55L3.mjs.map +1 -0
  139. package/dist/esm/chunk-DZJXOL64.mjs +2 -0
  140. package/dist/esm/chunk-DZJXOL64.mjs.map +1 -0
  141. package/dist/esm/{chunk-QCUFTD7K.mjs → chunk-EF2PUPUH.mjs} +2 -2
  142. package/dist/esm/chunk-EF2PUPUH.mjs.map +1 -0
  143. package/dist/esm/{chunk-XXHW3ZT3.mjs → chunk-EKZQ3EYX.mjs} +2 -2
  144. package/dist/esm/chunk-EKZQ3EYX.mjs.map +1 -0
  145. package/dist/esm/{chunk-XH7YKEYR.mjs → chunk-EN2HDNFE.mjs} +2 -2
  146. package/dist/esm/chunk-EN2HDNFE.mjs.map +1 -0
  147. package/dist/esm/{chunk-TL7DR54X.mjs → chunk-FO4F3OJJ.mjs} +2 -2
  148. package/dist/esm/chunk-FO4F3OJJ.mjs.map +1 -0
  149. package/dist/esm/{chunk-7ZLBJUVZ.mjs → chunk-FPF4KZ5M.mjs} +2 -2
  150. package/dist/esm/chunk-FPF4KZ5M.mjs.map +1 -0
  151. package/dist/esm/{chunk-Y7F2V3R6.mjs → chunk-FY7TSOUU.mjs} +2 -2
  152. package/dist/esm/chunk-FY7TSOUU.mjs.map +1 -0
  153. package/dist/esm/{chunk-XK3JFCP3.mjs → chunk-GIQQF2PD.mjs} +2 -2
  154. package/dist/esm/chunk-GIQQF2PD.mjs.map +1 -0
  155. package/dist/esm/{chunk-SRPI2FFA.mjs → chunk-GMKKHGXK.mjs} +1 -1
  156. package/dist/esm/chunk-GMKKHGXK.mjs.map +1 -0
  157. package/dist/esm/chunk-GPZRGLU2.mjs +2 -0
  158. package/dist/esm/chunk-GPZRGLU2.mjs.map +1 -0
  159. package/dist/esm/{chunk-TDGQGILY.mjs → chunk-GQABU3RQ.mjs} +1 -1
  160. package/dist/esm/chunk-GQABU3RQ.mjs.map +1 -0
  161. package/dist/esm/{chunk-BRFHAO2Y.mjs → chunk-HAMXSLWF.mjs} +2 -2
  162. package/dist/esm/chunk-HAMXSLWF.mjs.map +1 -0
  163. package/dist/esm/{chunk-AH44UPM4.mjs → chunk-HBIDHQ2M.mjs} +1 -1
  164. package/dist/esm/chunk-HBIDHQ2M.mjs.map +1 -0
  165. package/dist/esm/{chunk-FRGXKOU5.mjs → chunk-HCV3NGLS.mjs} +2 -2
  166. package/dist/esm/chunk-HCV3NGLS.mjs.map +1 -0
  167. package/dist/esm/{chunk-GFGX3QDP.mjs → chunk-HDTKBFRX.mjs} +2 -2
  168. package/dist/esm/chunk-HDTKBFRX.mjs.map +1 -0
  169. package/dist/esm/chunk-HGVZ7ULA.mjs +2 -0
  170. package/dist/esm/chunk-HGVZ7ULA.mjs.map +1 -0
  171. package/dist/esm/{chunk-6EMN3BOV.mjs → chunk-I2NMCLNW.mjs} +1 -1
  172. package/dist/esm/chunk-I2NMCLNW.mjs.map +1 -0
  173. package/dist/esm/chunk-IBLZ6MZU.mjs +2 -0
  174. package/dist/esm/chunk-IBLZ6MZU.mjs.map +1 -0
  175. package/dist/esm/chunk-IECDO22V.mjs +2 -0
  176. package/dist/esm/chunk-IECDO22V.mjs.map +1 -0
  177. package/dist/esm/{chunk-TMW2HIXC.mjs → chunk-IFHQSZLK.mjs} +2 -2
  178. package/dist/esm/chunk-IFHQSZLK.mjs.map +1 -0
  179. package/dist/esm/{chunk-EXP5STXZ.mjs → chunk-J245N3XF.mjs} +1 -1
  180. package/dist/esm/chunk-J245N3XF.mjs.map +1 -0
  181. package/dist/esm/{chunk-2TQIU7CG.mjs → chunk-JDYASF3E.mjs} +2 -2
  182. package/dist/esm/chunk-JDYASF3E.mjs.map +1 -0
  183. package/dist/esm/{chunk-MS4MRLGA.mjs → chunk-JGNMNCQB.mjs} +2 -2
  184. package/dist/esm/chunk-JGNMNCQB.mjs.map +1 -0
  185. package/dist/esm/{chunk-TS3PYRAT.mjs → chunk-JNHFQTFC.mjs} +2 -2
  186. package/dist/esm/chunk-JNHFQTFC.mjs.map +1 -0
  187. package/dist/esm/{chunk-CVDR5SJR.mjs → chunk-JY3JJ55D.mjs} +2 -2
  188. package/dist/esm/chunk-JY3JJ55D.mjs.map +1 -0
  189. package/dist/esm/{chunk-KYSDF3CA.mjs → chunk-K6MZXKVV.mjs} +2 -2
  190. package/dist/esm/chunk-K6MZXKVV.mjs.map +1 -0
  191. package/dist/esm/{chunk-FVA2OPG4.mjs → chunk-KDMSOCZY.mjs} +1 -1
  192. package/dist/esm/{chunk-BCUSI3N6.mjs → chunk-KFNDDPOW.mjs} +2 -2
  193. package/dist/esm/chunk-KFNDDPOW.mjs.map +1 -0
  194. package/dist/esm/{chunk-DF4WKSTK.mjs → chunk-KFSVKIFO.mjs} +2 -2
  195. package/dist/esm/chunk-KFSVKIFO.mjs.map +1 -0
  196. package/dist/esm/chunk-KIW54KWR.mjs +2 -0
  197. package/dist/esm/{chunk-QPP6BX53.mjs → chunk-KM6UXNC7.mjs} +2 -2
  198. package/dist/esm/chunk-KM6UXNC7.mjs.map +1 -0
  199. package/dist/esm/{chunk-PKXEB7XP.mjs → chunk-KRVLR3L4.mjs} +2 -2
  200. package/dist/esm/chunk-KRVLR3L4.mjs.map +1 -0
  201. package/dist/esm/{chunk-B6M7QBUO.mjs → chunk-KSKQVOBA.mjs} +2 -2
  202. package/dist/esm/chunk-KSKQVOBA.mjs.map +1 -0
  203. package/dist/esm/{chunk-G7MWTE2J.mjs → chunk-KSUZS6EL.mjs} +2 -2
  204. package/dist/esm/{chunk-YHAPZP5A.mjs → chunk-L5I7F3NZ.mjs} +2 -2
  205. package/dist/esm/chunk-L5I7F3NZ.mjs.map +1 -0
  206. package/dist/esm/{chunk-XONG5JZ4.mjs → chunk-LD5MUWGW.mjs} +2 -2
  207. package/dist/esm/chunk-LD5MUWGW.mjs.map +1 -0
  208. package/dist/esm/{chunk-UAL27G6B.mjs → chunk-LEKBJ2EG.mjs} +1 -1
  209. package/dist/esm/chunk-LEKBJ2EG.mjs.map +1 -0
  210. package/dist/esm/{chunk-6RZZIOGH.mjs → chunk-LZS7BQ2B.mjs} +2 -2
  211. package/dist/esm/chunk-LZS7BQ2B.mjs.map +1 -0
  212. package/dist/esm/{chunk-3YKAGVHZ.mjs → chunk-N3OYD6VZ.mjs} +2 -2
  213. package/dist/esm/chunk-N3OYD6VZ.mjs.map +1 -0
  214. package/dist/esm/{chunk-KEYAPEAX.mjs → chunk-N47FTRYO.mjs} +1 -1
  215. package/dist/esm/chunk-N47FTRYO.mjs.map +1 -0
  216. package/dist/esm/{chunk-QIW56MUH.mjs → chunk-NODYW7DM.mjs} +2 -2
  217. package/dist/esm/chunk-NODYW7DM.mjs.map +1 -0
  218. package/dist/esm/{chunk-25TIHDS6.mjs → chunk-NV6DHDM3.mjs} +2 -2
  219. package/dist/esm/chunk-NV6DHDM3.mjs.map +1 -0
  220. package/dist/esm/{chunk-EV2USF7B.mjs → chunk-OLPI7QAH.mjs} +2 -2
  221. package/dist/esm/chunk-OLPI7QAH.mjs.map +1 -0
  222. package/dist/esm/chunk-ONBFUPEC.mjs +2 -0
  223. package/dist/esm/chunk-ONBFUPEC.mjs.map +1 -0
  224. package/dist/esm/{chunk-N5JNKD5F.mjs → chunk-OS2EG6AE.mjs} +2 -2
  225. package/dist/esm/chunk-OS2EG6AE.mjs.map +1 -0
  226. package/dist/esm/chunk-OTY3NO7Q.mjs +2 -0
  227. package/dist/esm/chunk-OTY3NO7Q.mjs.map +1 -0
  228. package/dist/esm/{chunk-25NSCK4Q.mjs → chunk-OV5UQ75K.mjs} +2 -2
  229. package/dist/esm/chunk-OV5UQ75K.mjs.map +1 -0
  230. package/dist/esm/{chunk-YJCZU6PR.mjs → chunk-OZN3OOJV.mjs} +2 -2
  231. package/dist/esm/chunk-OZN3OOJV.mjs.map +1 -0
  232. package/dist/esm/{chunk-WP7WF54Q.mjs → chunk-PCLU4KLY.mjs} +2 -2
  233. package/dist/esm/chunk-PCLU4KLY.mjs.map +1 -0
  234. package/dist/esm/{chunk-SR24OGHJ.mjs → chunk-PGZWRY7A.mjs} +2 -2
  235. package/dist/esm/chunk-PGZWRY7A.mjs.map +1 -0
  236. package/dist/esm/{chunk-SAPUZZEU.mjs → chunk-PHG2IWZW.mjs} +2 -2
  237. package/dist/esm/chunk-PHG2IWZW.mjs.map +1 -0
  238. package/dist/esm/{chunk-LR65XHSF.mjs → chunk-PHP47DI4.mjs} +2 -2
  239. package/dist/esm/chunk-PHP47DI4.mjs.map +1 -0
  240. package/dist/esm/chunk-PRZ7AIGA.mjs +2 -0
  241. package/dist/esm/chunk-PRZ7AIGA.mjs.map +1 -0
  242. package/dist/esm/{chunk-OY2IX7HW.mjs → chunk-QBP4XJT5.mjs} +2 -2
  243. package/dist/esm/chunk-QBP4XJT5.mjs.map +1 -0
  244. package/dist/esm/{chunk-ZGO2SK6F.mjs → chunk-QBWGWHJK.mjs} +2 -2
  245. package/dist/esm/chunk-QBWGWHJK.mjs.map +1 -0
  246. package/dist/esm/chunk-QQIVWB6G.mjs +2 -0
  247. package/dist/esm/chunk-QQIVWB6G.mjs.map +1 -0
  248. package/dist/esm/{chunk-IYQISVDX.mjs → chunk-QRTZYRH2.mjs} +2 -2
  249. package/dist/esm/chunk-QRTZYRH2.mjs.map +1 -0
  250. package/dist/esm/{chunk-NH2S6SB2.mjs → chunk-R3Y6WH2U.mjs} +2 -2
  251. package/dist/esm/chunk-R3Y6WH2U.mjs.map +1 -0
  252. package/dist/esm/{chunk-X4KEZTUQ.mjs → chunk-RAXP3STS.mjs} +2 -2
  253. package/dist/esm/chunk-RAXP3STS.mjs.map +1 -0
  254. package/dist/esm/{chunk-TVFIUUVY.mjs → chunk-RNAKZVRN.mjs} +2 -2
  255. package/dist/esm/chunk-RNAKZVRN.mjs.map +1 -0
  256. package/dist/esm/{chunk-NNRAQP36.mjs → chunk-RUDS7RSB.mjs} +2 -2
  257. package/dist/esm/chunk-RUDS7RSB.mjs.map +1 -0
  258. package/dist/esm/{chunk-U67PFBTL.mjs → chunk-S3FVA55H.mjs} +2 -2
  259. package/dist/esm/chunk-S3FVA55H.mjs.map +1 -0
  260. package/dist/esm/{chunk-LDFTE4MM.mjs → chunk-TIZL5YVP.mjs} +2 -2
  261. package/dist/esm/chunk-TIZL5YVP.mjs.map +1 -0
  262. package/dist/esm/{chunk-EWZ2M5BW.mjs → chunk-TRU3EK64.mjs} +2 -2
  263. package/dist/esm/chunk-TRU3EK64.mjs.map +1 -0
  264. package/dist/esm/chunk-UI3AKMZX.mjs +2 -0
  265. package/dist/esm/{chunk-555I4YHP.mjs.map → chunk-UI3AKMZX.mjs.map} +1 -1
  266. package/dist/esm/{chunk-B2CXRZL5.mjs → chunk-UKAXCARD.mjs} +2 -2
  267. package/dist/esm/chunk-UKAXCARD.mjs.map +1 -0
  268. package/dist/esm/{chunk-NMD45OTM.mjs → chunk-V5NDNR36.mjs} +2 -2
  269. package/dist/esm/chunk-V5NDNR36.mjs.map +1 -0
  270. package/dist/esm/{chunk-KXBIA4KR.mjs → chunk-VQTEGTUQ.mjs} +2 -2
  271. package/dist/esm/chunk-VQTEGTUQ.mjs.map +1 -0
  272. package/dist/esm/{chunk-BD6BJETG.mjs → chunk-WIXNX7HY.mjs} +2 -2
  273. package/dist/esm/chunk-WIXNX7HY.mjs.map +1 -0
  274. package/dist/esm/{chunk-7V6DEA7G.mjs → chunk-WOOH5MMX.mjs} +2 -2
  275. package/dist/esm/chunk-WOOH5MMX.mjs.map +1 -0
  276. package/dist/esm/{chunk-DAJOX4PL.mjs → chunk-WSVOJSAC.mjs} +2 -2
  277. package/dist/esm/chunk-WSVOJSAC.mjs.map +1 -0
  278. package/dist/esm/{chunk-L5NY7TMI.mjs → chunk-WUCPTRXU.mjs} +2 -2
  279. package/dist/esm/chunk-WUCPTRXU.mjs.map +1 -0
  280. package/dist/esm/chunk-XHCALZ7X.mjs +2 -0
  281. package/dist/esm/chunk-XHCALZ7X.mjs.map +1 -0
  282. package/dist/esm/{chunk-DAXKRXRK.mjs → chunk-XIY2VORC.mjs} +2 -2
  283. package/dist/esm/chunk-XIY2VORC.mjs.map +1 -0
  284. package/dist/esm/chunk-XOCRDV2V.mjs +2 -0
  285. package/dist/esm/chunk-XOCRDV2V.mjs.map +1 -0
  286. package/dist/esm/{chunk-STGYDB5E.mjs → chunk-Z36WHOZV.mjs} +2 -2
  287. package/dist/esm/chunk-Z36WHOZV.mjs.map +1 -0
  288. package/dist/esm/{chunk-LXLISEQ4.mjs → chunk-ZINOJTLU.mjs} +2 -2
  289. package/dist/esm/chunk-ZINOJTLU.mjs.map +1 -0
  290. package/dist/esm/{chunk-46D5QX3G.mjs → chunk-ZS3EWM5A.mjs} +2 -2
  291. package/dist/esm/chunk-ZS3EWM5A.mjs.map +1 -0
  292. package/dist/esm/{chunk-QLN2URFX.mjs → chunk-ZUTOMGB7.mjs} +2 -2
  293. package/dist/esm/chunk-ZUTOMGB7.mjs.map +1 -0
  294. package/dist/esm/cli/index.mjs +1 -1
  295. package/dist/esm/cli/localNode.d.mts +26 -10
  296. package/dist/esm/cli/localNode.mjs +1 -1
  297. package/dist/esm/cli/move.d.mts +104 -123
  298. package/dist/esm/cli/move.mjs +1 -1
  299. package/dist/esm/client/core.d.mts +21 -6
  300. package/dist/esm/client/core.mjs +1 -1
  301. package/dist/esm/client/get.d.mts +34 -6
  302. package/dist/esm/client/get.mjs +1 -1
  303. package/dist/esm/client/index.mjs +1 -1
  304. package/dist/esm/client/post.d.mts +63 -6
  305. package/dist/esm/client/post.mjs +1 -1
  306. package/dist/esm/client/types.d.mts +21 -8
  307. package/dist/esm/client/types.mjs +1 -1
  308. package/dist/esm/core/account/index.mjs +1 -1
  309. package/dist/esm/core/account/utils/address.d.mts +1 -1
  310. package/dist/esm/core/account/utils/address.mjs +1 -1
  311. package/dist/esm/core/account/utils/index.mjs +1 -1
  312. package/dist/esm/core/accountAddress.d.mts +63 -48
  313. package/dist/esm/core/accountAddress.mjs +1 -1
  314. package/dist/esm/core/authenticationKey.d.mts +1 -1
  315. package/dist/esm/core/authenticationKey.mjs +1 -1
  316. package/dist/esm/core/common.d.mts +6 -0
  317. package/dist/esm/core/common.mjs +1 -1
  318. package/dist/esm/core/crypto/ed25519.d.mts +77 -26
  319. package/dist/esm/core/crypto/ed25519.mjs +1 -1
  320. package/dist/esm/core/crypto/ephemeral.d.mts +36 -14
  321. package/dist/esm/core/crypto/ephemeral.mjs +1 -1
  322. package/dist/esm/core/crypto/federatedKeyless.d.mts +2 -14
  323. package/dist/esm/core/crypto/federatedKeyless.mjs +1 -1
  324. package/dist/esm/core/crypto/hdKey.d.mts +9 -6
  325. package/dist/esm/core/crypto/hdKey.mjs +1 -1
  326. package/dist/esm/core/crypto/index.d.mts +1 -1
  327. package/dist/esm/core/crypto/index.mjs +1 -1
  328. package/dist/esm/core/crypto/keyless.d.mts +126 -45
  329. package/dist/esm/core/crypto/keyless.mjs +1 -1
  330. package/dist/esm/core/crypto/multiEd25519.d.mts +45 -6
  331. package/dist/esm/core/crypto/multiEd25519.mjs +1 -1
  332. package/dist/esm/core/crypto/multiKey.d.mts +58 -7
  333. package/dist/esm/core/crypto/multiKey.mjs +1 -1
  334. package/dist/esm/core/crypto/poseidon.d.mts +35 -5
  335. package/dist/esm/core/crypto/poseidon.mjs +1 -1
  336. package/dist/esm/core/crypto/privateKey.d.mts +10 -6
  337. package/dist/esm/core/crypto/proof.d.mts +2 -6
  338. package/dist/esm/core/crypto/proof.mjs +1 -1
  339. package/dist/esm/core/crypto/publicKey.d.mts +1 -1
  340. package/dist/esm/core/crypto/publicKey.mjs +1 -1
  341. package/dist/esm/core/crypto/secp256k1.d.mts +72 -27
  342. package/dist/esm/core/crypto/secp256k1.mjs +1 -1
  343. package/dist/esm/core/crypto/signature.d.mts +5 -4
  344. package/dist/esm/core/crypto/signature.mjs +1 -1
  345. package/dist/esm/core/crypto/singleKey.d.mts +63 -5
  346. package/dist/esm/core/crypto/singleKey.mjs +1 -1
  347. package/dist/esm/core/crypto/utils.mjs +1 -1
  348. package/dist/esm/core/hex.d.mts +27 -28
  349. package/dist/esm/core/hex.mjs +1 -1
  350. package/dist/esm/core/index.d.mts +1 -1
  351. package/dist/esm/core/index.mjs +1 -1
  352. package/dist/esm/index.d.mts +2 -2
  353. package/dist/esm/index.mjs +1 -1
  354. package/dist/esm/internal/account.d.mts +191 -12
  355. package/dist/esm/internal/account.mjs +1 -1
  356. package/dist/esm/internal/ans.d.mts +206 -14
  357. package/dist/esm/internal/ans.mjs +1 -1
  358. package/dist/esm/internal/coin.d.mts +13 -1
  359. package/dist/esm/internal/coin.mjs +1 -1
  360. package/dist/esm/internal/digitalAsset.d.mts +330 -2
  361. package/dist/esm/internal/digitalAsset.mjs +1 -1
  362. package/dist/esm/internal/event.d.mts +39 -0
  363. package/dist/esm/internal/event.mjs +1 -1
  364. package/dist/esm/internal/faucet.d.mts +14 -0
  365. package/dist/esm/internal/faucet.mjs +1 -1
  366. package/dist/esm/internal/fungibleAsset.d.mts +48 -2
  367. package/dist/esm/internal/fungibleAsset.mjs +1 -1
  368. package/dist/esm/internal/general.d.mts +46 -0
  369. package/dist/esm/internal/general.mjs +1 -1
  370. package/dist/esm/internal/keyless.d.mts +38 -2
  371. package/dist/esm/internal/keyless.mjs +1 -1
  372. package/dist/esm/internal/object.d.mts +21 -0
  373. package/dist/esm/internal/object.mjs +1 -1
  374. package/dist/esm/internal/staking.d.mts +26 -0
  375. package/dist/esm/internal/staking.mjs +1 -1
  376. package/dist/esm/internal/table.d.mts +33 -1
  377. package/dist/esm/internal/table.mjs +1 -1
  378. package/dist/esm/internal/transaction.d.mts +107 -5
  379. package/dist/esm/internal/transaction.mjs +1 -1
  380. package/dist/esm/internal/transactionSubmission.d.mts +72 -29
  381. package/dist/esm/internal/transactionSubmission.mjs +1 -1
  382. package/dist/esm/internal/view.d.mts +1 -1
  383. package/dist/esm/internal/view.mjs +1 -1
  384. package/dist/esm/publicKey-_tPa99ea.d.mts +151 -0
  385. package/dist/esm/transactions/authenticator/account.d.mts +66 -17
  386. package/dist/esm/transactions/authenticator/account.mjs +1 -1
  387. package/dist/esm/transactions/authenticator/index.d.mts +1 -1
  388. package/dist/esm/transactions/authenticator/index.mjs +1 -1
  389. package/dist/esm/transactions/authenticator/transaction.d.mts +53 -20
  390. package/dist/esm/transactions/authenticator/transaction.mjs +1 -1
  391. package/dist/esm/transactions/index.d.mts +1 -1
  392. package/dist/esm/transactions/index.mjs +1 -1
  393. package/dist/esm/transactions/instances/chainId.d.mts +20 -1
  394. package/dist/esm/transactions/instances/chainId.mjs +1 -1
  395. package/dist/esm/transactions/instances/identifier.d.mts +21 -3
  396. package/dist/esm/transactions/instances/identifier.mjs +1 -1
  397. package/dist/esm/transactions/instances/index.d.mts +1 -1
  398. package/dist/esm/transactions/instances/index.mjs +1 -1
  399. package/dist/esm/transactions/instances/moduleId.d.mts +22 -8
  400. package/dist/esm/transactions/instances/moduleId.mjs +1 -1
  401. package/dist/esm/transactions/instances/multiAgentTransaction.d.mts +24 -8
  402. package/dist/esm/transactions/instances/multiAgentTransaction.mjs +1 -1
  403. package/dist/esm/transactions/instances/rawTransaction.d.mts +31 -4
  404. package/dist/esm/transactions/instances/rawTransaction.mjs +1 -1
  405. package/dist/esm/transactions/instances/rotationProofChallenge.d.mts +25 -3
  406. package/dist/esm/transactions/instances/rotationProofChallenge.mjs +1 -1
  407. package/dist/esm/transactions/instances/signedTransaction.d.mts +29 -7
  408. package/dist/esm/transactions/instances/signedTransaction.mjs +1 -1
  409. package/dist/esm/transactions/instances/simpleTransaction.d.mts +23 -8
  410. package/dist/esm/transactions/instances/simpleTransaction.mjs +1 -1
  411. package/dist/esm/transactions/instances/transactionArgument.d.mts +23 -0
  412. package/dist/esm/transactions/instances/transactionPayload.d.mts +72 -26
  413. package/dist/esm/transactions/instances/transactionPayload.mjs +1 -1
  414. package/dist/esm/transactions/management/accountSequenceNumber.d.mts +37 -11
  415. package/dist/esm/transactions/management/accountSequenceNumber.mjs +1 -1
  416. package/dist/esm/transactions/management/asyncQueue.d.mts +22 -19
  417. package/dist/esm/transactions/management/asyncQueue.mjs +1 -1
  418. package/dist/esm/transactions/management/index.d.mts +2 -2
  419. package/dist/esm/transactions/management/index.mjs +1 -1
  420. package/dist/esm/transactions/management/transactionWorker.d.mts +67 -36
  421. package/dist/esm/transactions/management/transactionWorker.mjs +1 -1
  422. package/dist/esm/transactions/transactionBuilder/helpers.d.mts +74 -4
  423. package/dist/esm/transactions/transactionBuilder/helpers.mjs +1 -1
  424. package/dist/esm/transactions/transactionBuilder/index.d.mts +1 -1
  425. package/dist/esm/transactions/transactionBuilder/index.mjs +1 -1
  426. package/dist/esm/transactions/transactionBuilder/remoteAbi.d.mts +45 -23
  427. package/dist/esm/transactions/transactionBuilder/remoteAbi.mjs +1 -1
  428. package/dist/esm/transactions/transactionBuilder/signingMessage.d.mts +20 -15
  429. package/dist/esm/transactions/transactionBuilder/signingMessage.mjs +1 -1
  430. package/dist/esm/transactions/transactionBuilder/transactionBuilder.d.mts +101 -30
  431. package/dist/esm/transactions/transactionBuilder/transactionBuilder.mjs +1 -1
  432. package/dist/esm/transactions/typeTag/index.d.mts +244 -3
  433. package/dist/esm/transactions/typeTag/index.mjs +1 -1
  434. package/dist/esm/transactions/typeTag/parser.d.mts +31 -2
  435. package/dist/esm/transactions/typeTag/parser.mjs +1 -1
  436. package/dist/esm/transactions/types.d.mts +82 -34
  437. package/dist/esm/types/generated/queries.mjs +1 -1
  438. package/dist/esm/types/generated/types.mjs +1 -1
  439. package/dist/esm/types/index.d.mts +320 -59
  440. package/dist/esm/types/index.mjs +1 -1
  441. package/dist/esm/types/indexer.d.mts +65 -2
  442. package/dist/esm/types/keyless.d.mts +18 -0
  443. package/dist/esm/utils/apiEndpoints.d.mts +3 -0
  444. package/dist/esm/utils/apiEndpoints.mjs +1 -1
  445. package/dist/esm/utils/const.d.mts +2 -4
  446. package/dist/esm/utils/const.mjs +1 -1
  447. package/dist/esm/utils/helpers.d.mts +25 -10
  448. package/dist/esm/utils/helpers.mjs +1 -1
  449. package/dist/esm/utils/index.mjs +1 -1
  450. package/dist/esm/utils/memoize.d.mts +12 -10
  451. package/dist/esm/utils/memoize.mjs +1 -1
  452. package/dist/esm/utils/normalizeBundle.d.mts +11 -5
  453. package/dist/esm/utils/normalizeBundle.mjs +1 -1
  454. package/dist/esm/version.d.mts +1 -1
  455. package/dist/esm/version.mjs +1 -1
  456. package/package.json +3 -2
  457. package/src/account/AbstractKeylessAccount.ts +4 -3
  458. package/src/account/Account.ts +88 -54
  459. package/src/account/Ed25519Account.ts +56 -21
  460. package/src/account/EphemeralKeyPair.ts +50 -15
  461. package/src/account/FederatedKeylessAccount.ts +1 -1
  462. package/src/account/KeylessAccount.ts +37 -1
  463. package/src/account/MultiKeyAccount.ts +56 -35
  464. package/src/account/SingleKeyAccount.ts +60 -28
  465. package/src/api/account.ts +443 -159
  466. package/src/api/ans.ts +367 -120
  467. package/src/api/aptos.ts +38 -5
  468. package/src/api/aptosConfig.ts +102 -14
  469. package/src/api/coin.ts +49 -12
  470. package/src/api/digitalAsset.ts +707 -296
  471. package/src/api/event.ts +128 -25
  472. package/src/api/faucet.ts +44 -7
  473. package/src/api/fungibleAsset.ts +149 -46
  474. package/src/api/general.ts +168 -52
  475. package/src/api/keyless.ts +117 -21
  476. package/src/api/object.ts +49 -5
  477. package/src/api/staking.ts +84 -15
  478. package/src/api/table.ts +117 -37
  479. package/src/api/transaction.ts +438 -107
  480. package/src/api/transactionSubmission/build.ts +98 -12
  481. package/src/api/transactionSubmission/helpers.ts +79 -0
  482. package/src/api/transactionSubmission/management.ts +110 -10
  483. package/src/api/transactionSubmission/sign.ts +96 -2
  484. package/src/api/transactionSubmission/simulate.ts +139 -14
  485. package/src/api/transactionSubmission/submit.ts +103 -12
  486. package/src/api/utils.ts +26 -3
  487. package/src/bcs/deserializer.ts +82 -32
  488. package/src/bcs/serializable/entryFunctionBytes.ts +27 -6
  489. package/src/bcs/serializable/fixedBytes.ts +55 -25
  490. package/src/bcs/serializable/movePrimitives.ts +91 -0
  491. package/src/bcs/serializable/moveStructs.ts +123 -35
  492. package/src/bcs/serializer.ts +131 -84
  493. package/src/cli/localNode.ts +46 -17
  494. package/src/cli/move.ts +119 -136
  495. package/src/client/core.ts +22 -7
  496. package/src/client/get.ts +34 -6
  497. package/src/client/post.ts +63 -6
  498. package/src/client/types.ts +40 -13
  499. package/src/core/account/utils/address.ts +1 -1
  500. package/src/core/accountAddress.ts +63 -50
  501. package/src/core/authenticationKey.ts +47 -20
  502. package/src/core/common.ts +6 -0
  503. package/src/core/crypto/ed25519.ts +76 -25
  504. package/src/core/crypto/ephemeral.ts +37 -21
  505. package/src/core/crypto/federatedKeyless.ts +1 -20
  506. package/src/core/crypto/hdKey.ts +10 -7
  507. package/src/core/crypto/keyless.ts +140 -63
  508. package/src/core/crypto/multiEd25519.ts +44 -5
  509. package/src/core/crypto/multiKey.ts +66 -19
  510. package/src/core/crypto/poseidon.ts +72 -5
  511. package/src/core/crypto/privateKey.ts +9 -5
  512. package/src/core/crypto/proof.ts +3 -12
  513. package/src/core/crypto/publicKey.ts +15 -5
  514. package/src/core/crypto/secp256k1.ts +76 -26
  515. package/src/core/crypto/signature.ts +7 -4
  516. package/src/core/crypto/singleKey.ts +62 -5
  517. package/src/core/hex.ts +27 -28
  518. package/src/internal/account.ts +248 -12
  519. package/src/internal/ans.ts +219 -15
  520. package/src/internal/coin.ts +12 -0
  521. package/src/internal/digitalAsset.ts +344 -3
  522. package/src/internal/event.ts +51 -0
  523. package/src/internal/faucet.ts +14 -0
  524. package/src/internal/fungibleAsset.ts +46 -0
  525. package/src/internal/general.ts +46 -0
  526. package/src/internal/keyless.ts +37 -1
  527. package/src/internal/object.ts +21 -0
  528. package/src/internal/queries/getTableItemsData.graphql +1 -1
  529. package/src/internal/queries/getTableItemsMetadata.graphql +1 -1
  530. package/src/internal/staking.ts +27 -1
  531. package/src/internal/table.ts +32 -0
  532. package/src/internal/transaction.ts +120 -7
  533. package/src/internal/transactionSubmission.ts +86 -30
  534. package/src/transactions/authenticator/account.ts +65 -16
  535. package/src/transactions/authenticator/transaction.ts +52 -19
  536. package/src/transactions/instances/chainId.ts +20 -1
  537. package/src/transactions/instances/identifier.ts +21 -3
  538. package/src/transactions/instances/moduleId.ts +22 -8
  539. package/src/transactions/instances/multiAgentTransaction.ts +26 -10
  540. package/src/transactions/instances/rawTransaction.ts +31 -4
  541. package/src/transactions/instances/rotationProofChallenge.ts +24 -2
  542. package/src/transactions/instances/signedTransaction.ts +28 -6
  543. package/src/transactions/instances/simpleTransaction.ts +26 -11
  544. package/src/transactions/instances/transactionArgument.ts +26 -0
  545. package/src/transactions/instances/transactionPayload.ts +73 -26
  546. package/src/transactions/management/accountSequenceNumber.ts +38 -11
  547. package/src/transactions/management/asyncQueue.ts +22 -19
  548. package/src/transactions/management/transactionWorker.ts +66 -40
  549. package/src/transactions/transactionBuilder/helpers.ts +130 -3
  550. package/src/transactions/transactionBuilder/remoteAbi.ts +71 -30
  551. package/src/transactions/transactionBuilder/signingMessage.ts +19 -14
  552. package/src/transactions/transactionBuilder/transactionBuilder.ts +153 -40
  553. package/src/transactions/typeTag/index.ts +264 -3
  554. package/src/transactions/typeTag/parser.ts +54 -20
  555. package/src/transactions/types.ts +81 -33
  556. package/src/types/index.ts +338 -61
  557. package/src/types/indexer.ts +82 -2
  558. package/src/types/keyless.ts +21 -0
  559. package/src/utils/apiEndpoints.ts +3 -0
  560. package/src/utils/const.ts +2 -4
  561. package/src/utils/helpers.ts +25 -10
  562. package/src/utils/memoize.ts +12 -10
  563. package/src/utils/normalizeBundle.ts +11 -5
  564. package/src/version.ts +1 -1
  565. package/dist/common/chunk-HBPH2AD3.js.map +0 -1
  566. package/dist/esm/Ed25519Account-B1VMJOY2.d.mts +0 -361
  567. package/dist/esm/chunk-25NSCK4Q.mjs.map +0 -1
  568. package/dist/esm/chunk-25TIHDS6.mjs.map +0 -1
  569. package/dist/esm/chunk-2TQIU7CG.mjs.map +0 -1
  570. package/dist/esm/chunk-3MCYLML2.mjs +0 -2
  571. package/dist/esm/chunk-3MCYLML2.mjs.map +0 -1
  572. package/dist/esm/chunk-3YKAGVHZ.mjs.map +0 -1
  573. package/dist/esm/chunk-44GYWUSH.mjs.map +0 -1
  574. package/dist/esm/chunk-46D5QX3G.mjs.map +0 -1
  575. package/dist/esm/chunk-555I4YHP.mjs +0 -2
  576. package/dist/esm/chunk-5655UVIK.mjs.map +0 -1
  577. package/dist/esm/chunk-6EMN3BOV.mjs.map +0 -1
  578. package/dist/esm/chunk-6QGVRNV6.mjs +0 -2
  579. package/dist/esm/chunk-6QGVRNV6.mjs.map +0 -1
  580. package/dist/esm/chunk-6RZZIOGH.mjs.map +0 -1
  581. package/dist/esm/chunk-7V6DEA7G.mjs.map +0 -1
  582. package/dist/esm/chunk-7ZLBJUVZ.mjs.map +0 -1
  583. package/dist/esm/chunk-AFOPNDOJ.mjs.map +0 -1
  584. package/dist/esm/chunk-AH44UPM4.mjs.map +0 -1
  585. package/dist/esm/chunk-B2CXRZL5.mjs.map +0 -1
  586. package/dist/esm/chunk-B5NYEWNM.mjs +0 -2
  587. package/dist/esm/chunk-B5NYEWNM.mjs.map +0 -1
  588. package/dist/esm/chunk-B6M7QBUO.mjs.map +0 -1
  589. package/dist/esm/chunk-BCUSI3N6.mjs.map +0 -1
  590. package/dist/esm/chunk-BD6BJETG.mjs.map +0 -1
  591. package/dist/esm/chunk-BF4ZE37Q.mjs +0 -2
  592. package/dist/esm/chunk-BF4ZE37Q.mjs.map +0 -1
  593. package/dist/esm/chunk-BKEJMQQ6.mjs +0 -2
  594. package/dist/esm/chunk-BKEJMQQ6.mjs.map +0 -1
  595. package/dist/esm/chunk-BRFHAO2Y.mjs.map +0 -1
  596. package/dist/esm/chunk-BSUYPXRD.mjs +0 -2
  597. package/dist/esm/chunk-BSUYPXRD.mjs.map +0 -1
  598. package/dist/esm/chunk-CCMHWJ3Q.mjs +0 -2
  599. package/dist/esm/chunk-CCMHWJ3Q.mjs.map +0 -1
  600. package/dist/esm/chunk-CPPBQDHB.mjs.map +0 -1
  601. package/dist/esm/chunk-CVDR5SJR.mjs.map +0 -1
  602. package/dist/esm/chunk-DAJOX4PL.mjs.map +0 -1
  603. package/dist/esm/chunk-DAXKRXRK.mjs.map +0 -1
  604. package/dist/esm/chunk-DF4WKSTK.mjs.map +0 -1
  605. package/dist/esm/chunk-E37YRKWK.mjs.map +0 -1
  606. package/dist/esm/chunk-ECWOLU5T.mjs.map +0 -1
  607. package/dist/esm/chunk-EV2USF7B.mjs.map +0 -1
  608. package/dist/esm/chunk-EWZ2M5BW.mjs.map +0 -1
  609. package/dist/esm/chunk-EXP5STXZ.mjs.map +0 -1
  610. package/dist/esm/chunk-FRGXKOU5.mjs.map +0 -1
  611. package/dist/esm/chunk-GFGX3QDP.mjs.map +0 -1
  612. package/dist/esm/chunk-GGR3P2TG.mjs +0 -2
  613. package/dist/esm/chunk-GGR3P2TG.mjs.map +0 -1
  614. package/dist/esm/chunk-HAT5S2XX.mjs +0 -2
  615. package/dist/esm/chunk-HAT5S2XX.mjs.map +0 -1
  616. package/dist/esm/chunk-HPZ2S4FE.mjs +0 -2
  617. package/dist/esm/chunk-HPZ2S4FE.mjs.map +0 -1
  618. package/dist/esm/chunk-HSPBA2TZ.mjs.map +0 -1
  619. package/dist/esm/chunk-IMGLHDIA.mjs +0 -2
  620. package/dist/esm/chunk-IMGLHDIA.mjs.map +0 -1
  621. package/dist/esm/chunk-IYQISVDX.mjs.map +0 -1
  622. package/dist/esm/chunk-K2O24YLZ.mjs.map +0 -1
  623. package/dist/esm/chunk-KA6FZNWP.mjs +0 -2
  624. package/dist/esm/chunk-KA6FZNWP.mjs.map +0 -1
  625. package/dist/esm/chunk-KEYAPEAX.mjs.map +0 -1
  626. package/dist/esm/chunk-KXBIA4KR.mjs.map +0 -1
  627. package/dist/esm/chunk-KYSDF3CA.mjs.map +0 -1
  628. package/dist/esm/chunk-L5NY7TMI.mjs.map +0 -1
  629. package/dist/esm/chunk-LDFTE4MM.mjs.map +0 -1
  630. package/dist/esm/chunk-LG3DAAPD.mjs +0 -2
  631. package/dist/esm/chunk-LG3DAAPD.mjs.map +0 -1
  632. package/dist/esm/chunk-LG7RJQ57.mjs.map +0 -1
  633. package/dist/esm/chunk-LGD5KU56.mjs +0 -2
  634. package/dist/esm/chunk-LGD5KU56.mjs.map +0 -1
  635. package/dist/esm/chunk-LR65XHSF.mjs.map +0 -1
  636. package/dist/esm/chunk-LXLISEQ4.mjs.map +0 -1
  637. package/dist/esm/chunk-M2QV232A.mjs +0 -2
  638. package/dist/esm/chunk-M2QV232A.mjs.map +0 -1
  639. package/dist/esm/chunk-MEWFJJJN.mjs +0 -2
  640. package/dist/esm/chunk-MEWFJJJN.mjs.map +0 -1
  641. package/dist/esm/chunk-MO4IZXLK.mjs.map +0 -1
  642. package/dist/esm/chunk-MS4MRLGA.mjs.map +0 -1
  643. package/dist/esm/chunk-N5JNKD5F.mjs.map +0 -1
  644. package/dist/esm/chunk-NH2S6SB2.mjs.map +0 -1
  645. package/dist/esm/chunk-NMD45OTM.mjs.map +0 -1
  646. package/dist/esm/chunk-NNRAQP36.mjs.map +0 -1
  647. package/dist/esm/chunk-OY2IX7HW.mjs.map +0 -1
  648. package/dist/esm/chunk-PKXEB7XP.mjs.map +0 -1
  649. package/dist/esm/chunk-PNXUYOYI.mjs +0 -2
  650. package/dist/esm/chunk-PNXUYOYI.mjs.map +0 -1
  651. package/dist/esm/chunk-PUZ25PTD.mjs.map +0 -1
  652. package/dist/esm/chunk-Q4XR6QOZ.mjs +0 -2
  653. package/dist/esm/chunk-QCUFTD7K.mjs.map +0 -1
  654. package/dist/esm/chunk-QDIKOQRK.mjs +0 -2
  655. package/dist/esm/chunk-QDIKOQRK.mjs.map +0 -1
  656. package/dist/esm/chunk-QIW56MUH.mjs.map +0 -1
  657. package/dist/esm/chunk-QLN2URFX.mjs.map +0 -1
  658. package/dist/esm/chunk-QPP6BX53.mjs.map +0 -1
  659. package/dist/esm/chunk-RNTXQYJQ.mjs.map +0 -1
  660. package/dist/esm/chunk-SAPUZZEU.mjs.map +0 -1
  661. package/dist/esm/chunk-SR24OGHJ.mjs.map +0 -1
  662. package/dist/esm/chunk-SRPI2FFA.mjs.map +0 -1
  663. package/dist/esm/chunk-STGYDB5E.mjs.map +0 -1
  664. package/dist/esm/chunk-SWHLSREF.mjs.map +0 -1
  665. package/dist/esm/chunk-TDGQGILY.mjs.map +0 -1
  666. package/dist/esm/chunk-TL7DR54X.mjs.map +0 -1
  667. package/dist/esm/chunk-TMW2HIXC.mjs.map +0 -1
  668. package/dist/esm/chunk-TS3PYRAT.mjs.map +0 -1
  669. package/dist/esm/chunk-TVFIUUVY.mjs.map +0 -1
  670. package/dist/esm/chunk-U67PFBTL.mjs.map +0 -1
  671. package/dist/esm/chunk-U6Z4FNB7.mjs.map +0 -1
  672. package/dist/esm/chunk-UAL27G6B.mjs.map +0 -1
  673. package/dist/esm/chunk-WP7WF54Q.mjs.map +0 -1
  674. package/dist/esm/chunk-WS4RPKL6.mjs +0 -2
  675. package/dist/esm/chunk-WS4RPKL6.mjs.map +0 -1
  676. package/dist/esm/chunk-WWZ3METZ.mjs.map +0 -1
  677. package/dist/esm/chunk-X4KEZTUQ.mjs.map +0 -1
  678. package/dist/esm/chunk-XH7YKEYR.mjs.map +0 -1
  679. package/dist/esm/chunk-XK3JFCP3.mjs.map +0 -1
  680. package/dist/esm/chunk-XONG5JZ4.mjs.map +0 -1
  681. package/dist/esm/chunk-XXHW3ZT3.mjs.map +0 -1
  682. package/dist/esm/chunk-Y7F2V3R6.mjs.map +0 -1
  683. package/dist/esm/chunk-YHAPZP5A.mjs.map +0 -1
  684. package/dist/esm/chunk-YJCZU6PR.mjs.map +0 -1
  685. package/dist/esm/chunk-ZGO2SK6F.mjs.map +0 -1
  686. package/dist/esm/publicKey-B3XRNhHO.d.mts +0 -113
  687. /package/dist/esm/{chunk-FVA2OPG4.mjs.map → chunk-KDMSOCZY.mjs.map} +0 -0
  688. /package/dist/esm/{chunk-Q4XR6QOZ.mjs.map → chunk-KIW54KWR.mjs.map} +0 -0
  689. /package/dist/esm/{chunk-G7MWTE2J.mjs.map → chunk-KSUZS6EL.mjs.map} +0 -0
@@ -1,2 +1,2 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});var d=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var i=(e,n,t,r)=>{for(var o=r>1?void 0:r?m(n,t):n,s=e.length-1,a;s>=0;s--)(a=e[s])&&(o=(r?a(n,t,o):a(o))||o);return r&&o&&d(n,t,o),o};var _jsbase64 = require('js-base64');async function p(e){return new Promise(n=>{setTimeout(n,e)})}var _=()=>Math.floor(Date.now()/1e3);function f(e){let n=new Date(e*1e3);return n.setMinutes(0),n.setSeconds(0),n.setMilliseconds(0),Math.floor(n.getTime()/1e3)}function S(e){let n=e.replace(/-/g,"+").replace(/_/g,"/"),t=n+"==".substring(0,(3-n.length%3)%3);return _jsbase64.decode.call(void 0, t)}var h=(e,n)=>e*10**n,x= exports.g =(e,n)=>e/10**n,c=e=>{let n="";for(let t=2;t<e.length;t+=2)n+=String.fromCharCode(parseInt(e.substring(t,t+2),16));return n},y= exports.h =e=>{let{account_address:n,module_name:t,struct_name:r}=e,o=c(t),s=c(r);return`${n}::${o}::${s}`},b= exports.i =e=>typeof e=="object"&&!Array.isArray(e)&&e!==null&&"account_address"in e&&"module_name"in e&&"struct_name"in e&&typeof e.account_address=="string"&&typeof e.module_name=="string"&&typeof e.struct_name=="string";exports.a = i; exports.b = p; exports.c = _; exports.d = f; exports.e = S; exports.f = h; exports.g = x; exports.h = y; exports.i = b;
2
- //# sourceMappingURL=chunk-HBPH2AD3.js.map
2
+ //# sourceMappingURL=chunk-7IYTZDXV.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["/Users/maayansavir/work/aptos-ts-sdk/dist/common/chunk-7IYTZDXV.js","../../src/utils/helpers.ts"],"names":["sleep","timeMs","resolve","nowInSeconds","floorToWholeHour","timestampInSeconds","date","base64UrlDecode","base64Url","base64","paddedBase64","decode","convertAmountFromHumanReadableToOnChain","value","decimal","convertAmountFromOnChainToHumanReadable","hexToAscii","hex","str","n","parseEncodedStruct","structObj","account_address","module_name","struct_name","moduleName","structName"],"mappings":"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","file":"/Users/maayansavir/work/aptos-ts-sdk/dist/common/chunk-7IYTZDXV.js","sourcesContent":[null,"// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { decode } from \"js-base64\";\nimport { MoveStructId } from \"../types\";\n\n/**\n * Sleep for the specified amount of time in milliseconds.\n * This function can be used to introduce delays in asynchronous operations.\n *\n * @param timeMs - The time in milliseconds to sleep.\n */\nexport async function sleep(timeMs: number): Promise<null> {\n return new Promise((resolve) => {\n setTimeout(resolve, timeMs);\n });\n}\n\nexport const nowInSeconds = () => Math.floor(Date.now() / 1000);\n\n/**\n * Floors the given timestamp to the nearest whole hour.\n * This function is useful for normalizing timestamps to hourly intervals.\n *\n * @param timestampInSeconds - The timestamp in seconds to be floored.\n */\nexport function floorToWholeHour(timestampInSeconds: number): number {\n const date = new Date(timestampInSeconds * 1000);\n // Reset minutes and seconds to zero\n date.setMinutes(0);\n date.setSeconds(0);\n date.setMilliseconds(0);\n return Math.floor(date.getTime() / 1000);\n}\n\n/**\n * Decodes a base64 URL-encoded string into its original form.\n * This function is useful for converting base64 URL-encoded data back to a readable format.\n *\n * @param base64Url - The base64 URL-encoded string to decode.\n * @returns The decoded string.\n */\nexport function base64UrlDecode(base64Url: string): string {\n // Replace base64url-specific characters\n const base64 = base64Url.replace(/-/g, \"+\").replace(/_/g, \"/\");\n // Pad the string with '=' characters if needed\n const paddedBase64 = base64 + \"==\".substring(0, (3 - (base64.length % 3)) % 3);\n const decodedString = decode(paddedBase64);\n return decodedString;\n}\n\n/**\n * Amount is represented in the smallest unit format on chain, this function converts\n * a human-readable amount format to the smallest unit format\n * @example\n * human-readable amount format: 500\n * on chain amount format when decimal is 8: 50000000000\n *\n * @param value The value in human-readable format\n * @param decimal The token decimal\n * @returns The value in the smallest units\n */\nexport const convertAmountFromHumanReadableToOnChain = (value: number, decimal: number) => value * 10 ** decimal;\n\n/**\n * Amount is represented in the smallest unit format on chain, this function converts\n * the smallest unit format to a human-readable amount format\n * @example\n * human-readable amount format: 500\n * on chain amount format when decimal is 8: 50000000000\n *\n * @param value The value in human-readable format\n * @param decimal The token decimal\n * @returns The value in the smallest units\n */\nexport const convertAmountFromOnChainToHumanReadable = (value: number, decimal: number) => value / 10 ** decimal;\n\n/**\n * Convert a hex string to an ascii string with the `0x` prefix.\n *\n * `0x6170746f735f636f696e` --> `aptos_coin`\n *\n * @param hex The hex string to convert (e.g. `0x6170746f735f636f696e`)\n * @returns The ascii string\n */\nconst hexToAscii = (hex: string) => {\n let str = \"\";\n for (let n = 2; n < hex.length; n += 2) {\n str += String.fromCharCode(parseInt(hex.substring(n, n + 2), 16));\n }\n return str;\n};\n\n/**\n * Convert an encoded struct to a MoveStructId.\n *\n * @example\n * const structObj = {\n * account_address: \"0x1\",\n * module_name: \"0x6170746f735f636f696e\",\n * struct_name: \"0x4170746f73436f696e\",\n * };\n * // structId is \"0x1::aptos_coin::AptosCoin\"\n * const structId = parseEncodedStruct(structObj);\n *\n * @param structObj The struct with account_address, module_name, and struct_name properties\n * @returns The MoveStructId\n */\nexport const parseEncodedStruct = (structObj: {\n account_address: string;\n module_name: string;\n struct_name: string;\n}): MoveStructId => {\n // eslint-disable-next-line @typescript-eslint/naming-convention\n const { account_address, module_name, struct_name } = structObj;\n const moduleName = hexToAscii(module_name);\n const structName = hexToAscii(struct_name);\n return `${account_address}::${moduleName}::${structName}`;\n};\n\n/**\n * Determines whether the given object is an encoded struct type with the following properties:\n * - account_address: string\n * - module_name: string\n * - struct_name: string\n *\n * @param structObj The object to check\n * @returns Whether the object is an encoded struct type\n */\nexport const isEncodedStruct = (\n structObj: any,\n): structObj is {\n account_address: string;\n module_name: string;\n struct_name: string;\n} =>\n typeof structObj === \"object\" &&\n !Array.isArray(structObj) &&\n structObj !== null &&\n \"account_address\" in structObj &&\n \"module_name\" in structObj &&\n \"struct_name\" in structObj &&\n typeof structObj.account_address === \"string\" &&\n typeof structObj.module_name === \"string\" &&\n typeof structObj.struct_name === \"string\";\n"]}
@@ -1,119 +1,128 @@
1
1
  import { ChildProcessWithoutNullStreams } from 'child_process';
2
- import { N as Network, g as AccountAddress } from '../accountAddress-DUCC2ffJ.js';
2
+ import { N as Network, g as AccountAddress } from '../accountAddress-DnSqjhSl.js';
3
3
 
4
+ /**
5
+ * Represents a local node for running a testnet environment.
6
+ * This class provides methods to start, stop, and check the status of the local testnet process.
7
+ * It manages the lifecycle of the node process and ensures that it is operational before executing tests.
8
+ */
4
9
  declare class LocalNode {
5
10
  readonly MAXIMUM_WAIT_TIME_SEC = 75;
6
11
  readonly READINESS_ENDPOINT = "http://127.0.0.1:8070/";
12
+ showStdout: boolean;
7
13
  process: ChildProcessWithoutNullStreams | null;
14
+ constructor(args?: {
15
+ showStdout?: boolean;
16
+ });
8
17
  /**
9
- * kills all the descendent processes
10
- * of the node process, including the node process itself
18
+ * Kills the current process and all its descendant processes.
19
+ *
20
+ * @returns {Promise<void>} A promise that resolves to true if the process was successfully killed.
21
+ * @throws {Error} If there is an error while attempting to kill the process.
11
22
  */
12
23
  stop(): Promise<void>;
13
24
  /**
14
- * Runs a local testnet and waits for process to be up.
25
+ * Runs a local testnet and waits for the process to be up.
26
+ * If the local node process is already running, it returns without starting the process.
15
27
  *
16
- * If local node process is already up it returns and does
17
- * not start the process
28
+ * @returns {Promise<void>} A promise that resolves when the process is up.
18
29
  */
19
30
  run(): Promise<void>;
20
31
  /**
21
- * Starts the local testnet by running the aptos node run-local-testnet command
32
+ * Starts the local testnet by running the Aptos node with the specified command-line arguments.
33
+ *
34
+ * @returns {void}
35
+ *
36
+ * @throws {Error} If there is an issue starting the local testnet.
22
37
  */
23
38
  start(): void;
24
39
  /**
25
- * Waits for the local testnet process to be up
40
+ * Waits for the local testnet process to be operational within a specified maximum wait time.
41
+ * This function continuously checks if the process is up and will throw an error if it fails to start.
26
42
  *
27
- * @returns Promise<boolean>
43
+ * @returns Promise<boolean> - Resolves to true if the process is up, otherwise throws an error.
28
44
  */
29
45
  waitUntilProcessIsUp(): Promise<boolean>;
30
46
  /**
31
- * Checks if the local testnet is up
47
+ * Checks if the local testnet is up by querying the readiness endpoint.
32
48
  *
33
- * @returns Promise<boolean>
49
+ * @returns Promise<boolean> - A promise that resolves to true if the testnet is up, otherwise false.
34
50
  */
35
51
  checkIfProcessIsUp(): Promise<boolean>;
36
52
  }
37
53
 
54
+ /**
55
+ * Class representing a Move package management utility for the Aptos blockchain.
56
+ * This class provides methods to initialize directories, compile packages, run tests, publish modules, create objects, upgrade
57
+ * packages, build transaction payloads, and run scripts.
58
+ */
38
59
  declare class Move {
39
60
  /**
40
- * Function to initialize current directory for Aptos
41
- *
42
- * Configuration will be pushed into .aptos/config.yaml
43
- * @param args.network optional Network type argument to use for default settings, default is local
44
- * @param args.profile optional Profile to use from the config file, default is 'default'
45
- * This will be used to override associated settings such as the REST URL, the Faucet URL, and the private key arguments.
46
- * @param args.extraArguments (optional) Any extra arguments to include in the form of an array of strings
47
- * @example
48
- * ["--assume-yes","--gas-unit-price=10"]
61
+ * Initialize the current directory for Aptos by configuring the necessary settings.
62
+ * Configuration will be pushed into .aptos/config.yaml.
49
63
  *
64
+ * @param args - The arguments for initialization.
65
+ * @param args.network - Optional Network type argument to use for default settings; defaults to local.
66
+ * @param args.profile - Optional Profile to use from the config file; defaults to 'default'. This will override associated
67
+ * settings such as the REST URL, the Faucet URL, and the private key arguments.
68
+ * @param args.extraArguments - Optional extra arguments to include in the form of an array of strings.
69
+ * Ex. ["--assume-yes","--gas-unit-price=10"]
50
70
  * @returns stdout
51
71
  */
52
72
  init(args: {
53
73
  network?: Network;
54
74
  profile?: string;
55
75
  extraArguments?: Array<string>;
76
+ showStdout?: boolean;
56
77
  }): Promise<{
57
78
  output: string;
58
79
  }>;
59
80
  /**
60
- * Function to compile a package
61
- *
62
- * @param args.packageDirectoryPath Path to a move package (the folder with a Move.toml file)
63
- * @param args.namedAddresses Named addresses for the move binary
64
- * @param args.extraArguments (optional) Any extra arguments to include in the form of an array of strings
65
- * @example
66
- * ["--assume-yes","--gas-unit-price=10"]
67
- * @example
68
- * {
69
- * alice:0x1234, bob:0x5678
70
- * }
81
+ * Compile a Move package located at the specified directory path.
82
+ * This function helps in preparing the Move package for deployment or further processing.
71
83
  *
84
+ * @param args - The arguments for compiling the package.
85
+ * @param args.packageDirectoryPath - Path to a Move package (the folder with a Move.toml file).
86
+ * @param args.namedAddresses - Named addresses for the move binary. Ex. { alice: 0x1234, bob: 0x5678 }
87
+ * @param args.extraArguments - Optional extra arguments to include in the form of an array of strings.
88
+ * Ex. ["--assume-yes","--gas-unit-price=10"]
72
89
  * @returns stdout
73
90
  */
74
91
  compile(args: {
75
92
  packageDirectoryPath: string;
76
93
  namedAddresses: Record<string, AccountAddress>;
77
94
  extraArguments?: Array<string>;
95
+ showStdout?: boolean;
78
96
  }): Promise<{
79
97
  output: string;
80
98
  }>;
81
99
  /**
82
- * Function to run Move unit tests for a package
83
- *
84
- * @param args.packageDirectoryPath Path to a move package (the folder with a Move.toml file)
85
- * @param args.namedAddresses Named addresses for the move binary
86
- * @example
87
- * {
88
- * alice:0x1234, bob:0x5678
89
- * }
90
- * @param args.extraArguments (optional) Any extra arguments to include in the form of an array of strings
91
- * @example
92
- * ["--assume-yes","--gas-unit-price=10"]
100
+ * Run Move unit tests for a specified package.
93
101
  *
94
- * @returns stdout
102
+ * @param args - The arguments for running the tests.
103
+ * @param args.packageDirectoryPath - The path to a Move package (the folder containing a Move.toml file).
104
+ * @param args.namedAddresses - Named addresses for the move binary. Ex. { alice: 0x1234, bob: 0x5678 }
105
+ * @param args.extraArguments - Optional extra arguments to include in the form of an array of strings.
106
+ * Ex. ["--assume-yes","--gas-unit-price=10"]
107
+ * @returns The stdout output from running the tests.
95
108
  */
96
109
  test(args: {
97
110
  packageDirectoryPath: string;
98
111
  namedAddresses: Record<string, AccountAddress>;
99
112
  extraArguments?: Array<string>;
113
+ showStdout?: boolean;
100
114
  }): Promise<{
101
115
  output: string;
102
116
  }>;
103
117
  /**
104
- * Function to publish the modules to the publisher account on the Aptos blockchain
105
- *
106
- * @param args.packageDirectoryPath Path to a move package (the folder with a Move.toml file)
107
- * @param args.namedAddresses Named addresses for the move binary
108
- * @example
109
- * {
110
- * alice:0x1234, bob:0x5678
111
- * }
112
- * @param args.profile optional Profile to use from the config file.
113
- * @param args.extraArguments (optional) Any extra arguments to include in the form of an array of strings
114
- * @example
115
- * ["--assume-yes","--gas-unit-price=10"]
118
+ * Publishes the modules to the publisher account on the Aptos blockchain.
116
119
  *
120
+ * @param args - The arguments for publishing the modules.
121
+ * @param args.packageDirectoryPath - The path to a move package (the folder with a Move.toml file).
122
+ * @param args.namedAddresses - Named addresses for the move binary. Ex. { alice: 0x1234, bob: 0x5678 }
123
+ * @param args.profile - Optional profile to use from the config file.
124
+ * @param args.extraArguments - Optional extra arguments to include in the form of an array of strings.
125
+ * Ex. ["--assume-yes","--gas-unit-price=10"]
117
126
  * @returns stdout
118
127
  */
119
128
  publish(args: {
@@ -121,34 +130,29 @@ declare class Move {
121
130
  namedAddresses: Record<string, AccountAddress>;
122
131
  profile?: string;
123
132
  extraArguments?: Array<string>;
133
+ showStdout?: boolean;
124
134
  }): Promise<{
125
135
  output: string;
126
136
  }>;
127
137
  /**
128
- * Function to create a new object and publish the Move package to it on the Aptos blockchain
138
+ * Create a new object and publish the Move package to it on the Aptos blockchain.
129
139
  *
130
- * @param args.packageDirectoryPath Path to a move package (the folder with a Move.toml file)
131
- * @param args.addressName Address name for the Move package
132
- * @example
133
- * MoonCoin, please find the actual address name in Move.toml
134
- * @param args.namedAddresses Named addresses for the move binary
135
- * @example
136
- * {
137
- * alice:0x1234, bob:0x5678
138
- * }
139
- * @param args.profile optional Profile to use from the config file.
140
- * @param args.extraArguments (optional) Any extra arguments to include in the form of an array of strings
141
- * @example
142
- * ["--assume-yes","--gas-unit-price=10"]
140
+ * @param args - The arguments for creating the object and publishing the package.
141
+ * @param args.packageDirectoryPath - Path to a Move package (the folder with a Move.toml file).
142
+ * @param args.addressName - Address name for the Move package.
143
+ * @param args.namedAddresses - Named addresses for the Move binary.
144
+ * @param args.profile - Optional profile to use from the config file.
145
+ * @param args.extraArguments - Optional extra arguments to include in the form of an array of strings.
146
+ * Ex. ["--assume-yes","--gas-unit-price=10"]
147
+ * @returns The object address.
143
148
  *
144
- * A complete example in cli
149
+ * A complete example in CLI:
145
150
  * aptos move create-object-and-publish-package \
146
151
  * --package-dir path_to_directory_that_has_move.toml \
147
152
  * --address-name launchpad_addr \
148
- * --named-addresses "launchpad_addr=0x123,initial_creator_addr=0x456"\
153
+ * --named-addresses "launchpad_addr=0x123,initial_creator_addr=0x456" \
149
154
  * --profile my_profile \
150
155
  * --assume-yes
151
- * @returns object address
152
156
  */
153
157
  createObjectAndPublishPackage(args: {
154
158
  packageDirectoryPath: string;
@@ -156,27 +160,21 @@ declare class Move {
156
160
  namedAddresses: Record<string, AccountAddress>;
157
161
  profile?: string;
158
162
  extraArguments?: Array<string>;
163
+ showStdout?: boolean;
159
164
  }): Promise<{
160
165
  objectAddress: string;
161
166
  }>;
162
167
  /**
163
- * Function to upgrade a Move package previously published to an object on the Aptos blockchain
164
- * Caller must be the object owner to call this function
165
- *
166
- * @param args.packageDirectoryPath Path to a move package (the folder with a Move.toml file)
167
- * @param args.objectAddress Address of the object that the Move package published to
168
- * @example
169
- * 0x1000
170
- * @param args.namedAddresses Named addresses for the move binary
171
- * @example
172
- * {
173
- * alice:0x1234, bob:0x5678
174
- * }
175
- * @param args.profile optional Profile to use from the config file.
176
- * @param args.extraArguments (optional) Any extra arguments to include in the form of an array of strings
177
- * @example
178
- * ["--assume-yes","--gas-unit-price=10"]
168
+ * Upgrade a Move package previously published to an object on the Aptos blockchain.
169
+ * The caller must be the object owner to execute this function.
179
170
  *
171
+ * @param args - The arguments for upgrading the object package.
172
+ * @param args.packageDirectoryPath - Path to a Move package (the folder with a Move.toml file).
173
+ * @param args.objectAddress - Address of the object that the Move package published to. Ex. 0x1000
174
+ * @param args.namedAddresses - Named addresses for the move binary. Ex. { alice: 0x1234, bob: 0x5678 }
175
+ * @param args.profile - Optional profile to use from the config file.
176
+ * @param args.extraArguments - Optional extra arguments to include in the form of an array of strings.
177
+ * Ex. ["--assume-yes","--gas-unit-price=10"]
180
178
  * @returns stdout
181
179
  */
182
180
  upgradeObjectPackage(args: {
@@ -185,23 +183,19 @@ declare class Move {
185
183
  namedAddresses: Record<string, AccountAddress>;
186
184
  profile?: string;
187
185
  extraArguments?: Array<string>;
186
+ showStdout?: boolean;
188
187
  }): Promise<{
189
188
  output: string;
190
189
  }>;
191
190
  /**
192
- * Build a publication transaction payload and store it in a JSON output file
193
- *
194
- * @param args.packageDirectoryPath Path to a move package (the folder with a Move.toml file)
195
- * @param args.outputFile Output file to write publication transaction to
196
- * @param args.namedAddresses Named addresses for the move binary
197
- * @example
198
- * {
199
- * alice:0x1234, bob:0x5678
200
- * }
201
- * @param args.extraArguments (optional) Any extra arguments to include in the form of an array of strings
202
- * @example
203
- * ["--assume-yes","--gas-unit-price=10"]
191
+ * Build a publication transaction payload and store it in a JSON output file.
204
192
  *
193
+ * @param args - The arguments for building the publishing payload.
194
+ * @param args.packageDirectoryPath - Path to a move package (the folder with a Move.toml file).
195
+ * @param args.outputFile - Output file to write the publication transaction to.
196
+ * @param args.namedAddresses - Named addresses for the move binary. Ex. { alice: 0x1234, bob: 0x5678 }
197
+ * @param args.extraArguments - Optional extra arguments to include in the form of an array of strings.
198
+ * Ex. ["--assume-yes","--gas-unit-price=10"] *
205
199
  * @returns stdout
206
200
  */
207
201
  buildPublishPayload(args: {
@@ -209,60 +203,63 @@ declare class Move {
209
203
  outputFile: string;
210
204
  namedAddresses: Record<string, AccountAddress>;
211
205
  extraArguments?: Array<string>;
206
+ showStdout?: boolean;
212
207
  }): Promise<{
213
208
  output: string;
214
209
  }>;
215
210
  /**
216
- * Function to run a Move script, please run compile before running this
211
+ * Runs a Move script using the provided compiled script path and optional parameters. Ensure that the script is compiled
212
+ * before executing this function.
217
213
  *
218
- * @param args.compiledScriptPath Path to a compiled Move script bytecode file
219
- * @param args.namedAddresses Named addresses for the move binary
220
- * @example
221
- * build/my_package/bytecode_scripts/my_move_script.mv
222
- * @param args.profile optional Profile to use from the config file.
223
- * @param args.extraArguments (optional) Any extra arguments to include in the form of an array of strings
224
- * @example
225
- * ["--assume-yes","--gas-unit-price=10"]
214
+ * @param args - The arguments for running the script.
215
+ * @param args.compiledScriptPath - Path to a compiled Move script bytecode file.
216
+ * Ex. "build/my_package/bytecode_scripts/my_move_script.mv"
217
+ * @param args.profile - Optional profile to use from the config file.
218
+ * @param args.extraArguments - Optional extra arguments to include in the form of an array of strings.
219
+ * Ex. ["--assume-yes","--gas-unit-price=10"]
226
220
  *
227
- * @returns stdout
221
+ * @returns The standard output from running the script.
228
222
  */
229
223
  runScript(args: {
230
224
  compiledScriptPath: string;
231
225
  profile?: string;
232
226
  extraArguments?: Array<string>;
227
+ showStdout?: boolean;
233
228
  }): Promise<{
234
229
  output: string;
235
230
  }>;
236
231
  /**
237
- * Run a move command
232
+ * Run a command with the specified arguments and return the output.
238
233
  *
239
- * @param args
240
- * @returns stdout
234
+ * @param args - An array of strings representing the command-line arguments to be passed to the command.
235
+ * @param showStdout - Show the standard output generated by the command.
236
+ * @returns The standard output generated by the command.
241
237
  */
242
238
  private runCommand;
243
239
  /**
244
- * Convert named addresses from a Map into an array seperated by a comma
245
- *
246
- * @example
247
- * input: {'alice' => '0x123', 'bob' => '0x456'}
248
- * output: "alice=0x123,bob=0x456"
240
+ * Convert named addresses from a Map into an array separated by a comma.
249
241
  *
250
- * @param namedAddresses
251
- * @returns An array of names addresses seperated by a comma
242
+ * @param namedAddresses - A Map where the key is a string representing the name and the value is an AccountAddress.
243
+ * Ex. {'alice' => '0x123', 'bob' => '0x456'}
244
+ * @returns An array of named addresses formatted as strings separated by a comma. Ex. "alice=0x123,bob=0x456"
252
245
  */
253
246
  private prepareNamedAddresses;
254
247
  /**
255
- * Parse named addresses from a Record type into a Map
248
+ * Parse named addresses from a Record type into a Map.
249
+ *
250
+ * This function transforms a collection of named addresses into a more accessible format by mapping each name to its
251
+ * corresponding address.
256
252
  *
257
- * @param namedAddresses
258
- * @returns Map<name,address>
253
+ * @param namedAddresses - A record containing named addresses where the key is the name and the value is the AccountAddress.
254
+ * @returns A Map where each key is a name and each value is the corresponding address.
259
255
  */
260
256
  private parseNamedAddresses;
261
257
  /**
262
- * Extract object address from the output
258
+ * Extracts the object address from the provided output string.
263
259
  *
264
- * @param output
265
- * @returns object address
260
+ * @param output - The output string containing the object address.
261
+ * @returns The extracted object address.
262
+ * @throws Error if the object address cannot be extracted from the output.
266
263
  */
267
264
  private extractAddressFromOutput;
268
265
  }
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }var _chunkHBPH2AD3js = require('../chunk-HBPH2AD3.js');var _child_process = require('child_process');var _treekill = require('tree-kill'); var _treekill2 = _interopRequireDefault(_treekill);var _os = require('os');var p=class{constructor(){this.MAXIMUM_WAIT_TIME_SEC=75;this.READINESS_ENDPOINT="http://127.0.0.1:8070/";this.process=null}async stop(){await new Promise((s,e)=>{_optionalChain([this, 'access', _ => _.process, 'optionalAccess', _2 => _2.pid])&&_treekill2.default.call(void 0, this.process.pid,t=>{t?e(t):s(!0)})})}async run(){await this.checkIfProcessIsUp()||(this.start(),await this.waitUntilProcessIsUp())}start(){let s="npx",e=["aptos","node","run-localnet","--force-restart","--assume-yes","--with-indexer-api"],t=_os.platform.call(void 0, ),a;t==="win32"?a=_child_process.spawn.call(void 0, s,e,{shell:!0}):a=_child_process.spawn.call(void 0, s,e),this.process=a,_optionalChain([a, 'access', _3 => _3.stderr, 'optionalAccess', _4 => _4.on, 'call', _5 => _5("data",r=>{let o=r.toString();console.log(o)})]),_optionalChain([a, 'access', _6 => _6.stdout, 'optionalAccess', _7 => _7.on, 'call', _8 => _8("data",r=>{let o=r.toString();console.log(o)})])}async waitUntilProcessIsUp(){let s=await this.checkIfProcessIsUp(),e=Date.now()/1e3,t=e;for(;!s&&e+this.MAXIMUM_WAIT_TIME_SEC>t;)await _chunkHBPH2AD3js.b.call(void 0, 1e3),s=await this.checkIfProcessIsUp(),t=Date.now()/1e3;if(!s)throw new Error("Process failed to start");return!0}async checkIfProcessIsUp(){try{return(await fetch(this.READINESS_ENDPOINT)).status===200}catch (e2){return!1}}};var m=class{async init(s){let{network:e,profile:t,extraArguments:a}=s,r=["aptos","init",`--network=${_nullishCoalesce(e, () => ("local"))}`,`--profile=${_nullishCoalesce(t, () => ("default"))}`];return a&&r.push(...a),this.runCommand(r)}async compile(s){let{packageDirectoryPath:e,namedAddresses:t,extraArguments:a}=s,r=["aptos","move","compile","--package-dir",e],o=this.parseNamedAddresses(t);return r.push(...this.prepareNamedAddresses(o)),a&&r.push(...a),this.runCommand(r)}async test(s){let{packageDirectoryPath:e,namedAddresses:t,extraArguments:a}=s,r=["aptos","move","test","--package-dir",e],o=this.parseNamedAddresses(t);return r.push(...this.prepareNamedAddresses(o)),a&&r.push(...a),this.runCommand(r)}async publish(s){let{packageDirectoryPath:e,namedAddresses:t,profile:a,extraArguments:r}=s,o=["aptos","move","publish","--package-dir",e,`--profile=${_nullishCoalesce(a, () => ("default"))}`],n=this.parseNamedAddresses(t);return o.push(...this.prepareNamedAddresses(n)),r&&o.push(...r),this.runCommand(o)}async createObjectAndPublishPackage(s){let{packageDirectoryPath:e,addressName:t,namedAddresses:a,profile:r,extraArguments:o}=s,n=["aptos","move","create-object-and-publish-package","--package-dir",e,"--address-name",t,`--profile=${_nullishCoalesce(r, () => ("default"))}`],i=this.parseNamedAddresses(a);n.push(...this.prepareNamedAddresses(i)),o&&n.push(...o);let g=await this.runCommand(n);return{objectAddress:this.extractAddressFromOutput(g.output)}}async upgradeObjectPackage(s){let{packageDirectoryPath:e,objectAddress:t,namedAddresses:a,profile:r,extraArguments:o}=s,n=["aptos","move","upgrade-object-package","--package-dir",e,"--object-address",t,`--profile=${_nullishCoalesce(r, () => ("default"))}`],i=this.parseNamedAddresses(a);return n.push(...this.prepareNamedAddresses(i)),o&&n.push(...o),this.runCommand(n)}async buildPublishPayload(s){let{outputFile:e,packageDirectoryPath:t,namedAddresses:a,extraArguments:r}=s,o=["aptos","move","build-publish-payload","--json-output-file",e,"--package-dir",t],n=this.parseNamedAddresses(a);return o.push(...this.prepareNamedAddresses(n)),r&&o.push(...r),this.runCommand(o)}async runScript(s){let{compiledScriptPath:e,profile:t,extraArguments:a}=s,r=["aptos","move","run-script","--compiled-script-path",e,`--profile=${_nullishCoalesce(t, () => ("default"))}`];return a&&r.push(...a),this.runCommand(r)}async runCommand(s){return new Promise((e,t)=>{let a=_os.platform.call(void 0, ),r,o="";a==="win32"?r=_child_process.spawn.call(void 0, "npx",s,{shell:!0}):r=_child_process.spawn.call(void 0, "npx",s),r.stdout.on("data",n=>{o+=n.toString()}),r.stdout.pipe(process.stdout),r.stderr.pipe(process.stderr),process.stdin.pipe(r.stdin),r.on("close",n=>{n===0?e({output:o}):t(new Error(`Child process exited with code ${n}`))})})}prepareNamedAddresses(s){let e=s.size,t=[];if(e===0)return t;t.push("--named-addresses");let a=[];return s.forEach((r,o)=>{let n=`${o}=${r.toString()}`;a.push(n)}),t.push(a.join(",")),t}parseNamedAddresses(s){let e=new Map;return Object.keys(s).forEach(t=>{let a=s[t];e.set(t,a)}),e}extractAddressFromOutput(s){let e=s.match("Code was successfully deployed to object address (0x[0-9a-fA-F]+)");if(e)return e[1];throw new Error("Failed to extract object address from output")}};exports.LocalNode = p; exports.Move = m;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }var _chunk7IYTZDXVjs = require('../chunk-7IYTZDXV.js');var _child_process = require('child_process');var _treekill = require('tree-kill'); var _treekill2 = _interopRequireDefault(_treekill);var _os = require('os');var u=class{constructor(s){this.MAXIMUM_WAIT_TIME_SEC=75;this.READINESS_ENDPOINT="http://127.0.0.1:8070/";this.showStdout=!0;this.process=null;this.showStdout=_nullishCoalesce(_optionalChain([s, 'optionalAccess', _ => _.showStdout]), () => (!0))}async stop(){await new Promise((s,r)=>{_optionalChain([this, 'access', _2 => _2.process, 'optionalAccess', _3 => _3.pid])&&_treekill2.default.call(void 0, this.process.pid,e=>{e?r(e):s(!0)})})}async run(){await this.checkIfProcessIsUp()||(this.start(),await this.waitUntilProcessIsUp())}start(){let s="npx",r=["aptos","node","run-localnet","--force-restart","--assume-yes","--with-indexer-api"],e=_os.platform.call(void 0, ),o;e==="win32"?o=_child_process.spawn.call(void 0, s,r,{shell:!0}):o=_child_process.spawn.call(void 0, s,r),this.process=o,_optionalChain([o, 'access', _4 => _4.stderr, 'optionalAccess', _5 => _5.on, 'call', _6 => _6("data",a=>{let t=a.toString();console.log(t)})]),_optionalChain([o, 'access', _7 => _7.stdout, 'optionalAccess', _8 => _8.on, 'call', _9 => _9("data",a=>{let t=a.toString();this.showStdout&&console.log(t)})])}async waitUntilProcessIsUp(){let s=await this.checkIfProcessIsUp(),r=Date.now()/1e3,e=r;for(;!s&&r+this.MAXIMUM_WAIT_TIME_SEC>e;)await _chunk7IYTZDXVjs.b.call(void 0, 1e3),s=await this.checkIfProcessIsUp(),e=Date.now()/1e3;if(!s)throw new Error("Process failed to start");return!0}async checkIfProcessIsUp(){try{return(await fetch(this.READINESS_ENDPOINT)).status===200}catch (e2){return!1}}};var l=class{async init(s){let{network:r,profile:e,extraArguments:o,showStdout:a}=s,t=["aptos","init",`--network=${_nullishCoalesce(r, () => ("local"))}`,`--profile=${_nullishCoalesce(e, () => ("default"))}`];return o&&t.push(...o),this.runCommand(t,a)}async compile(s){let{packageDirectoryPath:r,namedAddresses:e,extraArguments:o,showStdout:a}=s,t=["aptos","move","compile","--package-dir",r],n=this.parseNamedAddresses(e);return t.push(...this.prepareNamedAddresses(n)),o&&t.push(...o),this.runCommand(t,a)}async test(s){let{packageDirectoryPath:r,namedAddresses:e,extraArguments:o,showStdout:a}=s,t=["aptos","move","test","--package-dir",r],n=this.parseNamedAddresses(e);return t.push(...this.prepareNamedAddresses(n)),o&&t.push(...o),this.runCommand(t,a)}async publish(s){let{packageDirectoryPath:r,namedAddresses:e,profile:o,extraArguments:a,showStdout:t}=s,n=["aptos","move","publish","--package-dir",r,`--profile=${_nullishCoalesce(o, () => ("default"))}`],i=this.parseNamedAddresses(e);return n.push(...this.prepareNamedAddresses(i)),a&&n.push(...a),this.runCommand(n,t)}async createObjectAndPublishPackage(s){let{packageDirectoryPath:r,addressName:e,namedAddresses:o,profile:a,extraArguments:t,showStdout:n}=s,i=["aptos","move","create-object-and-publish-package","--package-dir",r,"--address-name",e,`--profile=${_nullishCoalesce(a, () => ("default"))}`],d=this.parseNamedAddresses(o);i.push(...this.prepareNamedAddresses(d)),t&&i.push(...t);let g=await this.runCommand(i,n);return{objectAddress:this.extractAddressFromOutput(g.output)}}async upgradeObjectPackage(s){let{packageDirectoryPath:r,objectAddress:e,namedAddresses:o,profile:a,extraArguments:t,showStdout:n}=s,i=["aptos","move","upgrade-object-package","--package-dir",r,"--object-address",e,`--profile=${_nullishCoalesce(a, () => ("default"))}`],d=this.parseNamedAddresses(o);return i.push(...this.prepareNamedAddresses(d)),t&&i.push(...t),this.runCommand(i,n)}async buildPublishPayload(s){let{outputFile:r,packageDirectoryPath:e,namedAddresses:o,extraArguments:a,showStdout:t}=s,n=["aptos","move","build-publish-payload","--json-output-file",r,"--package-dir",e],i=this.parseNamedAddresses(o);return n.push(...this.prepareNamedAddresses(i)),a&&n.push(...a),this.runCommand(n,t)}async runScript(s){let{compiledScriptPath:r,profile:e,extraArguments:o,showStdout:a}=s,t=["aptos","move","run-script","--compiled-script-path",r,`--profile=${_nullishCoalesce(e, () => ("default"))}`];return o&&t.push(...o),this.runCommand(t,a)}async runCommand(s,r=!0){return new Promise((e,o)=>{let a=_os.platform.call(void 0, ),t,n="";a==="win32"?t=_child_process.spawn.call(void 0, "npx",s,{shell:!0}):t=_child_process.spawn.call(void 0, "npx",s),t.stdout.on("data",i=>{n+=i.toString()}),r&&(t.stdout.pipe(process.stdout),t.stderr.pipe(process.stderr),process.stdin.pipe(t.stdin)),t.on("close",i=>{i===0?e({output:n}):o(new Error(`Child process exited with code ${i}`))})})}prepareNamedAddresses(s){let r=s.size,e=[];if(r===0)return e;e.push("--named-addresses");let o=[];return s.forEach((a,t)=>{let n=`${t}=${a.toString()}`;o.push(n)}),e.push(o.join(",")),e}parseNamedAddresses(s){let r=new Map;return Object.keys(s).forEach(e=>{let o=s[e];r.set(e,o)}),r}extractAddressFromOutput(s){let r=s.match("Code was successfully deployed to object address (0x[0-9a-fA-F]+)");if(r)return r[1];throw new Error("Failed to extract object address from output")}};exports.LocalNode = u; exports.Move = l;
2
2
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/cli/localNode.ts","../../../src/cli/move.ts"],"names":["spawn","kill","platform","LocalNode","resolve","reject","err","cliCommand","cliArgs","currentPlatform","childProcess","data","str","operational","start","last","sleep","Move","args","network","profile","extraArguments","packageDirectoryPath","namedAddresses","addressesMap","addressName","result","objectAddress","outputFile","compiledScriptPath","stdout","code","totalNames","newArgs","names","value","key","toAppend","address","output","match"],"mappings":"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","sourcesContent":["import { ChildProcessWithoutNullStreams, spawn } from \"child_process\";\nimport kill from \"tree-kill\";\nimport { platform } from \"os\";\n\nimport { sleep } from \"../utils/helpers\";\n\nexport class LocalNode {\n readonly MAXIMUM_WAIT_TIME_SEC = 75;\n\n readonly READINESS_ENDPOINT = \"http://127.0.0.1:8070/\";\n\n process: ChildProcessWithoutNullStreams | null = null;\n\n /**\n * kills all the descendent processes\n * of the node process, including the node process itself\n */\n async stop() {\n await new Promise((resolve, reject) => {\n if (!this.process?.pid) return;\n kill(this.process.pid, (err) => {\n if (err) {\n reject(err);\n } else {\n resolve(true);\n }\n });\n });\n }\n\n /**\n * Runs a local testnet and waits for process to be up.\n *\n * If local node process is already up it returns and does\n * not start the process\n */\n async run() {\n const nodeIsUp = await this.checkIfProcessIsUp();\n if (nodeIsUp) {\n return;\n }\n this.start();\n await this.waitUntilProcessIsUp();\n }\n\n /**\n * Starts the local testnet by running the aptos node run-local-testnet command\n */\n start() {\n const cliCommand = \"npx\";\n const cliArgs = [\"aptos\", \"node\", \"run-localnet\", \"--force-restart\", \"--assume-yes\", \"--with-indexer-api\"];\n\n const currentPlatform = platform();\n let childProcess;\n // Check if current OS is windows\n if (currentPlatform === \"win32\") {\n childProcess = spawn(cliCommand, cliArgs, { shell: true });\n } else {\n childProcess = spawn(cliCommand, cliArgs);\n }\n\n this.process = childProcess;\n\n childProcess.stderr?.on(\"data\", (data: any) => {\n const str = data.toString();\n // Print local node output log\n // eslint-disable-next-line no-console\n console.log(str);\n });\n\n childProcess.stdout?.on(\"data\", (data: any) => {\n const str = data.toString();\n // Print local node output log\n // eslint-disable-next-line no-console\n console.log(str);\n });\n }\n\n /**\n * Waits for the local testnet process to be up\n *\n * @returns Promise<boolean>\n */\n async waitUntilProcessIsUp(): Promise<boolean> {\n let operational = await this.checkIfProcessIsUp();\n const start = Date.now() / 1000;\n let last = start;\n\n while (!operational && start + this.MAXIMUM_WAIT_TIME_SEC > last) {\n // eslint-disable-next-line no-await-in-loop\n await sleep(1000);\n // eslint-disable-next-line no-await-in-loop\n operational = await this.checkIfProcessIsUp();\n last = Date.now() / 1000;\n }\n\n // If we are here it means something blocks the process to start.\n // Might worth checking if another process is running on port 8080\n if (!operational) {\n throw new Error(\"Process failed to start\");\n }\n\n return true;\n }\n\n /**\n * Checks if the local testnet is up\n *\n * @returns Promise<boolean>\n */\n async checkIfProcessIsUp(): Promise<boolean> {\n try {\n // Query readiness endpoint\n const data = await fetch(this.READINESS_ENDPOINT);\n if (data.status === 200) {\n return true;\n }\n return false;\n } catch (err: any) {\n return false;\n }\n }\n}\n","import { spawn } from \"child_process\";\nimport { platform } from \"os\";\n\nimport { AccountAddress } from \"../core\";\nimport { Network } from \"../utils\";\n\nexport class Move {\n /**\n * Function to initialize current directory for Aptos\n *\n * Configuration will be pushed into .aptos/config.yaml\n * @param args.network optional Network type argument to use for default settings, default is local\n * @param args.profile optional Profile to use from the config file, default is 'default'\n * This will be used to override associated settings such as the REST URL, the Faucet URL, and the private key arguments.\n * @param args.extraArguments (optional) Any extra arguments to include in the form of an array of strings\n * @example\n * [\"--assume-yes\",\"--gas-unit-price=10\"]\n *\n * @returns stdout\n */\n async init(args: {\n network?: Network;\n profile?: string;\n extraArguments?: Array<string>;\n }): Promise<{ output: string }> {\n const { network, profile, extraArguments } = args;\n const cliArgs = [\"aptos\", \"init\", `--network=${network ?? \"local\"}`, `--profile=${profile ?? \"default\"}`];\n\n if (extraArguments) {\n cliArgs.push(...extraArguments);\n }\n\n return this.runCommand(cliArgs);\n }\n\n /**\n * Function to compile a package\n *\n * @param args.packageDirectoryPath Path to a move package (the folder with a Move.toml file)\n * @param args.namedAddresses Named addresses for the move binary\n * @param args.extraArguments (optional) Any extra arguments to include in the form of an array of strings\n * @example\n * [\"--assume-yes\",\"--gas-unit-price=10\"]\n * @example\n * {\n * alice:0x1234, bob:0x5678\n * }\n *\n * @returns stdout\n */\n async compile(args: {\n packageDirectoryPath: string;\n namedAddresses: Record<string, AccountAddress>;\n extraArguments?: Array<string>;\n }): Promise<{ output: string }> {\n const { packageDirectoryPath, namedAddresses, extraArguments } = args;\n const cliArgs = [\"aptos\", \"move\", \"compile\", \"--package-dir\", packageDirectoryPath];\n\n const addressesMap = this.parseNamedAddresses(namedAddresses);\n\n cliArgs.push(...this.prepareNamedAddresses(addressesMap));\n\n if (extraArguments) {\n cliArgs.push(...extraArguments);\n }\n\n return this.runCommand(cliArgs);\n }\n\n /**\n * Function to run Move unit tests for a package\n *\n * @param args.packageDirectoryPath Path to a move package (the folder with a Move.toml file)\n * @param args.namedAddresses Named addresses for the move binary\n * @example\n * {\n * alice:0x1234, bob:0x5678\n * }\n * @param args.extraArguments (optional) Any extra arguments to include in the form of an array of strings\n * @example\n * [\"--assume-yes\",\"--gas-unit-price=10\"]\n *\n * @returns stdout\n */\n async test(args: {\n packageDirectoryPath: string;\n namedAddresses: Record<string, AccountAddress>;\n extraArguments?: Array<string>;\n }): Promise<{ output: string }> {\n const { packageDirectoryPath, namedAddresses, extraArguments } = args;\n const cliArgs = [\"aptos\", \"move\", \"test\", \"--package-dir\", packageDirectoryPath];\n\n const addressesMap = this.parseNamedAddresses(namedAddresses);\n\n cliArgs.push(...this.prepareNamedAddresses(addressesMap));\n\n if (extraArguments) {\n cliArgs.push(...extraArguments);\n }\n\n return this.runCommand(cliArgs);\n }\n\n /**\n * Function to publish the modules to the publisher account on the Aptos blockchain\n *\n * @param args.packageDirectoryPath Path to a move package (the folder with a Move.toml file)\n * @param args.namedAddresses Named addresses for the move binary\n * @example\n * {\n * alice:0x1234, bob:0x5678\n * }\n * @param args.profile optional Profile to use from the config file.\n * @param args.extraArguments (optional) Any extra arguments to include in the form of an array of strings\n * @example\n * [\"--assume-yes\",\"--gas-unit-price=10\"]\n *\n * @returns stdout\n */\n async publish(args: {\n packageDirectoryPath: string;\n namedAddresses: Record<string, AccountAddress>;\n profile?: string;\n extraArguments?: Array<string>;\n }): Promise<{ output: string }> {\n const { packageDirectoryPath, namedAddresses, profile, extraArguments } = args;\n const cliArgs = [\n \"aptos\",\n \"move\",\n \"publish\",\n \"--package-dir\",\n packageDirectoryPath,\n `--profile=${profile ?? \"default\"}`,\n ];\n\n const addressesMap = this.parseNamedAddresses(namedAddresses);\n\n cliArgs.push(...this.prepareNamedAddresses(addressesMap));\n\n if (extraArguments) {\n cliArgs.push(...extraArguments);\n }\n\n return this.runCommand(cliArgs);\n }\n\n /**\n * Function to create a new object and publish the Move package to it on the Aptos blockchain\n *\n * @param args.packageDirectoryPath Path to a move package (the folder with a Move.toml file)\n * @param args.addressName Address name for the Move package\n * @example\n * MoonCoin, please find the actual address name in Move.toml\n * @param args.namedAddresses Named addresses for the move binary\n * @example\n * {\n * alice:0x1234, bob:0x5678\n * }\n * @param args.profile optional Profile to use from the config file.\n * @param args.extraArguments (optional) Any extra arguments to include in the form of an array of strings\n * @example\n * [\"--assume-yes\",\"--gas-unit-price=10\"]\n *\n * A complete example in cli\n * aptos move create-object-and-publish-package \\\n * --package-dir path_to_directory_that_has_move.toml \\\n * --address-name launchpad_addr \\\n * --named-addresses \"launchpad_addr=0x123,initial_creator_addr=0x456\"\\\n * --profile my_profile \\\n * --assume-yes\n * @returns object address\n */\n async createObjectAndPublishPackage(args: {\n packageDirectoryPath: string;\n addressName: string;\n namedAddresses: Record<string, AccountAddress>;\n profile?: string;\n extraArguments?: Array<string>;\n }): Promise<{ objectAddress: string }> {\n const { packageDirectoryPath, addressName, namedAddresses, profile, extraArguments } = args;\n const cliArgs = [\n \"aptos\",\n \"move\",\n \"create-object-and-publish-package\",\n \"--package-dir\",\n packageDirectoryPath,\n \"--address-name\",\n addressName,\n `--profile=${profile ?? \"default\"}`,\n ];\n\n const addressesMap = this.parseNamedAddresses(namedAddresses);\n\n cliArgs.push(...this.prepareNamedAddresses(addressesMap));\n\n if (extraArguments) {\n cliArgs.push(...extraArguments);\n }\n\n const result = await this.runCommand(cliArgs);\n return { objectAddress: this.extractAddressFromOutput(result.output) };\n }\n\n /**\n * Function to upgrade a Move package previously published to an object on the Aptos blockchain\n * Caller must be the object owner to call this function\n *\n * @param args.packageDirectoryPath Path to a move package (the folder with a Move.toml file)\n * @param args.objectAddress Address of the object that the Move package published to\n * @example\n * 0x1000\n * @param args.namedAddresses Named addresses for the move binary\n * @example\n * {\n * alice:0x1234, bob:0x5678\n * }\n * @param args.profile optional Profile to use from the config file.\n * @param args.extraArguments (optional) Any extra arguments to include in the form of an array of strings\n * @example\n * [\"--assume-yes\",\"--gas-unit-price=10\"]\n *\n * @returns stdout\n */\n async upgradeObjectPackage(args: {\n packageDirectoryPath: string;\n objectAddress: string;\n namedAddresses: Record<string, AccountAddress>;\n profile?: string;\n extraArguments?: Array<string>;\n }): Promise<{ output: string }> {\n const { packageDirectoryPath, objectAddress, namedAddresses, profile, extraArguments } = args;\n const cliArgs = [\n \"aptos\",\n \"move\",\n \"upgrade-object-package\",\n \"--package-dir\",\n packageDirectoryPath,\n \"--object-address\",\n objectAddress,\n `--profile=${profile ?? \"default\"}`,\n ];\n\n const addressesMap = this.parseNamedAddresses(namedAddresses);\n\n cliArgs.push(...this.prepareNamedAddresses(addressesMap));\n\n if (extraArguments) {\n cliArgs.push(...extraArguments);\n }\n\n return this.runCommand(cliArgs);\n }\n\n /**\n * Build a publication transaction payload and store it in a JSON output file\n *\n * @param args.packageDirectoryPath Path to a move package (the folder with a Move.toml file)\n * @param args.outputFile Output file to write publication transaction to\n * @param args.namedAddresses Named addresses for the move binary\n * @example\n * {\n * alice:0x1234, bob:0x5678\n * }\n * @param args.extraArguments (optional) Any extra arguments to include in the form of an array of strings\n * @example\n * [\"--assume-yes\",\"--gas-unit-price=10\"]\n *\n * @returns stdout\n */\n async buildPublishPayload(args: {\n packageDirectoryPath: string;\n outputFile: string;\n namedAddresses: Record<string, AccountAddress>;\n extraArguments?: Array<string>;\n }) {\n const { outputFile, packageDirectoryPath, namedAddresses, extraArguments } = args;\n const cliArgs = [\n \"aptos\",\n \"move\",\n \"build-publish-payload\",\n \"--json-output-file\",\n outputFile,\n \"--package-dir\",\n packageDirectoryPath,\n ];\n\n const addressesMap = this.parseNamedAddresses(namedAddresses);\n\n cliArgs.push(...this.prepareNamedAddresses(addressesMap));\n\n if (extraArguments) {\n cliArgs.push(...extraArguments);\n }\n\n return this.runCommand(cliArgs);\n }\n\n /**\n * Function to run a Move script, please run compile before running this\n *\n * @param args.compiledScriptPath Path to a compiled Move script bytecode file\n * @param args.namedAddresses Named addresses for the move binary\n * @example\n * build/my_package/bytecode_scripts/my_move_script.mv\n * @param args.profile optional Profile to use from the config file.\n * @param args.extraArguments (optional) Any extra arguments to include in the form of an array of strings\n * @example\n * [\"--assume-yes\",\"--gas-unit-price=10\"]\n *\n * @returns stdout\n */\n async runScript(args: {\n compiledScriptPath: string;\n profile?: string;\n extraArguments?: Array<string>;\n }): Promise<{ output: string }> {\n const { compiledScriptPath, profile, extraArguments } = args;\n const cliArgs = [\n \"aptos\",\n \"move\",\n \"run-script\",\n \"--compiled-script-path\",\n compiledScriptPath,\n `--profile=${profile ?? \"default\"}`,\n ];\n\n if (extraArguments) {\n cliArgs.push(...extraArguments);\n }\n\n return this.runCommand(cliArgs);\n }\n\n /**\n * Run a move command\n *\n * @param args\n * @returns stdout\n */\n // eslint-disable-next-line class-methods-use-this\n private async runCommand(args: Array<string>): Promise<{ output: string }> {\n return new Promise((resolve, reject) => {\n const currentPlatform = platform();\n let childProcess;\n let stdout = \"\";\n\n // Check if current OS is windows\n if (currentPlatform === \"win32\") {\n childProcess = spawn(\"npx\", args, { shell: true });\n } else {\n childProcess = spawn(\"npx\", args);\n }\n\n childProcess.stdout.on(\"data\", (data) => {\n stdout += data.toString();\n });\n\n childProcess.stdout.pipe(process.stdout);\n childProcess.stderr.pipe(process.stderr);\n process.stdin.pipe(childProcess.stdin);\n\n childProcess.on(\"close\", (code) => {\n if (code === 0) {\n resolve({ output: stdout }); // Resolve with stdout if the child process exits successfully\n } else {\n reject(new Error(`Child process exited with code ${code}`)); // Reject with an error if the child process exits with an error code\n }\n });\n });\n }\n\n /**\n * Convert named addresses from a Map into an array seperated by a comma\n *\n * @example\n * input: {'alice' => '0x123', 'bob' => '0x456'}\n * output: \"alice=0x123,bob=0x456\"\n *\n * @param namedAddresses\n * @returns An array of names addresses seperated by a comma\n */\n // eslint-disable-next-line class-methods-use-this\n private prepareNamedAddresses(namedAddresses: Map<string, AccountAddress>): Array<string> {\n const totalNames = namedAddresses.size;\n const newArgs: Array<string> = [];\n\n if (totalNames === 0) {\n return newArgs;\n }\n\n newArgs.push(\"--named-addresses\");\n\n const names: Array<string> = [];\n namedAddresses.forEach((value, key) => {\n const toAppend = `${key}=${value.toString()}`;\n names.push(toAppend);\n });\n newArgs.push(names.join(\",\"));\n return newArgs;\n }\n\n /**\n * Parse named addresses from a Record type into a Map\n *\n * @param namedAddresses\n * @returns Map<name,address>\n */\n // eslint-disable-next-line class-methods-use-this\n private parseNamedAddresses(namedAddresses: Record<string, AccountAddress>): Map<string, AccountAddress> {\n const addressesMap = new Map();\n\n Object.keys(namedAddresses).forEach((key) => {\n const address = namedAddresses[key];\n addressesMap.set(key, address);\n });\n\n return addressesMap;\n }\n\n /**\n * Extract object address from the output\n *\n * @param output\n * @returns object address\n */\n // eslint-disable-next-line class-methods-use-this\n private extractAddressFromOutput(output: string): string {\n const match = output.match(\"Code was successfully deployed to object address (0x[0-9a-fA-F]+)\");\n if (match) {\n return match[1];\n }\n throw new Error(\"Failed to extract object address from output\");\n }\n}\n"]}
1
+ {"version":3,"sources":["/Users/maayansavir/work/aptos-ts-sdk/dist/common/cli/index.js","../../../src/cli/localNode.ts","../../../src/cli/move.ts"],"names":["LocalNode","args","resolve","reject","kill","err","cliCommand","cliArgs","currentPlatform","platform","childProcess","spawn","data","str","operational","start","last","sleep","Move","network","profile","extraArguments","showStdout"],"mappings":"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","file":"/Users/maayansavir/work/aptos-ts-sdk/dist/common/cli/index.js","sourcesContent":[null,"/* eslint-disable no-console */\n\nimport { ChildProcessWithoutNullStreams, spawn } from \"child_process\";\nimport kill from \"tree-kill\";\nimport { platform } from \"os\";\n\nimport { sleep } from \"../utils/helpers\";\n\n/**\n * Represents a local node for running a testnet environment.\n * This class provides methods to start, stop, and check the status of the local testnet process.\n * It manages the lifecycle of the node process and ensures that it is operational before executing tests.\n */\nexport class LocalNode {\n readonly MAXIMUM_WAIT_TIME_SEC = 75;\n\n readonly READINESS_ENDPOINT = \"http://127.0.0.1:8070/\";\n\n showStdout: boolean = true;\n\n process: ChildProcessWithoutNullStreams | null = null;\n\n constructor(args?: { showStdout?: boolean }) {\n this.showStdout = args?.showStdout ?? true;\n }\n\n /**\n * Kills the current process and all its descendant processes.\n *\n * @returns {Promise<void>} A promise that resolves to true if the process was successfully killed.\n * @throws {Error} If there is an error while attempting to kill the process.\n */\n async stop(): Promise<void> {\n await new Promise((resolve, reject) => {\n if (!this.process?.pid) return;\n\n /**\n * Terminates the process associated with the given process ID.\n *\n * @param pid - The process ID of the process to be terminated.\n * @param callback - A function that is called after the termination attempt is complete.\n * @param callback.err - An error object if the termination failed; otherwise, null.\n * @param callback.resolve - A boolean indicating whether the termination was successful.\n */\n kill(this.process.pid, (err) => {\n if (err) {\n reject(err);\n } else {\n resolve(true);\n }\n });\n });\n }\n\n /**\n * Runs a local testnet and waits for the process to be up.\n * If the local node process is already running, it returns without starting the process.\n *\n * @returns {Promise<void>} A promise that resolves when the process is up.\n */\n async run(): Promise<void> {\n const nodeIsUp = await this.checkIfProcessIsUp();\n if (nodeIsUp) {\n return;\n }\n this.start();\n await this.waitUntilProcessIsUp();\n }\n\n /**\n * Starts the local testnet by running the Aptos node with the specified command-line arguments.\n *\n * @returns {void}\n *\n * @throws {Error} If there is an issue starting the local testnet.\n */\n start(): void {\n const cliCommand = \"npx\";\n const cliArgs = [\"aptos\", \"node\", \"run-localnet\", \"--force-restart\", \"--assume-yes\", \"--with-indexer-api\"];\n\n const currentPlatform = platform();\n let childProcess;\n // Check if current OS is windows\n if (currentPlatform === \"win32\") {\n childProcess = spawn(cliCommand, cliArgs, { shell: true });\n } else {\n childProcess = spawn(cliCommand, cliArgs);\n }\n\n this.process = childProcess;\n\n childProcess.stderr?.on(\"data\", (data: any) => {\n const str = data.toString();\n // Print local node output error log\n console.log(str);\n });\n\n childProcess.stdout?.on(\"data\", (data: any) => {\n const str = data.toString();\n // Print local node output log\n if (this.showStdout) {\n console.log(str);\n }\n });\n }\n\n /**\n * Waits for the local testnet process to be operational within a specified maximum wait time.\n * This function continuously checks if the process is up and will throw an error if it fails to start.\n *\n * @returns Promise<boolean> - Resolves to true if the process is up, otherwise throws an error.\n */\n async waitUntilProcessIsUp(): Promise<boolean> {\n let operational = await this.checkIfProcessIsUp();\n const start = Date.now() / 1000;\n let last = start;\n\n while (!operational && start + this.MAXIMUM_WAIT_TIME_SEC > last) {\n // eslint-disable-next-line no-await-in-loop\n await sleep(1000);\n // eslint-disable-next-line no-await-in-loop\n operational = await this.checkIfProcessIsUp();\n last = Date.now() / 1000;\n }\n\n // If we are here it means something blocks the process to start.\n // Might worth checking if another process is running on port 8080\n if (!operational) {\n throw new Error(\"Process failed to start\");\n }\n\n return true;\n }\n\n /**\n * Checks if the local testnet is up by querying the readiness endpoint.\n *\n * @returns Promise<boolean> - A promise that resolves to true if the testnet is up, otherwise false.\n */\n async checkIfProcessIsUp(): Promise<boolean> {\n try {\n // Query readiness endpoint\n const data = await fetch(this.READINESS_ENDPOINT);\n if (data.status === 200) {\n return true;\n }\n return false;\n } catch (err: any) {\n return false;\n }\n }\n}\n","import { spawn } from \"child_process\";\nimport { platform } from \"os\";\n\nimport { AccountAddress } from \"../core\";\nimport { Network } from \"../utils\";\n\n/**\n * Class representing a Move package management utility for the Aptos blockchain.\n * This class provides methods to initialize directories, compile packages, run tests, publish modules, create objects, upgrade\n * packages, build transaction payloads, and run scripts.\n */\nexport class Move {\n /**\n * Initialize the current directory for Aptos by configuring the necessary settings.\n * Configuration will be pushed into .aptos/config.yaml.\n *\n * @param args - The arguments for initialization.\n * @param args.network - Optional Network type argument to use for default settings; defaults to local.\n * @param args.profile - Optional Profile to use from the config file; defaults to 'default'. This will override associated\n * settings such as the REST URL, the Faucet URL, and the private key arguments.\n * @param args.extraArguments - Optional extra arguments to include in the form of an array of strings.\n * Ex. [\"--assume-yes\",\"--gas-unit-price=10\"]\n * @returns stdout\n */\n async init(args: {\n network?: Network;\n profile?: string;\n extraArguments?: Array<string>;\n showStdout?: boolean;\n }): Promise<{ output: string }> {\n const { network, profile, extraArguments, showStdout } = args;\n const cliArgs = [\"aptos\", \"init\", `--network=${network ?? \"local\"}`, `--profile=${profile ?? \"default\"}`];\n\n if (extraArguments) {\n cliArgs.push(...extraArguments);\n }\n\n return this.runCommand(cliArgs, showStdout);\n }\n\n /**\n * Compile a Move package located at the specified directory path.\n * This function helps in preparing the Move package for deployment or further processing.\n *\n * @param args - The arguments for compiling the package.\n * @param args.packageDirectoryPath - Path to a Move package (the folder with a Move.toml file).\n * @param args.namedAddresses - Named addresses for the move binary. Ex. { alice: 0x1234, bob: 0x5678 }\n * @param args.extraArguments - Optional extra arguments to include in the form of an array of strings.\n * Ex. [\"--assume-yes\",\"--gas-unit-price=10\"]\n * @returns stdout\n */\n async compile(args: {\n packageDirectoryPath: string;\n namedAddresses: Record<string, AccountAddress>;\n extraArguments?: Array<string>;\n showStdout?: boolean;\n }): Promise<{ output: string }> {\n const { packageDirectoryPath, namedAddresses, extraArguments, showStdout } = args;\n const cliArgs = [\"aptos\", \"move\", \"compile\", \"--package-dir\", packageDirectoryPath];\n\n const addressesMap = this.parseNamedAddresses(namedAddresses);\n\n cliArgs.push(...this.prepareNamedAddresses(addressesMap));\n\n if (extraArguments) {\n cliArgs.push(...extraArguments);\n }\n\n return this.runCommand(cliArgs, showStdout);\n }\n\n /**\n * Run Move unit tests for a specified package.\n *\n * @param args - The arguments for running the tests.\n * @param args.packageDirectoryPath - The path to a Move package (the folder containing a Move.toml file).\n * @param args.namedAddresses - Named addresses for the move binary. Ex. { alice: 0x1234, bob: 0x5678 }\n * @param args.extraArguments - Optional extra arguments to include in the form of an array of strings.\n * Ex. [\"--assume-yes\",\"--gas-unit-price=10\"]\n * @returns The stdout output from running the tests.\n */\n async test(args: {\n packageDirectoryPath: string;\n namedAddresses: Record<string, AccountAddress>;\n extraArguments?: Array<string>;\n showStdout?: boolean;\n }): Promise<{ output: string }> {\n const { packageDirectoryPath, namedAddresses, extraArguments, showStdout } = args;\n const cliArgs = [\"aptos\", \"move\", \"test\", \"--package-dir\", packageDirectoryPath];\n\n const addressesMap = this.parseNamedAddresses(namedAddresses);\n\n cliArgs.push(...this.prepareNamedAddresses(addressesMap));\n\n if (extraArguments) {\n cliArgs.push(...extraArguments);\n }\n\n return this.runCommand(cliArgs, showStdout);\n }\n\n /**\n * Publishes the modules to the publisher account on the Aptos blockchain.\n *\n * @param args - The arguments for publishing the modules.\n * @param args.packageDirectoryPath - The path to a move package (the folder with a Move.toml file).\n * @param args.namedAddresses - Named addresses for the move binary. Ex. { alice: 0x1234, bob: 0x5678 }\n * @param args.profile - Optional profile to use from the config file.\n * @param args.extraArguments - Optional extra arguments to include in the form of an array of strings.\n * Ex. [\"--assume-yes\",\"--gas-unit-price=10\"]\n * @returns stdout\n */\n async publish(args: {\n packageDirectoryPath: string;\n namedAddresses: Record<string, AccountAddress>;\n profile?: string;\n extraArguments?: Array<string>;\n showStdout?: boolean;\n }): Promise<{ output: string }> {\n const { packageDirectoryPath, namedAddresses, profile, extraArguments, showStdout } = args;\n const cliArgs = [\n \"aptos\",\n \"move\",\n \"publish\",\n \"--package-dir\",\n packageDirectoryPath,\n `--profile=${profile ?? \"default\"}`,\n ];\n\n const addressesMap = this.parseNamedAddresses(namedAddresses);\n\n cliArgs.push(...this.prepareNamedAddresses(addressesMap));\n\n if (extraArguments) {\n cliArgs.push(...extraArguments);\n }\n\n return this.runCommand(cliArgs, showStdout);\n }\n\n /**\n * Create a new object and publish the Move package to it on the Aptos blockchain.\n *\n * @param args - The arguments for creating the object and publishing the package.\n * @param args.packageDirectoryPath - Path to a Move package (the folder with a Move.toml file).\n * @param args.addressName - Address name for the Move package.\n * @param args.namedAddresses - Named addresses for the Move binary.\n * @param args.profile - Optional profile to use from the config file.\n * @param args.extraArguments - Optional extra arguments to include in the form of an array of strings.\n * Ex. [\"--assume-yes\",\"--gas-unit-price=10\"]\n * @returns The object address.\n *\n * A complete example in CLI:\n * aptos move create-object-and-publish-package \\\n * --package-dir path_to_directory_that_has_move.toml \\\n * --address-name launchpad_addr \\\n * --named-addresses \"launchpad_addr=0x123,initial_creator_addr=0x456\" \\\n * --profile my_profile \\\n * --assume-yes\n */\n async createObjectAndPublishPackage(args: {\n packageDirectoryPath: string;\n addressName: string;\n namedAddresses: Record<string, AccountAddress>;\n profile?: string;\n extraArguments?: Array<string>;\n showStdout?: boolean;\n }): Promise<{ objectAddress: string }> {\n const { packageDirectoryPath, addressName, namedAddresses, profile, extraArguments, showStdout } = args;\n const cliArgs = [\n \"aptos\",\n \"move\",\n \"create-object-and-publish-package\",\n \"--package-dir\",\n packageDirectoryPath,\n \"--address-name\",\n addressName,\n `--profile=${profile ?? \"default\"}`,\n ];\n\n const addressesMap = this.parseNamedAddresses(namedAddresses);\n\n cliArgs.push(...this.prepareNamedAddresses(addressesMap));\n\n if (extraArguments) {\n cliArgs.push(...extraArguments);\n }\n\n const result = await this.runCommand(cliArgs, showStdout);\n return { objectAddress: this.extractAddressFromOutput(result.output) };\n }\n\n /**\n * Upgrade a Move package previously published to an object on the Aptos blockchain.\n * The caller must be the object owner to execute this function.\n *\n * @param args - The arguments for upgrading the object package.\n * @param args.packageDirectoryPath - Path to a Move package (the folder with a Move.toml file).\n * @param args.objectAddress - Address of the object that the Move package published to. Ex. 0x1000\n * @param args.namedAddresses - Named addresses for the move binary. Ex. { alice: 0x1234, bob: 0x5678 }\n * @param args.profile - Optional profile to use from the config file.\n * @param args.extraArguments - Optional extra arguments to include in the form of an array of strings.\n * Ex. [\"--assume-yes\",\"--gas-unit-price=10\"]\n * @returns stdout\n */\n async upgradeObjectPackage(args: {\n packageDirectoryPath: string;\n objectAddress: string;\n namedAddresses: Record<string, AccountAddress>;\n profile?: string;\n extraArguments?: Array<string>;\n showStdout?: boolean;\n }): Promise<{ output: string }> {\n const { packageDirectoryPath, objectAddress, namedAddresses, profile, extraArguments, showStdout } = args;\n const cliArgs = [\n \"aptos\",\n \"move\",\n \"upgrade-object-package\",\n \"--package-dir\",\n packageDirectoryPath,\n \"--object-address\",\n objectAddress,\n `--profile=${profile ?? \"default\"}`,\n ];\n\n const addressesMap = this.parseNamedAddresses(namedAddresses);\n\n cliArgs.push(...this.prepareNamedAddresses(addressesMap));\n\n if (extraArguments) {\n cliArgs.push(...extraArguments);\n }\n\n return this.runCommand(cliArgs, showStdout);\n }\n\n /**\n * Build a publication transaction payload and store it in a JSON output file.\n *\n * @param args - The arguments for building the publishing payload.\n * @param args.packageDirectoryPath - Path to a move package (the folder with a Move.toml file).\n * @param args.outputFile - Output file to write the publication transaction to.\n * @param args.namedAddresses - Named addresses for the move binary. Ex. { alice: 0x1234, bob: 0x5678 }\n * @param args.extraArguments - Optional extra arguments to include in the form of an array of strings.\n * Ex. [\"--assume-yes\",\"--gas-unit-price=10\"] *\n * @returns stdout\n */\n async buildPublishPayload(args: {\n packageDirectoryPath: string;\n outputFile: string;\n namedAddresses: Record<string, AccountAddress>;\n extraArguments?: Array<string>;\n showStdout?: boolean;\n }): Promise<{ output: string }> {\n const { outputFile, packageDirectoryPath, namedAddresses, extraArguments, showStdout } = args;\n const cliArgs = [\n \"aptos\",\n \"move\",\n \"build-publish-payload\",\n \"--json-output-file\",\n outputFile,\n \"--package-dir\",\n packageDirectoryPath,\n ];\n\n const addressesMap = this.parseNamedAddresses(namedAddresses);\n\n cliArgs.push(...this.prepareNamedAddresses(addressesMap));\n\n if (extraArguments) {\n cliArgs.push(...extraArguments);\n }\n\n return this.runCommand(cliArgs, showStdout);\n }\n\n /**\n * Runs a Move script using the provided compiled script path and optional parameters. Ensure that the script is compiled\n * before executing this function.\n *\n * @param args - The arguments for running the script.\n * @param args.compiledScriptPath - Path to a compiled Move script bytecode file.\n * Ex. \"build/my_package/bytecode_scripts/my_move_script.mv\"\n * @param args.profile - Optional profile to use from the config file.\n * @param args.extraArguments - Optional extra arguments to include in the form of an array of strings.\n * Ex. [\"--assume-yes\",\"--gas-unit-price=10\"]\n *\n * @returns The standard output from running the script.\n */\n async runScript(args: {\n compiledScriptPath: string;\n profile?: string;\n extraArguments?: Array<string>;\n showStdout?: boolean;\n }): Promise<{ output: string }> {\n const { compiledScriptPath, profile, extraArguments, showStdout } = args;\n const cliArgs = [\n \"aptos\",\n \"move\",\n \"run-script\",\n \"--compiled-script-path\",\n compiledScriptPath,\n `--profile=${profile ?? \"default\"}`,\n ];\n\n if (extraArguments) {\n cliArgs.push(...extraArguments);\n }\n\n return this.runCommand(cliArgs, showStdout);\n }\n\n /**\n * Run a command with the specified arguments and return the output.\n *\n * @param args - An array of strings representing the command-line arguments to be passed to the command.\n * @param showStdout - Show the standard output generated by the command.\n * @returns The standard output generated by the command.\n */\n // eslint-disable-next-line class-methods-use-this\n private async runCommand(args: Array<string>, showStdout: boolean = true): Promise<{ output: string }> {\n return new Promise((resolve, reject) => {\n const currentPlatform = platform();\n let childProcess;\n let stdout = \"\";\n\n // Check if current OS is windows\n if (currentPlatform === \"win32\") {\n childProcess = spawn(\"npx\", args, { shell: true });\n } else {\n childProcess = spawn(\"npx\", args);\n }\n\n childProcess.stdout.on(\"data\", (data) => {\n stdout += data.toString();\n });\n\n if (showStdout) {\n childProcess.stdout.pipe(process.stdout);\n childProcess.stderr.pipe(process.stderr);\n process.stdin.pipe(childProcess.stdin);\n }\n\n childProcess.on(\"close\", (code) => {\n if (code === 0) {\n resolve({ output: stdout }); // Resolve with stdout if the child process exits successfully\n } else {\n reject(new Error(`Child process exited with code ${code}`)); // Reject with an error if the child process exits with an error code\n }\n });\n });\n }\n\n /**\n * Convert named addresses from a Map into an array separated by a comma.\n *\n * @param namedAddresses - A Map where the key is a string representing the name and the value is an AccountAddress.\n * Ex. {'alice' => '0x123', 'bob' => '0x456'}\n * @returns An array of named addresses formatted as strings separated by a comma. Ex. \"alice=0x123,bob=0x456\"\n */\n // eslint-disable-next-line class-methods-use-this\n private prepareNamedAddresses(namedAddresses: Map<string, AccountAddress>): Array<string> {\n const totalNames = namedAddresses.size;\n const newArgs: Array<string> = [];\n\n if (totalNames === 0) {\n return newArgs;\n }\n\n newArgs.push(\"--named-addresses\");\n\n const names: Array<string> = [];\n namedAddresses.forEach((value, key) => {\n const toAppend = `${key}=${value.toString()}`;\n names.push(toAppend);\n });\n newArgs.push(names.join(\",\"));\n return newArgs;\n }\n\n /**\n * Parse named addresses from a Record type into a Map.\n *\n * This function transforms a collection of named addresses into a more accessible format by mapping each name to its\n * corresponding address.\n *\n * @param namedAddresses - A record containing named addresses where the key is the name and the value is the AccountAddress.\n * @returns A Map where each key is a name and each value is the corresponding address.\n */\n // eslint-disable-next-line class-methods-use-this\n private parseNamedAddresses(namedAddresses: Record<string, AccountAddress>): Map<string, AccountAddress> {\n const addressesMap = new Map();\n\n Object.keys(namedAddresses).forEach((key) => {\n const address = namedAddresses[key];\n addressesMap.set(key, address);\n });\n\n return addressesMap;\n }\n\n /**\n * Extracts the object address from the provided output string.\n *\n * @param output - The output string containing the object address.\n * @returns The extracted object address.\n * @throws Error if the object address cannot be extracted from the output.\n */\n // eslint-disable-next-line class-methods-use-this\n private extractAddressFromOutput(output: string): string {\n const match = output.match(\"Code was successfully deployed to object address (0x[0-9a-fA-F]+)\");\n if (match) {\n return match[1];\n }\n throw new Error(\"Failed to extract object address from output\");\n }\n}\n"]}