@aptos-labs/ts-sdk 1.34.0 → 1.35.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 (419) hide show
  1. package/README.md +8 -9
  2. package/dist/common/{accountAddress-CDtCLtJA.d.ts → accountAddress-CuHovHdK.d.ts} +19 -0
  3. package/dist/common/chunk-RX5UBAME.js +4 -0
  4. package/dist/common/chunk-RX5UBAME.js.map +1 -0
  5. package/dist/common/cli/index.d.ts +1 -1
  6. package/dist/common/cli/index.js +1 -1
  7. package/dist/common/cli/index.js.map +1 -1
  8. package/dist/common/index.d.ts +489 -241
  9. package/dist/common/index.js +32 -32
  10. package/dist/common/index.js.map +1 -1
  11. package/dist/esm/account/AbstractKeylessAccount.mjs +1 -1
  12. package/dist/esm/account/AbstractedAccount.mjs +1 -1
  13. package/dist/esm/account/Account.d.mts +1 -1
  14. package/dist/esm/account/Account.mjs +1 -1
  15. package/dist/esm/account/AccountUtils.mjs +1 -1
  16. package/dist/esm/account/Ed25519Account.d.mts +2 -2
  17. package/dist/esm/account/Ed25519Account.mjs +1 -1
  18. package/dist/esm/account/EphemeralKeyPair.mjs +1 -1
  19. package/dist/esm/account/FederatedKeylessAccount.mjs +1 -1
  20. package/dist/esm/account/KeylessAccount.mjs +1 -1
  21. package/dist/esm/account/MultiEd25519Account.d.mts +108 -0
  22. package/dist/esm/account/MultiEd25519Account.mjs +2 -0
  23. package/dist/esm/account/MultiKeyAccount.d.mts +1 -2
  24. package/dist/esm/account/MultiKeyAccount.mjs +1 -1
  25. package/dist/esm/account/SingleKeyAccount.mjs +1 -1
  26. package/dist/esm/account/index.d.mts +1 -0
  27. package/dist/esm/account/index.mjs +1 -1
  28. package/dist/esm/account/utils.mjs +1 -1
  29. package/dist/esm/api/account/abstraction.mjs +1 -1
  30. package/dist/esm/api/account.d.mts +1 -1
  31. package/dist/esm/api/account.mjs +1 -1
  32. package/dist/esm/api/ans.mjs +1 -1
  33. package/dist/esm/api/aptos.d.mts +3 -1
  34. package/dist/esm/api/aptos.mjs +1 -1
  35. package/dist/esm/api/aptosConfig.mjs +1 -1
  36. package/dist/esm/api/coin.d.mts +2 -2
  37. package/dist/esm/api/coin.mjs +1 -1
  38. package/dist/esm/api/digitalAsset.mjs +1 -1
  39. package/dist/esm/api/event.mjs +1 -1
  40. package/dist/esm/api/experimental.d.mts +83 -0
  41. package/dist/esm/api/experimental.mjs +2 -0
  42. package/dist/esm/api/experimental.mjs.map +1 -0
  43. package/dist/esm/api/faucet.mjs +1 -1
  44. package/dist/esm/api/fungibleAsset.mjs +1 -1
  45. package/dist/esm/api/general.mjs +1 -1
  46. package/dist/esm/api/index.d.mts +1 -0
  47. package/dist/esm/api/index.mjs +1 -1
  48. package/dist/esm/api/keyless.mjs +1 -1
  49. package/dist/esm/api/object.mjs +1 -1
  50. package/dist/esm/api/staking.mjs +1 -1
  51. package/dist/esm/api/table.mjs +1 -1
  52. package/dist/esm/api/transaction.mjs +1 -1
  53. package/dist/esm/api/transactionSubmission/build.mjs +1 -1
  54. package/dist/esm/api/transactionSubmission/management.mjs +1 -1
  55. package/dist/esm/api/transactionSubmission/sign.mjs +1 -1
  56. package/dist/esm/api/transactionSubmission/sign.mjs.map +1 -1
  57. package/dist/esm/api/transactionSubmission/simulate.mjs +1 -1
  58. package/dist/esm/api/transactionSubmission/submit.mjs +1 -1
  59. package/dist/esm/api/utils.mjs +1 -1
  60. package/dist/esm/bcs/deserializer.mjs +1 -1
  61. package/dist/esm/bcs/index.mjs +1 -1
  62. package/dist/esm/bcs/serializable/entryFunctionBytes.mjs +1 -1
  63. package/dist/esm/bcs/serializable/fixedBytes.mjs +1 -1
  64. package/dist/esm/bcs/serializable/movePrimitives.mjs +1 -1
  65. package/dist/esm/bcs/serializable/moveStructs.mjs +1 -1
  66. package/dist/esm/bcs/serializer.mjs +1 -1
  67. package/dist/esm/{chunk-P7SE5LQE.mjs → chunk-27ESCVVC.mjs} +2 -2
  68. package/dist/esm/chunk-2SAYQUUX.mjs +2 -0
  69. package/dist/esm/chunk-2SAYQUUX.mjs.map +1 -0
  70. package/dist/esm/{chunk-UTXEW2FT.mjs → chunk-2TRQERBL.mjs} +2 -2
  71. package/dist/esm/chunk-2V636AYW.mjs +2 -0
  72. package/dist/esm/{chunk-L6FONDPA.mjs → chunk-2YKERRHD.mjs} +2 -2
  73. package/dist/esm/chunk-2ZLFQBT2.mjs +2 -0
  74. package/dist/esm/chunk-2ZLFQBT2.mjs.map +1 -0
  75. package/dist/esm/{chunk-XDIX7NIP.mjs → chunk-3LDVJ2YK.mjs} +2 -2
  76. package/dist/esm/{chunk-J7HRQ2IH.mjs → chunk-44EHAKKW.mjs} +2 -2
  77. package/dist/esm/{chunk-2FNFUTFJ.mjs → chunk-53IBOHXB.mjs} +2 -2
  78. package/dist/esm/{chunk-X6IHNXWY.mjs → chunk-5H5D6QVX.mjs} +2 -2
  79. package/dist/esm/{chunk-G4O6FXCF.mjs → chunk-5W2ERBGY.mjs} +2 -2
  80. package/dist/esm/{chunk-VOCI2675.mjs → chunk-67A5U2X6.mjs} +2 -2
  81. package/dist/esm/{chunk-XXHZQFYW.mjs → chunk-6IJZRG3U.mjs} +2 -2
  82. package/dist/esm/{chunk-N4DM5FYH.mjs → chunk-6KZT3KFZ.mjs} +2 -2
  83. package/dist/esm/chunk-752TOOCA.mjs +2 -0
  84. package/dist/esm/chunk-752TOOCA.mjs.map +1 -0
  85. package/dist/esm/{chunk-ZP5EBIBE.mjs → chunk-7A2KHJ3D.mjs} +2 -2
  86. package/dist/esm/{chunk-ROT6S6BM.mjs → chunk-7CRQNXR5.mjs} +2 -2
  87. package/dist/esm/{chunk-TM6IKHMX.mjs → chunk-7OUPEQRN.mjs} +2 -2
  88. package/dist/esm/chunk-A3VO773Q.mjs +2 -0
  89. package/dist/esm/{chunk-DWJ3PGWE.mjs → chunk-AEGA5N2W.mjs} +2 -2
  90. package/dist/esm/{chunk-BI3BTSUB.mjs → chunk-AIPHJFJL.mjs} +2 -2
  91. package/dist/esm/{chunk-HLJE5XGE.mjs → chunk-AQWKKSRN.mjs} +2 -2
  92. package/dist/esm/{chunk-D6T3NYOA.mjs → chunk-B23VO5TB.mjs} +2 -2
  93. package/dist/esm/{chunk-42T3UGSW.mjs → chunk-BHVSIRNF.mjs} +2 -2
  94. package/dist/esm/chunk-BMPHQ3E7.mjs +2 -0
  95. package/dist/esm/{chunk-EGZI6EJ2.mjs → chunk-BPHCRTHD.mjs} +2 -2
  96. package/dist/esm/{chunk-XH3BEKII.mjs → chunk-BQYKFATL.mjs} +2 -2
  97. package/dist/esm/chunk-BY3XFRUM.mjs +2 -0
  98. package/dist/esm/{chunk-EY2JUXEC.mjs.map → chunk-BY3XFRUM.mjs.map} +1 -1
  99. package/dist/esm/{chunk-DBIZE7G6.mjs → chunk-CGTMSLVZ.mjs} +2 -2
  100. package/dist/esm/{chunk-4T75XRI2.mjs → chunk-CPAAEEF4.mjs} +2 -2
  101. package/dist/esm/{chunk-DMS7K76O.mjs → chunk-CPFQUFVD.mjs} +2 -2
  102. package/dist/esm/chunk-CXLNTATW.mjs +2 -0
  103. package/dist/esm/chunk-CXLNTATW.mjs.map +1 -0
  104. package/dist/esm/{chunk-Q7RG7KQS.mjs → chunk-DAJFOJ3L.mjs} +2 -2
  105. package/dist/esm/chunk-DOVH6HPL.mjs +2 -0
  106. package/dist/esm/{chunk-U2SJIG2T.mjs → chunk-E5PAUR4N.mjs} +2 -2
  107. package/dist/esm/{chunk-6LGXFXXR.mjs → chunk-EGCL6KA6.mjs} +2 -2
  108. package/dist/esm/{chunk-TOBQ5UE6.mjs → chunk-ERLDXTIY.mjs} +2 -2
  109. package/dist/esm/{chunk-CSG67JHZ.mjs → chunk-FJ5J7CVW.mjs} +2 -2
  110. package/dist/esm/{chunk-DLLDRANJ.mjs → chunk-FOEPRHAC.mjs} +2 -2
  111. package/dist/esm/{chunk-6JTNS5O6.mjs → chunk-G5F5ZOH5.mjs} +2 -2
  112. package/dist/esm/chunk-GFPEB22G.mjs +1 -0
  113. package/dist/esm/chunk-GFPEB22G.mjs.map +1 -0
  114. package/dist/esm/{chunk-AZWVCBK2.mjs → chunk-GI4AR6DQ.mjs} +2 -2
  115. package/dist/esm/{chunk-Y3Y4DVCK.mjs → chunk-GRRBXHVG.mjs} +2 -2
  116. package/dist/esm/{chunk-HT2WC3QV.mjs → chunk-GTVMJJQQ.mjs} +2 -2
  117. package/dist/esm/{chunk-HL2O3T57.mjs → chunk-GU4MD5ST.mjs} +2 -2
  118. package/dist/esm/chunk-H4YAL2IL.mjs +2 -0
  119. package/dist/esm/{chunk-X24PSWCX.mjs → chunk-HBTJN4RJ.mjs} +2 -2
  120. package/dist/esm/{chunk-IDTLNF4M.mjs → chunk-HHWJHOFZ.mjs} +2 -2
  121. package/dist/esm/{chunk-OURSLL3I.mjs → chunk-HKL4MFNL.mjs} +2 -2
  122. package/dist/esm/{chunk-G6RLN6ET.mjs → chunk-HVIF6DW6.mjs} +2 -2
  123. package/dist/esm/{chunk-VKDTI6NX.mjs → chunk-HYJQHVDZ.mjs} +2 -2
  124. package/dist/esm/chunk-HYJQHVDZ.mjs.map +1 -0
  125. package/dist/esm/{chunk-XAPQNCTN.mjs → chunk-ILUFGYLO.mjs} +2 -2
  126. package/dist/esm/{chunk-ABXES4FS.mjs → chunk-IMYNN4TW.mjs} +2 -2
  127. package/dist/esm/{chunk-2GIPNLDO.mjs → chunk-IOHESHLR.mjs} +2 -2
  128. package/dist/esm/{chunk-GQX5KMF7.mjs → chunk-JNNFNYDO.mjs} +2 -2
  129. package/dist/esm/{chunk-3HFZN7L5.mjs → chunk-K233I26C.mjs} +2 -2
  130. package/dist/esm/{chunk-AC3BISWL.mjs → chunk-KK5HUWF6.mjs} +2 -2
  131. package/dist/esm/chunk-KSLLV3ZC.mjs +2 -0
  132. package/dist/esm/chunk-KSLLV3ZC.mjs.map +1 -0
  133. package/dist/esm/{chunk-N7C6LQPZ.mjs → chunk-L6KVC7CJ.mjs} +2 -2
  134. package/dist/esm/{chunk-Q4C4U6I4.mjs → chunk-LQOSHBB7.mjs} +2 -2
  135. package/dist/esm/{chunk-XKUIMGKU.mjs → chunk-LS3IDL2N.mjs} +2 -2
  136. package/dist/esm/{chunk-HFCWJ6QL.mjs → chunk-MAWGZICD.mjs} +2 -2
  137. package/dist/esm/{chunk-JF66JS2R.mjs → chunk-MFLHAVIW.mjs} +2 -2
  138. package/dist/esm/chunk-OLGEN23M.mjs +2 -0
  139. package/dist/esm/{chunk-4UK4MUSD.mjs → chunk-ONGH5DXZ.mjs} +2 -2
  140. package/dist/esm/{chunk-4776UXL6.mjs → chunk-OPD5EKOA.mjs} +2 -2
  141. package/dist/esm/{chunk-V2EXS6TM.mjs → chunk-P5CM4C2G.mjs} +2 -2
  142. package/dist/esm/{chunk-BBUN4IO4.mjs → chunk-PC25RPDV.mjs} +2 -2
  143. package/dist/esm/{chunk-N6YTF76Q.mjs → chunk-PDAWVDI7.mjs} +2 -2
  144. package/dist/esm/chunk-PIPDQFL2.mjs +2 -0
  145. package/dist/esm/chunk-PIPDQFL2.mjs.map +1 -0
  146. package/dist/esm/{chunk-6PBMD2BQ.mjs → chunk-PWGTRRSJ.mjs} +2 -2
  147. package/dist/esm/{chunk-PWYJWTEM.mjs → chunk-PYY2RXFP.mjs} +2 -2
  148. package/dist/esm/chunk-PYY2RXFP.mjs.map +1 -0
  149. package/dist/esm/chunk-QUJM5W4L.mjs +2 -0
  150. package/dist/esm/chunk-QUJM5W4L.mjs.map +1 -0
  151. package/dist/esm/{chunk-H4GZWYIG.mjs → chunk-QYJKCRVA.mjs} +2 -2
  152. package/dist/esm/{chunk-X2CPDUOS.mjs → chunk-R6QCPXQG.mjs} +2 -2
  153. package/dist/esm/chunk-R6QCPXQG.mjs.map +1 -0
  154. package/dist/esm/{chunk-33CBJFX2.mjs → chunk-RDPWCN4B.mjs} +2 -2
  155. package/dist/esm/{chunk-MT2RJ7H3.mjs → chunk-RIINVEZA.mjs} +2 -2
  156. package/dist/esm/{chunk-EBMEXURY.mjs → chunk-RXHER6EA.mjs} +2 -2
  157. package/dist/esm/chunk-SJDHW55X.mjs +2 -0
  158. package/dist/esm/chunk-SJDHW55X.mjs.map +1 -0
  159. package/dist/esm/{chunk-KEJAUCQF.mjs → chunk-T7X4GZDU.mjs} +2 -2
  160. package/dist/esm/{chunk-BUTMGMSD.mjs → chunk-TH5JCPN2.mjs} +2 -2
  161. package/dist/esm/{chunk-ORMOQWWH.mjs → chunk-TKXEVD7A.mjs} +2 -2
  162. package/dist/esm/{chunk-FN4C3CKC.mjs → chunk-TTY5GFMN.mjs} +2 -2
  163. package/dist/esm/chunk-TWETGZ3W.mjs +2 -0
  164. package/dist/esm/chunk-TWETGZ3W.mjs.map +1 -0
  165. package/dist/esm/{chunk-PR3W2QEH.mjs → chunk-U4DEYWFT.mjs} +2 -2
  166. package/dist/esm/{chunk-7CYCKCVU.mjs → chunk-UJJGIPOA.mjs} +2 -2
  167. package/dist/esm/{chunk-ZCEBDPBJ.mjs → chunk-US2HZFOM.mjs} +2 -2
  168. package/dist/esm/{chunk-S47HA7O7.mjs → chunk-VDYUMBOT.mjs} +2 -2
  169. package/dist/esm/chunk-VHY6ZATX.mjs +2 -0
  170. package/dist/esm/chunk-VHY6ZATX.mjs.map +1 -0
  171. package/dist/esm/{chunk-TDGUMBON.mjs → chunk-VWZEJTGP.mjs} +2 -2
  172. package/dist/esm/{chunk-TDGUMBON.mjs.map → chunk-VWZEJTGP.mjs.map} +1 -1
  173. package/dist/esm/{chunk-3EY7MT2M.mjs → chunk-W2C5KRUQ.mjs} +2 -2
  174. package/dist/esm/{chunk-O37BZP2G.mjs → chunk-W4SMZ6IW.mjs} +2 -2
  175. package/dist/esm/chunk-WFKPVKU3.mjs +2 -0
  176. package/dist/esm/chunk-WFKPVKU3.mjs.map +1 -0
  177. package/dist/esm/{chunk-CXNF73OX.mjs → chunk-WHVCUVZP.mjs} +2 -2
  178. package/dist/esm/{chunk-QBFGY74I.mjs → chunk-WLDYBSOG.mjs} +2 -2
  179. package/dist/esm/{chunk-HEAWDTLG.mjs → chunk-XRVZAEQO.mjs} +2 -2
  180. package/dist/esm/chunk-XSBUL2WP.mjs +2 -0
  181. package/dist/esm/chunk-XSBUL2WP.mjs.map +1 -0
  182. package/dist/esm/{chunk-DNWFDS7F.mjs → chunk-XW3BXTCZ.mjs} +2 -2
  183. package/dist/esm/{chunk-L2AQG3G3.mjs → chunk-Y65PKZLK.mjs} +2 -2
  184. package/dist/esm/{chunk-WXDA4CCR.mjs → chunk-YAGIE4GN.mjs} +2 -2
  185. package/dist/esm/{chunk-CRFLR3ZY.mjs → chunk-YLUULY6G.mjs} +2 -2
  186. package/dist/esm/{chunk-SCBYJU6K.mjs → chunk-YWSDONJJ.mjs} +2 -2
  187. package/dist/esm/{chunk-BYHCW7MI.mjs → chunk-YXYYII5S.mjs} +2 -2
  188. package/dist/esm/{chunk-XTOIL6MB.mjs → chunk-ZD2TY5N3.mjs} +2 -2
  189. package/dist/esm/{chunk-5BSMF22B.mjs → chunk-ZS2IVRHT.mjs} +2 -2
  190. package/dist/esm/cli/index.mjs +1 -1
  191. package/dist/esm/cli/localNode.mjs +1 -1
  192. package/dist/esm/client/core.d.mts +36 -1
  193. package/dist/esm/client/core.mjs +1 -1
  194. package/dist/esm/client/get.d.mts +35 -1
  195. package/dist/esm/client/get.mjs +1 -1
  196. package/dist/esm/client/index.d.mts +3 -3
  197. package/dist/esm/client/index.mjs +1 -1
  198. package/dist/esm/client/post.d.mts +34 -1
  199. package/dist/esm/client/post.mjs +1 -1
  200. package/dist/esm/core/account/index.mjs +1 -1
  201. package/dist/esm/core/account/utils/address.mjs +1 -1
  202. package/dist/esm/core/account/utils/index.mjs +1 -1
  203. package/dist/esm/core/accountAddress.mjs +1 -1
  204. package/dist/esm/core/authenticationKey.mjs +1 -1
  205. package/dist/esm/core/crypto/abstraction.mjs +1 -1
  206. package/dist/esm/core/crypto/ed25519.mjs +1 -1
  207. package/dist/esm/core/crypto/ephemeral.mjs +1 -1
  208. package/dist/esm/core/crypto/federatedKeyless.mjs +1 -1
  209. package/dist/esm/core/crypto/index.d.mts +1 -1
  210. package/dist/esm/core/crypto/index.mjs +1 -1
  211. package/dist/esm/core/crypto/keyless.mjs +1 -1
  212. package/dist/esm/core/crypto/multiEd25519.d.mts +17 -2
  213. package/dist/esm/core/crypto/multiEd25519.mjs +1 -1
  214. package/dist/esm/core/crypto/multiKey.d.mts +33 -15
  215. package/dist/esm/core/crypto/multiKey.mjs +1 -1
  216. package/dist/esm/core/crypto/privateKey.mjs +1 -1
  217. package/dist/esm/core/crypto/proof.mjs +1 -1
  218. package/dist/esm/core/crypto/publicKey.mjs +1 -1
  219. package/dist/esm/core/crypto/secp256k1.mjs +1 -1
  220. package/dist/esm/core/crypto/signature.mjs +1 -1
  221. package/dist/esm/core/crypto/singleKey.mjs +1 -1
  222. package/dist/esm/core/crypto/utils.mjs +1 -1
  223. package/dist/esm/core/hex.mjs +1 -1
  224. package/dist/esm/core/index.d.mts +1 -1
  225. package/dist/esm/core/index.mjs +1 -1
  226. package/dist/esm/errors/index.mjs +1 -1
  227. package/dist/esm/index.d.mts +6 -4
  228. package/dist/esm/index.mjs +1 -1
  229. package/dist/esm/internal/abstraction.mjs +1 -1
  230. package/dist/esm/internal/account.mjs +1 -1
  231. package/dist/esm/internal/ans.mjs +1 -1
  232. package/dist/esm/internal/coin.mjs +1 -1
  233. package/dist/esm/internal/digitalAsset.mjs +1 -1
  234. package/dist/esm/internal/event.mjs +1 -1
  235. package/dist/esm/internal/experimental.d.mts +52 -0
  236. package/dist/esm/internal/experimental.mjs +2 -0
  237. package/dist/esm/internal/experimental.mjs.map +1 -0
  238. package/dist/esm/internal/faucet.mjs +1 -1
  239. package/dist/esm/internal/fungibleAsset.mjs +1 -1
  240. package/dist/esm/internal/general.mjs +1 -1
  241. package/dist/esm/internal/keyless.mjs +1 -1
  242. package/dist/esm/internal/object.mjs +1 -1
  243. package/dist/esm/internal/staking.mjs +1 -1
  244. package/dist/esm/internal/table.mjs +1 -1
  245. package/dist/esm/internal/transaction.mjs +1 -1
  246. package/dist/esm/internal/transactionSubmission.mjs +1 -1
  247. package/dist/esm/internal/view.mjs +1 -1
  248. package/dist/esm/transactions/authenticator/account.mjs +1 -1
  249. package/dist/esm/transactions/authenticator/index.mjs +1 -1
  250. package/dist/esm/transactions/authenticator/transaction.mjs +1 -1
  251. package/dist/esm/transactions/index.mjs +1 -1
  252. package/dist/esm/transactions/instances/chainId.mjs +1 -1
  253. package/dist/esm/transactions/instances/identifier.mjs +1 -1
  254. package/dist/esm/transactions/instances/index.mjs +1 -1
  255. package/dist/esm/transactions/instances/moduleId.mjs +1 -1
  256. package/dist/esm/transactions/instances/multiAgentTransaction.mjs +1 -1
  257. package/dist/esm/transactions/instances/rawTransaction.mjs +1 -1
  258. package/dist/esm/transactions/instances/rotationProofChallenge.mjs +1 -1
  259. package/dist/esm/transactions/instances/signedTransaction.mjs +1 -1
  260. package/dist/esm/transactions/instances/simpleTransaction.mjs +1 -1
  261. package/dist/esm/transactions/instances/transactionPayload.mjs +1 -1
  262. package/dist/esm/transactions/management/accountSequenceNumber.mjs +1 -1
  263. package/dist/esm/transactions/management/index.mjs +1 -1
  264. package/dist/esm/transactions/management/transactionWorker.mjs +1 -1
  265. package/dist/esm/transactions/scriptComposer/index.mjs +1 -1
  266. package/dist/esm/transactions/transactionBuilder/helpers.mjs +1 -1
  267. package/dist/esm/transactions/transactionBuilder/index.mjs +1 -1
  268. package/dist/esm/transactions/transactionBuilder/remoteAbi.mjs +1 -1
  269. package/dist/esm/transactions/transactionBuilder/signingMessage.mjs +1 -1
  270. package/dist/esm/transactions/transactionBuilder/transactionBuilder.d.mts +2 -2
  271. package/dist/esm/transactions/transactionBuilder/transactionBuilder.mjs +1 -1
  272. package/dist/esm/transactions/typeTag/index.mjs +1 -1
  273. package/dist/esm/transactions/typeTag/parser.mjs +1 -1
  274. package/dist/esm/types/index.mjs +1 -1
  275. package/dist/esm/types/types.d.mts +19 -0
  276. package/dist/esm/types/types.mjs +1 -1
  277. package/dist/esm/utils/helpers.mjs +1 -1
  278. package/dist/esm/utils/index.mjs +1 -1
  279. package/dist/esm/utils/normalizeBundle.mjs +1 -1
  280. package/dist/esm/version.d.mts +1 -1
  281. package/dist/esm/version.mjs +1 -1
  282. package/package.json +2 -7
  283. package/src/account/MultiEd25519Account.ts +154 -0
  284. package/src/account/MultiKeyAccount.ts +1 -2
  285. package/src/account/index.ts +1 -0
  286. package/src/api/account.ts +1 -1
  287. package/src/api/aptos.ts +6 -0
  288. package/src/api/aptosConfig.ts +2 -2
  289. package/src/api/experimental.ts +64 -0
  290. package/src/client/core.ts +120 -0
  291. package/src/client/get.ts +73 -1
  292. package/src/client/post.ts +70 -1
  293. package/src/core/crypto/multiEd25519.ts +19 -3
  294. package/src/core/crypto/multiKey.ts +76 -52
  295. package/src/core/hex.ts +3 -1
  296. package/src/internal/experimental.ts +55 -0
  297. package/src/internal/view.ts +4 -4
  298. package/src/transactions/transactionBuilder/transactionBuilder.ts +7 -0
  299. package/src/types/types.ts +20 -0
  300. package/src/version.ts +1 -1
  301. package/dist/common/chunk-ZYPBABLQ.js +0 -4
  302. package/dist/common/chunk-ZYPBABLQ.js.map +0 -1
  303. package/dist/esm/chunk-4YLUM62M.mjs +0 -2
  304. package/dist/esm/chunk-66HHRRIX.mjs +0 -2
  305. package/dist/esm/chunk-66HHRRIX.mjs.map +0 -1
  306. package/dist/esm/chunk-7C2RDOWS.mjs +0 -1
  307. package/dist/esm/chunk-7DPHPPMG.mjs +0 -2
  308. package/dist/esm/chunk-7DPHPPMG.mjs.map +0 -1
  309. package/dist/esm/chunk-DNJQWGB7.mjs +0 -2
  310. package/dist/esm/chunk-DPW6ELCQ.mjs +0 -2
  311. package/dist/esm/chunk-EMURYYVO.mjs +0 -2
  312. package/dist/esm/chunk-EY2JUXEC.mjs +0 -2
  313. package/dist/esm/chunk-F2ZTBAJJ.mjs +0 -2
  314. package/dist/esm/chunk-F2ZTBAJJ.mjs.map +0 -1
  315. package/dist/esm/chunk-I7YHK6ZF.mjs +0 -2
  316. package/dist/esm/chunk-I7YHK6ZF.mjs.map +0 -1
  317. package/dist/esm/chunk-PNSF3E67.mjs +0 -2
  318. package/dist/esm/chunk-PNSF3E67.mjs.map +0 -1
  319. package/dist/esm/chunk-PWYJWTEM.mjs.map +0 -1
  320. package/dist/esm/chunk-STY74NUA.mjs +0 -2
  321. package/dist/esm/chunk-STY74NUA.mjs.map +0 -1
  322. package/dist/esm/chunk-ULHOJ2BE.mjs +0 -2
  323. package/dist/esm/chunk-ULHOJ2BE.mjs.map +0 -1
  324. package/dist/esm/chunk-V7G2EDNR.mjs +0 -2
  325. package/dist/esm/chunk-V7G2EDNR.mjs.map +0 -1
  326. package/dist/esm/chunk-VKDTI6NX.mjs.map +0 -1
  327. package/dist/esm/chunk-WCMW2L3P.mjs +0 -2
  328. package/dist/esm/chunk-X2CPDUOS.mjs.map +0 -1
  329. package/dist/esm/chunk-XJJVJOX5.mjs +0 -2
  330. package/dist/esm/chunk-YIF242TF.mjs +0 -2
  331. package/dist/esm/chunk-YIF242TF.mjs.map +0 -1
  332. /package/dist/esm/{chunk-7C2RDOWS.mjs.map → account/MultiEd25519Account.mjs.map} +0 -0
  333. /package/dist/esm/{chunk-P7SE5LQE.mjs.map → chunk-27ESCVVC.mjs.map} +0 -0
  334. /package/dist/esm/{chunk-UTXEW2FT.mjs.map → chunk-2TRQERBL.mjs.map} +0 -0
  335. /package/dist/esm/{chunk-XJJVJOX5.mjs.map → chunk-2V636AYW.mjs.map} +0 -0
  336. /package/dist/esm/{chunk-L6FONDPA.mjs.map → chunk-2YKERRHD.mjs.map} +0 -0
  337. /package/dist/esm/{chunk-XDIX7NIP.mjs.map → chunk-3LDVJ2YK.mjs.map} +0 -0
  338. /package/dist/esm/{chunk-J7HRQ2IH.mjs.map → chunk-44EHAKKW.mjs.map} +0 -0
  339. /package/dist/esm/{chunk-2FNFUTFJ.mjs.map → chunk-53IBOHXB.mjs.map} +0 -0
  340. /package/dist/esm/{chunk-X6IHNXWY.mjs.map → chunk-5H5D6QVX.mjs.map} +0 -0
  341. /package/dist/esm/{chunk-G4O6FXCF.mjs.map → chunk-5W2ERBGY.mjs.map} +0 -0
  342. /package/dist/esm/{chunk-VOCI2675.mjs.map → chunk-67A5U2X6.mjs.map} +0 -0
  343. /package/dist/esm/{chunk-XXHZQFYW.mjs.map → chunk-6IJZRG3U.mjs.map} +0 -0
  344. /package/dist/esm/{chunk-N4DM5FYH.mjs.map → chunk-6KZT3KFZ.mjs.map} +0 -0
  345. /package/dist/esm/{chunk-ZP5EBIBE.mjs.map → chunk-7A2KHJ3D.mjs.map} +0 -0
  346. /package/dist/esm/{chunk-ROT6S6BM.mjs.map → chunk-7CRQNXR5.mjs.map} +0 -0
  347. /package/dist/esm/{chunk-TM6IKHMX.mjs.map → chunk-7OUPEQRN.mjs.map} +0 -0
  348. /package/dist/esm/{chunk-WCMW2L3P.mjs.map → chunk-A3VO773Q.mjs.map} +0 -0
  349. /package/dist/esm/{chunk-DWJ3PGWE.mjs.map → chunk-AEGA5N2W.mjs.map} +0 -0
  350. /package/dist/esm/{chunk-BI3BTSUB.mjs.map → chunk-AIPHJFJL.mjs.map} +0 -0
  351. /package/dist/esm/{chunk-HLJE5XGE.mjs.map → chunk-AQWKKSRN.mjs.map} +0 -0
  352. /package/dist/esm/{chunk-D6T3NYOA.mjs.map → chunk-B23VO5TB.mjs.map} +0 -0
  353. /package/dist/esm/{chunk-42T3UGSW.mjs.map → chunk-BHVSIRNF.mjs.map} +0 -0
  354. /package/dist/esm/{chunk-4YLUM62M.mjs.map → chunk-BMPHQ3E7.mjs.map} +0 -0
  355. /package/dist/esm/{chunk-EGZI6EJ2.mjs.map → chunk-BPHCRTHD.mjs.map} +0 -0
  356. /package/dist/esm/{chunk-XH3BEKII.mjs.map → chunk-BQYKFATL.mjs.map} +0 -0
  357. /package/dist/esm/{chunk-DBIZE7G6.mjs.map → chunk-CGTMSLVZ.mjs.map} +0 -0
  358. /package/dist/esm/{chunk-4T75XRI2.mjs.map → chunk-CPAAEEF4.mjs.map} +0 -0
  359. /package/dist/esm/{chunk-DMS7K76O.mjs.map → chunk-CPFQUFVD.mjs.map} +0 -0
  360. /package/dist/esm/{chunk-Q7RG7KQS.mjs.map → chunk-DAJFOJ3L.mjs.map} +0 -0
  361. /package/dist/esm/{chunk-DPW6ELCQ.mjs.map → chunk-DOVH6HPL.mjs.map} +0 -0
  362. /package/dist/esm/{chunk-U2SJIG2T.mjs.map → chunk-E5PAUR4N.mjs.map} +0 -0
  363. /package/dist/esm/{chunk-6LGXFXXR.mjs.map → chunk-EGCL6KA6.mjs.map} +0 -0
  364. /package/dist/esm/{chunk-TOBQ5UE6.mjs.map → chunk-ERLDXTIY.mjs.map} +0 -0
  365. /package/dist/esm/{chunk-CSG67JHZ.mjs.map → chunk-FJ5J7CVW.mjs.map} +0 -0
  366. /package/dist/esm/{chunk-DLLDRANJ.mjs.map → chunk-FOEPRHAC.mjs.map} +0 -0
  367. /package/dist/esm/{chunk-6JTNS5O6.mjs.map → chunk-G5F5ZOH5.mjs.map} +0 -0
  368. /package/dist/esm/{chunk-AZWVCBK2.mjs.map → chunk-GI4AR6DQ.mjs.map} +0 -0
  369. /package/dist/esm/{chunk-Y3Y4DVCK.mjs.map → chunk-GRRBXHVG.mjs.map} +0 -0
  370. /package/dist/esm/{chunk-HT2WC3QV.mjs.map → chunk-GTVMJJQQ.mjs.map} +0 -0
  371. /package/dist/esm/{chunk-HL2O3T57.mjs.map → chunk-GU4MD5ST.mjs.map} +0 -0
  372. /package/dist/esm/{chunk-EMURYYVO.mjs.map → chunk-H4YAL2IL.mjs.map} +0 -0
  373. /package/dist/esm/{chunk-X24PSWCX.mjs.map → chunk-HBTJN4RJ.mjs.map} +0 -0
  374. /package/dist/esm/{chunk-IDTLNF4M.mjs.map → chunk-HHWJHOFZ.mjs.map} +0 -0
  375. /package/dist/esm/{chunk-OURSLL3I.mjs.map → chunk-HKL4MFNL.mjs.map} +0 -0
  376. /package/dist/esm/{chunk-G6RLN6ET.mjs.map → chunk-HVIF6DW6.mjs.map} +0 -0
  377. /package/dist/esm/{chunk-XAPQNCTN.mjs.map → chunk-ILUFGYLO.mjs.map} +0 -0
  378. /package/dist/esm/{chunk-ABXES4FS.mjs.map → chunk-IMYNN4TW.mjs.map} +0 -0
  379. /package/dist/esm/{chunk-2GIPNLDO.mjs.map → chunk-IOHESHLR.mjs.map} +0 -0
  380. /package/dist/esm/{chunk-GQX5KMF7.mjs.map → chunk-JNNFNYDO.mjs.map} +0 -0
  381. /package/dist/esm/{chunk-3HFZN7L5.mjs.map → chunk-K233I26C.mjs.map} +0 -0
  382. /package/dist/esm/{chunk-AC3BISWL.mjs.map → chunk-KK5HUWF6.mjs.map} +0 -0
  383. /package/dist/esm/{chunk-N7C6LQPZ.mjs.map → chunk-L6KVC7CJ.mjs.map} +0 -0
  384. /package/dist/esm/{chunk-Q4C4U6I4.mjs.map → chunk-LQOSHBB7.mjs.map} +0 -0
  385. /package/dist/esm/{chunk-XKUIMGKU.mjs.map → chunk-LS3IDL2N.mjs.map} +0 -0
  386. /package/dist/esm/{chunk-HFCWJ6QL.mjs.map → chunk-MAWGZICD.mjs.map} +0 -0
  387. /package/dist/esm/{chunk-JF66JS2R.mjs.map → chunk-MFLHAVIW.mjs.map} +0 -0
  388. /package/dist/esm/{chunk-DNJQWGB7.mjs.map → chunk-OLGEN23M.mjs.map} +0 -0
  389. /package/dist/esm/{chunk-4UK4MUSD.mjs.map → chunk-ONGH5DXZ.mjs.map} +0 -0
  390. /package/dist/esm/{chunk-4776UXL6.mjs.map → chunk-OPD5EKOA.mjs.map} +0 -0
  391. /package/dist/esm/{chunk-V2EXS6TM.mjs.map → chunk-P5CM4C2G.mjs.map} +0 -0
  392. /package/dist/esm/{chunk-BBUN4IO4.mjs.map → chunk-PC25RPDV.mjs.map} +0 -0
  393. /package/dist/esm/{chunk-N6YTF76Q.mjs.map → chunk-PDAWVDI7.mjs.map} +0 -0
  394. /package/dist/esm/{chunk-6PBMD2BQ.mjs.map → chunk-PWGTRRSJ.mjs.map} +0 -0
  395. /package/dist/esm/{chunk-H4GZWYIG.mjs.map → chunk-QYJKCRVA.mjs.map} +0 -0
  396. /package/dist/esm/{chunk-33CBJFX2.mjs.map → chunk-RDPWCN4B.mjs.map} +0 -0
  397. /package/dist/esm/{chunk-MT2RJ7H3.mjs.map → chunk-RIINVEZA.mjs.map} +0 -0
  398. /package/dist/esm/{chunk-EBMEXURY.mjs.map → chunk-RXHER6EA.mjs.map} +0 -0
  399. /package/dist/esm/{chunk-KEJAUCQF.mjs.map → chunk-T7X4GZDU.mjs.map} +0 -0
  400. /package/dist/esm/{chunk-BUTMGMSD.mjs.map → chunk-TH5JCPN2.mjs.map} +0 -0
  401. /package/dist/esm/{chunk-ORMOQWWH.mjs.map → chunk-TKXEVD7A.mjs.map} +0 -0
  402. /package/dist/esm/{chunk-FN4C3CKC.mjs.map → chunk-TTY5GFMN.mjs.map} +0 -0
  403. /package/dist/esm/{chunk-PR3W2QEH.mjs.map → chunk-U4DEYWFT.mjs.map} +0 -0
  404. /package/dist/esm/{chunk-7CYCKCVU.mjs.map → chunk-UJJGIPOA.mjs.map} +0 -0
  405. /package/dist/esm/{chunk-ZCEBDPBJ.mjs.map → chunk-US2HZFOM.mjs.map} +0 -0
  406. /package/dist/esm/{chunk-S47HA7O7.mjs.map → chunk-VDYUMBOT.mjs.map} +0 -0
  407. /package/dist/esm/{chunk-3EY7MT2M.mjs.map → chunk-W2C5KRUQ.mjs.map} +0 -0
  408. /package/dist/esm/{chunk-O37BZP2G.mjs.map → chunk-W4SMZ6IW.mjs.map} +0 -0
  409. /package/dist/esm/{chunk-CXNF73OX.mjs.map → chunk-WHVCUVZP.mjs.map} +0 -0
  410. /package/dist/esm/{chunk-QBFGY74I.mjs.map → chunk-WLDYBSOG.mjs.map} +0 -0
  411. /package/dist/esm/{chunk-HEAWDTLG.mjs.map → chunk-XRVZAEQO.mjs.map} +0 -0
  412. /package/dist/esm/{chunk-DNWFDS7F.mjs.map → chunk-XW3BXTCZ.mjs.map} +0 -0
  413. /package/dist/esm/{chunk-L2AQG3G3.mjs.map → chunk-Y65PKZLK.mjs.map} +0 -0
  414. /package/dist/esm/{chunk-WXDA4CCR.mjs.map → chunk-YAGIE4GN.mjs.map} +0 -0
  415. /package/dist/esm/{chunk-CRFLR3ZY.mjs.map → chunk-YLUULY6G.mjs.map} +0 -0
  416. /package/dist/esm/{chunk-SCBYJU6K.mjs.map → chunk-YWSDONJJ.mjs.map} +0 -0
  417. /package/dist/esm/{chunk-BYHCW7MI.mjs.map → chunk-YXYYII5S.mjs.map} +0 -0
  418. /package/dist/esm/{chunk-XTOIL6MB.mjs.map → chunk-ZD2TY5N3.mjs.map} +0 -0
  419. /package/dist/esm/{chunk-5BSMF22B.mjs.map → chunk-ZS2IVRHT.mjs.map} +0 -0
