@aptos-labs/ts-sdk 1.12.2 → 1.13.0-zeta.1

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 (536) hide show
  1. package/dist/common/chunk-KSEUZTKY.js +2 -0
  2. package/dist/common/chunk-KSEUZTKY.js.map +1 -0
  3. package/dist/common/cli/index.d.ts +37 -0
  4. package/dist/common/cli/index.js +2 -0
  5. package/dist/common/cli/index.js.map +1 -0
  6. package/dist/common/index.d.ts +2133 -1399
  7. package/dist/common/index.js +26 -26
  8. package/dist/common/index.js.map +1 -1
  9. package/dist/esm/{Ed25519Account-DHqzsb8B.d.mts → Ed25519Account-hkKk3b4Z.d.mts} +12 -14
  10. package/dist/esm/account/Account.d.mts +34 -0
  11. package/dist/esm/account/Account.mjs +2 -0
  12. package/dist/esm/account/Ed25519Account.d.mts +34 -0
  13. package/dist/esm/account/Ed25519Account.mjs +2 -0
  14. package/dist/esm/account/EphemeralKeyPair.d.mts +42 -0
  15. package/dist/esm/account/EphemeralKeyPair.mjs +2 -0
  16. package/dist/esm/account/KeylessAccount.d.mts +85 -0
  17. package/dist/esm/account/KeylessAccount.mjs +2 -0
  18. package/dist/esm/account/MultiKeyAccount.d.mts +99 -0
  19. package/dist/esm/account/MultiKeyAccount.mjs +2 -0
  20. package/dist/esm/account/SingleKeyAccount.d.mts +34 -0
  21. package/dist/esm/account/SingleKeyAccount.mjs +2 -0
  22. package/dist/esm/account/index.d.mts +39 -0
  23. package/dist/esm/account/index.mjs +2 -0
  24. package/dist/esm/api/account.d.mts +62 -9
  25. package/dist/esm/api/account.mjs +1 -1
  26. package/dist/esm/api/ans.d.mts +20 -28
  27. package/dist/esm/api/ans.mjs +1 -1
  28. package/dist/esm/api/aptos.d.mts +20 -9
  29. package/dist/esm/api/aptos.mjs +1 -1
  30. package/dist/esm/api/aptosConfig.d.mts +24 -0
  31. package/dist/esm/api/aptosConfig.mjs +1 -1
  32. package/dist/esm/api/coin.d.mts +14 -7
  33. package/dist/esm/api/coin.mjs +1 -1
  34. package/dist/esm/api/digitalAsset.d.mts +149 -10
  35. package/dist/esm/api/digitalAsset.mjs +1 -1
  36. package/dist/esm/api/event.d.mts +13 -8
  37. package/dist/esm/api/event.mjs +1 -1
  38. package/dist/esm/api/faucet.d.mts +3 -0
  39. package/dist/esm/api/faucet.mjs +1 -1
  40. package/dist/esm/api/fungibleAsset.d.mts +36 -13
  41. package/dist/esm/api/fungibleAsset.mjs +1 -1
  42. package/dist/esm/api/general.d.mts +55 -32
  43. package/dist/esm/api/general.mjs +1 -1
  44. package/dist/esm/api/index.d.mts +15 -9
  45. package/dist/esm/api/index.mjs +1 -1
  46. package/dist/esm/api/keyless.d.mts +75 -0
  47. package/dist/esm/api/keyless.mjs +2 -0
  48. package/dist/esm/api/staking.d.mts +9 -0
  49. package/dist/esm/api/staking.mjs +1 -1
  50. package/dist/esm/api/transaction.d.mts +59 -16
  51. package/dist/esm/api/transaction.mjs +1 -1
  52. package/dist/esm/api/transactionSubmission/build.d.mts +2 -2
  53. package/dist/esm/api/transactionSubmission/build.mjs +1 -1
  54. package/dist/esm/api/transactionSubmission/management.d.mts +9 -9
  55. package/dist/esm/api/transactionSubmission/management.mjs +1 -1
  56. package/dist/esm/api/transactionSubmission/sign.d.mts +2 -2
  57. package/dist/esm/api/transactionSubmission/sign.mjs +1 -1
  58. package/dist/esm/api/transactionSubmission/sign.mjs.map +1 -1
  59. package/dist/esm/api/transactionSubmission/simulate.d.mts +7 -7
  60. package/dist/esm/api/transactionSubmission/simulate.mjs +1 -1
  61. package/dist/esm/api/transactionSubmission/submit.d.mts +1 -1
  62. package/dist/esm/api/transactionSubmission/submit.mjs +1 -1
  63. package/dist/esm/api/utils.mjs +1 -1
  64. package/dist/esm/bcs/index.mjs +1 -1
  65. package/dist/esm/bcs/serializable/entryFunctionBytes.mjs +1 -1
  66. package/dist/esm/bcs/serializable/fixedBytes.mjs +1 -1
  67. package/dist/esm/bcs/serializable/movePrimitives.mjs +1 -1
  68. package/dist/esm/bcs/serializable/moveStructs.mjs +1 -1
  69. package/dist/esm/bcs/serializer.d.mts +2 -0
  70. package/dist/esm/bcs/serializer.mjs +1 -1
  71. package/dist/esm/chunk-2FKQJL3H.mjs +2 -0
  72. package/dist/esm/chunk-2FKQJL3H.mjs.map +1 -0
  73. package/dist/esm/chunk-2HXKDHMA.mjs +2 -0
  74. package/dist/esm/chunk-2HXKDHMA.mjs.map +1 -0
  75. package/dist/esm/{chunk-IYSHHN5A.mjs → chunk-2I2XAOH7.mjs} +2 -2
  76. package/dist/esm/chunk-2MPLQPZT.mjs +2 -0
  77. package/dist/esm/chunk-2MPLQPZT.mjs.map +1 -0
  78. package/dist/esm/{chunk-XDXI3TRT.mjs → chunk-2QGT5DK3.mjs} +2 -2
  79. package/dist/esm/{chunk-6ILDDGAX.mjs → chunk-2VCKY2ZJ.mjs} +2 -2
  80. package/dist/esm/chunk-2Z4N3GLA.mjs +2 -0
  81. package/dist/esm/chunk-2Z4N3GLA.mjs.map +1 -0
  82. package/dist/esm/{chunk-G56GPLTB.mjs → chunk-35ZI4WOQ.mjs} +2 -2
  83. package/dist/esm/{chunk-V6FZ7WZH.mjs → chunk-3FL3NLZ6.mjs} +2 -2
  84. package/dist/esm/chunk-3J2Q7O57.mjs +2 -0
  85. package/dist/esm/chunk-3J2Q7O57.mjs.map +1 -0
  86. package/dist/esm/chunk-4AOGG725.mjs +2 -0
  87. package/dist/esm/chunk-4AOGG725.mjs.map +1 -0
  88. package/dist/esm/{chunk-36QXVFR5.mjs → chunk-52DBSOFA.mjs} +2 -2
  89. package/dist/esm/{chunk-36QXVFR5.mjs.map → chunk-52DBSOFA.mjs.map} +1 -1
  90. package/dist/esm/{chunk-6APZ5TPE.mjs → chunk-5D65Z2SG.mjs} +2 -2
  91. package/dist/esm/chunk-5D65Z2SG.mjs.map +1 -0
  92. package/dist/esm/chunk-5GIWRESN.mjs +2 -0
  93. package/dist/esm/{chunk-KXR3IUJ7.mjs → chunk-5TNUDFLP.mjs} +2 -2
  94. package/dist/esm/{chunk-GHYE26Q5.mjs → chunk-6FBKUTGF.mjs} +2 -2
  95. package/dist/esm/chunk-6OKRMOWR.mjs +2 -0
  96. package/dist/esm/chunk-6OKRMOWR.mjs.map +1 -0
  97. package/dist/esm/chunk-7EQOLMEJ.mjs +2 -0
  98. package/dist/esm/{chunk-2EZJOBD2.mjs → chunk-7M3U2I23.mjs} +2 -2
  99. package/dist/esm/chunk-7M3U2I23.mjs.map +1 -0
  100. package/dist/esm/chunk-7Z6DYLCA.mjs +1 -0
  101. package/dist/esm/chunk-ACOL3VVP.mjs +2 -0
  102. package/dist/esm/chunk-ACOL3VVP.mjs.map +1 -0
  103. package/dist/esm/{chunk-BCUSI3N6.mjs → chunk-AOCNYMMX.mjs} +2 -2
  104. package/dist/esm/chunk-AQ4I7VVB.mjs +1 -0
  105. package/dist/esm/chunk-AQ4I7VVB.mjs.map +1 -0
  106. package/dist/esm/chunk-ATXQWKVH.mjs +2 -0
  107. package/dist/esm/chunk-ATXQWKVH.mjs.map +1 -0
  108. package/dist/esm/chunk-B645DPPF.mjs +2 -0
  109. package/dist/esm/chunk-B645DPPF.mjs.map +1 -0
  110. package/dist/esm/{chunk-3AYBWD76.mjs → chunk-BQCIUNLZ.mjs} +2 -2
  111. package/dist/esm/chunk-BQCIUNLZ.mjs.map +1 -0
  112. package/dist/esm/{chunk-LPB7SZHL.mjs → chunk-CHL5NDZD.mjs} +2 -2
  113. package/dist/esm/{chunk-TTUXAKCV.mjs → chunk-CYWA4AJF.mjs} +2 -2
  114. package/dist/esm/chunk-ED6PYTNG.mjs +2 -0
  115. package/dist/esm/chunk-EMFDNUP2.mjs +2 -0
  116. package/dist/esm/chunk-EMFDNUP2.mjs.map +1 -0
  117. package/dist/esm/chunk-EY3FIYMV.mjs +2 -0
  118. package/dist/esm/chunk-EY3FIYMV.mjs.map +1 -0
  119. package/dist/esm/chunk-FBPNHF54.mjs +2 -0
  120. package/dist/esm/chunk-FLYEALDB.mjs +2 -0
  121. package/dist/esm/chunk-FLYEALDB.mjs.map +1 -0
  122. package/dist/esm/chunk-HTO4EQNT.mjs +2 -0
  123. package/dist/esm/chunk-HTO4EQNT.mjs.map +1 -0
  124. package/dist/esm/chunk-HZC6A3QL.mjs +2 -0
  125. package/dist/esm/{chunk-MJPUASSD.mjs → chunk-IVBYTTN7.mjs} +2 -2
  126. package/dist/esm/chunk-J5SQQQPI.mjs +2 -0
  127. package/dist/esm/chunk-JXCZTOYC.mjs +1 -0
  128. package/dist/esm/chunk-JXCZTOYC.mjs.map +1 -0
  129. package/dist/esm/{chunk-5EN52MUT.mjs → chunk-JYFKKB34.mjs} +2 -2
  130. package/dist/esm/{chunk-KS7UY4W5.mjs → chunk-KBSAS57Q.mjs} +2 -2
  131. package/dist/esm/{chunk-Q73VKL3A.mjs → chunk-KMHJNUXU.mjs} +2 -2
  132. package/dist/esm/chunk-KWDJ4YOP.mjs +2 -0
  133. package/dist/esm/chunk-KWDJ4YOP.mjs.map +1 -0
  134. package/dist/esm/chunk-KX5ESZO7.mjs +2 -0
  135. package/dist/esm/chunk-LVYKZS54.mjs +2 -0
  136. package/dist/esm/{chunk-CXR7MOBW.mjs.map → chunk-LVYKZS54.mjs.map} +1 -1
  137. package/dist/esm/chunk-MAFSWKAF.mjs +2 -0
  138. package/dist/esm/chunk-MAFSWKAF.mjs.map +1 -0
  139. package/dist/esm/{chunk-Y2MYVQVT.mjs → chunk-MKHPGY3O.mjs} +2 -2
  140. package/dist/esm/chunk-MRCVSUJQ.mjs +2 -0
  141. package/dist/esm/chunk-MX3YIOU5.mjs +2 -0
  142. package/dist/esm/chunk-MX3YIOU5.mjs.map +1 -0
  143. package/dist/esm/chunk-NJWTXEHT.mjs +2 -0
  144. package/dist/esm/chunk-NJWTXEHT.mjs.map +1 -0
  145. package/dist/esm/{chunk-WHA7RISE.mjs → chunk-NU6UF6RM.mjs} +2 -2
  146. package/dist/esm/{chunk-GKGTODGE.mjs → chunk-OAOJVE5X.mjs} +2 -2
  147. package/dist/esm/chunk-ODA4KV4Q.mjs +2 -0
  148. package/dist/esm/chunk-OVXWFD2N.mjs +2 -0
  149. package/dist/esm/{chunk-CAGDOGXS.mjs.map → chunk-OVXWFD2N.mjs.map} +1 -1
  150. package/dist/esm/{chunk-5RUPEEIG.mjs → chunk-P4UY6YKM.mjs} +2 -2
  151. package/dist/esm/chunk-P4UY6YKM.mjs.map +1 -0
  152. package/dist/esm/{chunk-U3YYSIIT.mjs → chunk-Q225PZMV.mjs} +2 -2
  153. package/dist/esm/chunk-Q6CZDSLM.mjs +2 -0
  154. package/dist/esm/{chunk-GQR35QW3.mjs → chunk-R25D6NBC.mjs} +2 -2
  155. package/dist/esm/chunk-R25D6NBC.mjs.map +1 -0
  156. package/dist/esm/chunk-RBDX3YWC.mjs +2 -0
  157. package/dist/esm/chunk-RFSO3JRG.mjs +1 -0
  158. package/dist/esm/chunk-RFSO3JRG.mjs.map +1 -0
  159. package/dist/esm/chunk-RM7D2ITN.mjs +2 -0
  160. package/dist/esm/{chunk-C7YANDB2.mjs → chunk-RXMGJBCP.mjs} +2 -2
  161. package/dist/esm/chunk-RXMGJBCP.mjs.map +1 -0
  162. package/dist/esm/chunk-S5HG2QUD.mjs +2 -0
  163. package/dist/esm/chunk-S5HG2QUD.mjs.map +1 -0
  164. package/dist/esm/chunk-SCPXFKEK.mjs +2 -0
  165. package/dist/esm/chunk-SCPXFKEK.mjs.map +1 -0
  166. package/dist/esm/{chunk-TVHLZDCO.mjs → chunk-T3QZ5HSE.mjs} +2 -2
  167. package/dist/esm/chunk-T3QZ5HSE.mjs.map +1 -0
  168. package/dist/esm/chunk-T7TIIAWK.mjs +2 -0
  169. package/dist/esm/{chunk-MXO53VAI.mjs.map → chunk-T7TIIAWK.mjs.map} +1 -1
  170. package/dist/esm/chunk-TJDC5PWD.mjs +2 -0
  171. package/dist/esm/chunk-TR6Q7RSZ.mjs +2 -0
  172. package/dist/esm/chunk-TR6Q7RSZ.mjs.map +1 -0
  173. package/dist/esm/chunk-TT2VLL52.mjs +2 -0
  174. package/dist/esm/chunk-TT2VLL52.mjs.map +1 -0
  175. package/dist/esm/{chunk-UEKKYJGA.mjs → chunk-U426PZNM.mjs} +2 -2
  176. package/dist/esm/chunk-U426PZNM.mjs.map +1 -0
  177. package/dist/esm/{chunk-QRS4DGP3.mjs → chunk-U7EZI5D5.mjs} +2 -2
  178. package/dist/esm/{chunk-QRS4DGP3.mjs.map → chunk-U7EZI5D5.mjs.map} +1 -1
  179. package/dist/esm/chunk-ULUMROUJ.mjs +2 -0
  180. package/dist/esm/chunk-ULUMROUJ.mjs.map +1 -0
  181. package/dist/esm/chunk-UZHVGPGH.mjs +2 -0
  182. package/dist/esm/{chunk-IHPWATYH.mjs → chunk-V7VV5QW4.mjs} +2 -2
  183. package/dist/esm/chunk-V7VV5QW4.mjs.map +1 -0
  184. package/dist/esm/chunk-VAZQVN5V.mjs +2 -0
  185. package/dist/esm/chunk-VAZQVN5V.mjs.map +1 -0
  186. package/dist/esm/{chunk-OWXKKVWD.mjs → chunk-VJCQBX6V.mjs} +2 -2
  187. package/dist/esm/chunk-VJCQBX6V.mjs.map +1 -0
  188. package/dist/esm/chunk-VVJEWB26.mjs +2 -0
  189. package/dist/esm/{chunk-SRDIYE3M.mjs.map → chunk-VVJEWB26.mjs.map} +1 -1
  190. package/dist/esm/chunk-WF737YNO.mjs +2 -0
  191. package/dist/esm/chunk-WF737YNO.mjs.map +1 -0
  192. package/dist/esm/{chunk-35EWRSDK.mjs → chunk-WZCUABDL.mjs} +2 -2
  193. package/dist/esm/{chunk-EKR6HLSN.mjs → chunk-XESYWLDD.mjs} +2 -2
  194. package/dist/esm/chunk-XESYWLDD.mjs.map +1 -0
  195. package/dist/esm/{chunk-KAGLWBIJ.mjs → chunk-XI4LX4EC.mjs} +2 -2
  196. package/dist/esm/chunk-XJ3HRNOP.mjs +2 -0
  197. package/dist/esm/chunk-XJ3HRNOP.mjs.map +1 -0
  198. package/dist/esm/{chunk-KLAYDUFD.mjs → chunk-XJFGX3E4.mjs} +2 -2
  199. package/dist/esm/chunk-XJFGX3E4.mjs.map +1 -0
  200. package/dist/esm/chunk-YIG37BG2.mjs +2 -0
  201. package/dist/esm/chunk-YIG37BG2.mjs.map +1 -0
  202. package/dist/esm/chunk-YNBWXDRS.mjs +2 -0
  203. package/dist/esm/chunk-YP3RMVL3.mjs +2 -0
  204. package/dist/esm/chunk-YP3RMVL3.mjs.map +1 -0
  205. package/dist/esm/chunk-YPBHGSXY.mjs +2 -0
  206. package/dist/esm/chunk-YPBHGSXY.mjs.map +1 -0
  207. package/dist/esm/chunk-YU7DNMEA.mjs +2 -0
  208. package/dist/esm/chunk-YU7DNMEA.mjs.map +1 -0
  209. package/dist/esm/chunk-ZG6HOK6A.mjs +2 -0
  210. package/dist/esm/chunk-ZG6HOK6A.mjs.map +1 -0
  211. package/dist/esm/{chunk-U43KR4TW.mjs → chunk-ZGWWPB3D.mjs} +2 -2
  212. package/dist/esm/chunk-ZGWWPB3D.mjs.map +1 -0
  213. package/dist/esm/chunk-ZUDMSBVZ.mjs +2 -0
  214. package/dist/esm/chunk-ZUDMSBVZ.mjs.map +1 -0
  215. package/dist/esm/client/core.mjs +1 -1
  216. package/dist/esm/client/get.d.mts +2 -1
  217. package/dist/esm/client/get.mjs +1 -1
  218. package/dist/esm/client/index.d.mts +2 -2
  219. package/dist/esm/client/index.mjs +1 -1
  220. package/dist/esm/client/post.d.mts +3 -1
  221. package/dist/esm/client/post.mjs +1 -1
  222. package/dist/esm/client/types.mjs +1 -1
  223. package/dist/esm/core/account/utils/address.mjs +1 -1
  224. package/dist/esm/core/account/utils/index.mjs +1 -1
  225. package/dist/esm/core/accountAddress.mjs +1 -1
  226. package/dist/esm/core/authenticationKey.d.mts +1 -1
  227. package/dist/esm/core/authenticationKey.mjs +1 -1
  228. package/dist/esm/core/common.mjs +1 -1
  229. package/dist/esm/core/crypto/ed25519.d.mts +9 -12
  230. package/dist/esm/core/crypto/ed25519.mjs +1 -1
  231. package/dist/esm/core/crypto/ephemeral.d.mts +76 -0
  232. package/dist/esm/core/crypto/ephemeral.mjs +2 -0
  233. package/dist/esm/core/crypto/ephemeral.mjs.map +1 -0
  234. package/dist/esm/core/crypto/hdKey.d.mts +15 -1
  235. package/dist/esm/core/crypto/hdKey.mjs +1 -1
  236. package/dist/esm/core/crypto/index.d.mts +8 -6
  237. package/dist/esm/core/crypto/index.mjs +1 -1
  238. package/dist/esm/core/crypto/keyless.d.mts +217 -0
  239. package/dist/esm/core/crypto/keyless.mjs +2 -0
  240. package/dist/esm/core/crypto/keyless.mjs.map +1 -0
  241. package/dist/esm/core/crypto/multiEd25519.d.mts +1 -1
  242. package/dist/esm/core/crypto/multiEd25519.mjs +1 -1
  243. package/dist/esm/core/crypto/multiKey.d.mts +5 -4
  244. package/dist/esm/core/crypto/multiKey.mjs +1 -1
  245. package/dist/esm/core/crypto/poseidon.d.mts +7 -0
  246. package/dist/esm/core/crypto/poseidon.mjs +2 -0
  247. package/dist/esm/core/crypto/poseidon.mjs.map +1 -0
  248. package/dist/esm/core/crypto/privateKey.d.mts +1 -1
  249. package/dist/esm/core/crypto/publicKey.d.mts +1 -1
  250. package/dist/esm/core/crypto/publicKey.mjs +1 -1
  251. package/dist/esm/core/crypto/secp256k1.d.mts +8 -1
  252. package/dist/esm/core/crypto/secp256k1.mjs +1 -1
  253. package/dist/esm/core/crypto/signature.mjs +1 -1
  254. package/dist/esm/core/crypto/singleKey.d.mts +1 -1
  255. package/dist/esm/core/crypto/singleKey.mjs +1 -1
  256. package/dist/esm/core/crypto/utils.mjs +1 -1
  257. package/dist/esm/core/hex.mjs +1 -1
  258. package/dist/esm/core/index.d.mts +7 -8
  259. package/dist/esm/core/index.mjs +1 -1
  260. package/dist/esm/index.d.mts +16 -10
  261. package/dist/esm/index.mjs +1 -1
  262. package/dist/esm/internal/account.d.mts +14 -2
  263. package/dist/esm/internal/account.mjs +1 -1
  264. package/dist/esm/internal/ans.d.mts +4 -4
  265. package/dist/esm/internal/ans.mjs +1 -1
  266. package/dist/esm/internal/coin.d.mts +8 -8
  267. package/dist/esm/internal/coin.mjs +1 -1
  268. package/dist/esm/internal/digitalAsset.d.mts +11 -11
  269. package/dist/esm/internal/digitalAsset.mjs +1 -1
  270. package/dist/esm/internal/event.d.mts +1 -1
  271. package/dist/esm/internal/event.mjs +1 -1
  272. package/dist/esm/internal/faucet.d.mts +1 -1
  273. package/dist/esm/internal/faucet.mjs +1 -1
  274. package/dist/esm/internal/fungibleAsset.d.mts +12 -12
  275. package/dist/esm/internal/fungibleAsset.mjs +1 -1
  276. package/dist/esm/internal/general.mjs +1 -1
  277. package/dist/esm/internal/keyless.d.mts +68 -0
  278. package/dist/esm/internal/keyless.mjs +2 -0
  279. package/dist/esm/internal/keyless.mjs.map +1 -0
  280. package/dist/esm/internal/staking.d.mts +1 -1
  281. package/dist/esm/internal/staking.mjs +1 -1
  282. package/dist/esm/internal/transaction.d.mts +5 -1
  283. package/dist/esm/internal/transaction.mjs +1 -1
  284. package/dist/esm/internal/transactionSubmission.d.mts +2 -2
  285. package/dist/esm/internal/transactionSubmission.mjs +1 -1
  286. package/dist/esm/internal/view.d.mts +7 -7
  287. package/dist/esm/internal/view.mjs +1 -1
  288. package/dist/esm/transactions/authenticator/account.d.mts +4 -5
  289. package/dist/esm/transactions/authenticator/account.mjs +1 -1
  290. package/dist/esm/transactions/authenticator/index.d.mts +1 -1
  291. package/dist/esm/transactions/authenticator/index.mjs +1 -1
  292. package/dist/esm/transactions/authenticator/transaction.d.mts +1 -1
  293. package/dist/esm/transactions/authenticator/transaction.mjs +1 -1
  294. package/dist/esm/transactions/index.d.mts +3 -3
  295. package/dist/esm/transactions/index.mjs +1 -1
  296. package/dist/esm/transactions/instances/chainId.mjs +1 -1
  297. package/dist/esm/transactions/instances/identifier.mjs +1 -1
  298. package/dist/esm/transactions/instances/index.d.mts +1 -1
  299. package/dist/esm/transactions/instances/index.mjs +1 -1
  300. package/dist/esm/transactions/instances/moduleId.d.mts +1 -1
  301. package/dist/esm/transactions/instances/moduleId.mjs +1 -1
  302. package/dist/esm/transactions/instances/multiAgentTransaction.mjs +1 -1
  303. package/dist/esm/transactions/instances/rawTransaction.mjs +1 -1
  304. package/dist/esm/transactions/instances/rotationProofChallenge.d.mts +1 -1
  305. package/dist/esm/transactions/instances/rotationProofChallenge.mjs +1 -1
  306. package/dist/esm/transactions/instances/signedTransaction.d.mts +1 -1
  307. package/dist/esm/transactions/instances/signedTransaction.mjs +1 -1
  308. package/dist/esm/transactions/instances/simpleTransaction.mjs +1 -1
  309. package/dist/esm/transactions/instances/transactionPayload.d.mts +1 -1
  310. package/dist/esm/transactions/instances/transactionPayload.mjs +1 -1
  311. package/dist/esm/transactions/management/accountSequenceNumber.d.mts +14 -2
  312. package/dist/esm/transactions/management/accountSequenceNumber.mjs +1 -1
  313. package/dist/esm/transactions/management/index.d.mts +3 -3
  314. package/dist/esm/transactions/management/index.mjs +1 -1
  315. package/dist/esm/transactions/management/transactionWorker.d.mts +2 -2
  316. package/dist/esm/transactions/management/transactionWorker.mjs +1 -1
  317. package/dist/esm/transactions/transactionBuilder/helpers.d.mts +9 -9
  318. package/dist/esm/transactions/transactionBuilder/helpers.mjs +1 -1
  319. package/dist/esm/transactions/transactionBuilder/index.d.mts +9 -9
  320. package/dist/esm/transactions/transactionBuilder/index.mjs +1 -1
  321. package/dist/esm/transactions/transactionBuilder/remoteAbi.d.mts +6 -6
  322. package/dist/esm/transactions/transactionBuilder/remoteAbi.mjs +1 -1
  323. package/dist/esm/transactions/transactionBuilder/signingMessage.d.mts +47 -0
  324. package/dist/esm/transactions/transactionBuilder/signingMessage.mjs +2 -0
  325. package/dist/esm/transactions/transactionBuilder/signingMessage.mjs.map +1 -0
  326. package/dist/esm/transactions/transactionBuilder/transactionBuilder.d.mts +7 -29
  327. package/dist/esm/transactions/transactionBuilder/transactionBuilder.mjs +1 -1
  328. package/dist/esm/transactions/typeTag/index.mjs +1 -1
  329. package/dist/esm/transactions/typeTag/parser.mjs +1 -1
  330. package/dist/esm/transactions/types.d.mts +7 -7
  331. package/dist/esm/types/index.d.mts +18 -3
  332. package/dist/esm/types/index.mjs +1 -1
  333. package/dist/esm/types/keyless.d.mts +14 -0
  334. package/dist/esm/types/keyless.mjs +1 -0
  335. package/dist/esm/types/keyless.mjs.map +1 -0
  336. package/dist/esm/utils/apiEndpoints.d.mts +3 -1
  337. package/dist/esm/utils/apiEndpoints.mjs +1 -1
  338. package/dist/esm/utils/const.d.mts +5 -3
  339. package/dist/esm/utils/const.mjs +1 -1
  340. package/dist/esm/utils/index.d.mts +1 -1
  341. package/dist/esm/utils/index.mjs +1 -1
  342. package/dist/esm/version.d.mts +1 -1
  343. package/dist/esm/version.mjs +1 -1
  344. package/package.json +13 -7
  345. package/src/{core/account → account}/Account.ts +12 -16
  346. package/src/{core/account → account}/Ed25519Account.ts +13 -7
  347. package/src/account/EphemeralKeyPair.ts +78 -0
  348. package/src/account/KeylessAccount.ts +230 -0
  349. package/src/account/MultiKeyAccount.ts +121 -0
  350. package/src/{core/account → account}/SingleKeyAccount.ts +13 -7
  351. package/src/account/index.ts +6 -0
  352. package/src/api/account.ts +50 -8
  353. package/src/api/ans.ts +10 -17
  354. package/src/api/aptos.ts +10 -0
  355. package/src/api/aptosConfig.ts +50 -1
  356. package/src/api/coin.ts +7 -0
  357. package/src/api/digitalAsset.ts +142 -2
  358. package/src/api/event.ts +13 -8
  359. package/src/api/faucet.ts +3 -0
  360. package/src/api/fungibleAsset.ts +28 -4
  361. package/src/api/general.ts +48 -25
  362. package/src/api/keyless.ts +55 -0
  363. package/src/api/staking.ts +9 -0
  364. package/src/api/transaction.ts +59 -15
  365. package/src/api/transactionSubmission/management.ts +1 -1
  366. package/src/api/transactionSubmission/sign.ts +1 -1
  367. package/src/bcs/serializer.ts +18 -0
  368. package/src/client/core.ts +10 -1
  369. package/src/client/get.ts +6 -0
  370. package/src/client/post.ts +13 -0
  371. package/src/core/crypto/ed25519.ts +50 -34
  372. package/src/core/crypto/ephemeral.ts +147 -0
  373. package/src/core/crypto/hdKey.ts +31 -0
  374. package/src/core/crypto/index.ts +2 -0
  375. package/src/core/crypto/keyless.ts +502 -0
  376. package/src/core/crypto/multiKey.ts +23 -11
  377. package/src/core/crypto/poseidon.ts +134 -0
  378. package/src/core/crypto/secp256k1.ts +9 -3
  379. package/src/core/crypto/singleKey.ts +11 -0
  380. package/src/core/index.ts +0 -1
  381. package/src/index.ts +1 -0
  382. package/src/internal/account.ts +7 -10
  383. package/src/internal/ans.ts +2 -1
  384. package/src/internal/digitalAsset.ts +3 -2
  385. package/src/internal/fungibleAsset.ts +4 -3
  386. package/src/internal/keyless.ts +205 -0
  387. package/src/internal/transaction.ts +48 -10
  388. package/src/internal/transactionSubmission.ts +8 -7
  389. package/src/transactions/authenticator/account.ts +6 -11
  390. package/src/transactions/management/accountSequenceNumber.ts +1 -1
  391. package/src/transactions/management/transactionWorker.ts +8 -2
  392. package/src/transactions/transactionBuilder/index.ts +2 -0
  393. package/src/transactions/transactionBuilder/signingMessage.ts +75 -0
  394. package/src/transactions/transactionBuilder/transactionBuilder.ts +3 -80
  395. package/src/types/index.ts +21 -0
  396. package/src/types/keyless.ts +6 -0
  397. package/src/utils/apiEndpoints.ts +14 -0
  398. package/src/utils/const.ts +4 -2
  399. package/src/version.ts +1 -1
  400. package/dist/esm/chunk-2EZJOBD2.mjs.map +0 -1
  401. package/dist/esm/chunk-3AYBWD76.mjs.map +0 -1
  402. package/dist/esm/chunk-45ZZWQ7X.mjs +0 -2
  403. package/dist/esm/chunk-45ZZWQ7X.mjs.map +0 -1
  404. package/dist/esm/chunk-4ILXLBGX.mjs +0 -2
  405. package/dist/esm/chunk-4NHWV5AI.mjs +0 -2
  406. package/dist/esm/chunk-4QMXOWHP.mjs +0 -1
  407. package/dist/esm/chunk-5GKROFZ4.mjs +0 -2
  408. package/dist/esm/chunk-5GKROFZ4.mjs.map +0 -1
  409. package/dist/esm/chunk-5RUPEEIG.mjs.map +0 -1
  410. package/dist/esm/chunk-6APZ5TPE.mjs.map +0 -1
  411. package/dist/esm/chunk-6BR5UJDT.mjs +0 -2
  412. package/dist/esm/chunk-AEVRPB4E.mjs +0 -2
  413. package/dist/esm/chunk-AEVRPB4E.mjs.map +0 -1
  414. package/dist/esm/chunk-ARGODLTZ.mjs +0 -2
  415. package/dist/esm/chunk-ARGODLTZ.mjs.map +0 -1
  416. package/dist/esm/chunk-ASXXZH2D.mjs +0 -2
  417. package/dist/esm/chunk-ASXXZH2D.mjs.map +0 -1
  418. package/dist/esm/chunk-B7X6PSE7.mjs +0 -2
  419. package/dist/esm/chunk-C67BKZND.mjs +0 -2
  420. package/dist/esm/chunk-C67BKZND.mjs.map +0 -1
  421. package/dist/esm/chunk-C7YANDB2.mjs.map +0 -1
  422. package/dist/esm/chunk-CAGDOGXS.mjs +0 -2
  423. package/dist/esm/chunk-CEHCDA3G.mjs +0 -2
  424. package/dist/esm/chunk-CQS6ZCJ7.mjs +0 -2
  425. package/dist/esm/chunk-CQS6ZCJ7.mjs.map +0 -1
  426. package/dist/esm/chunk-CXR7MOBW.mjs +0 -2
  427. package/dist/esm/chunk-CYNQRMO5.mjs +0 -2
  428. package/dist/esm/chunk-CYNQRMO5.mjs.map +0 -1
  429. package/dist/esm/chunk-DUP7XY5P.mjs +0 -2
  430. package/dist/esm/chunk-DUP7XY5P.mjs.map +0 -1
  431. package/dist/esm/chunk-E7FWVXGX.mjs +0 -1
  432. package/dist/esm/chunk-EKR6HLSN.mjs.map +0 -1
  433. package/dist/esm/chunk-EV75CYGN.mjs +0 -2
  434. package/dist/esm/chunk-EV75CYGN.mjs.map +0 -1
  435. package/dist/esm/chunk-F7EMGK4M.mjs +0 -2
  436. package/dist/esm/chunk-FKTXWOKR.mjs +0 -2
  437. package/dist/esm/chunk-FKTXWOKR.mjs.map +0 -1
  438. package/dist/esm/chunk-GQR35QW3.mjs.map +0 -1
  439. package/dist/esm/chunk-IHPWATYH.mjs.map +0 -1
  440. package/dist/esm/chunk-IZF6DFAL.mjs +0 -2
  441. package/dist/esm/chunk-JOLLCFQL.mjs +0 -2
  442. package/dist/esm/chunk-JOLLCFQL.mjs.map +0 -1
  443. package/dist/esm/chunk-KLAYDUFD.mjs.map +0 -1
  444. package/dist/esm/chunk-LG7RJQ57.mjs +0 -2
  445. package/dist/esm/chunk-LR65XHSF.mjs +0 -2
  446. package/dist/esm/chunk-LR65XHSF.mjs.map +0 -1
  447. package/dist/esm/chunk-MLWIHWNH.mjs +0 -1
  448. package/dist/esm/chunk-MXO53VAI.mjs +0 -2
  449. package/dist/esm/chunk-N3U47Y6Y.mjs +0 -2
  450. package/dist/esm/chunk-NJRNZEHX.mjs +0 -2
  451. package/dist/esm/chunk-NJRNZEHX.mjs.map +0 -1
  452. package/dist/esm/chunk-OWXKKVWD.mjs.map +0 -1
  453. package/dist/esm/chunk-PF57EOJY.mjs +0 -2
  454. package/dist/esm/chunk-QJAI7DNA.mjs +0 -2
  455. package/dist/esm/chunk-QJAI7DNA.mjs.map +0 -1
  456. package/dist/esm/chunk-R7G3CLRI.mjs +0 -1
  457. package/dist/esm/chunk-RIUFW2OG.mjs +0 -2
  458. package/dist/esm/chunk-RIUFW2OG.mjs.map +0 -1
  459. package/dist/esm/chunk-SK5TPUAN.mjs +0 -2
  460. package/dist/esm/chunk-SOBCWGBM.mjs +0 -2
  461. package/dist/esm/chunk-SOBCWGBM.mjs.map +0 -1
  462. package/dist/esm/chunk-SRDIYE3M.mjs +0 -2
  463. package/dist/esm/chunk-SWZOGZJ6.mjs +0 -2
  464. package/dist/esm/chunk-SWZOGZJ6.mjs.map +0 -1
  465. package/dist/esm/chunk-T6J2LHHS.mjs +0 -2
  466. package/dist/esm/chunk-T6J2LHHS.mjs.map +0 -1
  467. package/dist/esm/chunk-TVHLZDCO.mjs.map +0 -1
  468. package/dist/esm/chunk-U43KR4TW.mjs.map +0 -1
  469. package/dist/esm/chunk-UEKKYJGA.mjs.map +0 -1
  470. package/dist/esm/chunk-UGPALAPN.mjs +0 -2
  471. package/dist/esm/chunk-URTTOOEM.mjs +0 -2
  472. package/dist/esm/chunk-URTTOOEM.mjs.map +0 -1
  473. package/dist/esm/chunk-UVSRX4SV.mjs +0 -1
  474. package/dist/esm/chunk-W3V4IGGB.mjs +0 -2
  475. package/dist/esm/chunk-WMJXRWVE.mjs +0 -2
  476. package/dist/esm/chunk-XX5J7KKC.mjs +0 -2
  477. package/dist/esm/chunk-XX5J7KKC.mjs.map +0 -1
  478. package/dist/esm/chunk-YZGEWPDE.mjs +0 -2
  479. package/dist/esm/chunk-YZGEWPDE.mjs.map +0 -1
  480. package/dist/esm/chunk-ZBT4HP6E.mjs +0 -2
  481. package/dist/esm/chunk-ZBT4HP6E.mjs.map +0 -1
  482. package/dist/esm/chunk-ZTIRBBNS.mjs +0 -2
  483. package/dist/esm/core/account/Account.d.mts +0 -20
  484. package/dist/esm/core/account/Account.mjs +0 -2
  485. package/dist/esm/core/account/Ed25519Account.d.mts +0 -20
  486. package/dist/esm/core/account/Ed25519Account.mjs +0 -2
  487. package/dist/esm/core/account/SingleKeyAccount.d.mts +0 -20
  488. package/dist/esm/core/account/SingleKeyAccount.mjs +0 -2
  489. package/dist/esm/core/account/index.d.mts +0 -21
  490. package/dist/esm/core/account/index.mjs +0 -2
  491. package/src/core/account/index.ts +0 -4
  492. /package/dist/esm/{core/account → account}/Account.mjs.map +0 -0
  493. /package/dist/esm/{core/account → account}/Ed25519Account.mjs.map +0 -0
  494. /package/dist/esm/{chunk-4QMXOWHP.mjs.map → account/EphemeralKeyPair.mjs.map} +0 -0
  495. /package/dist/esm/{chunk-E7FWVXGX.mjs.map → account/KeylessAccount.mjs.map} +0 -0
  496. /package/dist/esm/{chunk-MLWIHWNH.mjs.map → account/MultiKeyAccount.mjs.map} +0 -0
  497. /package/dist/esm/{core/account → account}/SingleKeyAccount.mjs.map +0 -0
  498. /package/dist/esm/{core/account → account}/index.mjs.map +0 -0
  499. /package/dist/esm/{chunk-R7G3CLRI.mjs.map → api/keyless.mjs.map} +0 -0
  500. /package/dist/esm/{chunk-IYSHHN5A.mjs.map → chunk-2I2XAOH7.mjs.map} +0 -0
  501. /package/dist/esm/{chunk-XDXI3TRT.mjs.map → chunk-2QGT5DK3.mjs.map} +0 -0
  502. /package/dist/esm/{chunk-6ILDDGAX.mjs.map → chunk-2VCKY2ZJ.mjs.map} +0 -0
  503. /package/dist/esm/{chunk-G56GPLTB.mjs.map → chunk-35ZI4WOQ.mjs.map} +0 -0
  504. /package/dist/esm/{chunk-V6FZ7WZH.mjs.map → chunk-3FL3NLZ6.mjs.map} +0 -0
  505. /package/dist/esm/{chunk-WMJXRWVE.mjs.map → chunk-5GIWRESN.mjs.map} +0 -0
  506. /package/dist/esm/{chunk-KXR3IUJ7.mjs.map → chunk-5TNUDFLP.mjs.map} +0 -0
  507. /package/dist/esm/{chunk-GHYE26Q5.mjs.map → chunk-6FBKUTGF.mjs.map} +0 -0
  508. /package/dist/esm/{chunk-CEHCDA3G.mjs.map → chunk-7EQOLMEJ.mjs.map} +0 -0
  509. /package/dist/esm/{chunk-UVSRX4SV.mjs.map → chunk-7Z6DYLCA.mjs.map} +0 -0
  510. /package/dist/esm/{chunk-BCUSI3N6.mjs.map → chunk-AOCNYMMX.mjs.map} +0 -0
  511. /package/dist/esm/{chunk-LPB7SZHL.mjs.map → chunk-CHL5NDZD.mjs.map} +0 -0
  512. /package/dist/esm/{chunk-TTUXAKCV.mjs.map → chunk-CYWA4AJF.mjs.map} +0 -0
  513. /package/dist/esm/{chunk-W3V4IGGB.mjs.map → chunk-ED6PYTNG.mjs.map} +0 -0
  514. /package/dist/esm/{chunk-LG7RJQ57.mjs.map → chunk-FBPNHF54.mjs.map} +0 -0
  515. /package/dist/esm/{chunk-4NHWV5AI.mjs.map → chunk-HZC6A3QL.mjs.map} +0 -0
  516. /package/dist/esm/{chunk-MJPUASSD.mjs.map → chunk-IVBYTTN7.mjs.map} +0 -0
  517. /package/dist/esm/{chunk-4ILXLBGX.mjs.map → chunk-J5SQQQPI.mjs.map} +0 -0
  518. /package/dist/esm/{chunk-5EN52MUT.mjs.map → chunk-JYFKKB34.mjs.map} +0 -0
  519. /package/dist/esm/{chunk-KS7UY4W5.mjs.map → chunk-KBSAS57Q.mjs.map} +0 -0
  520. /package/dist/esm/{chunk-Q73VKL3A.mjs.map → chunk-KMHJNUXU.mjs.map} +0 -0
  521. /package/dist/esm/{chunk-UGPALAPN.mjs.map → chunk-KX5ESZO7.mjs.map} +0 -0
  522. /package/dist/esm/{chunk-Y2MYVQVT.mjs.map → chunk-MKHPGY3O.mjs.map} +0 -0
  523. /package/dist/esm/{chunk-PF57EOJY.mjs.map → chunk-MRCVSUJQ.mjs.map} +0 -0
  524. /package/dist/esm/{chunk-WHA7RISE.mjs.map → chunk-NU6UF6RM.mjs.map} +0 -0
  525. /package/dist/esm/{chunk-GKGTODGE.mjs.map → chunk-OAOJVE5X.mjs.map} +0 -0
  526. /package/dist/esm/{chunk-6BR5UJDT.mjs.map → chunk-ODA4KV4Q.mjs.map} +0 -0
  527. /package/dist/esm/{chunk-U3YYSIIT.mjs.map → chunk-Q225PZMV.mjs.map} +0 -0
  528. /package/dist/esm/{chunk-SK5TPUAN.mjs.map → chunk-Q6CZDSLM.mjs.map} +0 -0
  529. /package/dist/esm/{chunk-ZTIRBBNS.mjs.map → chunk-RBDX3YWC.mjs.map} +0 -0
  530. /package/dist/esm/{chunk-B7X6PSE7.mjs.map → chunk-RM7D2ITN.mjs.map} +0 -0
  531. /package/dist/esm/{chunk-F7EMGK4M.mjs.map → chunk-TJDC5PWD.mjs.map} +0 -0
  532. /package/dist/esm/{chunk-N3U47Y6Y.mjs.map → chunk-UZHVGPGH.mjs.map} +0 -0
  533. /package/dist/esm/{chunk-35EWRSDK.mjs.map → chunk-WZCUABDL.mjs.map} +0 -0
  534. /package/dist/esm/{chunk-KAGLWBIJ.mjs.map → chunk-XI4LX4EC.mjs.map} +0 -0
  535. /package/dist/esm/{chunk-IZF6DFAL.mjs.map → chunk-YNBWXDRS.mjs.map} +0 -0
  536. /package/dist/esm/{publicKey-B3XRNhHO.d.mts → publicKey-lq5djCIY.d.mts} +0 -0
