@aptos-labs/ts-sdk 1.33.2 → 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.
- package/README.md +15 -9
- package/dist/common/{accountAddress-Cf1amU98.d.ts → accountAddress-CuHovHdK.d.ts} +22 -2
- package/dist/common/chunk-RX5UBAME.js +4 -0
- package/dist/common/chunk-RX5UBAME.js.map +1 -0
- package/dist/common/cli/index.d.ts +1 -1
- package/dist/common/cli/index.js +1 -1
- package/dist/common/cli/index.js.map +1 -1
- package/dist/common/index.d.ts +3139 -2533
- package/dist/common/index.js +33 -35
- package/dist/common/index.js.map +1 -1
- package/dist/esm/account/AbstractKeylessAccount.d.mts +1 -0
- package/dist/esm/account/AbstractKeylessAccount.mjs +1 -1
- package/dist/esm/account/AbstractedAccount.d.mts +91 -0
- package/dist/esm/account/AbstractedAccount.mjs +2 -0
- package/dist/esm/account/Account.d.mts +2 -1
- package/dist/esm/account/Account.mjs +1 -1
- package/dist/esm/account/AccountUtils.d.mts +17 -16
- package/dist/esm/account/AccountUtils.mjs +1 -1
- package/dist/esm/account/Ed25519Account.d.mts +3 -2
- package/dist/esm/account/Ed25519Account.mjs +1 -1
- package/dist/esm/account/EphemeralKeyPair.d.mts +1 -0
- package/dist/esm/account/EphemeralKeyPair.mjs +1 -1
- package/dist/esm/account/FederatedKeylessAccount.d.mts +1 -0
- package/dist/esm/account/FederatedKeylessAccount.mjs +1 -1
- package/dist/esm/account/KeylessAccount.d.mts +1 -0
- package/dist/esm/account/KeylessAccount.mjs +1 -1
- package/dist/esm/account/MultiEd25519Account.d.mts +108 -0
- package/dist/esm/account/MultiEd25519Account.mjs +2 -0
- package/dist/esm/account/MultiKeyAccount.d.mts +2 -2
- package/dist/esm/account/MultiKeyAccount.mjs +1 -1
- package/dist/esm/account/SingleKeyAccount.d.mts +1 -0
- package/dist/esm/account/SingleKeyAccount.mjs +1 -1
- package/dist/esm/account/index.d.mts +4 -0
- package/dist/esm/account/index.mjs +1 -1
- package/dist/esm/account/utils.d.mts +1 -0
- package/dist/esm/account/utils.mjs +1 -1
- package/dist/esm/api/account/abstraction.d.mts +209 -0
- package/dist/esm/api/account/abstraction.mjs +2 -0
- package/dist/esm/api/account.d.mts +4 -1
- package/dist/esm/api/account.mjs +1 -1
- package/dist/esm/api/ans.d.mts +1 -0
- package/dist/esm/api/ans.mjs +1 -1
- package/dist/esm/api/aptos.d.mts +6 -1
- package/dist/esm/api/aptos.mjs +1 -1
- package/dist/esm/api/aptosConfig.d.mts +1 -0
- package/dist/esm/api/aptosConfig.mjs +1 -1
- package/dist/esm/api/coin.d.mts +3 -2
- package/dist/esm/api/coin.mjs +1 -1
- package/dist/esm/api/digitalAsset.d.mts +1 -0
- package/dist/esm/api/digitalAsset.mjs +1 -1
- package/dist/esm/api/event.d.mts +1 -0
- package/dist/esm/api/event.mjs +1 -1
- package/dist/esm/api/experimental.d.mts +83 -0
- package/dist/esm/api/experimental.mjs +2 -0
- package/dist/esm/api/experimental.mjs.map +1 -0
- package/dist/esm/api/faucet.d.mts +1 -0
- package/dist/esm/api/faucet.mjs +1 -1
- package/dist/esm/api/fungibleAsset.d.mts +1 -0
- package/dist/esm/api/fungibleAsset.mjs +1 -1
- package/dist/esm/api/general.d.mts +1 -0
- package/dist/esm/api/general.mjs +1 -1
- package/dist/esm/api/index.d.mts +4 -0
- package/dist/esm/api/index.mjs +1 -1
- package/dist/esm/api/keyless.d.mts +2 -1
- package/dist/esm/api/keyless.mjs +1 -1
- package/dist/esm/api/object.d.mts +1 -0
- package/dist/esm/api/object.mjs +1 -1
- package/dist/esm/api/staking.d.mts +1 -0
- package/dist/esm/api/staking.mjs +1 -1
- package/dist/esm/api/table.d.mts +1 -0
- package/dist/esm/api/table.mjs +1 -1
- package/dist/esm/api/transaction.d.mts +2 -0
- package/dist/esm/api/transaction.mjs +1 -1
- package/dist/esm/api/transactionSubmission/build.d.mts +66 -0
- package/dist/esm/api/transactionSubmission/build.mjs +1 -1
- package/dist/esm/api/transactionSubmission/management.d.mts +1 -0
- package/dist/esm/api/transactionSubmission/management.mjs +1 -1
- package/dist/esm/api/transactionSubmission/sign.d.mts +1 -0
- package/dist/esm/api/transactionSubmission/sign.mjs +1 -1
- package/dist/esm/api/transactionSubmission/sign.mjs.map +1 -1
- package/dist/esm/api/transactionSubmission/simulate.d.mts +1 -0
- package/dist/esm/api/transactionSubmission/simulate.mjs +1 -1
- package/dist/esm/api/transactionSubmission/submit.d.mts +1 -0
- package/dist/esm/api/transactionSubmission/submit.mjs +1 -1
- package/dist/esm/api/utils.d.mts +1 -0
- package/dist/esm/api/utils.mjs +1 -1
- package/dist/esm/bcs/consts.d.mts +1 -0
- package/dist/esm/bcs/deserializer.d.mts +1 -0
- package/dist/esm/bcs/deserializer.mjs +1 -1
- package/dist/esm/bcs/index.d.mts +1 -0
- package/dist/esm/bcs/index.mjs +1 -1
- package/dist/esm/bcs/serializable/entryFunctionBytes.d.mts +1 -0
- package/dist/esm/bcs/serializable/entryFunctionBytes.mjs +1 -1
- package/dist/esm/bcs/serializable/fixedBytes.d.mts +1 -0
- package/dist/esm/bcs/serializable/fixedBytes.mjs +1 -1
- package/dist/esm/bcs/serializable/movePrimitives.d.mts +1 -0
- package/dist/esm/bcs/serializable/movePrimitives.mjs +1 -1
- package/dist/esm/bcs/serializable/moveStructs.d.mts +1 -0
- package/dist/esm/bcs/serializable/moveStructs.mjs +1 -1
- package/dist/esm/bcs/serializer.d.mts +1 -0
- package/dist/esm/bcs/serializer.mjs +1 -1
- package/dist/esm/{chunk-7IY3DTEF.mjs → chunk-27ESCVVC.mjs} +2 -2
- package/dist/esm/chunk-2SAYQUUX.mjs +2 -0
- package/dist/esm/chunk-2SAYQUUX.mjs.map +1 -0
- package/dist/esm/{chunk-VUIHJIMX.mjs → chunk-2TRQERBL.mjs} +2 -2
- package/dist/esm/chunk-2V636AYW.mjs +2 -0
- package/dist/esm/{chunk-XTJOA5QN.mjs → chunk-2YKERRHD.mjs} +2 -2
- package/dist/esm/chunk-2ZLFQBT2.mjs +2 -0
- package/dist/esm/chunk-2ZLFQBT2.mjs.map +1 -0
- package/dist/esm/{chunk-5YWH3XPN.mjs → chunk-3LDVJ2YK.mjs} +2 -2
- package/dist/esm/chunk-3OLFJ65O.mjs +2 -0
- package/dist/esm/chunk-3OLFJ65O.mjs.map +1 -0
- package/dist/esm/{chunk-ONTWK5FU.mjs → chunk-44EHAKKW.mjs} +2 -2
- package/dist/esm/{chunk-OEQ2U7GK.mjs → chunk-53IBOHXB.mjs} +2 -2
- package/dist/esm/{chunk-YCQUYDZI.mjs → chunk-5H5D6QVX.mjs} +2 -2
- package/dist/esm/{chunk-G4O6FXCF.mjs → chunk-5W2ERBGY.mjs} +2 -2
- package/dist/esm/{chunk-NYETBDSR.mjs → chunk-67A5U2X6.mjs} +2 -2
- package/dist/esm/{chunk-AXYARCYT.mjs → chunk-6IJZRG3U.mjs} +2 -2
- package/dist/esm/{chunk-N4DM5FYH.mjs → chunk-6KZT3KFZ.mjs} +2 -2
- package/dist/esm/chunk-752TOOCA.mjs +2 -0
- package/dist/esm/chunk-752TOOCA.mjs.map +1 -0
- package/dist/esm/{chunk-2WCATZVL.mjs → chunk-7A2KHJ3D.mjs} +2 -2
- package/dist/esm/{chunk-ROT6S6BM.mjs → chunk-7CRQNXR5.mjs} +2 -2
- package/dist/esm/{chunk-FZD5RWSZ.mjs → chunk-7OUPEQRN.mjs} +2 -2
- package/dist/esm/chunk-A3VO773Q.mjs +2 -0
- package/dist/esm/{chunk-OHZURQPY.mjs → chunk-AEGA5N2W.mjs} +2 -2
- package/dist/esm/{chunk-BI3BTSUB.mjs → chunk-AIPHJFJL.mjs} +2 -2
- package/dist/esm/chunk-AQWKKSRN.mjs +2 -0
- package/dist/esm/chunk-AQWKKSRN.mjs.map +1 -0
- package/dist/esm/{chunk-4EUS4E6S.mjs → chunk-B23VO5TB.mjs} +2 -2
- package/dist/esm/chunk-BHVSIRNF.mjs +2 -0
- package/dist/esm/chunk-BHVSIRNF.mjs.map +1 -0
- package/dist/esm/chunk-BMPHQ3E7.mjs +2 -0
- package/dist/esm/chunk-BPHCRTHD.mjs +2 -0
- package/dist/esm/chunk-BPHCRTHD.mjs.map +1 -0
- package/dist/esm/{chunk-DYATTONT.mjs → chunk-BQYKFATL.mjs} +2 -2
- package/dist/esm/chunk-BY3XFRUM.mjs +2 -0
- package/dist/esm/{chunk-77AEKF7K.mjs.map → chunk-BY3XFRUM.mjs.map} +1 -1
- package/dist/esm/chunk-CGTMSLVZ.mjs +2 -0
- package/dist/esm/chunk-CGTMSLVZ.mjs.map +1 -0
- package/dist/esm/{chunk-QQEK7WVP.mjs → chunk-CPAAEEF4.mjs} +2 -2
- package/dist/esm/{chunk-ZAIVZDOL.mjs → chunk-CPFQUFVD.mjs} +2 -2
- package/dist/esm/chunk-CXLNTATW.mjs +2 -0
- package/dist/esm/chunk-CXLNTATW.mjs.map +1 -0
- package/dist/esm/{chunk-ZPV7HPA4.mjs → chunk-DAJFOJ3L.mjs} +2 -2
- package/dist/esm/chunk-DOVH6HPL.mjs +2 -0
- package/dist/esm/{chunk-KOORZTHC.mjs → chunk-E5PAUR4N.mjs} +2 -2
- package/dist/esm/{chunk-E7JDVKFY.mjs → chunk-EGCL6KA6.mjs} +2 -2
- package/dist/esm/{chunk-TOBQ5UE6.mjs → chunk-ERLDXTIY.mjs} +2 -2
- package/dist/esm/chunk-FJ5J7CVW.mjs +2 -0
- package/dist/esm/chunk-FJ5J7CVW.mjs.map +1 -0
- package/dist/esm/{chunk-X6UNY6YM.mjs → chunk-FOEPRHAC.mjs} +2 -2
- package/dist/esm/{chunk-XYB6KYKW.mjs → chunk-G5F5ZOH5.mjs} +2 -2
- package/dist/esm/chunk-GFPEB22G.mjs +1 -0
- package/dist/esm/chunk-GFPEB22G.mjs.map +1 -0
- package/dist/esm/{chunk-AZWVCBK2.mjs → chunk-GI4AR6DQ.mjs} +2 -2
- package/dist/esm/{chunk-3RCAJICY.mjs → chunk-GRRBXHVG.mjs} +2 -2
- package/dist/esm/{chunk-5EYTHMRZ.mjs → chunk-GTVMJJQQ.mjs} +2 -2
- package/dist/esm/{chunk-2TJ6OTVD.mjs → chunk-GU4MD5ST.mjs} +2 -2
- package/dist/esm/chunk-H4YAL2IL.mjs +2 -0
- package/dist/esm/{chunk-ZGVNZE7J.mjs → chunk-HBTJN4RJ.mjs} +2 -2
- package/dist/esm/{chunk-IDTLNF4M.mjs → chunk-HHWJHOFZ.mjs} +2 -2
- package/dist/esm/{chunk-XZ4JRYCE.mjs → chunk-HKL4MFNL.mjs} +2 -2
- package/dist/esm/{chunk-IEUEMBFD.mjs → chunk-HVIF6DW6.mjs} +2 -2
- package/dist/esm/{chunk-MWBRD43V.mjs → chunk-HYJQHVDZ.mjs} +2 -2
- package/dist/esm/chunk-HYJQHVDZ.mjs.map +1 -0
- package/dist/esm/{chunk-JJM6ELMS.mjs → chunk-ILUFGYLO.mjs} +2 -2
- package/dist/esm/chunk-IMTC3J2M.mjs +2 -0
- package/dist/esm/chunk-IMTC3J2M.mjs.map +1 -0
- package/dist/esm/chunk-IMYNN4TW.mjs +2 -0
- package/dist/esm/chunk-IMYNN4TW.mjs.map +1 -0
- package/dist/esm/{chunk-DOQV5BSA.mjs → chunk-IOHESHLR.mjs} +2 -2
- package/dist/esm/{chunk-NBNZ53ZV.mjs → chunk-JNNFNYDO.mjs} +2 -2
- package/dist/esm/{chunk-2UXW3EB7.mjs → chunk-K233I26C.mjs} +2 -2
- package/dist/esm/{chunk-VV4HCOJQ.mjs → chunk-KK5HUWF6.mjs} +2 -2
- package/dist/esm/chunk-KSLLV3ZC.mjs +2 -0
- package/dist/esm/chunk-KSLLV3ZC.mjs.map +1 -0
- package/dist/esm/{chunk-67ZVDKJF.mjs → chunk-L6KVC7CJ.mjs} +2 -2
- package/dist/esm/{chunk-Q4C4U6I4.mjs → chunk-LQOSHBB7.mjs} +2 -2
- package/dist/esm/{chunk-XKUIMGKU.mjs → chunk-LS3IDL2N.mjs} +2 -2
- package/dist/esm/{chunk-2N5KYALM.mjs → chunk-MAWGZICD.mjs} +2 -2
- package/dist/esm/{chunk-S7RZGC56.mjs → chunk-MFLHAVIW.mjs} +2 -2
- package/dist/esm/chunk-OLGEN23M.mjs +2 -0
- package/dist/esm/chunk-OLGEN23M.mjs.map +1 -0
- package/dist/esm/{chunk-MCLYDS3O.mjs → chunk-ONGH5DXZ.mjs} +2 -2
- package/dist/esm/chunk-OPD5EKOA.mjs +2 -0
- package/dist/esm/chunk-OPD5EKOA.mjs.map +1 -0
- package/dist/esm/{chunk-4ZYPDCSP.mjs → chunk-P5CM4C2G.mjs} +2 -2
- package/dist/esm/chunk-PC25RPDV.mjs +2 -0
- package/dist/esm/chunk-PC25RPDV.mjs.map +1 -0
- package/dist/esm/{chunk-N6YTF76Q.mjs → chunk-PDAWVDI7.mjs} +2 -2
- package/dist/esm/chunk-PIPDQFL2.mjs +2 -0
- package/dist/esm/chunk-PIPDQFL2.mjs.map +1 -0
- package/dist/esm/{chunk-43GCGE6C.mjs → chunk-PWGTRRSJ.mjs} +2 -2
- package/dist/esm/{chunk-P7A5RILV.mjs → chunk-PYY2RXFP.mjs} +2 -2
- package/dist/esm/chunk-PYY2RXFP.mjs.map +1 -0
- package/dist/esm/chunk-QUJM5W4L.mjs +2 -0
- package/dist/esm/chunk-QUJM5W4L.mjs.map +1 -0
- package/dist/esm/{chunk-2FBJWTJD.mjs → chunk-QYJKCRVA.mjs} +2 -2
- package/dist/esm/chunk-R6QCPXQG.mjs +2 -0
- package/dist/esm/chunk-R6QCPXQG.mjs.map +1 -0
- package/dist/esm/{chunk-6YHDZLRN.mjs → chunk-RDPWCN4B.mjs} +2 -2
- package/dist/esm/{chunk-MT2RJ7H3.mjs → chunk-RIINVEZA.mjs} +2 -2
- package/dist/esm/{chunk-EBMEXURY.mjs → chunk-RXHER6EA.mjs} +2 -2
- package/dist/esm/chunk-SJDHW55X.mjs +2 -0
- package/dist/esm/chunk-SJDHW55X.mjs.map +1 -0
- package/dist/esm/{chunk-UC23V7PU.mjs → chunk-T7X4GZDU.mjs} +2 -2
- package/dist/esm/{chunk-QHEKBHNU.mjs → chunk-TH5JCPN2.mjs} +2 -2
- package/dist/esm/{chunk-ORMOQWWH.mjs → chunk-TKXEVD7A.mjs} +2 -2
- package/dist/esm/{chunk-FN4C3CKC.mjs → chunk-TTY5GFMN.mjs} +2 -2
- package/dist/esm/chunk-TWETGZ3W.mjs +2 -0
- package/dist/esm/chunk-TWETGZ3W.mjs.map +1 -0
- package/dist/esm/{chunk-E5HGSOG2.mjs → chunk-U4DEYWFT.mjs} +2 -2
- package/dist/esm/chunk-UIRAXHDH.mjs +1 -0
- package/dist/esm/chunk-UIRAXHDH.mjs.map +1 -0
- package/dist/esm/{chunk-OROPNHRY.mjs → chunk-UJJGIPOA.mjs} +2 -2
- package/dist/esm/{chunk-CWKNJZB6.mjs → chunk-US2HZFOM.mjs} +2 -2
- package/dist/esm/{chunk-XY43TPRH.mjs → chunk-VDYUMBOT.mjs} +2 -2
- package/dist/esm/chunk-VHY6ZATX.mjs +2 -0
- package/dist/esm/chunk-VHY6ZATX.mjs.map +1 -0
- package/dist/esm/chunk-VWZEJTGP.mjs +4 -0
- package/dist/esm/chunk-VWZEJTGP.mjs.map +1 -0
- package/dist/esm/{chunk-WUWPN7XV.mjs → chunk-W2C5KRUQ.mjs} +2 -2
- package/dist/esm/{chunk-OR6GFWLG.mjs → chunk-W4SMZ6IW.mjs} +2 -2
- package/dist/esm/chunk-WFKPVKU3.mjs +2 -0
- package/dist/esm/chunk-WFKPVKU3.mjs.map +1 -0
- package/dist/esm/{chunk-5VMAJTTV.mjs → chunk-WHVCUVZP.mjs} +2 -2
- package/dist/esm/{chunk-WQRGDSPD.mjs → chunk-WLDYBSOG.mjs} +2 -2
- package/dist/esm/chunk-XRVZAEQO.mjs +2 -0
- package/dist/esm/chunk-XRVZAEQO.mjs.map +1 -0
- package/dist/esm/chunk-XSBUL2WP.mjs +2 -0
- package/dist/esm/chunk-XSBUL2WP.mjs.map +1 -0
- package/dist/esm/{chunk-BGSEBFFC.mjs → chunk-XW3BXTCZ.mjs} +2 -2
- package/dist/esm/{chunk-6CXMDJQR.mjs → chunk-Y65PKZLK.mjs} +2 -2
- package/dist/esm/{chunk-NWLJ6RW7.mjs → chunk-YAGIE4GN.mjs} +2 -2
- package/dist/esm/{chunk-M77M6NSB.mjs → chunk-YLUULY6G.mjs} +2 -2
- package/dist/esm/{chunk-5EBUWO2M.mjs → chunk-YWSDONJJ.mjs} +2 -2
- package/dist/esm/{chunk-V6VPMNWJ.mjs → chunk-YXYYII5S.mjs} +2 -2
- package/dist/esm/{chunk-XTOIL6MB.mjs → chunk-ZD2TY5N3.mjs} +2 -2
- package/dist/esm/{chunk-FIEMUPXF.mjs → chunk-ZS2IVRHT.mjs} +2 -2
- package/dist/esm/cli/index.d.mts +1 -0
- package/dist/esm/cli/index.mjs +1 -1
- package/dist/esm/cli/localNode.mjs +1 -1
- package/dist/esm/cli/move.d.mts +1 -0
- package/dist/esm/client/core.d.mts +37 -1
- package/dist/esm/client/core.mjs +1 -1
- package/dist/esm/client/get.d.mts +36 -1
- package/dist/esm/client/get.mjs +1 -1
- package/dist/esm/client/index.d.mts +4 -3
- package/dist/esm/client/index.mjs +1 -1
- package/dist/esm/client/post.d.mts +35 -1
- package/dist/esm/client/post.mjs +1 -1
- package/dist/esm/core/account/index.d.mts +1 -0
- package/dist/esm/core/account/index.mjs +1 -1
- package/dist/esm/core/account/utils/address.d.mts +1 -0
- package/dist/esm/core/account/utils/address.mjs +1 -1
- package/dist/esm/core/account/utils/index.d.mts +1 -0
- package/dist/esm/core/account/utils/index.mjs +1 -1
- package/dist/esm/core/accountAddress.d.mts +1 -0
- package/dist/esm/core/accountAddress.mjs +1 -1
- package/dist/esm/core/authenticationKey.d.mts +1 -0
- package/dist/esm/core/authenticationKey.mjs +1 -1
- package/dist/esm/core/crypto/abstraction.d.mts +30 -0
- package/dist/esm/core/crypto/abstraction.mjs +2 -0
- package/dist/esm/core/crypto/abstraction.mjs.map +1 -0
- package/dist/esm/core/crypto/ed25519.d.mts +1 -0
- package/dist/esm/core/crypto/ed25519.mjs +1 -1
- package/dist/esm/core/crypto/ephemeral.d.mts +1 -0
- package/dist/esm/core/crypto/ephemeral.mjs +1 -1
- package/dist/esm/core/crypto/federatedKeyless.d.mts +1 -0
- package/dist/esm/core/crypto/federatedKeyless.mjs +1 -1
- package/dist/esm/core/crypto/index.d.mts +2 -1
- package/dist/esm/core/crypto/index.mjs +1 -1
- package/dist/esm/core/crypto/keyless.d.mts +1 -0
- package/dist/esm/core/crypto/keyless.mjs +1 -1
- package/dist/esm/core/crypto/multiEd25519.d.mts +18 -2
- package/dist/esm/core/crypto/multiEd25519.mjs +1 -1
- package/dist/esm/core/crypto/multiKey.d.mts +34 -15
- package/dist/esm/core/crypto/multiKey.mjs +1 -1
- package/dist/esm/core/crypto/privateKey.d.mts +1 -0
- package/dist/esm/core/crypto/privateKey.mjs +1 -1
- package/dist/esm/core/crypto/proof.d.mts +1 -0
- package/dist/esm/core/crypto/proof.mjs +1 -1
- package/dist/esm/core/crypto/publicKey.d.mts +1 -0
- package/dist/esm/core/crypto/publicKey.mjs +1 -1
- package/dist/esm/core/crypto/secp256k1.d.mts +1 -0
- package/dist/esm/core/crypto/secp256k1.mjs +1 -1
- package/dist/esm/core/crypto/signature.d.mts +1 -0
- package/dist/esm/core/crypto/signature.mjs +1 -1
- package/dist/esm/core/crypto/singleKey.d.mts +1 -0
- package/dist/esm/core/crypto/singleKey.mjs +1 -1
- package/dist/esm/core/crypto/utils.d.mts +1 -0
- package/dist/esm/core/crypto/utils.mjs +1 -1
- package/dist/esm/core/hex.d.mts +1 -0
- package/dist/esm/core/hex.mjs +1 -1
- package/dist/esm/core/index.d.mts +2 -1
- package/dist/esm/core/index.mjs +1 -1
- package/dist/esm/errors/index.d.mts +1 -0
- package/dist/esm/errors/index.mjs +1 -1
- package/dist/esm/index.d.mts +16 -9
- package/dist/esm/index.mjs +1 -1
- package/dist/esm/internal/abstraction.d.mts +55 -0
- package/dist/esm/internal/abstraction.mjs +2 -0
- package/dist/esm/internal/abstraction.mjs.map +1 -0
- package/dist/esm/internal/account.d.mts +1 -0
- package/dist/esm/internal/account.mjs +1 -1
- package/dist/esm/internal/ans.d.mts +1 -0
- package/dist/esm/internal/ans.mjs +1 -1
- package/dist/esm/internal/coin.d.mts +1 -0
- package/dist/esm/internal/coin.mjs +1 -1
- package/dist/esm/internal/digitalAsset.d.mts +1 -0
- package/dist/esm/internal/digitalAsset.mjs +1 -1
- package/dist/esm/internal/event.d.mts +1 -0
- package/dist/esm/internal/event.mjs +1 -1
- package/dist/esm/internal/experimental.d.mts +52 -0
- package/dist/esm/internal/experimental.mjs +2 -0
- package/dist/esm/internal/experimental.mjs.map +1 -0
- package/dist/esm/internal/faucet.d.mts +1 -0
- package/dist/esm/internal/faucet.mjs +1 -1
- package/dist/esm/internal/fungibleAsset.d.mts +1 -0
- package/dist/esm/internal/fungibleAsset.mjs +1 -1
- package/dist/esm/internal/general.d.mts +1 -0
- package/dist/esm/internal/general.mjs +1 -1
- package/dist/esm/internal/keyless.d.mts +1 -0
- package/dist/esm/internal/keyless.mjs +1 -1
- package/dist/esm/internal/object.d.mts +1 -0
- package/dist/esm/internal/object.mjs +1 -1
- package/dist/esm/internal/staking.d.mts +1 -0
- package/dist/esm/internal/staking.mjs +1 -1
- package/dist/esm/internal/table.d.mts +1 -0
- package/dist/esm/internal/table.mjs +1 -1
- package/dist/esm/internal/transaction.d.mts +1 -0
- package/dist/esm/internal/transaction.mjs +1 -1
- package/dist/esm/internal/transactionSubmission.d.mts +1 -0
- package/dist/esm/internal/transactionSubmission.mjs +1 -1
- package/dist/esm/internal/view.d.mts +1 -0
- package/dist/esm/internal/view.mjs +1 -1
- package/dist/esm/transactions/authenticator/account.d.mts +12 -3
- package/dist/esm/transactions/authenticator/account.mjs +1 -1
- package/dist/esm/transactions/authenticator/index.d.mts +2 -1
- package/dist/esm/transactions/authenticator/index.mjs +1 -1
- package/dist/esm/transactions/authenticator/transaction.d.mts +3 -2
- package/dist/esm/transactions/authenticator/transaction.mjs +1 -1
- package/dist/esm/transactions/index.d.mts +6 -4
- package/dist/esm/transactions/index.mjs +1 -1
- package/dist/esm/transactions/instances/chainId.d.mts +1 -0
- package/dist/esm/transactions/instances/chainId.mjs +1 -1
- package/dist/esm/transactions/instances/identifier.d.mts +1 -0
- package/dist/esm/transactions/instances/identifier.mjs +1 -1
- package/dist/esm/transactions/instances/index.d.mts +1 -0
- package/dist/esm/transactions/instances/index.mjs +1 -1
- package/dist/esm/transactions/instances/moduleId.d.mts +1 -0
- package/dist/esm/transactions/instances/moduleId.mjs +1 -1
- package/dist/esm/transactions/instances/multiAgentTransaction.d.mts +1 -0
- package/dist/esm/transactions/instances/multiAgentTransaction.mjs +1 -1
- package/dist/esm/transactions/instances/rawTransaction.d.mts +1 -0
- package/dist/esm/transactions/instances/rawTransaction.mjs +1 -1
- package/dist/esm/transactions/instances/rotationProofChallenge.d.mts +1 -0
- package/dist/esm/transactions/instances/rotationProofChallenge.mjs +1 -1
- package/dist/esm/transactions/instances/signedTransaction.d.mts +5 -4
- package/dist/esm/transactions/instances/signedTransaction.mjs +1 -1
- package/dist/esm/transactions/instances/simpleTransaction.d.mts +1 -0
- package/dist/esm/transactions/instances/simpleTransaction.mjs +1 -1
- package/dist/esm/transactions/instances/transactionArgument.d.mts +1 -0
- package/dist/esm/transactions/instances/transactionPayload.d.mts +1 -0
- package/dist/esm/transactions/instances/transactionPayload.mjs +1 -1
- package/dist/esm/transactions/management/accountSequenceNumber.d.mts +1 -0
- package/dist/esm/transactions/management/accountSequenceNumber.mjs +1 -1
- package/dist/esm/transactions/management/index.d.mts +1 -0
- package/dist/esm/transactions/management/index.mjs +1 -1
- package/dist/esm/transactions/management/transactionWorker.d.mts +1 -0
- package/dist/esm/transactions/management/transactionWorker.mjs +1 -1
- package/dist/esm/transactions/scriptComposer/index.d.mts +53 -0
- package/dist/esm/transactions/scriptComposer/index.mjs +2 -0
- package/dist/esm/transactions/scriptComposer/index.mjs.map +1 -0
- package/dist/esm/transactions/transactionBuilder/helpers.d.mts +3 -17
- package/dist/esm/transactions/transactionBuilder/helpers.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/index.d.mts +3 -2
- package/dist/esm/transactions/transactionBuilder/index.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/remoteAbi.d.mts +23 -2
- package/dist/esm/transactions/transactionBuilder/remoteAbi.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/signingMessage.d.mts +1 -0
- package/dist/esm/transactions/transactionBuilder/signingMessage.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/transactionBuilder.d.mts +1 -0
- package/dist/esm/transactions/transactionBuilder/transactionBuilder.mjs +1 -1
- package/dist/esm/transactions/typeTag/index.d.mts +1 -0
- package/dist/esm/transactions/typeTag/index.mjs +1 -1
- package/dist/esm/transactions/typeTag/parser.d.mts +1 -0
- package/dist/esm/transactions/typeTag/parser.mjs +1 -1
- package/dist/esm/transactions/types.d.mts +10 -1
- package/dist/esm/types/abstraction.d.mts +8 -0
- package/dist/esm/types/abstraction.mjs +2 -0
- package/dist/esm/types/abstraction.mjs.map +1 -0
- package/dist/esm/types/index.d.mts +1 -0
- package/dist/esm/types/index.mjs +1 -1
- package/dist/esm/types/types.d.mts +22 -1
- package/dist/esm/types/types.mjs +1 -1
- package/dist/esm/utils/helpers.d.mts +19 -2
- package/dist/esm/utils/helpers.mjs +1 -1
- package/dist/esm/utils/index.d.mts +2 -1
- package/dist/esm/utils/index.mjs +1 -1
- package/dist/esm/utils/normalizeBundle.d.mts +1 -0
- package/dist/esm/utils/normalizeBundle.mjs +1 -1
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +21 -19
- package/src/account/AbstractedAccount.ts +111 -0
- package/src/account/MultiEd25519Account.ts +154 -0
- package/src/account/MultiKeyAccount.ts +1 -2
- package/src/account/index.ts +2 -0
- package/src/api/account/abstraction.ts +239 -0
- package/src/api/account.ts +7 -2
- package/src/api/aptos.ts +9 -0
- package/src/api/aptosConfig.ts +2 -2
- package/src/api/experimental.ts +64 -0
- package/src/api/transactionSubmission/build.ts +85 -2
- package/src/client/core.ts +120 -0
- package/src/client/get.ts +73 -1
- package/src/client/post.ts +70 -1
- package/src/core/crypto/abstraction.ts +47 -0
- package/src/core/crypto/multiEd25519.ts +19 -3
- package/src/core/crypto/multiKey.ts +76 -52
- package/src/core/hex.ts +3 -1
- package/src/internal/abstraction.ts +79 -0
- package/src/internal/experimental.ts +55 -0
- package/src/internal/view.ts +4 -4
- package/src/transactions/authenticator/account.ts +52 -1
- package/src/transactions/index.ts +1 -0
- package/src/transactions/scriptComposer/index.ts +87 -0
- package/src/transactions/transactionBuilder/helpers.ts +1 -22
- package/src/transactions/transactionBuilder/remoteAbi.ts +62 -1
- package/src/transactions/transactionBuilder/transactionBuilder.ts +9 -1
- package/src/transactions/types.ts +11 -0
- package/src/types/abstraction.ts +6 -0
- package/src/types/index.ts +1 -0
- package/src/types/types.ts +21 -0
- package/src/utils/helpers.ts +28 -1
- package/src/version.ts +1 -1
- package/dist/common/chunk-IHUCZKG2.js +0 -2
- package/dist/common/chunk-IHUCZKG2.js.map +0 -1
- package/dist/esm/chunk-4YLUM62M.mjs +0 -2
- package/dist/esm/chunk-5PXDPMF2.mjs +0 -4
- package/dist/esm/chunk-5PXDPMF2.mjs.map +0 -1
- package/dist/esm/chunk-6IEZPA4H.mjs +0 -2
- package/dist/esm/chunk-6IEZPA4H.mjs.map +0 -1
- package/dist/esm/chunk-6YWYAVFS.mjs +0 -2
- package/dist/esm/chunk-6YWYAVFS.mjs.map +0 -1
- package/dist/esm/chunk-77AEKF7K.mjs +0 -2
- package/dist/esm/chunk-AFEHO5PP.mjs +0 -2
- package/dist/esm/chunk-AFEHO5PP.mjs.map +0 -1
- package/dist/esm/chunk-DAFSKSZ5.mjs +0 -2
- package/dist/esm/chunk-DAFSKSZ5.mjs.map +0 -1
- package/dist/esm/chunk-DPW6ELCQ.mjs +0 -2
- package/dist/esm/chunk-EMURYYVO.mjs +0 -2
- package/dist/esm/chunk-F2ZTBAJJ.mjs +0 -2
- package/dist/esm/chunk-F2ZTBAJJ.mjs.map +0 -1
- package/dist/esm/chunk-FD6FGKYY.mjs +0 -1
- package/dist/esm/chunk-GP4TLDVZ.mjs +0 -1
- package/dist/esm/chunk-HBH2NQKU.mjs +0 -2
- package/dist/esm/chunk-HBH2NQKU.mjs.map +0 -1
- package/dist/esm/chunk-I5OYNCZS.mjs +0 -1
- package/dist/esm/chunk-JBEUUULP.mjs +0 -2
- package/dist/esm/chunk-JBEUUULP.mjs.map +0 -1
- package/dist/esm/chunk-KVM2SGSF.mjs +0 -2
- package/dist/esm/chunk-KVM2SGSF.mjs.map +0 -1
- package/dist/esm/chunk-MLSAZJZK.mjs +0 -2
- package/dist/esm/chunk-MLSAZJZK.mjs.map +0 -1
- package/dist/esm/chunk-MWBRD43V.mjs.map +0 -1
- package/dist/esm/chunk-OSBRPVVI.mjs +0 -2
- package/dist/esm/chunk-OSBRPVVI.mjs.map +0 -1
- package/dist/esm/chunk-P7A5RILV.mjs.map +0 -1
- package/dist/esm/chunk-QHC5DKVZ.mjs +0 -2
- package/dist/esm/chunk-QHC5DKVZ.mjs.map +0 -1
- package/dist/esm/chunk-S4LZMY2L.mjs +0 -2
- package/dist/esm/chunk-S4LZMY2L.mjs.map +0 -1
- package/dist/esm/chunk-STY74NUA.mjs +0 -2
- package/dist/esm/chunk-STY74NUA.mjs.map +0 -1
- package/dist/esm/chunk-U2PRGW4O.mjs +0 -2
- package/dist/esm/chunk-U2PRGW4O.mjs.map +0 -1
- package/dist/esm/chunk-VVXBVJXD.mjs +0 -2
- package/dist/esm/chunk-VVXBVJXD.mjs.map +0 -1
- package/dist/esm/chunk-WCMW2L3P.mjs +0 -2
- package/dist/esm/chunk-XJJVJOX5.mjs +0 -2
- /package/dist/esm/{chunk-FD6FGKYY.mjs.map → account/AbstractedAccount.mjs.map} +0 -0
- /package/dist/esm/{chunk-GP4TLDVZ.mjs.map → account/MultiEd25519Account.mjs.map} +0 -0
- /package/dist/esm/{chunk-I5OYNCZS.mjs.map → api/account/abstraction.mjs.map} +0 -0
- /package/dist/esm/{chunk-7IY3DTEF.mjs.map → chunk-27ESCVVC.mjs.map} +0 -0
- /package/dist/esm/{chunk-VUIHJIMX.mjs.map → chunk-2TRQERBL.mjs.map} +0 -0
- /package/dist/esm/{chunk-XJJVJOX5.mjs.map → chunk-2V636AYW.mjs.map} +0 -0
- /package/dist/esm/{chunk-XTJOA5QN.mjs.map → chunk-2YKERRHD.mjs.map} +0 -0
- /package/dist/esm/{chunk-5YWH3XPN.mjs.map → chunk-3LDVJ2YK.mjs.map} +0 -0
- /package/dist/esm/{chunk-ONTWK5FU.mjs.map → chunk-44EHAKKW.mjs.map} +0 -0
- /package/dist/esm/{chunk-OEQ2U7GK.mjs.map → chunk-53IBOHXB.mjs.map} +0 -0
- /package/dist/esm/{chunk-YCQUYDZI.mjs.map → chunk-5H5D6QVX.mjs.map} +0 -0
- /package/dist/esm/{chunk-G4O6FXCF.mjs.map → chunk-5W2ERBGY.mjs.map} +0 -0
- /package/dist/esm/{chunk-NYETBDSR.mjs.map → chunk-67A5U2X6.mjs.map} +0 -0
- /package/dist/esm/{chunk-AXYARCYT.mjs.map → chunk-6IJZRG3U.mjs.map} +0 -0
- /package/dist/esm/{chunk-N4DM5FYH.mjs.map → chunk-6KZT3KFZ.mjs.map} +0 -0
- /package/dist/esm/{chunk-2WCATZVL.mjs.map → chunk-7A2KHJ3D.mjs.map} +0 -0
- /package/dist/esm/{chunk-ROT6S6BM.mjs.map → chunk-7CRQNXR5.mjs.map} +0 -0
- /package/dist/esm/{chunk-FZD5RWSZ.mjs.map → chunk-7OUPEQRN.mjs.map} +0 -0
- /package/dist/esm/{chunk-WCMW2L3P.mjs.map → chunk-A3VO773Q.mjs.map} +0 -0
- /package/dist/esm/{chunk-OHZURQPY.mjs.map → chunk-AEGA5N2W.mjs.map} +0 -0
- /package/dist/esm/{chunk-BI3BTSUB.mjs.map → chunk-AIPHJFJL.mjs.map} +0 -0
- /package/dist/esm/{chunk-4EUS4E6S.mjs.map → chunk-B23VO5TB.mjs.map} +0 -0
- /package/dist/esm/{chunk-4YLUM62M.mjs.map → chunk-BMPHQ3E7.mjs.map} +0 -0
- /package/dist/esm/{chunk-DYATTONT.mjs.map → chunk-BQYKFATL.mjs.map} +0 -0
- /package/dist/esm/{chunk-QQEK7WVP.mjs.map → chunk-CPAAEEF4.mjs.map} +0 -0
- /package/dist/esm/{chunk-ZAIVZDOL.mjs.map → chunk-CPFQUFVD.mjs.map} +0 -0
- /package/dist/esm/{chunk-ZPV7HPA4.mjs.map → chunk-DAJFOJ3L.mjs.map} +0 -0
- /package/dist/esm/{chunk-DPW6ELCQ.mjs.map → chunk-DOVH6HPL.mjs.map} +0 -0
- /package/dist/esm/{chunk-KOORZTHC.mjs.map → chunk-E5PAUR4N.mjs.map} +0 -0
- /package/dist/esm/{chunk-E7JDVKFY.mjs.map → chunk-EGCL6KA6.mjs.map} +0 -0
- /package/dist/esm/{chunk-TOBQ5UE6.mjs.map → chunk-ERLDXTIY.mjs.map} +0 -0
- /package/dist/esm/{chunk-X6UNY6YM.mjs.map → chunk-FOEPRHAC.mjs.map} +0 -0
- /package/dist/esm/{chunk-XYB6KYKW.mjs.map → chunk-G5F5ZOH5.mjs.map} +0 -0
- /package/dist/esm/{chunk-AZWVCBK2.mjs.map → chunk-GI4AR6DQ.mjs.map} +0 -0
- /package/dist/esm/{chunk-3RCAJICY.mjs.map → chunk-GRRBXHVG.mjs.map} +0 -0
- /package/dist/esm/{chunk-5EYTHMRZ.mjs.map → chunk-GTVMJJQQ.mjs.map} +0 -0
- /package/dist/esm/{chunk-2TJ6OTVD.mjs.map → chunk-GU4MD5ST.mjs.map} +0 -0
- /package/dist/esm/{chunk-EMURYYVO.mjs.map → chunk-H4YAL2IL.mjs.map} +0 -0
- /package/dist/esm/{chunk-ZGVNZE7J.mjs.map → chunk-HBTJN4RJ.mjs.map} +0 -0
- /package/dist/esm/{chunk-IDTLNF4M.mjs.map → chunk-HHWJHOFZ.mjs.map} +0 -0
- /package/dist/esm/{chunk-XZ4JRYCE.mjs.map → chunk-HKL4MFNL.mjs.map} +0 -0
- /package/dist/esm/{chunk-IEUEMBFD.mjs.map → chunk-HVIF6DW6.mjs.map} +0 -0
- /package/dist/esm/{chunk-JJM6ELMS.mjs.map → chunk-ILUFGYLO.mjs.map} +0 -0
- /package/dist/esm/{chunk-DOQV5BSA.mjs.map → chunk-IOHESHLR.mjs.map} +0 -0
- /package/dist/esm/{chunk-NBNZ53ZV.mjs.map → chunk-JNNFNYDO.mjs.map} +0 -0
- /package/dist/esm/{chunk-2UXW3EB7.mjs.map → chunk-K233I26C.mjs.map} +0 -0
- /package/dist/esm/{chunk-VV4HCOJQ.mjs.map → chunk-KK5HUWF6.mjs.map} +0 -0
- /package/dist/esm/{chunk-67ZVDKJF.mjs.map → chunk-L6KVC7CJ.mjs.map} +0 -0
- /package/dist/esm/{chunk-Q4C4U6I4.mjs.map → chunk-LQOSHBB7.mjs.map} +0 -0
- /package/dist/esm/{chunk-XKUIMGKU.mjs.map → chunk-LS3IDL2N.mjs.map} +0 -0
- /package/dist/esm/{chunk-2N5KYALM.mjs.map → chunk-MAWGZICD.mjs.map} +0 -0
- /package/dist/esm/{chunk-S7RZGC56.mjs.map → chunk-MFLHAVIW.mjs.map} +0 -0
- /package/dist/esm/{chunk-MCLYDS3O.mjs.map → chunk-ONGH5DXZ.mjs.map} +0 -0
- /package/dist/esm/{chunk-4ZYPDCSP.mjs.map → chunk-P5CM4C2G.mjs.map} +0 -0
- /package/dist/esm/{chunk-N6YTF76Q.mjs.map → chunk-PDAWVDI7.mjs.map} +0 -0
- /package/dist/esm/{chunk-43GCGE6C.mjs.map → chunk-PWGTRRSJ.mjs.map} +0 -0
- /package/dist/esm/{chunk-2FBJWTJD.mjs.map → chunk-QYJKCRVA.mjs.map} +0 -0
- /package/dist/esm/{chunk-6YHDZLRN.mjs.map → chunk-RDPWCN4B.mjs.map} +0 -0
- /package/dist/esm/{chunk-MT2RJ7H3.mjs.map → chunk-RIINVEZA.mjs.map} +0 -0
- /package/dist/esm/{chunk-EBMEXURY.mjs.map → chunk-RXHER6EA.mjs.map} +0 -0
- /package/dist/esm/{chunk-UC23V7PU.mjs.map → chunk-T7X4GZDU.mjs.map} +0 -0
- /package/dist/esm/{chunk-QHEKBHNU.mjs.map → chunk-TH5JCPN2.mjs.map} +0 -0
- /package/dist/esm/{chunk-ORMOQWWH.mjs.map → chunk-TKXEVD7A.mjs.map} +0 -0
- /package/dist/esm/{chunk-FN4C3CKC.mjs.map → chunk-TTY5GFMN.mjs.map} +0 -0
- /package/dist/esm/{chunk-E5HGSOG2.mjs.map → chunk-U4DEYWFT.mjs.map} +0 -0
- /package/dist/esm/{chunk-OROPNHRY.mjs.map → chunk-UJJGIPOA.mjs.map} +0 -0
- /package/dist/esm/{chunk-CWKNJZB6.mjs.map → chunk-US2HZFOM.mjs.map} +0 -0
- /package/dist/esm/{chunk-XY43TPRH.mjs.map → chunk-VDYUMBOT.mjs.map} +0 -0
- /package/dist/esm/{chunk-WUWPN7XV.mjs.map → chunk-W2C5KRUQ.mjs.map} +0 -0
- /package/dist/esm/{chunk-OR6GFWLG.mjs.map → chunk-W4SMZ6IW.mjs.map} +0 -0
- /package/dist/esm/{chunk-5VMAJTTV.mjs.map → chunk-WHVCUVZP.mjs.map} +0 -0
- /package/dist/esm/{chunk-WQRGDSPD.mjs.map → chunk-WLDYBSOG.mjs.map} +0 -0
- /package/dist/esm/{chunk-BGSEBFFC.mjs.map → chunk-XW3BXTCZ.mjs.map} +0 -0
- /package/dist/esm/{chunk-6CXMDJQR.mjs.map → chunk-Y65PKZLK.mjs.map} +0 -0
- /package/dist/esm/{chunk-NWLJ6RW7.mjs.map → chunk-YAGIE4GN.mjs.map} +0 -0
- /package/dist/esm/{chunk-M77M6NSB.mjs.map → chunk-YLUULY6G.mjs.map} +0 -0
- /package/dist/esm/{chunk-5EBUWO2M.mjs.map → chunk-YWSDONJJ.mjs.map} +0 -0
- /package/dist/esm/{chunk-V6VPMNWJ.mjs.map → chunk-YXYYII5S.mjs.map} +0 -0
- /package/dist/esm/{chunk-XTOIL6MB.mjs.map → chunk-ZD2TY5N3.mjs.map} +0 -0
- /package/dist/esm/{chunk-FIEMUPXF.mjs.map → chunk-ZS2IVRHT.mjs.map} +0 -0
|
@@ -0,0 +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. 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":"weAuDO,IAAMA,EAAN,KAAc,CAuBnB,YAAqBC,EAAqB,CAArB,YAAAA,EACnB,KAAK,YAAc,IAAIC,EAAmBD,CAAM,CAClD,CAyBA,MAAM,eAAeE,EAAqE,CACxF,OAAOC,EAAQ,CAAE,YAAa,KAAK,OAAQ,GAAGD,CAAK,CAAC,CACtD,CAoCA,MAAM,kBAAkBA,EAGU,CAChC,OAAOE,EAAW,CAAE,YAAa,KAAK,OAAQ,GAAGF,CAAK,CAAC,CACzD,CA+BA,MAAM,iBAAiBA,EAIS,CAC9B,OAAOG,EAAU,CAAE,YAAa,KAAK,OAAQ,GAAGH,CAAK,CAAC,CACxD,CAoCA,MAAM,uBAAuBA,EAGM,CACjC,OAAOI,EAAgB,CACrB,YAAa,KAAK,OAClB,GAAGJ,CACL,CAAC,CACH,CA4BA,MAAM,oBAAoBA,EAGE,CAC1B,OAAOK,EAAa,CAAE,YAAa,KAAK,OAAQ,GAAGL,CAAK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DQ,EAAYG,EAAK,aAAa,EAC1BA,IAASF,EAAe,IAC1BP,EAAgBN,EAIpB,KACE,OAAM,IAAI,MAAM,8DAA8D,EAKhF,GAAIM,IAAkB,OAAW,CAC/B,GAAM,CAACU,CAAU,EAAI,MAAMP,EAAe,CACxC,YAAa,KAAK,OAClB,QAAS,CACP,SAAU,qBACV,cAAe,CAACH,CAAa,EAC7B,kBAAmB,CAACJ,CAAc,CACpC,CACF,CAAC,EACD,OAAO,SAASc,EAAY,EAAE,CAChC,CACA,GAAM,CAACA,CAAU,EAAI,MAAMP,EAAe,CACxC,YAAa,KAAK,OAClB,QAAS,CACP,SAAU,uCACV,cAAe,CAAC,yBAAyB,EACzC,kBAAmB,CAACP,EAAgBU,CAAS,CAC/C,CACF,CAAC,EACD,OAAO,SAASI,EAAY,EAAE,CAChC,CAqCA,MAAM,uBAAuBhC,EAIW,CACtC,aAAMQ,EAAwB,CAC5B,OAAQ,KAAK,OACb,qBAAsBR,EAAK,qBAC3B,iCACF,CAAC,EACMiC,EAAuB,CAC5B,YAAa,KAAK,OAClB,GAAGjC,CACL,CAAC,CACH,CAkCA,MAAM,4BAA4BA,EAA0D,CAC1F,OAAOkC,EAA4B,CAAE,YAAa,KAAK,OAAQ,GAAGlC,CAAK,CAAC,CAC1E,CACF","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-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
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
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
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 =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,IAAI,MAAM,uCAAuCA,EAAsB,yBAA2B,CAAC,GAAG,EAG9G,GAAIO,EAAY,IAAIC,CAAG,EACrB,MAAM,IAAI,MAAM,0BAA0B,EAG5C,GAAIpB,EAAQ,GAAKoB,GAAOH,EAAKjB,EAAQ,CAAC,EACpC,MAAM,IAAI,MAAM,gDAAgD,EAGlEmB,EAAY,IAAIC,CAAG,EAEnB,IAAMC,EAAa,KAAK,MAAMD,EAAM,CAAC,EAEjCE,EAAOP,EAAOM,CAAU,EAG5BC,GAAQJ,GAAkBE,EAAM,EAEhCL,EAAOM,CAAU,EAAIC,CACvB,CAAC,EAEMP,CACT,CACF,EAnKaH,EAMJ,yBAA2B,GANvBA,EAaJ,WAAqB,EAbvB,IAAMf,EAANe","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-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
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-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
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
|
|
@@ -0,0 +1,2 @@
|
|
|
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 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/transactions/transactionBuilder/remoteAbi.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { parseTypeTag } from \"../typeTag/parser\";\nimport {\n TypeTag,\n TypeTagAddress,\n TypeTagBool,\n TypeTagStruct,\n TypeTagU128,\n TypeTagU16,\n TypeTagU256,\n TypeTagU32,\n TypeTagU64,\n TypeTagU8,\n} from \"../typeTag\";\nimport { AptosConfig } from \"../../api/aptosConfig\";\nimport {\n EntryFunctionArgumentTypes,\n SimpleEntryFunctionArgumentTypes,\n EntryFunctionABI,\n ViewFunctionABI,\n FunctionABI,\n TypeArgument,\n} from \"../types\";\nimport { Bool, MoveOption, MoveString, MoveVector, U128, U16, U256, U32, U64, U8 } from \"../../bcs\";\nimport { AccountAddress } from \"../../core\";\nimport { getModule } from \"../../internal/account\";\nimport {\n findFirstNonSignerArg,\n isBcsAddress,\n isBcsBool,\n isBcsString,\n isBcsU128,\n isBcsU16,\n isBcsU256,\n isBcsU32,\n isBcsU64,\n isBcsU8,\n isBool,\n isEncodedEntryFunctionArgument,\n isLargeNumber,\n isEmptyOption,\n isString,\n throwTypeMismatch,\n convertNumber,\n} from \"./helpers\";\nimport { CallArgument, MoveFunction } from \"../../types\";\n\nconst TEXT_ENCODER = new TextEncoder();\n\n/**\n * Convert type arguments to only type tags, allowing for string representations of type tags.\n *\n * @param typeArguments - An optional array of type arguments that may include string representations.\n * @returns An array of TypeTag objects derived from the provided type arguments.\n * @group Implementation\n * @category Transactions\n */\nexport function standardizeTypeTags(typeArguments?: Array<TypeArgument>): Array<TypeTag> {\n return (\n typeArguments?.map((typeArg: TypeArgument): TypeTag => {\n // Convert to TypeTag if it's a string representation\n if (isString(typeArg)) {\n return parseTypeTag(typeArg);\n }\n return typeArg;\n }) ?? []\n );\n}\n\n/**\n * Fetches the ABI of a specified function from the on-chain module ABI. This function allows you to access the details of a\n * specific function within a module.\n *\n * @param moduleAddress - The address of the module from which to fetch the function ABI.\n * @param moduleName - The name of the module containing the function.\n * @param functionName - The name of the function whose ABI is to be fetched.\n * @param aptosConfig - The configuration settings for Aptos.\n * @group Implementation\n * @category Transactions\n */\nexport async function fetchFunctionAbi(\n moduleAddress: string,\n moduleName: string,\n functionName: string,\n aptosConfig: AptosConfig,\n): Promise<MoveFunction | undefined> {\n // This fetch from the API is currently cached\n const module = await getModule({ aptosConfig, accountAddress: moduleAddress, moduleName });\n\n if (module.abi) {\n return module.abi.exposed_functions.find((func) => func.name === functionName);\n }\n\n return undefined;\n}\n\n/**\n * Fetches a function ABI from the on-chain module ABI. It doesn't validate whether it's a view or entry function.\n * @param moduleAddress\n * @param moduleName\n * @param functionName\n * @param aptosConfig\n */\nexport async function fetchMoveFunctionAbi(\n moduleAddress: string,\n moduleName: string,\n functionName: string,\n aptosConfig: AptosConfig,\n): Promise<FunctionABI> {\n const functionAbi = await fetchFunctionAbi(moduleAddress, moduleName, functionName, aptosConfig);\n if (!functionAbi) {\n throw new Error(`Could not find function ABI for '${moduleAddress}::${moduleName}::${functionName}'`);\n }\n const params: TypeTag[] = [];\n for (let i = 0; i < functionAbi.params.length; i += 1) {\n params.push(parseTypeTag(functionAbi.params[i], { allowGenerics: true }));\n }\n\n return {\n typeParameters: functionAbi.generic_type_params,\n parameters: params,\n };\n}\n\n/**\n * Fetches the ABI for an entry function from the specified module address.\n * This function validates if the ABI corresponds to an entry function and retrieves its parameters.\n *\n * @param moduleAddress - The address of the module containing the entry function.\n * @param moduleName - The name of the module containing the entry function.\n * @param functionName - The name of the entry function to fetch the ABI for.\n * @param aptosConfig - The configuration settings for Aptos.\n * @returns An object containing the number of signers, type parameters, and function parameters.\n * @throws Error if the ABI cannot be found or if the function is not an entry function.\n * @group Implementation\n * @category Transactions\n */\nexport async function fetchEntryFunctionAbi(\n moduleAddress: string,\n moduleName: string,\n functionName: string,\n aptosConfig: AptosConfig,\n): Promise<EntryFunctionABI> {\n const functionAbi = await fetchFunctionAbi(moduleAddress, moduleName, functionName, aptosConfig);\n\n // If there's no ABI, then the function is invalid\n if (!functionAbi) {\n throw new Error(`Could not find entry function ABI for '${moduleAddress}::${moduleName}::${functionName}'`);\n }\n\n // Non-entry functions also can't be used\n if (!functionAbi.is_entry) {\n throw new Error(`'${moduleAddress}::${moduleName}::${functionName}' is not an entry function`);\n }\n\n // Remove the signer arguments\n const numSigners = findFirstNonSignerArg(functionAbi);\n const params: TypeTag[] = [];\n for (let i = numSigners; i < functionAbi.params.length; i += 1) {\n params.push(parseTypeTag(functionAbi.params[i], { allowGenerics: true }));\n }\n\n return {\n signers: numSigners,\n typeParameters: functionAbi.generic_type_params,\n parameters: params,\n };\n}\n\n/**\n * Fetches the ABI for a view function from the specified module address.\n * This function ensures that the ABI is valid and retrieves the type parameters, parameters, and return types for the view function.\n *\n * @param moduleAddress - The address of the module containing the view function.\n * @param moduleName - The name of the module containing the view function.\n * @param functionName - The name of the view function for which to fetch the ABI.\n * @param aptosConfig - The configuration settings for Aptos.\n * @returns An object containing the type parameters, parameters, and return types of the view function.\n * @throws Error if the ABI cannot be found or if the function is not a view function.\n * @group Implementation\n * @category Transactions\n */\nexport async function fetchViewFunctionAbi(\n moduleAddress: string,\n moduleName: string,\n functionName: string,\n aptosConfig: AptosConfig,\n): Promise<ViewFunctionABI> {\n const functionAbi = await fetchFunctionAbi(moduleAddress, moduleName, functionName, aptosConfig);\n\n // If there's no ABI, then the function is invalid\n if (!functionAbi) {\n throw new Error(`Could not find view function ABI for '${moduleAddress}::${moduleName}::${functionName}'`);\n }\n\n // Non-view functions can't be used\n if (!functionAbi.is_view) {\n throw new Error(`'${moduleAddress}::${moduleName}::${functionName}' is not an view function`);\n }\n\n // Type tag parameters for the function\n const params: TypeTag[] = [];\n for (let i = 0; i < functionAbi.params.length; i += 1) {\n params.push(parseTypeTag(functionAbi.params[i], { allowGenerics: true }));\n }\n\n // The return types of the view function\n const returnTypes: TypeTag[] = [];\n for (let i = 0; i < functionAbi.return.length; i += 1) {\n returnTypes.push(parseTypeTag(functionAbi.return[i], { allowGenerics: true }));\n }\n\n return {\n typeParameters: functionAbi.generic_type_params,\n parameters: params,\n returnTypes,\n };\n}\n\n/**\n * Converts a entry function argument into CallArgument, if necessary.\n * This function checks the provided argument against the expected parameter type and converts it accordingly.\n *\n * @param functionName - The name of the function for which the argument is being converted.\n * @param functionAbi - The ABI (Application Binary Interface) of the function, which defines its parameters.\n * @param argument - The argument to be converted, which can be of various types. If the argument is already\n * CallArgument returned from TransactionComposer it would be returned immediately.\n * @param position - The index of the argument in the function's parameter list.\n * @param genericTypeParams - An array of type tags for any generic type parameters.\n */\nexport function convertCallArgument(\n argument: CallArgument | EntryFunctionArgumentTypes | SimpleEntryFunctionArgumentTypes,\n functionName: string,\n functionAbi: FunctionABI,\n position: number,\n genericTypeParams: Array<TypeTag>,\n): CallArgument {\n if (argument instanceof CallArgument) {\n return argument;\n }\n return CallArgument.newBytes(\n convertArgument(functionName, functionAbi, argument, position, genericTypeParams).bcsToBytes(),\n );\n}\n\n/**\n * Converts a non-BCS encoded argument into BCS encoded, if necessary.\n * This function checks the provided argument against the expected parameter type and converts it accordingly.\n *\n * @param functionName - The name of the function for which the argument is being converted.\n * @param functionAbi - The ABI (Application Binary Interface) of the function, which defines its parameters.\n * @param arg - The argument to be converted, which can be of various types.\n * @param position - The index of the argument in the function's parameter list.\n * @param genericTypeParams - An array of type tags for any generic type parameters.\n * @group Implementation\n * @category Transactions\n */\nexport function convertArgument(\n functionName: string,\n functionAbi: FunctionABI,\n arg: EntryFunctionArgumentTypes | SimpleEntryFunctionArgumentTypes,\n position: number,\n genericTypeParams: Array<TypeTag>,\n) {\n // Ensure not too many arguments\n if (position >= functionAbi.parameters.length) {\n throw new Error(`Too many arguments for '${functionName}', expected ${functionAbi.parameters.length}`);\n }\n\n const param = functionAbi.parameters[position];\n return checkOrConvertArgument(arg, param, position, genericTypeParams);\n}\n\n/**\n * Checks if the provided argument is BCS encoded and converts it if necessary, ensuring type compatibility with the ABI.\n * This function helps in validating and converting arguments for entry functions based on their expected types.\n *\n * @param arg - The argument to check or convert, which can be either a simple or entry function argument type.\n * @param param - The expected type tag for the argument.\n * @param position - The position of the argument in the function call.\n * @param genericTypeParams - An array of generic type parameters that may be used for conversion.\n * @group Implementation\n * @category Transactions\n */\nexport function checkOrConvertArgument(\n arg: SimpleEntryFunctionArgumentTypes | EntryFunctionArgumentTypes,\n param: TypeTag,\n position: number,\n genericTypeParams: Array<TypeTag>,\n) {\n // If the argument is bcs encoded, we can just use it directly\n if (isEncodedEntryFunctionArgument(arg)) {\n // Ensure the type matches the ABI\n\n /**\n * Checks the type of the provided argument against the expected type.\n * This function helps validate that the argument conforms to the specified type requirements.\n *\n * @param typeArgs - The expected type arguments.\n * @param arg - The argument to be checked.\n * @param position - The position of the argument in the context of the check.\n * @group Implementation\n * @category Transactions\n */\n checkType(param, arg, position);\n return arg;\n }\n\n // If it is not BCS encoded, we will need to convert it with the ABI\n return parseArg(arg, param, position, genericTypeParams);\n}\n\n/**\n * Parses a non-BCS encoded argument into a BCS encoded argument recursively.\n * This function helps convert various types of input arguments into their corresponding BCS encoded formats based on the\n * specified parameter type.\n *\n * @param arg - The argument to be parsed, which can be of various types.\n * @param param - The type tag that defines the expected type of the argument.\n * @param position - The position of the argument in the function call, used for error reporting.\n * @param genericTypeParams - An array of type tags for generic type parameters, used when the parameter type is generic.\n * @group Implementation\n * @category Transactions\n */\nfunction parseArg(\n arg: SimpleEntryFunctionArgumentTypes,\n param: TypeTag,\n position: number,\n genericTypeParams: Array<TypeTag>,\n): EntryFunctionArgumentTypes {\n if (param.isBool()) {\n if (isBool(arg)) {\n return new Bool(arg);\n }\n if (isString(arg)) {\n if (arg === \"true\") return new Bool(true);\n if (arg === \"false\") return new Bool(false);\n }\n\n /**\n * Throws a type mismatch error for the specified move option.\n *\n * @param moveOption - The name of the move option that caused the type mismatch.\n * @param position - The position where the error occurred.\n * @group Implementation\n * @category Transactions\n */\n throwTypeMismatch(\"boolean\", position);\n }\n // TODO: support uint8array?\n if (param.isAddress()) {\n if (isString(arg)) {\n return AccountAddress.fromString(arg);\n }\n throwTypeMismatch(\"string | AccountAddress\", position);\n }\n if (param.isU8()) {\n const num = convertNumber(arg);\n if (num !== undefined) {\n return new U8(num);\n }\n throwTypeMismatch(\"number | string\", position);\n }\n if (param.isU16()) {\n const num = convertNumber(arg);\n if (num !== undefined) {\n return new U16(num);\n }\n throwTypeMismatch(\"number | string\", position);\n }\n if (param.isU32()) {\n const num = convertNumber(arg);\n if (num !== undefined) {\n return new U32(num);\n }\n throwTypeMismatch(\"number | string\", position);\n }\n if (param.isU64()) {\n if (isLargeNumber(arg)) {\n return new U64(BigInt(arg));\n }\n throwTypeMismatch(\"bigint | number | string\", position);\n }\n if (param.isU128()) {\n if (isLargeNumber(arg)) {\n return new U128(BigInt(arg));\n }\n throwTypeMismatch(\"bigint | number | string\", position);\n }\n if (param.isU256()) {\n if (isLargeNumber(arg)) {\n return new U256(BigInt(arg));\n }\n throwTypeMismatch(\"bigint | number | string\", position);\n }\n\n // Generic needs to use the subtype\n if (param.isGeneric()) {\n const genericIndex = param.value;\n if (genericIndex < 0 || genericIndex >= genericTypeParams.length) {\n throw new Error(`Generic argument ${param.toString()} is invalid for argument ${position}`);\n }\n\n return checkOrConvertArgument(arg, genericTypeParams[genericIndex], position, genericTypeParams);\n }\n\n // We have to special case some vectors for Vector<u8>\n if (param.isVector()) {\n // Check special case for Vector<u8>\n if (param.value.isU8()) {\n // We don't allow vector<u8>, but we convert strings to UTF8 Uint8Array\n // This is legacy behavior from the original SDK\n if (isString(arg)) {\n return MoveVector.U8(TEXT_ENCODER.encode(arg));\n }\n if (arg instanceof Uint8Array) {\n return MoveVector.U8(arg);\n }\n if (arg instanceof ArrayBuffer) {\n return MoveVector.U8(new Uint8Array(arg));\n }\n }\n\n if (isString(arg)) {\n // In a web env, arguments are passing as strings\n if (arg.startsWith(\"[\")) {\n return checkOrConvertArgument(JSON.parse(arg), param, position, genericTypeParams);\n }\n }\n\n // TODO: Support Uint16Array, Uint32Array, BigUint64Array?\n\n if (Array.isArray(arg)) {\n return new MoveVector(arg.map((item) => checkOrConvertArgument(item, param.value, position, genericTypeParams)));\n }\n\n throw new Error(`Type mismatch for argument ${position}, type '${param.toString()}'`);\n }\n\n // Handle structs as they're more complex\n if (param.isStruct()) {\n if (param.isString()) {\n if (isString(arg)) {\n return new MoveString(arg);\n }\n throwTypeMismatch(\"string\", position);\n }\n if (param.isObject()) {\n // The inner type of Object doesn't matter, since it's just syntactic sugar\n if (isString(arg)) {\n return AccountAddress.fromString(arg);\n }\n throwTypeMismatch(\"string | AccountAddress\", position);\n }\n\n if (param.isOption()) {\n if (isEmptyOption(arg)) {\n // Here we attempt to reconstruct the underlying type\n // Note, for some reason the `isBool` etc. does not work with the compiler\n const innerParam = param.value.typeArgs[0];\n if (innerParam instanceof TypeTagBool) {\n return new MoveOption<Bool>(null);\n }\n if (innerParam instanceof TypeTagAddress) {\n return new MoveOption<AccountAddress>(null);\n }\n if (innerParam instanceof TypeTagU8) {\n return new MoveOption<U8>(null);\n }\n if (innerParam instanceof TypeTagU16) {\n return new MoveOption<U16>(null);\n }\n if (innerParam instanceof TypeTagU32) {\n return new MoveOption<U32>(null);\n }\n if (innerParam instanceof TypeTagU64) {\n return new MoveOption<U64>(null);\n }\n if (innerParam instanceof TypeTagU128) {\n return new MoveOption<U128>(null);\n }\n if (innerParam instanceof TypeTagU256) {\n return new MoveOption<U256>(null);\n }\n\n // In all other cases, we will use a placeholder, it doesn't actually matter what the type is, but it will be obvious\n // Note: This is a placeholder U8 type, and does not match the actual type, as that can't be dynamically grabbed\n return new MoveOption<MoveString>(null);\n }\n\n return new MoveOption(checkOrConvertArgument(arg, param.value.typeArgs[0], position, genericTypeParams));\n }\n\n throw new Error(`Unsupported struct input type for argument ${position}, type '${param.toString()}'`);\n }\n\n throw new Error(`Type mismatch for argument ${position}, type '${param.toString()}'`);\n}\n\n/**\n * Checks that the type of the BCS encoded argument matches the ABI\n * @param param\n * @param arg\n * @param position\n * @group Implementation\n * @category Transactions\n */\nfunction checkType(param: TypeTag, arg: EntryFunctionArgumentTypes, position: number) {\n if (param.isBool()) {\n if (isBcsBool(arg)) {\n return;\n }\n throwTypeMismatch(\"Bool\", position);\n }\n if (param.isAddress()) {\n if (isBcsAddress(arg)) {\n return;\n }\n throwTypeMismatch(\"AccountAddress\", position);\n }\n if (param.isU8()) {\n if (isBcsU8(arg)) {\n return;\n }\n throwTypeMismatch(\"U8\", position);\n }\n if (param.isU16()) {\n if (isBcsU16(arg)) {\n return;\n }\n throwTypeMismatch(\"U16\", position);\n }\n if (param.isU32()) {\n if (isBcsU32(arg)) {\n return;\n }\n throwTypeMismatch(\"U32\", position);\n }\n if (param.isU64()) {\n if (isBcsU64(arg)) {\n return;\n }\n throwTypeMismatch(\"U64\", position);\n }\n if (param.isU128()) {\n if (isBcsU128(arg)) {\n return;\n }\n throwTypeMismatch(\"U128\", position);\n }\n if (param.isU256()) {\n if (isBcsU256(arg)) {\n return;\n }\n throwTypeMismatch(\"U256\", position);\n }\n if (param.isVector()) {\n if (arg instanceof MoveVector) {\n // If there's anything in it, check that the inner types match\n // Note that since it's typed, the first item should be the same as the rest\n if (arg.values.length > 0) {\n checkType(param.value, arg.values[0], position);\n }\n\n return;\n }\n throwTypeMismatch(\"MoveVector\", position);\n }\n\n // Handle structs as they're more complex\n if (param instanceof TypeTagStruct) {\n if (param.isString()) {\n if (isBcsString(arg)) {\n return;\n }\n throwTypeMismatch(\"MoveString\", position);\n }\n if (param.isObject()) {\n if (isBcsAddress(arg)) {\n return;\n }\n throwTypeMismatch(\"AccountAddress\", position);\n }\n if (param.isOption()) {\n if (arg instanceof MoveOption) {\n // If there's a value, we can check the inner type (otherwise it doesn't really matter)\n if (arg.value !== undefined) {\n checkType(param.value.typeArgs[0], arg.value, position);\n }\n return;\n }\n throwTypeMismatch(\"MoveOption\", position);\n }\n }\n\n throw new Error(`Type mismatch for argument ${position}, expected '${param.toString()}'`);\n}\n"],"mappings":"wiBAiDA,IAAMA,EAAe,IAAI,YAUlB,SAASC,GAAoBC,EAAqD,CACvF,OACEA,GAAe,IAAKC,GAEdC,EAASD,CAAO,EACXE,EAAaF,CAAO,EAEtBA,CACR,GAAK,CAAC,CAEX,CAaA,eAAsBG,EACpBC,EACAC,EACAC,EACAC,EACmC,CAEnC,IAAMC,EAAS,MAAMC,E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C,CACA,GAAIK,EAAM,MAAM,EAAG,CACjB,GAAIqC,EAAStC,CAAG,EACd,OAEFQ,EAAkB,MAAOZ,CAAQ,CACnC,CACA,GAAIK,EAAM,MAAM,EAAG,CACjB,GAAIsC,EAASvC,CAAG,EACd,OAEFQ,EAAkB,MAAOZ,CAAQ,CACnC,CACA,GAAIK,EAAM,OAAO,EAAG,CAClB,GAAIuC,EAAUxC,CAAG,EACf,OAEFQ,EAAkB,OAAQZ,CAAQ,CACpC,CACA,GAAIK,EAAM,OAAO,EAAG,CAClB,GAAIwC,EAAUzC,CAAG,EACf,OAEFQ,EAAkB,OAAQZ,CAAQ,CACpC,CACA,GAAIK,EAAM,SAAS,EAAG,CACpB,GAAID,aAAeoB,EAAY,CAGzBpB,EAAI,OAAO,OAAS,GACtBI,EAAUH,EAAM,MAAOD,EAAI,OAAO,CAAC,EAAGJ,CAAQ,EAGhD,MACF,CACAY,EAAkB,aAAcZ,CAAQ,CAC1C,CAGA,GAAIK,aAAiByC,EAAe,CAClC,GAAIzC,EAAM,SAAS,EAAG,CACpB,GAAI0C,EAAY3C,CAAG,EACjB,OAEFQ,EAAkB,aAAcZ,CAAQ,CAC1C,CACA,GAAIK,EAAM,SAAS,EAAG,CACpB,GAAIkC,EAAanC,CAAG,EAClB,OAEFQ,EAAkB,iBAAkBZ,CAAQ,CAC9C,CACA,GAAIK,EAAM,SAAS,EAAG,CACpB,GAAID,aAAe0B,EAAY,CAEzB1B,EAAI,QAAU,QAChBI,EAAUH,EAAM,MAAM,SAAS,CAAC,EAAGD,EAAI,MAAOJ,CAAQ,EAExD,MACF,CACAY,EAAkB,aAAcZ,CAAQ,CAC1C,CACF,CAEA,MAAM,IAAI,MAAM,8BAA8BA,CAAQ,eAAeK,EAAM,SAAS,CAAC,GAAG,CAC1F","names":["TEXT_ENCODER","standardizeTypeTags","typeArguments","typeArg","isString","parseTypeTag","fetchFunctionAbi","moduleAddress","moduleName","functionName","aptosConfig","module","getModule","func","fetchMoveFunctionAbi","functionAbi","params","i","fetchEntryFunctionAbi","numSigners","findFirstNonSignerArg","fetchViewFunctionAbi","returnTypes","convertCallArgument","argument","position","genericTypeParams","CallArgument","convertArgument","arg","param","checkOrConvertArgument","isEncodedEntryFunctionArgument","checkType","parseArg","isBool","Bool","throwTypeMismatch","AccountAddress","num","convertNumber","U8","U16","U32","isLargeNumber","U64","U128","U256","genericIndex","MoveVector","item","MoveString","isEmptyOption","innerParam","TypeTagBool","MoveOption","TypeTagAddress","TypeTagU8","TypeTagU16","TypeTagU32","TypeTagU64","TypeTagU128","TypeTagU256","isBcsBool","isBcsAddress","isBcsU8","isBcsU16","isBcsU32","isBcsU64","isBcsU128","isBcsU256","TypeTagStruct","isBcsString"]}
|
|
@@ -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-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
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-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
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
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as g}from"./chunk-PYY2RXFP.mjs";import{a as m}from"./chunk-53IBOHXB.mjs";import{c as A}from"./chunk-KK5HUWF6.mjs";import{s as f}from"./chunk-VHNX2NUR.mjs";import{b as w}from"./chunk-LQOSHBB7.mjs";var T=["A name must be between 3 and 63 characters long,","and can only contain lowercase a-z, 0-9, and hyphens.","A name may not start or end with a hyphen."].join(" ");function D(e){return!(!e||e.length<3||e.length>63||!/^[a-z\d][a-z\d-]{1,61}[a-z\d]$/.test(e))}function c(e){let[t,n,...o]=e.replace(/\.apt$/,"").split(".");if(o.length>0)throw new Error(`${e} is invalid. A name can only have two parts, a domain and a subdomain separated by a "."`);if(!D(t))throw new Error(`${t} is not valid. ${T}`);if(n&&!D(n))throw new Error(`${n} is not valid. ${T}`);return{domainName:n||t,subdomainName:n?t:void 0}}var I=(n=>(n[n.Independent=0]="Independent",n[n.FollowsDomain=1]="FollowsDomain",n))(I||{});function E(e){if(!e)return!1;let t=new Date(e.domain_expiration_timestamp).getTime()<Date.now(),n=new Date(e.expiration_timestamp).getTime()<Date.now();return e.subdomain&&t?!1:e.subdomain&&e.subdomain_expiration_policy===1?!0:!n}var j="0x37368b46ce665362562c6d1d4ec01a08c8644c488690df5a17e13ba163e20221",v="0x585fc9f0f0c54183b039ffc770ca282ebd87307916c215a3e692f2f8e4305e82",O={testnet:"0x5f8fd2347449685cf41d4db97926ec3a096eaf381332be4f1318ad4d16a8497c",mainnet:"0x867ed1f6bf916171b1de3ee92849b8978b7d1b9e0a8cc982a3d19d535dfd9c0c",local:v,custom:null,devnet:null};function d(e){let t=O[e.network];if(!t)throw new Error(`The ANS contract is not deployed to ${e.network}`);return t}var b=e=>{if(e&&typeof e=="object"&&"vec"in e&&Array.isArray(e.vec))return e.vec[0]};async function F(e){let{aptosConfig:t,name:n}=e,o=d(t),{domainName:r,subdomainName:s}=c(n),i=await g({aptosConfig:t,payload:{function:`${o}::router::get_owner_addr`,functionArguments:[r,s]}}),a=b(i[0]);return a?w.from(a):void 0}async function Y(e){let{aptosConfig:t,expiration:n,name:o,sender:r,targetAddress:s,toAddress:i,options:a,transferable:u}=e,p=d(t),{domainName:y,subdomainName:N}=c(o),x=n.policy==="subdomain:independent"||n.policy==="subdomain:follow-domain";if(N&&!x)throw new Error("Subdomains must have an expiration policy of either 'subdomain:independent' or 'subdomain:follow-domain'");if(x&&!N)throw new Error(`Policy is set to ${n.policy} but no subdomain was provided`);if(n.policy==="domain"){let h=n.years??1;if(h!==1)throw new Error("For now, names can only be registered for 1 year at a time");let G=h*31536e3;return await m({aptosConfig:t,sender:r.accountAddress.toString(),data:{function:`${p}::router::register_domain`,functionArguments:[y,G,s,i]},options:a})}if(!N)throw new Error(`${n.policy} requires a subdomain to be provided.`);let _=await P({aptosConfig:t,name:y});if(!_)throw new Error("The domain does not exist");let S=n.policy==="subdomain:independent"?n.expirationDate:_;if(S>_)throw new Error("The subdomain expiration time cannot be greater than the domain expiration time");return await m({aptosConfig:t,sender:r.accountAddress.toString(),data:{function:`${p}::router::register_subdomain`,functionArguments:[y,N,Math.round(S/1e3),n.policy==="subdomain:follow-domain"?1:0,!!u,s,i]},options:a})}async function P(e){let{aptosConfig:t,name:n}=e,o=d(t),{domainName:r,subdomainName:s}=c(n);try{let i=await g({aptosConfig:t,payload:{function:`${o}::router::get_expiration`,functionArguments:[r,s]}});return Number(i[0])*1e3}catch{return}}async function K(e){let{aptosConfig:t,address:n}=e,o=d(t),r=await g({aptosConfig:t,payload:{function:`${o}::router::get_primary_name`,functionArguments:[w.from(n).toString()]}}),s=b(r[1]),i=b(r[0]);if(s)return[i,s].filter(Boolean).join(".")}async function W(e){let{aptosConfig:t,sender:n,name:o,options:r}=e,s=d(t);if(!o)return await m({aptosConfig:t,sender:n.accountAddress.toString(),data:{function:`${s}::router::clear_primary_name`,functionArguments:[]},options:r});let{domainName:i,subdomainName:a}=c(o);return await m({aptosConfig:t,sender:n.accountAddress.toString(),data:{function:`${s}::router::set_primary_name`,functionArguments:[i,a]},options:r})}async function H(e){let{aptosConfig:t,name:n}=e,o=d(t),{domainName:r,subdomainName:s}=c(n),i=await g({aptosConfig:t,payload:{function:`${o}::router::get_target_addr`,functionArguments:[r,s]}}),a=b(i[0]);return a?w.from(a):void 0}async function J(e){let{aptosConfig:t,sender:n,name:o,address:r,options:s}=e,i=d(t),{domainName:a,subdomainName:u}=c(o);return await m({aptosConfig:t,sender:n.accountAddress.toString(),data:{function:`${i}::router::set_target_addr`,functionArguments:[a,u,r]},options:s})}async function X(e){let{aptosConfig:t,name:n}=e,{domainName:o,subdomainName:r=""}=c(n),a=(await A({aptosConfig:t,query:{query:f,variables:{where_condition:{domain:{_eq:o},subdomain:{_eq:r}},limit:1}},originMethod:"getName"})).current_aptos_names[0];return a&&(a=l(a)),E(a)?a:void 0}async function Z(e){let{aptosConfig:t,options:n,accountAddress:o}=e,r=await C({aptosConfig:t});return(await A({aptosConfig:t,originMethod:"getAccountNames",query:{query:f,variables:{limit:n?.limit,offset:n?.offset,order_by:n?.orderBy,where_condition:{...e.options?.where??{},owner_address:{_eq:o.toString()},expiration_timestamp:{_gte:r}}}}})).current_aptos_names.map(l)}async function ee(e){let{aptosConfig:t,options:n,accountAddress:o}=e,r=await C({aptosConfig:t});return(await A({aptosConfig:t,originMethod:"getAccountDomains",query:{query:f,variables:{limit:n?.limit,offset:n?.offset,order_by:n?.orderBy,where_condition:{...e.options?.where??{},owner_address:{_eq:o.toString()},expiration_timestamp:{_gte:r},subdomain:{_eq:""}}}}})).current_aptos_names.map(l)}async function ne(e){let{aptosConfig:t,options:n,accountAddress:o}=e,r=await C({aptosConfig:t});return(await A({aptosConfig:t,originMethod:"getAccountSubdomains",query:{query:f,variables:{limit:n?.limit,offset:n?.offset,order_by:n?.orderBy,where_condition:{...e.options?.where??{},owner_address:{_eq:o.toString()},expiration_timestamp:{_gte:r},subdomain:{_neq:""}}}}})).current_aptos_names.map(l)}async function te(e){let{aptosConfig:t,options:n,domain:o}=e;return(await A({aptosConfig:t,originMethod:"getDomainSubdomains",query:{query:f,variables:{limit:n?.limit,offset:n?.offset,order_by:n?.orderBy,where_condition:{...e.options?.where??{},domain:{_eq:o},subdomain:{_neq:""}}}}})).current_aptos_names.map(l).filter(E)}async function C(e){let{aptosConfig:t}=e,n=d(t),[o]=await g({aptosConfig:t,payload:{function:`${n}::config::reregistration_grace_sec`,functionArguments:[]}}),r=o/60/60/24,s=()=>new Date;return new Date(s().setDate(s().getDate()-r)).toISOString()}async function oe(e){let{aptosConfig:t,sender:n,name:o,years:r=1,options:s}=e,i=d(t),a=r*31536e3,{domainName:u,subdomainName:p}=c(o);if(p)throw new Error("Subdomains cannot be renewed");if(r!==1)throw new Error("Currently, only 1 year renewals are supported");return await m({aptosConfig:t,sender:n.accountAddress.toString(),data:{function:`${i}::router::renew_domain`,functionArguments:[u,a]},options:s})}function l(e){return{...e,expiration_timestamp:new Date(e.expiration_timestamp).getTime()}}export{T as a,D as b,c,I as d,E as e,j as f,v as g,F as h,Y as i,P as j,K as k,W as l,H as m,J as n,X as o,Z as p,ee as q,ne as r,te as s,oe as t};
|
|
2
|
+
//# sourceMappingURL=chunk-YAGIE4GN.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{b as K}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{b as K}from"./chunk-CPAAEEF4.mjs";import{i as m,r as u}from"./chunk-HVIF6DW6.mjs";import{a as f}from"./chunk-ZD2TY5N3.mjs";import{b as y}from"./chunk-VHY6ZATX.mjs";var h=class c extends K{constructor(e){let r=m.create(e);super({publicKey:r,...e}),this.publicKey=r}serialize(e){super.serialize(e)}static deserialize(e){let{address:r,proof:l,ephemeralKeyPair:i,jwt:o,uidKey:t,pepper:s,verificationKeyHash:n}=K.partialDeserialize(e),{iss:a,aud:p,uidVal:d}=u({jwt:o,uidKey:t});return new c({address:r,proof:l,ephemeralKeyPair:i,iss:a,uidKey:t,uidVal:d,aud:p,pepper:s,jwt:o,verificationKeyHash:n})}static fromBytes(e){return c.deserialize(new f(y.hexInputToUint8Array(e)))}static create(e){let{address:r,proof:l,jwt:i,ephemeralKeyPair:o,pepper:t,uidKey:s="sub",proofFetchCallback:n,verificationKey:a}=e,{iss:p,aud:d,uidVal:g}=u({jwt:i,uidKey:s});return new c({address:r,proof:l,ephemeralKeyPair:o,iss:p,uidKey:s,uidVal:g,aud:d,pepper:t,jwt:i,proofFetchCallback:n,verificationKeyHash:a?a.hash():void 0})}};export{h as a};
|
|
2
|
+
//# sourceMappingURL=chunk-YLUULY6G.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as i}from"./chunk-27ESCVVC.mjs";import{a as e}from"./chunk-BQYKFATL.mjs";import{a as r}from"./chunk-RXHER6EA.mjs";var n=class o extends r{constructor(t,a){super(),this.raw_txn=t,this.authenticator=a}serialize(t){this.raw_txn.serialize(t),this.authenticator.serialize(t)}static deserialize(t){let a=i.deserialize(t),s=e.deserialize(t);return new o(a,s)}};export{n as a};
|
|
2
|
+
//# sourceMappingURL=chunk-YWSDONJJ.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as s}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as s}from"./chunk-W2C5KRUQ.mjs";import{a as e,c as n}from"./chunk-BHVSIRNF.mjs";var r=class{constructor(t,i,o,a,c){this.lastUncommintedNumber=null;this.currentNumber=null;this.lock=!1;this.aptosConfig=t,this.account=i,this.maxWaitTime=o,this.maximumInFlight=a,this.sleepTime=c}async nextSequenceNumber(){for(;this.lock;)await e(this.sleepTime);this.lock=!0;let t=BigInt(0);try{if((this.lastUncommintedNumber===null||this.currentNumber===null)&&await this.initialize(),this.currentNumber-this.lastUncommintedNumber>=this.maximumInFlight){await this.update();let i=n();for(;this.currentNumber-this.lastUncommintedNumber>=this.maximumInFlight;)await e(this.sleepTime),n()-i>this.maxWaitTime?(console.warn(`Waited over 30 seconds for a transaction to commit, re-syncing ${this.account.accountAddress.toString()}`),await this.initialize()):await this.update()}t=this.currentNumber,this.currentNumber+=BigInt(1)}catch(i){console.error("error in getting next sequence number for this account",i)}finally{this.lock=!1}return t}async initialize(){let{sequence_number:t}=await s({aptosConfig:this.aptosConfig,accountAddress:this.account.accountAddress});this.currentNumber=BigInt(t),this.lastUncommintedNumber=BigInt(t)}async update(){let{sequence_number:t}=await s({aptosConfig:this.aptosConfig,accountAddress:this.account.accountAddress});return this.lastUncommintedNumber=BigInt(t),this.lastUncommintedNumber}async synchronize(){if(this.lastUncommintedNumber!==this.currentNumber){for(;this.lock;)await e(this.sleepTime);this.lock=!0;try{await this.update();let t=n();for(;this.lastUncommintedNumber!==this.currentNumber;)n()-t>this.maxWaitTime?(console.warn(`Waited over 30 seconds for a transaction to commit, re-syncing ${this.account.accountAddress.toString()}`),await this.initialize()):(await e(this.sleepTime),await this.update())}catch(t){console.error("error in synchronizing this account sequence number with the one on chain",t)}finally{this.lock=!1}}}};export{r as a};
|
|
2
|
+
//# sourceMappingURL=chunk-YXYYII5S.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{b as s}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{b as s}from"./chunk-VHY6ZATX.mjs";import{c as r}from"./chunk-56CNRT2K.mjs";var a=class d{constructor(e){this.buffer=new ArrayBuffer(e.length),new Uint8Array(this.buffer).set(e,0),this.offset=0}static fromHex(e){let i=s.hexInputToUint8Array(e);return new d(i)}read(e){if(this.offset+e>this.buffer.byteLength)throw new Error("Reached to the end of buffer");let i=this.buffer.slice(this.offset,this.offset+e);return this.offset+=e,i}remaining(){return this.buffer.byteLength-this.offset}deserializeStr(){let e=this.deserializeBytes();return new TextDecoder().decode(e)}deserializeOptionStr(){return this.deserializeOption("string")}deserializeOption(e,i){if(this.deserializeBool()){if(e==="string")return this.deserializeStr();if(e==="bytes")return this.deserializeBytes();if(e==="fixedBytes"){if(i===void 0)throw new Error("Fixed bytes length not provided");return this.deserializeFixedBytes(i)}return this.deserialize(e)}}deserializeBytes(){let e=this.deserializeUleb128AsU32();return new Uint8Array(this.read(e))}deserializeFixedBytes(e){return new Uint8Array(this.read(e))}deserializeBool(){let e=new Uint8Array(this.read(1))[0];if(e!==1&&e!==0)throw new Error("Invalid boolean value");return e===1}deserializeU8(){return new DataView(this.read(1)).getUint8(0)}deserializeU16(){return new DataView(this.read(2)).getUint16(0,!0)}deserializeU32(){return new DataView(this.read(4)).getUint32(0,!0)}deserializeU64(){let e=this.deserializeU32(),i=this.deserializeU32();return BigInt(BigInt(i)<<BigInt(32)|BigInt(e))}deserializeU128(){let e=this.deserializeU64(),i=this.deserializeU64();return BigInt(i<<BigInt(64)|e)}deserializeU256(){let e=this.deserializeU128(),i=this.deserializeU128();return BigInt(i<<BigInt(128)|e)}deserializeUleb128AsU32(){let e=BigInt(0),i=0;for(;e<r;){let t=this.deserializeU8();if(e|=BigInt(t&127)<<BigInt(i),!(t&128))break;i+=7}if(e>r)throw new Error("Overflow while parsing uleb128-encoded uint32 value");return Number(e)}deserialize(e){return e.deserialize(this)}deserializeVector(e){let i=this.deserializeUleb128AsU32(),t=new Array;for(let n=0;n<i;n+=1)t.push(this.deserialize(e));return t}};export{a};
|
|
2
|
+
//# sourceMappingURL=chunk-ZD2TY5N3.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{b as s}from"./chunk-W4BSN6SK.mjs";import{g as r}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{b as s}from"./chunk-W4BSN6SK.mjs";import{g as r}from"./chunk-53IBOHXB.mjs";import{a as o}from"./chunk-KDMSOCZY.mjs";var i=class{constructor(n){this.config=n}async simple(n){return r({aptosConfig:this.config,...n})}async multiAgent(n){return r({aptosConfig:this.config,...n})}};o([s],i.prototype,"simple",1),o([s],i.prototype,"multiAgent",1);export{i as a};
|
|
2
|
+
//# sourceMappingURL=chunk-ZS2IVRHT.mjs.map
|
package/dist/esm/cli/index.d.mts
CHANGED
|
@@ -10,5 +10,6 @@ import '../types/indexer.mjs';
|
|
|
10
10
|
import '../types/generated/operations.mjs';
|
|
11
11
|
import '../types/generated/types.mjs';
|
|
12
12
|
import '../utils/apiEndpoints.mjs';
|
|
13
|
+
import '@aptos-labs/script-composer-pack';
|
|
13
14
|
import '../bcs/deserializer.mjs';
|
|
14
15
|
import '../transactions/instances/transactionArgument.mjs';
|
package/dist/esm/cli/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as o}from"../chunk-
|
|
1
|
+
import{a as o}from"../chunk-US2HZFOM.mjs";import{a as r}from"../chunk-35DKMW7Q.mjs";import"../chunk-BHVSIRNF.mjs";import"../chunk-LQOSHBB7.mjs";import"../chunk-3OLFJ65O.mjs";import"../chunk-R6QCPXQG.mjs";import"../chunk-4WPQQPUF.mjs";import"../chunk-RXHER6EA.mjs";import"../chunk-VHY6ZATX.mjs";import"../chunk-IF4UU2MT.mjs";import"../chunk-56CNRT2K.mjs";import"../chunk-KDMSOCZY.mjs";export{o as LocalNode,r as Move};
|
|
2
2
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a}from"../chunk-
|
|
1
|
+
import{a}from"../chunk-US2HZFOM.mjs";import"../chunk-BHVSIRNF.mjs";import"../chunk-LQOSHBB7.mjs";import"../chunk-3OLFJ65O.mjs";import"../chunk-R6QCPXQG.mjs";import"../chunk-4WPQQPUF.mjs";import"../chunk-RXHER6EA.mjs";import"../chunk-VHY6ZATX.mjs";import"../chunk-IF4UU2MT.mjs";import"../chunk-56CNRT2K.mjs";import"../chunk-KDMSOCZY.mjs";export{a as LocalNode};
|
|
2
2
|
//# sourceMappingURL=localNode.mjs.map
|
package/dist/esm/cli/move.d.mts
CHANGED
|
@@ -7,6 +7,7 @@ import '../types/types.mjs';
|
|
|
7
7
|
import '../types/indexer.mjs';
|
|
8
8
|
import '../types/generated/operations.mjs';
|
|
9
9
|
import '../types/generated/types.mjs';
|
|
10
|
+
import '@aptos-labs/script-composer-pack';
|
|
10
11
|
import '../bcs/deserializer.mjs';
|
|
11
12
|
import '../transactions/instances/transactionArgument.mjs';
|
|
12
13
|
|
|
@@ -5,6 +5,7 @@ import '../utils/apiEndpoints.mjs';
|
|
|
5
5
|
import '../types/indexer.mjs';
|
|
6
6
|
import '../types/generated/operations.mjs';
|
|
7
7
|
import '../types/generated/types.mjs';
|
|
8
|
+
import '@aptos-labs/script-composer-pack';
|
|
8
9
|
|
|
9
10
|
/**
|
|
10
11
|
* Sends a request using the specified options and returns the response.
|
|
@@ -14,6 +15,7 @@ import '../types/generated/types.mjs';
|
|
|
14
15
|
* @param options.method - The HTTP method to use for the request.
|
|
15
16
|
* @param options.body - The body of the request.
|
|
16
17
|
* @param options.contentType - The content type of the request.
|
|
18
|
+
* @param options.acceptType - The accept type of the request.
|
|
17
19
|
* @param options.params - The query parameters to include in the request.
|
|
18
20
|
* @param options.overrides - Additional overrides for the request.
|
|
19
21
|
* @param options.overrides.HEADERS - Custom headers to include in the request.
|
|
@@ -27,6 +29,28 @@ import '../types/generated/types.mjs';
|
|
|
27
29
|
* @category Client
|
|
28
30
|
*/
|
|
29
31
|
declare function request<Req, Res>(options: ClientRequest<Req>, client: Client): Promise<ClientResponse<Res>>;
|
|
32
|
+
/**
|
|
33
|
+
* Sends a request using the specified options and returns the response.
|
|
34
|
+
*
|
|
35
|
+
* @param options - The options for the request.
|
|
36
|
+
* @param options.url - The URL to send the request to.
|
|
37
|
+
* @param options.method - The HTTP method to use for the request.
|
|
38
|
+
* @param options.body - The body of the request.
|
|
39
|
+
* @param options.contentType - The content type of the request.
|
|
40
|
+
* @param options.acceptType - The accept type of the request.
|
|
41
|
+
* @param options.params - The query parameters to include in the request.
|
|
42
|
+
* @param options.overrides - Additional overrides for the request.
|
|
43
|
+
* @param options.overrides.HEADERS - Custom headers to include in the request.
|
|
44
|
+
* @param options.overrides.AUTH_TOKEN - The authorization token for the request.
|
|
45
|
+
* @param options.overrides.API_KEY - The API key for the request.
|
|
46
|
+
* @param options.originMethod - The origin method for the request.
|
|
47
|
+
* @param client - The client used to make the request.
|
|
48
|
+
*
|
|
49
|
+
* @returns The response from the request.
|
|
50
|
+
* @group Implementation
|
|
51
|
+
* @category Client
|
|
52
|
+
*/
|
|
53
|
+
declare function binaryRequest<Req>(options: ClientRequest<Req>, client: Client): Promise<ClientResponse<Buffer>>;
|
|
30
54
|
/**
|
|
31
55
|
* The main function to use when making an API request, returning the response or throwing an AptosApiError on failure.
|
|
32
56
|
*
|
|
@@ -38,5 +62,17 @@ declare function request<Req, Res>(options: ClientRequest<Req>, client: Client):
|
|
|
38
62
|
* @category Client
|
|
39
63
|
*/
|
|
40
64
|
declare function aptosRequest<Req extends {}, Res extends {}>(aptosRequestOpts: AptosRequest, aptosConfig: AptosConfig, apiType: AptosApiType): Promise<AptosResponse<Req, Res>>;
|
|
65
|
+
/**
|
|
66
|
+
* The main function to use when making an API request, returning the response or throwing an AptosApiError on failure.
|
|
67
|
+
*
|
|
68
|
+
* @param aptosRequestOpts - Options for the Aptos request, including the URL and path.
|
|
69
|
+
* @param aptosConfig - The configuration information for the SDK client instance.
|
|
70
|
+
* @param apiType - The type of API being accessed, which determines how the response is handled.
|
|
71
|
+
* @returns The response from the API request or throws an AptosApiError if the request fails.
|
|
72
|
+
* @group Implementation
|
|
73
|
+
* @category Client
|
|
74
|
+
* @experimental
|
|
75
|
+
*/
|
|
76
|
+
declare function aptosBinaryRequest<Req extends {}>(aptosRequestOpts: AptosRequest, aptosConfig: AptosConfig, apiType: AptosApiType): Promise<AptosResponse<Req, Buffer>>;
|
|
41
77
|
|
|
42
|
-
export { aptosRequest, request };
|
|
78
|
+
export { aptosBinaryRequest, aptosRequest, binaryRequest, request };
|
package/dist/esm/client/core.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a,b}from"../chunk-
|
|
1
|
+
import{a,b,c,d}from"../chunk-TWETGZ3W.mjs";import"../chunk-HGLO5LDS.mjs";import"../chunk-BMPHQ3E7.mjs";import"../chunk-TH5JCPN2.mjs";import"../chunk-4RXKALLC.mjs";import"../chunk-RJ7F4JDV.mjs";import"../chunk-FZY4PMEE.mjs";import"../chunk-ERLDXTIY.mjs";import"../chunk-RIINVEZA.mjs";import"../chunk-HHWJHOFZ.mjs";import"../chunk-TKXEVD7A.mjs";import"../chunk-ZD2TY5N3.mjs";import"../chunk-BHVSIRNF.mjs";import"../chunk-LQOSHBB7.mjs";import"../chunk-3OLFJ65O.mjs";import"../chunk-R6QCPXQG.mjs";import"../chunk-4WPQQPUF.mjs";import"../chunk-RXHER6EA.mjs";import"../chunk-VHY6ZATX.mjs";import"../chunk-IF4UU2MT.mjs";import"../chunk-56CNRT2K.mjs";import"../chunk-BY3XFRUM.mjs";import"../chunk-KDMSOCZY.mjs";export{d as aptosBinaryRequest,c as aptosRequest,b as binaryRequest,a as request};
|
|
2
2
|
//# sourceMappingURL=core.mjs.map
|