@@ -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 { VERSION } from \"../version\";\nimport { AnyNumber, AptosRequest, AptosResponse, Client, ClientRequest, ClientResponse, MimeType } from \"../types\";\nimport { AptosApiType } from \"../utils\";\nimport { AptosApiError } from \"../errors\";\n\n/**\n * Sends a request using the specified options and returns the response.\n *\n * @param options - The options for the request.\n * @param options.url - The URL to send the request to.\n * @param options.method - The HTTP method to use for the request.\n * @param options.body - The body of the request.\n * @param options.contentType - The content type of the request.\n * @param options.acceptType - The accept type of the request.\n * @param options.params - The query parameters to include in the request.\n * @param options.overrides - Additional overrides for the request.\n * @param options.overrides.HEADERS - Custom headers to include in the request.\n * @param options.overrides.AUTH_TOKEN - The authorization token for the request.\n * @param options.overrides.API_KEY - The API key for the request.\n * @param options.originMethod - The origin method for the request.\n * @param client - The client used to make the request.\n *\n * @returns The response from the request.\n * @group Implementation\n * @category Client\n */\nexport async function request<Req, Res>(options: ClientRequest<Req>, client: Client): Promise<ClientResponse<Res>> {\n const { url, method, body, contentType, params, overrides, originMethod } = 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 \"x-aptos-typescript-sdk-origin-method\": originMethod,\n };\n\n if (overrides?.AUTH_TOKEN) {\n headers.Authorization = `Bearer ${overrides?.AUTH_TOKEN}`;\n }\n if (overrides?.API_KEY) {\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 * Sends a request using the specified options and returns the response.\n *\n * @param options - The options for the request.\n * @param options.url - The URL to send the request to.\n * @param options.method - The HTTP method to use for the request.\n * @param options.body - The body of the request.\n * @param options.contentType - The content type of the request.\n * @param options.acceptType - The accept type of the request.\n * @param options.params - The query parameters to include in the request.\n * @param options.overrides - Additional overrides for the request.\n * @param options.overrides.HEADERS - Custom headers to include in the request.\n * @param options.overrides.AUTH_TOKEN - The authorization token for the request.\n * @param options.overrides.API_KEY - The API key for the request.\n * @param options.originMethod - The origin method for the request.\n * @param client - The client used to make the request.\n *\n * @returns The response from the request.\n * @group Implementation\n * @category Client\n */\nexport async function binaryRequest<Req>(options: ClientRequest<Req>, client: Client): Promise<ClientResponse<Buffer>> {\n if (client.binaryProvider === undefined) {\n throw new Error(\"Binary provider is not provided\");\n }\n const { url, method, body, contentType, acceptType, params, overrides, originMethod } = 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 accept: acceptType ?? MimeType.BCS,\n \"x-aptos-typescript-sdk-origin-method\": originMethod,\n };\n\n if (overrides?.AUTH_TOKEN) {\n headers.Authorization = `Bearer ${overrides?.AUTH_TOKEN}`;\n }\n if (overrides?.API_KEY) {\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.binaryProvider<Req>({\n acceptType: MimeType.BCS,\n url,\n method,\n body,\n params,\n headers,\n overrides,\n });\n}\n\n/**\n * The main function to use when making an API request, returning the response or throwing an AptosApiError on failure.\n *\n * @param aptosRequestOpts - Options for the Aptos request, including the URL and path.\n * @param aptosConfig - The configuration information for the SDK client instance.\n * @param apiType - The type of API being accessed, which determines how the response is handled.\n * @returns The response from the API request or throws an AptosApiError if the request fails.\n * @group Implementation\n * @category Client\n */\nexport async function aptosRequest<Req extends {}, Res extends {}>(\n aptosRequestOpts: AptosRequest,\n aptosConfig: AptosConfig,\n apiType: AptosApiType,\n): Promise<AptosResponse<Req, Res>> {\n const { url, path } = aptosRequestOpts;\n const fullUrl = path ? `${url}/${path}` : url;\n const clientResponse = await request<Req, Res>({ ...aptosRequestOpts, url: fullUrl }, aptosConfig.client);\n\n const aptosResponse: AptosResponse<Req, Res> = {\n status: clientResponse.status,\n statusText: clientResponse.statusText ?? \"No status text provided\",\n data: clientResponse.data,\n headers: clientResponse.headers,\n config: clientResponse.config,\n request: clientResponse.request,\n url: fullUrl,\n };\n\n // Handle case for `Unauthorized` error (i.e. API_KEY error)\n if (aptosResponse.status === 401) {\n throw new AptosApiError({ apiType, aptosRequest: aptosRequestOpts, aptosResponse });\n }\n\n // to support both fullnode and indexer responses,\n // check if it is an indexer query, and adjust response.data\n if (apiType === AptosApiType.INDEXER) {\n const indexerResponse = aptosResponse.data as any;\n // Handle Indexer general errors\n if (indexerResponse.errors) {\n throw new AptosApiError({\n apiType,\n aptosRequest: aptosRequestOpts,\n aptosResponse,\n });\n }\n aptosResponse.data = indexerResponse.data as Res;\n } else if (apiType === AptosApiType.PEPPER || apiType === AptosApiType.PROVER) {\n if (aptosResponse.status >= 400) {\n throw new AptosApiError({ apiType, aptosRequest: aptosRequestOpts, aptosResponse });\n }\n }\n\n if (aptosResponse.status >= 200 && aptosResponse.status < 300) {\n return aptosResponse;\n }\n\n // We have to explicitly check for all request types, because if the error is a non-indexer error, but\n // comes from an indexer request (e.g. 404), we'll need to mention it appropriately\n throw new AptosApiError({ apiType, aptosRequest: aptosRequestOpts, aptosResponse });\n}\n\n/**\n * The main function to use when making an API request, returning the response or throwing an AptosApiError on failure.\n *\n * @param aptosRequestOpts - Options for the Aptos request, including the URL and path.\n * @param aptosConfig - The configuration information for the SDK client instance.\n * @param apiType - The type of API being accessed, which determines how the response is handled.\n * @returns The response from the API request or throws an AptosApiError if the request fails.\n * @group Implementation\n * @category Client\n * @experimental\n */\nexport async function aptosBinaryRequest<Req extends {}>(\n aptosRequestOpts: AptosRequest,\n aptosConfig: AptosConfig,\n apiType: AptosApiType,\n): Promise<AptosResponse<Req, Buffer>> {\n const { url, path } = aptosRequestOpts;\n const fullUrl = path ? `${url}/${path}` : url;\n const clientResponse = await binaryRequest<Req>({ ...aptosRequestOpts, url: fullUrl }, aptosConfig.client);\n\n const aptosResponse: AptosResponse<Req, Buffer> = {\n status: clientResponse.status,\n statusText: clientResponse.statusText ?? \"No status text provided\",\n data: clientResponse.data,\n headers: clientResponse.headers,\n config: clientResponse.config,\n request: clientResponse.request,\n url: fullUrl,\n };\n\n // Handle case for `Unauthorized` error (i.e. API_KEY error)\n if (aptosResponse.status === 401) {\n throw new AptosApiError({ apiType, aptosRequest: aptosRequestOpts, aptosResponse });\n }\n\n // to support both fullnode and indexer responses,\n // check if it is an indexer query, and adjust response.data\n if (apiType === AptosApiType.INDEXER) {\n const indexerResponse = aptosResponse.data as any;\n // Handle Indexer general errors\n if (indexerResponse.errors) {\n throw new AptosApiError({\n apiType,\n aptosRequest: aptosRequestOpts,\n aptosResponse,\n });\n }\n aptosResponse.data = indexerResponse.data as Buffer;\n } else if (apiType === AptosApiType.PEPPER || apiType === AptosApiType.PROVER) {\n if (aptosResponse.status >= 400) {\n throw new AptosApiError({ apiType, aptosRequest: aptosRequestOpts, aptosResponse });\n }\n }\n\n if (aptosResponse.status >= 200 && aptosResponse.status < 300) {\n return aptosResponse;\n }\n\n // We have to explicitly check for all request types, because if the error is a non-indexer error, but\n // comes from an indexer request (e.g. 404), we'll need to mention it appropriately\n throw new AptosApiError({ apiType, aptosRequest: aptosRequestOpts, aptosResponse });\n}\n"],"mappings":"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","names":["request","options","client","url","method","body","contentType","params","overrides","originMethod","headers","VERSION","binaryRequest","acceptType","aptosRequest","aptosRequestOpts","aptosConfig","apiType","path","fullUrl","clientResponse","aptosResponse","AptosApiError","indexerResponse","aptosBinaryRequest"]}
@@ -1,2 +1,2 @@
1
- import{a as r,b as t,c as o,d as s}from"./chunk-6JTNS5O6.mjs";var n=class{constructor(e){this.config=e}async getPepper(e){return r({aptosConfig:this.config,...e})}async getProof(e){return t({aptosConfig:this.config,...e})}async deriveKeylessAccount(e){return o({aptosConfig:this.config,...e})}async updateFederatedKeylessJwkSetTransaction(e){return s({aptosConfig:this.config,...e})}};export{n as a};
2
- //# sourceMappingURL=chunk-PR3W2QEH.mjs.map
1
+ import{a as r,b as t,c as o,d as s}from"./chunk-G5F5ZOH5.mjs";var n=class{constructor(e){this.config=e}async getPepper(e){return r({aptosConfig:this.config,...e})}async getProof(e){return t({aptosConfig:this.config,...e})}async deriveKeylessAccount(e){return o({aptosConfig:this.config,...e})}async updateFederatedKeylessJwkSetTransaction(e){return s({aptosConfig:this.config,...e})}};export{n as a};
2
+ //# sourceMappingURL=chunk-U4DEYWFT.mjs.map
@@ -1,2 +1,2 @@
1
- import{a as t}from"./chunk-VOCI2675.mjs";import{h as r}from"./chunk-Y3Y4DVCK.mjs";var i=class{constructor(o){this.config=o}async fundAccount(o){let n=await t({aptosConfig:this.config,...o});return(o.options?.waitForIndexer===void 0||o.options?.waitForIndexer)&&await r({aptosConfig:this.config,minimumLedgerVersion:BigInt(n.version),processorType:"fungible_asset_processor"}),n}};export{i as a};
2
- //# sourceMappingURL=chunk-7CYCKCVU.mjs.map
1
+ import{a as t}from"./chunk-67A5U2X6.mjs";import{h as r}from"./chunk-GRRBXHVG.mjs";var i=class{constructor(o){this.config=o}async fundAccount(o){let n=await t({aptosConfig:this.config,...o});return(o.options?.waitForIndexer===void 0||o.options?.waitForIndexer)&&await r({aptosConfig:this.config,minimumLedgerVersion:BigInt(n.version),processorType:"fungible_asset_processor"}),n}};export{i as a};
2
+ //# sourceMappingURL=chunk-UJJGIPOA.mjs.map
@@ -1,2 +1,2 @@
1
- import{a as i}from"./chunk-42T3UGSW.mjs";import{spawn as n}from"child_process";import l from"tree-kill";import{platform as h}from"os";var c=class{constructor(t){this.MAXIMUM_WAIT_TIME_SEC=75;this.READINESS_ENDPOINT="http://127.0.0.1:8070/";this.showStdout=!0;this.process=null;this.showStdout=t?.showStdout??!0}async stop(){await new Promise((t,s)=>{this.process?.pid&&l(this.process.pid,o=>{o?s(o):t(!0)})})}async run(){await this.checkIfProcessIsUp()||(this.start(),await this.waitUntilProcessIsUp())}start(){let t="npx",s=["aptos","node","run-localnet","--force-restart","--assume-yes","--with-indexer-api"],o=h(),r;o==="win32"?r=n(t,s,{shell:!0}):r=n(t,s),this.process=r,r.stderr?.on("data",e=>{let a=e.toString();console.log(a)}),r.stdout?.on("data",e=>{let a=e.toString();this.showStdout&&console.log(a)})}async waitUntilProcessIsUp(){let t=await this.checkIfProcessIsUp(),s=Date.now()/1e3,o=s;for(;!t&&s+this.MAXIMUM_WAIT_TIME_SEC>o;)await i(1e3),t=await this.checkIfProcessIsUp(),o=Date.now()/1e3;if(!t)throw new Error("Process failed to start");return!0}async checkIfProcessIsUp(){try{return(await fetch(this.READINESS_ENDPOINT)).status===200}catch{return!1}}};export{c as a};
2
- //# sourceMappingURL=chunk-ZCEBDPBJ.mjs.map
1
+ import{a as i}from"./chunk-BHVSIRNF.mjs";import{spawn as n}from"child_process";import l from"tree-kill";import{platform as h}from"os";var c=class{constructor(t){this.MAXIMUM_WAIT_TIME_SEC=75;this.READINESS_ENDPOINT="http://127.0.0.1:8070/";this.showStdout=!0;this.process=null;this.showStdout=t?.showStdout??!0}async stop(){await new Promise((t,s)=>{this.process?.pid&&l(this.process.pid,o=>{o?s(o):t(!0)})})}async run(){await this.checkIfProcessIsUp()||(this.start(),await this.waitUntilProcessIsUp())}start(){let t="npx",s=["aptos","node","run-localnet","--force-restart","--assume-yes","--with-indexer-api"],o=h(),r;o==="win32"?r=n(t,s,{shell:!0}):r=n(t,s),this.process=r,r.stderr?.on("data",e=>{let a=e.toString();console.log(a)}),r.stdout?.on("data",e=>{let a=e.toString();this.showStdout&&console.log(a)})}async waitUntilProcessIsUp(){let t=await this.checkIfProcessIsUp(),s=Date.now()/1e3,o=s;for(;!t&&s+this.MAXIMUM_WAIT_TIME_SEC>o;)await i(1e3),t=await this.checkIfProcessIsUp(),o=Date.now()/1e3;if(!t)throw new Error("Process failed to start");return!0}async checkIfProcessIsUp(){try{return(await fetch(this.READINESS_ENDPOINT)).status===200}catch{return!1}}};export{c as a};
2
+ //# sourceMappingURL=chunk-US2HZFOM.mjs.map
@@ -1,2 +1,2 @@
1
- import{h as e,i as s,j as t,k as o,l as r,m as i,n as a,o as m,p as c,q as g,r as u,s as p,t as d}from"./chunk-WXDA4CCR.mjs";var A=class{constructor(n){this.config=n}async getOwnerAddress(n){return e({aptosConfig:this.config,...n})}async getExpiration(n){return t({aptosConfig:this.config,...n})}async getTargetAddress(n){return i({aptosConfig:this.config,...n})}async setTargetAddress(n){return a({aptosConfig:this.config,...n})}async getPrimaryName(n){return o({aptosConfig:this.config,...n})}async setPrimaryName(n){return r({aptosConfig:this.config,...n})}async registerName(n){return s({aptosConfig:this.config,...n})}async renewDomain(n){return d({aptosConfig:this.config,...n})}async getName(n){return m({aptosConfig:this.config,...n})}async getAccountNames(n){return c({aptosConfig:this.config,...n})}async getAccountDomains(n){return g({aptosConfig:this.config,...n})}async getAccountSubdomains(n){return u({aptosConfig:this.config,...n})}async getDomainSubdomains(n){return p({aptosConfig:this.config,...n})}};export{A as a};
2
- //# sourceMappingURL=chunk-S47HA7O7.mjs.map
1
+ import{h as e,i as s,j as t,k as o,l as r,m as i,n as a,o as m,p as c,q as g,r as u,s as p,t as d}from"./chunk-YAGIE4GN.mjs";var A=class{constructor(n){this.config=n}async getOwnerAddress(n){return e({aptosConfig:this.config,...n})}async getExpiration(n){return t({aptosConfig:this.config,...n})}async getTargetAddress(n){return i({aptosConfig:this.config,...n})}async setTargetAddress(n){return a({aptosConfig:this.config,...n})}async getPrimaryName(n){return o({aptosConfig:this.config,...n})}async setPrimaryName(n){return r({aptosConfig:this.config,...n})}async registerName(n){return s({aptosConfig:this.config,...n})}async renewDomain(n){return d({aptosConfig:this.config,...n})}async getName(n){return m({aptosConfig:this.config,...n})}async getAccountNames(n){return c({aptosConfig:this.config,...n})}async getAccountDomains(n){return g({aptosConfig:this.config,...n})}async getAccountSubdomains(n){return u({aptosConfig:this.config,...n})}async getDomainSubdomains(n){return p({aptosConfig:this.config,...n})}};export{A as a};
2
+ //# sourceMappingURL=chunk-VDYUMBOT.mjs.map
@@ -0,0 +1,2 @@
1
+ import{a as i}from"./chunk-IF4UU2MT.mjs";import{bytesToHex as o,hexToBytes as s}from"@noble/hashes/utils";var g=(n=>(n.TOO_SHORT="too_short",n.INVALID_LENGTH="invalid_length",n.INVALID_HEX_CHARS="invalid_hex_chars",n))(g||{}),a=class e{constructor(t){this.data=t}toUint8Array(){return this.data}toStringWithoutPrefix(){return o(this.data)}toString(){return`0x${this.toStringWithoutPrefix()}`}static fromHexString(t){let r=t;if(r.startsWith("0x")&&(r=r.slice(2)),r.length===0)throw new i("Hex string is too short, must be at least 1 char long, excluding the optional leading 0x.","too_short");if(r.length%2!==0)throw new i("Hex string must be an even number of hex characters.","invalid_length");try{return new e(s(r))}catch(n){throw new i(`Hex string contains invalid hex characters: ${n?.message}`,"invalid_hex_chars")}}static fromHexInput(t){if(t instanceof Buffer)return new e(new Uint8Array(t));if(t instanceof Uint8Array)return new e(t);if(typeof t=="string")return e.fromHexString(t);throw new Error(`Invalid hex input type: ${typeof t}`)}static hexInputToUint8Array(t){return t instanceof Uint8Array?t:e.fromHexString(t).toUint8Array()}static hexInputToString(t){return e.fromHexInput(t).toString()}static hexInputToStringWithoutPrefix(t){return e.fromHexInput(t).toStringWithoutPrefix()}static isValid(t){try{return e.fromHexString(t),{valid:!0}}catch(r){return{valid:!1,invalidReason:r?.invalidReason,invalidReasonMessage:r?.message}}}equals(t){return this.data.length!==t.data.length?!1:this.data.every((r,n)=>r===t.data[n])}},l=e=>new TextDecoder().decode(a.fromHexInput(e).toUint8Array());export{g as a,a as b,l as c};
2
+ //# sourceMappingURL=chunk-VHY6ZATX.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/core/hex.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { bytesToHex, hexToBytes } from \"@noble/hashes/utils\";\nimport { ParsingError, ParsingResult } from \"./common\";\nimport { HexInput } from \"../types\";\n\n/**\n * Provides reasons for parsing failures related to hexadecimal values.\n * @group Implementation\n * @category Serialization\n */\nexport enum HexInvalidReason {\n TOO_SHORT = \"too_short\",\n INVALID_LENGTH = \"invalid_length\",\n INVALID_HEX_CHARS = \"invalid_hex_chars\",\n}\n\n/**\n * NOTE: Do not use this class when working with account addresses; use AccountAddress instead.\n * When accepting hex data as input to a function, prefer to accept HexInput and\n *\n * A helper class for working with hex data. Hex data, when represented as a string,\n * generally looks like this, for example: 0xaabbcc, 45cd32, etc.\n *\n * then use the static helper methods of this class to convert it into the desired\n * format. This enables the greatest flexibility for the developer.\n *\n * Example usage:\n * ```typescript\n * getTransactionByHash(txnHash: HexInput): Promise<Transaction> {\n * const txnHashString = Hex.fromHexInput(txnHash).toString();\n * return await getTransactionByHashInner(txnHashString);\n * }\n * ```\n * This call to `Hex.fromHexInput().toString()` converts the HexInput to a hex string\n * with a leading 0x prefix, regardless of what the input format was.\n *\n * Other ways to chain the functions together:\n * - `Hex.fromHexString({ hexInput: \"0x1f\" }).toUint8Array()`\n * - `new Hex([1, 3]).toStringWithoutPrefix()`\n * @group Implementation\n * @category Serialization\n */\nexport class Hex {\n private readonly data: Uint8Array;\n\n /**\n * Create a new Hex instance from a Uint8Array.\n *\n * @param data - The Uint8Array containing the data to initialize the Hex instance.\n * @group Implementation\n * @category Serialization\n */\n constructor(data: Uint8Array) {\n this.data = data;\n }\n\n // ===\n // Methods for representing an instance of Hex as other types.\n // ===\n\n /**\n * Get the inner hex data as a Uint8Array. The inner data is already a Uint8Array, so no conversion takes place.\n *\n * @returns Hex data as Uint8Array\n * @group Implementation\n * @category Serialization\n */\n toUint8Array(): Uint8Array {\n return this.data;\n }\n\n /**\n * Get the hex data as a string without the 0x prefix.\n *\n * @returns Hex string without 0x prefix\n * @group Implementation\n * @category Serialization\n */\n toStringWithoutPrefix(): string {\n return bytesToHex(this.data);\n }\n\n /**\n * Get the hex data as a string with the 0x prefix.\n *\n * @returns Hex string with 0x prefix\n * @group Implementation\n * @category Serialization\n */\n toString(): string {\n return `0x${this.toStringWithoutPrefix()}`;\n }\n\n // ===\n // Methods for creating an instance of Hex from other types.\n // ===\n\n /**\n * Converts a hex string into a Hex instance, allowing for both prefixed and non-prefixed formats.\n *\n * @param str - A hex string, with or without the 0x prefix.\n *\n * @throws ParsingError - If the hex string is too short, has an odd number of characters, or contains invalid hex characters.\n *\n * @returns Hex - The resulting Hex instance created from the provided string.\n * @group Implementation\n * @category Serialization\n */\n static fromHexString(str: string): Hex {\n let input = str;\n\n if (input.startsWith(\"0x\")) {\n input = input.slice(2);\n }\n\n if (input.length === 0) {\n throw new ParsingError(\n \"Hex string is too short, must be at least 1 char long, excluding the optional leading 0x.\",\n HexInvalidReason.TOO_SHORT,\n );\n }\n\n if (input.length % 2 !== 0) {\n throw new ParsingError(\"Hex string must be an even number of hex characters.\", HexInvalidReason.INVALID_LENGTH);\n }\n\n try {\n return new Hex(hexToBytes(input));\n } catch (error: any) {\n throw new ParsingError(\n `Hex string contains invalid hex characters: ${error?.message}`,\n HexInvalidReason.INVALID_HEX_CHARS,\n );\n }\n }\n\n /**\n * Converts an instance of HexInput, which can be a string or a Uint8Array, into a Hex instance.\n * This function is useful for transforming hexadecimal representations into a structured Hex object for further manipulation.\n *\n * @param hexInput - A HexInput which can be a string or Uint8Array.\n * @returns A Hex instance created from the provided hexInput.\n * @group Implementation\n * @category Serialization\n */\n static fromHexInput(hexInput: HexInput): Hex {\n if (hexInput instanceof Buffer) return new Hex(new Uint8Array(hexInput));\n if (hexInput instanceof Uint8Array) return new Hex(hexInput);\n if (typeof hexInput === \"string\") return Hex.fromHexString(hexInput);\n throw new Error(`Invalid hex input type: ${typeof hexInput}`);\n }\n\n /**\n * Converts an instance of HexInput, which can be a string or a Uint8Array, into a Uint8Array.\n *\n * @param hexInput - A HexInput which can be a string or Uint8Array.\n * @returns A Uint8Array created from the provided hexInput.\n */\n static hexInputToUint8Array(hexInput: HexInput): Uint8Array {\n if (hexInput instanceof Uint8Array) return hexInput;\n return Hex.fromHexString(hexInput).toUint8Array();\n }\n\n /**\n * Converts a HexInput (string or Uint8Array) to a hex string with '0x' prefix.\n *\n * @param hexInput - The input to convert, either a hex string (with/without '0x' prefix) or Uint8Array\n * @returns A hex string with '0x' prefix (e.g., \"0x1234\")\n *\n * @example\n * ```typescript\n * Hex.hexInputToString(\"1234\") // returns \"0x1234\"\n * Hex.hexInputToString(\"0x1234\") // returns \"0x1234\"\n * Hex.hexInputToString(new Uint8Array([0x12, 0x34])) // returns \"0x1234\"\n * ```\n */\n static hexInputToString(hexInput: HexInput): string {\n return Hex.fromHexInput(hexInput).toString();\n }\n\n /**\n * Converts a HexInput (string or Uint8Array) to a hex string without '0x' prefix.\n *\n * @param hexInput - The input to convert, either a hex string (with/without '0x' prefix) or Uint8Array\n * @returns A hex string without '0x' prefix (e.g., \"1234\")\n *\n * @example\n * ```typescript\n * Hex.hexInputToStringWithoutPrefix(\"1234\") // returns \"1234\"\n * Hex.hexInputToStringWithoutPrefix(\"0x1234\") // returns \"1234\"\n * Hex.hexInputToStringWithoutPrefix(new Uint8Array([0x12, 0x34])) // returns \"1234\"\n * ```\n */\n static hexInputToStringWithoutPrefix(hexInput: HexInput): string {\n return Hex.fromHexInput(hexInput).toStringWithoutPrefix();\n }\n\n // ===\n // Methods for checking validity.\n // ===\n\n /**\n * Check if the provided string is a valid hexadecimal representation.\n *\n * @param str - A hex string representing byte data.\n *\n * @returns An object containing:\n * - valid: A boolean indicating whether the string is valid.\n * - invalidReason: The reason for invalidity if the string is not valid.\n * - invalidReasonMessage: A message explaining why the string is invalid.\n * @group Implementation\n * @category Serialization\n */\n static isValid(str: string): ParsingResult<HexInvalidReason> {\n try {\n Hex.fromHexString(str);\n return { valid: true };\n } catch (error: any) {\n return {\n valid: false,\n invalidReason: error?.invalidReason,\n invalidReasonMessage: error?.message,\n };\n }\n }\n\n /**\n * Determine if two Hex instances are equal by comparing their underlying byte data.\n *\n * @param other The Hex instance to compare to.\n * @returns true if the Hex instances are equal, false if not.\n * @group Implementation\n * @category Serialization\n */\n equals(other: Hex): boolean {\n if (this.data.length !== other.data.length) return false;\n return this.data.every((value, index) => value === other.data[index]);\n }\n}\n\nexport const hexToAsciiString = (hex: string) => new TextDecoder().decode(Hex.fromHexInput(hex).toUint8Array());\n"],"mappings":"yCAGA,OAAS,cAAAA,EAAY,cAAAC,MAAkB,sBAShC,IAAKC,OACVA,EAAA,UAAY,YACZA,EAAA,eAAiB,iBACjBA,EAAA,kBAAoB,oBAHVA,OAAA,IAgCCC,EAAN,MAAMC,CAAI,CAUf,YAAYC,EAAkB,CAC5B,KAAK,KAAOA,CACd,CAaA,cAA2B,CACzB,OAAO,KAAK,IACd,CASA,uBAAgC,CAC9B,OAAOC,EAAW,KAAK,IAAI,CAC7B,CASA,UAAmB,CACjB,MAAO,KAAK,KAAK,sBAAsB,CAAC,EAC1C,CAiBA,OAAO,cAAcC,EAAkB,CACrC,IAAIC,EAAQD,EAMZ,GAJIC,EAAM,WAAW,IAAI,IACvBA,EAAQA,EAAM,MAAM,CAAC,GAGnBA,EAAM,SAAW,EACnB,MAAM,IAAIC,EACR,4FACA,WACF,EAGF,GAAID,EAAM,OAAS,IAAM,EACvB,MAAM,IAAIC,EAAa,uDAAwD,gBAA+B,EAGhH,GAAI,CACF,OAAO,IAAIL,EAAIM,EAAWF,CAAK,CAAC,CAClC,OAASG,EAAY,CACnB,MAAM,IAAIF,EACR,+CAA+CE,GAAO,OAAO,GAC7D,mBACF,CACF,CACF,CAWA,OAAO,aAAaC,EAAyB,CAC3C,GAAIA,aAAoB,OAAQ,OAAO,IAAIR,EAAI,IAAI,WAAWQ,CAAQ,CAAC,EACvE,GAAIA,aAAoB,WAAY,OAAO,IAAIR,EAAIQ,CAAQ,EAC3D,GAAI,OAAOA,GAAa,SAAU,OAAOR,EAAI,cAAcQ,CAAQ,EACnE,MAAM,IAAI,MAAM,2BAA2B,OAAOA,CAAQ,EAAE,CAC9D,CAQA,OAAO,qBAAqBA,EAAgC,CAC1D,OAAIA,aAAoB,WAAmBA,EACpCR,EAAI,cAAcQ,CAAQ,EAAE,aAAa,CAClD,CAeA,OAAO,iBAAiBA,EAA4B,CAClD,OAAOR,EAAI,aAAaQ,CAAQ,EAAE,SAAS,CAC7C,CAeA,OAAO,8BAA8BA,EAA4B,CAC/D,OAAOR,EAAI,aAAaQ,CAAQ,EAAE,sBAAsB,CAC1D,CAkBA,OAAO,QAAQL,EAA8C,CAC3D,GAAI,CACF,OAAAH,EAAI,cAAcG,CAAG,EACd,CAAE,MAAO,EAAK,CACvB,OAASI,EAAY,CACnB,MAAO,CACL,MAAO,GACP,cAAeA,GAAO,cACtB,qBAAsBA,GAAO,OAC/B,CACF,CACF,CAUA,OAAOE,EAAqB,CAC1B,OAAI,KAAK,KAAK,SAAWA,EAAM,KAAK,OAAe,GAC5C,KAAK,KAAK,MAAM,CAACC,EAAOC,IAAUD,IAAUD,EAAM,KAAKE,CAAK,CAAC,CACtE,CACF,EAEaC,EAAoBC,GAAgB,IAAI,YAAY,EAAE,OAAOd,EAAI,aAAac,CAAG,EAAE,aAAa,CAAC","names":["bytesToHex","hexToBytes","HexInvalidReason","Hex","_Hex","data","bytesToHex","str","input","ParsingError","hexToBytes","error","hexInput","other","value","index","hexToAsciiString","hex"]}
@@ -1,4 +1,4 @@
1
- import{a as M}from"./chunk-HLJE5XGE.mjs";import{a as o}from"./chunk-JF66JS2R.mjs";import{a as d}from"./chunk-PWYJWTEM.mjs";import{a as y,b as l,c as C,d as T,e as O,f as h,g as b,h as L,i as P,j as S,k as V,l as R,n as w,o as I,p as v,q as k}from"./chunk-3EY7MT2M.mjs";import{a as f}from"./chunk-BI3BTSUB.mjs";import{a as p}from"./chunk-YOZBVVKL.mjs";import{e as u,f as A}from"./chunk-RJ7F4JDV.mjs";import{h as g,i as m}from"./chunk-42T3UGSW.mjs";import{b as r}from"./chunk-Q4C4U6I4.mjs";var N=class{constructor(e){this.config=e;this.abstraction=new M(e)}async getAccountInfo(e){return y({aptosConfig:this.config,...e})}async getAccountModules(e){return l({aptosConfig:this.config,...e})}async getAccountModule(e){return C({aptosConfig:this.config,...e})}async getAccountTransactions(e){return T({aptosConfig:this.config,...e})}async getAccountResources(e){return O({aptosConfig:this.config,...e})}async getAccountResource(e){return h({aptosConfig:this.config,...e})}async lookupOriginalAccountAddress(e){return b({aptosConfig:this.config,...e})}async getAccountTokensCount(e){return await o({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"account_transactions_processor"}),L({aptosConfig:this.config,...e})}async getAccountOwnedTokens(e){return await o({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),P({aptosConfig:this.config,...e})}async getAccountOwnedTokensFromCollectionAddress(e){return await o({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),S({aptosConfig:this.config,...e})}async getAccountCollectionsWithOwnedTokens(e){return await o({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),V({aptosConfig:this.config,...e})}async getAccountTransactionsCount(e){return await o({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"account_transactions_processor"}),R({aptosConfig:this.config,...e})}async getAccountCoinsData(e){return await o({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"fungible_asset_processor"}),w({aptosConfig:this.config,...e})}async getAccountCoinsCount(e){return await o({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"fungible_asset_processor"}),I({aptosConfig:this.config,...e})}async getAccountAPTAmount(e){return this.getAccountCoinAmount({coinType:u,faMetadataAddress:A,...e})}async getAccountCoinAmount(e){let{accountAddress:a,coinType:s,faMetadataAddress:t,minimumLedgerVersion:E}=e;E&&console.warn(`minimumLedgerVersion is not used anymore, here for backward
1
+ import{a as M}from"./chunk-AQWKKSRN.mjs";import{a as o}from"./chunk-MFLHAVIW.mjs";import{a as d}from"./chunk-PYY2RXFP.mjs";import{a as y,b as l,c as C,d as T,e as O,f as h,g as b,h as L,i as P,j as S,k as V,l as R,n as w,o as I,p as v,q as k}from"./chunk-W2C5KRUQ.mjs";import{a as f}from"./chunk-AIPHJFJL.mjs";import{a as p}from"./chunk-YOZBVVKL.mjs";import{e as u,f as A}from"./chunk-RJ7F4JDV.mjs";import{h as g,i as m}from"./chunk-BHVSIRNF.mjs";import{b as r}from"./chunk-LQOSHBB7.mjs";var N=class{constructor(e){this.config=e;this.abstraction=new M(e)}async getAccountInfo(e){return y({aptosConfig:this.config,...e})}async getAccountModules(e){return l({aptosConfig:this.config,...e})}async getAccountModule(e){return C({aptosConfig:this.config,...e})}async getAccountTransactions(e){return T({aptosConfig:this.config,...e})}async getAccountResources(e){return O({aptosConfig:this.config,...e})}async getAccountResource(e){return h({aptosConfig:this.config,...e})}async lookupOriginalAccountAddress(e){return b({aptosConfig:this.config,...e})}async getAccountTokensCount(e){return await o({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"account_transactions_processor"}),L({aptosConfig:this.config,...e})}async getAccountOwnedTokens(e){return await o({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),P({aptosConfig:this.config,...e})}async getAccountOwnedTokensFromCollectionAddress(e){return await o({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),S({aptosConfig:this.config,...e})}async getAccountCollectionsWithOwnedTokens(e){return await o({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),V({aptosConfig:this.config,...e})}async getAccountTransactionsCount(e){return await o({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"account_transactions_processor"}),R({aptosConfig:this.config,...e})}async getAccountCoinsData(e){return await o({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"fungible_asset_processor"}),w({aptosConfig:this.config,...e})}async getAccountCoinsCount(e){return await o({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"fungible_asset_processor"}),I({aptosConfig:this.config,...e})}async getAccountAPTAmount(e){return this.getAccountCoinAmount({coinType:u,faMetadataAddress:A,...e})}async getAccountCoinAmount(e){let{accountAddress:a,coinType:s,faMetadataAddress:t,minimumLedgerVersion:E}=e;E&&console.warn(`minimumLedgerVersion is not used anymore, here for backward
2
2
  compatibility see https://github.com/aptos-labs/aptos-ts-sdk/pull/519,
3
3
  will be removed in the near future`);let c=s;s===void 0&&t!==void 0&&(c=await p(async()=>{try{let n=(await d({aptosConfig:this.config,payload:{function:"0x1::coin::paired_coin",functionArguments:[t]}})).at(0);if(n.vec.length>0&&m(n.vec[0]))return g(n.vec[0])}catch{}},`coin-mapping-${t.toString()}`,1e3*60*5)());let i;if(s!==void 0&&t!==void 0)i=r.from(t).toStringLong();else if(s!==void 0&&t===void 0)s===u?i=r.A.toStringLong():i=f(r.A,s).toStringLong();else if(s===void 0&&t!==void 0){let n=r.from(t);i=n.toStringLong(),n===r.A&&(c=u)}else throw new Error("Either coinType, faMetadataAddress, or both must be provided");if(c!==void 0){let[n]=await d({aptosConfig:this.config,payload:{function:"0x1::coin::balance",typeArguments:[c],functionArguments:[a]}});return parseInt(n,10)}let[_]=await d({aptosConfig:this.config,payload:{function:"0x1::primary_fungible_store::balance",typeArguments:["0x1::object::ObjectCore"],functionArguments:[a,i]}});return parseInt(_,10)}async getAccountOwnedObjects(e){return await o({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"default_processor"}),v({aptosConfig:this.config,...e})}async deriveAccountFromPrivateKey(e){return k({aptosConfig:this.config,...e})}};export{N as a};
4
- //# sourceMappingURL=chunk-TDGUMBON.mjs.map
4
+ //# sourceMappingURL=chunk-VWZEJTGP.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/api/account.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { Account as AccountModule } from \"../account\";\nimport { AccountAddress, PrivateKey, AccountAddressInput, createObjectAddress } from \"../core\";\nimport {\n AccountData,\n AnyNumber,\n GetAccountCoinsDataResponse,\n GetAccountCollectionsWithOwnedTokenResponse,\n GetAccountOwnedTokensFromCollectionResponse,\n GetAccountOwnedTokensQueryResponse,\n GetObjectDataQueryResponse,\n LedgerVersionArg,\n MoveModuleBytecode,\n MoveResource,\n MoveStructId,\n MoveValue,\n OrderByArg,\n PaginationArgs,\n TokenStandardArg,\n TransactionResponse,\n WhereArg,\n} from \"../types\";\nimport {\n deriveAccountFromPrivateKey,\n getAccountCoinsCount,\n getAccountCoinsData,\n getAccountCollectionsWithOwnedTokens,\n getAccountOwnedObjects,\n getAccountOwnedTokens,\n getAccountOwnedTokensFromCollectionAddress,\n getAccountTokensCount,\n getAccountTransactionsCount,\n getInfo,\n getModule,\n getModules,\n getResource,\n getResources,\n getTransactions,\n lookupOriginalAccountAddress,\n} from \"../internal/account\";\nimport { APTOS_COIN, APTOS_FA, ProcessorType } from \"../utils/const\";\nimport { AptosConfig } from \"./aptosConfig\";\nimport { waitForIndexerOnVersion } from \"./utils\";\nimport { CurrentFungibleAssetBalancesBoolExp } from \"../types/generated/types\";\nimport { view } from \"../internal/view\";\nimport { isEncodedStruct, parseEncodedStruct } from \"../utils\";\nimport { memoizeAsync } from \"../utils/memoize\";\nimport { AccountAbstraction } from \"./account/abstraction\";\n\n/**\n * A class to query all `Account` related queries on Aptos.\n * @group Account\n */\nexport class Account {\n abstraction: AccountAbstraction;\n\n /**\n * Creates an instance of the Aptos client with the provided configuration.\n *\n * @param config - The configuration settings for the Aptos client.\n *\n * @example\n * ```typescript\n * import { Aptos, AptosConfig, Network } from \"@aptos-labs/ts-sdk\";\n *\n * async function runExample() {\n * // Initialize the Aptos client with testnet configuration\n * const config = new AptosConfig({ network: Network.TESTNET }); // specify your own network if needed\n * const aptos = new Aptos(config);\n *\n * console.log(\"Aptos client initialized:\", aptos);\n * }\n * runExample().catch(console.error);\n * ```\n * @group Account\n */\n constructor(readonly config: AptosConfig) {\n this.abstraction = new AccountAbstraction(config);\n }\n\n /**\n * Queries the current state for an Aptos account given its account address.\n *\n * @param args - The arguments for retrieving account information.\n * @param args.accountAddress - The Aptos account address to query.\n * @returns The account data.\n *\n * @example\n * ```typescript\n * import { Aptos, AptosConfig, Network } from \"@aptos-labs/ts-sdk\";\n *\n * const config = new AptosConfig({ network: Network.TESTNET });\n * const aptos = new Aptos(config);\n *\n * async function runExample() {\n * // Retrieve account information for a specific address\n * const accountInfo = await aptos.getAccountInfo({ accountAddress: \"0x1\" }); // replace with a real account address\n * console.log(accountInfo);\n * }\n * runExample().catch(console.error);\n * ```\n * @group Account\n */\n async getAccountInfo(args: { accountAddress: AccountAddressInput }): Promise<AccountData> {\n return getInfo({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Queries for all modules in an account given an account address.\n * This function may call the API multiple times to auto paginate through results.\n *\n * @param args.accountAddress - The Aptos account address to query modules for.\n * @param args.options.offset - The cursor to start returning results from. Note, this is obfuscated and is not an index.\n * @param args.options.limit - The maximum number of results to return.\n * @param args.options.ledgerVersion - The ledger version to query; if not provided, it retrieves the latest version.\n *\n * @returns - The account modules associated with the specified address.\n *\n * @example\n * ```typescript\n * import { Aptos, AptosConfig, Network } from \"@aptos-labs/ts-sdk\";\n *\n * const config = new AptosConfig({ network: Network.TESTNET });\n * const aptos = new Aptos(config);\n *\n * async function runExample() {\n * // Fetching account modules for a specific account\n * const accountModules = await aptos.getAccountModules({\n * accountAddress: \"0x1\", // replace with a real account address\n * options: {\n * offset: 0, // starting from the first module\n * limit: 10, // limiting to 10 modules\n * },\n * });\n *\n * console.log(accountModules);\n * }\n * runExample().catch(console.error);\n * ```\n * @group Account\n */\n async getAccountModules(args: {\n accountAddress: AccountAddressInput;\n options?: PaginationArgs & LedgerVersionArg;\n }): Promise<MoveModuleBytecode[]> {\n return getModules({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Queries for a specific account module given an account address and module name.\n *\n * @param args.accountAddress - The Aptos account address.\n * @param args.moduleName - The name of the module.\n * @param args.options.ledgerVersion - The ledger version to query; if not provided, it will get the latest version.\n *\n * @returns The account module associated with the specified account address and module name.\n *\n * @example\n * ```typescript\n * import { Aptos, AptosConfig, Network } from \"@aptos-labs/ts-sdk\";\n *\n * const config = new AptosConfig({ network: Network.TESTNET });\n * const aptos = new Aptos(config);\n *\n * async function runExample() {\n * // Get the account module for a specific account address and module name\n * const module = await aptos.getAccountModule({\n * accountAddress: \"0x1\", // replace with a real account address\n * moduleName: \"MyModule\" // specify the module name\n * });\n *\n * console.log(module);\n * }\n * runExample().catch(console.error);\n * ```\n * @group Account\n */\n async getAccountModule(args: {\n accountAddress: AccountAddressInput;\n moduleName: string;\n options?: LedgerVersionArg;\n }): Promise<MoveModuleBytecode> {\n return getModule({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Queries account transactions given an account address.\n * This function may call the API multiple times to auto paginate and retrieve all account transactions.\n *\n * @param args.accountAddress - The Aptos account address to query transactions for.\n * @param args.options - Optional pagination arguments.\n * @param args.options.offset - The number of transactions to start returning results from.\n * @param args.options.limit - The maximum number of results to return.\n *\n * @returns The account transactions.\n *\n * @example\n * ```typescript\n * import { Aptos, AptosConfig, Network } from \"@aptos-labs/ts-sdk\";\n *\n * const config = new AptosConfig({ network: Network.TESTNET });\n * const aptos = new Aptos(config);\n *\n * async function runExample() {\n * // Fetch transactions for a specific account\n * const transactions = await aptos.getAccountTransactions({\n * accountAddress: \"0x1\", // replace with a real account address\n * options: {\n * offset: 0, // starting from the first transaction\n * limit: 10, // limiting to 10 transactions\n * },\n * });\n *\n * console.log(transactions);\n * }\n * runExample().catch(console.error);\n * ```\n * @group Account\n */\n async getAccountTransactions(args: {\n accountAddress: AccountAddressInput;\n options?: PaginationArgs;\n }): Promise<TransactionResponse[]> {\n return getTransactions({\n aptosConfig: this.config,\n ...args,\n });\n }\n\n /**\n * Queries all account resources given an account address.\n * This function may call the API multiple times to auto paginate through results.\n *\n * @param args.accountAddress - The Aptos account address to query resources for.\n * @param args.options.offset - The cursor to start returning results from. Note, this is obfuscated and is not an index.\n * @param args.options.limit - The maximum number of results to return.\n * @param args.options.ledgerVersion - The ledger version to query; if not provided, it will get the latest version.\n * @returns Account resources.\n *\n * @example\n * ```typescript\n * import { Aptos, AptosConfig, Network } from \"@aptos-labs/ts-sdk\";\n *\n * const config = new AptosConfig({ network: Network.TESTNET });\n * const aptos = new Aptos(config);\n *\n * async function runExample() {\n * // Fetching account resources for a specific account address\n * const resources = await aptos.getAccountResources({ accountAddress: \"0x1\" }); // replace with a real account address\n * console.log(resources);\n * }\n * runExample().catch(console.error);\n * ```\n * @group Account\n */\n async getAccountResources(args: {\n accountAddress: AccountAddressInput;\n options?: PaginationArgs & LedgerVersionArg;\n }): Promise<MoveResource[]> {\n return getResources({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Queries a specific account resource given an account address and resource type.\n *\n * @template T - The typed output of the resource.\n * @param args.accountAddress - The Aptos account address to query.\n * @param args.resourceType - The string representation of an on-chain Move struct type, e.g., \"0x1::aptos_coin::AptosCoin\".\n * @param args.options.ledgerVersion - The ledger version to query; if not provided, it will get the latest version.\n * @returns The account resource of the specified type.\n *\n * @example\n * ```typescript\n * import { Aptos, AptosConfig, Network } from \"@aptos-labs/ts-sdk\";\n *\n * const config = new AptosConfig({ network: Network.TESTNET });\n * const aptos = new Aptos(config);\n *\n * async function runExample() {\n * // Get the account resource for a specific account address and resource type\n * const resource = await aptos.getAccountResource({\n * accountAddress: \"0x1\", // replace with a real account address\n * resourceType: \"0x1::aptos_coin::AptosCoin\"\n * });\n *\n * console.log(resource);\n * }\n * runExample().catch(console.error);\n * ```\n * @group Account\n */\n async getAccountResource<T extends {} = any>(args: {\n accountAddress: AccountAddressInput;\n resourceType: MoveStructId;\n options?: LedgerVersionArg;\n }): Promise<T> {\n return getResource<T>({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Looks up the account address for a given authentication key, handling both rotated and non-rotated keys.\n *\n * @param args.authenticationKey - The authentication key for which to look up the account address.\n * @param args.minimumLedgerVersion - Optional ledger version to sync up to before querying.\n * @param args.options.ledgerVersion - The ledger version to query; if not provided, it will get the latest version.\n * @returns Promise<AccountAddress> - The account address associated with the authentication key.\n *\n * @example\n * ```typescript\n * import { Aptos, AptosConfig, Network } from \"@aptos-labs/ts-sdk\";\n *\n * const config = new AptosConfig({ network: Network.TESTNET });\n * const aptos = new Aptos(config);\n *\n * async function runExample() {\n * // Look up the original account address for a given authentication key\n * const accountAddress = await aptos.lookupOriginalAccountAddress({\n * authenticationKey: \"0x1\", // replace with a real authentication key\n * });\n *\n * console.log(\"Original Account Address:\", accountAddress);\n * }\n * runExample().catch(console.error);\n * ```\n * @group Account\n */\n async lookupOriginalAccountAddress(args: {\n authenticationKey: AccountAddressInput;\n minimumLedgerVersion?: AnyNumber;\n options?: LedgerVersionArg;\n }): Promise<AccountAddress> {\n return lookupOriginalAccountAddress({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Queries the current count of tokens owned by a specified account.\n *\n * @param args - The parameters for the query.\n * @param args.accountAddress - The account address to query the token count for.\n * @param args.minimumLedgerVersion - Optional ledger version to sync up to before querying.\n * @returns The current count of tokens owned by the account.\n *\n * @example\n * ```typescript\n * import { Aptos, AptosConfig, Network } from \"@aptos-labs/ts-sdk\";\n *\n * const config = new AptosConfig({ network: Network.TESTNET });\n * const aptos = new Aptos(config);\n *\n * async function runExample() {\n * // Get the count of tokens owned by the account\n * const tokensCount = await aptos.getAccountTokensCount({ accountAddress: \"0x1\" }); // replace with a real account address\n * console.log(`Tokens Count: ${tokensCount}`);\n * }\n * runExample().catch(console.error);\n * ```\n * @group Account\n */\n async getAccountTokensCount(args: {\n accountAddress: AccountAddressInput;\n minimumLedgerVersion?: AnyNumber;\n }): Promise<number> {\n await waitForIndexerOnVersion({\n config: this.config,\n minimumLedgerVersion: args.minimumLedgerVersion,\n processorType: ProcessorType.ACCOUNT_TRANSACTION_PROCESSOR,\n });\n return getAccountTokensCount({\n aptosConfig: this.config,\n ...args,\n });\n }\n\n /**\n * Queries the tokens currently owned by a specified account, including NFTs and fungible tokens.\n * If desired, you can filter the results by a specific token standard.\n *\n * @param args.accountAddress The account address for which to retrieve owned tokens.\n * @param args.minimumLedgerVersion Optional ledger version to sync up to before querying.\n * @param args.options.tokenStandard Optional filter for the NFT standard to query for.\n * @param args.options.offset Optional number to start returning results from.\n * @param args.options.limit Optional number of results to return.\n * @param args.options.orderBy Optional order to sort the tokens by.\n * @returns An array of tokens with their respective data.\n *\n * @example\n * ```typescript\n * import { Aptos, AptosConfig, Network } from \"@aptos-labs/ts-sdk\";\n *\n * const config = new AptosConfig({ network: Network.TESTNET });\n * const aptos = new Aptos(config);\n *\n * async function runExample() {\n * // Get the tokens owned by a specific account\n * const accountOwnedTokens = await aptos.getAccountOwnedTokens({\n * accountAddress: \"0x1\", // replace with a real account address\n * options: {\n * limit: 10, // specify how many tokens to return\n * orderBy: \"created_at\", // specify the order of the results\n * },\n * });\n *\n * console.log(accountOwnedTokens);\n * }\n * runExample().catch(console.error);\n * ```\n * @group Account\n */\n async getAccountOwnedTokens(args: {\n accountAddress: AccountAddressInput;\n minimumLedgerVersion?: AnyNumber;\n options?: TokenStandardArg & PaginationArgs & OrderByArg<GetAccountOwnedTokensQueryResponse[0]>;\n }): Promise<GetAccountOwnedTokensQueryResponse> {\n await waitForIndexerOnVersion({\n config: this.config,\n minimumLedgerVersion: args.minimumLedgerVersion,\n processorType: ProcessorType.TOKEN_V2_PROCESSOR,\n });\n return getAccountOwnedTokens({\n aptosConfig: this.config,\n ...args,\n });\n }\n\n /**\n * Queries all current tokens of a specific collection that an account owns by the collection address.\n * This query returns all tokens (v1 and v2 standards) an account owns, including NFTs, fungible, soulbound, etc.\n * If you want to get only the token from a specific standard, you can pass an optional tokenStandard parameter.\n *\n * @param args.accountAddress - The account address we want to get the tokens for.\n * @param args.collectionAddress - The address of the collection being queried.\n * @param args.minimumLedgerVersion - Optional ledger version to sync up to, before querying.\n * @param args.options.tokenStandard - The NFT standard to query for.\n * @param args.options.offset - The number token to start returning results from.\n * @param args.options.limit - The number of results to return.\n * @param args.options.orderBy - The order to sort the tokens by.\n * @returns Tokens array with the token data.\n *\n * @example\n * ```typescript\n * import { Aptos, AptosConfig, Network } from \"@aptos-labs/ts-sdk\";\n *\n * const config = new AptosConfig({ network: Network.TESTNET });\n * const aptos = new Aptos(config);\n *\n * async function runExample() {\n * // Get tokens owned by a specific account in a specific collection\n * const accountOwnedTokens = await aptos.getAccountOwnedTokensFromCollectionAddress({\n * accountAddress: \"0x1\", // replace with a real account address\n * collectionAddress: \"0x2\", // replace with a real collection address\n * });\n *\n * console.log(accountOwnedTokens);\n * }\n * runExample().catch(console.error);\n * ```\n * @group Account\n */\n async getAccountOwnedTokensFromCollectionAddress(args: {\n accountAddress: AccountAddressInput;\n collectionAddress: AccountAddressInput;\n minimumLedgerVersion?: AnyNumber;\n options?: TokenStandardArg & PaginationArgs & OrderByArg<GetAccountOwnedTokensFromCollectionResponse[0]>;\n }): Promise<GetAccountOwnedTokensFromCollectionResponse> {\n await waitForIndexerOnVersion({\n config: this.config,\n minimumLedgerVersion: args.minimumLedgerVersion,\n processorType: ProcessorType.TOKEN_V2_PROCESSOR,\n });\n return getAccountOwnedTokensFromCollectionAddress({\n aptosConfig: this.config,\n ...args,\n });\n }\n\n /**\n * Queries for all collections that an account currently has tokens for, including NFTs, fungible tokens, and soulbound tokens.\n * If you want to filter by a specific token standard, you can pass an optional tokenStandard parameter.\n *\n * @param args.accountAddress - The account address we want to get the collections for.\n * @param args.minimumLedgerVersion - Optional ledger version to sync up to before querying.\n * @param args.options.tokenStandard - The NFT standard to query for.\n * @param args.options.offset - The number of the collection to start returning results from.\n * @param args.options.limit - The number of results to return.\n * @param args.options.orderBy - The order to sort the tokens by.\n * @returns Collections array with the collections data.\n *\n * @example\n * ```typescript\n * import { Aptos, AptosConfig, Network } from \"@aptos-labs/ts-sdk\";\n *\n * const config = new AptosConfig({ network: Network.TESTNET });\n * const aptos = new Aptos(config);\n *\n * async function runExample() {\n * // Get account collections with owned tokens for a specific account\n * const accountCollectionsWithOwnedTokens = await aptos.getAccountCollectionsWithOwnedTokens({\n * accountAddress: \"0x1\", // replace with a real account address\n * options: {\n * tokenStandard: \"NFT\", // specify the token standard if needed\n * limit: 10, // specify the number of results to return\n * },\n * });\n *\n * console.log(accountCollectionsWithOwnedTokens);\n * }\n * runExample().catch(console.error);\n * ```\n * @group Account\n */\n async getAccountCollectionsWithOwnedTokens(args: {\n accountAddress: AccountAddressInput;\n minimumLedgerVersion?: AnyNumber;\n options?: TokenStandardArg & PaginationArgs & OrderByArg<GetAccountCollectionsWithOwnedTokenResponse[0]>;\n }): Promise<GetAccountCollectionsWithOwnedTokenResponse> {\n await waitForIndexerOnVersion({\n config: this.config,\n minimumLedgerVersion: args.minimumLedgerVersion,\n processorType: ProcessorType.TOKEN_V2_PROCESSOR,\n });\n return getAccountCollectionsWithOwnedTokens({\n aptosConfig: this.config,\n ...args,\n });\n }\n\n /**\n * Queries the current count of transactions submitted by an account.\n *\n * @param args - The parameters for the query.\n * @param args.accountAddress - The account address we want to get the total count for.\n * @param args.minimumLedgerVersion - Optional ledger version to sync up to before querying.\n * @returns Current count of transactions made by an account.\n *\n * @example\n * ```typescript\n * import { Aptos, AptosConfig, Network } from \"@aptos-labs/ts-sdk\";\n *\n * const config = new AptosConfig({ network: Network.TESTNET });\n * const aptos = new Aptos(config);\n *\n * async function runExample() {\n * // Get the count of transactions for a specific account\n * const accountTransactionsCount = await aptos.getAccountTransactionsCount({\n * accountAddress: \"0x1\", // replace with a real account address\n * minimumLedgerVersion: 1, // specify your own minimum ledger version if needed\n * });\n *\n * console.log(accountTransactionsCount);\n * }\n * runExample().catch(console.error);\n * ```\n * @group Account\n */\n async getAccountTransactionsCount(args: {\n accountAddress: AccountAddressInput;\n minimumLedgerVersion?: AnyNumber;\n }): Promise<number> {\n await waitForIndexerOnVersion({\n config: this.config,\n minimumLedgerVersion: args.minimumLedgerVersion,\n processorType: ProcessorType.ACCOUNT_TRANSACTION_PROCESSOR,\n });\n return getAccountTransactionsCount({\n aptosConfig: this.config,\n ...args,\n });\n }\n\n /**\n * Retrieves the coins data for a specified account.\n *\n * @param args.accountAddress - The account address for which to retrieve the coin's data.\n * @param args.minimumLedgerVersion - Optional ledger version to sync up to before querying.\n * @param args.options.offset - Optional. The number of coins to start returning results from.\n * @param args.options.limit - Optional. The number of results to return.\n * @param args.options.orderBy - Optional. The order to sort the coins by.\n * @param args.options.where - Optional. Filter the results by specific criteria.\n * @returns An array containing the coins data for the specified account.\n *\n * @example\n * ```typescript\n * import { Aptos, AptosConfig, Network } from \"@aptos-labs/ts-sdk\";\n *\n * const config = new AptosConfig({ network: Network.TESTNET });\n * const aptos = new Aptos(config);\n *\n * async function runExample() {\n * // Fetching coins data for a specific account\n * const accountCoinsData = await aptos.getAccountCoinsData({\n * accountAddress: \"0x1\", // replace with a real account address\n * options: {\n * limit: 10, // specify the number of results to return\n * orderBy: { asset_type: \"asc\" }, // specify the order of results\n * },\n * });\n *\n * console.log(accountCoinsData);\n * }\n * runExample().catch(console.error);\n * ```\n * @group Account\n */\n async getAccountCoinsData(args: {\n accountAddress: AccountAddressInput;\n minimumLedgerVersion?: AnyNumber;\n options?: PaginationArgs &\n OrderByArg<GetAccountCoinsDataResponse[0]> &\n WhereArg<CurrentFungibleAssetBalancesBoolExp>;\n }): Promise<GetAccountCoinsDataResponse> {\n await waitForIndexerOnVersion({\n config: this.config,\n minimumLedgerVersion: args.minimumLedgerVersion,\n processorType: ProcessorType.FUNGIBLE_ASSET_PROCESSOR,\n });\n return getAccountCoinsData({\n aptosConfig: this.config,\n ...args,\n });\n }\n\n /**\n * Retrieves the current count of an account's coins aggregated across all types.\n *\n * @param args The parameters for the account coins count query.\n * @param args.accountAddress The account address we want to get the total count for.\n * @param args.minimumLedgerVersion Optional ledger version to sync up to before querying.\n * @returns The current count of the aggregated coins for the specified account.\n *\n * @example\n * ```typescript\n * import { Aptos, AptosConfig, Network } from \"@aptos-labs/ts-sdk\";\n *\n * const config = new AptosConfig({ network: Network.TESTNET });\n * const aptos = new Aptos(config);\n *\n * async function runExample() {\n * // Getting the account coins count for a specific account\n * const accountCoinsCount = await aptos.getAccountCoinsCount({ accountAddress: \"0x1\" }); // replace with a real account address\n * console.log(\"Account Coins Count:\", accountCoinsCount);\n * }\n * runExample().catch(console.error);\n * ```\n * @group Account\n */\n async getAccountCoinsCount(args: {\n accountAddress: AccountAddressInput;\n minimumLedgerVersion?: AnyNumber;\n }): Promise<number> {\n await waitForIndexerOnVersion({\n config: this.config,\n minimumLedgerVersion: args.minimumLedgerVersion,\n processorType: ProcessorType.FUNGIBLE_ASSET_PROCESSOR,\n });\n return getAccountCoinsCount({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Retrieves the current amount of APT for a specified account.\n *\n * @param args The arguments for the account query.\n * @param args.accountAddress The account address for which to retrieve the APT amount.\n * @param args.minimumLedgerVersion Optional ledger version to sync up to before querying.\n * @returns The current amount of APT for the specified account.\n *\n * @example\n * ```typescript\n * import { Aptos, AptosConfig, Network } from \"@aptos-labs/ts-sdk\";\n *\n * const config = new AptosConfig({ network: Network.TESTNET });\n * const aptos = new Aptos(config);\n *\n * async function runExample() {\n * // Get the APT amount for a specific account\n * const accountAPTAmount = await aptos.getAccountAPTAmount({ accountAddress: \"0x1\" }); // replace with a real account address\n * console.log(\"Account APT Amount:\", accountAPTAmount);\n * }\n * runExample().catch(console.error);\n * ```\n * @group Account\n */\n async getAccountAPTAmount(args: {\n accountAddress: AccountAddressInput;\n minimumLedgerVersion?: AnyNumber;\n }): Promise<number> {\n return this.getAccountCoinAmount({ coinType: APTOS_COIN, faMetadataAddress: APTOS_FA, ...args });\n }\n\n /**\n * Queries the current amount of a specified coin held by an account.\n *\n * @param args The parameters for querying the account's coin amount.\n * @param args.accountAddress The account address to query for the coin amount.\n * @param args.coinType The coin type to query. Note: If not provided, it may be automatically populated if `faMetadataAddress`\n * is specified.\n * @param args.faMetadataAddress The fungible asset metadata address to query. Note: If not provided, it may be automatically\n * populated if `coinType` is specified.\n * @param args.minimumLedgerVersion Not used anymore, here for backward compatibility\n * see https://github.com/aptos-labs/aptos-ts-sdk/pull/519, will be removed in the near future.\n * Optional ledger version to sync up to before querying.\n * @returns The current amount of the specified coin held by the account.\n *\n * @example\n * ```typescript\n * import { Aptos, AptosConfig, Network } from \"@aptos-labs/ts-sdk\";\n *\n * const config = new AptosConfig({ network: Network.TESTNET });\n * const aptos = new Aptos(config);\n *\n * async function runExample() {\n * // Query the account's coin amount for a specific coin type\n * const accountCoinAmount = await aptos.getAccountCoinAmount({\n * accountAddress: \"0x1\", // replace with a real account address\n * coinType: \"0x1::aptos_coin::AptosCoin\" // specify the coin type\n * });\n *\n * console.log(`Account coin amount: ${accountCoinAmount}`);\n * }\n * runExample().catch(console.error);\n * ```\n * @group Account\n */\n async getAccountCoinAmount(args: {\n accountAddress: AccountAddressInput;\n coinType?: MoveStructId;\n faMetadataAddress?: AccountAddressInput;\n minimumLedgerVersion?: AnyNumber;\n }): Promise<number> {\n const { accountAddress, coinType, faMetadataAddress, minimumLedgerVersion } = args;\n\n if (minimumLedgerVersion) {\n // eslint-disable-next-line no-console\n console.warn(\n `minimumLedgerVersion is not used anymore, here for backward \n compatibility see https://github.com/aptos-labs/aptos-ts-sdk/pull/519, \n will be removed in the near future`,\n );\n }\n // Attempt to populate the CoinType field if the FA address is provided.\n // We cannot do this internally due to dependency cycles issue.\n let coinAssetType: MoveStructId | undefined = coinType;\n if (coinType === undefined && faMetadataAddress !== undefined) {\n coinAssetType = await memoizeAsync(\n async () => {\n try {\n const pairedCoinTypeStruct = (\n await view({\n aptosConfig: this.config,\n payload: { function: \"0x1::coin::paired_coin\", functionArguments: [faMetadataAddress] },\n })\n ).at(0) as { vec: MoveValue[] };\n\n // Check if the Option has a value, and if so, parse the struct\n if (pairedCoinTypeStruct.vec.length > 0 && isEncodedStruct(pairedCoinTypeStruct.vec[0])) {\n return parseEncodedStruct(pairedCoinTypeStruct.vec[0]) as MoveStructId;\n }\n } catch (error) {\n /* No paired coin type found */\n }\n return undefined;\n },\n `coin-mapping-${faMetadataAddress.toString()}`,\n 1000 * 60 * 5, // 5 minutes\n )();\n }\n\n let faAddress: string;\n\n if (coinType !== undefined && faMetadataAddress !== undefined) {\n faAddress = AccountAddress.from(faMetadataAddress).toStringLong();\n } else if (coinType !== undefined && faMetadataAddress === undefined) {\n // TODO Move to a separate function as defined in the AIP for coin migration\n if (coinType === APTOS_COIN) {\n faAddress = AccountAddress.A.toStringLong();\n } else {\n faAddress = createObjectAddress(AccountAddress.A, coinType).toStringLong();\n }\n } else if (coinType === undefined && faMetadataAddress !== undefined) {\n const addr = AccountAddress.from(faMetadataAddress);\n faAddress = addr.toStringLong();\n if (addr === AccountAddress.A) {\n coinAssetType = APTOS_COIN;\n }\n // The paired CoinType should be populated outside of this function in another\n // async call. We cannot do this internally due to dependency cycles issue.\n } else {\n throw new Error(\"Either coinType, faMetadataAddress, or both must be provided\");\n }\n\n // When there is a coin mapping, use that first, otherwise use the fungible asset address\n // TODO: This function's signature at the top, returns number, but it could be greater than can be represented\n if (coinAssetType !== undefined) {\n const [balanceStr] = await view<[string]>({\n aptosConfig: this.config,\n payload: {\n function: \"0x1::coin::balance\",\n typeArguments: [coinAssetType],\n functionArguments: [accountAddress],\n },\n });\n return parseInt(balanceStr, 10);\n }\n const [balanceStr] = await view<[string]>({\n aptosConfig: this.config,\n payload: {\n function: \"0x1::primary_fungible_store::balance\",\n typeArguments: [\"0x1::object::ObjectCore\"],\n functionArguments: [accountAddress, faAddress],\n },\n });\n return parseInt(balanceStr, 10);\n }\n\n /**\n * Queries an account's owned objects.\n *\n * @param args.accountAddress The account address we want to get the objects for.\n * @param args.minimumLedgerVersion Optional ledger version to sync up to before querying.\n * @param args.options.offset The starting position to start returning results from.\n * @param args.options.limit The number of results to return.\n * @param args.options.orderBy The order to sort the objects by.\n * @returns Objects array with the object data.\n *\n * @example\n * ```typescript\n * import { Aptos, AptosConfig, Network } from \"@aptos-labs/ts-sdk\";\n *\n * const config = new AptosConfig({ network: Network.TESTNET });\n * const aptos = new Aptos(config);\n *\n * async function runExample() {\n * // Get the objects owned by the specified account\n * const accountOwnedObjects = await aptos.getAccountOwnedObjects({\n * accountAddress: \"0x1\", // replace with a real account address\n * minimumLedgerVersion: 1, // optional, specify if needed\n * options: {\n * offset: 0, // optional, specify if needed\n * limit: 10, // optional, specify if needed\n * orderBy: \"created_at\", // optional, specify if needed\n * },\n * });\n *\n * console.log(accountOwnedObjects);\n * }\n * runExample().catch(console.error);\n * ```\n * @group Account\n */\n async getAccountOwnedObjects(args: {\n accountAddress: AccountAddressInput;\n minimumLedgerVersion?: AnyNumber;\n options?: PaginationArgs & OrderByArg<GetObjectDataQueryResponse[0]>;\n }): Promise<GetObjectDataQueryResponse> {\n await waitForIndexerOnVersion({\n config: this.config,\n minimumLedgerVersion: args.minimumLedgerVersion,\n processorType: ProcessorType.DEFAULT,\n });\n return getAccountOwnedObjects({\n aptosConfig: this.config,\n ...args,\n });\n }\n\n /**\n * Derives an account by providing a private key. This function resolves the provided private key type and derives the public\n * key from it.\n *\n * If the privateKey is a Secp256k1 type, it derives the account using the derived public key and auth key using the SingleKey\n * scheme locally.\n * If the privateKey is an ED25519 type, it looks up the authentication key on chain to determine whether it is a Legacy ED25519\n * key or a Unified ED25519 key, and then derives the account based on that.\n *\n * @param args - The arguments for deriving the account.\n * @param args.privateKey - An account private key.\n * @returns The derived Account type.\n *\n * @example\n * ```typescript\n * import { Aptos, AptosConfig, Network, Ed25519PrivateKey } from \"@aptos-labs/ts-sdk\";\n *\n * const config = new AptosConfig({ network: Network.TESTNET });\n * const aptos = new Aptos(config);\n *\n * async function runExample() {\n * // Deriving an account from a private key\n * const account = await aptos.deriveAccountFromPrivateKey({\n * privateKey: new Ed25519PrivateKey(\"0x123\") // replace with a real private key\n * });\n *\n * console.log(account);\n * }\n * runExample().catch(console.error);\n * ```\n * @group Account\n */\n async deriveAccountFromPrivateKey(args: { privateKey: PrivateKey }): Promise<AccountModule> {\n return deriveAccountFromPrivateKey({ aptosConfig: this.config, ...args });\n }\n}\n"],"mappings":"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","names":["Account","config","AccountAbstraction","args","getInfo","getModules","getModule","getTransactions","getResources","getResource","lookupOriginalAccountAddress","waitForIndexerOnVersion","getAccountTokensCount","getAccountOwnedTokens","getAccountOwnedTokensFromCollectionAddress","getAccountCollectionsWithOwnedTokens","getAccountTransactionsCount","getAccountCoinsData","getAccountCoinsCount","APTOS_COIN","APTOS_FA","accountAddress","coinType","faMetadataAddress","minimumLedgerVersion","coinAssetType","memoizeAsync","pairedCoinTypeStruct","view","isEncodedStruct","parseEncodedStruct","faAddress","AccountAddress","createObjectAddress","addr","balanceStr","getAccountOwnedObjects","deriveAccountFromPrivateKey"]}
1
+ {"version":3,"sources":["../../src/api/account.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { Account as AccountModule } from \"../account\";\nimport { AccountAddress, PrivateKey, AccountAddressInput, createObjectAddress } from \"../core\";\nimport {\n AccountData,\n AnyNumber,\n GetAccountCoinsDataResponse,\n GetAccountCollectionsWithOwnedTokenResponse,\n GetAccountOwnedTokensFromCollectionResponse,\n GetAccountOwnedTokensQueryResponse,\n GetObjectDataQueryResponse,\n LedgerVersionArg,\n MoveModuleBytecode,\n MoveResource,\n MoveStructId,\n MoveValue,\n OrderByArg,\n PaginationArgs,\n TokenStandardArg,\n TransactionResponse,\n WhereArg,\n} from \"../types\";\nimport {\n deriveAccountFromPrivateKey,\n getAccountCoinsCount,\n getAccountCoinsData,\n getAccountCollectionsWithOwnedTokens,\n getAccountOwnedObjects,\n getAccountOwnedTokens,\n getAccountOwnedTokensFromCollectionAddress,\n getAccountTokensCount,\n getAccountTransactionsCount,\n getInfo,\n getModule,\n getModules,\n getResource,\n getResources,\n getTransactions,\n lookupOriginalAccountAddress,\n} from \"../internal/account\";\nimport { APTOS_COIN, APTOS_FA, ProcessorType } from \"../utils/const\";\nimport { AptosConfig } from \"./aptosConfig\";\nimport { waitForIndexerOnVersion } from \"./utils\";\nimport { CurrentFungibleAssetBalancesBoolExp } from \"../types/generated/types\";\nimport { view } from \"../internal/view\";\nimport { isEncodedStruct, parseEncodedStruct } from \"../utils\";\nimport { memoizeAsync } from \"../utils/memoize\";\nimport { AccountAbstraction } from \"./account/abstraction\";\n\n/**\n * A class to query all `Account` related queries on Aptos.\n * @group Account\n */\nexport class Account {\n abstraction: AccountAbstraction;\n\n /**\n * Creates an instance of the Aptos client with the provided configuration.\n *\n * @param config - The configuration settings for the Aptos client.\n *\n * @example\n * ```typescript\n * import { Aptos, AptosConfig, Network } from \"@aptos-labs/ts-sdk\";\n *\n * async function runExample() {\n * // Initialize the Aptos client with testnet configuration\n * const config = new AptosConfig({ network: Network.TESTNET }); // specify your own network if needed\n * const aptos = new Aptos(config);\n *\n * console.log(\"Aptos client initialized:\", aptos);\n * }\n * runExample().catch(console.error);\n * ```\n * @group Account\n */\n constructor(readonly config: AptosConfig) {\n this.abstraction = new AccountAbstraction(config);\n }\n\n /**\n * Queries the current state for an Aptos account given its account address.\n *\n * @param args - The arguments for retrieving account information.\n * @param args.accountAddress - The Aptos account address to query.\n * @returns The account data.\n *\n * @example\n * ```typescript\n * import { Aptos, AptosConfig, Network } from \"@aptos-labs/ts-sdk\";\n *\n * const config = new AptosConfig({ network: Network.TESTNET });\n * const aptos = new Aptos(config);\n *\n * async function runExample() {\n * // Retrieve account information for a specific address\n * const accountInfo = await aptos.getAccountInfo({ accountAddress: \"0x1\" }); // replace with a real account address\n * console.log(accountInfo);\n * }\n * runExample().catch(console.error);\n * ```\n * @group Account\n */\n async getAccountInfo(args: { accountAddress: AccountAddressInput }): Promise<AccountData> {\n return getInfo({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Queries for all modules in an account given an account address.\n * This function may call the API multiple times to auto paginate through results.\n *\n * @param args.accountAddress - The Aptos account address to query modules for.\n * @param args.options.offset - The cursor to start returning results from. Note, this is obfuscated and is not an index.\n * @param args.options.limit - The maximum number of results to return.\n * @param args.options.ledgerVersion - The ledger version to query; if not provided, it retrieves the latest version.\n *\n * @returns - The account modules associated with the specified address.\n *\n * @example\n * ```typescript\n * import { Aptos, AptosConfig, Network } from \"@aptos-labs/ts-sdk\";\n *\n * const config = new AptosConfig({ network: Network.TESTNET });\n * const aptos = new Aptos(config);\n *\n * async function runExample() {\n * // Fetching account modules for a specific account\n * const accountModules = await aptos.getAccountModules({\n * accountAddress: \"0x1\", // replace with a real account address\n * options: {\n * offset: 0, // starting from the first module\n * limit: 10, // limiting to 10 modules\n * },\n * });\n *\n * console.log(accountModules);\n * }\n * runExample().catch(console.error);\n * ```\n * @group Account\n */\n async getAccountModules(args: {\n accountAddress: AccountAddressInput;\n options?: PaginationArgs & LedgerVersionArg;\n }): Promise<MoveModuleBytecode[]> {\n return getModules({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Queries for a specific account module given an account address and module name.\n *\n * @param args.accountAddress - The Aptos account address.\n * @param args.moduleName - The name of the module.\n * @param args.options.ledgerVersion - The ledger version to query; if not provided, it will get the latest version.\n *\n * @returns The account module associated with the specified account address and module name.\n *\n * @example\n * ```typescript\n * import { Aptos, AptosConfig, Network } from \"@aptos-labs/ts-sdk\";\n *\n * const config = new AptosConfig({ network: Network.TESTNET });\n * const aptos = new Aptos(config);\n *\n * async function runExample() {\n * // Get the account module for a specific account address and module name\n * const module = await aptos.getAccountModule({\n * accountAddress: \"0x1\", // replace with a real account address\n * moduleName: \"MyModule\" // specify the module name\n * });\n *\n * console.log(module);\n * }\n * runExample().catch(console.error);\n * ```\n * @group Account\n */\n async getAccountModule(args: {\n accountAddress: AccountAddressInput;\n moduleName: string;\n options?: LedgerVersionArg;\n }): Promise<MoveModuleBytecode> {\n return getModule({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Queries account transactions given an account address.\n * This function may call the API multiple times to auto paginate and retrieve all account transactions.\n *\n * @param args.accountAddress - The Aptos account address to query transactions for.\n * @param args.options - Optional pagination arguments.\n * @param args.options.offset - The number of transactions to start returning results from.\n * @param args.options.limit - The maximum number of results to return.\n *\n * @returns The account transactions.\n *\n * @example\n * ```typescript\n * import { Aptos, AptosConfig, Network } from \"@aptos-labs/ts-sdk\";\n *\n * const config = new AptosConfig({ network: Network.TESTNET });\n * const aptos = new Aptos(config);\n *\n * async function runExample() {\n * // Fetch transactions for a specific account\n * const transactions = await aptos.getAccountTransactions({\n * accountAddress: \"0x1\", // replace with a real account address\n * options: {\n * offset: 0, // starting from the first transaction\n * limit: 10, // limiting to 10 transactions\n * },\n * });\n *\n * console.log(transactions);\n * }\n * runExample().catch(console.error);\n * ```\n * @group Account\n */\n async getAccountTransactions(args: {\n accountAddress: AccountAddressInput;\n options?: PaginationArgs;\n }): Promise<TransactionResponse[]> {\n return getTransactions({\n aptosConfig: this.config,\n ...args,\n });\n }\n\n /**\n * Queries all account resources given an account address.\n * This function may call the API multiple times to auto paginate through results.\n *\n * @param args.accountAddress - The Aptos account address to query resources for.\n * @param args.options.offset - The cursor to start returning results from. Note, this is obfuscated and is not an index.\n * @param args.options.limit - The maximum number of results to return.\n * @param args.options.ledgerVersion - The ledger version to query; if not provided, it will get the latest version.\n * @returns Account resources.\n *\n * @example\n * ```typescript\n * import { Aptos, AptosConfig, Network } from \"@aptos-labs/ts-sdk\";\n *\n * const config = new AptosConfig({ network: Network.TESTNET });\n * const aptos = new Aptos(config);\n *\n * async function runExample() {\n * // Fetching account resources for a specific account address\n * const resources = await aptos.getAccountResources({ accountAddress: \"0x1\" }); // replace with a real account address\n * console.log(resources);\n * }\n * runExample().catch(console.error);\n * ```\n * @group Account\n */\n async getAccountResources(args: {\n accountAddress: AccountAddressInput;\n options?: PaginationArgs & LedgerVersionArg;\n }): Promise<MoveResource[]> {\n return getResources({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Queries a specific account resource given an account address and resource type.\n *\n * @template T - The typed output of the resource.\n * @param args.accountAddress - The Aptos account address to query.\n * @param args.resourceType - The string representation of an on-chain Move struct type, e.g., \"0x1::aptos_coin::AptosCoin\".\n * @param args.options.ledgerVersion - The ledger version to query; if not provided, it will get the latest version.\n * @returns The account resource of the specified type.\n *\n * @example\n * ```typescript\n * import { Aptos, AptosConfig, Network } from \"@aptos-labs/ts-sdk\";\n *\n * const config = new AptosConfig({ network: Network.TESTNET });\n * const aptos = new Aptos(config);\n *\n * async function runExample() {\n * // Get the account resource for a specific account address and resource type\n * const resource = await aptos.getAccountResource({\n * accountAddress: \"0x1\", // replace with a real account address\n * resourceType: \"0x1::aptos_coin::AptosCoin\"\n * });\n *\n * console.log(resource);\n * }\n * runExample().catch(console.error);\n * ```\n * @group Account\n */\n async getAccountResource<T extends {} = any>(args: {\n accountAddress: AccountAddressInput;\n resourceType: MoveStructId;\n options?: LedgerVersionArg;\n }): Promise<T> {\n return getResource<T>({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Looks up the account address for a given authentication key, handling both rotated and non-rotated keys.\n *\n * @param args.authenticationKey - The authentication key for which to look up the account address.\n * @param args.minimumLedgerVersion - Optional ledger version to sync up to before querying.\n * @param args.options.ledgerVersion - The ledger version to query; if not provided, it will get the latest version.\n * @returns Promise<AccountAddress> - The account address associated with the authentication key.\n *\n * @example\n * ```typescript\n * import { Aptos, AptosConfig, Network } from \"@aptos-labs/ts-sdk\";\n *\n * const config = new AptosConfig({ network: Network.TESTNET });\n * const aptos = new Aptos(config);\n *\n * async function runExample() {\n * // Look up the original account address for a given authentication key\n * const accountAddress = await aptos.lookupOriginalAccountAddress({\n * authenticationKey: \"0x1\", // replace with a real authentication key\n * });\n *\n * console.log(\"Original Account Address:\", accountAddress);\n * }\n * runExample().catch(console.error);\n * ```\n * @group Account\n */\n async lookupOriginalAccountAddress(args: {\n authenticationKey: AccountAddressInput;\n minimumLedgerVersion?: AnyNumber;\n options?: LedgerVersionArg;\n }): Promise<AccountAddress> {\n return lookupOriginalAccountAddress({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Queries the current count of tokens owned by a specified account.\n *\n * @param args - The parameters for the query.\n * @param args.accountAddress - The account address to query the token count for.\n * @param args.minimumLedgerVersion - Optional ledger version to sync up to before querying.\n * @returns The current count of tokens owned by the account.\n *\n * @example\n * ```typescript\n * import { Aptos, AptosConfig, Network } from \"@aptos-labs/ts-sdk\";\n *\n * const config = new AptosConfig({ network: Network.TESTNET });\n * const aptos = new Aptos(config);\n *\n * async function runExample() {\n * // Get the count of tokens owned by the account\n * const tokensCount = await aptos.getAccountTokensCount({ accountAddress: \"0x1\" }); // replace with a real account address\n * console.log(`Tokens Count: ${tokensCount}`);\n * }\n * runExample().catch(console.error);\n * ```\n * @group Account\n */\n async getAccountTokensCount(args: {\n accountAddress: AccountAddressInput;\n minimumLedgerVersion?: AnyNumber;\n }): Promise<number> {\n await waitForIndexerOnVersion({\n config: this.config,\n minimumLedgerVersion: args.minimumLedgerVersion,\n processorType: ProcessorType.ACCOUNT_TRANSACTION_PROCESSOR,\n });\n return getAccountTokensCount({\n aptosConfig: this.config,\n ...args,\n });\n }\n\n /**\n * Queries the tokens currently owned by a specified account, including NFTs and fungible tokens.\n * If desired, you can filter the results by a specific token standard.\n *\n * @param args.accountAddress The account address for which to retrieve owned tokens.\n * @param args.minimumLedgerVersion Optional ledger version to sync up to before querying.\n * @param args.options.tokenStandard Optional filter for the NFT standard to query for.\n * @param args.options.offset Optional number to start returning results from.\n * @param args.options.limit Optional number of results to return.\n * @param args.options.orderBy Optional order to sort the tokens by.\n * @returns An array of tokens with their respective data.\n *\n * @example\n * ```typescript\n * import { Aptos, AptosConfig, Network } from \"@aptos-labs/ts-sdk\";\n *\n * const config = new AptosConfig({ network: Network.TESTNET });\n * const aptos = new Aptos(config);\n *\n * async function runExample() {\n * // Get the tokens owned by a specific account\n * const accountOwnedTokens = await aptos.getAccountOwnedTokens({\n * accountAddress: \"0x1\", // replace with a real account address\n * options: {\n * limit: 10, // specify how many tokens to return\n * orderBy: \"created_at\", // specify the order of the results\n * },\n * });\n *\n * console.log(accountOwnedTokens);\n * }\n * runExample().catch(console.error);\n * ```\n * @group Account\n */\n async getAccountOwnedTokens(args: {\n accountAddress: AccountAddressInput;\n minimumLedgerVersion?: AnyNumber;\n options?: TokenStandardArg & PaginationArgs & OrderByArg<GetAccountOwnedTokensQueryResponse[0]>;\n }): Promise<GetAccountOwnedTokensQueryResponse> {\n await waitForIndexerOnVersion({\n config: this.config,\n minimumLedgerVersion: args.minimumLedgerVersion,\n processorType: ProcessorType.TOKEN_V2_PROCESSOR,\n });\n return getAccountOwnedTokens({\n aptosConfig: this.config,\n ...args,\n });\n }\n\n /**\n * Queries all current tokens of a specific collection that an account owns by the collection address.\n * This query returns all tokens (v1 and v2 standards) an account owns, including NFTs, fungible, soulbound, etc.\n * If you want to get only the token from a specific standard, you can pass an optional tokenStandard parameter.\n *\n * @param args.accountAddress - The account address we want to get the tokens for.\n * @param args.collectionAddress - The address of the collection being queried.\n * @param args.minimumLedgerVersion - Optional ledger version to sync up to, before querying.\n * @param args.options.tokenStandard - The NFT standard to query for.\n * @param args.options.offset - The number token to start returning results from.\n * @param args.options.limit - The number of results to return.\n * @param args.options.orderBy - The order to sort the tokens by.\n * @returns Tokens array with the token data.\n *\n * @example\n * ```typescript\n * import { Aptos, AptosConfig, Network } from \"@aptos-labs/ts-sdk\";\n *\n * const config = new AptosConfig({ network: Network.TESTNET });\n * const aptos = new Aptos(config);\n *\n * async function runExample() {\n * // Get tokens owned by a specific account in a specific collection\n * const accountOwnedTokens = await aptos.getAccountOwnedTokensFromCollectionAddress({\n * accountAddress: \"0x1\", // replace with a real account address\n * collectionAddress: \"0x2\", // replace with a real collection address\n * });\n *\n * console.log(accountOwnedTokens);\n * }\n * runExample().catch(console.error);\n * ```\n * @group Account\n */\n async getAccountOwnedTokensFromCollectionAddress(args: {\n accountAddress: AccountAddressInput;\n collectionAddress: AccountAddressInput;\n minimumLedgerVersion?: AnyNumber;\n options?: TokenStandardArg & PaginationArgs & OrderByArg<GetAccountOwnedTokensFromCollectionResponse[0]>;\n }): Promise<GetAccountOwnedTokensFromCollectionResponse> {\n await waitForIndexerOnVersion({\n config: this.config,\n minimumLedgerVersion: args.minimumLedgerVersion,\n processorType: ProcessorType.TOKEN_V2_PROCESSOR,\n });\n return getAccountOwnedTokensFromCollectionAddress({\n aptosConfig: this.config,\n ...args,\n });\n }\n\n /**\n * Queries for all collections that an account currently has tokens for, including NFTs, fungible tokens, and soulbound tokens.\n * If you want to filter by a specific token standard, you can pass an optional tokenStandard parameter.\n *\n * @param args.accountAddress - The account address we want to get the collections for.\n * @param args.minimumLedgerVersion - Optional ledger version to sync up to before querying.\n * @param args.options.tokenStandard - The NFT standard to query for.\n * @param args.options.offset - The number of the collection to start returning results from.\n * @param args.options.limit - The number of results to return.\n * @param args.options.orderBy - The order to sort the tokens by.\n * @returns Collections array with the collections data.\n *\n * @example\n * ```typescript\n * import { Aptos, AptosConfig, Network } from \"@aptos-labs/ts-sdk\";\n *\n * const config = new AptosConfig({ network: Network.TESTNET });\n * const aptos = new Aptos(config);\n *\n * async function runExample() {\n * // Get account collections with owned tokens for a specific account\n * const accountCollectionsWithOwnedTokens = await aptos.getAccountCollectionsWithOwnedTokens({\n * accountAddress: \"0x1\", // replace with a real account address\n * options: {\n * tokenStandard: \"NFT\", // specify the token standard if needed\n * limit: 10, // specify the number of results to return\n * },\n * });\n *\n * console.log(accountCollectionsWithOwnedTokens);\n * }\n * runExample().catch(console.error);\n * ```\n * @group Account\n */\n async getAccountCollectionsWithOwnedTokens(args: {\n accountAddress: AccountAddressInput;\n minimumLedgerVersion?: AnyNumber;\n options?: TokenStandardArg & PaginationArgs & OrderByArg<GetAccountCollectionsWithOwnedTokenResponse[0]>;\n }): Promise<GetAccountCollectionsWithOwnedTokenResponse> {\n await waitForIndexerOnVersion({\n config: this.config,\n minimumLedgerVersion: args.minimumLedgerVersion,\n processorType: ProcessorType.TOKEN_V2_PROCESSOR,\n });\n return getAccountCollectionsWithOwnedTokens({\n aptosConfig: this.config,\n ...args,\n });\n }\n\n /**\n * Queries the current count of transactions submitted by an account.\n *\n * @param args - The parameters for the query.\n * @param args.accountAddress - The account address we want to get the total count for.\n * @param args.minimumLedgerVersion - Optional ledger version to sync up to before querying.\n * @returns Current count of transactions made by an account.\n *\n * @example\n * ```typescript\n * import { Aptos, AptosConfig, Network } from \"@aptos-labs/ts-sdk\";\n *\n * const config = new AptosConfig({ network: Network.TESTNET });\n * const aptos = new Aptos(config);\n *\n * async function runExample() {\n * // Get the count of transactions for a specific account\n * const accountTransactionsCount = await aptos.getAccountTransactionsCount({\n * accountAddress: \"0x1\", // replace with a real account address\n * minimumLedgerVersion: 1, // specify your own minimum ledger version if needed\n * });\n *\n * console.log(accountTransactionsCount);\n * }\n * runExample().catch(console.error);\n * ```\n * @group Account\n */\n async getAccountTransactionsCount(args: {\n accountAddress: AccountAddressInput;\n minimumLedgerVersion?: AnyNumber;\n }): Promise<number> {\n await waitForIndexerOnVersion({\n config: this.config,\n minimumLedgerVersion: args.minimumLedgerVersion,\n processorType: ProcessorType.ACCOUNT_TRANSACTION_PROCESSOR,\n });\n return getAccountTransactionsCount({\n aptosConfig: this.config,\n ...args,\n });\n }\n\n /**\n * Retrieves the coins data for a specified account.\n *\n * @param args.accountAddress - The account address for which to retrieve the coin's data.\n * @param args.minimumLedgerVersion - Optional ledger version to sync up to before querying.\n * @param args.options.offset - Optional. The number of coins to start returning results from.\n * @param args.options.limit - Optional. The number of results to return.\n * @param args.options.orderBy - Optional. The order to sort the coins by.\n * @param args.options.where - Optional. Filter the results by specific criteria.\n * @returns An array containing the coins data for the specified account.\n *\n * @example\n * ```typescript\n * import { Aptos, AptosConfig, Network } from \"@aptos-labs/ts-sdk\";\n *\n * const config = new AptosConfig({ network: Network.TESTNET });\n * const aptos = new Aptos(config);\n *\n * async function runExample() {\n * // Fetching coins data for a specific account\n * const accountCoinsData = await aptos.getAccountCoinsData({\n * accountAddress: \"0x1\", // replace with a real account address\n * options: {\n * limit: 10, // specify the number of results to return\n * orderBy: { asset_type: \"asc\" }, // specify the order of results\n * },\n * });\n *\n * console.log(accountCoinsData);\n * }\n * runExample().catch(console.error);\n * ```\n * @group Account\n */\n async getAccountCoinsData(args: {\n accountAddress: AccountAddressInput;\n minimumLedgerVersion?: AnyNumber;\n options?: PaginationArgs &\n OrderByArg<GetAccountCoinsDataResponse[0]> &\n WhereArg<CurrentFungibleAssetBalancesBoolExp>;\n }): Promise<GetAccountCoinsDataResponse> {\n await waitForIndexerOnVersion({\n config: this.config,\n minimumLedgerVersion: args.minimumLedgerVersion,\n processorType: ProcessorType.FUNGIBLE_ASSET_PROCESSOR,\n });\n return getAccountCoinsData({\n aptosConfig: this.config,\n ...args,\n });\n }\n\n /**\n * Retrieves the current count of an account's coins aggregated across all types.\n *\n * @param args The parameters for the account coins count query.\n * @param args.accountAddress The account address we want to get the total count for.\n * @param args.minimumLedgerVersion Optional ledger version to sync up to before querying.\n * @returns The current count of the aggregated coins for the specified account.\n *\n * @example\n * ```typescript\n * import { Aptos, AptosConfig, Network } from \"@aptos-labs/ts-sdk\";\n *\n * const config = new AptosConfig({ network: Network.TESTNET });\n * const aptos = new Aptos(config);\n *\n * async function runExample() {\n * // Getting the account coins count for a specific account\n * const accountCoinsCount = await aptos.getAccountCoinsCount({ accountAddress: \"0x1\" }); // replace with a real account address\n * console.log(\"Account Coins Count:\", accountCoinsCount);\n * }\n * runExample().catch(console.error);\n * ```\n * @group Account\n */\n async getAccountCoinsCount(args: {\n accountAddress: AccountAddressInput;\n minimumLedgerVersion?: AnyNumber;\n }): Promise<number> {\n await waitForIndexerOnVersion({\n config: this.config,\n minimumLedgerVersion: args.minimumLedgerVersion,\n processorType: ProcessorType.FUNGIBLE_ASSET_PROCESSOR,\n });\n return getAccountCoinsCount({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Retrieves the current amount of APT for a specified account. If the account does not exist, it will return 0.\n *\n * @param args The arguments for the account query.\n * @param args.accountAddress The account address for which to retrieve the APT amount.\n * @param args.minimumLedgerVersion Optional ledger version to sync up to before querying.\n * @returns The current amount of APT for the specified account.\n *\n * @example\n * ```typescript\n * import { Aptos, AptosConfig, Network } from \"@aptos-labs/ts-sdk\";\n *\n * const config = new AptosConfig({ network: Network.TESTNET });\n * const aptos = new Aptos(config);\n *\n * async function runExample() {\n * // Get the APT amount for a specific account\n * const accountAPTAmount = await aptos.getAccountAPTAmount({ accountAddress: \"0x1\" }); // replace with a real account address\n * console.log(\"Account APT Amount:\", accountAPTAmount);\n * }\n * runExample().catch(console.error);\n * ```\n * @group Account\n */\n async getAccountAPTAmount(args: {\n accountAddress: AccountAddressInput;\n minimumLedgerVersion?: AnyNumber;\n }): Promise<number> {\n return this.getAccountCoinAmount({ coinType: APTOS_COIN, faMetadataAddress: APTOS_FA, ...args });\n }\n\n /**\n * Queries the current amount of a specified coin held by an account.\n *\n * @param args The parameters for querying the account's coin amount.\n * @param args.accountAddress The account address to query for the coin amount.\n * @param args.coinType The coin type to query. Note: If not provided, it may be automatically populated if `faMetadataAddress`\n * is specified.\n * @param args.faMetadataAddress The fungible asset metadata address to query. Note: If not provided, it may be automatically\n * populated if `coinType` is specified.\n * @param args.minimumLedgerVersion Not used anymore, here for backward compatibility\n * see https://github.com/aptos-labs/aptos-ts-sdk/pull/519, will be removed in the near future.\n * Optional ledger version to sync up to before querying.\n * @returns The current amount of the specified coin held by the account.\n *\n * @example\n * ```typescript\n * import { Aptos, AptosConfig, Network } from \"@aptos-labs/ts-sdk\";\n *\n * const config = new AptosConfig({ network: Network.TESTNET });\n * const aptos = new Aptos(config);\n *\n * async function runExample() {\n * // Query the account's coin amount for a specific coin type\n * const accountCoinAmount = await aptos.getAccountCoinAmount({\n * accountAddress: \"0x1\", // replace with a real account address\n * coinType: \"0x1::aptos_coin::AptosCoin\" // specify the coin type\n * });\n *\n * console.log(`Account coin amount: ${accountCoinAmount}`);\n * }\n * runExample().catch(console.error);\n * ```\n * @group Account\n */\n async getAccountCoinAmount(args: {\n accountAddress: AccountAddressInput;\n coinType?: MoveStructId;\n faMetadataAddress?: AccountAddressInput;\n minimumLedgerVersion?: AnyNumber;\n }): Promise<number> {\n const { accountAddress, coinType, faMetadataAddress, minimumLedgerVersion } = args;\n\n if (minimumLedgerVersion) {\n // eslint-disable-next-line no-console\n console.warn(\n `minimumLedgerVersion is not used anymore, here for backward \n compatibility see https://github.com/aptos-labs/aptos-ts-sdk/pull/519, \n will be removed in the near future`,\n );\n }\n // Attempt to populate the CoinType field if the FA address is provided.\n // We cannot do this internally due to dependency cycles issue.\n let coinAssetType: MoveStructId | undefined = coinType;\n if (coinType === undefined && faMetadataAddress !== undefined) {\n coinAssetType = await memoizeAsync(\n async () => {\n try {\n const pairedCoinTypeStruct = (\n await view({\n aptosConfig: this.config,\n payload: { function: \"0x1::coin::paired_coin\", functionArguments: [faMetadataAddress] },\n })\n ).at(0) as { vec: MoveValue[] };\n\n // Check if the Option has a value, and if so, parse the struct\n if (pairedCoinTypeStruct.vec.length > 0 && isEncodedStruct(pairedCoinTypeStruct.vec[0])) {\n return parseEncodedStruct(pairedCoinTypeStruct.vec[0]) as MoveStructId;\n }\n } catch (error) {\n /* No paired coin type found */\n }\n return undefined;\n },\n `coin-mapping-${faMetadataAddress.toString()}`,\n 1000 * 60 * 5, // 5 minutes\n )();\n }\n\n let faAddress: string;\n\n if (coinType !== undefined && faMetadataAddress !== undefined) {\n faAddress = AccountAddress.from(faMetadataAddress).toStringLong();\n } else if (coinType !== undefined && faMetadataAddress === undefined) {\n // TODO Move to a separate function as defined in the AIP for coin migration\n if (coinType === APTOS_COIN) {\n faAddress = AccountAddress.A.toStringLong();\n } else {\n faAddress = createObjectAddress(AccountAddress.A, coinType).toStringLong();\n }\n } else if (coinType === undefined && faMetadataAddress !== undefined) {\n const addr = AccountAddress.from(faMetadataAddress);\n faAddress = addr.toStringLong();\n if (addr === AccountAddress.A) {\n coinAssetType = APTOS_COIN;\n }\n // The paired CoinType should be populated outside of this function in another\n // async call. We cannot do this internally due to dependency cycles issue.\n } else {\n throw new Error(\"Either coinType, faMetadataAddress, or both must be provided\");\n }\n\n // When there is a coin mapping, use that first, otherwise use the fungible asset address\n // TODO: This function's signature at the top, returns number, but it could be greater than can be represented\n if (coinAssetType !== undefined) {\n const [balanceStr] = await view<[string]>({\n aptosConfig: this.config,\n payload: {\n function: \"0x1::coin::balance\",\n typeArguments: [coinAssetType],\n functionArguments: [accountAddress],\n },\n });\n return parseInt(balanceStr, 10);\n }\n const [balanceStr] = await view<[string]>({\n aptosConfig: this.config,\n payload: {\n function: \"0x1::primary_fungible_store::balance\",\n typeArguments: [\"0x1::object::ObjectCore\"],\n functionArguments: [accountAddress, faAddress],\n },\n });\n return parseInt(balanceStr, 10);\n }\n\n /**\n * Queries an account's owned objects.\n *\n * @param args.accountAddress The account address we want to get the objects for.\n * @param args.minimumLedgerVersion Optional ledger version to sync up to before querying.\n * @param args.options.offset The starting position to start returning results from.\n * @param args.options.limit The number of results to return.\n * @param args.options.orderBy The order to sort the objects by.\n * @returns Objects array with the object data.\n *\n * @example\n * ```typescript\n * import { Aptos, AptosConfig, Network } from \"@aptos-labs/ts-sdk\";\n *\n * const config = new AptosConfig({ network: Network.TESTNET });\n * const aptos = new Aptos(config);\n *\n * async function runExample() {\n * // Get the objects owned by the specified account\n * const accountOwnedObjects = await aptos.getAccountOwnedObjects({\n * accountAddress: \"0x1\", // replace with a real account address\n * minimumLedgerVersion: 1, // optional, specify if needed\n * options: {\n * offset: 0, // optional, specify if needed\n * limit: 10, // optional, specify if needed\n * orderBy: \"created_at\", // optional, specify if needed\n * },\n * });\n *\n * console.log(accountOwnedObjects);\n * }\n * runExample().catch(console.error);\n * ```\n * @group Account\n */\n async getAccountOwnedObjects(args: {\n accountAddress: AccountAddressInput;\n minimumLedgerVersion?: AnyNumber;\n options?: PaginationArgs & OrderByArg<GetObjectDataQueryResponse[0]>;\n }): Promise<GetObjectDataQueryResponse> {\n await waitForIndexerOnVersion({\n config: this.config,\n minimumLedgerVersion: args.minimumLedgerVersion,\n processorType: ProcessorType.DEFAULT,\n });\n return getAccountOwnedObjects({\n aptosConfig: this.config,\n ...args,\n });\n }\n\n /**\n * Derives an account by providing a private key. This function resolves the provided private key type and derives the public\n * key from it.\n *\n * If the privateKey is a Secp256k1 type, it derives the account using the derived public key and auth key using the SingleKey\n * scheme locally.\n * If the privateKey is an ED25519 type, it looks up the authentication key on chain to determine whether it is a Legacy ED25519\n * key or a Unified ED25519 key, and then derives the account based on that.\n *\n * @param args - The arguments for deriving the account.\n * @param args.privateKey - An account private key.\n * @returns The derived Account type.\n *\n * @example\n * ```typescript\n * import { Aptos, AptosConfig, Network, Ed25519PrivateKey } from \"@aptos-labs/ts-sdk\";\n *\n * const config = new AptosConfig({ network: Network.TESTNET });\n * const aptos = new Aptos(config);\n *\n * async function runExample() {\n * // Deriving an account from a private key\n * const account = await aptos.deriveAccountFromPrivateKey({\n * privateKey: new Ed25519PrivateKey(\"0x123\") // replace with a real private key\n * });\n *\n * console.log(account);\n * }\n * runExample().catch(console.error);\n * ```\n * @group Account\n */\n async deriveAccountFromPrivateKey(args: { privateKey: PrivateKey }): Promise<AccountModule> {\n return deriveAccountFromPrivateKey({ aptosConfig: this.config, ...args });\n }\n}\n"],"mappings":"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","names":["Account","config","AccountAbstraction","args","getInfo","getModules","getModule","getTransactions","getResources","getResource","lookupOriginalAccountAddress","waitForIndexerOnVersion","getAccountTokensCount","getAccountOwnedTokens","getAccountOwnedTokensFromCollectionAddress","getAccountCollectionsWithOwnedTokens","getAccountTransactionsCount","getAccountCoinsData","getAccountCoinsCount","APTOS_COIN","APTOS_FA","accountAddress","coinType","faMetadataAddress","minimumLedgerVersion","coinAssetType","memoizeAsync","pairedCoinTypeStruct","view","isEncodedStruct","parseEncodedStruct","faAddress","AccountAddress","createObjectAddress","addr","balanceStr","getAccountOwnedObjects","deriveAccountFromPrivateKey"]}
@@ -1,2 +1,2 @@
1
- import{a as Q}from"./chunk-33CBJFX2.mjs";import{c as d}from"./chunk-AC3BISWL.mjs";import{d as v,e as q,f as O,g as P,i as S,j as M,k as G,u as K}from"./chunk-VHNX2NUR.mjs";import{a as p}from"./chunk-L6FONDPA.mjs";import{a as b}from"./chunk-BI3BTSUB.mjs";import{a as k}from"./chunk-UTXEW2FT.mjs";import{b as _}from"./chunk-GQX5KMF7.mjs";import{c as C}from"./chunk-TM6IKHMX.mjs";import{a as g}from"./chunk-FN4C3CKC.mjs";import{a as T}from"./chunk-YOZBVVKL.mjs";import{b as A,d as w,e as y}from"./chunk-V7G2EDNR.mjs";import{e as h}from"./chunk-BUTMGMSD.mjs";import{e as l}from"./chunk-RJ7F4JDV.mjs";import{b as i}from"./chunk-Q4C4U6I4.mjs";async function x(e){let{aptosConfig:n,accountAddress:t}=e,{data:o}=await A({aptosConfig:n,originMethod:"getInfo",path:`accounts/${i.from(t).toString()}`});return o}async function oo(e){let{aptosConfig:n,accountAddress:t,options:o}=e;return y({aptosConfig:n,originMethod:"getModules",path:`accounts/${i.from(t).toString()}/modules`,params:{ledger_version:o?.ledgerVersion,offset:o?.offset,limit:o?.limit??1e3}})}async function eo(e){return e.options?.ledgerVersion!==void 0?I(e):T(async()=>I(e),`module-${e.accountAddress}-${e.moduleName}`,1e3*60*5)()}async function I(e){let{aptosConfig:n,accountAddress:t,moduleName:o,options:r}=e,{data:s}=await A({aptosConfig:n,originMethod:"getModule",path:`accounts/${i.from(t).toString()}/module/${o}`,params:{ledger_version:r?.ledgerVersion}});return s}async function to(e){let{aptosConfig:n,accountAddress:t,options:o}=e;return w({aptosConfig:n,originMethod:"getTransactions",path:`accounts/${i.from(t).toString()}/transactions`,params:{start:o?.offset,limit:o?.limit}})}async function no(e){let{aptosConfig:n,accountAddress:t,options:o}=e;return y({aptosConfig:n,originMethod:"getResources",path:`accounts/${i.from(t).toString()}/resources`,params:{ledger_version:o?.ledgerVersion,offset:o?.offset,limit:o?.limit??999}})}async function L(e){let{aptosConfig:n,accountAddress:t,resourceType:o,options:r}=e,{data:s}=await A({aptosConfig:n,originMethod:"getResource",path:`accounts/${i.from(t).toString()}/resource/${o}`,params:{ledger_version:r?.ledgerVersion}});return s.data}async function B(e){let{aptosConfig:n,authenticationKey:t,options:o}=e,r=await L({aptosConfig:n,accountAddress:"0x1",resourceType:"0x1::account::OriginatingAddress",options:o}),{address_map:{handle:s}}=r,c=i.from(t);try{let a=await Q({aptosConfig:n,handle:s,data:{key:c.toString(),key_type:"address",value_type:"address"},options:o});return i.from(a)}catch(a){if(a instanceof h&&a.data.error_code==="table_item_not_found")return c;throw a}}async function ro(e){let{aptosConfig:n,accountAddress:t}=e,r={owner_address:{_eq:i.from(t).toStringLong()},amount:{_gt:0}},c=await d({aptosConfig:n,query:{query:M,variables:{where_condition:r}},originMethod:"getAccountTokensCount"});return c.current_token_ownerships_v2_aggregate.aggregate?c.current_token_ownerships_v2_aggregate.aggregate.count:0}async function so(e){let{aptosConfig:n,accountAddress:t,options:o}=e,s={owner_address:{_eq:i.from(t).toStringLong()},amount:{_gt:0}};o?.tokenStandard&&(s.token_standard={_eq:o?.tokenStandard});let c={query:P,variables:{where_condition:s,offset:o?.offset,limit:o?.limit,order_by:o?.orderBy}};return(await d({aptosConfig:n,query:c,originMethod:"getAccountOwnedTokens"})).current_token_ownerships_v2}async function co(e){let{aptosConfig:n,accountAddress:t,collectionAddress:o,options:r}=e,s=i.from(t).toStringLong(),c=i.from(o).toStringLong(),a={owner_address:{_eq:s},current_token_data:{collection_id:{_eq:c}},amount:{_gt:0}};r?.tokenStandard&&(a.token_standard={_eq:r?.tokenStandard});let u={query:S,variables:{where_condition:a,offset:r?.offset,limit:r?.limit,order_by:r?.orderBy}};return(await d({aptosConfig:n,query:u,originMethod:"getAccountOwnedTokensFromCollectionAddress"})).current_token_ownerships_v2}async function io(e){let{aptosConfig:n,accountAddress:t,options:o}=e,s={owner_address:{_eq:i.from(t).toStringLong()}};o?.tokenStandard&&(s.current_collection={token_standard:{_eq:o?.tokenStandard}});let c={query:O,variables:{where_condition:s,offset:o?.offset,limit:o?.limit,order_by:o?.orderBy}};return(await d({aptosConfig:n,query:c,originMethod:"getAccountCollectionsWithOwnedTokens"})).current_collection_ownership_v2_view}async function ao(e){let{aptosConfig:n,accountAddress:t}=e,o=i.from(t).toStringLong(),s=await d({aptosConfig:n,query:{query:G,variables:{address:o}},originMethod:"getAccountTransactionsCount"});return s.account_transactions_aggregate.aggregate?s.account_transactions_aggregate.aggregate.count:0}async function uo(e){let{aptosConfig:n,accountAddress:t,coinType:o,faMetadataAddress:r}=e,s=o,c;if(o!==void 0&&r!==void 0)c=i.from(r).toStringLong();else if(o!==void 0&&r===void 0)o===l?c=i.A.toStringLong():c=b(i.A,o).toStringLong();else if(o===void 0&&r!==void 0){let m=i.from(r);c=m.toStringLong(),m===i.A&&(s=l)}else throw new Error("Either coinType, fungibleAssetAddress, or both must be provided");let a=i.from(t).toStringLong(),u={asset_type:{_eq:c}};s!==void 0&&(u={asset_type:{_in:[s,c]}});let f=await D({aptosConfig:n,accountAddress:a,options:{where:u}});return f[0]?f[0].amount:0}async function D(e){let{aptosConfig:n,accountAddress:t,options:o}=e,r=i.from(t).toStringLong(),s={...o?.where,owner_address:{_eq:r}},c={query:q,variables:{where_condition:s,offset:o?.offset,limit:o?.limit,order_by:o?.orderBy}};return(await d({aptosConfig:n,query:c,originMethod:"getAccountCoinsData"})).current_fungible_asset_balances}async function go(e){let{aptosConfig:n,accountAddress:t}=e,o=i.from(t).toStringLong(),s=await d({aptosConfig:n,query:{query:v,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 Ao(e){let{aptosConfig:n,accountAddress:t,options:o}=e,s={owner_address:{_eq:i.from(t).toStringLong()}},c={query:K,variables:{where_condition:s,offset:o?.offset,limit:o?.limit,order_by:o?.orderBy}};return(await d({aptosConfig:n,query:c,originMethod:"getAccountOwnedObjects"})).current_objects}async function po(e){let{aptosConfig:n,privateKey:t}=e,o=new k(t.publicKey());if(t instanceof _){let s=g.fromPublicKey({publicKey:o}).derivedAddress();return p.fromPrivateKey({privateKey:t,address:s})}if(t instanceof C){let r=g.fromPublicKey({publicKey:o});if(await R({authKey:r,aptosConfig:n})){let u=r.derivedAddress();return p.fromPrivateKey({privateKey:t,address:u,legacy:!1})}let c=g.fromPublicKey({publicKey:o.publicKey});if(await R({authKey:c,aptosConfig:n})){let u=c.derivedAddress();return p.fromPrivateKey({privateKey:t,address:u,legacy:!0})}}throw new Error(`Can't derive account from private key ${t}`)}async function R(e){let{aptosConfig:n,authKey:t}=e,o=await B({aptosConfig:n,authenticationKey:t.derivedAddress()});try{return await x({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{x as a,oo as b,eo as c,to as d,no as e,L as f,B as g,ro as h,so as i,co as j,io as k,ao as l,uo as m,D as n,go as o,Ao as p,po as q,R as r};
2
- //# sourceMappingURL=chunk-3EY7MT2M.mjs.map
1
+ import{a as Q}from"./chunk-RDPWCN4B.mjs";import{c as d}from"./chunk-KK5HUWF6.mjs";import{d as v,e as q,f as O,g as P,i as S,j as M,k as G,u as K}from"./chunk-VHNX2NUR.mjs";import{a as p}from"./chunk-2YKERRHD.mjs";import{a as b}from"./chunk-AIPHJFJL.mjs";import{a as k}from"./chunk-2TRQERBL.mjs";import{b as _}from"./chunk-JNNFNYDO.mjs";import{c as C}from"./chunk-7OUPEQRN.mjs";import{a as g}from"./chunk-TTY5GFMN.mjs";import{a as T}from"./chunk-YOZBVVKL.mjs";import{c as A,f as w,g as y}from"./chunk-SJDHW55X.mjs";import{e as h}from"./chunk-TH5JCPN2.mjs";import{e as l}from"./chunk-RJ7F4JDV.mjs";import{b as i}from"./chunk-LQOSHBB7.mjs";async function x(e){let{aptosConfig:n,accountAddress:t}=e,{data:o}=await A({aptosConfig:n,originMethod:"getInfo",path:`accounts/${i.from(t).toString()}`});return o}async function oo(e){let{aptosConfig:n,accountAddress:t,options:o}=e;return y({aptosConfig:n,originMethod:"getModules",path:`accounts/${i.from(t).toString()}/modules`,params:{ledger_version:o?.ledgerVersion,offset:o?.offset,limit:o?.limit??1e3}})}async function eo(e){return e.options?.ledgerVersion!==void 0?I(e):T(async()=>I(e),`module-${e.accountAddress}-${e.moduleName}`,1e3*60*5)()}async function I(e){let{aptosConfig:n,accountAddress:t,moduleName:o,options:r}=e,{data:s}=await A({aptosConfig:n,originMethod:"getModule",path:`accounts/${i.from(t).toString()}/module/${o}`,params:{ledger_version:r?.ledgerVersion}});return s}async function to(e){let{aptosConfig:n,accountAddress:t,options:o}=e;return w({aptosConfig:n,originMethod:"getTransactions",path:`accounts/${i.from(t).toString()}/transactions`,params:{start:o?.offset,limit:o?.limit}})}async function no(e){let{aptosConfig:n,accountAddress:t,options:o}=e;return y({aptosConfig:n,originMethod:"getResources",path:`accounts/${i.from(t).toString()}/resources`,params:{ledger_version:o?.ledgerVersion,offset:o?.offset,limit:o?.limit??999}})}async function L(e){let{aptosConfig:n,accountAddress:t,resourceType:o,options:r}=e,{data:s}=await A({aptosConfig:n,originMethod:"getResource",path:`accounts/${i.from(t).toString()}/resource/${o}`,params:{ledger_version:r?.ledgerVersion}});return s.data}async function B(e){let{aptosConfig:n,authenticationKey:t,options:o}=e,r=await L({aptosConfig:n,accountAddress:"0x1",resourceType:"0x1::account::OriginatingAddress",options:o}),{address_map:{handle:s}}=r,c=i.from(t);try{let a=await Q({aptosConfig:n,handle:s,data:{key:c.toString(),key_type:"address",value_type:"address"},options:o});return i.from(a)}catch(a){if(a instanceof h&&a.data.error_code==="table_item_not_found")return c;throw a}}async function ro(e){let{aptosConfig:n,accountAddress:t}=e,r={owner_address:{_eq:i.from(t).toStringLong()},amount:{_gt:0}},c=await d({aptosConfig:n,query:{query:M,variables:{where_condition:r}},originMethod:"getAccountTokensCount"});return c.current_token_ownerships_v2_aggregate.aggregate?c.current_token_ownerships_v2_aggregate.aggregate.count:0}async function so(e){let{aptosConfig:n,accountAddress:t,options:o}=e,s={owner_address:{_eq:i.from(t).toStringLong()},amount:{_gt:0}};o?.tokenStandard&&(s.token_standard={_eq:o?.tokenStandard});let c={query:P,variables:{where_condition:s,offset:o?.offset,limit:o?.limit,order_by:o?.orderBy}};return(await d({aptosConfig:n,query:c,originMethod:"getAccountOwnedTokens"})).current_token_ownerships_v2}async function co(e){let{aptosConfig:n,accountAddress:t,collectionAddress:o,options:r}=e,s=i.from(t).toStringLong(),c=i.from(o).toStringLong(),a={owner_address:{_eq:s},current_token_data:{collection_id:{_eq:c}},amount:{_gt:0}};r?.tokenStandard&&(a.token_standard={_eq:r?.tokenStandard});let u={query:S,variables:{where_condition:a,offset:r?.offset,limit:r?.limit,order_by:r?.orderBy}};return(await d({aptosConfig:n,query:u,originMethod:"getAccountOwnedTokensFromCollectionAddress"})).current_token_ownerships_v2}async function io(e){let{aptosConfig:n,accountAddress:t,options:o}=e,s={owner_address:{_eq:i.from(t).toStringLong()}};o?.tokenStandard&&(s.current_collection={token_standard:{_eq:o?.tokenStandard}});let c={query:O,variables:{where_condition:s,offset:o?.offset,limit:o?.limit,order_by:o?.orderBy}};return(await d({aptosConfig:n,query:c,originMethod:"getAccountCollectionsWithOwnedTokens"})).current_collection_ownership_v2_view}async function ao(e){let{aptosConfig:n,accountAddress:t}=e,o=i.from(t).toStringLong(),s=await d({aptosConfig:n,query:{query:G,variables:{address:o}},originMethod:"getAccountTransactionsCount"});return s.account_transactions_aggregate.aggregate?s.account_transactions_aggregate.aggregate.count:0}async function uo(e){let{aptosConfig:n,accountAddress:t,coinType:o,faMetadataAddress:r}=e,s=o,c;if(o!==void 0&&r!==void 0)c=i.from(r).toStringLong();else if(o!==void 0&&r===void 0)o===l?c=i.A.toStringLong():c=b(i.A,o).toStringLong();else if(o===void 0&&r!==void 0){let m=i.from(r);c=m.toStringLong(),m===i.A&&(s=l)}else throw new Error("Either coinType, fungibleAssetAddress, or both must be provided");let a=i.from(t).toStringLong(),u={asset_type:{_eq:c}};s!==void 0&&(u={asset_type:{_in:[s,c]}});let f=await D({aptosConfig:n,accountAddress:a,options:{where:u}});return f[0]?f[0].amount:0}async function D(e){let{aptosConfig:n,accountAddress:t,options:o}=e,r=i.from(t).toStringLong(),s={...o?.where,owner_address:{_eq:r}},c={query:q,variables:{where_condition:s,offset:o?.offset,limit:o?.limit,order_by:o?.orderBy}};return(await d({aptosConfig:n,query:c,originMethod:"getAccountCoinsData"})).current_fungible_asset_balances}async function go(e){let{aptosConfig:n,accountAddress:t}=e,o=i.from(t).toStringLong(),s=await d({aptosConfig:n,query:{query:v,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 Ao(e){let{aptosConfig:n,accountAddress:t,options:o}=e,s={owner_address:{_eq:i.from(t).toStringLong()}},c={query:K,variables:{where_condition:s,offset:o?.offset,limit:o?.limit,order_by:o?.orderBy}};return(await d({aptosConfig:n,query:c,originMethod:"getAccountOwnedObjects"})).current_objects}async function po(e){let{aptosConfig:n,privateKey:t}=e,o=new k(t.publicKey());if(t instanceof _){let s=g.fromPublicKey({publicKey:o}).derivedAddress();return p.fromPrivateKey({privateKey:t,address:s})}if(t instanceof C){let r=g.fromPublicKey({publicKey:o});if(await R({authKey:r,aptosConfig:n})){let u=r.derivedAddress();return p.fromPrivateKey({privateKey:t,address:u,legacy:!1})}let c=g.fromPublicKey({publicKey:o.publicKey});if(await R({authKey:c,aptosConfig:n})){let u=c.derivedAddress();return p.fromPrivateKey({privateKey:t,address:u,legacy:!0})}}throw new Error(`Can't derive account from private key ${t}`)}async function R(e){let{aptosConfig:n,authKey:t}=e,o=await B({aptosConfig:n,authenticationKey:t.derivedAddress()});try{return await x({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{x as a,oo as b,eo as c,to as d,no as e,L as f,B as g,ro as h,so as i,co as j,io as k,ao as l,uo as m,D as n,go as o,Ao as p,po as q,R as r};
2
+ //# sourceMappingURL=chunk-W2C5KRUQ.mjs.map
@@ -1,2 +1,2 @@
1
- import{a as w}from"./chunk-DMS7K76O.mjs";import{a as g}from"./chunk-CRFLR3ZY.mjs";import{a as S}from"./chunk-VKDTI6NX.mjs";import{a as P}from"./chunk-XAPQNCTN.mjs";import{a as m,b as f}from"./chunk-CXNF73OX.mjs";import{a as d}from"./chunk-HFCWJ6QL.mjs";import{a as I}from"./chunk-X6IHNXWY.mjs";import{a as k}from"./chunk-PNSF3E67.mjs";import{b}from"./chunk-GQX5KMF7.mjs";import{n as F,r as K}from"./chunk-G6RLN6ET.mjs";import{c as p}from"./chunk-TM6IKHMX.mjs";import{b as U}from"./chunk-Q4C4U6I4.mjs";import{b as H}from"./chunk-EBMEXURY.mjs";import{a as v}from"./chunk-XTOIL6MB.mjs";import{b as A}from"./chunk-STY74NUA.mjs";function D(n,s){if(s.serializeStr(n.jwt),s.serializeStr(n.uidKey),s.serializeFixedBytes(n.pepper),n.ephemeralKeyPair.serialize(s),n.proof===void 0)throw new Error("Cannot serialize - proof undefined");n.proof.serialize(s),s.serializeOption(n.verificationKeyHash,32)}function B(n){let s=n.deserializeStr(),h=n.deserializeStr(),u=n.deserializeFixedBytes(31),x=I.deserialize(n),z=F.deserialize(n),E=n.deserializeOption("fixedBytes",32);return{jwt:s,uidKey:h,pepper:u,ephemeralKeyPair:x,proof:z,verificationKeyHash:E}}var M;($=>{function n(e){let t=new H;switch(t.serializeU32AsUleb128(e.signingScheme),e.accountAddress.serialize(t),e.signingScheme){case 0:return e.privateKey.serialize(t),t.toUint8Array();case 2:{if(!m(e))throw new Error("Account is not a SingleKeySigner");let o=e.getAnyPublicKey();switch(t.serializeU32AsUleb128(o.variant),o.variant){case 3:return D(e,t),t.toUint8Array();case 4:{let r=e;return D(r,t),r.publicKey.jwkAddress.serialize(t),t.serializeBool(r.audless),t.toUint8Array()}case 1:case 0:return e.privateKey.serialize(t),t.toUint8Array();default:throw new Error(`Invalid public key variant: ${o.variant}`)}}case 3:{let o=e;return o.publicKey.serialize(t),t.serializeU32AsUleb128(o.signers.length),o.signers.forEach(r=>{t.serializeFixedBytes(n(r))}),t.toUint8Array()}default:throw new Error(`Deserialization of Account failed: invalid signingScheme value ${e.signingScheme}`)}}$.toBytes=n;function s(e){return A.hexInputToStringWithoutPrefix(n(e))}$.toHexStringWithoutPrefix=s;function h(e){return A.hexInputToString(n(e))}$.toHexString=h;function u(e){let{address:t,signingScheme:o}=P(e);switch(o){case 0:{let r=p.deserialize(e);return new d({privateKey:r,address:t})}case 2:{let r=e.deserializeUleb128AsU32();switch(r){case 0:{let i=p.deserialize(e);return new f({privateKey:i,address:t})}case 1:{let i=b.deserialize(e);return new f({privateKey:i,address:t})}case 3:{let i=B(e),a=K(i);return new g({...i,...a})}case 4:{let i=B(e),a=U.deserialize(e),y=e.deserializeBool(),l=K(i);return new w({...i,...l,jwkAddress:a,audless:y})}default:throw new Error(`Unsupported public key variant ${r}`)}}case 3:{let r=k.deserialize(e),i=e.deserializeUleb128AsU32(),a=new Array;for(let y=0;y<i;y+=1){let l=u(e);if(!m(l)&&!(l instanceof d))throw new Error("Deserialization of MultiKeyAccount failed. Signer is not a SingleKeySigner or Ed25519Account");a.push(l)}return new S({multiKey:r,signers:a,address:t})}default:throw new Error(`Deserialization of Account failed: invalid signingScheme value ${o}`)}}$.deserialize=u;function x(e){let t=c(e);if(!(t instanceof g))throw new Error("Deserialization of KeylessAccount failed");return t}$.keylessAccountFromHex=x;function z(e){let t=c(e);if(!(t instanceof w))throw new Error("Deserialization of FederatedKeylessAccount failed");return t}$.federatedKeylessAccountFromHex=z;function E(e){let t=c(e);if(!(t instanceof S))throw new Error("Deserialization of MultiKeyAccount failed");return t}$.multiKeyAccountFromHex=E;function j(e){let t=c(e);if(!(t instanceof f))throw new Error("Deserialization of SingleKeyAccount failed");return t}$.singleKeyAccountFromHex=j;function C(e){let t=c(e);if(!(t instanceof d))throw new Error("Deserialization of Ed25519Account failed");return t}$.ed25519AccountFromHex=C;function c(e){return u(v.fromHex(e))}$.fromHex=c;function O(e){return c(e)}$.fromBytes=O})(M||(M={}));export{M as a};
2
- //# sourceMappingURL=chunk-O37BZP2G.mjs.map
1
+ import{a as w}from"./chunk-CPFQUFVD.mjs";import{a as g}from"./chunk-YLUULY6G.mjs";import{a as S}from"./chunk-HYJQHVDZ.mjs";import{a as P}from"./chunk-ILUFGYLO.mjs";import{a as m,b as f}from"./chunk-WHVCUVZP.mjs";import{a as d}from"./chunk-MAWGZICD.mjs";import{a as I}from"./chunk-5H5D6QVX.mjs";import{b as k}from"./chunk-QUJM5W4L.mjs";import{b}from"./chunk-JNNFNYDO.mjs";import{n as F,r as K}from"./chunk-HVIF6DW6.mjs";import{c as p}from"./chunk-7OUPEQRN.mjs";import{a as v}from"./chunk-ZD2TY5N3.mjs";import{b as U}from"./chunk-LQOSHBB7.mjs";import{b as H}from"./chunk-RXHER6EA.mjs";import{b as A}from"./chunk-VHY6ZATX.mjs";function D(n,s){if(s.serializeStr(n.jwt),s.serializeStr(n.uidKey),s.serializeFixedBytes(n.pepper),n.ephemeralKeyPair.serialize(s),n.proof===void 0)throw new Error("Cannot serialize - proof undefined");n.proof.serialize(s),s.serializeOption(n.verificationKeyHash,32)}function B(n){let s=n.deserializeStr(),h=n.deserializeStr(),u=n.deserializeFixedBytes(31),x=I.deserialize(n),z=F.deserialize(n),E=n.deserializeOption("fixedBytes",32);return{jwt:s,uidKey:h,pepper:u,ephemeralKeyPair:x,proof:z,verificationKeyHash:E}}var M;($=>{function n(e){let t=new H;switch(t.serializeU32AsUleb128(e.signingScheme),e.accountAddress.serialize(t),e.signingScheme){case 0:return e.privateKey.serialize(t),t.toUint8Array();case 2:{if(!m(e))throw new Error("Account is not a SingleKeySigner");let o=e.getAnyPublicKey();switch(t.serializeU32AsUleb128(o.variant),o.variant){case 3:return D(e,t),t.toUint8Array();case 4:{let r=e;return D(r,t),r.publicKey.jwkAddress.serialize(t),t.serializeBool(r.audless),t.toUint8Array()}case 1:case 0:return e.privateKey.serialize(t),t.toUint8Array();default:throw new Error(`Invalid public key variant: ${o.variant}`)}}case 3:{let o=e;return o.publicKey.serialize(t),t.serializeU32AsUleb128(o.signers.length),o.signers.forEach(r=>{t.serializeFixedBytes(n(r))}),t.toUint8Array()}default:throw new Error(`Deserialization of Account failed: invalid signingScheme value ${e.signingScheme}`)}}$.toBytes=n;function s(e){return A.hexInputToStringWithoutPrefix(n(e))}$.toHexStringWithoutPrefix=s;function h(e){return A.hexInputToString(n(e))}$.toHexString=h;function u(e){let{address:t,signingScheme:o}=P(e);switch(o){case 0:{let r=p.deserialize(e);return new d({privateKey:r,address:t})}case 2:{let r=e.deserializeUleb128AsU32();switch(r){case 0:{let i=p.deserialize(e);return new f({privateKey:i,address:t})}case 1:{let i=b.deserialize(e);return new f({privateKey:i,address:t})}case 3:{let i=B(e),a=K(i);return new g({...i,...a})}case 4:{let i=B(e),a=U.deserialize(e),y=e.deserializeBool(),l=K(i);return new w({...i,...l,jwkAddress:a,audless:y})}default:throw new Error(`Unsupported public key variant ${r}`)}}case 3:{let r=k.deserialize(e),i=e.deserializeUleb128AsU32(),a=new Array;for(let y=0;y<i;y+=1){let l=u(e);if(!m(l)&&!(l instanceof d))throw new Error("Deserialization of MultiKeyAccount failed. Signer is not a SingleKeySigner or Ed25519Account");a.push(l)}return new S({multiKey:r,signers:a,address:t})}default:throw new Error(`Deserialization of Account failed: invalid signingScheme value ${o}`)}}$.deserialize=u;function x(e){let t=c(e);if(!(t instanceof g))throw new Error("Deserialization of KeylessAccount failed");return t}$.keylessAccountFromHex=x;function z(e){let t=c(e);if(!(t instanceof w))throw new Error("Deserialization of FederatedKeylessAccount failed");return t}$.federatedKeylessAccountFromHex=z;function E(e){let t=c(e);if(!(t instanceof S))throw new Error("Deserialization of MultiKeyAccount failed");return t}$.multiKeyAccountFromHex=E;function j(e){let t=c(e);if(!(t instanceof f))throw new Error("Deserialization of SingleKeyAccount failed");return t}$.singleKeyAccountFromHex=j;function C(e){let t=c(e);if(!(t instanceof d))throw new Error("Deserialization of Ed25519Account failed");return t}$.ed25519AccountFromHex=C;function c(e){return u(v.fromHex(e))}$.fromHex=c;function O(e){return c(e)}$.fromBytes=O})(M||(M={}));export{M as a};
2
+ //# sourceMappingURL=chunk-W4SMZ6IW.mjs.map
@@ -0,0 +1,2 @@
1
+ import{a as d}from"./chunk-QUJM5W4L.mjs";import{b as h,d as u}from"./chunk-7OUPEQRN.mjs";import{a as E}from"./chunk-A3VO773Q.mjs";import{a as g}from"./chunk-TTY5GFMN.mjs";var o=class o extends d{constructor(t){let{publicKeys:e,threshold:r}=t;if(super({publicKeys:e}),e.length>o.MAX_KEYS||e.length<o.MIN_KEYS)throw new Error(`Must have between ${o.MIN_KEYS} and ${o.MAX_KEYS} public keys, inclusive`);if(r<o.MIN_THRESHOLD||r>e.length)throw new Error(`Threshold must be between ${o.MIN_THRESHOLD} and ${e.length}, inclusive`);this.publicKeys=e,this.threshold=r}verifySignature(t){let{message:e,signature:r}=t;if(!(r instanceof y))return!1;let s=[];for(let i=0;i<4;i+=1)for(let n=0;n<8;n+=1)if((r.bitmap[i]&1<<7-n)!==0){let l=i*8+n;s.push(l)}if(s.length!==r.signatures.length)throw new Error("Bitmap and signatures length mismatch");if(s.length<this.threshold)throw new Error("Not enough signatures");for(let i=0;i<s.length;i+=1)if(!this.publicKeys[s[i]].verifySignature({message:e,signature:r.signatures[i]}))return!1;return!0}authKey(){return g.fromSchemeAndBytes({scheme:1,input:this.toUint8Array()})}toUint8Array(){let t=new Uint8Array(this.publicKeys.length*h.LENGTH+1);return this.publicKeys.forEach((e,r)=>{t.set(e.toUint8Array(),r*h.LENGTH)}),t[this.publicKeys.length*h.LENGTH]=this.threshold,t}serialize(t){t.serializeBytes(this.toUint8Array())}static deserialize(t){let e=t.deserializeBytes(),r=e[e.length-1],s=[];for(let i=0;i<e.length-1;i+=h.LENGTH){let n=i;s.push(new h(e.subarray(n,n+h.LENGTH)))}return new o({publicKeys:s,threshold:r})}getIndex(t){return super.getIndex(t)}};o.MAX_KEYS=32,o.MIN_KEYS=2,o.MIN_THRESHOLD=1;var m=o,a=class a extends E{constructor(t){super();let{signatures:e,bitmap:r}=t;if(e.length>a.MAX_SIGNATURES_SUPPORTED)throw new Error(`The number of signatures cannot be greater than ${a.MAX_SIGNATURES_SUPPORTED}`);if(this.signatures=e,!(r instanceof Uint8Array))this.bitmap=a.createBitmap({bits:r});else{if(r.length!==a.BITMAP_LEN)throw new Error(`"bitmap" length should be ${a.BITMAP_LEN}`);this.bitmap=r}}toUint8Array(){let t=new Uint8Array(this.signatures.length*u.LENGTH+a.BITMAP_LEN);return this.signatures.forEach((e,r)=>{t.set(e.toUint8Array(),r*u.LENGTH)}),t.set(this.bitmap,this.signatures.length*u.LENGTH),t}serialize(t){t.serializeBytes(this.toUint8Array())}static deserialize(t){let e=t.deserializeBytes(),r=e.subarray(e.length-4),s=[];for(let i=0;i<e.length-r.length;i+=u.LENGTH){let n=i;s.push(new u(e.subarray(n,n+u.LENGTH)))}return new a({signatures:s,bitmap:r})}static createBitmap(t){let{bits:e}=t,r=128,s=new Uint8Array([0,0,0,0]),i=new Set;return e.forEach((n,c)=>{if(n>=a.MAX_SIGNATURES_SUPPORTED)throw new Error(`Cannot have a signature larger than ${a.MAX_SIGNATURES_SUPPORTED-1}.`);if(i.has(n))throw new Error("Duplicate bits detected.");if(c>0&&n<=e[c-1])throw new Error("The bits need to be sorted in ascending order.");i.add(n);let l=Math.floor(n/8),b=s[l];b|=r>>n%8,s[l]=b}),s}};a.MAX_SIGNATURES_SUPPORTED=32,a.BITMAP_LEN=4;var y=a;export{m as a,y as b};
2
+ //# sourceMappingURL=chunk-WFKPVKU3.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/core/crypto/multiEd25519.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { Deserializer, Serializer } from \"../../bcs\";\nimport { SigningScheme as AuthenticationKeyScheme } from \"../../types\";\nimport { AuthenticationKey } from \"../authenticationKey\";\nimport { Ed25519PublicKey, Ed25519Signature } from \"./ed25519\";\nimport { AbstractMultiKey } from \"./multiKey\";\nimport { VerifySignatureArgs } from \"./publicKey\";\nimport { Signature } from \"./signature\";\n\n/**\n * Represents the public key of a K-of-N Ed25519 multi-sig transaction.\n *\n * A K-of-N multi-sig transaction requires at least K out of N authorized signers to sign the transaction\n * for it to be executed. This class encapsulates the logic for managing the public keys and the threshold\n * for valid signatures.\n *\n * @see {@link https://aptos.dev/integration/creating-a-signed-transaction/ | Creating a Signed Transaction}\n * @group Implementation\n * @category Serialization\n */\nexport class MultiEd25519PublicKey extends AbstractMultiKey {\n /**\n * Maximum number of public keys supported\n * @group Implementation\n * @category Serialization\n */\n static readonly MAX_KEYS = 32;\n\n /**\n * Minimum number of public keys needed\n * @group Implementation\n * @category Serialization\n */\n static readonly MIN_KEYS = 2;\n\n /**\n * Minimum threshold for the number of valid signatures required\n * @group Implementation\n * @category Serialization\n */\n static readonly MIN_THRESHOLD = 1;\n\n /**\n * List of Ed25519 public keys for this LegacyMultiEd25519PublicKey\n * @group Implementation\n * @category Serialization\n */\n public readonly publicKeys: Ed25519PublicKey[];\n\n /**\n * The minimum number of valid signatures required, for the number of public keys specified\n * @group Implementation\n * @category Serialization\n */\n public readonly threshold: number;\n\n /**\n * Public key for a K-of-N multi-sig transaction. A K-of-N multi-sig transaction means that for such a\n * transaction to be executed, at least K out of the N authorized signers have signed the transaction\n * and passed the check conducted by the chain.\n *\n * @see {@link\n * https://aptos.dev/integration/creating-a-signed-transaction/ | Creating a Signed Transaction}\n * @param args - A wrapper to let you choose the param order.\n * @param args.publicKeys A list of public keys\n * @param args.threshold At least \"threshold\" signatures must be valid\n * @group Implementation\n * @category Serialization\n */\n constructor(args: { publicKeys: Ed25519PublicKey[]; threshold: number }) {\n const { publicKeys, threshold } = args;\n super({ publicKeys });\n\n // Validate number of public keys\n if (publicKeys.length > MultiEd25519PublicKey.MAX_KEYS || publicKeys.length < MultiEd25519PublicKey.MIN_KEYS) {\n throw new Error(\n `Must have between ${MultiEd25519PublicKey.MIN_KEYS} and ` +\n `${MultiEd25519PublicKey.MAX_KEYS} public keys, inclusive`,\n );\n }\n\n // Validate threshold: must be between 1 and the number of public keys, inclusive\n if (threshold < MultiEd25519PublicKey.MIN_THRESHOLD || threshold > publicKeys.length) {\n throw new Error(\n `Threshold must be between ${MultiEd25519PublicKey.MIN_THRESHOLD} and ${publicKeys.length}, inclusive`,\n );\n }\n\n this.publicKeys = publicKeys;\n this.threshold = threshold;\n }\n\n // region AccountPublicKey\n\n /**\n * Verifies a multi-signature against a given message.\n * This function ensures that the provided signatures meet the required threshold and are valid for the given message.\n *\n * @param args - The arguments for verifying the signature.\n * @param args.message - The message that was signed.\n * @param args.signature - The multi-signature containing multiple signatures and a bitmap indicating which signatures are valid.\n * @returns True if the signature is valid; otherwise, false.\n * @throws Error if the bitmap and signatures length mismatch or if there are not enough valid signatures.\n * @group Implementation\n * @category Serialization\n */\n verifySignature(args: VerifySignatureArgs): boolean {\n const { message, signature } = args;\n if (!(signature instanceof MultiEd25519Signature)) {\n return false;\n }\n\n const indices: number[] = [];\n for (let i = 0; i < 4; i += 1) {\n for (let j = 0; j < 8; j += 1) {\n // eslint-disable-next-line no-bitwise\n const bitIsSet = (signature.bitmap[i] & (1 << (7 - j))) !== 0;\n if (bitIsSet) {\n const index = i * 8 + j;\n indices.push(index);\n }\n }\n }\n\n if (indices.length !== signature.signatures.length) {\n throw new Error(\"Bitmap and signatures length mismatch\");\n }\n\n if (indices.length < this.threshold) {\n throw new Error(\"Not enough signatures\");\n }\n\n for (let i = 0; i < indices.length; i += 1) {\n const publicKey = this.publicKeys[indices[i]];\n if (!publicKey.verifySignature({ message, signature: signature.signatures[i] })) {\n return false;\n }\n }\n return true;\n }\n\n /**\n * Generates an authentication key based on the current instance's byte representation.\n * This function is essential for creating a secure authentication key that can be used for various cryptographic operations.\n *\n * @returns {AuthenticationKey} The generated authentication key.\n * @group Implementation\n * @category Serialization\n */\n authKey(): AuthenticationKey {\n return AuthenticationKey.fromSchemeAndBytes({\n scheme: AuthenticationKeyScheme.MultiEd25519,\n input: this.toUint8Array(),\n });\n }\n\n /**\n * Converts a PublicKeys into Uint8Array (bytes) with: bytes = p1_bytes | ... | pn_bytes | threshold\n * @group Implementation\n * @category Serialization\n */\n toUint8Array(): Uint8Array {\n const bytes = new Uint8Array(this.publicKeys.length * Ed25519PublicKey.LENGTH + 1);\n this.publicKeys.forEach((k: Ed25519PublicKey, i: number) => {\n bytes.set(k.toUint8Array(), i * Ed25519PublicKey.LENGTH);\n });\n\n bytes[this.publicKeys.length * Ed25519PublicKey.LENGTH] = this.threshold;\n\n return bytes;\n }\n\n // endregion\n\n // region Serializable\n\n /**\n * Serializes the current instance into bytes using the provided serializer.\n * This allows for the conversion of the instance's data into a format suitable for transmission or storage.\n *\n * @param serializer - The serializer used to convert the instance into bytes.\n * @group Implementation\n * @category Serialization\n */\n serialize(serializer: Serializer): void {\n serializer.serializeBytes(this.toUint8Array());\n }\n\n /**\n * Deserializes a MultiEd25519Signature from the provided deserializer.\n * This function helps in reconstructing a MultiEd25519Signature object from its serialized byte representation.\n *\n * @param deserializer - The deserializer instance used to read the serialized data.\n * @group Implementation\n * @category Serialization\n */\n static deserialize(deserializer: Deserializer): MultiEd25519PublicKey {\n const bytes = deserializer.deserializeBytes();\n const threshold = bytes[bytes.length - 1];\n\n const keys: Ed25519PublicKey[] = [];\n\n for (let i = 0; i < bytes.length - 1; i += Ed25519PublicKey.LENGTH) {\n const begin = i;\n keys.push(new Ed25519PublicKey(bytes.subarray(begin, begin + Ed25519PublicKey.LENGTH)));\n }\n return new MultiEd25519PublicKey({ publicKeys: keys, threshold });\n }\n\n // endregion\n\n /**\n * Get the index of the provided public key.\n *\n * This function retrieves the index of a specified public key within the MultiKey.\n * If the public key does not exist, it throws an error.\n *\n * @param publicKey - The public key to find the index for.\n * @returns The corresponding index of the public key, if it exists.\n * @throws Error - If the public key is not found in the MultiKey.\n * @group Implementation\n */\n getIndex(publicKey: Ed25519PublicKey): number {\n return super.getIndex(publicKey);\n }\n}\n\n/**\n * Represents the signature of a K-of-N Ed25519 multi-sig transaction.\n *\n * @see {@link https://aptos.dev/integration/creating-a-signed-transaction/#multisignature-transactions | Creating a Signed Transaction}\n * @group Implementation\n * @category Serialization\n */\nexport class MultiEd25519Signature extends Signature {\n /**\n * Maximum number of Ed25519 signatures supported\n * @group Implementation\n * @category Serialization\n */\n static MAX_SIGNATURES_SUPPORTED = 32;\n\n /**\n * Number of bytes in the bitmap representing who signed the transaction (32-bits)\n * @group Implementation\n * @category Serialization\n */\n static BITMAP_LEN: number = 4;\n\n /**\n * The list of underlying Ed25519 signatures\n * @group Implementation\n * @category Serialization\n */\n public readonly signatures: Ed25519Signature[];\n\n /**\n * 32-bit Bitmap representing who signed the transaction\n *\n * This is represented where each public key can be masked to determine whether the message was signed by that key.\n * @group Implementation\n * @category Serialization\n */\n public readonly bitmap: Uint8Array;\n\n /**\n * Signature for a K-of-N multi-sig transaction.\n *\n * @see {@link\n * https://aptos.dev/integration/creating-a-signed-transaction/#multisignature-transactions | Creating a Signed Transaction}\n *\n * @param args.signatures A list of signatures\n * @param args.bitmap 4 bytes, at most 32 signatures are supported. If Nth bit value is `1`, the Nth\n * signature should be provided in `signatures`. Bits are read from left to right.\n * Alternatively, you can specify an array of bitmap positions.\n * Valid position should range between 0 and 31.\n * @see MultiEd25519Signature.createBitmap\n * @group Implementation\n * @category Serialization\n */\n constructor(args: { signatures: Ed25519Signature[]; bitmap: Uint8Array | number[] }) {\n super();\n const { signatures, bitmap } = args;\n\n if (signatures.length > MultiEd25519Signature.MAX_SIGNATURES_SUPPORTED) {\n throw new Error(\n `The number of signatures cannot be greater than ${MultiEd25519Signature.MAX_SIGNATURES_SUPPORTED}`,\n );\n }\n this.signatures = signatures;\n\n if (!(bitmap instanceof Uint8Array)) {\n this.bitmap = MultiEd25519Signature.createBitmap({ bits: bitmap });\n } else if (bitmap.length !== MultiEd25519Signature.BITMAP_LEN) {\n throw new Error(`\"bitmap\" length should be ${MultiEd25519Signature.BITMAP_LEN}`);\n } else {\n this.bitmap = bitmap;\n }\n }\n\n // region AccountSignature\n\n /**\n * Converts a MultiSignature into Uint8Array (bytes) with `bytes = s1_bytes | ... | sn_bytes | bitmap`\n * @group Implementation\n * @category Serialization\n */\n toUint8Array(): Uint8Array {\n const bytes = new Uint8Array(this.signatures.length * Ed25519Signature.LENGTH + MultiEd25519Signature.BITMAP_LEN);\n this.signatures.forEach((k: Ed25519Signature, i: number) => {\n bytes.set(k.toUint8Array(), i * Ed25519Signature.LENGTH);\n });\n\n bytes.set(this.bitmap, this.signatures.length * Ed25519Signature.LENGTH);\n\n return bytes;\n }\n\n // endregion\n\n // region Serializable\n\n serialize(serializer: Serializer): void {\n serializer.serializeBytes(this.toUint8Array());\n }\n\n static deserialize(deserializer: Deserializer): MultiEd25519Signature {\n const bytes = deserializer.deserializeBytes();\n const bitmap = bytes.subarray(bytes.length - 4);\n\n const signatures: Ed25519Signature[] = [];\n\n for (let i = 0; i < bytes.length - bitmap.length; i += Ed25519Signature.LENGTH) {\n const begin = i;\n signatures.push(new Ed25519Signature(bytes.subarray(begin, begin + Ed25519Signature.LENGTH)));\n }\n return new MultiEd25519Signature({ signatures, bitmap });\n }\n\n // endregion\n\n /**\n * Helper method to create a bitmap out of the specified bit positions.\n * This function allows you to set specific bits in a 32-bit long bitmap based on the provided positions.\n *\n * @param args The arguments for creating the bitmap.\n * @param args.bits The bitmap positions that should be set. A position starts at index 0. Valid positions should range between 0 and 31.\n *\n * @example\n * Here's an example of valid `bits`\n * ```\n * [0, 2, 31]\n * ```\n * `[0, 2, 31]` means the 1st, 3rd and 32nd bits should be set in the bitmap.\n * The result bitmap should be 0b1010000000000000000000000000001\n *\n * @returns bitmap that is 32 bits long.\n * @group Implementation\n * @category Serialization\n */\n static createBitmap(args: { bits: number[] }): Uint8Array {\n const { bits } = args;\n // Bits are read from left to right. e.g. 0b10000000 represents the first bit is set in one byte.\n // The decimal value of 0b10000000 is 128.\n const firstBitInByte = 128;\n const bitmap = new Uint8Array([0, 0, 0, 0]);\n\n // Check if duplicates exist in bits\n const dupCheckSet = new Set();\n\n bits.forEach((bit: number, index) => {\n if (bit >= MultiEd25519Signature.MAX_SIGNATURES_SUPPORTED) {\n throw new Error(`Cannot have a signature larger than ${MultiEd25519Signature.MAX_SIGNATURES_SUPPORTED - 1}.`);\n }\n\n if (dupCheckSet.has(bit)) {\n throw new Error(\"Duplicate bits detected.\");\n }\n\n if (index > 0 && bit <= bits[index - 1]) {\n throw new Error(\"The bits need to be sorted in ascending order.\");\n }\n\n dupCheckSet.add(bit);\n\n const byteOffset = Math.floor(bit / 8);\n\n let byte = bitmap[byteOffset];\n\n // eslint-disable-next-line no-bitwise\n byte |= firstBitInByte >> bit % 8;\n\n bitmap[byteOffset] = byte;\n });\n\n return bitmap;\n }\n}\n"],"mappings":"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","names":["_MultiEd25519PublicKey","AbstractMultiKey","args","publicKeys","threshold","message","signature","MultiEd25519Signature","indices","j","index","AuthenticationKey","bytes","Ed25519PublicKey","k","i","serializer","deserializer","keys","begin","publicKey","MultiEd25519PublicKey","_MultiEd25519Signature","Signature","signatures","bitmap","Ed25519Signature","bits","firstBitInByte","dupCheckSet","bit","byteOffset","byte"]}
@@ -1,2 +1,2 @@
1
- import{d as p}from"./chunk-V2EXS6TM.mjs";import{d as s}from"./chunk-EGZI6EJ2.mjs";import{a as g,b as y}from"./chunk-UTXEW2FT.mjs";import{b as a}from"./chunk-GQX5KMF7.mjs";import{c}from"./chunk-TM6IKHMX.mjs";import{b as u}from"./chunk-Q4C4U6I4.mjs";function P(t){return typeof t=="object"&&t!==null&&"getAnyPublicKey"in t&&typeof t.getAnyPublicKey=="function"}var A=class t{constructor(e){this.signingScheme=2;let{privateKey:r,address:n}=e;this.privateKey=r,this.publicKey=new g(r.publicKey()),this.accountAddress=n?u.from(n):this.publicKey.authKey().derivedAddress()}getAnyPublicKey(){return this.publicKey}static generate(e={}){let{scheme:r=0}=e,n;switch(r){case 0:n=c.generate();break;case 2:n=a.generate();break;default:throw new Error(`Unsupported signature scheme ${r}`)}return new t({privateKey:n})}static fromDerivationPath(e){let{scheme:r=0,path:n,mnemonic:o}=e,i;switch(r){case 0:i=c.fromDerivationPath(n,o);break;case 2:i=a.fromDerivationPath(n,o);break;default:throw new Error(`Unsupported signature scheme ${r}`)}return new t({privateKey:i})}verifySignature(e){return this.publicKey.verifySignature(e)}signWithAuthenticator(e){return new s(this.publicKey,this.sign(e))}signTransactionWithAuthenticator(e){return new s(this.publicKey,this.signTransaction(e))}sign(e){return new y(this.privateKey.sign(e))}signTransaction(e){return this.sign(p(e))}static fromEd25519Account(e){return new t({privateKey:e.privateKey,address:e.accountAddress})}};export{P as a,A as b};
2
- //# sourceMappingURL=chunk-CXNF73OX.mjs.map
1
+ import{d as p}from"./chunk-P5CM4C2G.mjs";import{d as s}from"./chunk-BPHCRTHD.mjs";import{a as g,b as y}from"./chunk-2TRQERBL.mjs";import{b as a}from"./chunk-JNNFNYDO.mjs";import{c}from"./chunk-7OUPEQRN.mjs";import{b as u}from"./chunk-LQOSHBB7.mjs";function P(t){return typeof t=="object"&&t!==null&&"getAnyPublicKey"in t&&typeof t.getAnyPublicKey=="function"}var A=class t{constructor(e){this.signingScheme=2;let{privateKey:r,address:n}=e;this.privateKey=r,this.publicKey=new g(r.publicKey()),this.accountAddress=n?u.from(n):this.publicKey.authKey().derivedAddress()}getAnyPublicKey(){return this.publicKey}static generate(e={}){let{scheme:r=0}=e,n;switch(r){case 0:n=c.generate();break;case 2:n=a.generate();break;default:throw new Error(`Unsupported signature scheme ${r}`)}return new t({privateKey:n})}static fromDerivationPath(e){let{scheme:r=0,path:n,mnemonic:o}=e,i;switch(r){case 0:i=c.fromDerivationPath(n,o);break;case 2:i=a.fromDerivationPath(n,o);break;default:throw new Error(`Unsupported signature scheme ${r}`)}return new t({privateKey:i})}verifySignature(e){return this.publicKey.verifySignature(e)}signWithAuthenticator(e){return new s(this.publicKey,this.sign(e))}signTransactionWithAuthenticator(e){return new s(this.publicKey,this.signTransaction(e))}sign(e){return new y(this.privateKey.sign(e))}signTransaction(e){return this.sign(p(e))}static fromEd25519Account(e){return new t({privateKey:e.privateKey,address:e.accountAddress})}};export{P as a,A as b};
2
+ //# sourceMappingURL=chunk-WHVCUVZP.mjs.map
@@ -1,2 +1,2 @@
1
- import{a as i,b as o,c as a,d as c,e as p,f as d,g,h as u,i as A,j as y,k as m,l,m as T,n as f,o as C,p as I,q as O,r as P,s as D,t as V,u as S,v as h,w as R,x as G}from"./chunk-U2SJIG2T.mjs";import{a as e}from"./chunk-JF66JS2R.mjs";import{b as s}from"./chunk-Q4C4U6I4.mjs";var L=class{constructor(t){this.config=t}async getCollectionData(t){await e({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"});let{creatorAddress:N,collectionName:_,options:n}=t,w=s.from(N),r={collection_name:{_eq:_},creator_address:{_eq:w.toStringLong()}};return n?.tokenStandard&&(r.token_standard={_eq:n?.tokenStandard??"v2"}),d({aptosConfig:this.config,options:{where:r}})}async getCollectionDataByCreatorAddressAndCollectionName(t){return await e({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),g({aptosConfig:this.config,...t})}async getCollectionDataByCreatorAddress(t){return await e({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),u({aptosConfig:this.config,...t})}async getCollectionDataByCollectionId(t){return await e({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),A({aptosConfig:this.config,...t})}async getCollectionId(t){return await e({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),y({aptosConfig:this.config,...t})}async getDigitalAssetData(t){return await e({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),i({aptosConfig:this.config,...t})}async getCurrentDigitalAssetOwnership(t){return await e({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),o({aptosConfig:this.config,...t})}async getOwnedDigitalAssets(t){return await e({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),a({aptosConfig:this.config,...t})}async getDigitalAssetActivity(t){return await e({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),c({aptosConfig:this.config,...t})}async createCollectionTransaction(t){return p({aptosConfig:this.config,...t})}async mintDigitalAssetTransaction(t){return m({aptosConfig:this.config,...t})}async transferDigitalAssetTransaction(t){return l({aptosConfig:this.config,...t})}async mintSoulBoundTransaction(t){return T({aptosConfig:this.config,...t})}async burnDigitalAssetTransaction(t){return f({aptosConfig:this.config,...t})}async freezeDigitalAssetTransaferTransaction(t){return C({aptosConfig:this.config,...t})}async unfreezeDigitalAssetTransaferTransaction(t){return I({aptosConfig:this.config,...t})}async setDigitalAssetDescriptionTransaction(t){return O({aptosConfig:this.config,...t})}async setDigitalAssetNameTransaction(t){return P({aptosConfig:this.config,...t})}async setDigitalAssetURITransaction(t){return D({aptosConfig:this.config,...t})}async addDigitalAssetPropertyTransaction(t){return V({aptosConfig:this.config,...t})}async removeDigitalAssetPropertyTransaction(t){return S({aptosConfig:this.config,...t})}async updateDigitalAssetPropertyTransaction(t){return h({aptosConfig:this.config,...t})}async addDigitalAssetTypedPropertyTransaction(t){return R({aptosConfig:this.config,...t})}async updateDigitalAssetTypedPropertyTransaction(t){return G({aptosConfig:this.config,...t})}};export{L as a};
2
- //# sourceMappingURL=chunk-QBFGY74I.mjs.map
1
+ import{a as i,b as o,c as a,d as c,e as p,f as d,g,h as u,i as A,j as y,k as m,l,m as T,n as f,o as C,p as I,q as O,r as P,s as D,t as V,u as S,v as h,w as R,x as G}from"./chunk-E5PAUR4N.mjs";import{a as e}from"./chunk-MFLHAVIW.mjs";import{b as s}from"./chunk-LQOSHBB7.mjs";var L=class{constructor(t){this.config=t}async getCollectionData(t){await e({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"});let{creatorAddress:N,collectionName:_,options:n}=t,w=s.from(N),r={collection_name:{_eq:_},creator_address:{_eq:w.toStringLong()}};return n?.tokenStandard&&(r.token_standard={_eq:n?.tokenStandard??"v2"}),d({aptosConfig:this.config,options:{where:r}})}async getCollectionDataByCreatorAddressAndCollectionName(t){return await e({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),g({aptosConfig:this.config,...t})}async getCollectionDataByCreatorAddress(t){return await e({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),u({aptosConfig:this.config,...t})}async getCollectionDataByCollectionId(t){return await e({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),A({aptosConfig:this.config,...t})}async getCollectionId(t){return await e({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),y({aptosConfig:this.config,...t})}async getDigitalAssetData(t){return await e({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),i({aptosConfig:this.config,...t})}async getCurrentDigitalAssetOwnership(t){return await e({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),o({aptosConfig:this.config,...t})}async getOwnedDigitalAssets(t){return await e({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),a({aptosConfig:this.config,...t})}async getDigitalAssetActivity(t){return await e({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),c({aptosConfig:this.config,...t})}async createCollectionTransaction(t){return p({aptosConfig:this.config,...t})}async mintDigitalAssetTransaction(t){return m({aptosConfig:this.config,...t})}async transferDigitalAssetTransaction(t){return l({aptosConfig:this.config,...t})}async mintSoulBoundTransaction(t){return T({aptosConfig:this.config,...t})}async burnDigitalAssetTransaction(t){return f({aptosConfig:this.config,...t})}async freezeDigitalAssetTransaferTransaction(t){return C({aptosConfig:this.config,...t})}async unfreezeDigitalAssetTransaferTransaction(t){return I({aptosConfig:this.config,...t})}async setDigitalAssetDescriptionTransaction(t){return O({aptosConfig:this.config,...t})}async setDigitalAssetNameTransaction(t){return P({aptosConfig:this.config,...t})}async setDigitalAssetURITransaction(t){return D({aptosConfig:this.config,...t})}async addDigitalAssetPropertyTransaction(t){return V({aptosConfig:this.config,...t})}async removeDigitalAssetPropertyTransaction(t){return S({aptosConfig:this.config,...t})}async updateDigitalAssetPropertyTransaction(t){return h({aptosConfig:this.config,...t})}async addDigitalAssetTypedPropertyTransaction(t){return R({aptosConfig:this.config,...t})}async updateDigitalAssetTypedPropertyTransaction(t){return G({aptosConfig:this.config,...t})}};export{L as a};
2
+ //# sourceMappingURL=chunk-WLDYBSOG.mjs.map
@@ -1,2 +1,2 @@
1
- import{c as l}from"./chunk-AZWVCBK2.mjs";import{a as k,b as y,d as w,e as U,f as z,g as D,h as J,i as d,j as L,l as R,m as W,n as X,o as q,p as H,q as K,s as i,t as Q}from"./chunk-ABXES4FS.mjs";import{c as j}from"./chunk-3EY7MT2M.mjs";import{b as C,c as x,d as M,e as O,f as _,g as a,h as V,i as G,n as P}from"./chunk-G4O6FXCF.mjs";import{a as T,c as I,d as f}from"./chunk-IDTLNF4M.mjs";import{a as g,b as E,c as v,d as b,e as F,f as $,g as S}from"./chunk-ORMOQWWH.mjs";import{b as m}from"./chunk-Q4C4U6I4.mjs";import{a as p}from"./chunk-3OLFJ65O.mjs";var Y=new TextEncoder;function yn(n){return n?.map(e=>y(e)?l(e):e)??[]}async function B(n,e,t,u){let r=await j({aptosConfig:u,accountAddress:n,moduleName:e});if(r.abi)return r.abi.exposed_functions.find(s=>s.name===t)}async function Tn(n,e,t,u){let r=await B(n,e,t,u);if(!r)throw new Error(`Could not find function ABI for '${n}::${e}::${t}'`);let s=[];for(let c=0;c<r.params.length;c+=1)s.push(l(r.params[c],{allowGenerics:!0}));return{typeParameters:r.generic_type_params,parameters:s}}async function ln(n,e,t,u){let r=await B(n,e,t,u);if(!r)throw new Error(`Could not find entry function ABI for '${n}::${e}::${t}'`);if(!r.is_entry)throw new Error(`'${n}::${e}::${t}' is not an entry function`);let s=Q(r),c=[];for(let o=s;o<r.params.length;o+=1)c.push(l(r.params[o],{allowGenerics:!0}));return{signers:s,typeParameters:r.generic_type_params,parameters:c}}async function An(n,e,t,u){let r=await B(n,e,t,u);if(!r)throw new Error(`Could not find view function ABI for '${n}::${e}::${t}'`);if(!r.is_view)throw new Error(`'${n}::${e}::${t}' is not an view function`);let s=[];for(let o=0;o<r.params.length;o+=1)s.push(l(r.params[o],{allowGenerics:!0}));let c=[];for(let o=0;o<r.return.length;o+=1)c.push(l(r.return[o],{allowGenerics:!0}));return{typeParameters:r.generic_type_params,parameters:s,returnTypes:c}}function gn(n,e,t,u,r){return n instanceof p?n:p.newBytes(Z(e,t,n,u,r).bcsToBytes())}function Z(n,e,t,u,r){if(u>=e.parameters.length)throw new Error(`Too many arguments for '${n}', expected ${e.parameters.length}`);let s=e.parameters[u];return A(t,s,u,r)}function A(n,e,t,u){return D(n)?(h(e,n,t),n):N(n,e,t,u)}function N(n,e,t,u){if(e.isBool()){if(k(n))return new g(n);if(y(n)){if(n==="true")return new g(!0);if(n==="false")return new g(!1)}i("boolean",t)}if(e.isAddress()){if(y(n))return m.fromString(n);i("string | AccountAddress",t)}if(e.isU8()){let r=w(n);if(r!==void 0)return new E(r);i("number | string",t)}if(e.isU16()){let r=w(n);if(r!==void 0)return new v(r);i("number | string",t)}if(e.isU32()){let r=w(n);if(r!==void 0)return new b(r);i("number | string",t)}if(e.isU64()){if(U(n))return new F(BigInt(n));i("bigint | number | string",t)}if(e.isU128()){if(U(n))return new $(BigInt(n));i("bigint | number | string",t)}if(e.isU256()){if(U(n))return new S(BigInt(n));i("bigint | number | string",t)}if(e.isGeneric()){let r=e.value;if(r<0||r>=u.length)throw new Error(`Generic argument ${e.toString()} is invalid for argument ${t}`);return A(n,u[r],t,u)}if(e.isVector()){if(e.value.isU8()){if(y(n))return T.U8(Y.encode(n));if(n instanceof Uint8Array)return T.U8(n);if(n instanceof ArrayBuffer)return T.U8(new Uint8Array(n))}if(y(n)&&n.startsWith("["))return A(JSON.parse(n),e,t,u);if(Array.isArray(n))return new T(n.map(r=>A(r,e.value,t,u)));throw new Error(`Type mismatch for argument ${t}, type '${e.toString()}'`)}if(e.isStruct()){if(e.isString()){if(y(n))return new I(n);i("string",t)}if(e.isObject()){if(y(n))return m.fromString(n);i("string | AccountAddress",t)}if(e.isOption()){if(z(n)){let r=e.value.typeArgs[0];return r instanceof C?new f(null):r instanceof G?new f(null):r instanceof x?new f(null):r instanceof M?new f(null):r instanceof O?new f(null):r instanceof _?new f(null):r instanceof a?new f(null):r instanceof V?new f(null):new f(null)}return new f(A(n,e.value.typeArgs[0],t,u))}throw new Error(`Unsupported struct input type for argument ${t}, type '${e.toString()}'`)}throw new Error(`Type mismatch for argument ${t}, type '${e.toString()}'`)}function h(n,e,t){if(n.isBool()){if(J(e))return;i("Bool",t)}if(n.isAddress()){if(d(e))return;i("AccountAddress",t)}if(n.isU8()){if(R(e))return;i("U8",t)}if(n.isU16()){if(W(e))return;i("U16",t)}if(n.isU32()){if(X(e))return;i("U32",t)}if(n.isU64()){if(q(e))return;i("U64",t)}if(n.isU128()){if(H(e))return;i("U128",t)}if(n.isU256()){if(K(e))return;i("U256",t)}if(n.isVector()){if(e instanceof T){e.values.length>0&&h(n.value,e.values[0],t);return}i("MoveVector",t)}if(n instanceof P){if(n.isString()){if(L(e))return;i("MoveString",t)}if(n.isObject()){if(d(e))return;i("AccountAddress",t)}if(n.isOption()){if(e instanceof f){e.value!==void 0&&h(n.value.typeArgs[0],e.value,t);return}i("MoveOption",t)}}throw new Error(`Type mismatch for argument ${t}, expected '${n.toString()}'`)}export{yn as a,B as b,Tn as c,ln as d,An as e,gn as f,Z as g,A as h};
2
- //# sourceMappingURL=chunk-HEAWDTLG.mjs.map
1
+ import{c as l}from"./chunk-GI4AR6DQ.mjs";import{a as k,b as y,d as w,e as U,f as z,g as D,h as J,i as d,j as L,l as R,m as W,n as X,o as q,p as H,q as K,s as i,t as Q}from"./chunk-IMYNN4TW.mjs";import{c as j}from"./chunk-W2C5KRUQ.mjs";import{b as C,c as x,d as M,e as O,f as _,g as a,h as V,i as G,n as P}from"./chunk-5W2ERBGY.mjs";import{a as T,c as I,d as f}from"./chunk-HHWJHOFZ.mjs";import{a as g,b as E,c as v,d as b,e as F,f as $,g as S}from"./chunk-TKXEVD7A.mjs";import{b as m}from"./chunk-LQOSHBB7.mjs";import{a as p}from"./chunk-3OLFJ65O.mjs";var Y=new TextEncoder;function yn(n){return n?.map(e=>y(e)?l(e):e)??[]}async function B(n,e,t,u){let r=await j({aptosConfig:u,accountAddress:n,moduleName:e});if(r.abi)return r.abi.exposed_functions.find(s=>s.name===t)}async function Tn(n,e,t,u){let r=await B(n,e,t,u);if(!r)throw new Error(`Could not find function ABI for '${n}::${e}::${t}'`);let s=[];for(let c=0;c<r.params.length;c+=1)s.push(l(r.params[c],{allowGenerics:!0}));return{typeParameters:r.generic_type_params,parameters:s}}async function ln(n,e,t,u){let r=await B(n,e,t,u);if(!r)throw new Error(`Could not find entry function ABI for '${n}::${e}::${t}'`);if(!r.is_entry)throw new Error(`'${n}::${e}::${t}' is not an entry function`);let s=Q(r),c=[];for(let o=s;o<r.params.length;o+=1)c.push(l(r.params[o],{allowGenerics:!0}));return{signers:s,typeParameters:r.generic_type_params,parameters:c}}async function An(n,e,t,u){let r=await B(n,e,t,u);if(!r)throw new Error(`Could not find view function ABI for '${n}::${e}::${t}'`);if(!r.is_view)throw new Error(`'${n}::${e}::${t}' is not an view function`);let s=[];for(let o=0;o<r.params.length;o+=1)s.push(l(r.params[o],{allowGenerics:!0}));let c=[];for(let o=0;o<r.return.length;o+=1)c.push(l(r.return[o],{allowGenerics:!0}));return{typeParameters:r.generic_type_params,parameters:s,returnTypes:c}}function gn(n,e,t,u,r){return n instanceof p?n:p.newBytes(Z(e,t,n,u,r).bcsToBytes())}function Z(n,e,t,u,r){if(u>=e.parameters.length)throw new Error(`Too many arguments for '${n}', expected ${e.parameters.length}`);let s=e.parameters[u];return A(t,s,u,r)}function A(n,e,t,u){return D(n)?(h(e,n,t),n):N(n,e,t,u)}function N(n,e,t,u){if(e.isBool()){if(k(n))return new g(n);if(y(n)){if(n==="true")return new g(!0);if(n==="false")return new g(!1)}i("boolean",t)}if(e.isAddress()){if(y(n))return m.fromString(n);i("string | AccountAddress",t)}if(e.isU8()){let r=w(n);if(r!==void 0)return new E(r);i("number | string",t)}if(e.isU16()){let r=w(n);if(r!==void 0)return new v(r);i("number | string",t)}if(e.isU32()){let r=w(n);if(r!==void 0)return new b(r);i("number | string",t)}if(e.isU64()){if(U(n))return new F(BigInt(n));i("bigint | number | string",t)}if(e.isU128()){if(U(n))return new $(BigInt(n));i("bigint | number | string",t)}if(e.isU256()){if(U(n))return new S(BigInt(n));i("bigint | number | string",t)}if(e.isGeneric()){let r=e.value;if(r<0||r>=u.length)throw new Error(`Generic argument ${e.toString()} is invalid for argument ${t}`);return A(n,u[r],t,u)}if(e.isVector()){if(e.value.isU8()){if(y(n))return T.U8(Y.encode(n));if(n instanceof Uint8Array)return T.U8(n);if(n instanceof ArrayBuffer)return T.U8(new Uint8Array(n))}if(y(n)&&n.startsWith("["))return A(JSON.parse(n),e,t,u);if(Array.isArray(n))return new T(n.map(r=>A(r,e.value,t,u)));throw new Error(`Type mismatch for argument ${t}, type '${e.toString()}'`)}if(e.isStruct()){if(e.isString()){if(y(n))return new I(n);i("string",t)}if(e.isObject()){if(y(n))return m.fromString(n);i("string | AccountAddress",t)}if(e.isOption()){if(z(n)){let r=e.value.typeArgs[0];return r instanceof C?new f(null):r instanceof G?new f(null):r instanceof x?new f(null):r instanceof M?new f(null):r instanceof O?new f(null):r instanceof _?new f(null):r instanceof a?new f(null):r instanceof V?new f(null):new f(null)}return new f(A(n,e.value.typeArgs[0],t,u))}throw new Error(`Unsupported struct input type for argument ${t}, type '${e.toString()}'`)}throw new Error(`Type mismatch for argument ${t}, type '${e.toString()}'`)}function h(n,e,t){if(n.isBool()){if(J(e))return;i("Bool",t)}if(n.isAddress()){if(d(e))return;i("AccountAddress",t)}if(n.isU8()){if(R(e))return;i("U8",t)}if(n.isU16()){if(W(e))return;i("U16",t)}if(n.isU32()){if(X(e))return;i("U32",t)}if(n.isU64()){if(q(e))return;i("U64",t)}if(n.isU128()){if(H(e))return;i("U128",t)}if(n.isU256()){if(K(e))return;i("U256",t)}if(n.isVector()){if(e instanceof T){e.values.length>0&&h(n.value,e.values[0],t);return}i("MoveVector",t)}if(n instanceof P){if(n.isString()){if(L(e))return;i("MoveString",t)}if(n.isObject()){if(d(e))return;i("AccountAddress",t)}if(n.isOption()){if(e instanceof f){e.value!==void 0&&h(n.value.typeArgs[0],e.value,t);return}i("MoveOption",t)}}throw new Error(`Type mismatch for argument ${t}, expected '${n.toString()}'`)}export{yn as a,B as b,Tn as c,ln as d,An as e,gn as f,Z as g,A as h};
2
+ //# sourceMappingURL=chunk-XRVZAEQO.mjs.map
@@ -0,0 +1,2 @@
1
+ import{c as a}from"./chunk-PIPDQFL2.mjs";import{d as e}from"./chunk-752TOOCA.mjs";import{b as r}from"./chunk-RXHER6EA.mjs";async function v(s){let{aptosConfig:o,payload:p,options:n}=s,y=await a({...p,aptosConfig:o}),t=new r;y.serialize(t);let c=t.toUint8Array(),{data:g}=await e({aptosConfig:o,path:"view",originMethod:"view",contentType:"application/x.aptos.view_function+bcs",acceptType:"application/x-bcs",params:{ledger_version:n?.ledgerVersion},body:c}),i=new Uint8Array(g);return n?.convert?n.convert(i):i}export{v as a};
2
+ //# sourceMappingURL=chunk-XSBUL2WP.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/internal/experimental.ts"],"sourcesContent":["import { AptosConfig } from \"../api/aptosConfig\";\nimport { generateViewFunctionPayload, InputViewFunctionData } from \"../transactions\";\nimport { LedgerVersionArg, MimeType } from \"../types\";\nimport { Serializer } from \"../bcs\";\nimport { postBinaryAptosFullNode } from \"../client\";\n\nexport async function viewBinary(args: {\n aptosConfig: AptosConfig;\n payload: InputViewFunctionData;\n options?: LedgerVersionArg & { convert?: undefined };\n}): Promise<Uint8Array>;\n\nexport async function viewBinary<T extends {}>(args: {\n aptosConfig: AptosConfig;\n payload: InputViewFunctionData;\n options?: LedgerVersionArg & { convert?: (input: Uint8Array) => T };\n}): Promise<T>;\n\n/**\n * Reads a binary view function, and converts into the appropriate type if a converter is provided.\n * @experimental\n * @param args\n */\nexport async function viewBinary<T extends {} = Uint8Array>(args: {\n aptosConfig: AptosConfig;\n payload: InputViewFunctionData;\n options?: LedgerVersionArg & { convert?: (input: Uint8Array) => T };\n}): Promise<Uint8Array | T> {\n const { aptosConfig, payload, options } = args;\n const viewFunctionPayload = await generateViewFunctionPayload({\n ...payload,\n aptosConfig,\n });\n\n const serializer = new Serializer();\n viewFunctionPayload.serialize(serializer);\n const bytes = serializer.toUint8Array();\n\n const { data } = await postBinaryAptosFullNode<Uint8Array>({\n aptosConfig,\n path: \"view\",\n originMethod: \"view\",\n contentType: MimeType.BCS_VIEW_FUNCTION,\n acceptType: MimeType.BCS,\n params: { ledger_version: options?.ledgerVersion },\n body: bytes,\n });\n\n const array = new Uint8Array(data);\n if (options?.convert) {\n return options.convert(array);\n }\n\n return array;\n}\n"],"mappings":"2HAuBA,eAAsBA,EAAsCC,EAIhC,CAC1B,GAAM,CAAE,YAAAC,EAAa,QAAAC,EAAS,QAAAC,CAAQ,EAAIH,EACpCI,EAAsB,MAAMC,EAA4B,CAC5D,GAAGH,EACH,YAAAD,CACF,CAAC,EAEKK,EAAa,IAAIC,EACvBH,EAAoB,UAAUE,CAAU,EACxC,IAAME,EAAQF,EAAW,aAAa,EAEhC,CAAE,KAAAG,CAAK,EAAI,MAAMC,EAAoC,CACzD,YAAAT,EACA,KAAM,OACN,aAAc,OACd,oDACA,+BACA,OAAQ,CAAE,eAAgBE,GAAS,aAAc,EACjD,KAAMK,CACR,CAAC,EAEKG,EAAQ,IAAI,WAAWF,CAAI,EACjC,OAAIN,GAAS,QACJA,EAAQ,QAAQQ,CAAK,EAGvBA,CACT","names":["viewBinary","args","aptosConfig","payload","options","viewFunctionPayload","generateViewFunctionPayload","serializer","Serializer","bytes","data","postBinaryAptosFullNode","array"]}
@@ -1,2 +1,2 @@
1
- import{i as s}from"./chunk-G6RLN6ET.mjs";import{b as c}from"./chunk-EMURYYVO.mjs";import{a as d}from"./chunk-FN4C3CKC.mjs";import{b as i}from"./chunk-Q4C4U6I4.mjs";import{b as n}from"./chunk-EBMEXURY.mjs";var u=class r extends c{constructor(e,t){super(),this.jwkAddress=i.from(e),this.keylessPublicKey=t}authKey(){let e=new n;return e.serializeU32AsUleb128(4),e.serializeFixedBytes(this.bcsToBytes()),d.fromSchemeAndBytes({scheme:2,input:e.toUint8Array()})}verifySignature(e){throw new Error("Not yet implemented")}serialize(e){this.jwkAddress.serialize(e),this.keylessPublicKey.serialize(e)}static deserialize(e){let t=i.deserialize(e),l=s.deserialize(e);return new r(t,l)}static isPublicKey(e){return e instanceof r}static create(e){return new r(e.jwkAddress,s.create(e))}static fromJwtAndPepper(e){return new r(e.jwkAddress,s.fromJwtAndPepper(e))}static isInstance(e){return"jwkAddress"in e&&e.jwkAddress instanceof i&&"keylessPublicKey"in e&&e.keylessPublicKey instanceof s}};export{u as a};
2
- //# sourceMappingURL=chunk-DNWFDS7F.mjs.map
1
+ import{i as s}from"./chunk-HVIF6DW6.mjs";import{b as c}from"./chunk-H4YAL2IL.mjs";import{a as d}from"./chunk-TTY5GFMN.mjs";import{b as i}from"./chunk-LQOSHBB7.mjs";import{b as n}from"./chunk-RXHER6EA.mjs";var u=class r extends c{constructor(e,t){super(),this.jwkAddress=i.from(e),this.keylessPublicKey=t}authKey(){let e=new n;return e.serializeU32AsUleb128(4),e.serializeFixedBytes(this.bcsToBytes()),d.fromSchemeAndBytes({scheme:2,input:e.toUint8Array()})}verifySignature(e){throw new Error("Not yet implemented")}serialize(e){this.jwkAddress.serialize(e),this.keylessPublicKey.serialize(e)}static deserialize(e){let t=i.deserialize(e),l=s.deserialize(e);return new r(t,l)}static isPublicKey(e){return e instanceof r}static create(e){return new r(e.jwkAddress,s.create(e))}static fromJwtAndPepper(e){return new r(e.jwkAddress,s.fromJwtAndPepper(e))}static isInstance(e){return"jwkAddress"in e&&e.jwkAddress instanceof i&&"keylessPublicKey"in e&&e.keylessPublicKey instanceof s}};export{u as a};
2
+ //# sourceMappingURL=chunk-XW3BXTCZ.mjs.map
@@ -1,2 +1,2 @@
1
- import{b as o}from"./chunk-3HFZN7L5.mjs";import{a as r}from"./chunk-JF66JS2R.mjs";var t=class{constructor(e){this.config=e}async getObjectDataByObjectAddress(e){return await r({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"objects_processor"}),o({aptosConfig:this.config,...e})}};export{t as a};
2
- //# sourceMappingURL=chunk-L2AQG3G3.mjs.map
1
+ import{b as o}from"./chunk-K233I26C.mjs";import{a as r}from"./chunk-MFLHAVIW.mjs";var t=class{constructor(e){this.config=e}async getObjectDataByObjectAddress(e){return await r({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"objects_processor"}),o({aptosConfig:this.config,...e})}};export{t as a};
2
+ //# sourceMappingURL=chunk-Y65PKZLK.mjs.map