@aptos-labs/ts-sdk 0.0.8 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (296) hide show
  1. package/README.md +17 -17
  2. package/dist/browser/index.d.ts +528 -209
  3. package/dist/browser/index.global.js +25 -25
  4. package/dist/browser/index.global.js.map +1 -1
  5. package/dist/common/index.d.ts +528 -209
  6. package/dist/common/index.js +26 -26
  7. package/dist/common/index.js.map +1 -1
  8. package/dist/esm/api/account.mjs +1 -1
  9. package/dist/esm/api/ans.d.mts +9 -9
  10. package/dist/esm/api/ans.mjs +1 -1
  11. package/dist/esm/api/aptos.d.mts +4 -11
  12. package/dist/esm/api/aptos.mjs +1 -1
  13. package/dist/esm/api/coin.d.mts +3 -3
  14. package/dist/esm/api/coin.mjs +1 -1
  15. package/dist/esm/api/digitalAsset.d.mts +317 -73
  16. package/dist/esm/api/digitalAsset.mjs +1 -1
  17. package/dist/esm/api/event.mjs +1 -1
  18. package/dist/esm/api/faucet.mjs +1 -1
  19. package/dist/esm/api/fungibleAsset.d.mts +3 -3
  20. package/dist/esm/api/fungibleAsset.mjs +1 -1
  21. package/dist/esm/api/general.mjs +1 -1
  22. package/dist/esm/api/index.d.mts +0 -2
  23. package/dist/esm/api/index.mjs +1 -1
  24. package/dist/esm/api/staking.mjs +1 -1
  25. package/dist/esm/api/transaction.d.mts +118 -13
  26. package/dist/esm/api/transaction.mjs +1 -1
  27. package/dist/esm/api/transactionSubmission/build.d.mts +25 -4
  28. package/dist/esm/api/transactionSubmission/build.mjs +1 -1
  29. package/dist/esm/api/transactionSubmission/helpers.d.mts +4 -0
  30. package/dist/esm/api/transactionSubmission/helpers.mjs +2 -0
  31. package/dist/esm/api/transactionSubmission/sign.mjs +1 -1
  32. package/dist/esm/api/transactionSubmission/sign.mjs.map +1 -1
  33. package/dist/esm/api/transactionSubmission/simulate.d.mts +23 -2
  34. package/dist/esm/api/transactionSubmission/simulate.mjs +1 -1
  35. package/dist/esm/api/transactionSubmission/submit.d.mts +21 -2
  36. package/dist/esm/api/transactionSubmission/submit.mjs +1 -1
  37. package/dist/esm/api/utils.mjs +1 -1
  38. package/dist/esm/bcs/index.mjs +1 -1
  39. package/dist/esm/bcs/serializable/entryFunctionBytes.mjs +1 -1
  40. package/dist/esm/bcs/serializable/fixedBytes.mjs +1 -1
  41. package/dist/esm/bcs/serializable/movePrimitives.mjs +1 -1
  42. package/dist/esm/bcs/serializable/moveStructs.mjs +1 -1
  43. package/dist/esm/bcs/serializer.mjs +1 -1
  44. package/dist/esm/{chunk-ZJUDDSWN.mjs → chunk-2HBIGMDV.mjs} +2 -2
  45. package/dist/esm/{chunk-GIZLK7M7.mjs → chunk-3O4GKLXA.mjs} +2 -2
  46. package/dist/esm/chunk-3O4GKLXA.mjs.map +1 -0
  47. package/dist/esm/{chunk-CJPCOS4R.mjs → chunk-3QS3MFWJ.mjs} +2 -2
  48. package/dist/esm/{chunk-AZUWHKN5.mjs → chunk-4K252UDE.mjs} +2 -2
  49. package/dist/esm/{chunk-MWAMLQ25.mjs → chunk-4TIQQKXV.mjs} +2 -2
  50. package/dist/esm/{chunk-GMG4VR3K.mjs → chunk-4VG7DV6F.mjs} +2 -2
  51. package/dist/esm/{chunk-CCXMVVXD.mjs → chunk-4ZYW3BPF.mjs} +2 -2
  52. package/dist/esm/chunk-4ZYW3BPF.mjs.map +1 -0
  53. package/dist/esm/{chunk-UW6HQ643.mjs → chunk-5HZKDT5C.mjs} +2 -2
  54. package/dist/esm/{chunk-73VWOS4Z.mjs → chunk-6DYNAFAP.mjs} +2 -2
  55. package/dist/esm/chunk-6EMN3BOV.mjs +2 -0
  56. package/dist/esm/chunk-6EMN3BOV.mjs.map +1 -0
  57. package/dist/esm/{chunk-HTI5LEST.mjs → chunk-6F4ACCCZ.mjs} +2 -2
  58. package/dist/esm/chunk-6MKBROIC.mjs +2 -0
  59. package/dist/esm/chunk-6MKBROIC.mjs.map +1 -0
  60. package/dist/esm/{chunk-53DS6NBQ.mjs → chunk-7B3VSBCX.mjs} +2 -2
  61. package/dist/esm/{chunk-F7EWDYTE.mjs → chunk-7QJYTQSU.mjs} +2 -2
  62. package/dist/esm/{chunk-OZZDXS26.mjs → chunk-AS7RX4RK.mjs} +2 -2
  63. package/dist/esm/chunk-AS7RX4RK.mjs.map +1 -0
  64. package/dist/esm/{chunk-GEZSEAL5.mjs → chunk-BUM2FIHF.mjs} +2 -2
  65. package/dist/esm/chunk-BV6SCEXY.mjs +2 -0
  66. package/dist/esm/chunk-BV6SCEXY.mjs.map +1 -0
  67. package/dist/esm/chunk-C3Y52GHM.mjs +2 -0
  68. package/dist/esm/chunk-C3Y52GHM.mjs.map +1 -0
  69. package/dist/esm/{chunk-OBOOY2QD.mjs → chunk-D2XLC3KK.mjs} +2 -2
  70. package/dist/esm/chunk-EHJEK7FU.mjs +2 -0
  71. package/dist/esm/chunk-EMQWD6KP.mjs +2 -0
  72. package/dist/esm/chunk-EMQWD6KP.mjs.map +1 -0
  73. package/dist/esm/{chunk-PL2VA73L.mjs → chunk-F2GFSFPW.mjs} +2 -2
  74. package/dist/esm/{chunk-GXPGRCSW.mjs → chunk-F52GIFKT.mjs} +2 -2
  75. package/dist/esm/{chunk-QNTV5NMH.mjs → chunk-FGTQT7Q5.mjs} +2 -2
  76. package/dist/esm/{chunk-RCM3K5JL.mjs → chunk-GQI3HWOB.mjs} +2 -2
  77. package/dist/esm/chunk-HDNJ4JK4.mjs +2 -0
  78. package/dist/esm/chunk-HDNJ4JK4.mjs.map +1 -0
  79. package/dist/esm/{chunk-2SAKPC5Q.mjs → chunk-HQ4DGB7L.mjs} +2 -2
  80. package/dist/esm/{chunk-KNMWDGP4.mjs → chunk-IEL6J6Z3.mjs} +2 -2
  81. package/dist/esm/{chunk-NZSGGL25.mjs → chunk-IPW2YTRD.mjs} +2 -2
  82. package/dist/esm/{chunk-F6K26WV5.mjs → chunk-IU5JZNH4.mjs} +2 -2
  83. package/dist/esm/{chunk-Y6PVFMBS.mjs → chunk-KH3M3YPI.mjs} +2 -2
  84. package/dist/esm/chunk-KSWQZKMQ.mjs +2 -0
  85. package/dist/esm/chunk-KSWQZKMQ.mjs.map +1 -0
  86. package/dist/esm/{chunk-5OPOJ43H.mjs → chunk-KVJ2KGMW.mjs} +2 -2
  87. package/dist/esm/{chunk-TZ623H2V.mjs → chunk-LUCDRB52.mjs} +2 -2
  88. package/dist/esm/chunk-LUCDRB52.mjs.map +1 -0
  89. package/dist/esm/{chunk-WTGGCH34.mjs → chunk-N25GOEVL.mjs} +2 -2
  90. package/dist/esm/{chunk-CU2DINU4.mjs → chunk-NLONZHYT.mjs} +2 -2
  91. package/dist/esm/{chunk-FZ56IS3E.mjs → chunk-NMFS5KAE.mjs} +2 -2
  92. package/dist/esm/chunk-NZ6RYGJQ.mjs +2 -0
  93. package/dist/esm/chunk-NZ6RYGJQ.mjs.map +1 -0
  94. package/dist/esm/chunk-OU4MEM5F.mjs +2 -0
  95. package/dist/esm/chunk-OU4MEM5F.mjs.map +1 -0
  96. package/dist/esm/{chunk-KZSJ5MFF.mjs → chunk-OWP2MKTX.mjs} +2 -2
  97. package/dist/esm/{chunk-QCBIJCU4.mjs → chunk-OXO3Z2MF.mjs} +2 -2
  98. package/dist/esm/{chunk-CL5B2QNS.mjs → chunk-PANYJULW.mjs} +2 -2
  99. package/dist/esm/{chunk-QEXAMHPU.mjs → chunk-PJMRQLJ5.mjs} +2 -2
  100. package/dist/esm/chunk-PJMRQLJ5.mjs.map +1 -0
  101. package/dist/esm/{chunk-XMUUI6HG.mjs → chunk-PRKZ2KJ4.mjs} +2 -2
  102. package/dist/esm/{chunk-SGTFMSOG.mjs → chunk-R3SAAJ2N.mjs} +2 -2
  103. package/dist/esm/{chunk-VQ7LYNMD.mjs → chunk-R4APGSSC.mjs} +2 -2
  104. package/dist/esm/{chunk-3F5WV6US.mjs → chunk-RCYWJZR4.mjs} +2 -2
  105. package/dist/esm/chunk-SI6QMT4N.mjs +2 -0
  106. package/dist/esm/chunk-SI6QMT4N.mjs.map +1 -0
  107. package/dist/esm/{chunk-SSJQOXEP.mjs → chunk-SMN2QQ4Q.mjs} +2 -2
  108. package/dist/esm/chunk-SMN2QQ4Q.mjs.map +1 -0
  109. package/dist/esm/chunk-SODP7NAK.mjs +2 -0
  110. package/dist/esm/{chunk-SDPICQ5B.mjs.map → chunk-SODP7NAK.mjs.map} +1 -1
  111. package/dist/esm/{chunk-OT2UDMUU.mjs → chunk-SR7XLV76.mjs} +2 -2
  112. package/dist/esm/{chunk-APSQ4M23.mjs → chunk-T3ID6KFN.mjs} +2 -2
  113. package/dist/esm/{chunk-5UY5OKXR.mjs → chunk-TCSN7PYL.mjs} +2 -2
  114. package/dist/esm/chunk-TCSN7PYL.mjs.map +1 -0
  115. package/dist/esm/chunk-TTDCRLRD.mjs +2 -0
  116. package/dist/esm/chunk-TTDCRLRD.mjs.map +1 -0
  117. package/dist/esm/{chunk-G36AY4R7.mjs → chunk-UR5E2UDO.mjs} +2 -2
  118. package/dist/esm/{chunk-JI2BBZ2W.mjs → chunk-UZB7CTLX.mjs} +2 -2
  119. package/dist/esm/chunk-VA4K6DEK.mjs +2 -0
  120. package/dist/esm/chunk-VA4K6DEK.mjs.map +1 -0
  121. package/dist/esm/{chunk-CLJLQXFQ.mjs → chunk-VBUKPN4Q.mjs} +2 -2
  122. package/dist/esm/chunk-VBUKPN4Q.mjs.map +1 -0
  123. package/dist/esm/{chunk-XITLXPBK.mjs → chunk-VMCFN5CT.mjs} +2 -2
  124. package/dist/esm/{chunk-SRGPSANH.mjs → chunk-YLI6J47P.mjs} +2 -2
  125. package/dist/esm/chunk-YLPG6XMH.mjs +2 -0
  126. package/dist/esm/chunk-YLPG6XMH.mjs.map +1 -0
  127. package/dist/esm/{chunk-HC5VMNXA.mjs → chunk-ZLYSA7JR.mjs} +2 -2
  128. package/dist/esm/client/core.mjs +1 -1
  129. package/dist/esm/client/get.mjs +1 -1
  130. package/dist/esm/client/index.mjs +1 -1
  131. package/dist/esm/client/post.mjs +1 -1
  132. package/dist/esm/core/account.d.mts +2 -2
  133. package/dist/esm/core/account.mjs +1 -1
  134. package/dist/esm/core/accountAddress.mjs +1 -1
  135. package/dist/esm/core/authenticationKey.mjs +1 -1
  136. package/dist/esm/core/crypto/anyPublicKey.mjs +1 -1
  137. package/dist/esm/core/crypto/anySignature.mjs +1 -1
  138. package/dist/esm/core/crypto/asymmetricCrypto.mjs +1 -1
  139. package/dist/esm/core/crypto/ed25519.mjs +1 -1
  140. package/dist/esm/core/crypto/index.mjs +1 -1
  141. package/dist/esm/core/crypto/multiEd25519.mjs +1 -1
  142. package/dist/esm/core/crypto/multiKey.mjs +1 -1
  143. package/dist/esm/core/crypto/secp256k1.mjs +1 -1
  144. package/dist/esm/core/index.mjs +1 -1
  145. package/dist/esm/index.d.mts +1 -3
  146. package/dist/esm/index.mjs +1 -1
  147. package/dist/esm/internal/account.d.mts +1 -1
  148. package/dist/esm/internal/account.mjs +1 -1
  149. package/dist/esm/internal/ans.d.mts +5 -5
  150. package/dist/esm/internal/ans.mjs +1 -1
  151. package/dist/esm/internal/coin.d.mts +2 -2
  152. package/dist/esm/internal/coin.mjs +1 -1
  153. package/dist/esm/internal/digitalAsset.d.mts +151 -26
  154. package/dist/esm/internal/digitalAsset.mjs +1 -1
  155. package/dist/esm/internal/event.mjs +1 -1
  156. package/dist/esm/internal/faucet.mjs +1 -1
  157. package/dist/esm/internal/fungibleAsset.d.mts +12 -5
  158. package/dist/esm/internal/fungibleAsset.mjs +1 -1
  159. package/dist/esm/internal/general.mjs +1 -1
  160. package/dist/esm/internal/staking.mjs +1 -1
  161. package/dist/esm/internal/transaction.mjs +1 -1
  162. package/dist/esm/internal/transactionSubmission.d.mts +6 -6
  163. package/dist/esm/internal/transactionSubmission.mjs +1 -1
  164. package/dist/esm/transactions/authenticator/account.mjs +1 -1
  165. package/dist/esm/transactions/authenticator/index.mjs +1 -1
  166. package/dist/esm/transactions/authenticator/transaction.mjs +1 -1
  167. package/dist/esm/transactions/index.d.mts +1 -1
  168. package/dist/esm/transactions/index.mjs +1 -1
  169. package/dist/esm/transactions/instances/chainId.mjs +1 -1
  170. package/dist/esm/transactions/instances/identifier.mjs +1 -1
  171. package/dist/esm/transactions/instances/index.mjs +1 -1
  172. package/dist/esm/transactions/instances/moduleId.mjs +1 -1
  173. package/dist/esm/transactions/instances/rawTransaction.mjs +1 -1
  174. package/dist/esm/transactions/instances/rotationProofChallenge.mjs +1 -1
  175. package/dist/esm/transactions/instances/signedTransaction.mjs +1 -1
  176. package/dist/esm/transactions/instances/transactionPayload.mjs +1 -1
  177. package/dist/esm/transactions/management/accountSequenceNumber.mjs +1 -1
  178. package/dist/esm/transactions/management/index.mjs +1 -1
  179. package/dist/esm/transactions/management/transactionWorker.d.mts +2 -2
  180. package/dist/esm/transactions/management/transactionWorker.mjs +1 -1
  181. package/dist/esm/transactions/transactionBuilder/helpers.mjs +1 -1
  182. package/dist/esm/transactions/transactionBuilder/index.mjs +1 -1
  183. package/dist/esm/transactions/transactionBuilder/remoteAbi.mjs +1 -1
  184. package/dist/esm/transactions/transactionBuilder/transactionBuilder.d.mts +2 -2
  185. package/dist/esm/transactions/transactionBuilder/transactionBuilder.mjs +1 -1
  186. package/dist/esm/transactions/typeTag/index.mjs +1 -1
  187. package/dist/esm/transactions/typeTag/parser.mjs +1 -1
  188. package/dist/esm/transactions/types.d.mts +3 -3
  189. package/dist/esm/version.d.mts +1 -1
  190. package/dist/esm/version.mjs +1 -1
  191. package/package.json +4 -2
  192. package/src/api/ans.ts +9 -9
  193. package/src/api/aptos.ts +3 -28
  194. package/src/api/coin.ts +3 -3
  195. package/src/api/digitalAsset.ts +387 -88
  196. package/src/api/fungibleAsset.ts +3 -3
  197. package/src/api/transaction.ts +172 -2
  198. package/src/api/transactionSubmission/build.ts +25 -4
  199. package/src/api/transactionSubmission/helpers.ts +31 -0
  200. package/src/api/transactionSubmission/simulate.ts +26 -20
  201. package/src/api/transactionSubmission/submit.ts +24 -20
  202. package/src/client/core.ts +1 -1
  203. package/src/core/account.ts +2 -2
  204. package/src/internal/ans.ts +5 -5
  205. package/src/internal/coin.ts +2 -2
  206. package/src/internal/digitalAsset.ts +482 -58
  207. package/src/internal/fungibleAsset.ts +2 -2
  208. package/src/internal/transactionSubmission.ts +6 -6
  209. package/src/transactions/management/transactionWorker.ts +2 -9
  210. package/src/transactions/transactionBuilder/remoteAbi.ts +13 -5
  211. package/src/transactions/transactionBuilder/transactionBuilder.ts +2 -4
  212. package/src/transactions/typeTag/index.ts +1 -0
  213. package/src/transactions/types.ts +2 -2
  214. package/src/version.ts +1 -1
  215. package/dist/esm/api/transactionSubmission.d.mts +0 -113
  216. package/dist/esm/api/transactionSubmission.mjs +0 -2
  217. package/dist/esm/chunk-2YQXX64E.mjs +0 -2
  218. package/dist/esm/chunk-2YQXX64E.mjs.map +0 -1
  219. package/dist/esm/chunk-5CUNY7X2.mjs +0 -2
  220. package/dist/esm/chunk-5CUNY7X2.mjs.map +0 -1
  221. package/dist/esm/chunk-5UY5OKXR.mjs.map +0 -1
  222. package/dist/esm/chunk-5ZVCSKFX.mjs +0 -2
  223. package/dist/esm/chunk-5ZVCSKFX.mjs.map +0 -1
  224. package/dist/esm/chunk-CCXMVVXD.mjs.map +0 -1
  225. package/dist/esm/chunk-CLJLQXFQ.mjs.map +0 -1
  226. package/dist/esm/chunk-EFRFDFS4.mjs +0 -2
  227. package/dist/esm/chunk-EFRFDFS4.mjs.map +0 -1
  228. package/dist/esm/chunk-GIZLK7M7.mjs.map +0 -1
  229. package/dist/esm/chunk-IELTCGLP.mjs +0 -2
  230. package/dist/esm/chunk-IELTCGLP.mjs.map +0 -1
  231. package/dist/esm/chunk-KKER5KL4.mjs +0 -2
  232. package/dist/esm/chunk-KKER5KL4.mjs.map +0 -1
  233. package/dist/esm/chunk-OZZDXS26.mjs.map +0 -1
  234. package/dist/esm/chunk-P5747ZYC.mjs +0 -2
  235. package/dist/esm/chunk-P5747ZYC.mjs.map +0 -1
  236. package/dist/esm/chunk-PXTMLJKO.mjs +0 -2
  237. package/dist/esm/chunk-QEXAMHPU.mjs.map +0 -1
  238. package/dist/esm/chunk-RLG3WOTH.mjs +0 -2
  239. package/dist/esm/chunk-RLG3WOTH.mjs.map +0 -1
  240. package/dist/esm/chunk-SDPICQ5B.mjs +0 -2
  241. package/dist/esm/chunk-SO6EE5DX.mjs +0 -2
  242. package/dist/esm/chunk-SO6EE5DX.mjs.map +0 -1
  243. package/dist/esm/chunk-SSJQOXEP.mjs.map +0 -1
  244. package/dist/esm/chunk-TZ623H2V.mjs.map +0 -1
  245. package/dist/esm/chunk-UKSA4H2O.mjs +0 -2
  246. package/dist/esm/chunk-UKSA4H2O.mjs.map +0 -1
  247. package/dist/esm/chunk-UWXDXOFK.mjs +0 -2
  248. package/dist/esm/chunk-UWXDXOFK.mjs.map +0 -1
  249. package/dist/esm/chunk-XX2Z26FH.mjs +0 -2
  250. package/dist/esm/chunk-XX2Z26FH.mjs.map +0 -1
  251. package/dist/esm/chunk-YN6UIVFB.mjs +0 -2
  252. package/dist/esm/chunk-YN6UIVFB.mjs.map +0 -1
  253. package/dist/esm/chunk-ZFK7QD3B.mjs +0 -2
  254. package/dist/esm/chunk-ZFK7QD3B.mjs.map +0 -1
  255. package/src/api/transactionSubmission.ts +0 -121
  256. /package/dist/esm/api/{transactionSubmission.mjs.map → transactionSubmission/helpers.mjs.map} +0 -0
  257. /package/dist/esm/{chunk-ZJUDDSWN.mjs.map → chunk-2HBIGMDV.mjs.map} +0 -0
  258. /package/dist/esm/{chunk-CJPCOS4R.mjs.map → chunk-3QS3MFWJ.mjs.map} +0 -0
  259. /package/dist/esm/{chunk-AZUWHKN5.mjs.map → chunk-4K252UDE.mjs.map} +0 -0
  260. /package/dist/esm/{chunk-MWAMLQ25.mjs.map → chunk-4TIQQKXV.mjs.map} +0 -0
  261. /package/dist/esm/{chunk-GMG4VR3K.mjs.map → chunk-4VG7DV6F.mjs.map} +0 -0
  262. /package/dist/esm/{chunk-UW6HQ643.mjs.map → chunk-5HZKDT5C.mjs.map} +0 -0
  263. /package/dist/esm/{chunk-73VWOS4Z.mjs.map → chunk-6DYNAFAP.mjs.map} +0 -0
  264. /package/dist/esm/{chunk-HTI5LEST.mjs.map → chunk-6F4ACCCZ.mjs.map} +0 -0
  265. /package/dist/esm/{chunk-53DS6NBQ.mjs.map → chunk-7B3VSBCX.mjs.map} +0 -0
  266. /package/dist/esm/{chunk-F7EWDYTE.mjs.map → chunk-7QJYTQSU.mjs.map} +0 -0
  267. /package/dist/esm/{chunk-GEZSEAL5.mjs.map → chunk-BUM2FIHF.mjs.map} +0 -0
  268. /package/dist/esm/{chunk-OBOOY2QD.mjs.map → chunk-D2XLC3KK.mjs.map} +0 -0
  269. /package/dist/esm/{chunk-PXTMLJKO.mjs.map → chunk-EHJEK7FU.mjs.map} +0 -0
  270. /package/dist/esm/{chunk-PL2VA73L.mjs.map → chunk-F2GFSFPW.mjs.map} +0 -0
  271. /package/dist/esm/{chunk-GXPGRCSW.mjs.map → chunk-F52GIFKT.mjs.map} +0 -0
  272. /package/dist/esm/{chunk-QNTV5NMH.mjs.map → chunk-FGTQT7Q5.mjs.map} +0 -0
  273. /package/dist/esm/{chunk-RCM3K5JL.mjs.map → chunk-GQI3HWOB.mjs.map} +0 -0
  274. /package/dist/esm/{chunk-2SAKPC5Q.mjs.map → chunk-HQ4DGB7L.mjs.map} +0 -0
  275. /package/dist/esm/{chunk-KNMWDGP4.mjs.map → chunk-IEL6J6Z3.mjs.map} +0 -0
  276. /package/dist/esm/{chunk-NZSGGL25.mjs.map → chunk-IPW2YTRD.mjs.map} +0 -0
  277. /package/dist/esm/{chunk-F6K26WV5.mjs.map → chunk-IU5JZNH4.mjs.map} +0 -0
  278. /package/dist/esm/{chunk-Y6PVFMBS.mjs.map → chunk-KH3M3YPI.mjs.map} +0 -0
  279. /package/dist/esm/{chunk-5OPOJ43H.mjs.map → chunk-KVJ2KGMW.mjs.map} +0 -0
  280. /package/dist/esm/{chunk-WTGGCH34.mjs.map → chunk-N25GOEVL.mjs.map} +0 -0
  281. /package/dist/esm/{chunk-CU2DINU4.mjs.map → chunk-NLONZHYT.mjs.map} +0 -0
  282. /package/dist/esm/{chunk-FZ56IS3E.mjs.map → chunk-NMFS5KAE.mjs.map} +0 -0
  283. /package/dist/esm/{chunk-KZSJ5MFF.mjs.map → chunk-OWP2MKTX.mjs.map} +0 -0
  284. /package/dist/esm/{chunk-QCBIJCU4.mjs.map → chunk-OXO3Z2MF.mjs.map} +0 -0
  285. /package/dist/esm/{chunk-CL5B2QNS.mjs.map → chunk-PANYJULW.mjs.map} +0 -0
  286. /package/dist/esm/{chunk-XMUUI6HG.mjs.map → chunk-PRKZ2KJ4.mjs.map} +0 -0
  287. /package/dist/esm/{chunk-SGTFMSOG.mjs.map → chunk-R3SAAJ2N.mjs.map} +0 -0
  288. /package/dist/esm/{chunk-VQ7LYNMD.mjs.map → chunk-R4APGSSC.mjs.map} +0 -0
  289. /package/dist/esm/{chunk-3F5WV6US.mjs.map → chunk-RCYWJZR4.mjs.map} +0 -0
  290. /package/dist/esm/{chunk-OT2UDMUU.mjs.map → chunk-SR7XLV76.mjs.map} +0 -0
  291. /package/dist/esm/{chunk-APSQ4M23.mjs.map → chunk-T3ID6KFN.mjs.map} +0 -0
  292. /package/dist/esm/{chunk-G36AY4R7.mjs.map → chunk-UR5E2UDO.mjs.map} +0 -0
  293. /package/dist/esm/{chunk-JI2BBZ2W.mjs.map → chunk-UZB7CTLX.mjs.map} +0 -0
  294. /package/dist/esm/{chunk-XITLXPBK.mjs.map → chunk-VMCFN5CT.mjs.map} +0 -0
  295. /package/dist/esm/{chunk-SRGPSANH.mjs.map → chunk-YLI6J47P.mjs.map} +0 -0
  296. /package/dist/esm/{chunk-HC5VMNXA.mjs.map → chunk-ZLYSA7JR.mjs.map} +0 -0
