@aptos-labs/ts-sdk 1.29.1 → 1.31.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 (691) 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 +5919 -1627
  9. package/dist/common/index.js +11 -9
  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 +448 -161
  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 +52 -15
  39. package/dist/esm/api/coin.mjs +1 -1
  40. package/dist/esm/api/digitalAsset.d.mts +710 -300
  41. package/dist/esm/api/digitalAsset.mjs +1 -1
  42. package/dist/esm/api/event.d.mts +129 -26
  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 +152 -49
  47. package/dist/esm/api/fungibleAsset.mjs +1 -1
  48. package/dist/esm/api/general.d.mts +171 -55
  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 +86 -14
  53. package/dist/esm/api/keyless.mjs +1 -1
  54. package/dist/esm/api/object.d.mts +51 -7
  55. package/dist/esm/api/object.mjs +1 -1
  56. package/dist/esm/api/staking.d.mts +86 -17
  57. package/dist/esm/api/staking.mjs +1 -1
  58. package/dist/esm/api/table.d.mts +118 -38
  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-22ZSW5EN.mjs +2 -0
  92. package/dist/esm/chunk-22ZSW5EN.mjs.map +1 -0
  93. package/dist/esm/{chunk-7V6DEA7G.mjs → chunk-2652SPOM.mjs} +2 -2
  94. package/dist/esm/chunk-2652SPOM.mjs.map +1 -0
  95. package/dist/esm/chunk-2CGJLPHP.mjs +2 -0
  96. package/dist/esm/{chunk-555I4YHP.mjs.map → chunk-2CGJLPHP.mjs.map} +1 -1
  97. package/dist/esm/{chunk-U6Z4FNB7.mjs → chunk-2CJC43CV.mjs} +1 -1
  98. package/dist/esm/chunk-2CJC43CV.mjs.map +1 -0
  99. package/dist/esm/{chunk-PUZ25PTD.mjs → chunk-2GEIHUHT.mjs} +2 -2
  100. package/dist/esm/chunk-2GEIHUHT.mjs.map +1 -0
  101. package/dist/esm/{chunk-FRGXKOU5.mjs → chunk-3H5DGQKX.mjs} +2 -2
  102. package/dist/esm/chunk-3H5DGQKX.mjs.map +1 -0
  103. package/dist/esm/chunk-4CDDWSKZ.mjs +2 -0
  104. package/dist/esm/chunk-4CDDWSKZ.mjs.map +1 -0
  105. package/dist/esm/{chunk-L5NY7TMI.mjs → chunk-4JXB6V5O.mjs} +2 -2
  106. package/dist/esm/chunk-4JXB6V5O.mjs.map +1 -0
  107. package/dist/esm/{chunk-5655UVIK.mjs → chunk-4LKLOUMG.mjs} +2 -2
  108. package/dist/esm/chunk-4LKLOUMG.mjs.map +1 -0
  109. package/dist/esm/chunk-4OV7QU2U.mjs +2 -0
  110. package/dist/esm/chunk-4OV7QU2U.mjs.map +1 -0
  111. package/dist/esm/chunk-4VU2ABLU.mjs +2 -0
  112. package/dist/esm/chunk-4VU2ABLU.mjs.map +1 -0
  113. package/dist/esm/{chunk-25NSCK4Q.mjs → chunk-4ZK3JNQT.mjs} +2 -2
  114. package/dist/esm/chunk-4ZK3JNQT.mjs.map +1 -0
  115. package/dist/esm/{chunk-SWHLSREF.mjs → chunk-5N6KJ7KS.mjs} +2 -2
  116. package/dist/esm/chunk-5N6KJ7KS.mjs.map +1 -0
  117. package/dist/esm/{chunk-WWZ3METZ.mjs → chunk-5S3Z7MT4.mjs} +2 -2
  118. package/dist/esm/chunk-5S3Z7MT4.mjs.map +1 -0
  119. package/dist/esm/{chunk-46D5QX3G.mjs → chunk-5SGSPCOY.mjs} +2 -2
  120. package/dist/esm/chunk-5SGSPCOY.mjs.map +1 -0
  121. package/dist/esm/chunk-6DMDYBV6.mjs +2 -0
  122. package/dist/esm/chunk-6DMDYBV6.mjs.map +1 -0
  123. package/dist/esm/chunk-6FLHGOKP.mjs +2 -0
  124. package/dist/esm/chunk-6FLHGOKP.mjs.map +1 -0
  125. package/dist/esm/{chunk-LG7RJQ57.mjs → chunk-6Q2O5G3J.mjs} +1 -1
  126. package/dist/esm/chunk-6Q2O5G3J.mjs.map +1 -0
  127. package/dist/esm/{chunk-BRFHAO2Y.mjs → chunk-73GCGRFW.mjs} +2 -2
  128. package/dist/esm/chunk-73GCGRFW.mjs.map +1 -0
  129. package/dist/esm/{chunk-XK3JFCP3.mjs → chunk-7JK7UG4E.mjs} +2 -2
  130. package/dist/esm/chunk-7JK7UG4E.mjs.map +1 -0
  131. package/dist/esm/{chunk-44GYWUSH.mjs → chunk-7XS45O6M.mjs} +1 -1
  132. package/dist/esm/chunk-7XS45O6M.mjs.map +1 -0
  133. package/dist/esm/{chunk-RNTXQYJQ.mjs → chunk-A2AEFKXS.mjs} +2 -2
  134. package/dist/esm/chunk-A2AEFKXS.mjs.map +1 -0
  135. package/dist/esm/{chunk-E37YRKWK.mjs → chunk-AGBA3Y7A.mjs} +2 -2
  136. package/dist/esm/chunk-AGBA3Y7A.mjs.map +1 -0
  137. package/dist/esm/chunk-AITN3DO4.mjs +2 -0
  138. package/dist/esm/chunk-AITN3DO4.mjs.map +1 -0
  139. package/dist/esm/{chunk-OY2IX7HW.mjs → chunk-AT2ZGTXQ.mjs} +2 -2
  140. package/dist/esm/chunk-AT2ZGTXQ.mjs.map +1 -0
  141. package/dist/esm/{chunk-TVFIUUVY.mjs → chunk-AZ6LVQEG.mjs} +2 -2
  142. package/dist/esm/chunk-AZ6LVQEG.mjs.map +1 -0
  143. package/dist/esm/chunk-BAGUHYFD.mjs +2 -0
  144. package/dist/esm/chunk-BAGUHYFD.mjs.map +1 -0
  145. package/dist/esm/{chunk-EWZ2M5BW.mjs → chunk-BG2TZI3H.mjs} +2 -2
  146. package/dist/esm/chunk-BG2TZI3H.mjs.map +1 -0
  147. package/dist/esm/chunk-BOWPP6YG.mjs +2 -0
  148. package/dist/esm/chunk-BOWPP6YG.mjs.map +1 -0
  149. package/dist/esm/{chunk-GFGX3QDP.mjs → chunk-BVVHGSWC.mjs} +2 -2
  150. package/dist/esm/chunk-BVVHGSWC.mjs.map +1 -0
  151. package/dist/esm/{chunk-BD6BJETG.mjs → chunk-CC7VOPYH.mjs} +2 -2
  152. package/dist/esm/chunk-CC7VOPYH.mjs.map +1 -0
  153. package/dist/esm/{chunk-K2O24YLZ.mjs → chunk-CDQGPCHU.mjs} +2 -2
  154. package/dist/esm/chunk-CDQGPCHU.mjs.map +1 -0
  155. package/dist/esm/{chunk-HSPBA2TZ.mjs → chunk-CL6EEMSL.mjs} +2 -2
  156. package/dist/esm/chunk-CL6EEMSL.mjs.map +1 -0
  157. package/dist/esm/{chunk-SCHZ67F3.mjs → chunk-D3OEQLUE.mjs} +1 -1
  158. package/dist/esm/{chunk-SCHZ67F3.mjs.map → chunk-D3OEQLUE.mjs.map} +1 -1
  159. package/dist/esm/{chunk-NNRAQP36.mjs → chunk-DMSHPWA5.mjs} +2 -2
  160. package/dist/esm/chunk-DMSHPWA5.mjs.map +1 -0
  161. package/dist/esm/{chunk-STGYDB5E.mjs → chunk-EE7GDBA5.mjs} +2 -2
  162. package/dist/esm/chunk-EE7GDBA5.mjs.map +1 -0
  163. package/dist/esm/{chunk-CPPBQDHB.mjs → chunk-EUGLLGYW.mjs} +2 -2
  164. package/dist/esm/chunk-EUGLLGYW.mjs.map +1 -0
  165. package/dist/esm/{chunk-CVDR5SJR.mjs → chunk-F2RY4YQ7.mjs} +2 -2
  166. package/dist/esm/chunk-F2RY4YQ7.mjs.map +1 -0
  167. package/dist/esm/chunk-FTZGP6XW.mjs +2 -0
  168. package/dist/esm/chunk-FTZGP6XW.mjs.map +1 -0
  169. package/dist/esm/{chunk-6RZZIOGH.mjs → chunk-GLATLXF6.mjs} +2 -2
  170. package/dist/esm/chunk-GLATLXF6.mjs.map +1 -0
  171. package/dist/esm/{chunk-SRPI2FFA.mjs → chunk-GMKKHGXK.mjs} +1 -1
  172. package/dist/esm/chunk-GMKKHGXK.mjs.map +1 -0
  173. package/dist/esm/{chunk-TDGQGILY.mjs → chunk-GQABU3RQ.mjs} +1 -1
  174. package/dist/esm/chunk-GQABU3RQ.mjs.map +1 -0
  175. package/dist/esm/{chunk-AH44UPM4.mjs → chunk-HBIDHQ2M.mjs} +1 -1
  176. package/dist/esm/chunk-HBIDHQ2M.mjs.map +1 -0
  177. package/dist/esm/chunk-HM5HITUC.mjs +4 -0
  178. package/dist/esm/chunk-HM5HITUC.mjs.map +1 -0
  179. package/dist/esm/{chunk-6EMN3BOV.mjs → chunk-I2NMCLNW.mjs} +1 -1
  180. package/dist/esm/chunk-I2NMCLNW.mjs.map +1 -0
  181. package/dist/esm/{chunk-NH2S6SB2.mjs → chunk-IAVI3H4V.mjs} +2 -2
  182. package/dist/esm/chunk-IAVI3H4V.mjs.map +1 -0
  183. package/dist/esm/chunk-IBLZ6MZU.mjs +2 -0
  184. package/dist/esm/chunk-IBLZ6MZU.mjs.map +1 -0
  185. package/dist/esm/chunk-IECDO22V.mjs +2 -0
  186. package/dist/esm/chunk-IECDO22V.mjs.map +1 -0
  187. package/dist/esm/{chunk-3YKAGVHZ.mjs → chunk-IFXUWUP2.mjs} +2 -2
  188. package/dist/esm/chunk-IFXUWUP2.mjs.map +1 -0
  189. package/dist/esm/{chunk-EXP5STXZ.mjs → chunk-J245N3XF.mjs} +1 -1
  190. package/dist/esm/chunk-J245N3XF.mjs.map +1 -0
  191. package/dist/esm/{chunk-MS4MRLGA.mjs → chunk-JGNMNCQB.mjs} +2 -2
  192. package/dist/esm/chunk-JGNMNCQB.mjs.map +1 -0
  193. package/dist/esm/{chunk-SR24OGHJ.mjs → chunk-JN36BNWA.mjs} +2 -2
  194. package/dist/esm/chunk-JN36BNWA.mjs.map +1 -0
  195. package/dist/esm/{chunk-DAXKRXRK.mjs → chunk-JNRMHDRA.mjs} +2 -2
  196. package/dist/esm/chunk-JNRMHDRA.mjs.map +1 -0
  197. package/dist/esm/{chunk-SAPUZZEU.mjs → chunk-JVTDP4KV.mjs} +2 -2
  198. package/dist/esm/chunk-JVTDP4KV.mjs.map +1 -0
  199. package/dist/esm/{chunk-FVA2OPG4.mjs → chunk-KDMSOCZY.mjs} +1 -1
  200. package/dist/esm/{chunk-BCUSI3N6.mjs → chunk-KFNDDPOW.mjs} +2 -2
  201. package/dist/esm/chunk-KFNDDPOW.mjs.map +1 -0
  202. package/dist/esm/chunk-KIW54KWR.mjs +2 -0
  203. package/dist/esm/{chunk-QPP6BX53.mjs → chunk-KM6UXNC7.mjs} +2 -2
  204. package/dist/esm/chunk-KM6UXNC7.mjs.map +1 -0
  205. package/dist/esm/{chunk-PKXEB7XP.mjs → chunk-KRVLR3L4.mjs} +2 -2
  206. package/dist/esm/chunk-KRVLR3L4.mjs.map +1 -0
  207. package/dist/esm/{chunk-XH7YKEYR.mjs → chunk-KW4FVBDD.mjs} +2 -2
  208. package/dist/esm/chunk-KW4FVBDD.mjs.map +1 -0
  209. package/dist/esm/{chunk-AFOPNDOJ.mjs → chunk-KYJU5PWF.mjs} +2 -2
  210. package/dist/esm/chunk-KYJU5PWF.mjs.map +1 -0
  211. package/dist/esm/{chunk-X4KEZTUQ.mjs → chunk-L5J3V3HW.mjs} +2 -2
  212. package/dist/esm/chunk-L5J3V3HW.mjs.map +1 -0
  213. package/dist/esm/{chunk-LDFTE4MM.mjs → chunk-LDZPO76C.mjs} +2 -2
  214. package/dist/esm/chunk-LDZPO76C.mjs.map +1 -0
  215. package/dist/esm/{chunk-UAL27G6B.mjs → chunk-LEKBJ2EG.mjs} +1 -1
  216. package/dist/esm/chunk-LEKBJ2EG.mjs.map +1 -0
  217. package/dist/esm/{chunk-YHAPZP5A.mjs → chunk-M22UGFQ5.mjs} +2 -2
  218. package/dist/esm/chunk-M22UGFQ5.mjs.map +1 -0
  219. package/dist/esm/{chunk-TMW2HIXC.mjs → chunk-MK2QAHXC.mjs} +2 -2
  220. package/dist/esm/chunk-MK2QAHXC.mjs.map +1 -0
  221. package/dist/esm/{chunk-QCUFTD7K.mjs → chunk-MSHZ4FWB.mjs} +2 -2
  222. package/dist/esm/chunk-MSHZ4FWB.mjs.map +1 -0
  223. package/dist/esm/{chunk-KEYAPEAX.mjs → chunk-N47FTRYO.mjs} +1 -1
  224. package/dist/esm/chunk-N47FTRYO.mjs.map +1 -0
  225. package/dist/esm/{chunk-QIW56MUH.mjs → chunk-NODYW7DM.mjs} +2 -2
  226. package/dist/esm/chunk-NODYW7DM.mjs.map +1 -0
  227. package/dist/esm/chunk-OAEDFM7T.mjs +2 -0
  228. package/dist/esm/chunk-OAEDFM7T.mjs.map +1 -0
  229. package/dist/esm/chunk-ONBFUPEC.mjs +2 -0
  230. package/dist/esm/chunk-ONBFUPEC.mjs.map +1 -0
  231. package/dist/esm/chunk-OTY3NO7Q.mjs +2 -0
  232. package/dist/esm/chunk-OTY3NO7Q.mjs.map +1 -0
  233. package/dist/esm/{chunk-ZGO2SK6F.mjs → chunk-OXM4BVAY.mjs} +2 -2
  234. package/dist/esm/chunk-OXM4BVAY.mjs.map +1 -0
  235. package/dist/esm/{chunk-YJCZU6PR.mjs → chunk-OZN3OOJV.mjs} +2 -2
  236. package/dist/esm/chunk-OZN3OOJV.mjs.map +1 -0
  237. package/dist/esm/{chunk-DAJOX4PL.mjs → chunk-P3J54CQG.mjs} +2 -2
  238. package/dist/esm/chunk-P3J54CQG.mjs.map +1 -0
  239. package/dist/esm/{chunk-WP7WF54Q.mjs → chunk-PCLU4KLY.mjs} +2 -2
  240. package/dist/esm/chunk-PCLU4KLY.mjs.map +1 -0
  241. package/dist/esm/{chunk-LR65XHSF.mjs → chunk-PHP47DI4.mjs} +2 -2
  242. package/dist/esm/chunk-PHP47DI4.mjs.map +1 -0
  243. package/dist/esm/chunk-PRZ7AIGA.mjs +2 -0
  244. package/dist/esm/chunk-PRZ7AIGA.mjs.map +1 -0
  245. package/dist/esm/chunk-QQIVWB6G.mjs +2 -0
  246. package/dist/esm/chunk-QQIVWB6G.mjs.map +1 -0
  247. package/dist/esm/{chunk-TS3PYRAT.mjs → chunk-RAJTNQNL.mjs} +2 -2
  248. package/dist/esm/chunk-RAJTNQNL.mjs.map +1 -0
  249. package/dist/esm/{chunk-XONG5JZ4.mjs → chunk-RBJNSUSU.mjs} +2 -2
  250. package/dist/esm/chunk-RBJNSUSU.mjs.map +1 -0
  251. package/dist/esm/{chunk-EV2USF7B.mjs → chunk-RNJHULIT.mjs} +2 -2
  252. package/dist/esm/chunk-RNJHULIT.mjs.map +1 -0
  253. package/dist/esm/{chunk-IYQISVDX.mjs → chunk-RNRNGJDA.mjs} +2 -2
  254. package/dist/esm/chunk-RNRNGJDA.mjs.map +1 -0
  255. package/dist/esm/{chunk-N5JNKD5F.mjs → chunk-SGQFWWLQ.mjs} +2 -2
  256. package/dist/esm/chunk-SGQFWWLQ.mjs.map +1 -0
  257. package/dist/esm/{chunk-7ZLBJUVZ.mjs → chunk-SOLWFAUY.mjs} +2 -2
  258. package/dist/esm/chunk-SOLWFAUY.mjs.map +1 -0
  259. package/dist/esm/{chunk-MO4IZXLK.mjs → chunk-T5BCTWGK.mjs} +2 -2
  260. package/dist/esm/chunk-T5BCTWGK.mjs.map +1 -0
  261. package/dist/esm/{chunk-U67PFBTL.mjs → chunk-TPJLAYW6.mjs} +2 -2
  262. package/dist/esm/chunk-TPJLAYW6.mjs.map +1 -0
  263. package/dist/esm/{chunk-XXHW3ZT3.mjs → chunk-UCRROMZN.mjs} +2 -2
  264. package/dist/esm/chunk-UCRROMZN.mjs.map +1 -0
  265. package/dist/esm/{chunk-QLN2URFX.mjs → chunk-UGL2GPGK.mjs} +2 -2
  266. package/dist/esm/chunk-UGL2GPGK.mjs.map +1 -0
  267. package/dist/esm/{chunk-NMD45OTM.mjs → chunk-V5NDNR36.mjs} +2 -2
  268. package/dist/esm/chunk-V5NDNR36.mjs.map +1 -0
  269. package/dist/esm/{chunk-KYSDF3CA.mjs → chunk-VYMRIKUV.mjs} +2 -2
  270. package/dist/esm/chunk-VYMRIKUV.mjs.map +1 -0
  271. package/dist/esm/{chunk-KXBIA4KR.mjs → chunk-WSZCPSV4.mjs} +2 -2
  272. package/dist/esm/chunk-WSZCPSV4.mjs.map +1 -0
  273. package/dist/esm/{chunk-B2CXRZL5.mjs → chunk-WV2VJQDS.mjs} +2 -2
  274. package/dist/esm/chunk-WV2VJQDS.mjs.map +1 -0
  275. package/dist/esm/{chunk-B6M7QBUO.mjs → chunk-WZCKSN2U.mjs} +2 -2
  276. package/dist/esm/chunk-WZCKSN2U.mjs.map +1 -0
  277. package/dist/esm/{chunk-25TIHDS6.mjs → chunk-XFJD6QIP.mjs} +2 -2
  278. package/dist/esm/chunk-XFJD6QIP.mjs.map +1 -0
  279. package/dist/esm/{chunk-ECWOLU5T.mjs → chunk-XFY4O2S3.mjs} +2 -2
  280. package/dist/esm/chunk-XFY4O2S3.mjs.map +1 -0
  281. package/dist/esm/chunk-XOCRDV2V.mjs +2 -0
  282. package/dist/esm/chunk-XOCRDV2V.mjs.map +1 -0
  283. package/dist/esm/{chunk-TL7DR54X.mjs → chunk-XQ7ONNII.mjs} +2 -2
  284. package/dist/esm/chunk-XQ7ONNII.mjs.map +1 -0
  285. package/dist/esm/chunk-Y267I7DC.mjs +2 -0
  286. package/dist/esm/chunk-Y267I7DC.mjs.map +1 -0
  287. package/dist/esm/{chunk-G7MWTE2J.mjs → chunk-YZ5BCOGI.mjs} +2 -2
  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-2TQIU7CG.mjs → chunk-ZPIMARUG.mjs} +2 -2
  291. package/dist/esm/chunk-ZPIMARUG.mjs.map +1 -0
  292. package/dist/esm/chunk-ZPQUCT22.mjs +2 -0
  293. package/dist/esm/chunk-ZPQUCT22.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 +41 -4
  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 +454 -160
  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 +119 -22
  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 +135 -137
  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 +41 -3
  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 +0 -2
  605. package/dist/esm/chunk-DF4WKSTK.mjs.map +0 -1
  606. package/dist/esm/chunk-E37YRKWK.mjs.map +0 -1
  607. package/dist/esm/chunk-ECWOLU5T.mjs.map +0 -1
  608. package/dist/esm/chunk-EV2USF7B.mjs.map +0 -1
  609. package/dist/esm/chunk-EWZ2M5BW.mjs.map +0 -1
  610. package/dist/esm/chunk-EXP5STXZ.mjs.map +0 -1
  611. package/dist/esm/chunk-FRGXKOU5.mjs.map +0 -1
  612. package/dist/esm/chunk-GFGX3QDP.mjs.map +0 -1
  613. package/dist/esm/chunk-GGR3P2TG.mjs +0 -2
  614. package/dist/esm/chunk-GGR3P2TG.mjs.map +0 -1
  615. package/dist/esm/chunk-HAT5S2XX.mjs +0 -2
  616. package/dist/esm/chunk-HAT5S2XX.mjs.map +0 -1
  617. package/dist/esm/chunk-HPZ2S4FE.mjs +0 -2
  618. package/dist/esm/chunk-HPZ2S4FE.mjs.map +0 -1
  619. package/dist/esm/chunk-HSPBA2TZ.mjs.map +0 -1
  620. package/dist/esm/chunk-IMGLHDIA.mjs +0 -2
  621. package/dist/esm/chunk-IMGLHDIA.mjs.map +0 -1
  622. package/dist/esm/chunk-IYQISVDX.mjs.map +0 -1
  623. package/dist/esm/chunk-K2O24YLZ.mjs.map +0 -1
  624. package/dist/esm/chunk-KA6FZNWP.mjs +0 -2
  625. package/dist/esm/chunk-KA6FZNWP.mjs.map +0 -1
  626. package/dist/esm/chunk-KEYAPEAX.mjs.map +0 -1
  627. package/dist/esm/chunk-KXBIA4KR.mjs.map +0 -1
  628. package/dist/esm/chunk-KYSDF3CA.mjs.map +0 -1
  629. package/dist/esm/chunk-L5NY7TMI.mjs.map +0 -1
  630. package/dist/esm/chunk-LDFTE4MM.mjs.map +0 -1
  631. package/dist/esm/chunk-LG3DAAPD.mjs +0 -2
  632. package/dist/esm/chunk-LG3DAAPD.mjs.map +0 -1
  633. package/dist/esm/chunk-LG7RJQ57.mjs.map +0 -1
  634. package/dist/esm/chunk-LGD5KU56.mjs +0 -2
  635. package/dist/esm/chunk-LGD5KU56.mjs.map +0 -1
  636. package/dist/esm/chunk-LR65XHSF.mjs.map +0 -1
  637. package/dist/esm/chunk-LXLISEQ4.mjs.map +0 -1
  638. package/dist/esm/chunk-M2QV232A.mjs +0 -2
  639. package/dist/esm/chunk-M2QV232A.mjs.map +0 -1
  640. package/dist/esm/chunk-MEWFJJJN.mjs +0 -2
  641. package/dist/esm/chunk-MEWFJJJN.mjs.map +0 -1
  642. package/dist/esm/chunk-MO4IZXLK.mjs.map +0 -1
  643. package/dist/esm/chunk-MS4MRLGA.mjs.map +0 -1
  644. package/dist/esm/chunk-N5JNKD5F.mjs.map +0 -1
  645. package/dist/esm/chunk-NH2S6SB2.mjs.map +0 -1
  646. package/dist/esm/chunk-NMD45OTM.mjs.map +0 -1
  647. package/dist/esm/chunk-NNRAQP36.mjs.map +0 -1
  648. package/dist/esm/chunk-OY2IX7HW.mjs.map +0 -1
  649. package/dist/esm/chunk-PKXEB7XP.mjs.map +0 -1
  650. package/dist/esm/chunk-PNXUYOYI.mjs +0 -2
  651. package/dist/esm/chunk-PNXUYOYI.mjs.map +0 -1
  652. package/dist/esm/chunk-PUZ25PTD.mjs.map +0 -1
  653. package/dist/esm/chunk-Q4XR6QOZ.mjs +0 -2
  654. package/dist/esm/chunk-QCUFTD7K.mjs.map +0 -1
  655. package/dist/esm/chunk-QDIKOQRK.mjs +0 -2
  656. package/dist/esm/chunk-QDIKOQRK.mjs.map +0 -1
  657. package/dist/esm/chunk-QIW56MUH.mjs.map +0 -1
  658. package/dist/esm/chunk-QLN2URFX.mjs.map +0 -1
  659. package/dist/esm/chunk-QPP6BX53.mjs.map +0 -1
  660. package/dist/esm/chunk-RNTXQYJQ.mjs.map +0 -1
  661. package/dist/esm/chunk-SAPUZZEU.mjs.map +0 -1
  662. package/dist/esm/chunk-SR24OGHJ.mjs.map +0 -1
  663. package/dist/esm/chunk-SRPI2FFA.mjs.map +0 -1
  664. package/dist/esm/chunk-STGYDB5E.mjs.map +0 -1
  665. package/dist/esm/chunk-SWHLSREF.mjs.map +0 -1
  666. package/dist/esm/chunk-TDGQGILY.mjs.map +0 -1
  667. package/dist/esm/chunk-TL7DR54X.mjs.map +0 -1
  668. package/dist/esm/chunk-TMW2HIXC.mjs.map +0 -1
  669. package/dist/esm/chunk-TS3PYRAT.mjs.map +0 -1
  670. package/dist/esm/chunk-TVFIUUVY.mjs.map +0 -1
  671. package/dist/esm/chunk-U67PFBTL.mjs.map +0 -1
  672. package/dist/esm/chunk-U6Z4FNB7.mjs.map +0 -1
  673. package/dist/esm/chunk-UAL27G6B.mjs.map +0 -1
  674. package/dist/esm/chunk-WP7WF54Q.mjs.map +0 -1
  675. package/dist/esm/chunk-WS4RPKL6.mjs +0 -2
  676. package/dist/esm/chunk-WS4RPKL6.mjs.map +0 -1
  677. package/dist/esm/chunk-WWZ3METZ.mjs.map +0 -1
  678. package/dist/esm/chunk-X4KEZTUQ.mjs.map +0 -1
  679. package/dist/esm/chunk-XH7YKEYR.mjs.map +0 -1
  680. package/dist/esm/chunk-XK3JFCP3.mjs.map +0 -1
  681. package/dist/esm/chunk-XONG5JZ4.mjs.map +0 -1
  682. package/dist/esm/chunk-XXHW3ZT3.mjs.map +0 -1
  683. package/dist/esm/chunk-Y7F2V3R6.mjs +0 -2
  684. package/dist/esm/chunk-Y7F2V3R6.mjs.map +0 -1
  685. package/dist/esm/chunk-YHAPZP5A.mjs.map +0 -1
  686. package/dist/esm/chunk-YJCZU6PR.mjs.map +0 -1
  687. package/dist/esm/chunk-ZGO2SK6F.mjs.map +0 -1
  688. package/dist/esm/publicKey-B3XRNhHO.d.mts +0 -113
  689. /package/dist/esm/{chunk-FVA2OPG4.mjs.map → chunk-KDMSOCZY.mjs.map} +0 -0
  690. /package/dist/esm/{chunk-Q4XR6QOZ.mjs.map → chunk-KIW54KWR.mjs.map} +0 -0
  691. /package/dist/esm/{chunk-G7MWTE2J.mjs.map → chunk-YZ5BCOGI.mjs.map} +0 -0