@@ -1,2 +1,2 @@
1
- import{b as l,c as f,d as x,e as v,f as U,g as A,h as P,i as C,j as y,k as E,l as b,m as I,n as G,o as M}from"./chunk-U3YYSIIT.mjs";import{a as d}from"./chunk-B7X6PSE7.mjs";import{b as w}from"./chunk-QRS4DGP3.mjs";function N(e){return!!e.match(/^[_a-zA-Z0-9]+$/)}function V(e){return!!e.match(/\s/)}function $(e){return!!e.match(/^T[0-9]+$/)}function F(e,n){let i=n;for(;i<e.length;i+=1){let c=e[i];if(!V(c))break}return i}var S=(t=>(t.InvalidTypeTag="unknown type",t.UnexpectedGenericType="unexpected generic type",t.UnexpectedTypeArgumentClose="unexpected '>'",t.UnexpectedWhitespaceCharacter="unexpected whitespace character",t.UnexpectedComma="unexpected ','",t.TypeArgumentCountMismatch="type argument count doesn't match expected amount",t.MissingTypeArgumentClose="no matching '>' for '<'",t.UnexpectedPrimitiveTypeArguments="primitive types not expected to have type arguments",t.UnexpectedVectorTypeArgumentCount="vector type expected to have exactly one type argument",t.UnexpectedStructFormat="unexpected struct format, must be of the form 0xaddress::module_name::struct_name",t.InvalidModuleNameCharacter="module name must only contain alphanumeric or '_' characters",t.InvalidStructNameCharacter="struct name must only contain alphanumeric or '_' characters",t))(S||{}),r=class extends Error{constructor(n,i){super(`Failed to parse typeTag '${n}', ${i}`)}};function Z(e,n){let i=n?.allowGenerics??!1,c=[],o=[],p=[],T=0,a="",u=1;for(;T<e.length;){let g=e[T];if(g==="<")c.push({savedExpectedTypes:u,savedStr:a,savedTypes:p}),a="",p=[],u=1;else if(g===">"){if(a!==""){let _=m(a,o,i);p.push(_)}let s=c.pop();if(s===void 0)throw new r(e,"unexpected '>'");if(u!==p.length)throw new r(e,"type argument count doesn't match expected amount");let{savedStr:h,savedTypes:t,savedExpectedTypes:W}=s;o=p,p=t,a=h,u=W}else if(g===","){if(a.length!==0){let s=m(a,o,i);o=[],p.push(s),a="",u+=1}}else if(V(g)){let s=!1;if(a.length!==0){let t=m(a,o,i);o=[],p.push(t),a="",s=!0}T=F(e,T);let h=e[T];if(T<e.length&&s&&h!==","&&h!==">")throw new r(e,"unexpected whitespace character");continue}else a+=g;T+=1}if(c.length>0)throw new r(e,"no matching '>' for '<'");switch(p.length){case 0:return m(a,o,i);case 1:if(a==="")return p[0];throw new r(e,"unexpected ','");default:throw new r(e,"unexpected whitespace character")}}function m(e,n,i){switch(e){case"&signer":if(n.length>0)throw new r(e,"primitive types not expected to have type arguments");return new E(new y);case"signer":if(n.length>0)throw new r(e,"primitive types not expected to have type arguments");return new y;case"bool":if(n.length>0)throw new r(e,"primitive types not expected to have type arguments");return new l;case"address":if(n.length>0)throw new r(e,"primitive types not expected to have type arguments");return new C;case"u8":if(n.length>0)throw new r(e,"primitive types not expected to have type arguments");return new f;case"u16":if(n.length>0)throw new r(e,"primitive types not expected to have type arguments");return new x;case"u32":if(n.length>0)throw new r(e,"primitive types not expected to have type arguments");return new v;case"u64":if(n.length>0)throw new r(e,"primitive types not expected to have type arguments");return new U;case"u128":if(n.length>0)throw new r(e,"primitive types not expected to have type arguments");return new A;case"u256":if(n.length>0)throw new r(e,"primitive types not expected to have type arguments");return new P;case"vector":if(n.length!==1)throw new r(e,"vector type expected to have exactly one type argument");return new I(n[0]);default:if($(e)){if(i)return new b(Number(e.split("T")[1]));throw new r(e,"unexpected generic type")}if(!e.match(/:/))throw new r(e,"unknown type");let c=e.split("::");if(c.length!==3)throw new r(e,"unexpected struct format, must be of the form 0xaddress::module_name::struct_name");if(!N(c[1]))throw new r(e,"module name must only contain alphanumeric or '_' characters");if(!N(c[2]))throw new r(e,"struct name must only contain alphanumeric or '_' characters");return new G(new M(w.fromString(c[0]),new d(c[1]),new d(c[2]),n))}}export{S as a,r as b,Z as c};
2
- //# sourceMappingURL=chunk-MJPUASSD.mjs.map
1
+ import{b as l,c as f,d as x,e as v,f as U,g as A,h as P,i as C,j as y,k as E,l as b,m as I,n as G,o as M}from"./chunk-Q225PZMV.mjs";import{a as d}from"./chunk-RM7D2ITN.mjs";import{b as w}from"./chunk-U7EZI5D5.mjs";function N(e){return!!e.match(/^[_a-zA-Z0-9]+$/)}function V(e){return!!e.match(/\s/)}function $(e){return!!e.match(/^T[0-9]+$/)}function F(e,n){let i=n;for(;i<e.length;i+=1){let c=e[i];if(!V(c))break}return i}var S=(t=>(t.InvalidTypeTag="unknown type",t.UnexpectedGenericType="unexpected generic type",t.UnexpectedTypeArgumentClose="unexpected '>'",t.UnexpectedWhitespaceCharacter="unexpected whitespace character",t.UnexpectedComma="unexpected ','",t.TypeArgumentCountMismatch="type argument count doesn't match expected amount",t.MissingTypeArgumentClose="no matching '>' for '<'",t.UnexpectedPrimitiveTypeArguments="primitive types not expected to have type arguments",t.UnexpectedVectorTypeArgumentCount="vector type expected to have exactly one type argument",t.UnexpectedStructFormat="unexpected struct format, must be of the form 0xaddress::module_name::struct_name",t.InvalidModuleNameCharacter="module name must only contain alphanumeric or '_' characters",t.InvalidStructNameCharacter="struct name must only contain alphanumeric or '_' characters",t))(S||{}),r=class extends Error{constructor(n,i){super(`Failed to parse typeTag '${n}', ${i}`)}};function Z(e,n){let i=n?.allowGenerics??!1,c=[],o=[],p=[],T=0,a="",u=1;for(;T<e.length;){let g=e[T];if(g==="<")c.push({savedExpectedTypes:u,savedStr:a,savedTypes:p}),a="",p=[],u=1;else if(g===">"){if(a!==""){let _=m(a,o,i);p.push(_)}let s=c.pop();if(s===void 0)throw new r(e,"unexpected '>'");if(u!==p.length)throw new r(e,"type argument count doesn't match expected amount");let{savedStr:h,savedTypes:t,savedExpectedTypes:W}=s;o=p,p=t,a=h,u=W}else if(g===","){if(a.length!==0){let s=m(a,o,i);o=[],p.push(s),a="",u+=1}}else if(V(g)){let s=!1;if(a.length!==0){let t=m(a,o,i);o=[],p.push(t),a="",s=!0}T=F(e,T);let h=e[T];if(T<e.length&&s&&h!==","&&h!==">")throw new r(e,"unexpected whitespace character");continue}else a+=g;T+=1}if(c.length>0)throw new r(e,"no matching '>' for '<'");switch(p.length){case 0:return m(a,o,i);case 1:if(a==="")return p[0];throw new r(e,"unexpected ','");default:throw new r(e,"unexpected whitespace character")}}function m(e,n,i){switch(e){case"&signer":if(n.length>0)throw new r(e,"primitive types not expected to have type arguments");return new E(new y);case"signer":if(n.length>0)throw new r(e,"primitive types not expected to have type arguments");return new y;case"bool":if(n.length>0)throw new r(e,"primitive types not expected to have type arguments");return new l;case"address":if(n.length>0)throw new r(e,"primitive types not expected to have type arguments");return new C;case"u8":if(n.length>0)throw new r(e,"primitive types not expected to have type arguments");return new f;case"u16":if(n.length>0)throw new r(e,"primitive types not expected to have type arguments");return new x;case"u32":if(n.length>0)throw new r(e,"primitive types not expected to have type arguments");return new v;case"u64":if(n.length>0)throw new r(e,"primitive types not expected to have type arguments");return new U;case"u128":if(n.length>0)throw new r(e,"primitive types not expected to have type arguments");return new A;case"u256":if(n.length>0)throw new r(e,"primitive types not expected to have type arguments");return new P;case"vector":if(n.length!==1)throw new r(e,"vector type expected to have exactly one type argument");return new I(n[0]);default:if($(e)){if(i)return new b(Number(e.split("T")[1]));throw new r(e,"unexpected generic type")}if(!e.match(/:/))throw new r(e,"unknown type");let c=e.split("::");if(c.length!==3)throw new r(e,"unexpected struct format, must be of the form 0xaddress::module_name::struct_name");if(!N(c[1]))throw new r(e,"module name must only contain alphanumeric or '_' characters");if(!N(c[2]))throw new r(e,"struct name must only contain alphanumeric or '_' characters");return new G(new M(w.fromString(c[0]),new d(c[1]),new d(c[2]),n))}}export{S as a,r as b,Z as c};
2
+ //# sourceMappingURL=chunk-IVBYTTN7.mjs.map
@@ -0,0 +1,2 @@
1
+ import{a as e}from"./chunk-YNBWXDRS.mjs";import{a as i}from"./chunk-ED6PYTNG.mjs";import{a as r}from"./chunk-52DBSOFA.mjs";var n=class o extends r{constructor(t,a){super();this.raw_txn=t,this.authenticator=a}serialize(t){this.raw_txn.serialize(t),this.authenticator.serialize(t)}static deserialize(t){let a=i.deserialize(t),s=e.deserialize(t);return new o(a,s)}};export{n as a};
2
+ //# sourceMappingURL=chunk-J5SQQQPI.mjs.map
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=chunk-JXCZTOYC.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -1,2 +1,2 @@
1
- import{b as s}from"./chunk-QRS4DGP3.mjs";import{a as o}from"./chunk-36QXVFR5.mjs";import{b as n}from"./chunk-BCUSI3N6.mjs";import{sha3_256 as d}from"@noble/hashes/sha3";var r=class r extends o{constructor(t){super();let{data:e}=t,i=n.fromHexInput(e);if(i.toUint8Array().length!==r.LENGTH)throw new Error(`Authentication Key length should be ${r.LENGTH}`);this.data=i}serialize(t){t.serializeFixedBytes(this.data.toUint8Array())}static deserialize(t){let e=t.deserializeFixedBytes(r.LENGTH);return new r({data:e})}toString(){return this.data.toString()}toUint8Array(){return this.data.toUint8Array()}static fromSchemeAndBytes(t){let{scheme:e,input:i}=t,u=n.fromHexInput(i).toUint8Array(),h=new Uint8Array([...u,e]),a=d.create();a.update(h);let y=a.digest();return new r({data:y})}static fromPublicKeyAndScheme(t){let{publicKey:e}=t;return e.authKey()}static fromPublicKey(t){let{publicKey:e}=t;return e.authKey()}derivedAddress(){return new s(this.data.toUint8Array())}};r.LENGTH=32;var c=r;export{c as a};
2
- //# sourceMappingURL=chunk-5EN52MUT.mjs.map
1
+ import{b as s}from"./chunk-U7EZI5D5.mjs";import{a as o}from"./chunk-52DBSOFA.mjs";import{b as n}from"./chunk-AOCNYMMX.mjs";import{sha3_256 as d}from"@noble/hashes/sha3";var r=class r extends o{constructor(t){super();let{data:e}=t,i=n.fromHexInput(e);if(i.toUint8Array().length!==r.LENGTH)throw new Error(`Authentication Key length should be ${r.LENGTH}`);this.data=i}serialize(t){t.serializeFixedBytes(this.data.toUint8Array())}static deserialize(t){let e=t.deserializeFixedBytes(r.LENGTH);return new r({data:e})}toString(){return this.data.toString()}toUint8Array(){return this.data.toUint8Array()}static fromSchemeAndBytes(t){let{scheme:e,input:i}=t,u=n.fromHexInput(i).toUint8Array(),h=new Uint8Array([...u,e]),a=d.create();a.update(h);let y=a.digest();return new r({data:y})}static fromPublicKeyAndScheme(t){let{publicKey:e}=t;return e.authKey()}static fromPublicKey(t){let{publicKey:e}=t;return e.authKey()}derivedAddress(){return new s(this.data.toUint8Array())}};r.LENGTH=32;var c=r;export{c as a};
2
+ //# sourceMappingURL=chunk-JYFKKB34.mjs.map
@@ -1,2 +1,2 @@
1
- import{a as t}from"./chunk-URTTOOEM.mjs";var o=class{constructor(n){this.config=n}async simple(n){return t({aptosConfig:this.config,...n})}async multiAgent(n){return t({aptosConfig:this.config,...n})}};export{o as a};
2
- //# sourceMappingURL=chunk-KS7UY4W5.mjs.map
1
+ import{a as t}from"./chunk-6OKRMOWR.mjs";var o=class{constructor(n){this.config=n}async simple(n){return t({aptosConfig:this.config,...n})}async multiAgent(n){return t({aptosConfig:this.config,...n})}};export{o as a};
2
+ //# sourceMappingURL=chunk-KBSAS57Q.mjs.map
@@ -1,2 +1,2 @@
1
- import{b as p}from"./chunk-QRS4DGP3.mjs";import{f as a}from"./chunk-TTUXAKCV.mjs";import{q as d}from"./chunk-S4SEFF4K.mjs";var g=300,y=o=>{if(o&&o.length>g)throw new Error(`Event type length exceeds the maximum length of ${g}`)};async function f(o){let{aptosConfig:n,eventType:e,options:t}=o,r={where:{account_address:{_eq:"0x0000000000000000000000000000000000000000000000000000000000000000"},creation_number:{_eq:"0"},sequence_number:{_eq:"0"},indexed_type:{_eq:e}},pagination:t,orderBy:t?.orderBy};return c({aptosConfig:n,options:r})}async function h(o){let{accountAddress:n,aptosConfig:e,creationNumber:t,options:s}=o,i={where:{account_address:{_eq:p.from(n).toStringLong()},creation_number:{_eq:t}},pagination:s,orderBy:s?.orderBy};return c({aptosConfig:e,options:i})}async function _(o){let{accountAddress:n,aptosConfig:e,eventType:t,options:s}=o,i={where:{account_address:{_eq:p.from(n).toStringLong()},indexed_type:{_eq:t}},pagination:s,orderBy:s?.orderBy};return c({aptosConfig:e,options:i})}async function c(o){let{aptosConfig:n,options:e}=o;y(e?.where?.indexed_type?._eq);let t={query:d,variables:{where_condition:e?.where,offset:e?.offset,limit:e?.limit,order_by:e?.orderBy}};return(await a({aptosConfig:n,query:t,originMethod:"getEvents"})).events}export{f as a,h as b,_ as c,c as d};
2
- //# sourceMappingURL=chunk-Q73VKL3A.mjs.map
1
+ import{f as a}from"./chunk-CYWA4AJF.mjs";import{q as d}from"./chunk-S4SEFF4K.mjs";import{b as p}from"./chunk-U7EZI5D5.mjs";var g=300,y=o=>{if(o&&o.length>g)throw new Error(`Event type length exceeds the maximum length of ${g}`)};async function f(o){let{aptosConfig:n,eventType:e,options:t}=o,r={where:{account_address:{_eq:"0x0000000000000000000000000000000000000000000000000000000000000000"},creation_number:{_eq:"0"},sequence_number:{_eq:"0"},indexed_type:{_eq:e}},pagination:t,orderBy:t?.orderBy};return c({aptosConfig:n,options:r})}async function h(o){let{accountAddress:n,aptosConfig:e,creationNumber:t,options:s}=o,i={where:{account_address:{_eq:p.from(n).toStringLong()},creation_number:{_eq:t}},pagination:s,orderBy:s?.orderBy};return c({aptosConfig:e,options:i})}async function _(o){let{accountAddress:n,aptosConfig:e,eventType:t,options:s}=o,i={where:{account_address:{_eq:p.from(n).toStringLong()},indexed_type:{_eq:t}},pagination:s,orderBy:s?.orderBy};return c({aptosConfig:e,options:i})}async function c(o){let{aptosConfig:n,options:e}=o;y(e?.where?.indexed_type?._eq);let t={query:d,variables:{where_condition:e?.where,offset:e?.offset,limit:e?.limit,order_by:e?.orderBy}};return(await a({aptosConfig:n,query:t,originMethod:"getEvents"})).events}export{f as a,h as b,_ as c,c as d};
2
+ //# sourceMappingURL=chunk-KMHJNUXU.mjs.map
@@ -0,0 +1,2 @@
1
+ import{d as i}from"./chunk-YU7DNMEA.mjs";import{b as o}from"./chunk-4AOGG725.mjs";import{b as n}from"./chunk-VAZQVN5V.mjs";import{b as a}from"./chunk-U7EZI5D5.mjs";var c=class s{constructor(e){this.signingScheme=0;let{privateKey:r,address:t}=e;this.privateKey=r,this.publicKey=r.publicKey(),this.accountAddress=t?a.from(t):this.publicKey.authKey().derivedAddress()}static generate(){let e=n.generate();return new s({privateKey:e})}static fromDerivationPath(e){let{path:r,mnemonic:t}=e,u=n.fromDerivationPath(r,t);return new s({privateKey:u})}verifySignature(e){return this.publicKey.verifySignature(e)}signWithAuthenticator(e){let r=this.privateKey.sign(i(e));return new o(this.publicKey,r)}sign(e){return this.privateKey.sign(e)}signTransaction(e){return this.sign(i(e))}};export{c as a};
2
+ //# sourceMappingURL=chunk-KWDJ4YOP.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\nexport interface Ed25519SignerConstructorArgs {\n privateKey: Ed25519PrivateKey;\n address?: AccountAddressInput;\n}\n\nexport interface Ed25519SignerFromDerivationPathArgs {\n path: string;\n mnemonic: string;\n}\n\nexport interface VerifyEd25519SignatureArgs {\n message: HexInput;\n signature: Ed25519Signature;\n}\n\n/**\n * Signer implementation for the Ed25519 authentication scheme.\n * This extends an {@link Ed25519Account} by adding signing capabilities through an {@link Ed25519PrivateKey}.\n *\n * Note: Generating a signer instance 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 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 * Derives a signer from a randomly generated private key\n */\n static generate() {\n const privateKey = Ed25519PrivateKey.generate();\n return new Ed25519Account({ privateKey });\n }\n\n /**\n * Derives an account with bip44 path and mnemonics\n *\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\n // endregion\n\n // region Account\n\n verifySignature(args: VerifyEd25519SignatureArgs): boolean {\n return this.publicKey.verifySignature(args);\n }\n\n signWithAuthenticator(transaction: AnyRawTransaction) {\n const signature = this.privateKey.sign(generateSigningMessageForTransaction(transaction));\n return new AccountAuthenticatorEd25519(this.publicKey, signature);\n }\n\n sign(message: HexInput) {\n return this.privateKey.sign(message);\n }\n\n signTransaction(transaction: AnyRawTransaction) {\n return this.sign(generateSigningMessageForTransaction(transaction))\n }\n\n // endregion\n}\n"],"mappings":"oKA6BO,IAAMA,EAAN,MAAMC,CAAkC,CAc7C,YAAYC,EAAoC,CAJhD,KAAS,cAAgB,EAKvB,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,CAKA,OAAO,UAAW,CAChB,IAAMD,EAAaG,EAAkB,SAAS,EAC9C,OAAO,IAAIL,EAAe,CAAE,WAAAE,CAAW,CAAC,CAC1C,CASA,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,CAMA,gBAAgBD,EAA2C,CACzD,OAAO,KAAK,UAAU,gBAAgBA,CAAI,CAC5C,CAEA,sBAAsBO,EAAgC,CACpD,IAAMC,EAAY,KAAK,WAAW,KAAKC,EAAqCF,CAAW,CAAC,EACxF,OAAO,IAAIG,EAA4B,KAAK,UAAWF,CAAS,CAClE,CAEA,KAAKG,EAAmB,CACtB,OAAO,KAAK,WAAW,KAAKA,CAAO,CACrC,CAEA,gBAAgBJ,EAAgC,CAC9C,OAAO,KAAK,KAAKE,EAAqCF,CAAW,CAAC,CACpE,CAGF","names":["Ed25519Account","_Ed25519Account","args","privateKey","address","AccountAddress","Ed25519PrivateKey","path","mnemonic","transaction","signature","generateSigningMessageForTransaction","AccountAuthenticatorEd25519","message"]}
@@ -0,0 +1,2 @@
1
+ import{a as r}from"./chunk-52DBSOFA.mjs";import{b as t}from"./chunk-AOCNYMMX.mjs";var o=class extends r{toString(){let i=this.toUint8Array();return t.fromHexInput(i).toString()}};export{o as a};
2
+ //# sourceMappingURL=chunk-KX5ESZO7.mjs.map
@@ -0,0 +1,2 @@
1
+ var t="1.13.0-zeta.0";export{t as a};
2
+ //# sourceMappingURL=chunk-LVYKZS54.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/version.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\n/**\n * The current version of the SDK\n *\n * hardcoded for now, we would want to have it injected dynamically\n */\nexport const VERSION = \"1.12.1\";\n"],"mappings":"AAQO,IAAMA,EAAU","names":["VERSION"]}
1
+ {"version":3,"sources":["../../src/version.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\n/**\n * The current version of the SDK\n *\n * hardcoded for now, we would want to have it injected dynamically\n */\nexport const VERSION = \"1.13.0-zeta.0\";\n"],"mappings":"AAQO,IAAMA,EAAU","names":["VERSION"]}
@@ -0,0 +1,2 @@
1
+ import{a as D,c as Q,d as Y,e as R}from"./chunk-2VCKY2ZJ.mjs";import{q as J,t as p}from"./chunk-T7TIIAWK.mjs";import{a as nn}from"./chunk-5TNUDFLP.mjs";import{a as Z}from"./chunk-YIG37BG2.mjs";import{b as j}from"./chunk-YP3RMVL3.mjs";import{a as z}from"./chunk-AH44UPM4.mjs";import{a as L}from"./chunk-CYWA4AJF.mjs";import{g as _}from"./chunk-SCPXFKEK.mjs";import{a as X}from"./chunk-YU7DNMEA.mjs";import{a as m}from"./chunk-J5SQQQPI.mjs";import{a as H}from"./chunk-3FL3NLZ6.mjs";import{b as x,d as B,e as E,f as F}from"./chunk-YNBWXDRS.mjs";import{a as T,c as h,d as w}from"./chunk-ED6PYTNG.mjs";import{c as v,d as k,e as q,f as b,g as O,h as V,i as K}from"./chunk-RBDX3YWC.mjs";import{a as U}from"./chunk-MRCVSUJQ.mjs";import{b as g,d as l,e as W}from"./chunk-4AOGG725.mjs";import{b as C,c as G}from"./chunk-2HXKDHMA.mjs";import{a as M,b as N}from"./chunk-ULUMROUJ.mjs";import{a as $,c as S}from"./chunk-VAZQVN5V.mjs";import{b as u}from"./chunk-U7EZI5D5.mjs";import{b as I}from"./chunk-AOCNYMMX.mjs";import{sha3_256 as sn}from"@noble/hashes/sha3";async function Gn(n){if(J(n))return mn(n);let{moduleAddress:e,moduleName:t,functionName:o}=p(n.function),r=await en({key:"entry-function",moduleAddress:e,moduleName:t,functionName:o,aptosConfig:n.aptosConfig,abi:n.abi,fetch:Q});return cn({abi:r,...n})}function cn(n){let e=n.abi,{moduleAddress:t,moduleName:o,functionName:r}=p(n.function),a=D(n.typeArguments);if(a.length!==e.typeParameters.length)throw new Error(`Type argument count mismatch, expected ${e.typeParameters.length}, received ${a.length}`);let i=n.functionArguments.map((s,d)=>R(n.function,e,s,d,a));if(i.length!==e.parameters.length)throw new Error(`Too few arguments for '${t}::${o}::${r}', expected ${e.parameters.length} but got ${i.length}`);let c=b.build(`${t}::${o}`,r,a,i);if("multisigAddress"in n){let s=u.from(n.multisigAddress);return new q(new V(s,new K(c)))}return new k(c)}async function Un(n){let{moduleAddress:e,moduleName:t,functionName:o}=p(n.function),r=await en({key:"view-function",moduleAddress:e,moduleName:t,functionName:o,aptosConfig:n.aptosConfig,abi:n.abi,fetch:Y});return un({abi:r,...n})}function un(n){let e=n.abi,{moduleAddress:t,moduleName:o,functionName:r}=p(n.function),a=D(n.typeArguments);if(a.length!==e.typeParameters.length)throw new Error(`Type argument count mismatch, expected ${e.typeParameters.length}, received ${a.length}`);let i=n?.functionArguments?.map((c,s)=>R(n.function,e,c,s,a))??[];if(i.length!==e.parameters.length)throw new Error(`Too few arguments for '${t}::${o}::${r}', expected ${e.parameters.length} but got ${i.length}`);return b.build(`${t}::${o}`,r,a,i)}function mn(n){return new v(new O(I.fromHexInput(n.bytecode).toUint8Array(),n.typeArguments??[],n.functionArguments))}async function dn(n){let{aptosConfig:e,sender:t,payload:o,options:r,feePayerAddress:a}=n,i=_[e.network]?Promise.resolve({chain_id:_[e.network]}):L({aptosConfig:e}),c=r?.gasUnitPrice?Promise.resolve({gas_estimate:r.gasUnitPrice}):j({aptosConfig:e}),[{chain_id:s},{gas_estimate:d}]=await Promise.all([i,c]),A=r?.accountSequenceNumber!==void 0?Promise.resolve({sequence_number:r.accountSequenceNumber}):Z({aptosConfig:e,accountAddress:t}),y;if(a&&u.from(a).equals(u.ZERO))try{let{sequence_number:f}=await A;y=f}catch{y="0"}else{let{sequence_number:f}=await A;y=f}let{maxGasAmount:an,gasUnitPrice:rn,expireTimestamp:on}={maxGasAmount:r?.maxGasAmount?BigInt(r.maxGasAmount):BigInt(2e5),gasUnitPrice:BigInt(d),expireTimestamp:BigInt(Math.floor(Date.now()/1e3)+20),...r};return new T(u.from(t),BigInt(y),o,BigInt(an),BigInt(rn),BigInt(on),new U(s))}async function vn(n){let{aptosConfig:e,sender:t,payload:o,options:r,feePayerAddress:a}=n,i=await dn({aptosConfig:e,sender:t,payload:o,options:r,feePayerAddress:a});if("secondarySignerAddresses"in n){let c=n.secondarySignerAddresses?.map(s=>u.from(s))??[];return new nn(i,c,n.feePayerAddress?u.from(n.feePayerAddress):void 0)}return new H(i,n.feePayerAddress?u.from(n.feePayerAddress):void 0)}function kn(n){let{signerPublicKey:e,transaction:t,secondarySignersPublicKeys:o,feePayerPublicKey:r}=n,a=P(e);if(t.feePayerAddress){let c=new w(t.rawTransaction,t.secondarySignerAddresses??[],t.feePayerAddress),s=[];o&&(s=o.map(y=>P(y)));let d=P(r),A=new E(a,t.secondarySignerAddresses??[],s,{address:t.feePayerAddress,authenticator:d});return new m(c.raw_txn,A).bcsToBytes()}if(t.secondarySignerAddresses){let c=new h(t.rawTransaction,t.secondarySignerAddresses),s=[];s=o.map(A=>P(A));let d=new B(a,t.secondarySignerAddresses,s);return new m(c.raw_txn,d).bcsToBytes()}let i;if(a instanceof g)i=new x(a.public_key,a.signature);else if(a instanceof l)i=new F(a);else throw new Error("Invalid public key");return new m(t.rawTransaction,i).bcsToBytes()}function P(n){return n instanceof M?new l(n,new N(new S(new Uint8Array(64)))):new g(new $(n.toUint8Array()),new S(new Uint8Array(64)))}function An(n){let{transaction:e,senderAuthenticator:t,feePayerAuthenticator:o,additionalSignersAuthenticators:r}=n,a=X(e);if((o||r)&&(a instanceof h||a instanceof w))return pn(a,t,o,r);if(t instanceof g&&a instanceof T){let i=new x(t.public_key,t.signature);return new m(a,i).bcsToBytes()}if((t instanceof l||t instanceof W)&&a instanceof T){let i=new F(t);return new m(a,i).bcsToBytes()}throw new Error(`Cannot generate a signed transaction, ${t} is not a supported account authentication scheme`)}function tn(n){let e=sn.create();for(let t of n)e.update(t);return e.digest()}var yn=tn(["APTOS::Transaction"]);function qn(n){let e=An(n);return new I(tn([yn,new Uint8Array([0]),e])).toString()}function pn(n,e,t,o){if(n instanceof w){if(!t)throw new Error("Must provide a feePayerAuthenticator argument to generate a signed fee payer transaction");let r=new E(e,n.secondary_signer_addresses,o??[],{address:n.fee_payer_address,authenticator:t});return new m(n.raw_txn,r).bcsToBytes()}if(n instanceof h){if(!o)throw new Error("Must provide a additionalSignersAuthenticators argument to generate a signed multi agent transaction");let r=new B(e,n.secondary_signer_addresses,o??[]);return new m(n.raw_txn,r).bcsToBytes()}throw new Error(`Cannot prepare multi signers transaction to submission, ${typeof n} transaction is not supported`)}async function en({key:n,moduleAddress:e,moduleName:t,functionName:o,aptosConfig:r,abi:a,fetch:i}){return a||z(async()=>i(e,t,o,r),`${n}-${r.network}-${e}-${t}-${o}`,1e3*60*5)()}export{Gn as a,cn as b,Un as c,un as d,dn as e,vn as f,kn as g,P as h,An as i,tn as j,qn as k,pn as l};
2
+ //# sourceMappingURL=chunk-MAFSWKAF.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/transactions/transactionBuilder/transactionBuilder.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\n/**\n * This file handles the transaction creation lifecycle.\n * It holds different operations to generate a transaction payload, a raw transaction,\n * and a signed transaction that can be simulated, signed and submitted to chain.\n */\nimport { sha3_256 as sha3Hash } from \"@noble/hashes/sha3\";\nimport { AptosConfig } from \"../../api/aptosConfig\";\nimport { AccountAddress, AccountAddressInput, Hex, PublicKey } from \"../../core\";\nimport { AnyPublicKey, AnySignature } from \"../../core/crypto\";\nimport { Ed25519PublicKey, Ed25519Signature } from \"../../core/crypto/ed25519\";\nimport { getInfo } from \"../../internal/account\";\nimport { getLedgerInfo } from \"../../internal/general\";\nimport { getGasPriceEstimation } from \"../../internal/transaction\";\nimport { NetworkToChainId } from \"../../utils/apiEndpoints\";\nimport { DEFAULT_MAX_GAS_AMOUNT, DEFAULT_TXN_EXP_SEC_FROM_NOW } from \"../../utils/const\";\nimport {\n AccountAuthenticator,\n AccountAuthenticatorEd25519,\n AccountAuthenticatorMultiKey,\n AccountAuthenticatorSingleKey,\n} from \"../authenticator/account\";\nimport {\n TransactionAuthenticatorEd25519,\n TransactionAuthenticatorFeePayer,\n TransactionAuthenticatorMultiAgent,\n TransactionAuthenticatorSingleSender,\n} from \"../authenticator/transaction\";\nimport {\n ChainId,\n EntryFunction,\n FeePayerRawTransaction,\n MultiAgentRawTransaction,\n MultiSig,\n MultiSigTransactionPayload,\n RawTransaction,\n Script,\n TransactionPayloadEntryFunction,\n TransactionPayloadMultiSig,\n TransactionPayloadScript,\n} from \"../instances\";\nimport { SignedTransaction } from \"../instances/signedTransaction\";\nimport {\n AnyRawTransaction,\n AnyTransactionPayloadInstance,\n EntryFunctionArgumentTypes,\n InputGenerateMultiAgentRawTransactionArgs,\n InputGenerateRawTransactionArgs,\n InputGenerateSingleSignerRawTransactionArgs,\n InputGenerateTransactionOptions,\n InputScriptData,\n InputSimulateTransactionData,\n InputMultiSigDataWithRemoteABI,\n InputEntryFunctionDataWithRemoteABI,\n InputGenerateTransactionPayloadDataWithRemoteABI,\n InputSubmitTransactionData,\n InputGenerateTransactionPayloadDataWithABI,\n InputEntryFunctionDataWithABI,\n InputMultiSigDataWithABI,\n InputViewFunctionDataWithRemoteABI,\n InputViewFunctionDataWithABI,\n FunctionABI,\n} from \"../types\";\nimport { convertArgument, fetchEntryFunctionAbi, fetchViewFunctionAbi, standardizeTypeTags } from \"./remoteAbi\";\nimport { memoizeAsync } from \"../../utils/memoize\";\nimport { AnyNumber } from \"../../types\";\nimport { getFunctionParts, isScriptDataInput } from \"./helpers\";\nimport { SimpleTransaction } from \"../instances/simpleTransaction\";\nimport { MultiAgentTransaction } from \"../instances/multiAgentTransaction\";\nimport { deriveTransactionType } from \"./signingMessage\";\n\n/**\n * We are defining function signatures, each with its specific input and output.\n * These are the possible function signature for our `generateTransactionPayload` function.\n * When we call our `generateTransactionPayload` function with the relevant type properties,\n * Typescript can infer the return type based on the appropriate function overload.\n */\nexport async function generateTransactionPayload(args: InputScriptData): Promise<TransactionPayloadScript>;\nexport async function generateTransactionPayload(\n args: InputEntryFunctionDataWithRemoteABI,\n): Promise<TransactionPayloadEntryFunction>;\nexport async function generateTransactionPayload(\n args: InputMultiSigDataWithRemoteABI,\n): Promise<TransactionPayloadMultiSig>;\n\n/**\n * Builds a transaction payload based on the data argument and returns\n * a transaction payload - TransactionPayloadScript | TransactionPayloadMultiSig | TransactionPayloadEntryFunction\n *\n * This uses the RemoteABI by default, and the remote ABI can be skipped by using generateTransactionPayloadWithABI\n *\n * @param args.data GenerateTransactionPayloadData\n *\n * @return TransactionPayload\n */\nexport async function generateTransactionPayload(\n args: InputGenerateTransactionPayloadDataWithRemoteABI,\n): Promise<AnyTransactionPayloadInstance> {\n if (isScriptDataInput(args)) {\n return generateTransactionPayloadScript(args);\n }\n const { moduleAddress, moduleName, functionName } = getFunctionParts(args.function);\n\n const functionAbi = await fetchAbi({\n key: \"entry-function\",\n moduleAddress,\n moduleName,\n functionName,\n aptosConfig: args.aptosConfig,\n abi: args.abi,\n fetch: fetchEntryFunctionAbi,\n });\n\n // Fill in the ABI\n return generateTransactionPayloadWithABI({ abi: functionAbi, ...args });\n}\n\nexport function generateTransactionPayloadWithABI(args: InputEntryFunctionDataWithABI): TransactionPayloadEntryFunction;\nexport function generateTransactionPayloadWithABI(args: InputMultiSigDataWithABI): TransactionPayloadMultiSig;\nexport function generateTransactionPayloadWithABI(\n args: InputGenerateTransactionPayloadDataWithABI,\n): AnyTransactionPayloadInstance {\n const functionAbi = args.abi;\n const { moduleAddress, moduleName, functionName } = getFunctionParts(args.function);\n\n // Ensure that all type arguments are typed properly\n const typeArguments = standardizeTypeTags(args.typeArguments);\n\n // Check the type argument count against the ABI\n if (typeArguments.length !== functionAbi.typeParameters.length) {\n throw new Error(\n `Type argument count mismatch, expected ${functionAbi.typeParameters.length}, received ${typeArguments.length}`,\n );\n }\n\n // Check all BCS types, and convert any non-BCS types\n const functionArguments: Array<EntryFunctionArgumentTypes> = args.functionArguments.map((arg, i) =>\n convertArgument(args.function, functionAbi, arg, i, typeArguments),\n );\n\n // Check that all arguments are accounted for\n if (functionArguments.length !== functionAbi.parameters.length) {\n throw new Error(\n // eslint-disable-next-line max-len\n `Too few arguments for '${moduleAddress}::${moduleName}::${functionName}', expected ${functionAbi.parameters.length} but got ${functionArguments.length}`,\n );\n }\n\n // Generate entry function payload\n const entryFunctionPayload = EntryFunction.build(\n `${moduleAddress}::${moduleName}`,\n functionName,\n typeArguments,\n functionArguments,\n );\n\n // Send it as multi sig if it's a multisig payload\n if (\"multisigAddress\" in args) {\n const multisigAddress = AccountAddress.from(args.multisigAddress);\n return new TransactionPayloadMultiSig(\n new MultiSig(multisigAddress, new MultiSigTransactionPayload(entryFunctionPayload)),\n );\n }\n\n // Otherwise send as an entry function\n return new TransactionPayloadEntryFunction(entryFunctionPayload);\n}\n\nexport async function generateViewFunctionPayload(args: InputViewFunctionDataWithRemoteABI): Promise<EntryFunction> {\n const { moduleAddress, moduleName, functionName } = getFunctionParts(args.function);\n\n const functionAbi = await fetchAbi({\n key: \"view-function\",\n moduleAddress,\n moduleName,\n functionName,\n aptosConfig: args.aptosConfig,\n abi: args.abi,\n fetch: fetchViewFunctionAbi,\n });\n\n // Fill in the ABI\n return generateViewFunctionPayloadWithABI({ abi: functionAbi, ...args });\n}\n\nexport function generateViewFunctionPayloadWithABI(args: InputViewFunctionDataWithABI): EntryFunction {\n const functionAbi = args.abi;\n const { moduleAddress, moduleName, functionName } = getFunctionParts(args.function);\n\n // Ensure that all type arguments are typed properly\n const typeArguments = standardizeTypeTags(args.typeArguments);\n\n // Check the type argument count against the ABI\n if (typeArguments.length !== functionAbi.typeParameters.length) {\n throw new Error(\n `Type argument count mismatch, expected ${functionAbi.typeParameters.length}, received ${typeArguments.length}`,\n );\n }\n\n // Check all BCS types, and convert any non-BCS types\n const functionArguments: Array<EntryFunctionArgumentTypes> =\n args?.functionArguments?.map((arg, i) => convertArgument(args.function, functionAbi, arg, i, typeArguments)) ?? [];\n\n // Check that all arguments are accounted for\n if (functionArguments.length !== functionAbi.parameters.length) {\n throw new Error(\n // eslint-disable-next-line max-len\n `Too few arguments for '${moduleAddress}::${moduleName}::${functionName}', expected ${functionAbi.parameters.length} but got ${functionArguments.length}`,\n );\n }\n\n // Generate entry function payload\n return EntryFunction.build(`${moduleAddress}::${moduleName}`, functionName, typeArguments, functionArguments);\n}\n\nfunction generateTransactionPayloadScript(args: InputScriptData) {\n return new TransactionPayloadScript(\n new Script(Hex.fromHexInput(args.bytecode).toUint8Array(), args.typeArguments ?? [], args.functionArguments),\n );\n}\n\n/**\n * Generates a raw transaction\n *\n * @param args.aptosConfig AptosConfig\n * @param args.sender The transaction's sender account address as a hex input\n * @param args.payload The transaction payload - can create by using generateTransactionPayload()\n *\n * @returns RawTransaction\n */\nexport async function generateRawTransaction(args: {\n aptosConfig: AptosConfig;\n sender: AccountAddressInput;\n payload: AnyTransactionPayloadInstance;\n options?: InputGenerateTransactionOptions;\n feePayerAddress?: AccountAddressInput;\n}): Promise<RawTransaction> {\n const { aptosConfig, sender, payload, options, feePayerAddress } = args;\n\n const getChainId = NetworkToChainId[aptosConfig.network]\n ? Promise.resolve({ chain_id: NetworkToChainId[aptosConfig.network] })\n : getLedgerInfo({ aptosConfig });\n\n const getGasUnitPrice = options?.gasUnitPrice\n ? Promise.resolve({ gas_estimate: options.gasUnitPrice })\n : getGasPriceEstimation({ aptosConfig });\n\n const [{ chain_id: chainId }, { gas_estimate: gasEstimate }] = await Promise.all([getChainId, getGasUnitPrice]);\n\n const getSequenceNumber =\n options?.accountSequenceNumber !== undefined\n ? Promise.resolve({ sequence_number: options.accountSequenceNumber })\n : getInfo({ aptosConfig, accountAddress: sender });\n\n let sequenceNumber: string | AnyNumber;\n\n /**\n * Check if is sponsored transaction to honor AIP-52\n * {@link https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-52.md}\n */\n if (feePayerAddress && AccountAddress.from(feePayerAddress).equals(AccountAddress.ZERO)) {\n // Handle sponsored transaction generation with the option that\n // the main signer has not been created on chain\n try {\n // Check if main signer has been created on chain, if not assign sequence number 0\n const { sequence_number: seqNumber } = await getSequenceNumber;\n sequenceNumber = seqNumber;\n } catch (e: any) {\n sequenceNumber = \"0\";\n }\n } else {\n const { sequence_number: seqNumber } = await getSequenceNumber;\n sequenceNumber = seqNumber;\n }\n\n const { maxGasAmount, gasUnitPrice, expireTimestamp } = {\n maxGasAmount: options?.maxGasAmount ? BigInt(options.maxGasAmount) : BigInt(DEFAULT_MAX_GAS_AMOUNT),\n gasUnitPrice: BigInt(gasEstimate),\n expireTimestamp: BigInt(Math.floor(Date.now() / 1000) + DEFAULT_TXN_EXP_SEC_FROM_NOW),\n ...options,\n };\n\n return new RawTransaction(\n AccountAddress.from(sender),\n BigInt(sequenceNumber),\n payload,\n BigInt(maxGasAmount),\n BigInt(gasUnitPrice),\n BigInt(expireTimestamp),\n new ChainId(chainId),\n );\n}\n\n/**\n * We are defining function signatures, each with its specific input and output.\n * These are the possible function signature for our `generateTransaction` function.\n * When we call our `generateTransaction` function with the relevant type properties,\n * Typescript can infer the return type based on the appropriate function overload.\n */\nexport async function buildTransaction(args: InputGenerateSingleSignerRawTransactionArgs): Promise<SimpleTransaction>;\nexport async function buildTransaction(args: InputGenerateMultiAgentRawTransactionArgs): Promise<MultiAgentTransaction>;\n\n/**\n * Generates a transaction based on the provided arguments\n *\n * Note: we can start with one function to support all different payload/transaction types,\n * and if to complex to use, we could have function for each type\n *\n * @param args.aptosConfig AptosConfig\n * @param args.sender The transaction's sender account address as a hex input\n * @param args.payload The transaction payload - can create by using generateTransactionPayload()\n * @param args.options optional. Transaction options object\n * @param args.secondarySignerAddresses optional. For when want to create a multi signers transaction\n * @param args.feePayerAddress optional. For when want to create a fee payer (aka sponsored) transaction\n *\n * @return An instance of a RawTransaction, plus optional secondary/fee payer addresses\n * ```\n * {\n * rawTransaction: RawTransaction,\n * secondarySignerAddresses? : Array<AccountAddress>,\n * feePayerAddress?: AccountAddress\n * }\n * ```\n */\nexport async function buildTransaction(args: InputGenerateRawTransactionArgs): Promise<AnyRawTransaction> {\n const { aptosConfig, sender, payload, options, feePayerAddress } = args;\n // generate raw transaction\n const rawTxn = await generateRawTransaction({\n aptosConfig,\n sender,\n payload,\n options,\n feePayerAddress,\n });\n\n // if multi agent transaction\n if (\"secondarySignerAddresses\" in args) {\n const signers: Array<AccountAddress> =\n args.secondarySignerAddresses?.map((signer) => AccountAddress.from(signer)) ?? [];\n\n return new MultiAgentTransaction(\n rawTxn,\n signers,\n args.feePayerAddress ? AccountAddress.from(args.feePayerAddress) : undefined,\n );\n }\n // return the raw transaction\n return new SimpleTransaction(rawTxn, args.feePayerAddress ? AccountAddress.from(args.feePayerAddress) : undefined);\n}\n\n/**\n * Simulate a transaction before signing and submit to chain\n *\n * @param args.transaction A aptos transaction type to sign\n * @param args.signerPublicKey The signer public key\n * @param args.secondarySignersPublicKeys optional. The secondary signers public keys if multi signers transaction\n * @param args.feePayerPublicKey optional. The fee payer public key is a fee payer (aka sponsored) transaction\n * @param args.options optional. SimulateTransactionOptions\n *\n * @returns A signed serialized transaction that can be simulated\n */\nexport function generateSignedTransactionForSimulation(args: InputSimulateTransactionData): Uint8Array {\n const { signerPublicKey, transaction, secondarySignersPublicKeys, feePayerPublicKey } = args;\n\n const accountAuthenticator = getAuthenticatorForSimulation(signerPublicKey);\n\n // fee payer transaction\n if (transaction.feePayerAddress) {\n const transactionToSign = new FeePayerRawTransaction(\n transaction.rawTransaction,\n transaction.secondarySignerAddresses ?? [],\n transaction.feePayerAddress,\n );\n let secondaryAccountAuthenticators: Array<AccountAuthenticator> = [];\n if (secondarySignersPublicKeys) {\n secondaryAccountAuthenticators = secondarySignersPublicKeys.map((publicKey) =>\n getAuthenticatorForSimulation(publicKey),\n );\n }\n const feePayerAuthenticator = getAuthenticatorForSimulation(feePayerPublicKey!);\n\n const transactionAuthenticator = new TransactionAuthenticatorFeePayer(\n accountAuthenticator,\n transaction.secondarySignerAddresses ?? [],\n secondaryAccountAuthenticators,\n {\n address: transaction.feePayerAddress,\n authenticator: feePayerAuthenticator,\n },\n );\n return new SignedTransaction(transactionToSign.raw_txn, transactionAuthenticator).bcsToBytes();\n }\n\n // multi agent transaction\n if (transaction.secondarySignerAddresses) {\n const transactionToSign = new MultiAgentRawTransaction(\n transaction.rawTransaction,\n transaction.secondarySignerAddresses,\n );\n\n let secondaryAccountAuthenticators: Array<AccountAuthenticator> = [];\n\n secondaryAccountAuthenticators = secondarySignersPublicKeys!.map((publicKey) =>\n getAuthenticatorForSimulation(publicKey),\n );\n\n const transactionAuthenticator = new TransactionAuthenticatorMultiAgent(\n accountAuthenticator,\n transaction.secondarySignerAddresses,\n secondaryAccountAuthenticators,\n );\n\n return new SignedTransaction(transactionToSign.raw_txn, transactionAuthenticator).bcsToBytes();\n }\n\n // single signer raw transaction\n let transactionAuthenticator;\n if (accountAuthenticator instanceof AccountAuthenticatorEd25519) {\n transactionAuthenticator = new TransactionAuthenticatorEd25519(\n accountAuthenticator.public_key,\n accountAuthenticator.signature,\n );\n } else if (accountAuthenticator instanceof AccountAuthenticatorSingleKey) {\n transactionAuthenticator = new TransactionAuthenticatorSingleSender(accountAuthenticator);\n } else {\n throw new Error(\"Invalid public key\");\n }\n return new SignedTransaction(transaction.rawTransaction, transactionAuthenticator).bcsToBytes();\n}\n\nexport function getAuthenticatorForSimulation(publicKey: PublicKey) {\n // TODO add support for AnyMultiKey\n if (publicKey instanceof AnyPublicKey) {\n return new AccountAuthenticatorSingleKey(publicKey, new AnySignature(new Ed25519Signature(new Uint8Array(64))));\n }\n\n // legacy code\n return new AccountAuthenticatorEd25519(\n new Ed25519PublicKey(publicKey.toUint8Array()),\n new Ed25519Signature(new Uint8Array(64)),\n );\n}\n\n/**\n * Prepare a transaction to be submitted to chain\n *\n * @param args.transaction A aptos transaction type\n * @param args.senderAuthenticator The account authenticator of the transaction sender\n * @param args.secondarySignerAuthenticators optional. For when the transaction is a multi signers transaction\n *\n * @returns A SignedTransaction\n */\nexport function generateSignedTransaction(args: InputSubmitTransactionData): Uint8Array {\n const { transaction, senderAuthenticator, feePayerAuthenticator, additionalSignersAuthenticators } = args;\n\n const transactionToSubmit = deriveTransactionType(transaction);\n\n if (\n (feePayerAuthenticator || additionalSignersAuthenticators) &&\n (transactionToSubmit instanceof MultiAgentRawTransaction || transactionToSubmit instanceof FeePayerRawTransaction)\n ) {\n return generateMultiSignersSignedTransaction(\n transactionToSubmit,\n senderAuthenticator,\n feePayerAuthenticator,\n additionalSignersAuthenticators,\n );\n }\n\n // submit single signer transaction\n\n // check what instance is accountAuthenticator\n if (senderAuthenticator instanceof AccountAuthenticatorEd25519 && transactionToSubmit instanceof RawTransaction) {\n const transactionAuthenticator = new TransactionAuthenticatorEd25519(\n senderAuthenticator.public_key,\n senderAuthenticator.signature,\n );\n return new SignedTransaction(transactionToSubmit, transactionAuthenticator).bcsToBytes();\n }\n\n if (\n (senderAuthenticator instanceof AccountAuthenticatorSingleKey ||\n senderAuthenticator instanceof AccountAuthenticatorMultiKey) &&\n transactionToSubmit instanceof RawTransaction\n ) {\n const transactionAuthenticator = new TransactionAuthenticatorSingleSender(senderAuthenticator);\n return new SignedTransaction(transactionToSubmit, transactionAuthenticator).bcsToBytes();\n }\n\n throw new Error(\n `Cannot generate a signed transaction, ${senderAuthenticator} is not a supported account authentication scheme`,\n );\n}\n\n/**\n * Hashes the set of values with a SHA-3 256 hash\n * @param input array of UTF-8 strings or Uint8array byte arrays\n */\nexport function hashValues(input: (Uint8Array | string)[]): Uint8Array {\n const hash = sha3Hash.create();\n for (const item of input) {\n hash.update(item);\n }\n return hash.digest();\n}\n\n/**\n * The domain separated prefix for hashing transacitons\n */\nconst TRANSACTION_PREFIX = hashValues([\"APTOS::Transaction\"]);\n\n/**\n * Generates a user transaction hash for the given transaction payload. It must already have an authenticator\n * @param args InputSubmitTransactionData\n */\nexport function generateUserTransactionHash(args: InputSubmitTransactionData): string {\n const signedTransaction = generateSignedTransaction(args);\n\n // Transaction signature is defined as, the domain separated prefix based on struct (Transaction)\n // Then followed by the type of the transaction for the enum, UserTransaction is 0\n // Then followed by BCS encoded bytes of the signed transaction\n return new Hex(hashValues([TRANSACTION_PREFIX, new Uint8Array([0]), signedTransaction])).toString();\n}\n\n/**\n * Generate a multi signers signed transaction that can be submitted to chain\n *\n * @param transaction MultiAgentRawTransaction | FeePayerRawTransaction\n * @param senderAuthenticator The account authenticator of the transaction sender\n * @param secondarySignerAuthenticators The extra signers account Authenticators\n *\n * @returns A SignedTransaction\n */\nexport function generateMultiSignersSignedTransaction(\n transaction: MultiAgentRawTransaction | FeePayerRawTransaction,\n senderAuthenticator: AccountAuthenticator,\n feePayerAuthenticator?: AccountAuthenticator,\n additionalSignersAuthenticators?: Array<AccountAuthenticator>,\n) {\n if (transaction instanceof FeePayerRawTransaction) {\n if (!feePayerAuthenticator) {\n throw new Error(\"Must provide a feePayerAuthenticator argument to generate a signed fee payer transaction\");\n }\n const txAuthenticatorFeePayer = new TransactionAuthenticatorFeePayer(\n senderAuthenticator,\n transaction.secondary_signer_addresses,\n additionalSignersAuthenticators ?? [],\n {\n address: transaction.fee_payer_address,\n authenticator: feePayerAuthenticator,\n },\n );\n return new SignedTransaction(transaction.raw_txn, txAuthenticatorFeePayer).bcsToBytes();\n }\n if (transaction instanceof MultiAgentRawTransaction) {\n if (!additionalSignersAuthenticators) {\n throw new Error(\n \"Must provide a additionalSignersAuthenticators argument to generate a signed multi agent transaction\",\n );\n }\n const multiAgentAuthenticator = new TransactionAuthenticatorMultiAgent(\n senderAuthenticator,\n transaction.secondary_signer_addresses,\n additionalSignersAuthenticators ?? [],\n );\n return new SignedTransaction(transaction.raw_txn, multiAgentAuthenticator).bcsToBytes();\n }\n\n throw new Error(\n `Cannot prepare multi signers transaction to submission, ${typeof transaction} transaction is not supported`,\n );\n}\n\n/**\n * Fetches and caches ABIs with allowing for pass-through on provided ABIs\n * @param key\n * @param moduleAddress\n * @param moduleName\n * @param functionName\n * @param aptosConfig\n * @param abi\n * @param fetch\n */\nasync function fetchAbi<T extends FunctionABI>({\n key,\n moduleAddress,\n moduleName,\n functionName,\n aptosConfig,\n abi,\n fetch,\n}: {\n key: string;\n moduleAddress: string;\n moduleName: string;\n functionName: string;\n aptosConfig: AptosConfig;\n abi?: T;\n fetch: (moduleAddress: string, moduleName: string, functionName: string, aptosConfig: AptosConfig) => Promise<T>;\n}): Promise<T> {\n if (abi) {\n return abi;\n }\n\n // We fetch the entry function ABI, and then pretend that we already had the ABI\n return memoizeAsync(\n async () => fetch(moduleAddress, moduleName, functionName, aptosConfig),\n `${key}-${aptosConfig.network}-${moduleAddress}-${moduleName}-${functionName}`,\n 1000 * 60 * 5, // 5 minutes\n )();\n}\n"],"mappings":"0+BAQA,OAAS,YAAYA,OAAgB,qBAyFrC,eAAsBC,GACpBC,EACwC,CACxC,GAAIC,EAAkBD,CAAI,EACxB,OAAOE,GAAiCF,CAAI,EAE9C,GAAM,CAAE,cAAAG,EAAe,WAAAC,EAAY,aAAAC,CAAa,EAAIC,EAAiBN,EAAK,QAAQ,EAE5EO,EAAc,MAAMC,GAAS,CACjC,IAAK,iBACL,cAAAL,EACA,WAAAC,EACA,aAAAC,EACA,YAAaL,EAAK,YAClB,IAAKA,EAAK,IACV,MAAOS,CACT,CAAC,EAGD,OAAOC,GAAkC,CAAE,IAAKH,EAAa,GAAGP,CAAK,CAAC,CACxE,CAIO,SAASU,GACdV,EAC+B,CAC/B,IAAMO,EAAcP,EAAK,IACnB,CAAE,cAAAG,EAAe,WAAAC,EAAY,aAAAC,CAAa,EAAIC,EAAiBN,EAAK,QAAQ,EAG5EW,EAAgBC,EAAoBZ,EAAK,aAAa,EAG5D,GAAIW,EAAc,SAAWJ,EAAY,eAAe,OACtD,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AI,CAACG,EACH,MAAM,IAAI,MAAM,0FAA0F,EAE5G,IAAM6B,EAA0B,IAAI3B,EAClCa,EACAxB,EAAY,2BACZyB,GAAmC,CAAC,EACpC,CACE,QAASzB,EAAY,kBACrB,cAAeS,CACjB,CACF,EACA,OAAO,IAAIG,EAAkBZ,EAAY,QAASsC,CAAuB,EAAE,WAAW,CACxF,CACA,GAAItC,aAAuBa,EAA0B,CACnD,GAAI,CAACY,EACH,MAAM,IAAI,MACR,sGACF,EAEF,IAAMc,EAA0B,IAAIzB,EAClCU,EACAxB,EAAY,2BACZyB,GAAmC,CAAC,CACtC,EACA,OAAO,IAAIb,EAAkBZ,EAAY,QAASuC,CAAuB,EAAE,WAAW,CACxF,CAEA,MAAM,IAAI,MACR,2DAA2D,OAAOvC,CAAW,+BAC/E,CACF,CAYA,eAAerD,GAAgC,CAC7C,IAAA6F,EACA,cAAAlG,EACA,WAAAC,EACA,aAAAC,EACA,YAAA2B,EACA,IAAAsE,EACA,MAAAC,CACF,EAQe,CACb,OAAID,GAKGE,EACL,SAAYD,EAAMpG,EAAeC,EAAYC,EAAc2B,CAAW,EACtE,GAAGqE,CAAG,IAAIrE,EAAY,OAAO,IAAI7B,CAAa,IAAIC,CAAU,IAAIC,CAAY,GAC5E,IAAO,GAAK,CACd,EAAE,CACJ","names":["sha3Hash","generateTransactionPayload","args","isScriptDataInput","generateTransactionPayloadScript","moduleAddress","moduleName","functionName","getFunctionParts","functionAbi","fetchAbi","fetchEntryFunctionAbi","generateTransactionPayloadWithABI","typeArguments","standardizeTypeTags","functionArguments","arg","i","convertArgument","entryFunctionPayload","EntryFunction","multisigAddress","AccountAddress","TransactionPayloadMultiSig","MultiSig","MultiSigTransactionPayload","TransactionPayloadEntryFunction","generateViewFunctionPayload","fetchViewFunctionAbi","generateViewFunctionPayloadWithABI","TransactionPayloadScript","Script","Hex","generateRawTransaction","aptosConfig","sender","payload","options","feePayerAddress","getChainId","NetworkToChainId","getLedgerInfo","getGasUnitPrice","getGasPriceEstimation","chainId","gasEstimate","getSequenceNumber","getInfo","sequenceNumber","seqNumber","maxGasAmount","gasUnitPrice","expireTimestamp","RawTransaction","ChainId","buildTransaction","rawTxn","signers","signer","MultiAgentTransaction","SimpleTransaction","generateSignedTransactionForSimulation","signerPublicKey","transaction","secondarySignersPublicKeys","feePayerPublicKey","accountAuthenticator","getAuthenticatorForSimulation","transactionToSign","FeePayerRawTransaction","secondaryAccountAuthenticators","publicKey","feePayerAuthenticator","transactionAuthenticator","TransactionAuthenticatorFeePayer","SignedTransaction","MultiAgentRawTransaction","TransactionAuthenticatorMultiAgent","AccountAuthenticatorEd25519","TransactionAuthenticatorEd25519","AccountAuthenticatorSingleKey","TransactionAuthenticatorSingleSender","AnyPublicKey","AnySignature","Ed25519Signature","Ed25519PublicKey","generateSignedTransaction","senderAuthenticator","additionalSignersAuthenticators","transactionToSubmit","deriveTransactionType","generateMultiSignersSignedTransaction","AccountAuthenticatorMultiKey","hashValues","input","hash","sha3Hash","item","TRANSACTION_PREFIX","generateUserTransactionHash","signedTransaction","txAuthenticatorFeePayer","multiAgentAuthenticator","key","abi","fetch","memoizeAsync"]}
@@ -1,2 +1,2 @@
1
- import{b as s}from"./chunk-6EMN3BOV.mjs";import{f as r}from"./chunk-URTTOOEM.mjs";import{a as o}from"./chunk-FVA2OPG4.mjs";var i=class{constructor(n){this.config=n}async simple(n){return r({aptosConfig:this.config,...n})}async multiAgent(n){return r({aptosConfig:this.config,...n})}};o([s],i.prototype,"simple",1),o([s],i.prototype,"multiAgent",1);export{i as a};
2
- //# sourceMappingURL=chunk-Y2MYVQVT.mjs.map
1
+ import{b as s}from"./chunk-6EMN3BOV.mjs";import{f as r}from"./chunk-6OKRMOWR.mjs";import{a as o}from"./chunk-FVA2OPG4.mjs";var i=class{constructor(n){this.config=n}async simple(n){return r({aptosConfig:this.config,...n})}async multiAgent(n){return r({aptosConfig:this.config,...n})}};o([s],i.prototype,"simple",1),o([s],i.prototype,"multiAgent",1);export{i as a};
2
+ //# sourceMappingURL=chunk-MKHPGY3O.mjs.map
@@ -0,0 +1,2 @@
1
+ import{a as i}from"./chunk-52DBSOFA.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-MRCVSUJQ.mjs.map
@@ -0,0 +1,2 @@
1
+ import{a as m,b as I}from"./chunk-YU7DNMEA.mjs";import{d as E}from"./chunk-4AOGG725.mjs";import{a as A,b}from"./chunk-ULUMROUJ.mjs";import{i as h,j as g,k as l,n as K,o as y}from"./chunk-ZUDMSBVZ.mjs";import{k as w}from"./chunk-S5HG2QUD.mjs";import{b as S}from"./chunk-U7EZI5D5.mjs";import{b as f}from"./chunk-52DBSOFA.mjs";import{b as d}from"./chunk-AOCNYMMX.mjs";import{jwtDecode as H}from"jwt-decode";import{decode as O}from"base-64";function x(j){let e=j.replace(/-/g,"+").replace(/_/g,"/"),r=e+"==".substring(0,(3-e.length%3)%3);return O(r)}var s=class s{constructor(e){let{address:r,ephemeralKeyPair:t,iss:i,uidKey:a,uidVal:n,aud:o,pepper:p,proofFetcherOrData:c,jwt:u}=e;this.ephemeralKeyPair=t;let D=g(e);this.publicKey=new h(i,D),this.accountAddress=r?S.from(r):this.publicKey.authKey().derivedAddress(),this.uidKey=a,this.uidVal=n,this.aud=o,this.jwt=u,c instanceof Promise?(this.proof=c,this.initialize(c)):this.proof=c,this.signingScheme=2;let P=d.fromHexInput(p).toUint8Array();if(P.length!==s.PEPPER_LENGTH)throw new Error(`Pepper length in bytes should be ${s.PEPPER_LENGTH}`);this.pepper=P}async initialize(e){try{this.proof=await e}catch{throw new Error("Failed to fetch proof")}}signWithAuthenticator(e){let r=m(e),t=new b(this.sign(r.bcsToBytes())),i=new A(this.publicKey);return new E(i,t)}async waitForProofFetch(){this.proof instanceof Promise&&await this.proof}sign(e){let{expiryDateSecs:r}=this.ephemeralKeyPair,t=Math.floor(new Date().getTime()/1e3);if(r<t)throw new Error("Ephemeral key pair is expired.");if(this.proof instanceof Promise)throw new Error("Failed to fetch proof.");let i=this.jwt.split(".")[0],a=this.ephemeralKeyPair.publicKey,n=new f;n.serializeFixedBytes(d.fromHexInput(e).toUint8Array()),n.serializeOption(this.proof.proof);let o=I(n.toUint8Array(),"TransactionAndProof"),p=this.ephemeralKeyPair.sign(o);return new y({jwtHeader:x(i),openIdSignatureOrZkProof:new l(this.proof),expiryDateSecs:r,ephemeralPublicKey:a,ephemeralSignature:p})}signTransaction(e){let r=m(e);return this.sign(r.bcsToBytes())}signWithOpenIdSignature(e){let[r,t,i]=this.jwt.split("."),a=new K({jwtSignature:i,jwtPayloadJson:t,uidKey:this.uidKey,epkBlinder:this.ephemeralKeyPair.blinder,pepper:this.pepper}),{expiryDateSecs:n}=this.ephemeralKeyPair,o=this.ephemeralKeyPair.publicKey,p=this.ephemeralKeyPair.sign(e);return new y({jwtHeader:r,openIdSignatureOrZkProof:new l(a),expiryDateSecs:n,ephemeralPublicKey:o,ephemeralSignature:p})}deriveAptosConnectPublicKey(){let{uidKey:e,uidVal:r,pepper:t}=this,{iss:i}=this.publicKey,a=g({uidKey:e,uidVal:r,aud:s.APTOS_CONNECT_CLIENT_ID,pepper:t});return new h(i,a)}verifySignature(e){return!0}static fromJWTAndProof(e){let{proofFetcherOrData:r,jwt:t,ephemeralKeyPair:i,pepper:a}=e,n=e.uidKey??"sub",o=H(t),p=o.iss;if(typeof o.aud!="string")throw new Error("aud was not found or an array of values");let c=o.aud,u=o[n];return new s({proofFetcherOrData:r,ephemeralKeyPair:i,iss:p,uidKey:n,uidVal:u,aud:c,pepper:a,jwt:t})}static fromDerivationPath(e,r){return w(e,s.SLIP_0010_SEED,r)}};s.PEPPER_LENGTH=31,s.SLIP_0010_SEED="32 bytes",s.APTOS_CONNECT_CLIENT_ID="734998116548-ib6ircv72o1b6l0no9ol4spnnkr8gm69.apps.googleusercontent.com";var T=s;export{T as a};
2
+ //# sourceMappingURL=chunk-MX3YIOU5.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/account/KeylessAccount.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { JwtPayload, jwtDecode } from \"jwt-decode\";\nimport { decode } from \"base-64\";\nimport { HexInput, SigningScheme } from \"../types\";\nimport { AccountAddress } from \"../core/accountAddress\";\nimport {\n AnyPublicKey,\n AnySignature,\n KeylessPublicKey,\n KeylessSignature,\n OpenIdSignature,\n OpenIdSignatureOrZkProof,\n Signature,\n SignedGroth16Signature,\n computeAddressSeed,\n fromDerivationPath as fromDerivationPathInner,\n} from \"../core/crypto\";\n\nimport { Account } from \"./Account\";\nimport { EphemeralKeyPair } from \"./EphemeralKeyPair\";\nimport { Hex } from \"../core/hex\";\nimport { AccountAuthenticatorSingleKey } from \"../transactions/authenticator/account\";\nimport { Serializer } from \"../bcs\";\nimport { deriveTransactionType, generateSigningMessage } from \"../transactions/transactionBuilder/signingMessage\";\nimport { AnyRawTransaction } from \"../transactions/types\";\n\nfunction base64UrlDecode(base64Url: string): string {\n // Replace base64url-specific characters\n const base64 = base64Url.replace(/-/g, \"+\").replace(/_/g, \"/\");\n\n // Pad the string with '=' characters if needed\n const paddedBase64 = base64 + \"==\".substring(0, (3 - (base64.length % 3)) % 3);\n\n // Decode the base64 string using the base-64 library\n const decodedString = decode(paddedBase64);\n\n return decodedString;\n}\n\nexport class KeylessAccount implements Account {\n static readonly PEPPER_LENGTH: number = 31;\n\n static readonly SLIP_0010_SEED: string = \"32 bytes\";\n\n static readonly APTOS_CONNECT_CLIENT_ID: string =\n \"734998116548-ib6ircv72o1b6l0no9ol4spnnkr8gm69.apps.googleusercontent.com\";\n\n publicKey: KeylessPublicKey;\n\n ephemeralKeyPair: EphemeralKeyPair;\n\n uidKey: string;\n\n uidVal: string;\n\n aud: string;\n\n pepper: Uint8Array;\n\n accountAddress: AccountAddress;\n\n proof: SignedGroth16Signature | Promise<SignedGroth16Signature>;\n\n signingScheme: SigningScheme;\n\n jwt: string;\n\n constructor(args: {\n address?: AccountAddress;\n ephemeralKeyPair: EphemeralKeyPair;\n iss: string;\n uidKey: string;\n uidVal: string;\n aud: string;\n pepper: HexInput;\n proofFetcherOrData: Promise<SignedGroth16Signature> | SignedGroth16Signature;\n jwt: string;\n }) {\n const { address, ephemeralKeyPair, iss, uidKey, uidVal, aud, pepper, proofFetcherOrData, jwt } = args;\n this.ephemeralKeyPair = ephemeralKeyPair;\n const addressSeed = computeAddressSeed(args);\n this.publicKey = new KeylessPublicKey(iss, addressSeed);\n this.accountAddress = address ? AccountAddress.from(address) : this.publicKey.authKey().derivedAddress();\n this.uidKey = uidKey;\n this.uidVal = uidVal;\n this.aud = aud;\n this.jwt = jwt;\n if (proofFetcherOrData instanceof Promise) {\n this.proof = proofFetcherOrData;\n this.initialize(proofFetcherOrData);\n } else {\n this.proof = proofFetcherOrData;\n }\n\n this.signingScheme = SigningScheme.SingleKey;\n const pepperBytes = Hex.fromHexInput(pepper).toUint8Array();\n if (pepperBytes.length !== KeylessAccount.PEPPER_LENGTH) {\n throw new Error(`Pepper length in bytes should be ${KeylessAccount.PEPPER_LENGTH}`);\n }\n this.pepper = pepperBytes;\n }\n\n private async initialize(promise: Promise<SignedGroth16Signature>) {\n try {\n this.proof = await promise;\n } catch (error) {\n throw new Error(\"Failed to fetch proof\");\n }\n }\n\n signWithAuthenticator(transaction: AnyRawTransaction): AccountAuthenticatorSingleKey {\n const raw = deriveTransactionType(transaction);\n const signature = new AnySignature(this.sign(raw.bcsToBytes()));\n const publicKey = new AnyPublicKey(this.publicKey);\n return new AccountAuthenticatorSingleKey(publicKey, signature);\n }\n\n async waitForProofFetch() {\n if (this.proof instanceof Promise) {\n await this.proof\n }\n }\n\n sign(data: HexInput): Signature {\n const { expiryDateSecs } = this.ephemeralKeyPair;\n const currentTimeInSeconds = Math.floor(new Date().getTime() / 1000);\n if (expiryDateSecs < currentTimeInSeconds) {\n throw new Error(\"Ephemeral key pair is expired.\");\n }\n if (this.proof instanceof Promise) {\n throw new Error(\"Failed to fetch proof.\");\n }\n const jwtHeader = this.jwt.split(\".\")[0];\n const ephemeralPublicKey = this.ephemeralKeyPair.publicKey;\n\n const serializer = new Serializer();\n serializer.serializeFixedBytes(Hex.fromHexInput(data).toUint8Array());\n serializer.serializeOption(this.proof.proof);\n const signMess = generateSigningMessage(serializer.toUint8Array(), \"TransactionAndProof\");\n\n const ephemeralSignature = this.ephemeralKeyPair.sign(signMess);\n\n return new KeylessSignature({\n jwtHeader: base64UrlDecode(jwtHeader),\n openIdSignatureOrZkProof: new OpenIdSignatureOrZkProof(this.proof),\n expiryDateSecs,\n ephemeralPublicKey,\n ephemeralSignature,\n });\n }\n\n signTransaction(transaction: AnyRawTransaction): Signature {\n const raw = deriveTransactionType(transaction);\n return this.sign(raw.bcsToBytes());\n }\n\n signWithOpenIdSignature(data: HexInput): Signature {\n const [jwtHeader, jwtPayload, jwtSignature] = this.jwt.split(\".\");\n const openIdSig = new OpenIdSignature({\n jwtSignature,\n jwtPayloadJson: jwtPayload,\n uidKey: this.uidKey,\n epkBlinder: this.ephemeralKeyPair.blinder,\n pepper: this.pepper,\n });\n\n const { expiryDateSecs } = this.ephemeralKeyPair;\n const ephemeralPublicKey = this.ephemeralKeyPair.publicKey;\n const ephemeralSignature = this.ephemeralKeyPair.sign(data);\n return new KeylessSignature({\n jwtHeader,\n openIdSignatureOrZkProof: new OpenIdSignatureOrZkProof(openIdSig),\n expiryDateSecs,\n ephemeralPublicKey,\n ephemeralSignature,\n });\n }\n\n deriveAptosConnectPublicKey(): KeylessPublicKey {\n const { uidKey, uidVal, pepper } = this;\n const { iss } = this.publicKey;\n const addressSeed = computeAddressSeed({\n uidKey,\n uidVal,\n aud: KeylessAccount.APTOS_CONNECT_CLIENT_ID,\n pepper,\n });\n return new KeylessPublicKey(iss, addressSeed);\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unused-vars, class-methods-use-this\n verifySignature(args: { message: HexInput; signature: Signature }): boolean {\n return true;\n }\n\n static fromJWTAndProof(args: {\n proofFetcherOrData: Promise<SignedGroth16Signature> | SignedGroth16Signature;\n jwt: string;\n ephemeralKeyPair: EphemeralKeyPair;\n pepper: HexInput;\n uidKey?: string;\n }): KeylessAccount {\n const { proofFetcherOrData, jwt, ephemeralKeyPair, pepper } = args;\n const uidKey = args.uidKey ?? \"sub\";\n\n const jwtPayload = jwtDecode<JwtPayload & { [key: string]: string }>(jwt);\n const iss = jwtPayload.iss!;\n if (typeof jwtPayload.aud !== \"string\") {\n throw new Error(\"aud was not found or an array of values\");\n }\n const aud = jwtPayload.aud!;\n const uidVal = jwtPayload[uidKey];\n return new KeylessAccount({\n proofFetcherOrData,\n ephemeralKeyPair,\n iss,\n uidKey,\n uidVal,\n aud,\n pepper,\n jwt,\n });\n }\n\n static fromDerivationPath(path: string, seed: Uint8Array): Uint8Array {\n return fromDerivationPathInner(path, KeylessAccount.SLIP_0010_SEED, seed);\n }\n}\n"],"mappings":"6WAGA,OAAqB,aAAAA,MAAiB,aACtC,OAAS,UAAAC,MAAc,UAwBvB,SAASC,EAAgBC,EAA2B,CAElD,IAAMC,EAASD,EAAU,QAAQ,KAAM,GAAG,EAAE,QAAQ,KAAM,GAAG,EAGvDE,EAAeD,EAAS,KAAK,UAAU,GAAI,EAAKA,EAAO,OAAS,GAAM,CAAC,EAK7E,OAFsBE,EAAOD,CAAY,CAG3C,CAEO,IAAME,EAAN,MAAMA,CAAkC,CA4B7C,YAAYC,EAUT,CACD,GAAM,CAAE,QAAAC,EAAS,iBAAAC,EAAkB,IAAAC,EAAK,OAAAC,EAAQ,OAAAC,EAAQ,IAAAC,EAAK,OAAAC,EAAQ,mBAAAC,EAAoB,IAAAC,CAAI,EAAIT,EACjG,KAAK,iBAAmBE,EACxB,IAAMQ,EAAcC,EAAmBX,CAAI,EAC3C,KAAK,UAAY,IAAIY,EAAiBT,EAAKO,CAAW,EACtD,KAAK,eAAiBT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AAAK,CAAO,EAAIP,EACxDI,EAASJ,EAAK,QAAU,MAExBqC,EAAaI,EAAkDhC,CAAG,EAClEN,EAAMkC,EAAW,IACvB,GAAI,OAAOA,EAAW,KAAQ,SAC5B,MAAM,IAAI,MAAM,yCAAyC,EAE3D,IAAM/B,EAAM+B,EAAW,IACjBhC,EAASgC,EAAWjC,CAAM,EAChC,OAAO,IAAIL,EAAe,CACxB,mBAAAS,EACA,iBAAAN,EACA,IAAAC,EACA,OAAAC,EACA,OAAAC,EACA,IAAAC,EACA,OAAAC,EACA,IAAAE,CACF,CAAC,CACH,CAEA,OAAO,mBAAmBiC,EAAcC,EAA8B,CACpE,OAAOC,EAAwBF,EAAM3C,EAAe,eAAgB4C,CAAI,CAC1E,CACF,EA5La5C,EACK,cAAwB,GAD7BA,EAGK,eAAyB,WAH9BA,EAKK,wBACd,2EANG,IAAM8C,EAAN9C","names":["jwtDecode","decode","base64UrlDecode","base64Url","base64","paddedBase64","decode","_KeylessAccount","args","address","ephemeralKeyPair","iss","uidKey","uidVal","aud","pepper","proofFetcherOrData","jwt","addressSeed","computeAddressSeed","KeylessPublicKey","AccountAddress","pepperBytes","Hex","promise","transaction","raw","deriveTransactionType","signature","AnySignature","publicKey","AnyPublicKey","AccountAuthenticatorSingleKey","data","expiryDateSecs","currentTimeInSeconds","jwtHeader","ephemeralPublicKey","serializer","Serializer","signMess","generateSigningMessage","ephemeralSignature","KeylessSignature","OpenIdSignatureOrZkProof","jwtPayload","jwtSignature","openIdSig","OpenIdSignature","jwtDecode","path","seed","fromDerivationPath","KeylessAccount"]}
@@ -0,0 +1,2 @@
1
+ import{f as e,g as s,h as t,i as o,j as r,k as i,l as a,m,n as c,o as g,p as u,q as p,r as d}from"./chunk-XESYWLDD.mjs";var A=class{constructor(n){this.config=n}async getOwnerAddress(n){return e({aptosConfig:this.config,...n})}async getExpiration(n){return t({aptosConfig:this.config,...n})}async getTargetAddress(n){return i({aptosConfig:this.config,...n})}async setTargetAddress(n){return a({aptosConfig:this.config,...n})}async getPrimaryName(n){return o({aptosConfig:this.config,...n})}async setPrimaryName(n){return r({aptosConfig:this.config,...n})}async registerName(n){return s({aptosConfig:this.config,...n})}async renewDomain(n){return d({aptosConfig:this.config,...n})}async getName(n){return m({aptosConfig:this.config,...n})}async getAccountNames(n){return c({aptosConfig:this.config,...n})}async getAccountDomains(n){return g({aptosConfig:this.config,...n})}async getAccountSubdomains(n){return u({aptosConfig:this.config,...n})}async getDomainSubdomains(n){return p({aptosConfig:this.config,...n})}};export{A as a};
2
+ //# sourceMappingURL=chunk-NJWTXEHT.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/api/ans.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { AccountAddress, AccountAddressInput } from \"../core\";\nimport {\n RegisterNameParameters,\n getExpiration,\n getOwnerAddress,\n registerName,\n getPrimaryName,\n setPrimaryName,\n getTargetAddress,\n setTargetAddress,\n renewDomain,\n getName,\n getAccountDomains,\n GetAccountDomainsArgs,\n GetAccountSubdomainsArgs,\n getAccountSubdomains,\n getAccountNames,\n GetAccountNamesArgs,\n getDomainSubdomains,\n GetDomainSubdomainsArgs,\n} from \"../internal/ans\";\nimport { GetANSNameResponse } from \"../types\";\nimport { InputGenerateTransactionOptions } from \"../transactions/types\";\nimport { AptosConfig } from \"./aptosConfig\";\nimport { SimpleTransaction } from \"../transactions/instances/simpleTransaction\";\nimport { Account } from \"../account\";\n\n/**\n * A class to handle all `ANS` operations\n */\nexport class ANS {\n constructor(readonly config: AptosConfig) {}\n\n /**\n * Retrieve the owner address of a domain name or subdomain name from the contract.\n *\n * @example\n * // Will return the owner address of \"test.aptos.apt\" or undefined\n * const owner = await aptos.getOwnerAddress({name: \"test.aptos\"})\n * // owner = 0x123...\n *\n * @param args.name - A string of the name to retrieve\n *\n * @returns AccountAddress if the name is owned, undefined otherwise\n */\n async getOwnerAddress(args: { name: string }): Promise<AccountAddress | undefined> {\n return getOwnerAddress({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Retrieve the expiration time of a domain name or subdomain name from the contract.\n *\n * @example\n * // Will return the expiration of \"test.aptos.apt\" or undefined\n * const exp = await aptos.getExpiration({name: \"test.aptos\"})\n * // new Date(exp) would give you the date in question: 2021-01-01T00:00:00.000Z\n *\n * @param args.name - A string of the name to retrieve\n *\n * @returns number as a unix timestamp in milliseconds.\n */\n async getExpiration(args: { name: string }): Promise<number | undefined> {\n return getExpiration({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Retrieve the target address of a domain or subdomain name. This is the\n * address the name points to for use on chain. Note, the target address can\n * point to addresses that are not the owner of the name\n *\n * @example\n * const targetAddr = await aptos.getTargetAddress({name: \"test.aptos\"})\n * // targetAddr = 0x123...\n *\n * @param args.name - A string of the name: primary, primary.apt, secondary.primary, secondary.primary.apt, etc.\n *\n * @returns AccountAddress if the name has a target, undefined otherwise\n */\n async getTargetAddress(args: { name: string }): Promise<AccountAddress | undefined> {\n return getTargetAddress({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Sets the target address of a domain or subdomain name. This is the\n * address the name points to for use on chain. Note, the target address can\n * point to addresses that are not the owner of the name\n *\n * @example\n * await aptos.setTargetAddress({sender: alice, name: \"test.aptos\", address: bob.accountAddress})\n * const address = await aptos.getTargetAddress({name: \"test.aptos\"})\n * // address = bob.accountAddress\n *\n * @param args.name - A string of the name: test.aptos.apt, test.apt, test, test.aptos, etc.\n * @param args.address - A AccountAddressInput of the address to set the domain or subdomain to\n *\n * @returns SimpleTransaction\n */\n async setTargetAddress(args: {\n sender: Account;\n name: string;\n address: AccountAddressInput;\n options?: InputGenerateTransactionOptions;\n }): Promise<SimpleTransaction> {\n return setTargetAddress({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Retrieve the primary name for an account. An account can have\n * multiple names that target it, but only a single name that is primary. An\n * account also may not have a primary name.\n *\n * @example\n * const name = await aptos.getPrimaryName({address: alice.accountAddress})\n * // name = test.aptos\n *\n * @param args.address - A AccountAddressInput (address) of the account\n *\n * @returns a string if the account has a primary name, undefined otherwise\n */\n async getPrimaryName(args: { address: AccountAddressInput }): Promise<string | undefined> {\n return getPrimaryName({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Sets the primary name for the sender. An account can have\n * multiple names that target it, but only a single name that is primary. An\n * account also may not have a primary name.\n *\n * @example\n * await aptos.setPrimaryName({sender: alice, name: \"test.aptos\"})\n * const primaryName = await aptos.getPrimaryName({address: alice.accountAddress})\n * // primaryName = test.aptos\n *\n * @param args.sender - The sender account\n * @param args.name - A string of the name: test, test.apt, test.aptos, test.aptos.apt, etc.\n *\n * @returns SimpleTransaction\n */\n async setPrimaryName(args: {\n sender: Account;\n name?: string;\n options?: InputGenerateTransactionOptions;\n }): Promise<SimpleTransaction> {\n return setPrimaryName({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Registers a new name\n *\n * @example\n * // An example of registering a subdomain name assuming def.apt is already registered\n * // and belongs to the sender alice.\n * const txn = aptos.registerName({\n * sender: alice,\n * name: \"test.aptos.apt\",\n * expiration: {\n * policy: \"subdomain:independent\",\n * expirationDate: Date.now() + 30 * 24 * 60 * 60 * 1000,\n * },\n * });\n *\n * @param args.sender - The sender account\n * @param args.name - A string of the name to register. This can be inclusive or exclusive of the .apt suffix.\n * Examples include: \"test\", \"test.apt\", \"test.aptos.apt\", etc.\n * @param args.expiration - An object with the expiration policy of the name.\n * @param args.expiration.policy - 'domain' | 'subdomain:follow-domain' | 'subdomain:independent'\n * - domain: Years is required and the name will expire after the given number of years.\n * - subdomain:follow-domain: The name will expire at the same time as the domain name.\n * - subdomain:independent: The name will expire at the given date.\n * @param args.expiration.expirationDate - An epoch number in milliseconds of\n * the date when the subdomain will expire. Only applicable when the policy is\n * set to 'subdomain:independent'.\n * @param args.transferable - Determines if the subdomain being minted is soul-bound. Applicable only to subdomains.\n * @param args.targetAddress optional - The address the domain name will resolve to. If not provided,\n * the sender's address will be used.\n * @param args.toAddress optional - The address to send the domain name to. If not provided,\n * the transaction will be sent to the router.\n *\n * @returns SimpleTransaction\n */\n async registerName(args: Omit<RegisterNameParameters, \"aptosConfig\">): Promise<SimpleTransaction> {\n return registerName({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Renews a domain name\n *\n * Note: If a domain name was minted with V1 of the contract, it will automatically be upgraded to V2 via this transaction.\n *\n * @example\n * await aptos.renewDomain({sender: alice, name: \"test\"})\n * // test.apt will be renewed for one year\n *\n * @param args.sender - The sender account\n * @param args.name - A string of the domain the subdomain will be under. The signer must be the domain owner.\n * Subdomains cannot be renewed.\n * @param args.years - The number of years to renew the name. Currently only one year is permitted.\n *\n * @returns SimpleTransaction\n */\n async renewDomain(args: {\n sender: Account;\n name: string;\n years?: 1;\n options?: InputGenerateTransactionOptions;\n }): Promise<SimpleTransaction> {\n return renewDomain({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Fetches a single name from the indexer\n * @param args.name - A string of the name to retrieve, e.g. \"test.aptos.apt\"\n * or \"test.apt\" or \"test\". Can be inclusive or exclusive of the .apt suffix.\n * Can be a subdomain.\n *\n * @returns A promise of an ANSName or undefined\n */\n async getName(args: { name: string }): Promise<GetANSNameResponse[0] | undefined> {\n return getName({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Fetches all names for an account (both top level domains and subdomains)\n *\n * @param args\n * @param args.accountAddress - A AccountAddressInput of the address to retrieve names for.\n * @param args.options.offset - Optional, the offset to start from when fetching names\n * @param args.options.limit - Optional, A number of the names to fetch per request\n * @param args.options.orderBy - The order to sort the names by\n * @param args.options.where - Additional filters to apply to the query\n *\n * @returns a promise of an array of ANSName\n */\n async getAccountNames(args: GetAccountNamesArgs): Promise<GetANSNameResponse> {\n return getAccountNames({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Fetches all top level domain names for an account\n *\n * @param args\n * @param args.accountAddress - A AccountAddressInput of the address to retrieve domain names for.\n * @param args.options.offset - Optional, the offset to start from when fetching names\n * @param args.options.limit - Optional, A number of the names to fetch per request\n * @param args.options.orderBy - The order to sort the names by\n * @param args.options.where - Additional filters to apply to the query\n *\n * @returns a promise of an array of ANSName\n */\n async getAccountDomains(args: GetAccountDomainsArgs): Promise<GetANSNameResponse> {\n return getAccountDomains({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Fetches all subdomains names for an account\n *\n * @param args\n * @param args.accountAddress - A AccountAddressInput of the address to retrieve subdomains names for.\n * @param args.options.offset - Optional, the offset to start from when fetching names\n * @param args.options.limit - Optional, A number of the names to fetch per request\n * @param args.options.orderBy - The order to sort the names by\n * @param args.options.where - Additional filters to apply to the query\n *\n * @returns a promise of an array of ANSName\n */\n async getAccountSubdomains(args: GetAccountSubdomainsArgs): Promise<GetANSNameResponse> {\n return getAccountSubdomains({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Fetches all subdomains names for a given domain. Note, this will not return the domain itself.\n *\n * @param args\n * @param args.domain - A string of the domain name: eg. \"test.apt\" or \"test\" (without the suffix of .apt)\n * @param args.options.offset - Optional, the offset to start from when fetching names\n * @param args.options.limit - Optional, A number of the names to fetch per request\n * @param args.options.orderBy - The order to sort the names by\n * @param args.options.where - Additional filters to apply to the query\n *\n * @returns a promise of an array of ANSName\n */\n async getDomainSubdomains(args: GetDomainSubdomainsArgs): Promise<GetANSNameResponse> {\n return getDomainSubdomains({ aptosConfig: this.config, ...args });\n }\n}\n"],"mappings":"wHAiCO,IAAMA,EAAN,KAAU,CACf,YAAqBC,EAAqB,CAArB,YAAAA,CAAsB,CAc3C,MAAM,gBAAgBC,EAA6D,CACjF,OAAOC,EAAgB,CAAE,YAAa,KAAK,OAAQ,GAAGD,CAAK,CAAC,CAC9D,CAcA,MAAM,cAAcA,EAAqD,CACvE,OAAOE,EAAc,CAAE,YAAa,KAAK,OAAQ,GAAGF,CAAK,CAAC,CAC5D,CAeA,MAAM,iBAAiBA,EAA6D,CAClF,OAAOG,EAAiB,CAAE,YAAa,KAAK,OAAQ,GAAGH,CAAK,CAAC,CAC/D,CAiBA,MAAM,iBAAiBA,EAKQ,CAC7B,OAAOI,EAAiB,CAAE,YAAa,KAAK,OAAQ,GAAGJ,CAAK,CAAC,CAC/D,CAeA,MAAM,eAAeA,EAAqE,CACxF,OAAOK,EAAe,CAAE,YAAa,KAAK,OAAQ,GAAGL,CAAK,CAAC,CAC7D,CAiBA,MAAM,eAAeA,EAIU,CAC7B,OAAOM,EAAe,CAAE,YAAa,KAAK,OAAQ,GAAGN,CAAK,CAAC,CAC7D,CAoCA,MAAM,aAAaA,EAA+E,CAChG,OAAOO,EAAa,CAAE,YAAa,KAAK,OAAQ,GAAGP,CAAK,CAAC,CAC3D,CAkBA,MAAM,YAAYA,EAKa,CAC7B,OAAOQ,EAAY,CAAE,YAAa,KAAK,OAAQ,GAAGR,CAAK,CAAC,CAC1D,CAUA,MAAM,QAAQA,EAAoE,CAChF,OAAOS,EAAQ,CAAE,YAAa,KAAK,OAAQ,GAAGT,CAAK,CAAC,CACtD,CAcA,MAAM,gBAAgBA,EAAwD,CAC5E,OAAOU,EAAgB,CAAE,YAAa,KAAK,OAAQ,GAAGV,CAAK,CAAC,CAC9D,CAcA,MAAM,kBAAkBA,EAA0D,CAChF,OAAOW,EAAkB,CAAE,YAAa,KAAK,OAAQ,GAAGX,CAAK,CAAC,CAChE,CAcA,MAAM,qBAAqBA,EAA6D,CACtF,OAAOY,EAAqB,CAAE,YAAa,KAAK,OAAQ,GAAGZ,CAAK,CAAC,CACnE,CAcA,MAAM,oBAAoBA,EAA4D,CACpF,OAAOa,EAAoB,CAAE,YAAa,KAAK,OAAQ,GAAGb,CAAK,CAAC,CAClE,CACF","names":["ANS","config","args","getOwnerAddress","getExpiration","getTargetAddress","setTargetAddress","getPrimaryName","setPrimaryName","registerName","renewDomain","getName","getAccountNames","getAccountDomains","getAccountSubdomains","getDomainSubdomains"]}
@@ -1,2 +1,2 @@
1
- import{a as i}from"./chunk-6EMN3BOV.mjs";import{g as a}from"./chunk-URTTOOEM.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-WHA7RISE.mjs.map
1
+ import{a as i}from"./chunk-6EMN3BOV.mjs";import{g as a}from"./chunk-6OKRMOWR.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-NU6UF6RM.mjs.map
@@ -1,2 +1,2 @@
1
- import{b as s}from"./chunk-QRS4DGP3.mjs";import{f as n}from"./chunk-TTUXAKCV.mjs";import{p as g,u as d}from"./chunk-S4SEFF4K.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-GKGTODGE.mjs.map
1
+ import{f as n}from"./chunk-CYWA4AJF.mjs";import{p as g,u as d}from"./chunk-S4SEFF4K.mjs";import{b as s}from"./chunk-U7EZI5D5.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-OAOJVE5X.mjs.map
@@ -0,0 +1,2 @@
1
+ import{g as e}from"./chunk-YP3RMVL3.mjs";import{d as c}from"./chunk-OVXWFD2N.mjs";import{d as r}from"./chunk-2HXKDHMA.mjs";import{b as s}from"./chunk-U7EZI5D5.mjs";async function x(a){let{aptosConfig:t,accountAddress:i,amount:p,options:n}=a,u=n?.timeoutSecs||20,{data:d}=await c({aptosConfig:t,path:"fund",body:{address:s.from(i).toString(),amount:p},originMethod:"fundAccount"}),m=d.txn_hashes[0],o=await e({aptosConfig:t,transactionHash:m,options:{timeoutSecs:u,checkSuccess:n?.checkSuccess}});if(o.type==="user_transaction")return o;throw new Error(`Unexpected transaction received for fund account: ${o.type}`)}export{x as a};
2
+ //# sourceMappingURL=chunk-ODA4KV4Q.mjs.map
@@ -0,0 +1,2 @@
1
+ import{b as p}from"./chunk-TR6Q7RSZ.mjs";async function o(e){let{type:t,originMethod:s,path:i,body:r,acceptType:R,contentType:f,params:c,aptosConfig:n,overrides:A}=e,d=n.getRequestUrl(t);return p({url:d,method:"POST",originMethod:s,path:i,body:r,contentType:f,acceptType:R,params:c,overrides:A},n,e.type)}async function q(e){let{aptosConfig:t}=e;return o({...e,type:"Fullnode",overrides:{...t.clientConfig,...t.fullnodeConfig,...e.overrides,HEADERS:{...t.clientConfig?.HEADERS,...t.fullnodeConfig?.HEADERS}}})}async function C(e){let{aptosConfig:t}=e;return o({...e,type:"Indexer",overrides:{...t.clientConfig,...t.indexerConfig,...e.overrides,HEADERS:{...t.clientConfig?.HEADERS,...t.indexerConfig?.HEADERS}}})}async function m(e){let{aptosConfig:t}=e,s={...t,clientConfig:{...t.clientConfig}};return delete s?.clientConfig?.API_KEY,o({...e,type:"Faucet",overrides:{...s.clientConfig,...s.faucetConfig,...e.overrides,HEADERS:{...s.clientConfig?.HEADERS,...s.faucetConfig?.HEADERS}}})}async function E(e){return o({...e,type:"Pepper"})}async function a(e){return o({...e,type:"Prover"})}export{o as a,q as b,C as c,m as d,E as e,a as f};
2
+ //# sourceMappingURL=chunk-OVXWFD2N.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/client/post.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { AptosConfig } from \"../api/aptosConfig\";\nimport { aptosRequest } from \"./core\";\nimport { AptosResponse } from \"./types\";\nimport { AnyNumber, ClientConfig, MimeType } from \"../types\";\nimport { AptosApiType } from \"../utils/const\";\n\nexport type PostRequestOptions = {\n /**\n * The config for the API client\n */\n aptosConfig: AptosConfig;\n /**\n * The type of API endpoint to call e.g. fullnode, indexer, etc\n */\n type: AptosApiType;\n /**\n * The name of the API method\n */\n originMethod: string;\n /**\n * The URL path to the API method\n */\n path: string;\n /**\n * The content type of the request body\n */\n contentType?: MimeType;\n /**\n * The accepted content type of the response of the API\n */\n acceptType?: MimeType;\n /**\n * The query parameters for the request\n */\n params?: Record<string, string | AnyNumber | boolean | undefined>;\n /**\n * The body of the request, should match the content type of the request\n */\n body?: any;\n /**\n * Specific client overrides for this request to override aptosConfig\n */\n overrides?: ClientConfig;\n};\n\nexport type PostAptosRequestOptions = Omit<PostRequestOptions, \"type\">;\n\n/**\n * Main function to do a Post request\n *\n * @param options PostRequestOptions\n * @returns\n */\nexport async function post<Req extends {}, Res extends {}>(\n options: PostRequestOptions,\n): Promise<AptosResponse<Req, Res>> {\n const { type, originMethod, path, body, acceptType, contentType, params, aptosConfig, overrides } = options;\n const url = aptosConfig.getRequestUrl(type);\n\n return aptosRequest<Req, Res>(\n {\n url,\n method: \"POST\",\n originMethod,\n path,\n body,\n contentType,\n acceptType,\n params,\n overrides,\n },\n aptosConfig,\n options.type,\n );\n}\n\nexport async function postAptosFullNode<Req extends {}, Res extends {}>(\n options: PostAptosRequestOptions,\n): Promise<AptosResponse<Req, Res>> {\n const { aptosConfig } = options;\n\n return post<Req, Res>({\n ...options,\n type: AptosApiType.FULLNODE,\n overrides: {\n ...aptosConfig.clientConfig,\n ...aptosConfig.fullnodeConfig,\n ...options.overrides,\n HEADERS: { ...aptosConfig.clientConfig?.HEADERS, ...aptosConfig.fullnodeConfig?.HEADERS },\n },\n });\n}\n\nexport async function postAptosIndexer<Req extends {}, Res extends {}>(\n options: PostAptosRequestOptions,\n): Promise<AptosResponse<Req, Res>> {\n const { aptosConfig } = options;\n\n return post<Req, Res>({\n ...options,\n type: AptosApiType.INDEXER,\n overrides: {\n ...aptosConfig.clientConfig,\n ...aptosConfig.indexerConfig,\n ...options.overrides,\n HEADERS: { ...aptosConfig.clientConfig?.HEADERS, ...aptosConfig.indexerConfig?.HEADERS },\n },\n });\n}\n\nexport async function postAptosFaucet<Req extends {}, Res extends {}>(\n options: PostAptosRequestOptions,\n): Promise<AptosResponse<Req, Res>> {\n const { aptosConfig } = options;\n // Faucet does not support API_KEY\n // Create a new object with the desired modification\n const modifiedAptosConfig = {\n ...aptosConfig,\n clientConfig: { ...aptosConfig.clientConfig },\n };\n // Delete API_KEY config\n delete modifiedAptosConfig?.clientConfig?.API_KEY;\n\n return post<Req, Res>({\n ...options,\n type: AptosApiType.FAUCET,\n overrides: {\n ...modifiedAptosConfig.clientConfig,\n ...modifiedAptosConfig.faucetConfig,\n ...options.overrides,\n HEADERS: { ...modifiedAptosConfig.clientConfig?.HEADERS, ...modifiedAptosConfig.faucetConfig?.HEADERS },\n },\n });\n}\n"],"mappings":"yCAwDA,eAAsBA,EACpBC,EACkC,CAClC,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names":["post","options","type","originMethod","path","body","acceptType","contentType","params","aptosConfig","overrides","url","aptosRequest","postAptosFullNode","postAptosIndexer","postAptosFaucet","modifiedAptosConfig"]}
1
+ {"version":3,"sources":["../../src/client/post.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { AptosConfig } from \"../api/aptosConfig\";\nimport { aptosRequest } from \"./core\";\nimport { AptosResponse } from \"./types\";\nimport { AnyNumber, ClientConfig, MimeType } from \"../types\";\nimport { AptosApiType } from \"../utils/const\";\n\nexport type PostRequestOptions = {\n /**\n * The config for the API client\n */\n aptosConfig: AptosConfig;\n /**\n * The type of API endpoint to call e.g. fullnode, indexer, etc\n */\n type: AptosApiType;\n /**\n * The name of the API method\n */\n originMethod: string;\n /**\n * The URL path to the API method\n */\n path: string;\n /**\n * The content type of the request body\n */\n contentType?: MimeType;\n /**\n * The accepted content type of the response of the API\n */\n acceptType?: MimeType;\n /**\n * The query parameters for the request\n */\n params?: Record<string, string | AnyNumber | boolean | undefined>;\n /**\n * The body of the request, should match the content type of the request\n */\n body?: any;\n /**\n * Specific client overrides for this request to override aptosConfig\n */\n overrides?: ClientConfig;\n};\n\nexport type PostAptosRequestOptions = Omit<PostRequestOptions, \"type\">;\n\n/**\n * Main function to do a Post request\n *\n * @param options PostRequestOptions\n * @returns\n */\nexport async function post<Req extends {}, Res extends {}>(\n options: PostRequestOptions,\n): Promise<AptosResponse<Req, Res>> {\n const { type, originMethod, path, body, acceptType, contentType, params, aptosConfig, overrides } = options;\n const url = aptosConfig.getRequestUrl(type);\n\n return aptosRequest<Req, Res>(\n {\n url,\n method: \"POST\",\n originMethod,\n path,\n body,\n contentType,\n acceptType,\n params,\n overrides,\n },\n aptosConfig,\n options.type,\n );\n}\n\nexport async function postAptosFullNode<Req extends {}, Res extends {}>(\n options: PostAptosRequestOptions,\n): Promise<AptosResponse<Req, Res>> {\n const { aptosConfig } = options;\n\n return post<Req, Res>({\n ...options,\n type: AptosApiType.FULLNODE,\n overrides: {\n ...aptosConfig.clientConfig,\n ...aptosConfig.fullnodeConfig,\n ...options.overrides,\n HEADERS: { ...aptosConfig.clientConfig?.HEADERS, ...aptosConfig.fullnodeConfig?.HEADERS },\n },\n });\n}\n\nexport async function postAptosIndexer<Req extends {}, Res extends {}>(\n options: PostAptosRequestOptions,\n): Promise<AptosResponse<Req, Res>> {\n const { aptosConfig } = options;\n\n return post<Req, Res>({\n ...options,\n type: AptosApiType.INDEXER,\n overrides: {\n ...aptosConfig.clientConfig,\n ...aptosConfig.indexerConfig,\n ...options.overrides,\n HEADERS: { ...aptosConfig.clientConfig?.HEADERS, ...aptosConfig.indexerConfig?.HEADERS },\n },\n });\n}\n\nexport async function postAptosFaucet<Req extends {}, Res extends {}>(\n options: PostAptosRequestOptions,\n): Promise<AptosResponse<Req, Res>> {\n const { aptosConfig } = options;\n // Faucet does not support API_KEY\n // Create a new object with the desired modification\n const modifiedAptosConfig = {\n ...aptosConfig,\n clientConfig: { ...aptosConfig.clientConfig },\n };\n // Delete API_KEY config\n delete modifiedAptosConfig?.clientConfig?.API_KEY;\n\n return post<Req, Res>({\n ...options,\n type: AptosApiType.FAUCET,\n overrides: {\n ...modifiedAptosConfig.clientConfig,\n ...modifiedAptosConfig.faucetConfig,\n ...options.overrides,\n HEADERS: { ...modifiedAptosConfig.clientConfig?.HEADERS, ...modifiedAptosConfig.faucetConfig?.HEADERS },\n },\n });\n}\n\n\nexport async function postAptosPepperService<Req extends {}, Res extends {}>(\n options: PostAptosRequestOptions,\n): Promise<AptosResponse<Req, Res>> {\n return post<Req, Res>({ ...options, type: AptosApiType.PEPPER });\n}\n\nexport async function postAptosProvingService<Req extends {}, Res extends {}>(\n options: PostAptosRequestOptions,\n): Promise<AptosResponse<Req, Res>> {\n return post<Req, Res>({ ...options, type: AptosApiType.PROVER });\n}"],"mappings":"yCAwDA,eAAsBA,EACpBC,EACkC,CAClC,GAAM,CAAE,KAAAC,EAAM,aAAAC,EAAc,KAAA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AAe,CAAE,GAAGC,EAAS,aAA0B,CAAC,CACjE,CAEA,eAAsBiB,EACpBjB,EACkC,CAClC,OAAOD,EAAe,CAAE,GAAGC,EAAS,aAA0B,CAAC,CACjE","names":["post","options","type","originMethod","path","body","acceptType","contentType","params","aptosConfig","overrides","url","aptosRequest","postAptosFullNode","postAptosIndexer","postAptosFaucet","modifiedAptosConfig","postAptosPepperService","postAptosProvingService"]}
@@ -1,2 +1,2 @@
1
- import{a as i}from"./chunk-6BR5UJDT.mjs";import{g as t}from"./chunk-T6J2LHHS.mjs";var r=class{constructor(o){this.config=o}async fundAccount(o){let n=await i({aptosConfig:this.config,...o});return o.options?.waitForIndexer!==!1&&await t({aptosConfig:this.config,minimumLedgerVersion:BigInt(n.version)}),n}};export{r as a};
2
- //# sourceMappingURL=chunk-5RUPEEIG.mjs.map
1
+ import{a as i}from"./chunk-ODA4KV4Q.mjs";import{h as t}from"./chunk-YP3RMVL3.mjs";var r=class{constructor(o){this.config=o}async fundAccount(o){let n=await i({aptosConfig:this.config,...o});return o.options?.waitForIndexer!==!1&&await t({aptosConfig:this.config,minimumLedgerVersion:BigInt(n.version)}),n}};export{r as a};
2
+ //# sourceMappingURL=chunk-P4UY6YKM.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/api/faucet.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { fundAccount } from \"../internal/faucet\";\nimport { UserTransactionResponse, WaitForTransactionOptions } from \"../types\";\nimport { AccountAddressInput } from \"../core\";\nimport { AptosConfig } from \"./aptosConfig\";\nimport { waitForIndexer } from \"../internal/transaction\";\n\n/**\n * A class to query all `Faucet` related queries on Aptos.\n */\nexport class Faucet {\n constructor(readonly config: AptosConfig) {}\n\n /**\n * This creates an account if it does not exist and mints the specified amount of\n * coins into that account\n *\n * @example\n * const transaction = await aptos.fundAccount({accountAddress:\"0x123\", amount: 100})\n *\n * @param args.accountAddress Address of the account to fund\n * @param args.amount Amount of tokens to fund the account with\n * @param args.options Configuration options for waitForTransaction\n * @returns Transaction hash of the transaction that funded the account\n */\n async fundAccount(args: {\n accountAddress: AccountAddressInput;\n amount: number;\n options?: WaitForTransactionOptions;\n }): Promise<UserTransactionResponse> {\n const fundTxn = await fundAccount({ aptosConfig: this.config, ...args });\n\n if (args.options?.waitForIndexer !== false) {\n await waitForIndexer({ aptosConfig: this.config, minimumLedgerVersion: BigInt(fundTxn.version) });\n }\n\n return fundTxn;\n }\n}\n"],"mappings":"kFAYO,IAAMA,EAAN,KAAa,CAClB,YAAqBC,EAAqB,CAArB,YAAAA,CAAsB,CAc3C,MAAM,YAAYC,EAImB,CACnC,IAAMC,EAAU,MAAMC,EAAY,CAAE,YAAa,KAAK,OAAQ,GAAGF,CAAK,CAAC,EAEvE,OAAIA,EAAK,SAAS,iBAAmB,IACnC,MAAMG,EAAe,CAAE,YAAa,KAAK,OAAQ,qBAAsB,OAAOF,EAAQ,OAAO,CAAE,CAAC,EAG3FA,CACT,CACF","names":["Faucet","config","args","fundTxn","fundAccount","waitForIndexer"]}
@@ -1,2 +1,2 @@
1
- import{a as n}from"./chunk-B7X6PSE7.mjs";import{b as a}from"./chunk-QRS4DGP3.mjs";import{a as v}from"./chunk-36QXVFR5.mjs";var t=class extends v{static deserialize(e){let r=e.deserializeUleb128AsU32();switch(r){case 0:return c.load(e);case 1:return u.load(e);case 2:return p.load(e);case 3:return z.load(e);case 4:return S.load(e);case 5:return U.load(e);case 6:return y.load(e);case 7:return b.load(e);case 8:return d.load(e);case 9:return g.load(e);case 10:return T.load(e);case 255:return h.load(e);default:throw new Error(`Unknown variant index for TypeTag: ${r}`)}}isBool(){return this instanceof c}isAddress(){return this instanceof S}isGeneric(){return this instanceof h}isSigner(){return this instanceof U}isVector(){return this instanceof y}isStruct(){return this instanceof b}isU8(){return this instanceof u}isU16(){return this instanceof d}isU32(){return this instanceof g}isU64(){return this instanceof p}isU128(){return this instanceof z}isU256(){return this instanceof T}},c=class i extends t{toString(){return"bool"}serialize(e){e.serializeU32AsUleb128(0)}static load(e){return new i}},u=class i extends t{toString(){return"u8"}serialize(e){e.serializeU32AsUleb128(1)}static load(e){return new i}},d=class i extends t{toString(){return"u16"}serialize(e){e.serializeU32AsUleb128(8)}static load(e){return new i}},g=class i extends t{toString(){return"u32"}serialize(e){e.serializeU32AsUleb128(9)}static load(e){return new i}},p=class i extends t{toString(){return"u64"}serialize(e){e.serializeU32AsUleb128(2)}static load(e){return new i}},z=class i extends t{toString(){return"u128"}serialize(e){e.serializeU32AsUleb128(3)}static load(e){return new i}},T=class i extends t{toString(){return"u256"}serialize(e){e.serializeU32AsUleb128(10)}static load(e){return new i}},S=class i extends t{toString(){return"address"}serialize(e){e.serializeU32AsUleb128(4)}static load(e){return new i}},U=class i extends t{toString(){return"signer"}serialize(e){e.serializeU32AsUleb128(5)}static load(e){return new i}},x=class i extends t{constructor(r){super();this.value=r}toString(){return`&${this.value.toString()}`}serialize(r){r.serializeU32AsUleb128(254)}static load(r){let s=t.deserialize(r);return new i(s)}},h=class i extends t{constructor(r){super();this.value=r;if(r<0)throw new Error("Generic type parameter index cannot be negative")}toString(){return`T${this.value}`}serialize(r){r.serializeU32AsUleb128(255),r.serializeU32(this.value)}static load(r){let s=r.deserializeU32();return new i(s)}},y=class i extends t{constructor(r){super();this.value=r}toString(){return`vector<${this.value.toString()}>`}static u8(){return new i(new u)}serialize(r){r.serializeU32AsUleb128(6),this.value.serialize(r)}static load(r){let s=t.deserialize(r);return new i(s)}},b=class i extends t{constructor(r){super();this.value=r}toString(){let r="";return this.value.typeArgs.length>0&&(r=`<${this.value.typeArgs.map(s=>s.toString()).join(", ")}>`),`${this.value.address.toString()}::${this.value.moduleName.identifier}::${this.value.name.identifier}${r}`}serialize(r){r.serializeU32AsUleb128(7),this.value.serialize(r)}static load(r){let s=o.deserialize(r);return new i(s)}isTypeTag(r,s,l){return this.value.moduleName.identifier===s&&this.value.name.identifier===l&&this.value.address.equals(r)}isString(){return this.isTypeTag(a.ONE,"string","String")}isOption(){return this.isTypeTag(a.ONE,"option","Option")}isObject(){return this.isTypeTag(a.ONE,"object","Object")}},o=class i extends v{constructor(e,r,s,l){super(),this.address=e,this.moduleName=r,this.name=s,this.typeArgs=l}serialize(e){e.serialize(this.address),e.serialize(this.moduleName),e.serialize(this.name),e.serializeVector(this.typeArgs)}static deserialize(e){let r=a.deserialize(e),s=n.deserialize(e),l=n.deserialize(e),f=e.deserializeVector(t);return new i(r,s,l,f)}};function O(){return new o(a.ONE,new n("aptos_coin"),new n("AptosCoin"),[])}function E(){return new o(a.ONE,new n("string"),new n("String"),[])}function V(i){return new o(a.ONE,new n("option"),new n("Option"),[i])}function j(i){return new o(a.ONE,new n("object"),new n("Object"),[i])}export{t as a,c as b,u as c,d,g as e,p as f,z as g,T as h,S as i,U as j,x as k,h as l,y as m,b as n,o,O as p,E as q,V as r,j as s};
2
- //# sourceMappingURL=chunk-U3YYSIIT.mjs.map
1
+ import{a as n}from"./chunk-RM7D2ITN.mjs";import{b as a}from"./chunk-U7EZI5D5.mjs";import{a as x}from"./chunk-52DBSOFA.mjs";var t=class extends x{static deserialize(e){let r=e.deserializeUleb128AsU32();switch(r){case 0:return c.load(e);case 1:return u.load(e);case 2:return p.load(e);case 3:return z.load(e);case 4:return S.load(e);case 5:return U.load(e);case 6:return y.load(e);case 7:return b.load(e);case 8:return d.load(e);case 9:return g.load(e);case 10:return T.load(e);case 255:return h.load(e);default:throw new Error(`Unknown variant index for TypeTag: ${r}`)}}isBool(){return this instanceof c}isAddress(){return this instanceof S}isGeneric(){return this instanceof h}isSigner(){return this instanceof U}isVector(){return this instanceof y}isStruct(){return this instanceof b}isU8(){return this instanceof u}isU16(){return this instanceof d}isU32(){return this instanceof g}isU64(){return this instanceof p}isU128(){return this instanceof z}isU256(){return this instanceof T}},c=class i extends t{toString(){return"bool"}serialize(e){e.serializeU32AsUleb128(0)}static load(e){return new i}},u=class i extends t{toString(){return"u8"}serialize(e){e.serializeU32AsUleb128(1)}static load(e){return new i}},d=class i extends t{toString(){return"u16"}serialize(e){e.serializeU32AsUleb128(8)}static load(e){return new i}},g=class i extends t{toString(){return"u32"}serialize(e){e.serializeU32AsUleb128(9)}static load(e){return new i}},p=class i extends t{toString(){return"u64"}serialize(e){e.serializeU32AsUleb128(2)}static load(e){return new i}},z=class i extends t{toString(){return"u128"}serialize(e){e.serializeU32AsUleb128(3)}static load(e){return new i}},T=class i extends t{toString(){return"u256"}serialize(e){e.serializeU32AsUleb128(10)}static load(e){return new i}},S=class i extends t{toString(){return"address"}serialize(e){e.serializeU32AsUleb128(4)}static load(e){return new i}},U=class i extends t{toString(){return"signer"}serialize(e){e.serializeU32AsUleb128(5)}static load(e){return new i}},f=class i extends t{constructor(r){super();this.value=r}toString(){return`&${this.value.toString()}`}serialize(r){r.serializeU32AsUleb128(254)}static load(r){let s=t.deserialize(r);return new i(s)}},h=class i extends t{constructor(r){super();this.value=r;if(r<0)throw new Error("Generic type parameter index cannot be negative")}toString(){return`T${this.value}`}serialize(r){r.serializeU32AsUleb128(255),r.serializeU32(this.value)}static load(r){let s=r.deserializeU32();return new i(s)}},y=class i extends t{constructor(r){super();this.value=r}toString(){return`vector<${this.value.toString()}>`}static u8(){return new i(new u)}serialize(r){r.serializeU32AsUleb128(6),this.value.serialize(r)}static load(r){let s=t.deserialize(r);return new i(s)}},b=class i extends t{constructor(r){super();this.value=r}toString(){let r="";return this.value.typeArgs.length>0&&(r=`<${this.value.typeArgs.map(s=>s.toString()).join(", ")}>`),`${this.value.address.toString()}::${this.value.moduleName.identifier}::${this.value.name.identifier}${r}`}serialize(r){r.serializeU32AsUleb128(7),this.value.serialize(r)}static load(r){let s=o.deserialize(r);return new i(s)}isTypeTag(r,s,l){return this.value.moduleName.identifier===s&&this.value.name.identifier===l&&this.value.address.equals(r)}isString(){return this.isTypeTag(a.ONE,"string","String")}isOption(){return this.isTypeTag(a.ONE,"option","Option")}isObject(){return this.isTypeTag(a.ONE,"object","Object")}},o=class i extends x{constructor(r,s,l,v){super();this.address=r,this.moduleName=s,this.name=l,this.typeArgs=v}serialize(r){r.serialize(this.address),r.serialize(this.moduleName),r.serialize(this.name),r.serializeVector(this.typeArgs)}static deserialize(r){let s=a.deserialize(r),l=n.deserialize(r),v=n.deserialize(r),A=r.deserializeVector(t);return new i(s,l,v,A)}};function E(){return new o(a.ONE,new n("aptos_coin"),new n("AptosCoin"),[])}function V(){return new o(a.ONE,new n("string"),new n("String"),[])}function j(i){return new o(a.ONE,new n("option"),new n("Option"),[i])}function G(i){return new o(a.ONE,new n("object"),new n("Object"),[i])}export{t as a,c as b,u as c,d,g as e,p as f,z as g,T as h,S as i,U as j,f as k,h as l,y as m,b as n,o,E as p,V as q,j as r,G as s};
2
+ //# sourceMappingURL=chunk-Q225PZMV.mjs.map
@@ -0,0 +1,2 @@
1
+ import{c as r}from"./chunk-MAFSWKAF.mjs";import{b as i}from"./chunk-OVXWFD2N.mjs";import{b as t}from"./chunk-52DBSOFA.mjs";async function v(a){let{aptosConfig:o,payload:n,options:s}=a,p=await r({...n,aptosConfig:o}),e=new t;p.serialize(e);let l=e.toUint8Array(),{data:d}=await i({aptosConfig:o,path:"view",originMethod:"view",contentType:"application/x.aptos.view_function+bcs",params:{ledger_version:s?.ledgerVersion},body:l});return d}export{v as a};
2
+ //# sourceMappingURL=chunk-Q6CZDSLM.mjs.map
@@ -1,2 +1,2 @@
1
- import{a as i,b as t,c as n,d as o}from"./chunk-5GKROFZ4.mjs";import{a as s}from"./chunk-IYSHHN5A.mjs";var r=class{constructor(e){this.config=e}async getFungibleAssetMetadata(e){return await s({config:this.config,minimumLedgerVersion:e?.minimumLedgerVersion,processorType:"fungible_asset_processor"}),i({aptosConfig:this.config,...e})}async getFungibleAssetMetadataByAssetType(e){return await s({config:this.config,minimumLedgerVersion:e?.minimumLedgerVersion,processorType:"fungible_asset_processor"}),(await i({aptosConfig:this.config,options:{where:{asset_type:{_eq:e.assetType}}}}))[0]}async getFungibleAssetActivities(e){return await s({config:this.config,minimumLedgerVersion:e?.minimumLedgerVersion,processorType:"fungible_asset_processor"}),t({aptosConfig:this.config,...e})}async getCurrentFungibleAssetBalances(e){return await s({config:this.config,minimumLedgerVersion:e?.minimumLedgerVersion,processorType:"fungible_asset_processor"}),n({aptosConfig:this.config,...e})}async transferFungibleAsset(e){return o({aptosConfig:this.config,...e})}};export{r as a};
2
- //# sourceMappingURL=chunk-GQR35QW3.mjs.map
1
+ import{a as i,b as t,c as n,d as o}from"./chunk-2FKQJL3H.mjs";import{a as s}from"./chunk-2I2XAOH7.mjs";var r=class{constructor(e){this.config=e}async getFungibleAssetMetadata(e){return await s({config:this.config,minimumLedgerVersion:e?.minimumLedgerVersion,processorType:"fungible_asset_processor"}),i({aptosConfig:this.config,...e})}async getFungibleAssetMetadataByAssetType(e){return await s({config:this.config,minimumLedgerVersion:e?.minimumLedgerVersion,processorType:"fungible_asset_processor"}),(await i({aptosConfig:this.config,options:{where:{asset_type:{_eq:e.assetType}}}}))[0]}async getFungibleAssetActivities(e){return await s({config:this.config,minimumLedgerVersion:e?.minimumLedgerVersion,processorType:"fungible_asset_processor"}),t({aptosConfig:this.config,...e})}async getCurrentFungibleAssetBalances(e){return await s({config:this.config,minimumLedgerVersion:e?.minimumLedgerVersion,processorType:"fungible_asset_processor"}),n({aptosConfig:this.config,...e})}async transferFungibleAsset(e){return o({aptosConfig:this.config,...e})}};export{r as a};
2
+ //# sourceMappingURL=chunk-R25D6NBC.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/api/fungibleAsset.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport {\n AnyNumber,\n GetCurrentFungibleAssetBalancesResponse,\n GetFungibleAssetActivitiesResponse,\n GetFungibleAssetMetadataResponse,\n PaginationArgs,\n WhereArg,\n} from \"../types\";\nimport {\n getCurrentFungibleAssetBalances,\n getFungibleAssetActivities,\n getFungibleAssetMetadata,\n transferFungibleAsset,\n} from \"../internal/fungibleAsset\";\nimport {\n CurrentFungibleAssetBalancesBoolExp,\n FungibleAssetActivitiesBoolExp,\n FungibleAssetMetadataBoolExp,\n} from \"../types/generated/types\";\nimport { ProcessorType } from \"../utils/const\";\nimport { AptosConfig } from \"./aptosConfig\";\nimport { waitForIndexerOnVersion } from \"./utils\";\nimport { AccountAddressInput } from \"../core\";\nimport { InputGenerateTransactionOptions } from \"../transactions\";\nimport { Account } from \"../account\";\nimport { SimpleTransaction } from \"../transactions/instances/simpleTransaction\";\n\n/**\n * A class to query all `FungibleAsset` related queries on Aptos.\n */\nexport class FungibleAsset {\n constructor(readonly config: AptosConfig) {}\n\n /**\n * Queries all fungible asset metadata.\n *\n * @example\n * const fungibleAsset = await aptos.getFungibleAssetMetadata()\n *\n * @param args.minimumLedgerVersion Optional ledger version to sync up to, before querying\n * @param args.options Optional configuration for pagination and filtering\n *\n * @returns A list of fungible asset metadata\n */\n async getFungibleAssetMetadata(args?: {\n minimumLedgerVersion?: AnyNumber;\n options?: PaginationArgs & WhereArg<FungibleAssetMetadataBoolExp>;\n }): Promise<GetFungibleAssetMetadataResponse> {\n await waitForIndexerOnVersion({\n config: this.config,\n minimumLedgerVersion: args?.minimumLedgerVersion,\n processorType: ProcessorType.FUNGIBLE_ASSET_PROCESSOR,\n });\n return getFungibleAssetMetadata({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Queries a fungible asset metadata\n *\n * This query returns the fungible asset metadata for a specific fungible asset.\n *\n * @example\n * const fungibleAsset = await aptos.getFungibleAssetMetadataByAssetType({assetType:\"0x123::test_coin::TestCoin\"})\n *\n * @param args.minimumLedgerVersion Optional ledger version to sync up to, before querying\n * @param args.assetType The asset type of the fungible asset.\n * e.g\n * \"0x1::aptos_coin::AptosCoin\" for Aptos Coin\n * \"0xc2948283c2ce03aafbb294821de7ee684b06116bb378ab614fa2de07a99355a8\" - address format if this is fungible asset\n *\n * @returns A fungible asset metadata item\n */\n async getFungibleAssetMetadataByAssetType(args: {\n assetType: string;\n minimumLedgerVersion?: AnyNumber;\n }): Promise<GetFungibleAssetMetadataResponse[0]> {\n await waitForIndexerOnVersion({\n config: this.config,\n minimumLedgerVersion: args?.minimumLedgerVersion,\n processorType: ProcessorType.FUNGIBLE_ASSET_PROCESSOR,\n });\n const data = await getFungibleAssetMetadata({\n aptosConfig: this.config,\n options: {\n where: {\n asset_type: { _eq: args.assetType },\n },\n },\n });\n\n return data[0];\n }\n\n /**\n * Queries all fungible asset activities\n *\n * @example\n * const fungibleAssetActivities = await aptos.getFungibleAssetActivities()\n *\n * @param args.minimumLedgerVersion Optional ledger version to sync up to, before querying\n * @param args.options Optional configuration for pagination and filtering\n *\n * @returns A list of fungible asset metadata\n */\n async getFungibleAssetActivities(args?: {\n minimumLedgerVersion?: AnyNumber;\n options?: PaginationArgs & WhereArg<FungibleAssetActivitiesBoolExp>;\n }): Promise<GetFungibleAssetActivitiesResponse> {\n await waitForIndexerOnVersion({\n config: this.config,\n minimumLedgerVersion: args?.minimumLedgerVersion,\n processorType: ProcessorType.FUNGIBLE_ASSET_PROCESSOR,\n });\n return getFungibleAssetActivities({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Queries all fungible asset balances\n *\n * @example\n * const fungibleAssetBalances = await aptos.getCurrentFungibleAssetBalances()\n *\n * @param args.minimumLedgerVersion Optional ledger version to sync up to, before querying\n * @param args.options Optional configuration for pagination and filtering\n *\n * @returns A list of fungible asset metadata\n */\n async getCurrentFungibleAssetBalances(args?: {\n minimumLedgerVersion?: AnyNumber;\n options?: PaginationArgs & WhereArg<CurrentFungibleAssetBalancesBoolExp>;\n }): Promise<GetCurrentFungibleAssetBalancesResponse> {\n await waitForIndexerOnVersion({\n config: this.config,\n minimumLedgerVersion: args?.minimumLedgerVersion,\n processorType: ProcessorType.FUNGIBLE_ASSET_PROCESSOR,\n });\n return getCurrentFungibleAssetBalances({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Transfer `amount` of fungible asset from sender's primary store to recipient's primary store.\n *\n * Use this method to transfer any fungible asset including fungible token.\n *\n * @example\n * const transaction = await aptos.transferFungibleAsset({\n * sender: alice,\n * fungibleAssetMetadataAddress: \"0x123\",\n * recipient: \"0x456\",\n * amount: 5\n * })\n *\n * @param sender The sender account\n * @param fungibleAssetMetadataAddress The fungible asset account address.\n * For example if you’re transferring USDT this would be the USDT address\n * @param recipient The recipient account address\n * @param amount Number of assets to transfer\n *\n * @returns A SimpleTransaction that can be simulated or submitted to chain.\n */\n async transferFungibleAsset(args: {\n sender: Account;\n fungibleAssetMetadataAddress: AccountAddressInput;\n recipient: AccountAddressInput;\n amount: AnyNumber;\n options?: InputGenerateTransactionOptions;\n }): Promise<SimpleTransaction> {\n return transferFungibleAsset({ aptosConfig: this.config, ...args });\n }\n}\n"],"mappings":"uGAiCO,IAAMA,EAAN,KAAoB,CACzB,YAAqBC,EAAqB,CAArB,YAAAA,CAAsB,CAa3C,MAAM,yBAAyBC,EAGe,CAC5C,aAAMC,EAAwB,CAC5B,OAAQ,KAAK,OACb,qBAAsBD,GAAM,qBAC5B,wCACF,CAAC,EACME,EAAyB,CAAE,YAAa,KAAK,OAAQ,GAAGF,CAAK,CAAC,CACvE,CAkBA,MAAM,oCAAoCA,EAGO,CAC/C,aAAMC,EAAwB,CAC5B,OAAQ,KAAK,OACb,qBAAsBD,GAAM,qBAC5B,wCACF,CAAC,GACY,MAAME,EAAyB,CAC1C,YAAa,KAAK,OAClB,QAAS,CACP,MAAO,CACL,WAAY,CAAE,IAAKF,EAAK,SAAU,CACpC,CACF,CACF,CAAC,GAEW,CAAC,CACf,CAaA,MAAM,2BAA2BA,EAGe,CAC9C,aAAMC,EAAwB,CAC5B,OAAQ,KAAK,OACb,qBAAsBD,GAAM,qBAC5B,wCACF,CAAC,EACMG,EAA2B,CAAE,YAAa,KAAK,OAAQ,GAAGH,CAAK,CAAC,CACzE,CAaA,MAAM,gCAAgCA,EAGe,CACnD,aAAMC,EAAwB,CAC5B,OAAQ,KAAK,OACb,qBAAsBD,GAAM,qBAC5B,wCACF,CAAC,EACMI,EAAgC,CAAE,YAAa,KAAK,OAAQ,GAAGJ,CAAK,CAAC,CAC9E,CAuBA,MAAM,sBAAsBA,EAMG,CAC7B,OAAOK,EAAsB,CAAE,YAAa,KAAK,OAAQ,GAAGL,CAAK,CAAC,CACpE,CACF","names":["FungibleAsset","config","args","waitForIndexerOnVersion","getFungibleAssetMetadata","getFungibleAssetActivities","getCurrentFungibleAssetBalances","transferFungibleAsset"]}
@@ -0,0 +1,2 @@
1
+ import{a as m}from"./chunk-Q225PZMV.mjs";import{a as g}from"./chunk-WZCUABDL.mjs";import{a as p}from"./chunk-RM7D2ITN.mjs";import{a as S}from"./chunk-UZHVGPGH.mjs";import{a as v}from"./chunk-35ZI4WOQ.mjs";import{a as F,b as d,c as T,d as x,e as E,f as _,g as w}from"./chunk-VVJEWB26.mjs";import{b as y}from"./chunk-U7EZI5D5.mjs";import{a as u}from"./chunk-52DBSOFA.mjs";function D(r){let e=r.deserializeUleb128AsU32();switch(e){case 0:return d.deserialize(r);case 1:return E.deserialize(r);case 2:return _.deserialize(r);case 3:return y.deserialize(r);case 4:return v.deserialize(r,d);case 5:return F.deserialize(r);case 6:return T.deserialize(r);case 7:return x.deserialize(r);case 8:return w.deserialize(r);default:throw new Error(`Unknown variant index for ScriptTransactionArgument: ${e}`)}}var a=class extends u{static deserialize(e){let t=e.deserializeUleb128AsU32();switch(t){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: ${t}`)}}},A=class r extends a{constructor(t){super();this.script=t}serialize(t){t.serializeU32AsUleb128(0),this.script.serialize(t)}static load(t){let i=U.deserialize(t);return new r(i)}},z=class r extends a{constructor(t){super();this.entryFunction=t}serialize(t){t.serializeU32AsUleb128(2),this.entryFunction.serialize(t)}static load(t){let i=l.deserialize(t);return new r(i)}},h=class r extends a{constructor(t){super();this.multiSig=t}serialize(t){t.serializeU32AsUleb128(3),this.multiSig.serialize(t)}static load(t){let i=f.deserialize(t);return new r(i)}},l=class r{constructor(e,t,i,n){this.module_name=e,this.function_name=t,this.type_args=i,this.args=n}static build(e,t,i,n){return new r(g.fromStr(e),new p(t),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(t=>{t.serializeForEntryFunction(e)})}static deserialize(e){let t=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 M=e.deserializeUleb128AsU32(),B=S.deserialize(e,M);s.push(B)}return new r(t,i,n,s)}},U=class r{constructor(e,t,i){this.bytecode=e,this.type_args=t,this.args=i}serialize(e){e.serializeBytes(this.bytecode),e.serializeVector(this.type_args),e.serializeU32AsUleb128(this.args.length),this.args.forEach(t=>{t.serializeForScriptFunction(e)})}static deserialize(e){let t=e.deserializeBytes(),i=e.deserializeVector(m),n=e.deserializeUleb128AsU32(),o=new Array;for(let s=0;s<n;s+=1){let c=D(e);o.push(c)}return new r(t,i,o)}},f=class r{constructor(e,t){this.multisig_address=e,this.transaction_payload=t}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 t=y.deserialize(e),i=e.deserializeBool(),n;return i&&(n=b.deserialize(e)),new r(t,n)}},b=class r extends u{constructor(t){super();this.transaction_payload=t}serialize(t){t.serializeU32AsUleb128(0),this.transaction_payload.serialize(t)}static deserialize(t){return t.deserializeUleb128AsU32(),new r(l.deserialize(t))}};export{D 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-RBDX3YWC.mjs.map
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=chunk-RFSO3JRG.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,2 @@
1
+ import{a as e}from"./chunk-52DBSOFA.mjs";var r=class t extends e{constructor(i){super();this.identifier=i}serialize(i){i.serializeStr(this.identifier)}static deserialize(i){let s=i.deserializeStr();return new t(s)}};export{r as a};
2
+ //# sourceMappingURL=chunk-RM7D2ITN.mjs.map
@@ -1,2 +1,2 @@
1
- import{a as s}from"./chunk-FKTXWOKR.mjs";import{a as e}from"./chunk-3JPVQHOR.mjs";var n=()=>Math.floor(Date.now()/1e3),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, resyncing ${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, resyncing ${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-C7YANDB2.mjs.map
1
+ import{a as s}from"./chunk-YIG37BG2.mjs";import{a as e}from"./chunk-3JPVQHOR.mjs";var n=()=>Math.floor(Date.now()/1e3),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, resyncing ${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, resyncing ${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-RXMGJBCP.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 { sleep } from \"../../utils/helpers\";\n\n// returns `now` time in seconds\nconst now = () => Math.floor(Date.now() / 1000);\n\nexport class AccountSequenceNumber {\n readonly aptosConfig: AptosConfig;\n\n readonly account: Account;\n\n // sequence number on chain\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 a 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 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 *\n * @returns 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 = now();\n while (this.currentNumber! - this.lastUncommintedNumber! >= this.maximumInFlight) {\n await sleep(this.sleepTime);\n if (now() - startTime > this.maxWaitTime) {\n /* eslint-disable no-console */\n console.warn(\n `Waited over 30 seconds for a transaction to commit, resyncing ${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 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 sequence number with the one on-chain\n *\n * @returns 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 local sequence number with the seqeunce number on chain for this account.\n *\n * Poll the network until all submitted transactions have either been committed or until\n * the maximum wait time has elapsed\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 = now();\n while (this.lastUncommintedNumber !== this.currentNumber) {\n if (now() - startTime > this.maxWaitTime) {\n /* eslint-disable no-console */\n console.warn(\n `Waited over 30 seconds for a transaction to commit, resyncing ${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":"kFA+BA,IAAMA,EAAM,IAAM,KAAK,MAAM,KAAK,IAAI,EAAI,GAAI,EAEjCC,EAAN,KAA4B,CA8BjC,YACEC,EACAC,EACAC,EACAC,EACAC,EACA,CA9BF,2BAAuC,KAGvC,mBAA+B,KAa/B,UAAO,GAeL,KAAK,YAAcJ,EACnB,KAAK,QAAUC,EACf,KAAK,YAAcC,EACnB,KAAK,gBAAkBC,EACvB,KAAK,UAAYC,CACnB,CAOA,MAAM,oBAA6C,CAEjD,KAAO,KAAK,MACV,MAAMC,EAAM,KAAK,SAAS,EAG5B,KAAK,KAAO,GACZ,IAAIC,EAAa,OAAO,CAAC,EACzB,GAAI,CAKF,IAJI,KAAK,wBAA0B,MAAQ,KAAK,gBAAkB,OAChE,MAAM,KAAK,WAAW,EAGpB,KAAK,cAAiB,KAAK,uBAA0B,KAAK,gBAAiB,CAC7E,MAAM,KAAK,OAAO,EAElB,IAAMC,EAAYT,EAAI,EACtB,KAAO,KAAK,cAAiB,KAAK,uBAA0B,KAAK,iBAC/D,MAAMO,EAAM,KAAK,SAAS,EACtBP,EAAI,EAAIS,EAAY,KAAK,aAE3B,QAAQ,KACN,iEAAiE,KAAK,QAAQ,eAAe,SAAS,CAAC,EACzG,EACA,MAAM,KAAK,WAAW,GAEtB,MAAM,KAAK,OAAO,CAGxB,CACAD,EAAa,KAAK,cAClB,KAAK,eAAkB,OAAO,CAAC,CACjC,OAASE,EAAG,CACV,QAAQ,MAAM,yDAA0DA,CAAC,CAC3E,QAAE,CACA,KAAK,KAAO,EACd,CACA,OAAOF,CACT,CAKA,MAAM,YAA4B,CAChC,GAAM,CAAE,gBAAiBG,CAAe,EAAI,MAAMC,EAAQ,CACxD,YAAa,KAAK,YAClB,eAAgB,KAAK,QAAQ,cAC/B,CAAC,EACD,KAAK,cAAgB,OAAOD,CAAc,EAC1C,KAAK,sBAAwB,OAAOA,CAAc,CACpD,CAOA,MAAM,QAA0B,CAC9B,GAAM,CAAE,gBAAiBA,CAAe,EAAI,MAAMC,EAAQ,CACxD,YAAa,KAAK,YAClB,eAAgB,KAAK,QAAQ,cAC/B,CAAC,EACD,YAAK,sBAAwB,OAAOD,CAAc,EAC3C,KAAK,qBACd,CAQA,MAAM,aAA6B,CACjC,GAAI,KAAK,wBAA0B,KAAK,cAGxC,MAAO,KAAK,MACV,MAAMJ,EAAM,KAAK,SAAS,EAG5B,KAAK,KAAO,GAEZ,GAAI,CACF,MAAM,KAAK,OAAO,EAClB,IAAME,EAAYT,EAAI,EACtB,KAAO,KAAK,wBAA0B,KAAK,eACrCA,EAAI,EAAIS,EAAY,KAAK,aAE3B,QAAQ,KACN,iEAAiE,KAAK,QAAQ,eAAe,SAAS,CAAC,EACzG,EACA,MAAM,KAAK,WAAW,IAEtB,MAAMF,EAAM,KAAK,SAAS,EAC1B,MAAM,KAAK,OAAO,EAGxB,OAASG,EAAG,CACV,QAAQ,MAAM,4EAA6EA,CAAC,CAC9F,QAAE,CACA,KAAK,KAAO,EACd,EACF,CACF","names":["now","AccountSequenceNumber","aptosConfig","account","maxWaitTime","maximumInFlight","sleepTime","sleep","nextNumber","startTime","e","sequenceNumber","getInfo"]}
@@ -0,0 +1,2 @@
1
+ import{hmac as A}from"@noble/hashes/hmac";import{sha512 as u}from"@noble/hashes/sha512";import*as p from"@scure/bip39";var x=/^m\/44'\/637'\/[0-9]+'\/[0-9]+'\/[0-9]+'?$/,l=/^m\/44'\/637'\/[0-9]+'\/[0-9]+\/[0-9]+$/,f="m/44'/637'/0'/0'/0'",D=(r=>(r.ED25519="ed25519 seed",r))(D||{}),c=2147483648;function E(e){return l.test(e)}function g(e){return x.test(e)}var d=(e,r)=>{let t=A.create(u,e).update(r).digest();return{key:t.slice(0,32),chainCode:t.slice(32)}},v=({key:e,chainCode:r},t)=>{let n=new ArrayBuffer(4);new DataView(n).setUint32(0,t);let i=new Uint8Array(n),o=new Uint8Array([0]),s=new Uint8Array([...o,...e,...i]);return d(r,s)},P=e=>e.replace("'",""),U=e=>e.split("/").slice(1).map(P);function I(e,r,t,n=c){if(n===c&&!g(e))throw new Error(`Invalid hardened derivation path ${e}`);if(n!==c&&!E(e))throw new Error(`Invalid derivation path ${e}`);let{key:i,chainCode:o}=d(r,t),s=U(e).map(a=>parseInt(a,10)),{key:m}=s.reduce((a,y)=>v(a,y+n),{key:i,chainCode:o});return m}var _=e=>{let r=e.trim().split(/\s+/).map(t=>t.toLowerCase()).join(" ");return p.mnemonicToSeedSync(r)};export{x as a,l as b,f as c,D as d,c as e,E as f,g,d as h,v as i,U as j,I as k,_ as l};
2
+ //# sourceMappingURL=chunk-S5HG2QUD.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/core/crypto/hdKey.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { hmac } from \"@noble/hashes/hmac\";\nimport { sha512 } from \"@noble/hashes/sha512\";\nimport * as bip39 from \"@scure/bip39\";\nimport { HexInput } from \"../../types\";\n\nexport type DerivedKeys = {\n key: Uint8Array;\n chainCode: Uint8Array;\n};\n\n/**\n * Aptos derive path is 637\n */\nexport const APTOS_HARDENED_REGEX = /^m\\/44'\\/637'\\/[0-9]+'\\/[0-9]+'\\/[0-9]+'?$/;\nexport const APTOS_BIP44_REGEX = /^m\\/44'\\/637'\\/[0-9]+'\\/[0-9]+\\/[0-9]+$/;\nexport const APTOS_BIP44_DEFAULT_DERIVATION_PATH = \"m/44'/637'/0'/0'/0'\";\n\n/**\n * A list of supported key types and associated seeds\n */\nexport enum KeyType {\n ED25519 = \"ed25519 seed\",\n}\n\nexport const HARDENED_OFFSET = 0x80000000;\n\n/**\n * Aptos derive path is 637\n *\n * Parse and validate a path that is compliant to BIP-44 in form m/44'/637'/{account_index}'/{change_index}/{address_index}\n * for Secp256k1\n *\n * Note that for secp256k1, last two components must be non-hardened.\n *\n * @param path path string (e.g. `m/44'/637'/0'/0/0`).\n */\nexport function isValidBIP44Path(path: string): boolean {\n return APTOS_BIP44_REGEX.test(path);\n}\n\n/**\n * Aptos derive path is 637\n *\n * Parse and validate a path that is compliant to SLIP-0010 and BIP-44\n * in form m/44'/637'/{account_index}'/{change_index}'/{address_index}'.\n * See SLIP-0010 {@link https://github.com/satoshilabs/slips/blob/master/slip-0044.md}\n * See BIP-44 {@link https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki}\n *\n * Note that for Ed25519, all components must be hardened.\n * This is because non-hardened [PK] derivation would not work due to Ed25519's lack of a key homomorphism.\n * Specifically, you cannot derive the PK associated with derivation path a/b/c given the PK of a/b.\n * This is because the PK in Ed25519 is, more or less, computed as 𝑔𝐻(𝑠𝑘),\n * with the hash function breaking the homomorphism.\n *\n * @param path path string (e.g. `m/44'/637'/0'/0'/0'`).\n */\nexport function isValidHardenedPath(path: string): boolean {\n return APTOS_HARDENED_REGEX.test(path);\n}\n\nexport const deriveKey = (hashSeed: Uint8Array | string, data: Uint8Array | string): DerivedKeys => {\n const digest = hmac.create(sha512, hashSeed).update(data).digest();\n return {\n key: digest.slice(0, 32),\n chainCode: digest.slice(32),\n };\n};\n\n/**\n * Derive a child key from the private key\n * @param key\n * @param chainCode\n * @param index\n * @constructor\n */\nexport const CKDPriv = ({ key, chainCode }: DerivedKeys, index: number): DerivedKeys => {\n const buffer = new ArrayBuffer(4);\n new DataView(buffer).setUint32(0, index);\n const indexBytes = new Uint8Array(buffer);\n const zero = new Uint8Array([0]);\n const data = new Uint8Array([...zero, ...key, ...indexBytes]);\n return deriveKey(chainCode, data);\n};\n\nconst removeApostrophes = (val: string): string => val.replace(\"'\", \"\");\n\n/**\n * Splits derive path into segments\n * @param path\n */\nexport const splitPath = (path: string): Array<string> => path.split(\"/\").slice(1).map(removeApostrophes);\n\n/**\n * @param path the BIP44 path\n * @param seed the seed phrase created by the mnemonics\n * @param offset the offset used for key derivation, defaults to 0x80000000\n * @returns\n */\nexport function fromDerivationPath(\n path: string,\n hashSeed: HexInput,\n seed: Uint8Array,\n offset = HARDENED_OFFSET,\n): Uint8Array {\n if (offset === HARDENED_OFFSET && !isValidHardenedPath(path)) {\n throw new Error(`Invalid hardened derivation path ${path}`);\n } else if (offset !== HARDENED_OFFSET && !isValidBIP44Path(path)) {\n throw new Error(`Invalid derivation path ${path}`);\n }\n const { key, chainCode } = deriveKey(hashSeed, seed);\n\n const segments = splitPath(path).map((el) => parseInt(el, 10));\n\n // Derive the child key based on the path\n const { key: privateKey } = segments.reduce((parentKeys, segment) => CKDPriv(parentKeys, segment + offset), {\n key,\n chainCode,\n });\n return privateKey;\n}\n\n/**\n * Normalizes the mnemonic by removing extra whitespace and making it lowercase\n * @param mnemonic the mnemonic seed phrase\n */\nexport const mnemonicToSeed = (mnemonic: string): Uint8Array => {\n const normalizedMnemonic = mnemonic\n .trim()\n .split(/\\s+/)\n .map((part) => part.toLowerCase())\n .join(\" \");\n return bip39.mnemonicToSeedSync(normalizedMnemonic);\n};\n"],"mappings":"AAGA,OAAS,QAAAA,MAAY,qBACrB,OAAS,UAAAC,MAAc,uBACvB,UAAYC,MAAW,eAWhB,IAAMC,EAAuB,6CACvBC,EAAoB,0CACpBC,EAAsC,sBAKvCC,OACVA,EAAA,QAAU,eADAA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AE,CAAC,EAGvD,CAAE,IAAKC,CAAW,EAAIF,EAAS,OAAO,CAACG,EAAYC,IAAYjB,EAAQgB,EAAYC,EAAUL,CAAM,EAAG,CAC1G,IAAAX,EACA,UAAAC,CACF,CAAC,EACD,OAAOa,CACT,CAMO,IAAMG,EAAkBC,GAAiC,CAC9D,IAAMC,EAAqBD,EACxB,KAAK,EACL,MAAM,KAAK,EACX,IAAKE,GAASA,EAAK,YAAY,CAAC,EAChC,KAAK,GAAG,EACX,OAAa,qBAAmBD,CAAkB,CACpD","names":["hmac","sha512","bip39","APTOS_HARDENED_REGEX","APTOS_BIP44_REGEX","APTOS_BIP44_DEFAULT_DERIVATION_PATH","KeyType","HARDENED_OFFSET","isValidBIP44Path","path","isValidHardenedPath","deriveKey","hashSeed","data","digest","CKDPriv","key","chainCode","index","buffer","indexBytes","zero","removeApostrophes","val","splitPath","fromDerivationPath","seed","offset","segments","el","privateKey","parentKeys","segment","mnemonicToSeed","mnemonic","normalizedMnemonic","part"]}
@@ -0,0 +1,2 @@
1
+ var s={mainnet:"https://api.mainnet.aptoslabs.com/v1/graphql",testnet:"https://api.testnet.aptoslabs.com/v1/graphql",devnet:"https://api.devnet.aptoslabs.com/v1/graphql",randomnet:"https://indexer-randomnet.hasura.app/v1/graphql",local:"http://127.0.0.1:8090/v1/graphql"},o={mainnet:"https://api.mainnet.aptoslabs.com/v1",testnet:"https://api.testnet.aptoslabs.com/v1",devnet:"https://api.devnet.aptoslabs.com/v1",randomnet:"https://fullnode.random.aptoslabs.com/v1",local:"http://127.0.0.1:8080/v1"},n={mainnet:"https://faucet.mainnet.aptoslabs.com",testnet:"https://faucet.testnet.aptoslabs.com",devnet:"https://faucet.devnet.aptoslabs.com",randomnet:"https://faucet.random.aptoslabs.com",local:"http://127.0.0.1:8081"},a={mainnet:"mainnet not yet ready, requires sdk upgrade",testnet:"https://api.testnet.aptoslabs.com/keyless/pepper/v0",devnet:"https://api.devnet.aptoslabs.com/keyless/pepper/v0",local:"https://api.devnet.aptoslabs.com/keyless/pepper/v0"},p={mainnet:"mainnet not yet ready, requires sdk upgrade",testnet:"https://api.testnet.aptoslabs.com/keyless/prover/v0",devnet:"https://prover.keyless.devnet.aptoslabs.com/v0",local:"https://api.devnet.aptoslabs.com/keyless/prover/v0"},e=(t=>(t.MAINNET="mainnet",t.TESTNET="testnet",t.DEVNET="devnet",t.RANDOMNET="randomnet",t.LOCAL="local",t.CUSTOM="custom",t))(e||{}),r={mainnet:1,testnet:2,randomnet:70},c={mainnet:"mainnet",testnet:"testnet",devnet:"devnet",randomnet:"randomnet",local:"local",custom:"custom"};export{s as a,o as b,n as c,a as d,p as e,e as f,r as g,c as h};
2
+ //# sourceMappingURL=chunk-SCPXFKEK.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/utils/apiEndpoints.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nexport const NetworkToIndexerAPI: Record<string, string> = {\n mainnet: \"https://api.mainnet.aptoslabs.com/v1/graphql\",\n testnet: \"https://api.testnet.aptoslabs.com/v1/graphql\",\n devnet: \"https://api.devnet.aptoslabs.com/v1/graphql\",\n randomnet: \"https://indexer-randomnet.hasura.app/v1/graphql\",\n local: \"http://127.0.0.1:8090/v1/graphql\",\n};\n\nexport const NetworkToNodeAPI: Record<string, string> = {\n mainnet: \"https://api.mainnet.aptoslabs.com/v1\",\n testnet: \"https://api.testnet.aptoslabs.com/v1\",\n devnet: \"https://api.devnet.aptoslabs.com/v1\",\n randomnet: \"https://fullnode.random.aptoslabs.com/v1\",\n local: \"http://127.0.0.1:8080/v1\",\n};\n\nexport const NetworkToFaucetAPI: Record<string, string> = {\n mainnet: \"https://faucet.mainnet.aptoslabs.com\",\n testnet: \"https://faucet.testnet.aptoslabs.com\",\n devnet: \"https://faucet.devnet.aptoslabs.com\",\n randomnet: \"https://faucet.random.aptoslabs.com\",\n local: \"http://127.0.0.1:8081\",\n};\n\nexport const NetworkToPepperAPI: Record<string, string> = {\n mainnet: \"mainnet not yet ready, requires sdk upgrade\",\n testnet: \"https://api.testnet.aptoslabs.com/keyless/pepper/v0\",\n devnet: \"https://api.devnet.aptoslabs.com/keyless/pepper/v0\",\n local: \"https://api.devnet.aptoslabs.com/keyless/pepper/v0\",\n};\n\nexport const NetworkToProverAPI: Record<string, string> = {\n mainnet: \"mainnet not yet ready, requires sdk upgrade\",\n testnet: \"https://api.testnet.aptoslabs.com/keyless/prover/v0\",\n devnet: \"https://prover.keyless.devnet.aptoslabs.com/v0\",\n local: \"https://api.devnet.aptoslabs.com/keyless/prover/v0\",\n};\n\nexport enum Network {\n MAINNET = \"mainnet\",\n TESTNET = \"testnet\",\n DEVNET = \"devnet\",\n RANDOMNET = \"randomnet\",\n LOCAL = \"local\",\n CUSTOM = \"custom\",\n}\n\nexport const NetworkToChainId: Record<string, number> = {\n mainnet: 1,\n testnet: 2,\n randomnet: 70,\n};\n\nexport const NetworkToNetworkName: Record<string, Network> = {\n mainnet: Network.MAINNET,\n testnet: Network.TESTNET,\n devnet: Network.DEVNET,\n randomnet: Network.RANDOMNET,\n local: Network.LOCAL,\n custom: Network.CUSTOM,\n};\n"],"mappings":"AAGO,IAAMA,EAA8C,CACzD,QAAS,+CACT,QAAS,+CACT,OAAQ,8CACR,UAAW,kDACX,MAAO,kCACT,EAEaC,EAA2C,CACtD,QAAS,uCACT,QAAS,uCACT,OAAQ,sCACR,UAAW,2CACX,MAAO,0BACT,EAEaC,EAA6C,CACxD,QAAS,uCACT,QAAS,uCACT,OAAQ,sCACR,UAAW,sCACX,MAAO,uBACT,EAEaC,EAA6C,CACxD,QAAS,8CACT,QAAS,sDACT,OAAQ,qDACR,MAAO,oDACT,EAEaC,EAA6C,CACxD,QAAS,8CACT,QAAS,sDACT,OAAQ,iDACR,MAAO,oDACT,EAEYC,OACVA,EAAA,QAAU,UACVA,EAAA,QAAU,UACVA,EAAA,OAAS,SACTA,EAAA,UAAY,YACZA,EAAA,MAAQ,QACRA,EAAA,OAAS,SANCA,OAAA,IASCC,EAA2C,CACtD,QAAS,EACT,QAAS,EACT,UAAW,EACb,EAEaC,EAAgD,CAC3D,QAAS,UACT,QAAS,UACT,OAAQ,SACR,UAAW,YACX,MAAO,QACP,OAAQ,QACV","names":["NetworkToIndexerAPI","NetworkToNodeAPI","NetworkToFaucetAPI","NetworkToPepperAPI","NetworkToProverAPI","Network","NetworkToChainId","NetworkToNetworkName"]}
@@ -1,2 +1,2 @@
1
- import{a as n,b as s,c as r,d as i,e as o,f as a,g as c,h as p,i as d,j as g,k as u,l as A,m as y,n as l,o as m,p as T,q as f,r as I,s as C,t as O,u as P,v as D}from"./chunk-AEVRPB4E.mjs";import{a as e}from"./chunk-IYSHHN5A.mjs";var V=class{constructor(t){this.config=t}async getCollectionData(t){return await e({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),a({aptosConfig:this.config,...t})}async getCollectionDataByCollectionId(t){return await e({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),c({aptosConfig:this.config,...t})}async getCollectionId(t){return await e({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),p({aptosConfig:this.config,...t})}async getDigitalAssetData(t){return await e({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),n({aptosConfig:this.config,...t})}async getCurrentDigitalAssetOwnership(t){return await e({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),s({aptosConfig:this.config,...t})}async getOwnedDigitalAssets(t){return await e({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),r({aptosConfig:this.config,...t})}async getDigitalAssetActivity(t){return await e({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),i({aptosConfig:this.config,...t})}async createCollectionTransaction(t){return o({aptosConfig:this.config,...t})}async mintDigitalAssetTransaction(t){return d({aptosConfig:this.config,...t})}async transferDigitalAssetTransaction(t){return g({aptosConfig:this.config,...t})}async mintSoulBoundTransaction(t){return u({aptosConfig:this.config,...t})}async burnDigitalAssetTransaction(t){return A({aptosConfig:this.config,...t})}async freezeDigitalAssetTransaferTransaction(t){return y({aptosConfig:this.config,...t})}async unfreezeDigitalAssetTransaferTransaction(t){return l({aptosConfig:this.config,...t})}async setDigitalAssetDescriptionTransaction(t){return m({aptosConfig:this.config,...t})}async setDigitalAssetNameTransaction(t){return T({aptosConfig:this.config,...t})}async setDigitalAssetURITransaction(t){return f({aptosConfig:this.config,...t})}async addDigitalAssetPropertyTransaction(t){return I({aptosConfig:this.config,...t})}async removeDigitalAssetPropertyTransaction(t){return C({aptosConfig:this.config,...t})}async updateDigitalAssetPropertyTransaction(t){return O({aptosConfig:this.config,...t})}async addDigitalAssetTypedPropertyTransaction(t){return P({aptosConfig:this.config,...t})}async updateDigitalAssetTypedPropertyTransaction(t){return D({aptosConfig:this.config,...t})}};export{V as a};
2
- //# sourceMappingURL=chunk-TVHLZDCO.mjs.map
1
+ import{a as n,b as s,c as r,d as i,e as o,f as a,g as c,h as p,i as d,j as g,k as u,l as A,m as y,n as l,o as m,p as T,q as f,r as I,s as C,t as O,u as P,v as D}from"./chunk-ZG6HOK6A.mjs";import{a as e}from"./chunk-2I2XAOH7.mjs";var V=class{constructor(t){this.config=t}async getCollectionData(t){return await e({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),a({aptosConfig:this.config,...t})}async getCollectionDataByCollectionId(t){return await e({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),c({aptosConfig:this.config,...t})}async getCollectionId(t){return await e({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),p({aptosConfig:this.config,...t})}async getDigitalAssetData(t){return await e({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),n({aptosConfig:this.config,...t})}async getCurrentDigitalAssetOwnership(t){return await e({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),s({aptosConfig:this.config,...t})}async getOwnedDigitalAssets(t){return await e({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),r({aptosConfig:this.config,...t})}async getDigitalAssetActivity(t){return await e({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),i({aptosConfig:this.config,...t})}async createCollectionTransaction(t){return o({aptosConfig:this.config,...t})}async mintDigitalAssetTransaction(t){return d({aptosConfig:this.config,...t})}async transferDigitalAssetTransaction(t){return g({aptosConfig:this.config,...t})}async mintSoulBoundTransaction(t){return u({aptosConfig:this.config,...t})}async burnDigitalAssetTransaction(t){return A({aptosConfig:this.config,...t})}async freezeDigitalAssetTransaferTransaction(t){return y({aptosConfig:this.config,...t})}async unfreezeDigitalAssetTransaferTransaction(t){return l({aptosConfig:this.config,...t})}async setDigitalAssetDescriptionTransaction(t){return m({aptosConfig:this.config,...t})}async setDigitalAssetNameTransaction(t){return T({aptosConfig:this.config,...t})}async setDigitalAssetURITransaction(t){return f({aptosConfig:this.config,...t})}async addDigitalAssetPropertyTransaction(t){return I({aptosConfig:this.config,...t})}async removeDigitalAssetPropertyTransaction(t){return C({aptosConfig:this.config,...t})}async updateDigitalAssetPropertyTransaction(t){return O({aptosConfig:this.config,...t})}async addDigitalAssetTypedPropertyTransaction(t){return P({aptosConfig:this.config,...t})}async updateDigitalAssetTypedPropertyTransaction(t){return D({aptosConfig:this.config,...t})}};export{V as a};
2
+ //# sourceMappingURL=chunk-T3QZ5HSE.mjs.map