@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
package/dist/common/index.js
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } function _optionalChainDelete(ops) { const result = _optionalChain(ops); return result == null ? true : result; }var _chunkIHUCZKG2js = require('./chunk-IHUCZKG2.js');var Vr=255,Hr=65535,Ne=4294967295,gt=18446744073709551615n,ir=340282366920938463463374607431768211455n,qr=115792089237316195423570985008687907853269984665640564039457584007913129639935n;var _utils = require('@noble/hashes/utils');var J=class extends Error{constructor(e,t){super(e),this.invalidReason=t}};var Fa=(n=>(n.TOO_SHORT="too_short",n.INVALID_LENGTH="invalid_length",n.INVALID_HEX_CHARS="invalid_hex_chars",n))(Fa||{}),m= exports.Hex =class r{constructor(e){this.data=e}toUint8Array(){return this.data}toStringWithoutPrefix(){return _utils.bytesToHex.call(void 0, this.data)}toString(){return`0x${this.toStringWithoutPrefix()}`}static fromHexString(e){let t=e;if(t.startsWith("0x")&&(t=t.slice(2)),t.length===0)throw new J("Hex string is too short, must be at least 1 char long, excluding the optional leading 0x.","too_short");if(t.length%2!==0)throw new J("Hex string must be an even number of hex characters.","invalid_length");try{return new r(_utils.hexToBytes.call(void 0, t))}catch(n){throw new J(`Hex string contains invalid hex characters: ${_optionalChain([n, 'optionalAccess', _2 => _2.message])}`,"invalid_hex_chars")}}static fromHexInput(e){return e instanceof Uint8Array?new r(e):r.fromHexString(e)}static hexInputToUint8Array(e){return e instanceof Uint8Array?e:r.fromHexString(e).toUint8Array()}static hexInputToString(e){return r.fromHexInput(e).toString()}static hexInputToStringWithoutPrefix(e){return r.fromHexInput(e).toStringWithoutPrefix()}static isValid(e){try{return r.fromHexString(e),{valid:!0}}catch(t){return{valid:!1,invalidReason:_optionalChain([t, 'optionalAccess', _3 => _3.invalidReason]),invalidReasonMessage:_optionalChain([t, 'optionalAccess', _4 => _4.message])}}}equals(e){return this.data.length!==e.data.length?!1:this.data.every((t,n)=>t===e.data[n])}},Fi= exports.hexToAsciiString =r=>new TextDecoder().decode(m.fromHexInput(r).toUint8Array());var D=class r{constructor(e){this.buffer=new ArrayBuffer(e.length),new Uint8Array(this.buffer).set(e,0),this.offset=0}static fromHex(e){let t=m.hexInputToUint8Array(e);return new r(t)}read(e){if(this.offset+e>this.buffer.byteLength)throw new Error("Reached to the end of buffer");let t=this.buffer.slice(this.offset,this.offset+e);return this.offset+=e,t}remaining(){return this.buffer.byteLength-this.offset}deserializeStr(){let e=this.deserializeBytes();return new TextDecoder().decode(e)}deserializeOptionStr(){return this.deserializeOption("string")}deserializeOption(e,t){if(this.deserializeBool()){if(e==="string")return this.deserializeStr();if(e==="bytes")return this.deserializeBytes();if(e==="fixedBytes"){if(t===void 0)throw new Error("Fixed bytes length not provided");return this.deserializeFixedBytes(t)}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(),t=this.deserializeU32();return BigInt(BigInt(t)<<BigInt(32)|BigInt(e))}deserializeU128(){let e=this.deserializeU64(),t=this.deserializeU64();return BigInt(t<<BigInt(64)|e)}deserializeU256(){let e=this.deserializeU128(),t=this.deserializeU128();return BigInt(t<<BigInt(128)|e)}deserializeUleb128AsU32(){let e=BigInt(0),t=0;for(;e<Ne;){let n=this.deserializeU8();if(e|=BigInt(n&127)<<BigInt(t),!(n&128))break;t+=7}if(e>Ne)throw new Error("Overflow while parsing uleb128-encoded uint32 value");return Number(e)}deserialize(e){return e.deserialize(this)}deserializeVector(e){let t=this.deserializeUleb128AsU32(),n=new Array;for(let i=0;i<t;i+=1)n.push(this.deserialize(e));return n}};var y=class{bcsToBytes(){let e=new B;return this.serialize(e),e.toUint8Array()}bcsToHex(){let e=this.bcsToBytes();return m.fromHexInput(e)}toStringWithoutPrefix(){return this.bcsToHex().toStringWithoutPrefix()}toString(){return`0x${this.toStringWithoutPrefix()}`}},B= exports.Serializer =class{constructor(e=64){if(e<=0)throw new Error("Length needs to be greater than 0");this.buffer=new ArrayBuffer(e),this.offset=0}ensureBufferWillHandleSize(e){for(;this.buffer.byteLength<this.offset+e;){let t=new ArrayBuffer(this.buffer.byteLength*2);new Uint8Array(t).set(new Uint8Array(this.buffer)),this.buffer=t}}appendToBuffer(e){this.ensureBufferWillHandleSize(e.length),new Uint8Array(this.buffer,this.offset).set(e),this.offset+=e.length}serializeWithFunction(e,t,n){this.ensureBufferWillHandleSize(t);let i=new DataView(this.buffer,this.offset);e.apply(i,[0,n,!0]),this.offset+=t}serializeStr(e){let t=new TextEncoder;this.serializeBytes(t.encode(e))}serializeBytes(e){this.serializeU32AsUleb128(e.length),this.appendToBuffer(e)}serializeFixedBytes(e){this.appendToBuffer(e)}serializeBool(e){Gn(e);let t=e?1:0;this.appendToBuffer(new Uint8Array([t]))}serializeU8(e){this.appendToBuffer(new Uint8Array([e]))}serializeU16(e){this.serializeWithFunction(DataView.prototype.setUint16,2,e)}serializeU32(e){this.serializeWithFunction(DataView.prototype.setUint32,4,e)}serializeU64(e){let t=BigInt(e)&BigInt(Ne),n=BigInt(e)>>BigInt(32);this.serializeU32(Number(t)),this.serializeU32(Number(n))}serializeU128(e){let t=BigInt(e)>,n=BigInt(e)>>BigInt(64);this.serializeU64(t),this.serializeU64(n)}serializeU256(e){let t=BigInt(e)&ir,n=BigInt(e)>>BigInt(128);this.serializeU128(t),this.serializeU128(n)}serializeU32AsUleb128(e){let t=e,n=[];for(;t>>>7;)n.push(t&127|128),t>>>=7;n.push(t),this.appendToBuffer(new Uint8Array(n))}toUint8Array(){return new Uint8Array(this.buffer).slice(0,this.offset)}serialize(e){e.serialize(this)}serializeVector(e){this.serializeU32AsUleb128(e.length),e.forEach(t=>{t.serialize(this)})}serializeOption(e,t){let n=e!==void 0;this.serializeBool(n),n&&(typeof e=="string"?this.serializeStr(e):e instanceof Uint8Array?t!==void 0?this.serializeFixedBytes(e):this.serializeBytes(e):e.serialize(this))}serializeOptionStr(e){e===void 0?this.serializeU32AsUleb128(0):(this.serializeU32AsUleb128(1),this.serializeStr(e))}};_chunkIHUCZKG2js.a.call(void 0, [yt(0,Vr)],B.prototype,"serializeU8",1),_chunkIHUCZKG2js.a.call(void 0, [yt(0,Hr)],B.prototype,"serializeU16",1),_chunkIHUCZKG2js.a.call(void 0, [yt(0,Ne)],B.prototype,"serializeU32",1),_chunkIHUCZKG2js.a.call(void 0, [yt(BigInt(0),gt)],B.prototype,"serializeU64",1),_chunkIHUCZKG2js.a.call(void 0, [yt(BigInt(0),ir)],B.prototype,"serializeU128",1),_chunkIHUCZKG2js.a.call(void 0, [yt(BigInt(0),qr)],B.prototype,"serializeU256",1),_chunkIHUCZKG2js.a.call(void 0, [yt(0,Ne)],B.prototype,"serializeU32AsUleb128",1);function Gn(r){if(typeof r!="boolean")throw new Error(`${r} is not a boolean value`)}var Ga=(r,e,t)=>`${r} is out of range: [${e}, ${t}]`;function tt(r,e,t){let n=BigInt(r);if(n>BigInt(t)||n<BigInt(e))throw new Error(Ga(r,e,t))}function yt(r,e){return(t,n,i)=>{let o=i.value;return i.value=function(a){return tt(a,r,e),o.apply(this,[a])},i}}var mt=class r extends y{constructor(e){super(),this.value=m.fromHexInput(e).toUint8Array()}serialize(e){e.serializeFixedBytes(this.value)}serializeForEntryFunction(e){e.serialize(this)}serializeForScriptFunction(e){e.serialize(this)}static deserialize(e,t){let n=e.deserializeFixedBytes(t);return new r(n)}};var $r=class r extends y{constructor(e){super(),this.value=new mt(e)}serialize(e){e.serialize(this.value)}serializeForEntryFunction(e){e.serializeU32AsUleb128(this.value.value.length),e.serialize(this)}static deserialize(e,t){let n=mt.deserialize(e,t);return new r(n.value)}};var Wr=(i=>(i.JSON="application/json",i.BCS="application/x-bcs",i.BCS_SIGNED_TRANSACTION="application/x.aptos.signed_transaction+bcs",i.BCS_VIEW_FUNCTION="application/x.aptos.view_function+bcs",i))(Wr||{}),Gi= exports.TypeTagVariants =(d=>(d[d.Bool=0]="Bool",d[d.U8=1]="U8",d[d.U64=2]="U64",d[d.U128=3]="U128",d[d.Address=4]="Address",d[d.Signer=5]="Signer",d[d.Vector=6]="Vector",d[d.Struct=7]="Struct",d[d.U16=8]="U16",d[d.U32=9]="U32",d[d.U256=10]="U256",d[d.Reference=254]="Reference",d[d.Generic=255]="Generic",d))(Gi||{}),or= exports.ScriptTransactionArgumentVariants =(l=>(l[l.U8=0]="U8",l[l.U64=1]="U64",l[l.U128=2]="U128",l[l.Address=3]="Address",l[l.U8Vector=4]="U8Vector",l[l.Bool=5]="Bool",l[l.U16=6]="U16",l[l.U32=7]="U32",l[l.U256=8]="U256",l[l.Serialized=9]="Serialized",l))(or||{}),Bi= exports.TransactionPayloadVariants =(n=>(n[n.Script=0]="Script",n[n.EntryFunction=2]="EntryFunction",n[n.Multisig=3]="Multisig",n))(Bi||{}),Mi= exports.TransactionVariants =(t=>(t[t.MultiAgentTransaction=0]="MultiAgentTransaction",t[t.FeePayerTransaction=1]="FeePayerTransaction",t))(Mi||{}),Li= exports.TransactionAuthenticatorVariant =(o=>(o[o.Ed25519=0]="Ed25519",o[o.MultiEd25519=1]="MultiEd25519",o[o.MultiAgent=2]="MultiAgent",o[o.FeePayer=3]="FeePayer",o[o.SingleSender=4]="SingleSender",o))(Li||{}),Vi= exports.AccountAuthenticatorVariant =(o=>(o[o.Ed25519=0]="Ed25519",o[o.MultiEd25519=1]="MultiEd25519",o[o.SingleKey=2]="SingleKey",o[o.MultiKey=3]="MultiKey",o[o.NoAccountAuthenticator=4]="NoAccountAuthenticator",o))(Vi||{}),Qr= exports.PrivateKeyVariants =(t=>(t.Ed25519="ed25519",t.Secp256k1="secp256k1",t))(Qr||{}),sr= exports.AnyPublicKeyVariant =(i=>(i[i.Ed25519=0]="Ed25519",i[i.Secp256k1=1]="Secp256k1",i[i.Keyless=3]="Keyless",i[i.FederatedKeyless=4]="FederatedKeyless",i))(sr||{}),Hi= exports.AnySignatureVariant =(n=>(n[n.Ed25519=0]="Ed25519",n[n.Secp256k1=1]="Secp256k1",n[n.Keyless=3]="Keyless",n))(Hi||{}),Bn= exports.EphemeralPublicKeyVariant =(e=>(e[e.Ed25519=0]="Ed25519",e))(Bn||{}),qi= exports.EphemeralSignatureVariant =(e=>(e[e.Ed25519=0]="Ed25519",e))(qi||{}),Mn= exports.EphemeralCertificateVariant =(e=>(e[e.ZkProof=0]="ZkProof",e))(Mn||{}),Ln= exports.ZkpVariant =(e=>(e[e.Groth16=0]="Groth16",e))(Ln||{}),Vn= exports.TransactionResponseType =(a=>(a.Pending="pending_transaction",a.User="user_transaction",a.Genesis="genesis_transaction",a.BlockMetadata="block_metadata_transaction",a.StateCheckpoint="state_checkpoint_transaction",a.Validator="validator_transaction",a.BlockEpilogue="block_epilogue_transaction",a))(Vn||{});function sp(r){return r.type==="pending_transaction"}function ap(r){return r.type==="user_transaction"}function cp(r){return r.type==="genesis_transaction"}function up(r){return r.type==="block_metadata_transaction"}function pp(r){return r.type==="state_checkpoint_transaction"}function dp(r){return r.type==="validator_transaction"}function lp(r){return r.type==="block_epilogue_transaction"}function gp(r){return"signature"in r&&r.signature==="ed25519_signature"}function yp(r){return"signature"in r&&r.signature==="secp256k1_ecdsa_signature"}function mp(r){return r.type==="multi_agent_signature"}function fp(r){return r.type==="fee_payer_signature"}function Ap(r){return r.type==="multi_ed25519_signature"}var Ba=(n=>(n.PRIVATE="private",n.PUBLIC="public",n.FRIEND="friend",n))(Ba||{}),$i= exports.MoveAbility =(i=>(i.STORE="store",i.DROP="drop",i.KEY="key",i.COPY="copy",i))($i||{}),Ma= exports.RoleType =(t=>(t.VALIDATOR="validator",t.FULL_NODE="full_node",t))(Ma||{}),oe= exports.SigningScheme =(i=>(i[i.Ed25519=0]="Ed25519",i[i.MultiEd25519=1]="MultiEd25519",i[i.SingleKey=2]="SingleKey",i[i.MultiKey=3]="MultiKey",i))(oe||{}),Hn= exports.SigningSchemeInput =(t=>(t[t.Ed25519=0]="Ed25519",t[t.Secp256k1Ecdsa=2]="Secp256k1Ecdsa",t))(Hn||{}),Wi= exports.DeriveScheme =(o=>(o[o.DeriveAuid=251]="DeriveAuid",o[o.DeriveObjectAddressFromObject=252]="DeriveObjectAddressFromObject",o[o.DeriveObjectAddressFromGuid=253]="DeriveObjectAddressFromGuid",o[o.DeriveObjectAddressFromSeed=254]="DeriveObjectAddressFromSeed",o[o.DeriveResourceAccountAddress=255]="DeriveResourceAccountAddress",o))(Wi||{});var U=class r extends y{constructor(e){super(),Gn(e),this.value=e}serialize(e){e.serializeBool(this.value)}serializeForEntryFunction(e){let t=this.bcsToBytes();e.serializeBytes(t)}serializeForScriptFunction(e){e.serializeU32AsUleb128(5),e.serialize(this)}deserialize(e){return new ye(e.deserializeU256())}static deserialize(e){return new r(e.deserializeBool())}},X= exports.U8 =class r extends y{constructor(e){super(),tt(e,0,Vr),this.value=e}serialize(e){e.serializeU8(this.value)}serializeForEntryFunction(e){let t=this.bcsToBytes();e.serializeBytes(t)}serializeForScriptFunction(e){e.serializeU32AsUleb128(0),e.serialize(this)}static deserialize(e){return new r(e.deserializeU8())}},_e= exports.U16 =class r extends y{constructor(e){super(),tt(e,0,Hr),this.value=e}serialize(e){e.serializeU16(this.value)}serializeForEntryFunction(e){let t=this.bcsToBytes();e.serializeBytes(t)}serializeForScriptFunction(e){e.serializeU32AsUleb128(6),e.serialize(this)}static deserialize(e){return new r(e.deserializeU16())}},xe= exports.U32 =class r extends y{constructor(e){super(),tt(e,0,Ne),this.value=e}serialize(e){e.serializeU32(this.value)}serializeForEntryFunction(e){let t=this.bcsToBytes();e.serializeBytes(t)}serializeForScriptFunction(e){e.serializeU32AsUleb128(7),e.serialize(this)}static deserialize(e){return new r(e.deserializeU32())}},Q= exports.U64 =class r extends y{constructor(e){super(),tt(e,BigInt(0),gt),this.value=BigInt(e)}serialize(e){e.serializeU64(this.value)}serializeForEntryFunction(e){let t=this.bcsToBytes();e.serializeBytes(t)}serializeForScriptFunction(e){e.serializeU32AsUleb128(1),e.serialize(this)}static deserialize(e){return new r(e.deserializeU64())}},Ee= exports.U128 =class r extends y{constructor(e){super(),tt(e,BigInt(0),ir),this.value=BigInt(e)}serialize(e){e.serializeU128(this.value)}serializeForEntryFunction(e){let t=this.bcsToBytes();e.serializeBytes(t)}serializeForScriptFunction(e){e.serializeU32AsUleb128(2),e.serialize(this)}static deserialize(e){return new r(e.deserializeU128())}},ye= exports.U256 =class r extends y{constructor(e){super(),tt(e,BigInt(0),qr),this.value=BigInt(e)}serialize(e){e.serializeU256(this.value)}serializeForEntryFunction(e){let t=this.bcsToBytes();e.serializeBytes(t)}serializeForScriptFunction(e){e.serializeU32AsUleb128(8),e.serialize(this)}static deserialize(e){return new r(e.deserializeU256())}};var S=class r extends y{constructor(e){super(),this.values=e}serializeForEntryFunction(e){let t=this.bcsToBytes();e.serializeBytes(t)}serializeForScriptFunction(e){if(this.values[0]!==void 0&&!(this.values[0]instanceof X)){new ar(this.bcsToBytes()).serializeForScriptFunction(e);return}e.serializeU32AsUleb128(4),e.serialize(this)}static U8(e){let t;if(Array.isArray(e)&&e.length===0)t=[];else if(Array.isArray(e)&&typeof e[0]=="number")t=e;else if(typeof e=="string"){let n=m.fromHexInput(e);t=Array.from(n.toUint8Array())}else if(e instanceof Uint8Array)t=Array.from(e);else throw new Error("Invalid input type, must be an number[], Uint8Array, or hex string");return new r(t.map(n=>new X(n)))}static U16(e){return new r(e.map(t=>new _e(t)))}static U32(e){return new r(e.map(t=>new xe(t)))}static U64(e){return new r(e.map(t=>new Q(t)))}static U128(e){return new r(e.map(t=>new Ee(t)))}static U256(e){return new r(e.map(t=>new ye(t)))}static Bool(e){return new r(e.map(t=>new U(t)))}static MoveString(e){return new r(e.map(t=>new x(t)))}serialize(e){e.serializeVector(this.values)}static deserialize(e,t){let n=e.deserializeUleb128AsU32(),i=new Array;for(let o=0;o<n;o+=1)i.push(t.deserialize(e));return new r(i)}},ar= exports.Serialized =class r extends y{constructor(e){super(),this.value=m.fromHexInput(e).toUint8Array()}serialize(e){e.serializeBytes(this.value)}serializeForEntryFunction(e){this.serialize(e)}serializeForScriptFunction(e){e.serializeU32AsUleb128(9),this.serialize(e)}static deserialize(e){return new r(e.deserializeBytes())}toMoveVector(e){let t=new D(this.bcsToBytes());t.deserializeUleb128AsU32();let n=t.deserializeVector(e);return new S(n)}},x= exports.MoveString =class r extends y{constructor(e){super(),this.value=e}serialize(e){e.serializeStr(this.value)}serializeForEntryFunction(e){let t=this.bcsToBytes();e.serializeBytes(t)}serializeForScriptFunction(e){let n=new TextEncoder().encode(this.value);S.U8(n).serializeForScriptFunction(e)}static deserialize(e){return new r(e.deserializeStr())}},Y= exports.MoveOption =class r extends y{constructor(e){super(),typeof e<"u"&&e!==null?this.vec=new S([e]):this.vec=new S([]),[this.value]=this.vec.values}serializeForEntryFunction(e){let t=this.bcsToBytes();e.serializeBytes(t)}unwrap(){if(this.isSome())return this.vec.values[0];throw new Error("Called unwrap on a MoveOption with no value")}isSome(){return this.vec.values.length===1}serialize(e){this.vec.serialize(e)}static U8(e){return new r(e!=null?new X(e):void 0)}static U16(e){return new r(e!=null?new _e(e):void 0)}static U32(e){return new r(e!=null?new xe(e):void 0)}static U64(e){return new r(e!=null?new Q(e):void 0)}static U128(e){return new r(e!=null?new Ee(e):void 0)}static U256(e){return new r(e!=null?new ye(e):void 0)}static Bool(e){return new r(e!=null?new U(e):void 0)}static MoveString(e){return new r(e!=null?new x(e):void 0)}static deserialize(e,t){let n=S.deserialize(e,t);return new r(n.values[0])}};var _ed25519 = require('@noble/curves/ed25519');var _sha3 = require('@noble/hashes/sha3');var Va=(c=>(c.INCORRECT_NUMBER_OF_BYTES="incorrect_number_of_bytes",c.INVALID_HEX_CHARS="invalid_hex_chars",c.TOO_SHORT="too_short",c.TOO_LONG="too_long",c.LEADING_ZERO_X_REQUIRED="leading_zero_x_required",c.LONG_FORM_REQUIRED_UNLESS_SPECIAL="long_form_required_unless_special",c.INVALID_PADDING_ZEROES="INVALID_PADDING_ZEROES",c.INVALID_PADDING_STRICTNESS="INVALID_PADDING_STRICTNESS",c))(Va||{}),E=class E extends y{constructor(e){if(super(),e.length!==E.LENGTH)throw new J("AccountAddress data should be exactly 32 bytes long","incorrect_number_of_bytes");this.data=e}isSpecial(){return this.data.slice(0,this.data.length-1).every(e=>e===0)&&this.data[this.data.length-1]<16}toString(){return`0x${this.toStringWithoutPrefix()}`}toStringWithoutPrefix(){let e=_utils.bytesToHex.call(void 0, this.data);return this.isSpecial()&&(e=e[e.length-1]),e}toStringLong(){return`0x${this.toStringLongWithoutPrefix()}`}toStringLongWithoutPrefix(){return _utils.bytesToHex.call(void 0, this.data)}toUint8Array(){return this.data}serialize(e){e.serializeFixedBytes(this.data)}serializeForEntryFunction(e){let t=this.bcsToBytes();e.serializeBytes(t)}serializeForScriptFunction(e){e.serializeU32AsUleb128(3),e.serialize(this)}static deserialize(e){let t=e.deserializeFixedBytes(E.LENGTH);return new E(t)}static fromStringStrict(e){if(!e.startsWith("0x"))throw new J("Hex string must start with a leading 0x.","leading_zero_x_required");let t=E.fromString(e);if(e.length!==E.LONG_STRING_LENGTH+2)if(t.isSpecial()){if(e.length!==3)throw new J(`The given hex string ${e} is a special address not in LONG form, it must be 0x0 to 0xf without padding zeroes.`,"INVALID_PADDING_ZEROES")}else throw new J(`The given hex string ${e} is not a special address, it must be represented as 0x + 64 chars.`,"long_form_required_unless_special");return t}static fromString(e,{maxMissingChars:t=4}={}){let n=e;if(e.startsWith("0x")&&(n=e.slice(2)),n.length===0)throw new J("Hex string is too short, must be 1 to 64 chars long, excluding the leading 0x.","too_short");if(n.length>64)throw new J("Hex string is too long, must be 1 to 64 chars long, excluding the leading 0x.","too_long");if(t>63||t<0)throw new J(`maxMissingChars must be between or equal to 0 and 63. Received ${t}`,"INVALID_PADDING_STRICTNESS");let i;try{i=_utils.hexToBytes.call(void 0, n.padStart(64,"0"))}catch(s){throw new J(`Hex characters are invalid: ${_optionalChain([s, 'optionalAccess', _5 => _5.message])}`,"invalid_hex_chars")}let o=new E(i);if(n.length<64-t&&!o.isSpecial())throw new J(`Hex string is too short, must be ${64-t} to 64 chars long, excluding the leading 0x. You may need to fix
|
|
2
|
-
the addresss by padding it with 0s before passing it to \`fromString\` (e.g. <addressString>.padStart(64, '0')).
|
|
3
|
-
Received ${e}`,"too_short");return o}static from(e,{maxMissingChars:t=4}={}){return typeof e=="string"?E.fromString(e,{maxMissingChars:t}):e instanceof Uint8Array?new E(e):e}static fromStrict(e){return typeof e=="string"?E.fromStringStrict(e):e instanceof Uint8Array?new E(e):e}static isValid(e){try{return e.strict?E.fromStrict(e.input):E.from(e.input),{valid:!0}}catch(t){return{valid:!1,invalidReason:_optionalChain([t, 'optionalAccess', _6 => _6.invalidReason]),invalidReasonMessage:_optionalChain([t, 'optionalAccess', _7 => _7.message])}}}equals(e){return this.data.length!==e.data.length?!1:this.data.every((t,n)=>t===e.data[n])}};E.LENGTH=32,E.LONG_STRING_LENGTH=64,E.ZERO=E.from("0x0"),E.ONE=E.from("0x1"),E.TWO=E.from("0x2"),E.THREE=E.from("0x3"),E.FOUR=E.from("0x4"),E.A=E.from("0xA");var u=E;var rt=class rt extends y{constructor(e){super();let{data:t}=e,n=m.fromHexInput(t);if(n.toUint8Array().length!==rt.LENGTH)throw new Error(`Authentication Key length should be ${rt.LENGTH}`);this.data=n}serialize(e){e.serializeFixedBytes(this.data.toUint8Array())}static deserialize(e){let t=e.deserializeFixedBytes(rt.LENGTH);return new rt({data:t})}toUint8Array(){return this.data.toUint8Array()}static fromSchemeAndBytes(e){let{scheme:t,input:n}=e,i=m.fromHexInput(n).toUint8Array(),o=new Uint8Array([...i,t]),s=_sha3.sha3_256.create();s.update(o);let a=s.digest();return new rt({data:a})}static fromPublicKeyAndScheme(e){let{publicKey:t}=e;return t.authKey()}static fromPublicKey(e){let{publicKey:t}=e;return t.authKey()}derivedAddress(){return new u(this.data.toUint8Array())}};rt.LENGTH=32;var L=rt;var _hmac = require('@noble/hashes/hmac');var _sha512 = require('@noble/hashes/sha512');var _bip39 = require('@scure/bip39'); var ji = _interopRequireWildcard(_bip39);var Wa=/^m\/44'\/637'\/[0-9]+'\/[0-9]+'\/[0-9]+'?$/,Qa= exports.APTOS_BIP44_REGEX =/^m\/44'\/637'\/[0-9]+'\/[0-9]+\/[0-9]+$/,ja= exports.KeyType =(e=>(e.ED25519="ed25519 seed",e))(ja||{}),Ji= exports.HARDENED_OFFSET =2147483648;function Xi(r){return Qa.test(r)}function Yi(r){return Wa.test(r)}var qn=(r,e)=>{let t=_hmac.hmac.create(_sha512.sha512,r).update(e).digest();return{key:t.slice(0,32),chainCode:t.slice(32)}},Zi= exports.CKDPriv =({key:r,chainCode:e},t)=>{let n=new ArrayBuffer(4);new DataView(n).setUint32(0,t);let i=new Uint8Array(n),o=new Uint8Array([0]),s=new Uint8Array([...o,...r,...i]);return qn(e,s)},Ja=r=>r.replace(/'/g,""),eo= exports.splitPath =r=>r.split("/").slice(1).map(Ja),jr= exports.mnemonicToSeed =r=>{let e=r.trim().split(/\s+/).map(t=>t.toLowerCase()).join(" ");return ji.mnemonicToSeedSync(e)};var cr=class cr{static formatPrivateKey(e,t){let n=cr.AIP80_PREFIXES[t],i=e;return typeof i=="string"&&i.startsWith(n)&&(i=i.split("-")[2]),`${n}${m.fromHexInput(i).toString()}`}static parseHexInput(e,t,n){let i,o=cr.AIP80_PREFIXES[t];if(typeof e=="string")if(!n&&!e.startsWith(o))i=m.fromHexInput(e),n!==!1&&console.warn("[Aptos SDK] It is recommended that private keys are AIP-80 compliant (https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-80.md). You can fix the private key by formatting it with `PrivateKey.formatPrivateKey(privateKey: string, type: 'ed25519' | 'secp256k1'): string`.");else if(e.startsWith(o))i=m.fromHexString(e.split("-")[2]);else throw n?new Error("Invalid HexString input while parsing private key. Must AIP-80 compliant string."):new Error("Invalid HexString input while parsing private key.");else i=m.fromHexInput(e);return i}};cr.AIP80_PREFIXES={ed25519:"ed25519-priv-",secp256k1:"secp256k1-priv-"};var nt=cr;var ft=class extends y{toUint8Array(){return this.bcsToBytes()}toString(){let e=this.toUint8Array();return m.fromHexInput(e).toString()}},se= exports.AccountPublicKey =class extends ft{};var V=class extends y{toUint8Array(){return this.bcsToBytes()}toString(){let e=this.toUint8Array();return m.fromHexInput(e).toString()}};var zt=r=>typeof r=="string"?m.isValid(r).valid?r:new TextEncoder().encode(r):r;var $n=[237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16];function Xa(r){let e=r.toUint8Array().slice(32);for(let t=$n.length-1;t>=0;t-=1){if(e[t]<$n[t])return!0;if(e[t]>$n[t])return!1}return!1}var it=class it extends se{constructor(e){super();let t=m.fromHexInput(e);if(t.toUint8Array().length!==it.LENGTH)throw new Error(`PublicKey length should be ${it.LENGTH}`);this.key=t}verifySignature(e){let{message:t,signature:n}=e;if(!Xa(n))return!1;let i=zt(t),o=m.fromHexInput(i).toUint8Array(),s=n.toUint8Array(),a=this.key.toUint8Array();return _ed25519.ed25519.verify(s,o,a)}authKey(){return L.fromSchemeAndBytes({scheme:0,input:this.toUint8Array()})}toUint8Array(){return this.key.toUint8Array()}serialize(e){e.serializeBytes(this.key.toUint8Array())}static deserialize(e){let t=e.deserializeBytes();return new it(t)}static isPublicKey(e){return e instanceof it}static isInstance(e){return"key"in e&&_optionalChain([e, 'access', _8 => _8.key, 'optionalAccess', _9 => _9.data, 'optionalAccess', _10 => _10.length])===it.LENGTH}};it.LENGTH=32;var P=it,me=class me extends y{constructor(e,t){super();let n=nt.parseHexInput(e,"ed25519",t);if(n.toUint8Array().length!==me.LENGTH)throw new Error(`PrivateKey length should be ${me.LENGTH}`);this.signingKey=n}static generate(){let e=_ed25519.ed25519.utils.randomPrivateKey();return new me(e,!1)}static fromDerivationPath(e,t){if(!Yi(e))throw new Error(`Invalid derivation path ${e}`);return me.fromDerivationPathInner(e,jr(t))}static fromDerivationPathInner(e,t,n=Ji){let{key:i,chainCode:o}=qn(me.SLIP_0010_SEED,t),s=eo(e).map(c=>parseInt(c,10)),{key:a}=s.reduce((c,p)=>Zi(c,p+n),{key:i,chainCode:o});return new me(a,!1)}publicKey(){let e=_ed25519.ed25519.getPublicKey(this.signingKey.toUint8Array());return new P(e)}sign(e){let t=zt(e),n=m.fromHexInput(t).toUint8Array(),i=_ed25519.ed25519.sign(n,this.signingKey.toUint8Array());return new I(i)}toUint8Array(){return this.signingKey.toUint8Array()}toString(){return this.toHexString()}toHexString(){return this.signingKey.toString()}toAIP80String(){return nt.formatPrivateKey(this.signingKey.toString(),"ed25519")}serialize(e){e.serializeBytes(this.toUint8Array())}static deserialize(e){let t=e.deserializeBytes();return new me(t,!1)}static isPrivateKey(e){return e instanceof me}};me.LENGTH=32,me.SLIP_0010_SEED="ed25519 seed";var H=me,Dt=class Dt extends V{constructor(e){super();let t=m.fromHexInput(e);if(t.toUint8Array().length!==Dt.LENGTH)throw new Error(`Signature length should be ${Dt.LENGTH}`);this.data=t}toUint8Array(){return this.data.toUint8Array()}serialize(e){e.serializeBytes(this.data.toUint8Array())}static deserialize(e){let t=e.deserializeBytes();return new Dt(t)}};Dt.LENGTH=64;var I=Dt;var fe=class fe extends se{constructor(e){super();let{publicKeys:t,threshold:n}=e;if(t.length>fe.MAX_KEYS||t.length<fe.MIN_KEYS)throw new Error(`Must have between ${fe.MIN_KEYS} and ${fe.MAX_KEYS} public keys, inclusive`);if(n<fe.MIN_THRESHOLD||n>t.length)throw new Error(`Threshold must be between ${fe.MIN_THRESHOLD} and ${t.length}, inclusive`);this.publicKeys=t,this.threshold=n}verifySignature(e){let{message:t,signature:n}=e;if(!(n instanceof At))return!1;let i=[];for(let o=0;o<4;o+=1)for(let s=0;s<8;s+=1)if((n.bitmap[o]&1<<7-s)!==0){let c=o*8+s;i.push(c)}if(i.length!==n.signatures.length)throw new Error("Bitmap and signatures length mismatch");if(i.length<this.threshold)throw new Error("Not enough signatures");for(let o=0;o<i.length;o+=1)if(!this.publicKeys[i[o]].verifySignature({message:t,signature:n.signatures[o]}))return!1;return!0}authKey(){return L.fromSchemeAndBytes({scheme:1,input:this.toUint8Array()})}toUint8Array(){let e=new Uint8Array(this.publicKeys.length*P.LENGTH+1);return this.publicKeys.forEach((t,n)=>{e.set(t.toUint8Array(),n*P.LENGTH)}),e[this.publicKeys.length*P.LENGTH]=this.threshold,e}serialize(e){e.serializeBytes(this.toUint8Array())}static deserialize(e){let t=e.deserializeBytes(),n=t[t.length-1],i=[];for(let o=0;o<t.length-1;o+=P.LENGTH){let s=o;i.push(new P(t.subarray(s,s+P.LENGTH)))}return new fe({publicKeys:i,threshold:n})}};fe.MAX_KEYS=32,fe.MIN_KEYS=2,fe.MIN_THRESHOLD=1;var Ot=fe,ce=class ce extends V{constructor(e){super();let{signatures:t,bitmap:n}=e;if(t.length>ce.MAX_SIGNATURES_SUPPORTED)throw new Error(`The number of signatures cannot be greater than ${ce.MAX_SIGNATURES_SUPPORTED}`);if(this.signatures=t,!(n instanceof Uint8Array))this.bitmap=ce.createBitmap({bits:n});else{if(n.length!==ce.BITMAP_LEN)throw new Error(`"bitmap" length should be ${ce.BITMAP_LEN}`);this.bitmap=n}}toUint8Array(){let e=new Uint8Array(this.signatures.length*I.LENGTH+ce.BITMAP_LEN);return this.signatures.forEach((t,n)=>{e.set(t.toUint8Array(),n*I.LENGTH)}),e.set(this.bitmap,this.signatures.length*I.LENGTH),e}serialize(e){e.serializeBytes(this.toUint8Array())}static deserialize(e){let t=e.deserializeBytes(),n=t.subarray(t.length-4),i=[];for(let o=0;o<t.length-n.length;o+=I.LENGTH){let s=o;i.push(new I(t.subarray(s,s+I.LENGTH)))}return new ce({signatures:i,bitmap:n})}static createBitmap(e){let{bits:t}=e,n=128,i=new Uint8Array([0,0,0,0]),o=new Set;return t.forEach((s,a)=>{if(s>=ce.MAX_SIGNATURES_SUPPORTED)throw new Error(`Cannot have a signature larger than ${ce.MAX_SIGNATURES_SUPPORTED-1}.`);if(o.has(s))throw new Error("Duplicate bits detected.");if(a>0&&s<=t[a-1])throw new Error("The bits need to be sorted in ascending order.");o.add(s);let c=Math.floor(s/8),p=i[c];p|=n>>s%8,i[c]=p}),i}};ce.MAX_SIGNATURES_SUPPORTED=32,ce.BITMAP_LEN=4;var At=ce;var _secp256k1 = require('@noble/curves/secp256k1');var _bip32 = require('@scure/bip32');var Pe=class Pe extends ft{constructor(e){super();let t=m.fromHexInput(e),{length:n}=t.toUint8Array();if(n===Pe.LENGTH)this.key=t;else if(n===Pe.COMPRESSED_LENGTH){let i=_secp256k1.secp256k1.ProjectivePoint.fromHex(t.toUint8Array());this.key=m.fromHexInput(i.toRawBytes(!1))}else throw new Error(`PublicKey length should be ${Pe.LENGTH} or ${Pe.COMPRESSED_LENGTH}, received ${n}`)}verifySignature(e){let{message:t,signature:n}=e,i=zt(t),o=m.fromHexInput(i).toUint8Array(),s=_sha3.sha3_256.call(void 0, o),a=n.toUint8Array();return _secp256k1.secp256k1.verify(a,s,this.key.toUint8Array(),{lowS:!0})}toUint8Array(){return this.key.toUint8Array()}serialize(e){e.serializeBytes(this.key.toUint8Array())}deserialize(e){let t=e.deserializeBytes();return new ht(t)}static deserialize(e){let t=e.deserializeBytes();return new Pe(t)}static isPublicKey(e){return e instanceof Pe}static isInstance(e){return"key"in e&&_optionalChain([e, 'access', _11 => _11.key, 'optionalAccess', _12 => _12.data, 'optionalAccess', _13 => _13.length])===Pe.LENGTH}};Pe.LENGTH=65,Pe.COMPRESSED_LENGTH=33;var Fe=Pe,Ce=class Ce extends y{constructor(e,t){super();let n=nt.parseHexInput(e,"secp256k1",t);if(n.toUint8Array().length!==Ce.LENGTH)throw new Error(`PrivateKey length should be ${Ce.LENGTH}`);this.key=n}static generate(){let e=_secp256k1.secp256k1.utils.randomPrivateKey();return new Ce(e,!1)}static fromDerivationPath(e,t){if(!Xi(e))throw new Error(`Invalid derivation path ${e}`);return Ce.fromDerivationPathInner(e,jr(t))}static fromDerivationPathInner(e,t){let{privateKey:n}=_bip32.HDKey.fromMasterSeed(t).derive(e);if(n===null)throw new Error("Invalid key");return new Ce(n,!1)}sign(e){let t=zt(e),n=m.fromHexInput(t),i=_sha3.sha3_256.call(void 0, n.toUint8Array()),o=_secp256k1.secp256k1.sign(i,this.key.toUint8Array(),{lowS:!0});return new ht(o.toCompactRawBytes())}publicKey(){let e=_secp256k1.secp256k1.getPublicKey(this.key.toUint8Array(),!1);return new Fe(e)}toUint8Array(){return this.key.toUint8Array()}toString(){return this.toHexString()}toHexString(){return this.key.toString()}toAIP80String(){return nt.formatPrivateKey(this.key.toString(),"secp256k1")}serialize(e){e.serializeBytes(this.toUint8Array())}static deserialize(e){let t=e.deserializeBytes();return new Ce(t,!1)}static isPrivateKey(e){return e instanceof Ce}};Ce.LENGTH=32;var Ge=Ce,Nt=class Nt extends V{constructor(e){super();let t=m.fromHexInput(e);if(t.toUint8Array().length!==Nt.LENGTH)throw new Error(`Signature length should be ${Nt.LENGTH}, received ${t.toUint8Array().length}`);this.data=t}toUint8Array(){return this.data.toUint8Array()}serialize(e){e.serializeBytes(this.data.toUint8Array())}static deserialize(e){let t=e.deserializeBytes();return new Nt(t)}};Nt.LENGTH=64;var ht=Nt;var _jwtdecode = require('jwt-decode');var Tt=class r extends ft{constructor(e){super();let t=e.constructor.name;switch(t){case P.name:this.publicKey=e,this.variant=0;break;default:throw new Error(`Unsupported key for EphemeralPublicKey - ${t}`)}}verifySignature(e){let{message:t,signature:n}=e;return this.publicKey.verifySignature({message:t,signature:n.signature})}serialize(e){if(this.publicKey instanceof P)e.serializeU32AsUleb128(0),this.publicKey.serialize(e);else throw new Error("Unknown public key type")}static deserialize(e){let t=e.deserializeUleb128AsU32();switch(t){case 0:return new r(P.deserialize(e));default:throw new Error(`Unknown variant index for EphemeralPublicKey: ${t}`)}}static isPublicKey(e){return e instanceof r}},Re= exports.EphemeralSignature =class r extends V{constructor(e){super();let t=e.constructor.name;switch(t){case I.name:this.signature=e;break;default:throw new Error(`Unsupported signature for EphemeralSignature - ${t}`)}}static fromHex(e){let t=m.fromHexInput(e),n=new D(t.toUint8Array());return r.deserialize(n)}serialize(e){if(this.signature instanceof I)e.serializeU32AsUleb128(0),this.signature.serialize(e);else throw new Error("Unknown signature type")}static deserialize(e){let t=e.deserializeUleb128AsU32();switch(t){case 0:return new r(I.deserialize(e));default:throw new Error(`Unknown variant index for EphemeralSignature: ${t}`)}}};var _poseidonlite = require('poseidon-lite');var Wn=[_poseidonlite.poseidon1,_poseidonlite.poseidon2,_poseidonlite.poseidon3,_poseidonlite.poseidon4,_poseidonlite.poseidon5,_poseidonlite.poseidon6,_poseidonlite.poseidon7,_poseidonlite.poseidon8,_poseidonlite.poseidon9,_poseidonlite.poseidon10,_poseidonlite.poseidon11,_poseidonlite.poseidon12,_poseidonlite.poseidon13,_poseidonlite.poseidon14,_poseidonlite.poseidon15,_poseidonlite.poseidon16],no=31,mc=16,ro=(mc-1)*no;function Xr(r,e){let n=new TextEncoder().encode(r);return fc(n,e)}function fc(r,e){if(r.length>e)throw new Error(`Inputted bytes of length ${r} is longer than ${e}`);let t=Qn(r,e);return dr(t)}function Ac(r,e){if(r.length>e)throw new Error(`Input bytes of length ${r} is longer than ${e}`);let t=bc(r,e);return hc(t)}function Qn(r,e){if(r.length>e)throw new Error(`Input bytes of length ${r} is longer than ${e}`);return Ac(r,e).concat([BigInt(r.length)])}function hc(r){if(r.length>ro)throw new Error(`Can't pack more than ${ro}. Was given ${r.length} bytes`);return Tc(r,no).map(e=>pr(e))}function Tc(r,e){let t=[];for(let n=0;n<r.length;n+=e)t.push(r.subarray(n,n+e));return t}function pr(r){let e=BigInt(0);for(let t=r.length-1;t>=0;t-=1)e=e<<BigInt(8)|BigInt(r[t]);return e}function io(r,e){let t=BigInt(r),n=new Uint8Array(e);for(let i=0;i<e;i+=1)n[i]=Number(t&BigInt(255)),t>>=BigInt(8);return n}function bc(r,e){if(e<r.length)throw new Error("Padded size must be greater than or equal to the input array size.");let t=new Uint8Array(e);t.set(r);for(let n=r.length;n<e;n+=1)t[n]=0;return t}function dr(r){if(r.length>Wn.length)throw new Error(`Unable to hash input of length ${r.length}. Max input length is ${Wn.length}`);return Wn[r.length-1](r)}var Yr=class extends y{};var oo="1.33.2";var so={mainnet:"https://api.mainnet.aptoslabs.com/v1/graphql",testnet:"https://api.testnet.aptoslabs.com/v1/graphql",devnet:"https://api.devnet.aptoslabs.com/v1/graphql",local:"http://127.0.0.1:8090/v1/graphql"},ao= exports.NetworkToNodeAPI ={mainnet:"https://api.mainnet.aptoslabs.com/v1",testnet:"https://api.testnet.aptoslabs.com/v1",devnet:"https://api.devnet.aptoslabs.com/v1",local:"http://127.0.0.1:8080/v1"},co= exports.NetworkToFaucetAPI ={devnet:"https://faucet.devnet.aptoslabs.com",local:"http://127.0.0.1:8081"},jn= exports.NetworkToPepperAPI ={mainnet:"https://api.mainnet.aptoslabs.com/keyless/pepper/v0",testnet:"https://api.testnet.aptoslabs.com/keyless/pepper/v0",devnet:"https://api.devnet.aptoslabs.com/keyless/pepper/v0",local:"https://api.devnet.aptoslabs.com/keyless/pepper/v0"},Jn= exports.NetworkToProverAPI ={mainnet:"https://api.mainnet.aptoslabs.com/keyless/prover/v0",testnet:"https://api.testnet.aptoslabs.com/keyless/prover/v0",devnet:"https://api.devnet.aptoslabs.com/keyless/prover/v0",local:"https://api.devnet.aptoslabs.com/keyless/prover/v0"},Xn= exports.Network =(o=>(o.MAINNET="mainnet",o.TESTNET="testnet",o.DEVNET="devnet",o.LOCAL="local",o.CUSTOM="custom",o))(Xn||{}),Yn= exports.NetworkToChainId ={mainnet:1,testnet:2,local:4},wl= exports.NetworkToNetworkName ={mainnet:"mainnet",testnet:"testnet",devnet:"devnet",local:"local",custom:"custom"};var Ft=(o=>(o.FULLNODE="Fullnode",o.INDEXER="Indexer",o.FAUCET="Faucet",o.PEPPER="Pepper",o.PROVER="Prover",o))(Ft||{}),uo= exports.DEFAULT_MAX_GAS_AMOUNT =2e5,po= exports.DEFAULT_TXN_EXP_SEC_FROM_NOW =20,Zr= exports.DEFAULT_TXN_TIMEOUT_SEC =20,bt= exports.APTOS_COIN ="0x1::aptos_coin::AptosCoin",lo= exports.APTOS_FA ="0x000000000000000000000000000000000000000000000000000000000000000a",go= exports.RAW_TRANSACTION_SALT ="APTOS::RawTransaction",Zn= exports.RAW_TRANSACTION_WITH_DATA_SALT ="APTOS::RawTransactionWithData",Be= exports.ProcessorType =(c=>(c.ACCOUNT_TRANSACTION_PROCESSOR="account_transactions_processor",c.DEFAULT="default_processor",c.EVENTS_PROCESSOR="events_processor",c.FUNGIBLE_ASSET_PROCESSOR="fungible_asset_processor",c.STAKE_PROCESSOR="stake_processor",c.TOKEN_V2_PROCESSOR="token_v2_processor",c.USER_TRANSACTION_PROCESSOR="user_transaction_processor",c.OBJECT_PROCESSOR="objects_processor",c))(Be||{}),yo= exports.FIREBASE_AUTH_ISS_PATTERN =/^https:\/\/securetoken\.google\.com\/[a-zA-Z0-9-_]+$/;function mo(r,e){let t=e.bcsToBytes(),n=new D(t);return r.deserialize(n)}var wc=(o=>(o[o.API_ERROR=0]="API_ERROR",o[o.EXTERNAL_API_ERROR=1]="EXTERNAL_API_ERROR",o[o.SESSION_EXPIRED=2]="SESSION_EXPIRED",o[o.INVALID_STATE=3]="INVALID_STATE",o[o.UNKNOWN=4]="UNKNOWN",o))(wc||{}),Sc= exports.KeylessErrorResolutionTip =(p=>(p.REAUTHENTICATE="Re-authentiate to continue using your keyless account",p.REAUTHENTICATE_UNSURE="Try re-authentiating. If the error persists join the telegram group at https://t.me/+h5CN-W35yUFiYzkx for further support",p.UPDATE_REQUEST_PARAMS="Update the invalid request parameters and reauthenticate.",p.RATE_LIMIT_EXCEEDED="Cache the keyless account and reuse it to avoid making too many requests. Keyless accounts are valid until either the EphemeralKeyPair expires, when the JWK is rotated, or when the proof verifying key is changed, whichever comes soonest.",p.SERVER_ERROR="Try again later. See aptosApiError error for more context. For additional support join the telegram group at https://t.me/+h5CN-W35yUFiYzkx",p.CALL_PRECHECK="Call `await account.checkKeylessAccountValidity()` to wait for asyncronous changes and check for account validity before signing or serializing.",p.REINSTANTIATE="Try instantiating the account again. Avoid manipulating the account object directly",p.JOIN_SUPPORT_GROUP="For support join the telegram group at https://t.me/+h5CN-W35yUFiYzkx",p.UNKNOWN="Error unknown. For support join the telegram group at https://t.me/+h5CN-W35yUFiYzkx",p))(Sc||{}),en= exports.KeylessErrorType =(f=>(f[f.EPHEMERAL_KEY_PAIR_EXPIRED=0]="EPHEMERAL_KEY_PAIR_EXPIRED",f[f.PROOF_NOT_FOUND=1]="PROOF_NOT_FOUND",f[f.ASYNC_PROOF_FETCH_FAILED=2]="ASYNC_PROOF_FETCH_FAILED",f[f.INVALID_PROOF_VERIFICATION_FAILED=3]="INVALID_PROOF_VERIFICATION_FAILED",f[f.INVALID_PROOF_VERIFICATION_KEY_NOT_FOUND=4]="INVALID_PROOF_VERIFICATION_KEY_NOT_FOUND",f[f.INVALID_JWT_SIG=5]="INVALID_JWT_SIG",f[f.INVALID_JWT_JWK_NOT_FOUND=6]="INVALID_JWT_JWK_NOT_FOUND",f[f.INVALID_JWT_ISS_NOT_RECOGNIZED=7]="INVALID_JWT_ISS_NOT_RECOGNIZED",f[f.INVALID_JWT_FEDERATED_ISS_NOT_SUPPORTED=8]="INVALID_JWT_FEDERATED_ISS_NOT_SUPPORTED",f[f.INVALID_TW_SIG_VERIFICATION_FAILED=9]="INVALID_TW_SIG_VERIFICATION_FAILED",f[f.INVALID_TW_SIG_PUBLIC_KEY_NOT_FOUND=10]="INVALID_TW_SIG_PUBLIC_KEY_NOT_FOUND",f[f.INVALID_EXPIRY_HORIZON=11]="INVALID_EXPIRY_HORIZON",f[f.JWT_PARSING_ERROR=12]="JWT_PARSING_ERROR",f[f.JWK_FETCH_FAILED=13]="JWK_FETCH_FAILED",f[f.JWK_FETCH_FAILED_FEDERATED=14]="JWK_FETCH_FAILED_FEDERATED",f[f.RATE_LIMIT_EXCEEDED=15]="RATE_LIMIT_EXCEEDED",f[f.PEPPER_SERVICE_INTERNAL_ERROR=16]="PEPPER_SERVICE_INTERNAL_ERROR",f[f.PEPPER_SERVICE_BAD_REQUEST=17]="PEPPER_SERVICE_BAD_REQUEST",f[f.PEPPER_SERVICE_OTHER=18]="PEPPER_SERVICE_OTHER",f[f.PROVER_SERVICE_INTERNAL_ERROR=19]="PROVER_SERVICE_INTERNAL_ERROR",f[f.PROVER_SERVICE_BAD_REQUEST=20]="PROVER_SERVICE_BAD_REQUEST",f[f.PROVER_SERVICE_OTHER=21]="PROVER_SERVICE_OTHER",f[f.FULL_NODE_CONFIG_LOOKUP_ERROR=22]="FULL_NODE_CONFIG_LOOKUP_ERROR",f[f.FULL_NODE_VERIFICATION_KEY_LOOKUP_ERROR=23]="FULL_NODE_VERIFICATION_KEY_LOOKUP_ERROR",f[f.FULL_NODE_JWKS_LOOKUP_ERROR=24]="FULL_NODE_JWKS_LOOKUP_ERROR",f[f.FULL_NODE_OTHER=25]="FULL_NODE_OTHER",f[f.UNKNOWN=26]="UNKNOWN",f))(en||{}),fo={0:["The ephemeral keypair has expired.",2,"Re-authentiate to continue using your keyless account"],1:["The required proof could not be found.",3,"Call `await account.checkKeylessAccountValidity()` to wait for asyncronous changes and check for account validity before signing or serializing."],2:["The required proof failed to fetch.",3,"Try re-authentiating. If the error persists join the telegram group at https://t.me/+h5CN-W35yUFiYzkx for further support"],3:["The provided proof is invalid.",3,"Try re-authentiating. If the error persists join the telegram group at https://t.me/+h5CN-W35yUFiYzkx for further support"],4:["The verification key used to authenticate was updated.",2,"Re-authentiate to continue using your keyless account"],5:["The JWK was found, but JWT failed verification",3,"Try re-authentiating. If the error persists join the telegram group at https://t.me/+h5CN-W35yUFiYzkx for further support"],6:["The JWK required to verify the JWT could not be found. The JWK may have been rotated out.",2,"Re-authentiate to continue using your keyless account"],7:["The JWT issuer is not recognized.",3,"Update the invalid request parameters and reauthenticate."],8:["The JWT issuer is not supported by the Federated Keyless ",0,"Try re-authentiating. If the error persists join the telegram group at https://t.me/+h5CN-W35yUFiYzkx for further support"],9:["The training wheels signature is invalid.",3,"Try re-authentiating. If the error persists join the telegram group at https://t.me/+h5CN-W35yUFiYzkx for further support"],10:["The public key used to verify the training wheels signature was not found.",2,"Re-authentiate to continue using your keyless account"],11:["The expiry horizon is invalid.",2,"Re-authentiate to continue using your keyless account"],13:["Failed to fetch JWKS.",1,"For support join the telegram group at https://t.me/+h5CN-W35yUFiYzkx"],14:["Failed to fetch JWKS for Federated Keyless provider.",1,"For support join the telegram group at https://t.me/+h5CN-W35yUFiYzkx"],15:["Rate limit exceeded. Too many requests in a short period.",0,"Cache the keyless account and reuse it to avoid making too many requests. Keyless accounts are valid until either the EphemeralKeyPair expires, when the JWK is rotated, or when the proof verifying key is changed, whichever comes soonest."],16:["Internal error from Pepper service.",0,"Try again later. See aptosApiError error for more context. For additional support join the telegram group at https://t.me/+h5CN-W35yUFiYzkx"],17:["Bad request sent to Pepper service.",0,"Update the invalid request parameters and reauthenticate."],18:["Unknown error from Pepper service.",0,"Try again later. See aptosApiError error for more context. For additional support join the telegram group at https://t.me/+h5CN-W35yUFiYzkx"],19:["Internal error from Prover service.",0,"Try again later. See aptosApiError error for more context. For additional support join the telegram group at https://t.me/+h5CN-W35yUFiYzkx"],20:["Bad request sent to Prover service.",0,"Update the invalid request parameters and reauthenticate."],21:["Unknown error from Prover service.",0,"Try again later. See aptosApiError error for more context. For additional support join the telegram group at https://t.me/+h5CN-W35yUFiYzkx"],12:["Error when parsing JWT. This should never happen. Join https://t.me/+h5CN-W35yUFiYzkx for support",3,"Try instantiating the account again. Avoid manipulating the account object directly"],22:["Error when looking up on-chain keyless configuration.",0,"Try again later. See aptosApiError error for more context. For additional support join the telegram group at https://t.me/+h5CN-W35yUFiYzkx"],23:["Error when looking up on-chain verification key.",0,"Try again later. See aptosApiError error for more context. For additional support join the telegram group at https://t.me/+h5CN-W35yUFiYzkx"],24:["Error when looking up on-chain JWKS.",0,"Try again later. See aptosApiError error for more context. For additional support join the telegram group at https://t.me/+h5CN-W35yUFiYzkx"],25:["Unknown error from full node.",0,"Try again later. See aptosApiError error for more context. For additional support join the telegram group at https://t.me/+h5CN-W35yUFiYzkx"],26:["An unknown error has occurred.",4,"Error unknown. For support join the telegram group at https://t.me/+h5CN-W35yUFiYzkx"]},k= exports.KeylessError =class r extends Error{constructor(e){let{innerError:t,category:n,resolutionTip:i,type:o,message:s=fo[o][0],details:a}=e;super(s),this.name="KeylessError",this.innerError=t,this.category=n,this.resolutionTip=i,this.type=o,this.details=a,this.message=r.constructMessage(s,i,t,a)}static constructMessage(e,t,n,i){let o=`
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } function _optionalChainDelete(ops) { const result = _optionalChain(ops); return result == null ? true : result; }var _chunkRX5UBAMEjs = require('./chunk-RX5UBAME.js');var C=class n{constructor(e){this.buffer=new ArrayBuffer(e.length),new Uint8Array(this.buffer).set(e,0),this.offset=0}static fromHex(e){let t=_chunkRX5UBAMEjs.j.hexInputToUint8Array(e);return new n(t)}read(e){if(this.offset+e>this.buffer.byteLength)throw new Error("Reached to the end of buffer");let t=this.buffer.slice(this.offset,this.offset+e);return this.offset+=e,t}remaining(){return this.buffer.byteLength-this.offset}deserializeStr(){let e=this.deserializeBytes();return new TextDecoder().decode(e)}deserializeOptionStr(){return this.deserializeOption("string")}deserializeOption(e,t){if(this.deserializeBool()){if(e==="string")return this.deserializeStr();if(e==="bytes")return this.deserializeBytes();if(e==="fixedBytes"){if(t===void 0)throw new Error("Fixed bytes length not provided");return this.deserializeFixedBytes(t)}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(),t=this.deserializeU32();return BigInt(BigInt(t)<<BigInt(32)|BigInt(e))}deserializeU128(){let e=this.deserializeU64(),t=this.deserializeU64();return BigInt(t<<BigInt(64)|e)}deserializeU256(){let e=this.deserializeU128(),t=this.deserializeU128();return BigInt(t<<BigInt(128)|e)}deserializeUleb128AsU32(){let e=BigInt(0),t=0;for(;e<_chunkRX5UBAMEjs.d;){let r=this.deserializeU8();if(e|=BigInt(r&127)<<BigInt(t),!(r&128))break;t+=7}if(e>_chunkRX5UBAMEjs.d)throw new Error("Overflow while parsing uleb128-encoded uint32 value");return Number(e)}deserialize(e){return e.deserialize(this)}deserializeVector(e){let t=this.deserializeUleb128AsU32(),r=new Array;for(let i=0;i<t;i+=1)r.push(this.deserialize(e));return r}};var gt=class n extends _chunkRX5UBAMEjs.l{constructor(e){super(),this.value=_chunkRX5UBAMEjs.j.fromHexInput(e).toUint8Array()}serialize(e){e.serializeFixedBytes(this.value)}serializeForEntryFunction(e){e.serialize(this)}serializeForScriptFunction(e){e.serialize(this)}static deserialize(e,t){let r=e.deserializeFixedBytes(t);return new n(r)}};var Jn=class n extends _chunkRX5UBAMEjs.l{constructor(e){super(),this.value=new gt(e)}serialize(e){e.serialize(this.value)}serializeForEntryFunction(e){e.serializeU32AsUleb128(this.value.value.length),e.serialize(this)}static deserialize(e,t){let r=gt.deserialize(e,t);return new n(r.value)}};var U=class n extends _chunkRX5UBAMEjs.l{constructor(e){super(),_chunkRX5UBAMEjs.n.call(void 0, e),this.value=e}serialize(e){e.serializeBool(this.value)}serializeForEntryFunction(e){let t=this.bcsToBytes();e.serializeBytes(t)}serializeForScriptFunction(e){e.serializeU32AsUleb128(5),e.serialize(this)}deserialize(e){return new me(e.deserializeU256())}static deserialize(e){return new n(e.deserializeBool())}},X= exports.U8 =class n extends _chunkRX5UBAMEjs.l{constructor(e){super(),_chunkRX5UBAMEjs.p.call(void 0, e,0,_chunkRX5UBAMEjs.b),this.value=e}serialize(e){e.serializeU8(this.value)}serializeForEntryFunction(e){let t=this.bcsToBytes();e.serializeBytes(t)}serializeForScriptFunction(e){e.serializeU32AsUleb128(0),e.serialize(this)}static deserialize(e){return new n(e.deserializeU8())}},we= exports.U16 =class n extends _chunkRX5UBAMEjs.l{constructor(e){super(),_chunkRX5UBAMEjs.p.call(void 0, e,0,_chunkRX5UBAMEjs.c),this.value=e}serialize(e){e.serializeU16(this.value)}serializeForEntryFunction(e){let t=this.bcsToBytes();e.serializeBytes(t)}serializeForScriptFunction(e){e.serializeU32AsUleb128(6),e.serialize(this)}static deserialize(e){return new n(e.deserializeU16())}},Se= exports.U32 =class n extends _chunkRX5UBAMEjs.l{constructor(e){super(),_chunkRX5UBAMEjs.p.call(void 0, e,0,_chunkRX5UBAMEjs.d),this.value=e}serialize(e){e.serializeU32(this.value)}serializeForEntryFunction(e){let t=this.bcsToBytes();e.serializeBytes(t)}serializeForScriptFunction(e){e.serializeU32AsUleb128(7),e.serialize(this)}static deserialize(e){return new n(e.deserializeU32())}},W= exports.U64 =class n extends _chunkRX5UBAMEjs.l{constructor(e){super(),_chunkRX5UBAMEjs.p.call(void 0, e,BigInt(0),_chunkRX5UBAMEjs.e),this.value=BigInt(e)}serialize(e){e.serializeU64(this.value)}serializeForEntryFunction(e){let t=this.bcsToBytes();e.serializeBytes(t)}serializeForScriptFunction(e){e.serializeU32AsUleb128(1),e.serialize(this)}static deserialize(e){return new n(e.deserializeU64())}},_e= exports.U128 =class n extends _chunkRX5UBAMEjs.l{constructor(e){super(),_chunkRX5UBAMEjs.p.call(void 0, e,BigInt(0),_chunkRX5UBAMEjs.f),this.value=BigInt(e)}serialize(e){e.serializeU128(this.value)}serializeForEntryFunction(e){let t=this.bcsToBytes();e.serializeBytes(t)}serializeForScriptFunction(e){e.serializeU32AsUleb128(2),e.serialize(this)}static deserialize(e){return new n(e.deserializeU128())}},me= exports.U256 =class n extends _chunkRX5UBAMEjs.l{constructor(e){super(),_chunkRX5UBAMEjs.p.call(void 0, e,BigInt(0),_chunkRX5UBAMEjs.g),this.value=BigInt(e)}serialize(e){e.serializeU256(this.value)}serializeForEntryFunction(e){let t=this.bcsToBytes();e.serializeBytes(t)}serializeForScriptFunction(e){e.serializeU32AsUleb128(8),e.serialize(this)}static deserialize(e){return new n(e.deserializeU256())}};var _=class n extends _chunkRX5UBAMEjs.l{constructor(e){super(),this.values=e}serializeForEntryFunction(e){let t=this.bcsToBytes();e.serializeBytes(t)}serializeForScriptFunction(e){if(this.values[0]!==void 0&&!(this.values[0]instanceof X)){new cn(this.bcsToBytes()).serializeForScriptFunction(e);return}e.serializeU32AsUleb128(4),e.serialize(this)}static U8(e){let t;if(Array.isArray(e)&&e.length===0)t=[];else if(Array.isArray(e)&&typeof e[0]=="number")t=e;else if(typeof e=="string"){let r=_chunkRX5UBAMEjs.j.fromHexInput(e);t=Array.from(r.toUint8Array())}else if(e instanceof Uint8Array)t=Array.from(e);else throw new Error("Invalid input type, must be an number[], Uint8Array, or hex string");return new n(t.map(r=>new X(r)))}static U16(e){return new n(e.map(t=>new we(t)))}static U32(e){return new n(e.map(t=>new Se(t)))}static U64(e){return new n(e.map(t=>new W(t)))}static U128(e){return new n(e.map(t=>new _e(t)))}static U256(e){return new n(e.map(t=>new me(t)))}static Bool(e){return new n(e.map(t=>new U(t)))}static MoveString(e){return new n(e.map(t=>new P(t)))}serialize(e){e.serializeVector(this.values)}static deserialize(e,t){let r=e.deserializeUleb128AsU32(),i=new Array;for(let o=0;o<r;o+=1)i.push(t.deserialize(e));return new n(i)}},cn= exports.Serialized =class n extends _chunkRX5UBAMEjs.l{constructor(e){super(),this.value=_chunkRX5UBAMEjs.j.fromHexInput(e).toUint8Array()}serialize(e){e.serializeBytes(this.value)}serializeForEntryFunction(e){this.serialize(e)}serializeForScriptFunction(e){e.serializeU32AsUleb128(9),this.serialize(e)}static deserialize(e){return new n(e.deserializeBytes())}toMoveVector(e){let t=new C(this.bcsToBytes());t.deserializeUleb128AsU32();let r=t.deserializeVector(e);return new _(r)}},P= exports.MoveString =class n extends _chunkRX5UBAMEjs.l{constructor(e){super(),this.value=e}serialize(e){e.serializeStr(this.value)}serializeForEntryFunction(e){let t=this.bcsToBytes();e.serializeBytes(t)}serializeForScriptFunction(e){let r=new TextEncoder().encode(this.value);_.U8(r).serializeForScriptFunction(e)}static deserialize(e){return new n(e.deserializeStr())}},Y= exports.MoveOption =class n extends _chunkRX5UBAMEjs.l{constructor(e){super(),typeof e<"u"&&e!==null?this.vec=new _([e]):this.vec=new _([]),[this.value]=this.vec.values}serializeForEntryFunction(e){let t=this.bcsToBytes();e.serializeBytes(t)}unwrap(){if(this.isSome())return this.vec.values[0];throw new Error("Called unwrap on a MoveOption with no value")}isSome(){return this.vec.values.length===1}serialize(e){this.vec.serialize(e)}static U8(e){return new n(e!=null?new X(e):void 0)}static U16(e){return new n(e!=null?new we(e):void 0)}static U32(e){return new n(e!=null?new Se(e):void 0)}static U64(e){return new n(e!=null?new W(e):void 0)}static U128(e){return new n(e!=null?new _e(e):void 0)}static U256(e){return new n(e!=null?new me(e):void 0)}static Bool(e){return new n(e!=null?new U(e):void 0)}static MoveString(e){return new n(e!=null?new P(e):void 0)}static deserialize(e,t){let r=_.deserialize(e,t);return new n(r.values[0])}};var _ed25519 = require('@noble/curves/ed25519');var _sha3 = require('@noble/hashes/sha3');var rt=class rt extends _chunkRX5UBAMEjs.l{constructor(e){super();let{data:t}=e,r=_chunkRX5UBAMEjs.j.fromHexInput(t);if(r.toUint8Array().length!==rt.LENGTH)throw new Error(`Authentication Key length should be ${rt.LENGTH}`);this.data=r}serialize(e){e.serializeFixedBytes(this.data.toUint8Array())}static deserialize(e){let t=e.deserializeFixedBytes(rt.LENGTH);return new rt({data:t})}toUint8Array(){return this.data.toUint8Array()}static fromSchemeAndBytes(e){let{scheme:t,input:r}=e,i=_chunkRX5UBAMEjs.j.fromHexInput(r).toUint8Array(),o=new Uint8Array([...i,t]),s=_sha3.sha3_256.create();s.update(o);let a=s.digest();return new rt({data:a})}static fromPublicKeyAndScheme(e){let{publicKey:t}=e;return t.authKey()}static fromPublicKey(e){let{publicKey:t}=e;return t.authKey()}derivedAddress(){return new (0, _chunkRX5UBAMEjs.Z)(this.data.toUint8Array())}};rt.LENGTH=32;var B=rt;var _hmac = require('@noble/hashes/hmac');var _sha512 = require('@noble/hashes/sha512');var _bip39 = require('@scure/bip39'); var Xi = _interopRequireWildcard(_bip39);var rc=/^m\/44'\/637'\/[0-9]+'\/[0-9]+'\/[0-9]+'?$/,ic= exports.APTOS_BIP44_REGEX =/^m\/44'\/637'\/[0-9]+'\/[0-9]+\/[0-9]+$/,oc= exports.KeyType =(e=>(e.ED25519="ed25519 seed",e))(oc||{}),Yi= exports.HARDENED_OFFSET =2147483648;function Zi(n){return ic.test(n)}function eo(n){return rc.test(n)}var Lr=(n,e)=>{let t=_hmac.hmac.create(_sha512.sha512,n).update(e).digest();return{key:t.slice(0,32),chainCode:t.slice(32)}},to= exports.CKDPriv =({key:n,chainCode:e},t)=>{let r=new ArrayBuffer(4);new DataView(r).setUint32(0,t);let i=new Uint8Array(r),o=new Uint8Array([0]),s=new Uint8Array([...o,...n,...i]);return Lr(e,s)},sc=n=>n.replace(/'/g,""),no= exports.splitPath =n=>n.split("/").slice(1).map(sc),Xn= exports.mnemonicToSeed =n=>{let e=n.trim().split(/\s+/).map(t=>t.toLowerCase()).join(" ");return Xi.mnemonicToSeedSync(e)};var un=class un{static formatPrivateKey(e,t){let r=un.AIP80_PREFIXES[t],i=e;return typeof i=="string"&&i.startsWith(r)&&(i=i.split("-")[2]),`${r}${_chunkRX5UBAMEjs.j.fromHexInput(i).toString()}`}static parseHexInput(e,t,r){let i,o=un.AIP80_PREFIXES[t];if(typeof e=="string")if(!r&&!e.startsWith(o))i=_chunkRX5UBAMEjs.j.fromHexInput(e),r!==!1&&console.warn("[Aptos SDK] It is recommended that private keys are AIP-80 compliant (https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-80.md). You can fix the private key by formatting it with `PrivateKey.formatPrivateKey(privateKey: string, type: 'ed25519' | 'secp256k1'): string`.");else if(e.startsWith(o))i=_chunkRX5UBAMEjs.j.fromHexString(e.split("-")[2]);else throw r?new Error("Invalid HexString input while parsing private key. Must AIP-80 compliant string."):new Error("Invalid HexString input while parsing private key.");else i=_chunkRX5UBAMEjs.j.fromHexInput(e);return i}};un.AIP80_PREFIXES={ed25519:"ed25519-priv-",secp256k1:"secp256k1-priv-"};var it=un;var mt=class extends _chunkRX5UBAMEjs.l{toUint8Array(){return this.bcsToBytes()}toString(){let e=this.toUint8Array();return _chunkRX5UBAMEjs.j.fromHexInput(e).toString()}},oe= exports.AccountPublicKey =class extends mt{};var M=class extends _chunkRX5UBAMEjs.l{toUint8Array(){return this.bcsToBytes()}toString(){let e=this.toUint8Array();return _chunkRX5UBAMEjs.j.fromHexInput(e).toString()}};var Ot=n=>typeof n=="string"?_chunkRX5UBAMEjs.j.isValid(n).valid?n:new TextEncoder().encode(n):n;var Hr=[237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16];function ac(n){let e=n.toUint8Array().slice(32);for(let t=Hr.length-1;t>=0;t-=1){if(e[t]<Hr[t])return!0;if(e[t]>Hr[t])return!1}return!1}var ot=class ot extends oe{constructor(e){super();let t=_chunkRX5UBAMEjs.j.fromHexInput(e);if(t.toUint8Array().length!==ot.LENGTH)throw new Error(`PublicKey length should be ${ot.LENGTH}`);this.key=t}verifySignature(e){let{message:t,signature:r}=e;if(!ac(r))return!1;let i=Ot(t),o=_chunkRX5UBAMEjs.j.fromHexInput(i).toUint8Array(),s=r.toUint8Array(),a=this.key.toUint8Array();return _ed25519.ed25519.verify(s,o,a)}authKey(){return B.fromSchemeAndBytes({scheme:0,input:this.toUint8Array()})}toUint8Array(){return this.key.toUint8Array()}serialize(e){e.serializeBytes(this.key.toUint8Array())}static deserialize(e){let t=e.deserializeBytes();return new ot(t)}static isPublicKey(e){return e instanceof ot}static isInstance(e){return"key"in e&&_optionalChain([e, 'access', _2 => _2.key, 'optionalAccess', _3 => _3.data, 'optionalAccess', _4 => _4.length])===ot.LENGTH}};ot.LENGTH=32;var x=ot,ye=class ye extends _chunkRX5UBAMEjs.l{constructor(e,t){super();let r=it.parseHexInput(e,"ed25519",t);if(r.toUint8Array().length!==ye.LENGTH)throw new Error(`PrivateKey length should be ${ye.LENGTH}`);this.signingKey=r}static generate(){let e=_ed25519.ed25519.utils.randomPrivateKey();return new ye(e,!1)}static fromDerivationPath(e,t){if(!eo(e))throw new Error(`Invalid derivation path ${e}`);return ye.fromDerivationPathInner(e,Xn(t))}static fromDerivationPathInner(e,t,r=Yi){let{key:i,chainCode:o}=Lr(ye.SLIP_0010_SEED,t),s=no(e).map(c=>parseInt(c,10)),{key:a}=s.reduce((c,d)=>to(c,d+r),{key:i,chainCode:o});return new ye(a,!1)}publicKey(){let e=_ed25519.ed25519.getPublicKey(this.signingKey.toUint8Array());return new x(e)}sign(e){let t=Ot(e),r=_chunkRX5UBAMEjs.j.fromHexInput(t).toUint8Array(),i=_ed25519.ed25519.sign(r,this.signingKey.toUint8Array());return new I(i)}toUint8Array(){return this.signingKey.toUint8Array()}toString(){return this.toHexString()}toHexString(){return this.signingKey.toString()}toAIP80String(){return it.formatPrivateKey(this.signingKey.toString(),"ed25519")}serialize(e){e.serializeBytes(this.toUint8Array())}static deserialize(e){let t=e.deserializeBytes();return new ye(t,!1)}static isPrivateKey(e){return e instanceof ye}};ye.LENGTH=32,ye.SLIP_0010_SEED="ed25519 seed";var q=ye,Ft=class Ft extends M{constructor(e){super();let t=_chunkRX5UBAMEjs.j.fromHexInput(e);if(t.toUint8Array().length!==Ft.LENGTH)throw new Error(`Signature length should be ${Ft.LENGTH}`);this.data=t}toUint8Array(){return this.data.toUint8Array()}serialize(e){e.serializeBytes(this.data.toUint8Array())}static deserialize(e){let t=e.deserializeBytes();return new Ft(t)}};Ft.LENGTH=64;var I=Ft;var _secp256k1 = require('@noble/curves/secp256k1');var _bip32 = require('@scure/bip32');var Ee=class Ee extends mt{constructor(e){super();let t=_chunkRX5UBAMEjs.j.fromHexInput(e),{length:r}=t.toUint8Array();if(r===Ee.LENGTH)this.key=t;else if(r===Ee.COMPRESSED_LENGTH){let i=_secp256k1.secp256k1.ProjectivePoint.fromHex(t.toUint8Array());this.key=_chunkRX5UBAMEjs.j.fromHexInput(i.toRawBytes(!1))}else throw new Error(`PublicKey length should be ${Ee.LENGTH} or ${Ee.COMPRESSED_LENGTH}, received ${r}`)}verifySignature(e){let{message:t,signature:r}=e,i=Ot(t),o=_chunkRX5UBAMEjs.j.fromHexInput(i).toUint8Array(),s=_sha3.sha3_256.call(void 0, o),a=r.toUint8Array();return _secp256k1.secp256k1.verify(a,s,this.key.toUint8Array(),{lowS:!0})}toUint8Array(){return this.key.toUint8Array()}serialize(e){e.serializeBytes(this.key.toUint8Array())}deserialize(e){let t=e.deserializeBytes();return new yt(t)}static deserialize(e){let t=e.deserializeBytes();return new Ee(t)}static isPublicKey(e){return e instanceof Ee}static isInstance(e){return"key"in e&&_optionalChain([e, 'access', _5 => _5.key, 'optionalAccess', _6 => _6.data, 'optionalAccess', _7 => _7.length])===Ee.LENGTH}};Ee.LENGTH=65,Ee.COMPRESSED_LENGTH=33;var Ne=Ee,ve=class ve extends _chunkRX5UBAMEjs.l{constructor(e,t){super();let r=it.parseHexInput(e,"secp256k1",t);if(r.toUint8Array().length!==ve.LENGTH)throw new Error(`PrivateKey length should be ${ve.LENGTH}`);this.key=r}static generate(){let e=_secp256k1.secp256k1.utils.randomPrivateKey();return new ve(e,!1)}static fromDerivationPath(e,t){if(!Zi(e))throw new Error(`Invalid derivation path ${e}`);return ve.fromDerivationPathInner(e,Xn(t))}static fromDerivationPathInner(e,t){let{privateKey:r}=_bip32.HDKey.fromMasterSeed(t).derive(e);if(r===null)throw new Error("Invalid key");return new ve(r,!1)}sign(e){let t=Ot(e),r=_chunkRX5UBAMEjs.j.fromHexInput(t),i=_sha3.sha3_256.call(void 0, r.toUint8Array()),o=_secp256k1.secp256k1.sign(i,this.key.toUint8Array(),{lowS:!0});return new yt(o.toCompactRawBytes())}publicKey(){let e=_secp256k1.secp256k1.getPublicKey(this.key.toUint8Array(),!1);return new Ne(e)}toUint8Array(){return this.key.toUint8Array()}toString(){return this.toHexString()}toHexString(){return this.key.toString()}toAIP80String(){return it.formatPrivateKey(this.key.toString(),"secp256k1")}serialize(e){e.serializeBytes(this.toUint8Array())}static deserialize(e){let t=e.deserializeBytes();return new ve(t,!1)}static isPrivateKey(e){return e instanceof ve}};ve.LENGTH=32;var Ge=ve,Nt=class Nt extends M{constructor(e){super();let t=_chunkRX5UBAMEjs.j.fromHexInput(e);if(t.toUint8Array().length!==Nt.LENGTH)throw new Error(`Signature length should be ${Nt.LENGTH}, received ${t.toUint8Array().length}`);this.data=t}toUint8Array(){return this.data.toUint8Array()}serialize(e){e.serializeBytes(this.data.toUint8Array())}static deserialize(e){let t=e.deserializeBytes();return new Nt(t)}};Nt.LENGTH=64;var yt=Nt;var _jwtdecode = require('jwt-decode');var ft=class n extends mt{constructor(e){super();let t=e.constructor.name;switch(t){case x.name:this.publicKey=e,this.variant=0;break;default:throw new Error(`Unsupported key for EphemeralPublicKey - ${t}`)}}verifySignature(e){let{message:t,signature:r}=e;return this.publicKey.verifySignature({message:t,signature:r.signature})}serialize(e){if(this.publicKey instanceof x)e.serializeU32AsUleb128(0),this.publicKey.serialize(e);else throw new Error("Unknown public key type")}static deserialize(e){let t=e.deserializeUleb128AsU32();switch(t){case 0:return new n(x.deserialize(e));default:throw new Error(`Unknown variant index for EphemeralPublicKey: ${t}`)}}static isPublicKey(e){return e instanceof n}},Ce= exports.EphemeralSignature =class n extends M{constructor(e){super();let t=e.constructor.name;switch(t){case I.name:this.signature=e;break;default:throw new Error(`Unsupported signature for EphemeralSignature - ${t}`)}}static fromHex(e){let t=_chunkRX5UBAMEjs.j.fromHexInput(e),r=new C(t.toUint8Array());return n.deserialize(r)}serialize(e){if(this.signature instanceof I)e.serializeU32AsUleb128(0),this.signature.serialize(e);else throw new Error("Unknown signature type")}static deserialize(e){let t=e.deserializeUleb128AsU32();switch(t){case 0:return new n(I.deserialize(e));default:throw new Error(`Unknown variant index for EphemeralSignature: ${t}`)}}};var _poseidonlite = require('poseidon-lite');var $r=[_poseidonlite.poseidon1,_poseidonlite.poseidon2,_poseidonlite.poseidon3,_poseidonlite.poseidon4,_poseidonlite.poseidon5,_poseidonlite.poseidon6,_poseidonlite.poseidon7,_poseidonlite.poseidon8,_poseidonlite.poseidon9,_poseidonlite.poseidon10,_poseidonlite.poseidon11,_poseidonlite.poseidon12,_poseidonlite.poseidon13,_poseidonlite.poseidon14,_poseidonlite.poseidon15,_poseidonlite.poseidon16],oo=31,Pc=16,io=(Pc-1)*oo;function Zn(n,e){let r=new TextEncoder().encode(n);return xc(r,e)}function xc(n,e){if(n.length>e)throw new Error(`Inputted bytes of length ${n} is longer than ${e}`);let t=Wr(n,e);return ln(t)}function Ic(n,e){if(n.length>e)throw new Error(`Input bytes of length ${n} is longer than ${e}`);let t=Kc(n,e);return vc(t)}function Wr(n,e){if(n.length>e)throw new Error(`Input bytes of length ${n} is longer than ${e}`);return Ic(n,e).concat([BigInt(n.length)])}function vc(n){if(n.length>io)throw new Error(`Can't pack more than ${io}. Was given ${n.length} bytes`);return Cc(n,oo).map(e=>pn(e))}function Cc(n,e){let t=[];for(let r=0;r<n.length;r+=e)t.push(n.subarray(r,r+e));return t}function pn(n){let e=BigInt(0);for(let t=n.length-1;t>=0;t-=1)e=e<<BigInt(8)|BigInt(n[t]);return e}function so(n,e){let t=BigInt(n),r=new Uint8Array(e);for(let i=0;i<e;i+=1)r[i]=Number(t&BigInt(255)),t>>=BigInt(8);return r}function Kc(n,e){if(e<n.length)throw new Error("Padded size must be greater than or equal to the input array size.");let t=new Uint8Array(e);t.set(n);for(let r=n.length;r<e;r+=1)t[r]=0;return t}function ln(n){if(n.length>$r.length)throw new Error(`Unable to hash input of length ${n.length}. Max input length is ${$r.length}`);return $r[n.length-1](n)}var er=class extends _chunkRX5UBAMEjs.l{};var Qr="1.35.0";var ao={mainnet:"https://api.mainnet.aptoslabs.com/v1/graphql",testnet:"https://api.testnet.aptoslabs.com/v1/graphql",devnet:"https://api.devnet.aptoslabs.com/v1/graphql",local:"http://127.0.0.1:8090/v1/graphql"},co= exports.NetworkToNodeAPI ={mainnet:"https://api.mainnet.aptoslabs.com/v1",testnet:"https://api.testnet.aptoslabs.com/v1",devnet:"https://api.devnet.aptoslabs.com/v1",local:"http://127.0.0.1:8080/v1"},uo= exports.NetworkToFaucetAPI ={devnet:"https://faucet.devnet.aptoslabs.com",local:"http://127.0.0.1:8081"},jr= exports.NetworkToPepperAPI ={mainnet:"https://api.mainnet.aptoslabs.com/keyless/pepper/v0",testnet:"https://api.testnet.aptoslabs.com/keyless/pepper/v0",devnet:"https://api.devnet.aptoslabs.com/keyless/pepper/v0",local:"https://api.devnet.aptoslabs.com/keyless/pepper/v0"},Jr= exports.NetworkToProverAPI ={mainnet:"https://api.mainnet.aptoslabs.com/keyless/prover/v0",testnet:"https://api.testnet.aptoslabs.com/keyless/prover/v0",devnet:"https://api.devnet.aptoslabs.com/keyless/prover/v0",local:"https://api.devnet.aptoslabs.com/keyless/prover/v0"},Xr= exports.Network =(o=>(o.MAINNET="mainnet",o.TESTNET="testnet",o.DEVNET="devnet",o.LOCAL="local",o.CUSTOM="custom",o))(Xr||{}),Yr= exports.NetworkToChainId ={mainnet:1,testnet:2,local:4},pl= exports.NetworkToNetworkName ={mainnet:"mainnet",testnet:"testnet",devnet:"devnet",local:"local",custom:"custom"};var At=(o=>(o.FULLNODE="Fullnode",o.INDEXER="Indexer",o.FAUCET="Faucet",o.PEPPER="Pepper",o.PROVER="Prover",o))(At||{}),po= exports.DEFAULT_MAX_GAS_AMOUNT =2e5,lo= exports.DEFAULT_TXN_EXP_SEC_FROM_NOW =20,tr= exports.DEFAULT_TXN_TIMEOUT_SEC =20,ht= exports.APTOS_COIN ="0x1::aptos_coin::AptosCoin",go= exports.APTOS_FA ="0x000000000000000000000000000000000000000000000000000000000000000a",mo= exports.RAW_TRANSACTION_SALT ="APTOS::RawTransaction",Zr= exports.RAW_TRANSACTION_WITH_DATA_SALT ="APTOS::RawTransactionWithData",Be= exports.ProcessorType =(c=>(c.ACCOUNT_TRANSACTION_PROCESSOR="account_transactions_processor",c.DEFAULT="default_processor",c.EVENTS_PROCESSOR="events_processor",c.FUNGIBLE_ASSET_PROCESSOR="fungible_asset_processor",c.STAKE_PROCESSOR="stake_processor",c.TOKEN_V2_PROCESSOR="token_v2_processor",c.USER_TRANSACTION_PROCESSOR="user_transaction_processor",c.OBJECT_PROCESSOR="objects_processor",c))(Be||{}),yo= exports.FIREBASE_AUTH_ISS_PATTERN =/^https:\/\/securetoken\.google\.com\/[a-zA-Z0-9-_]+$/;function fo(n,e){let t=e.bcsToBytes(),r=new C(t);return n.deserialize(r)}var Rc=(o=>(o[o.API_ERROR=0]="API_ERROR",o[o.EXTERNAL_API_ERROR=1]="EXTERNAL_API_ERROR",o[o.SESSION_EXPIRED=2]="SESSION_EXPIRED",o[o.INVALID_STATE=3]="INVALID_STATE",o[o.UNKNOWN=4]="UNKNOWN",o))(Rc||{}),Uc= exports.KeylessErrorResolutionTip =(d=>(d.REAUTHENTICATE="Re-authentiate to continue using your keyless account",d.REAUTHENTICATE_UNSURE="Try re-authentiating. If the error persists join the telegram group at https://t.me/+h5CN-W35yUFiYzkx for further support",d.UPDATE_REQUEST_PARAMS="Update the invalid request parameters and reauthenticate.",d.RATE_LIMIT_EXCEEDED="Cache the keyless account and reuse it to avoid making too many requests. Keyless accounts are valid until either the EphemeralKeyPair expires, when the JWK is rotated, or when the proof verifying key is changed, whichever comes soonest.",d.SERVER_ERROR="Try again later. See aptosApiError error for more context. For additional support join the telegram group at https://t.me/+h5CN-W35yUFiYzkx",d.CALL_PRECHECK="Call `await account.checkKeylessAccountValidity()` to wait for asyncronous changes and check for account validity before signing or serializing.",d.REINSTANTIATE="Try instantiating the account again. Avoid manipulating the account object directly",d.JOIN_SUPPORT_GROUP="For support join the telegram group at https://t.me/+h5CN-W35yUFiYzkx",d.UNKNOWN="Error unknown. For support join the telegram group at https://t.me/+h5CN-W35yUFiYzkx",d))(Uc||{}),nr= exports.KeylessErrorType =(f=>(f[f.EPHEMERAL_KEY_PAIR_EXPIRED=0]="EPHEMERAL_KEY_PAIR_EXPIRED",f[f.PROOF_NOT_FOUND=1]="PROOF_NOT_FOUND",f[f.ASYNC_PROOF_FETCH_FAILED=2]="ASYNC_PROOF_FETCH_FAILED",f[f.INVALID_PROOF_VERIFICATION_FAILED=3]="INVALID_PROOF_VERIFICATION_FAILED",f[f.INVALID_PROOF_VERIFICATION_KEY_NOT_FOUND=4]="INVALID_PROOF_VERIFICATION_KEY_NOT_FOUND",f[f.INVALID_JWT_SIG=5]="INVALID_JWT_SIG",f[f.INVALID_JWT_JWK_NOT_FOUND=6]="INVALID_JWT_JWK_NOT_FOUND",f[f.INVALID_JWT_ISS_NOT_RECOGNIZED=7]="INVALID_JWT_ISS_NOT_RECOGNIZED",f[f.INVALID_JWT_FEDERATED_ISS_NOT_SUPPORTED=8]="INVALID_JWT_FEDERATED_ISS_NOT_SUPPORTED",f[f.INVALID_TW_SIG_VERIFICATION_FAILED=9]="INVALID_TW_SIG_VERIFICATION_FAILED",f[f.INVALID_TW_SIG_PUBLIC_KEY_NOT_FOUND=10]="INVALID_TW_SIG_PUBLIC_KEY_NOT_FOUND",f[f.INVALID_EXPIRY_HORIZON=11]="INVALID_EXPIRY_HORIZON",f[f.JWT_PARSING_ERROR=12]="JWT_PARSING_ERROR",f[f.JWK_FETCH_FAILED=13]="JWK_FETCH_FAILED",f[f.JWK_FETCH_FAILED_FEDERATED=14]="JWK_FETCH_FAILED_FEDERATED",f[f.RATE_LIMIT_EXCEEDED=15]="RATE_LIMIT_EXCEEDED",f[f.PEPPER_SERVICE_INTERNAL_ERROR=16]="PEPPER_SERVICE_INTERNAL_ERROR",f[f.PEPPER_SERVICE_BAD_REQUEST=17]="PEPPER_SERVICE_BAD_REQUEST",f[f.PEPPER_SERVICE_OTHER=18]="PEPPER_SERVICE_OTHER",f[f.PROVER_SERVICE_INTERNAL_ERROR=19]="PROVER_SERVICE_INTERNAL_ERROR",f[f.PROVER_SERVICE_BAD_REQUEST=20]="PROVER_SERVICE_BAD_REQUEST",f[f.PROVER_SERVICE_OTHER=21]="PROVER_SERVICE_OTHER",f[f.FULL_NODE_CONFIG_LOOKUP_ERROR=22]="FULL_NODE_CONFIG_LOOKUP_ERROR",f[f.FULL_NODE_VERIFICATION_KEY_LOOKUP_ERROR=23]="FULL_NODE_VERIFICATION_KEY_LOOKUP_ERROR",f[f.FULL_NODE_JWKS_LOOKUP_ERROR=24]="FULL_NODE_JWKS_LOOKUP_ERROR",f[f.FULL_NODE_OTHER=25]="FULL_NODE_OTHER",f[f.UNKNOWN=26]="UNKNOWN",f))(nr||{}),Ao={0:["The ephemeral keypair has expired.",2,"Re-authentiate to continue using your keyless account"],1:["The required proof could not be found.",3,"Call `await account.checkKeylessAccountValidity()` to wait for asyncronous changes and check for account validity before signing or serializing."],2:["The required proof failed to fetch.",3,"Try re-authentiating. If the error persists join the telegram group at https://t.me/+h5CN-W35yUFiYzkx for further support"],3:["The provided proof is invalid.",3,"Try re-authentiating. If the error persists join the telegram group at https://t.me/+h5CN-W35yUFiYzkx for further support"],4:["The verification key used to authenticate was updated.",2,"Re-authentiate to continue using your keyless account"],5:["The JWK was found, but JWT failed verification",3,"Try re-authentiating. If the error persists join the telegram group at https://t.me/+h5CN-W35yUFiYzkx for further support"],6:["The JWK required to verify the JWT could not be found. The JWK may have been rotated out.",2,"Re-authentiate to continue using your keyless account"],7:["The JWT issuer is not recognized.",3,"Update the invalid request parameters and reauthenticate."],8:["The JWT issuer is not supported by the Federated Keyless ",0,"Try re-authentiating. If the error persists join the telegram group at https://t.me/+h5CN-W35yUFiYzkx for further support"],9:["The training wheels signature is invalid.",3,"Try re-authentiating. If the error persists join the telegram group at https://t.me/+h5CN-W35yUFiYzkx for further support"],10:["The public key used to verify the training wheels signature was not found.",2,"Re-authentiate to continue using your keyless account"],11:["The expiry horizon is invalid.",2,"Re-authentiate to continue using your keyless account"],13:["Failed to fetch JWKS.",1,"For support join the telegram group at https://t.me/+h5CN-W35yUFiYzkx"],14:["Failed to fetch JWKS for Federated Keyless provider.",1,"For support join the telegram group at https://t.me/+h5CN-W35yUFiYzkx"],15:["Rate limit exceeded. Too many requests in a short period.",0,"Cache the keyless account and reuse it to avoid making too many requests. Keyless accounts are valid until either the EphemeralKeyPair expires, when the JWK is rotated, or when the proof verifying key is changed, whichever comes soonest."],16:["Internal error from Pepper service.",0,"Try again later. See aptosApiError error for more context. For additional support join the telegram group at https://t.me/+h5CN-W35yUFiYzkx"],17:["Bad request sent to Pepper service.",0,"Update the invalid request parameters and reauthenticate."],18:["Unknown error from Pepper service.",0,"Try again later. See aptosApiError error for more context. For additional support join the telegram group at https://t.me/+h5CN-W35yUFiYzkx"],19:["Internal error from Prover service.",0,"Try again later. See aptosApiError error for more context. For additional support join the telegram group at https://t.me/+h5CN-W35yUFiYzkx"],20:["Bad request sent to Prover service.",0,"Update the invalid request parameters and reauthenticate."],21:["Unknown error from Prover service.",0,"Try again later. See aptosApiError error for more context. For additional support join the telegram group at https://t.me/+h5CN-W35yUFiYzkx"],12:["Error when parsing JWT. This should never happen. Join https://t.me/+h5CN-W35yUFiYzkx for support",3,"Try instantiating the account again. Avoid manipulating the account object directly"],22:["Error when looking up on-chain keyless configuration.",0,"Try again later. See aptosApiError error for more context. For additional support join the telegram group at https://t.me/+h5CN-W35yUFiYzkx"],23:["Error when looking up on-chain verification key.",0,"Try again later. See aptosApiError error for more context. For additional support join the telegram group at https://t.me/+h5CN-W35yUFiYzkx"],24:["Error when looking up on-chain JWKS.",0,"Try again later. See aptosApiError error for more context. For additional support join the telegram group at https://t.me/+h5CN-W35yUFiYzkx"],25:["Unknown error from full node.",0,"Try again later. See aptosApiError error for more context. For additional support join the telegram group at https://t.me/+h5CN-W35yUFiYzkx"],26:["An unknown error has occurred.",4,"Error unknown. For support join the telegram group at https://t.me/+h5CN-W35yUFiYzkx"]},D= exports.KeylessError =class n extends Error{constructor(e){let{innerError:t,category:r,resolutionTip:i,type:o,message:s=Ao[o][0],details:a}=e;super(s),this.name="KeylessError",this.innerError=t,this.category=r,this.resolutionTip=i,this.type=o,this.details=a,this.message=n.constructMessage(s,i,t,a)}static constructMessage(e,t,r,i){let o=`
|
|
4
2
|
Message: ${e}`;return i&&(o+=`
|
|
5
|
-
Details: ${i}`),
|
|
6
|
-
AptosApiError: ${
|
|
7
|
-
Error: ${
|
|
8
|
-
KeylessErrorResolutionTip: ${t}`,o}static fromErrorType(e){let{error:t,type:n,details:i}=e,[o,s,a]=fo[n];return new r({message:o,details:i,innerError:t,category:s,resolutionTip:a,type:n})}},Ae= exports.AptosApiError =class extends Error{constructor({apiType:e,aptosRequest:t,aptosResponse:n}){super(_c({apiType:e,aptosRequest:t,aptosResponse:n})),this.name="AptosApiError",this.url=n.url,this.status=n.status,this.statusText=n.statusText,this.data=n.data,this.request=t}};function _c({apiType:r,aptosRequest:e,aptosResponse:t}){let n=_optionalChain([t, 'access', _14 => _14.headers, 'optionalAccess', _15 => _15.traceparent, 'optionalAccess', _16 => _16.split, 'call', _17 => _17("-"), 'access', _18 => _18[1]]),i=n?`(trace_id:${n}) `:"",o=`Request to [${r}]: ${e.method} ${_nullishCoalesce(t.url, () => (e.url))} ${i}failed with`;return r==="Indexer"&&_optionalChain([t, 'access', _19 => _19.data, 'optionalAccess', _20 => _20.errors, 'optionalAccess', _21 => _21[0], 'optionalAccess', _22 => _22.message])!=null?`${o}: ${t.data.errors[0].message}`:_optionalChain([t, 'access', _23 => _23.data, 'optionalAccess', _24 => _24.message])!=null&&_optionalChain([t, 'access', _25 => _25.data, 'optionalAccess', _26 => _26.error_code])!=null?`${o}: ${JSON.stringify(t.data)}`:`${o} status: ${t.statusText}(code:${t.status}) and response body: ${xc(t.data)}`}var ei=400;function xc(r){let e=JSON.stringify(r);return e.length<=ei?e:`truncated(original_size:${e.length}): ${e.slice(0,ei/2)}...${e.slice(-ei/2)}`}async function Ec(r,e){let{url:t,method:n,body:i,contentType:o,params:s,overrides:a,originMethod:c}=r,p={..._optionalChain([a, 'optionalAccess', _27 => _27.HEADERS]),"x-aptos-client":`aptos-typescript-sdk/${oo}`,"content-type":_nullishCoalesce(o, () => ("application/json")),"x-aptos-typescript-sdk-origin-method":c};return _optionalChain([a, 'optionalAccess', _28 => _28.AUTH_TOKEN])&&(p.Authorization=`Bearer ${_optionalChain([a, 'optionalAccess', _29 => _29.AUTH_TOKEN])}`),_optionalChain([a, 'optionalAccess', _30 => _30.API_KEY])&&(p.Authorization=`Bearer ${_optionalChain([a, 'optionalAccess', _31 => _31.API_KEY])}`),e.provider({url:t,method:n,body:i,params:s,headers:p,overrides:a})}async function tn(r,e,t){let{url:n,path:i}=r,o=i?`${n}/${i}`:n,s=await Ec({...r,url:o},e.client),a={status:s.status,statusText:_nullishCoalesce(s.statusText, () => ("No status text provided")),data:s.data,headers:s.headers,config:s.config,request:s.request,url:o};if(a.status===401)throw new Ae({apiType:t,aptosRequest:r,aptosResponse:a});if(t==="Indexer"){let c=a.data;if(c.errors)throw new Ae({apiType:t,aptosRequest:r,aptosResponse:a});a.data=c.data}else if((t==="Pepper"||t==="Prover")&&a.status>=400)throw new Ae({apiType:t,aptosRequest:r,aptosResponse:a});if(a.status>=200&&a.status<300)return a;throw new Ae({apiType:t,aptosRequest:r,aptosResponse:a})}async function rn(r){let{aptosConfig:e,overrides:t,params:n,contentType:i,acceptType:o,path:s,originMethod:a,type:c}=r,p=e.getRequestUrl(c);return tn({url:p,method:"GET",originMethod:a,path:s,contentType:i,acceptType:o,params:n,overrides:{...e.clientConfig,...t}},e,r.type)}async function q(r){let{aptosConfig:e}=r;return rn({...r,type:"Fullnode",overrides:{...e.clientConfig,...e.fullnodeConfig,...r.overrides,HEADERS:{..._optionalChain([e, 'access', _32 => _32.clientConfig, 'optionalAccess', _33 => _33.HEADERS]),..._optionalChain([e, 'access', _34 => _34.fullnodeConfig, 'optionalAccess', _35 => _35.HEADERS])}}})}async function Ql(r){return rn({...r,type:"Pepper"})}async function nn(r){let e=[],t,n=r.params;do{let i=await rn({type:"Fullnode",aptosConfig:r.aptosConfig,originMethod:r.originMethod,path:r.path,params:n,overrides:r.overrides});t=i.headers["x-aptos-cursor"],delete i.headers,e.push(...i.data),n.start=t}while(t!=null);return e}async function ti(r){let e=[],t,n=r.params,i=n.limit;do{let o=await rn({type:"Fullnode",aptosConfig:r.aptosConfig,originMethod:r.originMethod,path:r.path,params:n,overrides:r.overrides});if(t=o.headers["x-aptos-cursor"],delete o.headers,e.push(...o.data),n.offset=t,i!==void 0){let s=i-e.length;if(s<=0)break;n.limit=s}}while(t!=null);return e}async function lr(r){let{type:e,originMethod:t,path:n,body:i,acceptType:o,contentType:s,params:a,aptosConfig:c,overrides:p}=r,l=c.getRequestUrl(e);return tn({url:l,method:"POST",originMethod:t,path:n,body:i,contentType:s,acceptType:o,params:a,overrides:p},c,r.type)}async function ot(r){let{aptosConfig:e}=r;return lr({...r,type:"Fullnode",overrides:{...e.clientConfig,...e.fullnodeConfig,...r.overrides,HEADERS:{..._optionalChain([e, 'access', _36 => _36.clientConfig, 'optionalAccess', _37 => _37.HEADERS]),..._optionalChain([e, 'access', _38 => _38.fullnodeConfig, 'optionalAccess', _39 => _39.HEADERS])}}})}async function Ao(r){let{aptosConfig:e}=r;return lr({...r,type:"Indexer",overrides:{...e.clientConfig,...e.indexerConfig,...r.overrides,HEADERS:{..._optionalChain([e, 'access', _40 => _40.clientConfig, 'optionalAccess', _41 => _41.HEADERS]),..._optionalChain([e, 'access', _42 => _42.indexerConfig, 'optionalAccess', _43 => _43.HEADERS])}}})}async function ho(r){let{aptosConfig:e}=r,t={...e,clientConfig:{...e.clientConfig}};return _optionalChainDelete([t, 'optionalAccess', _44 => _44.clientConfig, 'optionalAccess', _45 => delete _45.API_KEY]),lr({...r,type:"Faucet",overrides:{...t.clientConfig,...t.faucetConfig,...r.overrides,HEADERS:{..._optionalChain([t, 'access', _46 => _46.clientConfig, 'optionalAccess', _47 => _47.HEADERS]),..._optionalChain([t, 'access', _48 => _48.faucetConfig, 'optionalAccess', _49 => _49.HEADERS])}}})}async function To(r){return lr({...r,type:"Pepper"})}async function bo(r){return lr({...r,type:"Prover"})}var ri=new Map;function Ke(r,e,t){return async(...n)=>{if(ri.has(e)){let{value:o,timestamp:s}=ri.get(e);if(t===void 0||Date.now()-s<=t)return o}let i=await r(...n);return ri.set(e,{value:i,timestamp:Date.now()}),i}}var vg=1e7,vc= exports.MAX_AUD_VAL_BYTES =120,Ic= exports.MAX_UID_KEY_BYTES =30,Cc= exports.MAX_UID_VAL_BYTES =330,Ig= exports.MAX_ISS_VAL_BYTES =120,Cg= exports.MAX_EXTRA_FIELD_BYTES =350,Rg= exports.MAX_JWT_HEADER_B64_BYTES =300,Kg= exports.MAX_COMMITED_EPK_BYTES =93,Ue=class Ue extends se{constructor(e,t){super();let n=m.fromHexInput(t).toUint8Array();if(n.length!==Ue.ID_COMMITMENT_LENGTH)throw new Error(`Id Commitment length in bytes should be ${Ue.ID_COMMITMENT_LENGTH}`);this.iss=e,this.idCommitment=n}authKey(){let e=new B;return e.serializeU32AsUleb128(3),e.serializeFixedBytes(this.bcsToBytes()),L.fromSchemeAndBytes({scheme:2,input:e.toUint8Array()})}verifySignature(e){throw new Error("Not yet implemented")}serialize(e){e.serializeStr(this.iss),e.serializeBytes(this.idCommitment)}static deserialize(e){let t=e.deserializeStr(),n=e.deserializeBytes();return new Ue(t,n)}static load(e){let t=e.deserializeStr(),n=e.deserializeBytes();return new Ue(t,n)}static isPublicKey(e){return e instanceof Ue}static create(e){return wo(e),new Ue(e.iss,wo(e))}static fromJwtAndPepper(e){let{jwt:t,pepper:n,uidKey:i="sub"}=e,o=_jwtdecode.jwtDecode.call(void 0, t);if(typeof o.iss!="string")throw new Error("iss was not found");if(typeof o.aud!="string")throw new Error("aud was not found or an array of values");let s=o[i];return Ue.create({iss:o.iss,uidKey:i,uidVal:s,aud:o.aud,pepper:n})}static isInstance(e){return"iss"in e&&typeof e.iss=="string"&&"idCommitment"in e&&e.idCommitment instanceof Uint8Array}};Ue.ID_COMMITMENT_LENGTH=32;var O=Ue;function wo(r){let{uidKey:e,uidVal:t,aud:n,pepper:i}=r,o=[pr(m.fromHexInput(i).toUint8Array()),Xr(n,vc),Xr(t,Cc),Xr(e,Ic)];return io(dr(o),O.ID_COMMITMENT_LENGTH)}var Le=class r extends V{constructor(e){super();let{jwtHeader:t,ephemeralCertificate:n,expiryDateSecs:i,ephemeralPublicKey:o,ephemeralSignature:s}=e;this.jwtHeader=t,this.ephemeralCertificate=n,this.expiryDateSecs=i,this.ephemeralPublicKey=o,this.ephemeralSignature=s}getJwkKid(){return Uc(this.jwtHeader).kid}serialize(e){this.ephemeralCertificate.serialize(e),e.serializeStr(this.jwtHeader),e.serializeU64(this.expiryDateSecs),this.ephemeralPublicKey.serialize(e),this.ephemeralSignature.serialize(e)}static deserialize(e){let t=Gt.deserialize(e),n=e.deserializeStr(),i=e.deserializeU64(),o=Tt.deserialize(e),s=Re.deserialize(e);return new r({jwtHeader:n,expiryDateSecs:Number(i),ephemeralCertificate:t,ephemeralPublicKey:o,ephemeralSignature:s})}static getSimulationSignature(){return new r({jwtHeader:"{}",ephemeralCertificate:new Gt(new ve({proof:new Mt(new Bt({a:new Uint8Array(32),b:new Uint8Array(64),c:new Uint8Array(32)}),0),expHorizonSecs:0}),0),expiryDateSecs:0,ephemeralPublicKey:new Tt(new P(new Uint8Array(32))),ephemeralSignature:new Re(new I(new Uint8Array(64)))})}static isSignature(e){return e instanceof r}},Gt= exports.EphemeralCertificate =class r extends V{constructor(e,t){super(),this.signature=e,this.variant=t}toUint8Array(){return this.signature.toUint8Array()}serialize(e){e.serializeU32AsUleb128(this.variant),this.signature.serialize(e)}static deserialize(e){let t=e.deserializeUleb128AsU32();switch(t){case 0:return new r(ve.deserialize(e),t);default:throw new Error(`Unknown variant index for EphemeralCertificate: ${t}`)}}},Me=class r extends y{constructor(e){if(super(),this.data=m.fromHexInput(e).toUint8Array(),this.data.length!==32)throw new Error("Input needs to be 32 bytes")}serialize(e){e.serializeFixedBytes(this.data)}static deserialize(e){let t=e.deserializeFixedBytes(32);return new r(t)}},wt=class r extends y{constructor(e){if(super(),this.data=m.fromHexInput(e).toUint8Array(),this.data.length!==64)throw new Error("Input needs to be 64 bytes")}serialize(e){e.serializeFixedBytes(this.data)}static deserialize(e){let t=e.deserializeFixedBytes(64);return new r(t)}},Bt= exports.Groth16Zkp =class r extends Yr{constructor(e){super();let{a:t,b:n,c:i}=e;this.a=new Me(t),this.b=new wt(n),this.c=new Me(i)}serialize(e){this.a.serialize(e),this.b.serialize(e),this.c.serialize(e)}static deserialize(e){let t=Me.deserialize(e).bcsToBytes(),n=wt.deserialize(e).bcsToBytes(),i=Me.deserialize(e).bcsToBytes();return new r({a:t,b:n,c:i})}},Mt= exports.ZkProof =class r extends y{constructor(e,t){super(),this.proof=e,this.variant=t}serialize(e){e.serializeU32AsUleb128(this.variant),this.proof.serialize(e)}static deserialize(e){let t=e.deserializeUleb128AsU32();switch(t){case 0:return new r(Bt.deserialize(e),t);default:throw new Error(`Unknown variant index for ZkProof: ${t}`)}}},ve= exports.ZeroKnowledgeSig =class r extends V{constructor(e){super();let{proof:t,expHorizonSecs:n,trainingWheelsSignature:i,extraField:o,overrideAudVal:s}=e;this.proof=t,this.expHorizonSecs=n,this.trainingWheelsSignature=i,this.extraField=o,this.overrideAudVal=s}static fromBytes(e){return r.deserialize(new D(e))}serialize(e){this.proof.serialize(e),e.serializeU64(this.expHorizonSecs),e.serializeOption(this.extraField),e.serializeOption(this.overrideAudVal),e.serializeOption(this.trainingWheelsSignature)}static deserialize(e){let t=Mt.deserialize(e),n=Number(e.deserializeU64()),i=e.deserializeOption("string"),o=e.deserializeOption("string"),s=e.deserializeOption(Re);return new r({proof:t,expHorizonSecs:n,trainingWheelsSignature:s,extraField:i,overrideAudVal:o})}},ni= exports.KeylessConfiguration =class r{constructor(e,t){this.verificationKey=e,this.maxExpHorizonSecs=t}static create(e,t){return new r(new ii({alphaG1:e.alpha_g1,betaG2:e.beta_g2,deltaG2:e.delta_g2,gammaAbcG1:e.gamma_abc_g1,gammaG2:e.gamma_g2}),t)}},ii= exports.Groth16VerificationKey =class r{constructor(e){let{alphaG1:t,betaG2:n,deltaG2:i,gammaAbcG1:o,gammaG2:s}=e;this.alphaG1=new Me(t),this.betaG2=new wt(n),this.deltaG2=new wt(i),this.gammaAbcG1=[new Me(o[0]),new Me(o[1])],this.gammaG2=new wt(s)}hash(){let e=new B;return this.serialize(e),_sha3.sha3_256.create().update(e.toUint8Array()).digest()}serialize(e){this.alphaG1.serialize(e),this.betaG2.serialize(e),this.deltaG2.serialize(e),this.gammaAbcG1[0].serialize(e),this.gammaAbcG1[1].serialize(e),this.gammaG2.serialize(e)}static fromGroth16VerificationKeyResponse(e){return new r({alphaG1:e.alpha_g1,betaG2:e.beta_g2,deltaG2:e.delta_g2,gammaAbcG1:e.gamma_abc_g1,gammaG2:e.gamma_g2})}};async function gr(r){let{aptosConfig:e}=r;try{return await Ke(async()=>{let t=await Rc(r),n=await Kc(r);return ni.create(n,Number(t.max_exp_horizon_secs))},`keyless-configuration-${e.network}`,1e3*60*5)()}catch(t){throw t instanceof k?t:k.fromErrorType({type:25,error:t})}}function Ve(r){let{jwt:e,uidKey:t="sub"}=r,n;try{n=_jwtdecode.jwtDecode.call(void 0, e)}catch(o){throw k.fromErrorType({type:12,details:`Failed to parse JWT - ${_chunkIHUCZKG2js.c.call(void 0, o)}`})}if(typeof n.iss!="string")throw k.fromErrorType({type:12,details:"JWT is missing 'iss' in the payload. This should never happen."});if(typeof n.aud!="string")throw k.fromErrorType({type:12,details:"JWT is missing 'aud' in the payload or 'aud' is an array of values."});let i=n[t];return{iss:n.iss,aud:n.aud,uidVal:i}}async function Rc(r){let{aptosConfig:e,options:t}=r,n="0x1::keyless_account::Configuration";try{let{data:i}=await q({aptosConfig:e,originMethod:"getKeylessConfigurationResource",path:`accounts/${u.from("0x1").toString()}/resource/${n}`,params:{ledger_version:_optionalChain([t, 'optionalAccess', _50 => _50.ledgerVersion])}});return i.data}catch(i){throw k.fromErrorType({type:22,error:i})}}async function Kc(r){let{aptosConfig:e,options:t}=r,n="0x1::keyless_account::Groth16VerificationKey";try{let{data:i}=await q({aptosConfig:e,originMethod:"getGroth16VerificationKeyResource",path:`accounts/${u.from("0x1").toString()}/resource/${n}`,params:{ledger_version:_optionalChain([t, 'optionalAccess', _51 => _51.ledgerVersion])}});return i.data}catch(i){throw k.fromErrorType({type:23,error:i})}}async function _o(r){let{aptosConfig:e,jwkAddr:t,options:n}=r,i;if(t){let s="0x1::jwks::FederatedJWKs",{data:a}=await q({aptosConfig:e,originMethod:"getKeylessJWKs",path:`accounts/${u.from(t).toString()}/resource/${s}`,params:{ledger_version:_optionalChain([n, 'optionalAccess', _52 => _52.ledgerVersion])}});i=a}else{let s="0x1::jwks::PatchedJWKs",{data:a}=await q({aptosConfig:e,originMethod:"getKeylessJWKs",path:`accounts/0x1/resource/${s}`,params:{ledger_version:_optionalChain([n, 'optionalAccess', _53 => _53.ledgerVersion])}});i=a}let o=new Map;for(let s of i.data.jwks.entries){let a=[];for(let c of s.jwks){let{data:p}=c.variant,l=new D(m.fromHexInput(p).toUint8Array()),h=oi.deserialize(l);a.push(h)}o.set(Fi(s.issuer),a)}return o}var oi=class r extends y{constructor(e){super();let{kid:t,kty:n,alg:i,e:o,n:s}=e;this.kid=t,this.kty=n,this.alg=i,this.e=o,this.n=s}serialize(e){e.serializeStr(this.kid),e.serializeStr(this.kty),e.serializeStr(this.alg),e.serializeStr(this.e),e.serializeStr(this.n)}static fromMoveStruct(e){let{data:t}=e.variant,n=new D(m.fromHexInput(t).toUint8Array());return r.deserialize(n)}static deserialize(e){let t=e.deserializeStr(),n=e.deserializeStr(),i=e.deserializeStr(),o=e.deserializeStr(),s=e.deserializeStr();return new r({kid:t,kty:n,alg:i,n:o,e:s})}};function Uc(r){try{let e=JSON.parse(r);if(e.kid===void 0)throw new Error("JWT header missing kid");return e}catch (e2){throw new Error("Failed to parse JWT header.")}}var re=class r extends se{constructor(e,t){super(),this.jwkAddress=u.from(e),this.keylessPublicKey=t}authKey(){let e=new B;return e.serializeU32AsUleb128(4),e.serializeFixedBytes(this.bcsToBytes()),L.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=u.deserialize(e),n=O.deserialize(e);return new r(t,n)}static isPublicKey(e){return e instanceof r}static create(e){return new r(e.jwkAddress,O.create(e))}static fromJwtAndPepper(e){return new r(e.jwkAddress,O.fromJwtAndPepper(e))}static isInstance(e){return"jwkAddress"in e&&e.jwkAddress instanceof u&&"keylessPublicKey"in e&&e.keylessPublicKey instanceof O}};var N=class r extends se{constructor(e){if(super(),this.publicKey=e,e instanceof P)this.variant=0;else if(e instanceof Fe)this.variant=1;else if(e instanceof O)this.variant=3;else if(e instanceof re)this.variant=4;else throw new Error("Unsupported public key type")}verifySignature(e){let{message:t,signature:n}=e;return $.isInstance(n)?this.publicKey.verifySignature({message:t,signature:n.signature}):!1}authKey(){return L.fromSchemeAndBytes({scheme:2,input:this.toUint8Array()})}toUint8Array(){return this.bcsToBytes()}serialize(e){e.serializeU32AsUleb128(this.variant),this.publicKey.serialize(e)}static deserialize(e){let t=e.deserializeUleb128AsU32(),n;switch(t){case 0:n=P.deserialize(e);break;case 1:n=Fe.deserialize(e);break;case 3:n=O.deserialize(e);break;case 4:n=re.deserialize(e);break;default:throw new Error(`Unknown variant index for AnyPublicKey: ${t}`)}return new r(n)}static isPublicKey(e){return e instanceof r}isEd25519(){return this.publicKey instanceof P}isSecp256k1PublicKey(){return this.publicKey instanceof Fe}static isInstance(e){return"publicKey"in e&&"variant"in e}},$= exports.AnySignature =class r extends V{constructor(e){if(super(),this.signature=e,e instanceof I)this.variant=0;else if(e instanceof ht)this.variant=1;else if(e instanceof Le)this.variant=3;else throw new Error("Unsupported signature type")}toUint8Array(){return console.warn("[Aptos SDK] Calls to AnySignature.toUint8Array() will soon return the underlying signature bytes. Use AnySignature.bcsToBytes() instead."),this.bcsToBytes()}serialize(e){e.serializeU32AsUleb128(this.variant),this.signature.serialize(e)}static deserialize(e){let t=e.deserializeUleb128AsU32(),n;switch(t){case 0:n=I.deserialize(e);break;case 1:n=ht.deserialize(e);break;case 3:n=Le.deserialize(e);break;default:throw new Error(`Unknown variant index for AnySignature: ${t}`)}return new r(n)}static isInstance(e){return"signature"in e&&typeof e.signature=="object"&&e.signature!==null&&"toUint8Array"in e.signature}};function kc(r){let e=r;return e-=e>>1&1431655765,e=(e&858993459)+(e>>2&858993459),(e+(e>>4)&252645135)*16843009>>24}var ke=class r extends se{constructor(e){super();let{publicKeys:t,signaturesRequired:n}=e;if(n<1)throw new Error("The number of required signatures needs to be greater than 0");if(t.length<n)throw new Error(`Provided ${t.length} public keys is smaller than the ${n} required signatures`);this.publicKeys=t.map(i=>i instanceof N?i:new N(i)),this.signaturesRequired=n}verifySignature(e){throw new Error("not implemented")}authKey(){return L.fromSchemeAndBytes({scheme:3,input:this.toUint8Array()})}serialize(e){e.serializeVector(this.publicKeys),e.serializeU8(this.signaturesRequired)}static deserialize(e){let t=e.deserializeVector(N),n=e.deserializeU8();return new r({publicKeys:t,signaturesRequired:n})}createBitmap(e){let{bits:t}=e,n=128,i=new Uint8Array([0,0,0,0]),o=new Set;return t.forEach((s,a)=>{if(a+1>this.publicKeys.length)throw new Error(`Signature index ${a+1} is out of public keys range, ${this.publicKeys.length}.`);if(o.has(s))throw new Error(`Duplicate bit ${s} detected.`);o.add(s);let c=Math.floor(s/8),p=i[c];p|=n>>s%8,i[c]=p}),i}getIndex(e){let t=e instanceof N?e:new N(e),n=this.publicKeys.findIndex(i=>i.toString()===t.toString());if(n!==-1)return n;throw new Error(`Public key ${e} not found in MultiKey ${this.publicKeys}`)}static isInstance(e){return"publicKeys"in e&&"signaturesRequired"in e}},ue=class ue extends V{constructor(e){super();let{signatures:t,bitmap:n}=e;if(t.length>ue.MAX_SIGNATURES_SUPPORTED)throw new Error(`The number of signatures cannot be greater than ${ue.MAX_SIGNATURES_SUPPORTED}`);if(this.signatures=t.map(o=>o instanceof $?o:new $(o)),!(n instanceof Uint8Array))this.bitmap=ue.createBitmap({bits:n});else{if(n.length!==ue.BITMAP_LEN)throw new Error(`"bitmap" length should be ${ue.BITMAP_LEN}`);this.bitmap=n}let i=this.bitmap.reduce((o,s)=>o+kc(s),0);if(i!==this.signatures.length)throw new Error(`Expecting ${i} signatures from the bitmap, but got ${this.signatures.length}`)}static createBitmap(e){let{bits:t}=e,n=128,i=new Uint8Array([0,0,0,0]),o=new Set;return t.forEach(s=>{if(s>=ue.MAX_SIGNATURES_SUPPORTED)throw new Error(`Cannot have a signature larger than ${ue.MAX_SIGNATURES_SUPPORTED-1}.`);if(o.has(s))throw new Error("Duplicate bits detected.");o.add(s);let a=Math.floor(s/8),c=i[a];c|=n>>s%8,i[a]=c}),i}serialize(e){e.serializeVector(this.signatures),e.serializeBytes(this.bitmap)}static deserialize(e){let t=e.deserializeVector($),n=e.deserializeBytes();return new ue({signatures:t,bitmap:n})}};ue.BITMAP_LEN=4,ue.MAX_SIGNATURES_SUPPORTED=ue.BITMAP_LEN*8;var He=ue;var Z=class extends y{static deserialize(e){let t=e.deserializeUleb128AsU32();switch(t){case 0:return Ie.load(e);case 1:return on.load(e);case 2:return ae.load(e);case 3:return ze.load(e);case 4:return Lt.load(e);default:throw new Error(`Unknown variant index for AccountAuthenticator: ${t}`)}}isEd25519(){return this instanceof Ie}isMultiEd25519(){return this instanceof on}isSingleKey(){return this instanceof ae}isMultiKey(){return this instanceof ze}},Ie= exports.AccountAuthenticatorEd25519 =class r extends Z{constructor(e,t){super(),this.public_key=e,this.signature=t}serialize(e){e.serializeU32AsUleb128(0),this.public_key.serialize(e),this.signature.serialize(e)}static load(e){let t=P.deserialize(e),n=I.deserialize(e);return new r(t,n)}},on= exports.AccountAuthenticatorMultiEd25519 =class r extends Z{constructor(e,t){super(),this.public_key=e,this.signature=t}serialize(e){e.serializeU32AsUleb128(1),this.public_key.serialize(e),this.signature.serialize(e)}static load(e){let t=Ot.deserialize(e),n=At.deserialize(e);return new r(t,n)}},ae= exports.AccountAuthenticatorSingleKey =class r extends Z{constructor(e,t){super(),this.public_key=e,this.signature=t}serialize(e){e.serializeU32AsUleb128(2),this.public_key.serialize(e),this.signature.serialize(e)}static load(e){let t=N.deserialize(e),n=$.deserialize(e);return new r(t,n)}},ze= exports.AccountAuthenticatorMultiKey =class r extends Z{constructor(e,t){super(),this.public_keys=e,this.signatures=t}serialize(e){e.serializeU32AsUleb128(3),this.public_keys.serialize(e),this.signatures.serialize(e)}static load(e){let t=ke.deserialize(e),n=He.deserialize(e);return new r(t,n)}},Lt= exports.AccountAuthenticatorNoAccountAuthenticator =class r extends Z{serialize(e){e.serializeU32AsUleb128(4)}static load(e){return new r}};var Vt=class r extends y{constructor(e){super(),this.chainId=e}serialize(e){e.serializeU8(this.chainId)}static deserialize(e){let t=e.deserializeU8();return new r(t)}};var R=class r extends y{constructor(e){super(),this.identifier=e}serialize(e){e.serializeStr(this.identifier)}static deserialize(e){let t=e.deserializeStr();return new r(t)}};var sn=(r,e)=>{let t=r.bcsToBytes(),n=typeof e=="string"?Buffer.from(e,"utf8"):e,i=new Uint8Array([...t,...n,254]);return new u(_sha3.sha3_256.call(void 0, i))},Hy= exports.createResourceAddress =(r,e)=>{let t=r.bcsToBytes(),n=typeof e=="string"?Buffer.from(e,"utf8"):e,i=new Uint8Array([...t,...n,255]);return new u(_sha3.sha3_256.call(void 0, i))},qy= exports.createTokenAddress =(r,e,t)=>{let n=`${e}::${t}`;return sn(r,n)};var yr=class r extends y{constructor(e,t){super(),this.address=e,this.name=t}static fromStr(e){let t=e.split("::");if(t.length!==2)throw new Error("Invalid module id.");return new r(u.fromString(t[0]),new R(t[1]))}serialize(e){this.address.serialize(e),this.name.serialize(e)}static deserialize(e){let t=u.deserialize(e),n=R.deserialize(e);return new r(t,n)}};var F=class r extends y{deserialize(e){let t=u.deserialize(e),n=R.deserialize(e),i=R.deserialize(e),o=e.deserializeVector(r);return new De(t,n,i,o)}static deserialize(e){let t=e.deserializeUleb128AsU32();switch(t){case 0:return M.load(e);case 1:return pe.load(e);case 2:return j.load(e);case 3:return We.load(e);case 4:return ee.load(e);case 5:return St.load(e);case 6:return C.load(e);case 7:return A.load(e);case 8:return qe.load(e);case 9:return $e.load(e);case 10:return Qe.load(e);case 255:return G.load(e);default:throw new Error(`Unknown variant index for TypeTag: ${t}`)}}isBool(){return this instanceof M}isAddress(){return this instanceof ee}isGeneric(){return this instanceof G}isSigner(){return this instanceof St}isVector(){return this instanceof C}isStruct(){return this instanceof A}isU8(){return this instanceof pe}isU16(){return this instanceof qe}isU32(){return this instanceof $e}isU64(){return this instanceof j}isU128(){return this instanceof We}isU256(){return this instanceof Qe}isPrimitive(){return this instanceof St||this instanceof ee||this instanceof M||this instanceof pe||this instanceof qe||this instanceof $e||this instanceof j||this instanceof We||this instanceof Qe}},M= exports.TypeTagBool =class r extends F{toString(){return"bool"}serialize(e){e.serializeU32AsUleb128(0)}static load(e){return new r}},pe= exports.TypeTagU8 =class r extends F{toString(){return"u8"}serialize(e){e.serializeU32AsUleb128(1)}static load(e){return new r}},qe= exports.TypeTagU16 =class r extends F{toString(){return"u16"}serialize(e){e.serializeU32AsUleb128(8)}static load(e){return new r}},$e= exports.TypeTagU32 =class r extends F{toString(){return"u32"}serialize(e){e.serializeU32AsUleb128(9)}static load(e){return new r}},j= exports.TypeTagU64 =class r extends F{toString(){return"u64"}serialize(e){e.serializeU32AsUleb128(2)}static load(e){return new r}},We= exports.TypeTagU128 =class r extends F{toString(){return"u128"}serialize(e){e.serializeU32AsUleb128(3)}static load(e){return new r}},Qe= exports.TypeTagU256 =class r extends F{toString(){return"u256"}serialize(e){e.serializeU32AsUleb128(10)}static load(e){return new r}},ee= exports.TypeTagAddress =class r extends F{toString(){return"address"}serialize(e){e.serializeU32AsUleb128(4)}static load(e){return new r}},St= exports.TypeTagSigner =class r extends F{toString(){return"signer"}serialize(e){e.serializeU32AsUleb128(5)}static load(e){return new r}},an= exports.TypeTagReference =class r extends F{constructor(t){super();this.value=t}toString(){return`&${this.value.toString()}`}serialize(t){t.serializeU32AsUleb128(254)}static load(t){let n=F.deserialize(t);return new r(n)}},G= exports.TypeTagGeneric =class r extends F{constructor(t){super();this.value=t;if(t<0)throw new Error("Generic type parameter index cannot be negative")}toString(){return`T${this.value}`}serialize(t){t.serializeU32AsUleb128(255),t.serializeU32(this.value)}static load(t){let n=t.deserializeU32();return new r(n)}},C= exports.TypeTagVector =class r extends F{constructor(t){super();this.value=t}toString(){return`vector<${this.value.toString()}>`}static u8(){return new r(new pe)}serialize(t){t.serializeU32AsUleb128(6),this.value.serialize(t)}static load(t){let n=F.deserialize(t);return new r(n)}},A= exports.TypeTagStruct =class r extends F{constructor(t){super();this.value=t}toString(){let t="";return this.value.typeArgs.length>0&&(t=`<${this.value.typeArgs.map(n=>n.toString()).join(", ")}>`),`${this.value.address.toString()}::${this.value.moduleName.identifier}::${this.value.name.identifier}${t}`}serialize(t){t.serializeU32AsUleb128(7),this.value.serialize(t)}static load(t){let n=De.deserialize(t);return new r(n)}isTypeTag(t,n,i){return this.value.moduleName.identifier===n&&this.value.name.identifier===i&&this.value.address.equals(t)}isString(){return this.isTypeTag(u.ONE,"string","String")}isOption(){return this.isTypeTag(u.ONE,"option","Option")}isObject(){return this.isTypeTag(u.ONE,"object","Object")}},De= exports.StructTag =class r extends y{constructor(e,t,n,i){super(),this.address=e,this.moduleName=t,this.name=n,this.typeArgs=i}serialize(e){e.serialize(this.address),e.serialize(this.moduleName),e.serialize(this.name),e.serializeVector(this.typeArgs)}static deserialize(e){let t=u.deserialize(e),n=R.deserialize(e),i=R.deserialize(e),o=e.deserializeVector(F);return new r(t,n,i,o)}};function ym(){return new De(u.ONE,new R("aptos_coin"),new R("AptosCoin"),[])}function v(){return new De(u.ONE,new R("string"),new R("String"),[])}function mm(r){return new De(u.ONE,new R("option"),new R("Option"),[r])}function de(r){return new De(u.ONE,new R("object"),new R("Object"),[r])}function zc(r){let e=r.deserializeUleb128AsU32();switch(e){case 0:return X.deserialize(r);case 1:return Q.deserialize(r);case 2:return Ee.deserialize(r);case 3:return u.deserialize(r);case 4:return S.deserialize(r,X);case 5:return U.deserialize(r);case 6:return _e.deserialize(r);case 7:return xe.deserialize(r);case 8:return ye.deserialize(r);case 9:return ar.deserialize(r);default:throw new Error(`Unknown variant index for ScriptTransactionArgument: ${e}`)}}var _t=class extends y{static deserialize(e){let t=e.deserializeUleb128AsU32();switch(t){case 0:return mr.load(e);case 2:return fr.load(e);case 3:return Ar.load(e);default:throw new Error(`Unknown variant index for TransactionPayload: ${t}`)}}},mr= exports.TransactionPayloadScript =class r extends _t{constructor(e){super(),this.script=e}serialize(e){e.serializeU32AsUleb128(0),this.script.serialize(e)}static load(e){let t=hr.deserialize(e);return new r(t)}},fr= exports.TransactionPayloadEntryFunction =class r extends _t{constructor(e){super(),this.entryFunction=e}serialize(e){e.serializeU32AsUleb128(2),this.entryFunction.serialize(e)}static load(e){let t=xt.deserialize(e);return new r(t)}},Ar= exports.TransactionPayloadMultiSig =class r extends _t{constructor(e){super(),this.multiSig=e}serialize(e){e.serializeU32AsUleb128(3),this.multiSig.serialize(e)}static load(e){let t=Tr.deserialize(e);return new r(t)}},xt= exports.EntryFunction =class r{constructor(e,t,n,i){this.module_name=e,this.function_name=t,this.type_args=n,this.args=i}static build(e,t,n,i){return new r(yr.fromStr(e),new R(t),n,i)}serialize(e){this.module_name.serialize(e),this.function_name.serialize(e),e.serializeVector(this.type_args),e.serializeU32AsUleb128(this.args.length),this.args.forEach(t=>{t.serializeForEntryFunction(e)})}static deserialize(e){let t=yr.deserialize(e),n=R.deserialize(e),i=e.deserializeVector(F),o=e.deserializeUleb128AsU32(),s=new Array;for(let a=0;a<o;a+=1){let c=e.deserializeUleb128AsU32(),p=$r.deserialize(e,c);s.push(p)}return new r(t,n,i,s)}},hr= exports.Script =class r{constructor(e,t,n){this.bytecode=e,this.type_args=t,this.args=n}serialize(e){e.serializeBytes(this.bytecode),e.serializeVector(this.type_args),e.serializeU32AsUleb128(this.args.length),this.args.forEach(t=>{t.serializeForScriptFunction(e)})}static deserialize(e){let t=e.deserializeBytes(),n=e.deserializeVector(F),i=e.deserializeUleb128AsU32(),o=new Array;for(let s=0;s<i;s+=1){let a=zc(e);o.push(a)}return new r(t,n,o)}},Tr= exports.MultiSig =class r{constructor(e,t){this.multisig_address=e,this.transaction_payload=t}serialize(e){this.multisig_address.serialize(e),this.transaction_payload===void 0?e.serializeBool(!1):(e.serializeBool(!0),this.transaction_payload.serialize(e))}static deserialize(e){let t=u.deserialize(e),n=e.deserializeBool(),i;return n&&(i=br.deserialize(e)),new r(t,i)}},br= exports.MultiSigTransactionPayload =class r extends y{constructor(e){super(),this.transaction_payload=e}serialize(e){e.serializeU32AsUleb128(0),this.transaction_payload.serialize(e)}static deserialize(e){return e.deserializeUleb128AsU32(),new r(xt.deserialize(e))}};var he=class r extends y{constructor(e,t,n,i,o,s,a){super(),this.sender=e,this.sequence_number=t,this.payload=n,this.max_gas_amount=i,this.gas_unit_price=o,this.expiration_timestamp_secs=s,this.chain_id=a}serialize(e){this.sender.serialize(e),e.serializeU64(this.sequence_number),this.payload.serialize(e),e.serializeU64(this.max_gas_amount),e.serializeU64(this.gas_unit_price),e.serializeU64(this.expiration_timestamp_secs),this.chain_id.serialize(e)}static deserialize(e){let t=u.deserialize(e),n=e.deserializeU64(),i=_t.deserialize(e),o=e.deserializeU64(),s=e.deserializeU64(),a=e.deserializeU64(),c=Vt.deserialize(e);return new r(t,n,i,o,s,a,c)}},cn= exports.RawTransactionWithData =class extends y{static deserialize(e){let t=e.deserializeUleb128AsU32();switch(t){case 0:return Et.load(e);case 1:return Pt.load(e);default:throw new Error(`Unknown variant index for RawTransactionWithData: ${t}`)}}},Et= exports.MultiAgentRawTransaction =class r extends cn{constructor(e,t){super(),this.raw_txn=e,this.secondary_signer_addresses=t}serialize(e){e.serializeU32AsUleb128(0),this.raw_txn.serialize(e),e.serializeVector(this.secondary_signer_addresses)}static load(e){let t=he.deserialize(e),n=e.deserializeVector(u);return new r(t,n)}},Pt= exports.FeePayerRawTransaction =class r extends cn{constructor(e,t,n){super(),this.raw_txn=e,this.secondary_signer_addresses=t,this.fee_payer_address=n}serialize(e){e.serializeU32AsUleb128(1),this.raw_txn.serialize(e),e.serializeVector(this.secondary_signer_addresses),this.fee_payer_address.serialize(e)}static load(e){let t=he.deserialize(e),n=e.deserializeVector(u),i=u.deserialize(e);return new r(t,n,i)}};var un=class extends y{constructor(t){super();this.accountAddress=u.ONE;this.moduleName=new x("account");this.structName=new x("RotationProofChallenge");this.sequenceNumber=new Q(t.sequenceNumber),this.originator=t.originator,this.currentAuthKey=t.currentAuthKey,this.newPublicKey=S.U8(t.newPublicKey.toUint8Array())}serialize(t){t.serialize(this.accountAddress),t.serialize(this.moduleName),t.serialize(this.structName),t.serialize(this.sequenceNumber),t.serialize(this.originator),t.serialize(this.currentAuthKey),t.serialize(this.newPublicKey)}};var je=class extends y{static deserialize(e){let t=e.deserializeUleb128AsU32();switch(t){case 0:return vt.load(e);case 1:return pn.load(e);case 2:return It.load(e);case 3:return Ct.load(e);case 4:return st.load(e);default:throw new Error(`Unknown variant index for TransactionAuthenticator: ${t}`)}}isEd25519(){return this instanceof vt}isMultiEd25519(){return this instanceof pn}isMultiAgent(){return this instanceof It}isFeePayer(){return this instanceof Ct}isSingleSender(){return this instanceof st}},vt= exports.TransactionAuthenticatorEd25519 =class r extends je{constructor(e,t){super(),this.public_key=e,this.signature=t}serialize(e){e.serializeU32AsUleb128(0),this.public_key.serialize(e),this.signature.serialize(e)}static load(e){let t=P.deserialize(e),n=I.deserialize(e);return new r(t,n)}},pn= exports.TransactionAuthenticatorMultiEd25519 =class r extends je{constructor(e,t){super(),this.public_key=e,this.signature=t}serialize(e){e.serializeU32AsUleb128(1),this.public_key.serialize(e),this.signature.serialize(e)}static load(e){let t=Ot.deserialize(e),n=At.deserialize(e);return new r(t,n)}},It= exports.TransactionAuthenticatorMultiAgent =class r extends je{constructor(e,t,n){super(),this.sender=e,this.secondary_signer_addresses=t,this.secondary_signers=n}serialize(e){e.serializeU32AsUleb128(2),this.sender.serialize(e),e.serializeVector(this.secondary_signer_addresses),e.serializeVector(this.secondary_signers)}static load(e){let t=Z.deserialize(e),n=e.deserializeVector(u),i=e.deserializeVector(Z);return new r(t,n,i)}},Ct= exports.TransactionAuthenticatorFeePayer =class r extends je{constructor(e,t,n,i){super(),this.sender=e,this.secondary_signer_addresses=t,this.secondary_signers=n,this.fee_payer=i}serialize(e){e.serializeU32AsUleb128(3),this.sender.serialize(e),e.serializeVector(this.secondary_signer_addresses),e.serializeVector(this.secondary_signers),this.fee_payer.address.serialize(e),this.fee_payer.authenticator.serialize(e)}static load(e){let t=Z.deserialize(e),n=e.deserializeVector(u),i=e.deserializeVector(Z),o=u.deserialize(e),s=Z.deserialize(e),a={address:o,authenticator:s};return new r(t,n,i,a)}},st= exports.TransactionAuthenticatorSingleSender =class r extends je{constructor(e){super(),this.sender=e}serialize(e){e.serializeU32AsUleb128(4),this.sender.serialize(e)}static load(e){let t=Z.deserialize(e);return new r(t)}};var Je=class r extends y{constructor(e,t){super(),this.raw_txn=e,this.authenticator=t}serialize(e){this.raw_txn.serialize(e),this.authenticator.serialize(e)}static deserialize(e){let t=he.deserialize(e),n=je.deserialize(e);return new r(t,n)}};var dn=class r extends y{constructor(e,t){super(),this.rawTransaction=e,this.feePayerAddress=t}serialize(e){this.rawTransaction.serialize(e),this.feePayerAddress===void 0?e.serializeBool(!1):(e.serializeBool(!0),this.feePayerAddress.serialize(e))}static deserialize(e){let t=he.deserialize(e),n=e.deserializeBool(),i;return n&&(i=u.deserialize(e)),new r(t,i)}};var ln=class r extends y{constructor(e,t,n){super(),this.rawTransaction=e,this.feePayerAddress=n,this.secondarySignerAddresses=t}serialize(e){this.rawTransaction.serialize(e),e.serializeVector(this.secondarySignerAddresses),this.feePayerAddress===void 0?e.serializeBool(!1):(e.serializeBool(!0),this.feePayerAddress.serialize(e))}static deserialize(e){let t=he.deserialize(e),n=e.deserializeVector(u),i=e.deserializeBool(),o;return i&&(o=u.deserialize(e)),new r(t,n,o)}};function si(r){return r.feePayerAddress?new Pt(r.rawTransaction,_nullishCoalesce(r.secondarySignerAddresses, () => ([])),r.feePayerAddress):r.secondarySignerAddresses?new Et(r.rawTransaction,r.secondarySignerAddresses):r.rawTransaction}function Ht(r,e){let t=_sha3.sha3_256.create();if(!e.startsWith("APTOS::"))throw new Error(`Domain separator needs to start with 'APTOS::'. Provided - ${e}`);t.update(e);let n=t.digest(),i=r,o=new Uint8Array(n.length+i.length);return o.set(n),o.set(i,n.length),o}function vf(r){return Ht(r.bcsToBytes(),`APTOS::${r.constructor.name}`)}function qt(r){let e=si(r);return r.feePayerAddress?Ht(e.bcsToBytes(),Zn):r.secondarySignerAddresses?Ht(e.bcsToBytes(),Zn):Ht(e.bcsToBytes(),go)}var Te=class r{constructor(e){this.signingScheme=0;let{privateKey:t,address:n}=e;this.privateKey=t,this.publicKey=t.publicKey(),this.accountAddress=n?u.from(n):this.publicKey.authKey().derivedAddress()}static generate(){let e=H.generate();return new r({privateKey:e})}static fromDerivationPath(e){let{path:t,mnemonic:n}=e,i=H.fromDerivationPath(t,n);return new r({privateKey:i})}verifySignature(e){return this.publicKey.verifySignature(e)}signWithAuthenticator(e){return new Ie(this.publicKey,this.privateKey.sign(e))}signTransactionWithAuthenticator(e){return new Ie(this.publicKey,this.signTransaction(e))}sign(e){return this.privateKey.sign(e)}signTransaction(e){return this.sign(qt(e))}};function ai(r){return typeof r=="object"&&r!==null&&"getAnyPublicKey"in r&&typeof r.getAnyPublicKey=="function"}var be=class r{constructor(e){this.signingScheme=2;let{privateKey:t,address:n}=e;this.privateKey=t,this.publicKey=new N(t.publicKey()),this.accountAddress=n?u.from(n):this.publicKey.authKey().derivedAddress()}getAnyPublicKey(){return this.publicKey}static generate(e={}){let{scheme:t=0}=e,n;switch(t){case 0:n=H.generate();break;case 2:n=Ge.generate();break;default:throw new Error(`Unsupported signature scheme ${t}`)}return new r({privateKey:n})}static fromDerivationPath(e){let{scheme:t=0,path:n,mnemonic:i}=e,o;switch(t){case 0:o=H.fromDerivationPath(n,i);break;case 2:o=Ge.fromDerivationPath(n,i);break;default:throw new Error(`Unsupported signature scheme ${t}`)}return new r({privateKey:o})}verifySignature(e){return this.publicKey.verifySignature(e)}signWithAuthenticator(e){return new ae(this.publicKey,this.sign(e))}signTransactionWithAuthenticator(e){return new ae(this.publicKey,this.signTransaction(e))}sign(e){return new $(this.privateKey.sign(e))}signTransaction(e){return this.sign(qt(e))}static fromEd25519Account(e){return new r({privateKey:e.privateKey,address:e.accountAddress})}};var at=class{static generate(e={}){let{scheme:t=0,legacy:n=!0}=e;return t===0&&n?Te.generate():be.generate({scheme:t})}static fromPrivateKey(e){let{privateKey:t,address:n,legacy:i=!0}=e;return t instanceof H&&i?new Te({privateKey:t,address:n}):new be({privateKey:t,address:n})}static fromPrivateKeyAndAddress(e){return this.fromPrivateKey(e)}static fromDerivationPath(e){let{scheme:t=0,mnemonic:n,path:i,legacy:o=!0}=e;return t===0&&o?Te.fromDerivationPath({mnemonic:n,path:i}):be.fromDerivationPath({scheme:t,mnemonic:n,path:i})}static authKey(e){let{publicKey:t}=e;return t.authKey()}verifySignature(e){return this.publicKey.verifySignature(e)}};var Nc=1209600,$t=class $t extends y{constructor(e){super();let{privateKey:t,expiryDateSecs:n,blinder:i}=e;this.privateKey=t,this.publicKey=new Tt(t.publicKey()),this.expiryDateSecs=n||_chunkIHUCZKG2js.e.call(void 0, _chunkIHUCZKG2js.d.call(void 0, )+Nc),this.blinder=i!==void 0?m.fromHexInput(i).toUint8Array():Fc();let o=Qn(this.publicKey.bcsToBytes(),93);o.push(BigInt(this.expiryDateSecs)),o.push(pr(this.blinder));let s=dr(o);this.nonce=s.toString()}getPublicKey(){return this.publicKey}isExpired(){return Math.floor(Date.now()/1e3)>this.expiryDateSecs}serialize(e){e.serializeU32AsUleb128(this.publicKey.variant),e.serializeBytes(this.privateKey.toUint8Array()),e.serializeU64(this.expiryDateSecs),e.serializeFixedBytes(this.blinder)}static deserialize(e){let t=e.deserializeUleb128AsU32(),n;switch(t){case 0:n=H.deserialize(e);break;default:throw new Error(`Unknown variant index for EphemeralPublicKey: ${t}`)}let i=e.deserializeU64(),o=e.deserializeFixedBytes(31);return new $t({privateKey:n,expiryDateSecs:Number(i),blinder:o})}static fromBytes(e){return $t.deserialize(new D(e))}static generate(e){let t;switch(_optionalChain([e, 'optionalAccess', _54 => _54.scheme])){case 0:default:t=H.generate()}return new $t({privateKey:t,expiryDateSecs:_optionalChain([e, 'optionalAccess', _55 => _55.expiryDateSecs])})}sign(e){if(this.isExpired())throw new Error("EphemeralKeyPair has expired");return new Re(this.privateKey.sign(e))}};$t.BLINDER_LENGTH=31;var Rt=$t;function Fc(){return _utils.randomBytes.call(void 0, Rt.BLINDER_LENGTH)}var _eventemitter3 = require('eventemitter3'); var _eventemitter32 = _interopRequireDefault(_eventemitter3);function gn(r){return r!=null&&typeof r.checkKeylessAccountValidity=="function"}var Wt=class Wt extends y{constructor(t){super();this.signingScheme=2;let{address:n,ephemeralKeyPair:i,publicKey:o,uidKey:s,uidVal:a,aud:c,pepper:p,proof:l,proofFetchCallback:h,jwt:g,verificationKeyHash:d}=t;if(this.ephemeralKeyPair=i,this.publicKey=o,this.accountAddress=n?u.from(n):this.publicKey.authKey().derivedAddress(),this.uidKey=s,this.uidVal=a,this.aud=c,this.jwt=g,this.emitter=new _eventemitter32.default,this.proofOrPromise=l,l instanceof ve)this.proof=l;else{if(h===void 0)throw new Error("Must provide callback for async proof fetch");this.emitter.on("proofFetchFinish",async K=>{await h(K),this.emitter.removeAllListeners()}),this.init(l)}let b=m.fromHexInput(p).toUint8Array();if(b.length!==Wt.PEPPER_LENGTH)throw new Error(`Pepper length in bytes should be ${Wt.PEPPER_LENGTH}`);if(this.pepper=b,d!==void 0){if(m.hexInputToUint8Array(d).length!==32)throw new Error("verificationKeyHash must be 32 bytes");this.verificationKeyHash=m.hexInputToUint8Array(d)}}getAnyPublicKey(){return new N(this.publicKey)}async init(t){try{this.proof=await t,this.emitter.emit("proofFetchFinish",{status:"Success"})}catch(n){n instanceof Error?this.emitter.emit("proofFetchFinish",{status:"Failed",error:n.toString()}):this.emitter.emit("proofFetchFinish",{status:"Failed",error:"Unknown"})}}serialize(t){if(this.accountAddress.serialize(t),t.serializeStr(this.jwt),t.serializeStr(this.uidKey),t.serializeFixedBytes(this.pepper),this.ephemeralKeyPair.serialize(t),this.proof===void 0)throw new Error("Cannot serialize - proof undefined");this.proof.serialize(t),t.serializeOption(this.verificationKeyHash,32)}static partialDeserialize(t){let n=u.deserialize(t),i=t.deserializeStr(),o=t.deserializeStr(),s=t.deserializeFixedBytes(31),a=Rt.deserialize(t),c=ve.deserialize(t),p=t.deserializeOption("fixedBytes",32);return{address:n,jwt:i,uidKey:o,pepper:s,ephemeralKeyPair:a,proof:c,verificationKeyHash:p}}isExpired(){return this.ephemeralKeyPair.isExpired()}signWithAuthenticator(t){let n=new $(this.sign(t)),i=new N(this.publicKey);return new ae(i,n)}signTransactionWithAuthenticator(t){let n=new $(this.signTransaction(t)),i=new N(this.publicKey);return new ae(i,n)}async waitForProofFetch(){this.proofOrPromise instanceof Promise&&await this.proofOrPromise}async checkKeylessAccountValidity(t){if(this.isExpired())throw k.fromErrorType({type:0});if(await this.waitForProofFetch(),this.proof===void 0)throw k.fromErrorType({type:2});let n=_jwtdecode.jwtDecode.call(void 0, this.jwt,{header:!0});if(n.kid===void 0)throw k.fromErrorType({type:12,details:"checkKeylessAccountValidity failed. JWT is missing 'kid' in header. This should never happen."});if(this.verificationKeyHash!==void 0){let{verificationKey:i}=await gr({aptosConfig:t});if(m.hexInputToString(i.hash())!==m.hexInputToString(this.verificationKeyHash))throw k.fromErrorType({type:4})}else console.warn("[Aptos SDK] The verification key hash was not set. Proof may be invalid if the verification key has rotated.");await Wt.fetchJWK({aptosConfig:t,publicKey:this.publicKey,kid:n.kid})}sign(t){let{expiryDateSecs:n}=this.ephemeralKeyPair;if(this.isExpired())throw k.fromErrorType({type:0});if(this.proof===void 0)throw k.fromErrorType({type:1,details:"Proof not found - make sure to call `await account.checkKeylessAccountValidity()` before signing."});let i=this.ephemeralKeyPair.getPublicKey(),o=this.ephemeralKeyPair.sign(t);return new Le({jwtHeader:_chunkIHUCZKG2js.f.call(void 0, this.jwt.split(".")[0]),ephemeralCertificate:new Gt(this.proof,0),expiryDateSecs:n,ephemeralPublicKey:i,ephemeralSignature:o})}signTransaction(t){if(this.proof===void 0)throw k.fromErrorType({type:1,details:"Proof not found - make sure to call `await account.checkKeylessAccountValidity()` before signing."});let n=si(t),o=new ci(n,this.proof.proof).hash();return this.sign(o)}verifySignature(t){let{message:n,signature:i}=t;return!(this.isExpired()||!this.ephemeralKeyPair.getPublicKey().verifySignature({message:n,signature:i.ephemeralSignature}))}static async fetchJWK(t){let{aptosConfig:n,publicKey:i,kid:o}=t,s=i instanceof O?i:i.keylessPublicKey,{iss:a}=s,c,p=i instanceof re?i.jwkAddress:void 0;try{c=await _o({aptosConfig:n,jwkAddr:p})}catch(g){throw k.fromErrorType({type:24,error:g,details:`Failed to fetch ${p?"Federated":"Patched"}JWKs ${p?`for address ${p}`:"0x1"}`})}let l=c.get(a);if(l===void 0)throw k.fromErrorType({type:7,details:`JWKs for issuer ${a} not found.`});let h=l.find(g=>g.kid===o);if(h===void 0)throw k.fromErrorType({type:6,details:`JWK with kid '${o}' for issuer '${a}' not found.`});return h}};Wt.PEPPER_LENGTH=31;var le=Wt,ci= exports.TransactionAndProof =class extends y{constructor(t,n){super();this.domainSeparator="APTOS::TransactionAndProof";this.transaction=t,this.proof=n}serialize(t){t.serializeFixedBytes(this.transaction.bcsToBytes()),t.serializeOption(this.proof)}hash(){return Ht(this.bcsToBytes(),this.domainSeparator)}};var Xe=class r extends le{constructor(e){let t=O.create(e);super({publicKey:t,...e}),this.publicKey=t}serialize(e){super.serialize(e)}static deserialize(e){let{address:t,proof:n,ephemeralKeyPair:i,jwt:o,uidKey:s,pepper:a,verificationKeyHash:c}=le.partialDeserialize(e),{iss:p,aud:l,uidVal:h}=Ve({jwt:o,uidKey:s});return new r({address:t,proof:n,ephemeralKeyPair:i,iss:p,uidKey:s,uidVal:h,aud:l,pepper:a,jwt:o,verificationKeyHash:c})}static fromBytes(e){return r.deserialize(new D(m.hexInputToUint8Array(e)))}static create(e){let{address:t,proof:n,jwt:i,ephemeralKeyPair:o,pepper:s,uidKey:a="sub",proofFetchCallback:c,verificationKey:p}=e,{iss:l,aud:h,uidVal:g}=Ve({jwt:i,uidKey:a});return new r({address:t,proof:n,ephemeralKeyPair:o,iss:l,uidKey:a,uidVal:g,aud:h,pepper:s,jwt:i,proofFetchCallback:c,verificationKeyHash:p?p.hash():void 0})}};var Kt=class r extends le{constructor(e){let t=re.create(e);super({publicKey:t,...e}),this.publicKey=t,this.audless=_nullishCoalesce(e.audless, () => (!1))}serialize(e){super.serialize(e),this.publicKey.jwkAddress.serialize(e)}static deserialize(e){let{address:t,proof:n,ephemeralKeyPair:i,jwt:o,uidKey:s,pepper:a,verificationKeyHash:c}=le.partialDeserialize(e),p=u.deserialize(e),{iss:l,aud:h,uidVal:g}=Ve({jwt:o,uidKey:s});return new r({address:t,proof:n,ephemeralKeyPair:i,iss:l,uidKey:s,uidVal:g,aud:h,pepper:a,jwt:o,verificationKeyHash:c,jwkAddress:p})}static fromBytes(e){return r.deserialize(D.fromHex(e))}static create(e){let{address:t,proof:n,jwt:i,ephemeralKeyPair:o,pepper:s,jwkAddress:a,uidKey:c="sub",proofFetchCallback:p,verificationKey:l}=e,{iss:h,aud:g,uidVal:d}=Ve({jwt:i,uidKey:c});return new r({address:t,proof:n,ephemeralKeyPair:o,iss:h,uidKey:c,uidVal:d,aud:g,pepper:s,jwkAddress:u.from(a),jwt:i,proofFetchCallback:p,verificationKeyHash:l?l.hash():void 0})}};var wr=class r{constructor(e){this.signingScheme=3;let{multiKey:t,address:n}=e,i=e.signers.map(a=>a instanceof Te?be.fromEd25519Account(a):a);if(t.signaturesRequired>i.length)throw new Error(`Not enough signers provided to satisfy the required signatures. Need ${t.signaturesRequired} signers, but only ${i.length} provided`);if(t.signaturesRequired<i.length)throw new Error(`More signers provided than required. Need ${t.signaturesRequired} signers, but ${i.length} provided`);this.publicKey=t,this.accountAddress=n?u.from(n):this.publicKey.authKey().derivedAddress();let o=[];for(let a of i)o.push(this.publicKey.getIndex(a.getAnyPublicKey()));let s=i.map((a,c)=>[a,o[c]]);s.sort((a,c)=>a[1]-c[1]),this.signers=s.map(a=>a[0]),this.signerIndicies=s.map(a=>a[1]),this.signaturesBitmap=this.publicKey.createBitmap({bits:o})}static fromPublicKeysAndSigners(e){let{publicKeys:t,signaturesRequired:n,signers:i}=e,o=new ke({publicKeys:t,signaturesRequired:n});return new r({multiKey:o,signers:i})}static isMultiKeySigner(e){return e instanceof r}signWithAuthenticator(e){return new ze(this.publicKey,this.sign(e))}signTransactionWithAuthenticator(e){return new ze(this.publicKey,this.signTransaction(e))}async waitForProofFetch(){let t=this.signers.filter(n=>n instanceof le).map(async n=>n.waitForProofFetch());await Promise.all(t)}async checkKeylessAccountValidity(e){let n=this.signers.filter(i=>i instanceof le).map(i=>i.checkKeylessAccountValidity(e));await Promise.all(n)}sign(e){let t=[];for(let n of this.signers)t.push(n.sign(e));return new He({signatures:t,bitmap:this.signaturesBitmap})}signTransaction(e){let t=[];for(let n of this.signers)t.push(n.signTransaction(e));return new He({signatures:t,bitmap:this.signaturesBitmap})}verifySignature(e){let{message:t,signature:n}=e;if(!this.signerIndicies.every((o,s)=>s===0||o>=this.signerIndicies[s-1]))return!1;for(let o=0;o<n.signatures.length;o+=1){let s=n.signatures[o];if(!this.publicKey.publicKeys[this.signerIndicies[o]].verifySignature({message:t,signature:s}))return!1}return!0}};function Eo(r){let e=r.deserializeUleb128AsU32();if(!Object.values(oe).includes(e))throw new Error(`Deserialization of Account failed: SigningScheme variant ${e} is invalid`);return{address:u.deserialize(r),signingScheme:e}}function Po(r,e){if(e.serializeStr(r.jwt),e.serializeStr(r.uidKey),e.serializeFixedBytes(r.pepper),r.ephemeralKeyPair.serialize(e),r.proof===void 0)throw new Error("Cannot serialize - proof undefined");r.proof.serialize(e),e.serializeOption(r.verificationKeyHash,32)}function vo(r){let e=r.deserializeStr(),t=r.deserializeStr(),n=r.deserializeFixedBytes(31),i=Rt.deserialize(r),o=ve.deserialize(r),s=r.deserializeOption("fixedBytes",32);return{jwt:e,uidKey:t,pepper:n,ephemeralKeyPair:i,proof:o,verificationKeyHash:s}}var Io;(h=>{function r(g){let d=new B;switch(d.serializeU32AsUleb128(g.signingScheme),g.accountAddress.serialize(d),g.signingScheme){case 0:return g.privateKey.serialize(d),d.toUint8Array();case 2:{if(!ai(g))throw new Error("Account is not a SingleKeySigner");let b=g.getAnyPublicKey();switch(d.serializeU32AsUleb128(b.variant),b.variant){case 3:return Po(g,d),d.toUint8Array();case 4:{let K=g;return Po(K,d),K.publicKey.jwkAddress.serialize(d),d.serializeBool(K.audless),d.toUint8Array()}case 1:case 0:return g.privateKey.serialize(d),d.toUint8Array();default:throw new Error(`Invalid public key variant: ${b.variant}`)}}case 3:{let b=g;return b.publicKey.serialize(d),d.serializeU32AsUleb128(b.signers.length),b.signers.forEach(K=>{d.serializeFixedBytes(r(K))}),d.toUint8Array()}default:throw new Error(`Deserialization of Account failed: invalid signingScheme value ${g.signingScheme}`)}}h.toBytes=r;function e(g){return m.hexInputToStringWithoutPrefix(r(g))}h.toHexStringWithoutPrefix=e;function t(g){return m.hexInputToString(r(g))}h.toHexString=t;function n(g){let{address:d,signingScheme:b}=Eo(g);switch(b){case 0:{let K=H.deserialize(g);return new Te({privateKey:K,address:d})}case 2:{let K=g.deserializeUleb128AsU32();switch(K){case 0:{let te=H.deserialize(g);return new be({privateKey:te,address:d})}case 1:{let te=Ge.deserialize(g);return new be({privateKey:te,address:d})}case 3:{let te=vo(g),dt=Ve(te);return new Xe({...te,...dt})}case 4:{let te=vo(g),dt=u.deserialize(g),Ut=g.deserializeBool(),kt=Ve(te);return new Kt({...te,...kt,jwkAddress:dt,audless:Ut})}default:throw new Error(`Unsupported public key variant ${K}`)}}case 3:{let K=ke.deserialize(g),te=g.deserializeUleb128AsU32(),dt=new Array;for(let Ut=0;Ut<te;Ut+=1){let kt=n(g);if(!ai(kt)&&!(kt instanceof Te))throw new Error("Deserialization of MultiKeyAccount failed. Signer is not a SingleKeySigner or Ed25519Account");dt.push(kt)}return new wr({multiKey:K,signers:dt,address:d})}default:throw new Error(`Deserialization of Account failed: invalid signingScheme value ${b}`)}}h.deserialize=n;function i(g){let d=p(g);if(!(d instanceof Xe))throw new Error("Deserialization of KeylessAccount failed");return d}h.keylessAccountFromHex=i;function o(g){let d=p(g);if(!(d instanceof Kt))throw new Error("Deserialization of FederatedKeylessAccount failed");return d}h.federatedKeylessAccountFromHex=o;function s(g){let d=p(g);if(!(d instanceof wr))throw new Error("Deserialization of MultiKeyAccount failed");return d}h.multiKeyAccountFromHex=s;function a(g){let d=p(g);if(!(d instanceof be))throw new Error("Deserialization of SingleKeyAccount failed");return d}h.singleKeyAccountFromHex=a;function c(g){let d=p(g);if(!(d instanceof Te))throw new Error("Deserialization of Ed25519Account failed");return d}h.ed25519AccountFromHex=c;function p(g){return n(D.fromHex(g))}h.fromHex=p;function l(g){return p(g)}h.fromBytes=l})(Io||(Io= exports.AccountUtils ={}));var Mc=`
|
|
3
|
+
Details: ${i}`),r instanceof Z?o+=`
|
|
4
|
+
AptosApiError: ${r.message}`:r!==void 0&&(o+=`
|
|
5
|
+
Error: ${_chunkRX5UBAMEjs.$.call(void 0, r)}`),o+=`
|
|
6
|
+
KeylessErrorResolutionTip: ${t}`,o}static fromErrorType(e){let{error:t,type:r,details:i}=e,[o,s,a]=Ao[r];return new n({message:o,details:i,innerError:t,category:s,resolutionTip:a,type:r})}},Z= exports.AptosApiError =class extends Error{constructor({apiType:e,aptosRequest:t,aptosResponse:r}){super(Dc({apiType:e,aptosRequest:t,aptosResponse:r})),this.name="AptosApiError",this.url=r.url,this.status=r.status,this.statusText=r.statusText,this.data=r.data,this.request=t}};function Dc({apiType:n,aptosRequest:e,aptosResponse:t}){let r=_optionalChain([t, 'access', _8 => _8.headers, 'optionalAccess', _9 => _9.traceparent, 'optionalAccess', _10 => _10.split, 'call', _11 => _11("-"), 'access', _12 => _12[1]]),i=r?`(trace_id:${r}) `:"",o=`Request to [${n}]: ${e.method} ${_nullishCoalesce(t.url, () => (e.url))} ${i}failed with`;return n==="Indexer"&&_optionalChain([t, 'access', _13 => _13.data, 'optionalAccess', _14 => _14.errors, 'optionalAccess', _15 => _15[0], 'optionalAccess', _16 => _16.message])!=null?`${o}: ${t.data.errors[0].message}`:_optionalChain([t, 'access', _17 => _17.data, 'optionalAccess', _18 => _18.message])!=null&&_optionalChain([t, 'access', _19 => _19.data, 'optionalAccess', _20 => _20.error_code])!=null?`${o}: ${JSON.stringify(t.data)}`:`${o} status: ${t.statusText}(code:${t.status}) and response body: ${zc(t.data)}`}var ei=400;function zc(n){let e=JSON.stringify(n);return e.length<=ei?e:`truncated(original_size:${e.length}): ${e.slice(0,ei/2)}...${e.slice(-ei/2)}`}async function kc(n,e){let{url:t,method:r,body:i,contentType:o,params:s,overrides:a,originMethod:c}=n,d={..._optionalChain([a, 'optionalAccess', _21 => _21.HEADERS]),"x-aptos-client":`aptos-typescript-sdk/${Qr}`,"content-type":_nullishCoalesce(o, () => ("application/json")),"x-aptos-typescript-sdk-origin-method":c};return _optionalChain([a, 'optionalAccess', _22 => _22.AUTH_TOKEN])&&(d.Authorization=`Bearer ${_optionalChain([a, 'optionalAccess', _23 => _23.AUTH_TOKEN])}`),_optionalChain([a, 'optionalAccess', _24 => _24.API_KEY])&&(d.Authorization=`Bearer ${_optionalChain([a, 'optionalAccess', _25 => _25.API_KEY])}`),e.provider({url:t,method:r,body:i,params:s,headers:d,overrides:a})}async function Oc(n,e){if(e.binaryProvider===void 0)throw new Error("Binary provider is not provided");let{url:t,method:r,body:i,contentType:o,acceptType:s,params:a,overrides:c,originMethod:d}=n,l={..._optionalChain([c, 'optionalAccess', _26 => _26.HEADERS]),"x-aptos-client":`aptos-typescript-sdk/${Qr}`,"content-type":_nullishCoalesce(o, () => ("application/json")),accept:_nullishCoalesce(s, () => ("application/x-bcs")),"x-aptos-typescript-sdk-origin-method":d};return _optionalChain([c, 'optionalAccess', _27 => _27.AUTH_TOKEN])&&(l.Authorization=`Bearer ${_optionalChain([c, 'optionalAccess', _28 => _28.AUTH_TOKEN])}`),_optionalChain([c, 'optionalAccess', _29 => _29.API_KEY])&&(l.Authorization=`Bearer ${_optionalChain([c, 'optionalAccess', _30 => _30.API_KEY])}`),e.binaryProvider({acceptType:"application/x-bcs",url:t,method:r,body:i,params:a,headers:l,overrides:c})}async function rr(n,e,t){let{url:r,path:i}=n,o=i?`${r}/${i}`:r,s=await kc({...n,url:o},e.client),a={status:s.status,statusText:_nullishCoalesce(s.statusText, () => ("No status text provided")),data:s.data,headers:s.headers,config:s.config,request:s.request,url:o};if(a.status===401)throw new Z({apiType:t,aptosRequest:n,aptosResponse:a});if(t==="Indexer"){let c=a.data;if(c.errors)throw new Z({apiType:t,aptosRequest:n,aptosResponse:a});a.data=c.data}else if((t==="Pepper"||t==="Prover")&&a.status>=400)throw new Z({apiType:t,aptosRequest:n,aptosResponse:a});if(a.status>=200&&a.status<300)return a;throw new Z({apiType:t,aptosRequest:n,aptosResponse:a})}async function ir(n,e,t){let{url:r,path:i}=n,o=i?`${r}/${i}`:r,s=await Oc({...n,url:o},e.client),a={status:s.status,statusText:_nullishCoalesce(s.statusText, () => ("No status text provided")),data:s.data,headers:s.headers,config:s.config,request:s.request,url:o};if(a.status===401)throw new Z({apiType:t,aptosRequest:n,aptosResponse:a});if(t==="Indexer"){let c=a.data;if(c.errors)throw new Z({apiType:t,aptosRequest:n,aptosResponse:a});a.data=c.data}else if((t==="Pepper"||t==="Prover")&&a.status>=400)throw new Z({apiType:t,aptosRequest:n,aptosResponse:a});if(a.status>=200&&a.status<300)return a;throw new Z({apiType:t,aptosRequest:n,aptosResponse:a})}async function or(n){let{aptosConfig:e,overrides:t,params:r,contentType:i,acceptType:o,path:s,originMethod:a,type:c}=n,d=e.getRequestUrl(c);return rr({url:d,method:"GET",originMethod:a,path:s,contentType:i,acceptType:o,params:r,overrides:{...e.clientConfig,...t}},e,n.type)}async function Fc(n){let{aptosConfig:e,overrides:t,params:r,contentType:i,acceptType:o,path:s,originMethod:a,type:c}=n,d=e.getRequestUrl(c);return ir({url:d,method:"GET",originMethod:a,path:s,contentType:i,acceptType:o,params:r,overrides:{...e.clientConfig,...t}},e,n.type)}async function L(n){let{aptosConfig:e}=n;return or({...n,type:"Fullnode",overrides:{...e.clientConfig,...e.fullnodeConfig,...n.overrides,HEADERS:{..._optionalChain([e, 'access', _31 => _31.clientConfig, 'optionalAccess', _32 => _32.HEADERS]),..._optionalChain([e, 'access', _33 => _33.fullnodeConfig, 'optionalAccess', _34 => _34.HEADERS])}}})}async function Nl(n){let{aptosConfig:e}=n;return Fc({...n,type:"Fullnode",overrides:{...e.clientConfig,...e.fullnodeConfig,...n.overrides,HEADERS:{..._optionalChain([e, 'access', _35 => _35.clientConfig, 'optionalAccess', _36 => _36.HEADERS]),..._optionalChain([e, 'access', _37 => _37.fullnodeConfig, 'optionalAccess', _38 => _38.HEADERS])}}})}async function Gl(n){return or({...n,type:"Pepper"})}async function sr(n){let e=[],t,r=n.params;do{let i=await or({type:"Fullnode",aptosConfig:n.aptosConfig,originMethod:n.originMethod,path:n.path,params:r,overrides:n.overrides});t=i.headers["x-aptos-cursor"],delete i.headers,e.push(...i.data),r.start=t}while(t!=null);return e}async function ti(n){let e=[],t,r=n.params,i=r.limit;do{let o=await or({type:"Fullnode",aptosConfig:n.aptosConfig,originMethod:n.originMethod,path:n.path,params:r,overrides:n.overrides});if(t=o.headers["x-aptos-cursor"],delete o.headers,e.push(...o.data),r.offset=t,i!==void 0){let s=i-e.length;if(s<=0)break;r.limit=s}}while(t!=null);return e}async function gn(n){let{type:e,originMethod:t,path:r,body:i,acceptType:o,contentType:s,params:a,aptosConfig:c,overrides:d}=n,l=c.getRequestUrl(e);return rr({url:l,method:"POST",originMethod:t,path:r,body:i,contentType:s,acceptType:o,params:a,overrides:d},c,n.type)}async function Nc(n){let{type:e,originMethod:t,path:r,body:i,acceptType:o,contentType:s,params:a,aptosConfig:c,overrides:d}=n,l=c.getRequestUrl(e);return ir({url:l,method:"POST",originMethod:t,path:r,body:i,contentType:s,acceptType:o,params:a,overrides:d},c,n.type)}async function st(n){let{aptosConfig:e}=n;return gn({...n,type:"Fullnode",overrides:{...e.clientConfig,...e.fullnodeConfig,...n.overrides,HEADERS:{..._optionalChain([e, 'access', _39 => _39.clientConfig, 'optionalAccess', _40 => _40.HEADERS]),..._optionalChain([e, 'access', _41 => _41.fullnodeConfig, 'optionalAccess', _42 => _42.HEADERS])}}})}async function ho(n){let{aptosConfig:e}=n;return Nc({...n,type:"Fullnode",overrides:{...e.clientConfig,...e.fullnodeConfig,...n.overrides,HEADERS:{..._optionalChain([e, 'access', _43 => _43.clientConfig, 'optionalAccess', _44 => _44.HEADERS]),..._optionalChain([e, 'access', _45 => _45.fullnodeConfig, 'optionalAccess', _46 => _46.HEADERS])}}})}async function To(n){let{aptosConfig:e}=n;return gn({...n,type:"Indexer",overrides:{...e.clientConfig,...e.indexerConfig,...n.overrides,HEADERS:{..._optionalChain([e, 'access', _47 => _47.clientConfig, 'optionalAccess', _48 => _48.HEADERS]),..._optionalChain([e, 'access', _49 => _49.indexerConfig, 'optionalAccess', _50 => _50.HEADERS])}}})}async function bo(n){let{aptosConfig:e}=n,t={...e,clientConfig:{...e.clientConfig}};return _optionalChainDelete([t, 'optionalAccess', _51 => _51.clientConfig, 'optionalAccess', _52 => delete _52.API_KEY]),gn({...n,type:"Faucet",overrides:{...t.clientConfig,...t.faucetConfig,...n.overrides,HEADERS:{..._optionalChain([t, 'access', _53 => _53.clientConfig, 'optionalAccess', _54 => _54.HEADERS]),..._optionalChain([t, 'access', _55 => _55.faucetConfig, 'optionalAccess', _56 => _56.HEADERS])}}})}async function wo(n){return gn({...n,type:"Pepper"})}async function So(n){return gn({...n,type:"Prover"})}var ni=new Map;function Ke(n,e,t){return async(...r)=>{if(ni.has(e)){let{value:o,timestamp:s}=ni.get(e);if(t===void 0||Date.now()-s<=t)return o}let i=await n(...r);return ni.set(e,{value:i,timestamp:Date.now()}),i}}var hg=1e7,Bc= exports.MAX_AUD_VAL_BYTES =120,Mc= exports.MAX_UID_KEY_BYTES =30,Vc= exports.MAX_UID_VAL_BYTES =330,Tg= exports.MAX_ISS_VAL_BYTES =120,bg= exports.MAX_EXTRA_FIELD_BYTES =350,wg= exports.MAX_JWT_HEADER_B64_BYTES =300,Sg= exports.MAX_COMMITED_EPK_BYTES =93,Re=class Re extends oe{constructor(e,t){super();let r=_chunkRX5UBAMEjs.j.fromHexInput(t).toUint8Array();if(r.length!==Re.ID_COMMITMENT_LENGTH)throw new Error(`Id Commitment length in bytes should be ${Re.ID_COMMITMENT_LENGTH}`);this.iss=e,this.idCommitment=r}authKey(){let e=new _chunkRX5UBAMEjs.m;return e.serializeU32AsUleb128(3),e.serializeFixedBytes(this.bcsToBytes()),B.fromSchemeAndBytes({scheme:2,input:e.toUint8Array()})}verifySignature(e){throw new Error("Not yet implemented")}serialize(e){e.serializeStr(this.iss),e.serializeBytes(this.idCommitment)}static deserialize(e){let t=e.deserializeStr(),r=e.deserializeBytes();return new Re(t,r)}static load(e){let t=e.deserializeStr(),r=e.deserializeBytes();return new Re(t,r)}static isPublicKey(e){return e instanceof Re}static create(e){return _o(e),new Re(e.iss,_o(e))}static fromJwtAndPepper(e){let{jwt:t,pepper:r,uidKey:i="sub"}=e,o=_jwtdecode.jwtDecode.call(void 0, t);if(typeof o.iss!="string")throw new Error("iss was not found");if(typeof o.aud!="string")throw new Error("aud was not found or an array of values");let s=o[i];return Re.create({iss:o.iss,uidKey:i,uidVal:s,aud:o.aud,pepper:r})}static isInstance(e){return"iss"in e&&typeof e.iss=="string"&&"idCommitment"in e&&e.idCommitment instanceof Uint8Array}};Re.ID_COMMITMENT_LENGTH=32;var k=Re;function _o(n){let{uidKey:e,uidVal:t,aud:r,pepper:i}=n,o=[pn(_chunkRX5UBAMEjs.j.fromHexInput(i).toUint8Array()),Zn(r,Bc),Zn(t,Vc),Zn(e,Mc)];return so(ln(o),k.ID_COMMITMENT_LENGTH)}var Ve=class n extends M{constructor(e){super();let{jwtHeader:t,ephemeralCertificate:r,expiryDateSecs:i,ephemeralPublicKey:o,ephemeralSignature:s}=e;this.jwtHeader=t,this.ephemeralCertificate=r,this.expiryDateSecs=i,this.ephemeralPublicKey=o,this.ephemeralSignature=s}getJwkKid(){return Hc(this.jwtHeader).kid}serialize(e){this.ephemeralCertificate.serialize(e),e.serializeStr(this.jwtHeader),e.serializeU64(this.expiryDateSecs),this.ephemeralPublicKey.serialize(e),this.ephemeralSignature.serialize(e)}static deserialize(e){let t=Gt.deserialize(e),r=e.deserializeStr(),i=e.deserializeU64(),o=ft.deserialize(e),s=Ce.deserialize(e);return new n({jwtHeader:r,expiryDateSecs:Number(i),ephemeralCertificate:t,ephemeralPublicKey:o,ephemeralSignature:s})}static getSimulationSignature(){return new n({jwtHeader:"{}",ephemeralCertificate:new Gt(new Pe({proof:new Mt(new Bt({a:new Uint8Array(32),b:new Uint8Array(64),c:new Uint8Array(32)}),0),expHorizonSecs:0}),0),expiryDateSecs:0,ephemeralPublicKey:new ft(new x(new Uint8Array(32))),ephemeralSignature:new Ce(new I(new Uint8Array(64)))})}static isSignature(e){return e instanceof n}},Gt= exports.EphemeralCertificate =class n extends M{constructor(e,t){super(),this.signature=e,this.variant=t}toUint8Array(){return this.signature.toUint8Array()}serialize(e){e.serializeU32AsUleb128(this.variant),this.signature.serialize(e)}static deserialize(e){let t=e.deserializeUleb128AsU32();switch(t){case 0:return new n(Pe.deserialize(e),t);default:throw new Error(`Unknown variant index for EphemeralCertificate: ${t}`)}}},Me=class n extends _chunkRX5UBAMEjs.l{constructor(e){if(super(),this.data=_chunkRX5UBAMEjs.j.fromHexInput(e).toUint8Array(),this.data.length!==32)throw new Error("Input needs to be 32 bytes")}serialize(e){e.serializeFixedBytes(this.data)}static deserialize(e){let t=e.deserializeFixedBytes(32);return new n(t)}},Tt=class n extends _chunkRX5UBAMEjs.l{constructor(e){if(super(),this.data=_chunkRX5UBAMEjs.j.fromHexInput(e).toUint8Array(),this.data.length!==64)throw new Error("Input needs to be 64 bytes")}serialize(e){e.serializeFixedBytes(this.data)}static deserialize(e){let t=e.deserializeFixedBytes(64);return new n(t)}},Bt= exports.Groth16Zkp =class n extends er{constructor(e){super();let{a:t,b:r,c:i}=e;this.a=new Me(t),this.b=new Tt(r),this.c=new Me(i)}serialize(e){this.a.serialize(e),this.b.serialize(e),this.c.serialize(e)}static deserialize(e){let t=Me.deserialize(e).bcsToBytes(),r=Tt.deserialize(e).bcsToBytes(),i=Me.deserialize(e).bcsToBytes();return new n({a:t,b:r,c:i})}},Mt= exports.ZkProof =class n extends _chunkRX5UBAMEjs.l{constructor(e,t){super(),this.proof=e,this.variant=t}serialize(e){e.serializeU32AsUleb128(this.variant),this.proof.serialize(e)}static deserialize(e){let t=e.deserializeUleb128AsU32();switch(t){case 0:return new n(Bt.deserialize(e),t);default:throw new Error(`Unknown variant index for ZkProof: ${t}`)}}},Pe= exports.ZeroKnowledgeSig =class n extends M{constructor(e){super();let{proof:t,expHorizonSecs:r,trainingWheelsSignature:i,extraField:o,overrideAudVal:s}=e;this.proof=t,this.expHorizonSecs=r,this.trainingWheelsSignature=i,this.extraField=o,this.overrideAudVal=s}static fromBytes(e){return n.deserialize(new C(e))}serialize(e){this.proof.serialize(e),e.serializeU64(this.expHorizonSecs),e.serializeOption(this.extraField),e.serializeOption(this.overrideAudVal),e.serializeOption(this.trainingWheelsSignature)}static deserialize(e){let t=Mt.deserialize(e),r=Number(e.deserializeU64()),i=e.deserializeOption("string"),o=e.deserializeOption("string"),s=e.deserializeOption(Ce);return new n({proof:t,expHorizonSecs:r,trainingWheelsSignature:s,extraField:i,overrideAudVal:o})}},ri= exports.KeylessConfiguration =class n{constructor(e,t){this.verificationKey=e,this.maxExpHorizonSecs=t}static create(e,t){return new n(new ii({alphaG1:e.alpha_g1,betaG2:e.beta_g2,deltaG2:e.delta_g2,gammaAbcG1:e.gamma_abc_g1,gammaG2:e.gamma_g2}),t)}},ii= exports.Groth16VerificationKey =class n{constructor(e){let{alphaG1:t,betaG2:r,deltaG2:i,gammaAbcG1:o,gammaG2:s}=e;this.alphaG1=new Me(t),this.betaG2=new Tt(r),this.deltaG2=new Tt(i),this.gammaAbcG1=[new Me(o[0]),new Me(o[1])],this.gammaG2=new Tt(s)}hash(){let e=new _chunkRX5UBAMEjs.m;return this.serialize(e),_sha3.sha3_256.create().update(e.toUint8Array()).digest()}serialize(e){this.alphaG1.serialize(e),this.betaG2.serialize(e),this.deltaG2.serialize(e),this.gammaAbcG1[0].serialize(e),this.gammaAbcG1[1].serialize(e),this.gammaG2.serialize(e)}static fromGroth16VerificationKeyResponse(e){return new n({alphaG1:e.alpha_g1,betaG2:e.beta_g2,deltaG2:e.delta_g2,gammaAbcG1:e.gamma_abc_g1,gammaG2:e.gamma_g2})}};async function mn(n){let{aptosConfig:e}=n;try{return await Ke(async()=>{let t=await qc(n),r=await Lc(n);return ri.create(r,Number(t.max_exp_horizon_secs))},`keyless-configuration-${e.network}`,1e3*60*5)()}catch(t){throw t instanceof D?t:D.fromErrorType({type:25,error:t})}}function qe(n){let{jwt:e,uidKey:t="sub"}=n,r;try{r=_jwtdecode.jwtDecode.call(void 0, e)}catch(o){throw D.fromErrorType({type:12,details:`Failed to parse JWT - ${_chunkRX5UBAMEjs.$.call(void 0, o)}`})}if(typeof r.iss!="string")throw D.fromErrorType({type:12,details:"JWT is missing 'iss' in the payload. This should never happen."});if(typeof r.aud!="string")throw D.fromErrorType({type:12,details:"JWT is missing 'aud' in the payload or 'aud' is an array of values."});let i=r[t];return{iss:r.iss,aud:r.aud,uidVal:i}}async function qc(n){let{aptosConfig:e,options:t}=n,r="0x1::keyless_account::Configuration";try{let{data:i}=await L({aptosConfig:e,originMethod:"getKeylessConfigurationResource",path:`accounts/${_chunkRX5UBAMEjs.Z.from("0x1").toString()}/resource/${r}`,params:{ledger_version:_optionalChain([t, 'optionalAccess', _57 => _57.ledgerVersion])}});return i.data}catch(i){throw D.fromErrorType({type:22,error:i})}}async function Lc(n){let{aptosConfig:e,options:t}=n,r="0x1::keyless_account::Groth16VerificationKey";try{let{data:i}=await L({aptosConfig:e,originMethod:"getGroth16VerificationKeyResource",path:`accounts/${_chunkRX5UBAMEjs.Z.from("0x1").toString()}/resource/${r}`,params:{ledger_version:_optionalChain([t, 'optionalAccess', _58 => _58.ledgerVersion])}});return i.data}catch(i){throw D.fromErrorType({type:23,error:i})}}async function Po(n){let{aptosConfig:e,jwkAddr:t,options:r}=n,i;if(t){let s="0x1::jwks::FederatedJWKs",{data:a}=await L({aptosConfig:e,originMethod:"getKeylessJWKs",path:`accounts/${_chunkRX5UBAMEjs.Z.from(t).toString()}/resource/${s}`,params:{ledger_version:_optionalChain([r, 'optionalAccess', _59 => _59.ledgerVersion])}});i=a}else{let s="0x1::jwks::PatchedJWKs",{data:a}=await L({aptosConfig:e,originMethod:"getKeylessJWKs",path:`accounts/0x1/resource/${s}`,params:{ledger_version:_optionalChain([r, 'optionalAccess', _60 => _60.ledgerVersion])}});i=a}let o=new Map;for(let s of i.data.jwks.entries){let a=[];for(let c of s.jwks){let{data:d}=c.variant,l=new C(_chunkRX5UBAMEjs.j.fromHexInput(d).toUint8Array()),h=oi.deserialize(l);a.push(h)}o.set(_chunkRX5UBAMEjs.k.call(void 0, s.issuer),a)}return o}var oi=class n extends _chunkRX5UBAMEjs.l{constructor(e){super();let{kid:t,kty:r,alg:i,e:o,n:s}=e;this.kid=t,this.kty=r,this.alg=i,this.e=o,this.n=s}serialize(e){e.serializeStr(this.kid),e.serializeStr(this.kty),e.serializeStr(this.alg),e.serializeStr(this.e),e.serializeStr(this.n)}static fromMoveStruct(e){let{data:t}=e.variant,r=new C(_chunkRX5UBAMEjs.j.fromHexInput(t).toUint8Array());return n.deserialize(r)}static deserialize(e){let t=e.deserializeStr(),r=e.deserializeStr(),i=e.deserializeStr(),o=e.deserializeStr(),s=e.deserializeStr();return new n({kid:t,kty:r,alg:i,n:o,e:s})}};function Hc(n){try{let e=JSON.parse(n);if(e.kid===void 0)throw new Error("JWT header missing kid");return e}catch (e2){throw new Error("Failed to parse JWT header.")}}var ne=class n extends oe{constructor(e,t){super(),this.jwkAddress=_chunkRX5UBAMEjs.Z.from(e),this.keylessPublicKey=t}authKey(){let e=new _chunkRX5UBAMEjs.m;return e.serializeU32AsUleb128(4),e.serializeFixedBytes(this.bcsToBytes()),B.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=_chunkRX5UBAMEjs.Z.deserialize(e),r=k.deserialize(e);return new n(t,r)}static isPublicKey(e){return e instanceof n}static create(e){return new n(e.jwkAddress,k.create(e))}static fromJwtAndPepper(e){return new n(e.jwkAddress,k.fromJwtAndPepper(e))}static isInstance(e){return"jwkAddress"in e&&e.jwkAddress instanceof _chunkRX5UBAMEjs.Z&&"keylessPublicKey"in e&&e.keylessPublicKey instanceof k}};var O=class n extends oe{constructor(e){if(super(),this.publicKey=e,e instanceof x)this.variant=0;else if(e instanceof Ne)this.variant=1;else if(e instanceof k)this.variant=3;else if(e instanceof ne)this.variant=4;else throw new Error("Unsupported public key type")}verifySignature(e){let{message:t,signature:r}=e;return H.isInstance(r)?this.publicKey.verifySignature({message:t,signature:r.signature}):!1}authKey(){return B.fromSchemeAndBytes({scheme:2,input:this.toUint8Array()})}toUint8Array(){return this.bcsToBytes()}serialize(e){e.serializeU32AsUleb128(this.variant),this.publicKey.serialize(e)}static deserialize(e){let t=e.deserializeUleb128AsU32(),r;switch(t){case 0:r=x.deserialize(e);break;case 1:r=Ne.deserialize(e);break;case 3:r=k.deserialize(e);break;case 4:r=ne.deserialize(e);break;default:throw new Error(`Unknown variant index for AnyPublicKey: ${t}`)}return new n(r)}static isPublicKey(e){return e instanceof n}isEd25519(){return this.publicKey instanceof x}isSecp256k1PublicKey(){return this.publicKey instanceof Ne}static isInstance(e){return"publicKey"in e&&"variant"in e}},H= exports.AnySignature =class n extends M{constructor(e){if(super(),this.signature=e,e instanceof I)this.variant=0;else if(e instanceof yt)this.variant=1;else if(e instanceof Ve)this.variant=3;else throw new Error("Unsupported signature type")}toUint8Array(){return console.warn("[Aptos SDK] Calls to AnySignature.toUint8Array() will soon return the underlying signature bytes. Use AnySignature.bcsToBytes() instead."),this.bcsToBytes()}serialize(e){e.serializeU32AsUleb128(this.variant),this.signature.serialize(e)}static deserialize(e){let t=e.deserializeUleb128AsU32(),r;switch(t){case 0:r=I.deserialize(e);break;case 1:r=yt.deserialize(e);break;case 3:r=Ve.deserialize(e);break;default:throw new Error(`Unknown variant index for AnySignature: ${t}`)}return new n(r)}static isInstance(e){return"signature"in e&&typeof e.signature=="object"&&e.signature!==null&&"toUint8Array"in e.signature}};function $c(n){let e=n;return e-=e>>1&1431655765,e=(e&858993459)+(e>>2&858993459),(e+(e>>4)&252645135)*16843009>>24}var yn=class extends oe{constructor(e){super(),this.publicKeys=e.publicKeys}createBitmap(e){let{bits:t}=e,r=128,i=new Uint8Array([0,0,0,0]),o=new Set;return t.forEach((s,a)=>{if(a+1>this.publicKeys.length)throw new Error(`Signature index ${a+1} is out of public keys range, ${this.publicKeys.length}.`);if(o.has(s))throw new Error(`Duplicate bit ${s} detected.`);o.add(s);let c=Math.floor(s/8),d=i[c];d|=r>>s%8,i[c]=d}),i}getIndex(e){let t=this.publicKeys.findIndex(r=>r.toString()===e.toString());if(t!==-1)return t;throw new Error(`Public key ${e} not found in multi key set ${this.publicKeys}`)}},Ue= exports.MultiKey =class n extends yn{constructor(e){let{publicKeys:t,signaturesRequired:r}=e;if(super({publicKeys:t}),r<1)throw new Error("The number of required signatures needs to be greater than 0");if(t.length<r)throw new Error(`Provided ${t.length} public keys is smaller than the ${r} required signatures`);this.publicKeys=t.map(i=>i instanceof O?i:new O(i)),this.signaturesRequired=r}verifySignature(e){throw new Error("not implemented")}authKey(){return B.fromSchemeAndBytes({scheme:3,input:this.toUint8Array()})}serialize(e){e.serializeVector(this.publicKeys),e.serializeU8(this.signaturesRequired)}static deserialize(e){let t=e.deserializeVector(O),r=e.deserializeU8();return new n({publicKeys:t,signaturesRequired:r})}getIndex(e){let t=e instanceof O?e:new O(e);return super.getIndex(t)}static isInstance(e){return"publicKeys"in e&&"signaturesRequired"in e}},ue=class ue extends M{constructor(e){super();let{signatures:t,bitmap:r}=e;if(t.length>ue.MAX_SIGNATURES_SUPPORTED)throw new Error(`The number of signatures cannot be greater than ${ue.MAX_SIGNATURES_SUPPORTED}`);if(this.signatures=t.map(o=>o instanceof H?o:new H(o)),!(r instanceof Uint8Array))this.bitmap=ue.createBitmap({bits:r});else{if(r.length!==ue.BITMAP_LEN)throw new Error(`"bitmap" length should be ${ue.BITMAP_LEN}`);this.bitmap=r}let i=this.bitmap.reduce((o,s)=>o+$c(s),0);if(i!==this.signatures.length)throw new Error(`Expecting ${i} signatures from the bitmap, but got ${this.signatures.length}`)}static createBitmap(e){let{bits:t}=e,r=128,i=new Uint8Array([0,0,0,0]),o=new Set;return t.forEach(s=>{if(s>=ue.MAX_SIGNATURES_SUPPORTED)throw new Error(`Cannot have a signature larger than ${ue.MAX_SIGNATURES_SUPPORTED-1}.`);if(o.has(s))throw new Error("Duplicate bits detected.");o.add(s);let a=Math.floor(s/8),c=i[a];c|=r>>s%8,i[a]=c}),i}serialize(e){e.serializeVector(this.signatures),e.serializeBytes(this.bitmap)}static deserialize(e){let t=e.deserializeVector(H),r=e.deserializeBytes();return new ue({signatures:t,bitmap:r})}};ue.BITMAP_LEN=4,ue.MAX_SIGNATURES_SUPPORTED=ue.BITMAP_LEN*8;var Le=ue;var fe=class fe extends yn{constructor(e){let{publicKeys:t,threshold:r}=e;if(super({publicKeys:t}),t.length>fe.MAX_KEYS||t.length<fe.MIN_KEYS)throw new Error(`Must have between ${fe.MIN_KEYS} and ${fe.MAX_KEYS} public keys, inclusive`);if(r<fe.MIN_THRESHOLD||r>t.length)throw new Error(`Threshold must be between ${fe.MIN_THRESHOLD} and ${t.length}, inclusive`);this.publicKeys=t,this.threshold=r}verifySignature(e){let{message:t,signature:r}=e;if(!(r instanceof He))return!1;let i=[];for(let o=0;o<4;o+=1)for(let s=0;s<8;s+=1)if((r.bitmap[o]&1<<7-s)!==0){let c=o*8+s;i.push(c)}if(i.length!==r.signatures.length)throw new Error("Bitmap and signatures length mismatch");if(i.length<this.threshold)throw new Error("Not enough signatures");for(let o=0;o<i.length;o+=1)if(!this.publicKeys[i[o]].verifySignature({message:t,signature:r.signatures[o]}))return!1;return!0}authKey(){return B.fromSchemeAndBytes({scheme:1,input:this.toUint8Array()})}toUint8Array(){let e=new Uint8Array(this.publicKeys.length*x.LENGTH+1);return this.publicKeys.forEach((t,r)=>{e.set(t.toUint8Array(),r*x.LENGTH)}),e[this.publicKeys.length*x.LENGTH]=this.threshold,e}serialize(e){e.serializeBytes(this.toUint8Array())}static deserialize(e){let t=e.deserializeBytes(),r=t[t.length-1],i=[];for(let o=0;o<t.length-1;o+=x.LENGTH){let s=o;i.push(new x(t.subarray(s,s+x.LENGTH)))}return new fe({publicKeys:i,threshold:r})}getIndex(e){return super.getIndex(e)}};fe.MAX_KEYS=32,fe.MIN_KEYS=2,fe.MIN_THRESHOLD=1;var Vt=fe,de=class de extends M{constructor(e){super();let{signatures:t,bitmap:r}=e;if(t.length>de.MAX_SIGNATURES_SUPPORTED)throw new Error(`The number of signatures cannot be greater than ${de.MAX_SIGNATURES_SUPPORTED}`);if(this.signatures=t,!(r instanceof Uint8Array))this.bitmap=de.createBitmap({bits:r});else{if(r.length!==de.BITMAP_LEN)throw new Error(`"bitmap" length should be ${de.BITMAP_LEN}`);this.bitmap=r}}toUint8Array(){let e=new Uint8Array(this.signatures.length*I.LENGTH+de.BITMAP_LEN);return this.signatures.forEach((t,r)=>{e.set(t.toUint8Array(),r*I.LENGTH)}),e.set(this.bitmap,this.signatures.length*I.LENGTH),e}serialize(e){e.serializeBytes(this.toUint8Array())}static deserialize(e){let t=e.deserializeBytes(),r=t.subarray(t.length-4),i=[];for(let o=0;o<t.length-r.length;o+=I.LENGTH){let s=o;i.push(new I(t.subarray(s,s+I.LENGTH)))}return new de({signatures:i,bitmap:r})}static createBitmap(e){let{bits:t}=e,r=128,i=new Uint8Array([0,0,0,0]),o=new Set;return t.forEach((s,a)=>{if(s>=de.MAX_SIGNATURES_SUPPORTED)throw new Error(`Cannot have a signature larger than ${de.MAX_SIGNATURES_SUPPORTED-1}.`);if(o.has(s))throw new Error("Duplicate bits detected.");if(a>0&&s<=t[a-1])throw new Error("The bits need to be sorted in ascending order.");o.add(s);let c=Math.floor(s/8),d=i[c];d|=r>>s%8,i[c]=d}),i}};de.MAX_SIGNATURES_SUPPORTED=32,de.BITMAP_LEN=4;var He=de;var ar=(n,e)=>{let t=n.bcsToBytes(),r=typeof e=="string"?Buffer.from(e,"utf8"):e,i=new Uint8Array([...t,...r,254]);return new (0, _chunkRX5UBAMEjs.Z)(_sha3.sha3_256.call(void 0, i))},Im= exports.createResourceAddress =(n,e)=>{let t=n.bcsToBytes(),r=typeof e=="string"?Buffer.from(e,"utf8"):e,i=new Uint8Array([...t,...r,255]);return new (0, _chunkRX5UBAMEjs.Z)(_sha3.sha3_256.call(void 0, i))},vm= exports.createTokenAddress =(n,e,t)=>{let r=`${e}::${t}`;return ar(n,r)};var Q=class extends _chunkRX5UBAMEjs.l{static deserialize(e){let t=e.deserializeUleb128AsU32();switch(t){case 0:return xe.load(e);case 1:return $e.load(e);case 2:return se.load(e);case 3:return De.load(e);case 4:return qt.load(e);case 5:return fn.load(e);default:throw new Error(`Unknown variant index for AccountAuthenticator: ${t}`)}}isEd25519(){return this instanceof xe}isMultiEd25519(){return this instanceof $e}isSingleKey(){return this instanceof se}isMultiKey(){return this instanceof De}},xe= exports.AccountAuthenticatorEd25519 =class n extends Q{constructor(e,t){super(),this.public_key=e,this.signature=t}serialize(e){e.serializeU32AsUleb128(0),this.public_key.serialize(e),this.signature.serialize(e)}static load(e){let t=x.deserialize(e),r=I.deserialize(e);return new n(t,r)}},$e= exports.AccountAuthenticatorMultiEd25519 =class n extends Q{constructor(e,t){super(),this.public_key=e,this.signature=t}serialize(e){e.serializeU32AsUleb128(1),this.public_key.serialize(e),this.signature.serialize(e)}static load(e){let t=Vt.deserialize(e),r=He.deserialize(e);return new n(t,r)}},se= exports.AccountAuthenticatorSingleKey =class n extends Q{constructor(e,t){super(),this.public_key=e,this.signature=t}serialize(e){e.serializeU32AsUleb128(2),this.public_key.serialize(e),this.signature.serialize(e)}static load(e){let t=O.deserialize(e),r=H.deserialize(e);return new n(t,r)}},De= exports.AccountAuthenticatorMultiKey =class n extends Q{constructor(e,t){super(),this.public_keys=e,this.signatures=t}serialize(e){e.serializeU32AsUleb128(3),this.public_keys.serialize(e),this.signatures.serialize(e)}static load(e){let t=Ue.deserialize(e),r=Le.deserialize(e);return new n(t,r)}},qt= exports.AccountAuthenticatorNoAccountAuthenticator =class n extends Q{serialize(e){e.serializeU32AsUleb128(4)}static load(e){return new n}},fn= exports.AccountAuthenticatorAbstraction =class n extends Q{constructor(e,t,r){if(super(),!_chunkRX5UBAMEjs.ia.call(void 0, e))throw new Error(`Invalid function info ${e} passed into AccountAuthenticatorAbstraction`);this.functionInfo=e,this.authenticator=_chunkRX5UBAMEjs.j.fromHexInput(r),this.signingMessageDigest=_chunkRX5UBAMEjs.j.fromHexInput(_chunkRX5UBAMEjs.j.fromHexInput(t).toUint8Array())}serialize(e){e.serializeU32AsUleb128(5);let{moduleAddress:t,moduleName:r,functionName:i}=_chunkRX5UBAMEjs.ha.call(void 0, this.functionInfo);_chunkRX5UBAMEjs.Z.fromString(t).serialize(e),e.serializeStr(r),e.serializeStr(i),e.serializeU32AsUleb128(0),e.serializeBytes(this.signingMessageDigest.toUint8Array()),e.serializeFixedBytes(this.authenticator.toUint8Array())}static load(e){let t=_chunkRX5UBAMEjs.Z.deserialize(e),r=e.deserializeStr(),i=e.deserializeStr(),o=e.deserializeUleb128AsU32();if(o===0){let s=e.deserializeBytes(),a=e.deserializeFixedBytes(e.remaining());return new n(`${t}::${r}::${i}`,s,a)}throw new Error(`Unknown variant index for AccountAuthenticatorAbstraction: ${o}`)}};var Lt=class n extends _chunkRX5UBAMEjs.l{constructor(e){super(),this.chainId=e}serialize(e){e.serializeU8(this.chainId)}static deserialize(e){let t=e.deserializeU8();return new n(t)}};var K=class n extends _chunkRX5UBAMEjs.l{constructor(e){super(),this.identifier=e}serialize(e){e.serializeStr(this.identifier)}static deserialize(e){let t=e.deserializeStr();return new n(t)}};var An=class n extends _chunkRX5UBAMEjs.l{constructor(e,t){super(),this.address=e,this.name=t}static fromStr(e){let t=e.split("::");if(t.length!==2)throw new Error("Invalid module id.");return new n(_chunkRX5UBAMEjs.Z.fromString(t[0]),new K(t[1]))}serialize(e){this.address.serialize(e),this.name.serialize(e)}static deserialize(e){let t=_chunkRX5UBAMEjs.Z.deserialize(e),r=K.deserialize(e);return new n(t,r)}};var N=class n extends _chunkRX5UBAMEjs.l{deserialize(e){let t=_chunkRX5UBAMEjs.Z.deserialize(e),r=K.deserialize(e),i=K.deserialize(e),o=e.deserializeVector(n);return new ze(t,r,i,o)}static deserialize(e){let t=e.deserializeUleb128AsU32();switch(t){case 0:return V.load(e);case 1:return pe.load(e);case 2:return j.load(e);case 3:return je.load(e);case 4:return F.load(e);case 5:return bt.load(e);case 6:return v.load(e);case 7:return A.load(e);case 8:return We.load(e);case 9:return Qe.load(e);case 10:return Je.load(e);case 255:return G.load(e);default:throw new Error(`Unknown variant index for TypeTag: ${t}`)}}isBool(){return this instanceof V}isAddress(){return this instanceof F}isGeneric(){return this instanceof G}isSigner(){return this instanceof bt}isVector(){return this instanceof v}isStruct(){return this instanceof A}isU8(){return this instanceof pe}isU16(){return this instanceof We}isU32(){return this instanceof Qe}isU64(){return this instanceof j}isU128(){return this instanceof je}isU256(){return this instanceof Je}isPrimitive(){return this instanceof bt||this instanceof F||this instanceof V||this instanceof pe||this instanceof We||this instanceof Qe||this instanceof j||this instanceof je||this instanceof Je}},V= exports.TypeTagBool =class n extends N{toString(){return"bool"}serialize(e){e.serializeU32AsUleb128(0)}static load(e){return new n}},pe= exports.TypeTagU8 =class n extends N{toString(){return"u8"}serialize(e){e.serializeU32AsUleb128(1)}static load(e){return new n}},We= exports.TypeTagU16 =class n extends N{toString(){return"u16"}serialize(e){e.serializeU32AsUleb128(8)}static load(e){return new n}},Qe= exports.TypeTagU32 =class n extends N{toString(){return"u32"}serialize(e){e.serializeU32AsUleb128(9)}static load(e){return new n}},j= exports.TypeTagU64 =class n extends N{toString(){return"u64"}serialize(e){e.serializeU32AsUleb128(2)}static load(e){return new n}},je= exports.TypeTagU128 =class n extends N{toString(){return"u128"}serialize(e){e.serializeU32AsUleb128(3)}static load(e){return new n}},Je= exports.TypeTagU256 =class n extends N{toString(){return"u256"}serialize(e){e.serializeU32AsUleb128(10)}static load(e){return new n}},F= exports.TypeTagAddress =class n extends N{toString(){return"address"}serialize(e){e.serializeU32AsUleb128(4)}static load(e){return new n}},bt= exports.TypeTagSigner =class n extends N{toString(){return"signer"}serialize(e){e.serializeU32AsUleb128(5)}static load(e){return new n}},cr= exports.TypeTagReference =class n extends N{constructor(t){super();this.value=t}toString(){return`&${this.value.toString()}`}serialize(t){t.serializeU32AsUleb128(254)}static load(t){let r=N.deserialize(t);return new n(r)}},G= exports.TypeTagGeneric =class n extends N{constructor(t){super();this.value=t;if(t<0)throw new Error("Generic type parameter index cannot be negative")}toString(){return`T${this.value}`}serialize(t){t.serializeU32AsUleb128(255),t.serializeU32(this.value)}static load(t){let r=t.deserializeU32();return new n(r)}},v= exports.TypeTagVector =class n extends N{constructor(t){super();this.value=t}toString(){return`vector<${this.value.toString()}>`}static u8(){return new n(new pe)}serialize(t){t.serializeU32AsUleb128(6),this.value.serialize(t)}static load(t){let r=N.deserialize(t);return new n(r)}},A= exports.TypeTagStruct =class n extends N{constructor(t){super();this.value=t}toString(){let t="";return this.value.typeArgs.length>0&&(t=`<${this.value.typeArgs.map(r=>r.toString()).join(", ")}>`),`${this.value.address.toString()}::${this.value.moduleName.identifier}::${this.value.name.identifier}${t}`}serialize(t){t.serializeU32AsUleb128(7),this.value.serialize(t)}static load(t){let r=ze.deserialize(t);return new n(r)}isTypeTag(t,r,i){return this.value.moduleName.identifier===r&&this.value.name.identifier===i&&this.value.address.equals(t)}isString(){return this.isTypeTag(_chunkRX5UBAMEjs.Z.ONE,"string","String")}isOption(){return this.isTypeTag(_chunkRX5UBAMEjs.Z.ONE,"option","Option")}isObject(){return this.isTypeTag(_chunkRX5UBAMEjs.Z.ONE,"object","Object")}},ze= exports.StructTag =class n extends _chunkRX5UBAMEjs.l{constructor(e,t,r,i){super(),this.address=e,this.moduleName=t,this.name=r,this.typeArgs=i}serialize(e){e.serialize(this.address),e.serialize(this.moduleName),e.serialize(this.name),e.serializeVector(this.typeArgs)}static deserialize(e){let t=_chunkRX5UBAMEjs.Z.deserialize(e),r=K.deserialize(e),i=K.deserialize(e),o=e.deserializeVector(N);return new n(t,r,i,o)}};function hy(){return new ze(_chunkRX5UBAMEjs.Z.ONE,new K("aptos_coin"),new K("AptosCoin"),[])}function E(){return new ze(_chunkRX5UBAMEjs.Z.ONE,new K("string"),new K("String"),[])}function Ty(n){return new ze(_chunkRX5UBAMEjs.Z.ONE,new K("option"),new K("Option"),[n])}function le(n){return new ze(_chunkRX5UBAMEjs.Z.ONE,new K("object"),new K("Object"),[n])}function Wc(n){let e=n.deserializeUleb128AsU32();switch(e){case 0:return X.deserialize(n);case 1:return W.deserialize(n);case 2:return _e.deserialize(n);case 3:return _chunkRX5UBAMEjs.Z.deserialize(n);case 4:return _.deserialize(n,X);case 5:return U.deserialize(n);case 6:return we.deserialize(n);case 7:return Se.deserialize(n);case 8:return me.deserialize(n);case 9:return cn.deserialize(n);default:throw new Error(`Unknown variant index for ScriptTransactionArgument: ${e}`)}}var wt=class extends _chunkRX5UBAMEjs.l{static deserialize(e){let t=e.deserializeUleb128AsU32();switch(t){case 0:return St.load(e);case 2:return hn.load(e);case 3:return Tn.load(e);default:throw new Error(`Unknown variant index for TransactionPayload: ${t}`)}}},St= exports.TransactionPayloadScript =class n extends wt{constructor(e){super(),this.script=e}serialize(e){e.serializeU32AsUleb128(0),this.script.serialize(e)}static load(e){let t=bn.deserialize(e);return new n(t)}},hn= exports.TransactionPayloadEntryFunction =class n extends wt{constructor(e){super(),this.entryFunction=e}serialize(e){e.serializeU32AsUleb128(2),this.entryFunction.serialize(e)}static load(e){let t=_t.deserialize(e);return new n(t)}},Tn= exports.TransactionPayloadMultiSig =class n extends wt{constructor(e){super(),this.multiSig=e}serialize(e){e.serializeU32AsUleb128(3),this.multiSig.serialize(e)}static load(e){let t=wn.deserialize(e);return new n(t)}},_t= exports.EntryFunction =class n{constructor(e,t,r,i){this.module_name=e,this.function_name=t,this.type_args=r,this.args=i}static build(e,t,r,i){return new n(An.fromStr(e),new K(t),r,i)}serialize(e){this.module_name.serialize(e),this.function_name.serialize(e),e.serializeVector(this.type_args),e.serializeU32AsUleb128(this.args.length),this.args.forEach(t=>{t.serializeForEntryFunction(e)})}static deserialize(e){let t=An.deserialize(e),r=K.deserialize(e),i=e.deserializeVector(N),o=e.deserializeUleb128AsU32(),s=new Array;for(let a=0;a<o;a+=1){let c=e.deserializeUleb128AsU32(),d=Jn.deserialize(e,c);s.push(d)}return new n(t,r,i,s)}},bn= exports.Script =class n{constructor(e,t,r){this.bytecode=e,this.type_args=t,this.args=r}serialize(e){e.serializeBytes(this.bytecode),e.serializeVector(this.type_args),e.serializeU32AsUleb128(this.args.length),this.args.forEach(t=>{t.serializeForScriptFunction(e)})}static deserialize(e){let t=e.deserializeBytes(),r=e.deserializeVector(N),i=e.deserializeUleb128AsU32(),o=new Array;for(let s=0;s<i;s+=1){let a=Wc(e);o.push(a)}return new n(t,r,o)}},wn= exports.MultiSig =class n{constructor(e,t){this.multisig_address=e,this.transaction_payload=t}serialize(e){this.multisig_address.serialize(e),this.transaction_payload===void 0?e.serializeBool(!1):(e.serializeBool(!0),this.transaction_payload.serialize(e))}static deserialize(e){let t=_chunkRX5UBAMEjs.Z.deserialize(e),r=e.deserializeBool(),i;return r&&(i=Sn.deserialize(e)),new n(t,i)}},Sn= exports.MultiSigTransactionPayload =class n extends _chunkRX5UBAMEjs.l{constructor(e){super(),this.transaction_payload=e}serialize(e){e.serializeU32AsUleb128(0),this.transaction_payload.serialize(e)}static deserialize(e){return e.deserializeUleb128AsU32(),new n(_t.deserialize(e))}};var Ae=class n extends _chunkRX5UBAMEjs.l{constructor(e,t,r,i,o,s,a){super(),this.sender=e,this.sequence_number=t,this.payload=r,this.max_gas_amount=i,this.gas_unit_price=o,this.expiration_timestamp_secs=s,this.chain_id=a}serialize(e){this.sender.serialize(e),e.serializeU64(this.sequence_number),this.payload.serialize(e),e.serializeU64(this.max_gas_amount),e.serializeU64(this.gas_unit_price),e.serializeU64(this.expiration_timestamp_secs),this.chain_id.serialize(e)}static deserialize(e){let t=_chunkRX5UBAMEjs.Z.deserialize(e),r=e.deserializeU64(),i=wt.deserialize(e),o=e.deserializeU64(),s=e.deserializeU64(),a=e.deserializeU64(),c=Lt.deserialize(e);return new n(t,r,i,o,s,a,c)}},ur= exports.RawTransactionWithData =class extends _chunkRX5UBAMEjs.l{static deserialize(e){let t=e.deserializeUleb128AsU32();switch(t){case 0:return Et.load(e);case 1:return Pt.load(e);default:throw new Error(`Unknown variant index for RawTransactionWithData: ${t}`)}}},Et= exports.MultiAgentRawTransaction =class n extends ur{constructor(e,t){super(),this.raw_txn=e,this.secondary_signer_addresses=t}serialize(e){e.serializeU32AsUleb128(0),this.raw_txn.serialize(e),e.serializeVector(this.secondary_signer_addresses)}static load(e){let t=Ae.deserialize(e),r=e.deserializeVector(_chunkRX5UBAMEjs.Z);return new n(t,r)}},Pt= exports.FeePayerRawTransaction =class n extends ur{constructor(e,t,r){super(),this.raw_txn=e,this.secondary_signer_addresses=t,this.fee_payer_address=r}serialize(e){e.serializeU32AsUleb128(1),this.raw_txn.serialize(e),e.serializeVector(this.secondary_signer_addresses),this.fee_payer_address.serialize(e)}static load(e){let t=Ae.deserialize(e),r=e.deserializeVector(_chunkRX5UBAMEjs.Z),i=_chunkRX5UBAMEjs.Z.deserialize(e);return new n(t,r,i)}};var dr=class extends _chunkRX5UBAMEjs.l{constructor(t){super();this.accountAddress=_chunkRX5UBAMEjs.Z.ONE;this.moduleName=new P("account");this.structName=new P("RotationProofChallenge");this.sequenceNumber=new W(t.sequenceNumber),this.originator=t.originator,this.currentAuthKey=t.currentAuthKey,this.newPublicKey=_.U8(t.newPublicKey.toUint8Array())}serialize(t){t.serialize(this.accountAddress),t.serialize(this.moduleName),t.serialize(this.structName),t.serialize(this.sequenceNumber),t.serialize(this.originator),t.serialize(this.currentAuthKey),t.serialize(this.newPublicKey)}};var Xe=class extends _chunkRX5UBAMEjs.l{static deserialize(e){let t=e.deserializeUleb128AsU32();switch(t){case 0:return xt.load(e);case 1:return Ht.load(e);case 2:return It.load(e);case 3:return vt.load(e);case 4:return at.load(e);default:throw new Error(`Unknown variant index for TransactionAuthenticator: ${t}`)}}isEd25519(){return this instanceof xt}isMultiEd25519(){return this instanceof Ht}isMultiAgent(){return this instanceof It}isFeePayer(){return this instanceof vt}isSingleSender(){return this instanceof at}},xt= exports.TransactionAuthenticatorEd25519 =class n extends Xe{constructor(e,t){super(),this.public_key=e,this.signature=t}serialize(e){e.serializeU32AsUleb128(0),this.public_key.serialize(e),this.signature.serialize(e)}static load(e){let t=x.deserialize(e),r=I.deserialize(e);return new n(t,r)}},Ht= exports.TransactionAuthenticatorMultiEd25519 =class n extends Xe{constructor(e,t){super(),this.public_key=e,this.signature=t}serialize(e){e.serializeU32AsUleb128(1),this.public_key.serialize(e),this.signature.serialize(e)}static load(e){let t=Vt.deserialize(e),r=He.deserialize(e);return new n(t,r)}},It= exports.TransactionAuthenticatorMultiAgent =class n extends Xe{constructor(e,t,r){super(),this.sender=e,this.secondary_signer_addresses=t,this.secondary_signers=r}serialize(e){e.serializeU32AsUleb128(2),this.sender.serialize(e),e.serializeVector(this.secondary_signer_addresses),e.serializeVector(this.secondary_signers)}static load(e){let t=Q.deserialize(e),r=e.deserializeVector(_chunkRX5UBAMEjs.Z),i=e.deserializeVector(Q);return new n(t,r,i)}},vt= exports.TransactionAuthenticatorFeePayer =class n extends Xe{constructor(e,t,r,i){super(),this.sender=e,this.secondary_signer_addresses=t,this.secondary_signers=r,this.fee_payer=i}serialize(e){e.serializeU32AsUleb128(3),this.sender.serialize(e),e.serializeVector(this.secondary_signer_addresses),e.serializeVector(this.secondary_signers),this.fee_payer.address.serialize(e),this.fee_payer.authenticator.serialize(e)}static load(e){let t=Q.deserialize(e),r=e.deserializeVector(_chunkRX5UBAMEjs.Z),i=e.deserializeVector(Q),o=_chunkRX5UBAMEjs.Z.deserialize(e),s=Q.deserialize(e),a={address:o,authenticator:s};return new n(t,r,i,a)}},at= exports.TransactionAuthenticatorSingleSender =class n extends Xe{constructor(e){super(),this.sender=e}serialize(e){e.serializeU32AsUleb128(4),this.sender.serialize(e)}static load(e){let t=Q.deserialize(e);return new n(t)}};var Ye=class n extends _chunkRX5UBAMEjs.l{constructor(e,t){super(),this.raw_txn=e,this.authenticator=t}serialize(e){this.raw_txn.serialize(e),this.authenticator.serialize(e)}static deserialize(e){let t=Ae.deserialize(e),r=Xe.deserialize(e);return new n(t,r)}};var $t=class n extends _chunkRX5UBAMEjs.l{constructor(e,t){super(),this.rawTransaction=e,this.feePayerAddress=t}serialize(e){this.rawTransaction.serialize(e),this.feePayerAddress===void 0?e.serializeBool(!1):(e.serializeBool(!0),this.feePayerAddress.serialize(e))}static deserialize(e){let t=Ae.deserialize(e),r=e.deserializeBool(),i;return r&&(i=_chunkRX5UBAMEjs.Z.deserialize(e)),new n(t,i)}};var pr=class n extends _chunkRX5UBAMEjs.l{constructor(e,t,r){super(),this.rawTransaction=e,this.feePayerAddress=r,this.secondarySignerAddresses=t}serialize(e){this.rawTransaction.serialize(e),e.serializeVector(this.secondarySignerAddresses),this.feePayerAddress===void 0?e.serializeBool(!1):(e.serializeBool(!0),this.feePayerAddress.serialize(e))}static deserialize(e){let t=Ae.deserialize(e),r=e.deserializeVector(_chunkRX5UBAMEjs.Z),i=e.deserializeBool(),o;return i&&(o=_chunkRX5UBAMEjs.Z.deserialize(e)),new n(t,r,o)}};function si(n){return n.feePayerAddress?new Pt(n.rawTransaction,_nullishCoalesce(n.secondarySignerAddresses, () => ([])),n.feePayerAddress):n.secondarySignerAddresses?new Et(n.rawTransaction,n.secondarySignerAddresses):n.rawTransaction}function Wt(n,e){let t=_sha3.sha3_256.create();if(!e.startsWith("APTOS::"))throw new Error(`Domain separator needs to start with 'APTOS::'. Provided - ${e}`);t.update(e);let r=t.digest(),i=n,o=new Uint8Array(r.length+i.length);return o.set(r),o.set(i,r.length),o}function Rf(n){return Wt(n.bcsToBytes(),`APTOS::${n.constructor.name}`)}function Ie(n){let e=si(n);return n.feePayerAddress?Wt(e.bcsToBytes(),Zr):n.secondarySignerAddresses?Wt(e.bcsToBytes(),Zr):Wt(e.bcsToBytes(),mo)}var he=class n{constructor(e){this.signingScheme=0;let{privateKey:t,address:r}=e;this.privateKey=t,this.publicKey=t.publicKey(),this.accountAddress=r?_chunkRX5UBAMEjs.Z.from(r):this.publicKey.authKey().derivedAddress()}static generate(){let e=q.generate();return new n({privateKey:e})}static fromDerivationPath(e){let{path:t,mnemonic:r}=e,i=q.fromDerivationPath(t,r);return new n({privateKey:i})}verifySignature(e){return this.publicKey.verifySignature(e)}signWithAuthenticator(e){return new xe(this.publicKey,this.privateKey.sign(e))}signTransactionWithAuthenticator(e){return new xe(this.publicKey,this.signTransaction(e))}sign(e){return this.privateKey.sign(e)}signTransaction(e){return this.sign(Ie(e))}};function ai(n){return typeof n=="object"&&n!==null&&"getAnyPublicKey"in n&&typeof n.getAnyPublicKey=="function"}var Te=class n{constructor(e){this.signingScheme=2;let{privateKey:t,address:r}=e;this.privateKey=t,this.publicKey=new O(t.publicKey()),this.accountAddress=r?_chunkRX5UBAMEjs.Z.from(r):this.publicKey.authKey().derivedAddress()}getAnyPublicKey(){return this.publicKey}static generate(e={}){let{scheme:t=0}=e,r;switch(t){case 0:r=q.generate();break;case 2:r=Ge.generate();break;default:throw new Error(`Unsupported signature scheme ${t}`)}return new n({privateKey:r})}static fromDerivationPath(e){let{scheme:t=0,path:r,mnemonic:i}=e,o;switch(t){case 0:o=q.fromDerivationPath(r,i);break;case 2:o=Ge.fromDerivationPath(r,i);break;default:throw new Error(`Unsupported signature scheme ${t}`)}return new n({privateKey:o})}verifySignature(e){return this.publicKey.verifySignature(e)}signWithAuthenticator(e){return new se(this.publicKey,this.sign(e))}signTransactionWithAuthenticator(e){return new se(this.publicKey,this.signTransaction(e))}sign(e){return new H(this.privateKey.sign(e))}signTransaction(e){return this.sign(Ie(e))}static fromEd25519Account(e){return new n({privateKey:e.privateKey,address:e.accountAddress})}};var ke=class{static generate(e={}){let{scheme:t=0,legacy:r=!0}=e;return t===0&&r?he.generate():Te.generate({scheme:t})}static fromPrivateKey(e){let{privateKey:t,address:r,legacy:i=!0}=e;return t instanceof q&&i?new he({privateKey:t,address:r}):new Te({privateKey:t,address:r})}static fromPrivateKeyAndAddress(e){return this.fromPrivateKey(e)}static fromDerivationPath(e){let{scheme:t=0,mnemonic:r,path:i,legacy:o=!0}=e;return t===0&&o?he.fromDerivationPath({mnemonic:r,path:i}):Te.fromDerivationPath({scheme:t,mnemonic:r,path:i})}static authKey(e){let{publicKey:t}=e;return t.authKey()}verifySignature(e){return this.publicKey.verifySignature(e)}};var _utils = require('@noble/hashes/utils');var Jc=1209600,Qt=class Qt extends _chunkRX5UBAMEjs.l{constructor(e){super();let{privateKey:t,expiryDateSecs:r,blinder:i}=e;this.privateKey=t,this.publicKey=new ft(t.publicKey()),this.expiryDateSecs=r||_chunkRX5UBAMEjs.ba.call(void 0, _chunkRX5UBAMEjs.aa.call(void 0, )+Jc),this.blinder=i!==void 0?_chunkRX5UBAMEjs.j.fromHexInput(i).toUint8Array():Xc();let o=Wr(this.publicKey.bcsToBytes(),93);o.push(BigInt(this.expiryDateSecs)),o.push(pn(this.blinder));let s=ln(o);this.nonce=s.toString()}getPublicKey(){return this.publicKey}isExpired(){return Math.floor(Date.now()/1e3)>this.expiryDateSecs}serialize(e){e.serializeU32AsUleb128(this.publicKey.variant),e.serializeBytes(this.privateKey.toUint8Array()),e.serializeU64(this.expiryDateSecs),e.serializeFixedBytes(this.blinder)}static deserialize(e){let t=e.deserializeUleb128AsU32(),r;switch(t){case 0:r=q.deserialize(e);break;default:throw new Error(`Unknown variant index for EphemeralPublicKey: ${t}`)}let i=e.deserializeU64(),o=e.deserializeFixedBytes(31);return new Qt({privateKey:r,expiryDateSecs:Number(i),blinder:o})}static fromBytes(e){return Qt.deserialize(new C(e))}static generate(e){let t;switch(_optionalChain([e, 'optionalAccess', _61 => _61.scheme])){case 0:default:t=q.generate()}return new Qt({privateKey:t,expiryDateSecs:_optionalChain([e, 'optionalAccess', _62 => _62.expiryDateSecs])})}sign(e){if(this.isExpired())throw new Error("EphemeralKeyPair has expired");return new Ce(this.privateKey.sign(e))}};Qt.BLINDER_LENGTH=31;var Ct=Qt;function Xc(){return _utils.randomBytes.call(void 0, Ct.BLINDER_LENGTH)}var _eventemitter3 = require('eventemitter3'); var _eventemitter32 = _interopRequireDefault(_eventemitter3);function lr(n){return n!=null&&typeof n.checkKeylessAccountValidity=="function"}var jt=class jt extends _chunkRX5UBAMEjs.l{constructor(t){super();this.signingScheme=2;let{address:r,ephemeralKeyPair:i,publicKey:o,uidKey:s,uidVal:a,aud:c,pepper:d,proof:l,proofFetchCallback:h,jwt:p,verificationKeyHash:g}=t;if(this.ephemeralKeyPair=i,this.publicKey=o,this.accountAddress=r?_chunkRX5UBAMEjs.Z.from(r):this.publicKey.authKey().derivedAddress(),this.uidKey=s,this.uidVal=a,this.aud=c,this.jwt=p,this.emitter=new _eventemitter32.default,this.proofOrPromise=l,l instanceof Pe)this.proof=l;else{if(h===void 0)throw new Error("Must provide callback for async proof fetch");this.emitter.on("proofFetchFinish",async R=>{await h(R),this.emitter.removeAllListeners()}),this.init(l)}let b=_chunkRX5UBAMEjs.j.fromHexInput(d).toUint8Array();if(b.length!==jt.PEPPER_LENGTH)throw new Error(`Pepper length in bytes should be ${jt.PEPPER_LENGTH}`);if(this.pepper=b,g!==void 0){if(_chunkRX5UBAMEjs.j.hexInputToUint8Array(g).length!==32)throw new Error("verificationKeyHash must be 32 bytes");this.verificationKeyHash=_chunkRX5UBAMEjs.j.hexInputToUint8Array(g)}}getAnyPublicKey(){return new O(this.publicKey)}async init(t){try{this.proof=await t,this.emitter.emit("proofFetchFinish",{status:"Success"})}catch(r){r instanceof Error?this.emitter.emit("proofFetchFinish",{status:"Failed",error:r.toString()}):this.emitter.emit("proofFetchFinish",{status:"Failed",error:"Unknown"})}}serialize(t){if(this.accountAddress.serialize(t),t.serializeStr(this.jwt),t.serializeStr(this.uidKey),t.serializeFixedBytes(this.pepper),this.ephemeralKeyPair.serialize(t),this.proof===void 0)throw new Error("Cannot serialize - proof undefined");this.proof.serialize(t),t.serializeOption(this.verificationKeyHash,32)}static partialDeserialize(t){let r=_chunkRX5UBAMEjs.Z.deserialize(t),i=t.deserializeStr(),o=t.deserializeStr(),s=t.deserializeFixedBytes(31),a=Ct.deserialize(t),c=Pe.deserialize(t),d=t.deserializeOption("fixedBytes",32);return{address:r,jwt:i,uidKey:o,pepper:s,ephemeralKeyPair:a,proof:c,verificationKeyHash:d}}isExpired(){return this.ephemeralKeyPair.isExpired()}signWithAuthenticator(t){let r=new H(this.sign(t)),i=new O(this.publicKey);return new se(i,r)}signTransactionWithAuthenticator(t){let r=new H(this.signTransaction(t)),i=new O(this.publicKey);return new se(i,r)}async waitForProofFetch(){this.proofOrPromise instanceof Promise&&await this.proofOrPromise}async checkKeylessAccountValidity(t){if(this.isExpired())throw D.fromErrorType({type:0});if(await this.waitForProofFetch(),this.proof===void 0)throw D.fromErrorType({type:2});let r=_jwtdecode.jwtDecode.call(void 0, this.jwt,{header:!0});if(r.kid===void 0)throw D.fromErrorType({type:12,details:"checkKeylessAccountValidity failed. JWT is missing 'kid' in header. This should never happen."});if(this.verificationKeyHash!==void 0){let{verificationKey:i}=await mn({aptosConfig:t});if(_chunkRX5UBAMEjs.j.hexInputToString(i.hash())!==_chunkRX5UBAMEjs.j.hexInputToString(this.verificationKeyHash))throw D.fromErrorType({type:4})}else console.warn("[Aptos SDK] The verification key hash was not set. Proof may be invalid if the verification key has rotated.");await jt.fetchJWK({aptosConfig:t,publicKey:this.publicKey,kid:r.kid})}sign(t){let{expiryDateSecs:r}=this.ephemeralKeyPair;if(this.isExpired())throw D.fromErrorType({type:0});if(this.proof===void 0)throw D.fromErrorType({type:1,details:"Proof not found - make sure to call `await account.checkKeylessAccountValidity()` before signing."});let i=this.ephemeralKeyPair.getPublicKey(),o=this.ephemeralKeyPair.sign(t);return new Ve({jwtHeader:_chunkRX5UBAMEjs.ca.call(void 0, this.jwt.split(".")[0]),ephemeralCertificate:new Gt(this.proof,0),expiryDateSecs:r,ephemeralPublicKey:i,ephemeralSignature:o})}signTransaction(t){if(this.proof===void 0)throw D.fromErrorType({type:1,details:"Proof not found - make sure to call `await account.checkKeylessAccountValidity()` before signing."});let r=si(t),o=new ci(r,this.proof.proof).hash();return this.sign(o)}verifySignature(t){let{message:r,signature:i}=t;return!(this.isExpired()||!this.ephemeralKeyPair.getPublicKey().verifySignature({message:r,signature:i.ephemeralSignature}))}static async fetchJWK(t){let{aptosConfig:r,publicKey:i,kid:o}=t,s=i instanceof k?i:i.keylessPublicKey,{iss:a}=s,c,d=i instanceof ne?i.jwkAddress:void 0;try{c=await Po({aptosConfig:r,jwkAddr:d})}catch(p){throw D.fromErrorType({type:24,error:p,details:`Failed to fetch ${d?"Federated":"Patched"}JWKs ${d?`for address ${d}`:"0x1"}`})}let l=c.get(a);if(l===void 0)throw D.fromErrorType({type:7,details:`JWKs for issuer ${a} not found.`});let h=l.find(p=>p.kid===o);if(h===void 0)throw D.fromErrorType({type:6,details:`JWK with kid '${o}' for issuer '${a}' not found.`});return h}};jt.PEPPER_LENGTH=31;var ge=jt,ci= exports.TransactionAndProof =class extends _chunkRX5UBAMEjs.l{constructor(t,r){super();this.domainSeparator="APTOS::TransactionAndProof";this.transaction=t,this.proof=r}serialize(t){t.serializeFixedBytes(this.transaction.bcsToBytes()),t.serializeOption(this.proof)}hash(){return Wt(this.bcsToBytes(),this.domainSeparator)}};var Ze=class n extends ge{constructor(e){let t=k.create(e);super({publicKey:t,...e}),this.publicKey=t}serialize(e){super.serialize(e)}static deserialize(e){let{address:t,proof:r,ephemeralKeyPair:i,jwt:o,uidKey:s,pepper:a,verificationKeyHash:c}=ge.partialDeserialize(e),{iss:d,aud:l,uidVal:h}=qe({jwt:o,uidKey:s});return new n({address:t,proof:r,ephemeralKeyPair:i,iss:d,uidKey:s,uidVal:h,aud:l,pepper:a,jwt:o,verificationKeyHash:c})}static fromBytes(e){return n.deserialize(new C(_chunkRX5UBAMEjs.j.hexInputToUint8Array(e)))}static create(e){let{address:t,proof:r,jwt:i,ephemeralKeyPair:o,pepper:s,uidKey:a="sub",proofFetchCallback:c,verificationKey:d}=e,{iss:l,aud:h,uidVal:p}=qe({jwt:i,uidKey:a});return new n({address:t,proof:r,ephemeralKeyPair:o,iss:l,uidKey:a,uidVal:p,aud:h,pepper:s,jwt:i,proofFetchCallback:c,verificationKeyHash:d?d.hash():void 0})}};var Kt=class n extends ge{constructor(e){let t=ne.create(e);super({publicKey:t,...e}),this.publicKey=t,this.audless=_nullishCoalesce(e.audless, () => (!1))}serialize(e){super.serialize(e),this.publicKey.jwkAddress.serialize(e)}static deserialize(e){let{address:t,proof:r,ephemeralKeyPair:i,jwt:o,uidKey:s,pepper:a,verificationKeyHash:c}=ge.partialDeserialize(e),d=_chunkRX5UBAMEjs.Z.deserialize(e),{iss:l,aud:h,uidVal:p}=qe({jwt:o,uidKey:s});return new n({address:t,proof:r,ephemeralKeyPair:i,iss:l,uidKey:s,uidVal:p,aud:h,pepper:a,jwt:o,verificationKeyHash:c,jwkAddress:d})}static fromBytes(e){return n.deserialize(C.fromHex(e))}static create(e){let{address:t,proof:r,jwt:i,ephemeralKeyPair:o,pepper:s,jwkAddress:a,uidKey:c="sub",proofFetchCallback:d,verificationKey:l}=e,{iss:h,aud:p,uidVal:g}=qe({jwt:i,uidKey:c});return new n({address:t,proof:r,ephemeralKeyPair:o,iss:h,uidKey:c,uidVal:g,aud:p,pepper:s,jwkAddress:_chunkRX5UBAMEjs.Z.from(a),jwt:i,proofFetchCallback:d,verificationKeyHash:l?l.hash():void 0})}};var _n=class n{constructor(e){this.signingScheme=3;let{multiKey:t,address:r}=e,i=e.signers.map(a=>a instanceof he?Te.fromEd25519Account(a):a);if(t.signaturesRequired>i.length)throw new Error(`Not enough signers provided to satisfy the required signatures. Need ${t.signaturesRequired} signers, but only ${i.length} provided`);if(t.signaturesRequired<i.length)throw new Error(`More signers provided than required. Need ${t.signaturesRequired} signers, but ${i.length} provided`);this.publicKey=t,this.accountAddress=r?_chunkRX5UBAMEjs.Z.from(r):this.publicKey.authKey().derivedAddress();let o=[];for(let a of i)o.push(this.publicKey.getIndex(a.getAnyPublicKey()));let s=i.map((a,c)=>[a,o[c]]);s.sort((a,c)=>a[1]-c[1]),this.signers=s.map(a=>a[0]),this.signerIndicies=s.map(a=>a[1]),this.signaturesBitmap=this.publicKey.createBitmap({bits:o})}static fromPublicKeysAndSigners(e){let{publicKeys:t,signaturesRequired:r,signers:i}=e,o=new Ue({publicKeys:t,signaturesRequired:r});return new n({multiKey:o,signers:i})}static isMultiKeySigner(e){return e instanceof n}signWithAuthenticator(e){return new De(this.publicKey,this.sign(e))}signTransactionWithAuthenticator(e){return new De(this.publicKey,this.signTransaction(e))}async waitForProofFetch(){let t=this.signers.filter(r=>r instanceof ge).map(async r=>r.waitForProofFetch());await Promise.all(t)}async checkKeylessAccountValidity(e){let r=this.signers.filter(i=>i instanceof ge).map(i=>i.checkKeylessAccountValidity(e));await Promise.all(r)}sign(e){let t=[];for(let r of this.signers)t.push(r.sign(e));return new Le({signatures:t,bitmap:this.signaturesBitmap})}signTransaction(e){let t=[];for(let r of this.signers)t.push(r.signTransaction(e));return new Le({signatures:t,bitmap:this.signaturesBitmap})}verifySignature(e){let{message:t,signature:r}=e;if(!this.signerIndicies.every((o,s)=>s===0||o>=this.signerIndicies[s-1]))return!1;for(let o=0;o<r.signatures.length;o+=1){let s=r.signatures[o];if(!this.publicKey.publicKeys[this.signerIndicies[o]].verifySignature({message:t,signature:s}))return!1}return!0}};var Io=class{constructor(e){this.signingScheme=1;let{signers:t,publicKey:r,address:i}=e;if(this.publicKey=r,this.accountAddress=i?_chunkRX5UBAMEjs.Z.from(i):this.publicKey.authKey().derivedAddress(),r.threshold>t.length)throw new Error(`Not enough signers provided to satisfy the required signatures. Need ${r.threshold} signers, but only ${t.length} provided`);if(r.threshold<t.length)throw new Error(`More signers provided than required. Need ${r.threshold} signers, but ${t.length} provided`);let o=[];for(let a of t)o.push(this.publicKey.getIndex(a.publicKey()));let s=t.map((a,c)=>[a,o[c]]);s.sort((a,c)=>a[1]-c[1]),this.signers=s.map(a=>a[0]),this.signerIndices=s.map(a=>a[1]),this.signaturesBitmap=this.publicKey.createBitmap({bits:o})}verifySignature(e){return this.publicKey.verifySignature(e)}signWithAuthenticator(e){return new $e(this.publicKey,this.sign(e))}signTransactionWithAuthenticator(e){return new $e(this.publicKey,this.signTransaction(e))}sign(e){let t=[];for(let r of this.signers)t.push(r.sign(e));return new He({signatures:t,bitmap:this.signaturesBitmap})}signTransaction(e){return this.sign(Ie(e))}};function vo(n){let e=n.deserializeUleb128AsU32();if(!Object.values(_chunkRX5UBAMEjs.U).includes(e))throw new Error(`Deserialization of Account failed: SigningScheme variant ${e} is invalid`);return{address:_chunkRX5UBAMEjs.Z.deserialize(n),signingScheme:e}}function Co(n,e){if(e.serializeStr(n.jwt),e.serializeStr(n.uidKey),e.serializeFixedBytes(n.pepper),n.ephemeralKeyPair.serialize(e),n.proof===void 0)throw new Error("Cannot serialize - proof undefined");n.proof.serialize(e),e.serializeOption(n.verificationKeyHash,32)}function Ko(n){let e=n.deserializeStr(),t=n.deserializeStr(),r=n.deserializeFixedBytes(31),i=Ct.deserialize(n),o=Pe.deserialize(n),s=n.deserializeOption("fixedBytes",32);return{jwt:e,uidKey:t,pepper:r,ephemeralKeyPair:i,proof:o,verificationKeyHash:s}}var Ro;(h=>{function n(p){let g=new _chunkRX5UBAMEjs.m;switch(g.serializeU32AsUleb128(p.signingScheme),p.accountAddress.serialize(g),p.signingScheme){case 0:return p.privateKey.serialize(g),g.toUint8Array();case 2:{if(!ai(p))throw new Error("Account is not a SingleKeySigner");let b=p.getAnyPublicKey();switch(g.serializeU32AsUleb128(b.variant),b.variant){case 3:return Co(p,g),g.toUint8Array();case 4:{let R=p;return Co(R,g),R.publicKey.jwkAddress.serialize(g),g.serializeBool(R.audless),g.toUint8Array()}case 1:case 0:return p.privateKey.serialize(g),g.toUint8Array();default:throw new Error(`Invalid public key variant: ${b.variant}`)}}case 3:{let b=p;return b.publicKey.serialize(g),g.serializeU32AsUleb128(b.signers.length),b.signers.forEach(R=>{g.serializeFixedBytes(n(R))}),g.toUint8Array()}default:throw new Error(`Deserialization of Account failed: invalid signingScheme value ${p.signingScheme}`)}}h.toBytes=n;function e(p){return _chunkRX5UBAMEjs.j.hexInputToStringWithoutPrefix(n(p))}h.toHexStringWithoutPrefix=e;function t(p){return _chunkRX5UBAMEjs.j.hexInputToString(n(p))}h.toHexString=t;function r(p){let{address:g,signingScheme:b}=vo(p);switch(b){case 0:{let R=q.deserialize(p);return new he({privateKey:R,address:g})}case 2:{let R=p.deserializeUleb128AsU32();switch(R){case 0:{let ee=q.deserialize(p);return new Te({privateKey:ee,address:g})}case 1:{let ee=Ge.deserialize(p);return new Te({privateKey:ee,address:g})}case 3:{let ee=Ko(p),dt=qe(ee);return new Ze({...ee,...dt})}case 4:{let ee=Ko(p),dt=_chunkRX5UBAMEjs.Z.deserialize(p),Dt=p.deserializeBool(),zt=qe(ee);return new Kt({...ee,...zt,jwkAddress:dt,audless:Dt})}default:throw new Error(`Unsupported public key variant ${R}`)}}case 3:{let R=Ue.deserialize(p),ee=p.deserializeUleb128AsU32(),dt=new Array;for(let Dt=0;Dt<ee;Dt+=1){let zt=r(p);if(!ai(zt)&&!(zt instanceof he))throw new Error("Deserialization of MultiKeyAccount failed. Signer is not a SingleKeySigner or Ed25519Account");dt.push(zt)}return new _n({multiKey:R,signers:dt,address:g})}default:throw new Error(`Deserialization of Account failed: invalid signingScheme value ${b}`)}}h.deserialize=r;function i(p){let g=d(p);if(!(g instanceof Ze))throw new Error("Deserialization of KeylessAccount failed");return g}h.keylessAccountFromHex=i;function o(p){let g=d(p);if(!(g instanceof Kt))throw new Error("Deserialization of FederatedKeylessAccount failed");return g}h.federatedKeylessAccountFromHex=o;function s(p){let g=d(p);if(!(g instanceof _n))throw new Error("Deserialization of MultiKeyAccount failed");return g}h.multiKeyAccountFromHex=s;function a(p){let g=d(p);if(!(g instanceof Te))throw new Error("Deserialization of SingleKeyAccount failed");return g}h.singleKeyAccountFromHex=a;function c(p){let g=d(p);if(!(g instanceof he))throw new Error("Deserialization of Ed25519Account failed");return g}h.ed25519AccountFromHex=c;function d(p){return r(C.fromHex(p))}h.fromHex=d;function l(p){return d(p)}h.fromBytes=l})(Ro||(Ro= exports.AccountUtils ={}));var En=class n extends M{constructor(e){super(),this.value=_chunkRX5UBAMEjs.j.fromHexInput(e)}serialize(e){e.serializeBytes(this.value.toUint8Array())}static deserialize(e){return new n(e.deserializeBytes())}},gr=class extends oe{constructor(e){super(),this.accountAddress=e}authKey(){return new B({data:this.accountAddress.toUint8Array()})}verifySignature(e){throw new Error("This function is not implemented for AbstractPublicKey.")}serialize(e){throw new Error("This function is not implemented for AbstractPublicKey.")}};var Do=class n extends ke{constructor({signer:t,accountAddress:r,authenticationFunction:i}){super();this.signingScheme=2;if(!_chunkRX5UBAMEjs.ia.call(void 0, i))throw new Error(`Invalid authentication function ${i} passed into AbstractedAccount`);this.authenticationFunction=i,this.accountAddress=r,this.publicKey=new gr(this.accountAddress),this.sign=o=>new En(t(o))}static fromPermissionedSigner({signer:t,accountAddress:r}){return new n({signer:i=>{let o=new _chunkRX5UBAMEjs.m;return t.publicKey.serialize(o),t.sign(i).serialize(o),o.toUint8Array()},accountAddress:_nullishCoalesce(r, () => (t.accountAddress)),authenticationFunction:"0x1::permissioned_delegation::authenticate"})}signWithAuthenticator(t){return new fn(this.authenticationFunction,_sha3.sha3_256.call(void 0, t),this.sign(_sha3.sha3_256.call(void 0, t)).toUint8Array())}signTransactionWithAuthenticator(t){return this.signWithAuthenticator(Ie(t))}signTransaction(t){return this.sign(Ie(t))}setSigner(t){this.sign=r=>new En(t(r))}};var eu=`
|
|
9
7
|
fragment TokenActivitiesFields on token_activities_v2 {
|
|
10
8
|
after_value
|
|
11
9
|
before_value
|
|
@@ -23,7 +21,7 @@ KeylessErrorResolutionTip: ${t}`,o}static fromErrorType(e){let{error:t,type:n,de
|
|
|
23
21
|
transaction_version
|
|
24
22
|
type
|
|
25
23
|
}
|
|
26
|
-
`,
|
|
24
|
+
`,tu=`
|
|
27
25
|
fragment AnsTokenFragment on current_aptos_names {
|
|
28
26
|
domain
|
|
29
27
|
expiration_timestamp
|
|
@@ -35,7 +33,7 @@ KeylessErrorResolutionTip: ${t}`,o}static fromErrorType(e){let{error:t,type:n,de
|
|
|
35
33
|
subdomain_expiration_policy
|
|
36
34
|
domain_expiration_timestamp
|
|
37
35
|
}
|
|
38
|
-
`,
|
|
36
|
+
`,mr=`
|
|
39
37
|
fragment CurrentTokenOwnershipFields on current_token_ownerships_v2 {
|
|
40
38
|
token_standard
|
|
41
39
|
token_properties_mutated_v1
|
|
@@ -82,7 +80,7 @@ KeylessErrorResolutionTip: ${t}`,o}static fromErrorType(e){let{error:t,type:n,de
|
|
|
82
80
|
}
|
|
83
81
|
}
|
|
84
82
|
}
|
|
85
|
-
`,
|
|
83
|
+
`,zo=`
|
|
86
84
|
query getAccountCoinsCount($address: String) {
|
|
87
85
|
current_fungible_asset_balances_aggregate(
|
|
88
86
|
where: {owner_address: {_eq: $address}}
|
|
@@ -92,7 +90,7 @@ KeylessErrorResolutionTip: ${t}`,o}static fromErrorType(e){let{error:t,type:n,de
|
|
|
92
90
|
}
|
|
93
91
|
}
|
|
94
92
|
}
|
|
95
|
-
`,
|
|
93
|
+
`,ko=`
|
|
96
94
|
query getAccountCoinsData($where_condition: current_fungible_asset_balances_bool_exp!, $offset: Int, $limit: Int, $order_by: [current_fungible_asset_balances_order_by!]) {
|
|
97
95
|
current_fungible_asset_balances(
|
|
98
96
|
where: $where_condition
|
|
@@ -125,7 +123,7 @@ KeylessErrorResolutionTip: ${t}`,o}static fromErrorType(e){let{error:t,type:n,de
|
|
|
125
123
|
}
|
|
126
124
|
}
|
|
127
125
|
}
|
|
128
|
-
`,
|
|
126
|
+
`,Oo=`
|
|
129
127
|
query getAccountCollectionsWithOwnedTokens($where_condition: current_collection_ownership_v2_view_bool_exp!, $offset: Int, $limit: Int, $order_by: [current_collection_ownership_v2_view_order_by!]) {
|
|
130
128
|
current_collection_ownership_v2_view(
|
|
131
129
|
where: $where_condition
|
|
@@ -159,7 +157,7 @@ KeylessErrorResolutionTip: ${t}`,o}static fromErrorType(e){let{error:t,type:n,de
|
|
|
159
157
|
single_token_uri
|
|
160
158
|
}
|
|
161
159
|
}
|
|
162
|
-
`,
|
|
160
|
+
`,Fo=`
|
|
163
161
|
query getAccountOwnedTokens($where_condition: current_token_ownerships_v2_bool_exp!, $offset: Int, $limit: Int, $order_by: [current_token_ownerships_v2_order_by!]) {
|
|
164
162
|
current_token_ownerships_v2(
|
|
165
163
|
where: $where_condition
|
|
@@ -170,7 +168,7 @@ KeylessErrorResolutionTip: ${t}`,o}static fromErrorType(e){let{error:t,type:n,de
|
|
|
170
168
|
...CurrentTokenOwnershipFields
|
|
171
169
|
}
|
|
172
170
|
}
|
|
173
|
-
${
|
|
171
|
+
${mr}`,fT=`
|
|
174
172
|
query getAccountOwnedTokensByTokenData($where_condition: current_token_ownerships_v2_bool_exp!, $offset: Int, $limit: Int, $order_by: [current_token_ownerships_v2_order_by!]) {
|
|
175
173
|
current_token_ownerships_v2(
|
|
176
174
|
where: $where_condition
|
|
@@ -181,7 +179,7 @@ KeylessErrorResolutionTip: ${t}`,o}static fromErrorType(e){let{error:t,type:n,de
|
|
|
181
179
|
...CurrentTokenOwnershipFields
|
|
182
180
|
}
|
|
183
181
|
}
|
|
184
|
-
${
|
|
182
|
+
${mr}`,No=`
|
|
185
183
|
query getAccountOwnedTokensFromCollection($where_condition: current_token_ownerships_v2_bool_exp!, $offset: Int, $limit: Int, $order_by: [current_token_ownerships_v2_order_by!]) {
|
|
186
184
|
current_token_ownerships_v2(
|
|
187
185
|
where: $where_condition
|
|
@@ -192,7 +190,7 @@ KeylessErrorResolutionTip: ${t}`,o}static fromErrorType(e){let{error:t,type:n,de
|
|
|
192
190
|
...CurrentTokenOwnershipFields
|
|
193
191
|
}
|
|
194
192
|
}
|
|
195
|
-
${
|
|
193
|
+
${mr}`,Go=`
|
|
196
194
|
query getAccountTokensCount($where_condition: current_token_ownerships_v2_bool_exp, $offset: Int, $limit: Int) {
|
|
197
195
|
current_token_ownerships_v2_aggregate(
|
|
198
196
|
where: $where_condition
|
|
@@ -204,7 +202,7 @@ KeylessErrorResolutionTip: ${t}`,o}static fromErrorType(e){let{error:t,type:n,de
|
|
|
204
202
|
}
|
|
205
203
|
}
|
|
206
204
|
}
|
|
207
|
-
`,
|
|
205
|
+
`,Bo=`
|
|
208
206
|
query getAccountTransactionsCount($address: String) {
|
|
209
207
|
account_transactions_aggregate(where: {account_address: {_eq: $address}}) {
|
|
210
208
|
aggregate {
|
|
@@ -212,13 +210,13 @@ KeylessErrorResolutionTip: ${t}`,o}static fromErrorType(e){let{error:t,type:n,de
|
|
|
212
210
|
}
|
|
213
211
|
}
|
|
214
212
|
}
|
|
215
|
-
`,
|
|
213
|
+
`,Mo=`
|
|
216
214
|
query getChainTopUserTransactions($limit: Int) {
|
|
217
215
|
user_transactions(limit: $limit, order_by: {version: desc}) {
|
|
218
216
|
version
|
|
219
217
|
}
|
|
220
218
|
}
|
|
221
|
-
`,
|
|
219
|
+
`,Vo=`
|
|
222
220
|
query getCollectionData($where_condition: current_collections_v2_bool_exp!) {
|
|
223
221
|
current_collections_v2(where: $where_condition) {
|
|
224
222
|
uri
|
|
@@ -248,7 +246,7 @@ KeylessErrorResolutionTip: ${t}`,o}static fromErrorType(e){let{error:t,type:n,de
|
|
|
248
246
|
}
|
|
249
247
|
}
|
|
250
248
|
}
|
|
251
|
-
`,
|
|
249
|
+
`,qo=`
|
|
252
250
|
query getCurrentFungibleAssetBalances($where_condition: current_fungible_asset_balances_bool_exp, $offset: Int, $limit: Int) {
|
|
253
251
|
current_fungible_asset_balances(
|
|
254
252
|
where: $where_condition
|
|
@@ -266,7 +264,7 @@ KeylessErrorResolutionTip: ${t}`,o}static fromErrorType(e){let{error:t,type:n,de
|
|
|
266
264
|
token_standard
|
|
267
265
|
}
|
|
268
266
|
}
|
|
269
|
-
`,
|
|
267
|
+
`,Lo=`
|
|
270
268
|
query getDelegatedStakingActivities($delegatorAddress: String, $poolAddress: String) {
|
|
271
269
|
delegated_staking_activities(
|
|
272
270
|
where: {delegator_address: {_eq: $delegatorAddress}, pool_address: {_eq: $poolAddress}}
|
|
@@ -279,7 +277,7 @@ KeylessErrorResolutionTip: ${t}`,o}static fromErrorType(e){let{error:t,type:n,de
|
|
|
279
277
|
transaction_version
|
|
280
278
|
}
|
|
281
279
|
}
|
|
282
|
-
`,
|
|
280
|
+
`,Ho=`
|
|
283
281
|
query getEvents($where_condition: events_bool_exp, $offset: Int, $limit: Int, $order_by: [events_order_by!]) {
|
|
284
282
|
events(
|
|
285
283
|
where: $where_condition
|
|
@@ -298,7 +296,7 @@ KeylessErrorResolutionTip: ${t}`,o}static fromErrorType(e){let{error:t,type:n,de
|
|
|
298
296
|
indexed_type
|
|
299
297
|
}
|
|
300
298
|
}
|
|
301
|
-
|
|
299
|
+
`,$o=`
|
|
302
300
|
query getFungibleAssetActivities($where_condition: fungible_asset_activities_bool_exp, $offset: Int, $limit: Int) {
|
|
303
301
|
fungible_asset_activities(
|
|
304
302
|
where: $where_condition
|
|
@@ -323,7 +321,7 @@ KeylessErrorResolutionTip: ${t}`,o}static fromErrorType(e){let{error:t,type:n,de
|
|
|
323
321
|
type
|
|
324
322
|
}
|
|
325
323
|
}
|
|
326
|
-
`,
|
|
324
|
+
`,Wo=`
|
|
327
325
|
query getFungibleAssetMetadata($where_condition: fungible_asset_metadata_bool_exp, $offset: Int, $limit: Int) {
|
|
328
326
|
fungible_asset_metadata(where: $where_condition, offset: $offset, limit: $limit) {
|
|
329
327
|
icon_uri
|
|
@@ -342,7 +340,7 @@ KeylessErrorResolutionTip: ${t}`,o}static fromErrorType(e){let{error:t,type:n,de
|
|
|
342
340
|
maximum_v2
|
|
343
341
|
}
|
|
344
342
|
}
|
|
345
|
-
`,
|
|
343
|
+
`,Jt=`
|
|
346
344
|
query getNames($offset: Int, $limit: Int, $where_condition: current_aptos_names_bool_exp, $order_by: [current_aptos_names_order_by!]) {
|
|
347
345
|
current_aptos_names(
|
|
348
346
|
limit: $limit
|
|
@@ -353,14 +351,14 @@ KeylessErrorResolutionTip: ${t}`,o}static fromErrorType(e){let{error:t,type:n,de
|
|
|
353
351
|
...AnsTokenFragment
|
|
354
352
|
}
|
|
355
353
|
}
|
|
356
|
-
${
|
|
354
|
+
${tu}`,ui=`
|
|
357
355
|
query getNumberOfDelegators($where_condition: num_active_delegator_per_pool_bool_exp, $order_by: [num_active_delegator_per_pool_order_by!]) {
|
|
358
356
|
num_active_delegator_per_pool(where: $where_condition, order_by: $order_by) {
|
|
359
357
|
num_active_delegator
|
|
360
358
|
pool_address
|
|
361
359
|
}
|
|
362
360
|
}
|
|
363
|
-
`,
|
|
361
|
+
`,yr=`
|
|
364
362
|
query getObjectData($where_condition: current_objects_bool_exp, $offset: Int, $limit: Int, $order_by: [current_objects_order_by!]) {
|
|
365
363
|
current_objects(
|
|
366
364
|
where: $where_condition
|
|
@@ -377,7 +375,7 @@ KeylessErrorResolutionTip: ${t}`,o}static fromErrorType(e){let{error:t,type:n,de
|
|
|
377
375
|
is_deleted
|
|
378
376
|
}
|
|
379
377
|
}
|
|
380
|
-
`,
|
|
378
|
+
`,di=`
|
|
381
379
|
query getProcessorStatus($where_condition: processor_status_bool_exp) {
|
|
382
380
|
processor_status(where: $where_condition) {
|
|
383
381
|
last_success_version
|
|
@@ -385,7 +383,7 @@ KeylessErrorResolutionTip: ${t}`,o}static fromErrorType(e){let{error:t,type:n,de
|
|
|
385
383
|
last_updated
|
|
386
384
|
}
|
|
387
385
|
}
|
|
388
|
-
`,
|
|
386
|
+
`,Qo=`
|
|
389
387
|
query getTableItemsData($where_condition: table_items_bool_exp!, $offset: Int, $limit: Int, $order_by: [table_items_order_by!]) {
|
|
390
388
|
table_items(
|
|
391
389
|
where: $where_condition
|
|
@@ -401,7 +399,7 @@ KeylessErrorResolutionTip: ${t}`,o}static fromErrorType(e){let{error:t,type:n,de
|
|
|
401
399
|
write_set_change_index
|
|
402
400
|
}
|
|
403
401
|
}
|
|
404
|
-
`,
|
|
402
|
+
`,jo=`
|
|
405
403
|
query getTableItemsMetadata($where_condition: table_metadatas_bool_exp!, $offset: Int, $limit: Int, $order_by: [table_metadatas_order_by!]) {
|
|
406
404
|
table_metadatas(
|
|
407
405
|
where: $where_condition
|
|
@@ -414,7 +412,7 @@ KeylessErrorResolutionTip: ${t}`,o}static fromErrorType(e){let{error:t,type:n,de
|
|
|
414
412
|
value_type
|
|
415
413
|
}
|
|
416
414
|
}
|
|
417
|
-
`,
|
|
415
|
+
`,Jo=`
|
|
418
416
|
query getTokenActivity($where_condition: token_activities_v2_bool_exp!, $offset: Int, $limit: Int, $order_by: [token_activities_v2_order_by!]) {
|
|
419
417
|
token_activities_v2(
|
|
420
418
|
where: $where_condition
|
|
@@ -425,7 +423,7 @@ KeylessErrorResolutionTip: ${t}`,o}static fromErrorType(e){let{error:t,type:n,de
|
|
|
425
423
|
...TokenActivitiesFields
|
|
426
424
|
}
|
|
427
425
|
}
|
|
428
|
-
${
|
|
426
|
+
${eu}`,pi=`
|
|
429
427
|
query getCurrentTokenOwnership($where_condition: current_token_ownerships_v2_bool_exp!, $offset: Int, $limit: Int, $order_by: [current_token_ownerships_v2_order_by!]) {
|
|
430
428
|
current_token_ownerships_v2(
|
|
431
429
|
where: $where_condition
|
|
@@ -436,7 +434,7 @@ KeylessErrorResolutionTip: ${t}`,o}static fromErrorType(e){let{error:t,type:n,de
|
|
|
436
434
|
...CurrentTokenOwnershipFields
|
|
437
435
|
}
|
|
438
436
|
}
|
|
439
|
-
${
|
|
437
|
+
${mr}`,Xo=`
|
|
440
438
|
query getTokenData($where_condition: current_token_datas_v2_bool_exp, $offset: Int, $limit: Int, $order_by: [current_token_datas_v2_order_by!]) {
|
|
441
439
|
current_token_datas_v2(
|
|
442
440
|
where: $where_condition
|
|
@@ -476,7 +474,7 @@ KeylessErrorResolutionTip: ${t}`,o}static fromErrorType(e){let{error:t,type:n,de
|
|
|
476
474
|
}
|
|
477
475
|
}
|
|
478
476
|
}
|
|
479
|
-
`;async function fn(r){let{aptosConfig:e}=r,{data:t}=await q({aptosConfig:e,originMethod:"getLedgerInfo",path:""});return t}async function Wo(r){let{aptosConfig:e,limit:t}=r;return(await T({aptosConfig:e,query:{query:Oo,variables:{limit:t}},originMethod:"getChainTopUserTransactions"})).user_transactions}async function T(r){let{aptosConfig:e,query:t,originMethod:n}=r,{data:i}=await Ao({aptosConfig:e,originMethod:_nullishCoalesce(n, () => ("queryIndexer")),path:"",body:t,overrides:{WITH_CREDENTIALS:!1}});return i}async function Vc(r){let{aptosConfig:e}=r;return(await T({aptosConfig:e,query:{query:pi},originMethod:"getProcessorStatuses"})).processor_status}async function An(r){let e=await Vc({aptosConfig:r.aptosConfig});return BigInt(e[0].last_success_version)}async function hn(r){let{aptosConfig:e,processorType:t}=r;return(await T({aptosConfig:e,query:{query:pi,variables:{where_condition:{processor:{_eq:t}}}},originMethod:"getProcessorStatus"})).processor_status[0]}async function Tn(r){let{aptosConfig:e,handle:t,data:n,options:i}=r;return(await ot({aptosConfig:e,originMethod:"getTableItem",path:`tables/${t}/item`,params:{ledger_version:_optionalChain([i, 'optionalAccess', _56 => _56.ledgerVersion])},body:n})).data}async function Qo(r){let{aptosConfig:e,options:t}=r,n={query:Vo,variables:{where_condition:_optionalChain([t, 'optionalAccess', _57 => _57.where]),offset:_optionalChain([t, 'optionalAccess', _58 => _58.offset]),limit:_optionalChain([t, 'optionalAccess', _59 => _59.limit]),order_by:_optionalChain([t, 'optionalAccess', _60 => _60.orderBy])}};return(await T({aptosConfig:e,query:n,originMethod:"getTableItemsData"})).table_items}async function jo(r){let{aptosConfig:e,options:t}=r,n={query:Ho,variables:{where_condition:_optionalChain([t, 'optionalAccess', _61 => _61.where]),offset:_optionalChain([t, 'optionalAccess', _62 => _62.offset]),limit:_optionalChain([t, 'optionalAccess', _63 => _63.limit]),order_by:_optionalChain([t, 'optionalAccess', _64 => _64.orderBy])}};return(await T({aptosConfig:e,query:n,originMethod:"getTableItemsMetadata"})).table_metadatas}async function Oe(r){let{aptosConfig:e,accountAddress:t}=r,{data:n}=await q({aptosConfig:e,originMethod:"getInfo",path:`accounts/${u.from(t).toString()}`});return n}async function Yo(r){let{aptosConfig:e,accountAddress:t,options:n}=r;return ti({aptosConfig:e,originMethod:"getModules",path:`accounts/${u.from(t).toString()}/modules`,params:{ledger_version:_optionalChain([n, 'optionalAccess', _65 => _65.ledgerVersion]),offset:_optionalChain([n, 'optionalAccess', _66 => _66.offset]),limit:_nullishCoalesce(_optionalChain([n, 'optionalAccess', _67 => _67.limit]), () => (1e3))}})}async function bn(r){return _optionalChain([r, 'access', _68 => _68.options, 'optionalAccess', _69 => _69.ledgerVersion])!==void 0?Jo(r):Ke(async()=>Jo(r),`module-${r.accountAddress}-${r.moduleName}`,1e3*60*5)()}async function Jo(r){let{aptosConfig:e,accountAddress:t,moduleName:n,options:i}=r,{data:o}=await q({aptosConfig:e,originMethod:"getModule",path:`accounts/${u.from(t).toString()}/module/${n}`,params:{ledger_version:_optionalChain([i, 'optionalAccess', _70 => _70.ledgerVersion])}});return o}async function Zo(r){let{aptosConfig:e,accountAddress:t,options:n}=r;return nn({aptosConfig:e,originMethod:"getTransactions",path:`accounts/${u.from(t).toString()}/transactions`,params:{start:_optionalChain([n, 'optionalAccess', _71 => _71.offset]),limit:_optionalChain([n, 'optionalAccess', _72 => _72.limit])}})}async function es(r){let{aptosConfig:e,accountAddress:t,options:n}=r;return ti({aptosConfig:e,originMethod:"getResources",path:`accounts/${u.from(t).toString()}/resources`,params:{ledger_version:_optionalChain([n, 'optionalAccess', _73 => _73.ledgerVersion]),offset:_optionalChain([n, 'optionalAccess', _74 => _74.offset]),limit:_nullishCoalesce(_optionalChain([n, 'optionalAccess', _75 => _75.limit]), () => (999))}})}async function li(r){let{aptosConfig:e,accountAddress:t,resourceType:n,options:i}=r,{data:o}=await q({aptosConfig:e,originMethod:"getResource",path:`accounts/${u.from(t).toString()}/resource/${n}`,params:{ledger_version:_optionalChain([i, 'optionalAccess', _76 => _76.ledgerVersion])}});return o.data}async function jt(r){let{aptosConfig:e,authenticationKey:t,options:n}=r,i=await li({aptosConfig:e,accountAddress:"0x1",resourceType:"0x1::account::OriginatingAddress",options:n}),{address_map:{handle:o}}=i,s=u.from(t);try{let a=await Tn({aptosConfig:e,handle:o,data:{key:s.toString(),key_type:"address",value_type:"address"},options:n});return u.from(a)}catch(a){if(a instanceof Ae&&a.data.error_code==="table_item_not_found")return s;throw a}}async function ts(r){let{aptosConfig:e,accountAddress:t}=r,i={owner_address:{_eq:u.from(t).toStringLong()},amount:{_gt:0}},s=await T({aptosConfig:e,query:{query:zo,variables:{where_condition:i}},originMethod:"getAccountTokensCount"});return s.current_token_ownerships_v2_aggregate.aggregate?s.current_token_ownerships_v2_aggregate.aggregate.count:0}async function rs(r){let{aptosConfig:e,accountAddress:t,options:n}=r,o={owner_address:{_eq:u.from(t).toStringLong()},amount:{_gt:0}};_optionalChain([n, 'optionalAccess', _77 => _77.tokenStandard])&&(o.token_standard={_eq:_optionalChain([n, 'optionalAccess', _78 => _78.tokenStandard])});let s={query:Uo,variables:{where_condition:o,offset:_optionalChain([n, 'optionalAccess', _79 => _79.offset]),limit:_optionalChain([n, 'optionalAccess', _80 => _80.limit]),order_by:_optionalChain([n, 'optionalAccess', _81 => _81.orderBy])}};return(await T({aptosConfig:e,query:s,originMethod:"getAccountOwnedTokens"})).current_token_ownerships_v2}async function ns(r){let{aptosConfig:e,accountAddress:t,collectionAddress:n,options:i}=r,o=u.from(t).toStringLong(),s=u.from(n).toStringLong(),a={owner_address:{_eq:o},current_token_data:{collection_id:{_eq:s}},amount:{_gt:0}};_optionalChain([i, 'optionalAccess', _82 => _82.tokenStandard])&&(a.token_standard={_eq:_optionalChain([i, 'optionalAccess', _83 => _83.tokenStandard])});let c={query:ko,variables:{where_condition:a,offset:_optionalChain([i, 'optionalAccess', _84 => _84.offset]),limit:_optionalChain([i, 'optionalAccess', _85 => _85.limit]),order_by:_optionalChain([i, 'optionalAccess', _86 => _86.orderBy])}};return(await T({aptosConfig:e,query:c,originMethod:"getAccountOwnedTokensFromCollectionAddress"})).current_token_ownerships_v2}async function is(r){let{aptosConfig:e,accountAddress:t,options:n}=r,o={owner_address:{_eq:u.from(t).toStringLong()}};_optionalChain([n, 'optionalAccess', _87 => _87.tokenStandard])&&(o.current_collection={token_standard:{_eq:_optionalChain([n, 'optionalAccess', _88 => _88.tokenStandard])}});let s={query:Ko,variables:{where_condition:o,offset:_optionalChain([n, 'optionalAccess', _89 => _89.offset]),limit:_optionalChain([n, 'optionalAccess', _90 => _90.limit]),order_by:_optionalChain([n, 'optionalAccess', _91 => _91.orderBy])}};return(await T({aptosConfig:e,query:s,originMethod:"getAccountCollectionsWithOwnedTokens"})).current_collection_ownership_v2_view}async function os(r){let{aptosConfig:e,accountAddress:t}=r,n=u.from(t).toStringLong(),o=await T({aptosConfig:e,query:{query:Do,variables:{address:n}},originMethod:"getAccountTransactionsCount"});return o.account_transactions_aggregate.aggregate?o.account_transactions_aggregate.aggregate.count:0}async function ss(r){let{aptosConfig:e,accountAddress:t,options:n}=r,i=u.from(t).toStringLong(),o={..._optionalChain([n, 'optionalAccess', _92 => _92.where]),owner_address:{_eq:i}},s={query:Ro,variables:{where_condition:o,offset:_optionalChain([n, 'optionalAccess', _93 => _93.offset]),limit:_optionalChain([n, 'optionalAccess', _94 => _94.limit]),order_by:_optionalChain([n, 'optionalAccess', _95 => _95.orderBy])}};return(await T({aptosConfig:e,query:s,originMethod:"getAccountCoinsData"})).current_fungible_asset_balances}async function as(r){let{aptosConfig:e,accountAddress:t}=r,n=u.from(t).toStringLong(),o=await T({aptosConfig:e,query:{query:Co,variables:{address:n}},originMethod:"getAccountCoinsCount"});if(!o.current_fungible_asset_balances_aggregate.aggregate)throw Error("Failed to get the count of account coins");return o.current_fungible_asset_balances_aggregate.aggregate.count}async function cs(r){let{aptosConfig:e,accountAddress:t,options:n}=r,o={owner_address:{_eq:u.from(t).toStringLong()}},s={query:mn,variables:{where_condition:o,offset:_optionalChain([n, 'optionalAccess', _96 => _96.offset]),limit:_optionalChain([n, 'optionalAccess', _97 => _97.limit]),order_by:_optionalChain([n, 'optionalAccess', _98 => _98.orderBy])}};return(await T({aptosConfig:e,query:s,originMethod:"getAccountOwnedObjects"})).current_objects}async function us(r){let{aptosConfig:e,privateKey:t}=r,n=new N(t.publicKey());if(t instanceof Ge){let o=L.fromPublicKey({publicKey:n}).derivedAddress();return at.fromPrivateKey({privateKey:t,address:o})}if(t instanceof H){let i=L.fromPublicKey({publicKey:n});if(await Xo({authKey:i,aptosConfig:e})){let c=i.derivedAddress();return at.fromPrivateKey({privateKey:t,address:c,legacy:!1})}let s=L.fromPublicKey({publicKey:n.publicKey});if(await Xo({authKey:s,aptosConfig:e})){let c=s.derivedAddress();return at.fromPrivateKey({privateKey:t,address:c,legacy:!0})}}throw new Error(`Can't derive account from private key ${t}`)}async function Xo(r){let{aptosConfig:e,authKey:t}=r,n=await jt({aptosConfig:e,authenticationKey:t.derivedAddress()});try{return await Oe({aptosConfig:e,accountAddress:n}),!0}catch(i){if(i.status===404)return!1;throw new Error(`Error while looking for an account info ${n.toString()}`)}}async function yi(r){let{aptosConfig:e,options:t}=r;return nn({aptosConfig:e,originMethod:"getTransactions",path:"transactions",params:{start:_optionalChain([t, 'optionalAccess', _99 => _99.offset]),limit:_optionalChain([t, 'optionalAccess', _100 => _100.limit])}})}async function Sn(r){let{aptosConfig:e}=r;return Ke(async()=>{let{data:t}=await q({aptosConfig:e,originMethod:"getGasPriceEstimation",path:"estimate_gas_price"});return t},`gas-price-${e.network}`,1e3*60*5)()}async function ps(r){let{aptosConfig:e,ledgerVersion:t}=r,{data:n}=await q({aptosConfig:e,originMethod:"getTransactionByVersion",path:`transactions/by_version/${t}`});return n}async function Sr(r){let{aptosConfig:e,transactionHash:t}=r,{data:n}=await q({aptosConfig:e,path:`transactions/by_hash/${t}`,originMethod:"getTransactionByHash"});return n}async function ds(r){let{aptosConfig:e,transactionHash:t}=r;try{return(await Sr({aptosConfig:e,transactionHash:t})).type==="pending_transaction"}catch(n){if(_optionalChain([n, 'optionalAccess', _101 => _101.status])===404)return!0;throw n}}async function Hc(r){let{aptosConfig:e,transactionHash:t}=r,{data:n}=await q({aptosConfig:e,path:`transactions/wait_by_hash/${t}`,originMethod:"longWaitForTransaction"});return n}async function Jt(r){let{aptosConfig:e,transactionHash:t,options:n}=r,i=_nullishCoalesce(_optionalChain([n, 'optionalAccess', _102 => _102.timeoutSecs]), () => (20)),o=_nullishCoalesce(_optionalChain([n, 'optionalAccess', _103 => _103.checkSuccess]), () => (!0)),s=!0,a=0,c,p,l=200,h=1.5;function g(d){if(!(d instanceof Ae)||(p=d,d.status!==404&&d.status>=400&&d.status<500))throw d}try{c=await Sr({aptosConfig:e,transactionHash:t}),s=c.type==="pending_transaction"}catch(d){g(d)}if(s){let d=Date.now();try{c=await Hc({aptosConfig:e,transactionHash:t}),s=c.type==="pending_transaction"}catch(b){g(b)}a=(Date.now()-d)/1e3}for(;s&&!(a>=i);){try{if(c=await Sr({aptosConfig:e,transactionHash:t}),s=c.type==="pending_transaction",!s)break}catch(d){g(d)}await _chunkIHUCZKG2js.b.call(void 0, l),a+=l/1e3,l*=h}if(c===void 0)throw p||new wn(`Fetching transaction ${t} failed and timed out after ${i} seconds`,c);if(c.type==="pending_transaction")throw new wn(`Transaction ${t} timed out in pending state after ${i} seconds`,c);if(!o)return c;if(!c.success)throw new gi(`Transaction ${t} failed with an error: ${c.vm_status}`,c);return c}async function _n(r){let{aptosConfig:e,processorType:t}=r,n=BigInt(r.minimumLedgerVersion),i=3e3,o=new Date().getTime(),s=BigInt(-1);for(;s<n;){if(new Date().getTime()-o>i)throw new Error("waitForLastSuccessIndexerVersionSync timeout");if(t===void 0?s=await An({aptosConfig:e}):s=(await hn({aptosConfig:e,processorType:t})).last_success_version,s>=n)break;await _chunkIHUCZKG2js.b.call(void 0, 200)}}var wn=class extends Error{constructor(e,t){super(e),this.lastSubmittedTransaction=t}},gi=class extends Error{constructor(e,t){super(e),this.transaction=t}};async function ls(r){let{aptosConfig:e,ledgerVersion:t,options:n}=r,{data:i}=await q({aptosConfig:e,originMethod:"getBlockByVersion",path:`blocks/by_version/${t}`,params:{with_transactions:_optionalChain([n, 'optionalAccess', _104 => _104.withTransactions])}});return ys({block:i,...r})}async function gs(r){let{aptosConfig:e,blockHeight:t,options:n}=r,{data:i}=await q({aptosConfig:e,originMethod:"getBlockByHeight",path:`blocks/by_height/${t}`,params:{with_transactions:_optionalChain([n, 'optionalAccess', _105 => _105.withTransactions])}});return ys({block:i,...r})}async function ys(r){let{aptosConfig:e,block:t,options:n}=r;if(_optionalChain([n, 'optionalAccess', _106 => _106.withTransactions])){t.transactions=_nullishCoalesce(t.transactions, () => ([]));let i=t.transactions[t.transactions.length-1],o=BigInt(t.first_version),s=BigInt(t.last_version),a=_optionalChain([i, 'optionalAccess', _107 => _107.version]),c;if(a===void 0?c=o-1n:c=BigInt(a),c===s)return t;let p=[],l=100n;for(let g=c+1n;g<s;g+=BigInt(100))p.push(yi({aptosConfig:e,options:{offset:g,limit:Math.min(Number(l),Number(s-g+1n))}}));let h=await Promise.all(p);for(let g of h)t.transactions.push(...g)}return t}async function w(r){r.minimumLedgerVersion!==void 0&&await _n({aptosConfig:r.config,minimumLedgerVersion:r.minimumLedgerVersion,processorType:r.processorType})}function ms(r){return typeof r=="boolean"}function ct(r){return typeof r=="string"}function qc(r){return typeof r=="number"}function xn(r){if(qc(r))return r;if(ct(r)&&r!=="")return Number.parseInt(r,10)}function En(r){return typeof r=="number"||typeof r=="bigint"||typeof r=="string"}function fs(r){return r==null}function As(r){return mi(r)||Ai(r)||hi(r)||Ti(r)||bi(r)||wi(r)||Si(r)||Pn(r)||fi(r)||$c(r)||r instanceof S||r instanceof Y}function mi(r){return r instanceof U}function Pn(r){return r instanceof u}function fi(r){return r instanceof x}function $c(r){return r instanceof mt}function Ai(r){return r instanceof X}function hi(r){return r instanceof _e}function Ti(r){return r instanceof xe}function bi(r){return r instanceof Q}function wi(r){return r instanceof Ee}function Si(r){return r instanceof ye}function hs(r){return"bytecode"in r}function z(r,e){throw new Error(`Type mismatch for argument ${e}, expected '${r}'`)}function Ts(r){let e=r.params.findIndex(t=>t!=="signer"&&t!=="&signer");return e<0?r.params.length:e}function _r(r){let e=r.split("::");if(e.length!==3)throw new Error(`Invalid function ${r}`);let t=e[0],n=e[1],i=e[2];return{moduleAddress:t,moduleName:n,functionName:i}}function bs(r){return!!r.match(/^[_a-zA-Z0-9]+$/)}function ws(r){return!!r.match(/\s/)}function Wc(r){return!!r.match(/^T[0-9]+$/)}function Qc(r){return!!r.match(/^&.+$/)}function jc(r){switch(r){case"signer":case"address":case"bool":case"u8":case"u16":case"u32":case"u64":case"u128":case"u256":return!0;default:return!1}}function Jc(r,e){let t=e;for(;t<r.length;t+=1){let n=r[t];if(!ws(n))break}return t}var Xc=(b=>(b.InvalidTypeTag="unknown type",b.UnexpectedGenericType="unexpected generic type",b.UnexpectedTypeArgumentClose="unexpected '>'",b.UnexpectedWhitespaceCharacter="unexpected whitespace character",b.UnexpectedComma="unexpected ','",b.TypeArgumentCountMismatch="type argument count doesn't match expected amount",b.MissingTypeArgumentClose="no matching '>' for '<'",b.MissingTypeArgument="no type argument before ','",b.UnexpectedPrimitiveTypeArguments="primitive types not expected to have type arguments",b.UnexpectedVectorTypeArgumentCount="vector type expected to have exactly one type argument",b.UnexpectedStructFormat="unexpected struct format, must be of the form 0xaddress::module_name::struct_name",b.InvalidModuleNameCharacter="module name must only contain alphanumeric or '_' characters",b.InvalidStructNameCharacter="struct name must only contain alphanumeric or '_' characters",b.InvalidAddress="struct address must be valid",b))(Xc||{}),W= exports.TypeTagParserError =class extends Error{constructor(e,t){super(`Failed to parse typeTag '${e}', ${t}`)}};function Ye(r,e){let t=_nullishCoalesce(_optionalChain([e, 'optionalAccess', _108 => _108.allowGenerics]), () => (!1)),n=[],i=[],o=[],s=0,a="",c=1;for(;s<r.length;){let p=r[s];if(p==="<")n.push({savedExpectedTypes:c,savedStr:a,savedTypes:o}),a="",o=[],c=1;else if(p===">"){if(a!==""){let b=xr(a,i,t);o.push(b)}let l=n.pop();if(l===void 0)throw new W(r,"unexpected '>'");if(c!==o.length)throw new W(r,"type argument count doesn't match expected amount");let{savedStr:h,savedTypes:g,savedExpectedTypes:d}=l;i=o,o=g,a=h,c=d}else if(p===","){if(n.length===0)throw new W(r,"unexpected ','");if(a.length===0)throw new W(r,"no type argument before ','");let l=xr(a,i,t);i=[],o.push(l),a="",c+=1}else if(ws(p)){let l=!1;if(a.length!==0){let g=xr(a,i,t);i=[],o.push(g),a="",l=!0}s=Jc(r,s);let h=r[s];if(s<r.length&&l&&h!==","&&h!==">")throw new W(r,"unexpected whitespace character");continue}else a+=p;s+=1}if(n.length>0)throw new W(r,"no matching '>' for '<'");switch(o.length){case 0:return xr(a,i,t);case 1:if(a==="")return o[0];throw new W(r,"unexpected ','");default:throw new W(r,"unexpected whitespace character")}}function xr(r,e,t){let n=r.trim(),i=n.toLowerCase();if(jc(i)&&e.length>0)throw new W(r,"primitive types not expected to have type arguments");switch(n.toLowerCase()){case"signer":return new St;case"bool":return new M;case"address":return new ee;case"u8":return new pe;case"u16":return new qe;case"u32":return new $e;case"u64":return new j;case"u128":return new We;case"u256":return new Qe;case"vector":if(e.length!==1)throw new W(r,"vector type expected to have exactly one type argument");return new C(e[0]);default:if(Qc(n)){let a=n.substring(1);return new an(xr(a,e,t))}if(Wc(n)){if(t)return new G(Number(n.split("T")[1]));throw new W(r,"unexpected generic type")}if(!n.match(/:/))throw new W(r,"unknown type");let o=n.split("::");if(o.length!==3)throw new W(r,"unexpected struct format, must be of the form 0xaddress::module_name::struct_name");let s;try{s=u.fromString(o[0])}catch (e3){throw new W(r,"struct address must be valid")}if(!bs(o[1]))throw new W(r,"module name must only contain alphanumeric or '_' characters");if(!bs(o[2]))throw new W(r,"struct name must only contain alphanumeric or '_' characters");return new A(new De(s,new R(o[1]),new R(o[2]),e))}}var Yc=new TextEncoder;function vn(r){return _nullishCoalesce(_optionalChain([r, 'optionalAccess', _109 => _109.map, 'call', _110 => _110(e=>ct(e)?Ye(e):e)]), () => ([]))}async function Ss(r,e,t,n){let i=await bn({aptosConfig:n,accountAddress:r,moduleName:e});if(i.abi)return i.abi.exposed_functions.find(o=>o.name===t)}async function _s(r,e,t,n){let i=await Ss(r,e,t,n);if(!i)throw new Error(`Could not find entry function ABI for '${r}::${e}::${t}'`);if(!i.is_entry)throw new Error(`'${r}::${e}::${t}' is not an entry function`);let o=Ts(i),s=[];for(let a=o;a<i.params.length;a+=1)s.push(Ye(i.params[a],{allowGenerics:!0}));return{signers:o,typeParameters:i.generic_type_params,parameters:s}}async function xs(r,e,t,n){let i=await Ss(r,e,t,n);if(!i)throw new Error(`Could not find view function ABI for '${r}::${e}::${t}'`);if(!i.is_view)throw new Error(`'${r}::${e}::${t}' is not an view function`);let o=[];for(let a=0;a<i.params.length;a+=1)o.push(Ye(i.params[a],{allowGenerics:!0}));let s=[];for(let a=0;a<i.return.length;a+=1)s.push(Ye(i.return[a],{allowGenerics:!0}));return{typeParameters:i.generic_type_params,parameters:o,returnTypes:s}}function xi(r,e,t,n,i){if(n>=e.parameters.length)throw new Error(`Too many arguments for '${r}', expected ${e.parameters.length}`);let o=e.parameters[n];return Xt(t,o,n,i)}function Xt(r,e,t,n){return As(r)?(_i(e,r,t),r):Zc(r,e,t,n)}function Zc(r,e,t,n){if(e.isBool()){if(ms(r))return new U(r);if(ct(r)){if(r==="true")return new U(!0);if(r==="false")return new U(!1)}z("boolean",t)}if(e.isAddress()){if(ct(r))return u.fromString(r);z("string | AccountAddress",t)}if(e.isU8()){let i=xn(r);if(i!==void 0)return new X(i);z("number | string",t)}if(e.isU16()){let i=xn(r);if(i!==void 0)return new _e(i);z("number | string",t)}if(e.isU32()){let i=xn(r);if(i!==void 0)return new xe(i);z("number | string",t)}if(e.isU64()){if(En(r))return new Q(BigInt(r));z("bigint | number | string",t)}if(e.isU128()){if(En(r))return new Ee(BigInt(r));z("bigint | number | string",t)}if(e.isU256()){if(En(r))return new ye(BigInt(r));z("bigint | number | string",t)}if(e.isGeneric()){let i=e.value;if(i<0||i>=n.length)throw new Error(`Generic argument ${e.toString()} is invalid for argument ${t}`);return Xt(r,n[i],t,n)}if(e.isVector()){if(e.value.isU8()){if(ct(r))return S.U8(Yc.encode(r));if(r instanceof Uint8Array)return S.U8(r);if(r instanceof ArrayBuffer)return S.U8(new Uint8Array(r))}if(Array.isArray(r))return new S(r.map(i=>Xt(i,e.value,t,n)));throw new Error(`Type mismatch for argument ${t}, type '${e.toString()}'`)}if(e.isStruct()){if(e.isString()){if(ct(r))return new x(r);z("string",t)}if(e.isObject()){if(ct(r))return u.fromString(r);z("string | AccountAddress",t)}if(e.isOption()){if(fs(r)){let i=e.value.typeArgs[0];return i instanceof M?new Y(null):i instanceof ee?new Y(null):i instanceof pe?new Y(null):i instanceof qe?new Y(null):i instanceof $e?new Y(null):i instanceof j?new Y(null):i instanceof We?new Y(null):i instanceof Qe?new Y(null):new Y(null)}return new Y(Xt(r,e.value.typeArgs[0],t,n))}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 _i(r,e,t){if(r.isBool()){if(mi(e))return;z("Bool",t)}if(r.isAddress()){if(Pn(e))return;z("AccountAddress",t)}if(r.isU8()){if(Ai(e))return;z("U8",t)}if(r.isU16()){if(hi(e))return;z("U16",t)}if(r.isU32()){if(Ti(e))return;z("U32",t)}if(r.isU64()){if(bi(e))return;z("U64",t)}if(r.isU128()){if(wi(e))return;z("U128",t)}if(r.isU256()){if(Si(e))return;z("U256",t)}if(r.isVector()){if(e instanceof S){e.values.length>0&&_i(r.value,e.values[0],t);return}z("MoveVector",t)}if(r instanceof A){if(r.isString()){if(fi(e))return;z("MoveString",t)}if(r.isObject()){if(Pn(e))return;z("AccountAddress",t)}if(r.isOption()){if(e instanceof Y){e.value!==void 0&&_i(r.value.typeArgs[0],e.value,t);return}z("MoveOption",t)}}throw new Error(`Type mismatch for argument ${t}, expected '${r.toString()}'`)}async function In(r){if(hs(r))return nu(r);let{moduleAddress:e,moduleName:t,functionName:n}=_r(r.function),i=await Is({key:"entry-function",moduleAddress:e,moduleName:t,functionName:n,aptosConfig:r.aptosConfig,abi:r.abi,fetch:_s});return tu({...r,abi:i})}function tu(r){let e=r.abi,{moduleAddress:t,moduleName:n,functionName:i}=_r(r.function),o=vn(r.typeArguments);if(o.length!==e.typeParameters.length)throw new Error(`Type argument count mismatch, expected ${e.typeParameters.length}, received ${o.length}`);let s=r.functionArguments.map((c,p)=>xi(r.function,e,c,p,o));if(s.length!==e.parameters.length)throw new Error(`Too few arguments for '${t}::${n}::${i}', expected ${e.parameters.length} but got ${s.length}`);let a=xt.build(`${t}::${n}`,i,o,s);if("multisigAddress"in r){let c=u.from(r.multisigAddress);return new Ar(new Tr(c,new br(a)))}return new fr(a)}async function Es(r){let{moduleAddress:e,moduleName:t,functionName:n}=_r(r.function),i=await Is({key:"view-function",moduleAddress:e,moduleName:t,functionName:n,aptosConfig:r.aptosConfig,abi:r.abi,fetch:xs});return ru({abi:i,...r})}function ru(r){let e=r.abi,{moduleAddress:t,moduleName:n,functionName:i}=_r(r.function),o=vn(r.typeArguments);if(o.length!==e.typeParameters.length)throw new Error(`Type argument count mismatch, expected ${e.typeParameters.length}, received ${o.length}`);let s=_nullishCoalesce(_optionalChain([r, 'optionalAccess', _111 => _111.functionArguments, 'optionalAccess', _112 => _112.map, 'call', _113 => _113((a,c)=>xi(r.function,e,a,c,o))]), () => ([]));if(s.length!==e.parameters.length)throw new Error(`Too few arguments for '${t}::${n}::${i}', expected ${e.parameters.length} but got ${s.length}`);return xt.build(`${t}::${n}`,i,o,s)}function nu(r){return new mr(new hr(m.fromHexInput(r.bytecode).toUint8Array(),vn(r.typeArguments),r.functionArguments))}async function iu(r){let{aptosConfig:e,sender:t,payload:n,options:i,feePayerAddress:o}=r,s=async()=>Yn[e.network]?{chainId:Yn[e.network]}:{chainId:(await fn({aptosConfig:e})).chain_id},a=async()=>_optionalChain([i, 'optionalAccess', _114 => _114.gasUnitPrice])?{gasEstimate:i.gasUnitPrice}:{gasEstimate:(await Sn({aptosConfig:e})).gas_estimate},c=async()=>{let K=async()=>_optionalChain([i, 'optionalAccess', _115 => _115.accountSequenceNumber])!==void 0?i.accountSequenceNumber:(await Oe({aptosConfig:e,accountAddress:t})).sequence_number;if(o&&u.from(o).equals(u.ZERO))try{return await K()}catch (e4){return 0}else return K()},[{chainId:p},{gasEstimate:l},h]=await Promise.all([s(),a(),c()]),{maxGasAmount:g,gasUnitPrice:d,expireTimestamp:b}={maxGasAmount:_optionalChain([i, 'optionalAccess', _116 => _116.maxGasAmount])?BigInt(i.maxGasAmount):BigInt(2e5),gasUnitPrice:_nullishCoalesce(_optionalChain([i, 'optionalAccess', _117 => _117.gasUnitPrice]), () => (BigInt(l))),expireTimestamp:_nullishCoalesce(_optionalChain([i, 'optionalAccess', _118 => _118.expireTimestamp]), () => (BigInt(Math.floor(Date.now()/1e3)+20)))};return new he(u.from(t),BigInt(h),n,BigInt(g),BigInt(d),BigInt(b),new Vt(p))}async function Ei(r){let{aptosConfig:e,sender:t,payload:n,options:i,feePayerAddress:o}=r,s=await iu({aptosConfig:e,sender:t,payload:n,options:i,feePayerAddress:o});if("secondarySignerAddresses"in r){let a=_nullishCoalesce(_optionalChain([r, 'access', _119 => _119.secondarySignerAddresses, 'optionalAccess', _120 => _120.map, 'call', _121 => _121(c=>u.from(c))]), () => ([]));return new ln(s,a,r.feePayerAddress?u.from(r.feePayerAddress):void 0)}return new dn(s,r.feePayerAddress?u.from(r.feePayerAddress):void 0)}function Ps(r){let{signerPublicKey:e,transaction:t,secondarySignersPublicKeys:n,feePayerPublicKey:i}=r,o=Yt(e);if(t.feePayerAddress){let a=new Pt(t.rawTransaction,_nullishCoalesce(t.secondarySignerAddresses, () => ([])),t.feePayerAddress),c=[];t.secondarySignerAddresses&&(n?c=n.map(h=>Yt(h)):c=Array.from({length:t.secondarySignerAddresses.length},()=>Yt(void 0)));let p=Yt(i),l=new Ct(o,_nullishCoalesce(t.secondarySignerAddresses, () => ([])),c,{address:t.feePayerAddress,authenticator:p});return new Je(a.raw_txn,l).bcsToBytes()}if(t.secondarySignerAddresses){let a=new Et(t.rawTransaction,t.secondarySignerAddresses),c=[];n?c=n.map(l=>Yt(l)):c=Array.from({length:t.secondarySignerAddresses.length},()=>Yt(void 0));let p=new It(o,t.secondarySignerAddresses,c);return new Je(a.raw_txn,p).bcsToBytes()}let s;if(o instanceof Ie)s=new vt(o.public_key,o.signature);else if(o instanceof ae||o instanceof ze)s=new st(o);else if(o instanceof Lt)s=new st(o);else throw new Error("Invalid public key");return new Je(t.rawTransaction,s).bcsToBytes()}function Yt(r){if(!r)return new Lt;let t=O.isInstance(r)||re.isInstance(r)||Fe.isInstance(r)?new N(r):r,n=new I(new Uint8Array(64));if(P.isInstance(t))return new Ie(t,n);if(N.isInstance(t))return O.isInstance(t.publicKey)?new ae(t,new $(Le.getSimulationSignature())):new ae(t,new $(n));if(ke.isInstance(t))return new ze(t,new He({signatures:t.publicKeys.map(()=>new $(n)),bitmap:t.createBitmap({bits:Array(t.publicKeys.length).fill(0).map((i,o)=>o)})}));throw new Error("Unsupported PublicKey used for simulations")}function Pi(r){let{transaction:e,feePayerAuthenticator:t,additionalSignersAuthenticators:n}=r,i=mo(Z,r.senderAuthenticator),o;if(e.feePayerAddress){if(!t)throw new Error("Must provide a feePayerAuthenticator argument to generate a signed fee payer transaction");o=new Ct(i,_nullishCoalesce(e.secondarySignerAddresses, () => ([])),_nullishCoalesce(n, () => ([])),{address:e.feePayerAddress,authenticator:t})}else if(e.secondarySignerAddresses){if(!n)throw new Error("Must provide a additionalSignersAuthenticators argument to generate a signed multi agent transaction");o=new It(i,e.secondarySignerAddresses,n)}else i instanceof Ie?o=new vt(i.public_key,i.signature):o=new st(i);return new Je(e.rawTransaction,o).bcsToBytes()}function vs(r){let e=_sha3.sha3_256.create();for(let t of r)e.update(t);return e.digest()}var ou=vs(["APTOS::Transaction"]);function pb(r){let e=Pi(r);return new m(vs([ou,new Uint8Array([0]),e])).toString()}async function Is({key:r,moduleAddress:e,moduleName:t,functionName:n,aptosConfig:i,abi:o,fetch:s}){return o!==void 0?o:Ke(async()=>s(e,t,n,i),`${r}-${i.network}-${e}-${t}-${n}`,1e3*60*5)()}async function we(r){let{aptosConfig:e,payload:t,options:n}=r,i=await Es({...t,aptosConfig:e}),o=new B;i.serialize(o);let s=o.toUint8Array(),{data:a}=await ot({aptosConfig:e,path:"view",originMethod:"view",contentType:"application/x.aptos.view_function+bcs",params:{ledger_version:_optionalChain([n, 'optionalAccess', _122 => _122.ledgerVersion])},body:s});return a}async function Cs(r){let{aptosConfig:e,payload:t,options:n}=r,{data:i}=await ot({aptosConfig:e,originMethod:"viewJson",path:"view",params:{ledger_version:_optionalChain([n, 'optionalAccess', _123 => _123.ledgerVersion])},body:{function:t.function,type_arguments:_nullishCoalesce(t.typeArguments, () => ([])),arguments:_nullishCoalesce(t.functionArguments, () => ([]))}});return i}var Er=class{constructor(e){this.config=e}async getAccountInfo(e){return Oe({aptosConfig:this.config,...e})}async getAccountModules(e){return Yo({aptosConfig:this.config,...e})}async getAccountModule(e){return bn({aptosConfig:this.config,...e})}async getAccountTransactions(e){return Zo({aptosConfig:this.config,...e})}async getAccountResources(e){return es({aptosConfig:this.config,...e})}async getAccountResource(e){return li({aptosConfig:this.config,...e})}async lookupOriginalAccountAddress(e){return jt({aptosConfig:this.config,...e})}async getAccountTokensCount(e){return await w({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"account_transactions_processor"}),ts({aptosConfig:this.config,...e})}async getAccountOwnedTokens(e){return await w({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),rs({aptosConfig:this.config,...e})}async getAccountOwnedTokensFromCollectionAddress(e){return await w({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),ns({aptosConfig:this.config,...e})}async getAccountCollectionsWithOwnedTokens(e){return await w({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),is({aptosConfig:this.config,...e})}async getAccountTransactionsCount(e){return await w({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"account_transactions_processor"}),os({aptosConfig:this.config,...e})}async getAccountCoinsData(e){return await w({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"fungible_asset_processor"}),ss({aptosConfig:this.config,...e})}async getAccountCoinsCount(e){return await w({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"fungible_asset_processor"}),as({aptosConfig:this.config,...e})}async getAccountAPTAmount(e){return this.getAccountCoinAmount({coinType:bt,faMetadataAddress:lo,...e})}async getAccountCoinAmount(e){let{accountAddress:t,coinType:n,faMetadataAddress:i,minimumLedgerVersion:o}=e;o&&console.warn(`minimumLedgerVersion is not used anymore, here for backward
|
|
477
|
+
`;async function fr(n){let{aptosConfig:e}=n,{data:t}=await L({aptosConfig:e,originMethod:"getLedgerInfo",path:""});return t}async function Yo(n){let{aptosConfig:e,limit:t}=n;return(await T({aptosConfig:e,query:{query:Mo,variables:{limit:t}},originMethod:"getChainTopUserTransactions"})).user_transactions}async function T(n){let{aptosConfig:e,query:t,originMethod:r}=n,{data:i}=await To({aptosConfig:e,originMethod:_nullishCoalesce(r, () => ("queryIndexer")),path:"",body:t,overrides:{WITH_CREDENTIALS:!1}});return i}async function nu(n){let{aptosConfig:e}=n;return(await T({aptosConfig:e,query:{query:di},originMethod:"getProcessorStatuses"})).processor_status}async function Ar(n){let e=await nu({aptosConfig:n.aptosConfig});return BigInt(e[0].last_success_version)}async function hr(n){let{aptosConfig:e,processorType:t}=n;return(await T({aptosConfig:e,query:{query:di,variables:{where_condition:{processor:{_eq:t}}}},originMethod:"getProcessorStatus"})).processor_status[0]}async function Tr(n){let{aptosConfig:e,handle:t,data:r,options:i}=n;return(await st({aptosConfig:e,originMethod:"getTableItem",path:`tables/${t}/item`,params:{ledger_version:_optionalChain([i, 'optionalAccess', _63 => _63.ledgerVersion])},body:r})).data}async function Zo(n){let{aptosConfig:e,options:t}=n,r={query:Qo,variables:{where_condition:_optionalChain([t, 'optionalAccess', _64 => _64.where]),offset:_optionalChain([t, 'optionalAccess', _65 => _65.offset]),limit:_optionalChain([t, 'optionalAccess', _66 => _66.limit]),order_by:_optionalChain([t, 'optionalAccess', _67 => _67.orderBy])}};return(await T({aptosConfig:e,query:r,originMethod:"getTableItemsData"})).table_items}async function es(n){let{aptosConfig:e,options:t}=n,r={query:jo,variables:{where_condition:_optionalChain([t, 'optionalAccess', _68 => _68.where]),offset:_optionalChain([t, 'optionalAccess', _69 => _69.offset]),limit:_optionalChain([t, 'optionalAccess', _70 => _70.limit]),order_by:_optionalChain([t, 'optionalAccess', _71 => _71.orderBy])}};return(await T({aptosConfig:e,query:r,originMethod:"getTableItemsMetadata"})).table_metadatas}async function Oe(n){let{aptosConfig:e,accountAddress:t}=n,{data:r}=await L({aptosConfig:e,originMethod:"getInfo",path:`accounts/${_chunkRX5UBAMEjs.Z.from(t).toString()}`});return r}async function rs(n){let{aptosConfig:e,accountAddress:t,options:r}=n;return ti({aptosConfig:e,originMethod:"getModules",path:`accounts/${_chunkRX5UBAMEjs.Z.from(t).toString()}/modules`,params:{ledger_version:_optionalChain([r, 'optionalAccess', _72 => _72.ledgerVersion]),offset:_optionalChain([r, 'optionalAccess', _73 => _73.offset]),limit:_nullishCoalesce(_optionalChain([r, 'optionalAccess', _74 => _74.limit]), () => (1e3))}})}async function br(n){return _optionalChain([n, 'access', _75 => _75.options, 'optionalAccess', _76 => _76.ledgerVersion])!==void 0?ts(n):Ke(async()=>ts(n),`module-${n.accountAddress}-${n.moduleName}`,1e3*60*5)()}async function ts(n){let{aptosConfig:e,accountAddress:t,moduleName:r,options:i}=n,{data:o}=await L({aptosConfig:e,originMethod:"getModule",path:`accounts/${_chunkRX5UBAMEjs.Z.from(t).toString()}/module/${r}`,params:{ledger_version:_optionalChain([i, 'optionalAccess', _77 => _77.ledgerVersion])}});return o}async function is(n){let{aptosConfig:e,accountAddress:t,options:r}=n;return sr({aptosConfig:e,originMethod:"getTransactions",path:`accounts/${_chunkRX5UBAMEjs.Z.from(t).toString()}/transactions`,params:{start:_optionalChain([r, 'optionalAccess', _78 => _78.offset]),limit:_optionalChain([r, 'optionalAccess', _79 => _79.limit])}})}async function os(n){let{aptosConfig:e,accountAddress:t,options:r}=n;return ti({aptosConfig:e,originMethod:"getResources",path:`accounts/${_chunkRX5UBAMEjs.Z.from(t).toString()}/resources`,params:{ledger_version:_optionalChain([r, 'optionalAccess', _80 => _80.ledgerVersion]),offset:_optionalChain([r, 'optionalAccess', _81 => _81.offset]),limit:_nullishCoalesce(_optionalChain([r, 'optionalAccess', _82 => _82.limit]), () => (999))}})}async function li(n){let{aptosConfig:e,accountAddress:t,resourceType:r,options:i}=n,{data:o}=await L({aptosConfig:e,originMethod:"getResource",path:`accounts/${_chunkRX5UBAMEjs.Z.from(t).toString()}/resource/${r}`,params:{ledger_version:_optionalChain([i, 'optionalAccess', _83 => _83.ledgerVersion])}});return o.data}async function Xt(n){let{aptosConfig:e,authenticationKey:t,options:r}=n,i=await li({aptosConfig:e,accountAddress:"0x1",resourceType:"0x1::account::OriginatingAddress",options:r}),{address_map:{handle:o}}=i,s=_chunkRX5UBAMEjs.Z.from(t);try{let a=await Tr({aptosConfig:e,handle:o,data:{key:s.toString(),key_type:"address",value_type:"address"},options:r});return _chunkRX5UBAMEjs.Z.from(a)}catch(a){if(a instanceof Z&&a.data.error_code==="table_item_not_found")return s;throw a}}async function ss(n){let{aptosConfig:e,accountAddress:t}=n,i={owner_address:{_eq:_chunkRX5UBAMEjs.Z.from(t).toStringLong()},amount:{_gt:0}},s=await T({aptosConfig:e,query:{query:Go,variables:{where_condition:i}},originMethod:"getAccountTokensCount"});return s.current_token_ownerships_v2_aggregate.aggregate?s.current_token_ownerships_v2_aggregate.aggregate.count:0}async function as(n){let{aptosConfig:e,accountAddress:t,options:r}=n,o={owner_address:{_eq:_chunkRX5UBAMEjs.Z.from(t).toStringLong()},amount:{_gt:0}};_optionalChain([r, 'optionalAccess', _84 => _84.tokenStandard])&&(o.token_standard={_eq:_optionalChain([r, 'optionalAccess', _85 => _85.tokenStandard])});let s={query:Fo,variables:{where_condition:o,offset:_optionalChain([r, 'optionalAccess', _86 => _86.offset]),limit:_optionalChain([r, 'optionalAccess', _87 => _87.limit]),order_by:_optionalChain([r, 'optionalAccess', _88 => _88.orderBy])}};return(await T({aptosConfig:e,query:s,originMethod:"getAccountOwnedTokens"})).current_token_ownerships_v2}async function cs(n){let{aptosConfig:e,accountAddress:t,collectionAddress:r,options:i}=n,o=_chunkRX5UBAMEjs.Z.from(t).toStringLong(),s=_chunkRX5UBAMEjs.Z.from(r).toStringLong(),a={owner_address:{_eq:o},current_token_data:{collection_id:{_eq:s}},amount:{_gt:0}};_optionalChain([i, 'optionalAccess', _89 => _89.tokenStandard])&&(a.token_standard={_eq:_optionalChain([i, 'optionalAccess', _90 => _90.tokenStandard])});let c={query:No,variables:{where_condition:a,offset:_optionalChain([i, 'optionalAccess', _91 => _91.offset]),limit:_optionalChain([i, 'optionalAccess', _92 => _92.limit]),order_by:_optionalChain([i, 'optionalAccess', _93 => _93.orderBy])}};return(await T({aptosConfig:e,query:c,originMethod:"getAccountOwnedTokensFromCollectionAddress"})).current_token_ownerships_v2}async function us(n){let{aptosConfig:e,accountAddress:t,options:r}=n,o={owner_address:{_eq:_chunkRX5UBAMEjs.Z.from(t).toStringLong()}};_optionalChain([r, 'optionalAccess', _94 => _94.tokenStandard])&&(o.current_collection={token_standard:{_eq:_optionalChain([r, 'optionalAccess', _95 => _95.tokenStandard])}});let s={query:Oo,variables:{where_condition:o,offset:_optionalChain([r, 'optionalAccess', _96 => _96.offset]),limit:_optionalChain([r, 'optionalAccess', _97 => _97.limit]),order_by:_optionalChain([r, 'optionalAccess', _98 => _98.orderBy])}};return(await T({aptosConfig:e,query:s,originMethod:"getAccountCollectionsWithOwnedTokens"})).current_collection_ownership_v2_view}async function ds(n){let{aptosConfig:e,accountAddress:t}=n,r=_chunkRX5UBAMEjs.Z.from(t).toStringLong(),o=await T({aptosConfig:e,query:{query:Bo,variables:{address:r}},originMethod:"getAccountTransactionsCount"});return o.account_transactions_aggregate.aggregate?o.account_transactions_aggregate.aggregate.count:0}async function ps(n){let{aptosConfig:e,accountAddress:t,options:r}=n,i=_chunkRX5UBAMEjs.Z.from(t).toStringLong(),o={..._optionalChain([r, 'optionalAccess', _99 => _99.where]),owner_address:{_eq:i}},s={query:ko,variables:{where_condition:o,offset:_optionalChain([r, 'optionalAccess', _100 => _100.offset]),limit:_optionalChain([r, 'optionalAccess', _101 => _101.limit]),order_by:_optionalChain([r, 'optionalAccess', _102 => _102.orderBy])}};return(await T({aptosConfig:e,query:s,originMethod:"getAccountCoinsData"})).current_fungible_asset_balances}async function ls(n){let{aptosConfig:e,accountAddress:t}=n,r=_chunkRX5UBAMEjs.Z.from(t).toStringLong(),o=await T({aptosConfig:e,query:{query:zo,variables:{address:r}},originMethod:"getAccountCoinsCount"});if(!o.current_fungible_asset_balances_aggregate.aggregate)throw Error("Failed to get the count of account coins");return o.current_fungible_asset_balances_aggregate.aggregate.count}async function gs(n){let{aptosConfig:e,accountAddress:t,options:r}=n,o={owner_address:{_eq:_chunkRX5UBAMEjs.Z.from(t).toStringLong()}},s={query:yr,variables:{where_condition:o,offset:_optionalChain([r, 'optionalAccess', _103 => _103.offset]),limit:_optionalChain([r, 'optionalAccess', _104 => _104.limit]),order_by:_optionalChain([r, 'optionalAccess', _105 => _105.orderBy])}};return(await T({aptosConfig:e,query:s,originMethod:"getAccountOwnedObjects"})).current_objects}async function ms(n){let{aptosConfig:e,privateKey:t}=n,r=new O(t.publicKey());if(t instanceof Ge){let o=B.fromPublicKey({publicKey:r}).derivedAddress();return ke.fromPrivateKey({privateKey:t,address:o})}if(t instanceof q){let i=B.fromPublicKey({publicKey:r});if(await ns({authKey:i,aptosConfig:e})){let c=i.derivedAddress();return ke.fromPrivateKey({privateKey:t,address:c,legacy:!1})}let s=B.fromPublicKey({publicKey:r.publicKey});if(await ns({authKey:s,aptosConfig:e})){let c=s.derivedAddress();return ke.fromPrivateKey({privateKey:t,address:c,legacy:!0})}}throw new Error(`Can't derive account from private key ${t}`)}async function ns(n){let{aptosConfig:e,authKey:t}=n,r=await Xt({aptosConfig:e,authenticationKey:t.derivedAddress()});try{return await Oe({aptosConfig:e,accountAddress:r}),!0}catch(i){if(i.status===404)return!1;throw new Error(`Error while looking for an account info ${r.toString()}`)}}async function mi(n){let{aptosConfig:e,options:t}=n;return sr({aptosConfig:e,originMethod:"getTransactions",path:"transactions",params:{start:_optionalChain([t, 'optionalAccess', _106 => _106.offset]),limit:_optionalChain([t, 'optionalAccess', _107 => _107.limit])}})}async function Sr(n){let{aptosConfig:e}=n;return Ke(async()=>{let{data:t}=await L({aptosConfig:e,originMethod:"getGasPriceEstimation",path:"estimate_gas_price"});return t},`gas-price-${e.network}`,1e3*60*5)()}async function ys(n){let{aptosConfig:e,ledgerVersion:t}=n,{data:r}=await L({aptosConfig:e,originMethod:"getTransactionByVersion",path:`transactions/by_version/${t}`});return r}async function Pn(n){let{aptosConfig:e,transactionHash:t}=n,{data:r}=await L({aptosConfig:e,path:`transactions/by_hash/${t}`,originMethod:"getTransactionByHash"});return r}async function fs(n){let{aptosConfig:e,transactionHash:t}=n;try{return(await Pn({aptosConfig:e,transactionHash:t})).type==="pending_transaction"}catch(r){if(_optionalChain([r, 'optionalAccess', _108 => _108.status])===404)return!0;throw r}}async function ru(n){let{aptosConfig:e,transactionHash:t}=n,{data:r}=await L({aptosConfig:e,path:`transactions/wait_by_hash/${t}`,originMethod:"longWaitForTransaction"});return r}async function Yt(n){let{aptosConfig:e,transactionHash:t,options:r}=n,i=_nullishCoalesce(_optionalChain([r, 'optionalAccess', _109 => _109.timeoutSecs]), () => (20)),o=_nullishCoalesce(_optionalChain([r, 'optionalAccess', _110 => _110.checkSuccess]), () => (!0)),s=!0,a=0,c,d,l=200,h=1.5;function p(g){if(!(g instanceof Z)||(d=g,g.status!==404&&g.status>=400&&g.status<500))throw g}try{c=await Pn({aptosConfig:e,transactionHash:t}),s=c.type==="pending_transaction"}catch(g){p(g)}if(s){let g=Date.now();try{c=await ru({aptosConfig:e,transactionHash:t}),s=c.type==="pending_transaction"}catch(b){p(b)}a=(Date.now()-g)/1e3}for(;s&&!(a>=i);){try{if(c=await Pn({aptosConfig:e,transactionHash:t}),s=c.type==="pending_transaction",!s)break}catch(g){p(g)}await _chunkRX5UBAMEjs._.call(void 0, l),a+=l/1e3,l*=h}if(c===void 0)throw d||new wr(`Fetching transaction ${t} failed and timed out after ${i} seconds`,c);if(c.type==="pending_transaction")throw new wr(`Transaction ${t} timed out in pending state after ${i} seconds`,c);if(!o)return c;if(!c.success)throw new gi(`Transaction ${t} failed with an error: ${c.vm_status}`,c);return c}async function _r(n){let{aptosConfig:e,processorType:t}=n,r=BigInt(n.minimumLedgerVersion),i=3e3,o=new Date().getTime(),s=BigInt(-1);for(;s<r;){if(new Date().getTime()-o>i)throw new Error("waitForLastSuccessIndexerVersionSync timeout");if(t===void 0?s=await Ar({aptosConfig:e}):s=(await hr({aptosConfig:e,processorType:t})).last_success_version,s>=r)break;await _chunkRX5UBAMEjs._.call(void 0, 200)}}var wr=class extends Error{constructor(e,t){super(e),this.lastSubmittedTransaction=t}},gi=class extends Error{constructor(e,t){super(e),this.transaction=t}};async function As(n){let{aptosConfig:e,ledgerVersion:t,options:r}=n,{data:i}=await L({aptosConfig:e,originMethod:"getBlockByVersion",path:`blocks/by_version/${t}`,params:{with_transactions:_optionalChain([r, 'optionalAccess', _111 => _111.withTransactions])}});return Ts({block:i,...n})}async function hs(n){let{aptosConfig:e,blockHeight:t,options:r}=n,{data:i}=await L({aptosConfig:e,originMethod:"getBlockByHeight",path:`blocks/by_height/${t}`,params:{with_transactions:_optionalChain([r, 'optionalAccess', _112 => _112.withTransactions])}});return Ts({block:i,...n})}async function Ts(n){let{aptosConfig:e,block:t,options:r}=n;if(_optionalChain([r, 'optionalAccess', _113 => _113.withTransactions])){t.transactions=_nullishCoalesce(t.transactions, () => ([]));let i=t.transactions[t.transactions.length-1],o=BigInt(t.first_version),s=BigInt(t.last_version),a=_optionalChain([i, 'optionalAccess', _114 => _114.version]),c;if(a===void 0?c=o-1n:c=BigInt(a),c===s)return t;let d=[],l=100n;for(let p=c+1n;p<s;p+=BigInt(100))d.push(mi({aptosConfig:e,options:{offset:p,limit:Math.min(Number(l),Number(s-p+1n))}}));let h=await Promise.all(d);for(let p of h)t.transactions.push(...p)}return t}async function S(n){n.minimumLedgerVersion!==void 0&&await _r({aptosConfig:n.config,minimumLedgerVersion:n.minimumLedgerVersion,processorType:n.processorType})}function bs(n){return typeof n=="boolean"}function et(n){return typeof n=="string"}function iu(n){return typeof n=="number"}function Er(n){if(iu(n))return n;if(et(n)&&n!=="")return Number.parseInt(n,10)}function Pr(n){return typeof n=="number"||typeof n=="bigint"||typeof n=="string"}function ws(n){return n==null}function Ss(n){return yi(n)||Ai(n)||hi(n)||Ti(n)||bi(n)||wi(n)||Si(n)||xr(n)||fi(n)||ou(n)||n instanceof _||n instanceof Y}function yi(n){return n instanceof U}function xr(n){return n instanceof _chunkRX5UBAMEjs.Z}function fi(n){return n instanceof P}function ou(n){return n instanceof gt}function Ai(n){return n instanceof X}function hi(n){return n instanceof we}function Ti(n){return n instanceof Se}function bi(n){return n instanceof W}function wi(n){return n instanceof _e}function Si(n){return n instanceof me}function _s(n){return"bytecode"in n}function z(n,e){throw new Error(`Type mismatch for argument ${e}, expected '${n}'`)}function Es(n){let e=n.params.findIndex(t=>t!=="signer"&&t!=="&signer");return e<0?n.params.length:e}function Ps(n){return!!n.match(/^[_a-zA-Z0-9]+$/)}function xs(n){return!!n.match(/\s/)}function su(n){return!!n.match(/^T[0-9]+$/)}function au(n){return!!n.match(/^&.+$/)}function cu(n){switch(n){case"signer":case"address":case"bool":case"u8":case"u16":case"u32":case"u64":case"u128":case"u256":return!0;default:return!1}}function uu(n,e){let t=e;for(;t<n.length;t+=1){let r=n[t];if(!xs(r))break}return t}var du=(b=>(b.InvalidTypeTag="unknown type",b.UnexpectedGenericType="unexpected generic type",b.UnexpectedTypeArgumentClose="unexpected '>'",b.UnexpectedWhitespaceCharacter="unexpected whitespace character",b.UnexpectedComma="unexpected ','",b.TypeArgumentCountMismatch="type argument count doesn't match expected amount",b.MissingTypeArgumentClose="no matching '>' for '<'",b.MissingTypeArgument="no type argument before ','",b.UnexpectedPrimitiveTypeArguments="primitive types not expected to have type arguments",b.UnexpectedVectorTypeArgumentCount="vector type expected to have exactly one type argument",b.UnexpectedStructFormat="unexpected struct format, must be of the form 0xaddress::module_name::struct_name",b.InvalidModuleNameCharacter="module name must only contain alphanumeric or '_' characters",b.InvalidStructNameCharacter="struct name must only contain alphanumeric or '_' characters",b.InvalidAddress="struct address must be valid",b))(du||{}),$= exports.TypeTagParserError =class extends Error{constructor(e,t){super(`Failed to parse typeTag '${e}', ${t}`)}};function Fe(n,e){let t=_nullishCoalesce(_optionalChain([e, 'optionalAccess', _115 => _115.allowGenerics]), () => (!1)),r=[],i=[],o=[],s=0,a="",c=1;for(;s<n.length;){let d=n[s];if(d==="<")r.push({savedExpectedTypes:c,savedStr:a,savedTypes:o}),a="",o=[],c=1;else if(d===">"){if(a!==""){let b=xn(a,i,t);o.push(b)}let l=r.pop();if(l===void 0)throw new $(n,"unexpected '>'");if(c!==o.length)throw new $(n,"type argument count doesn't match expected amount");let{savedStr:h,savedTypes:p,savedExpectedTypes:g}=l;i=o,o=p,a=h,c=g}else if(d===","){if(r.length===0)throw new $(n,"unexpected ','");if(a.length===0)throw new $(n,"no type argument before ','");let l=xn(a,i,t);i=[],o.push(l),a="",c+=1}else if(xs(d)){let l=!1;if(a.length!==0){let p=xn(a,i,t);i=[],o.push(p),a="",l=!0}s=uu(n,s);let h=n[s];if(s<n.length&&l&&h!==","&&h!==">")throw new $(n,"unexpected whitespace character");continue}else a+=d;s+=1}if(r.length>0)throw new $(n,"no matching '>' for '<'");switch(o.length){case 0:return xn(a,i,t);case 1:if(a==="")return o[0];throw new $(n,"unexpected ','");default:throw new $(n,"unexpected whitespace character")}}function xn(n,e,t){let r=n.trim(),i=r.toLowerCase();if(cu(i)&&e.length>0)throw new $(n,"primitive types not expected to have type arguments");switch(r.toLowerCase()){case"signer":return new bt;case"bool":return new V;case"address":return new F;case"u8":return new pe;case"u16":return new We;case"u32":return new Qe;case"u64":return new j;case"u128":return new je;case"u256":return new Je;case"vector":if(e.length!==1)throw new $(n,"vector type expected to have exactly one type argument");return new v(e[0]);default:if(au(r)){let a=r.substring(1);return new cr(xn(a,e,t))}if(su(r)){if(t)return new G(Number(r.split("T")[1]));throw new $(n,"unexpected generic type")}if(!r.match(/:/))throw new $(n,"unknown type");let o=r.split("::");if(o.length!==3)throw new $(n,"unexpected struct format, must be of the form 0xaddress::module_name::struct_name");let s;try{s=_chunkRX5UBAMEjs.Z.fromString(o[0])}catch (e3){throw new $(n,"struct address must be valid")}if(!Ps(o[1]))throw new $(n,"module name must only contain alphanumeric or '_' characters");if(!Ps(o[2]))throw new $(n,"struct name must only contain alphanumeric or '_' characters");return new A(new ze(s,new K(o[1]),new K(o[2]),e))}}var pu=new TextEncoder;function Zt(n){return _nullishCoalesce(_optionalChain([n, 'optionalAccess', _116 => _116.map, 'call', _117 => _117(e=>et(e)?Fe(e):e)]), () => ([]))}async function Ei(n,e,t,r){let i=await br({aptosConfig:r,accountAddress:n,moduleName:e});if(i.abi)return i.abi.exposed_functions.find(o=>o.name===t)}async function Is(n,e,t,r){let i=await Ei(n,e,t,r);if(!i)throw new Error(`Could not find function ABI for '${n}::${e}::${t}'`);let o=[];for(let s=0;s<i.params.length;s+=1)o.push(Fe(i.params[s],{allowGenerics:!0}));return{typeParameters:i.generic_type_params,parameters:o}}async function vs(n,e,t,r){let i=await Ei(n,e,t,r);if(!i)throw new Error(`Could not find entry function ABI for '${n}::${e}::${t}'`);if(!i.is_entry)throw new Error(`'${n}::${e}::${t}' is not an entry function`);let o=Es(i),s=[];for(let a=o;a<i.params.length;a+=1)s.push(Fe(i.params[a],{allowGenerics:!0}));return{signers:o,typeParameters:i.generic_type_params,parameters:s}}async function Cs(n,e,t,r){let i=await Ei(n,e,t,r);if(!i)throw new Error(`Could not find view function ABI for '${n}::${e}::${t}'`);if(!i.is_view)throw new Error(`'${n}::${e}::${t}' is not an view function`);let o=[];for(let a=0;a<i.params.length;a+=1)o.push(Fe(i.params[a],{allowGenerics:!0}));let s=[];for(let a=0;a<i.return.length;a+=1)s.push(Fe(i.return[a],{allowGenerics:!0}));return{typeParameters:i.generic_type_params,parameters:o,returnTypes:s}}function Ks(n,e,t,r,i){return n instanceof _chunkRX5UBAMEjs.X?n:_chunkRX5UBAMEjs.X.newBytes(Ir(e,t,n,r,i).bcsToBytes())}function Ir(n,e,t,r,i){if(r>=e.parameters.length)throw new Error(`Too many arguments for '${n}', expected ${e.parameters.length}`);let o=e.parameters[r];return Rt(t,o,r,i)}function Rt(n,e,t,r){return Ss(n)?(_i(e,n,t),n):lu(n,e,t,r)}function lu(n,e,t,r){if(e.isBool()){if(bs(n))return new U(n);if(et(n)){if(n==="true")return new U(!0);if(n==="false")return new U(!1)}z("boolean",t)}if(e.isAddress()){if(et(n))return _chunkRX5UBAMEjs.Z.fromString(n);z("string | AccountAddress",t)}if(e.isU8()){let i=Er(n);if(i!==void 0)return new X(i);z("number | string",t)}if(e.isU16()){let i=Er(n);if(i!==void 0)return new we(i);z("number | string",t)}if(e.isU32()){let i=Er(n);if(i!==void 0)return new Se(i);z("number | string",t)}if(e.isU64()){if(Pr(n))return new W(BigInt(n));z("bigint | number | string",t)}if(e.isU128()){if(Pr(n))return new _e(BigInt(n));z("bigint | number | string",t)}if(e.isU256()){if(Pr(n))return new me(BigInt(n));z("bigint | number | string",t)}if(e.isGeneric()){let i=e.value;if(i<0||i>=r.length)throw new Error(`Generic argument ${e.toString()} is invalid for argument ${t}`);return Rt(n,r[i],t,r)}if(e.isVector()){if(e.value.isU8()){if(et(n))return _.U8(pu.encode(n));if(n instanceof Uint8Array)return _.U8(n);if(n instanceof ArrayBuffer)return _.U8(new Uint8Array(n))}if(et(n)&&n.startsWith("["))return Rt(JSON.parse(n),e,t,r);if(Array.isArray(n))return new _(n.map(i=>Rt(i,e.value,t,r)));throw new Error(`Type mismatch for argument ${t}, type '${e.toString()}'`)}if(e.isStruct()){if(e.isString()){if(et(n))return new P(n);z("string",t)}if(e.isObject()){if(et(n))return _chunkRX5UBAMEjs.Z.fromString(n);z("string | AccountAddress",t)}if(e.isOption()){if(ws(n)){let i=e.value.typeArgs[0];return i instanceof V?new Y(null):i instanceof F?new Y(null):i instanceof pe?new Y(null):i instanceof We?new Y(null):i instanceof Qe?new Y(null):i instanceof j?new Y(null):i instanceof je?new Y(null):i instanceof Je?new Y(null):new Y(null)}return new Y(Rt(n,e.value.typeArgs[0],t,r))}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 _i(n,e,t){if(n.isBool()){if(yi(e))return;z("Bool",t)}if(n.isAddress()){if(xr(e))return;z("AccountAddress",t)}if(n.isU8()){if(Ai(e))return;z("U8",t)}if(n.isU16()){if(hi(e))return;z("U16",t)}if(n.isU32()){if(Ti(e))return;z("U32",t)}if(n.isU64()){if(bi(e))return;z("U64",t)}if(n.isU128()){if(wi(e))return;z("U128",t)}if(n.isU256()){if(Si(e))return;z("U256",t)}if(n.isVector()){if(e instanceof _){e.values.length>0&&_i(n.value,e.values[0],t);return}z("MoveVector",t)}if(n instanceof A){if(n.isString()){if(fi(e))return;z("MoveString",t)}if(n.isObject()){if(xr(e))return;z("AccountAddress",t)}if(n.isOption()){if(e instanceof Y){e.value!==void 0&&_i(n.value.typeArgs[0],e.value,t);return}z("MoveOption",t)}}throw new Error(`Type mismatch for argument ${t}, expected '${n.toString()}'`)}async function vr(n){if(_s(n))return fu(n);let{moduleAddress:e,moduleName:t,functionName:r}=_chunkRX5UBAMEjs.ha.call(void 0, n.function),i=await Ds({key:"entry-function",moduleAddress:e,moduleName:t,functionName:r,aptosConfig:n.aptosConfig,abi:n.abi,fetch:vs});return mu({...n,abi:i})}function mu(n){let e=n.abi,{moduleAddress:t,moduleName:r,functionName:i}=_chunkRX5UBAMEjs.ha.call(void 0, n.function),o=Zt(n.typeArguments);if(o.length!==e.typeParameters.length)throw new Error(`Type argument count mismatch, expected ${e.typeParameters.length}, received ${o.length}`);let s=n.functionArguments.map((c,d)=>Ir(n.function,e,c,d,o));if(s.length!==e.parameters.length)throw new Error(`Too few arguments for '${t}::${r}::${i}', expected ${e.parameters.length} but got ${s.length}`);let a=_t.build(`${t}::${r}`,i,o,s);if("multisigAddress"in n){let c=_chunkRX5UBAMEjs.Z.from(n.multisigAddress);return new Tn(new wn(c,new Sn(a)))}return new hn(a)}async function Cr(n){let{moduleAddress:e,moduleName:t,functionName:r}=_chunkRX5UBAMEjs.ha.call(void 0, n.function),i=await Ds({key:"view-function",moduleAddress:e,moduleName:t,functionName:r,aptosConfig:n.aptosConfig,abi:n.abi,fetch:Cs});return yu({abi:i,...n})}function yu(n){let e=n.abi,{moduleAddress:t,moduleName:r,functionName:i}=_chunkRX5UBAMEjs.ha.call(void 0, n.function),o=Zt(n.typeArguments);if(o.length!==e.typeParameters.length)throw new Error(`Type argument count mismatch, expected ${e.typeParameters.length}, received ${o.length}`);let s=_nullishCoalesce(_optionalChain([n, 'optionalAccess', _118 => _118.functionArguments, 'optionalAccess', _119 => _119.map, 'call', _120 => _120((a,c)=>Ir(n.function,e,a,c,o))]), () => ([]));if(s.length!==e.parameters.length)throw new Error(`Too few arguments for '${t}::${r}::${i}', expected ${e.parameters.length} but got ${s.length}`);return _t.build(`${t}::${r}`,i,o,s)}function fu(n){return new St(new bn(_chunkRX5UBAMEjs.j.fromHexInput(n.bytecode).toUint8Array(),Zt(n.typeArguments),n.functionArguments))}async function Pi(n){let{aptosConfig:e,sender:t,payload:r,options:i,feePayerAddress:o}=n,s=async()=>Yr[e.network]?{chainId:Yr[e.network]}:{chainId:(await fr({aptosConfig:e})).chain_id},a=async()=>_optionalChain([i, 'optionalAccess', _121 => _121.gasUnitPrice])?{gasEstimate:i.gasUnitPrice}:{gasEstimate:(await Sr({aptosConfig:e})).gas_estimate},c=async()=>{let R=async()=>_optionalChain([i, 'optionalAccess', _122 => _122.accountSequenceNumber])!==void 0?i.accountSequenceNumber:(await Oe({aptosConfig:e,accountAddress:t})).sequence_number;if(o&&_chunkRX5UBAMEjs.Z.from(o).equals(_chunkRX5UBAMEjs.Z.ZERO))try{return await R()}catch (e4){return 0}else return R()},[{chainId:d},{gasEstimate:l},h]=await Promise.all([s(),a(),c()]),{maxGasAmount:p,gasUnitPrice:g,expireTimestamp:b}={maxGasAmount:_optionalChain([i, 'optionalAccess', _123 => _123.maxGasAmount])?BigInt(i.maxGasAmount):BigInt(2e5),gasUnitPrice:_nullishCoalesce(_optionalChain([i, 'optionalAccess', _124 => _124.gasUnitPrice]), () => (BigInt(l))),expireTimestamp:_nullishCoalesce(_optionalChain([i, 'optionalAccess', _125 => _125.expireTimestamp]), () => (BigInt(Math.floor(Date.now()/1e3)+20)))};return new Ae(_chunkRX5UBAMEjs.Z.from(t),BigInt(h),r,BigInt(p),BigInt(g),BigInt(b),new Lt(d))}async function xi(n){let{aptosConfig:e,sender:t,payload:r,options:i,feePayerAddress:o}=n,s=await Pi({aptosConfig:e,sender:t,payload:r,options:i,feePayerAddress:o});if("secondarySignerAddresses"in n){let a=_nullishCoalesce(_optionalChain([n, 'access', _126 => _126.secondarySignerAddresses, 'optionalAccess', _127 => _127.map, 'call', _128 => _128(c=>_chunkRX5UBAMEjs.Z.from(c))]), () => ([]));return new pr(s,a,n.feePayerAddress?_chunkRX5UBAMEjs.Z.from(n.feePayerAddress):void 0)}return new $t(s,n.feePayerAddress?_chunkRX5UBAMEjs.Z.from(n.feePayerAddress):void 0)}function Rs(n){let{signerPublicKey:e,transaction:t,secondarySignersPublicKeys:r,feePayerPublicKey:i}=n,o=en(e);if(t.feePayerAddress){let a=new Pt(t.rawTransaction,_nullishCoalesce(t.secondarySignerAddresses, () => ([])),t.feePayerAddress),c=[];t.secondarySignerAddresses&&(r?c=r.map(h=>en(h)):c=Array.from({length:t.secondarySignerAddresses.length},()=>en(void 0)));let d=en(i),l=new vt(o,_nullishCoalesce(t.secondarySignerAddresses, () => ([])),c,{address:t.feePayerAddress,authenticator:d});return new Ye(a.raw_txn,l).bcsToBytes()}if(t.secondarySignerAddresses){let a=new Et(t.rawTransaction,t.secondarySignerAddresses),c=[];r?c=r.map(l=>en(l)):c=Array.from({length:t.secondarySignerAddresses.length},()=>en(void 0));let d=new It(o,t.secondarySignerAddresses,c);return new Ye(a.raw_txn,d).bcsToBytes()}let s;if(o instanceof xe)s=new xt(o.public_key,o.signature);else if(o instanceof se||o instanceof De)s=new at(o);else if(o instanceof qt)s=new at(o);else throw new Error("Invalid public key");return new Ye(t.rawTransaction,s).bcsToBytes()}function en(n){if(!n)return new qt;let t=k.isInstance(n)||ne.isInstance(n)||Ne.isInstance(n)?new O(n):n,r=new I(new Uint8Array(64));if(x.isInstance(t))return new xe(t,r);if(O.isInstance(t))return k.isInstance(t.publicKey)?new se(t,new H(Ve.getSimulationSignature())):new se(t,new H(r));if(Ue.isInstance(t))return new De(t,new Le({signatures:t.publicKeys.map(()=>new H(r)),bitmap:t.createBitmap({bits:Array(t.publicKeys.length).fill(0).map((i,o)=>o)})}));throw new Error("Unsupported PublicKey used for simulations")}function Ii(n){let{transaction:e,feePayerAuthenticator:t,additionalSignersAuthenticators:r}=n,i=fo(Q,n.senderAuthenticator),o;if(e.feePayerAddress){if(!t)throw new Error("Must provide a feePayerAuthenticator argument to generate a signed fee payer transaction");o=new vt(i,_nullishCoalesce(e.secondarySignerAddresses, () => ([])),_nullishCoalesce(r, () => ([])),{address:e.feePayerAddress,authenticator:t})}else if(e.secondarySignerAddresses){if(!r)throw new Error("Must provide a additionalSignersAuthenticators argument to generate a signed multi agent transaction");o=new It(i,e.secondarySignerAddresses,r)}else i instanceof xe?o=new xt(i.public_key,i.signature):i instanceof $e?o=new Ht(i.public_key,i.signature):o=new at(i);return new Ye(e.rawTransaction,o).bcsToBytes()}function Us(n){let e=_sha3.sha3_256.create();for(let t of n)e.update(t);return e.digest()}var Au=Us(["APTOS::Transaction"]);function Lb(n){let e=Ii(n);return new (0, _chunkRX5UBAMEjs.j)(Us([Au,new Uint8Array([0]),e])).toString()}async function Ds({key:n,moduleAddress:e,moduleName:t,functionName:r,aptosConfig:i,abi:o,fetch:s}){return o!==void 0?o:Ke(async()=>s(e,t,r,i),`${n}-${i.network}-${e}-${t}-${r}`,1e3*60*5)()}var _scriptcomposerpack = require('@aptos-labs/script-composer-pack');var Kr=class n{constructor(e){this.config=e,this.builder=void 0}async init(){if(!n.transactionComposer){let e=await Promise.resolve().then(() => _interopRequireWildcard(require("@aptos-labs/script-composer-pack"))),{TransactionComposer:t,initSync:r}=e;_scriptcomposerpack.ScriptComposerWasm.isInitialized||_scriptcomposerpack.ScriptComposerWasm.init(),r({module:_scriptcomposerpack.ScriptComposerWasm.wasm}),n.transactionComposer=t}this.builder=n.transactionComposer.single_signer()}async addBatchedCalls(e){let{moduleAddress:t,moduleName:r,functionName:i}=_chunkRX5UBAMEjs.ha.call(void 0, e.function),o=this.config.getRequestUrl("Fullnode");await this.builder.load_module(o,`${t}::${r}`),e.typeArguments!==void 0&&await Promise.all(e.typeArguments.map(d=>this.builder.load_type_tag(o,d.toString())));let s=Zt(e.typeArguments),a=await Is(t,r,i,this.config);if(s.length!==a.typeParameters.length)throw new Error(`Type argument count mismatch, expected ${a.typeParameters.length}, received ${s.length}`);let c=e.functionArguments.map((d,l)=>Ks(d,i,a,l,s));return this.builder.add_batched_call(`${t}::${r}`,i,s.map(d=>d.toString()),c)}build(){return this.builder.generate_batched_calls(!0)}};async function ae(n){let{aptosConfig:e,payload:t,options:r}=n,i=await Cr({...t,aptosConfig:e}),o=new _chunkRX5UBAMEjs.m;i.serialize(o);let s=o.toUint8Array(),{data:a}=await st({aptosConfig:e,path:"view",originMethod:"view",contentType:"application/x.aptos.view_function+bcs",params:{ledger_version:_optionalChain([r, 'optionalAccess', _129 => _129.ledgerVersion])},body:s});return a}async function zs(n){let{aptosConfig:e,payload:t,options:r}=n,{data:i}=await st({aptosConfig:e,originMethod:"viewJson",path:"view",params:{ledger_version:_optionalChain([r, 'optionalAccess', _130 => _130.ledgerVersion])},body:{function:t.function,type_arguments:_nullishCoalesce(t.typeArguments, () => ([])),arguments:_nullishCoalesce(t.functionArguments, () => ([]))}});return i}async function w(n){let e=await hu(n);return Tu(n,e)}async function hu(n){let{aptosConfig:e,data:t}=n,r,i;return"bytecode"in t?i=await vr(t):"multisigAddress"in t?(r={aptosConfig:e,multisigAddress:t.multisigAddress,function:t.function,functionArguments:t.functionArguments,typeArguments:t.typeArguments,abi:t.abi},i=await vr(r)):(r={aptosConfig:e,function:t.function,functionArguments:t.functionArguments,typeArguments:t.typeArguments,abi:t.abi},i=await vr(r)),i}async function Tu(n,e){let{aptosConfig:t,sender:r,options:i}=n,o;if(bu(n)&&(o=_chunkRX5UBAMEjs.Z.ZERO.toString()),wu(n)){let{secondarySignerAddresses:s}=n;return xi({aptosConfig:t,sender:r,payload:e,options:i,secondarySignerAddresses:s,feePayerAddress:o})}return xi({aptosConfig:t,sender:r,payload:e,options:i,feePayerAddress:o})}function bu(n){return n.withFeePayer===!0}function wu(n){return"secondarySignerAddresses"in n}function ks(n){let{transaction:e}=n;return Ie(e)}function Rr(n){let{signer:e,transaction:t}=n;return e.signTransactionWithAuthenticator(t)}function Ur(n){let{signer:e,transaction:t}=n;if(!t.feePayerAddress)throw new Error(`Transaction ${t} is not a Fee Payer transaction`);return t.feePayerAddress=e.accountAddress,Rr({signer:e,transaction:t})}async function Ci(n){let{aptosConfig:e,transaction:t,signerPublicKey:r,secondarySignersPublicKeys:i,feePayerPublicKey:o,options:s}=n,a=Rs({transaction:t,signerPublicKey:r,secondarySignersPublicKeys:i,feePayerPublicKey:o,options:s}),{data:c}=await st({aptosConfig:e,body:a,path:"transactions/simulate",params:{estimate_gas_unit_price:_nullishCoalesce(_optionalChain([n, 'access', _131 => _131.options, 'optionalAccess', _132 => _132.estimateGasUnitPrice]), () => (!1)),estimate_max_gas_amount:_nullishCoalesce(_optionalChain([n, 'access', _133 => _133.options, 'optionalAccess', _134 => _134.estimateMaxGasAmount]), () => (!1)),estimate_prioritized_gas_unit_price:_nullishCoalesce(_optionalChain([n, 'access', _135 => _135.options, 'optionalAccess', _136 => _136.estimatePrioritizedGasUnitPrice]), () => (!1))},originMethod:"simulateTransaction",contentType:"application/x.aptos.signed_transaction+bcs"});return c}async function In(n){let{aptosConfig:e}=n,t=Ii({...n});try{let{data:r}=await st({aptosConfig:e,body:t,path:"transactions",originMethod:"submitTransaction",contentType:"application/x.aptos.signed_transaction+bcs"});return r}catch(r){let i=Ye.deserialize(new C(t));throw i.authenticator.isSingleSender()&&i.authenticator.sender.isSingleKey()&&(i.authenticator.sender.public_key.publicKey instanceof k||i.authenticator.sender.public_key.publicKey instanceof ne)&&await ge.fetchJWK({aptosConfig:e,publicKey:i.authenticator.sender.public_key.publicKey,kid:i.authenticator.sender.signature.signature.getJwkKid()}),r}}async function vn(n){let{aptosConfig:e,signer:t,feePayer:r,transaction:i}=n;lr(t)&&await t.checkKeylessAccountValidity(e),lr(r)&&await r.checkKeylessAccountValidity(e);let o=n.feePayerAuthenticator||r&&Ur({signer:r,transaction:i}),s=Rr({signer:t,transaction:i});return In({aptosConfig:e,transaction:i,senderAuthenticator:s,feePayerAuthenticator:o})}async function Os(n){let{aptosConfig:e,senderAuthenticator:t,feePayer:r,transaction:i}=n;lr(r)&&await r.checkKeylessAccountValidity(e);let o=Ur({signer:r,transaction:i});return In({aptosConfig:e,transaction:i,senderAuthenticator:t,feePayerAuthenticator:o})}var Su={typeParameters:[],parameters:[v.u8(),new v(v.u8())]};async function Fs(n){let{aptosConfig:e,account:t,metadataBytes:r,moduleBytecode:i,options:o}=n,s=i.map(a=>_.U8(a));return w({aptosConfig:e,sender:_chunkRX5UBAMEjs.Z.from(t),data:{function:"0x1::code::publish_package_txn",functionArguments:[_.U8(r),new _(s)],abi:Su},options:o})}var _u={typeParameters:[],parameters:[new pe,v.u8(),new pe,v.u8(),v.u8(),v.u8()]};async function Ns(n){let{aptosConfig:e,fromAccount:t,toNewPrivateKey:r}=n,i=await Oe({aptosConfig:e,accountAddress:t.accountAddress}),o=ke.fromPrivateKey({privateKey:r,legacy:!0}),a=new dr({sequenceNumber:BigInt(i.sequence_number),originator:t.accountAddress,currentAuthKey:_chunkRX5UBAMEjs.Z.from(i.authentication_key),newPublicKey:o.publicKey}).bcsToBytes(),c=t.sign(a),d=o.sign(a),l=await w({aptosConfig:e,sender:t.accountAddress,data:{function:"0x1::account::rotate_authentication_key",functionArguments:[new X(t.signingScheme),_.U8(t.publicKey.toUint8Array()),new X(o.signingScheme),_.U8(o.publicKey.toUint8Array()),_.U8(c.toUint8Array()),_.U8(d.toUint8Array())],abi:_u}});return vn({aptosConfig:e,signer:t,transaction:l})}async function Gs(n){let{aptosConfig:e,sender:t,authenticationFunction:r,options:i}=n,{moduleAddress:o,moduleName:s,functionName:a}=_chunkRX5UBAMEjs.ha.call(void 0, r);return w({aptosConfig:e,sender:t,data:{function:"0x1::account_abstraction::add_authentication_function",typeArguments:[],functionArguments:[o,s,a],abi:{typeParameters:[],parameters:[new F,new A(E()),new A(E())]}},options:i})}async function Bs(n){let{aptosConfig:e,sender:t,authenticationFunction:r,options:i}=n,{moduleAddress:o,moduleName:s,functionName:a}=_chunkRX5UBAMEjs.ha.call(void 0, r);return w({aptosConfig:e,sender:t,data:{function:"0x1::account_abstraction::remove_authentication_function",typeArguments:[],functionArguments:[o,s,a],abi:{typeParameters:[],parameters:[new F,new A(E()),new A(E())]}},options:i})}async function Ms(n){let{aptosConfig:e,sender:t,options:r}=n;return w({aptosConfig:e,sender:t,data:{function:"0x1::account_abstraction::remove_authenticator",typeArguments:[],functionArguments:[],abi:{typeParameters:[],parameters:[]}},options:r})}var Ut=class{constructor(e){this.config=e;this.isAccountAbstractionEnabled=async e=>{let t=await this.getAuthenticationFunction(e),{moduleAddress:r,moduleName:i,functionName:o}=_chunkRX5UBAMEjs.ha.call(void 0, e.authenticationFunction);return _nullishCoalesce(_optionalChain([t, 'optionalAccess', _137 => _137.some, 'call', _138 => _138(s=>_chunkRX5UBAMEjs.Z.fromString(r).equals(s.moduleAddress)&&i===s.moduleName&&o===s.functionName)]), () => (!1))};this.enableAccountAbstractionTransaction=this.addAuthenticationFunctionTransaction;this.disableAccountAbstractionTransaction=async e=>{let{accountAddress:t,authenticationFunction:r,options:i}=e;return r?this.removeAuthenticationFunctionTransaction({accountAddress:t,authenticationFunction:r,options:i}):this.removeDispatchableAuthenticatorTransaction({accountAddress:t,options:i})}}async addAuthenticationFunctionTransaction(e){let{accountAddress:t,authenticationFunction:r,options:i}=e;return Gs({aptosConfig:this.config,authenticationFunction:r,sender:t,options:i})}async removeAuthenticationFunctionTransaction(e){let{accountAddress:t,authenticationFunction:r,options:i}=e;return Bs({aptosConfig:this.config,sender:t,authenticationFunction:r,options:i})}async removeDispatchableAuthenticatorTransaction(e){let{accountAddress:t,options:r}=e;return Ms({aptosConfig:this.config,sender:t,options:r})}async getAuthenticationFunction(e){let{accountAddress:t}=e,[{vec:r}]=await ae({aptosConfig:this.config,payload:{function:"0x1::account_abstraction::dispatchable_authenticator",functionArguments:[_chunkRX5UBAMEjs.Z.from(t)],abi:{typeParameters:[],parameters:[new F],returnTypes:[]}}});if(r.length!==0)return r[0].map(i=>({moduleAddress:_chunkRX5UBAMEjs.Z.fromString(i.module_address),moduleName:i.module_name,functionName:i.function_name}))}};var Cn=class{constructor(e){this.config=e;this.abstraction=new Ut(e)}async getAccountInfo(e){return Oe({aptosConfig:this.config,...e})}async getAccountModules(e){return rs({aptosConfig:this.config,...e})}async getAccountModule(e){return br({aptosConfig:this.config,...e})}async getAccountTransactions(e){return is({aptosConfig:this.config,...e})}async getAccountResources(e){return os({aptosConfig:this.config,...e})}async getAccountResource(e){return li({aptosConfig:this.config,...e})}async lookupOriginalAccountAddress(e){return Xt({aptosConfig:this.config,...e})}async getAccountTokensCount(e){return await S({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"account_transactions_processor"}),ss({aptosConfig:this.config,...e})}async getAccountOwnedTokens(e){return await S({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),as({aptosConfig:this.config,...e})}async getAccountOwnedTokensFromCollectionAddress(e){return await S({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),cs({aptosConfig:this.config,...e})}async getAccountCollectionsWithOwnedTokens(e){return await S({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),us({aptosConfig:this.config,...e})}async getAccountTransactionsCount(e){return await S({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"account_transactions_processor"}),ds({aptosConfig:this.config,...e})}async getAccountCoinsData(e){return await S({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"fungible_asset_processor"}),ps({aptosConfig:this.config,...e})}async getAccountCoinsCount(e){return await S({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"fungible_asset_processor"}),ls({aptosConfig:this.config,...e})}async getAccountAPTAmount(e){return this.getAccountCoinAmount({coinType:ht,faMetadataAddress:go,...e})}async getAccountCoinAmount(e){let{accountAddress:t,coinType:r,faMetadataAddress:i,minimumLedgerVersion:o}=e;o&&console.warn(`minimumLedgerVersion is not used anymore, here for backward
|
|
480
478
|
compatibility see https://github.com/aptos-labs/aptos-ts-sdk/pull/519,
|
|
481
|
-
will be removed in the near future`);let s=n;n===void 0&&i!==void 0&&(s=await Ke(async()=>{try{let p=(await we({aptosConfig:this.config,payload:{function:"0x1::coin::paired_coin",functionArguments:[i]}})).at(0);if(p.vec.length>0&&_chunkIHUCZKG2js.j.call(void 0, p.vec[0]))return _chunkIHUCZKG2js.i.call(void 0, p.vec[0])}catch (e5){}},`coin-mapping-${i.toString()}`,1e3*60*5)());let a;if(n!==void 0&&i!==void 0)a=u.from(i).toStringLong();else if(n!==void 0&&i===void 0)n===bt?a=u.A.toStringLong():a=sn(u.A,n).toStringLong();else if(n===void 0&&i!==void 0){let p=u.from(i);a=p.toStringLong(),p===u.A&&(s=bt)}else throw new Error("Either coinType, faMetadataAddress, or both must be provided");if(s!==void 0){let[p]=await we({aptosConfig:this.config,payload:{function:"0x1::coin::balance",typeArguments:[s],functionArguments:[t]}});return parseInt(p,10)}let[c]=await we({aptosConfig:this.config,payload:{function:"0x1::primary_fungible_store::balance",typeArguments:["0x1::object::ObjectCore"],functionArguments:[t,a]}});return parseInt(c,10)}async getAccountOwnedObjects(e){return await w({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"default_processor"}),cs({aptosConfig:this.config,...e})}async deriveAccountFromPrivateKey(e){return us({aptosConfig:this.config,...e})}};var _aptosclient = require('@aptos-labs/aptos-client'); var _aptosclient2 = _interopRequireDefault(_aptosclient);var Cn=class{constructor(e){this.network=_nullishCoalesce(_optionalChain([e, 'optionalAccess', _124 => _124.network]), () => ("devnet")),this.fullnode=_optionalChain([e, 'optionalAccess', _125 => _125.fullnode]),this.faucet=_optionalChain([e, 'optionalAccess', _126 => _126.faucet]),this.pepper=_optionalChain([e, 'optionalAccess', _127 => _127.pepper]),this.prover=_optionalChain([e, 'optionalAccess', _128 => _128.prover]),this.indexer=_optionalChain([e, 'optionalAccess', _129 => _129.indexer]),this.client=_nullishCoalesce(_optionalChain([e, 'optionalAccess', _130 => _130.client]), () => ({provider:_aptosclient2.default})),this.clientConfig=_nullishCoalesce(_optionalChain([e, 'optionalAccess', _131 => _131.clientConfig]), () => ({})),this.fullnodeConfig=_nullishCoalesce(_optionalChain([e, 'optionalAccess', _132 => _132.fullnodeConfig]), () => ({})),this.indexerConfig=_nullishCoalesce(_optionalChain([e, 'optionalAccess', _133 => _133.indexerConfig]), () => ({})),this.faucetConfig=_nullishCoalesce(_optionalChain([e, 'optionalAccess', _134 => _134.faucetConfig]), () => ({}))}getRequestUrl(e){switch(e){case"Fullnode":if(this.fullnode!==void 0)return this.fullnode;if(this.network==="custom")throw new Error("Please provide a custom full node url");return ao[this.network];case"Faucet":if(this.faucet!==void 0)return this.faucet;if(this.network==="testnet")throw new Error("There is no way to programmatically mint testnet APT, you must use the minting site at https://aptos.dev/network/faucet");if(this.network==="mainnet")throw new Error("There is no mainnet faucet");if(this.network==="custom")throw new Error("Please provide a custom faucet url");return co[this.network];case"Indexer":if(this.indexer!==void 0)return this.indexer;if(this.network==="custom")throw new Error("Please provide a custom indexer url");return so[this.network];case"Pepper":if(this.pepper!==void 0)return this.pepper;if(this.network==="custom")throw new Error("Please provide a custom pepper service url");return jn[this.network];case"Prover":if(this.prover!==void 0)return this.prover;if(this.network==="custom")throw new Error("Please provide a custom prover service url");return Jn[this.network];default:throw Error(`apiType ${e} is not supported`)}}isPepperServiceRequest(e){return jn[this.network]===e}isProverServiceRequest(e){return Jn[this.network]===e}};async function _(r){let e=await au(r);return cu(r,e)}async function au(r){let{aptosConfig:e,data:t}=r,n,i;return"bytecode"in t?i=await In(t):"multisigAddress"in t?(n={aptosConfig:e,multisigAddress:t.multisigAddress,function:t.function,functionArguments:t.functionArguments,typeArguments:t.typeArguments,abi:t.abi},i=await In(n)):(n={aptosConfig:e,function:t.function,functionArguments:t.functionArguments,typeArguments:t.typeArguments,abi:t.abi},i=await In(n)),i}async function cu(r,e){let{aptosConfig:t,sender:n,options:i}=r,o;if(uu(r)&&(o=u.ZERO.toString()),pu(r)){let{secondarySignerAddresses:s}=r;return Ei({aptosConfig:t,sender:n,payload:e,options:i,secondarySignerAddresses:s,feePayerAddress:o})}return Ei({aptosConfig:t,sender:n,payload:e,options:i,feePayerAddress:o})}function uu(r){return r.withFeePayer===!0}function pu(r){return"secondarySignerAddresses"in r}function Rs(r){let{transaction:e}=r;return qt(e)}function Rn(r){let{signer:e,transaction:t}=r;return e.signTransactionWithAuthenticator(t)}function Kn(r){let{signer:e,transaction:t}=r;if(!t.feePayerAddress)throw new Error(`Transaction ${t} is not a Fee Payer transaction`);return t.feePayerAddress=e.accountAddress,Rn({signer:e,transaction:t})}async function vi(r){let{aptosConfig:e,transaction:t,signerPublicKey:n,secondarySignersPublicKeys:i,feePayerPublicKey:o,options:s}=r,a=Ps({transaction:t,signerPublicKey:n,secondarySignersPublicKeys:i,feePayerPublicKey:o,options:s}),{data:c}=await ot({aptosConfig:e,body:a,path:"transactions/simulate",params:{estimate_gas_unit_price:_nullishCoalesce(_optionalChain([r, 'access', _135 => _135.options, 'optionalAccess', _136 => _136.estimateGasUnitPrice]), () => (!1)),estimate_max_gas_amount:_nullishCoalesce(_optionalChain([r, 'access', _137 => _137.options, 'optionalAccess', _138 => _138.estimateMaxGasAmount]), () => (!1)),estimate_prioritized_gas_unit_price:_nullishCoalesce(_optionalChain([r, 'access', _139 => _139.options, 'optionalAccess', _140 => _140.estimatePrioritizedGasUnitPrice]), () => (!1))},originMethod:"simulateTransaction",contentType:"application/x.aptos.signed_transaction+bcs"});return c}async function Pr(r){let{aptosConfig:e}=r,t=Pi({...r});try{let{data:n}=await ot({aptosConfig:e,body:t,path:"transactions",originMethod:"submitTransaction",contentType:"application/x.aptos.signed_transaction+bcs"});return n}catch(n){let i=Je.deserialize(new D(t));throw i.authenticator.isSingleSender()&&i.authenticator.sender.isSingleKey()&&(i.authenticator.sender.public_key.publicKey instanceof O||i.authenticator.sender.public_key.publicKey instanceof re)&&await le.fetchJWK({aptosConfig:e,publicKey:i.authenticator.sender.public_key.publicKey,kid:i.authenticator.sender.signature.signature.getJwkKid()}),n}}async function vr(r){let{aptosConfig:e,signer:t,feePayer:n,transaction:i}=r;gn(t)&&await t.checkKeylessAccountValidity(e),gn(n)&&await n.checkKeylessAccountValidity(e);let o=r.feePayerAuthenticator||n&&Kn({signer:n,transaction:i}),s=Rn({signer:t,transaction:i});return Pr({aptosConfig:e,transaction:i,senderAuthenticator:s,feePayerAuthenticator:o})}async function Ks(r){let{aptosConfig:e,senderAuthenticator:t,feePayer:n,transaction:i}=r;gn(n)&&await n.checkKeylessAccountValidity(e);let o=Kn({signer:n,transaction:i});return Pr({aptosConfig:e,transaction:i,senderAuthenticator:t,feePayerAuthenticator:o})}var du={typeParameters:[],parameters:[C.u8(),new C(C.u8())]};async function Us(r){let{aptosConfig:e,account:t,metadataBytes:n,moduleBytecode:i,options:o}=r,s=i.map(a=>S.U8(a));return _({aptosConfig:e,sender:u.from(t),data:{function:"0x1::code::publish_package_txn",functionArguments:[S.U8(n),new S(s)],abi:du},options:o})}var lu={typeParameters:[],parameters:[new pe,C.u8(),new pe,C.u8(),C.u8(),C.u8()]};async function ks(r){let{aptosConfig:e,fromAccount:t,toNewPrivateKey:n}=r,i=await Oe({aptosConfig:e,accountAddress:t.accountAddress}),o=at.fromPrivateKey({privateKey:n,legacy:!0}),a=new un({sequenceNumber:BigInt(i.sequence_number),originator:t.accountAddress,currentAuthKey:u.from(i.authentication_key),newPublicKey:o.publicKey}).bcsToBytes(),c=t.sign(a),p=o.sign(a),l=await _({aptosConfig:e,sender:t.accountAddress,data:{function:"0x1::account::rotate_authentication_key",functionArguments:[new X(t.signingScheme),S.U8(t.publicKey.toUint8Array()),new X(o.signingScheme),S.U8(o.publicKey.toUint8Array()),S.U8(c.toUint8Array()),S.U8(p.toUint8Array())],abi:lu}});return vr({aptosConfig:e,signer:t,transaction:l})}var gu={typeParameters:[{constraints:[]}],parameters:[new ee,new j]};async function zs(r){let{aptosConfig:e,sender:t,recipient:n,amount:i,coinType:o,options:s}=r;return _({aptosConfig:e,sender:t,data:{function:"0x1::aptos_account::transfer_coins",typeArguments:[_nullishCoalesce(o, () => (bt))],functionArguments:[n,i],abi:gu},options:s})}var Ir=class{constructor(e){this.config=e}async transferCoinTransaction(e){return zs({aptosConfig:this.config,...e})}};var ut={BOOLEAN:"bool",U8:"u8",U16:"u16",U32:"u32",U64:"u64",U128:"u128",U256:"u256",ADDRESS:"address",STRING:"0x1::string::String",ARRAY:"vector<u8>"},Se="0x4::token::Token";async function Ds(r){let{aptosConfig:e,digitalAssetAddress:t}=r,n={token_data_id:{_eq:u.from(t).toStringLong()}};return(await T({aptosConfig:e,query:{query:$o,variables:{where_condition:n}},originMethod:"getDigitalAssetData"})).current_token_datas_v2[0]}async function Os(r){let{aptosConfig:e,digitalAssetAddress:t}=r,n={token_data_id:{_eq:u.from(t).toStringLong()},amount:{_gt:0}};return(await T({aptosConfig:e,query:{query:di,variables:{where_condition:n}},originMethod:"getCurrentDigitalAssetOwnership"})).current_token_ownerships_v2[0]}async function Ns(r){let{aptosConfig:e,ownerAddress:t,options:n}=r,i={owner_address:{_eq:u.from(t).toStringLong()},amount:{_gt:0}},o={query:di,variables:{where_condition:i,offset:_optionalChain([n, 'optionalAccess', _141 => _141.offset]),limit:_optionalChain([n, 'optionalAccess', _142 => _142.limit]),order_by:_optionalChain([n, 'optionalAccess', _143 => _143.orderBy])}};return(await T({aptosConfig:e,query:o,originMethod:"getOwnedDigitalAssets"})).current_token_ownerships_v2}async function Fs(r){let{aptosConfig:e,digitalAssetAddress:t,options:n}=r,i={token_data_id:{_eq:u.from(t).toStringLong()}},o={query:qo,variables:{where_condition:i,offset:_optionalChain([n, 'optionalAccess', _144 => _144.offset]),limit:_optionalChain([n, 'optionalAccess', _145 => _145.limit]),order_by:_optionalChain([n, 'optionalAccess', _146 => _146.orderBy])}};return(await T({aptosConfig:e,query:o,originMethod:"getDigitalAssetActivity"})).token_activities_v2}var yu={typeParameters:[],parameters:[new A(v()),new j,new A(v()),new A(v()),new M,new M,new M,new M,new M,new M,new M,new M,new M,new j,new j]};async function Gs(r){let{aptosConfig:e,options:t,creator:n}=r;return _({aptosConfig:e,sender:n.accountAddress,data:{function:"0x4::aptos_token::create_collection",functionArguments:[new x(r.description),new Q(_nullishCoalesce(r.maxSupply, () => (gt))),new x(r.name),new x(r.uri),new U(_nullishCoalesce(r.mutableDescription, () => (!0))),new U(_nullishCoalesce(r.mutableRoyalty, () => (!0))),new U(_nullishCoalesce(r.mutableURI, () => (!0))),new U(_nullishCoalesce(r.mutableTokenDescription, () => (!0))),new U(_nullishCoalesce(r.mutableTokenName, () => (!0))),new U(_nullishCoalesce(r.mutableTokenProperties, () => (!0))),new U(_nullishCoalesce(r.mutableTokenURI, () => (!0))),new U(_nullishCoalesce(r.tokensBurnableByCreator, () => (!0))),new U(_nullishCoalesce(r.tokensFreezableByCreator, () => (!0))),new Q(_nullishCoalesce(r.royaltyNumerator, () => (0))),new Q(_nullishCoalesce(r.royaltyDenominator, () => (1)))],abi:yu},options:t})}async function Zt(r){let{aptosConfig:e,options:t}=r,n=_optionalChain([t, 'optionalAccess', _147 => _147.where]);_optionalChain([t, 'optionalAccess', _148 => _148.tokenStandard])&&(n.token_standard={_eq:_nullishCoalesce(_optionalChain([t, 'optionalAccess', _149 => _149.tokenStandard]), () => ("v2"))});let i={query:No,variables:{where_condition:n,offset:_optionalChain([t, 'optionalAccess', _150 => _150.offset]),limit:_optionalChain([t, 'optionalAccess', _151 => _151.limit])}};return(await T({aptosConfig:e,query:i,originMethod:"getCollectionData"})).current_collections_v2[0]}async function Bs(r){let{aptosConfig:e,creatorAddress:t,collectionName:n,options:i}=r,o=u.from(t),s={collection_name:{_eq:n},creator_address:{_eq:o.toStringLong()}};return _optionalChain([i, 'optionalAccess', _152 => _152.tokenStandard])&&(s.token_standard={_eq:_nullishCoalesce(_optionalChain([i, 'optionalAccess', _153 => _153.tokenStandard]), () => ("v2"))}),Zt({aptosConfig:e,options:{...i,where:s}})}async function Ms(r){let{aptosConfig:e,creatorAddress:t,options:n}=r,o={creator_address:{_eq:u.from(t).toStringLong()}};return _optionalChain([n, 'optionalAccess', _154 => _154.tokenStandard])&&(o.token_standard={_eq:_nullishCoalesce(_optionalChain([n, 'optionalAccess', _155 => _155.tokenStandard]), () => ("v2"))}),Zt({aptosConfig:e,options:{...n,where:o}})}async function Ls(r){let{aptosConfig:e,collectionId:t,options:n}=r,o={collection_id:{_eq:u.from(t).toStringLong()}};return _optionalChain([n, 'optionalAccess', _156 => _156.tokenStandard])&&(o.token_standard={_eq:_nullishCoalesce(_optionalChain([n, 'optionalAccess', _157 => _157.tokenStandard]), () => ("v2"))}),Zt({aptosConfig:e,options:{...n,where:o}})}async function Vs(r){let{creatorAddress:e,collectionName:t,options:n,aptosConfig:i}=r,o=u.from(e),s={collection_name:{_eq:t},creator_address:{_eq:o.toStringLong()}};return _optionalChain([n, 'optionalAccess', _158 => _158.tokenStandard])&&(s.token_standard={_eq:_nullishCoalesce(_optionalChain([n, 'optionalAccess', _159 => _159.tokenStandard]), () => ("v2"))}),(await Zt({aptosConfig:i,options:{where:s}})).collection_id}var mu={typeParameters:[],parameters:[new A(v()),new A(v()),new A(v()),new A(v()),new C(new A(v())),new C(new A(v())),new C(C.u8())]};async function Hs(r){let{aptosConfig:e,options:t,creator:n,collection:i,description:o,name:s,uri:a,propertyKeys:c,propertyTypes:p,propertyValues:l}=r,h=_optionalChain([p, 'optionalAccess', _160 => _160.map, 'call', _161 => _161(g=>ut[g])]);return _({aptosConfig:e,sender:n.accountAddress,data:{function:"0x4::aptos_token::mint",functionArguments:[new x(i),new x(o),new x(s),new x(a),S.MoveString(_nullishCoalesce(c, () => ([]))),S.MoveString(_nullishCoalesce(h, () => ([]))),ia(_nullishCoalesce(l, () => ([])),_nullishCoalesce(h, () => ([])))],abi:mu},options:t})}var fu={typeParameters:[{constraints:["key"]}],parameters:[new A(de(new G(0))),new ee]};async function qs(r){let{aptosConfig:e,sender:t,digitalAssetAddress:n,recipient:i,digitalAssetType:o,options:s}=r;return _({aptosConfig:e,sender:t.accountAddress,data:{function:"0x1::object::transfer",typeArguments:[_nullishCoalesce(o, () => (Se))],functionArguments:[u.from(n),u.from(i)],abi:fu},options:s})}var Au={typeParameters:[],parameters:[new A(v()),new A(v()),new A(v()),new A(v()),new C(new A(v())),new C(new A(v())),new C(C.u8()),new ee]};async function $s(r){let{aptosConfig:e,account:t,collection:n,description:i,name:o,uri:s,recipient:a,propertyKeys:c,propertyTypes:p,propertyValues:l,options:h}=r;if(_optionalChain([c, 'optionalAccess', _162 => _162.length])!==_optionalChain([l, 'optionalAccess', _163 => _163.length]))throw new Error("Property keys and property values counts do not match");if(_optionalChain([p, 'optionalAccess', _164 => _164.length])!==_optionalChain([l, 'optionalAccess', _165 => _165.length]))throw new Error("Property types and property values counts do not match");let g=_optionalChain([p, 'optionalAccess', _166 => _166.map, 'call', _167 => _167(d=>ut[d])]);return _({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::mint_soul_bound",functionArguments:[n,i,o,s,S.MoveString(_nullishCoalesce(c, () => ([]))),S.MoveString(_nullishCoalesce(g, () => ([]))),ia(_nullishCoalesce(l, () => ([])),_nullishCoalesce(g, () => ([]))),a],abi:Au},options:h})}var hu={typeParameters:[{constraints:["key"]}],parameters:[new A(de(new G(0)))]};async function Ws(r){let{aptosConfig:e,creator:t,digitalAssetAddress:n,digitalAssetType:i,options:o}=r;return _({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::burn",typeArguments:[_nullishCoalesce(i, () => (Se))],functionArguments:[u.from(n)],abi:hu},options:o})}var Tu={typeParameters:[{constraints:["key"]}],parameters:[new A(de(new G(0)))]};async function Qs(r){let{aptosConfig:e,creator:t,digitalAssetAddress:n,digitalAssetType:i,options:o}=r;return _({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::freeze_transfer",typeArguments:[_nullishCoalesce(i, () => (Se))],functionArguments:[n],abi:Tu},options:o})}var bu={typeParameters:[{constraints:["key"]}],parameters:[new A(de(new G(0)))]};async function js(r){let{aptosConfig:e,creator:t,digitalAssetAddress:n,digitalAssetType:i,options:o}=r;return _({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::unfreeze_transfer",typeArguments:[_nullishCoalesce(i, () => (Se))],functionArguments:[n],abi:bu},options:o})}var wu={typeParameters:[{constraints:["key"]}],parameters:[new A(de(new G(0))),new A(v())]};async function Js(r){let{aptosConfig:e,creator:t,description:n,digitalAssetAddress:i,digitalAssetType:o,options:s}=r;return _({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::set_description",typeArguments:[_nullishCoalesce(o, () => (Se))],functionArguments:[u.from(i),new x(n)],abi:wu},options:s})}var Su={typeParameters:[{constraints:["key"]}],parameters:[new A(de(new G(0))),new A(v())]};async function Xs(r){let{aptosConfig:e,creator:t,name:n,digitalAssetAddress:i,digitalAssetType:o,options:s}=r;return _({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::set_name",typeArguments:[_nullishCoalesce(o, () => (Se))],functionArguments:[u.from(i),new x(n)],abi:Su},options:s})}var _u={typeParameters:[{constraints:["key"]}],parameters:[new A(de(new G(0))),new A(v())]};async function Ys(r){let{aptosConfig:e,creator:t,uri:n,digitalAssetAddress:i,digitalAssetType:o,options:s}=r;return _({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::set_uri",typeArguments:[_nullishCoalesce(o, () => (Se))],functionArguments:[u.from(i),new x(n)],abi:_u},options:s})}var xu={typeParameters:[{constraints:["key"]}],parameters:[new A(de(new G(0))),new A(v()),new A(v()),C.u8()]};async function Zs(r){let{aptosConfig:e,creator:t,propertyKey:n,propertyType:i,propertyValue:o,digitalAssetAddress:s,digitalAssetType:a,options:c}=r;return _({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::add_property",typeArguments:[_nullishCoalesce(a, () => (Se))],functionArguments:[u.from(s),new x(n),new x(ut[i]),S.U8(Ii(o,ut[i]))],abi:xu},options:c})}var Eu={typeParameters:[{constraints:["key"]}],parameters:[new A(de(new G(0))),new A(v())]};async function ea(r){let{aptosConfig:e,creator:t,propertyKey:n,digitalAssetAddress:i,digitalAssetType:o,options:s}=r;return _({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::remove_property",typeArguments:[_nullishCoalesce(o, () => (Se))],functionArguments:[u.from(i),new x(n)],abi:Eu},options:s})}var Pu={typeParameters:[{constraints:["key"]}],parameters:[new A(de(new G(0))),new A(v()),new A(v()),C.u8()]};async function ta(r){let{aptosConfig:e,creator:t,propertyKey:n,propertyType:i,propertyValue:o,digitalAssetAddress:s,digitalAssetType:a,options:c}=r;return _({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::update_property",typeArguments:[_nullishCoalesce(a, () => (Se))],functionArguments:[u.from(s),new x(n),new x(ut[i]),Ii(o,ut[i])],abi:Pu},options:c})}var vu={typeParameters:[{constraints:["key"]},{constraints:[]}],parameters:[new A(de(new G(0))),new A(v()),new G(1)]};async function ra(r){let{aptosConfig:e,creator:t,propertyKey:n,propertyType:i,propertyValue:o,digitalAssetAddress:s,digitalAssetType:a,options:c}=r;return _({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::add_typed_property",typeArguments:[_nullishCoalesce(a, () => (Se)),ut[i]],functionArguments:[u.from(s),new x(n),o],abi:vu},options:c})}var Iu={typeParameters:[{constraints:["key"]},{constraints:[]}],parameters:[new A(de(new G(0))),new A(v()),new G(1)]};async function na(r){let{aptosConfig:e,creator:t,propertyKey:n,propertyType:i,propertyValue:o,digitalAssetAddress:s,digitalAssetType:a,options:c}=r;return _({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::update_typed_property",typeArguments:[_nullishCoalesce(a, () => (Se)),ut[i]],functionArguments:[u.from(s),new x(n),o],abi:Iu},options:c})}function ia(r,e){let t=new Array;return e.forEach((n,i)=>{t.push(Ii(r[i],n))}),t}function Ii(r,e){let t=Ye(e);return Xt(r,t,0,[]).bcsToBytes()}var Cr=class{constructor(e){this.config=e}async getCollectionData(e){await w({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"});let{creatorAddress:t,collectionName:n,options:i}=e,o=u.from(t),s={collection_name:{_eq:n},creator_address:{_eq:o.toStringLong()}};return _optionalChain([i, 'optionalAccess', _168 => _168.tokenStandard])&&(s.token_standard={_eq:_nullishCoalesce(_optionalChain([i, 'optionalAccess', _169 => _169.tokenStandard]), () => ("v2"))}),Zt({aptosConfig:this.config,options:{where:s}})}async getCollectionDataByCreatorAddressAndCollectionName(e){return await w({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),Bs({aptosConfig:this.config,...e})}async getCollectionDataByCreatorAddress(e){return await w({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),Ms({aptosConfig:this.config,...e})}async getCollectionDataByCollectionId(e){return await w({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),Ls({aptosConfig:this.config,...e})}async getCollectionId(e){return await w({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),Vs({aptosConfig:this.config,...e})}async getDigitalAssetData(e){return await w({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),Ds({aptosConfig:this.config,...e})}async getCurrentDigitalAssetOwnership(e){return await w({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),Os({aptosConfig:this.config,...e})}async getOwnedDigitalAssets(e){return await w({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),Ns({aptosConfig:this.config,...e})}async getDigitalAssetActivity(e){return await w({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),Fs({aptosConfig:this.config,...e})}async createCollectionTransaction(e){return Gs({aptosConfig:this.config,...e})}async mintDigitalAssetTransaction(e){return Hs({aptosConfig:this.config,...e})}async transferDigitalAssetTransaction(e){return qs({aptosConfig:this.config,...e})}async mintSoulBoundTransaction(e){return $s({aptosConfig:this.config,...e})}async burnDigitalAssetTransaction(e){return Ws({aptosConfig:this.config,...e})}async freezeDigitalAssetTransaferTransaction(e){return Qs({aptosConfig:this.config,...e})}async unfreezeDigitalAssetTransaferTransaction(e){return js({aptosConfig:this.config,...e})}async setDigitalAssetDescriptionTransaction(e){return Js({aptosConfig:this.config,...e})}async setDigitalAssetNameTransaction(e){return Xs({aptosConfig:this.config,...e})}async setDigitalAssetURITransaction(e){return Ys({aptosConfig:this.config,...e})}async addDigitalAssetPropertyTransaction(e){return Zs({aptosConfig:this.config,...e})}async removeDigitalAssetPropertyTransaction(e){return ea({aptosConfig:this.config,...e})}async updateDigitalAssetPropertyTransaction(e){return ta({aptosConfig:this.config,...e})}async addDigitalAssetTypedPropertyTransaction(e){return ra({aptosConfig:this.config,...e})}async updateDigitalAssetTypedPropertyTransaction(e){return na({aptosConfig:this.config,...e})}};var oa=300,Cu=r=>{if(r&&r.length>oa)throw new Error(`Event type length exceeds the maximum length of ${oa}`)};async function sa(r){let{aptosConfig:e,eventType:t,options:n}=r,i={_or:[{account_address:{_eq:t.split("::")[0]}},{account_address:{_eq:"0x0000000000000000000000000000000000000000000000000000000000000000"},sequence_number:{_eq:0},creation_number:{_eq:0}}],indexed_type:{_eq:t}};return Rr({aptosConfig:e,options:{...n,where:i}})}async function aa(r){let{accountAddress:e,aptosConfig:t,creationNumber:n,options:i}=r,s={account_address:{_eq:u.from(e).toStringLong()},creation_number:{_eq:n}};return Rr({aptosConfig:t,options:{...i,where:s}})}async function ca(r){let{accountAddress:e,aptosConfig:t,eventType:n,options:i}=r,s={account_address:{_eq:u.from(e).toStringLong()},indexed_type:{_eq:n}};return Rr({aptosConfig:t,options:{...i,where:s}})}async function Rr(r){let{aptosConfig:e,options:t}=r;Cu(_optionalChain([t, 'optionalAccess', _170 => _170.where, 'optionalAccess', _171 => _171.indexed_type, 'optionalAccess', _172 => _172._eq]));let n={query:Bo,variables:{where_condition:_optionalChain([t, 'optionalAccess', _173 => _173.where]),offset:_optionalChain([t, 'optionalAccess', _174 => _174.offset]),limit:_optionalChain([t, 'optionalAccess', _175 => _175.limit]),order_by:_optionalChain([t, 'optionalAccess', _176 => _176.orderBy])}};return(await T({aptosConfig:e,query:n,originMethod:"getEvents"})).events}var Kr=class{constructor(e){this.config=e}async getModuleEventsByEventType(e){return await w({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"events_processor"}),sa({aptosConfig:this.config,...e})}async getAccountEventsByCreationNumber(e){return await w({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"events_processor"}),aa({aptosConfig:this.config,...e})}async getAccountEventsByEventType(e){return await w({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"events_processor"}),ca({aptosConfig:this.config,...e})}async getEvents(e){return await w({config:this.config,minimumLedgerVersion:_optionalChain([e, 'optionalAccess', _177 => _177.minimumLedgerVersion]),processorType:"events_processor"}),Rr({aptosConfig:this.config,...e})}};async function ua(r){let{aptosConfig:e,accountAddress:t,amount:n,options:i}=r,o=_optionalChain([i, 'optionalAccess', _178 => _178.timeoutSecs])||20,{data:s}=await ho({aptosConfig:e,path:"fund",body:{address:u.from(t).toString(),amount:n},originMethod:"fundAccount"}),a=s.txn_hashes[0],c=await Jt({aptosConfig:e,transactionHash:a,options:{timeoutSecs:o,checkSuccess:_optionalChain([i, 'optionalAccess', _179 => _179.checkSuccess])}});if(c.type==="user_transaction")return c;throw new Error(`Unexpected transaction received for fund account: ${c.type}`)}var Ur=class{constructor(e){this.config=e}async fundAccount(e){let t=await ua({aptosConfig:this.config,...e});return(_optionalChain([e, 'access', _180 => _180.options, 'optionalAccess', _181 => _181.waitForIndexer])===void 0||_optionalChain([e, 'access', _182 => _182.options, 'optionalAccess', _183 => _183.waitForIndexer]))&&await _n({aptosConfig:this.config,minimumLedgerVersion:BigInt(t.version),processorType:"fungible_asset_processor"}),t}};async function Un(r){let{aptosConfig:e,options:t}=r,n={query:Lo,variables:{where_condition:_optionalChain([t, 'optionalAccess', _184 => _184.where]),limit:_optionalChain([t, 'optionalAccess', _185 => _185.limit]),offset:_optionalChain([t, 'optionalAccess', _186 => _186.offset])}};return(await T({aptosConfig:e,query:n,originMethod:"getFungibleAssetMetadata"})).fungible_asset_metadata}async function pa(r){let{aptosConfig:e,options:t}=r,n={query:Mo,variables:{where_condition:_optionalChain([t, 'optionalAccess', _187 => _187.where]),limit:_optionalChain([t, 'optionalAccess', _188 => _188.limit]),offset:_optionalChain([t, 'optionalAccess', _189 => _189.offset])}};return(await T({aptosConfig:e,query:n,originMethod:"getFungibleAssetActivities"})).fungible_asset_activities}async function da(r){let{aptosConfig:e,options:t}=r,n={query:Fo,variables:{where_condition:_optionalChain([t, 'optionalAccess', _190 => _190.where]),limit:_optionalChain([t, 'optionalAccess', _191 => _191.limit]),offset:_optionalChain([t, 'optionalAccess', _192 => _192.offset])}};return(await T({aptosConfig:e,query:n,originMethod:"getCurrentFungibleAssetBalances"})).current_fungible_asset_balances}var Ru={typeParameters:[{constraints:[]}],parameters:[Ye("0x1::object::Object"),new ee,new j]};async function la(r){let{aptosConfig:e,sender:t,fungibleAssetMetadataAddress:n,recipient:i,amount:o,options:s}=r;return _({aptosConfig:e,sender:t.accountAddress,data:{function:"0x1::primary_fungible_store::transfer",typeArguments:["0x1::fungible_asset::Metadata"],functionArguments:[n,i,o],abi:Ru},options:s})}var kr=class{constructor(e){this.config=e}async getFungibleAssetMetadata(e){return await w({config:this.config,minimumLedgerVersion:_optionalChain([e, 'optionalAccess', _193 => _193.minimumLedgerVersion]),processorType:"fungible_asset_processor"}),Un({aptosConfig:this.config,...e})}async getFungibleAssetMetadataByAssetType(e){return await w({config:this.config,minimumLedgerVersion:_optionalChain([e, 'optionalAccess', _194 => _194.minimumLedgerVersion]),processorType:"fungible_asset_processor"}),(await Un({aptosConfig:this.config,options:{where:{asset_type:{_eq:e.assetType}}}}))[0]}async getFungibleAssetMetadataByCreatorAddress(e){return await w({config:this.config,minimumLedgerVersion:_optionalChain([e, 'optionalAccess', _195 => _195.minimumLedgerVersion]),processorType:"fungible_asset_processor"}),await Un({aptosConfig:this.config,options:{where:{creator_address:{_eq:u.from(e.creatorAddress).toStringLong()}}}})}async getFungibleAssetActivities(e){return await w({config:this.config,minimumLedgerVersion:_optionalChain([e, 'optionalAccess', _196 => _196.minimumLedgerVersion]),processorType:"fungible_asset_processor"}),pa({aptosConfig:this.config,...e})}async getCurrentFungibleAssetBalances(e){return await w({config:this.config,minimumLedgerVersion:_optionalChain([e, 'optionalAccess', _197 => _197.minimumLedgerVersion]),processorType:"fungible_asset_processor"}),da({aptosConfig:this.config,...e})}async transferFungibleAsset(e){return la({aptosConfig:this.config,...e})}};var zr=class{constructor(e){this.config=e}async getLedgerInfo(){return fn({aptosConfig:this.config})}async getChainId(){return(await this.getLedgerInfo()).chain_id}async getBlockByVersion(e){return ls({aptosConfig:this.config,...e})}async getBlockByHeight(e){return gs({aptosConfig:this.config,...e})}async view(e){return we({aptosConfig:this.config,...e})}async viewJson(e){return Cs({aptosConfig:this.config,...e})}async getChainTopUserTransactions(e){return Wo({aptosConfig:this.config,...e})}async queryIndexer(e){return T({aptosConfig:this.config,...e})}async getIndexerLastSuccessVersion(){return An({aptosConfig:this.config})}async getProcessorStatus(e){return hn({aptosConfig:this.config,processorType:e})}};var ga=["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 ya(r){return!(!r||r.length<3||r.length>63||!/^[a-z\d][a-z\d-]{1,61}[a-z\d]$/.test(r))}function pt(r){let[e,t,...n]=r.replace(/\.apt$/,"").split(".");if(n.length>0)throw new Error(`${r} is invalid. A name can only have two parts, a domain and a subdomain separated by a "."`);if(!ya(e))throw new Error(`${e} is not valid. ${ga}`);if(t&&!ya(t))throw new Error(`${t} is not valid. ${ga}`);return{domainName:t||e,subdomainName:t?e:void 0}}function ma(r){if(!r)return!1;let e=new Date(r.domain_expiration_timestamp).getTime()<Date.now(),t=new Date(r.expiration_timestamp).getTime()<Date.now();return r.subdomain&&e?!1:r.subdomain&&r.subdomain_expiration_policy===1?!0:!t}var Ku="0x585fc9f0f0c54183b039ffc770ca282ebd87307916c215a3e692f2f8e4305e82",Uu={testnet:"0x5f8fd2347449685cf41d4db97926ec3a096eaf381332be4f1318ad4d16a8497c",mainnet:"0x867ed1f6bf916171b1de3ee92849b8978b7d1b9e0a8cc982a3d19d535dfd9c0c",local:Ku,custom:null,devnet:null};function Ze(r){let e=Uu[r.network];if(!e)throw new Error(`The ANS contract is not deployed to ${r.network}`);return e}var kn=r=>{if(r&&typeof r=="object"&&"vec"in r&&Array.isArray(r.vec))return r.vec[0]};async function fa(r){let{aptosConfig:e,name:t}=r,n=Ze(e),{domainName:i,subdomainName:o}=pt(t),s=await we({aptosConfig:e,payload:{function:`${n}::router::get_owner_addr`,functionArguments:[i,o]}}),a=kn(s[0]);return a?u.from(a):void 0}async function Aa(r){let{aptosConfig:e,expiration:t,name:n,sender:i,targetAddress:o,toAddress:s,options:a,transferable:c}=r,p=Ze(e),{domainName:l,subdomainName:h}=pt(n),g=t.policy==="subdomain:independent"||t.policy==="subdomain:follow-domain";if(h&&!g)throw new Error("Subdomains must have an expiration policy of either 'subdomain:independent' or 'subdomain:follow-domain'");if(g&&!h)throw new Error(`Policy is set to ${t.policy} but no subdomain was provided`);if(t.policy==="domain"){let te=_nullishCoalesce(t.years, () => (1));if(te!==1)throw new Error("For now, names can only be registered for 1 year at a time");let Ut=te*31536e3;return await _({aptosConfig:e,sender:i.accountAddress.toString(),data:{function:`${p}::router::register_domain`,functionArguments:[l,Ut,o,s]},options:a})}if(!h)throw new Error(`${t.policy} requires a subdomain to be provided.`);let d=await Ci({aptosConfig:e,name:l});if(!d)throw new Error("The domain does not exist");let b=t.policy==="subdomain:independent"?t.expirationDate:d;if(b>d)throw new Error("The subdomain expiration time cannot be greater than the domain expiration time");return await _({aptosConfig:e,sender:i.accountAddress.toString(),data:{function:`${p}::router::register_subdomain`,functionArguments:[l,h,Math.round(b/1e3),t.policy==="subdomain:follow-domain"?1:0,!!c,o,s]},options:a})}async function Ci(r){let{aptosConfig:e,name:t}=r,n=Ze(e),{domainName:i,subdomainName:o}=pt(t);try{let s=await we({aptosConfig:e,payload:{function:`${n}::router::get_expiration`,functionArguments:[i,o]}});return Number(s[0])*1e3}catch (e6){return}}async function ha(r){let{aptosConfig:e,address:t}=r,n=Ze(e),i=await we({aptosConfig:e,payload:{function:`${n}::router::get_primary_name`,functionArguments:[u.from(t).toString()]}}),o=kn(i[1]),s=kn(i[0]);if(o)return[s,o].filter(Boolean).join(".")}async function Ta(r){let{aptosConfig:e,sender:t,name:n,options:i}=r,o=Ze(e);if(!n)return await _({aptosConfig:e,sender:t.accountAddress.toString(),data:{function:`${o}::router::clear_primary_name`,functionArguments:[]},options:i});let{domainName:s,subdomainName:a}=pt(n);return await _({aptosConfig:e,sender:t.accountAddress.toString(),data:{function:`${o}::router::set_primary_name`,functionArguments:[s,a]},options:i})}async function ba(r){let{aptosConfig:e,name:t}=r,n=Ze(e),{domainName:i,subdomainName:o}=pt(t),s=await we({aptosConfig:e,payload:{function:`${n}::router::get_target_addr`,functionArguments:[i,o]}}),a=kn(s[0]);return a?u.from(a):void 0}async function wa(r){let{aptosConfig:e,sender:t,name:n,address:i,options:o}=r,s=Ze(e),{domainName:a,subdomainName:c}=pt(n);return await _({aptosConfig:e,sender:t.accountAddress.toString(),data:{function:`${s}::router::set_target_addr`,functionArguments:[a,c,i]},options:o})}async function Sa(r){let{aptosConfig:e,name:t}=r,{domainName:n,subdomainName:i=""}=pt(t),a=(await T({aptosConfig:e,query:{query:Qt,variables:{where_condition:{domain:{_eq:n},subdomain:{_eq:i}},limit:1}},originMethod:"getName"})).current_aptos_names[0];return a&&(a=Dr(a)),ma(a)?a:void 0}async function _a(r){let{aptosConfig:e,options:t,accountAddress:n}=r,i=await Ri({aptosConfig:e});return(await T({aptosConfig:e,originMethod:"getAccountNames",query:{query:Qt,variables:{limit:_optionalChain([t, 'optionalAccess', _198 => _198.limit]),offset:_optionalChain([t, 'optionalAccess', _199 => _199.offset]),order_by:_optionalChain([t, 'optionalAccess', _200 => _200.orderBy]),where_condition:{..._nullishCoalesce(_optionalChain([r, 'access', _201 => _201.options, 'optionalAccess', _202 => _202.where]), () => ({})),owner_address:{_eq:n.toString()},expiration_timestamp:{_gte:i}}}}})).current_aptos_names.map(Dr)}async function xa(r){let{aptosConfig:e,options:t,accountAddress:n}=r,i=await Ri({aptosConfig:e});return(await T({aptosConfig:e,originMethod:"getAccountDomains",query:{query:Qt,variables:{limit:_optionalChain([t, 'optionalAccess', _203 => _203.limit]),offset:_optionalChain([t, 'optionalAccess', _204 => _204.offset]),order_by:_optionalChain([t, 'optionalAccess', _205 => _205.orderBy]),where_condition:{..._nullishCoalesce(_optionalChain([r, 'access', _206 => _206.options, 'optionalAccess', _207 => _207.where]), () => ({})),owner_address:{_eq:n.toString()},expiration_timestamp:{_gte:i},subdomain:{_eq:""}}}}})).current_aptos_names.map(Dr)}async function Ea(r){let{aptosConfig:e,options:t,accountAddress:n}=r,i=await Ri({aptosConfig:e});return(await T({aptosConfig:e,originMethod:"getAccountSubdomains",query:{query:Qt,variables:{limit:_optionalChain([t, 'optionalAccess', _208 => _208.limit]),offset:_optionalChain([t, 'optionalAccess', _209 => _209.offset]),order_by:_optionalChain([t, 'optionalAccess', _210 => _210.orderBy]),where_condition:{..._nullishCoalesce(_optionalChain([r, 'access', _211 => _211.options, 'optionalAccess', _212 => _212.where]), () => ({})),owner_address:{_eq:n.toString()},expiration_timestamp:{_gte:i},subdomain:{_neq:""}}}}})).current_aptos_names.map(Dr)}async function Pa(r){let{aptosConfig:e,options:t,domain:n}=r;return(await T({aptosConfig:e,originMethod:"getDomainSubdomains",query:{query:Qt,variables:{limit:_optionalChain([t, 'optionalAccess', _213 => _213.limit]),offset:_optionalChain([t, 'optionalAccess', _214 => _214.offset]),order_by:_optionalChain([t, 'optionalAccess', _215 => _215.orderBy]),where_condition:{..._nullishCoalesce(_optionalChain([r, 'access', _216 => _216.options, 'optionalAccess', _217 => _217.where]), () => ({})),domain:{_eq:n},subdomain:{_neq:""}}}}})).current_aptos_names.map(Dr).filter(ma)}async function Ri(r){let{aptosConfig:e}=r,t=Ze(e),[n]=await we({aptosConfig:e,payload:{function:`${t}::config::reregistration_grace_sec`,functionArguments:[]}}),i=n/60/60/24,o=()=>new Date;return new Date(o().setDate(o().getDate()-i)).toISOString()}async function va(r){let{aptosConfig:e,sender:t,name:n,years:i=1,options:o}=r,s=Ze(e),a=i*31536e3,{domainName:c,subdomainName:p}=pt(n);if(p)throw new Error("Subdomains cannot be renewed");if(i!==1)throw new Error("Currently, only 1 year renewals are supported");return await _({aptosConfig:e,sender:t.accountAddress.toString(),data:{function:`${s}::router::renew_domain`,functionArguments:[c,a]},options:o})}function Dr(r){return{...r,expiration_timestamp:new Date(r.expiration_timestamp).getTime()}}var Or=class{constructor(e){this.config=e}async getOwnerAddress(e){return fa({aptosConfig:this.config,...e})}async getExpiration(e){return Ci({aptosConfig:this.config,...e})}async getTargetAddress(e){return ba({aptosConfig:this.config,...e})}async setTargetAddress(e){return wa({aptosConfig:this.config,...e})}async getPrimaryName(e){return ha({aptosConfig:this.config,...e})}async setPrimaryName(e){return Ta({aptosConfig:this.config,...e})}async registerName(e){return Aa({aptosConfig:this.config,...e})}async renewDomain(e){return va({aptosConfig:this.config,...e})}async getName(e){return Sa({aptosConfig:this.config,...e})}async getAccountNames(e){return _a({aptosConfig:this.config,...e})}async getAccountDomains(e){return xa({aptosConfig:this.config,...e})}async getAccountSubdomains(e){return Ea({aptosConfig:this.config,...e})}async getDomainSubdomains(e){return Pa({aptosConfig:this.config,...e})}};async function Ia(r){let{aptosConfig:e,poolAddress:t}=r,n=u.from(t).toStringLong(),o=await T({aptosConfig:e,query:{query:ui,variables:{where_condition:{pool_address:{_eq:n}}}}});return o.num_active_delegator_per_pool[0]?o.num_active_delegator_per_pool[0].num_active_delegator:0}async function Ca(r){let{aptosConfig:e,options:t}=r,n={query:ui,variables:{order_by:_optionalChain([t, 'optionalAccess', _218 => _218.orderBy])}};return(await T({aptosConfig:e,query:n})).num_active_delegator_per_pool}async function Ra(r){let{aptosConfig:e,delegatorAddress:t,poolAddress:n}=r,i={query:Go,variables:{delegatorAddress:u.from(t).toStringLong(),poolAddress:u.from(n).toStringLong()}};return(await T({aptosConfig:e,query:i})).delegated_staking_activities}var Nr=class{constructor(e){this.config=e}async getNumberOfDelegators(e){return await w({config:this.config,minimumLedgerVersion:_optionalChain([e, 'optionalAccess', _219 => _219.minimumLedgerVersion]),processorType:"stake_processor"}),Ia({aptosConfig:this.config,...e})}async getNumberOfDelegatorsForAllPools(e){return await w({config:this.config,minimumLedgerVersion:_optionalChain([e, 'optionalAccess', _220 => _220.minimumLedgerVersion]),processorType:"stake_processor"}),Ca({aptosConfig:this.config,...e})}async getDelegatedStakingActivities(e){return await w({config:this.config,minimumLedgerVersion:_optionalChain([e, 'optionalAccess', _221 => _221.minimumLedgerVersion]),processorType:"stake_processor"}),Ra({aptosConfig:this.config,...e})}};var zn=class{constructor(e){this.config=e}async simple(e){return _({aptosConfig:this.config,...e})}async multiAgent(e){return _({aptosConfig:this.config,...e})}};function Ki(r,e,t){let n=t.value;return t.value=async function(...i){let[o]=i;if(o.transaction.feePayerAddress&&!o.feePayerAuthenticator)throw new Error("You are submitting a Fee Payer transaction but missing the feePayerAuthenticator");return n.apply(this,i)},t}function Ui(r,e,t){let n=t.value;return t.value=async function(...i){return n.apply(this,i)},t}var er=class{constructor(e){this.config=e}async simple(e){return vi({aptosConfig:this.config,...e})}async multiAgent(e){return vi({aptosConfig:this.config,...e})}};_chunkIHUCZKG2js.a.call(void 0, [Ui],er.prototype,"simple",1),_chunkIHUCZKG2js.a.call(void 0, [Ui],er.prototype,"multiAgent",1);var tr=class{constructor(e){this.config=e}async simple(e){return Pr({aptosConfig:this.config,...e})}async multiAgent(e){return Pr({aptosConfig:this.config,...e})}};_chunkIHUCZKG2js.a.call(void 0, [Ki],tr.prototype,"simple",1),_chunkIHUCZKG2js.a.call(void 0, [Ki],tr.prototype,"multiAgent",1);var Dn=class{constructor(e,t,n,i,o){this.lastUncommintedNumber=null;this.currentNumber=null;this.lock=!1;this.aptosConfig=e,this.account=t,this.maxWaitTime=n,this.maximumInFlight=i,this.sleepTime=o}async nextSequenceNumber(){for(;this.lock;)await _chunkIHUCZKG2js.b.call(void 0, this.sleepTime);this.lock=!0;let e=BigInt(0);try{if((this.lastUncommintedNumber===null||this.currentNumber===null)&&await this.initialize(),this.currentNumber-this.lastUncommintedNumber>=this.maximumInFlight){await this.update();let t=_chunkIHUCZKG2js.d.call(void 0, );for(;this.currentNumber-this.lastUncommintedNumber>=this.maximumInFlight;)await _chunkIHUCZKG2js.b.call(void 0, this.sleepTime),_chunkIHUCZKG2js.d.call(void 0, )-t>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()}e=this.currentNumber,this.currentNumber+=BigInt(1)}catch(t){console.error("error in getting next sequence number for this account",t)}finally{this.lock=!1}return e}async initialize(){let{sequence_number:e}=await Oe({aptosConfig:this.aptosConfig,accountAddress:this.account.accountAddress});this.currentNumber=BigInt(e),this.lastUncommintedNumber=BigInt(e)}async update(){let{sequence_number:e}=await Oe({aptosConfig:this.aptosConfig,accountAddress:this.account.accountAddress});return this.lastUncommintedNumber=BigInt(e),this.lastUncommintedNumber}async synchronize(){if(this.lastUncommintedNumber!==this.currentNumber){for(;this.lock;)await _chunkIHUCZKG2js.b.call(void 0, this.sleepTime);this.lock=!0;try{await this.update();let e=_chunkIHUCZKG2js.d.call(void 0, );for(;this.lastUncommintedNumber!==this.currentNumber;)_chunkIHUCZKG2js.d.call(void 0, )-e>this.maxWaitTime?(console.warn(`Waited over 30 seconds for a transaction to commit, re-syncing ${this.account.accountAddress.toString()}`),await this.initialize()):(await _chunkIHUCZKG2js.b.call(void 0, this.sleepTime),await this.update())}catch(e){console.error("error in synchronizing this account sequence number with the one on chain",e)}finally{this.lock=!1}}}};var rr=class{constructor(){this.queue=[];this.pendingDequeue=[];this.cancelled=!1}enqueue(e){if(this.cancelled=!1,this.pendingDequeue.length>0){_optionalChain([this, 'access', _222 => _222.pendingDequeue, 'access', _223 => _223.shift, 'call', _224 => _224(), 'optionalAccess', _225 => _225.resolve, 'call', _226 => _226(e)]);return}this.queue.push(e)}async dequeue(){return this.queue.length>0?Promise.resolve(this.queue.shift()):new Promise((e,t)=>{this.pendingDequeue.push({resolve:e,reject:t})})}isEmpty(){return this.queue.length===0}cancel(){this.cancelled=!0,this.pendingDequeue.forEach(async({reject:e})=>{e(new nr("Task cancelled"))}),this.pendingDequeue=[],this.queue.length=0}isCancelled(){return this.cancelled}pendingDequeueLength(){return this.pendingDequeue.length}},nr=class extends Error{};var Ka="fulfilled",Ua= exports.TransactionWorkerEventsEnum =(o=>(o.TransactionSent="transactionSent",o.TransactionSendFailed="transactionSendFailed",o.TransactionExecuted="transactionExecuted",o.TransactionExecutionFailed="transactionExecutionFailed",o.ExecutionFinish="executionFinish",o))(Ua||{}),On= exports.TransactionWorker =class extends _eventemitter32.default{constructor(t,n,i=30,o=100,s=10){super();this.taskQueue=new rr;this.transactionsQueue=new rr;this.outstandingTransactions=new rr;this.sentTransactions=[];this.executedTransactions=[];this.aptosConfig=t,this.account=n,this.started=!1,this.accountSequnceNumber=new Dn(t,n,i,o,s)}async submitNextTransaction(){try{for(;;){let t=await this.accountSequnceNumber.nextSequenceNumber();if(t===null)return;let n=await this.generateNextTransaction(this.account,t);if(!n)return;let i=vr({aptosConfig:this.aptosConfig,transaction:n,signer:this.account});await this.outstandingTransactions.enqueue([i,t])}}catch(t){if(t instanceof nr)return;throw new Error(`Submit transaction failed for ${this.account.accountAddress.toString()} with error ${t}`)}}async processTransactions(){try{for(;;){let t=[],n=[],[i,o]=await this.outstandingTransactions.dequeue();for(t.push(i),n.push(o);!this.outstandingTransactions.isEmpty();)[i,o]=await this.outstandingTransactions.dequeue(),t.push(i),n.push(o);let s=await Promise.allSettled(t);for(let a=0;a<s.length&&a<n.length;a+=1){let c=s[a];o=n[a],c.status===Ka?(this.sentTransactions.push([c.value.hash,o,null]),this.emit("transactionSent",{message:`transaction hash ${c.value.hash} has been committed to chain`,transactionHash:c.value.hash}),await this.checkTransaction(c,o)):(this.sentTransactions.push([c.status,o,c.reason]),this.emit("transactionSendFailed",{message:`failed to commit transaction ${this.sentTransactions.length} with error ${c.reason}`,error:c.reason}))}this.emit("executionFinish",{message:`execute ${s.length} transactions finished`})}}catch(t){if(t instanceof nr)return;throw new Error(`Process execution failed for ${this.account.accountAddress.toString()} with error ${t}`)}}async checkTransaction(t,n){try{let i=[];i.push(Jt({aptosConfig:this.aptosConfig,transactionHash:t.value.hash}));let o=await Promise.allSettled(i);for(let s=0;s<o.length;s+=1){let a=o[s];a.status===Ka?(this.executedTransactions.push([a.value.hash,n,null]),this.emit("transactionExecuted",{message:`transaction hash ${a.value.hash} has been executed on chain`,transactionHash:t.value.hash})):(this.executedTransactions.push([a.status,n,a.reason]),this.emit("transactionExecutionFailed",{message:`failed to execute transaction ${this.executedTransactions.length} with error ${a.reason}`,error:a.reason}))}}catch(i){throw new Error(`Check transaction failed for ${this.account.accountAddress.toString()} with error ${i}`)}}async push(t,n){this.transactionsQueue.enqueue([t,n])}async generateNextTransaction(t,n){if(this.transactionsQueue.isEmpty())return;let[i,o]=await this.transactionsQueue.dequeue();return _({aptosConfig:this.aptosConfig,sender:t.accountAddress,data:i,options:{...o,accountSequenceNumber:n}})}async run(){try{for(;!this.taskQueue.isCancelled();)await(await this.taskQueue.dequeue())()}catch(t){throw new Error(`Unable to start transaction batching: ${t}`)}}start(){if(this.started)throw new Error("worker has already started");this.started=!0,this.taskQueue.enqueue(()=>this.submitNextTransaction()),this.taskQueue.enqueue(()=>this.processTransactions()),this.run()}stop(){if(this.taskQueue.isCancelled())throw new Error("worker has already stopped");this.started=!1,this.taskQueue.cancel()}};var Nn=class extends _eventemitter32.default{constructor(e){super(),this.config=e}start(e){let{sender:t}=e;this.account=t,this.transactionWorker=new On(this.config,t),this.transactionWorker.start(),this.registerToEvents()}push(e){let{data:t,options:n}=e;for(let i of t)this.transactionWorker.push(i,n)}registerToEvents(){this.transactionWorker.on("transactionSent",async e=>{this.emit("transactionSent",e)}),this.transactionWorker.on("transactionSendFailed",async e=>{this.emit("transactionSendFailed",e)}),this.transactionWorker.on("transactionExecuted",async e=>{this.emit("transactionExecuted",e)}),this.transactionWorker.on("transactionExecutionFailed",async e=>{this.emit("transactionExecutionFailed",e)}),this.transactionWorker.on("executionFinish",async e=>{this.emit("executionFinish",e)})}forSingleAccount(e){try{let{sender:t,data:n,options:i}=e;this.start({sender:t}),this.push({data:n,options:i})}catch(t){throw new Error(`failed to submit transactions with error: ${t}`)}}};var Fr=class{constructor(e){this.config=e,this.build=new zn(this.config),this.simulate=new er(this.config),this.submit=new tr(this.config),this.batch=new Nn(this.config)}async getTransactions(e){return yi({aptosConfig:this.config,...e})}async getTransactionByVersion(e){return ps({aptosConfig:this.config,...e})}async getTransactionByHash(e){return Sr({aptosConfig:this.config,...e})}async isPendingTransaction(e){return ds({aptosConfig:this.config,...e})}async waitForTransaction(e){return Jt({aptosConfig:this.config,...e})}async getGasPriceEstimation(){return Sn({aptosConfig:this.config})}getSigningMessage(e){return Rs(e)}async publishPackageTransaction(e){return Us({aptosConfig:this.config,...e})}async rotateAuthKey(e){return ks({aptosConfig:this.config,...e})}sign(e){return Rn({...e})}signAsFeePayer(e){return Kn({...e})}async batchTransactionsForSingleAccount(e){try{let{sender:t,data:n,options:i}=e;this.batch.forSingleAccount({sender:t,data:n,options:i})}catch(t){throw new Error(`failed to submit transactions with error: ${t}`)}}async signAndSubmitTransaction(e){return vr({aptosConfig:this.config,...e})}async signAndSubmitAsFeePayer(e){return Ks({aptosConfig:this.config,...e})}};var Gr=class{constructor(e){this.config=e}async getTableItem(e){return Tn({aptosConfig:this.config,...e})}async getTableItemsData(e){return await w({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"default_processor"}),Qo({aptosConfig:this.config,...e})}async getTableItemsMetadata(e){return await w({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"default_processor"}),jo({aptosConfig:this.config,...e})}};async function Fn(r){let{aptosConfig:e,jwt:t,ephemeralKeyPair:n,uidKey:i="sub",derivationPath:o}=r,s={jwt_b64:t,epk:n.getPublicKey().bcsToHex().toStringWithoutPrefix(),exp_date_secs:n.expiryDateSecs,epk_blinder:m.fromHexInput(n.blinder).toStringWithoutPrefix(),uid_key:i,derivation_path:o},{data:a}=await To({aptosConfig:e,path:"fetch",body:s,originMethod:"getPepper",overrides:{WITH_CREDENTIALS:!1}});return m.fromHexInput(a.pepper).toUint8Array()}async function ki(r){let{aptosConfig:e,jwt:t,ephemeralKeyPair:n,pepper:i=await Fn(r),uidKey:o="sub",maxExpHorizonSecs:s=(await gr({aptosConfig:e})).maxExpHorizonSecs}=r;if(m.fromHexInput(i).toUint8Array().length!==Xe.PEPPER_LENGTH)throw new Error(`Pepper needs to be ${Xe.PEPPER_LENGTH} bytes`);let a=_jwtdecode.jwtDecode.call(void 0, t);if(typeof a.iat!="number")throw new Error("iat was not found");if(s<n.expiryDateSecs-a.iat)throw Error(`The EphemeralKeyPair is too long lived. It's lifespan must be less than ${s}`);let c={jwt_b64:t,epk:n.getPublicKey().bcsToHex().toStringWithoutPrefix(),epk_blinder:m.fromHexInput(n.blinder).toStringWithoutPrefix(),exp_date_secs:n.expiryDateSecs,exp_horizon_secs:s,pepper:m.fromHexInput(i).toStringWithoutPrefix(),uid_key:o},{data:p}=await bo({aptosConfig:e,path:"prove",body:c,originMethod:"getProof",overrides:{WITH_CREDENTIALS:!1}}),l=p.proof,h=new Bt({a:l.a,b:l.b,c:l.c});return new ve({proof:new Mt(h,0),trainingWheelsSignature:Re.fromHex(p.training_wheels_signature),expHorizonSecs:s})}async function ka(r){let{aptosConfig:e,jwt:t,jwkAddress:n,uidKey:i,proofFetchCallback:o,pepper:s=await Fn(r)}=r,{verificationKey:a,maxExpHorizonSecs:c}=await gr({aptosConfig:e}),p=ki({...r,pepper:s,maxExpHorizonSecs:c}),l=o?p:await p;if(n!==void 0){let d=re.fromJwtAndPepper({jwt:t,pepper:s,jwkAddress:n,uidKey:i}),b=await jt({aptosConfig:e,authenticationKey:d.authKey().derivedAddress()});return Kt.create({...r,address:b,proof:l,pepper:s,proofFetchCallback:o,jwkAddress:n,verificationKey:a})}let h=O.fromJwtAndPepper({jwt:t,pepper:s,uidKey:i}),g=await jt({aptosConfig:e,authenticationKey:h.authKey().derivedAddress()});return Xe.create({...r,address:g,proof:l,pepper:s,proofFetchCallback:o,verificationKey:a})}async function za(r){let{aptosConfig:e,sender:t,iss:n,options:i}=r,{jwksUrl:o}=r;o===void 0&&(yo.test(n)?o="https://www.googleapis.com/service_accounts/v1/jwk/securetoken@system.gserviceaccount.com":o=n.endsWith("/")?`${n}.well-known/jwks.json`:`${n}/.well-known/jwks.json`);let s;try{if(s=await fetch(o),!s.ok)throw new Error(`${s.status} ${s.statusText}`)}catch(c){let p;throw c instanceof Error?p=`${c.message}`:p=`error unknown - ${c}`,k.fromErrorType({type:14,details:`Failed to fetch JWKS at ${o}: ${p}`})}let a=await s.json();return _({aptosConfig:e,sender:t.accountAddress,data:{function:"0x1::jwks::update_federated_jwk_set",functionArguments:[n,S.MoveString(a.keys.map(c=>c.kid)),S.MoveString(a.keys.map(c=>c.alg)),S.MoveString(a.keys.map(c=>c.e)),S.MoveString(a.keys.map(c=>c.n))]},options:i})}var Br=class{constructor(e){this.config=e}async getPepper(e){return Fn({aptosConfig:this.config,...e})}async getProof(e){return ki({aptosConfig:this.config,...e})}async deriveKeylessAccount(e){return ka({aptosConfig:this.config,...e})}async updateFederatedKeylessJwkSetTransaction(e){return za({aptosConfig:this.config,...e})}};async function Ou(r){let{aptosConfig:e,options:t}=r,n={query:mn,variables:{where_condition:_optionalChain([t, 'optionalAccess', _227 => _227.where]),offset:_optionalChain([t, 'optionalAccess', _228 => _228.offset]),limit:_optionalChain([t, 'optionalAccess', _229 => _229.limit]),order_by:_optionalChain([t, 'optionalAccess', _230 => _230.orderBy])}};return(await T({aptosConfig:e,query:n,originMethod:"getObjectData"})).current_objects}async function Da(r){let{aptosConfig:e,objectAddress:t,options:n}=r,o={object_address:{_eq:u.from(t).toStringLong()}};return(await Ou({aptosConfig:e,options:{...n,where:o}}))[0]}var Mr=class{constructor(e){this.config=e}async getObjectDataByObjectAddress(e){return await w({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"objects_processor"}),Da({aptosConfig:this.config,...e})}};var ne=class{constructor(e){this.config=new Cn(e),this.account=new Er(this.config),this.ans=new Or(this.config),this.coin=new Ir(this.config),this.digitalAsset=new Cr(this.config),this.event=new Kr(this.config),this.faucet=new Ur(this.config),this.fungibleAsset=new kr(this.config),this.general=new zr(this.config),this.staking=new Nr(this.config),this.transaction=new Fr(this.config),this.table=new Gr(this.config),this.keyless=new Br(this.config),this.object=new Mr(this.config)}};function ge(r,e,t){Object.getOwnPropertyNames(e.prototype).forEach(n=>{let i=Object.getOwnPropertyDescriptor(e.prototype,n);i&&(i.value=function(...o){return this[t][n](...o)},Object.defineProperty(r.prototype,n,i))})}ge(ne,Er,"account");ge(ne,Or,"ans");ge(ne,Ir,"coin");ge(ne,Cr,"digitalAsset");ge(ne,Kr,"event");ge(ne,Ur,"faucet");ge(ne,kr,"fungibleAsset");ge(ne,zr,"general");ge(ne,Nr,"staking");ge(ne,Fr,"transaction");ge(ne,Gr,"table");ge(ne,Br,"keyless");ge(ne,Mr,"object");exports.APTOS_BIP44_REGEX = Qa; exports.APTOS_COIN = bt; exports.APTOS_FA = lo; exports.APTOS_HARDENED_REGEX = Wa; exports.AbstractKeylessAccount = le; exports.Account = at; exports.AccountAddress = u; exports.AccountAuthenticator = Z; exports.AccountAuthenticatorEd25519 = Ie; exports.AccountAuthenticatorMultiEd25519 = on; exports.AccountAuthenticatorMultiKey = ze; exports.AccountAuthenticatorNoAccountAuthenticator = Lt; exports.AccountAuthenticatorSingleKey = ae; exports.AccountAuthenticatorVariant = Vi; exports.AccountPublicKey = se; exports.AccountSequenceNumber = Dn; exports.AccountUtils = Io; exports.AddressInvalidReason = Va; exports.AnyPublicKey = N; exports.AnyPublicKeyVariant = sr; exports.AnySignature = $; exports.AnySignatureVariant = Hi; exports.Aptos = ne; exports.AptosApiError = Ae; exports.AptosApiType = Ft; exports.AptosConfig = Cn; exports.AuthenticationKey = L; exports.Bool = U; exports.CKDPriv = Zi; exports.ChainId = Vt; exports.DEFAULT_MAX_GAS_AMOUNT = uo; exports.DEFAULT_TXN_EXP_SEC_FROM_NOW = po; exports.DEFAULT_TXN_TIMEOUT_SEC = Zr; exports.DeriveScheme = Wi; exports.Deserializer = D; exports.EPK_HORIZON_SECS = vg; exports.Ed25519Account = Te; exports.Ed25519PrivateKey = H; exports.Ed25519PublicKey = P; exports.Ed25519Signature = I; exports.EntryFunction = xt; exports.EntryFunctionBytes = $r; exports.EphemeralCertificate = Gt; exports.EphemeralCertificateVariant = Mn; exports.EphemeralKeyPair = Rt; exports.EphemeralPublicKey = Tt; exports.EphemeralPublicKeyVariant = Bn; exports.EphemeralSignature = Re; exports.EphemeralSignatureVariant = qi; exports.FIREBASE_AUTH_ISS_PATTERN = yo; exports.FederatedKeylessAccount = Kt; exports.FederatedKeylessPublicKey = re; exports.FeePayerRawTransaction = Pt; exports.FixedBytes = mt; exports.Groth16VerificationKey = ii; exports.Groth16Zkp = Bt; exports.HARDENED_OFFSET = Ji; exports.Hex = m; exports.HexInvalidReason = Fa; exports.Identifier = R; exports.KeyType = ja; exports.KeylessAccount = Xe; exports.KeylessConfiguration = ni; exports.KeylessError = k; exports.KeylessErrorCategory = wc; exports.KeylessErrorResolutionTip = Sc; exports.KeylessErrorType = en; exports.KeylessPublicKey = O; exports.KeylessSignature = Le; exports.MAX_AUD_VAL_BYTES = vc; exports.MAX_COMMITED_EPK_BYTES = Kg; exports.MAX_EXTRA_FIELD_BYTES = Cg; exports.MAX_ISS_VAL_BYTES = Ig; exports.MAX_JWT_HEADER_B64_BYTES = Rg; exports.MAX_UID_KEY_BYTES = Ic; exports.MAX_UID_VAL_BYTES = Cc; exports.MimeType = Wr; exports.ModuleId = yr; exports.MoveAbility = $i; exports.MoveFunctionVisibility = Ba; exports.MoveJWK = oi; exports.MoveOption = Y; exports.MoveString = x; exports.MoveVector = S; exports.MultiAgentRawTransaction = Et; exports.MultiAgentTransaction = ln; exports.MultiEd25519PublicKey = Ot; exports.MultiEd25519Signature = At; exports.MultiKey = ke; exports.MultiKeyAccount = wr; exports.MultiKeySignature = He; exports.MultiSig = Tr; exports.MultiSigTransactionPayload = br; exports.Network = Xn; exports.NetworkToChainId = Yn; exports.NetworkToFaucetAPI = co; exports.NetworkToIndexerAPI = so; exports.NetworkToNetworkName = wl; exports.NetworkToNodeAPI = ao; exports.NetworkToPepperAPI = jn; exports.NetworkToProverAPI = Jn; exports.ParsingError = J; exports.PrivateKey = nt; exports.PrivateKeyVariants = Qr; exports.ProcessorType = Be; exports.PublicKey = ft; exports.RAW_TRANSACTION_SALT = go; exports.RAW_TRANSACTION_WITH_DATA_SALT = Zn; exports.RawTransaction = he; exports.RawTransactionWithData = cn; exports.RoleType = Ma; exports.RotationProofChallenge = un; exports.Script = hr; exports.ScriptTransactionArgumentVariants = or; exports.Secp256k1PrivateKey = Ge; exports.Secp256k1PublicKey = Fe; exports.Secp256k1Signature = ht; exports.Serializable = y; exports.Serialized = ar; exports.Serializer = B; exports.Signature = V; exports.SignedTransaction = Je; exports.SigningScheme = oe; exports.SigningSchemeInput = Hn; exports.SimpleTransaction = dn; exports.SingleKeyAccount = be; exports.StructTag = De; exports.TransactionAndProof = ci; exports.TransactionAuthenticator = je; exports.TransactionAuthenticatorEd25519 = vt; exports.TransactionAuthenticatorFeePayer = Ct; exports.TransactionAuthenticatorMultiAgent = It; exports.TransactionAuthenticatorMultiEd25519 = pn; exports.TransactionAuthenticatorSingleSender = st; exports.TransactionAuthenticatorVariant = Li; exports.TransactionPayload = _t; exports.TransactionPayloadEntryFunction = fr; exports.TransactionPayloadMultiSig = Ar; exports.TransactionPayloadScript = mr; exports.TransactionPayloadVariants = Bi; exports.TransactionResponseType = Vn; exports.TransactionVariants = Mi; exports.TransactionWorker = On; exports.TransactionWorkerEventsEnum = Ua; exports.TypeTag = F; exports.TypeTagAddress = ee; exports.TypeTagBool = M; exports.TypeTagGeneric = G; exports.TypeTagParserError = W; exports.TypeTagParserErrorType = Xc; exports.TypeTagReference = an; exports.TypeTagSigner = St; exports.TypeTagStruct = A; exports.TypeTagU128 = We; exports.TypeTagU16 = qe; exports.TypeTagU256 = Qe; exports.TypeTagU32 = $e; exports.TypeTagU64 = j; exports.TypeTagU8 = pe; exports.TypeTagVariants = Gi; exports.TypeTagVector = C; exports.U128 = Ee; exports.U16 = _e; exports.U256 = ye; exports.U32 = xe; exports.U64 = Q; exports.U8 = X; exports.ZeroKnowledgeSig = ve; exports.ZkProof = Mt; exports.ZkpVariant = Ln; exports.aptosCoinStructTag = ym; exports.aptosRequest = tn; exports.base64UrlDecode = _chunkIHUCZKG2js.f; exports.bigIntToBytesLE = io; exports.buildTransaction = Ei; exports.bytesToBigIntLE = pr; exports.checkOrConvertArgument = Xt; exports.convertAmountFromHumanReadableToOnChain = _chunkIHUCZKG2js.g; exports.convertAmountFromOnChainToHumanReadable = _chunkIHUCZKG2js.h; exports.convertArgument = xi; exports.convertNumber = xn; exports.createObjectAddress = sn; exports.createResourceAddress = Hy; exports.createTokenAddress = qy; exports.deriveKey = qn; exports.deriveTransactionType = si; exports.deserializeFromScriptArgument = zc; exports.ensureBoolean = Gn; exports.fetchEntryFunctionAbi = _s; exports.fetchFunctionAbi = Ss; exports.fetchViewFunctionAbi = xs; exports.findFirstNonSignerArg = Ts; exports.floorToWholeHour = _chunkIHUCZKG2js.e; exports.generateRawTransaction = iu; exports.generateSignedTransaction = Pi; exports.generateSignedTransactionForSimulation = Ps; exports.generateSigningMessage = Ht; exports.generateSigningMessageForSerializable = vf; exports.generateSigningMessageForTransaction = qt; exports.generateTransactionPayload = In; exports.generateTransactionPayloadWithABI = tu; exports.generateUserTransactionHash = pb; exports.generateViewFunctionPayload = Es; exports.generateViewFunctionPayloadWithABI = ru; exports.get = rn; exports.getAptosFullNode = q; exports.getAptosPepperService = Ql; exports.getAuthenticatorForSimulation = Yt; exports.getErrorMessage = _chunkIHUCZKG2js.c; exports.getFunctionParts = _r; exports.getIssAudAndUidVal = Ve; exports.getKeylessConfig = gr; exports.getKeylessJWKs = _o; exports.hashStrToField = Xr; exports.hashValues = vs; exports.hexToAsciiString = Fi; exports.isBcsAddress = Pn; exports.isBcsBool = mi; exports.isBcsFixedBytes = $c; exports.isBcsString = fi; exports.isBcsU128 = wi; exports.isBcsU16 = hi; exports.isBcsU256 = Si; exports.isBcsU32 = Ti; exports.isBcsU64 = bi; exports.isBcsU8 = Ai; exports.isBlockEpilogueTransactionResponse = lp; exports.isBlockMetadataTransactionResponse = up; exports.isBool = ms; exports.isCanonicalEd25519Signature = Xa; exports.isEd25519Signature = gp; exports.isEmptyOption = fs; exports.isEncodedEntryFunctionArgument = As; exports.isEncodedStruct = _chunkIHUCZKG2js.j; exports.isFeePayerSignature = fp; exports.isGenesisTransactionResponse = cp; exports.isKeylessSigner = gn; exports.isLargeNumber = En; exports.isMultiAgentSignature = mp; exports.isMultiEd25519Signature = Ap; exports.isNumber = qc; exports.isPendingTransactionResponse = sp; exports.isScriptDataInput = hs; exports.isSecp256k1Signature = yp; exports.isSingleKeySigner = ai; exports.isStateCheckpointTransactionResponse = pp; exports.isString = ct; exports.isUserTransactionResponse = ap; exports.isValidBIP44Path = Xi; exports.isValidHardenedPath = Yi; exports.isValidatorTransactionResponse = dp; exports.mnemonicToSeed = jr; exports.normalizeBundle = mo; exports.nowInSeconds = _chunkIHUCZKG2js.d; exports.objectStructTag = de; exports.optionStructTag = mm; exports.outOfRangeErrorMessage = Ga; exports.padAndPackBytesWithLen = Qn; exports.paginateWithCursor = nn; exports.paginateWithObfuscatedCursor = ti; exports.parseEncodedStruct = _chunkIHUCZKG2js.i; exports.parseJwtHeader = Uc; exports.parseTypeTag = Ye; exports.poseidonHash = dr; exports.post = lr; exports.postAptosFaucet = ho; exports.postAptosFullNode = ot; exports.postAptosIndexer = Ao; exports.postAptosPepperService = To; exports.postAptosProvingService = bo; exports.promiseFulfilledStatus = Ka; exports.request = Ec; exports.sleep = _chunkIHUCZKG2js.b; exports.splitPath = eo; exports.standardizeTypeTags = vn; exports.stringStructTag = v; exports.throwTypeMismatch = z; exports.validateNumberInRange = tt;
|
|
479
|
+
will be removed in the near future`);let s=r;r===void 0&&i!==void 0&&(s=await Ke(async()=>{try{let d=(await ae({aptosConfig:this.config,payload:{function:"0x1::coin::paired_coin",functionArguments:[i]}})).at(0);if(d.vec.length>0&&_chunkRX5UBAMEjs.ga.call(void 0, d.vec[0]))return _chunkRX5UBAMEjs.fa.call(void 0, d.vec[0])}catch (e5){}},`coin-mapping-${i.toString()}`,1e3*60*5)());let a;if(r!==void 0&&i!==void 0)a=_chunkRX5UBAMEjs.Z.from(i).toStringLong();else if(r!==void 0&&i===void 0)r===ht?a=_chunkRX5UBAMEjs.Z.A.toStringLong():a=ar(_chunkRX5UBAMEjs.Z.A,r).toStringLong();else if(r===void 0&&i!==void 0){let d=_chunkRX5UBAMEjs.Z.from(i);a=d.toStringLong(),d===_chunkRX5UBAMEjs.Z.A&&(s=ht)}else throw new Error("Either coinType, faMetadataAddress, or both must be provided");if(s!==void 0){let[d]=await ae({aptosConfig:this.config,payload:{function:"0x1::coin::balance",typeArguments:[s],functionArguments:[t]}});return parseInt(d,10)}let[c]=await ae({aptosConfig:this.config,payload:{function:"0x1::primary_fungible_store::balance",typeArguments:["0x1::object::ObjectCore"],functionArguments:[t,a]}});return parseInt(c,10)}async getAccountOwnedObjects(e){return await S({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"default_processor"}),gs({aptosConfig:this.config,...e})}async deriveAccountFromPrivateKey(e){return ms({aptosConfig:this.config,...e})}};var _aptosclient = require('@aptos-labs/aptos-client'); var _aptosclient2 = _interopRequireDefault(_aptosclient);var Dr=class{constructor(e){this.network=_nullishCoalesce(_optionalChain([e, 'optionalAccess', _139 => _139.network]), () => ("devnet")),this.fullnode=_optionalChain([e, 'optionalAccess', _140 => _140.fullnode]),this.faucet=_optionalChain([e, 'optionalAccess', _141 => _141.faucet]),this.pepper=_optionalChain([e, 'optionalAccess', _142 => _142.pepper]),this.prover=_optionalChain([e, 'optionalAccess', _143 => _143.prover]),this.indexer=_optionalChain([e, 'optionalAccess', _144 => _144.indexer]),this.client=_nullishCoalesce(_optionalChain([e, 'optionalAccess', _145 => _145.client]), () => ({provider:_aptosclient2.default,binaryProvider:_aptosclient.bcsRequest})),this.clientConfig=_nullishCoalesce(_optionalChain([e, 'optionalAccess', _146 => _146.clientConfig]), () => ({})),this.fullnodeConfig=_nullishCoalesce(_optionalChain([e, 'optionalAccess', _147 => _147.fullnodeConfig]), () => ({})),this.indexerConfig=_nullishCoalesce(_optionalChain([e, 'optionalAccess', _148 => _148.indexerConfig]), () => ({})),this.faucetConfig=_nullishCoalesce(_optionalChain([e, 'optionalAccess', _149 => _149.faucetConfig]), () => ({}))}getRequestUrl(e){switch(e){case"Fullnode":if(this.fullnode!==void 0)return this.fullnode;if(this.network==="custom")throw new Error("Please provide a custom full node url");return co[this.network];case"Faucet":if(this.faucet!==void 0)return this.faucet;if(this.network==="testnet")throw new Error("There is no way to programmatically mint testnet APT, you must use the minting site at https://aptos.dev/network/faucet");if(this.network==="mainnet")throw new Error("There is no mainnet faucet");if(this.network==="custom")throw new Error("Please provide a custom faucet url");return uo[this.network];case"Indexer":if(this.indexer!==void 0)return this.indexer;if(this.network==="custom")throw new Error("Please provide a custom indexer url");return ao[this.network];case"Pepper":if(this.pepper!==void 0)return this.pepper;if(this.network==="custom")throw new Error("Please provide a custom pepper service url");return jr[this.network];case"Prover":if(this.prover!==void 0)return this.prover;if(this.network==="custom")throw new Error("Please provide a custom prover service url");return Jr[this.network];default:throw Error(`apiType ${e} is not supported`)}}isPepperServiceRequest(e){return jr[this.network]===e}isProverServiceRequest(e){return Jr[this.network]===e}};var xu={typeParameters:[{constraints:[]}],parameters:[new F,new j]};async function Vs(n){let{aptosConfig:e,sender:t,recipient:r,amount:i,coinType:o,options:s}=n;return w({aptosConfig:e,sender:t,data:{function:"0x1::aptos_account::transfer_coins",typeArguments:[_nullishCoalesce(o, () => (ht))],functionArguments:[r,i],abi:xu},options:s})}var Kn=class{constructor(e){this.config=e}async transferCoinTransaction(e){return Vs({aptosConfig:this.config,...e})}};var ct={BOOLEAN:"bool",U8:"u8",U16:"u16",U32:"u32",U64:"u64",U128:"u128",U256:"u256",ADDRESS:"address",STRING:"0x1::string::String",ARRAY:"vector<u8>"},be="0x4::token::Token";async function qs(n){let{aptosConfig:e,digitalAssetAddress:t}=n,r={token_data_id:{_eq:_chunkRX5UBAMEjs.Z.from(t).toStringLong()}};return(await T({aptosConfig:e,query:{query:Xo,variables:{where_condition:r}},originMethod:"getDigitalAssetData"})).current_token_datas_v2[0]}async function Ls(n){let{aptosConfig:e,digitalAssetAddress:t}=n,r={token_data_id:{_eq:_chunkRX5UBAMEjs.Z.from(t).toStringLong()},amount:{_gt:0}};return(await T({aptosConfig:e,query:{query:pi,variables:{where_condition:r}},originMethod:"getCurrentDigitalAssetOwnership"})).current_token_ownerships_v2[0]}async function Hs(n){let{aptosConfig:e,ownerAddress:t,options:r}=n,i={owner_address:{_eq:_chunkRX5UBAMEjs.Z.from(t).toStringLong()},amount:{_gt:0}},o={query:pi,variables:{where_condition:i,offset:_optionalChain([r, 'optionalAccess', _150 => _150.offset]),limit:_optionalChain([r, 'optionalAccess', _151 => _151.limit]),order_by:_optionalChain([r, 'optionalAccess', _152 => _152.orderBy])}};return(await T({aptosConfig:e,query:o,originMethod:"getOwnedDigitalAssets"})).current_token_ownerships_v2}async function $s(n){let{aptosConfig:e,digitalAssetAddress:t,options:r}=n,i={token_data_id:{_eq:_chunkRX5UBAMEjs.Z.from(t).toStringLong()}},o={query:Jo,variables:{where_condition:i,offset:_optionalChain([r, 'optionalAccess', _153 => _153.offset]),limit:_optionalChain([r, 'optionalAccess', _154 => _154.limit]),order_by:_optionalChain([r, 'optionalAccess', _155 => _155.orderBy])}};return(await T({aptosConfig:e,query:o,originMethod:"getDigitalAssetActivity"})).token_activities_v2}var Iu={typeParameters:[],parameters:[new A(E()),new j,new A(E()),new A(E()),new V,new V,new V,new V,new V,new V,new V,new V,new V,new j,new j]};async function Ws(n){let{aptosConfig:e,options:t,creator:r}=n;return w({aptosConfig:e,sender:r.accountAddress,data:{function:"0x4::aptos_token::create_collection",functionArguments:[new P(n.description),new W(_nullishCoalesce(n.maxSupply, () => (_chunkRX5UBAMEjs.e))),new P(n.name),new P(n.uri),new U(_nullishCoalesce(n.mutableDescription, () => (!0))),new U(_nullishCoalesce(n.mutableRoyalty, () => (!0))),new U(_nullishCoalesce(n.mutableURI, () => (!0))),new U(_nullishCoalesce(n.mutableTokenDescription, () => (!0))),new U(_nullishCoalesce(n.mutableTokenName, () => (!0))),new U(_nullishCoalesce(n.mutableTokenProperties, () => (!0))),new U(_nullishCoalesce(n.mutableTokenURI, () => (!0))),new U(_nullishCoalesce(n.tokensBurnableByCreator, () => (!0))),new U(_nullishCoalesce(n.tokensFreezableByCreator, () => (!0))),new W(_nullishCoalesce(n.royaltyNumerator, () => (0))),new W(_nullishCoalesce(n.royaltyDenominator, () => (1)))],abi:Iu},options:t})}async function tn(n){let{aptosConfig:e,options:t}=n,r=_optionalChain([t, 'optionalAccess', _156 => _156.where]);_optionalChain([t, 'optionalAccess', _157 => _157.tokenStandard])&&(r.token_standard={_eq:_nullishCoalesce(_optionalChain([t, 'optionalAccess', _158 => _158.tokenStandard]), () => ("v2"))});let i={query:Vo,variables:{where_condition:r,offset:_optionalChain([t, 'optionalAccess', _159 => _159.offset]),limit:_optionalChain([t, 'optionalAccess', _160 => _160.limit])}};return(await T({aptosConfig:e,query:i,originMethod:"getCollectionData"})).current_collections_v2[0]}async function Qs(n){let{aptosConfig:e,creatorAddress:t,collectionName:r,options:i}=n,o=_chunkRX5UBAMEjs.Z.from(t),s={collection_name:{_eq:r},creator_address:{_eq:o.toStringLong()}};return _optionalChain([i, 'optionalAccess', _161 => _161.tokenStandard])&&(s.token_standard={_eq:_nullishCoalesce(_optionalChain([i, 'optionalAccess', _162 => _162.tokenStandard]), () => ("v2"))}),tn({aptosConfig:e,options:{...i,where:s}})}async function js(n){let{aptosConfig:e,creatorAddress:t,options:r}=n,o={creator_address:{_eq:_chunkRX5UBAMEjs.Z.from(t).toStringLong()}};return _optionalChain([r, 'optionalAccess', _163 => _163.tokenStandard])&&(o.token_standard={_eq:_nullishCoalesce(_optionalChain([r, 'optionalAccess', _164 => _164.tokenStandard]), () => ("v2"))}),tn({aptosConfig:e,options:{...r,where:o}})}async function Js(n){let{aptosConfig:e,collectionId:t,options:r}=n,o={collection_id:{_eq:_chunkRX5UBAMEjs.Z.from(t).toStringLong()}};return _optionalChain([r, 'optionalAccess', _165 => _165.tokenStandard])&&(o.token_standard={_eq:_nullishCoalesce(_optionalChain([r, 'optionalAccess', _166 => _166.tokenStandard]), () => ("v2"))}),tn({aptosConfig:e,options:{...r,where:o}})}async function Xs(n){let{creatorAddress:e,collectionName:t,options:r,aptosConfig:i}=n,o=_chunkRX5UBAMEjs.Z.from(e),s={collection_name:{_eq:t},creator_address:{_eq:o.toStringLong()}};return _optionalChain([r, 'optionalAccess', _167 => _167.tokenStandard])&&(s.token_standard={_eq:_nullishCoalesce(_optionalChain([r, 'optionalAccess', _168 => _168.tokenStandard]), () => ("v2"))}),(await tn({aptosConfig:i,options:{where:s}})).collection_id}var vu={typeParameters:[],parameters:[new A(E()),new A(E()),new A(E()),new A(E()),new v(new A(E())),new v(new A(E())),new v(v.u8())]};async function Ys(n){let{aptosConfig:e,options:t,creator:r,collection:i,description:o,name:s,uri:a,propertyKeys:c,propertyTypes:d,propertyValues:l}=n,h=_optionalChain([d, 'optionalAccess', _169 => _169.map, 'call', _170 => _170(p=>ct[p])]);return w({aptosConfig:e,sender:r.accountAddress,data:{function:"0x4::aptos_token::mint",functionArguments:[new P(i),new P(o),new P(s),new P(a),_.MoveString(_nullishCoalesce(c, () => ([]))),_.MoveString(_nullishCoalesce(h, () => ([]))),la(_nullishCoalesce(l, () => ([])),_nullishCoalesce(h, () => ([])))],abi:vu},options:t})}var Cu={typeParameters:[{constraints:["key"]}],parameters:[new A(le(new G(0))),new F]};async function Zs(n){let{aptosConfig:e,sender:t,digitalAssetAddress:r,recipient:i,digitalAssetType:o,options:s}=n;return w({aptosConfig:e,sender:t.accountAddress,data:{function:"0x1::object::transfer",typeArguments:[_nullishCoalesce(o, () => (be))],functionArguments:[_chunkRX5UBAMEjs.Z.from(r),_chunkRX5UBAMEjs.Z.from(i)],abi:Cu},options:s})}var Ku={typeParameters:[],parameters:[new A(E()),new A(E()),new A(E()),new A(E()),new v(new A(E())),new v(new A(E())),new v(v.u8()),new F]};async function ea(n){let{aptosConfig:e,account:t,collection:r,description:i,name:o,uri:s,recipient:a,propertyKeys:c,propertyTypes:d,propertyValues:l,options:h}=n;if(_optionalChain([c, 'optionalAccess', _171 => _171.length])!==_optionalChain([l, 'optionalAccess', _172 => _172.length]))throw new Error("Property keys and property values counts do not match");if(_optionalChain([d, 'optionalAccess', _173 => _173.length])!==_optionalChain([l, 'optionalAccess', _174 => _174.length]))throw new Error("Property types and property values counts do not match");let p=_optionalChain([d, 'optionalAccess', _175 => _175.map, 'call', _176 => _176(g=>ct[g])]);return w({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::mint_soul_bound",functionArguments:[r,i,o,s,_.MoveString(_nullishCoalesce(c, () => ([]))),_.MoveString(_nullishCoalesce(p, () => ([]))),la(_nullishCoalesce(l, () => ([])),_nullishCoalesce(p, () => ([]))),a],abi:Ku},options:h})}var Ru={typeParameters:[{constraints:["key"]}],parameters:[new A(le(new G(0)))]};async function ta(n){let{aptosConfig:e,creator:t,digitalAssetAddress:r,digitalAssetType:i,options:o}=n;return w({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::burn",typeArguments:[_nullishCoalesce(i, () => (be))],functionArguments:[_chunkRX5UBAMEjs.Z.from(r)],abi:Ru},options:o})}var Uu={typeParameters:[{constraints:["key"]}],parameters:[new A(le(new G(0)))]};async function na(n){let{aptosConfig:e,creator:t,digitalAssetAddress:r,digitalAssetType:i,options:o}=n;return w({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::freeze_transfer",typeArguments:[_nullishCoalesce(i, () => (be))],functionArguments:[r],abi:Uu},options:o})}var Du={typeParameters:[{constraints:["key"]}],parameters:[new A(le(new G(0)))]};async function ra(n){let{aptosConfig:e,creator:t,digitalAssetAddress:r,digitalAssetType:i,options:o}=n;return w({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::unfreeze_transfer",typeArguments:[_nullishCoalesce(i, () => (be))],functionArguments:[r],abi:Du},options:o})}var zu={typeParameters:[{constraints:["key"]}],parameters:[new A(le(new G(0))),new A(E())]};async function ia(n){let{aptosConfig:e,creator:t,description:r,digitalAssetAddress:i,digitalAssetType:o,options:s}=n;return w({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::set_description",typeArguments:[_nullishCoalesce(o, () => (be))],functionArguments:[_chunkRX5UBAMEjs.Z.from(i),new P(r)],abi:zu},options:s})}var ku={typeParameters:[{constraints:["key"]}],parameters:[new A(le(new G(0))),new A(E())]};async function oa(n){let{aptosConfig:e,creator:t,name:r,digitalAssetAddress:i,digitalAssetType:o,options:s}=n;return w({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::set_name",typeArguments:[_nullishCoalesce(o, () => (be))],functionArguments:[_chunkRX5UBAMEjs.Z.from(i),new P(r)],abi:ku},options:s})}var Ou={typeParameters:[{constraints:["key"]}],parameters:[new A(le(new G(0))),new A(E())]};async function sa(n){let{aptosConfig:e,creator:t,uri:r,digitalAssetAddress:i,digitalAssetType:o,options:s}=n;return w({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::set_uri",typeArguments:[_nullishCoalesce(o, () => (be))],functionArguments:[_chunkRX5UBAMEjs.Z.from(i),new P(r)],abi:Ou},options:s})}var Fu={typeParameters:[{constraints:["key"]}],parameters:[new A(le(new G(0))),new A(E()),new A(E()),v.u8()]};async function aa(n){let{aptosConfig:e,creator:t,propertyKey:r,propertyType:i,propertyValue:o,digitalAssetAddress:s,digitalAssetType:a,options:c}=n;return w({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::add_property",typeArguments:[_nullishCoalesce(a, () => (be))],functionArguments:[_chunkRX5UBAMEjs.Z.from(s),new P(r),new P(ct[i]),_.U8(Ki(o,ct[i]))],abi:Fu},options:c})}var Nu={typeParameters:[{constraints:["key"]}],parameters:[new A(le(new G(0))),new A(E())]};async function ca(n){let{aptosConfig:e,creator:t,propertyKey:r,digitalAssetAddress:i,digitalAssetType:o,options:s}=n;return w({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::remove_property",typeArguments:[_nullishCoalesce(o, () => (be))],functionArguments:[_chunkRX5UBAMEjs.Z.from(i),new P(r)],abi:Nu},options:s})}var Gu={typeParameters:[{constraints:["key"]}],parameters:[new A(le(new G(0))),new A(E()),new A(E()),v.u8()]};async function ua(n){let{aptosConfig:e,creator:t,propertyKey:r,propertyType:i,propertyValue:o,digitalAssetAddress:s,digitalAssetType:a,options:c}=n;return w({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::update_property",typeArguments:[_nullishCoalesce(a, () => (be))],functionArguments:[_chunkRX5UBAMEjs.Z.from(s),new P(r),new P(ct[i]),Ki(o,ct[i])],abi:Gu},options:c})}var Bu={typeParameters:[{constraints:["key"]},{constraints:[]}],parameters:[new A(le(new G(0))),new A(E()),new G(1)]};async function da(n){let{aptosConfig:e,creator:t,propertyKey:r,propertyType:i,propertyValue:o,digitalAssetAddress:s,digitalAssetType:a,options:c}=n;return w({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::add_typed_property",typeArguments:[_nullishCoalesce(a, () => (be)),ct[i]],functionArguments:[_chunkRX5UBAMEjs.Z.from(s),new P(r),o],abi:Bu},options:c})}var Mu={typeParameters:[{constraints:["key"]},{constraints:[]}],parameters:[new A(le(new G(0))),new A(E()),new G(1)]};async function pa(n){let{aptosConfig:e,creator:t,propertyKey:r,propertyType:i,propertyValue:o,digitalAssetAddress:s,digitalAssetType:a,options:c}=n;return w({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::update_typed_property",typeArguments:[_nullishCoalesce(a, () => (be)),ct[i]],functionArguments:[_chunkRX5UBAMEjs.Z.from(s),new P(r),o],abi:Mu},options:c})}function la(n,e){let t=new Array;return e.forEach((r,i)=>{t.push(Ki(n[i],r))}),t}function Ki(n,e){let t=Fe(e);return Rt(n,t,0,[]).bcsToBytes()}var Rn=class{constructor(e){this.config=e}async getCollectionData(e){await S({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"});let{creatorAddress:t,collectionName:r,options:i}=e,o=_chunkRX5UBAMEjs.Z.from(t),s={collection_name:{_eq:r},creator_address:{_eq:o.toStringLong()}};return _optionalChain([i, 'optionalAccess', _177 => _177.tokenStandard])&&(s.token_standard={_eq:_nullishCoalesce(_optionalChain([i, 'optionalAccess', _178 => _178.tokenStandard]), () => ("v2"))}),tn({aptosConfig:this.config,options:{where:s}})}async getCollectionDataByCreatorAddressAndCollectionName(e){return await S({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),Qs({aptosConfig:this.config,...e})}async getCollectionDataByCreatorAddress(e){return await S({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),js({aptosConfig:this.config,...e})}async getCollectionDataByCollectionId(e){return await S({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),Js({aptosConfig:this.config,...e})}async getCollectionId(e){return await S({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),Xs({aptosConfig:this.config,...e})}async getDigitalAssetData(e){return await S({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),qs({aptosConfig:this.config,...e})}async getCurrentDigitalAssetOwnership(e){return await S({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),Ls({aptosConfig:this.config,...e})}async getOwnedDigitalAssets(e){return await S({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),Hs({aptosConfig:this.config,...e})}async getDigitalAssetActivity(e){return await S({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),$s({aptosConfig:this.config,...e})}async createCollectionTransaction(e){return Ws({aptosConfig:this.config,...e})}async mintDigitalAssetTransaction(e){return Ys({aptosConfig:this.config,...e})}async transferDigitalAssetTransaction(e){return Zs({aptosConfig:this.config,...e})}async mintSoulBoundTransaction(e){return ea({aptosConfig:this.config,...e})}async burnDigitalAssetTransaction(e){return ta({aptosConfig:this.config,...e})}async freezeDigitalAssetTransaferTransaction(e){return na({aptosConfig:this.config,...e})}async unfreezeDigitalAssetTransaferTransaction(e){return ra({aptosConfig:this.config,...e})}async setDigitalAssetDescriptionTransaction(e){return ia({aptosConfig:this.config,...e})}async setDigitalAssetNameTransaction(e){return oa({aptosConfig:this.config,...e})}async setDigitalAssetURITransaction(e){return sa({aptosConfig:this.config,...e})}async addDigitalAssetPropertyTransaction(e){return aa({aptosConfig:this.config,...e})}async removeDigitalAssetPropertyTransaction(e){return ca({aptosConfig:this.config,...e})}async updateDigitalAssetPropertyTransaction(e){return ua({aptosConfig:this.config,...e})}async addDigitalAssetTypedPropertyTransaction(e){return da({aptosConfig:this.config,...e})}async updateDigitalAssetTypedPropertyTransaction(e){return pa({aptosConfig:this.config,...e})}};var ga=300,Vu=n=>{if(n&&n.length>ga)throw new Error(`Event type length exceeds the maximum length of ${ga}`)};async function ma(n){let{aptosConfig:e,eventType:t,options:r}=n,i={_or:[{account_address:{_eq:t.split("::")[0]}},{account_address:{_eq:"0x0000000000000000000000000000000000000000000000000000000000000000"},sequence_number:{_eq:0},creation_number:{_eq:0}}],indexed_type:{_eq:t}};return Un({aptosConfig:e,options:{...r,where:i}})}async function ya(n){let{accountAddress:e,aptosConfig:t,creationNumber:r,options:i}=n,s={account_address:{_eq:_chunkRX5UBAMEjs.Z.from(e).toStringLong()},creation_number:{_eq:r}};return Un({aptosConfig:t,options:{...i,where:s}})}async function fa(n){let{accountAddress:e,aptosConfig:t,eventType:r,options:i}=n,s={account_address:{_eq:_chunkRX5UBAMEjs.Z.from(e).toStringLong()},indexed_type:{_eq:r}};return Un({aptosConfig:t,options:{...i,where:s}})}async function Un(n){let{aptosConfig:e,options:t}=n;Vu(_optionalChain([t, 'optionalAccess', _179 => _179.where, 'optionalAccess', _180 => _180.indexed_type, 'optionalAccess', _181 => _181._eq]));let r={query:Ho,variables:{where_condition:_optionalChain([t, 'optionalAccess', _182 => _182.where]),offset:_optionalChain([t, 'optionalAccess', _183 => _183.offset]),limit:_optionalChain([t, 'optionalAccess', _184 => _184.limit]),order_by:_optionalChain([t, 'optionalAccess', _185 => _185.orderBy])}};return(await T({aptosConfig:e,query:r,originMethod:"getEvents"})).events}var Dn=class{constructor(e){this.config=e}async getModuleEventsByEventType(e){return await S({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"events_processor"}),ma({aptosConfig:this.config,...e})}async getAccountEventsByCreationNumber(e){return await S({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"events_processor"}),ya({aptosConfig:this.config,...e})}async getAccountEventsByEventType(e){return await S({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"events_processor"}),fa({aptosConfig:this.config,...e})}async getEvents(e){return await S({config:this.config,minimumLedgerVersion:_optionalChain([e, 'optionalAccess', _186 => _186.minimumLedgerVersion]),processorType:"events_processor"}),Un({aptosConfig:this.config,...e})}};async function Aa(n){let{aptosConfig:e,accountAddress:t,amount:r,options:i}=n,o=_optionalChain([i, 'optionalAccess', _187 => _187.timeoutSecs])||20,{data:s}=await bo({aptosConfig:e,path:"fund",body:{address:_chunkRX5UBAMEjs.Z.from(t).toString(),amount:r},originMethod:"fundAccount"}),a=s.txn_hashes[0],c=await Yt({aptosConfig:e,transactionHash:a,options:{timeoutSecs:o,checkSuccess:_optionalChain([i, 'optionalAccess', _188 => _188.checkSuccess])}});if(c.type==="user_transaction")return c;throw new Error(`Unexpected transaction received for fund account: ${c.type}`)}var zn=class{constructor(e){this.config=e}async fundAccount(e){let t=await Aa({aptosConfig:this.config,...e});return(_optionalChain([e, 'access', _189 => _189.options, 'optionalAccess', _190 => _190.waitForIndexer])===void 0||_optionalChain([e, 'access', _191 => _191.options, 'optionalAccess', _192 => _192.waitForIndexer]))&&await _r({aptosConfig:this.config,minimumLedgerVersion:BigInt(t.version),processorType:"fungible_asset_processor"}),t}};async function zr(n){let{aptosConfig:e,options:t}=n,r={query:Wo,variables:{where_condition:_optionalChain([t, 'optionalAccess', _193 => _193.where]),limit:_optionalChain([t, 'optionalAccess', _194 => _194.limit]),offset:_optionalChain([t, 'optionalAccess', _195 => _195.offset])}};return(await T({aptosConfig:e,query:r,originMethod:"getFungibleAssetMetadata"})).fungible_asset_metadata}async function ha(n){let{aptosConfig:e,options:t}=n,r={query:$o,variables:{where_condition:_optionalChain([t, 'optionalAccess', _196 => _196.where]),limit:_optionalChain([t, 'optionalAccess', _197 => _197.limit]),offset:_optionalChain([t, 'optionalAccess', _198 => _198.offset])}};return(await T({aptosConfig:e,query:r,originMethod:"getFungibleAssetActivities"})).fungible_asset_activities}async function Ta(n){let{aptosConfig:e,options:t}=n,r={query:qo,variables:{where_condition:_optionalChain([t, 'optionalAccess', _199 => _199.where]),limit:_optionalChain([t, 'optionalAccess', _200 => _200.limit]),offset:_optionalChain([t, 'optionalAccess', _201 => _201.offset])}};return(await T({aptosConfig:e,query:r,originMethod:"getCurrentFungibleAssetBalances"})).current_fungible_asset_balances}var qu={typeParameters:[{constraints:[]}],parameters:[Fe("0x1::object::Object"),new F,new j]};async function ba(n){let{aptosConfig:e,sender:t,fungibleAssetMetadataAddress:r,recipient:i,amount:o,options:s}=n;return w({aptosConfig:e,sender:t.accountAddress,data:{function:"0x1::primary_fungible_store::transfer",typeArguments:["0x1::fungible_asset::Metadata"],functionArguments:[r,i,o],abi:qu},options:s})}var kn=class{constructor(e){this.config=e}async getFungibleAssetMetadata(e){return await S({config:this.config,minimumLedgerVersion:_optionalChain([e, 'optionalAccess', _202 => _202.minimumLedgerVersion]),processorType:"fungible_asset_processor"}),zr({aptosConfig:this.config,...e})}async getFungibleAssetMetadataByAssetType(e){return await S({config:this.config,minimumLedgerVersion:_optionalChain([e, 'optionalAccess', _203 => _203.minimumLedgerVersion]),processorType:"fungible_asset_processor"}),(await zr({aptosConfig:this.config,options:{where:{asset_type:{_eq:e.assetType}}}}))[0]}async getFungibleAssetMetadataByCreatorAddress(e){return await S({config:this.config,minimumLedgerVersion:_optionalChain([e, 'optionalAccess', _204 => _204.minimumLedgerVersion]),processorType:"fungible_asset_processor"}),await zr({aptosConfig:this.config,options:{where:{creator_address:{_eq:_chunkRX5UBAMEjs.Z.from(e.creatorAddress).toStringLong()}}}})}async getFungibleAssetActivities(e){return await S({config:this.config,minimumLedgerVersion:_optionalChain([e, 'optionalAccess', _205 => _205.minimumLedgerVersion]),processorType:"fungible_asset_processor"}),ha({aptosConfig:this.config,...e})}async getCurrentFungibleAssetBalances(e){return await S({config:this.config,minimumLedgerVersion:_optionalChain([e, 'optionalAccess', _206 => _206.minimumLedgerVersion]),processorType:"fungible_asset_processor"}),Ta({aptosConfig:this.config,...e})}async transferFungibleAsset(e){return ba({aptosConfig:this.config,...e})}};var On=class{constructor(e){this.config=e}async getLedgerInfo(){return fr({aptosConfig:this.config})}async getChainId(){return(await this.getLedgerInfo()).chain_id}async getBlockByVersion(e){return As({aptosConfig:this.config,...e})}async getBlockByHeight(e){return hs({aptosConfig:this.config,...e})}async view(e){return ae({aptosConfig:this.config,...e})}async viewJson(e){return zs({aptosConfig:this.config,...e})}async getChainTopUserTransactions(e){return Yo({aptosConfig:this.config,...e})}async queryIndexer(e){return T({aptosConfig:this.config,...e})}async getIndexerLastSuccessVersion(){return Ar({aptosConfig:this.config})}async getProcessorStatus(e){return hr({aptosConfig:this.config,processorType:e})}};var wa=["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 Sa(n){return!(!n||n.length<3||n.length>63||!/^[a-z\d][a-z\d-]{1,61}[a-z\d]$/.test(n))}function ut(n){let[e,t,...r]=n.replace(/\.apt$/,"").split(".");if(r.length>0)throw new Error(`${n} is invalid. A name can only have two parts, a domain and a subdomain separated by a "."`);if(!Sa(e))throw new Error(`${e} is not valid. ${wa}`);if(t&&!Sa(t))throw new Error(`${t} is not valid. ${wa}`);return{domainName:t||e,subdomainName:t?e:void 0}}function _a(n){if(!n)return!1;let e=new Date(n.domain_expiration_timestamp).getTime()<Date.now(),t=new Date(n.expiration_timestamp).getTime()<Date.now();return n.subdomain&&e?!1:n.subdomain&&n.subdomain_expiration_policy===1?!0:!t}var Lu="0x585fc9f0f0c54183b039ffc770ca282ebd87307916c215a3e692f2f8e4305e82",Hu={testnet:"0x5f8fd2347449685cf41d4db97926ec3a096eaf381332be4f1318ad4d16a8497c",mainnet:"0x867ed1f6bf916171b1de3ee92849b8978b7d1b9e0a8cc982a3d19d535dfd9c0c",local:Lu,custom:null,devnet:null};function tt(n){let e=Hu[n.network];if(!e)throw new Error(`The ANS contract is not deployed to ${n.network}`);return e}var kr=n=>{if(n&&typeof n=="object"&&"vec"in n&&Array.isArray(n.vec))return n.vec[0]};async function Ea(n){let{aptosConfig:e,name:t}=n,r=tt(e),{domainName:i,subdomainName:o}=ut(t),s=await ae({aptosConfig:e,payload:{function:`${r}::router::get_owner_addr`,functionArguments:[i,o]}}),a=kr(s[0]);return a?_chunkRX5UBAMEjs.Z.from(a):void 0}async function Pa(n){let{aptosConfig:e,expiration:t,name:r,sender:i,targetAddress:o,toAddress:s,options:a,transferable:c}=n,d=tt(e),{domainName:l,subdomainName:h}=ut(r),p=t.policy==="subdomain:independent"||t.policy==="subdomain:follow-domain";if(h&&!p)throw new Error("Subdomains must have an expiration policy of either 'subdomain:independent' or 'subdomain:follow-domain'");if(p&&!h)throw new Error(`Policy is set to ${t.policy} but no subdomain was provided`);if(t.policy==="domain"){let ee=_nullishCoalesce(t.years, () => (1));if(ee!==1)throw new Error("For now, names can only be registered for 1 year at a time");let Dt=ee*31536e3;return await w({aptosConfig:e,sender:i.accountAddress.toString(),data:{function:`${d}::router::register_domain`,functionArguments:[l,Dt,o,s]},options:a})}if(!h)throw new Error(`${t.policy} requires a subdomain to be provided.`);let g=await Ri({aptosConfig:e,name:l});if(!g)throw new Error("The domain does not exist");let b=t.policy==="subdomain:independent"?t.expirationDate:g;if(b>g)throw new Error("The subdomain expiration time cannot be greater than the domain expiration time");return await w({aptosConfig:e,sender:i.accountAddress.toString(),data:{function:`${d}::router::register_subdomain`,functionArguments:[l,h,Math.round(b/1e3),t.policy==="subdomain:follow-domain"?1:0,!!c,o,s]},options:a})}async function Ri(n){let{aptosConfig:e,name:t}=n,r=tt(e),{domainName:i,subdomainName:o}=ut(t);try{let s=await ae({aptosConfig:e,payload:{function:`${r}::router::get_expiration`,functionArguments:[i,o]}});return Number(s[0])*1e3}catch (e6){return}}async function xa(n){let{aptosConfig:e,address:t}=n,r=tt(e),i=await ae({aptosConfig:e,payload:{function:`${r}::router::get_primary_name`,functionArguments:[_chunkRX5UBAMEjs.Z.from(t).toString()]}}),o=kr(i[1]),s=kr(i[0]);if(o)return[s,o].filter(Boolean).join(".")}async function Ia(n){let{aptosConfig:e,sender:t,name:r,options:i}=n,o=tt(e);if(!r)return await w({aptosConfig:e,sender:t.accountAddress.toString(),data:{function:`${o}::router::clear_primary_name`,functionArguments:[]},options:i});let{domainName:s,subdomainName:a}=ut(r);return await w({aptosConfig:e,sender:t.accountAddress.toString(),data:{function:`${o}::router::set_primary_name`,functionArguments:[s,a]},options:i})}async function va(n){let{aptosConfig:e,name:t}=n,r=tt(e),{domainName:i,subdomainName:o}=ut(t),s=await ae({aptosConfig:e,payload:{function:`${r}::router::get_target_addr`,functionArguments:[i,o]}}),a=kr(s[0]);return a?_chunkRX5UBAMEjs.Z.from(a):void 0}async function Ca(n){let{aptosConfig:e,sender:t,name:r,address:i,options:o}=n,s=tt(e),{domainName:a,subdomainName:c}=ut(r);return await w({aptosConfig:e,sender:t.accountAddress.toString(),data:{function:`${s}::router::set_target_addr`,functionArguments:[a,c,i]},options:o})}async function Ka(n){let{aptosConfig:e,name:t}=n,{domainName:r,subdomainName:i=""}=ut(t),a=(await T({aptosConfig:e,query:{query:Jt,variables:{where_condition:{domain:{_eq:r},subdomain:{_eq:i}},limit:1}},originMethod:"getName"})).current_aptos_names[0];return a&&(a=Fn(a)),_a(a)?a:void 0}async function Ra(n){let{aptosConfig:e,options:t,accountAddress:r}=n,i=await Ui({aptosConfig:e});return(await T({aptosConfig:e,originMethod:"getAccountNames",query:{query:Jt,variables:{limit:_optionalChain([t, 'optionalAccess', _207 => _207.limit]),offset:_optionalChain([t, 'optionalAccess', _208 => _208.offset]),order_by:_optionalChain([t, 'optionalAccess', _209 => _209.orderBy]),where_condition:{..._nullishCoalesce(_optionalChain([n, 'access', _210 => _210.options, 'optionalAccess', _211 => _211.where]), () => ({})),owner_address:{_eq:r.toString()},expiration_timestamp:{_gte:i}}}}})).current_aptos_names.map(Fn)}async function Ua(n){let{aptosConfig:e,options:t,accountAddress:r}=n,i=await Ui({aptosConfig:e});return(await T({aptosConfig:e,originMethod:"getAccountDomains",query:{query:Jt,variables:{limit:_optionalChain([t, 'optionalAccess', _212 => _212.limit]),offset:_optionalChain([t, 'optionalAccess', _213 => _213.offset]),order_by:_optionalChain([t, 'optionalAccess', _214 => _214.orderBy]),where_condition:{..._nullishCoalesce(_optionalChain([n, 'access', _215 => _215.options, 'optionalAccess', _216 => _216.where]), () => ({})),owner_address:{_eq:r.toString()},expiration_timestamp:{_gte:i},subdomain:{_eq:""}}}}})).current_aptos_names.map(Fn)}async function Da(n){let{aptosConfig:e,options:t,accountAddress:r}=n,i=await Ui({aptosConfig:e});return(await T({aptosConfig:e,originMethod:"getAccountSubdomains",query:{query:Jt,variables:{limit:_optionalChain([t, 'optionalAccess', _217 => _217.limit]),offset:_optionalChain([t, 'optionalAccess', _218 => _218.offset]),order_by:_optionalChain([t, 'optionalAccess', _219 => _219.orderBy]),where_condition:{..._nullishCoalesce(_optionalChain([n, 'access', _220 => _220.options, 'optionalAccess', _221 => _221.where]), () => ({})),owner_address:{_eq:r.toString()},expiration_timestamp:{_gte:i},subdomain:{_neq:""}}}}})).current_aptos_names.map(Fn)}async function za(n){let{aptosConfig:e,options:t,domain:r}=n;return(await T({aptosConfig:e,originMethod:"getDomainSubdomains",query:{query:Jt,variables:{limit:_optionalChain([t, 'optionalAccess', _222 => _222.limit]),offset:_optionalChain([t, 'optionalAccess', _223 => _223.offset]),order_by:_optionalChain([t, 'optionalAccess', _224 => _224.orderBy]),where_condition:{..._nullishCoalesce(_optionalChain([n, 'access', _225 => _225.options, 'optionalAccess', _226 => _226.where]), () => ({})),domain:{_eq:r},subdomain:{_neq:""}}}}})).current_aptos_names.map(Fn).filter(_a)}async function Ui(n){let{aptosConfig:e}=n,t=tt(e),[r]=await ae({aptosConfig:e,payload:{function:`${t}::config::reregistration_grace_sec`,functionArguments:[]}}),i=r/60/60/24,o=()=>new Date;return new Date(o().setDate(o().getDate()-i)).toISOString()}async function ka(n){let{aptosConfig:e,sender:t,name:r,years:i=1,options:o}=n,s=tt(e),a=i*31536e3,{domainName:c,subdomainName:d}=ut(r);if(d)throw new Error("Subdomains cannot be renewed");if(i!==1)throw new Error("Currently, only 1 year renewals are supported");return await w({aptosConfig:e,sender:t.accountAddress.toString(),data:{function:`${s}::router::renew_domain`,functionArguments:[c,a]},options:o})}function Fn(n){return{...n,expiration_timestamp:new Date(n.expiration_timestamp).getTime()}}var Nn=class{constructor(e){this.config=e}async getOwnerAddress(e){return Ea({aptosConfig:this.config,...e})}async getExpiration(e){return Ri({aptosConfig:this.config,...e})}async getTargetAddress(e){return va({aptosConfig:this.config,...e})}async setTargetAddress(e){return Ca({aptosConfig:this.config,...e})}async getPrimaryName(e){return xa({aptosConfig:this.config,...e})}async setPrimaryName(e){return Ia({aptosConfig:this.config,...e})}async registerName(e){return Pa({aptosConfig:this.config,...e})}async renewDomain(e){return ka({aptosConfig:this.config,...e})}async getName(e){return Ka({aptosConfig:this.config,...e})}async getAccountNames(e){return Ra({aptosConfig:this.config,...e})}async getAccountDomains(e){return Ua({aptosConfig:this.config,...e})}async getAccountSubdomains(e){return Da({aptosConfig:this.config,...e})}async getDomainSubdomains(e){return za({aptosConfig:this.config,...e})}};async function Oa(n){let{aptosConfig:e,poolAddress:t}=n,r=_chunkRX5UBAMEjs.Z.from(t).toStringLong(),o=await T({aptosConfig:e,query:{query:ui,variables:{where_condition:{pool_address:{_eq:r}}}}});return o.num_active_delegator_per_pool[0]?o.num_active_delegator_per_pool[0].num_active_delegator:0}async function Fa(n){let{aptosConfig:e,options:t}=n,r={query:ui,variables:{order_by:_optionalChain([t, 'optionalAccess', _227 => _227.orderBy])}};return(await T({aptosConfig:e,query:r})).num_active_delegator_per_pool}async function Na(n){let{aptosConfig:e,delegatorAddress:t,poolAddress:r}=n,i={query:Lo,variables:{delegatorAddress:_chunkRX5UBAMEjs.Z.from(t).toStringLong(),poolAddress:_chunkRX5UBAMEjs.Z.from(r).toStringLong()}};return(await T({aptosConfig:e,query:i})).delegated_staking_activities}var Gn=class{constructor(e){this.config=e}async getNumberOfDelegators(e){return await S({config:this.config,minimumLedgerVersion:_optionalChain([e, 'optionalAccess', _228 => _228.minimumLedgerVersion]),processorType:"stake_processor"}),Oa({aptosConfig:this.config,...e})}async getNumberOfDelegatorsForAllPools(e){return await S({config:this.config,minimumLedgerVersion:_optionalChain([e, 'optionalAccess', _229 => _229.minimumLedgerVersion]),processorType:"stake_processor"}),Fa({aptosConfig:this.config,...e})}async getDelegatedStakingActivities(e){return await S({config:this.config,minimumLedgerVersion:_optionalChain([e, 'optionalAccess', _230 => _230.minimumLedgerVersion]),processorType:"stake_processor"}),Na({aptosConfig:this.config,...e})}};var Or=class{constructor(e){this.config=e}async simple(e){return w({aptosConfig:this.config,...e})}async scriptComposer(e){let t=new Kr(this.config);await t.init();let i=(await e.builder(t)).build(),o=await Pi({aptosConfig:this.config,payload:St.load(new C(i)),...e});return new $t(o,e.withFeePayer===!0?_chunkRX5UBAMEjs.Z.ZERO:void 0)}async multiAgent(e){return w({aptosConfig:this.config,...e})}};function Di(n,e,t){let r=t.value;return t.value=async function(...i){let[o]=i;if(o.transaction.feePayerAddress&&!o.feePayerAuthenticator)throw new Error("You are submitting a Fee Payer transaction but missing the feePayerAuthenticator");return r.apply(this,i)},t}function zi(n,e,t){let r=t.value;return t.value=async function(...i){return r.apply(this,i)},t}var nn=class{constructor(e){this.config=e}async simple(e){return Ci({aptosConfig:this.config,...e})}async multiAgent(e){return Ci({aptosConfig:this.config,...e})}};_chunkRX5UBAMEjs.a.call(void 0, [zi],nn.prototype,"simple",1),_chunkRX5UBAMEjs.a.call(void 0, [zi],nn.prototype,"multiAgent",1);var rn=class{constructor(e){this.config=e}async simple(e){return In({aptosConfig:this.config,...e})}async multiAgent(e){return In({aptosConfig:this.config,...e})}};_chunkRX5UBAMEjs.a.call(void 0, [Di],rn.prototype,"simple",1),_chunkRX5UBAMEjs.a.call(void 0, [Di],rn.prototype,"multiAgent",1);var Fr=class{constructor(e,t,r,i,o){this.lastUncommintedNumber=null;this.currentNumber=null;this.lock=!1;this.aptosConfig=e,this.account=t,this.maxWaitTime=r,this.maximumInFlight=i,this.sleepTime=o}async nextSequenceNumber(){for(;this.lock;)await _chunkRX5UBAMEjs._.call(void 0, this.sleepTime);this.lock=!0;let e=BigInt(0);try{if((this.lastUncommintedNumber===null||this.currentNumber===null)&&await this.initialize(),this.currentNumber-this.lastUncommintedNumber>=this.maximumInFlight){await this.update();let t=_chunkRX5UBAMEjs.aa.call(void 0, );for(;this.currentNumber-this.lastUncommintedNumber>=this.maximumInFlight;)await _chunkRX5UBAMEjs._.call(void 0, this.sleepTime),_chunkRX5UBAMEjs.aa.call(void 0, )-t>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()}e=this.currentNumber,this.currentNumber+=BigInt(1)}catch(t){console.error("error in getting next sequence number for this account",t)}finally{this.lock=!1}return e}async initialize(){let{sequence_number:e}=await Oe({aptosConfig:this.aptosConfig,accountAddress:this.account.accountAddress});this.currentNumber=BigInt(e),this.lastUncommintedNumber=BigInt(e)}async update(){let{sequence_number:e}=await Oe({aptosConfig:this.aptosConfig,accountAddress:this.account.accountAddress});return this.lastUncommintedNumber=BigInt(e),this.lastUncommintedNumber}async synchronize(){if(this.lastUncommintedNumber!==this.currentNumber){for(;this.lock;)await _chunkRX5UBAMEjs._.call(void 0, this.sleepTime);this.lock=!0;try{await this.update();let e=_chunkRX5UBAMEjs.aa.call(void 0, );for(;this.lastUncommintedNumber!==this.currentNumber;)_chunkRX5UBAMEjs.aa.call(void 0, )-e>this.maxWaitTime?(console.warn(`Waited over 30 seconds for a transaction to commit, re-syncing ${this.account.accountAddress.toString()}`),await this.initialize()):(await _chunkRX5UBAMEjs._.call(void 0, this.sleepTime),await this.update())}catch(e){console.error("error in synchronizing this account sequence number with the one on chain",e)}finally{this.lock=!1}}}};var on=class{constructor(){this.queue=[];this.pendingDequeue=[];this.cancelled=!1}enqueue(e){if(this.cancelled=!1,this.pendingDequeue.length>0){_optionalChain([this, 'access', _231 => _231.pendingDequeue, 'access', _232 => _232.shift, 'call', _233 => _233(), 'optionalAccess', _234 => _234.resolve, 'call', _235 => _235(e)]);return}this.queue.push(e)}async dequeue(){return this.queue.length>0?Promise.resolve(this.queue.shift()):new Promise((e,t)=>{this.pendingDequeue.push({resolve:e,reject:t})})}isEmpty(){return this.queue.length===0}cancel(){this.cancelled=!0,this.pendingDequeue.forEach(async({reject:e})=>{e(new sn("Task cancelled"))}),this.pendingDequeue=[],this.queue.length=0}isCancelled(){return this.cancelled}pendingDequeueLength(){return this.pendingDequeue.length}},sn=class extends Error{};var Ga="fulfilled",Ba= exports.TransactionWorkerEventsEnum =(o=>(o.TransactionSent="transactionSent",o.TransactionSendFailed="transactionSendFailed",o.TransactionExecuted="transactionExecuted",o.TransactionExecutionFailed="transactionExecutionFailed",o.ExecutionFinish="executionFinish",o))(Ba||{}),Nr= exports.TransactionWorker =class extends _eventemitter32.default{constructor(t,r,i=30,o=100,s=10){super();this.taskQueue=new on;this.transactionsQueue=new on;this.outstandingTransactions=new on;this.sentTransactions=[];this.executedTransactions=[];this.aptosConfig=t,this.account=r,this.started=!1,this.accountSequnceNumber=new Fr(t,r,i,o,s)}async submitNextTransaction(){try{for(;;){let t=await this.accountSequnceNumber.nextSequenceNumber();if(t===null)return;let r=await this.generateNextTransaction(this.account,t);if(!r)return;let i=vn({aptosConfig:this.aptosConfig,transaction:r,signer:this.account});await this.outstandingTransactions.enqueue([i,t])}}catch(t){if(t instanceof sn)return;throw new Error(`Submit transaction failed for ${this.account.accountAddress.toString()} with error ${t}`)}}async processTransactions(){try{for(;;){let t=[],r=[],[i,o]=await this.outstandingTransactions.dequeue();for(t.push(i),r.push(o);!this.outstandingTransactions.isEmpty();)[i,o]=await this.outstandingTransactions.dequeue(),t.push(i),r.push(o);let s=await Promise.allSettled(t);for(let a=0;a<s.length&&a<r.length;a+=1){let c=s[a];o=r[a],c.status===Ga?(this.sentTransactions.push([c.value.hash,o,null]),this.emit("transactionSent",{message:`transaction hash ${c.value.hash} has been committed to chain`,transactionHash:c.value.hash}),await this.checkTransaction(c,o)):(this.sentTransactions.push([c.status,o,c.reason]),this.emit("transactionSendFailed",{message:`failed to commit transaction ${this.sentTransactions.length} with error ${c.reason}`,error:c.reason}))}this.emit("executionFinish",{message:`execute ${s.length} transactions finished`})}}catch(t){if(t instanceof sn)return;throw new Error(`Process execution failed for ${this.account.accountAddress.toString()} with error ${t}`)}}async checkTransaction(t,r){try{let i=[];i.push(Yt({aptosConfig:this.aptosConfig,transactionHash:t.value.hash}));let o=await Promise.allSettled(i);for(let s=0;s<o.length;s+=1){let a=o[s];a.status===Ga?(this.executedTransactions.push([a.value.hash,r,null]),this.emit("transactionExecuted",{message:`transaction hash ${a.value.hash} has been executed on chain`,transactionHash:t.value.hash})):(this.executedTransactions.push([a.status,r,a.reason]),this.emit("transactionExecutionFailed",{message:`failed to execute transaction ${this.executedTransactions.length} with error ${a.reason}`,error:a.reason}))}}catch(i){throw new Error(`Check transaction failed for ${this.account.accountAddress.toString()} with error ${i}`)}}async push(t,r){this.transactionsQueue.enqueue([t,r])}async generateNextTransaction(t,r){if(this.transactionsQueue.isEmpty())return;let[i,o]=await this.transactionsQueue.dequeue();return w({aptosConfig:this.aptosConfig,sender:t.accountAddress,data:i,options:{...o,accountSequenceNumber:r}})}async run(){try{for(;!this.taskQueue.isCancelled();)await(await this.taskQueue.dequeue())()}catch(t){throw new Error(`Unable to start transaction batching: ${t}`)}}start(){if(this.started)throw new Error("worker has already started");this.started=!0,this.taskQueue.enqueue(()=>this.submitNextTransaction()),this.taskQueue.enqueue(()=>this.processTransactions()),this.run()}stop(){if(this.taskQueue.isCancelled())throw new Error("worker has already stopped");this.started=!1,this.taskQueue.cancel()}};var Gr=class extends _eventemitter32.default{constructor(e){super(),this.config=e}start(e){let{sender:t}=e;this.account=t,this.transactionWorker=new Nr(this.config,t),this.transactionWorker.start(),this.registerToEvents()}push(e){let{data:t,options:r}=e;for(let i of t)this.transactionWorker.push(i,r)}registerToEvents(){this.transactionWorker.on("transactionSent",async e=>{this.emit("transactionSent",e)}),this.transactionWorker.on("transactionSendFailed",async e=>{this.emit("transactionSendFailed",e)}),this.transactionWorker.on("transactionExecuted",async e=>{this.emit("transactionExecuted",e)}),this.transactionWorker.on("transactionExecutionFailed",async e=>{this.emit("transactionExecutionFailed",e)}),this.transactionWorker.on("executionFinish",async e=>{this.emit("executionFinish",e)})}forSingleAccount(e){try{let{sender:t,data:r,options:i}=e;this.start({sender:t}),this.push({data:r,options:i})}catch(t){throw new Error(`failed to submit transactions with error: ${t}`)}}};var Bn=class{constructor(e){this.config=e,this.build=new Or(this.config),this.simulate=new nn(this.config),this.submit=new rn(this.config),this.batch=new Gr(this.config)}async getTransactions(e){return mi({aptosConfig:this.config,...e})}async getTransactionByVersion(e){return ys({aptosConfig:this.config,...e})}async getTransactionByHash(e){return Pn({aptosConfig:this.config,...e})}async isPendingTransaction(e){return fs({aptosConfig:this.config,...e})}async waitForTransaction(e){return Yt({aptosConfig:this.config,...e})}async getGasPriceEstimation(){return Sr({aptosConfig:this.config})}getSigningMessage(e){return ks(e)}async publishPackageTransaction(e){return Fs({aptosConfig:this.config,...e})}async rotateAuthKey(e){return Ns({aptosConfig:this.config,...e})}sign(e){return Rr({...e})}signAsFeePayer(e){return Ur({...e})}async batchTransactionsForSingleAccount(e){try{let{sender:t,data:r,options:i}=e;this.batch.forSingleAccount({sender:t,data:r,options:i})}catch(t){throw new Error(`failed to submit transactions with error: ${t}`)}}async signAndSubmitTransaction(e){return vn({aptosConfig:this.config,...e})}async signAndSubmitAsFeePayer(e){return Os({aptosConfig:this.config,...e})}};var Mn=class{constructor(e){this.config=e}async getTableItem(e){return Tr({aptosConfig:this.config,...e})}async getTableItemsData(e){return await S({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"default_processor"}),Zo({aptosConfig:this.config,...e})}async getTableItemsMetadata(e){return await S({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"default_processor"}),es({aptosConfig:this.config,...e})}};async function Br(n){let{aptosConfig:e,jwt:t,ephemeralKeyPair:r,uidKey:i="sub",derivationPath:o}=n,s={jwt_b64:t,epk:r.getPublicKey().bcsToHex().toStringWithoutPrefix(),exp_date_secs:r.expiryDateSecs,epk_blinder:_chunkRX5UBAMEjs.j.fromHexInput(r.blinder).toStringWithoutPrefix(),uid_key:i,derivation_path:o},{data:a}=await wo({aptosConfig:e,path:"fetch",body:s,originMethod:"getPepper",overrides:{WITH_CREDENTIALS:!1}});return _chunkRX5UBAMEjs.j.fromHexInput(a.pepper).toUint8Array()}async function ki(n){let{aptosConfig:e,jwt:t,ephemeralKeyPair:r,pepper:i=await Br(n),uidKey:o="sub",maxExpHorizonSecs:s=(await mn({aptosConfig:e})).maxExpHorizonSecs}=n;if(_chunkRX5UBAMEjs.j.fromHexInput(i).toUint8Array().length!==Ze.PEPPER_LENGTH)throw new Error(`Pepper needs to be ${Ze.PEPPER_LENGTH} bytes`);let a=_jwtdecode.jwtDecode.call(void 0, t);if(typeof a.iat!="number")throw new Error("iat was not found");if(s<r.expiryDateSecs-a.iat)throw Error(`The EphemeralKeyPair is too long lived. It's lifespan must be less than ${s}`);let c={jwt_b64:t,epk:r.getPublicKey().bcsToHex().toStringWithoutPrefix(),epk_blinder:_chunkRX5UBAMEjs.j.fromHexInput(r.blinder).toStringWithoutPrefix(),exp_date_secs:r.expiryDateSecs,exp_horizon_secs:s,pepper:_chunkRX5UBAMEjs.j.fromHexInput(i).toStringWithoutPrefix(),uid_key:o},{data:d}=await So({aptosConfig:e,path:"prove",body:c,originMethod:"getProof",overrides:{WITH_CREDENTIALS:!1}}),l=d.proof,h=new Bt({a:l.a,b:l.b,c:l.c});return new Pe({proof:new Mt(h,0),trainingWheelsSignature:Ce.fromHex(d.training_wheels_signature),expHorizonSecs:s})}async function Ma(n){let{aptosConfig:e,jwt:t,jwkAddress:r,uidKey:i,proofFetchCallback:o,pepper:s=await Br(n)}=n,{verificationKey:a,maxExpHorizonSecs:c}=await mn({aptosConfig:e}),d=ki({...n,pepper:s,maxExpHorizonSecs:c}),l=o?d:await d;if(r!==void 0){let g=ne.fromJwtAndPepper({jwt:t,pepper:s,jwkAddress:r,uidKey:i}),b=await Xt({aptosConfig:e,authenticationKey:g.authKey().derivedAddress()});return Kt.create({...n,address:b,proof:l,pepper:s,proofFetchCallback:o,jwkAddress:r,verificationKey:a})}let h=k.fromJwtAndPepper({jwt:t,pepper:s,uidKey:i}),p=await Xt({aptosConfig:e,authenticationKey:h.authKey().derivedAddress()});return Ze.create({...n,address:p,proof:l,pepper:s,proofFetchCallback:o,verificationKey:a})}async function Va(n){let{aptosConfig:e,sender:t,iss:r,options:i}=n,{jwksUrl:o}=n;o===void 0&&(yo.test(r)?o="https://www.googleapis.com/service_accounts/v1/jwk/securetoken@system.gserviceaccount.com":o=r.endsWith("/")?`${r}.well-known/jwks.json`:`${r}/.well-known/jwks.json`);let s;try{if(s=await fetch(o),!s.ok)throw new Error(`${s.status} ${s.statusText}`)}catch(c){let d;throw c instanceof Error?d=`${c.message}`:d=`error unknown - ${c}`,D.fromErrorType({type:14,details:`Failed to fetch JWKS at ${o}: ${d}`})}let a=await s.json();return w({aptosConfig:e,sender:t.accountAddress,data:{function:"0x1::jwks::update_federated_jwk_set",functionArguments:[r,_.MoveString(a.keys.map(c=>c.kid)),_.MoveString(a.keys.map(c=>c.alg)),_.MoveString(a.keys.map(c=>c.e)),_.MoveString(a.keys.map(c=>c.n))]},options:i})}var Vn=class{constructor(e){this.config=e}async getPepper(e){return Br({aptosConfig:this.config,...e})}async getProof(e){return ki({aptosConfig:this.config,...e})}async deriveKeylessAccount(e){return Ma({aptosConfig:this.config,...e})}async updateFederatedKeylessJwkSetTransaction(e){return Va({aptosConfig:this.config,...e})}};async function ju(n){let{aptosConfig:e,options:t}=n,r={query:yr,variables:{where_condition:_optionalChain([t, 'optionalAccess', _236 => _236.where]),offset:_optionalChain([t, 'optionalAccess', _237 => _237.offset]),limit:_optionalChain([t, 'optionalAccess', _238 => _238.limit]),order_by:_optionalChain([t, 'optionalAccess', _239 => _239.orderBy])}};return(await T({aptosConfig:e,query:r,originMethod:"getObjectData"})).current_objects}async function qa(n){let{aptosConfig:e,objectAddress:t,options:r}=n,o={object_address:{_eq:_chunkRX5UBAMEjs.Z.from(t).toStringLong()}};return(await ju({aptosConfig:e,options:{...r,where:o}}))[0]}var qn=class{constructor(e){this.config=e}async getObjectDataByObjectAddress(e){return await S({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"objects_processor"}),qa({aptosConfig:this.config,...e})}};async function La(n){let{aptosConfig:e,payload:t,options:r}=n,i=await Cr({...t,aptosConfig:e}),o=new _chunkRX5UBAMEjs.m;i.serialize(o);let s=o.toUint8Array(),{data:a}=await ho({aptosConfig:e,path:"view",originMethod:"view",contentType:"application/x.aptos.view_function+bcs",acceptType:"application/x-bcs",params:{ledger_version:_optionalChain([r, 'optionalAccess', _240 => _240.ledgerVersion])},body:s}),c=new Uint8Array(a);return _optionalChain([r, 'optionalAccess', _241 => _241.convert])?r.convert(c):c}var Ln=class{constructor(e){this.config=e}async viewBinary(e){return La({...e,aptosConfig:this.config})}};var J=class{constructor(e){this.config=new Dr(e),this.account=new Cn(this.config),this.abstraction=new Ut(this.config),this.ans=new Nn(this.config),this.coin=new Kn(this.config),this.digitalAsset=new Rn(this.config),this.event=new Dn(this.config),this.experimental=new Ln(this.config),this.faucet=new zn(this.config),this.fungibleAsset=new kn(this.config),this.general=new On(this.config),this.staking=new Gn(this.config),this.transaction=new Bn(this.config),this.table=new Mn(this.config),this.keyless=new Vn(this.config),this.object=new qn(this.config)}};function re(n,e,t){Object.getOwnPropertyNames(e.prototype).forEach(r=>{let i=Object.getOwnPropertyDescriptor(e.prototype,r);i&&(i.value=function(...o){return this[t][r](...o)},Object.defineProperty(n.prototype,r,i))})}re(J,Cn,"account");re(J,Ut,"abstraction");re(J,Nn,"ans");re(J,Kn,"coin");re(J,Rn,"digitalAsset");re(J,Dn,"event");re(J,Ln,"experimental");re(J,zn,"faucet");re(J,kn,"fungibleAsset");re(J,On,"general");re(J,Gn,"staking");re(J,Bn,"transaction");re(J,Mn,"table");re(J,Vn,"keyless");re(J,qn,"object");exports.APTOS_BIP44_REGEX = ic; exports.APTOS_COIN = ht; exports.APTOS_FA = go; exports.APTOS_HARDENED_REGEX = rc; exports.AbstractKeylessAccount = ge; exports.AbstractMultiKey = yn; exports.AbstractedAccount = Do; exports.Account = ke; exports.AccountAddress = _chunkRX5UBAMEjs.Z; exports.AccountAuthenticator = Q; exports.AccountAuthenticatorAbstraction = fn; exports.AccountAuthenticatorEd25519 = xe; exports.AccountAuthenticatorMultiEd25519 = $e; exports.AccountAuthenticatorMultiKey = De; exports.AccountAuthenticatorNoAccountAuthenticator = qt; exports.AccountAuthenticatorSingleKey = se; exports.AccountAuthenticatorVariant = _chunkRX5UBAMEjs.w; exports.AccountPublicKey = oe; exports.AccountSequenceNumber = Fr; exports.AccountUtils = Ro; exports.AddressInvalidReason = _chunkRX5UBAMEjs.Y; exports.AnyPublicKey = O; exports.AnyPublicKeyVariant = _chunkRX5UBAMEjs.y; exports.AnySignature = H; exports.AnySignatureVariant = _chunkRX5UBAMEjs.z; exports.Aptos = J; exports.AptosApiError = Z; exports.AptosApiType = At; exports.AptosConfig = Dr; exports.AptosScriptComposer = Kr; exports.AuthenticationKey = B; exports.Bool = U; exports.CKDPriv = to; exports.CallArgument = _chunkRX5UBAMEjs.X; exports.ChainId = Lt; exports.DEFAULT_MAX_GAS_AMOUNT = po; exports.DEFAULT_TXN_EXP_SEC_FROM_NOW = lo; exports.DEFAULT_TXN_TIMEOUT_SEC = tr; exports.DeriveScheme = _chunkRX5UBAMEjs.W; exports.Deserializer = C; exports.EPK_HORIZON_SECS = hg; exports.Ed25519Account = he; exports.Ed25519PrivateKey = q; exports.Ed25519PublicKey = x; exports.Ed25519Signature = I; exports.EntryFunction = _t; exports.EntryFunctionBytes = Jn; exports.EphemeralCertificate = Gt; exports.EphemeralCertificateVariant = _chunkRX5UBAMEjs.C; exports.EphemeralKeyPair = Ct; exports.EphemeralPublicKey = ft; exports.EphemeralPublicKeyVariant = _chunkRX5UBAMEjs.A; exports.EphemeralSignature = Ce; exports.EphemeralSignatureVariant = _chunkRX5UBAMEjs.B; exports.FIREBASE_AUTH_ISS_PATTERN = yo; exports.FederatedKeylessAccount = Kt; exports.FederatedKeylessPublicKey = ne; exports.FeePayerRawTransaction = Pt; exports.FixedBytes = gt; exports.Groth16VerificationKey = ii; exports.Groth16Zkp = Bt; exports.HARDENED_OFFSET = Yi; exports.Hex = _chunkRX5UBAMEjs.j; exports.HexInvalidReason = _chunkRX5UBAMEjs.i; exports.Identifier = K; exports.KeyType = oc; exports.KeylessAccount = Ze; exports.KeylessConfiguration = ri; exports.KeylessError = D; exports.KeylessErrorCategory = Rc; exports.KeylessErrorResolutionTip = Uc; exports.KeylessErrorType = nr; exports.KeylessPublicKey = k; exports.KeylessSignature = Ve; exports.MAX_AUD_VAL_BYTES = Bc; exports.MAX_COMMITED_EPK_BYTES = Sg; exports.MAX_EXTRA_FIELD_BYTES = bg; exports.MAX_ISS_VAL_BYTES = Tg; exports.MAX_JWT_HEADER_B64_BYTES = wg; exports.MAX_UID_KEY_BYTES = Mc; exports.MAX_UID_VAL_BYTES = Vc; exports.MimeType = _chunkRX5UBAMEjs.q; exports.ModuleId = An; exports.MoveAbility = _chunkRX5UBAMEjs.S; exports.MoveFunctionVisibility = _chunkRX5UBAMEjs.R; exports.MoveJWK = oi; exports.MoveOption = Y; exports.MoveString = P; exports.MoveVector = _; exports.MultiAgentRawTransaction = Et; exports.MultiAgentTransaction = pr; exports.MultiEd25519Account = Io; exports.MultiEd25519PublicKey = Vt; exports.MultiEd25519Signature = He; exports.MultiKey = Ue; exports.MultiKeyAccount = _n; exports.MultiKeySignature = Le; exports.MultiSig = wn; exports.MultiSigTransactionPayload = Sn; exports.Network = Xr; exports.NetworkToChainId = Yr; exports.NetworkToFaucetAPI = uo; exports.NetworkToIndexerAPI = ao; exports.NetworkToNetworkName = pl; exports.NetworkToNodeAPI = co; exports.NetworkToPepperAPI = jr; exports.NetworkToProverAPI = Jr; exports.ParsingError = _chunkRX5UBAMEjs.h; exports.PrivateKey = it; exports.PrivateKeyVariants = _chunkRX5UBAMEjs.x; exports.ProcessorType = Be; exports.PublicKey = mt; exports.RAW_TRANSACTION_SALT = mo; exports.RAW_TRANSACTION_WITH_DATA_SALT = Zr; exports.RawTransaction = Ae; exports.RawTransactionWithData = ur; exports.RoleType = _chunkRX5UBAMEjs.T; exports.RotationProofChallenge = dr; exports.Script = bn; exports.ScriptTransactionArgumentVariants = _chunkRX5UBAMEjs.s; exports.Secp256k1PrivateKey = Ge; exports.Secp256k1PublicKey = Ne; exports.Secp256k1Signature = yt; exports.Serializable = _chunkRX5UBAMEjs.l; exports.Serialized = cn; exports.Serializer = _chunkRX5UBAMEjs.m; exports.Signature = M; exports.SignedTransaction = Ye; exports.SigningScheme = _chunkRX5UBAMEjs.U; exports.SigningSchemeInput = _chunkRX5UBAMEjs.V; exports.SimpleTransaction = $t; exports.SingleKeyAccount = Te; exports.StructTag = ze; exports.TransactionAndProof = ci; exports.TransactionAuthenticator = Xe; exports.TransactionAuthenticatorEd25519 = xt; exports.TransactionAuthenticatorFeePayer = vt; exports.TransactionAuthenticatorMultiAgent = It; exports.TransactionAuthenticatorMultiEd25519 = Ht; exports.TransactionAuthenticatorSingleSender = at; exports.TransactionAuthenticatorVariant = _chunkRX5UBAMEjs.v; exports.TransactionPayload = wt; exports.TransactionPayloadEntryFunction = hn; exports.TransactionPayloadMultiSig = Tn; exports.TransactionPayloadScript = St; exports.TransactionPayloadVariants = _chunkRX5UBAMEjs.t; exports.TransactionResponseType = _chunkRX5UBAMEjs.E; exports.TransactionVariants = _chunkRX5UBAMEjs.u; exports.TransactionWorker = Nr; exports.TransactionWorkerEventsEnum = Ba; exports.TypeTag = N; exports.TypeTagAddress = F; exports.TypeTagBool = V; exports.TypeTagGeneric = G; exports.TypeTagParserError = $; exports.TypeTagParserErrorType = du; exports.TypeTagReference = cr; exports.TypeTagSigner = bt; exports.TypeTagStruct = A; exports.TypeTagU128 = je; exports.TypeTagU16 = We; exports.TypeTagU256 = Je; exports.TypeTagU32 = Qe; exports.TypeTagU64 = j; exports.TypeTagU8 = pe; exports.TypeTagVariants = _chunkRX5UBAMEjs.r; exports.TypeTagVector = v; exports.U128 = _e; exports.U16 = we; exports.U256 = me; exports.U32 = Se; exports.U64 = W; exports.U8 = X; exports.ZeroKnowledgeSig = Pe; exports.ZkProof = Mt; exports.ZkpVariant = _chunkRX5UBAMEjs.D; exports.aptosBinaryRequest = ir; exports.aptosCoinStructTag = hy; exports.aptosRequest = rr; exports.base64UrlDecode = _chunkRX5UBAMEjs.ca; exports.bigIntToBytesLE = so; exports.binaryRequest = Oc; exports.buildTransaction = xi; exports.bytesToBigIntLE = pn; exports.checkOrConvertArgument = Rt; exports.convertAmountFromHumanReadableToOnChain = _chunkRX5UBAMEjs.da; exports.convertAmountFromOnChainToHumanReadable = _chunkRX5UBAMEjs.ea; exports.convertArgument = Ir; exports.convertCallArgument = Ks; exports.convertNumber = Er; exports.createObjectAddress = ar; exports.createResourceAddress = Im; exports.createTokenAddress = vm; exports.deriveKey = Lr; exports.deriveTransactionType = si; exports.deserializeFromScriptArgument = Wc; exports.ensureBoolean = _chunkRX5UBAMEjs.n; exports.fetchEntryFunctionAbi = vs; exports.fetchFunctionAbi = Ei; exports.fetchMoveFunctionAbi = Is; exports.fetchViewFunctionAbi = Cs; exports.findFirstNonSignerArg = Es; exports.floorToWholeHour = _chunkRX5UBAMEjs.ba; exports.generateRawTransaction = Pi; exports.generateSignedTransaction = Ii; exports.generateSignedTransactionForSimulation = Rs; exports.generateSigningMessage = Wt; exports.generateSigningMessageForSerializable = Rf; exports.generateSigningMessageForTransaction = Ie; exports.generateTransactionPayload = vr; exports.generateTransactionPayloadWithABI = mu; exports.generateUserTransactionHash = Lb; exports.generateViewFunctionPayload = Cr; exports.generateViewFunctionPayloadWithABI = yu; exports.get = or; exports.getAptosFullNode = L; exports.getAptosPepperService = Gl; exports.getAuthenticatorForSimulation = en; exports.getBinary = Fc; exports.getBinaryAptosFullNode = Nl; exports.getErrorMessage = _chunkRX5UBAMEjs.$; exports.getFunctionParts = _chunkRX5UBAMEjs.ha; exports.getIssAudAndUidVal = qe; exports.getKeylessConfig = mn; exports.getKeylessJWKs = Po; exports.hashStrToField = Zn; exports.hashValues = Us; exports.hexToAsciiString = _chunkRX5UBAMEjs.k; exports.isBcsAddress = xr; exports.isBcsBool = yi; exports.isBcsFixedBytes = ou; exports.isBcsString = fi; exports.isBcsU128 = wi; exports.isBcsU16 = hi; exports.isBcsU256 = Si; exports.isBcsU32 = Ti; exports.isBcsU64 = bi; exports.isBcsU8 = Ai; exports.isBlockEpilogueTransactionResponse = _chunkRX5UBAMEjs.L; exports.isBlockMetadataTransactionResponse = _chunkRX5UBAMEjs.I; exports.isBool = bs; exports.isCanonicalEd25519Signature = ac; exports.isEd25519Signature = _chunkRX5UBAMEjs.M; exports.isEmptyOption = ws; exports.isEncodedEntryFunctionArgument = Ss; exports.isEncodedStruct = _chunkRX5UBAMEjs.ga; exports.isFeePayerSignature = _chunkRX5UBAMEjs.P; exports.isGenesisTransactionResponse = _chunkRX5UBAMEjs.H; exports.isKeylessSigner = lr; exports.isLargeNumber = Pr; exports.isMultiAgentSignature = _chunkRX5UBAMEjs.O; exports.isMultiEd25519Signature = _chunkRX5UBAMEjs.Q; exports.isNumber = iu; exports.isPendingTransactionResponse = _chunkRX5UBAMEjs.F; exports.isScriptDataInput = _s; exports.isSecp256k1Signature = _chunkRX5UBAMEjs.N; exports.isSingleKeySigner = ai; exports.isStateCheckpointTransactionResponse = _chunkRX5UBAMEjs.J; exports.isString = et; exports.isUserTransactionResponse = _chunkRX5UBAMEjs.G; exports.isValidBIP44Path = Zi; exports.isValidFunctionInfo = _chunkRX5UBAMEjs.ia; exports.isValidHardenedPath = eo; exports.isValidatorTransactionResponse = _chunkRX5UBAMEjs.K; exports.mnemonicToSeed = Xn; exports.normalizeBundle = fo; exports.nowInSeconds = _chunkRX5UBAMEjs.aa; exports.objectStructTag = le; exports.optionStructTag = Ty; exports.outOfRangeErrorMessage = _chunkRX5UBAMEjs.o; exports.padAndPackBytesWithLen = Wr; exports.paginateWithCursor = sr; exports.paginateWithObfuscatedCursor = ti; exports.parseEncodedStruct = _chunkRX5UBAMEjs.fa; exports.parseJwtHeader = Hc; exports.parseTypeTag = Fe; exports.poseidonHash = ln; exports.post = gn; exports.postAptosFaucet = bo; exports.postAptosFullNode = st; exports.postAptosIndexer = To; exports.postAptosPepperService = wo; exports.postAptosProvingService = So; exports.postBinary = Nc; exports.postBinaryAptosFullNode = ho; exports.promiseFulfilledStatus = Ga; exports.request = kc; exports.sleep = _chunkRX5UBAMEjs._; exports.splitPath = no; exports.standardizeTypeTags = Zt; exports.stringStructTag = E; exports.throwTypeMismatch = z; exports.validateNumberInRange = _chunkRX5UBAMEjs.p;
|
|
482
480
|
//# sourceMappingURL=index.js.map
|