@@ -1,2 +1,2 @@
1
- import{a as t,b as n,c as i,d as r,e as o}from"./chunk-SCHZ67F3.mjs";import f from"@aptos-labs/aptos-client";var l=class{constructor(e){this.network=e?.network??"devnet",this.fullnode=e?.fullnode,this.faucet=e?.faucet,this.pepper=e?.pepper,this.prover=e?.prover,this.indexer=e?.indexer,this.client=e?.client??{provider:f},this.clientConfig=e?.clientConfig??{},this.fullnodeConfig=e?.fullnodeConfig??{},this.indexerConfig=e?.indexerConfig??{},this.faucetConfig=e?.faucetConfig??{}}getRequestUrl(e){switch(e){case"Fullnode":if(this.fullnode!==void 0)return this.fullnode;if(this.network==="custom")throw new Error("Please provide a custom full node url");return n[this.network];case"Faucet":if(this.faucet!==void 0)return this.faucet;if(this.network==="custom")throw new Error("Please provide a custom faucet url");return i[this.network];case"Indexer":if(this.indexer!==void 0)return this.indexer;if(this.network==="custom")throw new Error("Please provide a custom indexer url");return t[this.network];case"Pepper":if(this.pepper!==void 0)return this.pepper;if(this.network==="custom")throw new Error("Please provide a custom pepper service url");return r[this.network];case"Prover":if(this.prover!==void 0)return this.prover;if(this.network==="custom")throw new Error("Please provide a custom prover service url");return o[this.network];default:throw Error(`apiType ${e} is not supported`)}}isPepperServiceRequest(e){return r[this.network]===e}isProverServiceRequest(e){return o[this.network]===e}};export{l as a};
2
- //# sourceMappingURL=chunk-NMD45OTM.mjs.map
1
+ import{a as t,b as n,c as i,d as r,e as o}from"./chunk-D3OEQLUE.mjs";import f from"@aptos-labs/aptos-client";var l=class{constructor(e){this.network=e?.network??"devnet",this.fullnode=e?.fullnode,this.faucet=e?.faucet,this.pepper=e?.pepper,this.prover=e?.prover,this.indexer=e?.indexer,this.client=e?.client??{provider:f},this.clientConfig=e?.clientConfig??{},this.fullnodeConfig=e?.fullnodeConfig??{},this.indexerConfig=e?.indexerConfig??{},this.faucetConfig=e?.faucetConfig??{}}getRequestUrl(e){switch(e){case"Fullnode":if(this.fullnode!==void 0)return this.fullnode;if(this.network==="custom")throw new Error("Please provide a custom full node url");return n[this.network];case"Faucet":if(this.faucet!==void 0)return this.faucet;if(this.network==="custom")throw new Error("Please provide a custom faucet url");return i[this.network];case"Indexer":if(this.indexer!==void 0)return this.indexer;if(this.network==="custom")throw new Error("Please provide a custom indexer url");return t[this.network];case"Pepper":if(this.pepper!==void 0)return this.pepper;if(this.network==="custom")throw new Error("Please provide a custom pepper service url");return r[this.network];case"Prover":if(this.prover!==void 0)return this.prover;if(this.network==="custom")throw new Error("Please provide a custom prover service url");return o[this.network];default:throw Error(`apiType ${e} is not supported`)}}isPepperServiceRequest(e){return r[this.network]===e}isProverServiceRequest(e){return o[this.network]===e}};export{l as a};
2
+ //# sourceMappingURL=chunk-V5NDNR36.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/api/aptosConfig.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport aptosClient from \"@aptos-labs/aptos-client\";\nimport { AptosSettings, ClientConfig, Client, FullNodeConfig, IndexerConfig, FaucetConfig } from \"../types\";\nimport {\n NetworkToNodeAPI,\n NetworkToFaucetAPI,\n NetworkToIndexerAPI,\n Network,\n NetworkToPepperAPI,\n NetworkToProverAPI,\n} from \"../utils/apiEndpoints\";\nimport { AptosApiType } from \"../utils/const\";\n\n/**\n * Represents the configuration settings for an Aptos SDK client instance.\n * This class allows customization of various endpoints and client settings.\n *\n * @example\n * ```typescript\n * import { Aptos, AptosConfig, Network } from \"@aptos-labs/ts-sdk\";\n *\n * async function runExample() {\n * // Create a configuration for connecting to the Aptos testnet\n * const config = new AptosConfig({ network: Network.TESTNET });\n *\n * // Initialize the Aptos client with the configuration\n * const aptos = new Aptos(config);\n *\n * console.log(\"Aptos client initialized:\", aptos);\n * }\n * runExample().catch(console.error);\n * ```\n */\nexport class AptosConfig {\n /**\n * The Network that this SDK is associated with. Defaults to DEVNET\n */\n readonly network: Network;\n\n /**\n * The client instance the SDK uses. Defaults to `@aptos-labs/aptos-client\n */\n readonly client: Client;\n\n /**\n * The optional hardcoded fullnode URL to send requests to instead of using the network\n */\n readonly fullnode?: string;\n\n /**\n * The optional hardcoded faucet URL to send requests to instead of using the network\n */\n readonly faucet?: string;\n\n /**\n * The optional hardcoded pepper service URL to send requests to instead of using the network\n */\n readonly pepper?: string;\n\n /**\n * The optional hardcoded prover service URL to send requests to instead of using the network\n */\n readonly prover?: string;\n\n /**\n * The optional hardcoded indexer URL to send requests to instead of using the network\n */\n readonly indexer?: string;\n\n /**\n * Optional client configurations\n */\n readonly clientConfig?: ClientConfig;\n\n /**\n * Optional specific Fullnode configurations\n */\n readonly fullnodeConfig?: FullNodeConfig;\n\n /**\n * Optional specific Indexer configurations\n */\n readonly indexerConfig?: IndexerConfig;\n\n /**\n * Optional specific Faucet configurations\n */\n readonly faucetConfig?: FaucetConfig;\n\n /**\n * Initializes an instance of the Aptos client with the specified settings.\n * This allows users to configure various aspects of the client, such as network and endpoints.\n *\n * @param settings - Optional configuration settings for the Aptos client.\n * @param settings.network - The network to connect to, defaults to `Network.DEVNET`.\n * @param settings.fullnode - The fullnode endpoint to use for requests.\n * @param settings.faucet - The faucet endpoint for obtaining test tokens.\n * @param settings.pepper - The pepper used for transaction signing.\n * @param settings.prover - The prover endpoint for transaction verification.\n * @param settings.indexer - The indexer endpoint for querying blockchain data.\n * @param settings.client - Custom client settings, defaults to a standard Aptos client.\n * @param settings.clientConfig - Additional configuration for the client.\n * @param settings.fullnodeConfig - Additional configuration for the fullnode.\n * @param settings.indexerConfig - Additional configuration for the indexer.\n * @param settings.faucetConfig - Additional configuration for the faucet.\n *\n * @example\n * ```typescript\n * import { Aptos, AptosConfig, Network } from \"@aptos-labs/ts-sdk\";\n *\n * async function runExample() {\n * // Create a new Aptos client with default settings\n * const config = new AptosConfig({ network: Network.TESTNET }); // Specify the network\n * const aptos = new Aptos(config);\n *\n * console.log(\"Aptos client initialized:\", aptos);\n * }\n * runExample().catch(console.error);\n * ```\n */\n constructor(settings?: AptosSettings) {\n this.network = settings?.network ?? Network.DEVNET;\n this.fullnode = settings?.fullnode;\n this.faucet = settings?.faucet;\n this.pepper = settings?.pepper;\n this.prover = settings?.prover;\n this.indexer = settings?.indexer;\n this.client = settings?.client ?? { provider: aptosClient };\n this.clientConfig = settings?.clientConfig ?? {};\n this.fullnodeConfig = settings?.fullnodeConfig ?? {};\n this.indexerConfig = settings?.indexerConfig ?? {};\n this.faucetConfig = settings?.faucetConfig ?? {};\n }\n\n /**\n * Returns the URL endpoint to send the request to based on the specified API type.\n * If a custom URL was provided in the configuration, that URL is returned. Otherwise, the URL endpoint is derived from the network.\n *\n * @param apiType - The type of Aptos API to get the URL for. This can be one of the following: FULLNODE, FAUCET, INDEXER, PEPPER, PROVER.\n *\n * @example\n * ```typescript\n * import { Aptos, AptosConfig, Network, AptosApiType } from \"@aptos-labs/ts-sdk\";\n *\n * const config = new AptosConfig({ network: Network.TESTNET });\n * const aptos = new Aptos(config);\n *\n * async function runExample() {\n * // Getting the request URL for the FULLNODE API\n * const url = config.getRequestUrl(AptosApiType.FULLNODE);\n * console.log(\"Request URL for FULLNODE:\", url);\n * }\n * runExample().catch(console.error);\n * ```\n */\n getRequestUrl(apiType: AptosApiType): string {\n switch (apiType) {\n case AptosApiType.FULLNODE:\n if (this.fullnode !== undefined) return this.fullnode;\n if (this.network === Network.CUSTOM) throw new Error(\"Please provide a custom full node url\");\n return NetworkToNodeAPI[this.network];\n case AptosApiType.FAUCET:\n if (this.faucet !== undefined) return this.faucet;\n if (this.network === Network.CUSTOM) throw new Error(\"Please provide a custom faucet url\");\n return NetworkToFaucetAPI[this.network];\n case AptosApiType.INDEXER:\n if (this.indexer !== undefined) return this.indexer;\n if (this.network === Network.CUSTOM) throw new Error(\"Please provide a custom indexer url\");\n return NetworkToIndexerAPI[this.network];\n case AptosApiType.PEPPER:\n if (this.pepper !== undefined) return this.pepper;\n if (this.network === Network.CUSTOM) throw new Error(\"Please provide a custom pepper service url\");\n return NetworkToPepperAPI[this.network];\n case AptosApiType.PROVER:\n if (this.prover !== undefined) return this.prover;\n if (this.network === Network.CUSTOM) throw new Error(\"Please provide a custom prover service url\");\n return NetworkToProverAPI[this.network];\n default:\n throw Error(`apiType ${apiType} is not supported`);\n }\n }\n\n /**\n * Checks if the provided URL is a known pepper service endpoint.\n *\n * @param url - The URL to check against the known pepper service endpoints.\n *\n * @example\n * ```typescript\n * import { Aptos, AptosConfig, Network } from \"@aptos-labs/ts-sdk\";\n *\n * const config = new AptosConfig({ network: Network.TESTNET });\n * const aptos = new Aptos(config);\n *\n * async function runExample() {\n * const url = \"https://example.pepper.service\"; // replace with a real pepper service URL\n *\n * // Check if the URL is a known pepper service endpoint\n * const isPepperService = config.isPepperServiceRequest(url);\n *\n * console.log(`Is the URL a known pepper service? ${isPepperService}`);\n * }\n * runExample().catch(console.error);\n * ```\n */\n isPepperServiceRequest(url: string): boolean {\n return NetworkToPepperAPI[this.network] === url;\n }\n\n /**\n * Checks if the provided URL is a known prover service endpoint.\n *\n * @param url - The URL to check against known prover service endpoints.\n * @returns A boolean indicating whether the URL is a known prover service endpoint.\n *\n * @example\n * ```typescript\n * import { Aptos, AptosConfig, Network } from \"@aptos-labs/ts-sdk\";\n *\n * const config = new AptosConfig({ network: Network.TESTNET });\n * const aptos = new Aptos(config);\n *\n * // Check if the URL is a known prover service endpoint\n * const url = \"https://prover.testnet.aptos.dev\"; // replace with a real URL if needed\n * const isProver = config.isProverServiceRequest(url);\n *\n * console.log(`Is the URL a known prover service? ${isProver}`);\n * ```\n */\n isProverServiceRequest(url: string): boolean {\n return NetworkToProverAPI[this.network] === url;\n }\n}\n"],"mappings":"qEAGA,OAAOA,MAAiB,2BAgCjB,IAAMC,EAAN,KAAkB,CAuFvB,YAAYC,EAA0B,CACpC,KAAK,QAAUA,GAAU,SAAW,SACpC,KAAK,SAAWA,GAAU,SAC1B,KAAK,OAASA,GAAU,OACxB,KAAK,OAASA,GAAU,OACxB,KAAK,OAASA,GAAU,OACxB,KAAK,QAAUA,GAAU,QACzB,KAAK,OAASA,GAAU,QAAU,CAAE,SAAUC,CAAY,EAC1D,KAAK,aAAeD,GAAU,cAAgB,CAAC,EAC/C,KAAK,eAAiBA,GAAU,gBAAkB,CAAC,EACnD,KAAK,cAAgBA,GAAU,eAAiB,CAAC,EACjD,KAAK,aAAeA,GAAU,cAAgB,CAAC,CACjD,CAuBA,cAAcE,EAA+B,CAC3C,OAAQA,EAAS,CACf,eACE,GAAI,KAAK,WAAa,OAAW,OAAO,KAAK,SAC7C,GAAI,KAAK,UAAY,SAAgB,MAAM,IAAI,MAAM,uCAAuC,EAC5F,OAAOC,EAAiB,KAAK,OAAO,EACtC,aACE,GAAI,KAAK,SAAW,OAAW,OAAO,KAAK,OAC3C,GAAI,KAAK,UAAY,SAAgB,MAAM,IAAI,MAAM,oCAAoC,EACzF,OAAOC,EAAmB,KAAK,OAAO,EACxC,cACE,GAAI,KAAK,UAAY,OAAW,OAAO,KAAK,QAC5C,GAAI,KAAK,UAAY,SAAgB,MAAM,IAAI,MAAM,qCAAqC,EAC1F,OAAOC,EAAoB,KAAK,OAAO,EACzC,aACE,GAAI,KAAK,SAAW,OAAW,OAAO,KAAK,OAC3C,GAAI,KAAK,UAAY,SAAgB,MAAM,IAAI,MAAM,4CAA4C,EACjG,OAAOC,EAAmB,KAAK,OAAO,EACxC,aACE,GAAI,KAAK,SAAW,OAAW,OAAO,KAAK,OAC3C,GAAI,KAAK,UAAY,SAAgB,MAAM,IAAI,MAAM,4CAA4C,EACjG,OAAOC,EAAmB,KAAK,OAAO,EACxC,QACE,MAAM,MAAM,WAAWL,CAAO,mBAAmB,CACrD,CACF,CAyBA,uBAAuBM,EAAsB,CAC3C,OAAOF,EAAmB,KAAK,OAAO,IAAME,CAC9C,CAsBA,uBAAuBA,EAAsB,CAC3C,OAAOD,EAAmB,KAAK,OAAO,IAAMC,CAC9C,CACF","names":["aptosClient","AptosConfig","settings","aptosClient","apiType","NetworkToNodeAPI","NetworkToFaucetAPI","NetworkToIndexerAPI","NetworkToPepperAPI","NetworkToProverAPI","url"]}
@@ -1,2 +1,2 @@
1
- import{d as o}from"./chunk-KXBIA4KR.mjs";import{b as i}from"./chunk-TMW2HIXC.mjs";import{c as n}from"./chunk-DAJOX4PL.mjs";import{b as s}from"./chunk-QPP6BX53.mjs";var c=class a{constructor(t){this.signingScheme=0;let{privateKey:e,address:r}=t;this.privateKey=e,this.publicKey=e.publicKey(),this.accountAddress=r?s.from(r):this.publicKey.authKey().derivedAddress()}static generate(){let t=n.generate();return new a({privateKey:t})}static fromDerivationPath(t){let{path:e,mnemonic:r}=t,u=n.fromDerivationPath(e,r);return new a({privateKey:u})}verifySignature(t){return this.publicKey.verifySignature(t)}signWithAuthenticator(t){return new i(this.publicKey,this.privateKey.sign(t))}signTransactionWithAuthenticator(t){return new i(this.publicKey,this.signTransaction(t))}sign(t){return this.privateKey.sign(t)}signTransaction(t){return this.sign(o(t))}};export{c as a};
2
- //# sourceMappingURL=chunk-KYSDF3CA.mjs.map
1
+ import{d as s}from"./chunk-WSZCPSV4.mjs";import{b as i}from"./chunk-MK2QAHXC.mjs";import{c as n}from"./chunk-P3J54CQG.mjs";import{b as o}from"./chunk-KM6UXNC7.mjs";var c=class a{constructor(t){this.signingScheme=0;let{privateKey:e,address:r}=t;this.privateKey=e,this.publicKey=e.publicKey(),this.accountAddress=r?o.from(r):this.publicKey.authKey().derivedAddress()}static generate(){let t=n.generate();return new a({privateKey:t})}static fromDerivationPath(t){let{path:e,mnemonic:r}=t,u=n.fromDerivationPath(e,r);return new a({privateKey:u})}verifySignature(t){return this.publicKey.verifySignature(t)}signWithAuthenticator(t){return new i(this.publicKey,this.privateKey.sign(t))}signTransactionWithAuthenticator(t){return new i(this.publicKey,this.signTransaction(t))}sign(t){return this.privateKey.sign(t)}signTransaction(t){return this.sign(s(t))}};export{c as a};
2
+ //# sourceMappingURL=chunk-VYMRIKUV.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/account/Ed25519Account.ts"],"sourcesContent":["import { AccountAuthenticatorEd25519 } from \"../transactions/authenticator/account\";\nimport { HexInput, SigningScheme } from \"../types\";\nimport { AccountAddress, AccountAddressInput } from \"../core/accountAddress\";\nimport { Ed25519PrivateKey, Ed25519PublicKey, Ed25519Signature } from \"../core/crypto\";\nimport type { Account } from \"./Account\";\nimport { AnyRawTransaction } from \"../transactions/types\";\nimport { generateSigningMessageForTransaction } from \"../transactions/transactionBuilder/signingMessage\";\n\n/**\n * Arguments required to create an instance of an Ed25519 signer.\n *\n * @param privateKey - The private key used for signing.\n * @param address - Optional account address associated with the signer.\n */\nexport interface Ed25519SignerConstructorArgs {\n privateKey: Ed25519PrivateKey;\n address?: AccountAddressInput;\n}\n\n/**\n * Arguments for creating an Ed25519 signer from a derivation path.\n *\n * @param path - The derivation path for the Ed25519 key.\n * @param mnemonic - The mnemonic phrase used to generate the key.\n */\nexport interface Ed25519SignerFromDerivationPathArgs {\n path: string;\n mnemonic: string;\n}\n\n/**\n * Arguments required to verify an Ed25519 signature against a given message.\n *\n * @param message - The message to be verified, represented in hexadecimal format.\n * @param signature - The Ed25519 signature to validate.\n */\nexport interface VerifyEd25519SignatureArgs {\n message: HexInput;\n signature: Ed25519Signature;\n}\n\n/**\n * Represents an Ed25519 account that provides signing capabilities through an Ed25519 private key.\n * This class allows for the creation of accounts, signing messages and transactions, and verifying signatures.\n *\n * Note: Generating an instance of this class does not create the account on-chain.\n */\nexport class Ed25519Account implements Account {\n /**\n * Private key associated with the account\n */\n readonly privateKey: Ed25519PrivateKey;\n\n readonly publicKey: Ed25519PublicKey;\n\n readonly accountAddress: AccountAddress;\n\n readonly signingScheme = SigningScheme.Ed25519;\n\n // region Constructors\n\n /**\n * Creates an instance of the Ed25519Signer with the specified parameters.\n * This constructor initializes the private key, public key, and account address for the signer.\n *\n * @param args - The constructor arguments for the Ed25519Signer.\n * @param args.privateKey - The private key used for signing.\n * @param args.address - The optional account address; if not provided, it will derive the address from the public key.\n */\n constructor(args: Ed25519SignerConstructorArgs) {\n const { privateKey, address } = args;\n this.privateKey = privateKey;\n this.publicKey = privateKey.publicKey();\n this.accountAddress = address ? AccountAddress.from(address) : this.publicKey.authKey().derivedAddress();\n }\n\n /**\n * Generates a new Ed25519 account using a randomly generated private key.\n * This function is useful for creating a signer that can be used for cryptographic operations.\n *\n * @returns {Ed25519Account} The newly generated Ed25519 account.\n */\n static generate(): Ed25519Account {\n const privateKey = Ed25519PrivateKey.generate();\n return new Ed25519Account({ privateKey });\n }\n\n /**\n * Derives an Ed25519 account using a specified BIP44 path and mnemonic seed phrase.\n *\n * @param args - The arguments for deriving the account.\n * @param args.path - The BIP44 derive hardened path, e.g., m/44'/637'/0'/0'/0'.\n * Detailed description: {@link https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki}\n * @param args.mnemonic - The mnemonic seed phrase of the account.\n */\n static fromDerivationPath(args: Ed25519SignerFromDerivationPathArgs) {\n const { path, mnemonic } = args;\n const privateKey = Ed25519PrivateKey.fromDerivationPath(path, mnemonic);\n return new Ed25519Account({ privateKey });\n }\n // endregion\n\n // region Account\n /**\n * Verify the given message and signature with the public key.\n *\n * @param args - The arguments for verifying the signature.\n * @param args.message - Raw message data in HexInput format.\n * @param args.signature - Signed message signature.\n * @returns A boolean indicating whether the signature is valid.\n */\n verifySignature(args: VerifyEd25519SignatureArgs): boolean {\n return this.publicKey.verifySignature(args);\n }\n\n /**\n * Sign a message using the account's Ed25519 private key.\n * This function returns an AccountAuthenticator containing the signature along with the account's public key.\n *\n * @param message - The signing message, represented as hexadecimal input.\n * @returns An AccountAuthenticator containing the signature and the account's public key.\n */\n signWithAuthenticator(message: HexInput): AccountAuthenticatorEd25519 {\n return new AccountAuthenticatorEd25519(this.publicKey, this.privateKey.sign(message));\n }\n\n /**\n * Sign a transaction using the account's Ed25519 private key.\n * This function returns an AccountAuthenticator that contains the signature of the transaction along with the account's public key.\n *\n * @param transaction - The raw transaction to be signed.\n * @returns An AccountAuthenticator containing the signature and the public key.\n */\n signTransactionWithAuthenticator(transaction: AnyRawTransaction): AccountAuthenticatorEd25519 {\n return new AccountAuthenticatorEd25519(this.publicKey, this.signTransaction(transaction));\n }\n\n /**\n * Sign the given message using the account's Ed25519 private key.\n * @param message - The message to be signed in HexInput format.\n * @returns Signature - The resulting signature of the signed message.\n */\n sign(message: HexInput): Ed25519Signature {\n return this.privateKey.sign(message);\n }\n\n /**\n * Sign the given transaction using the available signing capabilities.\n * This function helps ensure that the transaction is properly authenticated before submission.\n *\n * @param transaction - The transaction to be signed.\n * @returns Signature - The resulting signature for the transaction.\n */\n signTransaction(transaction: AnyRawTransaction): Ed25519Signature {\n return this.sign(generateSigningMessageForTransaction(transaction));\n }\n\n // endregion\n}\n"],"mappings":"oKA+CO,IAAMA,EAAN,MAAMC,CAAkC,CAsB7C,YAAYC,EAAoC,CAZhD,KAAS,cAAgB,EAavB,GAAM,CAAE,WAAAC,EAAY,QAAAC,CAAQ,EAAIF,EAChC,KAAK,WAAaC,EAClB,KAAK,UAAYA,EAAW,UAAU,EACtC,KAAK,eAAiBC,EAAUC,EAAe,KAAKD,CAAO,EAAI,KAAK,UAAU,QAAQ,EAAE,eAAe,CACzG,CAQA,OAAO,UAA2B,CAChC,IAAMD,EAAaG,EAAkB,SAAS,EAC9C,OAAO,IAAIL,EAAe,CAAE,WAAAE,CAAW,CAAC,CAC1C,CAUA,OAAO,mBAAmBD,EAA2C,CACnE,GAAM,CAAE,KAAAK,EAAM,SAAAC,CAAS,EAAIN,EACrBC,EAAaG,EAAkB,mBAAmBC,EAAMC,CAAQ,EACtE,OAAO,IAAIP,EAAe,CAAE,WAAAE,CAAW,CAAC,CAC1C,CAYA,gBAAgBD,EAA2C,CACzD,OAAO,KAAK,UAAU,gBAAgBA,CAAI,CAC5C,CASA,sBAAsBO,EAAgD,CACpE,OAAO,IAAIC,EAA4B,KAAK,UAAW,KAAK,WAAW,KAAKD,CAAO,CAAC,CACtF,CASA,iCAAiCE,EAA6D,CAC5F,OAAO,IAAID,EAA4B,KAAK,UAAW,KAAK,gBAAgBC,CAAW,CAAC,CAC1F,CAOA,KAAKF,EAAqC,CACxC,OAAO,KAAK,WAAW,KAAKA,CAAO,CACrC,CASA,gBAAgBE,EAAkD,CAChE,OAAO,KAAK,KAAKC,EAAqCD,CAAW,CAAC,CACpE,CAGF","names":["Ed25519Account","_Ed25519Account","args","privateKey","address","AccountAddress","Ed25519PrivateKey","path","mnemonic","message","AccountAuthenticatorEd25519","transaction","generateSigningMessageForTransaction"]}
@@ -1,2 +1,2 @@
1
- import{c as T,d as c}from"./chunk-5655UVIK.mjs";import{g as A,h as a}from"./chunk-EXP5STXZ.mjs";import{sha3_256 as y}from"@noble/hashes/sha3";function d(e){return e.feePayerAddress?new c(e.rawTransaction,e.secondarySignerAddresses??[],e.feePayerAddress):e.secondarySignerAddresses?new T(e.rawTransaction,e.secondarySignerAddresses):e.rawTransaction}function n(e,r){let i=y.create();if(!r.startsWith("APTOS::"))throw new Error(`Domain separator needs to start with 'APTOS::'. Provided - ${r}`);i.update(r);let s=i.digest(),o=e,t=new Uint8Array(s.length+o.length);return t.set(s),t.set(o,s.length),t}function u(e){return n(e.bcsToBytes(),`APTOS::${e.constructor.name}`)}function S(e){let r=d(e);return e.feePayerAddress?n(r.bcsToBytes(),a):e.secondarySignerAddresses?n(r.bcsToBytes(),a):n(r.bcsToBytes(),A)}export{d as a,n as b,u as c,S as d};
2
- //# sourceMappingURL=chunk-KXBIA4KR.mjs.map
1
+ import{c as T,d as c}from"./chunk-4LKLOUMG.mjs";import{g as A,h as a}from"./chunk-J245N3XF.mjs";import{sha3_256 as y}from"@noble/hashes/sha3";function d(e){return e.feePayerAddress?new c(e.rawTransaction,e.secondarySignerAddresses??[],e.feePayerAddress):e.secondarySignerAddresses?new T(e.rawTransaction,e.secondarySignerAddresses):e.rawTransaction}function n(e,r){let i=y.create();if(!r.startsWith("APTOS::"))throw new Error(`Domain separator needs to start with 'APTOS::'. Provided - ${r}`);i.update(r);let s=i.digest(),o=e,t=new Uint8Array(s.length+o.length);return t.set(s),t.set(o,s.length),t}function u(e){return n(e.bcsToBytes(),`APTOS::${e.constructor.name}`)}function S(e){let r=d(e);return e.feePayerAddress?n(r.bcsToBytes(),a):e.secondarySignerAddresses?n(r.bcsToBytes(),a):n(r.bcsToBytes(),A)}export{d as a,n as b,u as c,S as d};
2
+ //# sourceMappingURL=chunk-WSZCPSV4.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/transactions/transactionBuilder/signingMessage.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\n/**\n * This file handles the generation of the signing message.\n */\nimport { sha3_256 as sha3Hash } from \"@noble/hashes/sha3\";\nimport { RAW_TRANSACTION_SALT, RAW_TRANSACTION_WITH_DATA_SALT } from \"../../utils/const\";\nimport { FeePayerRawTransaction, MultiAgentRawTransaction } from \"../instances\";\nimport { AnyRawTransaction, AnyRawTransactionInstance } from \"../types\";\nimport { Serializable } from \"../../bcs\";\n\n/**\n * Derives the appropriate raw transaction type based on the provided transaction details.\n * This function helps in identifying whether the transaction is a FeePayerRawTransaction,\n * MultiAgentRawTransaction, or a standard RawTransaction.\n *\n * @param transaction - An object representing an Aptos transaction, which may include:\n * - feePayerAddress - The address of the fee payer (optional).\n * - secondarySignerAddresses - An array of secondary signer addresses (optional).\n * - rawTransaction - The raw transaction data.\n *\n * @returns FeePayerRawTransaction | MultiAgentRawTransaction | RawTransaction\n */\nexport function deriveTransactionType(transaction: AnyRawTransaction): AnyRawTransactionInstance {\n if (transaction.feePayerAddress) {\n return new FeePayerRawTransaction(\n transaction.rawTransaction,\n transaction.secondarySignerAddresses ?? [],\n transaction.feePayerAddress,\n );\n }\n if (transaction.secondarySignerAddresses) {\n return new MultiAgentRawTransaction(transaction.rawTransaction, transaction.secondarySignerAddresses);\n }\n\n return transaction.rawTransaction;\n}\n\n/**\n * Generates the 'signing message' form of a message to be signed.\n * This function combines a domain separator with the byte representation of the message to create a signing message.\n *\n * @param bytes - The byte representation of the message to be signed and sent to the chain.\n * @param domainSeparator - A domain separator that starts with 'APTOS::'.\n *\n * @returns The Uint8Array of the signing message.\n */\nexport function generateSigningMessage(bytes: Uint8Array, domainSeparator: string): Uint8Array {\n const hash = sha3Hash.create();\n\n if (!domainSeparator.startsWith(\"APTOS::\")) {\n throw new Error(`Domain separator needs to start with 'APTOS::'. Provided - ${domainSeparator}`);\n }\n\n hash.update(domainSeparator);\n\n const prefix = hash.digest();\n\n const body = bytes;\n\n const mergedArray = new Uint8Array(prefix.length + body.length);\n mergedArray.set(prefix);\n mergedArray.set(body, prefix.length);\n\n return mergedArray;\n}\n\n/**\n * @deprecated\n * Use CryptoHashable instead by having your class implement it and call hash() to get the signing message.\n *\n * Generates the 'signing message' form of a serializable value by serializing it and using the constructor name as the domain\n * separator.\n *\n * @param serializable - An object that has a BCS serialized form.\n *\n * @returns The Uint8Array of the signing message.\n */\nexport function generateSigningMessageForSerializable(serializable: Serializable): Uint8Array {\n return generateSigningMessage(serializable.bcsToBytes(), `APTOS::${serializable.constructor.name}`);\n}\n\n/**\n * Generates the 'signing message' form of a transaction by deriving the type of transaction and applying the appropriate domain\n * separator based on the presence of a fee payer or secondary signers.\n *\n * @param transaction - A transaction that is to be signed, which can include a fee payer address or secondary signer addresses.\n *\n * @returns The Uint8Array of the signing message.\n */\nexport function generateSigningMessageForTransaction(transaction: AnyRawTransaction): Uint8Array {\n const rawTxn = deriveTransactionType(transaction);\n if (transaction.feePayerAddress) {\n return generateSigningMessage(rawTxn.bcsToBytes(), RAW_TRANSACTION_WITH_DATA_SALT);\n }\n if (transaction.secondarySignerAddresses) {\n return generateSigningMessage(rawTxn.bcsToBytes(), RAW_TRANSACTION_WITH_DATA_SALT);\n }\n return generateSigningMessage(rawTxn.bcsToBytes(), RAW_TRANSACTION_SALT);\n}\n"],"mappings":"gGAMA,OAAS,YAAYA,MAAgB,qBAkB9B,SAASC,EAAsBC,EAA2D,CAC/F,OAAIA,EAAY,gBACP,IAAIC,EACTD,EAAY,eACZA,EAAY,0BAA4B,CAAC,EACzCA,EAAY,eACd,EAEEA,EAAY,yBACP,IAAIE,EAAyBF,EAAY,eAAgBA,EAAY,wBAAwB,EAG/FA,EAAY,cACrB,CAWO,SAASG,EAAuBC,EAAmBC,EAAqC,CAC7F,IAAMC,EAAOC,EAAS,OAAO,EAE7B,GAAI,CAACF,EAAgB,WAAW,SAAS,EACvC,MAAM,IAAI,MAAM,+DAA+DA,CAAe,EAAE,EAGlGC,EAAK,OAAOD,CAAe,EAE3B,IAAMG,EAASF,EAAK,OAAO,EAErBG,EAAOL,EAEPM,EAAc,IAAI,WAAWF,EAAO,OAASC,EAAK,MAAM,EAC9D,OAAAC,EAAY,IAAIF,CAAM,EACtBE,EAAY,IAAID,EAAMD,EAAO,MAAM,EAE5BE,CACT,CAaO,SAASC,EAAsCC,EAAwC,CAC5F,OAAOT,EAAuBS,EAAa,WAAW,EAAG,UAAUA,EAAa,YAAY,IAAI,EAAE,CACpG,CAUO,SAASC,EAAqCb,EAA4C,CAC/F,IAAMc,EAASf,EAAsBC,CAAW,EAChD,OAAIA,EAAY,gBACPG,EAAuBW,EAAO,WAAW,EAAGC,CAA8B,EAE/Ef,EAAY,yBACPG,EAAuBW,EAAO,WAAW,EAAGC,CAA8B,EAE5EZ,EAAuBW,EAAO,WAAW,EAAGE,CAAoB,CACzE","names":["sha3Hash","deriveTransactionType","transaction","FeePayerRawTransaction","MultiAgentRawTransaction","generateSigningMessage","bytes","domainSeparator","hash","sha3Hash","prefix","body","mergedArray","generateSigningMessageForSerializable","serializable","generateSigningMessageForTransaction","rawTxn","RAW_TRANSACTION_WITH_DATA_SALT","RAW_TRANSACTION_SALT"]}
@@ -1,2 +1,2 @@
1
- import{b as h,c as d,e as m}from"./chunk-SRPI2FFA.mjs";import{a as p,b as u}from"./chunk-3MCYLML2.mjs";import{c as s}from"./chunk-DAJOX4PL.mjs";import{a as l}from"./chunk-KEYAPEAX.mjs";import{a as c}from"./chunk-HPZ2S4FE.mjs";import{b as y}from"./chunk-BCUSI3N6.mjs";import{b,c as K}from"./chunk-UAL27G6B.mjs";import{randomBytes as E}from"@noble/hashes/utils";var S=1209600,i=class i extends c{constructor(e){super();let{privateKey:r,expiryDateSecs:a,blinder:n}=e;this.privateKey=r,this.publicKey=new p(r.publicKey()),this.expiryDateSecs=a||K(b()+S),this.blinder=n!==void 0?y.fromHexInput(n).toUint8Array():v();let t=h(this.publicKey.bcsToBytes(),93);t.push(BigInt(this.expiryDateSecs)),t.push(d(this.blinder));let x=m(t);this.nonce=x.toString()}getPublicKey(){return this.publicKey}isExpired(){return Math.floor(Date.now()/1e3)>this.expiryDateSecs}serialize(e){e.serializeU32AsUleb128(this.publicKey.variant),e.serializeBytes(this.privateKey.toUint8Array()),e.serializeU64(this.expiryDateSecs),e.serializeFixedBytes(this.blinder)}static deserialize(e){let r=e.deserializeUleb128AsU32(),a;switch(r){case 0:a=s.deserialize(e);break;default:throw new Error(`Unknown variant index for EphemeralPublicKey: ${r}`)}let n=e.deserializeU64(),t=e.deserializeFixedBytes(31);return new i({privateKey:a,expiryDateSecs:Number(n),blinder:t})}static fromBytes(e){return i.deserialize(new l(e))}static generate(e){let r;switch(e?.scheme){case 0:default:r=s.generate()}return new i({privateKey:r,expiryDateSecs:e?.expiryDateSecs})}sign(e){if(this.isExpired())throw new Error("EphemeralKeyPair has expired");return new u(this.privateKey.sign(e))}};i.BLINDER_LENGTH=31;var o=i;function v(){return E(o.BLINDER_LENGTH)}export{o as a};
2
- //# sourceMappingURL=chunk-B2CXRZL5.mjs.map
1
+ import{b as h,c as d,e as m}from"./chunk-GMKKHGXK.mjs";import{a as p,b as u}from"./chunk-OAEDFM7T.mjs";import{c as s}from"./chunk-P3J54CQG.mjs";import{a as l}from"./chunk-N47FTRYO.mjs";import{a as c}from"./chunk-QQIVWB6G.mjs";import{b as y}from"./chunk-KFNDDPOW.mjs";import{b,c as K}from"./chunk-LEKBJ2EG.mjs";import{randomBytes as E}from"@noble/hashes/utils";var S=1209600,i=class i extends c{constructor(e){super();let{privateKey:r,expiryDateSecs:a,blinder:n}=e;this.privateKey=r,this.publicKey=new p(r.publicKey()),this.expiryDateSecs=a||K(b()+S),this.blinder=n!==void 0?y.fromHexInput(n).toUint8Array():v();let t=h(this.publicKey.bcsToBytes(),93);t.push(BigInt(this.expiryDateSecs)),t.push(d(this.blinder));let x=m(t);this.nonce=x.toString()}getPublicKey(){return this.publicKey}isExpired(){return Math.floor(Date.now()/1e3)>this.expiryDateSecs}serialize(e){e.serializeU32AsUleb128(this.publicKey.variant),e.serializeBytes(this.privateKey.toUint8Array()),e.serializeU64(this.expiryDateSecs),e.serializeFixedBytes(this.blinder)}static deserialize(e){let r=e.deserializeUleb128AsU32(),a;switch(r){case 0:a=s.deserialize(e);break;default:throw new Error(`Unknown variant index for EphemeralPublicKey: ${r}`)}let n=e.deserializeU64(),t=e.deserializeFixedBytes(31);return new i({privateKey:a,expiryDateSecs:Number(n),blinder:t})}static fromBytes(e){return i.deserialize(new l(e))}static generate(e){let r;switch(e?.scheme){case 0:default:r=s.generate()}return new i({privateKey:r,expiryDateSecs:e?.expiryDateSecs})}sign(e){if(this.isExpired())throw new Error("EphemeralKeyPair has expired");return new u(this.privateKey.sign(e))}};i.BLINDER_LENGTH=31;var o=i;function v(){return E(o.BLINDER_LENGTH)}export{o as a};
2
+ //# sourceMappingURL=chunk-WV2VJQDS.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/account/EphemeralKeyPair.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { randomBytes } from \"@noble/hashes/utils\";\n\nimport {\n bytesToBigIntLE,\n padAndPackBytesWithLen,\n poseidonHash,\n Ed25519PrivateKey,\n EphemeralPublicKey,\n EphemeralSignature,\n PrivateKey,\n} from \"../core/crypto\";\nimport { Hex } from \"../core/hex\";\nimport { EphemeralPublicKeyVariant, HexInput } from \"../types\";\nimport { Deserializer, Serializable, Serializer } from \"../bcs\";\nimport { floorToWholeHour, nowInSeconds } from \"../utils/helpers\";\n\nconst TWO_WEEKS_IN_SECONDS = 1_209_600;\n\n/**\n * Represents an ephemeral key pair used for signing transactions via the Keyless authentication scheme.\n * This key pair is temporary and includes an expiration time.\n * For more details on how this class is used, refer to the documentation:\n * https://aptos.dev/guides/keyless-accounts/#1-present-the-user-with-a-sign-in-with-idp-button-on-the-ui\n */\nexport class EphemeralKeyPair extends Serializable {\n static readonly BLINDER_LENGTH: number = 31;\n\n /**\n * A byte array of length BLINDER_LENGTH used to obfuscate the public key from the IdP.\n * Used in calculating the nonce passed to the IdP and as a secret witness in proof generation.\n */\n readonly blinder: Uint8Array;\n\n /**\n * A timestamp in seconds indicating when the ephemeral key pair is expired. After expiry, a new\n * EphemeralKeyPair must be generated and a new JWT needs to be created.\n */\n readonly expiryDateSecs: number;\n\n /**\n * The value passed to the IdP when the user authenticates. It consists of a hash of the\n * ephemeral public key, expiry date, and blinder.\n */\n readonly nonce: string;\n\n /**\n * A private key used to sign transactions. This private key is not tied to any account on the chain as it\n * is ephemeral (not permanent) in nature.\n */\n private privateKey: PrivateKey;\n\n /**\n * A public key used to verify transactions. This public key is not tied to any account on the chain as it\n * is ephemeral (not permanent) in nature.\n */\n private publicKey: EphemeralPublicKey;\n\n /**\n * Creates an instance of the class with a specified private key, optional expiry date, and optional blinder.\n * This constructor initializes the public key, sets the expiry date to a default value if not provided,\n * generates a blinder if not supplied, and calculates the nonce based on the public key, expiry date, and blinder.\n *\n * @param args - The parameters for constructing the instance.\n * @param args.privateKey - The private key used for creating the instance.\n * @param args.expiryDateSecs - Optional expiry date in seconds from the current time. Defaults to two weeks from now.\n * @param args.blinder - Optional blinder value. If not provided, a new blinder will be generated.\n */\n constructor(args: { privateKey: PrivateKey; expiryDateSecs?: number; blinder?: HexInput }) {\n super();\n const { privateKey, expiryDateSecs, blinder } = args;\n this.privateKey = privateKey;\n this.publicKey = new EphemeralPublicKey(privateKey.publicKey());\n // By default, we set the expiry date to be two weeks in the future floored to the nearest hour\n this.expiryDateSecs = expiryDateSecs || floorToWholeHour(nowInSeconds() + TWO_WEEKS_IN_SECONDS);\n // Generate the blinder if not provided\n this.blinder = blinder !== undefined ? Hex.fromHexInput(blinder).toUint8Array() : generateBlinder();\n // Calculate the nonce\n const fields = padAndPackBytesWithLen(this.publicKey.bcsToBytes(), 93);\n fields.push(BigInt(this.expiryDateSecs));\n fields.push(bytesToBigIntLE(this.blinder));\n const nonceHash = poseidonHash(fields);\n this.nonce = nonceHash.toString();\n }\n\n /**\n * Returns the public key of the key pair.\n * @return EphemeralPublicKey\n */\n getPublicKey(): EphemeralPublicKey {\n return this.publicKey;\n }\n\n /**\n * Checks if the current time has surpassed the expiry date of the key pair.\n * @return boolean - Returns true if the key pair is expired, otherwise false.\n */\n isExpired(): boolean {\n const currentTimeSecs: number = Math.floor(Date.now() / 1000);\n return currentTimeSecs > this.expiryDateSecs;\n }\n\n /**\n * Serializes the object's properties into a format suitable for transmission or storage.\n * This function is essential for preparing the object data for serialization processes.\n *\n * @param serializer - The serializer instance used to serialize the object's properties.\n */\n serialize(serializer: Serializer): void {\n serializer.serializeU32AsUleb128(this.publicKey.variant);\n serializer.serializeBytes(this.privateKey.toUint8Array());\n serializer.serializeU64(this.expiryDateSecs);\n serializer.serializeFixedBytes(this.blinder);\n }\n\n /**\n * Deserializes an ephemeral key pair from the provided deserializer.\n * This function helps in reconstructing an ephemeral key pair, which is essential for cryptographic operations.\n *\n * @param deserializer - The deserializer instance used to read the serialized data.\n */\n static deserialize(deserializer: Deserializer): EphemeralKeyPair {\n const variantIndex = deserializer.deserializeUleb128AsU32();\n let privateKey: PrivateKey;\n switch (variantIndex) {\n case EphemeralPublicKeyVariant.Ed25519:\n privateKey = Ed25519PrivateKey.deserialize(deserializer);\n break;\n default:\n throw new Error(`Unknown variant index for EphemeralPublicKey: ${variantIndex}`);\n }\n const expiryDateSecs = deserializer.deserializeU64();\n const blinder = deserializer.deserializeFixedBytes(31);\n return new EphemeralKeyPair({ privateKey, expiryDateSecs: Number(expiryDateSecs), blinder });\n }\n\n /**\n * Deserialize a byte array into an EphemeralKeyPair object.\n * This function allows you to reconstruct an EphemeralKeyPair from its serialized byte representation.\n *\n * @param bytes - The byte array representing the serialized EphemeralKeyPair.\n */\n static fromBytes(bytes: Uint8Array): EphemeralKeyPair {\n return EphemeralKeyPair.deserialize(new Deserializer(bytes));\n }\n\n /**\n * Generates a new ephemeral key pair with an optional expiry date.\n * This function allows you to create a temporary key pair for secure operations.\n *\n * @param args - Optional parameters for key pair generation.\n * @param args.scheme - The type of key pair to use for the EphemeralKeyPair. Only Ed25519 is supported for now.\n * @param args.expiryDateSecs - The date of expiry for the key pair in seconds.\n * @returns An instance of EphemeralKeyPair containing the generated private key and expiry date.\n */\n static generate(args?: { scheme?: EphemeralPublicKeyVariant; expiryDateSecs?: number }): EphemeralKeyPair {\n let privateKey: PrivateKey;\n\n switch (args?.scheme) {\n case EphemeralPublicKeyVariant.Ed25519:\n default:\n privateKey = Ed25519PrivateKey.generate();\n }\n\n return new EphemeralKeyPair({ privateKey, expiryDateSecs: args?.expiryDateSecs });\n }\n\n /**\n * Sign the given data using the private key, returning an ephemeral signature.\n * This function is essential for creating a secure signature that can be used for authentication or verification purposes.\n *\n * @param data - The data to be signed, provided in HexInput format.\n * @returns EphemeralSignature - The resulting ephemeral signature.\n * @throws Error - Throws an error if the EphemeralKeyPair has expired.\n */\n sign(data: HexInput): EphemeralSignature {\n if (this.isExpired()) {\n throw new Error(\"EphemeralKeyPair has expired\");\n }\n return new EphemeralSignature(this.privateKey.sign(data));\n }\n}\n\n/**\n * Generates a random byte array of length EphemeralKeyPair.BLINDER_LENGTH.\n * @returns Uint8Array A random byte array used for blinding.\n */\nfunction generateBlinder(): Uint8Array {\n return randomBytes(EphemeralKeyPair.BLINDER_LENGTH);\n}\n"],"mappings":"sTAGA,OAAS,eAAAA,MAAmB,sBAgB5B,IAAMC,EAAuB,QAQhBC,EAAN,MAAMA,UAAyBC,CAAa,CA2CjD,YAAYC,EAA+E,CACzF,MAAM,EACN,GAAM,CAAE,WAAAC,EAAY,eAAAC,EAAgB,QAAAC,CAAQ,EAAIH,EAChD,KAAK,WAAaC,EAClB,KAAK,UAAY,IAAIG,EAAmBH,EAAW,UAAU,CAAC,EAE9D,KAAK,eAAiBC,GAAkBG,EAAiBC,EAAa,EAAIT,CAAoB,EAE9F,KAAK,QAAUM,IAAY,OAAYI,EAAI,aAAaJ,CAAO,EAAE,aAAa,EAAIK,EAAgB,EAElG,IAAMC,EAASC,EAAuB,KAAK,UAAU,WAAW,EAAG,EAAE,EACrED,EAAO,KAAK,OA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ACK,eAAyB,GADpC,IAAMwB,EAANxB,EAkKP,SAASU,GAA8B,CACrC,OAAOe,EAAYD,EAAiB,cAAc,CACpD","names":["randomBytes","TWO_WEEKS_IN_SECONDS","_EphemeralKeyPair","Serializable","args","privateKey","expiryDateSecs","blinder","EphemeralPublicKey","floorToWholeHour","nowInSeconds","Hex","generateBlinder","fields","padAndPackBytesWithLen","bytesToBigIntLE","nonceHash","poseidonHash","serializer","deserializer","variantIndex","Ed25519PrivateKey","bytes","Deserializer","data","EphemeralSignature","EphemeralKeyPair","randomBytes"]}
@@ -1,2 +1,2 @@
1
- import{d as p}from"./chunk-KXBIA4KR.mjs";import{d as s}from"./chunk-TMW2HIXC.mjs";import{a as u,b as y}from"./chunk-U67PFBTL.mjs";import{b as a}from"./chunk-LGD5KU56.mjs";import{c as i}from"./chunk-DAJOX4PL.mjs";import{b as g}from"./chunk-QPP6BX53.mjs";var h=class c{constructor(e){this.signingScheme=2;let{privateKey:r,address:t}=e;this.privateKey=r,this.publicKey=new u(r.publicKey()),this.accountAddress=t?g.from(t):this.publicKey.authKey().derivedAddress()}static generate(e={}){let{scheme:r=0}=e,t;switch(r){case 0:t=i.generate();break;case 2:t=a.generate();break;default:throw new Error(`Unsupported signature scheme ${r}`)}return new c({privateKey:t})}static fromDerivationPath(e){let{scheme:r=0,path:t,mnemonic:o}=e,n;switch(r){case 0:n=i.fromDerivationPath(t,o);break;case 2:n=a.fromDerivationPath(t,o);break;default:throw new Error(`Unsupported signature scheme ${r}`)}return new c({privateKey:n})}verifySignature(e){return this.publicKey.verifySignature(e)}signWithAuthenticator(e){return new s(this.publicKey,this.sign(e))}signTransactionWithAuthenticator(e){return new s(this.publicKey,this.signTransaction(e))}sign(e){return new y(this.privateKey.sign(e))}signTransaction(e){return this.sign(p(e))}};export{h as a};
2
- //# sourceMappingURL=chunk-B6M7QBUO.mjs.map
1
+ import{d as p}from"./chunk-WSZCPSV4.mjs";import{d as s}from"./chunk-MK2QAHXC.mjs";import{a as u,b as y}from"./chunk-TPJLAYW6.mjs";import{b as a}from"./chunk-4VU2ABLU.mjs";import{c as i}from"./chunk-P3J54CQG.mjs";import{b as g}from"./chunk-KM6UXNC7.mjs";var h=class c{constructor(e){this.signingScheme=2;let{privateKey:r,address:t}=e;this.privateKey=r,this.publicKey=new u(r.publicKey()),this.accountAddress=t?g.from(t):this.publicKey.authKey().derivedAddress()}static generate(e={}){let{scheme:r=0}=e,t;switch(r){case 0:t=i.generate();break;case 2:t=a.generate();break;default:throw new Error(`Unsupported signature scheme ${r}`)}return new c({privateKey:t})}static fromDerivationPath(e){let{scheme:r=0,path:t,mnemonic:o}=e,n;switch(r){case 0:n=i.fromDerivationPath(t,o);break;case 2:n=a.fromDerivationPath(t,o);break;default:throw new Error(`Unsupported signature scheme ${r}`)}return new c({privateKey:n})}verifySignature(e){return this.publicKey.verifySignature(e)}signWithAuthenticator(e){return new s(this.publicKey,this.sign(e))}signTransactionWithAuthenticator(e){return new s(this.publicKey,this.signTransaction(e))}sign(e){return new y(this.privateKey.sign(e))}signTransaction(e){return this.sign(p(e))}};export{h as a};
2
+ //# sourceMappingURL=chunk-WZCKSN2U.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/account/SingleKeyAccount.ts"],"sourcesContent":["import { AccountAuthenticatorSingleKey } from \"../transactions/authenticator/account\";\nimport { type HexInput, SigningScheme, SigningSchemeInput } from \"../types\";\nimport { AccountAddress, AccountAddressInput } from \"../core/accountAddress\";\nimport { AnyPublicKey, AnySignature, Ed25519PrivateKey, PrivateKey, Secp256k1PrivateKey } from \"../core/crypto\";\nimport type { Account } from \"./Account\";\nimport { generateSigningMessageForTransaction } from \"../transactions/transactionBuilder/signingMessage\";\nimport { AnyRawTransaction } from \"../transactions/types\";\n\n/**\n * Arguments required to create a single key signer.\n *\n * @param privateKey - The private key used for signing.\n * @param address - Optional account address associated with the signer.\n */\nexport interface SingleKeySignerConstructorArgs {\n privateKey: PrivateKey;\n address?: AccountAddressInput;\n}\n\n/**\n * Arguments for generating a single key signer.\n *\n * @param scheme - The signing scheme to be used.\n */\nexport interface SingleKeySignerGenerateArgs {\n scheme?: SigningSchemeInput;\n}\n\n/**\n * The arguments for generating a single key signer from a specified derivation path.\n */\nexport type SingleKeySignerFromDerivationPathArgs = SingleKeySignerGenerateArgs & {\n path: string;\n mnemonic: string;\n};\n\n/**\n * Arguments required to verify a single key signature for a given message.\n *\n * @param message - The message to be verified, represented in hexadecimal format.\n * @param signature - The signature that corresponds to the message.\n */\nexport interface VerifySingleKeySignatureArgs {\n message: HexInput;\n signature: AnySignature;\n}\n\n/**\n * Signer implementation for the SingleKey authentication scheme.\n * This class extends a SingleKeyAccount by adding signing capabilities through a valid private key.\n * Currently, the only supported signature schemes are Ed25519 and Secp256k1.\n *\n * Note: Generating a signer instance does not create the account on-chain.\n */\nexport class SingleKeyAccount implements Account {\n /**\n * Private key associated with the account\n */\n readonly privateKey: PrivateKey;\n\n readonly publicKey: AnyPublicKey;\n\n readonly accountAddress: AccountAddress;\n\n readonly signingScheme = SigningScheme.SingleKey;\n\n /**\n * Creates an instance of the SingleKeySigner using the provided private key and address.\n * This allows for signing transactions and messages with the specified private key.\n *\n * @param args - The constructor arguments for initializing the SingleKeySigner.\n * @param args.privateKey - The private key used for signing.\n * @param args.address - The optional account address; if not provided, it will derive the address from the public key.\n */\n constructor(args: SingleKeySignerConstructorArgs) {\n const { privateKey, address } = args;\n this.privateKey = privateKey;\n this.publicKey = new AnyPublicKey(privateKey.publicKey());\n this.accountAddress = address ? AccountAddress.from(address) : this.publicKey.authKey().derivedAddress();\n }\n\n /**\n * Derives an account from a randomly generated private key based on the specified signing scheme.\n * The default generation scheme is Ed25519, but it can also support Secp256k1Ecdsa.\n *\n * @param args - The arguments for generating the account.\n * @param args.scheme - The signing scheme to use for generating the private key. Defaults to SigningSchemeInput.Ed25519.\n * @returns An account with the generated private key based on the specified signing scheme.\n * @throws Error if an unsupported signature scheme is provided.\n */\n static generate(args: SingleKeySignerGenerateArgs = {}) {\n const { scheme = SigningSchemeInput.Ed25519 } = args;\n let privateKey: PrivateKey;\n switch (scheme) {\n case SigningSchemeInput.Ed25519:\n privateKey = Ed25519PrivateKey.generate();\n break;\n case SigningSchemeInput.Secp256k1Ecdsa:\n privateKey = Secp256k1PrivateKey.generate();\n break;\n default:\n throw new Error(`Unsupported signature scheme ${scheme}`);\n }\n return new SingleKeyAccount({ privateKey });\n }\n\n /**\n * Derives an account using a specified BIP44 path and mnemonic seed phrase, defaulting to the Ed25519 signature scheme.\n * This function allows you to create a single key account based on the provided derivation path and mnemonic.\n *\n * @param args - The arguments for deriving the account.\n * @param args.scheme - The signature scheme to derive the private key with. Defaults to Ed25519.\n * @param args.path - The BIP44 derive hardened path (e.g. m/44'/637'/0'/0'/0') for Ed25519, or non-hardened path\n * (e.g. m/44'/637'/0'/0/0) for secp256k1.\n * Detailed description: {@link https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki}\n * @param args.mnemonic - The mnemonic seed phrase of the account.\n */\n static fromDerivationPath(args: SingleKeySignerFromDerivationPathArgs) {\n const { scheme = SigningSchemeInput.Ed25519, path, mnemonic } = args;\n let privateKey: PrivateKey;\n switch (scheme) {\n case SigningSchemeInput.Ed25519:\n privateKey = Ed25519PrivateKey.fromDerivationPath(path, mnemonic);\n break;\n case SigningSchemeInput.Secp256k1Ecdsa:\n privateKey = Secp256k1PrivateKey.fromDerivationPath(path, mnemonic);\n break;\n default:\n throw new Error(`Unsupported signature scheme ${scheme}`);\n }\n return new SingleKeyAccount({ privateKey });\n }\n\n /**\n * Verify the given message and signature with the public key.\n *\n * @param args - The arguments for verifying the signature.\n * @param args.message - The raw message data in HexInput format.\n * @param args.signature - The signed message signature.\n * @returns A boolean indicating whether the signature is valid.\n */\n verifySignature(args: VerifySingleKeySignatureArgs): boolean {\n return this.publicKey.verifySignature(args);\n }\n\n /**\n * Sign a message using the account's private key and return an AccountAuthenticator containing the signature along with the\n * account's public key.\n * @param message - The signing message, represented as binary input in hexadecimal format.\n * @returns An instance of AccountAuthenticatorSingleKey containing the signature and the public key.\n */\n signWithAuthenticator(message: HexInput): AccountAuthenticatorSingleKey {\n return new AccountAuthenticatorSingleKey(this.publicKey, this.sign(message));\n }\n\n /**\n * Sign a transaction using the account's private key.\n * This function returns an AccountAuthenticator that contains the signature of the transaction along with the account's public key.\n * @param transaction - The raw transaction to be signed.\n * @returns An AccountAuthenticatorSingleKey containing the signature of the transaction and the account's public key.\n */\n signTransactionWithAuthenticator(transaction: AnyRawTransaction): AccountAuthenticatorSingleKey {\n return new AccountAuthenticatorSingleKey(this.publicKey, this.signTransaction(transaction));\n }\n\n /**\n * Sign the given message using the account's private key.\n * @param message - The message to be signed in HexInput format.\n * @returns A new AnySignature containing the signature of the message.\n */\n sign(message: HexInput): AnySignature {\n return new AnySignature(this.privateKey.sign(message));\n }\n\n /**\n * Sign the given transaction using the account's private key.\n * This function generates a signing message for the transaction and then signs it.\n *\n * @param transaction - The transaction to be signed.\n * @returns Signature - The resulting signature for the signed transaction.\n */\n signTransaction(transaction: AnyRawTransaction): AnySignature {\n return this.sign(generateSigningMessageForTransaction(transaction));\n }\n\n // endregion\n}\n"],"mappings":"6PAsDO,IAAMA,EAAN,MAAMC,CAAoC,CAoB/C,YAAYC,EAAsC,CAVlD,KAAS,cAAgB,EAWvB,GAAM,CAAE,WAAAC,EAAY,QAAAC,CAAQ,EAAIF,EAChC,KAAK,WAAaC,EAClB,KAAK,UAAY,IAAIE,EAAaF,EAAW,UAAU,CAAC,EACxD,KAAK,eAAiBC,EAAUE,EAAe,KAAKF,CAAO,EAAI,KAAK,UAAU,QAAQ,EAAE,eAAe,CACzG,CAWA,OAAO,SAASF,EAAoC,CAAC,EAAG,CACtD,GAAM,CAAE,OAAAK,GAAoC,EAAIL,EAC5CC,EACJ,OAAQI,EAAQ,CACd,OACEJ,EAAaK,EAAkB,SAAS,EACxC,MACF,OACEL,EAAaM,EAAoB,SAAS,EAC1C,MACF,QACE,MAAM,IAAI,MAAM,gCAAgCF,CAAM,EAAE,CAC5D,CACA,OAAO,IAAIN,EAAiB,CAAE,WAAAE,CAAW,CAAC,CAC5C,CAaA,OAAO,mBAAmBD,EAA6C,CACrE,GAAM,CAAE,OAAAK,IAAqC,KAAAG,EAAM,SAAAC,CAAS,EAAIT,EAC5DC,EACJ,OAAQI,EAAQ,CACd,OACEJ,EAAaK,EAAkB,mBAAmBE,EAAMC,CAAQ,EAChE,MACF,OACER,EAAaM,EAAoB,mBAAmBC,EAAMC,CAAQ,EAClE,MACF,QACE,MAAM,IAAI,MAAM,gCAAgCJ,CAAM,EAAE,CAC5D,CACA,OAAO,IAAIN,EAAiB,CAAE,WAAAE,CAAW,CAAC,CAC5C,CAUA,gBAAgBD,EAA6C,CAC3D,OAAO,KAAK,UAAU,gBAAgBA,CAAI,CAC5C,CAQA,sBAAsBU,EAAkD,CACtE,OAAO,IAAIC,EAA8B,KAAK,UAAW,KAAK,KAAKD,CAAO,CAAC,CAC7E,CAQA,iCAAiCE,EAA+D,CAC9F,OAAO,IAAID,EAA8B,KAAK,UAAW,KAAK,gBAAgBC,CAAW,CAAC,CAC5F,CAOA,KAAKF,EAAiC,CACpC,OAAO,IAAIG,EAAa,KAAK,WAAW,KAAKH,CAAO,CAAC,CACvD,CASA,gBAAgBE,EAA8C,CAC5D,OAAO,KAAK,KAAKE,EAAqCF,CAAW,CAAC,CACpE,CAGF","names":["SingleKeyAccount","_SingleKeyAccount","args","privateKey","address","AnyPublicKey","AccountAddress","scheme","Ed25519PrivateKey","Secp256k1PrivateKey","path","mnemonic","message","AccountAuthenticatorSingleKey","transaction","AnySignature","generateSigningMessageForTransaction"]}
@@ -1,2 +1,2 @@
1
- import{a as i}from"./chunk-6EMN3BOV.mjs";import{h as a}from"./chunk-WWZ3METZ.mjs";import{a as o}from"./chunk-FVA2OPG4.mjs";var n=class{constructor(t){this.config=t}async simple(t){return a({aptosConfig:this.config,...t})}async multiAgent(t){return a({aptosConfig:this.config,...t})}};o([i],n.prototype,"simple",1),o([i],n.prototype,"multiAgent",1);export{n as a};
2
- //# sourceMappingURL=chunk-25TIHDS6.mjs.map
1
+ import{a as i}from"./chunk-I2NMCLNW.mjs";import{h as a}from"./chunk-5S3Z7MT4.mjs";import{a as o}from"./chunk-KDMSOCZY.mjs";var n=class{constructor(t){this.config=t}async simple(t){return a({aptosConfig:this.config,...t})}async multiAgent(t){return a({aptosConfig:this.config,...t})}};o([i],n.prototype,"simple",1),o([i],n.prototype,"multiAgent",1);export{n as a};
2
+ //# sourceMappingURL=chunk-XFJD6QIP.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/api/transactionSubmission/submit.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { submitTransaction } from \"../../internal/transactionSubmission\";\nimport { AccountAuthenticator, AnyRawTransaction } from \"../../transactions\";\nimport { PendingTransactionResponse } from \"../../types\";\nimport { AptosConfig } from \"../aptosConfig\";\nimport { ValidateFeePayerDataOnSubmission } from \"./helpers\";\n\n/**\n * A class to handle all `Submit` transaction operations.\n */\nexport class Submit {\n readonly config: AptosConfig;\n\n /**\n * Initializes a new instance of the Aptos client with the specified configuration.\n * This allows you to interact with the Aptos blockchain using the provided settings.\n *\n * @param config - The configuration settings for the Aptos client.\n * @param config.network - The network to connect to (e.g., TESTNET, MAINNET).\n * @param config.nodeUrl - The URL of the Aptos node to connect to.\n * @param config.faucetUrl - The URL of the faucet for obtaining test tokens.\n *\n * @example\n * ```typescript\n * import { Aptos, AptosConfig, Network } from \"@aptos-labs/ts-sdk\";\n *\n * async function runExample() {\n * // Create a configuration for the Aptos client\n * const config = new AptosConfig({\n * network: Network.TESTNET, // Use the TESTNET for testing\n * nodeUrl: \"https://testnet.aptos.dev\", // Specify the node URL\n * faucetUrl: \"https://faucet.testnet.aptos.dev\" // Specify the faucet URL\n * });\n *\n * // Initialize the Aptos client with the configuration\n * const aptos = new Aptos(config);\n *\n * console.log(\"Aptos client initialized:\", aptos);\n * }\n * runExample().catch(console.error);\n * ```\n */\n constructor(config: AptosConfig) {\n this.config = config;\n }\n\n /**\n * Submits a transaction to the Aptos blockchain using the provided transaction details and authenticators.\n * This function allows you to execute transactions securely by specifying the sender and optional fee payer authenticators.\n *\n * @param args - The arguments for submitting the transaction.\n * @param args.transaction - The raw transaction data to be submitted.\n * @param args.senderAuthenticator - The authenticator for the sender's account.\n * @param [args.feePayerAuthenticator] - The optional authenticator for the fee payer's account.\n *\n * @example\n * ```typescript\n * import { Aptos, AptosConfig, Network, Account } from \"@aptos-labs/ts-sdk\";\n *\n * const config = new AptosConfig({ network: Network.TESTNET });\n * const aptos = new Aptos(config);\n *\n * async function runExample() {\n * const sender = Account.generate(); // Generate a new sender account\n * const transaction = await aptos.transaction.build.simple({\n * sender: sender.accountAddress,\n * data: {\n * function: \"0x1::aptos_account::transfer\",\n * functionArguments: [Account.generate().accountAddress, 100], // Replace with a real destination account\n * },\n * });\n *\n * // Submit the transaction\n * const response = await aptos.simple({\n * transaction,\n * senderAuthenticator: sender.getAuthenticator(), // Use the sender's authenticator\n * });\n *\n * console.log(\"Transaction submitted:\", response);\n * }\n * runExample().catch(console.error);\n * ```\n */\n @ValidateFeePayerDataOnSubmission\n async simple(args: {\n transaction: AnyRawTransaction;\n senderAuthenticator: AccountAuthenticator;\n feePayerAuthenticator?: AccountAuthenticator;\n }): Promise<PendingTransactionResponse> {\n return submitTransaction({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Submits a multi-agent transaction to the Aptos network, allowing multiple signers to authorize the transaction.\n * This function is useful for scenarios where a transaction requires approval from multiple accounts.\n *\n * @param args - The parameters for the multi-agent transaction.\n * @param args.transaction - The raw transaction to be submitted.\n * @param args.senderAuthenticator - The authenticator for the sender account.\n * @param args.additionalSignersAuthenticators - An array of authenticators for additional signers.\n * @param [args.feePayerAuthenticator] - An optional authenticator for the fee payer account.\n *\n * @example\n * ```typescript\n * import { Aptos, AptosConfig, Network, Account } from \"@aptos-labs/ts-sdk\";\n *\n * const config = new AptosConfig({ network: Network.TESTNET });\n * const aptos = new Aptos(config);\n *\n * async function runExample() {\n * const sender = Account.generate(); // Generate a new sender account\n * const additionalSigner1 = Account.generate(); // Generate an additional signer account\n * const additionalSigner2 = Account.generate(); // Generate another additional signer account\n *\n * const transaction = await aptos.transaction.build.simple({\n * sender: sender.accountAddress,\n * data: {\n * function: \"0x1::aptos_account::transfer\",\n * functionArguments: [additionalSigner1.accountAddress, 100],\n * },\n * });\n *\n * const response = await aptos.multiAgent({\n * transaction,\n * senderAuthenticator: sender.getAuthenticator(), // Use the sender's authenticator\n * additionalSignersAuthenticators: [\n * additionalSigner1.getAuthenticator(), // Use the first additional signer's authenticator\n * additionalSigner2.getAuthenticator(), // Use the second additional signer's authenticator\n * ],\n * });\n *\n * console.log(response); // Log the response from the transaction submission\n * }\n * runExample().catch(console.error);\n * ```\n */\n @ValidateFeePayerDataOnSubmission\n async multiAgent(args: {\n transaction: AnyRawTransaction;\n senderAuthenticator: AccountAuthenticator;\n additionalSignersAuthenticators: Array<AccountAuthenticator>;\n feePayerAuthenticator?: AccountAuthenticator;\n }): Promise<PendingTransactionResponse> {\n return submitTransaction({ aptosConfig: this.config, ...args });\n }\n}\n"],"mappings":"2HAYO,IAAMA,EAAN,KAAa,CAgClB,YAAYC,EAAqB,CAC/B,KAAK,OAASA,CAChB,CAwCA,MAAM,OAAOC,EAI2B,CACtC,OAAOC,EAAkB,CAAE,YAAa,KAAK,OAAQ,GAAGD,CAAK,CAAC,CAChE,CA+CA,MAAM,WAAWA,EAKuB,CACtC,OAAOC,EAAkB,CAAE,YAAa,KAAK,OAAQ,GAAGD,CAAK,CAAC,CAChE,CACF,EA7DQE,EAAA,CADLC,GAzEUL,EA0EL,sBAqDAI,EAAA,CADLC,GA9HUL,EA+HL","names":["Submit","config","args","submitTransaction","__decorateClass","ValidateFeePayerDataOnSubmission"]}
@@ -1,2 +1,2 @@
1
- import{c as n}from"./chunk-GFGX3QDP.mjs";import{o as g,t as d}from"./chunk-VHNX2NUR.mjs";import{b as s}from"./chunk-QPP6BX53.mjs";async function m(e){let{aptosConfig:t,poolAddress:o}=e,r=s.from(o).toStringLong(),i=await n({aptosConfig:t,query:{query:d,variables:{where_condition:{pool_address:{_eq:r}}}}});return i.num_active_delegator_per_pool[0]?i.num_active_delegator_per_pool[0].num_active_delegator:0}async function f(e){let{aptosConfig:t,options:o}=e,r={query:d,variables:{order_by:o?.orderBy}};return(await n({aptosConfig:t,query:r})).num_active_delegator_per_pool}async function A(e){let{aptosConfig:t,delegatorAddress:o,poolAddress:r}=e,a={query:g,variables:{delegatorAddress:s.from(o).toStringLong(),poolAddress:s.from(r).toStringLong()}};return(await n({aptosConfig:t,query:a})).delegated_staking_activities}export{m as a,f as b,A as c};
2
- //# sourceMappingURL=chunk-ECWOLU5T.mjs.map
1
+ import{c as n}from"./chunk-BVVHGSWC.mjs";import{o as g,t as d}from"./chunk-VHNX2NUR.mjs";import{b as s}from"./chunk-KM6UXNC7.mjs";async function m(e){let{aptosConfig:t,poolAddress:o}=e,r=s.from(o).toStringLong(),i=await n({aptosConfig:t,query:{query:d,variables:{where_condition:{pool_address:{_eq:r}}}}});return i.num_active_delegator_per_pool[0]?i.num_active_delegator_per_pool[0].num_active_delegator:0}async function f(e){let{aptosConfig:t,options:o}=e,r={query:d,variables:{order_by:o?.orderBy}};return(await n({aptosConfig:t,query:r})).num_active_delegator_per_pool}async function A(e){let{aptosConfig:t,delegatorAddress:o,poolAddress:r}=e,a={query:g,variables:{delegatorAddress:s.from(o).toStringLong(),poolAddress:s.from(r).toStringLong()}};return(await n({aptosConfig:t,query:a})).delegated_staking_activities}export{m as a,f as b,A as c};
2
+ //# sourceMappingURL=chunk-XFY4O2S3.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/internal/staking.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\n/**\n * This file contains the underlying implementations for exposed API surface in\n * the {@link api/staking}. By moving the methods out into a separate file,\n * other namespaces and processes can access these methods without depending on the entire\n * faucet namespace and without having a dependency cycle error.\n */\n\nimport { AptosConfig } from \"../api/aptosConfig\";\nimport { AccountAddress, AccountAddressInput } from \"../core\";\nimport { GetDelegatedStakingActivitiesResponse, GetNumberOfDelegatorsResponse, OrderByArg } from \"../types\";\nimport { GetDelegatedStakingActivitiesQuery, GetNumberOfDelegatorsQuery } from \"../types/generated/operations\";\nimport { GetDelegatedStakingActivities, GetNumberOfDelegators } from \"../types/generated/queries\";\nimport { queryIndexer } from \"./general\";\n\n/**\n * Retrieves the number of active delegators for a specified pool address.\n *\n * @param args - The arguments for the function.\n * @param args.aptosConfig - The configuration object for Aptos.\n * @param args.poolAddress - The address of the pool for which to retrieve the number of delegators.\n * @returns The number of active delegators for the specified pool address.\n */\nexport async function getNumberOfDelegators(args: {\n aptosConfig: AptosConfig;\n poolAddress: AccountAddressInput;\n}): Promise<number> {\n const { aptosConfig, poolAddress } = args;\n const address = AccountAddress.from(poolAddress).toStringLong();\n const query = {\n query: GetNumberOfDelegators,\n variables: { where_condition: { pool_address: { _eq: address } } },\n };\n const data = await queryIndexer<GetNumberOfDelegatorsQuery>({ aptosConfig, query });\n\n // commonjs (aka cjs) doesn't handle Nullish Coalescing for some reason\n // might be because of how ts infer the graphql generated scheme type\n return data.num_active_delegator_per_pool[0] ? data.num_active_delegator_per_pool[0].num_active_delegator : 0;\n}\n\n/**\n * Retrieves the number of active delegators for all pools.\n *\n * @param args - The arguments for the function.\n * @param args.aptosConfig - The configuration for the Aptos client.\n * @param [args.options] - Optional parameters for ordering the results.\n * @param args.options.orderBy - Specifies the order in which to return the results.\n * @returns The number of active delegators per pool.\n */\nexport async function getNumberOfDelegatorsForAllPools(args: {\n aptosConfig: AptosConfig;\n options?: OrderByArg<GetNumberOfDelegatorsResponse[0]>;\n}): Promise<GetNumberOfDelegatorsResponse> {\n const { aptosConfig, options } = args;\n const query = {\n query: GetNumberOfDelegators,\n variables: { order_by: options?.orderBy },\n };\n const data = await queryIndexer<GetNumberOfDelegatorsQuery>({\n aptosConfig,\n query,\n });\n return data.num_active_delegator_per_pool;\n}\n\n/**\n * Retrieves the delegated staking activities for a specified delegator and pool.\n *\n * @param args - The parameters for the query.\n * @param args.aptosConfig - The configuration object for Aptos.\n * @param args.delegatorAddress - The address of the delegator whose activities are being queried.\n * @param args.poolAddress - The address of the pool associated with the delegated staking activities.\n * @returns The delegated staking activities for the specified delegator and pool.\n */\nexport async function getDelegatedStakingActivities(args: {\n aptosConfig: AptosConfig;\n delegatorAddress: AccountAddressInput;\n poolAddress: AccountAddressInput;\n}): Promise<GetDelegatedStakingActivitiesResponse> {\n const { aptosConfig, delegatorAddress, poolAddress } = args;\n const query = {\n query: GetDelegatedStakingActivities,\n variables: {\n delegatorAddress: AccountAddress.from(delegatorAddress).toStringLong(),\n poolAddress: AccountAddress.from(poolAddress).toStringLong(),\n },\n };\n const data = await queryIndexer<GetDelegatedStakingActivitiesQuery>({ aptosConfig, query });\n return data.delegated_staking_activities;\n}\n"],"mappings":"kIAyBA,eAAsBA,EAAsBC,EAGxB,CAClB,GAAM,CAAE,YAAAC,EAAa,YAAAC,CAAY,EAAIF,EAC/BG,EAAUC,EAAe,KAAKF,CAAW,EAAE,aAAa,EAKxDG,EAAO,MAAMC,EAAyC,CAAE,YAAAL,EAAa,MAJ7D,CACZ,MAAOM,EACP,UAAW,CAAE,gBAAiB,CAAE,aAAc,CAAE,IAAKJ,CAAQ,CAAE,CAAE,CACnE,CACiF,CAAC,EAIlF,OAAOE,EAAK,8BAA8B,CAAC,EAAIA,EAAK,8BAA8B,CAAC,EAAE,qBAAuB,CAC9G,CAWA,eAAsBG,EAAiCR,EAGZ,CACzC,GAAM,CAAE,YAAAC,EAAa,QAAAQ,CAAQ,EAAIT,EAC3BU,EAAQ,CACZ,MAAOH,EACP,UAAW,CAAE,SAAUE,GAAS,OAAQ,CAC1C,EAKA,OAJa,MAAMH,EAAyC,CAC1D,YAAAL,EACA,MAAAS,CACF,CAAC,GACW,6BACd,CAWA,eAAsBC,EAA8BX,EAID,CACjD,GAAM,CAAE,YAAAC,EAAa,iBAAAW,EAAkB,YAAAV,CAAY,EAAIF,EACjDU,EAAQ,CACZ,MAAOG,EACP,UAAW,CACT,iBAAkBT,EAAe,KAAKQ,CAAgB,EAAE,aAAa,EACrE,YAAaR,EAAe,KAAKF,CAAW,EAAE,aAAa,CAC7D,CACF,EAEA,OADa,MAAMI,EAAiD,CAAE,YAAAL,EAAa,MAAAS,CAAM,CAAC,GAC9E,4BACd","names":["getNumberOfDelegators","args","aptosConfig","poolAddress","address","AccountAddress","data","queryIndexer","GetNumberOfDelegators","getNumberOfDelegatorsForAllPools","options","query","getDelegatedStakingActivities","delegatorAddress","GetDelegatedStakingActivities"]}
@@ -0,0 +1,2 @@
1
+ import{a as i}from"./chunk-LEKBJ2EG.mjs";import{spawn as n}from"child_process";import l from"tree-kill";import{platform as h}from"os";var c=class{constructor(t){this.MAXIMUM_WAIT_TIME_SEC=75;this.READINESS_ENDPOINT="http://127.0.0.1:8070/";this.showStdout=!0;this.process=null;this.showStdout=t?.showStdout??!0}async stop(){await new Promise((t,s)=>{this.process?.pid&&l(this.process.pid,o=>{o?s(o):t(!0)})})}async run(){await this.checkIfProcessIsUp()||(this.start(),await this.waitUntilProcessIsUp())}start(){let t="npx",s=["aptos","node","run-localnet","--force-restart","--assume-yes","--with-indexer-api"],o=h(),r;o==="win32"?r=n(t,s,{shell:!0}):r=n(t,s),this.process=r,r.stderr?.on("data",e=>{let a=e.toString();console.log(a)}),r.stdout?.on("data",e=>{let a=e.toString();this.showStdout&&console.log(a)})}async waitUntilProcessIsUp(){let t=await this.checkIfProcessIsUp(),s=Date.now()/1e3,o=s;for(;!t&&s+this.MAXIMUM_WAIT_TIME_SEC>o;)await i(1e3),t=await this.checkIfProcessIsUp(),o=Date.now()/1e3;if(!t)throw new Error("Process failed to start");return!0}async checkIfProcessIsUp(){try{return(await fetch(this.READINESS_ENDPOINT)).status===200}catch{return!1}}};export{c as a};
2
+ //# sourceMappingURL=chunk-XOCRDV2V.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/cli/localNode.ts"],"sourcesContent":["/* 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"],"mappings":"yCAEA,OAAyC,SAAAA,MAAa,gBACtD,OAAOC,MAAU,YACjB,OAAS,YAAAC,MAAgB,KASlB,IAAMC,EAAN,KAAgB,CASr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,EACT,CAOA,MAAM,oBAAuC,CAC3C,GAAI,CAGF,OADa,MAAM,MAAM,KAAK,kBAAkB,GACvC,SAAW,GAItB,MAAmB,CACjB,MAAO,EACT,CACF,CACF","names":["spawn","kill","platform","LocalNode","args","resolve","reject","kill","err","cliCommand","cliArgs","currentPlatform","platform","childProcess","spawn","data","str","operational","start","last","sleep"]}
@@ -1,2 +1,2 @@
1
- import{a as n}from"./chunk-5655UVIK.mjs";import{b as a}from"./chunk-QPP6BX53.mjs";import{a as i}from"./chunk-HPZ2S4FE.mjs";var o=class t extends i{constructor(e,r){super(),this.rawTransaction=e,this.feePayerAddress=r}serialize(e){this.rawTransaction.serialize(e),this.feePayerAddress===void 0?e.serializeBool(!1):(e.serializeBool(!0),this.feePayerAddress.serialize(e))}static deserialize(e){let r=n.deserialize(e),d=e.deserializeBool(),s;return d&&(s=a.deserialize(e)),new t(r,s)}};export{o as a};
2
- //# sourceMappingURL=chunk-TL7DR54X.mjs.map
1
+ import{a as n}from"./chunk-4LKLOUMG.mjs";import{b as a}from"./chunk-KM6UXNC7.mjs";import{a as i}from"./chunk-QQIVWB6G.mjs";var o=class t extends i{constructor(e,r){super(),this.rawTransaction=e,this.feePayerAddress=r}serialize(e){this.rawTransaction.serialize(e),this.feePayerAddress===void 0?e.serializeBool(!1):(e.serializeBool(!0),this.feePayerAddress.serialize(e))}static deserialize(e){let r=n.deserialize(e),d=e.deserializeBool(),s;return d&&(s=a.deserialize(e)),new t(r,s)}};export{o as a};
2
+ //# sourceMappingURL=chunk-XQ7ONNII.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/transactions/instances/simpleTransaction.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\n/* eslint-disable @typescript-eslint/naming-convention */\n\nimport { Deserializer } from \"../../bcs/deserializer\";\nimport { Serializable, Serializer } from \"../../bcs/serializer\";\nimport { AccountAddress } from \"../../core\";\nimport { RawTransaction } from \"./rawTransaction\";\n\n/**\n * Represents a simple transaction type that can be submitted to the Aptos chain for execution.\n *\n * This transaction type is designed for a single signer and includes metadata such as the Raw Transaction\n * and an optional sponsor Account Address to cover gas fees.\n *\n * @param rawTransaction - The Raw Transaction.\n * @param feePayerAddress - The optional sponsor Account Address.\n */\nexport class SimpleTransaction extends Serializable {\n public rawTransaction: RawTransaction;\n\n public feePayerAddress?: AccountAddress | undefined;\n\n // We don't really need it, we add it for type checking we do\n // throughout the SDK\n public readonly secondarySignerAddresses: undefined;\n\n /**\n * SimpleTransaction represents a transaction signed by a single account that\n * can be submitted to the Aptos chain for execution.\n *\n * @param rawTransaction The Raw Transaction.\n * @param feePayerAddress The optional sponsor Account Address to pay the gas fees.\n */\n constructor(rawTransaction: RawTransaction, feePayerAddress?: AccountAddress) {\n super();\n this.rawTransaction = rawTransaction;\n this.feePayerAddress = feePayerAddress;\n }\n\n /**\n * Serializes the transaction data using the provided serializer.\n * This function ensures that the raw transaction and fee payer address are properly serialized for further processing.\n *\n * @param serializer - The serializer instance used to serialize the transaction data.\n */\n serialize(serializer: Serializer): void {\n this.rawTransaction.serialize(serializer);\n\n if (this.feePayerAddress === undefined) {\n serializer.serializeBool(false);\n } else {\n serializer.serializeBool(true);\n this.feePayerAddress.serialize(serializer);\n }\n }\n\n /**\n * Deserializes a SimpleTransaction from the given deserializer.\n * This function helps in reconstructing a SimpleTransaction object from its serialized form.\n *\n * @param deserializer - The deserializer instance used to read the serialized data.\n */\n static deserialize(deserializer: Deserializer): SimpleTransaction {\n const rawTransaction = RawTransaction.deserialize(deserializer);\n const feePayerPresent = deserializer.deserializeBool();\n let feePayerAddress;\n if (feePayerPresent) {\n feePayerAddress = AccountAddress.deserialize(deserializer);\n }\n\n return new SimpleTransaction(rawTransaction, feePayerAddress);\n }\n}\n"],"mappings":"2HAmBO,IAAMA,EAAN,MAAMC,UAA0BC,CAAa,CAgBlD,YAAYC,EAAgCC,EAAkC,CAC5E,MAAM,EACN,KAAK,eAAiBD,EACtB,KAAK,gBAAkBC,CACzB,CAQA,UAAUC,EAA8B,CACtC,KAAK,eAAe,UAAUA,CAAU,EAEpC,KAAK,kBAAoB,OAC3BA,EAAW,cAAc,EAAK,GAE9BA,EAAW,cAAc,EAAI,EAC7B,KAAK,gBAAgB,UAAUA,CAAU,EAE7C,CAQA,OAAO,YAAYC,EAA+C,CAChE,IAAMH,EAAiBI,EAAe,YAAYD,CAAY,EACxDE,EAAkBF,EAAa,gBAAgB,EACjDF,EACJ,OAAII,IACFJ,EAAkBK,EAAe,YAAYH,CAAY,GAGpD,IAAIL,EAAkBE,EAAgBC,CAAe,CAC9D,CACF","names":["SimpleTransaction","_SimpleTransaction","Serializable","rawTransaction","feePayerAddress","serializer","deserializer","RawTransaction","feePayerPresent","AccountAddress"]}
@@ -0,0 +1,2 @@
1
+ import{a as K}from"./chunk-EE7GDBA5.mjs";import{c as d}from"./chunk-BVVHGSWC.mjs";import{d as b,e as v,f as q,g as O,i as P,j as S,k as M,u as G}from"./chunk-VHNX2NUR.mjs";import{a as f}from"./chunk-3H5DGQKX.mjs";import{a as k}from"./chunk-PCLU4KLY.mjs";import{a as T}from"./chunk-TPJLAYW6.mjs";import{b as C}from"./chunk-4VU2ABLU.mjs";import{c as _}from"./chunk-P3J54CQG.mjs";import{a as w}from"./chunk-HBIDHQ2M.mjs";import{b as A,d as p}from"./chunk-RNJHULIT.mjs";import{a as h}from"./chunk-GQABU3RQ.mjs";import{e as y}from"./chunk-J245N3XF.mjs";import{a as g}from"./chunk-PRZ7AIGA.mjs";import{b as i}from"./chunk-KM6UXNC7.mjs";async function R(o){let{aptosConfig:n,accountAddress:t}=o,{data:e}=await A({aptosConfig:n,originMethod:"getInfo",path:`accounts/${i.from(t).toString()}`});return e}async function Y(o){let{aptosConfig:n,accountAddress:t,options:e}=o;return p({aptosConfig:n,originMethod:"getModules",path:`accounts/${i.from(t).toString()}/modules`,params:{ledger_version:e?.ledgerVersion,start:e?.offset,limit:e?.limit??1e3}})}async function Z(o){return o.options?.ledgerVersion!==void 0?Q(o):w(async()=>Q(o),`module-${o.accountAddress}-${o.moduleName}`,1e3*60*5)()}async function Q(o){let{aptosConfig:n,accountAddress:t,moduleName:e,options:r}=o,{data:s}=await A({aptosConfig:n,originMethod:"getModule",path:`accounts/${i.from(t).toString()}/module/${e}`,params:{ledger_version:r?.ledgerVersion}});return s}async function ee(o){let{aptosConfig:n,accountAddress:t,options:e}=o;return p({aptosConfig:n,originMethod:"getTransactions",path:`accounts/${i.from(t).toString()}/transactions`,params:{start:e?.offset,limit:e?.limit}})}async function oe(o){let{aptosConfig:n,accountAddress:t,options:e}=o;return p({aptosConfig:n,originMethod:"getResources",path:`accounts/${i.from(t).toString()}/resources`,params:{ledger_version:e?.ledgerVersion,start:e?.offset,limit:e?.limit??999}})}async function x(o){let{aptosConfig:n,accountAddress:t,resourceType:e,options:r}=o,{data:s}=await A({aptosConfig:n,originMethod:"getResource",path:`accounts/${i.from(t).toString()}/resource/${e}`,params:{ledger_version:r?.ledgerVersion}});return s.data}async function L(o){let{aptosConfig:n,authenticationKey:t,options:e}=o,r=await x({aptosConfig:n,accountAddress:"0x1",resourceType:"0x1::account::OriginatingAddress",options:e}),{address_map:{handle:s}}=r,c=i.from(t);try{let a=await K({aptosConfig:n,handle:s,data:{key:c.toString(),key_type:"address",value_type:"address"},options:e});return i.from(a)}catch(a){if(a instanceof h&&a.data.error_code==="table_item_not_found")return c;throw a}}async function te(o){let{aptosConfig:n,accountAddress:t}=o,r={owner_address:{_eq:i.from(t).toStringLong()},amount:{_gt:0}},c=await d({aptosConfig:n,query:{query:S,variables:{where_condition:r}},originMethod:"getAccountTokensCount"});return c.current_token_ownerships_v2_aggregate.aggregate?c.current_token_ownerships_v2_aggregate.aggregate.count:0}async function ne(o){let{aptosConfig:n,accountAddress:t,options:e}=o,s={owner_address:{_eq:i.from(t).toStringLong()},amount:{_gt:0}};e?.tokenStandard&&(s.token_standard={_eq:e?.tokenStandard});let c={query:O,variables:{where_condition:s,offset:e?.offset,limit:e?.limit,order_by:e?.orderBy}};return(await d({aptosConfig:n,query:c,originMethod:"getAccountOwnedTokens"})).current_token_ownerships_v2}async function re(o){let{aptosConfig:n,accountAddress:t,collectionAddress:e,options:r}=o,s=i.from(t).toStringLong(),c=i.from(e).toStringLong(),a={owner_address:{_eq:s},current_token_data:{collection_id:{_eq:c}},amount:{_gt:0}};r?.tokenStandard&&(a.token_standard={_eq:r?.tokenStandard});let u={query:P,variables:{where_condition:a,offset:r?.offset,limit:r?.limit,order_by:r?.orderBy}};return(await d({aptosConfig:n,query:u,originMethod:"getAccountOwnedTokensFromCollectionAddress"})).current_token_ownerships_v2}async function se(o){let{aptosConfig:n,accountAddress:t,options:e}=o,s={owner_address:{_eq:i.from(t).toStringLong()}};e?.tokenStandard&&(s.current_collection={token_standard:{_eq:e?.tokenStandard}});let c={query:q,variables:{where_condition:s,offset:e?.offset,limit:e?.limit,order_by:e?.orderBy}};return(await d({aptosConfig:n,query:c,originMethod:"getAccountCollectionsWithOwnedTokens"})).current_collection_ownership_v2_view}async function ce(o){let{aptosConfig:n,accountAddress:t}=o,e=i.from(t).toStringLong(),s=await d({aptosConfig:n,query:{query:M,variables:{address:e}},originMethod:"getAccountTransactionsCount"});return s.account_transactions_aggregate.aggregate?s.account_transactions_aggregate.aggregate.count:0}async function ie(o){let{aptosConfig:n,accountAddress:t,coinType:e,faMetadataAddress:r}=o,s=e,c;if(e!==void 0&&r!==void 0)c=i.from(r).toStringLong();else if(e!==void 0&&r===void 0)e===y?c=i.A.toStringLong():c=k(i.A,e).toStringLong();else if(e===void 0&&r!==void 0){let m=i.from(r);c=m.toStringLong(),m===i.A&&(s=y)}else throw new Error("Either coinType, fungibleAssetAddress, or both must be provided");let a=i.from(t).toStringLong(),u={asset_type:{_eq:c}};s!==void 0&&(u={asset_type:{_in:[s,c]}});let l=await B({aptosConfig:n,accountAddress:a,options:{where:u}});return l[0]?l[0].amount:0}async function B(o){let{aptosConfig:n,accountAddress:t,options:e}=o,r=i.from(t).toStringLong(),s={...e?.where,owner_address:{_eq:r}},c={query:v,variables:{where_condition:s,offset:e?.offset,limit:e?.limit,order_by:e?.orderBy}};return(await d({aptosConfig:n,query:c,originMethod:"getAccountCoinsData"})).current_fungible_asset_balances}async function ae(o){let{aptosConfig:n,accountAddress:t}=o,e=i.from(t).toStringLong(),s=await d({aptosConfig:n,query:{query:b,variables:{address:e}},originMethod:"getAccountCoinsCount"});if(!s.current_fungible_asset_balances_aggregate.aggregate)throw Error("Failed to get the count of account coins");return s.current_fungible_asset_balances_aggregate.aggregate.count}async function de(o){let{aptosConfig:n,accountAddress:t,options:e}=o,s={owner_address:{_eq:i.from(t).toStringLong()}},c={query:G,variables:{where_condition:s,offset:e?.offset,limit:e?.limit,order_by:e?.orderBy}};return(await d({aptosConfig:n,query:c,originMethod:"getAccountOwnedObjects"})).current_objects}async function ue(o){let{aptosConfig:n,privateKey:t}=o,e=new T(t.publicKey());if(t instanceof C){let s=g.fromPublicKey({publicKey:e}).derivedAddress();return f.fromPrivateKey({privateKey:t,address:s})}if(t instanceof _){let r=g.fromPublicKey({publicKey:e});if(await I({authKey:r,aptosConfig:n})){let u=r.derivedAddress();return f.fromPrivateKey({privateKey:t,address:u,legacy:!1})}let c=g.fromPublicKey({publicKey:e.publicKey});if(await I({authKey:c,aptosConfig:n})){let u=c.derivedAddress();return f.fromPrivateKey({privateKey:t,address:u,legacy:!0})}}throw new Error(`Can't derive account from private key ${t}`)}async function I(o){let{aptosConfig:n,authKey:t}=o,e=await L({aptosConfig:n,authenticationKey:t.derivedAddress()});try{return await R({aptosConfig:n,accountAddress:e}),!0}catch(r){if(r.status===404)return!1;throw new Error(`Error while looking for an account info ${e.toString()}`)}}export{R as a,Y as b,Z as c,ee as d,oe as e,x as f,L as g,te as h,ne as i,re as j,se as k,ce as l,ie as m,B as n,ae as o,de as p,ue as q,I as r};
2
+ //# sourceMappingURL=chunk-Y267I7DC.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/internal/account.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\n/**\n * This file contains the underlying implementations for exposed API surface in\n * the {@link api/account}. By moving the methods out into a separate file,\n * other namespaces and processes can access these methods without depending on the entire\n * account namespace and without having a dependency cycle error.\n */\n\nimport { AptosConfig } from \"../api/aptosConfig\";\nimport { AptosApiError, getAptosFullNode, paginateWithCursor } from \"../client\";\nimport { AccountAddress, AccountAddressInput } from \"../core/accountAddress\";\nimport { Account } from \"../account\";\nimport { AnyPublicKey, Ed25519PublicKey, PrivateKey } from \"../core/crypto\";\nimport { queryIndexer } from \"./general\";\nimport {\n AccountData,\n GetAccountCoinsDataResponse,\n GetAccountCollectionsWithOwnedTokenResponse,\n GetAccountOwnedTokensFromCollectionResponse,\n GetAccountOwnedTokensQueryResponse,\n GetObjectDataQueryResponse,\n LedgerVersionArg,\n MoveModuleBytecode,\n MoveResource,\n MoveStructId,\n OrderByArg,\n PaginationArgs,\n TokenStandardArg,\n TransactionResponse,\n WhereArg,\n} from \"../types\";\nimport {\n GetAccountCoinsCountQuery,\n GetAccountCoinsDataQuery,\n GetAccountCollectionsWithOwnedTokensQuery,\n GetObjectDataQuery,\n GetAccountOwnedTokensFromCollectionQuery,\n GetAccountOwnedTokensQuery,\n GetAccountTokensCountQuery,\n GetAccountTransactionsCountQuery,\n} from \"../types/generated/operations\";\nimport {\n GetAccountCoinsCount,\n GetAccountCoinsData,\n GetAccountCollectionsWithOwnedTokens,\n GetObjectData,\n GetAccountOwnedTokens,\n GetAccountOwnedTokensFromCollection,\n GetAccountTokensCount,\n GetAccountTransactionsCount,\n} from \"../types/generated/queries\";\nimport { memoizeAsync } from \"../utils/memoize\";\nimport { Secp256k1PrivateKey, AuthenticationKey, Ed25519PrivateKey, createObjectAddress } from \"../core\";\nimport { CurrentFungibleAssetBalancesBoolExp } from \"../types/generated/types\";\nimport { getTableItem } from \"./table\";\nimport { APTOS_COIN } from \"../utils\";\n\n/**\n * Retrieves account information for a specified account address.\n *\n * @param args - The arguments for retrieving account information.\n * @param args.aptosConfig - The configuration object for Aptos.\n * @param args.accountAddress - The address of the account to retrieve information for.\n */\nexport async function getInfo(args: {\n aptosConfig: AptosConfig;\n accountAddress: AccountAddressInput;\n}): Promise<AccountData> {\n const { aptosConfig, accountAddress } = args;\n const { data } = await getAptosFullNode<{}, AccountData>({\n aptosConfig,\n originMethod: \"getInfo\",\n path: `accounts/${AccountAddress.from(accountAddress).toString()}`,\n });\n return data;\n}\n\n/**\n * Retrieves the modules associated with a specified account address.\n *\n * @param args - The arguments for retrieving modules.\n * @param args.aptosConfig - The configuration for connecting to the Aptos blockchain.\n * @param args.accountAddress - The address of the account whose modules are to be retrieved.\n * @param args.options - Optional parameters for pagination and ledger version.\n * @param args.options.limit - The maximum number of modules to retrieve (default is 1000).\n * @param args.options.offset - The starting point for pagination.\n * @param args.options.ledgerVersion - The specific ledger version to query.\n */\nexport async function getModules(args: {\n aptosConfig: AptosConfig;\n accountAddress: AccountAddressInput;\n options?: PaginationArgs & LedgerVersionArg;\n}): Promise<MoveModuleBytecode[]> {\n const { aptosConfig, accountAddress, options } = args;\n return paginateWithCursor<{}, MoveModuleBytecode[]>({\n aptosConfig,\n originMethod: \"getModules\",\n path: `accounts/${AccountAddress.from(accountAddress).toString()}/modules`,\n params: {\n ledger_version: options?.ledgerVersion,\n start: options?.offset,\n limit: options?.limit ?? 1000,\n },\n });\n}\n\n/**\n * Queries for a move module given an account address and module name.\n * This function can help you retrieve the module's ABI and other relevant information.\n *\n * @param args - The arguments for retrieving the module.\n * @param args.aptosConfig - The configuration for the Aptos client.\n * @param args.accountAddress - The account address in hex-encoded 32 byte format.\n * @param args.moduleName - The name of the module to retrieve.\n * @param args.options - Optional parameters for the request.\n * @param args.options.ledgerVersion - Specifies the ledger version of transactions. By default, the latest version will be used.\n * @returns The move module.\n */\nexport async function getModule(args: {\n aptosConfig: AptosConfig;\n accountAddress: AccountAddressInput;\n moduleName: string;\n options?: LedgerVersionArg;\n}): Promise<MoveModuleBytecode> {\n // We don't memoize the account module by ledger version, as it's not a common use case, this would be handled\n // by the developer directly\n if (args.options?.ledgerVersion !== undefined) {\n return getModuleInner(args);\n }\n\n return memoizeAsync(\n async () => getModuleInner(args),\n `module-${args.accountAddress}-${args.moduleName}`,\n 1000 * 60 * 5, // 5 minutes\n )();\n}\n\n/**\n * Retrieves the bytecode of a specified module from a given account address.\n *\n * @param args - The parameters for retrieving the module bytecode.\n * @param args.aptosConfig - The configuration for connecting to the Aptos network.\n * @param args.accountAddress - The address of the account from which to retrieve the module.\n * @param args.moduleName - The name of the module to retrieve.\n * @param args.options - Optional parameters for specifying the ledger version.\n * @param args.options.ledgerVersion - The specific ledger version to query.\n */\nasync function getModuleInner(args: {\n aptosConfig: AptosConfig;\n accountAddress: AccountAddressInput;\n moduleName: string;\n options?: LedgerVersionArg;\n}): Promise<MoveModuleBytecode> {\n const { aptosConfig, accountAddress, moduleName, options } = args;\n\n const { data } = await getAptosFullNode<{}, MoveModuleBytecode>({\n aptosConfig,\n originMethod: \"getModule\",\n path: `accounts/${AccountAddress.from(accountAddress).toString()}/module/${moduleName}`,\n params: { ledger_version: options?.ledgerVersion },\n });\n return data;\n}\n\n/**\n * Retrieves a list of transactions associated with a specific account address.\n * This function allows you to paginate through the transactions for better performance and usability.\n *\n * @param args - The arguments for retrieving transactions.\n * @param args.aptosConfig - The configuration settings for Aptos.\n * @param args.accountAddress - The account address for which to retrieve transactions.\n * @param args.options - Optional pagination parameters.\n * @param args.options.offset - The starting point for pagination.\n * @param args.options.limit - The maximum number of transactions to retrieve.\n */\nexport async function getTransactions(args: {\n aptosConfig: AptosConfig;\n accountAddress: AccountAddressInput;\n options?: PaginationArgs;\n}): Promise<TransactionResponse[]> {\n const { aptosConfig, accountAddress, options } = args;\n return paginateWithCursor<{}, TransactionResponse[]>({\n aptosConfig,\n originMethod: \"getTransactions\",\n path: `accounts/${AccountAddress.from(accountAddress).toString()}/transactions`,\n params: { start: options?.offset, limit: options?.limit },\n });\n}\n\n/**\n * Retrieves a list of resources associated with a specific account address.\n *\n * @param args - The arguments for retrieving resources.\n * @param args.aptosConfig - The configuration settings for Aptos.\n * @param args.accountAddress - The address of the account to fetch resources for.\n * @param args.options - Optional pagination and ledger version parameters.\n * @param args.options.offset - The starting point for pagination.\n * @param args.options.limit - The maximum number of resources to retrieve (default is 999).\n * @param args.options.ledgerVersion - The specific ledger version to query.\n */\nexport async function getResources(args: {\n aptosConfig: AptosConfig;\n accountAddress: AccountAddressInput;\n options?: PaginationArgs & LedgerVersionArg;\n}): Promise<MoveResource[]> {\n const { aptosConfig, accountAddress, options } = args;\n return paginateWithCursor<{}, MoveResource[]>({\n aptosConfig,\n originMethod: \"getResources\",\n path: `accounts/${AccountAddress.from(accountAddress).toString()}/resources`,\n params: {\n ledger_version: options?.ledgerVersion,\n start: options?.offset,\n limit: options?.limit ?? 999,\n },\n });\n}\n\n/**\n * Retrieves a specific resource of a given type for the specified account address.\n *\n * @param args - The arguments for retrieving the resource.\n * @param args.aptosConfig - The configuration settings for Aptos.\n * @param args.accountAddress - The address of the account from which to retrieve the resource.\n * @param args.resourceType - The type of the resource to retrieve, specified as a MoveStructId.\n * @param args.options - Optional parameters for specifying the ledger version.\n */\nexport async function getResource<T extends {}>(args: {\n aptosConfig: AptosConfig;\n accountAddress: AccountAddressInput;\n resourceType: MoveStructId;\n options?: LedgerVersionArg;\n}): Promise<T> {\n const { aptosConfig, accountAddress, resourceType, options } = args;\n const { data } = await getAptosFullNode<{}, MoveResource>({\n aptosConfig,\n originMethod: \"getResource\",\n path: `accounts/${AccountAddress.from(accountAddress).toString()}/resource/${resourceType}`,\n params: { ledger_version: options?.ledgerVersion },\n });\n return data.data as T;\n}\n\n/**\n * Retrieves the original account address associated with a given authentication key, which is useful for handling key rotations.\n *\n * @param args - The arguments for the lookup.\n * @param args.aptosConfig - The configuration for the Aptos client.\n * @param args.authenticationKey - The authentication key for which to look up the original address.\n * @param args.options - Optional parameters for specifying the ledger version.\n * @returns The original account address or the provided authentication key address if not found.\n * @throws Throws an error if the lookup fails for reasons other than the address not being found.\n */\nexport async function lookupOriginalAccountAddress(args: {\n aptosConfig: AptosConfig;\n authenticationKey: AccountAddressInput;\n options?: LedgerVersionArg;\n}): Promise<AccountAddress> {\n const { aptosConfig, authenticationKey, options } = args;\n type OriginatingAddress = {\n address_map: { handle: string };\n };\n const resource = await getResource<OriginatingAddress>({\n aptosConfig,\n accountAddress: \"0x1\",\n resourceType: \"0x1::account::OriginatingAddress\",\n options,\n });\n\n const {\n address_map: { handle },\n } = resource;\n\n const authKeyAddress = AccountAddress.from(authenticationKey);\n\n // If the address is not found in the address map, which means its not rotated\n // then return the address as is\n try {\n const originalAddress = await getTableItem<string>({\n aptosConfig,\n handle,\n data: {\n key: authKeyAddress.toString(),\n key_type: \"address\",\n value_type: \"address\",\n },\n options,\n });\n\n return AccountAddress.from(originalAddress);\n } catch (err) {\n if (err instanceof AptosApiError && err.data.error_code === \"table_item_not_found\") {\n return authKeyAddress;\n }\n\n throw err;\n }\n}\n\n/**\n * Retrieves the count of tokens owned by a specific account address.\n *\n * @param args - The arguments for retrieving the account tokens count.\n * @param args.aptosConfig - The configuration settings for the Aptos network.\n * @param args.accountAddress - The address of the account for which to count the tokens.\n * @returns The count of tokens owned by the specified account.\n */\nexport async function getAccountTokensCount(args: {\n aptosConfig: AptosConfig;\n accountAddress: AccountAddressInput;\n}): Promise<number> {\n const { aptosConfig, accountAddress } = args;\n\n const address = AccountAddress.from(accountAddress).toStringLong();\n\n const whereCondition: { owner_address: { _eq: string }; amount: { _gt: number } } = {\n owner_address: { _eq: address },\n amount: { _gt: 0 },\n };\n\n const graphqlQuery = {\n query: GetAccountTokensCount,\n variables: { where_condition: whereCondition },\n };\n\n const data = await queryIndexer<GetAccountTokensCountQuery>({\n aptosConfig,\n query: graphqlQuery,\n originMethod: \"getAccountTokensCount\",\n });\n\n // commonjs (aka cjs) doesn't handle Nullish Coalescing for some reason\n // might be because of how ts infer the graphql generated scheme type\n return data.current_token_ownerships_v2_aggregate.aggregate\n ? data.current_token_ownerships_v2_aggregate.aggregate.count\n : 0;\n}\n\n/**\n * Retrieves the tokens owned by a specified account address.\n *\n * @param args - The arguments for retrieving the account's tokens.\n * @param args.aptosConfig - The configuration for the Aptos client.\n * @param args.accountAddress - The address of the account whose tokens are being queried.\n * @param args.options - Optional parameters for filtering and pagination.\n * @param args.options.tokenStandard - The specific token standard to filter the results.\n * @param args.options.offset - The number of records to skip before starting to collect the result set.\n * @param args.options.limit - The maximum number of records to return.\n * @param args.options.orderBy - The criteria for ordering the results.\n * @returns A promise that resolves to the current token ownerships of the specified account.\n */\nexport async function getAccountOwnedTokens(args: {\n aptosConfig: AptosConfig;\n accountAddress: AccountAddressInput;\n options?: TokenStandardArg & PaginationArgs & OrderByArg<GetAccountOwnedTokensQueryResponse[0]>;\n}): Promise<GetAccountOwnedTokensQueryResponse> {\n const { aptosConfig, accountAddress, options } = args;\n const address = AccountAddress.from(accountAddress).toStringLong();\n\n const whereCondition: { owner_address: { _eq: string }; amount: { _gt: number }; token_standard?: { _eq: string } } =\n {\n owner_address: { _eq: address },\n amount: { _gt: 0 },\n };\n\n if (options?.tokenStandard) {\n whereCondition.token_standard = { _eq: options?.tokenStandard };\n }\n\n const graphqlQuery = {\n query: GetAccountOwnedTokens,\n variables: {\n where_condition: whereCondition,\n offset: options?.offset,\n limit: options?.limit,\n order_by: options?.orderBy,\n },\n };\n\n const data = await queryIndexer<GetAccountOwnedTokensQuery>({\n aptosConfig,\n query: graphqlQuery,\n originMethod: \"getAccountOwnedTokens\",\n });\n\n return data.current_token_ownerships_v2;\n}\n\n/**\n * Retrieves the tokens owned by a specific account from a particular collection address.\n *\n * @param args - The parameters required to fetch the owned tokens.\n * @param args.aptosConfig - The Aptos configuration object.\n * @param args.accountAddress - The address of the account whose tokens are being queried.\n * @param args.collectionAddress - The address of the collection from which tokens are being retrieved.\n * @param args.options - Optional parameters for filtering and pagination, including token standard, pagination arguments, and\n * order by options.\n */\nexport async function getAccountOwnedTokensFromCollectionAddress(args: {\n aptosConfig: AptosConfig;\n accountAddress: AccountAddressInput;\n collectionAddress: AccountAddressInput;\n options?: TokenStandardArg & PaginationArgs & OrderByArg<GetAccountOwnedTokensFromCollectionResponse[0]>;\n}): Promise<GetAccountOwnedTokensFromCollectionResponse> {\n const { aptosConfig, accountAddress, collectionAddress, options } = args;\n const ownerAddress = AccountAddress.from(accountAddress).toStringLong();\n const collAddress = AccountAddress.from(collectionAddress).toStringLong();\n\n const whereCondition: {\n owner_address: { _eq: string };\n current_token_data: { collection_id: { _eq: string } };\n amount: { _gt: number };\n token_standard?: { _eq: string };\n } = {\n owner_address: { _eq: ownerAddress },\n current_token_data: { collection_id: { _eq: collAddress } },\n amount: { _gt: 0 },\n };\n\n if (options?.tokenStandard) {\n whereCondition.token_standard = { _eq: options?.tokenStandard };\n }\n\n const graphqlQuery = {\n query: GetAccountOwnedTokensFromCollection,\n variables: {\n where_condition: whereCondition,\n offset: options?.offset,\n limit: options?.limit,\n order_by: options?.orderBy,\n },\n };\n\n const data = await queryIndexer<GetAccountOwnedTokensFromCollectionQuery>({\n aptosConfig,\n query: graphqlQuery,\n originMethod: \"getAccountOwnedTokensFromCollectionAddress\",\n });\n\n return data.current_token_ownerships_v2;\n}\n\n/**\n * Retrieves the collections owned by a specified account along with the tokens in those collections.\n *\n * @param args - The arguments for the function.\n * @param args.aptosConfig - The configuration for the Aptos client.\n * @param args.accountAddress - The address of the account whose collections are being queried.\n * @param args.options - Optional parameters for filtering and pagination.\n * @param args.options.tokenStandard - An optional token standard to filter the collections.\n * @param args.options.offset - An optional offset for pagination.\n * @param args.options.limit - An optional limit for the number of results returned.\n * @param args.options.orderBy - An optional parameter to specify the order of the results.\n */\nexport async function getAccountCollectionsWithOwnedTokens(args: {\n aptosConfig: AptosConfig;\n accountAddress: AccountAddressInput;\n options?: TokenStandardArg & PaginationArgs & OrderByArg<GetAccountCollectionsWithOwnedTokenResponse[0]>;\n}): Promise<GetAccountCollectionsWithOwnedTokenResponse> {\n const { aptosConfig, accountAddress, options } = args;\n const address = AccountAddress.from(accountAddress).toStringLong();\n\n const whereCondition: {\n owner_address: { _eq: string };\n current_collection?: { token_standard: { _eq: string } };\n } = {\n owner_address: { _eq: address },\n };\n\n if (options?.tokenStandard) {\n whereCondition.current_collection = {\n token_standard: { _eq: options?.tokenStandard },\n };\n }\n\n const graphqlQuery = {\n query: GetAccountCollectionsWithOwnedTokens,\n variables: {\n where_condition: whereCondition,\n offset: options?.offset,\n limit: options?.limit,\n order_by: options?.orderBy,\n },\n };\n\n const data = await queryIndexer<GetAccountCollectionsWithOwnedTokensQuery>({\n aptosConfig,\n query: graphqlQuery,\n originMethod: \"getAccountCollectionsWithOwnedTokens\",\n });\n\n return data.current_collection_ownership_v2_view;\n}\n\n/**\n * Retrieves the count of transactions associated with a specified account.\n *\n * @param args - The arguments for the function.\n * @param args.aptosConfig - The configuration settings for Aptos.\n * @param args.accountAddress - The address of the account for which to retrieve the transaction count.\n * @returns The number of transactions associated with the specified account.\n */\nexport async function getAccountTransactionsCount(args: {\n aptosConfig: AptosConfig;\n accountAddress: AccountAddressInput;\n}): Promise<number> {\n const { aptosConfig, accountAddress } = args;\n\n const address = AccountAddress.from(accountAddress).toStringLong();\n\n const graphqlQuery = {\n query: GetAccountTransactionsCount,\n variables: { address },\n };\n\n const data = await queryIndexer<GetAccountTransactionsCountQuery>({\n aptosConfig,\n query: graphqlQuery,\n originMethod: \"getAccountTransactionsCount\",\n });\n\n // commonjs (aka cjs) doesn't handle Nullish Coalescing for some reason\n // might be because of how ts infer the graphql generated scheme type\n return data.account_transactions_aggregate.aggregate ? data.account_transactions_aggregate.aggregate.count : 0;\n}\n\n/**\n * Retrieves the amount of a specific coin held by an account.\n *\n * @param args - The parameters for the request.\n * @param args.aptosConfig - The Aptos configuration object.\n * @param args.accountAddress - The address of the account to query.\n * @param args.coinType - Optional; the type of coin to check the amount for.\n * @param args.faMetadataAddress - Optional; the address of the fungible asset metadata.\n * @returns The amount of the specified coin held by the account, or 0 if none is found.\n * @throws Error if neither coinType nor faMetadataAddress is provided.\n */\nexport async function getAccountCoinAmount(args: {\n aptosConfig: AptosConfig;\n accountAddress: AccountAddressInput;\n coinType?: MoveStructId;\n faMetadataAddress?: AccountAddressInput;\n}): Promise<number> {\n const { aptosConfig, accountAddress, coinType, faMetadataAddress } = args;\n\n let coinAssetType: string | undefined = coinType;\n let faAddress: string;\n\n if (coinType !== undefined && faMetadataAddress !== undefined) {\n faAddress = AccountAddress.from(faMetadataAddress).toStringLong();\n } else if (coinType !== undefined && faMetadataAddress === undefined) {\n // TODO Move to a separate function as defined in the AIP for coin migration\n if (coinType === APTOS_COIN) {\n faAddress = AccountAddress.A.toStringLong();\n } else {\n faAddress = createObjectAddress(AccountAddress.A, coinType).toStringLong();\n }\n } else if (coinType === undefined && faMetadataAddress !== undefined) {\n const addr = AccountAddress.from(faMetadataAddress);\n faAddress = addr.toStringLong();\n if (addr === AccountAddress.A) {\n coinAssetType = APTOS_COIN;\n }\n // The paired CoinType should be populated outside of this function in another\n // async call. We cannot do this internally due to dependency cycles issue.\n } else {\n throw new Error(\"Either coinType, fungibleAssetAddress, or both must be provided\");\n }\n const address = AccountAddress.from(accountAddress).toStringLong();\n\n // Search by fungible asset address, unless it has a coin it migrated from\n let where: any = { asset_type: { _eq: faAddress } };\n if (coinAssetType !== undefined) {\n where = { asset_type: { _in: [coinAssetType, faAddress] } };\n }\n\n const data = await getAccountCoinsData({\n aptosConfig,\n accountAddress: address,\n options: {\n where,\n },\n });\n\n // commonjs (aka cjs) doesn't handle Nullish Coalescing for some reason\n // might be because of how ts infer the graphql generated scheme type\n return data[0] ? data[0].amount : 0;\n}\n\n/**\n * Retrieves the current fungible asset balances for a specified account.\n *\n * @param args - The arguments for retrieving account coins data.\n * @param args.aptosConfig - The configuration for connecting to the Aptos network.\n * @param args.accountAddress - The address of the account for which to retrieve coin data.\n * @param args.options - Optional parameters for pagination and filtering the results.\n * @param args.options.offset - The number of items to skip before starting to collect the result set.\n * @param args.options.limit - The maximum number of items to return.\n * @param args.options.orderBy - The criteria for ordering the results.\n * @param args.options.where - Conditions to filter the results based on the current fungible asset balances.\n */\nexport async function getAccountCoinsData(args: {\n aptosConfig: AptosConfig;\n accountAddress: AccountAddressInput;\n options?: PaginationArgs & OrderByArg<GetAccountCoinsDataResponse[0]> & WhereArg<CurrentFungibleAssetBalancesBoolExp>;\n}): Promise<GetAccountCoinsDataResponse> {\n const { aptosConfig, accountAddress, options } = args;\n const address = AccountAddress.from(accountAddress).toStringLong();\n\n const whereCondition: { owner_address: { _eq: string } } = {\n ...options?.where,\n owner_address: { _eq: address },\n };\n\n const graphqlQuery = {\n query: GetAccountCoinsData,\n variables: {\n where_condition: whereCondition,\n offset: options?.offset,\n limit: options?.limit,\n order_by: options?.orderBy,\n },\n };\n\n const data = await queryIndexer<GetAccountCoinsDataQuery>({\n aptosConfig,\n query: graphqlQuery,\n originMethod: \"getAccountCoinsData\",\n });\n\n return data.current_fungible_asset_balances;\n}\n\n/**\n * Retrieves the count of fungible asset coins held by a specified account.\n *\n * @param args - The arguments for the function.\n * @param args.aptosConfig - The configuration settings for the Aptos network.\n * @param args.accountAddress - The address of the account for which to retrieve the coin count.\n * @throws Error if the count of account coins cannot be retrieved.\n */\nexport async function getAccountCoinsCount(args: {\n aptosConfig: AptosConfig;\n accountAddress: AccountAddressInput;\n}): Promise<number> {\n const { aptosConfig, accountAddress } = args;\n const address = AccountAddress.from(accountAddress).toStringLong();\n\n const graphqlQuery = {\n query: GetAccountCoinsCount,\n variables: { address },\n };\n\n const data = await queryIndexer<GetAccountCoinsCountQuery>({\n aptosConfig,\n query: graphqlQuery,\n originMethod: \"getAccountCoinsCount\",\n });\n\n if (!data.current_fungible_asset_balances_aggregate.aggregate) {\n throw Error(\"Failed to get the count of account coins\");\n }\n\n return data.current_fungible_asset_balances_aggregate.aggregate.count;\n}\n\n/**\n * Retrieves the objects owned by a specified account.\n *\n * @param args - The parameters for the request.\n * @param args.aptosConfig - The configuration for the Aptos client.\n * @param args.accountAddress - The address of the account whose owned objects are to be retrieved.\n * @param args.options - Optional parameters for pagination and ordering of the results.\n * @param args.options.offset - The number of items to skip before starting to collect the result set.\n * @param args.options.limit - The maximum number of items to return.\n * @param args.options.orderBy - The criteria to order the results by.\n * @returns A promise that resolves to the current objects owned by the specified account.\n */\nexport async function getAccountOwnedObjects(args: {\n aptosConfig: AptosConfig;\n accountAddress: AccountAddressInput;\n options?: PaginationArgs & OrderByArg<GetObjectDataQueryResponse[0]>;\n}): Promise<GetObjectDataQueryResponse> {\n const { aptosConfig, accountAddress, options } = args;\n const address = AccountAddress.from(accountAddress).toStringLong();\n\n const whereCondition: { owner_address: { _eq: string } } = {\n owner_address: { _eq: address },\n };\n const graphqlQuery = {\n query: GetObjectData,\n variables: {\n where_condition: whereCondition,\n offset: options?.offset,\n limit: options?.limit,\n order_by: options?.orderBy,\n },\n };\n const data = await queryIndexer<GetObjectDataQuery>({\n aptosConfig,\n query: graphqlQuery,\n originMethod: \"getAccountOwnedObjects\",\n });\n\n return data.current_objects;\n}\n\n/**\n * Derives an account from the provided private key and Aptos configuration.\n * This function helps in obtaining the account details associated with a given private key,\n * considering both unified and legacy authentication schemes.\n *\n * NOTE: There is a potential issue once the unified single signer scheme is adopted by the community.\n * Because one could create two accounts with the same private key with this new authenticator type,\n * we’ll need to determine the order in which we look up the accounts: first unified scheme and then legacy scheme,\n * or first legacy scheme and then unified scheme.\n *\n * @param args - The arguments for deriving the account.\n * @param args.aptosConfig - The Aptos configuration used for account lookup.\n * @param args.privateKey - The private key used to derive the account.\n * @throws Error if the account cannot be derived from the private key.\n */\nexport async function deriveAccountFromPrivateKey(args: {\n aptosConfig: AptosConfig;\n privateKey: PrivateKey;\n}): Promise<Account> {\n const { aptosConfig, privateKey } = args;\n const publicKey = new AnyPublicKey(privateKey.publicKey());\n\n if (privateKey instanceof Secp256k1PrivateKey) {\n // private key is secp256k1, therefore we know it for sure uses a single signer key\n const authKey = AuthenticationKey.fromPublicKey({ publicKey });\n const address = authKey.derivedAddress();\n return Account.fromPrivateKey({ privateKey, address });\n }\n\n if (privateKey instanceof Ed25519PrivateKey) {\n // lookup single sender ed25519\n const singleSenderTransactionAuthenticatorAuthKey = AuthenticationKey.fromPublicKey({\n publicKey,\n });\n const isSingleSenderTransactionAuthenticator = await isAccountExist({\n authKey: singleSenderTransactionAuthenticatorAuthKey,\n aptosConfig,\n });\n if (isSingleSenderTransactionAuthenticator) {\n const address = singleSenderTransactionAuthenticatorAuthKey.derivedAddress();\n return Account.fromPrivateKey({ privateKey, address, legacy: false });\n }\n // lookup legacy ed25519\n const legacyAuthKey = AuthenticationKey.fromPublicKey({\n publicKey: publicKey.publicKey as Ed25519PublicKey,\n });\n const isLegacyEd25519 = await isAccountExist({ authKey: legacyAuthKey, aptosConfig });\n if (isLegacyEd25519) {\n const address = legacyAuthKey.derivedAddress();\n return Account.fromPrivateKey({ privateKey, address, legacy: true });\n }\n }\n // if we are here, it means we couldn't find an address with an\n // auth key that matches the provided private key\n throw new Error(`Can't derive account from private key ${privateKey}`);\n}\n\n/**\n * Checks if an account exists by verifying its information against the Aptos blockchain.\n *\n * @param args - The arguments for the function.\n * @param args.aptosConfig - The configuration for connecting to the Aptos blockchain.\n * @param args.authKey - The authentication key used to derive the account address.\n * @returns A promise that resolves to a boolean indicating whether the account exists.\n *\n * @throws Throws an Error if there is an issue while looking for account information.\n */\nexport async function isAccountExist(args: { aptosConfig: AptosConfig; authKey: AuthenticationKey }): Promise<boolean> {\n const { aptosConfig, authKey } = args;\n const accountAddress = await lookupOriginalAccountAddress({\n aptosConfig,\n authenticationKey: authKey.derivedAddress(),\n });\n\n try {\n await getInfo({\n aptosConfig,\n accountAddress,\n });\n return true;\n } catch (error: any) {\n // account not found\n if (error.status === 404) {\n return false;\n }\n throw new Error(`Error while looking for an account info ${accountAddress.toString()}`);\n }\n}\n"],"mappings":"sn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CAAC,EAKD,GAJ+C,MAAMO,EAAe,CAClE,QAASD,EACT,YAAAjE,CACF,CAAC,EAC2C,CAC1C,IAAMwC,EAAUyB,EAA4C,eAAe,EAC3E,OAAOF,EAAQ,eAAe,CAAE,WAAAL,EAAY,QAAAlB,EAAS,OAAQ,EAAM,CAAC,CACtE,CAEA,IAAM2B,EAAgBL,EAAkB,cAAc,CACpD,UAAWH,EAAU,SACvB,CAAC,EAED,GADwB,MAAMO,EAAe,CAAE,QAASC,EAAe,YAAAnE,CAAY,CAAC,EAC/D,CACnB,IAAMwC,EAAU2B,EAAc,eAAe,EAC7C,OAAOJ,EAAQ,eAAe,CAAE,WAAAL,EAAY,QAAAlB,EAAS,OAAQ,EAAK,CAAC,CACrE,CACF,CAGA,MAAM,IAAI,MAAM,yCAAyCkB,CAAU,EAAE,CACvE,CAYA,eAAsBQ,EAAenE,EAAkF,CACrH,GAAM,CAAE,YAAAC,EAAa,QAAAoE,CAAQ,EAAIrE,EAC3BE,EAAiB,MAAMe,EAA6B,CACxD,YAAAhB,EACA,kBAAmBoE,EAAQ,eAAe,CAC5C,CAAC,EAED,GAAI,CACF,aAAMtE,EAAQ,CACZ,YAAAE,EACA,eAAAC,CACF,CAAC,EACM,EACT,OAASoE,EAAY,CAEnB,GAAIA,EAAM,SAAW,IACnB,MAAO,GAET,MAAM,IAAI,MAAM,2CAA2CpE,EAAe,SAAS,CAAC,EAAE,CACxF,CACF","names":["getInfo","args","aptosConfig","accountAddress","data","getAptosFullNode","AccountAddress","getModules","options","paginateWithCursor","getModule","getModuleInner","memoizeAsync","moduleName","getTransactions","getResources","getResource","resourceType","lookupOriginalAccountAddress","authenticationKey","resource","handle","authKeyAddress","originalAddress","getTableItem","err","AptosApiError","getAccountTokensCount","whereCondition","queryIndexer","GetAccountTokensCount","getAccountOwnedTokens","graphqlQuery","GetAccountOwnedTokens","getAccountOwnedTokensFromCollectionAddress","collectionAddress","ownerAddress","collAddress","GetAccountOwnedTokensFromCollection","getAccountCollectionsWithOwnedTokens","GetAccountCollectionsWithOwnedTokens","getAccountTransactionsCount","address","GetAccountTransactionsCount","getAccountCoinAmount","coinType","faMetadataAddress","coinAssetType","faAddress","APTOS_COIN","createObjectAddress","addr","where","getAccountCoinsData","GetAccountCoinsData","getAccountCoinsCount","GetAccountCoinsCount","getAccountOwnedObjects","GetObjectData","deriveAccountFromPrivateKey","privateKey","publicKey","AnyPublicKey","Secp256k1PrivateKey","AuthenticationKey","Account","Ed25519PrivateKey","singleSenderTransactionAuthenticatorAuthKey","isAccountExist","legacyAuthKey","authKey","error"]}
@@ -1,2 +1,2 @@
1
- import{c as p}from"./chunk-MEWFJJJN.mjs";import{b as a}from"./chunk-7V6DEA7G.mjs";import{b as s}from"./chunk-HPZ2S4FE.mjs";async function F(n){let{aptosConfig:e,payload:o,options:t}=n,i=await p({...o,aptosConfig:e}),r=new s;i.serialize(r);let u=r.toUint8Array(),{data:d}=await a({aptosConfig:e,path:"view",originMethod:"view",contentType:"application/x.aptos.view_function+bcs",params:{ledger_version:t?.ledgerVersion},body:u});return d}async function M(n){let{aptosConfig:e,payload:o,options:t}=n,{data:i}=await a({aptosConfig:e,originMethod:"viewJson",path:"view",params:{ledger_version:t?.ledgerVersion},body:{function:o.function,type_arguments:o.typeArguments??[],arguments:o.functionArguments??[]}});return i}export{F as a,M as b};
2
- //# sourceMappingURL=chunk-G7MWTE2J.mjs.map
1
+ import{c as p}from"./chunk-22ZSW5EN.mjs";import{b as a}from"./chunk-2652SPOM.mjs";import{b as s}from"./chunk-QQIVWB6G.mjs";async function F(n){let{aptosConfig:e,payload:o,options:t}=n,i=await p({...o,aptosConfig:e}),r=new s;i.serialize(r);let u=r.toUint8Array(),{data:d}=await a({aptosConfig:e,path:"view",originMethod:"view",contentType:"application/x.aptos.view_function+bcs",params:{ledger_version:t?.ledgerVersion},body:u});return d}async function M(n){let{aptosConfig:e,payload:o,options:t}=n,{data:i}=await a({aptosConfig:e,originMethod:"viewJson",path:"view",params:{ledger_version:t?.ledgerVersion},body:{function:o.function,type_arguments:o.typeArguments??[],arguments:o.functionArguments??[]}});return i}export{F as a,M as b};
2
+ //# sourceMappingURL=chunk-YZ5BCOGI.mjs.map
@@ -1,2 +1,2 @@
1
- import{a as i}from"./chunk-HPZ2S4FE.mjs";var r=class a extends i{constructor(e){super(),this.chainId=e}serialize(e){e.serializeU8(this.chainId)}static deserialize(e){let s=e.deserializeU8();return new a(s)}};export{r as a};
2
- //# sourceMappingURL=chunk-LXLISEQ4.mjs.map
1
+ import{a as i}from"./chunk-QQIVWB6G.mjs";var r=class a extends i{constructor(e){super(),this.chainId=e}serialize(e){e.serializeU8(this.chainId)}static deserialize(e){let s=e.deserializeU8();return new a(s)}};export{r as a};
2
+ //# sourceMappingURL=chunk-ZINOJTLU.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/transactions/instances/chainId.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { Serializer, Serializable } from \"../../bcs/serializer\";\nimport { Deserializer } from \"../../bcs/deserializer\";\n\n/**\n * Represents a ChainId that can be serialized and deserialized.\n *\n * @extends Serializable\n */\nexport class ChainId extends Serializable {\n public readonly chainId: number;\n\n /**\n * Initializes a new instance of the class with the specified chain ID.\n *\n * @param chainId - The ID of the blockchain network to be used.\n */\n constructor(chainId: number) {\n super();\n this.chainId = chainId;\n }\n\n /**\n * Serializes the current object using the provided serializer.\n * This function helps in converting the object into a format suitable for transmission or storage.\n *\n * @param serializer - The serializer instance used to perform the serialization.\n */\n serialize(serializer: Serializer): void {\n serializer.serializeU8(this.chainId);\n }\n\n /**\n * Deserializes a ChainId from the provided deserializer.\n * This function allows you to reconstruct a ChainId object from serialized data.\n *\n * @param deserializer - The deserializer instance used to read the serialized data.\n */\n static deserialize(deserializer: Deserializer): ChainId {\n const chainId = deserializer.deserializeU8();\n return new ChainId(chainId);\n }\n}\n"],"mappings":"yCAWO,IAAMA,EAAN,MAAMC,UAAgBC,CAAa,CAQxC,YAAYC,EAAiB,CAC3B,MAAM,EACN,KAAK,QAAUA,CACjB,CAQA,UAAUC,EAA8B,CACtCA,EAAW,YAAY,KAAK,OAAO,CACrC,CAQA,OAAO,YAAYC,EAAqC,CACtD,IAAMF,EAAUE,EAAa,cAAc,EAC3C,OAAO,IAAIJ,EAAQE,CAAO,CAC5B,CACF","names":["ChainId","_ChainId","Serializable","chainId","serializer","deserializer"]}
@@ -1,2 +1,2 @@
1
- import{a as m}from"./chunk-QDIKOQRK.mjs";import{a as g}from"./chunk-QIW56MUH.mjs";import{a as p}from"./chunk-E37YRKWK.mjs";import{b as y}from"./chunk-QPP6BX53.mjs";import{a as v,b as M}from"./chunk-CCMHWJ3Q.mjs";import{a as F,b as d,c as T,d as x,e as E,f as _,g as w}from"./chunk-6QGVRNV6.mjs";import{a as S}from"./chunk-YJCZU6PR.mjs";import{a as u}from"./chunk-HPZ2S4FE.mjs";function I(t){let e=t.deserializeUleb128AsU32();switch(e){case 0:return d.deserialize(t);case 1:return E.deserialize(t);case 2:return _.deserialize(t);case 3:return y.deserialize(t);case 4:return v.deserialize(t,d);case 5:return F.deserialize(t);case 6:return T.deserialize(t);case 7:return x.deserialize(t);case 8:return w.deserialize(t);case 9:return M.deserialize(t);default:throw new Error(`Unknown variant index for ScriptTransactionArgument: ${e}`)}}var a=class extends u{static deserialize(e){let r=e.deserializeUleb128AsU32();switch(r){case 0:return A.load(e);case 2:return z.load(e);case 3:return h.load(e);default:throw new Error(`Unknown variant index for TransactionPayload: ${r}`)}}},A=class t extends a{constructor(e){super(),this.script=e}serialize(e){e.serializeU32AsUleb128(0),this.script.serialize(e)}static load(e){let r=U.deserialize(e);return new t(r)}},z=class t extends a{constructor(e){super(),this.entryFunction=e}serialize(e){e.serializeU32AsUleb128(2),this.entryFunction.serialize(e)}static load(e){let r=l.deserialize(e);return new t(r)}},h=class t extends a{constructor(e){super(),this.multiSig=e}serialize(e){e.serializeU32AsUleb128(3),this.multiSig.serialize(e)}static load(e){let r=f.deserialize(e);return new t(r)}},l=class t{constructor(e,r,i,n){this.module_name=e,this.function_name=r,this.type_args=i,this.args=n}static build(e,r,i,n){return new t(g.fromStr(e),new p(r),i,n)}serialize(e){this.module_name.serialize(e),this.function_name.serialize(e),e.serializeVector(this.type_args),e.serializeU32AsUleb128(this.args.length),this.args.forEach(r=>{r.serializeForEntryFunction(e)})}static deserialize(e){let r=g.deserialize(e),i=p.deserialize(e),n=e.deserializeVector(m),o=e.deserializeUleb128AsU32(),s=new Array;for(let c=0;c<o;c+=1){let B=e.deserializeUleb128AsU32(),D=S.deserialize(e,B);s.push(D)}return new t(r,i,n,s)}},U=class t{constructor(e,r,i){this.bytecode=e,this.type_args=r,this.args=i}serialize(e){e.serializeBytes(this.bytecode),e.serializeVector(this.type_args),e.serializeU32AsUleb128(this.args.length),this.args.forEach(r=>{r.serializeForScriptFunction(e)})}static deserialize(e){let r=e.deserializeBytes(),i=e.deserializeVector(m),n=e.deserializeUleb128AsU32(),o=new Array;for(let s=0;s<n;s+=1){let c=I(e);o.push(c)}return new t(r,i,o)}},f=class t{constructor(e,r){this.multisig_address=e,this.transaction_payload=r}serialize(e){this.multisig_address.serialize(e),this.transaction_payload===void 0?e.serializeBool(!1):(e.serializeBool(!0),this.transaction_payload.serialize(e))}static deserialize(e){let r=y.deserialize(e),i=e.deserializeBool(),n;return i&&(n=b.deserialize(e)),new t(r,n)}},b=class t extends u{constructor(e){super(),this.transaction_payload=e}serialize(e){e.serializeU32AsUleb128(0),this.transaction_payload.serialize(e)}static deserialize(e){return e.deserializeUleb128AsU32(),new t(l.deserialize(e))}};export{I as a,a as b,A as c,z as d,h as e,l as f,U as g,f as h,b as i};
2
- //# sourceMappingURL=chunk-2TQIU7CG.mjs.map
1
+ import{a as m}from"./chunk-OTY3NO7Q.mjs";import{a as g}from"./chunk-NODYW7DM.mjs";import{a as p}from"./chunk-AGBA3Y7A.mjs";import{b as y}from"./chunk-KM6UXNC7.mjs";import{a as v,b as M}from"./chunk-IECDO22V.mjs";import{a as F,b as d,c as T,d as x,e as E,f as _,g as w}from"./chunk-6FLHGOKP.mjs";import{a as S}from"./chunk-OZN3OOJV.mjs";import{a as u}from"./chunk-QQIVWB6G.mjs";function I(t){let e=t.deserializeUleb128AsU32();switch(e){case 0:return d.deserialize(t);case 1:return E.deserialize(t);case 2:return _.deserialize(t);case 3:return y.deserialize(t);case 4:return v.deserialize(t,d);case 5:return F.deserialize(t);case 6:return T.deserialize(t);case 7:return x.deserialize(t);case 8:return w.deserialize(t);case 9:return M.deserialize(t);default:throw new Error(`Unknown variant index for ScriptTransactionArgument: ${e}`)}}var a=class extends u{static deserialize(e){let r=e.deserializeUleb128AsU32();switch(r){case 0:return A.load(e);case 2:return z.load(e);case 3:return h.load(e);default:throw new Error(`Unknown variant index for TransactionPayload: ${r}`)}}},A=class t extends a{constructor(e){super(),this.script=e}serialize(e){e.serializeU32AsUleb128(0),this.script.serialize(e)}static load(e){let r=U.deserialize(e);return new t(r)}},z=class t extends a{constructor(e){super(),this.entryFunction=e}serialize(e){e.serializeU32AsUleb128(2),this.entryFunction.serialize(e)}static load(e){let r=l.deserialize(e);return new t(r)}},h=class t extends a{constructor(e){super(),this.multiSig=e}serialize(e){e.serializeU32AsUleb128(3),this.multiSig.serialize(e)}static load(e){let r=f.deserialize(e);return new t(r)}},l=class t{constructor(e,r,i,n){this.module_name=e,this.function_name=r,this.type_args=i,this.args=n}static build(e,r,i,n){return new t(g.fromStr(e),new p(r),i,n)}serialize(e){this.module_name.serialize(e),this.function_name.serialize(e),e.serializeVector(this.type_args),e.serializeU32AsUleb128(this.args.length),this.args.forEach(r=>{r.serializeForEntryFunction(e)})}static deserialize(e){let r=g.deserialize(e),i=p.deserialize(e),n=e.deserializeVector(m),o=e.deserializeUleb128AsU32(),s=new Array;for(let c=0;c<o;c+=1){let B=e.deserializeUleb128AsU32(),D=S.deserialize(e,B);s.push(D)}return new t(r,i,n,s)}},U=class t{constructor(e,r,i){this.bytecode=e,this.type_args=r,this.args=i}serialize(e){e.serializeBytes(this.bytecode),e.serializeVector(this.type_args),e.serializeU32AsUleb128(this.args.length),this.args.forEach(r=>{r.serializeForScriptFunction(e)})}static deserialize(e){let r=e.deserializeBytes(),i=e.deserializeVector(m),n=e.deserializeUleb128AsU32(),o=new Array;for(let s=0;s<n;s+=1){let c=I(e);o.push(c)}return new t(r,i,o)}},f=class t{constructor(e,r){this.multisig_address=e,this.transaction_payload=r}serialize(e){this.multisig_address.serialize(e),this.transaction_payload===void 0?e.serializeBool(!1):(e.serializeBool(!0),this.transaction_payload.serialize(e))}static deserialize(e){let r=y.deserialize(e),i=e.deserializeBool(),n;return i&&(n=b.deserialize(e)),new t(r,n)}},b=class t extends u{constructor(e){super(),this.transaction_payload=e}serialize(e){e.serializeU32AsUleb128(0),this.transaction_payload.serialize(e)}static deserialize(e){return e.deserializeUleb128AsU32(),new t(l.deserialize(e))}};export{I as a,a as b,A as c,z as d,h as e,l as f,U as g,f as h,b as i};
2
+ //# sourceMappingURL=chunk-ZPIMARUG.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/transactions/instances/transactionPayload.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\n/* eslint-disable @typescript-eslint/naming-convention */\n\nimport { Deserializer } from \"../../bcs/deserializer\";\nimport { Serializable, Serializer } from \"../../bcs/serializer\";\nimport { EntryFunctionBytes } from \"../../bcs/serializable/entryFunctionBytes\";\nimport { Bool, U128, U16, U256, U32, U64, U8 } from \"../../bcs/serializable/movePrimitives\";\nimport { MoveVector, Serialized } from \"../../bcs/serializable/moveStructs\";\nimport { AccountAddress } from \"../../core\";\nimport { Identifier } from \"./identifier\";\nimport { ModuleId } from \"./moduleId\";\nimport type { EntryFunctionArgument, ScriptFunctionArgument, TransactionArgument } from \"./transactionArgument\";\nimport { MoveModuleId, ScriptTransactionArgumentVariants, TransactionPayloadVariants } from \"../../types\";\nimport { TypeTag } from \"../typeTag\";\n\n/**\n * Deserialize a Script Transaction Argument.\n * This function retrieves and deserializes various types of script transaction arguments based on the provided deserializer.\n *\n * @param deserializer - The deserializer used to read the script transaction argument.\n * @returns The deserialized script transaction argument.\n * @throws Error if the variant index is unknown.\n */\nexport function deserializeFromScriptArgument(deserializer: Deserializer): TransactionArgument {\n // index enum variant\n const index = deserializer.deserializeUleb128AsU32();\n switch (index) {\n case ScriptTransactionArgumentVariants.U8:\n return U8.deserialize(deserializer);\n case ScriptTransactionArgumentVariants.U64:\n return U64.deserialize(deserializer);\n case ScriptTransactionArgumentVariants.U128:\n return U128.deserialize(deserializer);\n case ScriptTransactionArgumentVariants.Address:\n return AccountAddress.deserialize(deserializer);\n case ScriptTransactionArgumentVariants.U8Vector:\n return MoveVector.deserialize(deserializer, U8);\n case ScriptTransactionArgumentVariants.Bool:\n return Bool.deserialize(deserializer);\n case ScriptTransactionArgumentVariants.U16:\n return U16.deserialize(deserializer);\n case ScriptTransactionArgumentVariants.U32:\n return U32.deserialize(deserializer);\n case ScriptTransactionArgumentVariants.U256:\n return U256.deserialize(deserializer);\n case ScriptTransactionArgumentVariants.Serialized:\n return Serialized.deserialize(deserializer);\n default:\n throw new Error(`Unknown variant index for ScriptTransactionArgument: ${index}`);\n }\n}\n\n/**\n * Represents a supported Transaction Payload that can be serialized and deserialized.\n *\n * This class serves as a base for different types of transaction payloads, allowing for\n * their serialization into a format suitable for transmission and deserialization back\n * into their original form.\n */\nexport abstract class TransactionPayload extends Serializable {\n /**\n * Serialize a Transaction Payload\n */\n abstract serialize(serializer: Serializer): void;\n\n /**\n * Deserialize a Transaction Payload\n */\n\n /**\n * Deserializes a multisig transaction payload from the provided deserializer.\n * This function enables the reconstruction of a MultiSigTransactionPayload object from its serialized form.\n *\n * @param deserializer - The deserializer instance used to read the serialized data.\n */\n static deserialize(deserializer: Deserializer): TransactionPayload {\n // index enum variant\n const index = deserializer.deserializeUleb128AsU32();\n switch (index) {\n case TransactionPayloadVariants.Script:\n return TransactionPayloadScript.load(deserializer);\n case TransactionPayloadVariants.EntryFunction:\n return TransactionPayloadEntryFunction.load(deserializer);\n case TransactionPayloadVariants.Multisig:\n return TransactionPayloadMultiSig.load(deserializer);\n default:\n throw new Error(`Unknown variant index for TransactionPayload: ${index}`);\n }\n }\n}\n\n/**\n * Represents a transaction payload script that can be serialized and deserialized.\n *\n * This class encapsulates a script that defines the logic for a transaction payload.\n *\n * @extends TransactionPayload\n */\nexport class TransactionPayloadScript extends TransactionPayload {\n public readonly script: Script;\n\n /**\n * Initializes a multi-sig account transaction with the provided payload.\n *\n * @param script - The payload of the multi-sig transaction. This can only be an EntryFunction for now, but Script might be\n * supported in the future.\n */\n constructor(script: Script) {\n super();\n this.script = script;\n }\n\n /**\n * Serializes the transaction payload, enabling future support for multiple types of inner transaction payloads.\n *\n * @param serializer - The serializer instance used to serialize the transaction data.\n */\n serialize(serializer: Serializer): void {\n serializer.serializeU32AsUleb128(TransactionPayloadVariants.Script);\n this.script.serialize(serializer);\n }\n\n /**\n * Loads a MultiSig transaction payload from the provided deserializer.\n * This function helps in reconstructing a MultiSig transaction payload from its serialized form.\n *\n * @param deserializer - The deserializer used to read the serialized data.\n */\n static load(deserializer: Deserializer): TransactionPayloadScript {\n const script = Script.deserialize(deserializer);\n return new TransactionPayloadScript(script);\n }\n}\n\n/**\n * Represents a transaction payload entry function that can be serialized and deserialized.\n *\n * @extends TransactionPayload\n */\nexport class TransactionPayloadEntryFunction extends TransactionPayload {\n public readonly entryFunction: EntryFunction;\n\n constructor(entryFunction: EntryFunction) {\n super();\n this.entryFunction = entryFunction;\n }\n\n serialize(serializer: Serializer): void {\n serializer.serializeU32AsUleb128(TransactionPayloadVariants.EntryFunction);\n this.entryFunction.serialize(serializer);\n }\n\n static load(deserializer: Deserializer): TransactionPayloadEntryFunction {\n const entryFunction = EntryFunction.deserialize(deserializer);\n return new TransactionPayloadEntryFunction(entryFunction);\n }\n}\n\n/**\n * Represents a multi-signature transaction payload that can be serialized and deserialized.\n */\nexport class TransactionPayloadMultiSig extends TransactionPayload {\n public readonly multiSig: MultiSig;\n\n constructor(multiSig: MultiSig) {\n super();\n this.multiSig = multiSig;\n }\n\n serialize(serializer: Serializer): void {\n serializer.serializeU32AsUleb128(TransactionPayloadVariants.Multisig);\n this.multiSig.serialize(serializer);\n }\n\n static load(deserializer: Deserializer): TransactionPayloadMultiSig {\n const value = MultiSig.deserialize(deserializer);\n return new TransactionPayloadMultiSig(value);\n }\n}\n\n/**\n * Represents an entry function that can be serialized and deserialized.\n * This class encapsulates the details required to invoke a function within a module,\n * including the module name, function name, type arguments, and function arguments.\n *\n * @param module_name - Fully qualified module name in the format \"account_address::module_name\" (e.g., \"0x1::coin\").\n * @param function_name - The name of the function (e.g., \"transfer\").\n * @param type_args - Type arguments required by the Move function.\n * @param args - Arguments to the Move function.\n */\nexport class EntryFunction {\n public readonly module_name: ModuleId;\n\n public readonly function_name: Identifier;\n\n public readonly type_args: Array<TypeTag>;\n\n public readonly args: Array<EntryFunctionArgument>;\n\n /**\n * Contains the payload to run a function within a module.\n * @param module_name Fully qualified module name in format \"account_address::module_name\" e.g. \"0x1::coin\"\n * @param function_name The function name. e.g \"transfer\"\n * @param type_args Type arguments that move function requires.\n *\n * @example\n * A coin transfer function has one type argument \"CoinType\".\n * ```\n * public entry fun transfer<CoinType>(from: &signer, to: address, amount: u64)\n * ```\n * @param args arguments to the move function.\n *\n * @example\n * A coin transfer function has three arguments \"from\", \"to\" and \"amount\".\n * ```\n * public entry fun transfer<CoinType>(from: &signer, to: address, amount: u64)\n * ```\n */\n constructor(\n module_name: ModuleId,\n function_name: Identifier,\n type_args: Array<TypeTag>,\n args: Array<EntryFunctionArgument>,\n ) {\n this.module_name = module_name;\n this.function_name = function_name;\n this.type_args = type_args;\n this.args = args;\n }\n\n /**\n * Build an EntryFunction payload from raw primitive values.\n *\n * @param module_id - Fully qualified module name in the format \"AccountAddress::module_id\", e.g., \"0x1::coin\".\n * @param function_name - The name of the function to be called.\n * @param type_args - Type arguments that the Move function requires.\n * @param args - Arguments to the Move function.\n *\n * @example\n * A coin transfer function has one type argument \"CoinType\".\n * ```\n * public(script) fun transfer<CoinType>(from: &signer, to: address, amount: u64)\n * ```\n *\n * A coin transfer function has three arguments \"from\", \"to\", and \"amount\".\n * ```\n * public(script) fun transfer<CoinType>(from: &signer, to: address, amount: u64)\n * ```\n *\n * @returns EntryFunction\n */\n static build(\n module_id: MoveModuleId,\n function_name: string,\n type_args: Array<TypeTag>,\n args: Array<EntryFunctionArgument>,\n ): EntryFunction {\n return new EntryFunction(ModuleId.fromStr(module_id), new Identifier(function_name), type_args, args);\n }\n\n serialize(serializer: Serializer): void {\n this.module_name.serialize(serializer);\n this.function_name.serialize(serializer);\n serializer.serializeVector<TypeTag>(this.type_args);\n serializer.serializeU32AsUleb128(this.args.length);\n this.args.forEach((item: EntryFunctionArgument) => {\n item.serializeForEntryFunction(serializer);\n });\n }\n\n /**\n * Deserializes an entry function payload with the arguments represented as EntryFunctionBytes instances.\n * @see EntryFunctionBytes\n *\n * NOTE: When you deserialize an EntryFunction payload with this method, the entry function\n * arguments are populated into the deserialized instance as type-agnostic, raw fixed bytes\n * in the form of the EntryFunctionBytes class.\n *\n * In order to correctly deserialize these arguments as their actual type representations, you\n * must know the types of the arguments beforehand and deserialize them yourself individually.\n *\n * One way you could achieve this is by using the ABIs for an entry function and deserializing each\n * argument as its given, corresponding type.\n *\n * @param deserializer\n * @returns A deserialized EntryFunction payload for a transaction.\n *\n */\n static deserialize(deserializer: Deserializer): EntryFunction {\n const module_name = ModuleId.deserialize(deserializer);\n const function_name = Identifier.deserialize(deserializer);\n const type_args = deserializer.deserializeVector(TypeTag);\n\n const length = deserializer.deserializeUleb128AsU32();\n const args: Array<EntryFunctionArgument> = new Array<EntryFunctionBytes>();\n\n for (let i = 0; i < length; i += 1) {\n const fixedBytesLength = deserializer.deserializeUleb128AsU32();\n const fixedBytes = EntryFunctionBytes.deserialize(deserializer, fixedBytesLength);\n args.push(fixedBytes);\n }\n\n return new EntryFunction(module_name, function_name, type_args, args);\n }\n}\n\n/**\n * Represents a Script that can be serialized and deserialized.\n * Scripts contain the Move bytecode payload that can be submitted to the Aptos chain for execution.\n */\nexport class Script {\n /**\n * The move module bytecode\n */\n public readonly bytecode: Uint8Array;\n\n /**\n * The type arguments that the bytecode function requires.\n */\n public readonly type_args: Array<TypeTag>;\n\n /**\n * The arguments that the bytecode function requires.\n */\n public readonly args: Array<ScriptFunctionArgument>;\n\n /**\n * Scripts contain the Move bytecodes payload that can be submitted to Aptos chain for execution.\n *\n * @param bytecode The move module bytecode\n * @param type_args The type arguments that the bytecode function requires.\n *\n * @example\n * A coin transfer function has one type argument \"CoinType\".\n * ```\n * public(script) fun transfer<CoinType>(from: &signer, to: address, amount: u64)\n * ```\n * @param args The arguments that the bytecode function requires.\n *\n * @example\n * A coin transfer function has three arguments \"from\", \"to\" and \"amount\".\n * ```\n * public(script) fun transfer<CoinType>(from: &signer, to: address, amount: u64)\n * ```\n */\n constructor(bytecode: Uint8Array, type_args: Array<TypeTag>, args: Array<ScriptFunctionArgument>) {\n this.bytecode = bytecode;\n this.type_args = type_args;\n this.args = args;\n }\n\n serialize(serializer: Serializer): void {\n serializer.serializeBytes(this.bytecode);\n serializer.serializeVector<TypeTag>(this.type_args);\n serializer.serializeU32AsUleb128(this.args.length);\n this.args.forEach((item: ScriptFunctionArgument) => {\n item.serializeForScriptFunction(serializer);\n });\n }\n\n static deserialize(deserializer: Deserializer): Script {\n const bytecode = deserializer.deserializeBytes();\n const type_args = deserializer.deserializeVector(TypeTag);\n const length = deserializer.deserializeUleb128AsU32();\n const args = new Array<ScriptFunctionArgument>();\n for (let i = 0; i < length; i += 1) {\n // Note that we deserialize directly to the Move value, not its Script argument representation.\n // We are abstracting away the Script argument representation because knowing about it is\n // functionally useless.\n const scriptArgument = deserializeFromScriptArgument(deserializer);\n args.push(scriptArgument);\n }\n return new Script(bytecode, type_args, args);\n }\n}\n\n/**\n * Represents a MultiSig account that can be serialized and deserialized.\n *\n * This class encapsulates the functionality to manage multi-signature transactions, including the address of the\n * multi-sig account and the associated transaction payload.\n */\nexport class MultiSig {\n public readonly multisig_address: AccountAddress;\n\n public readonly transaction_payload?: MultiSigTransactionPayload;\n\n /**\n * Contains the payload to run a multi-sig account transaction.\n *\n * @param multisig_address The multi-sig account address the transaction will be executed as.\n *\n * @param transaction_payload The payload of the multi-sig transaction. This is optional when executing a multi-sig\n * transaction whose payload is already stored on chain.\n */\n constructor(multisig_address: AccountAddress, transaction_payload?: MultiSigTransactionPayload) {\n this.multisig_address = multisig_address;\n this.transaction_payload = transaction_payload;\n }\n\n serialize(serializer: Serializer): void {\n this.multisig_address.serialize(serializer);\n // Options are encoded with an extra u8 field before the value - 0x0 is none and 0x1 is present.\n // We use serializeBool below to create this prefix value.\n if (this.transaction_payload === undefined) {\n serializer.serializeBool(false);\n } else {\n serializer.serializeBool(true);\n this.transaction_payload.serialize(serializer);\n }\n }\n\n static deserialize(deserializer: Deserializer): MultiSig {\n const multisig_address = AccountAddress.deserialize(deserializer);\n const payloadPresent = deserializer.deserializeBool();\n let transaction_payload;\n if (payloadPresent) {\n transaction_payload = MultiSigTransactionPayload.deserialize(deserializer);\n }\n return new MultiSig(multisig_address, transaction_payload);\n }\n}\n\n/**\n * Represents a multi-signature transaction payload that can be serialized and deserialized.\n * This class is designed to encapsulate the transaction payload for multi-sig account transactions\n * as defined in the `multisig_account.move` module. Future enhancements may allow support for script\n * payloads as the `multisig_account.move` module evolves.\n */\nexport class MultiSigTransactionPayload extends Serializable {\n public readonly transaction_payload: EntryFunction;\n\n /**\n * Contains the payload to run a multi-sig account transaction.\n *\n * @param transaction_payload The payload of the multi-sig transaction.\n * This can only be EntryFunction for now but,\n * Script might be supported in the future.\n */\n constructor(transaction_payload: EntryFunction) {\n super();\n this.transaction_payload = transaction_payload;\n }\n\n serialize(serializer: Serializer): void {\n /**\n * We can support multiple types of inner transaction payload in the future.\n * For now, it's only EntryFunction but if we support more types,\n * we need to serialize with the right enum values here\n */\n serializer.serializeU32AsUleb128(0);\n this.transaction_payload.serialize(serializer);\n }\n\n static deserialize(deserializer: Deserializer): MultiSigTransactionPayload {\n // TODO: Support other types of payload beside EntryFunction.\n // This is the enum value indicating which type of payload the multisig tx contains.\n deserializer.deserializeUleb128AsU32();\n return new MultiSigTransactionPayload(EntryFunction.deserialize(deserializer));\n }\n}\n"],"mappings":"yXAyBO,SAASA,EAA8BC,EAAiD,CAE7F,IAAMC,EAAQD,EAAa,wBAAwB,EACnD,OAAQC,EAAO,CACb,OACE,OAAOC,EAAG,YAAYF,CAAY,EACpC,OACE,OAAOG,EAAI,YAAYH,CAAY,EACrC,OACE,OAAOI,EAAK,YAAYJ,CAAY,EACtC,OACE,OAAOK,EAAe,YAAYL,CAAY,EAChD,OACE,OAAOM,EAAW,YAAYN,EAAcE,CAAE,EAChD,OACE,OAAOK,EAAK,YAAYP,CAAY,EACtC,OACE,OAAOQ,EAAI,YAAYR,CAAY,EACrC,OACE,OAAOS,EAAI,YAAYT,CAAY,EACrC,OACE,OAAOU,EAAK,YAAYV,CAAY,EACtC,OACE,OAAOW,EAAW,YAAYX,CAAY,EAC5C,QACE,MAAM,IAAI,MAAM,wDAAwDC,CAAK,EAAE,CACnF,CACF,CASO,IAAeW,EAAf,cAA0CC,CAAa,CAgB5D,OAAO,YAAYb,EAAgD,CAEjE,IAAMC,EAAQD,EAAa,wBAAwB,EACnD,OAAQC,EAAO,CACb,OACE,OAAOa,EAAyB,KAAKd,CAAY,EACnD,OACE,OAAOe,EAAgC,KAAKf,CAAY,EAC1D,OACE,OAAOgB,EAA2B,KAAKhB,CAAY,EACrD,QACE,MAAM,IAAI,MAAM,iDAAiDC,CAAK,EAAE,CAC5E,CACF,CACF,EASaa,EAAN,MAAMG,UAAiCL,CAAmB,CAS/D,YAAYM,EAAgB,CAC1B,MAAM,EACN,KAAK,OAASA,CAChB,CAOA,UAAUC,EAA8B,CACtCA,EAAW,uBAAuD,EACl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BAAsBC,CAC7B,CAEA,UAAU7B,EAA8B,CACtC,KAAK,iBAAiB,UAAUA,CAAU,EAGtC,KAAK,sBAAwB,OAC/BA,EAAW,cAAc,EAAK,GAE9BA,EAAW,cAAc,EAAI,EAC7B,KAAK,oBAAoB,UAAUA,CAAU,EAEjD,CAEA,OAAO,YAAYnB,EAAsC,CACvD,IAAM+C,EAAmB1C,EAAe,YAAYL,CAAY,EAC1DiD,EAAiBjD,EAAa,gBAAgB,EAChDgD,EACJ,OAAIC,IACFD,EAAsBE,EAA2B,YAAYlD,CAAY,GAEpE,IAAI8C,EAASC,EAAkBC,CAAmB,CAC3D,CACF,EAQaE,EAAN,MAAMC,UAAmCtC,CAAa,CAU3D,YAAYmC,EAAoC,CAC9C,MAAM,EACN,KAAK,oBAAsBA,CAC7B,CAEA,UAAU7B,EAA8B,CAMtCA,EAAW,sBAAsB,CAAC,EAClC,KAAK,oBAAoB,UAAUA,CAAU,CAC/C,CAEA,OAAO,YAAYnB,EAAwD,CAGzE,OAAAA,EAAa,wBAAwB,EAC9B,IAAImD,EAA2B5B,EAAc,YAAYvB,CAAY,CAAC,CAC/E,CACF","names":["deserializeFromScriptArgument","deserializer","index","U8","U64","U128","AccountAddress","MoveVector","Bool","U16","U32","U256","Serialized","TransactionPayload","Serializable","TransactionPayloadScript","TransactionPayloadEntryFunction","TransactionPayloadMultiSig","_TransactionPayloadScript","script","serializer","Script","_TransactionPayloadEntryFunction","entryFunction","EntryFunction","_TransactionPayloadMultiSig","multiSig","value","MultiSig","_EntryFunction","module_name","function_name","type_args","args","module_id","ModuleId","Identifier","item","TypeTag","length","i","fixedBytesLength","fixedBytes","EntryFunctionBytes","_Script","bytecode","scriptArgument","_MultiSig","multisig_address","transaction_payload","payloadPresent","MultiSigTransactionPayload","_MultiSigTransactionPayload"]}
@@ -0,0 +1,2 @@
1
+ import{a as s}from"./chunk-Y267I7DC.mjs";import{a as e,b as n}from"./chunk-LEKBJ2EG.mjs";var r=class{constructor(t,i,o,a,c){this.lastUncommintedNumber=null;this.currentNumber=null;this.lock=!1;this.aptosConfig=t,this.account=i,this.maxWaitTime=o,this.maximumInFlight=a,this.sleepTime=c}async nextSequenceNumber(){for(;this.lock;)await e(this.sleepTime);this.lock=!0;let t=BigInt(0);try{if((this.lastUncommintedNumber===null||this.currentNumber===null)&&await this.initialize(),this.currentNumber-this.lastUncommintedNumber>=this.maximumInFlight){await this.update();let i=n();for(;this.currentNumber-this.lastUncommintedNumber>=this.maximumInFlight;)await e(this.sleepTime),n()-i>this.maxWaitTime?(console.warn(`Waited over 30 seconds for a transaction to commit, re-syncing ${this.account.accountAddress.toString()}`),await this.initialize()):await this.update()}t=this.currentNumber,this.currentNumber+=BigInt(1)}catch(i){console.error("error in getting next sequence number for this account",i)}finally{this.lock=!1}return t}async initialize(){let{sequence_number:t}=await s({aptosConfig:this.aptosConfig,accountAddress:this.account.accountAddress});this.currentNumber=BigInt(t),this.lastUncommintedNumber=BigInt(t)}async update(){let{sequence_number:t}=await s({aptosConfig:this.aptosConfig,accountAddress:this.account.accountAddress});return this.lastUncommintedNumber=BigInt(t),this.lastUncommintedNumber}async synchronize(){if(this.lastUncommintedNumber!==this.currentNumber){for(;this.lock;)await e(this.sleepTime);this.lock=!0;try{await this.update();let t=n();for(;this.lastUncommintedNumber!==this.currentNumber;)n()-t>this.maxWaitTime?(console.warn(`Waited over 30 seconds for a transaction to commit, re-syncing ${this.account.accountAddress.toString()}`),await this.initialize()):(await e(this.sleepTime),await this.update())}catch(t){console.error("error in synchronizing this account sequence number with the one on chain",t)}finally{this.lock=!1}}}};export{r as a};
2
+ //# sourceMappingURL=chunk-ZPQUCT22.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/transactions/management/accountSequenceNumber.ts"],"sourcesContent":["/**\n * A wrapper that handles and manages an account sequence number.\n *\n * Submit up to `maximumInFlight` transactions per account in parallel with a timeout of `sleepTime`\n * If local assumes `maximumInFlight` are in flight, determine the actual committed state from the network\n * If there are less than `maximumInFlight` due to some being committed, adjust the window\n * If `maximumInFlight` are in flight, wait `sleepTime` seconds before re-evaluating\n * If ever waiting more than `maxWaitTime` restart the sequence number to the current on-chain state\n *\n * Assumptions:\n * Accounts are expected to be managed by a single AccountSequenceNumber and not used otherwise.\n * They are initialized to the current on-chain state, so if there are already transactions in\n * flight, they may take some time to reset.\n * Accounts are automatically initialized if not explicitly\n *\n * Notes:\n * This is co-routine safe, that is many async tasks can be reading from this concurrently.\n * The state of an account cannot be used across multiple AccountSequenceNumber services.\n * The synchronize method will create a barrier that prevents additional nextSequenceNumber\n * calls until it is complete.\n * This only manages the distribution of sequence numbers it does not help handle transaction\n * failures.\n * If a transaction fails, you should call synchronize and wait for timeouts.\n */\n\nimport { AptosConfig } from \"../../api/aptosConfig\";\nimport { Account } from \"../../account\";\nimport { getInfo } from \"../../internal/account\";\nimport { nowInSeconds, sleep } from \"../../utils/helpers\";\n\n/**\n * Represents an account's sequence number management for transaction handling on the Aptos blockchain.\n * This class provides methods to retrieve the next available sequence number, synchronize with the on-chain sequence number,\n * and manage local sequence numbers while ensuring thread safety.\n *\n * @param aptosConfig - The configuration settings for Aptos.\n * @param account - The account associated with the sequence number.\n * @param maxWaitTime - The maximum time to wait for a transaction to commit.\n * @param maximumInFlight - The maximum number of transactions that can be in flight at once.\n * @param sleepTime - The time to wait before retrying to get the sequence number.\n */\nexport class AccountSequenceNumber {\n readonly aptosConfig: AptosConfig;\n\n readonly account: Account;\n\n // sequence number on chain\n // TODO: Change to Uncommitted\n lastUncommintedNumber: bigint | null = null;\n\n // local sequence number\n currentNumber: bigint | null = null;\n\n /**\n * We want to guarantee that we preserve ordering of workers to requests.\n *\n * `lock` is used to try to prevent multiple coroutines from accessing a shared resource at the same time,\n * which can result in race conditions and data inconsistency.\n * This code actually doesn't do it though, since we aren't giving out a slot, it is still somewhat a race condition.\n *\n * The ideal solution is likely that each thread grabs the next number from an incremental integer.\n * When they complete, they increment that number and that entity is able to enter the `lock`.\n * That would guarantee ordering.\n */\n lock = false;\n\n maxWaitTime: number;\n\n maximumInFlight: number;\n\n sleepTime: number;\n\n /**\n * Creates an instance of the class with the specified configuration and account details.\n * This constructor initializes the necessary parameters for managing Aptos transactions.\n *\n * @param aptosConfig - The configuration settings for Aptos.\n * @param account - The account associated with the Aptos transactions.\n * @param maxWaitTime - The maximum time to wait for a transaction to be processed, in milliseconds.\n * @param maximumInFlight - The maximum number of transactions that can be in flight at the same time.\n * @param sleepTime - The time to sleep between transaction checks, in milliseconds.\n */\n constructor(\n aptosConfig: AptosConfig,\n account: Account,\n maxWaitTime: number,\n maximumInFlight: number,\n sleepTime: number,\n ) {\n this.aptosConfig = aptosConfig;\n this.account = account;\n this.maxWaitTime = maxWaitTime;\n this.maximumInFlight = maximumInFlight;\n this.sleepTime = sleepTime;\n }\n\n /**\n * Returns the next available sequence number for this account.\n * This function ensures that the sequence number is updated and synchronized, handling potential delays in transaction commits.\n *\n * @returns {BigInt} The next available sequence number.\n */\n async nextSequenceNumber(): Promise<bigint | null> {\n /* eslint-disable no-await-in-loop */\n while (this.lock) {\n await sleep(this.sleepTime);\n }\n\n this.lock = true;\n let nextNumber = BigInt(0);\n try {\n if (this.lastUncommintedNumber === null || this.currentNumber === null) {\n await this.initialize();\n }\n\n if (this.currentNumber! - this.lastUncommintedNumber! >= this.maximumInFlight) {\n await this.update();\n\n const startTime = nowInSeconds();\n while (this.currentNumber! - this.lastUncommintedNumber! >= this.maximumInFlight) {\n await sleep(this.sleepTime);\n if (nowInSeconds() - startTime > this.maxWaitTime) {\n /* eslint-disable no-console */\n console.warn(\n `Waited over 30 seconds for a transaction to commit, re-syncing ${this.account.accountAddress.toString()}`,\n );\n await this.initialize();\n } else {\n await this.update();\n }\n }\n }\n nextNumber = this.currentNumber!;\n this.currentNumber! += BigInt(1);\n } catch (e) {\n console.error(\"error in getting next sequence number for this account\", e);\n } finally {\n this.lock = false;\n }\n return nextNumber;\n }\n\n /**\n * Initializes this account with the sequence number on chain.\n *\n * @returns {Promise<void>} A promise that resolves when the account has been initialized.\n *\n * @throws {Error} Throws an error if the account information cannot be retrieved.\n */\n async initialize(): Promise<void> {\n const { sequence_number: sequenceNumber } = await getInfo({\n aptosConfig: this.aptosConfig,\n accountAddress: this.account.accountAddress,\n });\n this.currentNumber = BigInt(sequenceNumber);\n this.lastUncommintedNumber = BigInt(sequenceNumber);\n }\n\n /**\n * Updates this account's sequence number with the one on-chain.\n *\n * @returns The on-chain sequence number for this account.\n */\n async update(): Promise<bigint> {\n const { sequence_number: sequenceNumber } = await getInfo({\n aptosConfig: this.aptosConfig,\n accountAddress: this.account.accountAddress,\n });\n this.lastUncommintedNumber = BigInt(sequenceNumber);\n return this.lastUncommintedNumber;\n }\n\n /**\n * Synchronizes the local sequence number with the sequence number on-chain for the specified account.\n * This function polls the network until all submitted transactions have either been committed or until the maximum wait time has elapsed.\n *\n * @throws {Error} Throws an error if there is an issue synchronizing the account sequence number with the one on-chain.\n */\n async synchronize(): Promise<void> {\n if (this.lastUncommintedNumber === this.currentNumber) return;\n\n /* eslint-disable no-await-in-loop */\n while (this.lock) {\n await sleep(this.sleepTime);\n }\n\n this.lock = true;\n\n try {\n await this.update();\n const startTime = nowInSeconds();\n while (this.lastUncommintedNumber !== this.currentNumber) {\n if (nowInSeconds() - startTime > this.maxWaitTime) {\n /* eslint-disable no-console */\n console.warn(\n `Waited over 30 seconds for a transaction to commit, re-syncing ${this.account.accountAddress.toString()}`,\n );\n await this.initialize();\n } else {\n await sleep(this.sleepTime);\n await this.update();\n }\n }\n } catch (e) {\n console.error(\"error in synchronizing this account sequence number with the one on chain\", e);\n } finally {\n this.lock = false;\n }\n }\n}\n"],"mappings":"yFAyCO,IAAMA,EAAN,KAA4B,CAyCjC,YACEC,EACAC,EACAC,EACAC,EACAC,EACA,CAxCF,2BAAuC,KAGvC,mBAA+B,KAa/B,UAAO,GAyBL,KAAK,YAAcJ,EACnB,KAAK,QAAUC,EACf,KAAK,YAAcC,EACnB,KAAK,gBAAkBC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AAI,CACF,MAAM,KAAK,OAAO,EAClB,IAAME,EAAYC,EAAa,EAC/B,KAAO,KAAK,wBAA0B,KAAK,eACrCA,EAAa,EAAID,EAAY,KAAK,aAEpC,QAAQ,KACN,kEAAkE,KAAK,QAAQ,eAAe,SAAS,CAAC,EAC1G,EACA,MAAM,KAAK,WAAW,IAEtB,MAAMF,EAAM,KAAK,SAAS,EAC1B,MAAM,KAAK,OAAO,EAGxB,OAASI,EAAG,CACV,QAAQ,MAAM,4EAA6EA,CAAC,CAC9F,QAAE,CACA,KAAK,KAAO,EACd,EACF,CACF","names":["AccountSequenceNumber","aptosConfig","account","maxWaitTime","maximumInFlight","sleepTime","sleep","nextNumber","startTime","nowInSeconds","e","sequenceNumber","getInfo"]}
@@ -1,2 +1,2 @@
1
- import{a as r}from"../chunk-HAT5S2XX.mjs";import{a as o}from"../chunk-B5NYEWNM.mjs";import"../chunk-UAL27G6B.mjs";import"../chunk-FVA2OPG4.mjs";export{o as LocalNode,r as Move};
1
+ import{a as o}from"../chunk-XOCRDV2V.mjs";import{a as r}from"../chunk-AITN3DO4.mjs";import"../chunk-LEKBJ2EG.mjs";import"../chunk-KDMSOCZY.mjs";export{o as LocalNode,r as Move};
2
2
  //# sourceMappingURL=index.mjs.map