@@ -1,2 +1,2 @@
1
- import{a as n}from"./chunk-HTI5LEST.mjs";import{a as g,b as _}from"./chunk-AZUWHKN5.mjs";import{a as p,c as b}from"./chunk-UW6HQ643.mjs";import{b as o}from"./chunk-G36AY4R7.mjs";import{a as h}from"./chunk-F6K26WV5.mjs";var c=class extends h{static deserialize(t){let e=t.deserializeUleb128AsU32();switch(e){case 0:return d.load(t);case 1:return u.load(t);case 2:return l.load(t);case 3:return A.load(t);case 4:return y.load(t);default:throw new Error(`Unknown variant index for TransactionAuthenticator: ${e}`)}}},d=class i extends c{constructor(e,r){super();this.public_key=e,this.signature=r}serialize(e){e.serializeU32AsUleb128(0),this.public_key.serialize(e),this.signature.serialize(e)}static load(e){let r=p.deserialize(e),s=b.deserialize(e);return new i(r,s)}},u=class i extends c{constructor(e,r){super();this.public_key=e,this.signature=r}serialize(e){e.serializeU32AsUleb128(1),this.public_key.serialize(e),this.signature.serialize(e)}static load(e){let r=g.deserialize(e),s=_.deserialize(e);return new i(r,s)}},l=class i extends c{constructor(e,r,s){super();this.sender=e,this.secondary_signer_addresses=r,this.secondary_signers=s}serialize(e){e.serializeU32AsUleb128(2),this.sender.serialize(e),e.serializeVector(this.secondary_signer_addresses),e.serializeVector(this.secondary_signers)}static load(e){let r=n.deserialize(e),s=e.deserializeVector(o),a=e.deserializeVector(n);return new i(r,s,a)}},A=class i extends c{constructor(e,r,s,a){super();this.sender=e,this.secondary_signer_addresses=r,this.secondary_signers=s,this.fee_payer=a}serialize(e){e.serializeU32AsUleb128(3),this.sender.serialize(e),e.serializeVector(this.secondary_signer_addresses),e.serializeVector(this.secondary_signers),this.fee_payer.address.serialize(e),this.fee_payer.authenticator.serialize(e)}static load(e){let r=n.deserialize(e),s=e.deserializeVector(o),a=e.deserializeVector(n),z=o.deserialize(e),S=n.deserialize(e),E={address:z,authenticator:S};return new i(r,s,a,E)}},y=class i extends c{constructor(e){super();this.sender=e}serialize(e){e.serializeU32AsUleb128(4),this.sender.serialize(e)}static load(e){let r=n.deserialize(e);return new i(r)}};export{c as a,d as b,u as c,l as d,A as e,y as f};
2
- //# sourceMappingURL=chunk-RCM3K5JL.mjs.map
1
+ import{a as n}from"./chunk-6F4ACCCZ.mjs";import{a as g,b as _}from"./chunk-4K252UDE.mjs";import{a as p,c as b}from"./chunk-5HZKDT5C.mjs";import{b as o}from"./chunk-UR5E2UDO.mjs";import{a as h}from"./chunk-IU5JZNH4.mjs";var c=class extends h{static deserialize(t){let e=t.deserializeUleb128AsU32();switch(e){case 0:return d.load(t);case 1:return u.load(t);case 2:return l.load(t);case 3:return A.load(t);case 4:return y.load(t);default:throw new Error(`Unknown variant index for TransactionAuthenticator: ${e}`)}}},d=class i extends c{constructor(e,r){super();this.public_key=e,this.signature=r}serialize(e){e.serializeU32AsUleb128(0),this.public_key.serialize(e),this.signature.serialize(e)}static load(e){let r=p.deserialize(e),s=b.deserialize(e);return new i(r,s)}},u=class i extends c{constructor(e,r){super();this.public_key=e,this.signature=r}serialize(e){e.serializeU32AsUleb128(1),this.public_key.serialize(e),this.signature.serialize(e)}static load(e){let r=g.deserialize(e),s=_.deserialize(e);return new i(r,s)}},l=class i extends c{constructor(e,r,s){super();this.sender=e,this.secondary_signer_addresses=r,this.secondary_signers=s}serialize(e){e.serializeU32AsUleb128(2),this.sender.serialize(e),e.serializeVector(this.secondary_signer_addresses),e.serializeVector(this.secondary_signers)}static load(e){let r=n.deserialize(e),s=e.deserializeVector(o),a=e.deserializeVector(n);return new i(r,s,a)}},A=class i extends c{constructor(e,r,s,a){super();this.sender=e,this.secondary_signer_addresses=r,this.secondary_signers=s,this.fee_payer=a}serialize(e){e.serializeU32AsUleb128(3),this.sender.serialize(e),e.serializeVector(this.secondary_signer_addresses),e.serializeVector(this.secondary_signers),this.fee_payer.address.serialize(e),this.fee_payer.authenticator.serialize(e)}static load(e){let r=n.deserialize(e),s=e.deserializeVector(o),a=e.deserializeVector(n),z=o.deserialize(e),S=n.deserialize(e),E={address:z,authenticator:S};return new i(r,s,a,E)}},y=class i extends c{constructor(e){super();this.sender=e}serialize(e){e.serializeU32AsUleb128(4),this.sender.serialize(e)}static load(e){let r=n.deserialize(e);return new i(r)}};export{c as a,d as b,u as c,l as d,A as e,y as f};
2
+ //# sourceMappingURL=chunk-GQI3HWOB.mjs.map
@@ -0,0 +1,2 @@
1
+ import{f as n,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-TTDCRLRD.mjs";var A=class{constructor(e){this.config=e}async getOwnerAddress(e){return n({aptosConfig:this.config,...e})}async getExpiration(e){return t({aptosConfig:this.config,...e})}async getTargetAddress(e){return i({aptosConfig:this.config,...e})}async setTargetAddress(e){return a({aptosConfig:this.config,...e})}async getPrimaryName(e){return o({aptosConfig:this.config,...e})}async setPrimaryName(e){return r({aptosConfig:this.config,...e})}async registerName(e){return s({aptosConfig:this.config,...e})}async renewDomain(e){return d({aptosConfig:this.config,...e})}async getName(e){return m({aptosConfig:this.config,...e})}async getAccountNames(e){return c({aptosConfig:this.config,...e})}async getAccountDomains(e){return g({aptosConfig:this.config,...e})}async getAccountSubdomains(e){return u({aptosConfig:this.config,...e})}async getDomainSubdomains(e){return p({aptosConfig:this.config,...e})}};export{A as a};
2
+ //# sourceMappingURL=chunk-HDNJ4JK4.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 { Account, 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, MoveAddressType } from \"../types\";\nimport { InputGenerateTransactionOptions, SimpleTransaction } from \"../transactions/types\";\nimport { AptosConfig } from \"./aptosConfig\";\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 * ```ts\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 *\n * @param args.name - A string of the name to retrieve\n *\n * @returns MoveAddressType if the name is owned, undefined otherwise\n */\n async getOwnerAddress(args: { name: string }): Promise<MoveAddressType | 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 * ```ts\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 *\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 * ```ts\n * const targetAddr = await aptos.getTargetAddress({name: \"test.aptos\"})\n * // targetAddr = 0x123...\n * ```\n *\n * @param args.name - A string of the name: primary, primary.apt, secondary.primary, secondary.primary.apt, etc.\n *\n * @returns MoveAddressType if the name has a target, undefined otherwise\n */\n async getTargetAddress(args: { name: string }): Promise<MoveAddressType | 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 * ```ts\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 *\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 * ```ts\n * const name = await aptos.getPrimaryName({address: alice.accountAddress})\n * // name = test.aptos\n * ```\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 * ```ts\n * await aptos.setPrimaryName({sender: alice, name: \"test.aptos\"})\n * const primaryName = await aptos.getPrimaryName({address: alice.accountAddress})\n * // primaryName = test.aptos\n * ```\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 * ```ts\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 *\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 * ```ts\n * await aptos.renewDomain({sender: alice, name: \"test\"})\n * // test.apt will be renewed for one year\n * ```\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":"wHA+BO,IAAMA,EAAN,KAAU,CACf,YAAqBC,EAAqB,CAArB,YAAAA,CAAsB,CAe3C,MAAM,gBAAgBC,EAA8D,CAClF,OAAOC,EAAgB,CAAE,YAAa,KAAK,OAAQ,GAAGD,CAAK,CAAC,CAC9D,CAeA,MAAM,cAAcA,EAAqD,CACvE,OAAOE,EAAc,CAAE,YAAa,KAAK,OAAQ,GAAGF,CAAK,CAAC,CAC5D,CAgBA,MAAM,iBAAiBA,EAA8D,CACnF,OAAOG,EAAiB,CAAE,YAAa,KAAK,OAAQ,GAAGH,CAAK,CAAC,CAC/D,CAkBA,MAAM,iBAAiBA,EAKQ,CAC7B,OAAOI,EAAiB,CAAE,YAAa,KAAK,OAAQ,GAAGJ,CAAK,CAAC,CAC/D,CAgBA,MAAM,eAAeA,EAAqE,CACxF,OAAOK,EAAe,CAAE,YAAa,KAAK,OAAQ,GAAGL,CAAK,CAAC,CAC7D,CAkBA,MAAM,eAAeA,EAIU,CAC7B,OAAOM,EAAe,CAAE,YAAa,KAAK,OAAQ,GAAGN,CAAK,CAAC,CAC7D,CAqCA,MAAM,aAAaA,EAA+E,CAChG,OAAOO,EAAa,CAAE,YAAa,KAAK,OAAQ,GAAGP,CAAK,CAAC,CAC3D,CAmBA,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 o,b as r}from"./chunk-53DS6NBQ.mjs";import{e as u}from"./chunk-XITLXPBK.mjs";import{b as t}from"./chunk-G36AY4R7.mjs";import{a as i}from"./chunk-F6K26WV5.mjs";var c=class extends i{constructor(e){super();this.accountAddress=t.ONE;this.moduleName=new r("account");this.structName=new r("RotationProofChallenge");this.sequenceNumber=new u(e.sequenceNumber),this.originator=e.originator,this.currentAuthKey=e.currentAuthKey,this.newPublicKey=o.U8(e.newPublicKey.toUint8Array())}serialize(e){e.serialize(this.accountAddress),e.serialize(this.moduleName),e.serialize(this.structName),e.serialize(this.sequenceNumber),e.serialize(this.originator),e.serialize(this.currentAuthKey),e.serialize(this.newPublicKey)}};export{c as a};
2
- //# sourceMappingURL=chunk-2SAKPC5Q.mjs.map
1
+ import{b as t}from"./chunk-UR5E2UDO.mjs";import{a as o,b as r}from"./chunk-7B3VSBCX.mjs";import{e as u}from"./chunk-VMCFN5CT.mjs";import{a as i}from"./chunk-IU5JZNH4.mjs";var c=class extends i{constructor(e){super();this.accountAddress=t.ONE;this.moduleName=new r("account");this.structName=new r("RotationProofChallenge");this.sequenceNumber=new u(e.sequenceNumber),this.originator=e.originator,this.currentAuthKey=e.currentAuthKey,this.newPublicKey=o.U8(e.newPublicKey.toUint8Array())}serialize(e){e.serialize(this.accountAddress),e.serialize(this.moduleName),e.serialize(this.structName),e.serialize(this.sequenceNumber),e.serialize(this.originator),e.serialize(this.currentAuthKey),e.serialize(this.newPublicKey)}};export{c as a};
2
+ //# sourceMappingURL=chunk-HQ4DGB7L.mjs.map
@@ -1,2 +1,2 @@
1
- import{a as r,b as i,c as s}from"./chunk-ZJUDDSWN.mjs";import{a as o}from"./chunk-APSQ4M23.mjs";var t=class{constructor(e){this.config=e}async getNumberOfDelegators(e){return await o({config:this.config,minimumLedgerVersion:e?.minimumLedgerVersion,processorTypes:["stake_processor"]}),r({aptosConfig:this.config,...e})}async getNumberOfDelegatorsForAllPools(e){return await o({config:this.config,minimumLedgerVersion:e?.minimumLedgerVersion,processorTypes:["stake_processor"]}),i({aptosConfig:this.config,...e})}async getDelegatedStakingActivities(e){return await o({config:this.config,minimumLedgerVersion:e?.minimumLedgerVersion,processorTypes:["stake_processor"]}),s({aptosConfig:this.config,...e})}};export{t as a};
2
- //# sourceMappingURL=chunk-KNMWDGP4.mjs.map
1
+ import{a as r,b as i,c as s}from"./chunk-2HBIGMDV.mjs";import{a as o}from"./chunk-T3ID6KFN.mjs";var t=class{constructor(e){this.config=e}async getNumberOfDelegators(e){return await o({config:this.config,minimumLedgerVersion:e?.minimumLedgerVersion,processorTypes:["stake_processor"]}),r({aptosConfig:this.config,...e})}async getNumberOfDelegatorsForAllPools(e){return await o({config:this.config,minimumLedgerVersion:e?.minimumLedgerVersion,processorTypes:["stake_processor"]}),i({aptosConfig:this.config,...e})}async getDelegatedStakingActivities(e){return await o({config:this.config,minimumLedgerVersion:e?.minimumLedgerVersion,processorTypes:["stake_processor"]}),s({aptosConfig:this.config,...e})}};export{t as a};
2
+ //# sourceMappingURL=chunk-IEL6J6Z3.mjs.map
@@ -1,2 +1,2 @@
1
- import{a as n}from"./chunk-APSQ4M23.mjs";import{a as t,b as i,c as r,d as c,e as u,f as A,g as d,h as g,i as m,j as a,k as p,l as C,m as o,n as O,o as T,p as f,q as y}from"./chunk-SGTFMSOG.mjs";import{f as s}from"./chunk-EOC4UI5B.mjs";var R=class{constructor(e){this.config=e}async getAccountInfo(e){return t({aptosConfig:this.config,...e})}async getAccountModules(e){return i({aptosConfig:this.config,...e})}async getAccountModule(e){return r({aptosConfig:this.config,...e})}async getAccountTransactions(e){return c({aptosConfig:this.config,...e})}async getAccountResources(e){return u({aptosConfig:this.config,...e})}async getAccountResource(e){return A({aptosConfig:this.config,...e})}async lookupOriginalAccountAddress(e){return await n({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorTypes:["account_transactions_processor"]}),d({aptosConfig:this.config,...e})}async getAccountTokensCount(e){return await n({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorTypes:["account_transactions_processor"]}),g({aptosConfig:this.config,...e})}async getAccountOwnedTokens(e){return await n({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorTypes:["account_transactions_processor"]}),m({aptosConfig:this.config,...e})}async getAccountOwnedTokensFromCollectionAddress(e){return await n({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorTypes:["account_transactions_processor"]}),a({aptosConfig:this.config,...e})}async getAccountCollectionsWithOwnedTokens(e){return await n({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorTypes:["account_transactions_processor"]}),p({aptosConfig:this.config,...e})}async getAccountTransactionsCount(e){return await n({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorTypes:["account_transactions_processor"]}),C({aptosConfig:this.config,...e})}async getAccountCoinsData(e){return await n({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorTypes:["account_transactions_processor"]}),O({aptosConfig:this.config,...e})}async getAccountCoinsCount(e){return await n({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorTypes:["account_transactions_processor"]}),T({aptosConfig:this.config,...e})}async getAccountAPTAmount(e){return await n({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorTypes:["account_transactions_processor"]}),o({aptosConfig:this.config,coinType:s,...e})}async getAccountCoinAmount(e){return await n({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorTypes:["account_transactions_processor"]}),o({aptosConfig:this.config,...e})}async getAccountOwnedObjects(e){return await n({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorTypes:["account_transactions_processor"]}),f({aptosConfig:this.config,...e})}async deriveAccountFromPrivateKey(e){return y({aptosConfig:this.config,...e})}};export{R as a};
2
- //# sourceMappingURL=chunk-NZSGGL25.mjs.map
1
+ import{a as n}from"./chunk-T3ID6KFN.mjs";import{a as t,b as i,c as r,d as c,e as u,f as A,g as d,h as g,i as m,j as a,k as p,l as C,m as o,n as O,o as T,p as f,q as y}from"./chunk-R3SAAJ2N.mjs";import{f as s}from"./chunk-EOC4UI5B.mjs";var R=class{constructor(e){this.config=e}async getAccountInfo(e){return t({aptosConfig:this.config,...e})}async getAccountModules(e){return i({aptosConfig:this.config,...e})}async getAccountModule(e){return r({aptosConfig:this.config,...e})}async getAccountTransactions(e){return c({aptosConfig:this.config,...e})}async getAccountResources(e){return u({aptosConfig:this.config,...e})}async getAccountResource(e){return A({aptosConfig:this.config,...e})}async lookupOriginalAccountAddress(e){return await n({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorTypes:["account_transactions_processor"]}),d({aptosConfig:this.config,...e})}async getAccountTokensCount(e){return await n({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorTypes:["account_transactions_processor"]}),g({aptosConfig:this.config,...e})}async getAccountOwnedTokens(e){return await n({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorTypes:["account_transactions_processor"]}),m({aptosConfig:this.config,...e})}async getAccountOwnedTokensFromCollectionAddress(e){return await n({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorTypes:["account_transactions_processor"]}),a({aptosConfig:this.config,...e})}async getAccountCollectionsWithOwnedTokens(e){return await n({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorTypes:["account_transactions_processor"]}),p({aptosConfig:this.config,...e})}async getAccountTransactionsCount(e){return await n({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorTypes:["account_transactions_processor"]}),C({aptosConfig:this.config,...e})}async getAccountCoinsData(e){return await n({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorTypes:["account_transactions_processor"]}),O({aptosConfig:this.config,...e})}async getAccountCoinsCount(e){return await n({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorTypes:["account_transactions_processor"]}),T({aptosConfig:this.config,...e})}async getAccountAPTAmount(e){return await n({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorTypes:["account_transactions_processor"]}),o({aptosConfig:this.config,coinType:s,...e})}async getAccountCoinAmount(e){return await n({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorTypes:["account_transactions_processor"]}),o({aptosConfig:this.config,...e})}async getAccountOwnedObjects(e){return await n({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorTypes:["account_transactions_processor"]}),f({aptosConfig:this.config,...e})}async deriveAccountFromPrivateKey(e){return y({aptosConfig:this.config,...e})}};export{R as a};
2
+ //# sourceMappingURL=chunk-IPW2YTRD.mjs.map
@@ -1,2 +1,2 @@
1
- import{a as U,b,c as f,d as u,e as h,f as y}from"./chunk-DNDWTM7A.mjs";import{b as c}from"./chunk-NL72WE3E.mjs";import{a as s}from"./chunk-ZWH2ESXT.mjs";var B=class{bcsToBytes(){let e=new n;return this.serialize(e),e.toUint8Array()}bcsToHex(){let e=this.bcsToBytes();return c.fromHexInput(e)}},n=class{constructor(e=64){if(e<=0)throw new Error("Length needs to be greater than 0");this.buffer=new ArrayBuffer(e),this.offset=0}ensureBufferWillHandleSize(e){for(;this.buffer.byteLength<this.offset+e;){let t=new ArrayBuffer(this.buffer.byteLength*2);new Uint8Array(t).set(new Uint8Array(this.buffer)),this.buffer=t}}appendToBuffer(e){this.ensureBufferWillHandleSize(e.length),new Uint8Array(this.buffer,this.offset).set(e),this.offset+=e.length}serializeWithFunction(e,t,i){this.ensureBufferWillHandleSize(t);let a=new DataView(this.buffer,this.offset);e.apply(a,[0,i,!0]),this.offset+=t}serializeStr(e){let t=new TextEncoder;this.serializeBytes(t.encode(e))}serializeBytes(e){this.serializeU32AsUleb128(e.length),this.appendToBuffer(e)}serializeFixedBytes(e){this.appendToBuffer(e)}serializeBool(e){A(e);let t=e?1:0;this.appendToBuffer(new Uint8Array([t]))}serializeU8(e){this.appendToBuffer(new Uint8Array([e]))}serializeU16(e){this.serializeWithFunction(DataView.prototype.setUint16,2,e)}serializeU32(e){this.serializeWithFunction(DataView.prototype.setUint32,4,e)}serializeU64(e){let t=BigInt(e)&BigInt(f),i=BigInt(e)>>BigInt(32);this.serializeU32(Number(t)),this.serializeU32(Number(i))}serializeU128(e){let t=BigInt(e)&u,i=BigInt(e)>>BigInt(64);this.serializeU64(t),this.serializeU64(i)}serializeU256(e){let t=BigInt(e)&h,i=BigInt(e)>>BigInt(128);this.serializeU128(t),this.serializeU128(i)}serializeU32AsUleb128(e){let t=e,i=[];for(;t>>>7;)i.push(t&127|128),t>>>=7;i.push(t),this.appendToBuffer(new Uint8Array(i))}toUint8Array(){return new Uint8Array(this.buffer).slice(0,this.offset)}serialize(e){e.serialize(this)}serializeVector(e){this.serializeU32AsUleb128(e.length),e.forEach(t=>{t.serialize(this)})}};s([o(0,U)],n.prototype,"serializeU8",1),s([o(0,b)],n.prototype,"serializeU16",1),s([o(0,f)],n.prototype,"serializeU32",1),s([o(BigInt(0),u)],n.prototype,"serializeU64",1),s([o(BigInt(0),h)],n.prototype,"serializeU128",1),s([o(BigInt(0),y)],n.prototype,"serializeU256",1),s([o(0,f)],n.prototype,"serializeU32AsUleb128",1);function A(r){if(typeof r!="boolean")throw new Error(`${r} is not a boolean value`)}var g=(r,e,t)=>`${r} is out of range: [${e}, ${t}]`;function w(r,e,t){let i=BigInt(r);if(i>BigInt(t)||i<BigInt(e))throw new Error(g(r,e,t))}function o(r,e){return(t,i,a)=>{let p=a.value;return a.value=function(l){return w(l,r,e),p.apply(this,[l])},a}}export{B as a,n as b,A as c,g as d,w as e};
2
- //# sourceMappingURL=chunk-F6K26WV5.mjs.map
1
+ import{b as c}from"./chunk-NL72WE3E.mjs";import{a as U,b,c as f,d as u,e as h,f as y}from"./chunk-DNDWTM7A.mjs";import{a as s}from"./chunk-ZWH2ESXT.mjs";var B=class{bcsToBytes(){let e=new n;return this.serialize(e),e.toUint8Array()}bcsToHex(){let e=this.bcsToBytes();return c.fromHexInput(e)}},n=class{constructor(e=64){if(e<=0)throw new Error("Length needs to be greater than 0");this.buffer=new ArrayBuffer(e),this.offset=0}ensureBufferWillHandleSize(e){for(;this.buffer.byteLength<this.offset+e;){let t=new ArrayBuffer(this.buffer.byteLength*2);new Uint8Array(t).set(new Uint8Array(this.buffer)),this.buffer=t}}appendToBuffer(e){this.ensureBufferWillHandleSize(e.length),new Uint8Array(this.buffer,this.offset).set(e),this.offset+=e.length}serializeWithFunction(e,t,i){this.ensureBufferWillHandleSize(t);let a=new DataView(this.buffer,this.offset);e.apply(a,[0,i,!0]),this.offset+=t}serializeStr(e){let t=new TextEncoder;this.serializeBytes(t.encode(e))}serializeBytes(e){this.serializeU32AsUleb128(e.length),this.appendToBuffer(e)}serializeFixedBytes(e){this.appendToBuffer(e)}serializeBool(e){A(e);let t=e?1:0;this.appendToBuffer(new Uint8Array([t]))}serializeU8(e){this.appendToBuffer(new Uint8Array([e]))}serializeU16(e){this.serializeWithFunction(DataView.prototype.setUint16,2,e)}serializeU32(e){this.serializeWithFunction(DataView.prototype.setUint32,4,e)}serializeU64(e){let t=BigInt(e)&BigInt(f),i=BigInt(e)>>BigInt(32);this.serializeU32(Number(t)),this.serializeU32(Number(i))}serializeU128(e){let t=BigInt(e)&u,i=BigInt(e)>>BigInt(64);this.serializeU64(t),this.serializeU64(i)}serializeU256(e){let t=BigInt(e)&h,i=BigInt(e)>>BigInt(128);this.serializeU128(t),this.serializeU128(i)}serializeU32AsUleb128(e){let t=e,i=[];for(;t>>>7;)i.push(t&127|128),t>>>=7;i.push(t),this.appendToBuffer(new Uint8Array(i))}toUint8Array(){return new Uint8Array(this.buffer).slice(0,this.offset)}serialize(e){e.serialize(this)}serializeVector(e){this.serializeU32AsUleb128(e.length),e.forEach(t=>{t.serialize(this)})}};s([o(0,U)],n.prototype,"serializeU8",1),s([o(0,b)],n.prototype,"serializeU16",1),s([o(0,f)],n.prototype,"serializeU32",1),s([o(BigInt(0),u)],n.prototype,"serializeU64",1),s([o(BigInt(0),h)],n.prototype,"serializeU128",1),s([o(BigInt(0),y)],n.prototype,"serializeU256",1),s([o(0,f)],n.prototype,"serializeU32AsUleb128",1);function A(r){if(typeof r!="boolean")throw new Error(`${r} is not a boolean value`)}var g=(r,e,t)=>`${r} is out of range: [${e}, ${t}]`;function w(r,e,t){let i=BigInt(r);if(i>BigInt(t)||i<BigInt(e))throw new Error(g(r,e,t))}function o(r,e){return(t,i,a)=>{let p=a.value;return a.value=function(l){return w(l,r,e),p.apply(this,[l])},a}}export{B as a,n as b,A as c,g as d,w as e};
2
+ //# sourceMappingURL=chunk-IU5JZNH4.mjs.map
@@ -1,2 +1,2 @@
1
- import{a as s}from"./chunk-SGTFMSOG.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-Y6PVFMBS.mjs.map
1
+ import{a as s}from"./chunk-R3SAAJ2N.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-KH3M3YPI.mjs.map
@@ -0,0 +1,2 @@
1
+ import{a as c}from"./chunk-4TIQQKXV.mjs";import{a as g}from"./chunk-YLI6J47P.mjs";import{a as f}from"./chunk-PJMRQLJ5.mjs";import{a as l}from"./chunk-R4APGSSC.mjs";import{a as u}from"./chunk-IEL6J6Z3.mjs";import{a as h}from"./chunk-SI6QMT4N.mjs";import{a as s}from"./chunk-IPW2YTRD.mjs";import{a as p}from"./chunk-HDNJ4JK4.mjs";import{a as y}from"./chunk-3RMXGSHK.mjs";import{a as r}from"./chunk-TCSN7PYL.mjs";import{a}from"./chunk-EMQWD6KP.mjs";var t=class{constructor(i){this.config=new y(i),this.account=new s(this.config),this.ans=new p(this.config),this.coin=new r(this.config),this.digitalAsset=new a(this.config),this.event=new c(this.config),this.faucet=new g(this.config),this.fungibleAsset=new f(this.config),this.general=new l(this.config),this.staking=new u(this.config),this.transaction=new h(this.config)}};function n(m,i,A){Object.getOwnPropertyNames(i.prototype).forEach(e=>{let o=Object.getOwnPropertyDescriptor(i.prototype,e);o&&(o.value=function(...d){return this[A][e](...d)},Object.defineProperty(m.prototype,e,o))})}n(t,s,"account");n(t,p,"ans");n(t,r,"coin");n(t,a,"digitalAsset");n(t,c,"event");n(t,g,"faucet");n(t,f,"fungibleAsset");n(t,l,"general");n(t,u,"staking");n(t,h,"transaction");export{t as a};
2
+ //# sourceMappingURL=chunk-KSWQZKMQ.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/api/aptos.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { Account } from \"./account\";\nimport { AptosConfig } from \"./aptosConfig\";\nimport { Coin } from \"./coin\";\nimport { DigitalAsset } from \"./digitalAsset\";\nimport { Event } from \"./event\";\nimport { Faucet } from \"./faucet\";\nimport { FungibleAsset } from \"./fungibleAsset\";\nimport { General } from \"./general\";\nimport { ANS } from \"./ans\";\nimport { Staking } from \"./staking\";\nimport { Transaction } from \"./transaction\";\n\n/**\n * This class is the main entry point into Aptos's\n * APIs and separates functionality into different namespaces.\n *\n * To use the SDK, create a new Aptos instance to get access\n * to all the sdk functionality.\n */\nexport class Aptos {\n readonly config: AptosConfig;\n\n readonly account: Account;\n\n readonly ans: ANS;\n\n readonly coin: Coin;\n\n readonly digitalAsset: DigitalAsset;\n\n readonly event: Event;\n\n readonly faucet: Faucet;\n\n readonly fungibleAsset: FungibleAsset;\n\n readonly general: General;\n\n readonly staking: Staking;\n\n readonly transaction: Transaction;\n\n constructor(settings?: AptosConfig) {\n this.config = new AptosConfig(settings);\n this.account = new Account(this.config);\n this.ans = new ANS(this.config);\n this.coin = new Coin(this.config);\n this.digitalAsset = new DigitalAsset(this.config);\n this.event = new Event(this.config);\n this.faucet = new Faucet(this.config);\n this.fungibleAsset = new FungibleAsset(this.config);\n this.general = new General(this.config);\n this.staking = new Staking(this.config);\n this.transaction = new Transaction(this.config);\n }\n}\n\n// extends Aptos interface so all the methods and properties from the other classes will be recognized by typescript.\nexport interface Aptos\n extends Account,\n ANS,\n Coin,\n DigitalAsset,\n Event,\n Faucet,\n FungibleAsset,\n General,\n Staking,\n Transaction {}\n\n/**\nIn TypeScript, we can’t inherit or extend from more than one class,\nMixins helps us to get around that by creating a partial classes\nthat we can combine to form a single class that contains all the methods and properties from the partial classes.\n{@link https://www.typescriptlang.org/docs/handbook/mixins.html#alternative-pattern}\n\nHere, we combine any subclass and the Aptos class.\n*/\nfunction applyMixin(targetClass: any, baseClass: any, baseClassProp: string) {\n // Mixin instance methods\n Object.getOwnPropertyNames(baseClass.prototype).forEach((propertyName) => {\n const propertyDescriptor = Object.getOwnPropertyDescriptor(baseClass.prototype, propertyName);\n if (!propertyDescriptor) return;\n // eslint-disable-next-line func-names\n propertyDescriptor.value = function (...args: any) {\n return (this as any)[baseClassProp][propertyName](...args);\n };\n Object.defineProperty(targetClass.prototype, propertyName, propertyDescriptor);\n });\n}\n\napplyMixin(Aptos, Account, \"account\");\napplyMixin(Aptos, ANS, \"ans\");\napplyMixin(Aptos, Coin, \"coin\");\napplyMixin(Aptos, DigitalAsset, \"digitalAsset\");\napplyMixin(Aptos, Event, \"event\");\napplyMixin(Aptos, Faucet, \"faucet\");\napplyMixin(Aptos, FungibleAsset, \"fungibleAsset\");\napplyMixin(Aptos, General, \"general\");\napplyMixin(Aptos, Staking, \"staking\");\napplyMixin(Aptos, Transaction, \"transaction\");\n"],"mappings":"8bAsBO,IAAMA,EAAN,KAAY,CAuBjB,YAAYC,EAAwB,CAClC,KAAK,OAAS,IAAIC,EAAYD,CAAQ,EACtC,KAAK,QAAU,IAAIE,EAAQ,KAAK,MAAM,EACtC,KAAK,IAAM,IAAIC,EAAI,KAAK,MAAM,EAC9B,KAAK,KAAO,IAAIC,EAAK,KAAK,MAAM,EAChC,KAAK,aAAe,IAAIC,EAAa,KAAK,MAAM,EAChD,KAAK,MAAQ,IAAIC,EAAM,KAAK,MAAM,EAClC,KAAK,OAAS,IAAIC,EAAO,KAAK,MAAM,EACpC,KAAK,cAAgB,IAAIC,EAAc,KAAK,MAAM,EAClD,KAAK,QAAU,IAAIC,EAAQ,KAAK,MAAM,EACtC,KAAK,QAAU,IAAIC,EAAQ,KAAK,MAAM,EACtC,KAAK,YAAc,IAAIC,EAAY,KAAK,MAAM,CAChD,CACF,EAuBA,SAASC,EAAWC,EAAkBC,EAAgBC,EAAuB,CAE3E,OAAO,oBAAoBD,EAAU,SAAS,EAAE,QAASE,GAAiB,CACxE,IAAMC,EAAqB,OAAO,yBAAyBH,EAAU,UAAWE,CAAY,EACvFC,IAELA,EAAmB,MAAQ,YAAaC,EAAW,CACjD,OAAQ,KAAaH,CAAa,EAAEC,CAAY,EAAE,GAAGE,CAAI,CAC3D,EACA,OAAO,eAAeL,EAAY,UAAWG,EAAcC,CAAkB,EAC/E,CAAC,CACH,CAEAL,EAAWb,EAAOG,EAAS,SAAS,EACpCU,EAAWb,EAAOI,EAAK,KAAK,EAC5BS,EAAWb,EAAOK,EAAM,MAAM,EAC9BQ,EAAWb,EAAOM,EAAc,cAAc,EAC9CO,EAAWb,EAAOO,EAAO,OAAO,EAChCM,EAAWb,EAAOQ,EAAQ,QAAQ,EAClCK,EAAWb,EAAOS,EAAe,eAAe,EAChDI,EAAWb,EAAOU,EAAS,SAAS,EACpCG,EAAWb,EAAOW,EAAS,SAAS,EACpCE,EAAWb,EAAOY,EAAa,aAAa","names":["Aptos","settings","AptosConfig","Account","ANS","Coin","DigitalAsset","Event","Faucet","FungibleAsset","General","Staking","Transaction","applyMixin","targetClass","baseClass","baseClassProp","propertyName","propertyDescriptor","args"]}
@@ -1,2 +1,2 @@
1
- import{c as i}from"./chunk-3F5WV6US.mjs";import{c as e}from"./chunk-UW6HQ643.mjs";import{c as a}from"./chunk-PXTMLJKO.mjs";var s=class t extends a{constructor(r){super();this.signature=r}toUint8Array(){return this.signature.toUint8Array()}toString(){return this.signature.toString()}serialize(r){if(this.signature instanceof e)r.serializeU32AsUleb128(0),this.signature.serialize(r);else if(this.signature instanceof i)r.serializeU32AsUleb128(1),this.signature.serialize(r);else throw new Error("Unknown signature type")}static deserialize(r){let n=r.deserializeUleb128AsU32();switch(n){case 0:return new t(e.load(r));case 1:return new t(i.load(r));default:throw new Error(`Unknown variant index for AnySignature: ${n}`)}}};export{s as a};
2
- //# sourceMappingURL=chunk-5OPOJ43H.mjs.map
1
+ import{c as i}from"./chunk-RCYWJZR4.mjs";import{c as e}from"./chunk-5HZKDT5C.mjs";import{c as a}from"./chunk-EHJEK7FU.mjs";var s=class t extends a{constructor(r){super();this.signature=r}toUint8Array(){return this.signature.toUint8Array()}toString(){return this.signature.toString()}serialize(r){if(this.signature instanceof e)r.serializeU32AsUleb128(0),this.signature.serialize(r);else if(this.signature instanceof i)r.serializeU32AsUleb128(1),this.signature.serialize(r);else throw new Error("Unknown signature type")}static deserialize(r){let n=r.deserializeUleb128AsU32();switch(n){case 0:return new t(e.load(r));case 1:return new t(i.load(r));default:throw new Error(`Unknown variant index for AnySignature: ${n}`)}}};export{s as a};
2
+ //# sourceMappingURL=chunk-KVJ2KGMW.mjs.map
@@ -1,2 +1,2 @@
1
- import{a as t}from"./chunk-CLJLQXFQ.mjs";import{f as n}from"./chunk-EOC4UI5B.mjs";async function A(o){let{aptosConfig:r,sender:e,recipient:i,amount:c,coinType:s,options:a}=o,p=s??n;return await t({aptosConfig:r,sender:e.accountAddress,data:{function:"0x1::aptos_account::transfer_coins",typeArguments:[p],functionArguments:[i,c]},options:a})}export{A as a};
2
- //# sourceMappingURL=chunk-TZ623H2V.mjs.map
1
+ import{a as t}from"./chunk-VBUKPN4Q.mjs";import{f as n}from"./chunk-EOC4UI5B.mjs";async function A(o){let{aptosConfig:r,sender:e,recipient:i,amount:c,coinType:s,options:a}=o,p=s??n;return await t({aptosConfig:r,sender:e.accountAddress,data:{function:"0x1::aptos_account::transfer_coins",typeArguments:[p],functionArguments:[i,c]},options:a})}export{A as a};
2
+ //# sourceMappingURL=chunk-LUCDRB52.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/internal/coin.ts"],"sourcesContent":["import { AptosConfig } from \"../api/aptosConfig\";\nimport { Account, AccountAddressInput } from \"../core\";\nimport { InputGenerateTransactionOptions, SimpleTransaction } from \"../transactions/types\";\nimport { AnyNumber, MoveStructId } from \"../types\";\nimport { APTOS_COIN } from \"../utils/const\";\nimport { generateTransaction } from \"./transactionSubmission\";\n\nexport async function transferCoinTransaction(args: {\n aptosConfig: AptosConfig;\n sender: Account;\n recipient: AccountAddressInput;\n amount: AnyNumber;\n coinType?: MoveStructId;\n options?: InputGenerateTransactionOptions;\n}): Promise<SimpleTransaction> {\n const { aptosConfig, sender, recipient, amount, coinType, options } = args;\n const coinStructType = coinType ?? APTOS_COIN;\n const transaction = await generateTransaction({\n aptosConfig,\n sender: sender.accountAddress,\n data: {\n function: \"0x1::aptos_account::transfer_coins\",\n typeArguments: [coinStructType],\n functionArguments: [recipient, amount],\n },\n options,\n });\n\n return transaction;\n}\n"],"mappings":"kFAOA,eAAsBA,EAAwBC,EAOf,CAC7B,GAAM,CAAE,YAAAC,EAAa,OAAAC,EAAQ,UAAAC,EAAW,OAAAC,EAAQ,SAAAC,EAAU,QAAAC,CAAQ,EAAIN,EAChEO,EAAiBF,GAAYG,EAYnC,OAXoB,MAAMC,EAAoB,CAC5C,YAAAR,EACA,OAAQC,EAAO,eACf,KAAM,CACJ,SAAU,qCACV,cAAe,CAACK,CAAc,EAC9B,kBAAmB,CAACJ,EAAWC,CAAM,CACvC,EACA,QAAAE,CACF,CAAC,CAGH","names":["transferCoinTransaction","args","aptosConfig","sender","recipient","amount","coinType","options","coinStructType","APTOS_COIN","generateTransaction"]}
@@ -1,2 +1,2 @@
1
- import{a as y}from"./chunk-AZUWHKN5.mjs";import{a as m}from"./chunk-FZ56IS3E.mjs";import{a as d}from"./chunk-KZSJ5MFF.mjs";import{a as l}from"./chunk-UW6HQ643.mjs";import{b as u}from"./chunk-G36AY4R7.mjs";import{a as c}from"./chunk-F6K26WV5.mjs";import{b as s}from"./chunk-NL72WE3E.mjs";import{sha3_256 as b}from"@noble/hashes/sha3";var i=class i extends c{constructor(r){super();let{data:t}=r,e=s.fromHexInput(t);if(e.toUint8Array().length!==i.LENGTH)throw new Error(`Authentication Key length should be ${i.LENGTH}`);this.data=e}serialize(r){r.serializeFixedBytes(this.data.toUint8Array())}static deserialize(r){let t=r.deserializeFixedBytes(i.LENGTH);return new i({data:t})}toString(){return this.data.toString()}toUint8Array(){return this.data.toUint8Array()}static fromPublicKeyAndScheme(r){let{publicKey:t,scheme:e}=r,n;switch(e){case 3:case 2:{let a=t.bcsToBytes();n=new Uint8Array([...a,e]);break}case 0:case 1:{let a=t.toUint8Array(),p=s.fromHexInput(a).toUint8Array();n=new Uint8Array([...p,e]);break}default:throw new Error(`Scheme ${e} is not supported`)}let o=b.create();o.update(n);let f=o.digest();return new i({data:f})}static fromPublicKey(r){let{publicKey:t}=r,e;if(t instanceof l)e=0 .valueOf();else if(t instanceof y)e=1 .valueOf();else if(t instanceof d)e=2 .valueOf();else if(t instanceof m)e=3 .valueOf();else throw new Error("No supported authentication scheme for public key");return i.fromPublicKeyAndScheme({publicKey:t,scheme:e})}derivedAddress(){return new u(this.data.toUint8Array())}};i.LENGTH=32;var h=i;export{h as a};
2
- //# sourceMappingURL=chunk-WTGGCH34.mjs.map
1
+ import{a as y}from"./chunk-4K252UDE.mjs";import{a as m}from"./chunk-NMFS5KAE.mjs";import{a as d}from"./chunk-OWP2MKTX.mjs";import{a as l}from"./chunk-5HZKDT5C.mjs";import{b as u}from"./chunk-UR5E2UDO.mjs";import{a as c}from"./chunk-IU5JZNH4.mjs";import{b as s}from"./chunk-NL72WE3E.mjs";import{sha3_256 as b}from"@noble/hashes/sha3";var i=class i extends c{constructor(r){super();let{data:t}=r,e=s.fromHexInput(t);if(e.toUint8Array().length!==i.LENGTH)throw new Error(`Authentication Key length should be ${i.LENGTH}`);this.data=e}serialize(r){r.serializeFixedBytes(this.data.toUint8Array())}static deserialize(r){let t=r.deserializeFixedBytes(i.LENGTH);return new i({data:t})}toString(){return this.data.toString()}toUint8Array(){return this.data.toUint8Array()}static fromPublicKeyAndScheme(r){let{publicKey:t,scheme:e}=r,n;switch(e){case 3:case 2:{let a=t.bcsToBytes();n=new Uint8Array([...a,e]);break}case 0:case 1:{let a=t.toUint8Array(),p=s.fromHexInput(a).toUint8Array();n=new Uint8Array([...p,e]);break}default:throw new Error(`Scheme ${e} is not supported`)}let o=b.create();o.update(n);let f=o.digest();return new i({data:f})}static fromPublicKey(r){let{publicKey:t}=r,e;if(t instanceof l)e=0 .valueOf();else if(t instanceof y)e=1 .valueOf();else if(t instanceof d)e=2 .valueOf();else if(t instanceof m)e=3 .valueOf();else throw new Error("No supported authentication scheme for public key");return i.fromPublicKeyAndScheme({publicKey:t,scheme:e})}derivedAddress(){return new u(this.data.toUint8Array())}};i.LENGTH=32;var h=i;export{h as a};
2
+ //# sourceMappingURL=chunk-N25GOEVL.mjs.map
@@ -1,2 +1,2 @@
1
- import{a as e}from"./chunk-F6K26WV5.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-CU2DINU4.mjs.map
1
+ import{a as e}from"./chunk-IU5JZNH4.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-NLONZHYT.mjs.map
@@ -1,2 +1,2 @@
1
- import{a as o}from"./chunk-KZSJ5MFF.mjs";import{a as y}from"./chunk-PXTMLJKO.mjs";import{b as l}from"./chunk-NL72WE3E.mjs";var p=class h extends y{constructor(e){super();let{publicKeys:t,signaturesRequired:r}=e;if(r<1)throw new Error("The number of required signatures needs to be greater then 0");if(t.length<r)throw new Error(`Provided ${t.length} public keys is smaller than the ${r} required signatures`);let i=[];t.forEach(s=>{s instanceof o?i.push(s):i.push(new o(s))}),this.publicKeys=i,this.signaturesRequired=r}toUint8Array(){return this.bcsToBytes()}createBitmap(e){let{bits:t}=e,r=128,i=new Uint8Array([0,0,0,0]),s=new Set;return t.forEach((n,u)=>{if(u+1>this.publicKeys.length)throw new Error(`Signature index ${u+1} is out of public keys range, ${this.publicKeys.length}.`);if(s.has(n))throw new Error(`Duplicate bit ${n} detected.`);s.add(n);let a=Math.floor(n/8),c=i[a];c|=r>>n%8,i[a]=c}),i}toString(){return l.fromHexInput(this.toUint8Array()).toString()}verifySignature(e){throw new Error("not implemented")}serialize(e){e.serializeVector(this.publicKeys),e.serializeU8(this.signaturesRequired)}static deserialize(e){let t=e.deserializeVector(o),r=e.deserializeU8();return new h({publicKeys:t,signaturesRequired:r})}};export{p as a};
2
- //# sourceMappingURL=chunk-FZ56IS3E.mjs.map
1
+ import{a as o}from"./chunk-OWP2MKTX.mjs";import{a as y}from"./chunk-EHJEK7FU.mjs";import{b as l}from"./chunk-NL72WE3E.mjs";var p=class h extends y{constructor(e){super();let{publicKeys:t,signaturesRequired:r}=e;if(r<1)throw new Error("The number of required signatures needs to be greater then 0");if(t.length<r)throw new Error(`Provided ${t.length} public keys is smaller than the ${r} required signatures`);let i=[];t.forEach(s=>{s instanceof o?i.push(s):i.push(new o(s))}),this.publicKeys=i,this.signaturesRequired=r}toUint8Array(){return this.bcsToBytes()}createBitmap(e){let{bits:t}=e,r=128,i=new Uint8Array([0,0,0,0]),s=new Set;return t.forEach((n,u)=>{if(u+1>this.publicKeys.length)throw new Error(`Signature index ${u+1} is out of public keys range, ${this.publicKeys.length}.`);if(s.has(n))throw new Error(`Duplicate bit ${n} detected.`);s.add(n);let a=Math.floor(n/8),c=i[a];c|=r>>n%8,i[a]=c}),i}toString(){return l.fromHexInput(this.toUint8Array()).toString()}verifySignature(e){throw new Error("not implemented")}serialize(e){e.serializeVector(this.publicKeys),e.serializeU8(this.signaturesRequired)}static deserialize(e){let t=e.deserializeVector(o),r=e.deserializeU8();return new h({publicKeys:t,signaturesRequired:r})}};export{p as a};
2
+ //# sourceMappingURL=chunk-NMFS5KAE.mjs.map
@@ -0,0 +1,2 @@
1
+ import{a as d}from"./chunk-6FBKUTGF.mjs";import{a as R}from"./chunk-SODP7NAK.mjs";var p={400:"Bad Request",401:"Unauthorized",403:"Forbidden",404:"Not Found",429:"Too Many Requests",500:"Internal Server Error",502:"Bad Gateway",503:"Service Unavailable"};async function c(n,a){let{url:o,method:u,body:i,contentType:s,params:e,overrides:t}=n,r={...t?.HEADERS,"x-aptos-client":`aptos-typescript-sdk/${R}`,"content-type":s??"application/json"};return t?.AUTH_TOKEN&&o.includes("faucet")&&(r.Authorization=`Bearer ${t?.AUTH_TOKEN}`),t?.API_KEY&&!o.includes("faucet")&&(r.Authorization=`Bearer ${t?.API_KEY}`),a.provider({url:o,method:u,body:i,params:e,headers:r,overrides:t})}async function T(n,a){let{url:o,path:u}=n,i=`${o}/${u??""}`,s=await c({...n,url:i},a.client),e={status:s.status,statusText:s.statusText,data:s.data,headers:s.headers,config:s.config,request:s.request,url:i};if(a.isIndexerRequest(o)){let r=e.data;if(r.errors)throw new d(n,e,r.errors[0].message??`Unhandled Error ${s.status} : ${s.statusText}`);e.data=r.data}if(e.status>=200&&e.status<300)return e;let t;throw e&&e.data&&"message"in e.data&&"error_code"in e.data?t=JSON.stringify(e.data):e.status in p?t=p[e.status]:t=`Unhandled Error ${e.status} : ${e.statusText}`,new d(n,e,t)}export{c as a,T as b};
2
+ //# sourceMappingURL=chunk-NZ6RYGJQ.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/client/core.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { AptosConfig } from \"../api/aptosConfig\";\nimport { AptosApiError, AptosResponse } from \"./types\";\nimport { VERSION } from \"../version\";\nimport { AptosRequest, MimeType, ClientRequest, ClientResponse, Client, AnyNumber } from \"../types\";\n\n/**\n * Meaningful errors map\n */\nconst errors: Record<number, string> = {\n 400: \"Bad Request\",\n 401: \"Unauthorized\",\n 403: \"Forbidden\",\n 404: \"Not Found\",\n 429: \"Too Many Requests\",\n 500: \"Internal Server Error\",\n 502: \"Bad Gateway\",\n 503: \"Service Unavailable\",\n};\n\n/**\n * Given a url and method, sends the request with axios and\n * returns the response.\n */\nexport async function request<Req, Res>(options: ClientRequest<Req>, client: Client): Promise<ClientResponse<Res>> {\n const { url, method, body, contentType, params, overrides } = options;\n const headers: Record<string, string | AnyNumber | boolean | undefined> = {\n ...overrides?.HEADERS,\n \"x-aptos-client\": `aptos-typescript-sdk/${VERSION}`,\n \"content-type\": contentType ?? MimeType.JSON,\n };\n\n // TODO - auth token is being used only for faucet, it breaks full node requests.\n // Find a more sophisticated way than that but without the need to add the\n // auth_token on every `aptos.fundAccount()` call\n if (overrides?.AUTH_TOKEN && url.includes(\"faucet\")) {\n headers.Authorization = `Bearer ${overrides?.AUTH_TOKEN}`;\n }\n if (overrides?.API_KEY && !url.includes(\"faucet\")) {\n headers.Authorization = `Bearer ${overrides?.API_KEY}`;\n }\n\n /*\n * make a call using the @aptos-labs/aptos-client package\n * {@link https://www.npmjs.com/package/@aptos-labs/aptos-client}\n */\n return client.provider<Req, Res>({\n url,\n method,\n body,\n params,\n headers,\n overrides,\n });\n}\n\n/**\n * The main function to use when doing an API request.\n *\n * @param options AptosRequest\n * @param aptosConfig The config information for the SDK client instance\n * @returns the response or AptosApiError\n */\nexport async function aptosRequest<Req extends {}, Res extends {}>(\n options: AptosRequest,\n aptosConfig: AptosConfig,\n): Promise<AptosResponse<Req, Res>> {\n const { url, path } = options;\n const fullUrl = `${url}/${path ?? \"\"}`;\n const response = await request<Req, Res>({ ...options, url: fullUrl }, aptosConfig.client);\n\n const result: AptosResponse<Req, Res> = {\n status: response.status,\n statusText: response.statusText!,\n data: response.data,\n headers: response.headers,\n config: response.config,\n request: response.request,\n url: fullUrl,\n };\n\n // to support both fullnode and indexer responses,\n // check if it is an indexer query, and adjust response.data\n if (aptosConfig.isIndexerRequest(url)) {\n const indexerResponse = result.data as any;\n // errors from indexer\n if (indexerResponse.errors) {\n throw new AptosApiError(\n options,\n result,\n indexerResponse.errors[0].message ?? `Unhandled Error ${response.status} : ${response.statusText}`,\n );\n }\n result.data = indexerResponse.data as Res;\n }\n\n if (result.status >= 200 && result.status < 300) {\n return result;\n }\n\n let errorMessage: string;\n\n if (result && result.data && \"message\" in result.data && \"error_code\" in result.data) {\n errorMessage = JSON.stringify(result.data);\n } else if (result.status in errors) {\n // If it's not an API type, it must come form infra, these are prehandled\n errorMessage = errors[result.status];\n } else {\n // Everything else is unhandled\n errorMessage = `Unhandled Error ${result.status} : ${result.statusText}`;\n }\n\n throw new AptosApiError(options, result, errorMessage);\n}\n"],"mappings":"kFAWA,IAAMA,EAAiC,CACrC,IAAK,cACL,IAAK,eACL,IAAK,YACL,IAAK,YACL,IAAK,oBACL,IAAK,wBACL,IAAK,cACL,IAAK,qBACP,EAMA,eAAsBC,EAAkBC,EAA6BC,EAA8C,CACjH,GAAM,CAAE,IAAAC,EAAK,OAAAC,EAAQ,KAAAC,EAAM,YAAAC,EAAa,OAAAC,EAAQ,UAAAC,CAAU,EAAIP,EACxDQ,EAAoE,CACxE,GAAGD,GAAW,QACd,iBAAkB,wBAAwBE,CAAO,GACjD,eAAgBJ,qBAClB,EAKA,OAAIE,GAAW,YAAcL,EAAI,SAAS,QAAQ,IAChDM,EAAQ,cAAgB,UAAUD,GAAW,UAAU,IAErDA,GAAW,SAAW,CAACL,EAAI,SAAS,QAAQ,IAC9CM,EAAQ,cAAgB,UAAUD,GAAW,OAAO,IAO/CN,EAAO,SAAmB,CAC/B,IAAAC,EACA,OAAAC,EACA,KAAAC,EACA,OAAAE,EACA,QAAAE,EACA,UAAAD,CACF,CAAC,CACH,CASA,eAAsBG,EACpBV,EACAW,EACkC,CAClC,GAAM,CAAE,IAAAT,EAAK,KAAAU,CAAK,EAAIZ,EAChBa,EAAU,GAAGX,CAAG,IAAIU,GAAQ,EAAE,GAC9BE,EAAW,MAAMf,EAAkB,CAAE,GAAGC,EAAS,IAAKa,CAAQ,EAAGF,EAAY,MAAM,EAEnFI,EAAkC,CACtC,OAAQD,EAAS,OACjB,WAAYA,EAAS,WACrB,KAAMA,EAAS,KACf,QAASA,EAAS,QAClB,OAAQA,EAAS,OACjB,QAASA,EAAS,QAClB,IAAKD,CACP,EAIA,GAAIF,EAAY,iBAAiBT,CAAG,EAAG,CACrC,IAAMc,EAAkBD,EAAO,KAE/B,GAAIC,EAAgB,OAClB,MAAM,IAAIC,EACRjB,EACAe,EACAC,EAAgB,OAAO,CAAC,EAAE,SAAW,mBAAmBF,EAAS,MAAM,MAAMA,EAAS,UAAU,EAClG,EAEFC,EAAO,KAAOC,EAAgB,IAChC,CAEA,GAAID,EAAO,QAAU,KAAOA,EAAO,OAAS,IAC1C,OAAOA,EAGT,IAAIG,EAEJ,MAAIH,GAAUA,EAAO,MAAQ,YAAaA,EAAO,MAAQ,eAAgBA,EAAO,KAC9EG,EAAe,KAAK,UAAUH,EAAO,IAAI,EAChCA,EAAO,UAAUjB,EAE1BoB,EAAepB,EAAOiB,EAAO,MAAM,EAGnCG,EAAe,mBAAmBH,EAAO,MAAM,MAAMA,EAAO,UAAU,GAGlE,IAAIE,EAAcjB,EAASe,EAAQG,CAAY,CACvD","names":["errors","request","options","client","url","method","body","contentType","params","overrides","headers","VERSION","aptosRequest","aptosConfig","path","fullUrl","response","result","indexerResponse","AptosApiError","errorMessage"]}
@@ -0,0 +1,2 @@
1
+ import{b as s}from"./chunk-6EMN3BOV.mjs";import{f as r}from"./chunk-VBUKPN4Q.mjs";import{a as o}from"./chunk-ZWH2ESXT.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-OU4MEM5F.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/api/transactionSubmission/simulate.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { PublicKey } from \"../../core\";\nimport { simulateTransaction } from \"../../internal/transactionSubmission\";\nimport { AnyRawTransaction, InputSimulateTransactionOptions } from \"../../transactions\";\nimport { UserTransactionResponse } from \"../../types\";\nimport { AptosConfig } from \"../aptosConfig\";\nimport { ValidateFeePayerDataOnSimulation } from \"./helpers\";\n\n/**\n * A class to handle all `Simulate` transaction operations\n */\nexport class Simulate {\n readonly config: AptosConfig;\n\n constructor(config: AptosConfig) {\n this.config = config;\n }\n\n /**\n * Simulate a simple transaction\n *\n * @param args.signerPublicKey The signer public key\n * @param args.transaction An instance of a raw transaction\n * @param args.options optional. Optional transaction configurations\n * @param args.feePayerPublicKey optional. The fee payer public key if it is a fee payer transaction\n *\n * @returns Array<UserTransactionResponse>\n */\n @ValidateFeePayerDataOnSimulation\n async simple(args: {\n signerPublicKey: PublicKey;\n transaction: AnyRawTransaction;\n feePayerPublicKey?: PublicKey;\n options?: InputSimulateTransactionOptions;\n }): Promise<Array<UserTransactionResponse>> {\n return simulateTransaction({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Simulate a multi agent transaction\n *\n * @param args.signerPublicKey The signer public key\n * @param args.transaction An instance of a raw transaction\n * @param args.secondarySignersPublicKeys An array of the secondary signers public keys\n * @param args.options optional. Optional transaction configurations\n * @param args.feePayerPublicKey optional. The fee payer public key if it is a fee payer transaction\n *\n * @returns Array<UserTransactionResponse>\n */\n @ValidateFeePayerDataOnSimulation\n async multiAgent(args: {\n signerPublicKey: PublicKey;\n transaction: AnyRawTransaction;\n secondarySignersPublicKeys: Array<PublicKey>;\n feePayerPublicKey?: PublicKey;\n options?: InputSimulateTransactionOptions;\n }): Promise<Array<UserTransactionResponse>> {\n return simulateTransaction({ aptosConfig: this.config, ...args });\n }\n}\n"],"mappings":"2HAaO,IAAMA,EAAN,KAAe,CAGpB,YAAYC,EAAqB,CAC/B,KAAK,OAASA,CAChB,CAaA,MAAM,OAAOC,EAK+B,CAC1C,OAAOC,EAAoB,CAAE,YAAa,KAAK,OAAQ,GAAGD,CAAK,CAAC,CAClE,CAcA,MAAM,WAAWA,EAM2B,CAC1C,OAAOC,EAAoB,CAAE,YAAa,KAAK,OAAQ,GAAGD,CAAK,CAAC,CAClE,CACF,EA9BQE,EAAA,CADLC,GAjBUL,EAkBL,sBAqBAI,EAAA,CADLC,GAtCUL,EAuCL","names":["Simulate","config","args","simulateTransaction","__decorateClass","ValidateFeePayerDataOnSimulation"]}
@@ -1,2 +1,2 @@
1
- import{a as t}from"./chunk-3F5WV6US.mjs";import{a as r}from"./chunk-UW6HQ643.mjs";import{a as s}from"./chunk-PXTMLJKO.mjs";var c=class n extends s{constructor(e){super();this.publicKey=e}toUint8Array(){return this.publicKey.toUint8Array()}toString(){return this.publicKey.toString()}verifySignature(e){let{message:i,signature:u}=e;return this.publicKey.verifySignature({message:i,signature:u})}serialize(e){if(this.publicKey instanceof r)e.serializeU32AsUleb128(0),this.publicKey.serialize(e);else if(this.publicKey instanceof t)e.serializeU32AsUleb128(1),this.publicKey.serialize(e);else throw new Error("Unknown public key type")}static deserialize(e){let i=e.deserializeUleb128AsU32();switch(i){case 0:return new n(r.load(e));case 1:return new n(t.load(e));default:throw new Error(`Unknown variant index for AnyPublicKey: ${i}`)}}static isPublicKey(e){return e instanceof n}isEd25519(){return this.publicKey instanceof r}isSecp256k1PublicKey(){return this.publicKey instanceof t}};export{c as a};
2
- //# sourceMappingURL=chunk-KZSJ5MFF.mjs.map
1
+ import{a as t}from"./chunk-RCYWJZR4.mjs";import{a as r}from"./chunk-5HZKDT5C.mjs";import{a as s}from"./chunk-EHJEK7FU.mjs";var c=class n extends s{constructor(e){super();this.publicKey=e}toUint8Array(){return this.publicKey.toUint8Array()}toString(){return this.publicKey.toString()}verifySignature(e){let{message:i,signature:u}=e;return this.publicKey.verifySignature({message:i,signature:u})}serialize(e){if(this.publicKey instanceof r)e.serializeU32AsUleb128(0),this.publicKey.serialize(e);else if(this.publicKey instanceof t)e.serializeU32AsUleb128(1),this.publicKey.serialize(e);else throw new Error("Unknown public key type")}static deserialize(e){let i=e.deserializeUleb128AsU32();switch(i){case 0:return new n(r.load(e));case 1:return new n(t.load(e));default:throw new Error(`Unknown variant index for AnyPublicKey: ${i}`)}}static isPublicKey(e){return e instanceof n}isEd25519(){return this.publicKey instanceof r}isSecp256k1PublicKey(){return this.publicKey instanceof t}};export{c as a};
2
+ //# sourceMappingURL=chunk-OWP2MKTX.mjs.map
@@ -1,2 +1,2 @@
1
- import{a as i}from"./chunk-RCM3K5JL.mjs";import{a as e}from"./chunk-CJPCOS4R.mjs";import{a as r}from"./chunk-F6K26WV5.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=e.deserialize(t),s=i.deserialize(t);return new o(a,s)}};export{n as a};
2
- //# sourceMappingURL=chunk-QCBIJCU4.mjs.map
1
+ import{a as e}from"./chunk-3QS3MFWJ.mjs";import{a as i}from"./chunk-GQI3HWOB.mjs";import{a as r}from"./chunk-IU5JZNH4.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=e.deserialize(t),s=i.deserialize(t);return new o(a,s)}};export{n as a};
2
+ //# sourceMappingURL=chunk-OXO3Z2MF.mjs.map
@@ -1,2 +1,2 @@
1
- import{a as g}from"./chunk-YN6UIVFB.mjs";import{a as p}from"./chunk-XMUUI6HG.mjs";import{a as y}from"./chunk-CU2DINU4.mjs";import{a as M}from"./chunk-53DS6NBQ.mjs";import{a as S}from"./chunk-73VWOS4Z.mjs";import{a as F,b as d,c as T,d as E,e as _,f as w,g as x}from"./chunk-XITLXPBK.mjs";import{b as u}from"./chunk-G36AY4R7.mjs";import{a as b}from"./chunk-F6K26WV5.mjs";function D(r){let e=r.deserializeUleb128AsU32();switch(e){case 0:return d.deserialize(r);case 1:return _.deserialize(r);case 2:return w.deserialize(r);case 3:return u.deserialize(r);case 4:return M.deserialize(r,d);case 5:return F.deserialize(r);case 6:return T.deserialize(r);case 7:return E.deserialize(r);case 8:return x.deserialize(r);default:throw new Error(`Unknown variant index for ScriptTransactionArgument: ${e}`)}}var a=class extends b{static deserialize(e){let t=e.deserializeUleb128AsU32();switch(t){case 0:return m.load(e);case 2:return A.load(e);case 3:return z.load(e);default:throw new Error(`Unknown variant index for TransactionPayload: ${t}`)}}},m=class r extends a{constructor(t){super();this.script=t}serialize(t){t.serializeU32AsUleb128(0),this.script.serialize(t)}static load(t){let i=h.deserialize(t);return new r(i)}},A=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)}},z=class r extends a{constructor(t){super();this.multiSig=t}serialize(t){t.serializeU32AsUleb128(3),this.multiSig.serialize(t)}static load(t){let i=U.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(p.fromStr(e),new y(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=p.deserialize(e),i=y.deserialize(e),n=e.deserializeVector(g),o=e.deserializeUleb128AsU32(),s=new Array;for(let c=0;c<o;c+=1){let v=e.deserializeUleb128AsU32(),B=S.deserialize(e,v);s.push(B)}return new r(t,i,n,s)}},h=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(g),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)}},U=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=u.deserialize(e),i=e.deserializeBool(),n;return i&&(n=f.deserialize(e)),new r(t,n)}},f=class r{constructor(e){this.transaction_payload=e}serialize(e){e.serializeU32AsUleb128(0),this.transaction_payload.serialize(e)}static deserialize(e){return e.deserializeUleb128AsU32(),new r(l.deserialize(e))}};export{D as a,a as b,m as c,A as d,z as e,l as f,h as g,U as h,f as i};
2
- //# sourceMappingURL=chunk-CL5B2QNS.mjs.map
1
+ import{a as g}from"./chunk-C3Y52GHM.mjs";import{a as p}from"./chunk-PRKZ2KJ4.mjs";import{a as y}from"./chunk-NLONZHYT.mjs";import{b as u}from"./chunk-UR5E2UDO.mjs";import{a as S}from"./chunk-6DYNAFAP.mjs";import{a as M}from"./chunk-7B3VSBCX.mjs";import{a as F,b as d,c as T,d as E,e as _,f as w,g as x}from"./chunk-VMCFN5CT.mjs";import{a as b}from"./chunk-IU5JZNH4.mjs";function D(r){let e=r.deserializeUleb128AsU32();switch(e){case 0:return d.deserialize(r);case 1:return _.deserialize(r);case 2:return w.deserialize(r);case 3:return u.deserialize(r);case 4:return M.deserialize(r,d);case 5:return F.deserialize(r);case 6:return T.deserialize(r);case 7:return E.deserialize(r);case 8:return x.deserialize(r);default:throw new Error(`Unknown variant index for ScriptTransactionArgument: ${e}`)}}var a=class extends b{static deserialize(e){let t=e.deserializeUleb128AsU32();switch(t){case 0:return m.load(e);case 2:return A.load(e);case 3:return z.load(e);default:throw new Error(`Unknown variant index for TransactionPayload: ${t}`)}}},m=class r extends a{constructor(t){super();this.script=t}serialize(t){t.serializeU32AsUleb128(0),this.script.serialize(t)}static load(t){let i=h.deserialize(t);return new r(i)}},A=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)}},z=class r extends a{constructor(t){super();this.multiSig=t}serialize(t){t.serializeU32AsUleb128(3),this.multiSig.serialize(t)}static load(t){let i=U.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(p.fromStr(e),new y(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=p.deserialize(e),i=y.deserialize(e),n=e.deserializeVector(g),o=e.deserializeUleb128AsU32(),s=new Array;for(let c=0;c<o;c+=1){let v=e.deserializeUleb128AsU32(),B=S.deserialize(e,v);s.push(B)}return new r(t,i,n,s)}},h=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(g),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)}},U=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=u.deserialize(e),i=e.deserializeBool(),n;return i&&(n=f.deserialize(e)),new r(t,n)}},f=class r{constructor(e){this.transaction_payload=e}serialize(e){e.serializeU32AsUleb128(0),this.transaction_payload.serialize(e)}static deserialize(e){return e.deserializeUleb128AsU32(),new r(l.deserialize(e))}};export{D as a,a as b,m as c,A as d,z as e,l as f,h as g,U as h,f as i};
2
+ //# sourceMappingURL=chunk-PANYJULW.mjs.map
@@ -1,2 +1,2 @@
1
- import{a as i,b as n,c as t,d as o}from"./chunk-CCXMVVXD.mjs";import{a as s}from"./chunk-APSQ4M23.mjs";var r=class{constructor(e){this.config=e}async getFungibleAssetMetadata(e){return await s({config:this.config,minimumLedgerVersion:e?.minimumLedgerVersion,processorTypes:["fungible_asset_processor"]}),i({aptosConfig:this.config,...e})}async getFungibleAssetMetadataByAssetType(e){return await s({config:this.config,minimumLedgerVersion:e?.minimumLedgerVersion,processorTypes:["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,processorTypes:["fungible_asset_processor"]}),n({aptosConfig:this.config,...e})}async getCurrentFungibleAssetBalances(e){return await s({config:this.config,minimumLedgerVersion:e?.minimumLedgerVersion,processorTypes:["fungible_asset_processor"]}),t({aptosConfig:this.config,...e})}async transferFungibleAsset(e){return o({aptosConfig:this.config,...e})}};export{r as a};
2
- //# sourceMappingURL=chunk-QEXAMHPU.mjs.map
1
+ import{a as i,b as t,c as n,d as o}from"./chunk-4ZYW3BPF.mjs";import{a as s}from"./chunk-T3ID6KFN.mjs";var r=class{constructor(e){this.config=e}async getFungibleAssetMetadata(e){return await s({config:this.config,minimumLedgerVersion:e?.minimumLedgerVersion,processorTypes:["fungible_asset_processor"]}),i({aptosConfig:this.config,...e})}async getFungibleAssetMetadataByAssetType(e){return await s({config:this.config,minimumLedgerVersion:e?.minimumLedgerVersion,processorTypes:["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,processorTypes:["fungible_asset_processor"]}),t({aptosConfig:this.config,...e})}async getCurrentFungibleAssetBalances(e){return await s({config:this.config,minimumLedgerVersion:e?.minimumLedgerVersion,processorTypes:["fungible_asset_processor"]}),n({aptosConfig:this.config,...e})}async transferFungibleAsset(e){return o({aptosConfig:this.config,...e})}};export{r as a};
2
+ //# sourceMappingURL=chunk-PJMRQLJ5.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 { Account, AccountAddress } from \"../core\";\nimport { InputGenerateTransactionOptions, SimpleTransaction } from \"../transactions\";\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 * @param args.minimumLedgerVersion Optional ledger version to sync up to, before querying\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 processorTypes: [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 * @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 processorTypes: [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 * @param args.minimumLedgerVersion Optional ledger version to sync up to, before querying\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 processorTypes: [ProcessorType.FUNGIBLE_ASSET_PROCESSOR],\n });\n return getFungibleAssetActivities({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Queries all fungible asset balances\n *\n * @param args.minimumLedgerVersion Optional ledger version to sync up to, before querying\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 processorTypes: [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 * @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: AccountAddress;\n recipient: AccountAddress;\n amount: AnyNumber;\n options?: InputGenerateTransactionOptions;\n }): Promise<SimpleTransaction> {\n return transferFungibleAsset({ aptosConfig: this.config, ...args });\n }\n}\n"],"mappings":"uGA+BO,IAAMA,EAAN,KAAoB,CACzB,YAAqBC,EAAqB,CAArB,YAAAA,CAAsB,CAS3C,MAAM,yBAAyBC,EAGe,CAC5C,aAAMC,EAAwB,CAC5B,OAAQ,KAAK,OACb,qBAAsBD,GAAM,qBAC5B,eAAgB,2BAAuC,CACzD,CAAC,EACME,EAAyB,CAAE,YAAa,KAAK,OAAQ,GAAGF,CAAK,CAAC,CACvE,CAeA,MAAM,oCAAoCA,EAGO,CAC/C,aAAMC,EAAwB,CAC5B,OAAQ,KAAK,OACb,qBAAsBD,GAAM,qBAC5B,eAAgB,2BAAuC,CACzD,CAAC,GACY,MAAME,EAAyB,CAC1C,YAAa,KAAK,OAClB,QAAS,CACP,MAAO,CACL,WAAY,CAAE,IAAKF,EAAK,SAAU,CACpC,CACF,CACF,CAAC,GAEW,CAAC,CACf,CASA,MAAM,2BAA2BA,EAGe,CAC9C,aAAMC,EAAwB,CAC5B,OAAQ,KAAK,OACb,qBAAsBD,GAAM,qBAC5B,eAAgB,2BAAuC,CACzD,CAAC,EACMG,EAA2B,CAAE,YAAa,KAAK,OAAQ,GAAGH,CAAK,CAAC,CACzE,CASA,MAAM,gCAAgCA,EAGe,CACnD,aAAMC,EAAwB,CAC5B,OAAQ,KAAK,OACb,qBAAsBD,GAAM,qBAC5B,eAAgB,2BAAuC,CACzD,CAAC,EACMI,EAAgC,CAAE,YAAa,KAAK,OAAQ,GAAGJ,CAAK,CAAC,CAC9E,CAeA,MAAM,sBAAsBA,EAMG,CAC7B,OAAOK,EAAsB,CAAE,YAAa,KAAK,OAAQ,GAAGL,CAAK,CAAC,CACpE,CACF","names":["FungibleAsset","config","args","waitForIndexerOnVersion","getFungibleAssetMetadata","getFungibleAssetActivities","getCurrentFungibleAssetBalances","transferFungibleAsset"]}
@@ -1,2 +1,2 @@
1
- import{a as s}from"./chunk-CU2DINU4.mjs";import{b as i}from"./chunk-G36AY4R7.mjs";import{a as d}from"./chunk-F6K26WV5.mjs";var o=class t extends d{constructor(e,r){super();this.address=e,this.name=r}static fromStr(e){let r=e.split("::");if(r.length!==2)throw new Error("Invalid module id.");return new t(i.fromString(r[0]),new s(r[1]))}serialize(e){this.address.serialize(e),this.name.serialize(e)}static deserialize(e){let r=i.deserialize(e),n=s.deserialize(e);return new t(r,n)}};export{o as a};
2
- //# sourceMappingURL=chunk-XMUUI6HG.mjs.map
1
+ import{a as s}from"./chunk-NLONZHYT.mjs";import{b as i}from"./chunk-UR5E2UDO.mjs";import{a as d}from"./chunk-IU5JZNH4.mjs";var o=class t extends d{constructor(e,r){super();this.address=e,this.name=r}static fromStr(e){let r=e.split("::");if(r.length!==2)throw new Error("Invalid module id.");return new t(i.fromString(r[0]),new s(r[1]))}serialize(e){this.address.serialize(e),this.name.serialize(e)}static deserialize(e){let r=i.deserialize(e),n=s.deserialize(e);return new t(r,n)}};export{o as a};
2
+ //# sourceMappingURL=chunk-PRKZ2KJ4.mjs.map
@@ -1,2 +1,2 @@
1
- import{a as S}from"./chunk-AH44UPM4.mjs";import{a as f}from"./chunk-SSJQOXEP.mjs";import{a as p}from"./chunk-WTGGCH34.mjs";import{a as _}from"./chunk-KZSJ5MFF.mjs";import{b as m}from"./chunk-3F5WV6US.mjs";import{b as y}from"./chunk-UW6HQ643.mjs";import{b as c}from"./chunk-G36AY4R7.mjs";import{d as b,g as d}from"./chunk-OT2UDMUU.mjs";import{d as C,e as h,f as w,g as k,h as T,j as O,k as q,l as v}from"./chunk-BQSE5HHW.mjs";import{b as g,c as A}from"./chunk-JI2BBZ2W.mjs";import{a as l}from"./chunk-6FBKUTGF.mjs";async function M(e){let{aptosConfig:n,accountAddress:t}=e,{data:o}=await g({aptosConfig:n,originMethod:"getInfo",path:`accounts/${c.from(t).toString()}`});return o}async function io(e){let{aptosConfig:n,accountAddress:t,options:o}=e;return A({aptosConfig:n,originMethod:"getModules",path:`accounts/${c.from(t).toString()}/modules`,params:{ledger_version:o?.ledgerVersion,start:o?.offset,limit:o?.limit??1e3}})}async function uo(e){return e.options?.ledgerVersion!==void 0?P(e):S(async()=>P(e),`module-${e.accountAddress}-${e.moduleName}`,1e3*60*5)()}async function P(e){let{aptosConfig:n,accountAddress:t,moduleName:o,options:r}=e,{data:s}=await g({aptosConfig:n,originMethod:"getModule",path:`accounts/${c.from(t).toString()}/module/${o}`,params:{ledger_version:r?.ledgerVersion}});return s}async function go(e){let{aptosConfig:n,accountAddress:t,options:o}=e;return A({aptosConfig:n,originMethod:"getTransactions",path:`accounts/${c.from(t).toString()}/transactions`,params:{start:o?.offset,limit:o?.limit}})}async function Ao(e){let{aptosConfig:n,accountAddress:t,options:o}=e;return A({aptosConfig:n,originMethod:"getResources",path:`accounts/${c.from(t).toString()}/resources`,params:{ledger_version:o?.ledgerVersion,start:o?.offset,limit:o?.limit??999}})}async function K(e){let{aptosConfig:n,accountAddress:t,resourceType:o,options:r}=e,{data:s}=await g({aptosConfig:n,originMethod:"getResource",path:`accounts/${c.from(t).toString()}/resource/${o}`,params:{ledger_version:r?.ledgerVersion}});return s.data}async function Q(e){let{aptosConfig:n,authenticationKey:t,options:o}=e,r=await K({aptosConfig:n,accountAddress:"0x1",resourceType:"0x1::account::OriginatingAddress",options:o}),{address_map:{handle:s}}=r,a=c.from(t);try{let i=await b({aptosConfig:n,handle:s,data:{key:a.toString(),key_type:"address",value_type:"address"},options:o});return c.from(i)}catch(i){if(i instanceof l&&i.data.error_code==="table_item_not_found")return a;throw i}}async function po(e){let{aptosConfig:n,accountAddress:t}=e,r={owner_address:{_eq:c.from(t).toStringLong()},amount:{_gt:0}},a=await d({aptosConfig:n,query:{query:q,variables:{where_condition:r}},originMethod:"getAccountTokensCount"});return a.current_token_ownerships_v2_aggregate.aggregate?a.current_token_ownerships_v2_aggregate.aggregate.count:0}async function fo(e){let{aptosConfig:n,accountAddress:t,options:o}=e,s={owner_address:{_eq:c.from(t).toStringLong()},amount:{_gt:0}};o?.tokenStandard&&(s.token_standard={_eq:o?.tokenStandard});let a={query:T,variables:{where_condition:s,offset:o?.offset,limit:o?.limit,order_by:o?.orderBy}};return(await d({aptosConfig:n,query:a,originMethod:"getAccountOwnedTokens"})).current_token_ownerships_v2}async function lo(e){let{aptosConfig:n,accountAddress:t,collectionAddress:o,options:r}=e,s=c.from(t).toStringLong(),a=c.from(o).toStringLong(),i={owner_address:{_eq:s},current_token_data:{collection_id:{_eq:a}},amount:{_gt:0}};r?.tokenStandard&&(i.token_standard={_eq:r?.tokenStandard});let u={query:O,variables:{where_condition:i,offset:r?.offset,limit:r?.limit,order_by:r?.orderBy}};return(await d({aptosConfig:n,query:u,originMethod:"getAccountOwnedTokensFromCollectionAddress"})).current_token_ownerships_v2}async function yo(e){let{aptosConfig:n,accountAddress:t,options:o}=e,s={owner_address:{_eq:c.from(t).toStringLong()},amount:{_gt:0}};o?.tokenStandard&&(s.current_collection={token_standard:{_eq:o?.tokenStandard}});let a={query:w,variables:{where_condition:s,offset:o?.offset,limit:o?.limit,order_by:o?.orderBy}};return(await d({aptosConfig:n,query:a,originMethod:"getAccountCollectionsWithOwnedTokens"})).current_collection_ownership_v2_view}async function mo(e){let{aptosConfig:n,accountAddress:t}=e,o=c.from(t).toStringLong(),s=await d({aptosConfig:n,query:{query:v,variables:{address:o}},originMethod:"getAccountTransactionsCount"});return s.account_transactions_aggregate.aggregate?s.account_transactions_aggregate.aggregate.count:0}async function _o(e){let{aptosConfig:n,accountAddress:t,coinType:o}=e,r=c.from(t).toStringLong(),s=await I({aptosConfig:n,accountAddress:r,options:{where:{asset_type:{_eq:o}}}});return s[0]?s[0].amount:0}async function I(e){let{aptosConfig:n,accountAddress:t,options:o}=e,r=c.from(t).toStringLong(),s={...o?.where,owner_address:{_eq:r}},a={query:h,variables:{where_condition:s,offset:o?.offset,limit:o?.limit,order_by:o?.orderBy}};return(await d({aptosConfig:n,query:a,originMethod:"getAccountCoinsData"})).current_fungible_asset_balances}async function Co(e){let{aptosConfig:n,accountAddress:t}=e,o=c.from(t).toStringLong(),s=await d({aptosConfig:n,query:{query:C,variables:{address:o}},originMethod:"getAccountCoinsCount"});if(!s.current_fungible_asset_balances_aggregate.aggregate)throw Error("Failed to get the count of account coins");return s.current_fungible_asset_balances_aggregate.aggregate.count}async function ho(e){let{aptosConfig:n,accountAddress:t,options:o}=e,s={owner_address:{_eq:c.from(t).toStringLong()}},a={query:k,variables:{where_condition:s,offset:o?.offset,limit:o?.limit,order_by:o?.orderBy}};return(await d({aptosConfig:n,query:a,originMethod:"getAccountOwnedObjects"})).current_objects}async function wo(e){let{aptosConfig:n,privateKey:t}=e,o=new _(t.publicKey());if(t instanceof m){let s=p.fromPublicKeyAndScheme({publicKey:o,scheme:2}).derivedAddress();return f.fromPrivateKeyAndAddress({privateKey:t,address:s})}if(t instanceof y){let r=p.fromPublicKeyAndScheme({publicKey:o,scheme:2});if(await G({authKey:r,aptosConfig:n})){let u=r.derivedAddress();return f.fromPrivateKeyAndAddress({privateKey:t,address:u,legacy:!1})}let a=p.fromPublicKeyAndScheme({publicKey:o,scheme:0});if(await G({authKey:a,aptosConfig:n})){let u=a.derivedAddress();return f.fromPrivateKeyAndAddress({privateKey:t,address:u,legacy:!0})}}throw new Error(`Can't derive account from private key ${t}`)}async function G(e){let{aptosConfig:n,authKey:t}=e,o=await Q({aptosConfig:n,authenticationKey:t.derivedAddress()});try{return await M({aptosConfig:n,accountAddress:o}),!0}catch(r){if(r.status===404)return!1;throw new Error(`Error while looking for an account info ${o.toString()}`)}}export{M as a,io as b,uo as c,go as d,Ao as e,K as f,Q as g,po as h,fo as i,lo as j,yo as k,mo as l,_o as m,I as n,Co as o,ho as p,wo as q,G as r};
2
- //# sourceMappingURL=chunk-SGTFMSOG.mjs.map
1
+ import{a as f}from"./chunk-SMN2QQ4Q.mjs";import{a as p}from"./chunk-N25GOEVL.mjs";import{a as _}from"./chunk-OWP2MKTX.mjs";import{b as m}from"./chunk-RCYWJZR4.mjs";import{b as y}from"./chunk-5HZKDT5C.mjs";import{b as c}from"./chunk-UR5E2UDO.mjs";import{a as S}from"./chunk-AH44UPM4.mjs";import{d as b,g as d}from"./chunk-SR7XLV76.mjs";import{d as C,e as h,f as w,g as k,h as T,j as O,k as q,l as v}from"./chunk-BQSE5HHW.mjs";import{b as g,c as A}from"./chunk-UZB7CTLX.mjs";import{a as l}from"./chunk-6FBKUTGF.mjs";async function M(e){let{aptosConfig:n,accountAddress:t}=e,{data:o}=await g({aptosConfig:n,originMethod:"getInfo",path:`accounts/${c.from(t).toString()}`});return o}async function io(e){let{aptosConfig:n,accountAddress:t,options:o}=e;return A({aptosConfig:n,originMethod:"getModules",path:`accounts/${c.from(t).toString()}/modules`,params:{ledger_version:o?.ledgerVersion,start:o?.offset,limit:o?.limit??1e3}})}async function uo(e){return e.options?.ledgerVersion!==void 0?P(e):S(async()=>P(e),`module-${e.accountAddress}-${e.moduleName}`,1e3*60*5)()}async function P(e){let{aptosConfig:n,accountAddress:t,moduleName:o,options:r}=e,{data:s}=await g({aptosConfig:n,originMethod:"getModule",path:`accounts/${c.from(t).toString()}/module/${o}`,params:{ledger_version:r?.ledgerVersion}});return s}async function go(e){let{aptosConfig:n,accountAddress:t,options:o}=e;return A({aptosConfig:n,originMethod:"getTransactions",path:`accounts/${c.from(t).toString()}/transactions`,params:{start:o?.offset,limit:o?.limit}})}async function Ao(e){let{aptosConfig:n,accountAddress:t,options:o}=e;return A({aptosConfig:n,originMethod:"getResources",path:`accounts/${c.from(t).toString()}/resources`,params:{ledger_version:o?.ledgerVersion,start:o?.offset,limit:o?.limit??999}})}async function K(e){let{aptosConfig:n,accountAddress:t,resourceType:o,options:r}=e,{data:s}=await g({aptosConfig:n,originMethod:"getResource",path:`accounts/${c.from(t).toString()}/resource/${o}`,params:{ledger_version:r?.ledgerVersion}});return s.data}async function Q(e){let{aptosConfig:n,authenticationKey:t,options:o}=e,r=await K({aptosConfig:n,accountAddress:"0x1",resourceType:"0x1::account::OriginatingAddress",options:o}),{address_map:{handle:s}}=r,a=c.from(t);try{let i=await b({aptosConfig:n,handle:s,data:{key:a.toString(),key_type:"address",value_type:"address"},options:o});return c.from(i)}catch(i){if(i instanceof l&&i.data.error_code==="table_item_not_found")return a;throw i}}async function po(e){let{aptosConfig:n,accountAddress:t}=e,r={owner_address:{_eq:c.from(t).toStringLong()},amount:{_gt:0}},a=await d({aptosConfig:n,query:{query:q,variables:{where_condition:r}},originMethod:"getAccountTokensCount"});return a.current_token_ownerships_v2_aggregate.aggregate?a.current_token_ownerships_v2_aggregate.aggregate.count:0}async function fo(e){let{aptosConfig:n,accountAddress:t,options:o}=e,s={owner_address:{_eq:c.from(t).toStringLong()},amount:{_gt:0}};o?.tokenStandard&&(s.token_standard={_eq:o?.tokenStandard});let a={query:T,variables:{where_condition:s,offset:o?.offset,limit:o?.limit,order_by:o?.orderBy}};return(await d({aptosConfig:n,query:a,originMethod:"getAccountOwnedTokens"})).current_token_ownerships_v2}async function lo(e){let{aptosConfig:n,accountAddress:t,collectionAddress:o,options:r}=e,s=c.from(t).toStringLong(),a=c.from(o).toStringLong(),i={owner_address:{_eq:s},current_token_data:{collection_id:{_eq:a}},amount:{_gt:0}};r?.tokenStandard&&(i.token_standard={_eq:r?.tokenStandard});let u={query:O,variables:{where_condition:i,offset:r?.offset,limit:r?.limit,order_by:r?.orderBy}};return(await d({aptosConfig:n,query:u,originMethod:"getAccountOwnedTokensFromCollectionAddress"})).current_token_ownerships_v2}async function yo(e){let{aptosConfig:n,accountAddress:t,options:o}=e,s={owner_address:{_eq:c.from(t).toStringLong()},amount:{_gt:0}};o?.tokenStandard&&(s.current_collection={token_standard:{_eq:o?.tokenStandard}});let a={query:w,variables:{where_condition:s,offset:o?.offset,limit:o?.limit,order_by:o?.orderBy}};return(await d({aptosConfig:n,query:a,originMethod:"getAccountCollectionsWithOwnedTokens"})).current_collection_ownership_v2_view}async function mo(e){let{aptosConfig:n,accountAddress:t}=e,o=c.from(t).toStringLong(),s=await d({aptosConfig:n,query:{query:v,variables:{address:o}},originMethod:"getAccountTransactionsCount"});return s.account_transactions_aggregate.aggregate?s.account_transactions_aggregate.aggregate.count:0}async function _o(e){let{aptosConfig:n,accountAddress:t,coinType:o}=e,r=c.from(t).toStringLong(),s=await I({aptosConfig:n,accountAddress:r,options:{where:{asset_type:{_eq:o}}}});return s[0]?s[0].amount:0}async function I(e){let{aptosConfig:n,accountAddress:t,options:o}=e,r=c.from(t).toStringLong(),s={...o?.where,owner_address:{_eq:r}},a={query:h,variables:{where_condition:s,offset:o?.offset,limit:o?.limit,order_by:o?.orderBy}};return(await d({aptosConfig:n,query:a,originMethod:"getAccountCoinsData"})).current_fungible_asset_balances}async function Co(e){let{aptosConfig:n,accountAddress:t}=e,o=c.from(t).toStringLong(),s=await d({aptosConfig:n,query:{query:C,variables:{address:o}},originMethod:"getAccountCoinsCount"});if(!s.current_fungible_asset_balances_aggregate.aggregate)throw Error("Failed to get the count of account coins");return s.current_fungible_asset_balances_aggregate.aggregate.count}async function ho(e){let{aptosConfig:n,accountAddress:t,options:o}=e,s={owner_address:{_eq:c.from(t).toStringLong()}},a={query:k,variables:{where_condition:s,offset:o?.offset,limit:o?.limit,order_by:o?.orderBy}};return(await d({aptosConfig:n,query:a,originMethod:"getAccountOwnedObjects"})).current_objects}async function wo(e){let{aptosConfig:n,privateKey:t}=e,o=new _(t.publicKey());if(t instanceof m){let s=p.fromPublicKeyAndScheme({publicKey:o,scheme:2}).derivedAddress();return f.fromPrivateKeyAndAddress({privateKey:t,address:s})}if(t instanceof y){let r=p.fromPublicKeyAndScheme({publicKey:o,scheme:2});if(await G({authKey:r,aptosConfig:n})){let u=r.derivedAddress();return f.fromPrivateKeyAndAddress({privateKey:t,address:u,legacy:!1})}let a=p.fromPublicKeyAndScheme({publicKey:o,scheme:0});if(await G({authKey:a,aptosConfig:n})){let u=a.derivedAddress();return f.fromPrivateKeyAndAddress({privateKey:t,address:u,legacy:!0})}}throw new Error(`Can't derive account from private key ${t}`)}async function G(e){let{aptosConfig:n,authKey:t}=e,o=await Q({aptosConfig:n,authenticationKey:t.derivedAddress()});try{return await M({aptosConfig:n,accountAddress:o}),!0}catch(r){if(r.status===404)return!1;throw new Error(`Error while looking for an account info ${o.toString()}`)}}export{M as a,io as b,uo as c,go as d,Ao as e,K as f,Q as g,po as h,fo as i,lo as j,yo as k,mo as l,_o as m,I as n,Co as o,ho as p,wo as q,G as r};
2
+ //# sourceMappingURL=chunk-R3SAAJ2N.mjs.map
@@ -1,2 +1,2 @@
1
- import{a as o,b as s,c as t,d as r,e as n,f as i,g as a,i as g,j as c}from"./chunk-OT2UDMUU.mjs";var u=class{constructor(e){this.config=e}async getLedgerInfo(){return o({aptosConfig:this.config})}async getChainId(){return(await this.getLedgerInfo()).chain_id}async getBlockByVersion(e){return s({aptosConfig:this.config,...e})}async getBlockByHeight(e){return t({aptosConfig:this.config,...e})}async getTableItem(e){return r({aptosConfig:this.config,...e})}async view(e){return n({aptosConfig:this.config,...e})}async getChainTopUserTransactions(e){return i({aptosConfig:this.config,...e})}async queryIndexer(e){return a({aptosConfig:this.config,...e})}async getIndexerLastSuccessVersion(){return g({aptosConfig:this.config})}async getProcessorStatus(e){return c({aptosConfig:this.config,processorType:e})}};export{u as a};
2
- //# sourceMappingURL=chunk-VQ7LYNMD.mjs.map
1
+ import{a as o,b as s,c as t,d as r,e as n,f as i,g as a,i as g,j as c}from"./chunk-SR7XLV76.mjs";var u=class{constructor(e){this.config=e}async getLedgerInfo(){return o({aptosConfig:this.config})}async getChainId(){return(await this.getLedgerInfo()).chain_id}async getBlockByVersion(e){return s({aptosConfig:this.config,...e})}async getBlockByHeight(e){return t({aptosConfig:this.config,...e})}async getTableItem(e){return r({aptosConfig:this.config,...e})}async view(e){return n({aptosConfig:this.config,...e})}async getChainTopUserTransactions(e){return i({aptosConfig:this.config,...e})}async queryIndexer(e){return a({aptosConfig:this.config,...e})}async getIndexerLastSuccessVersion(){return g({aptosConfig:this.config})}async getProcessorStatus(e){return c({aptosConfig:this.config,processorType:e})}};export{u as a};
2
+ //# sourceMappingURL=chunk-R4APGSSC.mjs.map
@@ -1,2 +1,2 @@
1
- import{e as d,j as m}from"./chunk-LR65XHSF.mjs";import{a as p,b as g,c as h}from"./chunk-PXTMLJKO.mjs";import{b as s}from"./chunk-NL72WE3E.mjs";import{sha3_256 as f}from"@noble/hashes/sha3";import{secp256k1 as o}from"@noble/curves/secp256k1";import{HDKey as H}from"@scure/bip32";var i=class i extends p{constructor(e){super();let t=s.fromHexInput(e);if(t.toUint8Array().length!==i.LENGTH)throw new Error(`PublicKey length should be ${i.LENGTH}`);this.key=t}toUint8Array(){return this.key.toUint8Array()}toString(){return this.key.toString()}verifySignature(e){let{message:t,signature:a}=e,y=s.fromHexInput(t).toUint8Array(),v=f(y),x=a.toUint8Array();return o.verify(x,v,this.toUint8Array())}serialize(e){e.serializeBytes(this.key.toUint8Array())}static deserialize(e){let t=e.deserializeBytes();return new i(t)}static load(e){let t=e.deserializeBytes();return new i(t)}static isPublicKey(e){return e instanceof i}};i.LENGTH=65;var u=i,r=class r extends g{constructor(e){super();let t=s.fromHexInput(e);if(t.toUint8Array().length!==r.LENGTH)throw new Error(`PrivateKey length should be ${r.LENGTH}`);this.key=t}toUint8Array(){return this.key.toUint8Array()}toString(){return this.key.toString()}sign(e){let t=s.fromHexInput(e),a=f(t.toUint8Array()),y=o.sign(a,this.key.toUint8Array());return new c(y.toCompactRawBytes())}serialize(e){e.serializeBytes(this.toUint8Array())}static deserialize(e){let t=e.deserializeBytes();return new r(t)}static generate(){let e=o.utils.randomPrivateKey();return new r(e)}publicKey(){let e=o.getPublicKey(this.key.toUint8Array(),!1);return new u(e)}static fromDerivationPath(e,t){if(!d(e))throw new Error(`Invalid derivation path ${e}`);return r.fromDerivationPathInner(e,m(t))}static fromDerivationPathInner(e,t){let{privateKey:a}=H.fromMasterSeed(t).derive(e);if(a===null)throw new Error("Invalid key");return new r(a)}static isPrivateKey(e){return e instanceof r}};r.LENGTH=32;var S=r,n=class n extends h{constructor(e){super();let t=s.fromHexInput(e);if(t.toUint8Array().length!==n.LENGTH)throw new Error(`Signature length should be ${n.LENGTH}, recieved ${t.toUint8Array().length}`);this.data=t}toUint8Array(){return this.data.toUint8Array()}toString(){return this.data.toString()}serialize(e){e.serializeBytes(this.data.toUint8Array())}static deserialize(e){let t=e.deserializeBytes();return new n(t)}static load(e){let t=e.deserializeBytes();return new n(t)}static isSignature(e){return e instanceof n}};n.LENGTH=64;var c=n;export{u as a,S as b,c};
2
- //# sourceMappingURL=chunk-3F5WV6US.mjs.map
1
+ import{e as d,j as m}from"./chunk-LR65XHSF.mjs";import{a as p,b as g,c as h}from"./chunk-EHJEK7FU.mjs";import{b as s}from"./chunk-NL72WE3E.mjs";import{sha3_256 as f}from"@noble/hashes/sha3";import{secp256k1 as o}from"@noble/curves/secp256k1";import{HDKey as H}from"@scure/bip32";var i=class i extends p{constructor(e){super();let t=s.fromHexInput(e);if(t.toUint8Array().length!==i.LENGTH)throw new Error(`PublicKey length should be ${i.LENGTH}`);this.key=t}toUint8Array(){return this.key.toUint8Array()}toString(){return this.key.toString()}verifySignature(e){let{message:t,signature:a}=e,y=s.fromHexInput(t).toUint8Array(),v=f(y),x=a.toUint8Array();return o.verify(x,v,this.toUint8Array())}serialize(e){e.serializeBytes(this.key.toUint8Array())}static deserialize(e){let t=e.deserializeBytes();return new i(t)}static load(e){let t=e.deserializeBytes();return new i(t)}static isPublicKey(e){return e instanceof i}};i.LENGTH=65;var u=i,r=class r extends g{constructor(e){super();let t=s.fromHexInput(e);if(t.toUint8Array().length!==r.LENGTH)throw new Error(`PrivateKey length should be ${r.LENGTH}`);this.key=t}toUint8Array(){return this.key.toUint8Array()}toString(){return this.key.toString()}sign(e){let t=s.fromHexInput(e),a=f(t.toUint8Array()),y=o.sign(a,this.key.toUint8Array());return new c(y.toCompactRawBytes())}serialize(e){e.serializeBytes(this.toUint8Array())}static deserialize(e){let t=e.deserializeBytes();return new r(t)}static generate(){let e=o.utils.randomPrivateKey();return new r(e)}publicKey(){let e=o.getPublicKey(this.key.toUint8Array(),!1);return new u(e)}static fromDerivationPath(e,t){if(!d(e))throw new Error(`Invalid derivation path ${e}`);return r.fromDerivationPathInner(e,m(t))}static fromDerivationPathInner(e,t){let{privateKey:a}=H.fromMasterSeed(t).derive(e);if(a===null)throw new Error("Invalid key");return new r(a)}static isPrivateKey(e){return e instanceof r}};r.LENGTH=32;var S=r,n=class n extends h{constructor(e){super();let t=s.fromHexInput(e);if(t.toUint8Array().length!==n.LENGTH)throw new Error(`Signature length should be ${n.LENGTH}, recieved ${t.toUint8Array().length}`);this.data=t}toUint8Array(){return this.data.toUint8Array()}toString(){return this.data.toString()}serialize(e){e.serializeBytes(this.data.toUint8Array())}static deserialize(e){let t=e.deserializeBytes();return new n(t)}static load(e){let t=e.deserializeBytes();return new n(t)}static isSignature(e){return e instanceof n}};n.LENGTH=64;var c=n;export{u as a,S as b,c};
2
+ //# sourceMappingURL=chunk-RCYWJZR4.mjs.map
@@ -0,0 +1,2 @@
1
+ import{a as A}from"./chunk-AS7RX4RK.mjs";import{a as T}from"./chunk-BV6SCEXY.mjs";import{a as d}from"./chunk-OU4MEM5F.mjs";import{a as h}from"./chunk-6MKBROIC.mjs";import{d as p,e as a,h as m,i as f,j as y}from"./chunk-VBUKPN4Q.mjs";import{a as s,b as r,c as e,d as c,e as u,f as g}from"./chunk-BUM2FIHF.mjs";var P=class{constructor(n){this.config=n,this.build=new T(this.config),this.simulate=new d(this.config),this.submit=new h(this.config)}async getTransactions(n){return s({aptosConfig:this.config,...n})}async getTransactionByVersion(n){return e({aptosConfig:this.config,...n})}async getTransactionByHash(n){return c({aptosConfig:this.config,...n})}async isPendingTransaction(n){return u({aptosConfig:this.config,...n})}async waitForTransaction(n){return g({aptosConfig:this.config,...n})}async getGasPriceEstimation(){return r({aptosConfig:this.config})}getSigningMessage(n){return p(n)}async publishPackageTransaction(n){return f({aptosConfig:this.config,...n})}async rotateAuthKey(n){return y({aptosConfig:this.config,...n})}sign(n){return a({...n})}signAsFeePayer(n){let{signer:t,transaction:o}=n;if(!o.feePayerAddress)throw new Error(`Transaction ${o} is not a Fee Payer transaction`);return o.feePayerAddress=t.accountAddress,a({signer:t,transaction:o})}async batchTransactionsForSingleAccount(n){try{let{sender:t,data:o,options:l}=n,i=new A(this.config,t);i.start();for(let w of o)await i.push(w,l)}catch(t){throw new Error(`failed to submit transactions with error: ${t}`)}}async signAndSubmitTransaction(n){let{signer:t,transaction:o}=n;return m({aptosConfig:this.config,signer:t,transaction:o})}};export{P as a};
2
+ //# sourceMappingURL=chunk-SI6QMT4N.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/api/transaction.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { AptosConfig } from \"./aptosConfig\";\nimport {\n getGasPriceEstimation,\n getTransactionByHash,\n getTransactionByVersion,\n getTransactions,\n isTransactionPending,\n waitForTransaction,\n} from \"../internal/transaction\";\nimport {\n AnyNumber,\n CommittedTransactionResponse,\n GasEstimation,\n HexInput,\n PaginationArgs,\n PendingTransactionResponse,\n TransactionResponse,\n WaitForTransactionOptions,\n} from \"../types\";\nimport {\n getSigningMessage,\n publicPackageTransaction,\n rotateAuthKey,\n signAndSubmitTransaction,\n signTransaction,\n} from \"../internal/transactionSubmission\";\nimport {\n AccountAuthenticator,\n AnyRawTransaction,\n InputGenerateTransactionOptions,\n InputGenerateTransactionPayloadData,\n SimpleTransaction,\n} from \"../transactions\";\nimport { AccountAddressInput, Account, PrivateKey } from \"../core\";\nimport { TransactionWorker } from \"../transactions/management\";\nimport { Build } from \"./transactionSubmission/build\";\nimport { Simulate } from \"./transactionSubmission/simulate\";\nimport { Submit } from \"./transactionSubmission/submit\";\n\nexport class Transaction {\n readonly config: AptosConfig;\n\n readonly build: Build;\n\n readonly simulate: Simulate;\n\n readonly submit: Submit;\n\n constructor(config: AptosConfig) {\n this.config = config;\n this.build = new Build(this.config);\n this.simulate = new Simulate(this.config);\n this.submit = new Submit(this.config);\n }\n\n /**\n * Queries on-chain transactions. This function will not return pending\n * transactions. For that, use `getTransactionsByHash`.\n *\n * @param args.options.offset The number transaction to start with\n * @param args.options.limit Number of results to return\n *\n * @returns Array of on-chain transactions\n */\n async getTransactions(args?: { options?: PaginationArgs }): Promise<TransactionResponse[]> {\n return getTransactions({\n aptosConfig: this.config,\n ...args,\n });\n }\n\n /**\n * Queries on-chain transaction by version. This function will not return pending transactions.\n *\n * @param args.ledgerVersion - Transaction version is an unsigned 64-bit number.\n * @returns On-chain transaction. Only on-chain transactions have versions, so this\n * function cannot be used to query pending transactions.\n */\n async getTransactionByVersion(args: { ledgerVersion: AnyNumber }): Promise<TransactionResponse> {\n return getTransactionByVersion({\n aptosConfig: this.config,\n ...args,\n });\n }\n\n /**\n * Queries on-chain transaction by transaction hash. This function will return pending transactions.\n * @param args.transactionHash - Transaction hash should be hex-encoded bytes string with 0x prefix.\n * @returns Transaction from mempool (pending) or on-chain (committed) transaction\n */\n async getTransactionByHash(args: { transactionHash: HexInput }): Promise<TransactionResponse> {\n return getTransactionByHash({\n aptosConfig: this.config,\n ...args,\n });\n }\n\n /**\n * Defines if specified transaction is currently in pending state\n *\n * To create a transaction hash:\n *\n * 1. Create a hash message from the bytes: \"Aptos::Transaction\" bytes + the BCS-serialized Transaction bytes.\n * 2. Apply hash algorithm SHA3-256 to the hash message bytes.\n * 3. Hex-encode the hash bytes with 0x prefix.\n *\n * @param args.transactionHash A hash of transaction\n * @returns `true` if transaction is in pending state and `false` otherwise\n */\n async isPendingTransaction(args: { transactionHash: HexInput }): Promise<boolean> {\n return isTransactionPending({\n aptosConfig: this.config,\n ...args,\n });\n }\n\n /**\n * Waits for a transaction to move past the pending state.\n *\n * There are 4 cases.\n * 1. Transaction is successfully processed and committed to the chain.\n * - The function will resolve with the transaction response from the API.\n * 2. Transaction is rejected for some reason, and is therefore not committed to the blockchain.\n * - The function will throw an AptosApiError with an HTTP status code indicating some problem with the request.\n * 3. Transaction is committed but execution failed, meaning no changes were\n * written to the blockchain state.\n * - If `checkSuccess` is true, the function will throw a FailedTransactionError\n * If `checkSuccess` is false, the function will resolve with the transaction response where the `success` field is false.\n * 4. Transaction does not move past the pending state within `args.options.timeoutSecs` seconds.\n * - The function will throw a WaitForTransactionError\n *\n *\n * @param args.transactionHash The hash of a transaction previously submitted to the blockchain.\n * @param args.options.timeoutSecs Timeout in seconds. Defaults to 20 seconds.\n * @param args.options.checkSuccess A boolean which controls whether the function will error if the transaction failed.\n * Defaults to true. See case 3 above.\n * @returns The transaction on-chain. See above for more details.\n */\n async waitForTransaction(args: {\n transactionHash: HexInput;\n options?: WaitForTransactionOptions;\n }): Promise<CommittedTransactionResponse> {\n return waitForTransaction({\n aptosConfig: this.config,\n ...args,\n });\n }\n\n /**\n * Gives an estimate of the gas unit price required to get a\n * transaction on chain in a reasonable amount of time.\n * For more information {@link https://fullnode.mainnet.aptoslabs.com/v1/spec#/operations/estimate_gas_price}\n *\n * @returns Object holding the outputs of the estimate gas API\n * @example\n * ```\n * {\n * gas_estimate: number;\n * deprioritized_gas_estimate?: number;\n * prioritized_gas_estimate?: number;\n * }\n * ```\n */\n async getGasPriceEstimation(): Promise<GasEstimation> {\n return getGasPriceEstimation({\n aptosConfig: this.config,\n });\n }\n\n /**\n * Returns a signing message for a transaction.\n *\n * This allows a user to sign a transaction using their own preferred signing method, and\n * then submit it to the network.\n * @param args.transaction A raw transaction for signing elsewhere\n */\n // eslint-disable-next-line class-methods-use-this\n getSigningMessage(args: { transaction: AnyRawTransaction }): Uint8Array {\n return getSigningMessage(args);\n }\n\n /**\n * Generates a transaction to publish a move package to chain.\n *\n * To get the `metadataBytes` and `byteCode`, can compile using Aptos CLI with command\n * `aptos move compile --save-metadata ...`,\n * For more info {@link https://aptos.dev/tutorials/your-first-dapp/#step-4-publish-a-move-module}\n *\n * @param args.account The publisher account\n * @param args.metadataBytes The package metadata bytes\n * @param args.moduleBytecode An array of the bytecode of each module in the package in compiler output order\n *\n * @returns A SimpleTransaction that can be simulated or submitted to chain\n */\n async publishPackageTransaction(args: {\n account: AccountAddressInput;\n metadataBytes: HexInput;\n moduleBytecode: Array<HexInput>;\n options?: InputGenerateTransactionOptions;\n }): Promise<SimpleTransaction> {\n return publicPackageTransaction({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Rotate an account's auth key. After rotation, only the new private key can be used to sign txns for\n * the account.\n * Note: Only legacy Ed25519 scheme is supported for now.\n * More info: {@link https://aptos.dev/guides/account-management/key-rotation/}\n * @param args.fromAccount The account to rotate the auth key for\n * @param args.toNewPrivateKey The new private key to rotate to\n *\n * @returns PendingTransactionResponse\n */\n async rotateAuthKey(args: { fromAccount: Account; toNewPrivateKey: PrivateKey }): Promise<TransactionResponse> {\n return rotateAuthKey({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Sign a transaction that can later be submitted to chain\n *\n * @param args.signer The signer account\n * @param args.transaction A raw transaction to sign on\n *\n * @returns AccountAuthenticator\n */\n // eslint-disable-next-line class-methods-use-this\n sign(args: { signer: Account; transaction: AnyRawTransaction }): AccountAuthenticator {\n return signTransaction({\n ...args,\n });\n }\n\n /**\n * Sign a transaction as a fee payer that can later be submitted to chain\n *\n * @param args.signer The fee payer signer account\n * @param args.transaction A raw transaction to sign on\n *\n * @returns AccountAuthenticator\n */\n // eslint-disable-next-line class-methods-use-this\n signAsFeePayer(args: { signer: Account; transaction: AnyRawTransaction }): AccountAuthenticator {\n const { signer, transaction } = args;\n\n // if transaction doesnt hold a \"feePayerAddress\" prop it means\n // this is not a fee payer transaction\n if (!transaction.feePayerAddress) {\n throw new Error(`Transaction ${transaction} is not a Fee Payer transaction`);\n }\n\n // Set the feePayerAddress to the signer account address\n transaction.feePayerAddress = signer.accountAddress;\n\n return signTransaction({\n signer,\n transaction,\n });\n }\n\n // TRANSACTION SUBMISSION //\n\n /**\n * Batch transactions for a single account.\n *\n * This function uses a transaction worker that receives payloads to be processed\n * and submitted to chain.\n * Note that this process is best for submitting multiple transactions that\n * dont rely on each other, i.e batch funds, batch token mints, etc.\n *\n * If any worker failure, the functions throws an error.\n *\n * @param args.sender The sender account to sign and submit the transaction\n * @param args.data An array of transaction payloads\n * @param args.options optional. Transaction generation configurations (excluding accountSequenceNumber)\n *\n * @return void. Throws if any error\n */\n async batchTransactionsForSingleAccount(args: {\n sender: Account;\n data: InputGenerateTransactionPayloadData[];\n options?: Omit<InputGenerateTransactionOptions, \"accountSequenceNumber\">;\n }): Promise<void> {\n try {\n const { sender, data, options } = args;\n const transactionWorker = new TransactionWorker(this.config, sender);\n\n transactionWorker.start();\n\n for (const d of data) {\n /* eslint-disable no-await-in-loop */\n await transactionWorker.push(d, options);\n }\n } catch (error: any) {\n throw new Error(`failed to submit transactions with error: ${error}`);\n }\n }\n\n /**\n * Sign and submit a single signer transaction to chain\n *\n * @param args.signer The signer account to sign the transaction\n * @param args.transaction 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 *\n * @return PendingTransactionResponse\n */\n async signAndSubmitTransaction(args: {\n signer: Account;\n transaction: AnyRawTransaction;\n }): Promise<PendingTransactionResponse> {\n const { signer, transaction } = args;\n return signAndSubmitTransaction({\n aptosConfig: this.config,\n signer,\n transaction,\n });\n }\n}\n"],"mappings":"qTA0CO,IAAMA,EAAN,KAAkB,CASvB,YAAYC,EAAqB,CAC/B,KAAK,OAASA,EACd,KAAK,MAAQ,IAAIC,EAAM,KAAK,MAAM,EAClC,KAAK,SAAW,IAAIC,EAAS,KAAK,MAAM,EACxC,KAAK,OAAS,IAAIC,EAAO,KAAK,MAAM,CACtC,CAWA,MAAM,gBAAgBC,EAAqE,CACzF,OAAOC,EAAgB,CACrB,YAAa,KAAK,OAClB,GAAGD,CACL,CAAC,CACH,CASA,MAAM,wBAAwBA,EAAkE,CAC9F,OAAOE,EAAwB,CAC7B,YAAa,KAAK,OAClB,GAAGF,CACL,CAAC,CACH,CAOA,MAAM,qBAAqBA,EAAmE,CAC5F,OAAOG,EAAqB,CAC1B,YAAa,KAAK,OAClB,GAAGH,CACL,CAAC,CACH,CAcA,MAAM,qBAAqBA,EAAuD,CAChF,OAAOI,EAAqB,CAC1B,YAAa,KAAK,OAClB,GAAGJ,CACL,CAAC,CACH,CAwBA,MAAM,mBAAmBA,EAGiB,CACxC,OAAOK,EAAmB,CACxB,YAAa,KAAK,OAClB,GAAGL,CACL,CAAC,CACH,CAiBA,MAAM,uBAAgD,CACpD,OAAOM,EAAsB,CAC3B,YAAa,KAAK,MACpB,CAAC,CACH,CAUA,kBAAkBN,EAAsD,CACtE,OAAOO,EAAkBP,CAAI,CAC/B,CAeA,MAAM,0BAA0BA,EAKD,CAC7B,OAAOQ,EAAyB,CAAE,YAAa,KAAK,OAAQ,GAAGR,CAAK,CAAC,CACvE,CAYA,MAAM,cAAcA,EAA2F,CAC7G,OAAOS,EAAc,CAAE,YAAa,KAAK,OAAQ,GAAGT,CAAK,CAAC,CAC5D,CAWA,KAAKA,EAAiF,CACpF,OAAOU,EAAgB,CACrB,GAAGV,CACL,CAAC,CACH,CAWA,eAAeA,EAAiF,CAC9F,GAAM,CAAE,OAAAW,EAAQ,YAAAC,CAAY,EAAIZ,EAIhC,GAAI,CAACY,EAAY,gBACf,MAAM,IAAI,MAAM,eAAeA,CAAW,iCAAiC,EAI7E,OAAAA,EAAY,gBAAkBD,EAAO,eAE9BD,EAAgB,CACrB,OAAAC,EACA,YAAAC,CACF,CAAC,CACH,CAoBA,MAAM,kCAAkCZ,EAItB,CAChB,GAAI,CACF,GAAM,CAAE,OAAAa,EAAQ,KAAAC,EAAM,QAAAC,CAAQ,EAAIf,EAC5BgB,EAAoB,IAAIC,EAAkB,KAAK,OAAQJ,CAAM,EAEnEG,EAAkB,MAAM,EAExB,QAAWE,KAAKJ,EAEd,MAAME,EAAkB,KAAKE,EAAGH,CAAO,CAE3C,OAASI,EAAY,CACnB,MAAM,IAAI,MAAM,6CAA6CA,CAAK,EAAE,CACtE,CACF,CAiBA,MAAM,yBAAyBnB,EAGS,CACtC,GAAM,CAAE,OAAAW,EAAQ,YAAAC,CAAY,EAAIZ,EAChC,OAAOoB,EAAyB,CAC9B,YAAa,KAAK,OAClB,OAAAT,EACA,YAAAC,CACF,CAAC,CACH,CACF","names":["Transaction","config","Build","Simulate","Submit","args","getTransactions","getTransactionByVersion","getTransactionByHash","isTransactionPending","waitForTransaction","getGasPriceEstimation","getSigningMessage","publicPackageTransaction","rotateAuthKey","signTransaction","signer","transaction","sender","data","options","transactionWorker","TransactionWorker","d","error","signAndSubmitTransaction"]}
@@ -1,2 +1,2 @@
1
- import{a as u}from"./chunk-WTGGCH34.mjs";import{a as K}from"./chunk-AZUWHKN5.mjs";import{a as n}from"./chunk-KZSJ5MFF.mjs";import{a as d,b as y}from"./chunk-3F5WV6US.mjs";import{a as p,b as o}from"./chunk-UW6HQ643.mjs";import{b as l}from"./chunk-NL72WE3E.mjs";var g=class a{constructor(t){let{privateKey:e,address:i,legacy:r}=t,c=r??!0;if(this.publicKey=e.publicKey(),this.publicKey instanceof p)c?this.signingScheme=0:(this.publicKey=new n(this.publicKey),this.signingScheme=2);else if(this.publicKey instanceof K)this.signingScheme=1;else if(this.publicKey instanceof d)this.publicKey=new n(this.publicKey),this.signingScheme=2;else throw new Error("Can not create new Account, unsupported public key type");this.privateKey=e,this.accountAddress=i}static generate(t){let e=t?.legacy??!0,i,r;switch(t?.scheme){case 2:i=y.generate(),r=new n(i.publicKey());break;default:i=o.generate(),e===!1?r=new n(i.publicKey()):r=i.publicKey()}let s=u.fromPublicKey({publicKey:r}).derivedAddress();return new a({privateKey:i,address:s,legacy:t?.legacy})}static fromPrivateKey(t){let{privateKey:e,legacy:i}=t,r=i??!0,c;if(e instanceof y)c=new n(e.publicKey());else if(e instanceof o)r?c=e.publicKey():c=new n(e.publicKey());else throw new Error(`Unsupported private key ${e}`);let m=u.fromPublicKey({publicKey:c}).derivedAddress();return new a({privateKey:e,address:m,legacy:r})}static fromPrivateKeyAndAddress(t){let{privateKey:e,address:i,legacy:r}=t;return new a({privateKey:e,address:i,legacy:r})}static fromDerivationPath(t){let{path:e,mnemonic:i,scheme:r,legacy:c}=t,s;switch(r){case 2:s=y.fromDerivationPath(e,i);break;case 0:s=o.fromDerivationPath(e,i);break;default:throw new Error(`Unsupported scheme ${r}`)}return a.fromPrivateKey({privateKey:s,legacy:c})}static authKey(t){let{publicKey:e}=t;return u.fromPublicKey({publicKey:e})}sign(t){return this.privateKey.sign(t)}verifySignature(t){let{message:e,signature:i}=t,r=l.fromHexInput(e).toUint8Array();return this.publicKey.verifySignature({message:r,signature:i})}};export{g as a};
2
- //# sourceMappingURL=chunk-SSJQOXEP.mjs.map
1
+ import{a as u}from"./chunk-N25GOEVL.mjs";import{a as K}from"./chunk-4K252UDE.mjs";import{a as n}from"./chunk-OWP2MKTX.mjs";import{a as d,b as y}from"./chunk-RCYWJZR4.mjs";import{a as p,b as o}from"./chunk-5HZKDT5C.mjs";import{b as l}from"./chunk-NL72WE3E.mjs";var g=class a{constructor(t){let{privateKey:e,address:i,legacy:r}=t,c=r??!0;if(this.publicKey=e.publicKey(),this.publicKey instanceof p)c?this.signingScheme=0:(this.publicKey=new n(this.publicKey),this.signingScheme=2);else if(this.publicKey instanceof K)this.signingScheme=1;else if(this.publicKey instanceof d)this.publicKey=new n(this.publicKey),this.signingScheme=2;else throw new Error("Can not create new Account, unsupported public key type");this.privateKey=e,this.accountAddress=i}static generate(t){let e=t?.legacy??!0,i,r;switch(t?.scheme){case 2:i=y.generate(),r=new n(i.publicKey());break;default:i=o.generate(),e===!1?r=new n(i.publicKey()):r=i.publicKey()}let s=u.fromPublicKey({publicKey:r}).derivedAddress();return new a({privateKey:i,address:s,legacy:t?.legacy})}static fromPrivateKey(t){let{privateKey:e,legacy:i}=t,r=i??!0,c;if(e instanceof y)c=new n(e.publicKey());else if(e instanceof o)r?c=e.publicKey():c=new n(e.publicKey());else throw new Error(`Unsupported private key ${e}`);let m=u.fromPublicKey({publicKey:c}).derivedAddress();return new a({privateKey:e,address:m,legacy:r})}static fromPrivateKeyAndAddress(t){let{privateKey:e,address:i,legacy:r}=t;return new a({privateKey:e,address:i,legacy:r})}static fromDerivationPath(t){let{path:e,mnemonic:i,scheme:r,legacy:c}=t,s;switch(r){case 2:s=y.fromDerivationPath(e,i);break;case 0:s=o.fromDerivationPath(e,i);break;default:throw new Error(`Unsupported scheme ${r}`)}return a.fromPrivateKey({privateKey:s,legacy:c})}static authKey(t){let{publicKey:e}=t;return u.fromPublicKey({publicKey:e})}sign(t){return this.privateKey.sign(t)}verifySignature(t){let{message:e,signature:i}=t,r=l.fromHexInput(e).toUint8Array();return this.publicKey.verifySignature({message:r,signature:i})}};export{g as a};
2
+ //# sourceMappingURL=chunk-SMN2QQ4Q.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/core/account.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { AccountAddress } from \"./accountAddress\";\nimport { AuthenticationKey } from \"./authenticationKey\";\nimport { PrivateKey, PublicKey, Signature } from \"./crypto/asymmetricCrypto\";\nimport { Ed25519PrivateKey, Ed25519PublicKey } from \"./crypto/ed25519\";\nimport { MultiEd25519PublicKey } from \"./crypto/multiEd25519\";\nimport { Secp256k1PrivateKey, Secp256k1PublicKey } from \"./crypto/secp256k1\";\nimport { Hex } from \"./hex\";\nimport { GenerateAccount, HexInput, SigningScheme, SigningSchemeInput } from \"../types\";\nimport { AnyPublicKey } from \"./crypto/anyPublicKey\";\n\n/**\n * Class for creating and managing account on Aptos network\n *\n * Use this class to create accounts, sign transactions, and more.\n * Note: Creating an account instance does not create the account on-chain.\n *\n * Since [AIP-55](https://github.com/aptos-foundation/AIPs/pull/263) Aptos supports\n * `Legacy` and `Unified` authentications.\n *\n * @Legacy includes `ED25519` and `MultiED25519`\n * @Unified includes `SingleSender` and `MultiSender`, where currently\n * `SingleSender` supports `ED25519` and `Secp256k1`, and `MultiSender` supports\n * `MultiED25519`.\n *\n * In TypeScript SDK, we support all of these options:\n *\n * @generate default to generate Legacy Ed25519 keys, with an optional `legacy` boolean argument\n * that lets you generate new keys conforming to the Unified authentication.\n *\n * @fromPrivateKey derives an account by a provided private key and address, with an optional\n * `legacy` boolean argument that lets you generate new keys conforming to the Unified authentication.\n *\n * @fromDerivationPath derives an account with bip44 path and mnemonics,\n *\n */\nexport class Account {\n /**\n * Public key associated with the account\n */\n readonly publicKey: PublicKey;\n\n /**\n * Private key associated with the account\n */\n readonly privateKey: PrivateKey;\n\n /**\n * Account address associated with the account\n */\n readonly accountAddress: AccountAddress;\n\n /**\n * Signing scheme used to sign transactions\n */\n readonly signingScheme: SigningScheme;\n\n /**\n * constructor for Account\n *\n * Need to update this to use the new crypto library if new schemes are added.\n *\n * @param args.privateKey PrivateKey - private key of the account\n * @param args.address AccountAddress - address of the account\n * @param args.legacy optional. If set to false, the keypair authentication keys will be derived with a unified scheme.\n * Defaults to deriving an authentication key with the legacy scheme.\n *\n * This method is private because it should only be called by the factory static methods.\n * @returns Account\n */\n private constructor(args: { privateKey: PrivateKey; address: AccountAddress; legacy?: boolean }) {\n const { privateKey, address, legacy } = args;\n const useLegacy = legacy ?? true;\n\n // Derive the public key from the private key\n this.publicKey = privateKey.publicKey();\n\n // Derive the signing scheme from the public key\n if (this.publicKey instanceof Ed25519PublicKey) {\n if (useLegacy) {\n this.signingScheme = SigningScheme.Ed25519;\n } else {\n this.publicKey = new AnyPublicKey(this.publicKey);\n this.signingScheme = SigningScheme.SingleKey;\n }\n } else if (this.publicKey instanceof MultiEd25519PublicKey) {\n this.signingScheme = SigningScheme.MultiEd25519;\n } else if (this.publicKey instanceof Secp256k1PublicKey) {\n this.publicKey = new AnyPublicKey(this.publicKey);\n this.signingScheme = SigningScheme.SingleKey;\n } else {\n throw new Error(\"Can not create new Account, unsupported public key type\");\n }\n\n this.privateKey = privateKey;\n this.accountAddress = address;\n }\n\n /**\n * Derives an account with random private key and address.\n *\n * Default generation is using the Legacy ED25519 key\n *\n * @param args optional. Unify GenerateAccount type for Legacy and Unified keys\n *\n * Account input type to generate an account using Legacy\n * Ed25519 or MultiEd25519 keys or without a specified `scheme`.\n * ```\n * GenerateAccountWithLegacyKey = {\n * scheme?: SigningSchemeInput.Ed25519 | SigningSchemeInput.MultiEd25519;\n * legacy: true;\n * };\n * ```\n *\n * Account input type to generate an account using Unified\n * Secp256k1Ecdsa key\n * In this case `legacy` is always false\n * ```\n * GenerateAccountWithUnifiedKey = {\n * scheme: SigningSchemeInput.Secp256k1Ecdsa;\n * legacy?: false;\n * };\n * ```\n *\n * @returns Account with the given signing scheme\n */\n static generate(args?: GenerateAccount): Account {\n const useLegacy = args?.legacy ?? true;\n\n let privateKey: PrivateKey;\n let publicKey: PublicKey;\n\n switch (args?.scheme) {\n case SigningSchemeInput.Secp256k1Ecdsa:\n privateKey = Secp256k1PrivateKey.generate();\n publicKey = new AnyPublicKey(privateKey.publicKey());\n break;\n default:\n privateKey = Ed25519PrivateKey.generate();\n if (useLegacy === false) {\n publicKey = new AnyPublicKey(privateKey.publicKey());\n } else {\n publicKey = privateKey.publicKey();\n }\n }\n const authKey = AuthenticationKey.fromPublicKey({ publicKey });\n\n const address = authKey.derivedAddress();\n return new Account({ privateKey, address, legacy: args?.legacy });\n }\n\n /**\n * Instantiates an account given a private key.\n *\n * This is used as a local calculation and therefore is used to instantiate an `Account`\n * that has not had its authentication key rotated.\n *\n * @param privateKey PrivateKey - private key of the account\n * @param args.legacy optional. If set to false, the keypair generated is a Unified keypair. Defaults\n * to generating a Legacy Ed25519 keypair\n *\n * @returns Account\n */\n static fromPrivateKey(args: { privateKey: PrivateKey; legacy?: boolean }): Account {\n const { privateKey, legacy } = args;\n const useLegacy = legacy ?? true;\n\n let publicKey;\n if (privateKey instanceof Secp256k1PrivateKey) {\n // Secp256k1 single sender\n publicKey = new AnyPublicKey(privateKey.publicKey());\n } else if (privateKey instanceof Ed25519PrivateKey) {\n // legacy Ed25519\n if (useLegacy) {\n publicKey = privateKey.publicKey();\n } else {\n // Ed25519 single sender\n publicKey = new AnyPublicKey(privateKey.publicKey());\n }\n } else {\n throw new Error(`Unsupported private key ${privateKey}`);\n }\n\n const authKey = AuthenticationKey.fromPublicKey({ publicKey });\n const address = authKey.derivedAddress();\n return new Account({ privateKey, address, legacy: useLegacy });\n }\n\n /**\n * Instantiates an account given a private key and a specified account address.\n * This is primarily used to instantiate an `Account` that has had its authentication key rotated.\n *\n * @param args.privateKey PrivateKey - the underlying private key for the account\n * @param args.address AccountAddress - The account address the `Account` will sign for\n * @param args.legacy optional. If set to false, the keypair generated is a Unified keypair. Defaults\n * to generating a Legacy Ed25519 keypair\n *\n * @returns Account\n */\n static fromPrivateKeyAndAddress(args: {\n privateKey: PrivateKey;\n address: AccountAddress;\n legacy?: boolean;\n }): Account {\n const { privateKey, address, legacy } = args;\n return new Account({ privateKey, address, legacy });\n }\n\n /**\n * Derives an account with bip44 path and mnemonics,\n *\n * @param args.scheme The signing scheme to derive with\n * @param args.path the BIP44 derive hardened path (e.g. m/44'/637'/0'/0'/0') for Ed25519,\n * or non-hardened path (e.g. m/44'/637'/0'/0/0) for secp256k1\n * Detailed description: {@link https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki}\n * @param args.mnemonic the mnemonic seed phrase of the account\n * @param args.legacy optional. If set to false, the keypair generated is a Unified keypair. Defaults\n * to generating a Legacy Ed25519 keypair\n *\n * @returns Account\n */\n static fromDerivationPath(args: {\n scheme: SigningSchemeInput;\n path: string;\n mnemonic: string;\n legacy?: boolean;\n }): Account {\n const { path, mnemonic, scheme, legacy } = args;\n let privateKey: PrivateKey;\n switch (scheme) {\n case SigningSchemeInput.Secp256k1Ecdsa:\n privateKey = Secp256k1PrivateKey.fromDerivationPath(path, mnemonic);\n break;\n case SigningSchemeInput.Ed25519:\n privateKey = Ed25519PrivateKey.fromDerivationPath(path, mnemonic);\n break;\n default:\n throw new Error(`Unsupported scheme ${scheme}`);\n }\n return Account.fromPrivateKey({ privateKey, legacy });\n }\n\n /**\n * This key enables account owners to rotate their private key(s)\n * associated with the account without changing the address that hosts their account.\n * See here for more info: {@link https://aptos.dev/concepts/accounts#single-signer-authentication}\n *\n * @param args.publicKey PublicKey - public key of the account\n * @returns The authentication key for the associated account\n */\n static authKey(args: { publicKey: PublicKey }): AuthenticationKey {\n const { publicKey } = args;\n return AuthenticationKey.fromPublicKey({ publicKey });\n }\n\n /**\n * Sign the given message with the private key.\n *\n * TODO: Add sign transaction or specific types\n *\n * @param data in HexInput format\n * @returns Signature\n */\n sign(data: HexInput): Signature {\n return this.privateKey.sign(data);\n }\n\n /**\n * Verify the given message and signature with the public key.\n *\n * @param args.message raw message data in HexInput format\n * @param args.signature signed message Signature\n * @returns\n */\n verifySignature(args: { message: HexInput; signature: Signature }): boolean {\n const { message, signature } = args;\n const rawMessage = Hex.fromHexInput(message).toUint8Array();\n return this.publicKey.verifySignature({ message: rawMessage, signature });\n }\n}\n"],"mappings":"oQAsCO,IAAMA,EAAN,MAAMC,CAAQ,CAkCX,YAAYC,EAA6E,CAC/F,GAAM,CAAE,WAAAC,EAAY,QAAAC,EAAS,OAAAC,CAAO,EAAIH,EAClCI,EAAYD,GAAU,GAM5B,GAHA,KAAK,UAAYF,EAAW,UAAU,EAGlC,KAAK,qBAAqBI,EACxBD,EACF,KAAK,cAAgB,GAErB,KAAK,UAAY,IAAIE,EAAa,KAAK,SAAS,EAChD,KAAK,cAAgB,WAEd,KAAK,qBAAqBC,EACnC,KAAK,cAAgB,UACZ,KAAK,qBAAqBC,EACnC,KAAK,UAAY,IAAIF,EAAa,KAAK,SAAS,EAChD,KAAK,cAAgB,MAErB,OAAM,IAAI,MAAM,yDAAyD,EAG3E,KAAK,WAAaL,EAClB,KAAK,eAAiBC,CACxB,CA8BA,OAAO,SAASF,EAAiC,CAC/C,IAAMI,EAAYJ,GAAM,QAAU,GAE9BC,EACAQ,EAEJ,OAAQT,GAAM,OAAQ,CACpB,OACEC,EAAaS,EAAoB,SAAS,EAC1CD,EAAY,IAAIH,EAAaL,EAAW,UAAU,CAAC,EACnD,MACF,QACEA,EAAaU,EAAkB,SAAS,EACpCP,IAAc,GAChBK,EAAY,IAAIH,EAAaL,EAAW,UAAU,CAAC,EAEnDQ,EAAYR,EAAW,UAAU,CAEvC,CAGA,IAAMC,EAFUU,EAAkB,cAAc,CAAE,UAAAH,CAAU,CAAC,EAErC,eAAe,EACvC,OAAO,IAAIV,EAAQ,CAAE,WAAAE,EAAY,QAAAC,EAAS,OAAQF,GAAM,MAAO,CAAC,CAClE,CAcA,OAAO,eAAeA,EAA6D,CACjF,GAAM,CAAE,WAAAC,EAAY,OAAAE,CAAO,EAAIH,EACzBI,EAAYD,GAAU,GAExBM,EACJ,GAAIR,aAAsBS,EAExBD,EAAY,IAAIH,EAAaL,EAAW,UAAU,CAAC,UAC1CA,aAAsBU,EAE3BP,EACFK,EAAYR,EAAW,UAAU,EAGjCQ,EAAY,IAAIH,EAAaL,EAAW,UAAU,CAAC,MAGrD,OAAM,IAAI,MAAM,2BAA2BA,CAAU,EAAE,EAIzD,IAAMC,EADUU,EAAkB,cAAc,CAAE,UAAAH,CAAU,CAAC,EACrC,eAAe,EACvC,OAAO,IAAIV,EAAQ,CAAE,WAAAE,EAAY,QAAAC,EAAS,OAAQE,CAAU,CAAC,CAC/D,CAaA,OAAO,yBAAyBJ,EAIpB,CACV,GAAM,CAAE,WAAAC,EAAY,QAAAC,EAAS,OAAAC,CAAO,EAAIH,EACxC,OAAO,IAAID,EAAQ,CAAE,WAAAE,EAAY,QAAAC,EAAS,OAAAC,CAAO,CAAC,CACpD,CAeA,OAAO,mBAAmBH,EAKd,CACV,GAAM,CAAE,KAAAa,EAAM,SAAAC,EAAU,OAAAC,EAAQ,OAAAZ,CAAO,EAAIH,EACvCC,EACJ,OAAQc,EAAQ,CACd,OACEd,EAAaS,EAAoB,mBAAmBG,EAAMC,CAAQ,EAClE,MACF,OACEb,EAAaU,EAAkB,mBAAmBE,EAAMC,CAAQ,EAChE,MACF,QACE,MAAM,IAAI,MAAM,sBAAsBC,CAAM,EAAE,CAClD,CACA,OAAOhB,EAAQ,eAAe,CAAE,WAAAE,EAAY,OAAAE,CAAO,CAAC,CACtD,CAUA,OAAO,QAAQH,EAAmD,CAChE,GAAM,CAAE,UAAAS,CAAU,EAAIT,EACtB,OAAOY,EAAkB,cAAc,CAAE,UAAAH,CAAU,CAAC,CACtD,CAUA,KAAKO,EAA2B,CAC9B,OAAO,KAAK,WAAW,KAAKA,CAAI,CAClC,CASA,gBAAgBhB,EAA4D,CAC1E,GAAM,CAAE,QAAAiB,EAAS,UAAAC,CAAU,EAAIlB,EACzBmB,EAAaC,EAAI,aAAaH,CAAO,EAAE,aAAa,EAC1D,OAAO,KAAK,UAAU,gBAAgB,CAAE,QAASE,EAAY,UAAAD,CAAU,CAAC,CAC1E,CACF","names":["Account","_Account","args","privateKey","address","legacy","useLegacy","Ed25519PublicKey","AnyPublicKey","MultiEd25519PublicKey","Secp256k1PublicKey","publicKey","Secp256k1PrivateKey","Ed25519PrivateKey","AuthenticationKey","path","mnemonic","scheme","data","message","signature","rawMessage","Hex"]}
@@ -0,0 +1,2 @@
1
+ var o="1.1.0";export{o as a};
2
+ //# sourceMappingURL=chunk-SODP7NAK.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 = \"0.0.8\";\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.1.0\";\n"],"mappings":"AAQO,IAAMA,EAAU","names":["VERSION"]}
@@ -1,2 +1,2 @@
1
- import{m as g,v as i}from"./chunk-BQSE5HHW.mjs";import{b as n}from"./chunk-JI2BBZ2W.mjs";import{b as a,c}from"./chunk-HC5VMNXA.mjs";async function l(o){let{aptosConfig:e}=o,{data:t}=await n({aptosConfig:e,originMethod:"getLedgerInfo",path:""});return t}async function h(o){let{aptosConfig:e,ledgerVersion:t,options:s}=o,{data:r}=await n({aptosConfig:e,originMethod:"getBlockByVersion",path:`blocks/by_version/${t}`,params:{with_transactions:s?.withTransactions}});return r}async function m(o){let{aptosConfig:e,blockHeight:t,options:s}=o,{data:r}=await n({aptosConfig:e,originMethod:"getBlockByHeight",path:`blocks/by_height/${t}`,params:{with_transactions:s?.withTransactions}});return r}async function C(o){let{aptosConfig:e,handle:t,data:s,options:r}=o;return(await a({aptosConfig:e,originMethod:"getTableItem",path:`tables/${t}/item`,params:{ledger_version:r?.ledgerVersion},body:s})).data}async function T(o){let{aptosConfig:e,payload:t,options:s}=o,{data:r}=await a({aptosConfig:e,originMethod:"view",path:"view",params:{ledger_version:s?.ledgerVersion},body:{function:t.function,type_arguments:t.typeArguments??[],arguments:t.functionArguments??[]}});return r}async function q(o){let{aptosConfig:e,limit:t}=o;return(await p({aptosConfig:e,query:{query:g,variables:{limit:t}},originMethod:"getChainTopUserTransactions"})).user_transactions}async function p(o){let{aptosConfig:e,query:t,originMethod:s}=o,{data:r}=await c({aptosConfig:e,originMethod:s??"queryIndexer",path:"",body:t,overrides:{WITH_CREDENTIALS:!1}});return r}async function f(o){let{aptosConfig:e}=o;return(await p({aptosConfig:e,query:{query:i},originMethod:"getProcessorStatuses"})).processor_status}async function w(o){return(await f({aptosConfig:o.aptosConfig}))[0].last_success_version}async function A(o){let{aptosConfig:e,processorType:t}=o,s={processor:{_eq:t.valueOf()}};return(await p({aptosConfig:e,query:{query:i,variables:{where_condition:s}},originMethod:"getProcessorStatus"})).processor_status[0]}export{l as a,h as b,m as c,C as d,T as e,q as f,p as g,f as h,w as i,A as j};
2
- //# sourceMappingURL=chunk-OT2UDMUU.mjs.map
1
+ import{m as g,v as i}from"./chunk-BQSE5HHW.mjs";import{b as n}from"./chunk-UZB7CTLX.mjs";import{b as a,c}from"./chunk-ZLYSA7JR.mjs";async function l(o){let{aptosConfig:e}=o,{data:t}=await n({aptosConfig:e,originMethod:"getLedgerInfo",path:""});return t}async function h(o){let{aptosConfig:e,ledgerVersion:t,options:s}=o,{data:r}=await n({aptosConfig:e,originMethod:"getBlockByVersion",path:`blocks/by_version/${t}`,params:{with_transactions:s?.withTransactions}});return r}async function m(o){let{aptosConfig:e,blockHeight:t,options:s}=o,{data:r}=await n({aptosConfig:e,originMethod:"getBlockByHeight",path:`blocks/by_height/${t}`,params:{with_transactions:s?.withTransactions}});return r}async function C(o){let{aptosConfig:e,handle:t,data:s,options:r}=o;return(await a({aptosConfig:e,originMethod:"getTableItem",path:`tables/${t}/item`,params:{ledger_version:r?.ledgerVersion},body:s})).data}async function T(o){let{aptosConfig:e,payload:t,options:s}=o,{data:r}=await a({aptosConfig:e,originMethod:"view",path:"view",params:{ledger_version:s?.ledgerVersion},body:{function:t.function,type_arguments:t.typeArguments??[],arguments:t.functionArguments??[]}});return r}async function q(o){let{aptosConfig:e,limit:t}=o;return(await p({aptosConfig:e,query:{query:g,variables:{limit:t}},originMethod:"getChainTopUserTransactions"})).user_transactions}async function p(o){let{aptosConfig:e,query:t,originMethod:s}=o,{data:r}=await c({aptosConfig:e,originMethod:s??"queryIndexer",path:"",body:t,overrides:{WITH_CREDENTIALS:!1}});return r}async function f(o){let{aptosConfig:e}=o;return(await p({aptosConfig:e,query:{query:i},originMethod:"getProcessorStatuses"})).processor_status}async function w(o){return(await f({aptosConfig:o.aptosConfig}))[0].last_success_version}async function A(o){let{aptosConfig:e,processorType:t}=o,s={processor:{_eq:t.valueOf()}};return(await p({aptosConfig:e,query:{query:i,variables:{where_condition:s}},originMethod:"getProcessorStatus"})).processor_status[0]}export{l as a,h as b,m as c,C as d,T as e,q as f,p as g,f as h,w as i,A as j};
2
+ //# sourceMappingURL=chunk-SR7XLV76.mjs.map
@@ -1,2 +1,2 @@
1
- import{g as e}from"./chunk-GEZSEAL5.mjs";async function m(o){if(o.minimumLedgerVersion!==void 0){let r=[];for(let i of o.processorTypes)r.push(e({aptosConfig:o.config,minimumLedgerVersion:o.minimumLedgerVersion,processorType:i}));await Promise.all(r)}}export{m as a};
2
- //# sourceMappingURL=chunk-APSQ4M23.mjs.map
1
+ import{g as e}from"./chunk-BUM2FIHF.mjs";async function m(o){if(o.minimumLedgerVersion!==void 0){let r=[];for(let i of o.processorTypes)r.push(e({aptosConfig:o.config,minimumLedgerVersion:o.minimumLedgerVersion,processorType:i}));await Promise.all(r)}}export{m as a};
2
+ //# sourceMappingURL=chunk-T3ID6KFN.mjs.map
@@ -1,2 +1,2 @@
1
- import{a as o}from"./chunk-TZ623H2V.mjs";var t=class{constructor(n){this.config=n}async transferCoinTransaction(n){return o({aptosConfig:this.config,...n})}};export{t as a};
2
- //# sourceMappingURL=chunk-5UY5OKXR.mjs.map
1
+ import{a as o}from"./chunk-LUCDRB52.mjs";var t=class{constructor(n){this.config=n}async transferCoinTransaction(n){return o({aptosConfig:this.config,...n})}};export{t as a};
2
+ //# sourceMappingURL=chunk-TCSN7PYL.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/api/coin.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { Account, AccountAddressInput } from \"../core\";\nimport { transferCoinTransaction } from \"../internal/coin\";\nimport { SimpleTransaction, InputGenerateTransactionOptions } from \"../transactions/types\";\nimport { AnyNumber, MoveStructId } from \"../types\";\nimport { AptosConfig } from \"./aptosConfig\";\n\n/**\n * A class to handle all `Coin` operations\n */\nexport class Coin {\n constructor(readonly config: AptosConfig) {}\n\n /**\n * Generate a transfer coin transaction that can be simulated and/or signed and submitted\n *\n * @param args.sender The sender account\n * @param args.recipient The recipient address\n * @param args.amount The amount to transfer\n * @param args.coinType optional. The coin struct type to transfer. Defaults to 0x1::aptos_coin::AptosCoin\n *\n * @returns SimpleTransaction\n */\n async transferCoinTransaction(args: {\n sender: Account;\n recipient: AccountAddressInput;\n amount: AnyNumber;\n coinType?: MoveStructId;\n options?: InputGenerateTransactionOptions;\n }): Promise<SimpleTransaction> {\n return transferCoinTransaction({ aptosConfig: this.config, ...args });\n }\n}\n"],"mappings":"yCAYO,IAAMA,EAAN,KAAW,CAChB,YAAqBC,EAAqB,CAArB,YAAAA,CAAsB,CAY3C,MAAM,wBAAwBC,EAMC,CAC7B,OAAOC,EAAwB,CAAE,YAAa,KAAK,OAAQ,GAAGD,CAAK,CAAC,CACtE,CACF","names":["Coin","config","args","transferCoinTransaction"]}
@@ -0,0 +1,2 @@
1
+ import{a as u}from"./chunk-VBUKPN4Q.mjs";import{b as w}from"./chunk-UR5E2UDO.mjs";import{e as A,g}from"./chunk-SR7XLV76.mjs";import{t as f}from"./chunk-BQSE5HHW.mjs";var E=["A name must be between 3 and 63 characters long,","and can only contain lowercase a-z, 0-9, and hyphens.","A name may not start or end with a hyphen."].join(" ");function D(e){return!(!e||e.length<3||e.length>63||!/^[a-z\d][a-z\d-]{1,61}[a-z\d]$/.test(e))}function c(e){let[n,t,...o]=e.replace(/\.apt$/,"").split(".");if(o.length>0)throw new Error(`${e} is invalid. A name can only have two parts, a domain and a subdomain separated by a "."`);if(!D(n))throw new Error(`${n} is not valid. ${E}`);if(t&&!D(t))throw new Error(`${t} is not valid. ${E}`);return{domainName:t||n,subdomainName:t?n:void 0}}var Y="0x37368b46ce665362562c6d1d4ec01a08c8644c488690df5a17e13ba163e20221",G="0x585fc9f0f0c54183b039ffc770ca282ebd87307916c215a3e692f2f8e4305e82",O={testnet:"0x5f8fd2347449685cf41d4db97926ec3a096eaf381332be4f1318ad4d16a8497c",mainnet:"0x867ed1f6bf916171b1de3ee92849b8978b7d1b9e0a8cc982a3d19d535dfd9c0c",local:G,custom:null,devnet:null};function d(e){let n=O[e.network];if(!n)throw new Error(`The ANS contract is not deployed to ${e.network}`);return n}var P=e=>({vec:[e]}),I=()=>({vec:[]}),S=e=>e!=null?P(e):I(),b=e=>{if(e&&typeof e=="object"&&"vec"in e&&Array.isArray(e.vec))return e.vec[0]};async function K(e){let{aptosConfig:n,name:t}=e,o=d(n),{domainName:r,subdomainName:s}=c(t),i=await A({aptosConfig:n,payload:{function:`${o}::router::get_owner_addr`,functionArguments:[r,S(s)]}}),a=b(i[0]);return a?w.from(a).toString():void 0}async function W(e){let{aptosConfig:n,expiration:t,name:o,sender:r,targetAddress:s,toAddress:i,options:a,transferable:m}=e,p=d(n),{domainName:l,subdomainName:N}=c(o),x=t.policy==="subdomain:independent"||t.policy==="subdomain:follow-domain";if(N&&!x)throw new Error("Subdomains must have an expiration policy of either 'subdomain:independent' or 'subdomain:follow-domain'");if(x&&!N)throw new Error(`Policy is set to ${t.policy} but no subdomain was provided`);if(t.policy==="domain"){let T=t.years??1;if(T!==1)throw new Error("For now, names can only be registered for 1 year at a time");let v=T*31536e3;return await u({aptosConfig:n,sender:r.accountAddress.toString(),data:{function:`${p}::router::register_domain`,functionArguments:[l,v,s,i]},options:a})}if(!N)throw new Error(`${t.policy} requires a subdomain to be provided.`);let _=await q({aptosConfig:n,name:l});if(!_)throw new Error("The domain does not exist");let h=t.policy==="subdomain:independent"?t.expirationDate:_;if(h>_)throw new Error("The subdomain expiration time cannot be greater than the domain expiration time");return await u({aptosConfig:n,sender:r.accountAddress.toString(),data:{function:`${p}::router::register_subdomain`,functionArguments:[l,N,Math.round(h/1e3),t.policy==="subdomain:follow-domain"?1:0,!!m,s,i]},options:a})}async function q(e){let{aptosConfig:n,name:t}=e,o=d(n),{domainName:r,subdomainName:s}=c(t);try{let i=await A({aptosConfig:n,payload:{function:`${o}::router::get_expiration`,functionArguments:[r,S(s)]}});return Number(i[0])*1e3}catch{return}}async function F(e){let{aptosConfig:n,address:t}=e,o=d(n),r=await A({aptosConfig:n,payload:{function:`${o}::router::get_primary_name`,functionArguments:[w.from(t).toString()]}}),s=b(r[1]),i=b(r[0]);if(s)return[i,s].filter(Boolean).join(".")}async function H(e){let{aptosConfig:n,sender:t,name:o,options:r}=e,s=d(n);if(!o)return await u({aptosConfig:n,sender:t.accountAddress.toString(),data:{function:`${s}::router::clear_primary_name`,functionArguments:[]},options:r});let{domainName:i,subdomainName:a}=c(o);return await u({aptosConfig:n,sender:t.accountAddress.toString(),data:{function:`${s}::router::set_primary_name`,functionArguments:[i,a]},options:r})}async function J(e){let{aptosConfig:n,name:t}=e,o=d(n),{domainName:r,subdomainName:s}=c(t),i=await A({aptosConfig:n,payload:{function:`${o}::router::get_target_addr`,functionArguments:[r,S(s)]}}),a=b(i[0]);return a?w.from(a).toString():void 0}async function X(e){let{aptosConfig:n,sender:t,name:o,address:r,options:s}=e,i=d(n),{domainName:a,subdomainName:m}=c(o);return await u({aptosConfig:n,sender:t.accountAddress.toString(),data:{function:`${i}::router::set_target_addr`,functionArguments:[a,m,r]},options:s})}async function Z(e){let{aptosConfig:n,name:t}=e,{domainName:o,subdomainName:r=""}=c(t),a=(await g({aptosConfig:n,query:{query:f,variables:{where_condition:{domain:{_eq:o},subdomain:{_eq:r}},limit:1}},originMethod:"getName"})).current_aptos_names[0];return a&&(a=y(a)),a}async function ee(e){let{aptosConfig:n,options:t,accountAddress:o}=e,r=await C({aptosConfig:n});return(await g({aptosConfig:n,originMethod:"getAccountNames",query:{query:f,variables:{limit:t?.limit,offset:t?.offset,order_by:t?.orderBy,where_condition:{...e.options?.where??{},owner_address:{_eq:o.toString()},expiration_timestamp:{_gte:r}}}}})).current_aptos_names.map(y)}async function ne(e){let{aptosConfig:n,options:t,accountAddress:o}=e,r=await C({aptosConfig:n});return(await g({aptosConfig:n,originMethod:"getAccountDomains",query:{query:f,variables:{limit:t?.limit,offset:t?.offset,order_by:t?.orderBy,where_condition:{...e.options?.where??{},owner_address:{_eq:o.toString()},expiration_timestamp:{_gte:r},subdomain:{_eq:""}}}}})).current_aptos_names.map(y)}async function te(e){let{aptosConfig:n,options:t,accountAddress:o}=e,r=await C({aptosConfig:n});return(await g({aptosConfig:n,originMethod:"getAccountSubdomains",query:{query:f,variables:{limit:t?.limit,offset:t?.offset,order_by:t?.orderBy,where_condition:{...e.options?.where??{},owner_address:{_eq:o.toString()},expiration_timestamp:{_gte:r},subdomain:{_neq:""}}}}})).current_aptos_names.map(y)}async function oe(e){let{aptosConfig:n,options:t,domain:o}=e;return(await g({aptosConfig:n,originMethod:"getDomainSubdomains",query:{query:f,variables:{limit:t?.limit,offset:t?.offset,order_by:t?.orderBy,where_condition:{...e.options?.where??{},domain:{_eq:o},subdomain:{_neq:""}}}}})).current_aptos_names.map(y)}async function C(e){let{aptosConfig:n}=e,t=d(n),[o]=await A({aptosConfig:n,payload:{function:`${t}::config::reregistration_grace_sec`,functionArguments:[]}}),r=o/60/60/24,s=()=>new Date;return new Date(s().setDate(s().getDate()-r)).toISOString()}async function re(e){let{aptosConfig:n,sender:t,name:o,years:r=1,options:s}=e,i=d(n),a=r*31536e3,{domainName:m,subdomainName:p}=c(o);if(p)throw new Error("Subdomains cannot be renewed");if(r!==1)throw new Error("Currently, only 1 year renewals are supported");return await u({aptosConfig:n,sender:t.accountAddress.toString(),data:{function:`${i}::router::renew_domain`,functionArguments:[m,a]},options:s})}function y(e){return{...e,expiration_timestamp:new Date(e.expiration_timestamp).valueOf()}}export{E as a,D as b,c,Y as d,G as e,K as f,W as g,q as h,F as i,H as j,J as k,X as l,Z as m,ee as n,ne as o,te as p,oe as q,re as r};
2
+ //# sourceMappingURL=chunk-TTDCRLRD.mjs.map