@aptos-labs/ts-sdk 1.15.0 → 1.16.0-zeta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/common/{accountAddress-ccLvlUQe.d.ts → accountAddress-OUd5ov6z.d.ts} +97 -5
- package/dist/common/chunk-VLEH6QBR.js +2 -0
- package/dist/common/chunk-VLEH6QBR.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 +757 -58
- package/dist/common/index.js +28 -28
- package/dist/common/index.js.map +1 -1
- package/dist/esm/{Ed25519Account-B1VMJOY2.d.mts → Ed25519Account-9zBaZEnp.d.mts} +1 -1
- package/dist/esm/account/Account.d.mts +2 -2
- package/dist/esm/account/Account.mjs +1 -1
- package/dist/esm/account/Ed25519Account.d.mts +2 -2
- package/dist/esm/account/Ed25519Account.mjs +1 -1
- package/dist/esm/account/EphemeralKeyPair.d.mts +85 -0
- package/dist/esm/account/EphemeralKeyPair.mjs +2 -0
- package/dist/esm/account/KeylessAccount.d.mts +225 -0
- package/dist/esm/account/KeylessAccount.mjs +2 -0
- package/dist/esm/account/MultiKeyAccount.d.mts +13 -7
- package/dist/esm/account/MultiKeyAccount.mjs +1 -1
- package/dist/esm/account/SingleKeyAccount.d.mts +2 -2
- package/dist/esm/account/SingleKeyAccount.mjs +1 -1
- package/dist/esm/account/index.d.mts +10 -2
- package/dist/esm/account/index.mjs +1 -1
- package/dist/esm/api/account.d.mts +2 -2
- package/dist/esm/api/account.mjs +1 -1
- package/dist/esm/api/ans.d.mts +2 -2
- package/dist/esm/api/ans.mjs +1 -1
- package/dist/esm/api/aptos.d.mts +13 -3
- package/dist/esm/api/aptos.mjs +1 -1
- package/dist/esm/api/aptosConfig.d.mts +20 -0
- package/dist/esm/api/aptosConfig.mjs +1 -1
- package/dist/esm/api/coin.d.mts +1 -1
- package/dist/esm/api/coin.mjs +1 -1
- package/dist/esm/api/digitalAsset.d.mts +2 -2
- package/dist/esm/api/digitalAsset.mjs +1 -1
- package/dist/esm/api/event.mjs +1 -1
- package/dist/esm/api/faucet.mjs +1 -1
- package/dist/esm/api/fungibleAsset.d.mts +2 -2
- package/dist/esm/api/fungibleAsset.mjs +1 -1
- package/dist/esm/api/general.d.mts +1 -1
- package/dist/esm/api/general.mjs +1 -1
- package/dist/esm/api/index.d.mts +11 -2
- package/dist/esm/api/index.mjs +1 -1
- package/dist/esm/api/keyless.d.mts +88 -0
- package/dist/esm/api/keyless.mjs +2 -0
- package/dist/esm/api/keyless.mjs.map +1 -0
- package/dist/esm/api/staking.mjs +1 -1
- package/dist/esm/api/table.mjs +1 -1
- package/dist/esm/api/transaction.d.mts +2 -2
- package/dist/esm/api/transaction.mjs +1 -1
- package/dist/esm/api/transactionSubmission/build.d.mts +1 -1
- package/dist/esm/api/transactionSubmission/build.mjs +1 -1
- package/dist/esm/api/transactionSubmission/management.d.mts +2 -2
- package/dist/esm/api/transactionSubmission/management.mjs +1 -1
- package/dist/esm/api/transactionSubmission/sign.d.mts +2 -2
- 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 -1
- package/dist/esm/api/transactionSubmission/simulate.mjs +1 -1
- package/dist/esm/api/transactionSubmission/submit.d.mts +1 -1
- package/dist/esm/api/transactionSubmission/submit.mjs +1 -1
- package/dist/esm/api/utils.mjs +1 -1
- package/dist/esm/bcs/deserializer.d.mts +32 -0
- package/dist/esm/bcs/deserializer.mjs +1 -1
- package/dist/esm/bcs/index.mjs +1 -1
- package/dist/esm/bcs/serializable/entryFunctionBytes.mjs +1 -1
- package/dist/esm/bcs/serializable/fixedBytes.mjs +1 -1
- package/dist/esm/bcs/serializable/movePrimitives.mjs +1 -1
- package/dist/esm/bcs/serializable/moveStructs.mjs +1 -1
- package/dist/esm/bcs/serializer.d.mts +42 -0
- package/dist/esm/bcs/serializer.mjs +1 -1
- package/dist/esm/{chunk-36QXVFR5.mjs → chunk-272NA6H5.mjs} +2 -2
- package/dist/esm/{chunk-36QXVFR5.mjs.map → chunk-272NA6H5.mjs.map} +1 -1
- package/dist/esm/{chunk-R5ST36VJ.mjs → chunk-34WI7I3Z.mjs} +2 -2
- package/dist/esm/chunk-3DP4R3FI.mjs +2 -0
- package/dist/esm/{chunk-FFGY7Z4B.mjs → chunk-3J53BCEQ.mjs} +2 -2
- package/dist/esm/chunk-3SXTTG2X.mjs +2 -0
- package/dist/esm/chunk-3SXTTG2X.mjs.map +1 -0
- package/dist/esm/{chunk-4GWNWSZP.mjs → chunk-3YIUOKWW.mjs} +2 -2
- package/dist/esm/{chunk-EA2DKJPX.mjs → chunk-45ESRYGP.mjs} +2 -2
- package/dist/esm/chunk-4RXGVY2H.mjs +2 -0
- package/dist/esm/chunk-4RXGVY2H.mjs.map +1 -0
- package/dist/esm/chunk-4VAYXBD2.mjs +2 -0
- package/dist/esm/chunk-5SGIYAB7.mjs +2 -0
- package/dist/esm/chunk-5SGIYAB7.mjs.map +1 -0
- package/dist/esm/chunk-5VLCYHNJ.mjs +2 -0
- package/dist/esm/chunk-5VLCYHNJ.mjs.map +1 -0
- package/dist/esm/{chunk-JGSOTNJ5.mjs → chunk-6F3HFDL3.mjs} +2 -2
- package/dist/esm/{chunk-BN22EYXR.mjs → chunk-6MDYCC7P.mjs} +2 -2
- package/dist/esm/{chunk-F7NLNWHN.mjs → chunk-7CJAEAQZ.mjs} +2 -2
- package/dist/esm/chunk-7QGIAVW4.mjs +2 -0
- package/dist/esm/chunk-7QGIAVW4.mjs.map +1 -0
- package/dist/esm/chunk-7UBKXR37.mjs +2 -0
- package/dist/esm/chunk-7UBKXR37.mjs.map +1 -0
- package/dist/esm/{chunk-JQIGQMNZ.mjs → chunk-7Y6AWDBZ.mjs} +2 -2
- package/dist/esm/chunk-7Z6DYLCA.mjs +1 -0
- package/dist/esm/chunk-7Z6DYLCA.mjs.map +1 -0
- package/dist/esm/{chunk-BCUSI3N6.mjs → chunk-AOCNYMMX.mjs} +2 -2
- package/dist/esm/chunk-AQ4I7VVB.mjs +1 -0
- package/dist/esm/chunk-AQ4I7VVB.mjs.map +1 -0
- package/dist/esm/chunk-AUAL3H36.mjs +2 -0
- package/dist/esm/{chunk-I5T6PHDV.mjs → chunk-AUV4VAXK.mjs} +2 -2
- package/dist/esm/{chunk-2X7A4HUS.mjs → chunk-AVWAYKNS.mjs} +2 -2
- package/dist/esm/{chunk-EZPUVLME.mjs → chunk-BNA3SGG6.mjs} +2 -2
- package/dist/esm/chunk-CEGCSC3T.mjs +2 -0
- package/dist/esm/chunk-CIPPNT3W.mjs +2 -0
- package/dist/esm/chunk-CIPPNT3W.mjs.map +1 -0
- package/dist/esm/{chunk-F4GDEXZ6.mjs → chunk-CZOUSIAD.mjs} +2 -2
- package/dist/esm/chunk-D76FE35G.mjs +2 -0
- package/dist/esm/chunk-D76FE35G.mjs.map +1 -0
- package/dist/esm/{chunk-A4JUQZXI.mjs → chunk-DSVNXD5A.mjs} +2 -2
- package/dist/esm/chunk-EJ7ODMDA.mjs +2 -0
- package/dist/esm/{chunk-UR3JTLIT.mjs → chunk-EJURLI4L.mjs} +2 -2
- package/dist/esm/chunk-FBPNHF54.mjs +2 -0
- package/dist/esm/chunk-FUQDDIKQ.mjs +2 -0
- package/dist/esm/chunk-FUQDDIKQ.mjs.map +1 -0
- package/dist/esm/chunk-FWTJQHJR.mjs +2 -0
- package/dist/esm/chunk-FWTJQHJR.mjs.map +1 -0
- package/dist/esm/{chunk-AHW3SKT7.mjs → chunk-GHHIUWPP.mjs} +2 -2
- package/dist/esm/{chunk-G56GPLTB.mjs → chunk-GS5Z3HO7.mjs} +2 -2
- package/dist/esm/chunk-HGRU3HWY.mjs +2 -0
- package/dist/esm/{chunk-P5TZBE3L.mjs.map → chunk-HGRU3HWY.mjs.map} +1 -1
- package/dist/esm/{chunk-XFSDV3ND.mjs → chunk-HOX6Q6ZP.mjs} +2 -2
- package/dist/esm/chunk-HQK6MF3G.mjs +2 -0
- package/dist/esm/chunk-IMVC2JKU.mjs +2 -0
- package/dist/esm/{chunk-2XK53QFA.mjs.map → chunk-IMVC2JKU.mjs.map} +1 -1
- package/dist/esm/chunk-ISXBJPLD.mjs +2 -0
- package/dist/esm/{chunk-JX75UKJX.mjs → chunk-IU6REVKX.mjs} +2 -2
- package/dist/esm/{chunk-ERIPXWXJ.mjs → chunk-IWKIZLFW.mjs} +2 -2
- package/dist/esm/{chunk-PIVZMT5D.mjs → chunk-J534ICWA.mjs} +2 -2
- package/dist/esm/chunk-J577ODDM.mjs +2 -0
- package/dist/esm/chunk-JBTLE33X.mjs +2 -0
- package/dist/esm/{chunk-CJDEPZ4J.mjs.map → chunk-JBTLE33X.mjs.map} +1 -1
- package/dist/esm/chunk-JCDZ2WXX.mjs +2 -0
- package/dist/esm/chunk-JCDZ2WXX.mjs.map +1 -0
- package/dist/esm/{chunk-YK63A5T6.mjs → chunk-LLRWILVZ.mjs} +2 -2
- package/dist/esm/chunk-M4Q4XDVR.mjs +2 -0
- package/dist/esm/chunk-M4Q4XDVR.mjs.map +1 -0
- package/dist/esm/chunk-MEOBWD6V.mjs +2 -0
- package/dist/esm/chunk-MEOBWD6V.mjs.map +1 -0
- package/dist/esm/{chunk-35EWRSDK.mjs → chunk-MLQT5I6K.mjs} +2 -2
- package/dist/esm/chunk-MSGHGK52.mjs +2 -0
- package/dist/esm/{chunk-5EN52MUT.mjs → chunk-NGTNMV6Q.mjs} +2 -2
- package/dist/esm/{chunk-P46OPJB4.mjs → chunk-NH466YFP.mjs} +2 -2
- package/dist/esm/chunk-NMD45OTM.mjs +2 -0
- package/dist/esm/chunk-NMD45OTM.mjs.map +1 -0
- package/dist/esm/{chunk-ZM33M6QO.mjs → chunk-NUBYALZP.mjs} +2 -2
- package/dist/esm/{chunk-CHWE77CR.mjs → chunk-OFC75EWS.mjs} +2 -2
- package/dist/esm/{chunk-H6FEXRTK.mjs → chunk-OOYRJQPD.mjs} +2 -2
- package/dist/esm/chunk-OZ3GSAFK.mjs +2 -0
- package/dist/esm/chunk-OZ3GSAFK.mjs.map +1 -0
- package/dist/esm/chunk-PENBUSGL.mjs +2 -0
- package/dist/esm/chunk-PENBUSGL.mjs.map +1 -0
- package/dist/esm/{chunk-WN3JL7ZT.mjs → chunk-PG7KSUMN.mjs} +2 -2
- package/dist/esm/{chunk-KAGLWBIJ.mjs → chunk-PGP2XMDE.mjs} +2 -2
- package/dist/esm/chunk-Q6LFIZ3L.mjs +2 -0
- package/dist/esm/chunk-Q6LFIZ3L.mjs.map +1 -0
- package/dist/esm/{chunk-CYTRYBWN.mjs → chunk-QJIMZI32.mjs} +2 -2
- package/dist/esm/{chunk-E56MTU2U.mjs → chunk-QLE5JL4X.mjs} +2 -2
- package/dist/esm/{chunk-WNPL4SEJ.mjs → chunk-QOOHLRRJ.mjs} +2 -2
- package/dist/esm/chunk-QYEJOEWB.mjs +2 -0
- package/dist/esm/chunk-QYEJOEWB.mjs.map +1 -0
- package/dist/esm/{chunk-TM7NDDT3.mjs → chunk-R4HLV32L.mjs} +2 -2
- package/dist/esm/chunk-RAHMGSBW.mjs +2 -0
- package/dist/esm/chunk-RAHMGSBW.mjs.map +1 -0
- package/dist/esm/{chunk-GHYE26Q5.mjs → chunk-RKHPXZM6.mjs} +2 -2
- package/dist/esm/{chunk-GHYE26Q5.mjs.map → chunk-RKHPXZM6.mjs.map} +1 -1
- package/dist/esm/{chunk-MCRRHBFQ.mjs → chunk-RWYPGTNL.mjs} +2 -2
- package/dist/esm/chunk-SCHMTP4N.mjs +2 -0
- package/dist/esm/chunk-SCHZ67F3.mjs +2 -0
- package/dist/esm/chunk-SCHZ67F3.mjs.map +1 -0
- package/dist/esm/{chunk-GP6Z47HM.mjs → chunk-SCRIQQV3.mjs} +2 -2
- package/dist/esm/{chunk-NGQR5UQ3.mjs → chunk-SNBE5YAC.mjs} +2 -2
- package/dist/esm/chunk-SSDWEOF7.mjs +2 -0
- package/dist/esm/chunk-SSDWEOF7.mjs.map +1 -0
- package/dist/esm/chunk-SZ6KR73C.mjs +2 -0
- package/dist/esm/chunk-SZ6KR73C.mjs.map +1 -0
- package/dist/esm/{chunk-UW2FPXYA.mjs → chunk-THURV6CN.mjs} +2 -2
- package/dist/esm/chunk-TJDC5PWD.mjs +2 -0
- package/dist/esm/{chunk-GUALXVFI.mjs → chunk-TU6VKYDC.mjs} +2 -2
- package/dist/esm/{chunk-DZSDCUP2.mjs → chunk-UFMIMN7W.mjs} +2 -2
- package/dist/esm/{chunk-3Y46WJUR.mjs → chunk-ULW5LX5H.mjs} +2 -2
- package/dist/esm/chunk-V6M7FGQT.mjs +2 -0
- package/dist/esm/chunk-V6M7FGQT.mjs.map +1 -0
- package/dist/esm/{chunk-U3YYSIIT.mjs → chunk-VBODXPT3.mjs} +2 -2
- package/dist/esm/chunk-VMVSUH2K.mjs +2 -0
- package/dist/esm/{chunk-QRS4DGP3.mjs → chunk-WHSN42R2.mjs} +2 -2
- package/dist/esm/{chunk-QRS4DGP3.mjs.map → chunk-WHSN42R2.mjs.map} +1 -1
- package/dist/esm/{chunk-ZCG6WBLE.mjs → chunk-WJIICWOB.mjs} +2 -2
- package/dist/esm/{chunk-T2AGN5YT.mjs → chunk-WOLLRMXR.mjs} +2 -2
- package/dist/esm/chunk-WSVJNBSJ.mjs +2 -0
- package/dist/esm/{chunk-YMB2XW2O.mjs.map → chunk-WSVJNBSJ.mjs.map} +1 -1
- package/dist/esm/chunk-WXLSJF4A.mjs +2 -0
- package/dist/esm/chunk-WXLSJF4A.mjs.map +1 -0
- package/dist/esm/{chunk-GM56MMNJ.mjs → chunk-XQ7I34AL.mjs} +2 -2
- package/dist/esm/{chunk-RT6LEYHZ.mjs → chunk-Y24BMR2W.mjs} +2 -2
- package/dist/esm/chunk-YE5B2S5L.mjs +2 -0
- package/dist/esm/chunk-YE5B2S5L.mjs.map +1 -0
- package/dist/esm/{chunk-HSJTQLI2.mjs → chunk-YLQJBXUF.mjs} +2 -2
- package/dist/esm/chunk-ZAXWW7VW.mjs +2 -0
- package/dist/esm/chunk-ZAXWW7VW.mjs.map +1 -0
- package/dist/esm/chunk-ZV5P2GSJ.mjs +2 -0
- package/dist/esm/{chunk-SRDIYE3M.mjs.map → chunk-ZV5P2GSJ.mjs.map} +1 -1
- package/dist/esm/cli/index.mjs +1 -1
- package/dist/esm/cli/localNode.mjs +1 -1
- package/dist/esm/cli/move.mjs +1 -1
- package/dist/esm/client/core.mjs +1 -1
- package/dist/esm/client/get.d.mts +8 -1
- package/dist/esm/client/get.mjs +1 -1
- package/dist/esm/client/index.d.mts +2 -2
- package/dist/esm/client/index.mjs +1 -1
- package/dist/esm/client/post.d.mts +9 -1
- package/dist/esm/client/post.mjs +1 -1
- package/dist/esm/client/types.d.mts +5 -1
- package/dist/esm/client/types.mjs +1 -1
- package/dist/esm/core/account/index.mjs +1 -1
- package/dist/esm/core/account/utils/address.mjs +1 -1
- package/dist/esm/core/account/utils/index.mjs +1 -1
- package/dist/esm/core/accountAddress.mjs +1 -1
- package/dist/esm/core/authenticationKey.d.mts +1 -1
- package/dist/esm/core/authenticationKey.mjs +1 -1
- package/dist/esm/core/common.mjs +1 -1
- package/dist/esm/core/crypto/cryptoHasher.d.mts +21 -0
- package/dist/esm/core/crypto/cryptoHasher.mjs +2 -0
- package/dist/esm/core/crypto/cryptoHasher.mjs.map +1 -0
- package/dist/esm/core/crypto/ed25519.d.mts +1 -1
- package/dist/esm/core/crypto/ed25519.mjs +1 -1
- package/dist/esm/core/crypto/ephemeral.d.mts +73 -0
- package/dist/esm/core/crypto/ephemeral.mjs +2 -0
- package/dist/esm/core/crypto/ephemeral.mjs.map +1 -0
- package/dist/esm/core/crypto/index.d.mts +5 -1
- package/dist/esm/core/crypto/index.mjs +1 -1
- package/dist/esm/core/crypto/keyless.d.mts +276 -0
- package/dist/esm/core/crypto/keyless.mjs +2 -0
- package/dist/esm/core/crypto/keyless.mjs.map +1 -0
- package/dist/esm/core/crypto/multiEd25519.d.mts +1 -1
- package/dist/esm/core/crypto/multiEd25519.mjs +1 -1
- package/dist/esm/core/crypto/multiKey.d.mts +1 -1
- package/dist/esm/core/crypto/multiKey.mjs +1 -1
- package/dist/esm/core/crypto/poseidon.d.mts +19 -0
- package/dist/esm/core/crypto/poseidon.mjs +2 -0
- package/dist/esm/core/crypto/poseidon.mjs.map +1 -0
- package/dist/esm/core/crypto/privateKey.d.mts +1 -1
- package/dist/esm/core/crypto/proof.d.mts +21 -0
- package/dist/esm/core/crypto/proof.mjs +2 -0
- package/dist/esm/core/crypto/proof.mjs.map +1 -0
- package/dist/esm/core/crypto/publicKey.d.mts +1 -1
- package/dist/esm/core/crypto/publicKey.mjs +1 -1
- package/dist/esm/core/crypto/secp256k1.d.mts +1 -1
- package/dist/esm/core/crypto/secp256k1.mjs +1 -1
- package/dist/esm/core/crypto/signature.mjs +1 -1
- package/dist/esm/core/crypto/singleKey.d.mts +1 -1
- package/dist/esm/core/crypto/singleKey.mjs +1 -1
- package/dist/esm/core/crypto/utils.mjs +1 -1
- package/dist/esm/core/hex.mjs +1 -1
- package/dist/esm/core/index.d.mts +5 -1
- package/dist/esm/core/index.mjs +1 -1
- package/dist/esm/index.d.mts +16 -8
- package/dist/esm/index.mjs +1 -1
- package/dist/esm/internal/account.d.mts +2 -2
- package/dist/esm/internal/account.mjs +1 -1
- package/dist/esm/internal/ans.d.mts +2 -2
- package/dist/esm/internal/ans.mjs +1 -1
- package/dist/esm/internal/coin.d.mts +1 -1
- package/dist/esm/internal/coin.mjs +1 -1
- package/dist/esm/internal/digitalAsset.d.mts +2 -2
- package/dist/esm/internal/digitalAsset.mjs +1 -1
- package/dist/esm/internal/event.mjs +1 -1
- package/dist/esm/internal/faucet.mjs +1 -1
- package/dist/esm/internal/fungibleAsset.d.mts +2 -2
- package/dist/esm/internal/fungibleAsset.mjs +1 -1
- package/dist/esm/internal/general.mjs +1 -1
- package/dist/esm/internal/keyless.d.mts +78 -0
- package/dist/esm/internal/keyless.mjs +2 -0
- package/dist/esm/internal/keyless.mjs.map +1 -0
- package/dist/esm/internal/staking.mjs +1 -1
- package/dist/esm/internal/table.mjs +1 -1
- package/dist/esm/internal/transaction.mjs +1 -1
- package/dist/esm/internal/transactionSubmission.d.mts +2 -2
- package/dist/esm/internal/transactionSubmission.mjs +1 -1
- package/dist/esm/internal/view.d.mts +1 -1
- package/dist/esm/internal/view.mjs +1 -1
- package/dist/esm/transactions/authenticator/account.d.mts +1 -1
- package/dist/esm/transactions/authenticator/account.mjs +1 -1
- package/dist/esm/transactions/authenticator/index.d.mts +1 -1
- package/dist/esm/transactions/authenticator/index.mjs +1 -1
- package/dist/esm/transactions/authenticator/transaction.d.mts +1 -1
- package/dist/esm/transactions/authenticator/transaction.mjs +1 -1
- package/dist/esm/transactions/index.d.mts +3 -3
- package/dist/esm/transactions/index.mjs +1 -1
- package/dist/esm/transactions/instances/chainId.mjs +1 -1
- package/dist/esm/transactions/instances/identifier.mjs +1 -1
- package/dist/esm/transactions/instances/index.d.mts +1 -1
- package/dist/esm/transactions/instances/index.mjs +1 -1
- package/dist/esm/transactions/instances/moduleId.mjs +1 -1
- package/dist/esm/transactions/instances/multiAgentTransaction.mjs +1 -1
- package/dist/esm/transactions/instances/rawTransaction.mjs +1 -1
- package/dist/esm/transactions/instances/rotationProofChallenge.d.mts +1 -1
- package/dist/esm/transactions/instances/rotationProofChallenge.mjs +1 -1
- package/dist/esm/transactions/instances/signedTransaction.d.mts +1 -1
- package/dist/esm/transactions/instances/signedTransaction.mjs +1 -1
- package/dist/esm/transactions/instances/simpleTransaction.mjs +1 -1
- package/dist/esm/transactions/instances/transactionPayload.mjs +1 -1
- package/dist/esm/transactions/management/accountSequenceNumber.d.mts +2 -2
- package/dist/esm/transactions/management/accountSequenceNumber.mjs +1 -1
- package/dist/esm/transactions/management/index.d.mts +2 -2
- package/dist/esm/transactions/management/index.mjs +1 -1
- package/dist/esm/transactions/management/transactionWorker.d.mts +2 -2
- package/dist/esm/transactions/management/transactionWorker.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/helpers.d.mts +1 -1
- package/dist/esm/transactions/transactionBuilder/helpers.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/index.d.mts +2 -2
- package/dist/esm/transactions/transactionBuilder/index.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/remoteAbi.d.mts +3 -3
- package/dist/esm/transactions/transactionBuilder/remoteAbi.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/signingMessage.d.mts +4 -13
- package/dist/esm/transactions/transactionBuilder/signingMessage.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/transactionBuilder.d.mts +1 -1
- package/dist/esm/transactions/transactionBuilder/transactionBuilder.mjs +1 -1
- package/dist/esm/transactions/typeTag/index.mjs +1 -1
- package/dist/esm/transactions/typeTag/parser.d.mts +3 -1
- package/dist/esm/transactions/typeTag/parser.mjs +1 -1
- package/dist/esm/transactions/types.d.mts +23 -5
- package/dist/esm/types/index.d.mts +21 -5
- package/dist/esm/types/index.mjs +1 -1
- package/dist/esm/types/keyless.d.mts +52 -0
- package/dist/esm/types/keyless.mjs +1 -0
- package/dist/esm/types/keyless.mjs.map +1 -0
- package/dist/esm/utils/apiEndpoints.d.mts +3 -1
- package/dist/esm/utils/apiEndpoints.mjs +1 -1
- package/dist/esm/utils/const.d.mts +3 -1
- package/dist/esm/utils/const.mjs +1 -1
- package/dist/esm/utils/helpers.d.mts +4 -1
- package/dist/esm/utils/helpers.mjs +1 -1
- package/dist/esm/utils/index.d.mts +1 -1
- package/dist/esm/utils/index.mjs +1 -1
- 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 +11 -3
- package/src/account/EphemeralKeyPair.ts +157 -0
- package/src/account/KeylessAccount.ts +404 -0
- package/src/account/MultiKeyAccount.ts +11 -0
- package/src/account/index.ts +2 -0
- package/src/api/aptos.ts +6 -0
- package/src/api/aptosConfig.ts +46 -1
- package/src/api/keyless.ts +59 -0
- package/src/bcs/deserializer.ts +46 -0
- package/src/bcs/serializer.ts +58 -0
- package/src/cli/localNode.ts +11 -1
- package/src/cli/move.ts +11 -1
- package/src/client/core.ts +5 -0
- package/src/client/get.ts +12 -0
- package/src/client/post.ts +18 -0
- package/src/client/types.ts +1 -1
- package/src/core/crypto/cryptoHasher.ts +16 -0
- package/src/core/crypto/ephemeral.ts +138 -0
- package/src/core/crypto/index.ts +2 -0
- package/src/core/crypto/keyless.ts +589 -0
- package/src/core/crypto/poseidon.ts +142 -0
- package/src/core/crypto/proof.ts +16 -0
- package/src/core/crypto/singleKey.ts +11 -0
- package/src/internal/keyless.ts +175 -0
- package/src/internal/transactionSubmission.ts +7 -2
- package/src/transactions/transactionBuilder/remoteAbi.ts +16 -2
- package/src/transactions/transactionBuilder/signingMessage.ts +0 -13
- package/src/transactions/transactionBuilder/transactionBuilder.ts +22 -2
- package/src/transactions/typeTag/parser.ts +98 -52
- package/src/transactions/types.ts +22 -3
- package/src/types/index.ts +24 -2
- package/src/types/keyless.ts +42 -0
- package/src/utils/apiEndpoints.ts +16 -0
- package/src/utils/const.ts +2 -0
- package/src/utils/helpers.ts +25 -0
- package/src/version.ts +1 -1
- package/dist/common/chunk-KSEUZTKY.js +0 -2
- package/dist/common/chunk-KSEUZTKY.js.map +0 -1
- package/dist/esm/chunk-2XK53QFA.mjs +0 -2
- package/dist/esm/chunk-3JPVQHOR.mjs +0 -2
- package/dist/esm/chunk-3JPVQHOR.mjs.map +0 -1
- package/dist/esm/chunk-4NHWV5AI.mjs +0 -2
- package/dist/esm/chunk-53INTTOI.mjs +0 -2
- package/dist/esm/chunk-6IFMQ5AS.mjs +0 -2
- package/dist/esm/chunk-6IFMQ5AS.mjs.map +0 -1
- package/dist/esm/chunk-AF5WNJOP.mjs +0 -2
- package/dist/esm/chunk-B7X6PSE7.mjs +0 -2
- package/dist/esm/chunk-BBKE2QJU.mjs +0 -2
- package/dist/esm/chunk-BBKE2QJU.mjs.map +0 -1
- package/dist/esm/chunk-CEHCDA3G.mjs +0 -2
- package/dist/esm/chunk-CJDEPZ4J.mjs +0 -2
- package/dist/esm/chunk-CYNQRMO5.mjs +0 -2
- package/dist/esm/chunk-CYNQRMO5.mjs.map +0 -1
- package/dist/esm/chunk-F7EMGK4M.mjs +0 -2
- package/dist/esm/chunk-GPEM3JVU.mjs +0 -2
- package/dist/esm/chunk-HYCGMFC2.mjs +0 -2
- package/dist/esm/chunk-HYCGMFC2.mjs.map +0 -1
- package/dist/esm/chunk-IENCDVPF.mjs +0 -2
- package/dist/esm/chunk-IENCDVPF.mjs.map +0 -1
- package/dist/esm/chunk-L54P6EGN.mjs +0 -2
- package/dist/esm/chunk-L54P6EGN.mjs.map +0 -1
- package/dist/esm/chunk-LDQ6JFEF.mjs +0 -2
- package/dist/esm/chunk-LDQ6JFEF.mjs.map +0 -1
- package/dist/esm/chunk-LG7RJQ57.mjs +0 -2
- package/dist/esm/chunk-LQNPI3IR.mjs +0 -2
- package/dist/esm/chunk-LQNPI3IR.mjs.map +0 -1
- package/dist/esm/chunk-MJPUASSD.mjs +0 -2
- package/dist/esm/chunk-MJPUASSD.mjs.map +0 -1
- package/dist/esm/chunk-N3U47Y6Y.mjs +0 -2
- package/dist/esm/chunk-O2K7RZWM.mjs +0 -2
- package/dist/esm/chunk-O2K7RZWM.mjs.map +0 -1
- package/dist/esm/chunk-O4WVPLUX.mjs +0 -2
- package/dist/esm/chunk-OWW6SIDP.mjs +0 -2
- package/dist/esm/chunk-OWW6SIDP.mjs.map +0 -1
- package/dist/esm/chunk-P5TZBE3L.mjs +0 -2
- package/dist/esm/chunk-PF57EOJY.mjs +0 -2
- package/dist/esm/chunk-PZ4SAXY7.mjs +0 -2
- package/dist/esm/chunk-PZ4SAXY7.mjs.map +0 -1
- package/dist/esm/chunk-RFZ5LTGP.mjs +0 -2
- package/dist/esm/chunk-RFZ5LTGP.mjs.map +0 -1
- package/dist/esm/chunk-ROXFCLDT.mjs +0 -2
- package/dist/esm/chunk-RTSWVT2Q.mjs +0 -2
- package/dist/esm/chunk-RTSWVT2Q.mjs.map +0 -1
- package/dist/esm/chunk-S2VSJJRJ.mjs +0 -2
- package/dist/esm/chunk-S2VSJJRJ.mjs.map +0 -1
- package/dist/esm/chunk-SRDIYE3M.mjs +0 -2
- package/dist/esm/chunk-UGPALAPN.mjs +0 -2
- package/dist/esm/chunk-UO3NZ5AH.mjs +0 -1
- package/dist/esm/chunk-UVSRX4SV.mjs +0 -1
- package/dist/esm/chunk-YCC6HN74.mjs +0 -2
- package/dist/esm/chunk-YCC6HN74.mjs.map +0 -1
- package/dist/esm/chunk-YMB2XW2O.mjs +0 -2
- /package/dist/esm/{chunk-UO3NZ5AH.mjs.map → account/EphemeralKeyPair.mjs.map} +0 -0
- /package/dist/esm/{chunk-UVSRX4SV.mjs.map → account/KeylessAccount.mjs.map} +0 -0
- /package/dist/esm/{chunk-R5ST36VJ.mjs.map → chunk-34WI7I3Z.mjs.map} +0 -0
- /package/dist/esm/{chunk-53INTTOI.mjs.map → chunk-3DP4R3FI.mjs.map} +0 -0
- /package/dist/esm/{chunk-FFGY7Z4B.mjs.map → chunk-3J53BCEQ.mjs.map} +0 -0
- /package/dist/esm/{chunk-4GWNWSZP.mjs.map → chunk-3YIUOKWW.mjs.map} +0 -0
- /package/dist/esm/{chunk-EA2DKJPX.mjs.map → chunk-45ESRYGP.mjs.map} +0 -0
- /package/dist/esm/{chunk-PF57EOJY.mjs.map → chunk-4VAYXBD2.mjs.map} +0 -0
- /package/dist/esm/{chunk-JGSOTNJ5.mjs.map → chunk-6F3HFDL3.mjs.map} +0 -0
- /package/dist/esm/{chunk-BN22EYXR.mjs.map → chunk-6MDYCC7P.mjs.map} +0 -0
- /package/dist/esm/{chunk-F7NLNWHN.mjs.map → chunk-7CJAEAQZ.mjs.map} +0 -0
- /package/dist/esm/{chunk-JQIGQMNZ.mjs.map → chunk-7Y6AWDBZ.mjs.map} +0 -0
- /package/dist/esm/{chunk-BCUSI3N6.mjs.map → chunk-AOCNYMMX.mjs.map} +0 -0
- /package/dist/esm/{chunk-4NHWV5AI.mjs.map → chunk-AUAL3H36.mjs.map} +0 -0
- /package/dist/esm/{chunk-I5T6PHDV.mjs.map → chunk-AUV4VAXK.mjs.map} +0 -0
- /package/dist/esm/{chunk-2X7A4HUS.mjs.map → chunk-AVWAYKNS.mjs.map} +0 -0
- /package/dist/esm/{chunk-EZPUVLME.mjs.map → chunk-BNA3SGG6.mjs.map} +0 -0
- /package/dist/esm/{chunk-GPEM3JVU.mjs.map → chunk-CEGCSC3T.mjs.map} +0 -0
- /package/dist/esm/{chunk-F4GDEXZ6.mjs.map → chunk-CZOUSIAD.mjs.map} +0 -0
- /package/dist/esm/{chunk-A4JUQZXI.mjs.map → chunk-DSVNXD5A.mjs.map} +0 -0
- /package/dist/esm/{chunk-AF5WNJOP.mjs.map → chunk-EJ7ODMDA.mjs.map} +0 -0
- /package/dist/esm/{chunk-UR3JTLIT.mjs.map → chunk-EJURLI4L.mjs.map} +0 -0
- /package/dist/esm/{chunk-LG7RJQ57.mjs.map → chunk-FBPNHF54.mjs.map} +0 -0
- /package/dist/esm/{chunk-AHW3SKT7.mjs.map → chunk-GHHIUWPP.mjs.map} +0 -0
- /package/dist/esm/{chunk-G56GPLTB.mjs.map → chunk-GS5Z3HO7.mjs.map} +0 -0
- /package/dist/esm/{chunk-XFSDV3ND.mjs.map → chunk-HOX6Q6ZP.mjs.map} +0 -0
- /package/dist/esm/{chunk-ROXFCLDT.mjs.map → chunk-HQK6MF3G.mjs.map} +0 -0
- /package/dist/esm/{chunk-O4WVPLUX.mjs.map → chunk-ISXBJPLD.mjs.map} +0 -0
- /package/dist/esm/{chunk-JX75UKJX.mjs.map → chunk-IU6REVKX.mjs.map} +0 -0
- /package/dist/esm/{chunk-ERIPXWXJ.mjs.map → chunk-IWKIZLFW.mjs.map} +0 -0
- /package/dist/esm/{chunk-PIVZMT5D.mjs.map → chunk-J534ICWA.mjs.map} +0 -0
- /package/dist/esm/{chunk-UGPALAPN.mjs.map → chunk-J577ODDM.mjs.map} +0 -0
- /package/dist/esm/{chunk-YK63A5T6.mjs.map → chunk-LLRWILVZ.mjs.map} +0 -0
- /package/dist/esm/{chunk-35EWRSDK.mjs.map → chunk-MLQT5I6K.mjs.map} +0 -0
- /package/dist/esm/{chunk-N3U47Y6Y.mjs.map → chunk-MSGHGK52.mjs.map} +0 -0
- /package/dist/esm/{chunk-5EN52MUT.mjs.map → chunk-NGTNMV6Q.mjs.map} +0 -0
- /package/dist/esm/{chunk-P46OPJB4.mjs.map → chunk-NH466YFP.mjs.map} +0 -0
- /package/dist/esm/{chunk-ZM33M6QO.mjs.map → chunk-NUBYALZP.mjs.map} +0 -0
- /package/dist/esm/{chunk-CHWE77CR.mjs.map → chunk-OFC75EWS.mjs.map} +0 -0
- /package/dist/esm/{chunk-H6FEXRTK.mjs.map → chunk-OOYRJQPD.mjs.map} +0 -0
- /package/dist/esm/{chunk-WN3JL7ZT.mjs.map → chunk-PG7KSUMN.mjs.map} +0 -0
- /package/dist/esm/{chunk-KAGLWBIJ.mjs.map → chunk-PGP2XMDE.mjs.map} +0 -0
- /package/dist/esm/{chunk-CYTRYBWN.mjs.map → chunk-QJIMZI32.mjs.map} +0 -0
- /package/dist/esm/{chunk-E56MTU2U.mjs.map → chunk-QLE5JL4X.mjs.map} +0 -0
- /package/dist/esm/{chunk-WNPL4SEJ.mjs.map → chunk-QOOHLRRJ.mjs.map} +0 -0
- /package/dist/esm/{chunk-TM7NDDT3.mjs.map → chunk-R4HLV32L.mjs.map} +0 -0
- /package/dist/esm/{chunk-MCRRHBFQ.mjs.map → chunk-RWYPGTNL.mjs.map} +0 -0
- /package/dist/esm/{chunk-CEHCDA3G.mjs.map → chunk-SCHMTP4N.mjs.map} +0 -0
- /package/dist/esm/{chunk-GP6Z47HM.mjs.map → chunk-SCRIQQV3.mjs.map} +0 -0
- /package/dist/esm/{chunk-NGQR5UQ3.mjs.map → chunk-SNBE5YAC.mjs.map} +0 -0
- /package/dist/esm/{chunk-UW2FPXYA.mjs.map → chunk-THURV6CN.mjs.map} +0 -0
- /package/dist/esm/{chunk-F7EMGK4M.mjs.map → chunk-TJDC5PWD.mjs.map} +0 -0
- /package/dist/esm/{chunk-GUALXVFI.mjs.map → chunk-TU6VKYDC.mjs.map} +0 -0
- /package/dist/esm/{chunk-DZSDCUP2.mjs.map → chunk-UFMIMN7W.mjs.map} +0 -0
- /package/dist/esm/{chunk-3Y46WJUR.mjs.map → chunk-ULW5LX5H.mjs.map} +0 -0
- /package/dist/esm/{chunk-U3YYSIIT.mjs.map → chunk-VBODXPT3.mjs.map} +0 -0
- /package/dist/esm/{chunk-B7X6PSE7.mjs.map → chunk-VMVSUH2K.mjs.map} +0 -0
- /package/dist/esm/{chunk-ZCG6WBLE.mjs.map → chunk-WJIICWOB.mjs.map} +0 -0
- /package/dist/esm/{chunk-T2AGN5YT.mjs.map → chunk-WOLLRMXR.mjs.map} +0 -0
- /package/dist/esm/{chunk-GM56MMNJ.mjs.map → chunk-XQ7I34AL.mjs.map} +0 -0
- /package/dist/esm/{chunk-RT6LEYHZ.mjs.map → chunk-Y24BMR2W.mjs.map} +0 -0
- /package/dist/esm/{chunk-HSJTQLI2.mjs.map → chunk-YLQJBXUF.mjs.map} +0 -0
- /package/dist/esm/{publicKey-B3XRNhHO.d.mts → publicKey-lq5djCIY.d.mts} +0 -0
package/dist/common/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
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 _chunkKSEUZTKYjs = require('./chunk-KSEUZTKY.js');var Xt=255,Yt=65535,Ae=4294967295,ze=18446744073709551615n,St=340282366920938463463374607431768211455n,Zt=115792089237316195423570985008687907853269984665640564039457584007913129639935n;var Jt=class{constructor(e){this.buffer=new ArrayBuffer(e.length),new Uint8Array(this.buffer).set(e,0),this.offset=0}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}deserializeStr(){let e=this.deserializeBytes();return new TextDecoder().decode(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<Ae;){let r=this.deserializeU8();if(e|=BigInt(r&127)<<BigInt(t),!(r&128))break;t+=7}if(e>Ae)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 o=0;o<t;o+=1)r.push(this.deserialize(e));return r}};var _utils = require('@noble/hashes/utils');var F=class extends Error{constructor(e,t){super(e),this.invalidReason=t}};var is=(r=>(r.TOO_SHORT="too_short",r.INVALID_LENGTH="invalid_length",r.INVALID_HEX_CHARS="invalid_hex_chars",r))(is||{}),h= exports.Hex =class n{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 F("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 F("Hex string must be an even number of hex characters.","invalid_length");try{return new n(_utils.hexToBytes.call(void 0, t))}catch(r){throw new F(`Hex string contains invalid hex characters: ${_optionalChain([r, 'optionalAccess', _2 => _2.message])}`,"invalid_hex_chars")}}static fromHexInput(e){return e instanceof Uint8Array?new n(e):n.fromHexString(e)}static isValid(e){try{return n.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,r)=>t===e.data[r])}};var d=class{bcsToBytes(){let e=new X;return this.serialize(e),e.toUint8Array()}bcsToHex(){let e=this.bcsToBytes();return h.fromHexInput(e)}},X= 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,r){this.ensureBufferWillHandleSize(t);let o=new DataView(this.buffer,this.offset);e.apply(o,[0,r,!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){Kn(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(Ae),r=BigInt(e)>>BigInt(32);this.serializeU32(Number(t)),this.serializeU32(Number(r))}serializeU128(e){let t=BigInt(e)&ze,r=BigInt(e)>>BigInt(64);this.serializeU64(t),this.serializeU64(r)}serializeU256(e){let t=BigInt(e)&St,r=BigInt(e)>>BigInt(128);this.serializeU128(t),this.serializeU128(r)}serializeU32AsUleb128(e){let t=e,r=[];for(;t>>>7;)r.push(t&127|128),t>>>=7;r.push(t),this.appendToBuffer(new Uint8Array(r))}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)})}};_chunkKSEUZTKYjs.a.call(void 0, [Ge(0,Xt)],X.prototype,"serializeU8",1),_chunkKSEUZTKYjs.a.call(void 0, [Ge(0,Yt)],X.prototype,"serializeU16",1),_chunkKSEUZTKYjs.a.call(void 0, [Ge(0,Ae)],X.prototype,"serializeU32",1),_chunkKSEUZTKYjs.a.call(void 0, [Ge(BigInt(0),ze)],X.prototype,"serializeU64",1),_chunkKSEUZTKYjs.a.call(void 0, [Ge(BigInt(0),St)],X.prototype,"serializeU128",1),_chunkKSEUZTKYjs.a.call(void 0, [Ge(BigInt(0),Zt)],X.prototype,"serializeU256",1),_chunkKSEUZTKYjs.a.call(void 0, [Ge(0,Ae)],X.prototype,"serializeU32AsUleb128",1);function Kn(n){if(typeof n!="boolean")throw new Error(`${n} is not a boolean value`)}var ss=(n,e,t)=>`${n} is out of range: [${e}, ${t}]`;function xe(n,e,t){let r=BigInt(n);if(r>BigInt(t)||r<BigInt(e))throw new Error(ss(n,e,t))}function Ge(n,e){return(t,r,o)=>{let i=o.value;return o.value=function(a){return xe(a,n,e),i.apply(this,[a])},o}}var De=class n extends d{constructor(e){super(),this.value=h.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 en=class n extends d{constructor(e){super(),this.value=new De(e)}serialize(e){e.serialize(this.value)}serializeForEntryFunction(e){e.serializeU32AsUleb128(this.value.value.length),e.serialize(this)}static deserialize(e,t){let r=De.deserialize(e,t);return new n(r.value)}};var tn=(o=>(o.JSON="application/json",o.BCS="application/x-bcs",o.BCS_SIGNED_TRANSACTION="application/x.aptos.signed_transaction+bcs",o.BCS_VIEW_FUNCTION="application/x.aptos.view_function+bcs",o))(tn||{}),Cr= exports.TypeTagVariants =(l=>(l[l.Bool=0]="Bool",l[l.U8=1]="U8",l[l.U64=2]="U64",l[l.U128=3]="U128",l[l.Address=4]="Address",l[l.Signer=5]="Signer",l[l.Vector=6]="Vector",l[l.Struct=7]="Struct",l[l.U16=8]="U16",l[l.U32=9]="U32",l[l.U256=10]="U256",l[l.Reference=254]="Reference",l[l.Generic=255]="Generic",l))(Cr||{}),xt= exports.ScriptTransactionArgumentVariants =(p=>(p[p.U8=0]="U8",p[p.U64=1]="U64",p[p.U128=2]="U128",p[p.Address=3]="Address",p[p.U8Vector=4]="U8Vector",p[p.Bool=5]="Bool",p[p.U16=6]="U16",p[p.U32=7]="U32",p[p.U256=8]="U256",p))(xt||{}),Pr= exports.TransactionPayloadVariants =(r=>(r[r.Script=0]="Script",r[r.EntryFunction=2]="EntryFunction",r[r.Multisig=3]="Multisig",r))(Pr||{}),Ir= exports.TransactionVariants =(t=>(t[t.MultiAgentTransaction=0]="MultiAgentTransaction",t[t.FeePayerTransaction=1]="FeePayerTransaction",t))(Ir||{}),Er= exports.TransactionAuthenticatorVariant =(i=>(i[i.Ed25519=0]="Ed25519",i[i.MultiEd25519=1]="MultiEd25519",i[i.MultiAgent=2]="MultiAgent",i[i.FeePayer=3]="FeePayer",i[i.SingleSender=4]="SingleSender",i))(Er||{}),Ur= exports.AccountAuthenticatorVariant =(o=>(o[o.Ed25519=0]="Ed25519",o[o.MultiEd25519=1]="MultiEd25519",o[o.SingleKey=2]="SingleKey",o[o.MultiKey=3]="MultiKey",o))(Ur||{}),Rr= exports.AnyPublicKeyVariant =(t=>(t[t.Ed25519=0]="Ed25519",t[t.Secp256k1=1]="Secp256k1",t))(Rr||{}),zr= exports.AnySignatureVariant =(t=>(t[t.Ed25519=0]="Ed25519",t[t.Secp256k1=1]="Secp256k1",t))(zr||{}),qn= exports.TransactionResponseType =(s=>(s.Pending="pending_transaction",s.User="user_transaction",s.Genesis="genesis_transaction",s.BlockMetadata="block_metadata_transaction",s.StateCheckpoint="state_checkpoint_transaction",s.Validator="validator_transaction",s))(qn||{});function Oa(n){return n.type==="pending_transaction"}function Ma(n){return n.type==="user_transaction"}function Fa(n){return n.type==="genesis_transaction"}function Ka(n){return n.type==="block_metadata_transaction"}function qa(n){return n.type==="state_checkpoint_transaction"}function $a(n){return n.type==="validator_transaction"}function Va(n){return"signature"in n&&n.signature==="ed25519_signature"}function La(n){return"signature"in n&&n.signature==="secp256k1_ecdsa_signature"}function Ha(n){return n.type==="multi_agent_signature"}function Qa(n){return n.type==="fee_payer_signature"}function Wa(n){return n.type==="multi_ed25519_signature"}var as=(r=>(r.PRIVATE="private",r.PUBLIC="public",r.FRIEND="friend",r))(as||{}),Gr= exports.MoveAbility =(o=>(o.STORE="store",o.DROP="drop",o.KEY="key",o.COPY="copy",o))(Gr||{}),cs= exports.RoleType =(t=>(t.VALIDATOR="validator",t.FULL_NODE="full_node",t))(cs||{}),ve= exports.SigningScheme =(o=>(o[o.Ed25519=0]="Ed25519",o[o.MultiEd25519=1]="MultiEd25519",o[o.SingleKey=2]="SingleKey",o[o.MultiKey=3]="MultiKey",o))(ve||{}),$n= exports.SigningSchemeInput =(t=>(t[t.Ed25519=0]="Ed25519",t[t.Secp256k1Ecdsa=2]="Secp256k1Ecdsa",t))($n||{}),us= exports.DeriveScheme =(i=>(i[i.DeriveAuid=251]="DeriveAuid",i[i.DeriveObjectAddressFromObject=252]="DeriveObjectAddressFromObject",i[i.DeriveObjectAddressFromGuid=253]="DeriveObjectAddressFromGuid",i[i.DeriveObjectAddressFromSeed=254]="DeriveObjectAddressFromSeed",i[i.DeriveResourceAccountAddress=255]="DeriveResourceAccountAddress",i))(us||{});var I=class n extends d{constructor(e){super(),Kn(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)}static deserialize(e){return new n(e.deserializeBool())}},N= exports.U8 =class n extends d{constructor(e){super(),xe(e,0,Xt),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())}},re= exports.U16 =class n extends d{constructor(e){super(),xe(e,0,Yt),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())}},oe= exports.U32 =class n extends d{constructor(e){super(),xe(e,0,Ae),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())}},D= exports.U64 =class n extends d{constructor(e){super(),xe(e,BigInt(0),ze),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())}},ie= exports.U128 =class n extends d{constructor(e){super(),xe(e,BigInt(0),St),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())}},se= exports.U256 =class n extends d{constructor(e){super(),xe(e,BigInt(0),Zt),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 T=class n extends d{constructor(e){super(),this.values=e}serializeForEntryFunction(e){let t=this.bcsToBytes();e.serializeBytes(t)}serializeForScriptFunction(e){if(!(this.values[0]instanceof N)&&this.values[0]!==void 0)throw new Error("Script function arguments only accept u8 vectors");e.serializeU32AsUleb128(4),e.serialize(this)}static U8(e){let t;if(Array.isArray(e)&&typeof e[0]=="number")t=e;else if(typeof e=="string"){let r=h.fromHexInput(e);t=Array.from(r.toUint8Array())}else if(e instanceof Uint8Array)t=Array.from(e);else throw new Error("Invalid input type");return new n(t.map(r=>new N(r)))}static U16(e){return new n(e.map(t=>new re(t)))}static U32(e){return new n(e.map(t=>new oe(t)))}static U64(e){return new n(e.map(t=>new D(t)))}static U128(e){return new n(e.map(t=>new ie(t)))}static U256(e){return new n(e.map(t=>new se(t)))}static Bool(e){return new n(e.map(t=>new I(t)))}static MoveString(e){return new n(e.map(t=>new w(t)))}serialize(e){e.serializeVector(this.values)}static deserialize(e,t){let r=e.deserializeUleb128AsU32(),o=new Array;for(let i=0;i<r;i+=1)o.push(t.deserialize(e));return new n(o)}},w= exports.MoveString =class n extends d{constructor(e){super(),this.value=e}serialize(e){e.serializeStr(this.value)}serializeForEntryFunction(e){let t=this.bcsToBytes();e.serializeBytes(t)}serializeForScriptFunction(e){let t=this.bcsToBytes().slice(1);T.U8(t).serializeForScriptFunction(e)}static deserialize(e){return new n(e.deserializeStr())}},Ce= exports.MoveOption =class n extends d{constructor(e){super(),typeof e<"u"&&e!==null?this.vec=new T([e]):this.vec=new T([]),[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 N(e):void 0)}static U16(e){return new n(e!=null?new re(e):void 0)}static U32(e){return new n(e!=null?new oe(e):void 0)}static U64(e){return new n(e!=null?new D(e):void 0)}static U128(e){return new n(e!=null?new ie(e):void 0)}static U256(e){return new n(e!=null?new se(e):void 0)}static Bool(e){return new n(e!=null?new I(e):void 0)}static MoveString(e){return new n(e!=null?new w(e):void 0)}static deserialize(e,t){let r=T.deserialize(e,t);return new n(r.values[0])}};var _ed25519 = require('@noble/curves/ed25519');var _sha3 = require('@noble/hashes/sha3');var ds=(a=>(a.INCORRECT_NUMBER_OF_BYTES="incorrect_number_of_bytes",a.INVALID_HEX_CHARS="invalid_hex_chars",a.TOO_SHORT="too_short",a.TOO_LONG="too_long",a.LEADING_ZERO_X_REQUIRED="leading_zero_x_required",a.LONG_FORM_REQUIRED_UNLESS_SPECIAL="long_form_required_unless_special",a.INVALID_PADDING_ZEROES="INVALID_PADDING_ZEROES",a))(ds||{}),_=class _ extends d{constructor(e){if(super(),e.length!==_.LENGTH)throw new F("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(_.LENGTH);return new _(t)}static fromStringStrict(e){if(!e.startsWith("0x"))throw new F("Hex string must start with a leading 0x.","leading_zero_x_required");let t=_.fromString(e);if(e.length!==_.LONG_STRING_LENGTH+2)if(t.isSpecial()){if(e.length!==3)throw new F(`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 F(`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){let t=e;if(e.startsWith("0x")&&(t=e.slice(2)),t.length===0)throw new F("Hex string is too short, must be 1 to 64 chars long, excluding the leading 0x.","too_short");if(t.length>64)throw new F("Hex string is too long, must be 1 to 64 chars long, excluding the leading 0x.","too_long");let r;try{r=_utils.hexToBytes.call(void 0, t.padStart(64,"0"))}catch(o){throw new F(`Hex characters are invalid: ${_optionalChain([o, 'optionalAccess', _5 => _5.message])}`,"invalid_hex_chars")}return new _(r)}static from(e){return e instanceof _?e:e instanceof Uint8Array?new _(e):_.fromString(e)}static fromStrict(e){return e instanceof _?e:e instanceof Uint8Array?new _(e):_.fromStringStrict(e)}static isValid(e){try{return e.strict?_.fromStrict(e.input):_.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,r)=>t===e.data[r])}};_.LENGTH=32,_.LONG_STRING_LENGTH=64,_.ZERO=_.from("0x0"),_.ONE=_.from("0x1"),_.TWO=_.from("0x2"),_.THREE=_.from("0x3"),_.FOUR=_.from("0x4");var u=_;var Pe=class Pe extends d{constructor(e){super();let{data:t}=e,r=h.fromHexInput(t);if(r.toUint8Array().length!==Pe.LENGTH)throw new Error(`Authentication Key length should be ${Pe.LENGTH}`);this.data=r}serialize(e){e.serializeFixedBytes(this.data.toUint8Array())}static deserialize(e){let t=e.deserializeFixedBytes(Pe.LENGTH);return new Pe({data:t})}toString(){return this.data.toString()}toUint8Array(){return this.data.toUint8Array()}static fromSchemeAndBytes(e){let{scheme:t,input:r}=e,o=h.fromHexInput(r).toUint8Array(),i=new Uint8Array([...o,t]),s=_sha3.sha3_256.create();s.update(i);let a=s.digest();return new Pe({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())}};Pe.LENGTH=32;var K=Pe;var _hmac = require('@noble/hashes/hmac');var _sha512 = require('@noble/hashes/sha512');var _bip39 = require('@scure/bip39'); var Nr = _interopRequireWildcard(_bip39);var ys=/^m\/44'\/637'\/[0-9]+'\/[0-9]+'\/[0-9]+'?$/,As= exports.APTOS_BIP44_REGEX =/^m\/44'\/637'\/[0-9]+'\/[0-9]+\/[0-9]+$/,fs= exports.KeyType =(e=>(e.ED25519="ed25519 seed",e))(fs||{}),Br= exports.HARDENED_OFFSET =2147483648;function kr(n){return As.test(n)}function Or(n){return ys.test(n)}var Vn=(n,e)=>{let t=_hmac.hmac.create(_sha512.sha512,n).update(e).digest();return{key:t.slice(0,32),chainCode:t.slice(32)}},Mr= exports.CKDPriv =({key:n,chainCode:e},t)=>{let r=new ArrayBuffer(4);new DataView(r).setUint32(0,t);let o=new Uint8Array(r),i=new Uint8Array([0]),s=new Uint8Array([...i,...n,...o]);return Vn(e,s)},hs=n=>n.replace("'",""),Fr= exports.splitPath =n=>n.split("/").slice(1).map(hs),nn= exports.mnemonicToSeed =n=>{let e=n.trim().split(/\s+/).map(t=>t.toLowerCase()).join(" ");return Nr.mnemonicToSeedSync(e)};var vt=class extends d{toString(){let e=this.toUint8Array();return h.fromHexInput(e).toString()}},pe= exports.AccountPublicKey =class extends vt{};var Y=class extends d{toString(){let e=this.toUint8Array();return h.fromHexInput(e).toString()}};var Xe=n=>typeof n=="string"?h.isValid(n).valid?n:Buffer.from(n,"utf8"):n;var Kr=[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],Ne=class Ne extends pe{constructor(e){super();let t=h.fromHexInput(e);if(t.toUint8Array().length!==Ne.LENGTH)throw new Error(`PublicKey length should be ${Ne.LENGTH}`);this.key=t}verifySignature(e){let{message:t,signature:r}=e;if(!(r instanceof U))return!1;let o=Xe(t),i=h.fromHexInput(o).toUint8Array(),s=r.toUint8Array(),a=this.key.toUint8Array();return r.isCanonicalSignature()?_ed25519.ed25519.verify(s,i,a):!1}authKey(){return K.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 Ne(t)}static isPublicKey(e){return e instanceof Ne}};Ne.LENGTH=32;var E=Ne,Z=class Z extends d{constructor(e){super();let t=h.fromHexInput(e);if(t.toUint8Array().length!==Z.LENGTH)throw new Error(`PrivateKey length should be ${Z.LENGTH}`);this.signingKey=t}static generate(){let e=_ed25519.ed25519.utils.randomPrivateKey();return new Z(e)}static fromDerivationPath(e,t){if(!Or(e))throw new Error(`Invalid derivation path ${e}`);return Z.fromDerivationPathInner(e,nn(t))}static fromDerivationPathInner(e,t,r=Br){let{key:o,chainCode:i}=Vn(Z.SLIP_0010_SEED,t),s=Fr(e).map(c=>parseInt(c,10)),{key:a}=s.reduce((c,p)=>Mr(c,p+r),{key:o,chainCode:i});return new Z(a)}publicKey(){let e=_ed25519.ed25519.getPublicKey(this.signingKey.toUint8Array());return new E(e)}sign(e){let t=Xe(e),r=h.fromHexInput(t).toUint8Array(),o=_ed25519.ed25519.sign(r,this.signingKey.toUint8Array());return new U(o)}toUint8Array(){return this.signingKey.toUint8Array()}toString(){return this.signingKey.toString()}serialize(e){e.serializeBytes(this.toUint8Array())}static deserialize(e){let t=e.deserializeBytes();return new Z(t)}static isPrivateKey(e){return e instanceof Z}};Z.LENGTH=32,Z.SLIP_0010_SEED="ed25519 seed";var J=Z,Ye=class Ye extends Y{constructor(e){super();let t=h.fromHexInput(e);if(t.toUint8Array().length!==Ye.LENGTH)throw new Error(`Signature length should be ${Ye.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 Ye(t)}isCanonicalSignature(){let e=this.toUint8Array().slice(32);for(let t=e.length-1;t>=0;t-=1){if(e[t]<Kr[t])return!0;if(e[t]>Kr[t])return!1}return!1}};Ye.LENGTH=64;var U=Ye;var ee=class ee extends pe{constructor(e){super();let{publicKeys:t,threshold:r}=e;if(t.length>ee.MAX_KEYS||t.length<ee.MIN_KEYS)throw new Error(`Must have between ${ee.MIN_KEYS} and ${ee.MAX_KEYS} public keys, inclusive`);if(r<ee.MIN_THRESHOLD||r>t.length)throw new Error(`Threshold must be between ${ee.MIN_THRESHOLD} and ${t.length}, inclusive`);this.publicKeys=t,this.threshold=r}verifySignature(e){let{message:t,signature:r}=e;if(!(r instanceof Be))return!1;let o=[];for(let i=0;i<4;i+=1)for(let s=0;s<8;s+=1)if((r.bitmap[i]&1<<7-s)!==0){let c=i*8+s;o.push(c)}if(o.length!==r.signatures.length)throw new Error("Bitmap and signatures length mismatch");if(o.length<this.threshold)throw new Error("Not enough signatures");for(let i=0;i<o.length;i+=1)if(!this.publicKeys[o[i]].verifySignature({message:t,signature:r.signatures[i]}))return!1;return!0}authKey(){return K.fromSchemeAndBytes({scheme:1,input:this.toUint8Array()})}toUint8Array(){let e=new Uint8Array(this.publicKeys.length*E.LENGTH+1);return this.publicKeys.forEach((t,r)=>{e.set(t.toUint8Array(),r*E.LENGTH)}),e[this.publicKeys.length*E.LENGTH]=this.threshold,e}serialize(e){e.serializeBytes(this.toUint8Array())}static deserialize(e){let t=e.deserializeBytes(),r=t[t.length-1],o=[];for(let i=0;i<t.length-1;i+=E.LENGTH){let s=i;o.push(new E(t.subarray(s,s+E.LENGTH)))}return new ee({publicKeys:o,threshold:r})}};ee.MAX_KEYS=32,ee.MIN_KEYS=2,ee.MIN_THRESHOLD=1;var Ze=ee,V=class V extends Y{constructor(e){super();let{signatures:t,bitmap:r}=e;if(t.length>V.MAX_SIGNATURES_SUPPORTED)throw new Error(`The number of signatures cannot be greater than ${V.MAX_SIGNATURES_SUPPORTED}`);if(this.signatures=t,!(r instanceof Uint8Array))this.bitmap=V.createBitmap({bits:r});else{if(r.length!==V.BITMAP_LEN)throw new Error(`"bitmap" length should be ${V.BITMAP_LEN}`);this.bitmap=r}}toUint8Array(){let e=new Uint8Array(this.signatures.length*U.LENGTH+V.BITMAP_LEN);return this.signatures.forEach((t,r)=>{e.set(t.toUint8Array(),r*U.LENGTH)}),e.set(this.bitmap,this.signatures.length*U.LENGTH),e}serialize(e){e.serializeBytes(this.toUint8Array())}static deserialize(e){let t=e.deserializeBytes(),r=t.subarray(t.length-4),o=[];for(let i=0;i<t.length-r.length;i+=U.LENGTH){let s=i;o.push(new U(t.subarray(s,s+U.LENGTH)))}return new V({signatures:o,bitmap:r})}static createBitmap(e){let{bits:t}=e,r=128,o=new Uint8Array([0,0,0,0]),i=new Set;return t.forEach((s,a)=>{if(s>=V.MAX_SIGNATURES_SUPPORTED)throw new Error(`Cannot have a signature larger than ${V.MAX_SIGNATURES_SUPPORTED-1}.`);if(i.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.");i.add(s);let c=Math.floor(s/8),p=o[c];p|=r>>s%8,o[c]=p}),o}};V.MAX_SIGNATURES_SUPPORTED=32,V.BITMAP_LEN=4;var Be=V;var _secp256k1 = require('@noble/curves/secp256k1');var _bip32 = require('@scure/bip32');var ke=class ke extends vt{constructor(e){super();let t=h.fromHexInput(e);if(t.toUint8Array().length!==ke.LENGTH)throw new Error(`PublicKey length should be ${ke.LENGTH}`);this.key=t}verifySignature(e){let{message:t,signature:r}=e;if(!(r instanceof he))return!1;let o=Xe(t),i=h.fromHexInput(o).toUint8Array(),s=_sha3.sha3_256.call(void 0, i),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())}static deserialize(e){let t=e.deserializeBytes();return new ke(t)}static isPublicKey(e){return e instanceof ke}};ke.LENGTH=65;var fe=ke,de=class de extends d{constructor(e){super();let t=h.fromHexInput(e);if(t.toUint8Array().length!==de.LENGTH)throw new Error(`PrivateKey length should be ${de.LENGTH}`);this.key=t}static generate(){let e=_secp256k1.secp256k1.utils.randomPrivateKey();return new de(e)}static fromDerivationPath(e,t){if(!kr(e))throw new Error(`Invalid derivation path ${e}`);return de.fromDerivationPathInner(e,nn(t))}static fromDerivationPathInner(e,t){let{privateKey:r}=_bip32.HDKey.fromMasterSeed(t).derive(e);if(r===null)throw new Error("Invalid key");return new de(r)}sign(e){let t=Xe(e),r=h.fromHexInput(t),o=_sha3.sha3_256.call(void 0, r.toUint8Array()),i=_secp256k1.secp256k1.sign(o,this.key.toUint8Array(),{lowS:!0});return new he(i.toCompactRawBytes())}publicKey(){let e=_secp256k1.secp256k1.getPublicKey(this.key.toUint8Array(),!1);return new fe(e)}toUint8Array(){return this.key.toUint8Array()}toString(){return this.key.toString()}serialize(e){e.serializeBytes(this.toUint8Array())}static deserialize(e){let t=e.deserializeBytes();return new de(t)}static isPrivateKey(e){return e instanceof de}};de.LENGTH=32;var Oe=de,Je=class Je extends Y{constructor(e){super();let t=h.fromHexInput(e);if(t.toUint8Array().length!==Je.LENGTH)throw new Error(`Signature length should be ${Je.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 Je(t)}};Je.LENGTH=64;var he=Je;var B=class n extends pe{constructor(e){if(super(),this.publicKey=e,e instanceof E)this.variant=0;else if(e instanceof fe)this.variant=1;else throw new Error("Unsupported public key type")}verifySignature(e){let{message:t,signature:r}=e;return r instanceof q?this.publicKey.verifySignature({message:t,signature:r.signature}):!1}authKey(){return K.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=E.deserialize(e);break;case 1:r=fe.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 E}isSecp256k1PublicKey(){return this.publicKey instanceof fe}},q= exports.AnySignature =class n extends Y{constructor(e){if(super(),this.signature=e,e instanceof U)this.variant=0;else if(e instanceof he)this.variant=1;else throw new Error("Unsupported signature type")}toUint8Array(){return 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=U.deserialize(e);break;case 1:r=he.deserialize(e);break;default:throw new Error(`Unknown variant index for AnySignature: ${t}`)}return new n(r)}};function bs(n){let e=n;return e-=e>>1&1431655765,e=(e&858993459)+(e>>2&858993459),(e+(e>>4)&252645135)*16843009>>24}var et=class n extends pe{constructor(e){super();let{publicKeys:t,signaturesRequired:r}=e;if(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(o=>o instanceof B?o:new B(o)),this.signaturesRequired=r}verifySignature(e){throw new Error("not implemented")}authKey(){return K.fromSchemeAndBytes({scheme:3,input:this.toUint8Array()})}toUint8Array(){return this.bcsToBytes()}serialize(e){e.serializeVector(this.publicKeys),e.serializeU8(this.signaturesRequired)}static deserialize(e){let t=e.deserializeVector(B),r=e.deserializeU8();return new n({publicKeys:t,signaturesRequired:r})}createBitmap(e){let{bits:t}=e,r=128,o=new Uint8Array([0,0,0,0]),i=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(i.has(s))throw new Error(`Duplicate bit ${s} detected.`);i.add(s);let c=Math.floor(s/8),p=o[c];p|=r>>s%8,o[c]=p}),o}getIndex(e){let t=e instanceof B?e:new B(e),r=this.publicKeys.findIndex(o=>o.toString()===t.toString());if(r!==-1)return r;throw new Error("Public key not found in MultiKey")}},L=class L extends Y{constructor(e){super();let{signatures:t,bitmap:r}=e;if(t.length>L.MAX_SIGNATURES_SUPPORTED)throw new Error(`The number of signatures cannot be greater than ${L.MAX_SIGNATURES_SUPPORTED}`);if(this.signatures=t.map(i=>i instanceof q?i:new q(i)),!(r instanceof Uint8Array))this.bitmap=L.createBitmap({bits:r});else{if(r.length!==L.BITMAP_LEN)throw new Error(`"bitmap" length should be ${L.BITMAP_LEN}`);this.bitmap=r}let o=this.bitmap.reduce((i,s)=>i+bs(s),0);if(o!==this.signatures.length)throw new Error(`Expecting ${o} signatures from the bitmap, but got ${this.signatures.length}`)}static createBitmap(e){let{bits:t}=e,r=128,o=new Uint8Array([0,0,0,0]),i=new Set;return t.forEach(s=>{if(s>=L.MAX_SIGNATURES_SUPPORTED)throw new Error(`Cannot have a signature larger than ${L.MAX_SIGNATURES_SUPPORTED-1}.`);if(i.has(s))throw new Error("Duplicate bits detected.");i.add(s);let a=Math.floor(s/8),c=o[a];c|=r>>s%8,o[a]=c}),o}toUint8Array(){return this.bcsToBytes()}serialize(e){e.serializeVector(this.signatures),e.serializeBytes(this.bitmap)}static deserialize(e){let t=e.deserializeVector(q),r=e.deserializeBytes();return new L({signatures:t,bitmap:r})}};L.BITMAP_LEN=4,L.MAX_SIGNATURES_SUPPORTED=L.BITMAP_LEN*8;var Me=L;var O=class extends d{static deserialize(e){let t=e.deserializeUleb128AsU32();switch(t){case 0:return ae.load(e);case 1:return sn.load(e);case 2:return ce.load(e);case 3:return Fe.load(e);default:throw new Error(`Unknown variant index for AccountAuthenticator: ${t}`)}}isEd25519(){return this instanceof ae}isMultiEd25519(){return this instanceof sn}isSingleKey(){return this instanceof ce}isMultiKey(){return this instanceof Fe}},ae= exports.AccountAuthenticatorEd25519 =class n extends O{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=E.deserialize(e),r=U.deserialize(e);return new n(t,r)}},sn= exports.AccountAuthenticatorMultiEd25519 =class n extends O{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=Ze.deserialize(e),r=Be.deserialize(e);return new n(t,r)}},ce= exports.AccountAuthenticatorSingleKey =class n extends O{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=B.deserialize(e),r=q.deserialize(e);return new n(t,r)}},Fe= exports.AccountAuthenticatorMultiKey =class n extends O{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=et.deserialize(e),r=Me.deserialize(e);return new n(t,r)}};var Ct=(r=>(r.FULLNODE="Fullnode",r.INDEXER="Indexer",r.FAUCET="Faucet",r))(Ct||{}),$r= exports.DEFAULT_MAX_GAS_AMOUNT =2e5,Vr= exports.DEFAULT_TXN_EXP_SEC_FROM_NOW =20,an= exports.DEFAULT_TXN_TIMEOUT_SEC =20,cn= exports.APTOS_COIN ="0x1::aptos_coin::AptosCoin",Lr= exports.RAW_TRANSACTION_SALT ="APTOS::RawTransaction",Ln= exports.RAW_TRANSACTION_WITH_DATA_SALT ="APTOS::RawTransactionWithData",Ke= exports.ProcessorType =(a=>(a.ACCOUNT_TRANSACTION_PROCESSOR="account_transactions_processor",a.DEFAULT="default_processor",a.EVENTS_PROCESSOR="events_processor",a.FUNGIBLE_ASSET_PROCESSOR="fungible_asset_processor",a.STAKE_PROCESSOR="stake_processor",a.TOKEN_V2_PROCESSOR="token_v2_processor",a.USER_TRANSACTION_PROCESSOR="user_transaction_processor",a))(Ke||{});var tt=class n extends d{constructor(e){super(),this.chainId=e}serialize(e){e.serializeU8(this.chainId)}static deserialize(e){let t=e.deserializeU8();return new n(t)}};var P=class n extends d{constructor(e){super(),this.identifier=e}serialize(e){e.serializeStr(this.identifier)}static deserialize(e){let t=e.deserializeStr();return new n(t)}};var Pt=class n extends d{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(u.fromString(t[0]),new P(t[1]))}serialize(e){this.address.serialize(e),this.name.serialize(e)}static deserialize(e){let t=u.deserialize(e),r=P.deserialize(e);return new n(t,r)}};var R=class extends d{static deserialize(e){let t=e.deserializeUleb128AsU32();switch(t){case 0:return k.load(e);case 1:return le.load(e);case 2:return $.load(e);case 3:return ot.load(e);case 4:return H.load(e);case 5:return qe.load(e);case 6:return x.load(e);case 7:return g.load(e);case 8:return nt.load(e);case 9:return rt.load(e);case 10:return it.load(e);case 255:return z.load(e);default:throw new Error(`Unknown variant index for TypeTag: ${t}`)}}isBool(){return this instanceof k}isAddress(){return this instanceof H}isGeneric(){return this instanceof z}isSigner(){return this instanceof qe}isVector(){return this instanceof x}isStruct(){return this instanceof g}isU8(){return this instanceof le}isU16(){return this instanceof nt}isU32(){return this instanceof rt}isU64(){return this instanceof $}isU128(){return this instanceof ot}isU256(){return this instanceof it}},k= exports.TypeTagBool =class n extends R{toString(){return"bool"}serialize(e){e.serializeU32AsUleb128(0)}static load(e){return new n}},le= exports.TypeTagU8 =class n extends R{toString(){return"u8"}serialize(e){e.serializeU32AsUleb128(1)}static load(e){return new n}},nt= exports.TypeTagU16 =class n extends R{toString(){return"u16"}serialize(e){e.serializeU32AsUleb128(8)}static load(e){return new n}},rt= exports.TypeTagU32 =class n extends R{toString(){return"u32"}serialize(e){e.serializeU32AsUleb128(9)}static load(e){return new n}},$= exports.TypeTagU64 =class n extends R{toString(){return"u64"}serialize(e){e.serializeU32AsUleb128(2)}static load(e){return new n}},ot= exports.TypeTagU128 =class n extends R{toString(){return"u128"}serialize(e){e.serializeU32AsUleb128(3)}static load(e){return new n}},it= exports.TypeTagU256 =class n extends R{toString(){return"u256"}serialize(e){e.serializeU32AsUleb128(10)}static load(e){return new n}},H= exports.TypeTagAddress =class n extends R{toString(){return"address"}serialize(e){e.serializeU32AsUleb128(4)}static load(e){return new n}},qe= exports.TypeTagSigner =class n extends R{toString(){return"signer"}serialize(e){e.serializeU32AsUleb128(5)}static load(e){return new n}},un= exports.TypeTagReference =class n extends R{constructor(t){super();this.value=t}toString(){return`&${this.value.toString()}`}serialize(t){t.serializeU32AsUleb128(254)}static load(t){let r=R.deserialize(t);return new n(r)}},z= exports.TypeTagGeneric =class n extends R{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)}},x= exports.TypeTagVector =class n extends R{constructor(t){super();this.value=t}toString(){return`vector<${this.value.toString()}>`}static u8(){return new n(new le)}serialize(t){t.serializeU32AsUleb128(6),this.value.serialize(t)}static load(t){let r=R.deserialize(t);return new n(r)}},g= exports.TypeTagStruct =class n extends R{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=Te.deserialize(t);return new n(r)}isTypeTag(t,r,o){return this.value.moduleName.identifier===r&&this.value.name.identifier===o&&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")}},Te= exports.StructTag =class n extends d{constructor(e,t,r,o){super(),this.address=e,this.moduleName=t,this.name=r,this.typeArgs=o}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),r=P.deserialize(e),o=P.deserialize(e),i=e.deserializeVector(R);return new n(t,r,o,i)}};function Up(){return new Te(u.ONE,new P("aptos_coin"),new P("AptosCoin"),[])}function S(){return new Te(u.ONE,new P("string"),new P("String"),[])}function Rp(n){return new Te(u.ONE,new P("option"),new P("Option"),[n])}function Q(n){return new Te(u.ONE,new P("object"),new P("Object"),[n])}function ws(n){let e=n.deserializeUleb128AsU32();switch(e){case 0:return N.deserialize(n);case 1:return D.deserialize(n);case 2:return ie.deserialize(n);case 3:return u.deserialize(n);case 4:return T.deserialize(n,N);case 5:return I.deserialize(n);case 6:return re.deserialize(n);case 7:return oe.deserialize(n);case 8:return se.deserialize(n);default:throw new Error(`Unknown variant index for ScriptTransactionArgument: ${e}`)}}var $e=class extends d{static deserialize(e){let t=e.deserializeUleb128AsU32();switch(t){case 0:return It.load(e);case 2:return Et.load(e);case 3:return Ut.load(e);default:throw new Error(`Unknown variant index for TransactionPayload: ${t}`)}}},It= exports.TransactionPayloadScript =class n extends $e{constructor(e){super(),this.script=e}serialize(e){e.serializeU32AsUleb128(0),this.script.serialize(e)}static load(e){let t=Rt.deserialize(e);return new n(t)}},Et= exports.TransactionPayloadEntryFunction =class n extends $e{constructor(e){super(),this.entryFunction=e}serialize(e){e.serializeU32AsUleb128(2),this.entryFunction.serialize(e)}static load(e){let t=Ve.deserialize(e);return new n(t)}},Ut= exports.TransactionPayloadMultiSig =class n extends $e{constructor(e){super(),this.multiSig=e}serialize(e){e.serializeU32AsUleb128(3),this.multiSig.serialize(e)}static load(e){let t=zt.deserialize(e);return new n(t)}},Ve= exports.EntryFunction =class n{constructor(e,t,r,o){this.module_name=e,this.function_name=t,this.type_args=r,this.args=o}static build(e,t,r,o){return new n(Pt.fromStr(e),new P(t),r,o)}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=Pt.deserialize(e),r=P.deserialize(e),o=e.deserializeVector(R),i=e.deserializeUleb128AsU32(),s=new Array;for(let a=0;a<i;a+=1){let c=e.deserializeUleb128AsU32(),p=en.deserialize(e,c);s.push(p)}return new n(t,r,o,s)}},Rt= 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(R),o=e.deserializeUleb128AsU32(),i=new Array;for(let s=0;s<o;s+=1){let a=ws(e);i.push(a)}return new n(t,r,i)}},zt= 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=u.deserialize(e),r=e.deserializeBool(),o;return r&&(o=Gt.deserialize(e)),new n(t,o)}},Gt= exports.MultiSigTransactionPayload =class n extends d{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(Ve.deserialize(e))}};var te=class n extends d{constructor(e,t,r,o,i,s,a){super(),this.sender=e,this.sequence_number=t,this.payload=r,this.max_gas_amount=o,this.gas_unit_price=i,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),r=e.deserializeU64(),o=$e.deserialize(e),i=e.deserializeU64(),s=e.deserializeU64(),a=e.deserializeU64(),c=tt.deserialize(e);return new n(t,r,o,i,s,a,c)}},pn= exports.RawTransactionWithData =class extends d{static deserialize(e){let t=e.deserializeUleb128AsU32();switch(t){case 0:return Le.load(e);case 1:return He.load(e);default:throw new Error(`Unknown variant index for RawTransactionWithData: ${t}`)}}},Le= exports.MultiAgentRawTransaction =class n extends pn{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=te.deserialize(e),r=e.deserializeVector(u);return new n(t,r)}},He= exports.FeePayerRawTransaction =class n extends pn{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=te.deserialize(e),r=e.deserializeVector(u),o=u.deserialize(e);return new n(t,r,o)}};var dn=class extends d{constructor(t){super();this.accountAddress=u.ONE;this.moduleName=new w("account");this.structName=new w("RotationProofChallenge");this.sequenceNumber=new D(t.sequenceNumber),this.originator=t.originator,this.currentAuthKey=t.currentAuthKey,this.newPublicKey=T.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 be=class extends d{static deserialize(e){let t=e.deserializeUleb128AsU32();switch(t){case 0:return st.load(e);case 1:return Hn.load(e);case 2:return at.load(e);case 3:return ct.load(e);case 4:return ut.load(e);default:throw new Error(`Unknown variant index for TransactionAuthenticator: ${t}`)}}},st= exports.TransactionAuthenticatorEd25519 =class n extends be{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=E.deserialize(e),r=U.deserialize(e);return new n(t,r)}},Hn= exports.TransactionAuthenticatorMultiEd25519 =class n extends be{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=Ze.deserialize(e),r=Be.deserialize(e);return new n(t,r)}},at= exports.TransactionAuthenticatorMultiAgent =class n extends be{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=O.deserialize(e),r=e.deserializeVector(u),o=e.deserializeVector(O);return new n(t,r,o)}},ct= exports.TransactionAuthenticatorFeePayer =class n extends be{constructor(e,t,r,o){super(),this.sender=e,this.secondary_signer_addresses=t,this.secondary_signers=r,this.fee_payer=o}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=O.deserialize(e),r=e.deserializeVector(u),o=e.deserializeVector(O),i=u.deserialize(e),s=O.deserialize(e),a={address:i,authenticator:s};return new n(t,r,o,a)}},ut= exports.TransactionAuthenticatorSingleSender =class n extends be{constructor(e){super(),this.sender=e}serialize(e){e.serializeU32AsUleb128(4),this.sender.serialize(e)}static load(e){let t=O.deserialize(e);return new n(t)}};var Qe=class n extends d{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=te.deserialize(e),r=be.deserialize(e);return new n(t,r)}};var ln=class n extends d{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=te.deserialize(e),r=e.deserializeBool(),o;return r&&(o=u.deserialize(e)),new n(t,o)}};var gn=class n extends d{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=te.deserialize(e),r=e.deserializeVector(u),o=e.deserializeBool(),i;return o&&(i=u.deserialize(e)),new n(t,r,i)}};function Ss(n){return n.feePayerAddress?new He(n.rawTransaction,_nullishCoalesce(n.secondarySignerAddresses, () => ([])),n.feePayerAddress):n.secondarySignerAddresses?new Le(n.rawTransaction,n.secondarySignerAddresses):n.rawTransaction}function mn(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(),o=n,i=new Uint8Array(r.length+o.length);return i.set(r),i.set(o,r.length),i}function qd(n){return mn(n.bcsToBytes(),`APTOS::${n.constructor.name}`)}function pt(n){let e=Ss(n);return n.feePayerAddress?mn(e.bcsToBytes(),Ln):n.secondarySignerAddresses?mn(e.bcsToBytes(),Ln):mn(e.bcsToBytes(),Lr)}var dt=class n{constructor(e){this.signingScheme=0;let{privateKey:t,address:r}=e;this.privateKey=t,this.publicKey=t.publicKey(),this.accountAddress=r?u.from(r):this.publicKey.authKey().derivedAddress()}static generate(){let e=J.generate();return new n({privateKey:e})}static fromDerivationPath(e){let{path:t,mnemonic:r}=e,o=J.fromDerivationPath(t,r);return new n({privateKey:o})}verifySignature(e){return this.publicKey.verifySignature(e)}signWithAuthenticator(e){return new ae(this.publicKey,this.privateKey.sign(e))}signTransactionWithAuthenticator(e){return new ae(this.publicKey,this.signTransaction(e))}sign(e){return this.privateKey.sign(e)}signTransaction(e){return this.sign(pt(e))}};var lt=class n{constructor(e){this.signingScheme=2;let{privateKey:t,address:r}=e;this.privateKey=t,this.publicKey=new B(t.publicKey()),this.accountAddress=r?u.from(r):this.publicKey.authKey().derivedAddress()}static generate(e={}){let{scheme:t=0}=e,r;switch(t){case 0:r=J.generate();break;case 2:r=Oe.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:o}=e,i;switch(t){case 0:i=J.fromDerivationPath(r,o);break;case 2:i=Oe.fromDerivationPath(r,o);break;default:throw new Error(`Unsupported signature scheme ${t}`)}return new n({privateKey:i})}verifySignature(e){return this.publicKey.verifySignature(e)}signWithAuthenticator(e){return new ce(this.publicKey,this.sign(e))}signTransactionWithAuthenticator(e){return new ce(this.publicKey,this.signTransaction(e))}sign(e){return new q(this.privateKey.sign(e))}signTransaction(e){return this.sign(pt(e))}};var Ie=class{static generate(e={}){let{scheme:t=0,legacy:r=!0}=e;return t===0&&r?dt.generate():lt.generate({scheme:t})}static fromPrivateKey(e){let{privateKey:t,address:r,legacy:o=!0}=e;return t instanceof J&&o?new dt({privateKey:t,address:r}):new lt({privateKey:t,address:r})}static fromPrivateKeyAndAddress(e){return this.fromPrivateKey(e)}static fromDerivationPath(e){let{scheme:t=0,mnemonic:r,path:o,legacy:i=!0}=e;return t===0&&i?dt.fromDerivationPath({mnemonic:r,path:o}):lt.fromDerivationPath({scheme:t,mnemonic:r,path:o})}static authKey(e){let{publicKey:t}=e;return t.authKey()}verifySignature(e){return this.publicKey.verifySignature(e)}};var Hr=class n{constructor(e){let{multiKey:t,signers:r}=e;this.publicKey=t,this.signingScheme=3,this.accountAddress=this.publicKey.authKey().derivedAddress();let o=[];for(let s of r)o.push(this.publicKey.getIndex(s.publicKey));let i=r.map((s,a)=>[s,o[a]]);i.sort((s,a)=>s[1]-a[1]),this.signers=i.map(s=>s[0]),this.signerIndicies=i.map(s=>s[1]),this.signaturesBitmap=this.publicKey.createBitmap({bits:o})}static fromPublicKeysAndSigners(e){let{publicKeys:t,signaturesRequired:r,signers:o}=e,i=new et({publicKeys:t,signaturesRequired:r});return new n({multiKey:i,signers:o})}static isMultiKeySigner(e){return e instanceof n}signWithAuthenticator(e){return new Fe(this.publicKey,this.sign(e))}signTransactionWithAuthenticator(e){return new Fe(this.publicKey,this.signTransaction(e))}sign(e){let t=[];for(let r of this.signers)t.push(r.sign(e));return new Me({signatures:t,bitmap:this.signaturesBitmap})}signTransaction(e){let t=[];for(let r of this.signers)t.push(r.signTransaction(e));return new Me({signatures:t,bitmap:this.signaturesBitmap})}verifySignature(e){let{message:t,signature:r}=e;if(!this.signerIndicies.every((i,s)=>s===0||i>=this.signerIndicies[s-1]))return!1;for(let i=0;i<r.signatures.length;i+=1){let s=r.signatures[i];if(!this.publicKey.publicKeys[this.signerIndicies[i]].verifySignature({message:t,signature:s}))return!1}return!0}};var ge=class extends Error{constructor(e,t,r){super(r),this.name="AptosApiError",this.url=t.url,this.status=t.status,this.statusText=t.statusText,this.data=t.data,this.request=e}};var Qr="1.15.0";var Wr={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"},jr= 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"},Xr= exports.NetworkToFaucetAPI ={mainnet:"https://faucet.mainnet.aptoslabs.com",testnet:"https://faucet.testnet.aptoslabs.com",devnet:"https://faucet.devnet.aptoslabs.com",local:"http://127.0.0.1:8081"},Qn= exports.Network =(i=>(i.MAINNET="mainnet",i.TESTNET="testnet",i.DEVNET="devnet",i.LOCAL="local",i.CUSTOM="custom",i))(Qn||{}),Wn= exports.NetworkToChainId ={mainnet:1,testnet:2,local:4},zl= exports.NetworkToNetworkName ={mainnet:"mainnet",testnet:"testnet",devnet:"devnet",local:"local",custom:"custom"};function Yr(n,e){let t=e.bcsToBytes(),r=new Jt(t);return n.deserialize(r)}var Zr={400:"Bad Request",401:"Unauthorized",403:"Forbidden",404:"Not Found",429:"Too Many Requests",500:"Internal Server Error",502:"Bad Gateway",503:"Service Unavailable"};async function xs(n,e){let{url:t,method:r,body:o,contentType:i,params:s,overrides:a,originMethod:c}=n,p={..._optionalChain([a, 'optionalAccess', _8 => _8.HEADERS]),"x-aptos-client":`aptos-typescript-sdk/${Qr}`,"content-type":_nullishCoalesce(i, () => ("application/json")),"x-aptos-typescript-sdk-origin-method":c};return _optionalChain([a, 'optionalAccess', _9 => _9.AUTH_TOKEN])&&(p.Authorization=`Bearer ${_optionalChain([a, 'optionalAccess', _10 => _10.AUTH_TOKEN])}`),_optionalChain([a, 'optionalAccess', _11 => _11.API_KEY])&&(p.Authorization=`Bearer ${_optionalChain([a, 'optionalAccess', _12 => _12.API_KEY])}`),e.provider({url:t,method:r,body:o,params:s,headers:p,overrides:a})}async function yn(n,e,t){let{url:r,path:o}=n,i=o?`${r}/${o}`:r,s=await xs({...n,url:i},e.client),a={status:s.status,statusText:s.statusText,data:s.data,headers:s.headers,config:s.config,request:s.request,url:i};if(a.status===401)throw new ge(n,a,`Error: ${a.data}`);if(t==="Indexer"){let p=a.data;if(p.errors)throw new ge(n,a,_nullishCoalesce(`Indexer error: ${p.errors[0].message}`, () => (`Indexer unhandled Error ${s.status} : ${s.statusText}`)));a.data=p.data}if(a.status>=200&&a.status<300)return a;let c;throw a&&a.data&&"message"in a.data&&"error_code"in a.data?c=JSON.stringify(a.data):a.status in Zr?c=Zr[a.status]:c=`Unhandled Error ${a.status} : ${a.statusText}`,new ge(n,a,`${t} error: ${c}`)}async function Jr(n){let{aptosConfig:e,overrides:t,params:r,contentType:o,acceptType:i,path:s,originMethod:a,type:c}=n,p=e.getRequestUrl(c);return yn({url:p,method:"GET",originMethod:a,path:s,contentType:o,acceptType:i,params:r,overrides:{...e.clientConfig,...t}},e,n.type)}async function W(n){let{aptosConfig:e}=n;return Jr({...n,type:"Fullnode",overrides:{...e.clientConfig,...e.fullnodeConfig,...n.overrides,HEADERS:{..._optionalChain([e, 'access', _13 => _13.clientConfig, 'optionalAccess', _14 => _14.HEADERS]),..._optionalChain([e, 'access', _15 => _15.fullnodeConfig, 'optionalAccess', _16 => _16.HEADERS])}}})}async function gt(n){let e=[],t,r=n.params;do{let o=await Jr({type:"Fullnode",aptosConfig:n.aptosConfig,originMethod:n.originMethod,path:n.path,params:r,overrides:n.overrides});t=o.headers["x-aptos-cursor"],delete o.headers,e.push(...o.data),r.start=t}while(t!=null);return e}async function jn(n){let{type:e,originMethod:t,path:r,body:o,acceptType:i,contentType:s,params:a,aptosConfig:c,overrides:p}=n,f=c.getRequestUrl(e);return yn({url:f,method:"POST",originMethod:t,path:r,body:o,contentType:s,acceptType:i,params:a,overrides:p},c,n.type)}async function We(n){let{aptosConfig:e}=n;return jn({...n,type:"Fullnode",overrides:{...e.clientConfig,...e.fullnodeConfig,...n.overrides,HEADERS:{..._optionalChain([e, 'access', _17 => _17.clientConfig, 'optionalAccess', _18 => _18.HEADERS]),..._optionalChain([e, 'access', _19 => _19.fullnodeConfig, 'optionalAccess', _20 => _20.HEADERS])}}})}async function eo(n){let{aptosConfig:e}=n;return jn({...n,type:"Indexer",overrides:{...e.clientConfig,...e.indexerConfig,...n.overrides,HEADERS:{..._optionalChain([e, 'access', _21 => _21.clientConfig, 'optionalAccess', _22 => _22.HEADERS]),..._optionalChain([e, 'access', _23 => _23.indexerConfig, 'optionalAccess', _24 => _24.HEADERS])}}})}async function to(n){let{aptosConfig:e}=n,t={...e,clientConfig:{...e.clientConfig}};return _optionalChainDelete([t, 'optionalAccess', _25 => _25.clientConfig, 'optionalAccess', _26 => delete _26.API_KEY]),jn({...n,type:"Faucet",overrides:{...t.clientConfig,...t.faucetConfig,...n.overrides,HEADERS:{..._optionalChain([t, 'access', _27 => _27.clientConfig, 'optionalAccess', _28 => _28.HEADERS]),..._optionalChain([t, 'access', _29 => _29.faucetConfig, 'optionalAccess', _30 => _30.HEADERS])}}})}var vs=`
|
|
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 _chunkVLEH6QBRjs = require('./chunk-VLEH6QBR.js');var wn=255,Sn=65535,xe=4294967295,$e=18446744073709551615n,Ot=340282366920938463463374607431768211455n,xn=115792089237316195423570985008687907853269984665640564039457584007913129639935n;var te=class{constructor(t){this.buffer=new ArrayBuffer(t.length),new Uint8Array(this.buffer).set(t,0),this.offset=0}read(t){if(this.offset+t>this.buffer.byteLength)throw new Error("Reached to the end of buffer");let e=this.buffer.slice(this.offset,this.offset+t);return this.offset+=t,e}deserializeStr(){let t=this.deserializeBytes();return new TextDecoder().decode(t)}deserializeOptionStr(){if(this.deserializeUleb128AsU32()===1)return this.deserializeStr()}deserializeOption(t){if(this.deserializeUleb128AsU32()===1)return this.deserialize(t)}deserializeBytes(){let t=this.deserializeUleb128AsU32();return new Uint8Array(this.read(t))}deserializeFixedBytes(t){return new Uint8Array(this.read(t))}deserializeBool(){let t=new Uint8Array(this.read(1))[0];if(t!==1&&t!==0)throw new Error("Invalid boolean value");return t===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 t=this.deserializeU32(),e=this.deserializeU32();return BigInt(BigInt(e)<<BigInt(32)|BigInt(t))}deserializeU128(){let t=this.deserializeU64(),e=this.deserializeU64();return BigInt(e<<BigInt(64)|t)}deserializeU256(){let t=this.deserializeU128(),e=this.deserializeU128();return BigInt(e<<BigInt(128)|t)}deserializeUleb128AsU32(){let t=BigInt(0),e=0;for(;t<xe;){let r=this.deserializeU8();if(t|=BigInt(r&127)<<BigInt(e),!(r&128))break;e+=7}if(t>xe)throw new Error("Overflow while parsing uleb128-encoded uint32 value");return Number(t)}deserialize(t){return t.deserialize(this)}deserializeVector(t){let e=this.deserializeUleb128AsU32(),r=new Array;for(let i=0;i<e;i+=1)r.push(this.deserialize(t));return r}};var _utils = require('@noble/hashes/utils');var Q=class extends Error{constructor(e,r){super(e);this.invalidReason=r}};var Zs=(r=>(r.TOO_SHORT="too_short",r.INVALID_LENGTH="invalid_length",r.INVALID_HEX_CHARS="invalid_hex_chars",r))(Zs||{}),g= exports.Hex =class n{constructor(t){this.data=t}toUint8Array(){return this.data}toStringWithoutPrefix(){return _utils.bytesToHex.call(void 0, this.data)}toString(){return`0x${this.toStringWithoutPrefix()}`}static fromHexString(t){let e=t;if(e.startsWith("0x")&&(e=e.slice(2)),e.length===0)throw new Q("Hex string is too short, must be at least 1 char long, excluding the optional leading 0x.","too_short");if(e.length%2!==0)throw new Q("Hex string must be an even number of hex characters.","invalid_length");try{return new n(_utils.hexToBytes.call(void 0, e))}catch(r){throw new Q(`Hex string contains invalid hex characters: ${_optionalChain([r, 'optionalAccess', _2 => _2.message])}`,"invalid_hex_chars")}}static fromHexInput(t){return t instanceof Uint8Array?new n(t):n.fromHexString(t)}static isValid(t){try{return n.fromHexString(t),{valid:!0}}catch(e){return{valid:!1,invalidReason:_optionalChain([e, 'optionalAccess', _3 => _3.invalidReason]),invalidReasonMessage:_optionalChain([e, 'optionalAccess', _4 => _4.message])}}}equals(t){return this.data.length!==t.data.length?!1:this.data.every((e,r)=>e===t.data[r])}};var d=class{bcsToBytes(){let t=new W;return this.serialize(t),t.toUint8Array()}bcsToHex(){let t=this.bcsToBytes();return g.fromHexInput(t)}},W= exports.Serializer =class{constructor(t=64){if(t<=0)throw new Error("Length needs to be greater than 0");this.buffer=new ArrayBuffer(t),this.offset=0}ensureBufferWillHandleSize(t){for(;this.buffer.byteLength<this.offset+t;){let e=new ArrayBuffer(this.buffer.byteLength*2);new Uint8Array(e).set(new Uint8Array(this.buffer)),this.buffer=e}}appendToBuffer(t){this.ensureBufferWillHandleSize(t.length),new Uint8Array(this.buffer,this.offset).set(t),this.offset+=t.length}serializeWithFunction(t,e,r){this.ensureBufferWillHandleSize(e);let i=new DataView(this.buffer,this.offset);t.apply(i,[0,r,!0]),this.offset+=e}serializeStr(t){let e=new TextEncoder;this.serializeBytes(e.encode(t))}serializeBytes(t){this.serializeU32AsUleb128(t.length),this.appendToBuffer(t)}serializeFixedBytes(t){this.appendToBuffer(t)}serializeBool(t){mr(t);let e=t?1:0;this.appendToBuffer(new Uint8Array([e]))}serializeU8(t){this.appendToBuffer(new Uint8Array([t]))}serializeU16(t){this.serializeWithFunction(DataView.prototype.setUint16,2,t)}serializeU32(t){this.serializeWithFunction(DataView.prototype.setUint32,4,t)}serializeU64(t){let e=BigInt(t)&BigInt(xe),r=BigInt(t)>>BigInt(32);this.serializeU32(Number(e)),this.serializeU32(Number(r))}serializeU128(t){let e=BigInt(t)&$e,r=BigInt(t)>>BigInt(64);this.serializeU64(e),this.serializeU64(r)}serializeU256(t){let e=BigInt(t)&Ot,r=BigInt(t)>>BigInt(128);this.serializeU128(e),this.serializeU128(r)}serializeU32AsUleb128(t){let e=t,r=[];for(;e>>>7;)r.push(e&127|128),e>>>=7;r.push(e),this.appendToBuffer(new Uint8Array(r))}toUint8Array(){return new Uint8Array(this.buffer).slice(0,this.offset)}serialize(t){t.serialize(this)}serializeVector(t){this.serializeU32AsUleb128(t.length),t.forEach(e=>{e.serialize(this)})}serializeOption(t){t===void 0?this.serializeU32AsUleb128(0):(this.serializeU32AsUleb128(1),t.serialize(this))}serializeOptionStr(t){t===void 0?this.serializeU32AsUleb128(0):(this.serializeU32AsUleb128(1),this.serializeStr(t))}};_chunkVLEH6QBRjs.a.call(void 0, [Ve(0,wn)],W.prototype,"serializeU8",1),_chunkVLEH6QBRjs.a.call(void 0, [Ve(0,Sn)],W.prototype,"serializeU16",1),_chunkVLEH6QBRjs.a.call(void 0, [Ve(0,xe)],W.prototype,"serializeU32",1),_chunkVLEH6QBRjs.a.call(void 0, [Ve(BigInt(0),$e)],W.prototype,"serializeU64",1),_chunkVLEH6QBRjs.a.call(void 0, [Ve(BigInt(0),Ot)],W.prototype,"serializeU128",1),_chunkVLEH6QBRjs.a.call(void 0, [Ve(BigInt(0),xn)],W.prototype,"serializeU256",1),_chunkVLEH6QBRjs.a.call(void 0, [Ve(0,xe)],W.prototype,"serializeU32AsUleb128",1);function mr(n){if(typeof n!="boolean")throw new Error(`${n} is not a boolean value`)}var Js=(n,t,e)=>`${n} is out of range: [${t}, ${e}]`;function De(n,t,e){let r=BigInt(n);if(r>BigInt(e)||r<BigInt(t))throw new Error(Js(n,t,e))}function Ve(n,t){return(e,r,i)=>{let o=i.value;return i.value=function(a){return De(a,n,t),o.apply(this,[a])},i}}var Le=class n extends d{constructor(e){super();this.value=g.fromHexInput(e).toUint8Array()}serialize(e){e.serializeFixedBytes(this.value)}serializeForEntryFunction(e){e.serialize(this)}serializeForScriptFunction(e){e.serialize(this)}static deserialize(e,r){let i=e.deserializeFixedBytes(r);return new n(i)}};var _n=class n extends d{constructor(e){super();this.value=new Le(e)}serialize(e){e.serialize(this.value)}serializeForEntryFunction(e){e.serializeU32AsUleb128(this.value.value.length),e.serialize(this)}static deserialize(e,r){let i=Le.deserialize(e,r);return new n(i.value)}};var vn=(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))(vn||{}),gi= exports.TypeTagVariants =(l=>(l[l.Bool=0]="Bool",l[l.U8=1]="U8",l[l.U64=2]="U64",l[l.U128=3]="U128",l[l.Address=4]="Address",l[l.Signer=5]="Signer",l[l.Vector=6]="Vector",l[l.Struct=7]="Struct",l[l.U16=8]="U16",l[l.U32=9]="U32",l[l.U256=10]="U256",l[l.Reference=254]="Reference",l[l.Generic=255]="Generic",l))(gi||{}),Ft= exports.ScriptTransactionArgumentVariants =(p=>(p[p.U8=0]="U8",p[p.U64=1]="U64",p[p.U128=2]="U128",p[p.Address=3]="Address",p[p.U8Vector=4]="U8Vector",p[p.Bool=5]="Bool",p[p.U16=6]="U16",p[p.U32=7]="U32",p[p.U256=8]="U256",p))(Ft||{}),mi= exports.TransactionPayloadVariants =(r=>(r[r.Script=0]="Script",r[r.EntryFunction=2]="EntryFunction",r[r.Multisig=3]="Multisig",r))(mi||{}),yi= exports.TransactionVariants =(e=>(e[e.MultiAgentTransaction=0]="MultiAgentTransaction",e[e.FeePayerTransaction=1]="FeePayerTransaction",e))(yi||{}),fi= 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))(fi||{}),Ai= exports.AccountAuthenticatorVariant =(i=>(i[i.Ed25519=0]="Ed25519",i[i.MultiEd25519=1]="MultiEd25519",i[i.SingleKey=2]="SingleKey",i[i.MultiKey=3]="MultiKey",i))(Ai||{}),yr= exports.AnyPublicKeyVariant =(r=>(r[r.Ed25519=0]="Ed25519",r[r.Secp256k1=1]="Secp256k1",r[r.Keyless=3]="Keyless",r))(yr||{}),hi= exports.AnySignatureVariant =(r=>(r[r.Ed25519=0]="Ed25519",r[r.Secp256k1=1]="Secp256k1",r[r.Keyless=3]="Keyless",r))(hi||{}),fr= exports.EphemeralPublicKeyVariant =(t=>(t[t.Ed25519=0]="Ed25519",t))(fr||{}),Ti= exports.EphemeralSignatureVariant =(t=>(t[t.Ed25519=0]="Ed25519",t))(Ti||{}),Ar= exports.EphemeralCertificateVariant =(t=>(t[t.ZkProof=0]="ZkProof",t))(Ar||{}),hr= exports.ZkpVariant =(t=>(t[t.Groth16=0]="Groth16",t))(hr||{}),Tr= exports.TransactionResponseType =(s=>(s.Pending="pending_transaction",s.User="user_transaction",s.Genesis="genesis_transaction",s.BlockMetadata="block_metadata_transaction",s.StateCheckpoint="state_checkpoint_transaction",s.Validator="validator_transaction",s))(Tr||{});function du(n){return n.type==="pending_transaction"}function lu(n){return n.type==="user_transaction"}function gu(n){return n.type==="genesis_transaction"}function mu(n){return n.type==="block_metadata_transaction"}function yu(n){return n.type==="state_checkpoint_transaction"}function fu(n){return n.type==="validator_transaction"}function Au(n){return"signature"in n&&n.signature==="ed25519_signature"}function hu(n){return"signature"in n&&n.signature==="secp256k1_ecdsa_signature"}function Tu(n){return n.type==="multi_agent_signature"}function bu(n){return n.type==="fee_payer_signature"}function wu(n){return n.type==="multi_ed25519_signature"}var ea=(r=>(r.PRIVATE="private",r.PUBLIC="public",r.FRIEND="friend",r))(ea||{}),bi= exports.MoveAbility =(i=>(i.STORE="store",i.DROP="drop",i.KEY="key",i.COPY="copy",i))(bi||{}),ta= exports.RoleType =(e=>(e.VALIDATOR="validator",e.FULL_NODE="full_node",e))(ta||{}),fe= exports.SigningScheme =(i=>(i[i.Ed25519=0]="Ed25519",i[i.MultiEd25519=1]="MultiEd25519",i[i.SingleKey=2]="SingleKey",i[i.MultiKey=3]="MultiKey",i))(fe||{}),br= exports.SigningSchemeInput =(e=>(e[e.Ed25519=0]="Ed25519",e[e.Secp256k1Ecdsa=2]="Secp256k1Ecdsa",e))(br||{}),na= 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))(na||{});var E=class n extends d{constructor(e){super();mr(e),this.value=e}serialize(e){e.serializeBool(this.value)}serializeForEntryFunction(e){let r=this.bcsToBytes();e.serializeBytes(r)}serializeForScriptFunction(e){e.serializeU32AsUleb128(5),e.serialize(this)}static deserialize(e){return new n(e.deserializeBool())}},B= exports.U8 =class n extends d{constructor(e){super();De(e,0,wn),this.value=e}serialize(e){e.serializeU8(this.value)}serializeForEntryFunction(e){let r=this.bcsToBytes();e.serializeBytes(r)}serializeForScriptFunction(e){e.serializeU32AsUleb128(0),e.serialize(this)}static deserialize(e){return new n(e.deserializeU8())}},ne= exports.U16 =class n extends d{constructor(e){super();De(e,0,Sn),this.value=e}serialize(e){e.serializeU16(this.value)}serializeForEntryFunction(e){let r=this.bcsToBytes();e.serializeBytes(r)}serializeForScriptFunction(e){e.serializeU32AsUleb128(6),e.serialize(this)}static deserialize(e){return new n(e.deserializeU16())}},re= exports.U32 =class n extends d{constructor(e){super();De(e,0,xe),this.value=e}serialize(e){e.serializeU32(this.value)}serializeForEntryFunction(e){let r=this.bcsToBytes();e.serializeBytes(r)}serializeForScriptFunction(e){e.serializeU32AsUleb128(7),e.serialize(this)}static deserialize(e){return new n(e.deserializeU32())}},O= exports.U64 =class n extends d{constructor(e){super();De(e,BigInt(0),$e),this.value=BigInt(e)}serialize(e){e.serializeU64(this.value)}serializeForEntryFunction(e){let r=this.bcsToBytes();e.serializeBytes(r)}serializeForScriptFunction(e){e.serializeU32AsUleb128(1),e.serialize(this)}static deserialize(e){return new n(e.deserializeU64())}},de= exports.U128 =class n extends d{constructor(e){super();De(e,BigInt(0),Ot),this.value=BigInt(e)}serialize(e){e.serializeU128(this.value)}serializeForEntryFunction(e){let r=this.bcsToBytes();e.serializeBytes(r)}serializeForScriptFunction(e){e.serializeU32AsUleb128(2),e.serialize(this)}static deserialize(e){return new n(e.deserializeU128())}},le= exports.U256 =class n extends d{constructor(e){super();De(e,BigInt(0),xn),this.value=BigInt(e)}serialize(e){e.serializeU256(this.value)}serializeForEntryFunction(e){let r=this.bcsToBytes();e.serializeBytes(r)}serializeForScriptFunction(e){e.serializeU32AsUleb128(8),e.serialize(this)}static deserialize(e){return new n(e.deserializeU256())}};var T=class n extends d{constructor(e){super();this.values=e}serializeForEntryFunction(e){let r=this.bcsToBytes();e.serializeBytes(r)}serializeForScriptFunction(e){if(!(this.values[0]instanceof B)&&this.values[0]!==void 0)throw new Error("Script function arguments only accept u8 vectors");e.serializeU32AsUleb128(4),e.serialize(this)}static U8(e){let r;if(Array.isArray(e)&&typeof e[0]=="number")r=e;else if(typeof e=="string"){let i=g.fromHexInput(e);r=Array.from(i.toUint8Array())}else if(e instanceof Uint8Array)r=Array.from(e);else throw new Error("Invalid input type");return new n(r.map(i=>new B(i)))}static U16(e){return new n(e.map(r=>new ne(r)))}static U32(e){return new n(e.map(r=>new re(r)))}static U64(e){return new n(e.map(r=>new O(r)))}static U128(e){return new n(e.map(r=>new de(r)))}static U256(e){return new n(e.map(r=>new le(r)))}static Bool(e){return new n(e.map(r=>new E(r)))}static MoveString(e){return new n(e.map(r=>new b(r)))}serialize(e){e.serializeVector(this.values)}static deserialize(e,r){let i=e.deserializeUleb128AsU32(),o=new Array;for(let s=0;s<i;s+=1)o.push(r.deserialize(e));return new n(o)}},b= exports.MoveString =class n extends d{constructor(e){super();this.value=e}serialize(e){e.serializeStr(this.value)}serializeForEntryFunction(e){let r=this.bcsToBytes();e.serializeBytes(r)}serializeForScriptFunction(e){let r=this.bcsToBytes().slice(1);T.U8(r).serializeForScriptFunction(e)}static deserialize(e){return new n(e.deserializeStr())}},Ke= exports.MoveOption =class n extends d{constructor(e){super();typeof e<"u"&&e!==null?this.vec=new T([e]):this.vec=new T([]),[this.value]=this.vec.values}serializeForEntryFunction(e){let r=this.bcsToBytes();e.serializeBytes(r)}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 B(e):void 0)}static U16(e){return new n(e!=null?new ne(e):void 0)}static U32(e){return new n(e!=null?new re(e):void 0)}static U64(e){return new n(e!=null?new O(e):void 0)}static U128(e){return new n(e!=null?new de(e):void 0)}static U256(e){return new n(e!=null?new le(e):void 0)}static Bool(e){return new n(e!=null?new E(e):void 0)}static MoveString(e){return new n(e!=null?new b(e):void 0)}static deserialize(e,r){let i=T.deserialize(e,r);return new n(i.values[0])}};var _ed25519 = require('@noble/curves/ed25519');var _sha3 = require('@noble/hashes/sha3');var ia=(a=>(a.INCORRECT_NUMBER_OF_BYTES="incorrect_number_of_bytes",a.INVALID_HEX_CHARS="invalid_hex_chars",a.TOO_SHORT="too_short",a.TOO_LONG="too_long",a.LEADING_ZERO_X_REQUIRED="leading_zero_x_required",a.LONG_FORM_REQUIRED_UNLESS_SPECIAL="long_form_required_unless_special",a.INVALID_PADDING_ZEROES="INVALID_PADDING_ZEROES",a))(ia||{}),w=class w extends d{constructor(e){super();if(e.length!==w.LENGTH)throw new Q("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 r=this.bcsToBytes();e.serializeBytes(r)}serializeForScriptFunction(e){e.serializeU32AsUleb128(3),e.serialize(this)}static deserialize(e){let r=e.deserializeFixedBytes(w.LENGTH);return new w(r)}static fromStringStrict(e){if(!e.startsWith("0x"))throw new Q("Hex string must start with a leading 0x.","leading_zero_x_required");let r=w.fromString(e);if(e.length!==w.LONG_STRING_LENGTH+2)if(r.isSpecial()){if(e.length!==3)throw new Q(`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 Q(`The given hex string ${e} is not a special address, it must be represented as 0x + 64 chars.`,"long_form_required_unless_special");return r}static fromString(e){let r=e;if(e.startsWith("0x")&&(r=e.slice(2)),r.length===0)throw new Q("Hex string is too short, must be 1 to 64 chars long, excluding the leading 0x.","too_short");if(r.length>64)throw new Q("Hex string is too long, must be 1 to 64 chars long, excluding the leading 0x.","too_long");let i;try{i=_utils.hexToBytes.call(void 0, r.padStart(64,"0"))}catch(o){throw new Q(`Hex characters are invalid: ${_optionalChain([o, 'optionalAccess', _5 => _5.message])}`,"invalid_hex_chars")}return new w(i)}static from(e){return e instanceof w?e:e instanceof Uint8Array?new w(e):w.fromString(e)}static fromStrict(e){return e instanceof w?e:e instanceof Uint8Array?new w(e):w.fromStringStrict(e)}static isValid(e){try{return e.strict?w.fromStrict(e.input):w.from(e.input),{valid:!0}}catch(r){return{valid:!1,invalidReason:_optionalChain([r, 'optionalAccess', _6 => _6.invalidReason]),invalidReasonMessage:_optionalChain([r, 'optionalAccess', _7 => _7.message])}}}equals(e){return this.data.length!==e.data.length?!1:this.data.every((r,i)=>r===e.data[i])}};w.LENGTH=32,w.LONG_STRING_LENGTH=64,w.ZERO=w.from("0x0"),w.ONE=w.from("0x1"),w.TWO=w.from("0x2"),w.THREE=w.from("0x3"),w.FOUR=w.from("0x4");var u=w;var Ge=class Ge extends d{constructor(e){super();let{data:r}=e,i=g.fromHexInput(r);if(i.toUint8Array().length!==Ge.LENGTH)throw new Error(`Authentication Key length should be ${Ge.LENGTH}`);this.data=i}serialize(e){e.serializeFixedBytes(this.data.toUint8Array())}static deserialize(e){let r=e.deserializeFixedBytes(Ge.LENGTH);return new Ge({data:r})}toString(){return this.data.toString()}toUint8Array(){return this.data.toUint8Array()}static fromSchemeAndBytes(e){let{scheme:r,input:i}=e,o=g.fromHexInput(i).toUint8Array(),s=new Uint8Array([...o,r]),a=_sha3.sha3_256.create();a.update(s);let c=a.digest();return new Ge({data:c})}static fromPublicKeyAndScheme(e){let{publicKey:r}=e;return r.authKey()}static fromPublicKey(e){let{publicKey:r}=e;return r.authKey()}derivedAddress(){return new u(this.data.toUint8Array())}};Ge.LENGTH=32;var F=Ge;var _hmac = require('@noble/hashes/hmac');var _sha512 = require('@noble/hashes/sha512');var _bip39 = require('@scure/bip39'); var Si = _interopRequireWildcard(_bip39);var ca=/^m\/44'\/637'\/[0-9]+'\/[0-9]+'\/[0-9]+'?$/,ua= exports.APTOS_BIP44_REGEX =/^m\/44'\/637'\/[0-9]+'\/[0-9]+\/[0-9]+$/,pa= exports.KeyType =(t=>(t.ED25519="ed25519 seed",t))(pa||{}),xi= exports.HARDENED_OFFSET =2147483648;function _i(n){return ua.test(n)}function vi(n){return ca.test(n)}var wr=(n,t)=>{let e=_hmac.hmac.create(_sha512.sha512,n).update(t).digest();return{key:e.slice(0,32),chainCode:e.slice(32)}},Pi= exports.CKDPriv =({key:n,chainCode:t},e)=>{let r=new ArrayBuffer(4);new DataView(r).setUint32(0,e);let i=new Uint8Array(r),o=new Uint8Array([0]),s=new Uint8Array([...o,...n,...i]);return wr(t,s)},da=n=>n.replace("'",""),Ci= exports.splitPath =n=>n.split("/").slice(1).map(da),Pn= exports.mnemonicToSeed =n=>{let t=n.trim().split(/\s+/).map(e=>e.toLowerCase()).join(" ");return Si.mnemonicToSeedSync(t)};var He=class extends d{toString(){let t=this.toUint8Array();return g.fromHexInput(t).toString()}},ie= exports.AccountPublicKey =class extends He{};var G=class extends d{toString(){let t=this.toUint8Array();return g.fromHexInput(t).toString()}};var dt=n=>typeof n=="string"?g.isValid(n).valid?n:Buffer.from(n,"utf8"):n;var Ei=[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],Qe=class Qe extends ie{constructor(e){super();let r=g.fromHexInput(e);if(r.toUint8Array().length!==Qe.LENGTH)throw new Error(`PublicKey length should be ${Qe.LENGTH}`);this.key=r}verifySignature(e){let{message:r,signature:i}=e;if(!(i instanceof S))return!1;let o=dt(r),s=g.fromHexInput(o).toUint8Array(),a=i.toUint8Array(),c=this.key.toUint8Array();return i.isCanonicalSignature()?_ed25519.ed25519.verify(a,s,c):!1}authKey(){return F.fromSchemeAndBytes({scheme:0,input:this.toUint8Array()})}toUint8Array(){return this.key.toUint8Array()}serialize(e){e.serializeBytes(this.key.toUint8Array())}static deserialize(e){let r=e.deserializeBytes();return new Qe(r)}static isPublicKey(e){return e instanceof Qe}};Qe.LENGTH=32;var x=Qe,oe=class oe extends d{constructor(e){super();let r=g.fromHexInput(e);if(r.toUint8Array().length!==oe.LENGTH)throw new Error(`PrivateKey length should be ${oe.LENGTH}`);this.signingKey=r}static generate(){let e=_ed25519.ed25519.utils.randomPrivateKey();return new oe(e)}static fromDerivationPath(e,r){if(!vi(e))throw new Error(`Invalid derivation path ${e}`);return oe.fromDerivationPathInner(e,Pn(r))}static fromDerivationPathInner(e,r,i=xi){let{key:o,chainCode:s}=wr(oe.SLIP_0010_SEED,r),a=Ci(e).map(p=>parseInt(p,10)),{key:c}=a.reduce((p,m)=>Pi(p,m+i),{key:o,chainCode:s});return new oe(c)}publicKey(){let e=_ed25519.ed25519.getPublicKey(this.signingKey.toUint8Array());return new x(e)}sign(e){let r=dt(e),i=g.fromHexInput(r).toUint8Array(),o=_ed25519.ed25519.sign(i,this.signingKey.toUint8Array());return new S(o)}toUint8Array(){return this.signingKey.toUint8Array()}toString(){return this.signingKey.toString()}serialize(e){e.serializeBytes(this.toUint8Array())}static deserialize(e){let r=e.deserializeBytes();return new oe(r)}static isPrivateKey(e){return e instanceof oe}};oe.LENGTH=32,oe.SLIP_0010_SEED="ed25519 seed";var $=oe,lt=class lt extends G{constructor(e){super();let r=g.fromHexInput(e);if(r.toUint8Array().length!==lt.LENGTH)throw new Error(`Signature length should be ${lt.LENGTH}`);this.data=r}toUint8Array(){return this.data.toUint8Array()}serialize(e){e.serializeBytes(this.data.toUint8Array())}static deserialize(e){let r=e.deserializeBytes();return new lt(r)}isCanonicalSignature(){let e=this.toUint8Array().slice(32);for(let r=e.length-1;r>=0;r-=1){if(e[r]<Ei[r])return!0;if(e[r]>Ei[r])return!1}return!1}};lt.LENGTH=64;var S=lt;var se=class se extends ie{constructor(e){super();let{publicKeys:r,threshold:i}=e;if(r.length>se.MAX_KEYS||r.length<se.MIN_KEYS)throw new Error(`Must have between ${se.MIN_KEYS} and ${se.MAX_KEYS} public keys, inclusive`);if(i<se.MIN_THRESHOLD||i>r.length)throw new Error(`Threshold must be between ${se.MIN_THRESHOLD} and ${r.length}, inclusive`);this.publicKeys=r,this.threshold=i}verifySignature(e){let{message:r,signature:i}=e;if(!(i instanceof We))return!1;let o=[];for(let s=0;s<4;s+=1)for(let a=0;a<8;a+=1)if((i.bitmap[s]&1<<7-a)!==0){let p=s*8+a;o.push(p)}if(o.length!==i.signatures.length)throw new Error("Bitmap and signatures length mismatch");if(o.length<this.threshold)throw new Error("Not enough signatures");for(let s=0;s<o.length;s+=1)if(!this.publicKeys[o[s]].verifySignature({message:r,signature:i.signatures[s]}))return!1;return!0}authKey(){return F.fromSchemeAndBytes({scheme:1,input:this.toUint8Array()})}toUint8Array(){let e=new Uint8Array(this.publicKeys.length*x.LENGTH+1);return this.publicKeys.forEach((r,i)=>{e.set(r.toUint8Array(),i*x.LENGTH)}),e[this.publicKeys.length*x.LENGTH]=this.threshold,e}serialize(e){e.serializeBytes(this.toUint8Array())}static deserialize(e){let r=e.deserializeBytes(),i=r[r.length-1],o=[];for(let s=0;s<r.length-1;s+=x.LENGTH){let a=s;o.push(new x(r.subarray(a,a+x.LENGTH)))}return new se({publicKeys:o,threshold:i})}};se.MAX_KEYS=32,se.MIN_KEYS=2,se.MIN_THRESHOLD=1;var gt=se,Y=class Y extends G{constructor(e){super();let{signatures:r,bitmap:i}=e;if(r.length>Y.MAX_SIGNATURES_SUPPORTED)throw new Error(`The number of signatures cannot be greater than ${Y.MAX_SIGNATURES_SUPPORTED}`);if(this.signatures=r,!(i instanceof Uint8Array))this.bitmap=Y.createBitmap({bits:i});else{if(i.length!==Y.BITMAP_LEN)throw new Error(`"bitmap" length should be ${Y.BITMAP_LEN}`);this.bitmap=i}}toUint8Array(){let e=new Uint8Array(this.signatures.length*S.LENGTH+Y.BITMAP_LEN);return this.signatures.forEach((r,i)=>{e.set(r.toUint8Array(),i*S.LENGTH)}),e.set(this.bitmap,this.signatures.length*S.LENGTH),e}serialize(e){e.serializeBytes(this.toUint8Array())}static deserialize(e){let r=e.deserializeBytes(),i=r.subarray(r.length-4),o=[];for(let s=0;s<r.length-i.length;s+=S.LENGTH){let a=s;o.push(new S(r.subarray(a,a+S.LENGTH)))}return new Y({signatures:o,bitmap:i})}static createBitmap(e){let{bits:r}=e,i=128,o=new Uint8Array([0,0,0,0]),s=new Set;return r.forEach((a,c)=>{if(a>=Y.MAX_SIGNATURES_SUPPORTED)throw new Error(`Cannot have a signature larger than ${Y.MAX_SIGNATURES_SUPPORTED-1}.`);if(s.has(a))throw new Error("Duplicate bits detected.");if(c>0&&a<=r[c-1])throw new Error("The bits need to be sorted in ascending order.");s.add(a);let p=Math.floor(a/8),m=o[p];m|=i>>a%8,o[p]=m}),o}};Y.MAX_SIGNATURES_SUPPORTED=32,Y.BITMAP_LEN=4;var We=Y;var _secp256k1 = require('@noble/curves/secp256k1');var _bip32 = require('@scure/bip32');var je=class je extends He{constructor(e){super();let r=g.fromHexInput(e);if(r.toUint8Array().length!==je.LENGTH)throw new Error(`PublicKey length should be ${je.LENGTH}`);this.key=r}verifySignature(e){let{message:r,signature:i}=e;if(!(i instanceof _e))return!1;let o=dt(r),s=g.fromHexInput(o).toUint8Array(),a=_sha3.sha3_256.call(void 0, s),c=i.toUint8Array();return _secp256k1.secp256k1.verify(c,a,this.key.toUint8Array(),{lowS:!0})}toUint8Array(){return this.key.toUint8Array()}serialize(e){e.serializeBytes(this.key.toUint8Array())}static deserialize(e){let r=e.deserializeBytes();return new je(r)}static isPublicKey(e){return e instanceof je}};je.LENGTH=65;var he=je,Ae=class Ae extends d{constructor(e){super();let r=g.fromHexInput(e);if(r.toUint8Array().length!==Ae.LENGTH)throw new Error(`PrivateKey length should be ${Ae.LENGTH}`);this.key=r}static generate(){let e=_secp256k1.secp256k1.utils.randomPrivateKey();return new Ae(e)}static fromDerivationPath(e,r){if(!_i(e))throw new Error(`Invalid derivation path ${e}`);return Ae.fromDerivationPathInner(e,Pn(r))}static fromDerivationPathInner(e,r){let{privateKey:i}=_bip32.HDKey.fromMasterSeed(r).derive(e);if(i===null)throw new Error("Invalid key");return new Ae(i)}sign(e){let r=dt(e),i=g.fromHexInput(r),o=_sha3.sha3_256.call(void 0, i.toUint8Array()),s=_secp256k1.secp256k1.sign(o,this.key.toUint8Array(),{lowS:!0});return new _e(s.toCompactRawBytes())}publicKey(){let e=_secp256k1.secp256k1.getPublicKey(this.key.toUint8Array(),!1);return new he(e)}toUint8Array(){return this.key.toUint8Array()}toString(){return this.key.toString()}serialize(e){e.serializeBytes(this.toUint8Array())}static deserialize(e){let r=e.deserializeBytes();return new Ae(r)}static isPrivateKey(e){return e instanceof Ae}};Ae.LENGTH=32;var Xe=Ae,mt=class mt extends G{constructor(e){super();let r=g.fromHexInput(e);if(r.toUint8Array().length!==mt.LENGTH)throw new Error(`Signature length should be ${mt.LENGTH}, received ${r.toUint8Array().length}`);this.data=r}toUint8Array(){return this.data.toUint8Array()}serialize(e){e.serializeBytes(this.data.toUint8Array())}static deserialize(e){let r=e.deserializeBytes();return new mt(r)}};mt.LENGTH=64;var _e=mt;var ke=class n extends He{constructor(e){super();let r=e.constructor.name;switch(r){case x.name:this.publicKey=e,this.variant=0;break;default:throw new Error(`Unsupported key for EphemeralPublicKey - ${r}`)}}toUint8Array(){return this.bcsToBytes()}verifySignature(e){let{message:r,signature:i}=e;return this.publicKey.verifySignature({message:r,signature:i})}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 r=e.deserializeUleb128AsU32();switch(r){case 0:return new n(x.deserialize(e));default:throw new Error(`Unknown variant index for EphemeralPublicKey: ${r}`)}}static isPublicKey(e){return e instanceof n}},ae= exports.EphemeralSignature =class n extends G{constructor(e){super();let r=e.constructor.name;switch(r){case S.name:this.signature=e;break;default:throw new Error(`Unsupported signature for EphemeralSignature - ${r}`)}}toUint8Array(){return this.bcsToBytes()}static fromHex(e){let r=g.fromHexInput(e),i=new te(r.toUint8Array());return n.deserialize(i)}serialize(e){if(this.signature instanceof S)e.serializeU32AsUleb128(0),this.signature.serialize(e);else throw new Error("Unknown signature type")}static deserialize(e){let r=e.deserializeUleb128AsU32();switch(r){case 0:return new n(S.deserialize(e));default:throw new Error(`Unknown variant index for EphemeralSignature: ${r}`)}}};var _poseidonlite = require('poseidon-lite');var Sr=[_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],Ri=31,Ia=16,Ui=(Ia-1)*Ri;function In(n,t){let r=new TextEncoder().encode(n);return Ua(r,t)}function Ua(n,t){if(n.length>t)throw new Error(`Inputted bytes of length ${n} is longer than ${t}`);let e=xr(n,t);return qt(e)}function Ra(n,t){if(n.length>t)throw new Error(`Input bytes of length ${n} is longer than ${t}`);let e=Ka(n,t);return za(e)}function xr(n,t){if(n.length>t)throw new Error(`Input bytes of length ${n} is longer than ${t}`);return Ra(n,t).concat([BigInt(n.length)])}function za(n){if(n.length>Ui)throw new Error(`Can't pack more than ${Ui}. Was given ${n.length} bytes`);return Da(n,Ri).map(t=>Mt(t))}function Da(n,t){let e=[];for(let r=0;r<n.length;r+=t)e.push(n.subarray(r,r+t));return e}function Mt(n){let t=BigInt(0);for(let e=n.length-1;e>=0;e-=1)t=t<<BigInt(8)|BigInt(n[e]);return t}function zi(n,t){let e=new Uint8Array(t);for(let r=0;r<t;r+=1)e[r]=Number(n&BigInt(255)),n>>=BigInt(8);return e}function Ka(n,t){if(t<n.length)throw new Error("Padded size must be greater than or equal to the input array size.");let e=new Uint8Array(t);e.set(n);for(let r=n.length;r<t;r+=1)e[r]=0;return e}function qt(n){if(n.length>Sr.length)throw new Error(`Unable to hash input of length ${n.length}. Max input length is ${Sr.length}`);return Sr[n.length-1](n)}var Un=class extends d{toString(){let t=this.bcsToBytes();return g.fromHexInput(t).toString()}};var $t=1e7,Ga= exports.MAX_AUD_VAL_BYTES =120,ka= exports.MAX_UID_KEY_BYTES =30,Na= exports.MAX_UID_VAL_BYTES =330,_d= exports.MAX_ISS_VAL_BYTES =120,vd= exports.MAX_EXTRA_FIELD_BYTES =350,Pd= exports.MAX_JWT_HEADER_B64_BYTES =300,Cd= exports.MAX_COMMITED_EPK_BYTES =93,ve=class ve extends ie{constructor(e,r){super();let i=g.fromHexInput(r).toUint8Array();if(i.length!==ve.ID_COMMITMENT_LENGTH)throw new Error(`Id Commitment length in bytes should be ${ve.ID_COMMITMENT_LENGTH}`);this.iss=e,this.idCommitment=i}authKey(){let e=new W;return e.serializeU32AsUleb128(3),e.serializeFixedBytes(this.bcsToBytes()),F.fromSchemeAndBytes({scheme:2,input:e.toUint8Array()})}toUint8Array(){return this.bcsToBytes()}toString(){return g.fromHexInput(this.toUint8Array()).toString()}verifySignature(e){throw new Error("Not yet implemented")}serialize(e){e.serializeStr(this.iss),e.serializeBytes(this.idCommitment)}static deserialize(e){let r=e.deserializeStr(),i=e.deserializeBytes();return new ve(r,i)}static load(e){let r=e.deserializeStr(),i=e.deserializeBytes();return new ve(r,i)}static isPublicKey(e){return e instanceof ve}static create(e){return Di(e),new ve(e.iss,Di(e))}};ve.ID_COMMITMENT_LENGTH=32;var ge=ve;function Di(n){let{uidKey:t,uidVal:e,aud:r,pepper:i}=n,o=[Mt(g.fromHexInput(i).toUint8Array()),In(r,Ga),In(e,Na),In(t,ka)];return zi(qt(o),ge.ID_COMMITMENT_LENGTH)}var Je=class n extends G{constructor(e){super();let{jwtHeader:r,ephemeralCertificate:i,expiryDateSecs:o,ephemeralPublicKey:s,ephemeralSignature:a}=e;this.jwtHeader=r,this.ephemeralCertificate=i,this.expiryDateSecs=o,this.ephemeralPublicKey=s,this.ephemeralSignature=a}toUint8Array(){return this.bcsToBytes()}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 r=Ye.deserialize(e),i=e.deserializeStr(),o=e.deserializeU64(),s=ke.deserialize(e),a=ae.deserialize(e);return new n({jwtHeader:i,expiryDateSecs:Number(o),ephemeralCertificate:r,ephemeralPublicKey:s,ephemeralSignature:a})}static load(e){let r=Ye.deserialize(e),i=e.deserializeStr(),o=e.deserializeU64(),s=ke.deserialize(e),a=ae.deserialize(e);return new n({jwtHeader:i,expiryDateSecs:Number(o),ephemeralCertificate:r,ephemeralPublicKey:s,ephemeralSignature:a})}static getSimulationSignature(){return new n({jwtHeader:"{}",ephemeralCertificate:new Ye(new Ce({proof:new et(new yt({a:new Uint8Array(32),b:new Uint8Array(64),c:new Uint8Array(32)}),0)}),0),expiryDateSecs:0,ephemeralPublicKey:new ke(new x(new Uint8Array(32))),ephemeralSignature:new ae(new S(new Uint8Array(64)))})}static isSignature(e){return e instanceof n}},Ye= exports.EphemeralCertificate =class n extends G{constructor(e,r){super();this.signature=e,this.variant=r}toUint8Array(){return this.signature.toUint8Array()}serialize(e){e.serializeU32AsUleb128(this.variant),this.signature.serialize(e)}static deserialize(e){let r=e.deserializeUleb128AsU32();switch(r){case 0:return new n(Ce.deserialize(e),r);default:throw new Error(`Unknown variant index for EphemeralCertificate: ${r}`)}}},Pe=class n extends d{constructor(e){super();if(this.data=g.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 r=e.deserializeFixedBytes(32);return new n(r)}},Ze=class n extends d{constructor(e){super();if(this.data=g.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 r=e.deserializeFixedBytes(64);return new n(r)}},yt= exports.Groth16Zkp =class n extends Un{constructor(e){super();let{a:r,b:i,c:o}=e;this.a=new Pe(r),this.b=new Ze(i),this.c=new Pe(o)}serialize(e){this.a.serialize(e),this.b.serialize(e),this.c.serialize(e)}static deserialize(e){let r=Pe.deserialize(e).bcsToBytes(),i=Ze.deserialize(e).bcsToBytes(),o=Pe.deserialize(e).bcsToBytes();return new n({a:r,b:i,c:o})}},et= exports.ZkProof =class n extends d{constructor(e,r){super();this.proof=e,this.variant=r}serialize(e){e.serializeU32AsUleb128(this.variant),this.proof.serialize(e)}static deserialize(e){let r=e.deserializeUleb128AsU32();switch(r){case 0:return new n(yt.deserialize(e),r);default:throw new Error(`Unknown variant index for ZkProof: ${r}`)}}},Ce= exports.ZeroKnowledgeSig =class n extends G{constructor(e){super();let{proof:r,expHorizonSecs:i=BigInt($t),trainingWheelsSignature:o,extraField:s,overrideAudVal:a}=e;this.proof=r,this.expHorizonSecs=i,this.trainingWheelsSignature=o,this.extraField=s,this.overrideAudVal=a}toUint8Array(){return this.bcsToBytes()}static fromBytes(e){return n.deserialize(new te(e))}serialize(e){this.proof.serialize(e),e.serializeU64(this.expHorizonSecs),e.serializeOptionStr(this.extraField),e.serializeOptionStr(this.overrideAudVal),e.serializeOption(this.trainingWheelsSignature)}static deserialize(e){let r=et.deserialize(e),i=e.deserializeU64(),o=e.deserializeOptionStr(),s=e.deserializeOptionStr(),a=e.deserializeOption(ae);return new n({proof:r,expHorizonSecs:i,trainingWheelsSignature:a,extraField:o,overrideAudVal:s})}static load(e){let r=et.deserialize(e),i=e.deserializeU64(),o=e.deserializeOptionStr(),s=e.deserializeOptionStr(),a=e.deserializeOption(ae);return new n({proof:r,expHorizonSecs:i,trainingWheelsSignature:a,extraField:o,overrideAudVal:s})}},Rn= exports.KeylessConfiguration =class n{constructor(t,e){this.verficationKey=t,this.maxExpHorizonSecs=e}static create(t,e){return new n(new _r({alphaG1:t.alpha_g1,betaG2:t.beta_g2,deltaG2:t.delta_g2,gammaAbcG1:t.gamma_abc_g1,gammaG2:t.gamma_g2}),e)}},_r=class n{constructor(t){let{alphaG1:e,betaG2:r,deltaG2:i,gammaAbcG1:o,gammaG2:s}=t;this.alphaG1=new Pe(e),this.betaG2=new Ze(r),this.deltaG2=new Ze(i),this.gammaAbcG1=[new Pe(o[0]),new Pe(o[1])],this.gammaG2=new Ze(s)}static fromGroth16VerificationKeyResponse(t){return new n({alphaG1:t.alpha_g1,betaG2:t.beta_g2,deltaG2:t.delta_g2,gammaAbcG1:t.gamma_abc_g1,gammaG2:t.gamma_g2})}};var K=class n extends ie{constructor(e){super();if(this.publicKey=e,e instanceof x)this.variant=0;else if(e instanceof he)this.variant=1;else if(e instanceof ge)this.variant=3;else throw new Error("Unsupported public key type")}verifySignature(e){let{message:r,signature:i}=e;return i instanceof k?this.publicKey.verifySignature({message:r,signature:i.signature}):!1}authKey(){return F.fromSchemeAndBytes({scheme:2,input:this.toUint8Array()})}toUint8Array(){return this.bcsToBytes()}serialize(e){e.serializeU32AsUleb128(this.variant),this.publicKey.serialize(e)}static deserialize(e){let r=e.deserializeUleb128AsU32(),i;switch(r){case 0:i=x.deserialize(e);break;case 1:i=he.deserialize(e);break;case 3:i=ge.deserialize(e);break;default:throw new Error(`Unknown variant index for AnyPublicKey: ${r}`)}return new n(i)}static isPublicKey(e){return e instanceof n}isEd25519(){return this.publicKey instanceof x}isSecp256k1PublicKey(){return this.publicKey instanceof he}},k= exports.AnySignature =class n extends G{constructor(e){super();if(this.signature=e,e instanceof S)this.variant=0;else if(e instanceof _e)this.variant=1;else if(e instanceof Je)this.variant=3;else throw new Error("Unsupported signature type")}toUint8Array(){return this.bcsToBytes()}serialize(e){e.serializeU32AsUleb128(this.variant),this.signature.serialize(e)}static deserialize(e){let r=e.deserializeUleb128AsU32(),i;switch(r){case 0:i=S.deserialize(e);break;case 1:i=_e.deserialize(e);break;case 3:i=Je.deserialize(e);break;default:throw new Error(`Unknown variant index for AnySignature: ${r}`)}return new n(i)}};function Ba(n){let t=n;return t-=t>>1&1431655765,t=(t&858993459)+(t>>2&858993459),(t+(t>>4)&252645135)*16843009>>24}var ft=class n extends ie{constructor(e){super();let{publicKeys:r,signaturesRequired:i}=e;if(i<1)throw new Error("The number of required signatures needs to be greater than 0");if(r.length<i)throw new Error(`Provided ${r.length} public keys is smaller than the ${i} required signatures`);this.publicKeys=r.map(o=>o instanceof K?o:new K(o)),this.signaturesRequired=i}verifySignature(e){throw new Error("not implemented")}authKey(){return F.fromSchemeAndBytes({scheme:3,input:this.toUint8Array()})}toUint8Array(){return this.bcsToBytes()}serialize(e){e.serializeVector(this.publicKeys),e.serializeU8(this.signaturesRequired)}static deserialize(e){let r=e.deserializeVector(K),i=e.deserializeU8();return new n({publicKeys:r,signaturesRequired:i})}createBitmap(e){let{bits:r}=e,i=128,o=new Uint8Array([0,0,0,0]),s=new Set;return r.forEach((a,c)=>{if(c+1>this.publicKeys.length)throw new Error(`Signature index ${c+1} is out of public keys range, ${this.publicKeys.length}.`);if(s.has(a))throw new Error(`Duplicate bit ${a} detected.`);s.add(a);let p=Math.floor(a/8),m=o[p];m|=i>>a%8,o[p]=m}),o}getIndex(e){let r=e instanceof K?e:new K(e),i=this.publicKeys.findIndex(o=>o.toString()===r.toString());if(i!==-1)return i;throw new Error("Public key not found in MultiKey")}},Z=class Z extends G{constructor(e){super();let{signatures:r,bitmap:i}=e;if(r.length>Z.MAX_SIGNATURES_SUPPORTED)throw new Error(`The number of signatures cannot be greater than ${Z.MAX_SIGNATURES_SUPPORTED}`);if(this.signatures=r.map(s=>s instanceof k?s:new k(s)),!(i instanceof Uint8Array))this.bitmap=Z.createBitmap({bits:i});else{if(i.length!==Z.BITMAP_LEN)throw new Error(`"bitmap" length should be ${Z.BITMAP_LEN}`);this.bitmap=i}let o=this.bitmap.reduce((s,a)=>s+Ba(a),0);if(o!==this.signatures.length)throw new Error(`Expecting ${o} signatures from the bitmap, but got ${this.signatures.length}`)}static createBitmap(e){let{bits:r}=e,i=128,o=new Uint8Array([0,0,0,0]),s=new Set;return r.forEach(a=>{if(a>=Z.MAX_SIGNATURES_SUPPORTED)throw new Error(`Cannot have a signature larger than ${Z.MAX_SIGNATURES_SUPPORTED-1}.`);if(s.has(a))throw new Error("Duplicate bits detected.");s.add(a);let c=Math.floor(a/8),p=o[c];p|=i>>a%8,o[c]=p}),o}toUint8Array(){return this.bcsToBytes()}serialize(e){e.serializeVector(this.signatures),e.serializeBytes(this.bitmap)}static deserialize(e){let r=e.deserializeVector(k),i=e.deserializeBytes();return new Z({signatures:r,bitmap:i})}};Z.BITMAP_LEN=4,Z.MAX_SIGNATURES_SUPPORTED=Z.BITMAP_LEN*8;var tt=Z;var V=class extends d{static deserialize(t){let e=t.deserializeUleb128AsU32();switch(e){case 0:return me.load(t);case 1:return zn.load(t);case 2:return L.load(t);case 3:return nt.load(t);default:throw new Error(`Unknown variant index for AccountAuthenticator: ${e}`)}}isEd25519(){return this instanceof me}isMultiEd25519(){return this instanceof zn}isSingleKey(){return this instanceof L}isMultiKey(){return this instanceof nt}},me= exports.AccountAuthenticatorEd25519 =class n extends V{constructor(e,r){super();this.public_key=e,this.signature=r}serialize(e){e.serializeU32AsUleb128(0),this.public_key.serialize(e),this.signature.serialize(e)}static load(e){let r=x.deserialize(e),i=S.deserialize(e);return new n(r,i)}},zn= exports.AccountAuthenticatorMultiEd25519 =class n extends V{constructor(e,r){super();this.public_key=e,this.signature=r}serialize(e){e.serializeU32AsUleb128(1),this.public_key.serialize(e),this.signature.serialize(e)}static load(e){let r=gt.deserialize(e),i=We.deserialize(e);return new n(r,i)}},L= exports.AccountAuthenticatorSingleKey =class n extends V{constructor(e,r){super();this.public_key=e,this.signature=r}serialize(e){e.serializeU32AsUleb128(2),this.public_key.serialize(e),this.signature.serialize(e)}static load(e){let r=K.deserialize(e),i=k.deserialize(e);return new n(r,i)}},nt= exports.AccountAuthenticatorMultiKey =class n extends V{constructor(e,r){super();this.public_keys=e,this.signatures=r}serialize(e){e.serializeU32AsUleb128(3),this.public_keys.serialize(e),this.signatures.serialize(e)}static load(e){let r=ft.deserialize(e),i=tt.deserialize(e);return new n(r,i)}};var Vt=(o=>(o.FULLNODE="Fullnode",o.INDEXER="Indexer",o.FAUCET="Faucet",o.PEPPER="Pepper",o.PROVER="Prover",o))(Vt||{}),Ki= exports.DEFAULT_MAX_GAS_AMOUNT =2e5,Gi= exports.DEFAULT_TXN_EXP_SEC_FROM_NOW =20,Dn= exports.DEFAULT_TXN_TIMEOUT_SEC =20,Kn= exports.APTOS_COIN ="0x1::aptos_coin::AptosCoin",ki= exports.RAW_TRANSACTION_SALT ="APTOS::RawTransaction",vr= exports.RAW_TRANSACTION_WITH_DATA_SALT ="APTOS::RawTransactionWithData",rt= exports.ProcessorType =(a=>(a.ACCOUNT_TRANSACTION_PROCESSOR="account_transactions_processor",a.DEFAULT="default_processor",a.EVENTS_PROCESSOR="events_processor",a.FUNGIBLE_ASSET_PROCESSOR="fungible_asset_processor",a.STAKE_PROCESSOR="stake_processor",a.TOKEN_V2_PROCESSOR="token_v2_processor",a.USER_TRANSACTION_PROCESSOR="user_transaction_processor",a))(rt||{});var At=class n extends d{constructor(e){super();this.chainId=e}serialize(e){e.serializeU8(this.chainId)}static deserialize(e){let r=e.deserializeU8();return new n(r)}};var R=class n extends d{constructor(e){super();this.identifier=e}serialize(e){e.serializeStr(this.identifier)}static deserialize(e){let r=e.deserializeStr();return new n(r)}};var Lt=class n extends d{constructor(e,r){super();this.address=e,this.name=r}static fromStr(e){let r=e.split("::");if(r.length!==2)throw new Error("Invalid module id.");return new n(u.fromString(r[0]),new R(r[1]))}serialize(e){this.address.serialize(e),this.name.serialize(e)}static deserialize(e){let r=u.deserialize(e),i=R.deserialize(e);return new n(r,i)}};var z=class extends d{static deserialize(t){let e=t.deserializeUleb128AsU32();switch(e){case 0:return M.load(t);case 1:return Te.load(t);case 2:return j.load(t);case 3:return bt.load(t);case 4:return J.load(t);case 5:return St.load(t);case 6:return v.load(t);case 7:return y.load(t);case 8:return ht.load(t);case 9:return Tt.load(t);case 10:return wt.load(t);case 255:return D.load(t);default:throw new Error(`Unknown variant index for TypeTag: ${e}`)}}isBool(){return this instanceof M}isAddress(){return this instanceof J}isGeneric(){return this instanceof D}isSigner(){return this instanceof St}isVector(){return this instanceof v}isStruct(){return this instanceof y}isU8(){return this instanceof Te}isU16(){return this instanceof ht}isU32(){return this instanceof Tt}isU64(){return this instanceof j}isU128(){return this instanceof bt}isU256(){return this instanceof wt}},M= exports.TypeTagBool =class n extends z{toString(){return"bool"}serialize(t){t.serializeU32AsUleb128(0)}static load(t){return new n}},Te= exports.TypeTagU8 =class n extends z{toString(){return"u8"}serialize(t){t.serializeU32AsUleb128(1)}static load(t){return new n}},ht= exports.TypeTagU16 =class n extends z{toString(){return"u16"}serialize(t){t.serializeU32AsUleb128(8)}static load(t){return new n}},Tt= exports.TypeTagU32 =class n extends z{toString(){return"u32"}serialize(t){t.serializeU32AsUleb128(9)}static load(t){return new n}},j= exports.TypeTagU64 =class n extends z{toString(){return"u64"}serialize(t){t.serializeU32AsUleb128(2)}static load(t){return new n}},bt= exports.TypeTagU128 =class n extends z{toString(){return"u128"}serialize(t){t.serializeU32AsUleb128(3)}static load(t){return new n}},wt= exports.TypeTagU256 =class n extends z{toString(){return"u256"}serialize(t){t.serializeU32AsUleb128(10)}static load(t){return new n}},J= exports.TypeTagAddress =class n extends z{toString(){return"address"}serialize(t){t.serializeU32AsUleb128(4)}static load(t){return new n}},St= exports.TypeTagSigner =class n extends z{toString(){return"signer"}serialize(t){t.serializeU32AsUleb128(5)}static load(t){return new n}},Gn= exports.TypeTagReference =class n extends z{constructor(e){super();this.value=e}toString(){return`&${this.value.toString()}`}serialize(e){e.serializeU32AsUleb128(254)}static load(e){let r=z.deserialize(e);return new n(r)}},D= exports.TypeTagGeneric =class n extends z{constructor(e){super();this.value=e;if(e<0)throw new Error("Generic type parameter index cannot be negative")}toString(){return`T${this.value}`}serialize(e){e.serializeU32AsUleb128(255),e.serializeU32(this.value)}static load(e){let r=e.deserializeU32();return new n(r)}},v= exports.TypeTagVector =class n extends z{constructor(e){super();this.value=e}toString(){return`vector<${this.value.toString()}>`}static u8(){return new n(new Te)}serialize(e){e.serializeU32AsUleb128(6),this.value.serialize(e)}static load(e){let r=z.deserialize(e);return new n(r)}},y= exports.TypeTagStruct =class n extends z{constructor(e){super();this.value=e}toString(){let e="";return this.value.typeArgs.length>0&&(e=`<${this.value.typeArgs.map(r=>r.toString()).join(", ")}>`),`${this.value.address.toString()}::${this.value.moduleName.identifier}::${this.value.name.identifier}${e}`}serialize(e){e.serializeU32AsUleb128(7),this.value.serialize(e)}static load(e){let r=Ee.deserialize(e);return new n(r)}isTypeTag(e,r,i){return this.value.moduleName.identifier===r&&this.value.name.identifier===i&&this.value.address.equals(e)}isString(){return this.isTypeTag(u.ONE,"string","String")}isOption(){return this.isTypeTag(u.ONE,"option","Option")}isObject(){return this.isTypeTag(u.ONE,"object","Object")}},Ee= exports.StructTag =class n extends d{constructor(e,r,i,o){super();this.address=e,this.moduleName=r,this.name=i,this.typeArgs=o}serialize(e){e.serialize(this.address),e.serialize(this.moduleName),e.serialize(this.name),e.serializeVector(this.typeArgs)}static deserialize(e){let r=u.deserialize(e),i=R.deserialize(e),o=R.deserialize(e),s=e.deserializeVector(z);return new n(r,i,o,s)}};function Nl(){return new Ee(u.ONE,new R("aptos_coin"),new R("AptosCoin"),[])}function _(){return new Ee(u.ONE,new R("string"),new R("String"),[])}function Bl(n){return new Ee(u.ONE,new R("option"),new R("Option"),[n])}function ee(n){return new Ee(u.ONE,new R("object"),new R("Object"),[n])}function Oa(n){let t=n.deserializeUleb128AsU32();switch(t){case 0:return B.deserialize(n);case 1:return O.deserialize(n);case 2:return de.deserialize(n);case 3:return u.deserialize(n);case 4:return T.deserialize(n,B);case 5:return E.deserialize(n);case 6:return ne.deserialize(n);case 7:return re.deserialize(n);case 8:return le.deserialize(n);default:throw new Error(`Unknown variant index for ScriptTransactionArgument: ${t}`)}}var it=class extends d{static deserialize(t){let e=t.deserializeUleb128AsU32();switch(e){case 0:return Ht.load(t);case 2:return Qt.load(t);case 3:return Wt.load(t);default:throw new Error(`Unknown variant index for TransactionPayload: ${e}`)}}},Ht= exports.TransactionPayloadScript =class n extends it{constructor(e){super();this.script=e}serialize(e){e.serializeU32AsUleb128(0),this.script.serialize(e)}static load(e){let r=jt.deserialize(e);return new n(r)}},Qt= exports.TransactionPayloadEntryFunction =class n extends it{constructor(e){super();this.entryFunction=e}serialize(e){e.serializeU32AsUleb128(2),this.entryFunction.serialize(e)}static load(e){let r=ot.deserialize(e);return new n(r)}},Wt= exports.TransactionPayloadMultiSig =class n extends it{constructor(e){super();this.multiSig=e}serialize(e){e.serializeU32AsUleb128(3),this.multiSig.serialize(e)}static load(e){let r=Xt.deserialize(e);return new n(r)}},ot= exports.EntryFunction =class n{constructor(t,e,r,i){this.module_name=t,this.function_name=e,this.type_args=r,this.args=i}static build(t,e,r,i){return new n(Lt.fromStr(t),new R(e),r,i)}serialize(t){this.module_name.serialize(t),this.function_name.serialize(t),t.serializeVector(this.type_args),t.serializeU32AsUleb128(this.args.length),this.args.forEach(e=>{e.serializeForEntryFunction(t)})}static deserialize(t){let e=Lt.deserialize(t),r=R.deserialize(t),i=t.deserializeVector(z),o=t.deserializeUleb128AsU32(),s=new Array;for(let a=0;a<o;a+=1){let c=t.deserializeUleb128AsU32(),p=_n.deserialize(t,c);s.push(p)}return new n(e,r,i,s)}},jt= exports.Script =class n{constructor(t,e,r){this.bytecode=t,this.type_args=e,this.args=r}serialize(t){t.serializeBytes(this.bytecode),t.serializeVector(this.type_args),t.serializeU32AsUleb128(this.args.length),this.args.forEach(e=>{e.serializeForScriptFunction(t)})}static deserialize(t){let e=t.deserializeBytes(),r=t.deserializeVector(z),i=t.deserializeUleb128AsU32(),o=new Array;for(let s=0;s<i;s+=1){let a=Oa(t);o.push(a)}return new n(e,r,o)}},Xt= exports.MultiSig =class n{constructor(t,e){this.multisig_address=t,this.transaction_payload=e}serialize(t){this.multisig_address.serialize(t),this.transaction_payload===void 0?t.serializeBool(!1):(t.serializeBool(!0),this.transaction_payload.serialize(t))}static deserialize(t){let e=u.deserialize(t),r=t.deserializeBool(),i;return r&&(i=Yt.deserialize(t)),new n(e,i)}},Yt= exports.MultiSigTransactionPayload =class n extends d{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(ot.deserialize(e))}};var ce=class n extends d{constructor(e,r,i,o,s,a,c){super();this.sender=e,this.sequence_number=r,this.payload=i,this.max_gas_amount=o,this.gas_unit_price=s,this.expiration_timestamp_secs=a,this.chain_id=c}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 r=u.deserialize(e),i=e.deserializeU64(),o=it.deserialize(e),s=e.deserializeU64(),a=e.deserializeU64(),c=e.deserializeU64(),p=At.deserialize(e);return new n(r,i,o,s,a,c,p)}},kn= exports.RawTransactionWithData =class extends d{static deserialize(t){let e=t.deserializeUleb128AsU32();switch(e){case 0:return st.load(t);case 1:return at.load(t);default:throw new Error(`Unknown variant index for RawTransactionWithData: ${e}`)}}},st= exports.MultiAgentRawTransaction =class n extends kn{constructor(e,r){super();this.raw_txn=e,this.secondary_signer_addresses=r}serialize(e){e.serializeU32AsUleb128(0),this.raw_txn.serialize(e),e.serializeVector(this.secondary_signer_addresses)}static load(e){let r=ce.deserialize(e),i=e.deserializeVector(u);return new n(r,i)}},at= exports.FeePayerRawTransaction =class n extends kn{constructor(e,r,i){super();this.raw_txn=e,this.secondary_signer_addresses=r,this.fee_payer_address=i}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 r=ce.deserialize(e),i=e.deserializeVector(u),o=u.deserialize(e);return new n(r,i,o)}};var Nn=class extends d{constructor(e){super();this.accountAddress=u.ONE;this.moduleName=new b("account");this.structName=new b("RotationProofChallenge");this.sequenceNumber=new O(e.sequenceNumber),this.originator=e.originator,this.currentAuthKey=e.currentAuthKey,this.newPublicKey=T.U8(e.newPublicKey.toUint8Array())}serialize(e){e.serialize(this.accountAddress),e.serialize(this.moduleName),e.serialize(this.structName),e.serialize(this.sequenceNumber),e.serialize(this.originator),e.serialize(this.currentAuthKey),e.serialize(this.newPublicKey)}};var Ie=class extends d{static deserialize(t){let e=t.deserializeUleb128AsU32();switch(e){case 0:return xt.load(t);case 1:return Pr.load(t);case 2:return _t.load(t);case 3:return vt.load(t);case 4:return Pt.load(t);default:throw new Error(`Unknown variant index for TransactionAuthenticator: ${e}`)}}},xt= exports.TransactionAuthenticatorEd25519 =class n extends Ie{constructor(e,r){super();this.public_key=e,this.signature=r}serialize(e){e.serializeU32AsUleb128(0),this.public_key.serialize(e),this.signature.serialize(e)}static load(e){let r=x.deserialize(e),i=S.deserialize(e);return new n(r,i)}},Pr= exports.TransactionAuthenticatorMultiEd25519 =class n extends Ie{constructor(e,r){super();this.public_key=e,this.signature=r}serialize(e){e.serializeU32AsUleb128(1),this.public_key.serialize(e),this.signature.serialize(e)}static load(e){let r=gt.deserialize(e),i=We.deserialize(e);return new n(r,i)}},_t= exports.TransactionAuthenticatorMultiAgent =class n extends Ie{constructor(e,r,i){super();this.sender=e,this.secondary_signer_addresses=r,this.secondary_signers=i}serialize(e){e.serializeU32AsUleb128(2),this.sender.serialize(e),e.serializeVector(this.secondary_signer_addresses),e.serializeVector(this.secondary_signers)}static load(e){let r=V.deserialize(e),i=e.deserializeVector(u),o=e.deserializeVector(V);return new n(r,i,o)}},vt= exports.TransactionAuthenticatorFeePayer =class n extends Ie{constructor(e,r,i,o){super();this.sender=e,this.secondary_signer_addresses=r,this.secondary_signers=i,this.fee_payer=o}serialize(e){e.serializeU32AsUleb128(3),this.sender.serialize(e),e.serializeVector(this.secondary_signer_addresses),e.serializeVector(this.secondary_signers),this.fee_payer.address.serialize(e),this.fee_payer.authenticator.serialize(e)}static load(e){let r=V.deserialize(e),i=e.deserializeVector(u),o=e.deserializeVector(V),s=u.deserialize(e),a=V.deserialize(e),c={address:s,authenticator:a};return new n(r,i,o,c)}},Pt= exports.TransactionAuthenticatorSingleSender =class n extends Ie{constructor(e){super();this.sender=e}serialize(e){e.serializeU32AsUleb128(4),this.sender.serialize(e)}static load(e){let r=V.deserialize(e);return new n(r)}};var ct=class n extends d{constructor(e,r){super();this.raw_txn=e,this.authenticator=r}serialize(e){this.raw_txn.serialize(e),this.authenticator.serialize(e)}static deserialize(e){let r=ce.deserialize(e),i=Ie.deserialize(e);return new n(r,i)}};var Bn=class n extends d{constructor(e,r){super();this.rawTransaction=e,this.feePayerAddress=r}serialize(e){this.rawTransaction.serialize(e),this.feePayerAddress===void 0?e.serializeBool(!1):(e.serializeBool(!0),this.feePayerAddress.serialize(e))}static deserialize(e){let r=ce.deserialize(e),i=e.deserializeBool(),o;return i&&(o=u.deserialize(e)),new n(r,o)}};var On=class n extends d{constructor(e,r,i){super();this.rawTransaction=e,this.feePayerAddress=i,this.secondarySignerAddresses=r}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 r=ce.deserialize(e),i=e.deserializeVector(u),o=e.deserializeBool(),s;return o&&(s=u.deserialize(e)),new n(r,i,s)}};function Cr(n){return n.feePayerAddress?new at(n.rawTransaction,_nullishCoalesce(n.secondarySignerAddresses, () => ([])),n.feePayerAddress):n.secondarySignerAddresses?new st(n.rawTransaction,n.secondarySignerAddresses):n.rawTransaction}function Zt(n,t){let e=_sha3.sha3_256.create();if(!t.startsWith("APTOS::"))throw new Error(`Domain separator needs to start with 'APTOS::'. Provided - ${t}`);e.update(t);let r=e.digest(),i=n,o=new Uint8Array(r.length+i.length);return o.set(r),o.set(i,r.length),o}function Ct(n){let t=Cr(n);return n.feePayerAddress?Zt(t.bcsToBytes(),vr):n.secondarySignerAddresses?Zt(t.bcsToBytes(),vr):Zt(t.bcsToBytes(),ki)}var Et=class n{constructor(t){this.signingScheme=0;let{privateKey:e,address:r}=t;this.privateKey=e,this.publicKey=e.publicKey(),this.accountAddress=r?u.from(r):this.publicKey.authKey().derivedAddress()}static generate(){let t=$.generate();return new n({privateKey:t})}static fromDerivationPath(t){let{path:e,mnemonic:r}=t,i=$.fromDerivationPath(e,r);return new n({privateKey:i})}verifySignature(t){return this.publicKey.verifySignature(t)}signWithAuthenticator(t){return new me(this.publicKey,this.privateKey.sign(t))}signTransactionWithAuthenticator(t){return new me(this.publicKey,this.signTransaction(t))}sign(t){return this.privateKey.sign(t)}signTransaction(t){return this.sign(Ct(t))}};var It=class n{constructor(t){this.signingScheme=2;let{privateKey:e,address:r}=t;this.privateKey=e,this.publicKey=new K(e.publicKey()),this.accountAddress=r?u.from(r):this.publicKey.authKey().derivedAddress()}static generate(t={}){let{scheme:e=0}=t,r;switch(e){case 0:r=$.generate();break;case 2:r=Xe.generate();break;default:throw new Error(`Unsupported signature scheme ${e}`)}return new n({privateKey:r})}static fromDerivationPath(t){let{scheme:e=0,path:r,mnemonic:i}=t,o;switch(e){case 0:o=$.fromDerivationPath(r,i);break;case 2:o=Xe.fromDerivationPath(r,i);break;default:throw new Error(`Unsupported signature scheme ${e}`)}return new n({privateKey:o})}verifySignature(t){return this.publicKey.verifySignature(t)}signWithAuthenticator(t){return new L(this.publicKey,this.sign(t))}signTransactionWithAuthenticator(t){return new L(this.publicKey,this.signTransaction(t))}sign(t){return new k(this.privateKey.sign(t))}signTransaction(t){return this.sign(Ct(t))}};var Ne=class{static generate(t={}){let{scheme:e=0,legacy:r=!0}=t;return e===0&&r?Et.generate():It.generate({scheme:e})}static fromPrivateKey(t){let{privateKey:e,address:r,legacy:i=!0}=t;return e instanceof $&&i?new Et({privateKey:e,address:r}):new It({privateKey:e,address:r})}static fromPrivateKeyAndAddress(t){return this.fromPrivateKey(t)}static fromDerivationPath(t){let{scheme:e=0,mnemonic:r,path:i,legacy:o=!0}=t;return e===0&&o?Et.fromDerivationPath({mnemonic:r,path:i}):It.fromDerivationPath({scheme:e,mnemonic:r,path:i})}static authKey(t){let{publicKey:e}=t;return e.authKey()}verifySignature(t){return this.publicKey.verifySignature(t)}};var Ut=class Ut extends d{constructor(e){super();let{privateKey:r,expiryDateSecs:i,blinder:o}=e;this.privateKey=r,this.publicKey=new ke(r.publicKey()),this.expiryDateSecs=i||_chunkVLEH6QBRjs.d.call(void 0, _chunkVLEH6QBRjs.c.call(void 0, )+$t),this.blinder=o!==void 0?g.fromHexInput(o).toUint8Array():qa(),this.nonce=this.generateNonce()}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 r=e.deserializeUleb128AsU32(),i;switch(r){case 0:i=$.deserialize(e);break;default:throw new Error(`Unknown variant index for EphemeralPublicKey: ${r}`)}let o=e.deserializeU64(),s=e.deserializeFixedBytes(31);return new Ut({privateKey:i,expiryDateSecs:Number(o),blinder:s})}static fromBytes(e){return Ut.deserialize(new te(e))}static generate(e){let r;switch(_optionalChain([e, 'optionalAccess', _8 => _8.scheme])){case 0:default:r=$.generate()}return new Ut({privateKey:r,expiryDateSecs:_optionalChain([e, 'optionalAccess', _9 => _9.expiryDateSecs])})}generateNonce(){let e=xr(this.publicKey.bcsToBytes(),93);return e.push(BigInt(this.expiryDateSecs)),e.push(Mt(this.blinder)),qt(e).toString()}sign(e){if(this.isExpired())throw new Error("EphemeralKeyPair has expired");return new ae(this.privateKey.sign(e))}};Ut.BLINDER_LENGTH=31;var Jt=Ut;function qa(){return _utils.randomBytes.call(void 0, Jt.BLINDER_LENGTH)}var _jwtdecode = require('jwt-decode');var _eventemitter3 = require('eventemitter3'); var _eventemitter32 = _interopRequireDefault(_eventemitter3);var Fn=class extends d{hash(){return Zt(this.bcsToBytes(),this.domainSeparator)}};var ry={"https://accounts.google.com":"https://www.googleapis.com/oauth2/v3/certs"},La= exports.KeylessErrorType =(o=>(o[o.JWK_EXPIRED=0]="JWK_EXPIRED",o[o.EPK_EXPIRED=1]="EPK_EXPIRED",o[o.PROOF_NOT_FOUND=2]="PROOF_NOT_FOUND",o[o.UNKNOWN_INVALID_SIGNATURE=3]="UNKNOWN_INVALID_SIGNATURE",o[o.UNKNOWN=4]="UNKNOWN",o))(La||{}),en= exports.KeylessError =class n extends Error{constructor(e){super();this.type=e}static async fromAptosApiError(e,r){return e.data.message.includes("INVALID_SIGNATURE")?r.isExpired()?new n(1):new n(3):new n(4)}},Be=class Be extends d{constructor(e){super();let{address:r,ephemeralKeyPair:i,uidKey:o,uidVal:s,aud:a,pepper:c,proofOrFetcher:p,proofFetchCallback:m,jwt:P}=e;if(this.ephemeralKeyPair=i,this.publicKey=ge.create(e),this.accountAddress=r?u.from(r):this.publicKey.authKey().derivedAddress(),this.uidKey=o,this.uidVal=s,this.aud=a,this.jwt=P,this.emitter=new _eventemitter32.default,this.proofOrPromise=p,p instanceof Ce)this.proof=p;else{if(m===void 0)throw new Error("Must provide callback for async proof fetch");this.emitter.on("proofFetchFinish",async l=>{await m(l),this.emitter.removeAllListeners()}),this.init(p)}this.signingScheme=2;let U=g.fromHexInput(c).toUint8Array();if(U.length!==Be.PEPPER_LENGTH)throw new Error(`Pepper length in bytes should be ${Be.PEPPER_LENGTH}`);this.pepper=U,this.isJwtValid=!0}async init(e){try{this.proof=await e,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(e){if(e.serializeStr(this.jwt),e.serializeStr(this.uidKey),e.serializeFixedBytes(this.pepper),this.ephemeralKeyPair.serialize(e),this.proof===void 0)throw new Error("Connot serialize - proof undefined");this.proof.serialize(e)}static deserialize(e){let r=e.deserializeStr(),i=e.deserializeStr(),o=e.deserializeFixedBytes(31),s=Jt.deserialize(e),a=Ce.deserialize(e);return Be.fromJWTAndProof({proof:a,pepper:o,uidKey:i,jwt:r,ephemeralKeyPair:s})}isExpired(){return this.ephemeralKeyPair.isExpired()}signWithAuthenticator(e){let r=new k(this.sign(e)),i=new K(this.publicKey);return new L(i,r)}signTransactionWithAuthenticator(e){let r=new k(this.signTransaction(e)),i=new K(this.publicKey);return new L(i,r)}async waitForProofFetch(){this.proofOrPromise instanceof Promise&&await this.proofOrPromise}sign(e){let{expiryDateSecs:r}=this.ephemeralKeyPair;if(this.isExpired())throw new en(1);if(this.proof===void 0)throw new en(2);if(!this.isJwtValid)throw new en(0);let i=this.ephemeralKeyPair.getPublicKey(),o=this.ephemeralKeyPair.sign(e);return new Je({jwtHeader:_chunkVLEH6QBRjs.e.call(void 0, this.jwt.split(".")[0]),ephemeralCertificate:new Ye(this.proof,0),expiryDateSecs:r,ephemeralPublicKey:i,ephemeralSignature:o})}signTransaction(e){if(this.proof===void 0)throw new Error("Proof not found");let r=Cr(e),o=new Er(r,this.proof.proof).hash();return this.sign(o)}verifySignature(e){throw new Error("Not implemented")}static fromBytes(e){return Be.deserialize(new te(e))}static fromJWTAndProof(e){let{proof:r,jwt:i,ephemeralKeyPair:o,pepper:s,proofFetchCallback:a}=e,c=_nullishCoalesce(e.uidKey, () => ("sub")),p=_jwtdecode.jwtDecode.call(void 0, i),m=p.iss;if(typeof p.aud!="string")throw new Error("aud was not found or an array of values");let P=p.aud,U=p[c];return new Be({proofOrFetcher:r,ephemeralKeyPair:o,iss:m,uidKey:c,uidVal:U,aud:P,pepper:s,jwt:i,proofFetchCallback:a})}};Be.PEPPER_LENGTH=31;var be=Be,Er= exports.TransactionAndProof =class extends Fn{constructor(e,r){super();this.transaction=e,this.proof=r,this.domainSeparator="APTOS::TransactionAndProof"}serialize(e){e.serializeFixedBytes(this.transaction.bcsToBytes()),e.serializeOption(this.proof)}};var Mn=class n{constructor(t){let{multiKey:e,signers:r}=t;this.publicKey=e,this.signingScheme=3,this.accountAddress=this.publicKey.authKey().derivedAddress();let i=[];for(let s of r)i.push(this.publicKey.getIndex(s.publicKey));let o=r.map((s,a)=>[s,i[a]]);o.sort((s,a)=>s[1]-a[1]),this.signers=o.map(s=>s[0]),this.signerIndicies=o.map(s=>s[1]),this.signaturesBitmap=this.publicKey.createBitmap({bits:i})}static fromPublicKeysAndSigners(t){let{publicKeys:e,signaturesRequired:r,signers:i}=t,o=new ft({publicKeys:e,signaturesRequired:r});return new n({multiKey:o,signers:i})}static isMultiKeySigner(t){return t instanceof n}signWithAuthenticator(t){return new nt(this.publicKey,this.sign(t))}signTransactionWithAuthenticator(t){return new nt(this.publicKey,this.signTransaction(t))}async waitForProofFetch(){let t=this.signers.filter(e=>e instanceof be);await Promise.all(t.filter(e=>e.proof instanceof Promise).map(e=>e.proof))}sign(t){let e=[];for(let r of this.signers)e.push(r.sign(t));return new tt({signatures:e,bitmap:this.signaturesBitmap})}signTransaction(t){let e=[];for(let r of this.signers)e.push(r.signTransaction(t));return new tt({signatures:e,bitmap:this.signaturesBitmap})}verifySignature(t){let{message:e,signature:r}=t;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:e,signature:s}))return!1}return!0}};var ye=class extends Error{constructor(e,r,i){super(i);this.name="AptosApiError",this.url=r.url,this.status=r.status,this.statusText=r.statusText,this.data=r.data,this.request=e}};var Ni="1.16.0-zeta.1";var Bi={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"},Oi= 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"},Fi= exports.NetworkToFaucetAPI ={mainnet:"https://faucet.mainnet.aptoslabs.com",testnet:"https://faucet.testnet.aptoslabs.com",devnet:"https://faucet.devnet.aptoslabs.com",local:"http://127.0.0.1:8081"},Ir= 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"},Ur= 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"},Rr= exports.Network =(o=>(o.MAINNET="mainnet",o.TESTNET="testnet",o.DEVNET="devnet",o.LOCAL="local",o.CUSTOM="custom",o))(Rr||{}),zr= exports.NetworkToChainId ={mainnet:1,testnet:2,local:4},wy= exports.NetworkToNetworkName ={mainnet:"mainnet",testnet:"testnet",devnet:"devnet",local:"local",custom:"custom"};function Mi(n,t){let e=t.bcsToBytes(),r=new te(e);return n.deserialize(r)}var qi={400:"Bad Request",401:"Unauthorized",403:"Forbidden",404:"Not Found",429:"Too Many Requests",500:"Internal Server Error",502:"Bad Gateway",503:"Service Unavailable"};async function Ha(n,t){let{url:e,method:r,body:i,contentType:o,params:s,overrides:a,originMethod:c}=n,p={..._optionalChain([a, 'optionalAccess', _10 => _10.HEADERS]),"x-aptos-client":`aptos-typescript-sdk/${Ni}`,"content-type":_nullishCoalesce(o, () => ("application/json")),"x-aptos-typescript-sdk-origin-method":c};return _optionalChain([a, 'optionalAccess', _11 => _11.AUTH_TOKEN])&&(p.Authorization=`Bearer ${_optionalChain([a, 'optionalAccess', _12 => _12.AUTH_TOKEN])}`),_optionalChain([a, 'optionalAccess', _13 => _13.API_KEY])&&(p.Authorization=`Bearer ${_optionalChain([a, 'optionalAccess', _14 => _14.API_KEY])}`),t.provider({url:e,method:r,body:i,params:s,headers:p,overrides:a})}async function qn(n,t,e){let{url:r,path:i}=n,o=i?`${r}/${i}`:r,s=await Ha({...n,url:o},t.client),a={status:s.status,statusText:s.statusText,data:s.data,headers:s.headers,config:s.config,request:s.request,url:o};if(a.status===401)throw new ye(n,a,`Error: ${a.data}`);if(e==="Indexer"){let p=a.data;if(p.errors)throw new ye(n,a,_nullishCoalesce(`Indexer error: ${p.errors[0].message}`, () => (`Indexer unhandled Error ${s.status} : ${s.statusText}`)));a.data=p.data}else if((e==="Pepper"||e==="Prover")&&a.status>=500)throw new ye(n,a,`${s.data}`);if(a.status>=200&&a.status<300)return a;let c;throw a&&a.data&&"message"in a.data&&"error_code"in a.data?c=JSON.stringify(a.data):a.status in qi?c=qi[a.status]:c=`Unhandled Error ${a.status} : ${a.statusText}`,new ye(n,a,`${e} error: ${c}`)}async function Dr(n){let{aptosConfig:t,overrides:e,params:r,contentType:i,acceptType:o,path:s,originMethod:a,type:c}=n,p=t.getRequestUrl(c);return qn({url:p,method:"GET",originMethod:a,path:s,contentType:i,acceptType:o,params:r,overrides:{...t.clientConfig,...e}},t,n.type)}async function q(n){let{aptosConfig:t}=n;return Dr({...n,type:"Fullnode",overrides:{...t.clientConfig,...t.fullnodeConfig,...n.overrides,HEADERS:{..._optionalChain([t, 'access', _15 => _15.clientConfig, 'optionalAccess', _16 => _16.HEADERS]),..._optionalChain([t, 'access', _17 => _17.fullnodeConfig, 'optionalAccess', _18 => _18.HEADERS])}}})}async function $y(n){return Dr({...n,type:"Pepper"})}async function Rt(n){let t=[],e,r=n.params;do{let i=await Dr({type:"Fullnode",aptosConfig:n.aptosConfig,originMethod:n.originMethod,path:n.path,params:r,overrides:n.overrides});e=i.headers["x-aptos-cursor"],delete i.headers,t.push(...i.data),r.start=e}while(e!=null);return t}async function tn(n){let{type:t,originMethod:e,path:r,body:i,acceptType:o,contentType:s,params:a,aptosConfig:c,overrides:p}=n,m=c.getRequestUrl(t);return qn({url:m,method:"POST",originMethod:e,path:r,body:i,contentType:s,acceptType:o,params:a,overrides:p},c,n.type)}async function ut(n){let{aptosConfig:t}=n;return tn({...n,type:"Fullnode",overrides:{...t.clientConfig,...t.fullnodeConfig,...n.overrides,HEADERS:{..._optionalChain([t, 'access', _19 => _19.clientConfig, 'optionalAccess', _20 => _20.HEADERS]),..._optionalChain([t, 'access', _21 => _21.fullnodeConfig, 'optionalAccess', _22 => _22.HEADERS])}}})}async function $i(n){let{aptosConfig:t}=n;return tn({...n,type:"Indexer",overrides:{...t.clientConfig,...t.indexerConfig,...n.overrides,HEADERS:{..._optionalChain([t, 'access', _23 => _23.clientConfig, 'optionalAccess', _24 => _24.HEADERS]),..._optionalChain([t, 'access', _25 => _25.indexerConfig, 'optionalAccess', _26 => _26.HEADERS])}}})}async function Vi(n){let{aptosConfig:t}=n,e={...t,clientConfig:{...t.clientConfig}};return _optionalChainDelete([e, 'optionalAccess', _27 => _27.clientConfig, 'optionalAccess', _28 => delete _28.API_KEY]),tn({...n,type:"Faucet",overrides:{...e.clientConfig,...e.faucetConfig,...n.overrides,HEADERS:{..._optionalChain([e, 'access', _29 => _29.clientConfig, 'optionalAccess', _30 => _30.HEADERS]),..._optionalChain([e, 'access', _31 => _31.faucetConfig, 'optionalAccess', _32 => _32.HEADERS])}}})}async function Li(n){return tn({...n,type:"Pepper"})}async function Hi(n){return tn({...n,type:"Prover"})}var Qa=`
|
|
2
2
|
fragment TokenActivitiesFields on token_activities_v2 {
|
|
3
3
|
after_value
|
|
4
4
|
before_value
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
transaction_version
|
|
17
17
|
type
|
|
18
18
|
}
|
|
19
|
-
`,
|
|
19
|
+
`,Wa=`
|
|
20
20
|
fragment AnsTokenFragment on current_aptos_names {
|
|
21
21
|
domain
|
|
22
22
|
expiration_timestamp
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
is_primary
|
|
27
27
|
owner_address
|
|
28
28
|
}
|
|
29
|
-
|
|
29
|
+
`,$n=`
|
|
30
30
|
fragment CurrentTokenOwnershipFields on current_token_ownerships_v2 {
|
|
31
31
|
token_standard
|
|
32
32
|
token_properties_mutated_v1
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
75
|
}
|
|
76
|
-
`,
|
|
76
|
+
`,Qi=`
|
|
77
77
|
query getAccountCoinsCount($address: String) {
|
|
78
78
|
current_fungible_asset_balances_aggregate(
|
|
79
79
|
where: {owner_address: {_eq: $address}}
|
|
@@ -83,7 +83,7 @@
|
|
|
83
83
|
}
|
|
84
84
|
}
|
|
85
85
|
}
|
|
86
|
-
`,
|
|
86
|
+
`,Wi=`
|
|
87
87
|
query getAccountCoinsData($where_condition: current_fungible_asset_balances_bool_exp!, $offset: Int, $limit: Int, $order_by: [current_fungible_asset_balances_order_by!]) {
|
|
88
88
|
current_fungible_asset_balances(
|
|
89
89
|
where: $where_condition
|
|
@@ -116,7 +116,7 @@
|
|
|
116
116
|
}
|
|
117
117
|
}
|
|
118
118
|
}
|
|
119
|
-
`,
|
|
119
|
+
`,ji=`
|
|
120
120
|
query getAccountCollectionsWithOwnedTokens($where_condition: current_collection_ownership_v2_view_bool_exp!, $offset: Int, $limit: Int, $order_by: [current_collection_ownership_v2_view_order_by!]) {
|
|
121
121
|
current_collection_ownership_v2_view(
|
|
122
122
|
where: $where_condition
|
|
@@ -150,7 +150,7 @@
|
|
|
150
150
|
single_token_uri
|
|
151
151
|
}
|
|
152
152
|
}
|
|
153
|
-
`,
|
|
153
|
+
`,Xi=`
|
|
154
154
|
query getAccountOwnedObjects($where_condition: current_objects_bool_exp, $offset: Int, $limit: Int, $order_by: [current_objects_order_by!]) {
|
|
155
155
|
current_objects(
|
|
156
156
|
where: $where_condition
|
|
@@ -167,7 +167,7 @@
|
|
|
167
167
|
is_deleted
|
|
168
168
|
}
|
|
169
169
|
}
|
|
170
|
-
`,
|
|
170
|
+
`,Yi=`
|
|
171
171
|
query getAccountOwnedTokens($where_condition: current_token_ownerships_v2_bool_exp!, $offset: Int, $limit: Int, $order_by: [current_token_ownerships_v2_order_by!]) {
|
|
172
172
|
current_token_ownerships_v2(
|
|
173
173
|
where: $where_condition
|
|
@@ -178,7 +178,7 @@
|
|
|
178
178
|
...CurrentTokenOwnershipFields
|
|
179
179
|
}
|
|
180
180
|
}
|
|
181
|
-
${
|
|
181
|
+
${$n}`,Jy=`
|
|
182
182
|
query getAccountOwnedTokensByTokenData($where_condition: current_token_ownerships_v2_bool_exp!, $offset: Int, $limit: Int, $order_by: [current_token_ownerships_v2_order_by!]) {
|
|
183
183
|
current_token_ownerships_v2(
|
|
184
184
|
where: $where_condition
|
|
@@ -189,7 +189,7 @@
|
|
|
189
189
|
...CurrentTokenOwnershipFields
|
|
190
190
|
}
|
|
191
191
|
}
|
|
192
|
-
${
|
|
192
|
+
${$n}`,Zi=`
|
|
193
193
|
query getAccountOwnedTokensFromCollection($where_condition: current_token_ownerships_v2_bool_exp!, $offset: Int, $limit: Int, $order_by: [current_token_ownerships_v2_order_by!]) {
|
|
194
194
|
current_token_ownerships_v2(
|
|
195
195
|
where: $where_condition
|
|
@@ -200,7 +200,7 @@
|
|
|
200
200
|
...CurrentTokenOwnershipFields
|
|
201
201
|
}
|
|
202
202
|
}
|
|
203
|
-
${
|
|
203
|
+
${$n}`,Ji=`
|
|
204
204
|
query getAccountTokensCount($where_condition: current_token_ownerships_v2_bool_exp, $offset: Int, $limit: Int) {
|
|
205
205
|
current_token_ownerships_v2_aggregate(
|
|
206
206
|
where: $where_condition
|
|
@@ -212,7 +212,7 @@
|
|
|
212
212
|
}
|
|
213
213
|
}
|
|
214
214
|
}
|
|
215
|
-
`,
|
|
215
|
+
`,eo=`
|
|
216
216
|
query getAccountTransactionsCount($address: String) {
|
|
217
217
|
account_transactions_aggregate(where: {account_address: {_eq: $address}}) {
|
|
218
218
|
aggregate {
|
|
@@ -220,13 +220,13 @@
|
|
|
220
220
|
}
|
|
221
221
|
}
|
|
222
222
|
}
|
|
223
|
-
`,
|
|
223
|
+
`,to=`
|
|
224
224
|
query getChainTopUserTransactions($limit: Int) {
|
|
225
225
|
user_transactions(limit: $limit, order_by: {version: desc}) {
|
|
226
226
|
version
|
|
227
227
|
}
|
|
228
228
|
}
|
|
229
|
-
`,
|
|
229
|
+
`,Kr=`
|
|
230
230
|
query getCollectionData($where_condition: current_collections_v2_bool_exp!) {
|
|
231
231
|
current_collections_v2(where: $where_condition) {
|
|
232
232
|
collection_id
|
|
@@ -245,7 +245,7 @@
|
|
|
245
245
|
uri
|
|
246
246
|
}
|
|
247
247
|
}
|
|
248
|
-
`,
|
|
248
|
+
`,no=`
|
|
249
249
|
query getCurrentFungibleAssetBalances($where_condition: current_fungible_asset_balances_bool_exp, $offset: Int, $limit: Int) {
|
|
250
250
|
current_fungible_asset_balances(
|
|
251
251
|
where: $where_condition
|
|
@@ -263,7 +263,7 @@
|
|
|
263
263
|
token_standard
|
|
264
264
|
}
|
|
265
265
|
}
|
|
266
|
-
`,
|
|
266
|
+
`,ro=`
|
|
267
267
|
query getDelegatedStakingActivities($delegatorAddress: String, $poolAddress: String) {
|
|
268
268
|
delegated_staking_activities(
|
|
269
269
|
where: {delegator_address: {_eq: $delegatorAddress}, pool_address: {_eq: $poolAddress}}
|
|
@@ -276,7 +276,7 @@
|
|
|
276
276
|
transaction_version
|
|
277
277
|
}
|
|
278
278
|
}
|
|
279
|
-
`,
|
|
279
|
+
`,io=`
|
|
280
280
|
query getEvents($where_condition: events_bool_exp, $offset: Int, $limit: Int, $order_by: [events_order_by!]) {
|
|
281
281
|
events(
|
|
282
282
|
where: $where_condition
|
|
@@ -295,7 +295,7 @@
|
|
|
295
295
|
indexed_type
|
|
296
296
|
}
|
|
297
297
|
}
|
|
298
|
-
`,
|
|
298
|
+
`,oo=`
|
|
299
299
|
query getFungibleAssetActivities($where_condition: fungible_asset_activities_bool_exp, $offset: Int, $limit: Int) {
|
|
300
300
|
fungible_asset_activities(
|
|
301
301
|
where: $where_condition
|
|
@@ -320,7 +320,7 @@
|
|
|
320
320
|
type
|
|
321
321
|
}
|
|
322
322
|
}
|
|
323
|
-
`,
|
|
323
|
+
`,so=`
|
|
324
324
|
query getFungibleAssetMetadata($where_condition: fungible_asset_metadata_bool_exp, $offset: Int, $limit: Int) {
|
|
325
325
|
fungible_asset_metadata(where: $where_condition, offset: $offset, limit: $limit) {
|
|
326
326
|
icon_uri
|
|
@@ -337,7 +337,7 @@
|
|
|
337
337
|
token_standard
|
|
338
338
|
}
|
|
339
339
|
}
|
|
340
|
-
`,
|
|
340
|
+
`,zt=`
|
|
341
341
|
query getNames($offset: Int, $limit: Int, $where_condition: current_aptos_names_bool_exp, $order_by: [current_aptos_names_order_by!]) {
|
|
342
342
|
current_aptos_names(
|
|
343
343
|
limit: $limit
|
|
@@ -348,14 +348,14 @@
|
|
|
348
348
|
...AnsTokenFragment
|
|
349
349
|
}
|
|
350
350
|
}
|
|
351
|
-
${
|
|
351
|
+
${Wa}`,Gr=`
|
|
352
352
|
query getNumberOfDelegators($where_condition: num_active_delegator_per_pool_bool_exp, $order_by: [num_active_delegator_per_pool_order_by!]) {
|
|
353
353
|
num_active_delegator_per_pool(where: $where_condition, order_by: $order_by) {
|
|
354
354
|
num_active_delegator
|
|
355
355
|
pool_address
|
|
356
356
|
}
|
|
357
357
|
}
|
|
358
|
-
`,
|
|
358
|
+
`,kr=`
|
|
359
359
|
query getProcessorStatus($where_condition: processor_status_bool_exp) {
|
|
360
360
|
processor_status(where: $where_condition) {
|
|
361
361
|
last_success_version
|
|
@@ -363,7 +363,7 @@
|
|
|
363
363
|
last_updated
|
|
364
364
|
}
|
|
365
365
|
}
|
|
366
|
-
`,
|
|
366
|
+
`,ao=`
|
|
367
367
|
query getTableItemsData($where_condition: table_items_bool_exp!, $offset: Int, $limit: Int, $order_by: [table_items_order_by!]) {
|
|
368
368
|
table_items(
|
|
369
369
|
where: $where_condition
|
|
@@ -379,7 +379,7 @@
|
|
|
379
379
|
write_set_change_index
|
|
380
380
|
}
|
|
381
381
|
}
|
|
382
|
-
`,
|
|
382
|
+
`,co=`
|
|
383
383
|
query getTableItemsMetadata($where_condition: table_metadatas_bool_exp!, $offset: Int, $limit: Int, $order_by: [table_metadatas_order_by!]) {
|
|
384
384
|
table_metadatas(
|
|
385
385
|
where: $where_condition
|
|
@@ -392,7 +392,7 @@
|
|
|
392
392
|
value_type
|
|
393
393
|
}
|
|
394
394
|
}
|
|
395
|
-
`,
|
|
395
|
+
`,uo=`
|
|
396
396
|
query getTokenActivity($where_condition: token_activities_v2_bool_exp!, $offset: Int, $limit: Int, $order_by: [token_activities_v2_order_by!]) {
|
|
397
397
|
token_activities_v2(
|
|
398
398
|
where: $where_condition
|
|
@@ -403,7 +403,7 @@
|
|
|
403
403
|
...TokenActivitiesFields
|
|
404
404
|
}
|
|
405
405
|
}
|
|
406
|
-
${
|
|
406
|
+
${Qa}`,Nr=`
|
|
407
407
|
query getCurrentTokenOwnership($where_condition: current_token_ownerships_v2_bool_exp!, $offset: Int, $limit: Int, $order_by: [current_token_ownerships_v2_order_by!]) {
|
|
408
408
|
current_token_ownerships_v2(
|
|
409
409
|
where: $where_condition
|
|
@@ -414,7 +414,7 @@
|
|
|
414
414
|
...CurrentTokenOwnershipFields
|
|
415
415
|
}
|
|
416
416
|
}
|
|
417
|
-
${
|
|
417
|
+
${$n}`,po=`
|
|
418
418
|
query getTokenData($where_condition: current_token_datas_v2_bool_exp, $offset: Int, $limit: Int, $order_by: [current_token_datas_v2_order_by!]) {
|
|
419
419
|
current_token_datas_v2(
|
|
420
420
|
where: $where_condition
|
|
@@ -454,5 +454,5 @@
|
|
|
454
454
|
}
|
|
455
455
|
}
|
|
456
456
|
}
|
|
457
|
-
`;async function fn(n){let{aptosConfig:e}=n,{data:t}=await W({aptosConfig:e,originMethod:"getLedgerInfo",path:""});return t}async function wo(n){let{aptosConfig:e,ledgerVersion:t,options:r}=n,{data:o}=await W({aptosConfig:e,originMethod:"getBlockByVersion",path:`blocks/by_version/${t}`,params:{with_transactions:_optionalChain([r, 'optionalAccess', _31 => _31.withTransactions])}});return o}async function _o(n){let{aptosConfig:e,blockHeight:t,options:r}=n,{data:o}=await W({aptosConfig:e,originMethod:"getBlockByHeight",path:`blocks/by_height/${t}`,params:{with_transactions:_optionalChain([r, 'optionalAccess', _32 => _32.withTransactions])}});return o}async function So(n){let{aptosConfig:e,limit:t}=n;return(await m({aptosConfig:e,query:{query:po,variables:{limit:t}},originMethod:"getChainTopUserTransactions"})).user_transactions}async function m(n){let{aptosConfig:e,query:t,originMethod:r}=n,{data:o}=await eo({aptosConfig:e,originMethod:_nullishCoalesce(r, () => ("queryIndexer")),path:"",body:t,overrides:{WITH_CREDENTIALS:!1}});return o}async function Ps(n){let{aptosConfig:e}=n;return(await m({aptosConfig:e,query:{query:Zn},originMethod:"getProcessorStatuses"})).processor_status}async function hn(n){let e=await Ps({aptosConfig:n.aptosConfig});return BigInt(e[0].last_success_version)}async function Tn(n){let{aptosConfig:e,processorType:t}=n;return(await m({aptosConfig:e,query:{query:Zn,variables:{where_condition:{processor:{_eq:t}}}},originMethod:"getProcessorStatus"})).processor_status[0]}var er=new Map;function yt(n,e,t){return async(...r)=>{if(er.has(e)){let{value:i,timestamp:s}=er.get(e);if(t===void 0||Date.now()-s<=t)return i}let o=await n(...r);return er.set(e,{value:o,timestamp:Date.now()}),o}}async function bn(n){let{aptosConfig:e,handle:t,data:r,options:o}=n;return(await We({aptosConfig:e,originMethod:"getTableItem",path:`tables/${t}/item`,params:{ledger_version:_optionalChain([o, 'optionalAccess', _33 => _33.ledgerVersion])},body:r})).data}async function xo(n){let{aptosConfig:e,options:t}=n,r={query:fo,variables:{where_condition:_optionalChain([t, 'optionalAccess', _34 => _34.where]),offset:_optionalChain([t, 'optionalAccess', _35 => _35.offset]),limit:_optionalChain([t, 'optionalAccess', _36 => _36.limit]),order_by:_optionalChain([t, 'optionalAccess', _37 => _37.orderBy])}};return(await m({aptosConfig:e,query:r,originMethod:"getTableItemsData"})).table_items}async function vo(n){let{aptosConfig:e,options:t}=n,r={query:ho,variables:{where_condition:_optionalChain([t, 'optionalAccess', _38 => _38.where]),offset:_optionalChain([t, 'optionalAccess', _39 => _39.offset]),limit:_optionalChain([t, 'optionalAccess', _40 => _40.limit]),order_by:_optionalChain([t, 'optionalAccess', _41 => _41.orderBy])}};return(await m({aptosConfig:e,query:r,originMethod:"getTableItemsMetadata"})).table_metadatas}async function me(n){let{aptosConfig:e,accountAddress:t}=n,{data:r}=await W({aptosConfig:e,originMethod:"getInfo",path:`accounts/${u.from(t).toString()}`});return r}async function Io(n){let{aptosConfig:e,accountAddress:t,options:r}=n;return gt({aptosConfig:e,originMethod:"getModules",path:`accounts/${u.from(t).toString()}/modules`,params:{ledger_version:_optionalChain([r, 'optionalAccess', _42 => _42.ledgerVersion]),start:_optionalChain([r, 'optionalAccess', _43 => _43.offset]),limit:_nullishCoalesce(_optionalChain([r, 'optionalAccess', _44 => _44.limit]), () => (1e3))}})}async function wn(n){return _optionalChain([n, 'access', _45 => _45.options, 'optionalAccess', _46 => _46.ledgerVersion])!==void 0?Co(n):yt(async()=>Co(n),`module-${n.accountAddress}-${n.moduleName}`,1e3*60*5)()}async function Co(n){let{aptosConfig:e,accountAddress:t,moduleName:r,options:o}=n,{data:i}=await W({aptosConfig:e,originMethod:"getModule",path:`accounts/${u.from(t).toString()}/module/${r}`,params:{ledger_version:_optionalChain([o, 'optionalAccess', _47 => _47.ledgerVersion])}});return i}async function Eo(n){let{aptosConfig:e,accountAddress:t,options:r}=n;return gt({aptosConfig:e,originMethod:"getTransactions",path:`accounts/${u.from(t).toString()}/transactions`,params:{start:_optionalChain([r, 'optionalAccess', _48 => _48.offset]),limit:_optionalChain([r, 'optionalAccess', _49 => _49.limit])}})}async function Uo(n){let{aptosConfig:e,accountAddress:t,options:r}=n;return gt({aptosConfig:e,originMethod:"getResources",path:`accounts/${u.from(t).toString()}/resources`,params:{ledger_version:_optionalChain([r, 'optionalAccess', _50 => _50.ledgerVersion]),start:_optionalChain([r, 'optionalAccess', _51 => _51.offset]),limit:_nullishCoalesce(_optionalChain([r, 'optionalAccess', _52 => _52.limit]), () => (999))}})}async function tr(n){let{aptosConfig:e,accountAddress:t,resourceType:r,options:o}=n,{data:i}=await W({aptosConfig:e,originMethod:"getResource",path:`accounts/${u.from(t).toString()}/resource/${r}`,params:{ledger_version:_optionalChain([o, 'optionalAccess', _53 => _53.ledgerVersion])}});return i.data}async function nr(n){let{aptosConfig:e,authenticationKey:t,options:r}=n,o=await tr({aptosConfig:e,accountAddress:"0x1",resourceType:"0x1::account::OriginatingAddress",options:r}),{address_map:{handle:i}}=o,s=u.from(t);try{let a=await bn({aptosConfig:e,handle:i,data:{key:s.toString(),key_type:"address",value_type:"address"},options:r});return u.from(a)}catch(a){if(a instanceof ge&&a.data.error_code==="table_item_not_found")return s;throw a}}async function Ro(n){let{aptosConfig:e,accountAddress:t}=n,o={owner_address:{_eq:u.from(t).toStringLong()},amount:{_gt:0}},s=await m({aptosConfig:e,query:{query:co,variables:{where_condition:o}},originMethod:"getAccountTokensCount"});return s.current_token_ownerships_v2_aggregate.aggregate?s.current_token_ownerships_v2_aggregate.aggregate.count:0}async function zo(n){let{aptosConfig:e,accountAddress:t,options:r}=n,i={owner_address:{_eq:u.from(t).toStringLong()},amount:{_gt:0}};_optionalChain([r, 'optionalAccess', _54 => _54.tokenStandard])&&(i.token_standard={_eq:_optionalChain([r, 'optionalAccess', _55 => _55.tokenStandard])});let s={query:so,variables:{where_condition:i,offset:_optionalChain([r, 'optionalAccess', _56 => _56.offset]),limit:_optionalChain([r, 'optionalAccess', _57 => _57.limit]),order_by:_optionalChain([r, 'optionalAccess', _58 => _58.orderBy])}};return(await m({aptosConfig:e,query:s,originMethod:"getAccountOwnedTokens"})).current_token_ownerships_v2}async function Go(n){let{aptosConfig:e,accountAddress:t,collectionAddress:r,options:o}=n,i=u.from(t).toStringLong(),s=u.from(r).toStringLong(),a={owner_address:{_eq:i},current_token_data:{collection_id:{_eq:s}},amount:{_gt:0}};_optionalChain([o, 'optionalAccess', _59 => _59.tokenStandard])&&(a.token_standard={_eq:_optionalChain([o, 'optionalAccess', _60 => _60.tokenStandard])});let c={query:ao,variables:{where_condition:a,offset:_optionalChain([o, 'optionalAccess', _61 => _61.offset]),limit:_optionalChain([o, 'optionalAccess', _62 => _62.limit]),order_by:_optionalChain([o, 'optionalAccess', _63 => _63.orderBy])}};return(await m({aptosConfig:e,query:c,originMethod:"getAccountOwnedTokensFromCollectionAddress"})).current_token_ownerships_v2}async function Do(n){let{aptosConfig:e,accountAddress:t,options:r}=n,i={owner_address:{_eq:u.from(t).toStringLong()},amount:{_gt:0}};_optionalChain([r, 'optionalAccess', _64 => _64.tokenStandard])&&(i.current_collection={token_standard:{_eq:_optionalChain([r, 'optionalAccess', _65 => _65.tokenStandard])}});let s={query:oo,variables:{where_condition:i,offset:_optionalChain([r, 'optionalAccess', _66 => _66.offset]),limit:_optionalChain([r, 'optionalAccess', _67 => _67.limit]),order_by:_optionalChain([r, 'optionalAccess', _68 => _68.orderBy])}};return(await m({aptosConfig:e,query:s,originMethod:"getAccountCollectionsWithOwnedTokens"})).current_collection_ownership_v2_view}async function No(n){let{aptosConfig:e,accountAddress:t}=n,r=u.from(t).toStringLong(),i=await m({aptosConfig:e,query:{query:uo,variables:{address:r}},originMethod:"getAccountTransactionsCount"});return i.account_transactions_aggregate.aggregate?i.account_transactions_aggregate.aggregate.count:0}async function Bo(n){let{aptosConfig:e,accountAddress:t,coinType:r}=n,o=u.from(t).toStringLong(),i=await rr({aptosConfig:e,accountAddress:o,options:{where:{asset_type:{_eq:r}}}});return i[0]?i[0].amount:0}async function rr(n){let{aptosConfig:e,accountAddress:t,options:r}=n,o=u.from(t).toStringLong(),i={..._optionalChain([r, 'optionalAccess', _69 => _69.where]),owner_address:{_eq:o}},s={query:ro,variables:{where_condition:i,offset:_optionalChain([r, 'optionalAccess', _70 => _70.offset]),limit:_optionalChain([r, 'optionalAccess', _71 => _71.limit]),order_by:_optionalChain([r, 'optionalAccess', _72 => _72.orderBy])}};return(await m({aptosConfig:e,query:s,originMethod:"getAccountCoinsData"})).current_fungible_asset_balances}async function ko(n){let{aptosConfig:e,accountAddress:t}=n,r=u.from(t).toStringLong(),i=await m({aptosConfig:e,query:{query:no,variables:{address:r}},originMethod:"getAccountCoinsCount"});if(!i.current_fungible_asset_balances_aggregate.aggregate)throw Error("Failed to get the count of account coins");return i.current_fungible_asset_balances_aggregate.aggregate.count}async function Oo(n){let{aptosConfig:e,accountAddress:t,options:r}=n,i={owner_address:{_eq:u.from(t).toStringLong()}},s={query:io,variables:{where_condition:i,offset:_optionalChain([r, 'optionalAccess', _73 => _73.offset]),limit:_optionalChain([r, 'optionalAccess', _74 => _74.limit]),order_by:_optionalChain([r, 'optionalAccess', _75 => _75.orderBy])}};return(await m({aptosConfig:e,query:s,originMethod:"getAccountOwnedObjects"})).current_objects}async function Mo(n){let{aptosConfig:e,privateKey:t}=n,r=new B(t.publicKey());if(t instanceof Oe){let i=K.fromPublicKey({publicKey:r}).derivedAddress();return Ie.fromPrivateKey({privateKey:t,address:i})}if(t instanceof J){let o=K.fromPublicKey({publicKey:r});if(await Po({authKey:o,aptosConfig:e})){let c=o.derivedAddress();return Ie.fromPrivateKey({privateKey:t,address:c,legacy:!1})}let s=K.fromPublicKey({publicKey:r.publicKey});if(await Po({authKey:s,aptosConfig:e})){let c=s.derivedAddress();return Ie.fromPrivateKey({privateKey:t,address:c,legacy:!0})}}throw new Error(`Can't derive account from private key ${t}`)}async function Po(n){let{aptosConfig:e,authKey:t}=n,r=await nr({aptosConfig:e,authenticationKey:t.derivedAddress()});try{return await me({aptosConfig:e,accountAddress:r}),!0}catch(o){if(o.status===404)return!1;throw new Error(`Error while looking for an account info ${r.toString()}`)}}async function Fo(n){let{aptosConfig:e,options:t}=n;return gt({aptosConfig:e,originMethod:"getTransactions",path:"transactions",params:{start:_optionalChain([t, 'optionalAccess', _76 => _76.offset]),limit:_optionalChain([t, 'optionalAccess', _77 => _77.limit])}})}async function Sn(n){let{aptosConfig:e}=n;return yt(async()=>{let{data:t}=await W({aptosConfig:e,originMethod:"getGasPriceEstimation",path:"estimate_gas_price"});return t},`gas-price-${e.network}`,1e3*60*5)()}async function Ko(n){let{aptosConfig:e,ledgerVersion:t}=n,{data:r}=await W({aptosConfig:e,originMethod:"getTransactionByVersion",path:`transactions/by_version/${t}`});return r}async function Dt(n){let{aptosConfig:e,transactionHash:t}=n,{data:r}=await W({aptosConfig:e,path:`transactions/by_hash/${t}`,originMethod:"getTransactionByHash"});return r}async function qo(n){let{aptosConfig:e,transactionHash:t}=n;try{return(await Dt({aptosConfig:e,transactionHash:t})).type==="pending_transaction"}catch(r){if(_optionalChain([r, 'optionalAccess', _78 => _78.status])===404)return!0;throw r}}async function Is(n){let{aptosConfig:e,transactionHash:t}=n,{data:r}=await W({aptosConfig:e,path:`transactions/wait_by_hash/${t}`,originMethod:"longWaitForTransaction"});return r}async function At(n){let{aptosConfig:e,transactionHash:t,options:r}=n,o=_nullishCoalesce(_optionalChain([r, 'optionalAccess', _79 => _79.timeoutSecs]), () => (20)),i=_nullishCoalesce(_optionalChain([r, 'optionalAccess', _80 => _80.checkSuccess]), () => (!0)),s=!0,a=0,c,p,f=200,G=1.5;function b(l){if(!(l instanceof ge)||(p=l,l.status!==404&&l.status>=400&&l.status<500))throw l}try{c=await Dt({aptosConfig:e,transactionHash:t}),s=c.type==="pending_transaction"}catch(l){b(l)}if(s){let l=Date.now();try{c=await Is({aptosConfig:e,transactionHash:t}),s=c.type==="pending_transaction"}catch(ye){b(ye)}a=(Date.now()-l)/1e3}for(;s&&!(a>=o);){try{if(c=await Dt({aptosConfig:e,transactionHash:t}),s=c.type==="pending_transaction",!s)break}catch(l){b(l)}await _chunkKSEUZTKYjs.b.call(void 0, f),a+=f/1e3,f*=G}if(c===void 0)throw p||new _n(`Fetching transaction ${t} failed and timed out after ${o} seconds`,c);if(c.type==="pending_transaction")throw new _n(`Transaction ${t} timed out in pending state after ${o} seconds`,c);if(!i)return c;if(!c.success)throw new or(`Transaction ${t} failed with an error: ${c.vm_status}`,c);return c}async function xn(n){let{aptosConfig:e,processorType:t}=n,r=BigInt(n.minimumLedgerVersion),o=3e3,i=new Date().getTime(),s=BigInt(-1);for(;s<r;){if(new Date().getTime()-i>o)throw new Error("waitForLastSuccessIndexerVersionSync timeout");if(t===void 0?s=await hn({aptosConfig:e}):s=(await Tn({aptosConfig:e,processorType:t})).last_success_version,s>=r)break;await _chunkKSEUZTKYjs.b.call(void 0, 200)}}var _n=class extends Error{constructor(e,t){super(e),this.lastSubmittedTransaction=t}},or=class extends Error{constructor(e,t){super(e),this.transaction=t}};async function y(n){n.minimumLedgerVersion!==void 0&&await xn({aptosConfig:n.config,minimumLedgerVersion:n.minimumLedgerVersion,processorType:n.processorType})}var Nt=class{constructor(e){this.config=e}async getAccountInfo(e){return me({aptosConfig:this.config,...e})}async getAccountModules(e){return Io({aptosConfig:this.config,...e})}async getAccountModule(e){return wn({aptosConfig:this.config,...e})}async getAccountTransactions(e){return Eo({aptosConfig:this.config,...e})}async getAccountResources(e){return Uo({aptosConfig:this.config,...e})}async getAccountResource(e){return tr({aptosConfig:this.config,...e})}async lookupOriginalAccountAddress(e){return nr({aptosConfig:this.config,...e})}async getAccountTokensCount(e){return await y({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"account_transactions_processor"}),Ro({aptosConfig:this.config,...e})}async getAccountOwnedTokens(e){return await y({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),zo({aptosConfig:this.config,...e})}async getAccountOwnedTokensFromCollectionAddress(e){return await y({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),Go({aptosConfig:this.config,...e})}async getAccountCollectionsWithOwnedTokens(e){return await y({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),Do({aptosConfig:this.config,...e})}async getAccountTransactionsCount(e){return await y({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"account_transactions_processor"}),No({aptosConfig:this.config,...e})}async getAccountCoinsData(e){return await y({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"fungible_asset_processor"}),rr({aptosConfig:this.config,...e})}async getAccountCoinsCount(e){return await y({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"fungible_asset_processor"}),ko({aptosConfig:this.config,...e})}async getAccountAPTAmount(e){return this.getAccountCoinAmount({coinType:cn,...e})}async getAccountCoinAmount(e){return await y({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"fungible_asset_processor"}),Bo({aptosConfig:this.config,...e})}async getAccountOwnedObjects(e){return await y({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"default_processor"}),Oo({aptosConfig:this.config,...e})}async deriveAccountFromPrivateKey(e){return Mo({aptosConfig:this.config,...e})}};var _aptosclient = require('@aptos-labs/aptos-client'); var _aptosclient2 = _interopRequireDefault(_aptosclient);var vn=class{constructor(e){this.network=_nullishCoalesce(_optionalChain([e, 'optionalAccess', _81 => _81.network]), () => ("devnet")),this.fullnode=_optionalChain([e, 'optionalAccess', _82 => _82.fullnode]),this.faucet=_optionalChain([e, 'optionalAccess', _83 => _83.faucet]),this.indexer=_optionalChain([e, 'optionalAccess', _84 => _84.indexer]),this.client=_nullishCoalesce(_optionalChain([e, 'optionalAccess', _85 => _85.client]), () => ({provider:_aptosclient2.default})),this.clientConfig=_nullishCoalesce(_optionalChain([e, 'optionalAccess', _86 => _86.clientConfig]), () => ({})),this.fullnodeConfig=_nullishCoalesce(_optionalChain([e, 'optionalAccess', _87 => _87.fullnodeConfig]), () => ({})),this.indexerConfig=_nullishCoalesce(_optionalChain([e, 'optionalAccess', _88 => _88.indexerConfig]), () => ({})),this.faucetConfig=_nullishCoalesce(_optionalChain([e, 'optionalAccess', _89 => _89.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 jr[this.network];case"Faucet":if(this.faucet!==void 0)return this.faucet;if(this.network==="custom")throw new Error("Please provide a custom faucet url");return Xr[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 Wr[this.network];default:throw Error(`apiType ${e} is not supported`)}}};function $o(n){return!!n.match(/^[_a-zA-Z0-9]+$/)}function Vo(n){return!!n.match(/\s/)}function Us(n){return!!n.match(/^T[0-9]+$/)}function Rs(n,e){let t=e;for(;t<n.length;t+=1){let r=n[t];if(!Vo(r))break}return t}var zs=(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.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))(zs||{}),v= exports.TypeTagParserError =class extends Error{constructor(e,t){super(`Failed to parse typeTag '${e}', ${t}`)}};function we(n,e){let t=_nullishCoalesce(_optionalChain([e, 'optionalAccess', _90 => _90.allowGenerics]), () => (!1)),r=[],o=[],i=[],s=0,a="",c=1;for(;s<n.length;){let p=n[s];if(p==="<")r.push({savedExpectedTypes:c,savedStr:a,savedTypes:i}),a="",i=[],c=1;else if(p===">"){if(a!==""){let ye=Cn(a,o,t);i.push(ye)}let f=r.pop();if(f===void 0)throw new v(n,"unexpected '>'");if(c!==i.length)throw new v(n,"type argument count doesn't match expected amount");let{savedStr:G,savedTypes:b,savedExpectedTypes:l}=f;o=i,i=b,a=G,c=l}else if(p===","){if(a.length!==0){let f=Cn(a,o,t);o=[],i.push(f),a="",c+=1}}else if(Vo(p)){let f=!1;if(a.length!==0){let b=Cn(a,o,t);o=[],i.push(b),a="",f=!0}s=Rs(n,s);let G=n[s];if(s<n.length&&f&&G!==","&&G!==">")throw new v(n,"unexpected whitespace character");continue}else a+=p;s+=1}if(r.length>0)throw new v(n,"no matching '>' for '<'");switch(i.length){case 0:return Cn(a,o,t);case 1:if(a==="")return i[0];throw new v(n,"unexpected ','");default:throw new v(n,"unexpected whitespace character")}}function Cn(n,e,t){switch(n){case"&signer":if(e.length>0)throw new v(n,"primitive types not expected to have type arguments");return new un(new qe);case"signer":if(e.length>0)throw new v(n,"primitive types not expected to have type arguments");return new qe;case"bool":if(e.length>0)throw new v(n,"primitive types not expected to have type arguments");return new k;case"address":if(e.length>0)throw new v(n,"primitive types not expected to have type arguments");return new H;case"u8":if(e.length>0)throw new v(n,"primitive types not expected to have type arguments");return new le;case"u16":if(e.length>0)throw new v(n,"primitive types not expected to have type arguments");return new nt;case"u32":if(e.length>0)throw new v(n,"primitive types not expected to have type arguments");return new rt;case"u64":if(e.length>0)throw new v(n,"primitive types not expected to have type arguments");return new $;case"u128":if(e.length>0)throw new v(n,"primitive types not expected to have type arguments");return new ot;case"u256":if(e.length>0)throw new v(n,"primitive types not expected to have type arguments");return new it;case"vector":if(e.length!==1)throw new v(n,"vector type expected to have exactly one type argument");return new x(e[0]);default:if(Us(n)){if(t)return new z(Number(n.split("T")[1]));throw new v(n,"unexpected generic type")}if(!n.match(/:/))throw new v(n,"unknown type");let r=n.split("::");if(r.length!==3)throw new v(n,"unexpected struct format, must be of the form 0xaddress::module_name::struct_name");if(!$o(r[1]))throw new v(n,"module name must only contain alphanumeric or '_' characters");if(!$o(r[2]))throw new v(n,"struct name must only contain alphanumeric or '_' characters");return new g(new Te(u.fromString(r[0]),new P(r[1]),new P(r[2]),e))}}function Lo(n){return typeof n=="boolean"}function ft(n){return typeof n=="string"}function Pn(n){return typeof n=="number"}function In(n){return typeof n=="number"||typeof n=="bigint"||typeof n=="string"}function Ho(n){return n==null}function Qo(n){return ir(n)||ar(n)||cr(n)||ur(n)||pr(n)||dr(n)||lr(n)||En(n)||sr(n)||Gs(n)||n instanceof T||n instanceof Ce}function ir(n){return n instanceof I}function En(n){return n instanceof u}function sr(n){return n instanceof w}function Gs(n){return n instanceof De}function ar(n){return n instanceof N}function cr(n){return n instanceof re}function ur(n){return n instanceof oe}function pr(n){return n instanceof D}function dr(n){return n instanceof ie}function lr(n){return n instanceof se}function Wo(n){return"bytecode"in n}function C(n,e){throw new Error(`Type mismatch for argument ${e}, expected '${n}'`)}function jo(n){let e=n.params.findIndex(t=>t!=="signer"&&t!=="&signer");return e<0?n.params.length:e}function Bt(n){let e=n.split("::");if(e.length!==3)throw new Error(`Invalid function ${n}`);let t=e[0],r=e[1],o=e[2];return{moduleAddress:t,moduleName:r,functionName:o}}var Ds=new TextEncoder;function mr(n){return _nullishCoalesce(_optionalChain([n, 'optionalAccess', _91 => _91.map, 'call', _92 => _92(e=>ft(e)?we(e):e)]), () => ([]))}async function Xo(n,e,t,r){let o=await wn({aptosConfig:r,accountAddress:n,moduleName:e});if(o.abi)return o.abi.exposed_functions.find(i=>i.name===t)}async function Yo(n,e,t,r){let o=await Xo(n,e,t,r);if(!o)throw new Error(`Could not find entry function ABI for '${n}::${e}::${t}'`);if(!o.is_entry)throw new Error(`'${n}::${e}::${t}' is not an entry function`);let i=jo(o),s=[];for(let a=i;a<o.params.length;a+=1)s.push(we(o.params[a],{allowGenerics:!0}));return{signers:i,typeParameters:o.generic_type_params,parameters:s}}async function Zo(n,e,t,r){let o=await Xo(n,e,t,r);if(!o)throw new Error(`Could not find view function ABI for '${n}::${e}::${t}'`);if(!o.is_view)throw new Error(`'${n}::${e}::${t}' is not an view function`);let i=[];for(let a=0;a<o.params.length;a+=1)i.push(we(o.params[a],{allowGenerics:!0}));let s=[];for(let a=0;a<o.return.length;a+=1)s.push(we(o.return[a],{allowGenerics:!0}));return{typeParameters:o.generic_type_params,parameters:i,returnTypes:s}}function yr(n,e,t,r,o){if(r>=e.parameters.length)throw new Error(`Too many arguments for '${n}', expected ${e.parameters.length}`);let i=e.parameters[r];return ht(t,i,r,o)}function ht(n,e,t,r){return Qo(n)?(gr(e,n,t),n):Ns(n,e,t,r)}function Ns(n,e,t,r){if(e.isBool()){if(Lo(n))return new I(n);C("boolean",t)}if(e.isAddress()){if(ft(n))return u.fromString(n);C("string | AccountAddress",t)}if(e.isU8()){if(Pn(n))return new N(n);C("number",t)}if(e.isU16()){if(Pn(n))return new re(n);C("number",t)}if(e.isU32()){if(Pn(n))return new oe(n);C("number",t)}if(e.isU64()){if(In(n))return new D(BigInt(n));C("bigint | number | string",t)}if(e.isU128()){if(In(n))return new ie(BigInt(n));C("bigint | number | string",t)}if(e.isU256()){if(In(n))return new se(BigInt(n));C("bigint | number | string",t)}if(e.isGeneric()){let o=e.value;if(o<0||o>=r.length)throw new Error(`Generic argument ${e.toString()} is invalid for argument ${t}`);return ht(n,r[o],t,r)}if(e.isVector()){if(e.value.isU8()){if(ft(n))return T.U8(Ds.encode(n));if(n instanceof Uint8Array)return T.U8(n);if(n instanceof ArrayBuffer)return T.U8(new Uint8Array(n))}if(Array.isArray(n))return new T(n.map(o=>ht(o,e.value,t,r)));throw new Error(`Type mismatch for argument ${t}, type '${e.toString()}'`)}if(e.isStruct()){if(e.isString()){if(ft(n))return new w(n);C("string",t)}if(e.isObject()){if(ft(n))return u.fromString(n);C("string | AccountAddress",t)}if(e.isOption())return Ho(n)?new Ce(null):new Ce(ht(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 gr(n,e,t){if(n.isBool()){if(ir(e))return;C("Bool",t)}if(n.isAddress()){if(En(e))return;C("AccountAddress",t)}if(n.isU8()){if(ar(e))return;C("U8",t)}if(n.isU16()){if(cr(e))return;C("U16",t)}if(n.isU32()){if(ur(e))return;C("U32",t)}if(n.isU64()){if(pr(e))return;C("U64",t)}if(n.isU128()){if(dr(e))return;C("U128",t)}if(n.isU256()){if(lr(e))return;C("U256",t)}if(n.isVector()){if(e instanceof T){e.values.length>0&&gr(n.value,e.values[0],t);return}C("MoveVector",t)}if(n instanceof g){if(n.isString()){if(sr(e))return;C("MoveString",t)}if(n.isObject()){if(En(e))return;C("AccountAddress",t)}if(n.isOption()){if(e instanceof Ce){e.value!==void 0&&gr(n.value.typeArgs[0],e.value,t);return}C("MoveOption",t)}}throw new Error(`Type mismatch for argument ${t}, expected '${n.toString()}'`)}async function Rn(n){if(Wo(n))return Ms(n);let{moduleAddress:e,moduleName:t,functionName:r}=Bt(n.function),o=await ni({key:"entry-function",moduleAddress:e,moduleName:t,functionName:r,aptosConfig:n.aptosConfig,abi:n.abi,fetch:Yo});return ks({...n,abi:o})}function ks(n){let e=n.abi,{moduleAddress:t,moduleName:r,functionName:o}=Bt(n.function),i=mr(n.typeArguments);if(i.length!==e.typeParameters.length)throw new Error(`Type argument count mismatch, expected ${e.typeParameters.length}, received ${i.length}`);let s=n.functionArguments.map((c,p)=>yr(n.function,e,c,p,i));if(s.length!==e.parameters.length)throw new Error(`Too few arguments for '${t}::${r}::${o}', expected ${e.parameters.length} but got ${s.length}`);let a=Ve.build(`${t}::${r}`,o,i,s);if("multisigAddress"in n){let c=u.from(n.multisigAddress);return new Ut(new zt(c,new Gt(a)))}return new Et(a)}async function Jo(n){let{moduleAddress:e,moduleName:t,functionName:r}=Bt(n.function),o=await ni({key:"view-function",moduleAddress:e,moduleName:t,functionName:r,aptosConfig:n.aptosConfig,abi:n.abi,fetch:Zo});return Os({abi:o,...n})}function Os(n){let e=n.abi,{moduleAddress:t,moduleName:r,functionName:o}=Bt(n.function),i=mr(n.typeArguments);if(i.length!==e.typeParameters.length)throw new Error(`Type argument count mismatch, expected ${e.typeParameters.length}, received ${i.length}`);let s=_nullishCoalesce(_optionalChain([n, 'optionalAccess', _93 => _93.functionArguments, 'optionalAccess', _94 => _94.map, 'call', _95 => _95((a,c)=>yr(n.function,e,a,c,i))]), () => ([]));if(s.length!==e.parameters.length)throw new Error(`Too few arguments for '${t}::${r}::${o}', expected ${e.parameters.length} but got ${s.length}`);return Ve.build(`${t}::${r}`,o,i,s)}function Ms(n){return new It(new Rt(h.fromHexInput(n.bytecode).toUint8Array(),_nullishCoalesce(n.typeArguments, () => ([])),n.functionArguments))}async function Fs(n){let{aptosConfig:e,sender:t,payload:r,options:o,feePayerAddress:i}=n,s=async()=>Wn[e.network]?{chainId:Wn[e.network]}:{chainId:(await fn({aptosConfig:e})).chain_id},a=async()=>_optionalChain([o, 'optionalAccess', _96 => _96.gasUnitPrice])?{gasEstimate:o.gasUnitPrice}:{gasEstimate:(await Sn({aptosConfig:e})).gas_estimate},c=async()=>{let je=async()=>_optionalChain([o, 'optionalAccess', _97 => _97.accountSequenceNumber])!==void 0?o.accountSequenceNumber:(await me({aptosConfig:e,accountAddress:t})).sequence_number;if(i&&u.from(i).equals(u.ZERO))try{return await je()}catch (e2){return 0}else return je()},[{chainId:p},{gasEstimate:f},G]=await Promise.all([s(),a(),c()]),{maxGasAmount:b,gasUnitPrice:l,expireTimestamp:ye}={maxGasAmount:_optionalChain([o, 'optionalAccess', _98 => _98.maxGasAmount])?BigInt(o.maxGasAmount):BigInt(2e5),gasUnitPrice:_nullishCoalesce(_optionalChain([o, 'optionalAccess', _99 => _99.gasUnitPrice]), () => (BigInt(f))),expireTimestamp:_nullishCoalesce(_optionalChain([o, 'optionalAccess', _100 => _100.expireTimestamp]), () => (BigInt(Math.floor(Date.now()/1e3)+20)))};return new te(u.from(t),BigInt(G),r,BigInt(b),BigInt(l),BigInt(ye),new tt(p))}async function Ar(n){let{aptosConfig:e,sender:t,payload:r,options:o,feePayerAddress:i}=n,s=await Fs({aptosConfig:e,sender:t,payload:r,options:o,feePayerAddress:i});if("secondarySignerAddresses"in n){let a=_nullishCoalesce(_optionalChain([n, 'access', _101 => _101.secondarySignerAddresses, 'optionalAccess', _102 => _102.map, 'call', _103 => _103(c=>u.from(c))]), () => ([]));return new gn(s,a,n.feePayerAddress?u.from(n.feePayerAddress):void 0)}return new ln(s,n.feePayerAddress?u.from(n.feePayerAddress):void 0)}function ei(n){let{signerPublicKey:e,transaction:t,secondarySignersPublicKeys:r,feePayerPublicKey:o}=n,i=Un(e);if(t.feePayerAddress){let a=new He(t.rawTransaction,_nullishCoalesce(t.secondarySignerAddresses, () => ([])),t.feePayerAddress),c=[];r&&(c=r.map(G=>Un(G)));let p=Un(o),f=new ct(i,_nullishCoalesce(t.secondarySignerAddresses, () => ([])),c,{address:t.feePayerAddress,authenticator:p});return new Qe(a.raw_txn,f).bcsToBytes()}if(t.secondarySignerAddresses){let a=new Le(t.rawTransaction,t.secondarySignerAddresses),c=[];c=r.map(f=>Un(f));let p=new at(i,t.secondarySignerAddresses,c);return new Qe(a.raw_txn,p).bcsToBytes()}let s;if(i instanceof ae)s=new st(i.public_key,i.signature);else if(i instanceof ce)s=new ut(i);else throw new Error("Invalid public key");return new Qe(t.rawTransaction,s).bcsToBytes()}function Un(n){if(n instanceof B){if(n.publicKey instanceof E)return new ce(n,new q(new U(new Uint8Array(64))));if(n.publicKey instanceof fe)return new ce(n,new q(new he(new Uint8Array(64))))}return new ae(new E(n.toUint8Array()),new U(new Uint8Array(64)))}function fr(n){let{transaction:e,feePayerAuthenticator:t,additionalSignersAuthenticators:r}=n,o=Yr(O,n.senderAuthenticator),i;if(e.feePayerAddress){if(!t)throw new Error("Must provide a feePayerAuthenticator argument to generate a signed fee payer transaction");i=new ct(o,_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");i=new at(o,e.secondarySignerAddresses,r)}else o instanceof ae?i=new st(o.public_key,o.signature):i=new ut(o);return new Qe(e.rawTransaction,i).bcsToBytes()}function ti(n){let e=_sha3.sha3_256.create();for(let t of n)e.update(t);return e.digest()}var Ks=ti(["APTOS::Transaction"]);function Bm(n){let e=fr(n);return new h(ti([Ks,new Uint8Array([0]),e])).toString()}async function ni({key:n,moduleAddress:e,moduleName:t,functionName:r,aptosConfig:o,abi:i,fetch:s}){return i!==void 0?i:yt(async()=>s(e,t,r,o),`${n}-${o.network}-${e}-${t}-${r}`,1e3*60*5)()}async function A(n){let e=await qs(n);return $s(n,e)}async function qs(n){let{aptosConfig:e,data:t}=n,r,o;return"bytecode"in t?o=await Rn(t):"multisigAddress"in t?(r={aptosConfig:e,multisigAddress:t.multisigAddress,function:t.function,functionArguments:t.functionArguments,typeArguments:t.typeArguments,abi:t.abi},o=await Rn(r)):(r={aptosConfig:e,function:t.function,functionArguments:t.functionArguments,typeArguments:t.typeArguments,abi:t.abi},o=await Rn(r)),o}async function $s(n,e){let{aptosConfig:t,sender:r,options:o}=n,i;if(Vs(n)&&(i=u.ZERO.toString()),Ls(n)){let{secondarySignerAddresses:s}=n;return Ar({aptosConfig:t,sender:r,payload:e,options:o,secondarySignerAddresses:s,feePayerAddress:i})}return Ar({aptosConfig:t,sender:r,payload:e,options:o,feePayerAddress:i})}function Vs(n){return n.withFeePayer===!0}function Ls(n){return"secondarySignerAddresses"in n}function ri(n){let{transaction:e}=n;return pt(e)}function zn(n){let{signer:e,transaction:t}=n;return e.signTransactionWithAuthenticator(t)}async function hr(n){let{aptosConfig:e,transaction:t,signerPublicKey:r,secondarySignersPublicKeys:o,feePayerPublicKey:i,options:s}=n,a=ei({transaction:t,signerPublicKey:r,secondarySignersPublicKeys:o,feePayerPublicKey:i,options:s}),{data:c}=await We({aptosConfig:e,body:a,path:"transactions/simulate",params:{estimate_gas_unit_price:_nullishCoalesce(_optionalChain([n, 'access', _104 => _104.options, 'optionalAccess', _105 => _105.estimateGasUnitPrice]), () => (!1)),estimate_max_gas_amount:_nullishCoalesce(_optionalChain([n, 'access', _106 => _106.options, 'optionalAccess', _107 => _107.estimateMaxGasAmount]), () => (!1)),estimate_prioritized_gas_unit_price:_nullishCoalesce(_optionalChain([n, 'access', _108 => _108.options, 'optionalAccess', _109 => _109.estimatePrioritizedGasUnitPrice]), () => (!1))},originMethod:"simulateTransaction",contentType:"application/x.aptos.signed_transaction+bcs"});return c}async function Gn(n){let{aptosConfig:e}=n,t=fr({...n}),{data:r}=await We({aptosConfig:e,body:t,path:"transactions",originMethod:"submitTransaction",contentType:"application/x.aptos.signed_transaction+bcs"});return r}async function kt(n){let{aptosConfig:e,signer:t,transaction:r}=n,o=zn({signer:t,transaction:r});return Gn({aptosConfig:e,transaction:r,senderAuthenticator:o})}var Hs={typeParameters:[],parameters:[x.u8(),new x(x.u8())]};async function oi(n){let{aptosConfig:e,account:t,metadataBytes:r,moduleBytecode:o,options:i}=n,s=o.map(a=>T.U8(a));return A({aptosConfig:e,sender:u.from(t),data:{function:"0x1::code::publish_package_txn",functionArguments:[T.U8(r),new T(s)],abi:Hs},options:i})}var Qs={typeParameters:[],parameters:[new le,x.u8(),new le,x.u8(),x.u8(),x.u8()]};async function ii(n){let{aptosConfig:e,fromAccount:t,toNewPrivateKey:r}=n,o=await me({aptosConfig:e,accountAddress:t.accountAddress}),i=Ie.fromPrivateKey({privateKey:r,legacy:!0}),a=new dn({sequenceNumber:BigInt(o.sequence_number),originator:t.accountAddress,currentAuthKey:u.from(o.authentication_key),newPublicKey:i.publicKey}).bcsToBytes(),c=t.sign(a),p=i.sign(a),f=await A({aptosConfig:e,sender:t.accountAddress,data:{function:"0x1::account::rotate_authentication_key",functionArguments:[new N(t.signingScheme),T.U8(t.publicKey.toUint8Array()),new N(i.signingScheme),T.U8(i.publicKey.toUint8Array()),T.U8(c.toUint8Array()),T.U8(p.toUint8Array())],abi:Qs}});return kt({aptosConfig:e,signer:t,transaction:f})}var Ws={typeParameters:[{constraints:[]}],parameters:[new H,new $]};async function si(n){let{aptosConfig:e,sender:t,recipient:r,amount:o,coinType:i,options:s}=n;return A({aptosConfig:e,sender:t,data:{function:"0x1::aptos_account::transfer_coins",typeArguments:[_nullishCoalesce(i, () => (cn))],functionArguments:[r,o],abi:Ws},options:s})}var Ot=class{constructor(e){this.config=e}async transferCoinTransaction(e){return si({aptosConfig:this.config,...e})}};var Ee={BOOLEAN:"bool",U8:"u8",U16:"u16",U32:"u32",U64:"u64",U128:"u128",U256:"u256",ADDRESS:"address",STRING:"0x1::string::String",ARRAY:"vector<u8>"},ne="0x4::token::Token";async function ai(n){let{aptosConfig:e,digitalAssetAddress:t}=n,r={token_data_id:{_eq:u.from(t).toStringLong()}};return(await m({aptosConfig:e,query:{query:bo,variables:{where_condition:r}},originMethod:"getDigitalAssetData"})).current_token_datas_v2[0]}async function ci(n){let{aptosConfig:e,digitalAssetAddress:t}=n,r={token_data_id:{_eq:u.from(t).toStringLong()},amount:{_gt:0}};return(await m({aptosConfig:e,query:{query:Jn,variables:{where_condition:r}},originMethod:"getCurrentDigitalAssetOwnership"})).current_token_ownerships_v2[0]}async function ui(n){let{aptosConfig:e,ownerAddress:t,options:r}=n,o={owner_address:{_eq:u.from(t).toStringLong()},amount:{_gt:0}},i={query:Jn,variables:{where_condition:o,offset:_optionalChain([r, 'optionalAccess', _110 => _110.offset]),limit:_optionalChain([r, 'optionalAccess', _111 => _111.limit]),order_by:_optionalChain([r, 'optionalAccess', _112 => _112.orderBy])}};return(await m({aptosConfig:e,query:i,originMethod:"getOwnedDigitalAssets"})).current_token_ownerships_v2}async function pi(n){let{aptosConfig:e,digitalAssetAddress:t,options:r}=n,o={token_data_id:{_eq:u.from(t).toStringLong()}},i={query:To,variables:{where_condition:o,offset:_optionalChain([r, 'optionalAccess', _113 => _113.offset]),limit:_optionalChain([r, 'optionalAccess', _114 => _114.limit]),order_by:_optionalChain([r, 'optionalAccess', _115 => _115.orderBy])}};return(await m({aptosConfig:e,query:i,originMethod:"getDigitalAssetActivity"})).token_activities_v2}var js={typeParameters:[],parameters:[new g(S()),new $,new g(S()),new g(S()),new k,new k,new k,new k,new k,new k,new k,new k,new k,new $,new $]};async function di(n){let{aptosConfig:e,options:t,creator:r}=n;return A({aptosConfig:e,sender:r.accountAddress,data:{function:"0x4::aptos_token::create_collection",functionArguments:[new w(n.description),new D(_nullishCoalesce(n.maxSupply, () => (ze))),new w(n.name),new w(n.uri),new I(_nullishCoalesce(n.mutableDescription, () => (!0))),new I(_nullishCoalesce(n.mutableRoyalty, () => (!0))),new I(_nullishCoalesce(n.mutableURI, () => (!0))),new I(_nullishCoalesce(n.mutableTokenDescription, () => (!0))),new I(_nullishCoalesce(n.mutableTokenName, () => (!0))),new I(_nullishCoalesce(n.mutableTokenProperties, () => (!0))),new I(_nullishCoalesce(n.mutableTokenURI, () => (!0))),new I(_nullishCoalesce(n.tokensBurnableByCreator, () => (!0))),new I(_nullishCoalesce(n.tokensFreezableByCreator, () => (!0))),new D(_nullishCoalesce(n.royaltyNumerator, () => (0))),new D(_nullishCoalesce(n.royaltyDenominator, () => (1)))],abi:js},options:t})}async function Tr(n){let{aptosConfig:e,creatorAddress:t,collectionName:r,options:o}=n,i=u.from(t),s={collection_name:{_eq:r},creator_address:{_eq:i.toStringLong()}};return _optionalChain([o, 'optionalAccess', _116 => _116.tokenStandard])&&(s.token_standard={_eq:_nullishCoalesce(_optionalChain([o, 'optionalAccess', _117 => _117.tokenStandard]), () => ("v2"))}),(await m({aptosConfig:e,query:{query:Xn,variables:{where_condition:s}},originMethod:"getCollectionData"})).current_collections_v2[0]}async function li(n){let{aptosConfig:e,collectionId:t}=n,o={collection_id:{_eq:u.from(t).toStringLong()}};return(await m({aptosConfig:e,query:{query:Xn,variables:{where_condition:o}},originMethod:"getCollectionData"})).current_collections_v2[0]}async function gi(n){return(await Tr(n)).collection_id}var Xs={typeParameters:[],parameters:[new g(S()),new g(S()),new g(S()),new g(S()),new x(new g(S())),new x(new g(S())),new x(x.u8())]};async function mi(n){let{aptosConfig:e,options:t,creator:r,collection:o,description:i,name:s,uri:a,propertyKeys:c,propertyTypes:p,propertyValues:f}=n,G=_optionalChain([p, 'optionalAccess', _118 => _118.map, 'call', _119 => _119(b=>Ee[b])]);return A({aptosConfig:e,sender:r.accountAddress,data:{function:"0x4::aptos_token::mint",functionArguments:[new w(o),new w(i),new w(s),new w(a),T.MoveString(_nullishCoalesce(c, () => ([]))),T.MoveString(_nullishCoalesce(G, () => ([]))),Ii(_nullishCoalesce(f, () => ([])),_nullishCoalesce(G, () => ([])))],abi:Xs},options:t})}var Ys={typeParameters:[{constraints:["key"]}],parameters:[new g(Q(new z(0))),new H]};async function yi(n){let{aptosConfig:e,sender:t,digitalAssetAddress:r,recipient:o,digitalAssetType:i,options:s}=n;return A({aptosConfig:e,sender:t.accountAddress,data:{function:"0x1::object::transfer",typeArguments:[_nullishCoalesce(i, () => (ne))],functionArguments:[u.from(r),u.from(o)],abi:Ys},options:s})}var Zs={typeParameters:[],parameters:[new g(S()),new g(S()),new g(S()),new g(S()),new x(new g(S())),new x(new g(S())),new x(x.u8()),new H]};async function Ai(n){let{aptosConfig:e,account:t,collection:r,description:o,name:i,uri:s,recipient:a,propertyKeys:c,propertyTypes:p,propertyValues:f,options:G}=n;if(_optionalChain([c, 'optionalAccess', _120 => _120.length])!==_optionalChain([f, 'optionalAccess', _121 => _121.length]))throw new Error("Property keys and property values counts do not match");if(_optionalChain([p, 'optionalAccess', _122 => _122.length])!==_optionalChain([f, 'optionalAccess', _123 => _123.length]))throw new Error("Property types and property values counts do not match");let b=_optionalChain([p, 'optionalAccess', _124 => _124.map, 'call', _125 => _125(l=>Ee[l])]);return A({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::mint_soul_bound",functionArguments:[r,o,i,s,T.MoveString(_nullishCoalesce(c, () => ([]))),T.MoveString(_nullishCoalesce(b, () => ([]))),Ii(_nullishCoalesce(f, () => ([])),_nullishCoalesce(b, () => ([]))),a],abi:Zs},options:G})}var Js={typeParameters:[{constraints:["key"]}],parameters:[new g(Q(new z(0)))]};async function fi(n){let{aptosConfig:e,creator:t,digitalAssetAddress:r,digitalAssetType:o,options:i}=n;return A({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::burn",typeArguments:[_nullishCoalesce(o, () => (ne))],functionArguments:[u.from(r)],abi:Js},options:i})}var ea={typeParameters:[{constraints:["key"]}],parameters:[new g(Q(new z(0)))]};async function hi(n){let{aptosConfig:e,creator:t,digitalAssetAddress:r,digitalAssetType:o,options:i}=n;return A({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::freeze_transfer",typeArguments:[_nullishCoalesce(o, () => (ne))],functionArguments:[r],abi:ea},options:i})}var ta={typeParameters:[{constraints:["key"]}],parameters:[new g(Q(new z(0)))]};async function Ti(n){let{aptosConfig:e,creator:t,digitalAssetAddress:r,digitalAssetType:o,options:i}=n;return A({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::unfreeze_transfer",typeArguments:[_nullishCoalesce(o, () => (ne))],functionArguments:[r],abi:ta},options:i})}var na={typeParameters:[{constraints:["key"]}],parameters:[new g(Q(new z(0))),new g(S())]};async function bi(n){let{aptosConfig:e,creator:t,description:r,digitalAssetAddress:o,digitalAssetType:i,options:s}=n;return A({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::set_description",typeArguments:[_nullishCoalesce(i, () => (ne))],functionArguments:[u.from(o),new w(r)],abi:na},options:s})}var ra={typeParameters:[{constraints:["key"]}],parameters:[new g(Q(new z(0))),new g(S())]};async function wi(n){let{aptosConfig:e,creator:t,name:r,digitalAssetAddress:o,digitalAssetType:i,options:s}=n;return A({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::set_name",typeArguments:[_nullishCoalesce(i, () => (ne))],functionArguments:[u.from(o),new w(r)],abi:ra},options:s})}var oa={typeParameters:[{constraints:["key"]}],parameters:[new g(Q(new z(0))),new g(S())]};async function _i(n){let{aptosConfig:e,creator:t,uri:r,digitalAssetAddress:o,digitalAssetType:i,options:s}=n;return A({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::set_uri",typeArguments:[_nullishCoalesce(i, () => (ne))],functionArguments:[u.from(o),new w(r)],abi:oa},options:s})}var ia={typeParameters:[{constraints:["key"]}],parameters:[new g(Q(new z(0))),new g(S()),new g(S()),x.u8()]};async function Si(n){let{aptosConfig:e,creator:t,propertyKey:r,propertyType:o,propertyValue:i,digitalAssetAddress:s,digitalAssetType:a,options:c}=n;return A({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::add_property",typeArguments:[_nullishCoalesce(a, () => (ne))],functionArguments:[u.from(s),new w(r),new w(Ee[o]),T.U8(br(i,Ee[o]))],abi:ia},options:c})}var sa={typeParameters:[{constraints:["key"]}],parameters:[new g(Q(new z(0))),new g(S())]};async function xi(n){let{aptosConfig:e,creator:t,propertyKey:r,digitalAssetAddress:o,digitalAssetType:i,options:s}=n;return A({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::remove_property",typeArguments:[_nullishCoalesce(i, () => (ne))],functionArguments:[u.from(o),new w(r)],abi:sa},options:s})}var aa={typeParameters:[{constraints:["key"]}],parameters:[new g(Q(new z(0))),new g(S()),new g(S()),x.u8()]};async function vi(n){let{aptosConfig:e,creator:t,propertyKey:r,propertyType:o,propertyValue:i,digitalAssetAddress:s,digitalAssetType:a,options:c}=n;return A({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::update_property",typeArguments:[_nullishCoalesce(a, () => (ne))],functionArguments:[u.from(s),new w(r),new w(Ee[o]),br(i,Ee[o])],abi:aa},options:c})}var ca={typeParameters:[{constraints:["key"]},{constraints:[]}],parameters:[new g(Q(new z(0))),new g(S()),new z(1)]};async function Ci(n){let{aptosConfig:e,creator:t,propertyKey:r,propertyType:o,propertyValue:i,digitalAssetAddress:s,digitalAssetType:a,options:c}=n;return A({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::add_typed_property",typeArguments:[_nullishCoalesce(a, () => (ne)),Ee[o]],functionArguments:[u.from(s),new w(r),i],abi:ca},options:c})}var ua={typeParameters:[{constraints:["key"]},{constraints:[]}],parameters:[new g(Q(new z(0))),new g(S()),new z(1)]};async function Pi(n){let{aptosConfig:e,creator:t,propertyKey:r,propertyType:o,propertyValue:i,digitalAssetAddress:s,digitalAssetType:a,options:c}=n;return A({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::update_typed_property",typeArguments:[_nullishCoalesce(a, () => (ne)),Ee[o]],functionArguments:[u.from(s),new w(r),i],abi:ua},options:c})}function Ii(n,e){let t=new Array;return e.forEach((r,o)=>{t.push(br(n[o],r))}),t}function br(n,e){let t=we(e);return ht(n,t,0,[]).bcsToBytes()}var Mt=class{constructor(e){this.config=e}async getCollectionData(e){return await y({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),Tr({aptosConfig:this.config,...e})}async getCollectionDataByCollectionId(e){return await y({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),li({aptosConfig:this.config,...e})}async getCollectionId(e){return await y({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),gi({aptosConfig:this.config,...e})}async getDigitalAssetData(e){return await y({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),ai({aptosConfig:this.config,...e})}async getCurrentDigitalAssetOwnership(e){return await y({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),ci({aptosConfig:this.config,...e})}async getOwnedDigitalAssets(e){return await y({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),ui({aptosConfig:this.config,...e})}async getDigitalAssetActivity(e){return await y({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),pi({aptosConfig:this.config,...e})}async createCollectionTransaction(e){return di({aptosConfig:this.config,...e})}async mintDigitalAssetTransaction(e){return mi({aptosConfig:this.config,...e})}async transferDigitalAssetTransaction(e){return yi({aptosConfig:this.config,...e})}async mintSoulBoundTransaction(e){return Ai({aptosConfig:this.config,...e})}async burnDigitalAssetTransaction(e){return fi({aptosConfig:this.config,...e})}async freezeDigitalAssetTransaferTransaction(e){return hi({aptosConfig:this.config,...e})}async unfreezeDigitalAssetTransaferTransaction(e){return Ti({aptosConfig:this.config,...e})}async setDigitalAssetDescriptionTransaction(e){return bi({aptosConfig:this.config,...e})}async setDigitalAssetNameTransaction(e){return wi({aptosConfig:this.config,...e})}async setDigitalAssetURITransaction(e){return _i({aptosConfig:this.config,...e})}async addDigitalAssetPropertyTransaction(e){return Si({aptosConfig:this.config,...e})}async removeDigitalAssetPropertyTransaction(e){return xi({aptosConfig:this.config,...e})}async updateDigitalAssetPropertyTransaction(e){return vi({aptosConfig:this.config,...e})}async addDigitalAssetTypedPropertyTransaction(e){return Ci({aptosConfig:this.config,...e})}async updateDigitalAssetTypedPropertyTransaction(e){return Pi({aptosConfig:this.config,...e})}};var Ei=300,pa=n=>{if(n&&n.length>Ei)throw new Error(`Event type length exceeds the maximum length of ${Ei}`)};async function Ui(n){let{aptosConfig:e,eventType:t,options:r}=n,i={where:{account_address:{_eq:"0x0000000000000000000000000000000000000000000000000000000000000000"},creation_number:{_eq:"0"},sequence_number:{_eq:"0"},indexed_type:{_eq:t}},pagination:r,orderBy:_optionalChain([r, 'optionalAccess', _126 => _126.orderBy])};return Ft({aptosConfig:e,options:i})}async function Ri(n){let{accountAddress:e,aptosConfig:t,creationNumber:r,options:o}=n,a={where:{account_address:{_eq:u.from(e).toStringLong()},creation_number:{_eq:r}},pagination:o,orderBy:_optionalChain([o, 'optionalAccess', _127 => _127.orderBy])};return Ft({aptosConfig:t,options:a})}async function zi(n){let{accountAddress:e,aptosConfig:t,eventType:r,options:o}=n,a={where:{account_address:{_eq:u.from(e).toStringLong()},indexed_type:{_eq:r}},pagination:o,orderBy:_optionalChain([o, 'optionalAccess', _128 => _128.orderBy])};return Ft({aptosConfig:t,options:a})}async function Ft(n){let{aptosConfig:e,options:t}=n;pa(_optionalChain([t, 'optionalAccess', _129 => _129.where, 'optionalAccess', _130 => _130.indexed_type, 'optionalAccess', _131 => _131._eq]));let r={query:mo,variables:{where_condition:_optionalChain([t, 'optionalAccess', _132 => _132.where]),offset:_optionalChain([t, 'optionalAccess', _133 => _133.offset]),limit:_optionalChain([t, 'optionalAccess', _134 => _134.limit]),order_by:_optionalChain([t, 'optionalAccess', _135 => _135.orderBy])}};return(await m({aptosConfig:e,query:r,originMethod:"getEvents"})).events}var Kt=class{constructor(e){this.config=e}async getModuleEventsByEventType(e){return await y({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"events_processor"}),Ui({aptosConfig:this.config,...e})}async getAccountEventsByCreationNumber(e){return await y({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"events_processor"}),Ri({aptosConfig:this.config,...e})}async getAccountEventsByEventType(e){return await y({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"events_processor"}),zi({aptosConfig:this.config,...e})}async getEvents(e){return await y({config:this.config,minimumLedgerVersion:_optionalChain([e, 'optionalAccess', _136 => _136.minimumLedgerVersion]),processorType:"events_processor"}),Ft({aptosConfig:this.config,...e})}};async function Gi(n){let{aptosConfig:e,accountAddress:t,amount:r,options:o}=n,i=_optionalChain([o, 'optionalAccess', _137 => _137.timeoutSecs])||20,{data:s}=await to({aptosConfig:e,path:"fund",body:{address:u.from(t).toString(),amount:r},originMethod:"fundAccount"}),a=s.txn_hashes[0],c=await At({aptosConfig:e,transactionHash:a,options:{timeoutSecs:i,checkSuccess:_optionalChain([o, 'optionalAccess', _138 => _138.checkSuccess])}});if(c.type==="user_transaction")return c;throw new Error(`Unexpected transaction received for fund account: ${c.type}`)}var qt=class{constructor(e){this.config=e}async fundAccount(e){let t=await Gi({aptosConfig:this.config,...e});return _optionalChain([e, 'access', _139 => _139.options, 'optionalAccess', _140 => _140.waitForIndexer])!==!1&&await xn({aptosConfig:this.config,minimumLedgerVersion:BigInt(t.version)}),t}};async function wr(n){let{aptosConfig:e,options:t}=n,r={query:Ao,variables:{where_condition:_optionalChain([t, 'optionalAccess', _141 => _141.where]),limit:_optionalChain([t, 'optionalAccess', _142 => _142.limit]),offset:_optionalChain([t, 'optionalAccess', _143 => _143.offset])}};return(await m({aptosConfig:e,query:r,originMethod:"getFungibleAssetMetadata"})).fungible_asset_metadata}async function Di(n){let{aptosConfig:e,options:t}=n,r={query:yo,variables:{where_condition:_optionalChain([t, 'optionalAccess', _144 => _144.where]),limit:_optionalChain([t, 'optionalAccess', _145 => _145.limit]),offset:_optionalChain([t, 'optionalAccess', _146 => _146.offset])}};return(await m({aptosConfig:e,query:r,originMethod:"getFungibleAssetActivities"})).fungible_asset_activities}async function Ni(n){let{aptosConfig:e,options:t}=n,r={query:lo,variables:{where_condition:_optionalChain([t, 'optionalAccess', _147 => _147.where]),limit:_optionalChain([t, 'optionalAccess', _148 => _148.limit]),offset:_optionalChain([t, 'optionalAccess', _149 => _149.offset])}};return(await m({aptosConfig:e,query:r,originMethod:"getCurrentFungibleAssetBalances"})).current_fungible_asset_balances}var da={typeParameters:[{constraints:[]}],parameters:[we("0x1::object::Object"),new H,new $]};async function Bi(n){let{aptosConfig:e,sender:t,fungibleAssetMetadataAddress:r,recipient:o,amount:i,options:s}=n;return A({aptosConfig:e,sender:t.accountAddress,data:{function:"0x1::primary_fungible_store::transfer",typeArguments:["0x1::fungible_asset::Metadata"],functionArguments:[r,o,i],abi:da},options:s})}var $t=class{constructor(e){this.config=e}async getFungibleAssetMetadata(e){return await y({config:this.config,minimumLedgerVersion:_optionalChain([e, 'optionalAccess', _150 => _150.minimumLedgerVersion]),processorType:"fungible_asset_processor"}),wr({aptosConfig:this.config,...e})}async getFungibleAssetMetadataByAssetType(e){return await y({config:this.config,minimumLedgerVersion:_optionalChain([e, 'optionalAccess', _151 => _151.minimumLedgerVersion]),processorType:"fungible_asset_processor"}),(await wr({aptosConfig:this.config,options:{where:{asset_type:{_eq:e.assetType}}}}))[0]}async getFungibleAssetActivities(e){return await y({config:this.config,minimumLedgerVersion:_optionalChain([e, 'optionalAccess', _152 => _152.minimumLedgerVersion]),processorType:"fungible_asset_processor"}),Di({aptosConfig:this.config,...e})}async getCurrentFungibleAssetBalances(e){return await y({config:this.config,minimumLedgerVersion:_optionalChain([e, 'optionalAccess', _153 => _153.minimumLedgerVersion]),processorType:"fungible_asset_processor"}),Ni({aptosConfig:this.config,...e})}async transferFungibleAsset(e){return Bi({aptosConfig:this.config,...e})}};async function Ue(n){let{aptosConfig:e,payload:t,options:r}=n,o=await Jo({...t,aptosConfig:e}),i=new X;o.serialize(i);let s=i.toUint8Array(),{data:a}=await We({aptosConfig:e,path:"view",originMethod:"view",contentType:"application/x.aptos.view_function+bcs",params:{ledger_version:_optionalChain([r, 'optionalAccess', _154 => _154.ledgerVersion])},body:s});return a}var Vt=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 wo({aptosConfig:this.config,...e})}async getBlockByHeight(e){return _o({aptosConfig:this.config,...e})}async view(e){return Ue({aptosConfig:this.config,...e})}async getChainTopUserTransactions(e){return So({aptosConfig:this.config,...e})}async queryIndexer(e){return m({aptosConfig:this.config,...e})}async getIndexerLastSuccessVersion(){return hn({aptosConfig:this.config})}async getProcessorStatus(e){return Tn({aptosConfig:this.config,processorType:e})}};var ki=["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 Oi(n){return!(!n||n.length<3||n.length>63||!/^[a-z\d][a-z\d-]{1,61}[a-z\d]$/.test(n))}function Re(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(!Oi(e))throw new Error(`${e} is not valid. ${ki}`);if(t&&!Oi(t))throw new Error(`${t} is not valid. ${ki}`);return{domainName:t||e,subdomainName:t?e:void 0}}var la="0x585fc9f0f0c54183b039ffc770ca282ebd87307916c215a3e692f2f8e4305e82",ga={testnet:"0x5f8fd2347449685cf41d4db97926ec3a096eaf381332be4f1318ad4d16a8497c",mainnet:"0x867ed1f6bf916171b1de3ee92849b8978b7d1b9e0a8cc982a3d19d535dfd9c0c",local:la,custom:null,devnet:null};function _e(n){let e=ga[n.network];if(!e)throw new Error(`The ANS contract is not deployed to ${n.network}`);return e}var Dn=n=>{if(n&&typeof n=="object"&&"vec"in n&&Array.isArray(n.vec))return n.vec[0]};async function Mi(n){let{aptosConfig:e,name:t}=n,r=_e(e),{domainName:o,subdomainName:i}=Re(t),s=await Ue({aptosConfig:e,payload:{function:`${r}::router::get_owner_addr`,functionArguments:[o,i]}}),a=Dn(s[0]);return a?u.from(a):void 0}async function Fi(n){let{aptosConfig:e,expiration:t,name:r,sender:o,targetAddress:i,toAddress:s,options:a,transferable:c}=n,p=_e(e),{domainName:f,subdomainName:G}=Re(r),b=t.policy==="subdomain:independent"||t.policy==="subdomain:follow-domain";if(G&&!b)throw new Error("Subdomains must have an expiration policy of either 'subdomain:independent' or 'subdomain:follow-domain'");if(b&&!G)throw new Error(`Policy is set to ${t.policy} but no subdomain was provided`);if(t.policy==="domain"){let Fn=_nullishCoalesce(t.years, () => (1));if(Fn!==1)throw new Error("For now, names can only be registered for 1 year at a time");let ns=Fn*31536e3;return await A({aptosConfig:e,sender:o.accountAddress.toString(),data:{function:`${p}::router::register_domain`,functionArguments:[f,ns,i,s]},options:a})}if(!G)throw new Error(`${t.policy} requires a subdomain to be provided.`);let l=await _r({aptosConfig:e,name:f});if(!l)throw new Error("The domain does not exist");let ye=t.policy==="subdomain:independent"?t.expirationDate:l;if(ye>l)throw new Error("The subdomain expiration time cannot be greater than the domain expiration time");return await A({aptosConfig:e,sender:o.accountAddress.toString(),data:{function:`${p}::router::register_subdomain`,functionArguments:[f,G,Math.round(ye/1e3),t.policy==="subdomain:follow-domain"?1:0,!!c,i,s]},options:a})}async function _r(n){let{aptosConfig:e,name:t}=n,r=_e(e),{domainName:o,subdomainName:i}=Re(t);try{let s=await Ue({aptosConfig:e,payload:{function:`${r}::router::get_expiration`,functionArguments:[o,i]}});return Number(s[0])*1e3}catch (e3){return}}async function Ki(n){let{aptosConfig:e,address:t}=n,r=_e(e),o=await Ue({aptosConfig:e,payload:{function:`${r}::router::get_primary_name`,functionArguments:[u.from(t).toString()]}}),i=Dn(o[1]),s=Dn(o[0]);if(i)return[s,i].filter(Boolean).join(".")}async function qi(n){let{aptosConfig:e,sender:t,name:r,options:o}=n,i=_e(e);if(!r)return await A({aptosConfig:e,sender:t.accountAddress.toString(),data:{function:`${i}::router::clear_primary_name`,functionArguments:[]},options:o});let{domainName:s,subdomainName:a}=Re(r);return await A({aptosConfig:e,sender:t.accountAddress.toString(),data:{function:`${i}::router::set_primary_name`,functionArguments:[s,a]},options:o})}async function $i(n){let{aptosConfig:e,name:t}=n,r=_e(e),{domainName:o,subdomainName:i}=Re(t),s=await Ue({aptosConfig:e,payload:{function:`${r}::router::get_target_addr`,functionArguments:[o,i]}}),a=Dn(s[0]);return a?u.from(a):void 0}async function Vi(n){let{aptosConfig:e,sender:t,name:r,address:o,options:i}=n,s=_e(e),{domainName:a,subdomainName:c}=Re(r);return await A({aptosConfig:e,sender:t.accountAddress.toString(),data:{function:`${s}::router::set_target_addr`,functionArguments:[a,c,o]},options:i})}async function Li(n){let{aptosConfig:e,name:t}=n,{domainName:r,subdomainName:o=""}=Re(t),a=(await m({aptosConfig:e,query:{query:mt,variables:{where_condition:{domain:{_eq:r},subdomain:{_eq:o},is_active:{_eq:!0}},limit:1}},originMethod:"getName"})).current_aptos_names[0];return a&&(a=Lt(a)),a}async function Hi(n){let{aptosConfig:e,options:t,accountAddress:r}=n,o=await Sr({aptosConfig:e});return(await m({aptosConfig:e,originMethod:"getAccountNames",query:{query:mt,variables:{limit:_optionalChain([t, 'optionalAccess', _155 => _155.limit]),offset:_optionalChain([t, 'optionalAccess', _156 => _156.offset]),order_by:_optionalChain([t, 'optionalAccess', _157 => _157.orderBy]),where_condition:{..._nullishCoalesce(_optionalChain([n, 'access', _158 => _158.options, 'optionalAccess', _159 => _159.where]), () => ({})),owner_address:{_eq:r.toString()},expiration_timestamp:{_gte:o}}}}})).current_aptos_names.map(Lt)}async function Qi(n){let{aptosConfig:e,options:t,accountAddress:r}=n,o=await Sr({aptosConfig:e});return(await m({aptosConfig:e,originMethod:"getAccountDomains",query:{query:mt,variables:{limit:_optionalChain([t, 'optionalAccess', _160 => _160.limit]),offset:_optionalChain([t, 'optionalAccess', _161 => _161.offset]),order_by:_optionalChain([t, 'optionalAccess', _162 => _162.orderBy]),where_condition:{..._nullishCoalesce(_optionalChain([n, 'access', _163 => _163.options, 'optionalAccess', _164 => _164.where]), () => ({})),owner_address:{_eq:r.toString()},expiration_timestamp:{_gte:o},subdomain:{_eq:""}}}}})).current_aptos_names.map(Lt)}async function Wi(n){let{aptosConfig:e,options:t,accountAddress:r}=n,o=await Sr({aptosConfig:e});return(await m({aptosConfig:e,originMethod:"getAccountSubdomains",query:{query:mt,variables:{limit:_optionalChain([t, 'optionalAccess', _165 => _165.limit]),offset:_optionalChain([t, 'optionalAccess', _166 => _166.offset]),order_by:_optionalChain([t, 'optionalAccess', _167 => _167.orderBy]),where_condition:{..._nullishCoalesce(_optionalChain([n, 'access', _168 => _168.options, 'optionalAccess', _169 => _169.where]), () => ({})),owner_address:{_eq:r.toString()},expiration_timestamp:{_gte:o},subdomain:{_neq:""}}}}})).current_aptos_names.map(Lt)}async function ji(n){let{aptosConfig:e,options:t,domain:r}=n;return(await m({aptosConfig:e,originMethod:"getDomainSubdomains",query:{query:mt,variables:{limit:_optionalChain([t, 'optionalAccess', _170 => _170.limit]),offset:_optionalChain([t, 'optionalAccess', _171 => _171.offset]),order_by:_optionalChain([t, 'optionalAccess', _172 => _172.orderBy]),where_condition:{..._nullishCoalesce(_optionalChain([n, 'access', _173 => _173.options, 'optionalAccess', _174 => _174.where]), () => ({})),domain:{_eq:r},subdomain:{_neq:""},is_active:{_eq:!0}}}}})).current_aptos_names.map(Lt)}async function Sr(n){let{aptosConfig:e}=n,t=_e(e),[r]=await Ue({aptosConfig:e,payload:{function:`${t}::config::reregistration_grace_sec`,functionArguments:[]}}),o=r/60/60/24,i=()=>new Date;return new Date(i().setDate(i().getDate()-o)).toISOString()}async function Xi(n){let{aptosConfig:e,sender:t,name:r,years:o=1,options:i}=n,s=_e(e),a=o*31536e3,{domainName:c,subdomainName:p}=Re(r);if(p)throw new Error("Subdomains cannot be renewed");if(o!==1)throw new Error("Currently, only 1 year renewals are supported");return await A({aptosConfig:e,sender:t.accountAddress.toString(),data:{function:`${s}::router::renew_domain`,functionArguments:[c,a]},options:i})}function Lt(n){return{...n,expiration_timestamp:new Date(n.expiration_timestamp).getTime()}}var Ht=class{constructor(e){this.config=e}async getOwnerAddress(e){return Mi({aptosConfig:this.config,...e})}async getExpiration(e){return _r({aptosConfig:this.config,...e})}async getTargetAddress(e){return $i({aptosConfig:this.config,...e})}async setTargetAddress(e){return Vi({aptosConfig:this.config,...e})}async getPrimaryName(e){return Ki({aptosConfig:this.config,...e})}async setPrimaryName(e){return qi({aptosConfig:this.config,...e})}async registerName(e){return Fi({aptosConfig:this.config,...e})}async renewDomain(e){return Xi({aptosConfig:this.config,...e})}async getName(e){return Li({aptosConfig:this.config,...e})}async getAccountNames(e){return Hi({aptosConfig:this.config,...e})}async getAccountDomains(e){return Qi({aptosConfig:this.config,...e})}async getAccountSubdomains(e){return Wi({aptosConfig:this.config,...e})}async getDomainSubdomains(e){return ji({aptosConfig:this.config,...e})}};async function Yi(n){let{aptosConfig:e,poolAddress:t}=n,r=u.from(t).toStringLong(),i=await m({aptosConfig:e,query:{query:Yn,variables:{where_condition:{pool_address:{_eq:r}}}}});return i.num_active_delegator_per_pool[0]?i.num_active_delegator_per_pool[0].num_active_delegator:0}async function Zi(n){let{aptosConfig:e,options:t}=n,r={query:Yn,variables:{order_by:_optionalChain([t, 'optionalAccess', _175 => _175.orderBy])}};return(await m({aptosConfig:e,query:r})).num_active_delegator_per_pool}async function Ji(n){let{aptosConfig:e,delegatorAddress:t,poolAddress:r}=n,o={query:go,variables:{delegatorAddress:u.from(t).toStringLong(),poolAddress:u.from(r).toStringLong()}};return(await m({aptosConfig:e,query:o})).delegated_staking_activities}var Qt=class{constructor(e){this.config=e}async getNumberOfDelegators(e){return await y({config:this.config,minimumLedgerVersion:_optionalChain([e, 'optionalAccess', _176 => _176.minimumLedgerVersion]),processorType:"stake_processor"}),Yi({aptosConfig:this.config,...e})}async getNumberOfDelegatorsForAllPools(e){return await y({config:this.config,minimumLedgerVersion:_optionalChain([e, 'optionalAccess', _177 => _177.minimumLedgerVersion]),processorType:"stake_processor"}),Zi({aptosConfig:this.config,...e})}async getDelegatedStakingActivities(e){return await y({config:this.config,minimumLedgerVersion:_optionalChain([e, 'optionalAccess', _178 => _178.minimumLedgerVersion]),processorType:"stake_processor"}),Ji({aptosConfig:this.config,...e})}};var Nn=class{constructor(e){this.config=e}async simple(e){return A({aptosConfig:this.config,...e})}async multiAgent(e){return A({aptosConfig:this.config,...e})}};function xr(n,e,t){let r=t.value;return t.value=async function(...o){let[i]=o;if(i.transaction.feePayerAddress&&!i.feePayerAuthenticator)throw new Error("You are submitting a Fee Payer transaction but missing the feePayerAuthenticator");return r.apply(this,o)},t}function vr(n,e,t){let r=t.value;return t.value=async function(...o){let[i]=o;if(i.transaction.feePayerAddress&&!i.feePayerPublicKey)throw new Error("You are simulating a Fee Payer transaction but missing the feePayerPublicKey");return r.apply(this,o)},t}var Tt=class{constructor(e){this.config=e}async simple(e){return hr({aptosConfig:this.config,...e})}async multiAgent(e){return hr({aptosConfig:this.config,...e})}};_chunkKSEUZTKYjs.a.call(void 0, [vr],Tt.prototype,"simple",1),_chunkKSEUZTKYjs.a.call(void 0, [vr],Tt.prototype,"multiAgent",1);var bt=class{constructor(e){this.config=e}async simple(e){return Gn({aptosConfig:this.config,...e})}async multiAgent(e){return Gn({aptosConfig:this.config,...e})}};_chunkKSEUZTKYjs.a.call(void 0, [xr],bt.prototype,"simple",1),_chunkKSEUZTKYjs.a.call(void 0, [xr],bt.prototype,"multiAgent",1);var _eventemitter3 = require('eventemitter3'); var _eventemitter32 = _interopRequireDefault(_eventemitter3);var Bn=()=>Math.floor(Date.now()/1e3),kn= exports.AccountSequenceNumber =class{constructor(e,t,r,o,i){this.lastUncommintedNumber=null;this.currentNumber=null;this.lock=!1;this.aptosConfig=e,this.account=t,this.maxWaitTime=r,this.maximumInFlight=o,this.sleepTime=i}async nextSequenceNumber(){for(;this.lock;)await _chunkKSEUZTKYjs.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=Bn();for(;this.currentNumber-this.lastUncommintedNumber>=this.maximumInFlight;)await _chunkKSEUZTKYjs.b.call(void 0, this.sleepTime),Bn()-t>this.maxWaitTime?(console.warn(`Waited over 30 seconds for a transaction to commit, resyncing ${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 me({aptosConfig:this.aptosConfig,accountAddress:this.account.accountAddress});this.currentNumber=BigInt(e),this.lastUncommintedNumber=BigInt(e)}async update(){let{sequence_number:e}=await me({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 _chunkKSEUZTKYjs.b.call(void 0, this.sleepTime);this.lock=!0;try{await this.update();let e=Bn();for(;this.lastUncommintedNumber!==this.currentNumber;)Bn()-e>this.maxWaitTime?(console.warn(`Waited over 30 seconds for a transaction to commit, resyncing ${this.account.accountAddress.toString()}`),await this.initialize()):(await _chunkKSEUZTKYjs.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 wt=class{constructor(){this.queue=[];this.pendingDequeue=[];this.cancelled=!1}enqueue(e){if(this.cancelled=!1,this.pendingDequeue.length>0){_optionalChain([this, 'access', _179 => _179.pendingDequeue, 'access', _180 => _180.shift, 'call', _181 => _181(), 'optionalAccess', _182 => _182.resolve, 'call', _183 => _183(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 _t("Task cancelled"))}),this.pendingDequeue=[],this.queue.length=0}isCancelled(){return this.cancelled}pendingDequeueLength(){return this.pendingDequeue.length}},_t=class extends Error{};var es="fulfilled",ts= exports.TransactionWorkerEventsEnum =(i=>(i.TransactionSent="transactionSent",i.TransactionSendFailed="transactionSendFailed",i.TransactionExecuted="transactionExecuted",i.TransactionExecutionFailed="transactionExecutionFailed",i.ExecutionFinish="executionFinish",i))(ts||{}),On= exports.TransactionWorker =class extends _eventemitter32.default{constructor(t,r,o=30,i=100,s=10){super();this.taskQueue=new wt;this.transactionsQueue=new wt;this.outstandingTransactions=new wt;this.sentTransactions=[];this.executedTransactions=[];this.aptosConfig=t,this.account=r,this.started=!1,this.accountSequnceNumber=new kn(t,r,o,i,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 o=kt({aptosConfig:this.aptosConfig,transaction:r,signer:this.account});await this.outstandingTransactions.enqueue([o,t])}}catch(t){if(t instanceof _t)return;throw new Error(`Submit transaction failed for ${this.account.accountAddress.toString()} with error ${t}`)}}async processTransactions(){try{for(;;){let t=[],r=[],[o,i]=await this.outstandingTransactions.dequeue();for(t.push(o),r.push(i);!this.outstandingTransactions.isEmpty();)[o,i]=await this.outstandingTransactions.dequeue(),t.push(o),r.push(i);let s=await Promise.allSettled(t);for(let a=0;a<s.length&&a<r.length;a+=1){let c=s[a];i=r[a],c.status===es?(this.sentTransactions.push([c.value.hash,i,null]),this.emit("transactionSent",{message:`transaction hash ${c.value.hash} has been committed to chain`,transactionHash:c.value.hash}),await this.checkTransaction(c,i)):(this.sentTransactions.push([c.status,i,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 _t)return;throw new Error(`Process execution failed for ${this.account.accountAddress.toString()} with error ${t}`)}}async checkTransaction(t,r){try{let o=[];o.push(At({aptosConfig:this.aptosConfig,transactionHash:t.value.hash}));let i=await Promise.allSettled(o);for(let s=0;s<i.length;s+=1){let a=i[s];a.status===es?(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(o){throw new Error(`Check transaction failed for ${this.account.accountAddress.toString()} with error ${o}`)}}async push(t,r){this.transactionsQueue.enqueue([t,r])}async generateNextTransaction(t,r){if(this.transactionsQueue.isEmpty())return;let[o,i]=await this.transactionsQueue.dequeue();return A({aptosConfig:this.aptosConfig,sender:t.accountAddress,data:o,options:{...i,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 Mn=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:r}=e;for(let o of t)this.transactionWorker.push(o,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:o}=e;this.start({sender:t}),this.push({data:r,options:o})}catch(t){throw new Error(`failed to submit transactions with error: ${t}`)}}};var Wt=class{constructor(e){this.config=e,this.build=new Nn(this.config),this.simulate=new Tt(this.config),this.submit=new bt(this.config),this.batch=new Mn(this.config)}async getTransactions(e){return Fo({aptosConfig:this.config,...e})}async getTransactionByVersion(e){return Ko({aptosConfig:this.config,...e})}async getTransactionByHash(e){return Dt({aptosConfig:this.config,...e})}async isPendingTransaction(e){return qo({aptosConfig:this.config,...e})}async waitForTransaction(e){return At({aptosConfig:this.config,...e})}async getGasPriceEstimation(){return Sn({aptosConfig:this.config})}getSigningMessage(e){return ri(e)}async publishPackageTransaction(e){return oi({aptosConfig:this.config,...e})}async rotateAuthKey(e){return ii({aptosConfig:this.config,...e})}sign(e){return zn({...e})}signAsFeePayer(e){let{signer:t,transaction:r}=e;if(!r.feePayerAddress)throw new Error(`Transaction ${r} is not a Fee Payer transaction`);return r.feePayerAddress=t.accountAddress,zn({signer:t,transaction:r})}async batchTransactionsForSingleAccount(e){try{let{sender:t,data:r,options:o}=e;this.batch.forSingleAccount({sender:t,data:r,options:o})}catch(t){throw new Error(`failed to submit transactions with error: ${t}`)}}async signAndSubmitTransaction(e){let{signer:t,transaction:r}=e;return kt({aptosConfig:this.config,signer:t,transaction:r})}};var jt=class{constructor(e){this.config=e}async getTableItem(e){return bn({aptosConfig:this.config,...e})}async getTableItemsData(e){return await y({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"default_processor"}),xo({aptosConfig:this.config,...e})}async getTableItemsMetadata(e){return await y({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"default_processor"}),vo({aptosConfig:this.config,...e})}};var j=class{constructor(e){this.config=new vn(e),this.account=new Nt(this.config),this.ans=new Ht(this.config),this.coin=new Ot(this.config),this.digitalAsset=new Mt(this.config),this.event=new Kt(this.config),this.faucet=new qt(this.config),this.fungibleAsset=new $t(this.config),this.general=new Vt(this.config),this.staking=new Qt(this.config),this.transaction=new Wt(this.config),this.table=new jt(this.config)}};function ue(n,e,t){Object.getOwnPropertyNames(e.prototype).forEach(r=>{let o=Object.getOwnPropertyDescriptor(e.prototype,r);o&&(o.value=function(...i){return this[t][r](...i)},Object.defineProperty(n.prototype,r,o))})}ue(j,Nt,"account");ue(j,Ht,"ans");ue(j,Ot,"coin");ue(j,Mt,"digitalAsset");ue(j,Kt,"event");ue(j,qt,"faucet");ue(j,$t,"fungibleAsset");ue(j,Vt,"general");ue(j,Qt,"staking");ue(j,Wt,"transaction");ue(j,jt,"table");exports.APTOS_BIP44_REGEX = As; exports.APTOS_COIN = cn; exports.APTOS_HARDENED_REGEX = ys; exports.Account = Ie; exports.AccountAddress = u; exports.AccountAuthenticator = O; exports.AccountAuthenticatorEd25519 = ae; exports.AccountAuthenticatorMultiEd25519 = sn; exports.AccountAuthenticatorMultiKey = Fe; exports.AccountAuthenticatorSingleKey = ce; exports.AccountAuthenticatorVariant = Ur; exports.AccountPublicKey = pe; exports.AccountSequenceNumber = kn; exports.AddressInvalidReason = ds; exports.AnyPublicKey = B; exports.AnyPublicKeyVariant = Rr; exports.AnySignature = q; exports.AnySignatureVariant = zr; exports.Aptos = j; exports.AptosApiError = ge; exports.AptosApiType = Ct; exports.AptosConfig = vn; exports.AuthenticationKey = K; exports.Bool = I; exports.CKDPriv = Mr; exports.ChainId = tt; exports.DEFAULT_MAX_GAS_AMOUNT = $r; exports.DEFAULT_TXN_EXP_SEC_FROM_NOW = Vr; exports.DEFAULT_TXN_TIMEOUT_SEC = an; exports.DeriveScheme = us; exports.Deserializer = Jt; exports.Ed25519Account = dt; exports.Ed25519PrivateKey = J; exports.Ed25519PublicKey = E; exports.Ed25519Signature = U; exports.EntryFunction = Ve; exports.EntryFunctionBytes = en; exports.FeePayerRawTransaction = He; exports.FixedBytes = De; exports.HARDENED_OFFSET = Br; exports.Hex = h; exports.HexInvalidReason = is; exports.Identifier = P; exports.KeyType = fs; exports.MimeType = tn; exports.ModuleId = Pt; exports.MoveAbility = Gr; exports.MoveFunctionVisibility = as; exports.MoveOption = Ce; exports.MoveString = w; exports.MoveVector = T; exports.MultiAgentRawTransaction = Le; exports.MultiAgentTransaction = gn; exports.MultiEd25519PublicKey = Ze; exports.MultiEd25519Signature = Be; exports.MultiKey = et; exports.MultiKeyAccount = Hr; exports.MultiKeySignature = Me; exports.MultiSig = zt; exports.MultiSigTransactionPayload = Gt; exports.Network = Qn; exports.NetworkToChainId = Wn; exports.NetworkToFaucetAPI = Xr; exports.NetworkToIndexerAPI = Wr; exports.NetworkToNetworkName = zl; exports.NetworkToNodeAPI = jr; exports.ParsingError = F; exports.ProcessorType = Ke; exports.PublicKey = vt; exports.RAW_TRANSACTION_SALT = Lr; exports.RAW_TRANSACTION_WITH_DATA_SALT = Ln; exports.RawTransaction = te; exports.RawTransactionWithData = pn; exports.RoleType = cs; exports.RotationProofChallenge = dn; exports.Script = Rt; exports.ScriptTransactionArgumentVariants = xt; exports.Secp256k1PrivateKey = Oe; exports.Secp256k1PublicKey = fe; exports.Secp256k1Signature = he; exports.Serializable = d; exports.Serializer = X; exports.Signature = Y; exports.SignedTransaction = Qe; exports.SigningScheme = ve; exports.SigningSchemeInput = $n; exports.SimpleTransaction = ln; exports.SingleKeyAccount = lt; exports.StructTag = Te; exports.TransactionAuthenticator = be; exports.TransactionAuthenticatorEd25519 = st; exports.TransactionAuthenticatorFeePayer = ct; exports.TransactionAuthenticatorMultiAgent = at; exports.TransactionAuthenticatorMultiEd25519 = Hn; exports.TransactionAuthenticatorSingleSender = ut; exports.TransactionAuthenticatorVariant = Er; exports.TransactionPayload = $e; exports.TransactionPayloadEntryFunction = Et; exports.TransactionPayloadMultiSig = Ut; exports.TransactionPayloadScript = It; exports.TransactionPayloadVariants = Pr; exports.TransactionResponseType = qn; exports.TransactionVariants = Ir; exports.TransactionWorker = On; exports.TransactionWorkerEventsEnum = ts; exports.TypeTag = R; exports.TypeTagAddress = H; exports.TypeTagBool = k; exports.TypeTagGeneric = z; exports.TypeTagParserError = v; exports.TypeTagParserErrorType = zs; exports.TypeTagReference = un; exports.TypeTagSigner = qe; exports.TypeTagStruct = g; exports.TypeTagU128 = ot; exports.TypeTagU16 = nt; exports.TypeTagU256 = it; exports.TypeTagU32 = rt; exports.TypeTagU64 = $; exports.TypeTagU8 = le; exports.TypeTagVariants = Cr; exports.TypeTagVector = x; exports.U128 = ie; exports.U16 = re; exports.U256 = se; exports.U32 = oe; exports.U64 = D; exports.U8 = N; exports.aptosCoinStructTag = Up; exports.aptosRequest = yn; exports.buildTransaction = Ar; exports.checkOrConvertArgument = ht; exports.convertArgument = yr; exports.deriveKey = Vn; exports.deriveTransactionType = Ss; exports.deserializeFromScriptArgument = ws; exports.ensureBoolean = Kn; exports.fetchEntryFunctionAbi = Yo; exports.fetchFunctionAbi = Xo; exports.fetchViewFunctionAbi = Zo; exports.findFirstNonSignerArg = jo; exports.generateRawTransaction = Fs; exports.generateSignedTransaction = fr; exports.generateSignedTransactionForSimulation = ei; exports.generateSigningMessage = mn; exports.generateSigningMessageForSerializable = qd; exports.generateSigningMessageForTransaction = pt; exports.generateTransactionPayload = Rn; exports.generateTransactionPayloadWithABI = ks; exports.generateUserTransactionHash = Bm; exports.generateViewFunctionPayload = Jo; exports.generateViewFunctionPayloadWithABI = Os; exports.get = Jr; exports.getAptosFullNode = W; exports.getAuthenticatorForSimulation = Un; exports.getFunctionParts = Bt; exports.hashValues = ti; exports.isBcsAddress = En; exports.isBcsBool = ir; exports.isBcsFixedBytes = Gs; exports.isBcsString = sr; exports.isBcsU128 = dr; exports.isBcsU16 = cr; exports.isBcsU256 = lr; exports.isBcsU32 = ur; exports.isBcsU64 = pr; exports.isBcsU8 = ar; exports.isBlockMetadataTransactionResponse = Ka; exports.isBool = Lo; exports.isEd25519Signature = Va; exports.isEncodedEntryFunctionArgument = Qo; exports.isFeePayerSignature = Qa; exports.isGenesisTransactionResponse = Fa; exports.isLargeNumber = In; exports.isMultiAgentSignature = Ha; exports.isMultiEd25519Signature = Wa; exports.isNull = Ho; exports.isNumber = Pn; exports.isPendingTransactionResponse = Oa; exports.isScriptDataInput = Wo; exports.isSecp256k1Signature = La; exports.isStateCheckpointTransactionResponse = qa; exports.isString = ft; exports.isUserTransactionResponse = Ma; exports.isValidBIP44Path = kr; exports.isValidHardenedPath = Or; exports.isValidatorTransactionResponse = $a; exports.mnemonicToSeed = nn; exports.normalizeBundle = Yr; exports.objectStructTag = Q; exports.optionStructTag = Rp; exports.outOfRangeErrorMessage = ss; exports.paginateWithCursor = gt; exports.parseTypeTag = we; exports.post = jn; exports.postAptosFaucet = to; exports.postAptosFullNode = We; exports.postAptosIndexer = eo; exports.promiseFulfilledStatus = es; exports.request = xs; exports.splitPath = Fr; exports.standardizeTypeTags = mr; exports.stringStructTag = S; exports.throwTypeMismatch = C; exports.validateNumberInRange = xe;
|
|
457
|
+
`;async function Vn(n){let{aptosConfig:t}=n,{data:e}=await q({aptosConfig:t,originMethod:"getLedgerInfo",path:""});return e}async function lo(n){let{aptosConfig:t,ledgerVersion:e,options:r}=n,{data:i}=await q({aptosConfig:t,originMethod:"getBlockByVersion",path:`blocks/by_version/${e}`,params:{with_transactions:_optionalChain([r, 'optionalAccess', _33 => _33.withTransactions])}});return i}async function go(n){let{aptosConfig:t,blockHeight:e,options:r}=n,{data:i}=await q({aptosConfig:t,originMethod:"getBlockByHeight",path:`blocks/by_height/${e}`,params:{with_transactions:_optionalChain([r, 'optionalAccess', _34 => _34.withTransactions])}});return i}async function mo(n){let{aptosConfig:t,limit:e}=n;return(await f({aptosConfig:t,query:{query:to,variables:{limit:e}},originMethod:"getChainTopUserTransactions"})).user_transactions}async function f(n){let{aptosConfig:t,query:e,originMethod:r}=n,{data:i}=await $i({aptosConfig:t,originMethod:_nullishCoalesce(r, () => ("queryIndexer")),path:"",body:e,overrides:{WITH_CREDENTIALS:!1}});return i}async function ja(n){let{aptosConfig:t}=n;return(await f({aptosConfig:t,query:{query:kr},originMethod:"getProcessorStatuses"})).processor_status}async function Ln(n){let t=await ja({aptosConfig:n.aptosConfig});return BigInt(t[0].last_success_version)}async function Hn(n){let{aptosConfig:t,processorType:e}=n;return(await f({aptosConfig:t,query:{query:kr,variables:{where_condition:{processor:{_eq:e}}}},originMethod:"getProcessorStatus"})).processor_status[0]}var Br=new Map;function Oe(n,t,e){return async(...r)=>{if(Br.has(t)){let{value:o,timestamp:s}=Br.get(t);if(e===void 0||Date.now()-s<=e)return o}let i=await n(...r);return Br.set(t,{value:i,timestamp:Date.now()}),i}}async function Qn(n){let{aptosConfig:t,handle:e,data:r,options:i}=n;return(await ut({aptosConfig:t,originMethod:"getTableItem",path:`tables/${e}/item`,params:{ledger_version:_optionalChain([i, 'optionalAccess', _35 => _35.ledgerVersion])},body:r})).data}async function yo(n){let{aptosConfig:t,options:e}=n,r={query:ao,variables:{where_condition:_optionalChain([e, 'optionalAccess', _36 => _36.where]),offset:_optionalChain([e, 'optionalAccess', _37 => _37.offset]),limit:_optionalChain([e, 'optionalAccess', _38 => _38.limit]),order_by:_optionalChain([e, 'optionalAccess', _39 => _39.orderBy])}};return(await f({aptosConfig:t,query:r,originMethod:"getTableItemsData"})).table_items}async function fo(n){let{aptosConfig:t,options:e}=n,r={query:co,variables:{where_condition:_optionalChain([e, 'optionalAccess', _40 => _40.where]),offset:_optionalChain([e, 'optionalAccess', _41 => _41.offset]),limit:_optionalChain([e, 'optionalAccess', _42 => _42.limit]),order_by:_optionalChain([e, 'optionalAccess', _43 => _43.orderBy])}};return(await f({aptosConfig:t,query:r,originMethod:"getTableItemsMetadata"})).table_metadatas}async function we(n){let{aptosConfig:t,accountAddress:e}=n,{data:r}=await q({aptosConfig:t,originMethod:"getInfo",path:`accounts/${u.from(e).toString()}`});return r}async function To(n){let{aptosConfig:t,accountAddress:e,options:r}=n;return Rt({aptosConfig:t,originMethod:"getModules",path:`accounts/${u.from(e).toString()}/modules`,params:{ledger_version:_optionalChain([r, 'optionalAccess', _44 => _44.ledgerVersion]),start:_optionalChain([r, 'optionalAccess', _45 => _45.offset]),limit:_nullishCoalesce(_optionalChain([r, 'optionalAccess', _46 => _46.limit]), () => (1e3))}})}async function Wn(n){return _optionalChain([n, 'access', _47 => _47.options, 'optionalAccess', _48 => _48.ledgerVersion])!==void 0?Ao(n):Oe(async()=>Ao(n),`module-${n.accountAddress}-${n.moduleName}`,1e3*60*5)()}async function Ao(n){let{aptosConfig:t,accountAddress:e,moduleName:r,options:i}=n,{data:o}=await q({aptosConfig:t,originMethod:"getModule",path:`accounts/${u.from(e).toString()}/module/${r}`,params:{ledger_version:_optionalChain([i, 'optionalAccess', _49 => _49.ledgerVersion])}});return o}async function bo(n){let{aptosConfig:t,accountAddress:e,options:r}=n;return Rt({aptosConfig:t,originMethod:"getTransactions",path:`accounts/${u.from(e).toString()}/transactions`,params:{start:_optionalChain([r, 'optionalAccess', _50 => _50.offset]),limit:_optionalChain([r, 'optionalAccess', _51 => _51.limit])}})}async function wo(n){let{aptosConfig:t,accountAddress:e,options:r}=n;return Rt({aptosConfig:t,originMethod:"getResources",path:`accounts/${u.from(e).toString()}/resources`,params:{ledger_version:_optionalChain([r, 'optionalAccess', _52 => _52.ledgerVersion]),start:_optionalChain([r, 'optionalAccess', _53 => _53.offset]),limit:_nullishCoalesce(_optionalChain([r, 'optionalAccess', _54 => _54.limit]), () => (999))}})}async function Or(n){let{aptosConfig:t,accountAddress:e,resourceType:r,options:i}=n,{data:o}=await q({aptosConfig:t,originMethod:"getResource",path:`accounts/${u.from(e).toString()}/resource/${r}`,params:{ledger_version:_optionalChain([i, 'optionalAccess', _55 => _55.ledgerVersion])}});return o.data}async function Fr(n){let{aptosConfig:t,authenticationKey:e,options:r}=n,i=await Or({aptosConfig:t,accountAddress:"0x1",resourceType:"0x1::account::OriginatingAddress",options:r}),{address_map:{handle:o}}=i,s=u.from(e);try{let a=await Qn({aptosConfig:t,handle:o,data:{key:s.toString(),key_type:"address",value_type:"address"},options:r});return u.from(a)}catch(a){if(a instanceof ye&&a.data.error_code==="table_item_not_found")return s;throw a}}async function So(n){let{aptosConfig:t,accountAddress:e}=n,i={owner_address:{_eq:u.from(e).toStringLong()},amount:{_gt:0}},s=await f({aptosConfig:t,query:{query:Ji,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 xo(n){let{aptosConfig:t,accountAddress:e,options:r}=n,o={owner_address:{_eq:u.from(e).toStringLong()},amount:{_gt:0}};_optionalChain([r, 'optionalAccess', _56 => _56.tokenStandard])&&(o.token_standard={_eq:_optionalChain([r, 'optionalAccess', _57 => _57.tokenStandard])});let s={query:Yi,variables:{where_condition:o,offset:_optionalChain([r, 'optionalAccess', _58 => _58.offset]),limit:_optionalChain([r, 'optionalAccess', _59 => _59.limit]),order_by:_optionalChain([r, 'optionalAccess', _60 => _60.orderBy])}};return(await f({aptosConfig:t,query:s,originMethod:"getAccountOwnedTokens"})).current_token_ownerships_v2}async function _o(n){let{aptosConfig:t,accountAddress:e,collectionAddress:r,options:i}=n,o=u.from(e).toStringLong(),s=u.from(r).toStringLong(),a={owner_address:{_eq:o},current_token_data:{collection_id:{_eq:s}},amount:{_gt:0}};_optionalChain([i, 'optionalAccess', _61 => _61.tokenStandard])&&(a.token_standard={_eq:_optionalChain([i, 'optionalAccess', _62 => _62.tokenStandard])});let c={query:Zi,variables:{where_condition:a,offset:_optionalChain([i, 'optionalAccess', _63 => _63.offset]),limit:_optionalChain([i, 'optionalAccess', _64 => _64.limit]),order_by:_optionalChain([i, 'optionalAccess', _65 => _65.orderBy])}};return(await f({aptosConfig:t,query:c,originMethod:"getAccountOwnedTokensFromCollectionAddress"})).current_token_ownerships_v2}async function vo(n){let{aptosConfig:t,accountAddress:e,options:r}=n,o={owner_address:{_eq:u.from(e).toStringLong()},amount:{_gt:0}};_optionalChain([r, 'optionalAccess', _66 => _66.tokenStandard])&&(o.current_collection={token_standard:{_eq:_optionalChain([r, 'optionalAccess', _67 => _67.tokenStandard])}});let s={query:ji,variables:{where_condition:o,offset:_optionalChain([r, 'optionalAccess', _68 => _68.offset]),limit:_optionalChain([r, 'optionalAccess', _69 => _69.limit]),order_by:_optionalChain([r, 'optionalAccess', _70 => _70.orderBy])}};return(await f({aptosConfig:t,query:s,originMethod:"getAccountCollectionsWithOwnedTokens"})).current_collection_ownership_v2_view}async function Po(n){let{aptosConfig:t,accountAddress:e}=n,r=u.from(e).toStringLong(),o=await f({aptosConfig:t,query:{query:eo,variables:{address:r}},originMethod:"getAccountTransactionsCount"});return o.account_transactions_aggregate.aggregate?o.account_transactions_aggregate.aggregate.count:0}async function Co(n){let{aptosConfig:t,accountAddress:e,coinType:r}=n,i=u.from(e).toStringLong(),o=await Mr({aptosConfig:t,accountAddress:i,options:{where:{asset_type:{_eq:r}}}});return o[0]?o[0].amount:0}async function Mr(n){let{aptosConfig:t,accountAddress:e,options:r}=n,i=u.from(e).toStringLong(),o={..._optionalChain([r, 'optionalAccess', _71 => _71.where]),owner_address:{_eq:i}},s={query:Wi,variables:{where_condition:o,offset:_optionalChain([r, 'optionalAccess', _72 => _72.offset]),limit:_optionalChain([r, 'optionalAccess', _73 => _73.limit]),order_by:_optionalChain([r, 'optionalAccess', _74 => _74.orderBy])}};return(await f({aptosConfig:t,query:s,originMethod:"getAccountCoinsData"})).current_fungible_asset_balances}async function Eo(n){let{aptosConfig:t,accountAddress:e}=n,r=u.from(e).toStringLong(),o=await f({aptosConfig:t,query:{query:Qi,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 Io(n){let{aptosConfig:t,accountAddress:e,options:r}=n,o={owner_address:{_eq:u.from(e).toStringLong()}},s={query:Xi,variables:{where_condition:o,offset:_optionalChain([r, 'optionalAccess', _75 => _75.offset]),limit:_optionalChain([r, 'optionalAccess', _76 => _76.limit]),order_by:_optionalChain([r, 'optionalAccess', _77 => _77.orderBy])}};return(await f({aptosConfig:t,query:s,originMethod:"getAccountOwnedObjects"})).current_objects}async function Uo(n){let{aptosConfig:t,privateKey:e}=n,r=new K(e.publicKey());if(e instanceof Xe){let o=F.fromPublicKey({publicKey:r}).derivedAddress();return Ne.fromPrivateKey({privateKey:e,address:o})}if(e instanceof $){let i=F.fromPublicKey({publicKey:r});if(await ho({authKey:i,aptosConfig:t})){let c=i.derivedAddress();return Ne.fromPrivateKey({privateKey:e,address:c,legacy:!1})}let s=F.fromPublicKey({publicKey:r.publicKey});if(await ho({authKey:s,aptosConfig:t})){let c=s.derivedAddress();return Ne.fromPrivateKey({privateKey:e,address:c,legacy:!0})}}throw new Error(`Can't derive account from private key ${e}`)}async function ho(n){let{aptosConfig:t,authKey:e}=n,r=await Fr({aptosConfig:t,authenticationKey:e.derivedAddress()});try{return await we({aptosConfig:t,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 Ro(n){let{aptosConfig:t,options:e}=n;return Rt({aptosConfig:t,originMethod:"getTransactions",path:"transactions",params:{start:_optionalChain([e, 'optionalAccess', _78 => _78.offset]),limit:_optionalChain([e, 'optionalAccess', _79 => _79.limit])}})}async function Xn(n){let{aptosConfig:t}=n;return Oe(async()=>{let{data:e}=await q({aptosConfig:t,originMethod:"getGasPriceEstimation",path:"estimate_gas_price"});return e},`gas-price-${t.network}`,1e3*60*5)()}async function zo(n){let{aptosConfig:t,ledgerVersion:e}=n,{data:r}=await q({aptosConfig:t,originMethod:"getTransactionByVersion",path:`transactions/by_version/${e}`});return r}async function nn(n){let{aptosConfig:t,transactionHash:e}=n,{data:r}=await q({aptosConfig:t,path:`transactions/by_hash/${e}`,originMethod:"getTransactionByHash"});return r}async function Do(n){let{aptosConfig:t,transactionHash:e}=n;try{return(await nn({aptosConfig:t,transactionHash:e})).type==="pending_transaction"}catch(r){if(_optionalChain([r, 'optionalAccess', _80 => _80.status])===404)return!0;throw r}}async function Xa(n){let{aptosConfig:t,transactionHash:e}=n,{data:r}=await q({aptosConfig:t,path:`transactions/wait_by_hash/${e}`,originMethod:"longWaitForTransaction"});return r}async function Dt(n){let{aptosConfig:t,transactionHash:e,options:r}=n,i=_nullishCoalesce(_optionalChain([r, 'optionalAccess', _81 => _81.timeoutSecs]), () => (20)),o=_nullishCoalesce(_optionalChain([r, 'optionalAccess', _82 => _82.checkSuccess]), () => (!0)),s=!0,a=0,c,p,m=200,P=1.5;function U(l){if(!(l instanceof ye)||(p=l,l.status!==404&&l.status>=400&&l.status<500))throw l}try{c=await nn({aptosConfig:t,transactionHash:e}),s=c.type==="pending_transaction"}catch(l){U(l)}if(s){let l=Date.now();try{c=await Xa({aptosConfig:t,transactionHash:e}),s=c.type==="pending_transaction"}catch(C){U(C)}a=(Date.now()-l)/1e3}for(;s&&!(a>=i);){try{if(c=await nn({aptosConfig:t,transactionHash:e}),s=c.type==="pending_transaction",!s)break}catch(l){U(l)}await _chunkVLEH6QBRjs.b.call(void 0, m),a+=m/1e3,m*=P}if(c===void 0)throw p||new jn(`Fetching transaction ${e} failed and timed out after ${i} seconds`,c);if(c.type==="pending_transaction")throw new jn(`Transaction ${e} timed out in pending state after ${i} seconds`,c);if(!o)return c;if(!c.success)throw new qr(`Transaction ${e} failed with an error: ${c.vm_status}`,c);return c}async function Yn(n){let{aptosConfig:t,processorType:e}=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(e===void 0?s=await Ln({aptosConfig:t}):s=(await Hn({aptosConfig:t,processorType:e})).last_success_version,s>=r)break;await _chunkVLEH6QBRjs.b.call(void 0, 200)}}var jn=class extends Error{constructor(e,r){super(e);this.lastSubmittedTransaction=r}},qr=class extends Error{constructor(e,r){super(e);this.transaction=r}};async function A(n){n.minimumLedgerVersion!==void 0&&await Yn({aptosConfig:n.config,minimumLedgerVersion:n.minimumLedgerVersion,processorType:n.processorType})}var rn=class{constructor(t){this.config=t}async getAccountInfo(t){return we({aptosConfig:this.config,...t})}async getAccountModules(t){return To({aptosConfig:this.config,...t})}async getAccountModule(t){return Wn({aptosConfig:this.config,...t})}async getAccountTransactions(t){return bo({aptosConfig:this.config,...t})}async getAccountResources(t){return wo({aptosConfig:this.config,...t})}async getAccountResource(t){return Or({aptosConfig:this.config,...t})}async lookupOriginalAccountAddress(t){return Fr({aptosConfig:this.config,...t})}async getAccountTokensCount(t){return await A({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"account_transactions_processor"}),So({aptosConfig:this.config,...t})}async getAccountOwnedTokens(t){return await A({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),xo({aptosConfig:this.config,...t})}async getAccountOwnedTokensFromCollectionAddress(t){return await A({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),_o({aptosConfig:this.config,...t})}async getAccountCollectionsWithOwnedTokens(t){return await A({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),vo({aptosConfig:this.config,...t})}async getAccountTransactionsCount(t){return await A({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"account_transactions_processor"}),Po({aptosConfig:this.config,...t})}async getAccountCoinsData(t){return await A({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"fungible_asset_processor"}),Mr({aptosConfig:this.config,...t})}async getAccountCoinsCount(t){return await A({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"fungible_asset_processor"}),Eo({aptosConfig:this.config,...t})}async getAccountAPTAmount(t){return this.getAccountCoinAmount({coinType:Kn,...t})}async getAccountCoinAmount(t){return await A({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"fungible_asset_processor"}),Co({aptosConfig:this.config,...t})}async getAccountOwnedObjects(t){return await A({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"default_processor"}),Io({aptosConfig:this.config,...t})}async deriveAccountFromPrivateKey(t){return Uo({aptosConfig:this.config,...t})}};var _aptosclient = require('@aptos-labs/aptos-client'); var _aptosclient2 = _interopRequireDefault(_aptosclient);var Zn=class{constructor(t){this.network=_nullishCoalesce(_optionalChain([t, 'optionalAccess', _83 => _83.network]), () => ("devnet")),this.fullnode=_optionalChain([t, 'optionalAccess', _84 => _84.fullnode]),this.faucet=_optionalChain([t, 'optionalAccess', _85 => _85.faucet]),this.pepper=_optionalChain([t, 'optionalAccess', _86 => _86.pepper]),this.prover=_optionalChain([t, 'optionalAccess', _87 => _87.prover]),this.indexer=_optionalChain([t, 'optionalAccess', _88 => _88.indexer]),this.client=_nullishCoalesce(_optionalChain([t, 'optionalAccess', _89 => _89.client]), () => ({provider:_aptosclient2.default})),this.clientConfig=_nullishCoalesce(_optionalChain([t, 'optionalAccess', _90 => _90.clientConfig]), () => ({})),this.fullnodeConfig=_nullishCoalesce(_optionalChain([t, 'optionalAccess', _91 => _91.fullnodeConfig]), () => ({})),this.indexerConfig=_nullishCoalesce(_optionalChain([t, 'optionalAccess', _92 => _92.indexerConfig]), () => ({})),this.faucetConfig=_nullishCoalesce(_optionalChain([t, 'optionalAccess', _93 => _93.faucetConfig]), () => ({}))}getRequestUrl(t){switch(t){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 Oi[this.network];case"Faucet":if(this.faucet!==void 0)return this.faucet;if(this.network==="custom")throw new Error("Please provide a custom faucet url");return Fi[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 Bi[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 Ir[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 Ur[this.network];default:throw Error(`apiType ${t} is not supported`)}}isPepperServiceRequest(t){return Ir[this.network]===t}isProverServiceRequest(t){return Ur[this.network]===t}};function Ko(n){return!!n.match(/^[_a-zA-Z0-9]+$/)}function Go(n){return!!n.match(/\s/)}function Za(n){return!!n.match(/^T[0-9]+$/)}function Ja(n){return!!n.match(/^&.+$/)}function ec(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 tc(n,t){let e=t;for(;e<n.length;e+=1){let r=n[e];if(!Go(r))break}return e}var nc=(C=>(C.InvalidTypeTag="unknown type",C.UnexpectedGenericType="unexpected generic type",C.UnexpectedTypeArgumentClose="unexpected '>'",C.UnexpectedWhitespaceCharacter="unexpected whitespace character",C.UnexpectedComma="unexpected ','",C.TypeArgumentCountMismatch="type argument count doesn't match expected amount",C.MissingTypeArgumentClose="no matching '>' for '<'",C.MissingTypeArgument="no type argument before ','",C.UnexpectedPrimitiveTypeArguments="primitive types not expected to have type arguments",C.UnexpectedVectorTypeArgumentCount="vector type expected to have exactly one type argument",C.UnexpectedStructFormat="unexpected struct format, must be of the form 0xaddress::module_name::struct_name",C.InvalidModuleNameCharacter="module name must only contain alphanumeric or '_' characters",C.InvalidStructNameCharacter="struct name must only contain alphanumeric or '_' characters",C.InvalidAddress="struct address must be valid",C))(nc||{}),N= exports.TypeTagParserError =class extends Error{constructor(t,e){super(`Failed to parse typeTag '${t}', ${e}`)}};function Ue(n,t){let e=_nullishCoalesce(_optionalChain([t, 'optionalAccess', _94 => _94.allowGenerics]), () => (!1)),r=[],i=[],o=[],s=0,a="",c=1;for(;s<n.length;){let p=n[s];if(p==="<")r.push({savedExpectedTypes:c,savedStr:a,savedTypes:o}),a="",o=[],c=1;else if(p===">"){if(a!==""){let C=on(a,i,e);o.push(C)}let m=r.pop();if(m===void 0)throw new N(n,"unexpected '>'");if(c!==o.length)throw new N(n,"type argument count doesn't match expected amount");let{savedStr:P,savedTypes:U,savedExpectedTypes:l}=m;i=o,o=U,a=P,c=l}else if(p===","){if(r.length===0)throw new N(n,"unexpected ','");if(a.length===0)throw new N(n,"no type argument before ','");let m=on(a,i,e);i=[],o.push(m),a="",c+=1}else if(Go(p)){let m=!1;if(a.length!==0){let U=on(a,i,e);i=[],o.push(U),a="",m=!0}s=tc(n,s);let P=n[s];if(s<n.length&&m&&P!==","&&P!==">")throw new N(n,"unexpected whitespace character");continue}else a+=p;s+=1}if(r.length>0)throw new N(n,"no matching '>' for '<'");switch(o.length){case 0:return on(a,i,e);case 1:if(a==="")return o[0];throw new N(n,"unexpected ','");default:throw new N(n,"unexpected whitespace character")}}function on(n,t,e){let r=n.trim(),i=r.toLowerCase();if(ec(i)&&t.length>0)throw new N(n,"primitive types not expected to have type arguments");switch(r.toLowerCase()){case"signer":return new St;case"bool":return new M;case"address":return new J;case"u8":return new Te;case"u16":return new ht;case"u32":return new Tt;case"u64":return new j;case"u128":return new bt;case"u256":return new wt;case"vector":if(t.length!==1)throw new N(n,"vector type expected to have exactly one type argument");return new v(t[0]);default:if(Ja(r)){let a=r.substring(1);return new Gn(on(a,t,e))}if(Za(r)){if(e)return new D(Number(r.split("T")[1]));throw new N(n,"unexpected generic type")}if(!r.match(/:/))throw new N(n,"unknown type");let o=r.split("::");if(o.length!==3)throw new N(n,"unexpected struct format, must be of the form 0xaddress::module_name::struct_name");let s;try{s=u.fromString(o[0])}catch (e2){throw new N(n,"struct address must be valid")}if(!Ko(o[1]))throw new N(n,"module name must only contain alphanumeric or '_' characters");if(!Ko(o[2]))throw new N(n,"struct name must only contain alphanumeric or '_' characters");return new y(new Ee(s,new R(o[1]),new R(o[2]),t))}}function ko(n){return typeof n=="boolean"}function Se(n){return typeof n=="string"}function Jn(n){return typeof n=="number"}function er(n){return typeof n=="number"||typeof n=="bigint"||typeof n=="string"}function No(n){return n==null}function Bo(n){return $r(n)||Lr(n)||Hr(n)||Qr(n)||Wr(n)||jr(n)||Xr(n)||tr(n)||Vr(n)||rc(n)||n instanceof T||n instanceof Ke}function $r(n){return n instanceof E}function tr(n){return n instanceof u}function Vr(n){return n instanceof b}function rc(n){return n instanceof Le}function Lr(n){return n instanceof B}function Hr(n){return n instanceof ne}function Qr(n){return n instanceof re}function Wr(n){return n instanceof O}function jr(n){return n instanceof de}function Xr(n){return n instanceof le}function Oo(n){return"bytecode"in n}function I(n,t){throw new Error(`Type mismatch for argument ${t}, expected '${n}'`)}function Fo(n){let t=n.params.findIndex(e=>e!=="signer"&&e!=="&signer");return t<0?n.params.length:t}function sn(n){let t=n.split("::");if(t.length!==3)throw new Error(`Invalid function ${n}`);let e=t[0],r=t[1],i=t[2];return{moduleAddress:e,moduleName:r,functionName:i}}var ic=new TextEncoder;function nr(n){return _nullishCoalesce(_optionalChain([n, 'optionalAccess', _95 => _95.map, 'call', _96 => _96(t=>Se(t)?Ue(t):t)]), () => ([]))}async function Mo(n,t,e,r){let i=await Wn({aptosConfig:r,accountAddress:n,moduleName:t});if(i.abi)return i.abi.exposed_functions.find(o=>o.name===e)}async function qo(n,t,e,r){let i=await Mo(n,t,e,r);if(!i)throw new Error(`Could not find entry function ABI for '${n}::${t}::${e}'`);if(!i.is_entry)throw new Error(`'${n}::${t}::${e}' is not an entry function`);let o=Fo(i),s=[];for(let a=o;a<i.params.length;a+=1)s.push(Ue(i.params[a],{allowGenerics:!0}));return{signers:o,typeParameters:i.generic_type_params,parameters:s}}async function $o(n,t,e,r){let i=await Mo(n,t,e,r);if(!i)throw new Error(`Could not find view function ABI for '${n}::${t}::${e}'`);if(!i.is_view)throw new Error(`'${n}::${t}::${e}' is not an view function`);let o=[];for(let a=0;a<i.params.length;a+=1)o.push(Ue(i.params[a],{allowGenerics:!0}));let s=[];for(let a=0;a<i.return.length;a+=1)s.push(Ue(i.return[a],{allowGenerics:!0}));return{typeParameters:i.generic_type_params,parameters:o,returnTypes:s}}function Zr(n,t,e,r,i){if(r>=t.parameters.length)throw new Error(`Too many arguments for '${n}', expected ${t.parameters.length}`);let o=t.parameters[r];return Kt(e,o,r,i)}function Kt(n,t,e,r){return Bo(n)?(Yr(t,n,e),n):oc(n,t,e,r)}function oc(n,t,e,r){if(t.isBool()){if(ko(n))return new E(n);if(Se(n)){if(n==="true")return new E(!0);if(n==="false")return new E(!1)}I("boolean",e)}if(t.isAddress()){if(Se(n))return u.fromString(n);I("string | AccountAddress",e)}if(t.isU8()){if(Jn(n))return new B(n);if(Se(n))return new B(Number.parseInt(n,10));I("number",e)}if(t.isU16()){if(Jn(n))return new ne(n);if(Se(n))return new ne(Number.parseInt(n,10));I("number",e)}if(t.isU32()){if(Jn(n))return new re(n);if(Se(n))return new re(Number.parseInt(n,10));I("number",e)}if(t.isU64()){if(er(n))return new O(BigInt(n));I("bigint | number | string",e)}if(t.isU128()){if(er(n))return new de(BigInt(n));I("bigint | number | string",e)}if(t.isU256()){if(er(n))return new le(BigInt(n));I("bigint | number | string",e)}if(t.isGeneric()){let i=t.value;if(i<0||i>=r.length)throw new Error(`Generic argument ${t.toString()} is invalid for argument ${e}`);return Kt(n,r[i],e,r)}if(t.isVector()){if(t.value.isU8()){if(Se(n))return T.U8(ic.encode(n));if(n instanceof Uint8Array)return T.U8(n);if(n instanceof ArrayBuffer)return T.U8(new Uint8Array(n))}if(Array.isArray(n))return new T(n.map(i=>Kt(i,t.value,e,r)));throw new Error(`Type mismatch for argument ${e}, type '${t.toString()}'`)}if(t.isStruct()){if(t.isString()){if(Se(n))return new b(n);I("string",e)}if(t.isObject()){if(Se(n))return u.fromString(n);I("string | AccountAddress",e)}if(t.isOption())return No(n)?new Ke(null):new Ke(Kt(n,t.value.typeArgs[0],e,r));throw new Error(`Unsupported struct input type for argument ${e}, type '${t.toString()}'`)}throw new Error(`Type mismatch for argument ${e}, type '${t.toString()}'`)}function Yr(n,t,e){if(n.isBool()){if($r(t))return;I("Bool",e)}if(n.isAddress()){if(tr(t))return;I("AccountAddress",e)}if(n.isU8()){if(Lr(t))return;I("U8",e)}if(n.isU16()){if(Hr(t))return;I("U16",e)}if(n.isU32()){if(Qr(t))return;I("U32",e)}if(n.isU64()){if(Wr(t))return;I("U64",e)}if(n.isU128()){if(jr(t))return;I("U128",e)}if(n.isU256()){if(Xr(t))return;I("U256",e)}if(n.isVector()){if(t instanceof T){t.values.length>0&&Yr(n.value,t.values[0],e);return}I("MoveVector",e)}if(n instanceof y){if(n.isString()){if(Vr(t))return;I("MoveString",e)}if(n.isObject()){if(tr(t))return;I("AccountAddress",e)}if(n.isOption()){if(t instanceof Ke){t.value!==void 0&&Yr(n.value.typeArgs[0],t.value,e);return}I("MoveOption",e)}}throw new Error(`Type mismatch for argument ${e}, expected '${n.toString()}'`)}async function ir(n){if(Oo(n))return uc(n);let{moduleAddress:t,moduleName:e,functionName:r}=sn(n.function),i=await Qo({key:"entry-function",moduleAddress:t,moduleName:e,functionName:r,aptosConfig:n.aptosConfig,abi:n.abi,fetch:qo});return ac({...n,abi:i})}function ac(n){let t=n.abi,{moduleAddress:e,moduleName:r,functionName:i}=sn(n.function),o=nr(n.typeArguments);if(o.length!==t.typeParameters.length)throw new Error(`Type argument count mismatch, expected ${t.typeParameters.length}, received ${o.length}`);let s=n.functionArguments.map((c,p)=>Zr(n.function,t,c,p,o));if(s.length!==t.parameters.length)throw new Error(`Too few arguments for '${e}::${r}::${i}', expected ${t.parameters.length} but got ${s.length}`);let a=ot.build(`${e}::${r}`,i,o,s);if("multisigAddress"in n){let c=u.from(n.multisigAddress);return new Wt(new Xt(c,new Yt(a)))}return new Qt(a)}async function Vo(n){let{moduleAddress:t,moduleName:e,functionName:r}=sn(n.function),i=await Qo({key:"view-function",moduleAddress:t,moduleName:e,functionName:r,aptosConfig:n.aptosConfig,abi:n.abi,fetch:$o});return cc({abi:i,...n})}function cc(n){let t=n.abi,{moduleAddress:e,moduleName:r,functionName:i}=sn(n.function),o=nr(n.typeArguments);if(o.length!==t.typeParameters.length)throw new Error(`Type argument count mismatch, expected ${t.typeParameters.length}, received ${o.length}`);let s=_nullishCoalesce(_optionalChain([n, 'optionalAccess', _97 => _97.functionArguments, 'optionalAccess', _98 => _98.map, 'call', _99 => _99((a,c)=>Zr(n.function,t,a,c,o))]), () => ([]));if(s.length!==t.parameters.length)throw new Error(`Too few arguments for '${e}::${r}::${i}', expected ${t.parameters.length} but got ${s.length}`);return ot.build(`${e}::${r}`,i,o,s)}function uc(n){return new Ht(new jt(g.fromHexInput(n.bytecode).toUint8Array(),nr(n.typeArguments),n.functionArguments))}async function pc(n){let{aptosConfig:t,sender:e,payload:r,options:i,feePayerAddress:o}=n,s=async()=>zr[t.network]?{chainId:zr[t.network]}:{chainId:(await Vn({aptosConfig:t})).chain_id},a=async()=>_optionalChain([i, 'optionalAccess', _100 => _100.gasUnitPrice])?{gasEstimate:i.gasUnitPrice}:{gasEstimate:(await Xn({aptosConfig:t})).gas_estimate},c=async()=>{let pt=async()=>_optionalChain([i, 'optionalAccess', _101 => _101.accountSequenceNumber])!==void 0?i.accountSequenceNumber:(await we({aptosConfig:t,accountAddress:e})).sequence_number;if(o&&u.from(o).equals(u.ZERO))try{return await pt()}catch (e3){return 0}else return pt()},[{chainId:p},{gasEstimate:m},P]=await Promise.all([s(),a(),c()]),{maxGasAmount:U,gasUnitPrice:l,expireTimestamp:C}={maxGasAmount:_optionalChain([i, 'optionalAccess', _102 => _102.maxGasAmount])?BigInt(i.maxGasAmount):BigInt(2e5),gasUnitPrice:_nullishCoalesce(_optionalChain([i, 'optionalAccess', _103 => _103.gasUnitPrice]), () => (BigInt(m))),expireTimestamp:_nullishCoalesce(_optionalChain([i, 'optionalAccess', _104 => _104.expireTimestamp]), () => (BigInt(Math.floor(Date.now()/1e3)+20)))};return new ce(u.from(e),BigInt(P),r,BigInt(U),BigInt(l),BigInt(C),new At(p))}async function Jr(n){let{aptosConfig:t,sender:e,payload:r,options:i,feePayerAddress:o}=n,s=await pc({aptosConfig:t,sender:e,payload:r,options:i,feePayerAddress:o});if("secondarySignerAddresses"in n){let a=_nullishCoalesce(_optionalChain([n, 'access', _105 => _105.secondarySignerAddresses, 'optionalAccess', _106 => _106.map, 'call', _107 => _107(c=>u.from(c))]), () => ([]));return new On(s,a,n.feePayerAddress?u.from(n.feePayerAddress):void 0)}return new Bn(s,n.feePayerAddress?u.from(n.feePayerAddress):void 0)}function Lo(n){let{signerPublicKey:t,transaction:e,secondarySignersPublicKeys:r,feePayerPublicKey:i}=n,o=rr(t);if(e.feePayerAddress){let a=new at(e.rawTransaction,_nullishCoalesce(e.secondarySignerAddresses, () => ([])),e.feePayerAddress),c=[];r&&(c=r.map(P=>rr(P)));let p=rr(i),m=new vt(o,_nullishCoalesce(e.secondarySignerAddresses, () => ([])),c,{address:e.feePayerAddress,authenticator:p});return new ct(a.raw_txn,m).bcsToBytes()}if(e.secondarySignerAddresses){let a=new st(e.rawTransaction,e.secondarySignerAddresses),c=[];c=r.map(m=>rr(m));let p=new _t(o,e.secondarySignerAddresses,c);return new ct(a.raw_txn,p).bcsToBytes()}let s;if(o instanceof me)s=new xt(o.public_key,o.signature);else if(o instanceof L)s=new Pt(o);else throw new Error("Invalid public key");return new ct(e.rawTransaction,s).bcsToBytes()}function rr(n){if((n instanceof ge||n instanceof he)&&(n=new K(n)),n instanceof K){if(n.publicKey instanceof x)return new L(n,new k(new S(new Uint8Array(64))));if(n.publicKey instanceof he)return new L(n,new k(new _e(new Uint8Array(64))));if(n.publicKey instanceof ge)return new L(n,new k(new S(new Uint8Array(64))))}return new me(new x(n.toUint8Array()),new S(new Uint8Array(64)))}function ei(n){let{transaction:t,feePayerAuthenticator:e,additionalSignersAuthenticators:r}=n,i=Mi(V,n.senderAuthenticator),o;if(t.feePayerAddress){if(!e)throw new Error("Must provide a feePayerAuthenticator argument to generate a signed fee payer transaction");o=new vt(i,_nullishCoalesce(t.secondarySignerAddresses, () => ([])),_nullishCoalesce(r, () => ([])),{address:t.feePayerAddress,authenticator:e})}else if(t.secondarySignerAddresses){if(!r)throw new Error("Must provide a additionalSignersAuthenticators argument to generate a signed multi agent transaction");o=new _t(i,t.secondarySignerAddresses,r)}else i instanceof me?o=new xt(i.public_key,i.signature):o=new Pt(i);return new ct(t.rawTransaction,o).bcsToBytes()}function Ho(n){let t=_sha3.sha3_256.create();for(let e of n)t.update(e);return t.digest()}var dc=Ho(["APTOS::Transaction"]);function CA(n){let t=ei(n);return new g(Ho([dc,new Uint8Array([0]),t])).toString()}async function Qo({key:n,moduleAddress:t,moduleName:e,functionName:r,aptosConfig:i,abi:o,fetch:s}){return o!==void 0?o:Oe(async()=>s(t,e,r,i),`${n}-${i.network}-${t}-${e}-${r}`,1e3*60*5)()}async function h(n){let t=await lc(n);return gc(n,t)}async function lc(n){let{aptosConfig:t,data:e}=n,r,i;return"bytecode"in e?i=await ir(e):"multisigAddress"in e?(r={aptosConfig:t,multisigAddress:e.multisigAddress,function:e.function,functionArguments:e.functionArguments,typeArguments:e.typeArguments,abi:e.abi},i=await ir(r)):(r={aptosConfig:t,function:e.function,functionArguments:e.functionArguments,typeArguments:e.typeArguments,abi:e.abi},i=await ir(r)),i}async function gc(n,t){let{aptosConfig:e,sender:r,options:i}=n,o;if(mc(n)&&(o=u.ZERO.toString()),yc(n)){let{secondarySignerAddresses:s}=n;return Jr({aptosConfig:e,sender:r,payload:t,options:i,secondarySignerAddresses:s,feePayerAddress:o})}return Jr({aptosConfig:e,sender:r,payload:t,options:i,feePayerAddress:o})}function mc(n){return n.withFeePayer===!0}function yc(n){return"secondarySignerAddresses"in n}function Wo(n){let{transaction:t}=n;return Ct(t)}function or(n){let{signer:t,transaction:e}=n;return t.signTransactionWithAuthenticator(e)}async function ti(n){let{aptosConfig:t,transaction:e,signerPublicKey:r,secondarySignersPublicKeys:i,feePayerPublicKey:o,options:s}=n,a=Lo({transaction:e,signerPublicKey:r,secondarySignersPublicKeys:i,feePayerPublicKey:o,options:s}),{data:c}=await ut({aptosConfig:t,body:a,path:"transactions/simulate",params:{estimate_gas_unit_price:_nullishCoalesce(_optionalChain([n, 'access', _108 => _108.options, 'optionalAccess', _109 => _109.estimateGasUnitPrice]), () => (!1)),estimate_max_gas_amount:_nullishCoalesce(_optionalChain([n, 'access', _110 => _110.options, 'optionalAccess', _111 => _111.estimateMaxGasAmount]), () => (!1)),estimate_prioritized_gas_unit_price:_nullishCoalesce(_optionalChain([n, 'access', _112 => _112.options, 'optionalAccess', _113 => _113.estimatePrioritizedGasUnitPrice]), () => (!1))},originMethod:"simulateTransaction",contentType:"application/x.aptos.signed_transaction+bcs"});return c}async function sr(n){let{aptosConfig:t}=n,e=ei({...n}),{data:r}=await ut({aptosConfig:t,body:e,path:"transactions",originMethod:"submitTransaction",contentType:"application/x.aptos.signed_transaction+bcs"});return r}async function an(n){let{aptosConfig:t,signer:e,transaction:r}=n;(e instanceof be||e instanceof Mn)&&await e.waitForProofFetch();let i=or({signer:e,transaction:r});return sr({aptosConfig:t,transaction:r,senderAuthenticator:i})}var fc={typeParameters:[],parameters:[v.u8(),new v(v.u8())]};async function jo(n){let{aptosConfig:t,account:e,metadataBytes:r,moduleBytecode:i,options:o}=n,s=i.map(a=>T.U8(a));return h({aptosConfig:t,sender:u.from(e),data:{function:"0x1::code::publish_package_txn",functionArguments:[T.U8(r),new T(s)],abi:fc},options:o})}var Ac={typeParameters:[],parameters:[new Te,v.u8(),new Te,v.u8(),v.u8(),v.u8()]};async function Xo(n){let{aptosConfig:t,fromAccount:e,toNewPrivateKey:r}=n,i=await we({aptosConfig:t,accountAddress:e.accountAddress}),o=Ne.fromPrivateKey({privateKey:r,legacy:!0}),a=new Nn({sequenceNumber:BigInt(i.sequence_number),originator:e.accountAddress,currentAuthKey:u.from(i.authentication_key),newPublicKey:o.publicKey}).bcsToBytes(),c=e.sign(a),p=o.sign(a),m=await h({aptosConfig:t,sender:e.accountAddress,data:{function:"0x1::account::rotate_authentication_key",functionArguments:[new B(e.signingScheme),T.U8(e.publicKey.toUint8Array()),new B(o.signingScheme),T.U8(o.publicKey.toUint8Array()),T.U8(c.toUint8Array()),T.U8(p.toUint8Array())],abi:Ac}});return an({aptosConfig:t,signer:e,transaction:m})}var hc={typeParameters:[{constraints:[]}],parameters:[new J,new j]};async function Yo(n){let{aptosConfig:t,sender:e,recipient:r,amount:i,coinType:o,options:s}=n;return h({aptosConfig:t,sender:e,data:{function:"0x1::aptos_account::transfer_coins",typeArguments:[_nullishCoalesce(o, () => (Kn))],functionArguments:[r,i],abi:hc},options:s})}var cn=class{constructor(t){this.config=t}async transferCoinTransaction(t){return Yo({aptosConfig:this.config,...t})}};var Fe={BOOLEAN:"bool",U8:"u8",U16:"u16",U32:"u32",U64:"u64",U128:"u128",U256:"u256",ADDRESS:"address",STRING:"0x1::string::String",ARRAY:"vector<u8>"},ue="0x4::token::Token";async function Zo(n){let{aptosConfig:t,digitalAssetAddress:e}=n,r={token_data_id:{_eq:u.from(e).toStringLong()}};return(await f({aptosConfig:t,query:{query:po,variables:{where_condition:r}},originMethod:"getDigitalAssetData"})).current_token_datas_v2[0]}async function Jo(n){let{aptosConfig:t,digitalAssetAddress:e}=n,r={token_data_id:{_eq:u.from(e).toStringLong()},amount:{_gt:0}};return(await f({aptosConfig:t,query:{query:Nr,variables:{where_condition:r}},originMethod:"getCurrentDigitalAssetOwnership"})).current_token_ownerships_v2[0]}async function es(n){let{aptosConfig:t,ownerAddress:e,options:r}=n,i={owner_address:{_eq:u.from(e).toStringLong()},amount:{_gt:0}},o={query:Nr,variables:{where_condition:i,offset:_optionalChain([r, 'optionalAccess', _114 => _114.offset]),limit:_optionalChain([r, 'optionalAccess', _115 => _115.limit]),order_by:_optionalChain([r, 'optionalAccess', _116 => _116.orderBy])}};return(await f({aptosConfig:t,query:o,originMethod:"getOwnedDigitalAssets"})).current_token_ownerships_v2}async function ts(n){let{aptosConfig:t,digitalAssetAddress:e,options:r}=n,i={token_data_id:{_eq:u.from(e).toStringLong()}},o={query:uo,variables:{where_condition:i,offset:_optionalChain([r, 'optionalAccess', _117 => _117.offset]),limit:_optionalChain([r, 'optionalAccess', _118 => _118.limit]),order_by:_optionalChain([r, 'optionalAccess', _119 => _119.orderBy])}};return(await f({aptosConfig:t,query:o,originMethod:"getDigitalAssetActivity"})).token_activities_v2}var Tc={typeParameters:[],parameters:[new y(_()),new j,new y(_()),new y(_()),new M,new M,new M,new M,new M,new M,new M,new M,new M,new j,new j]};async function ns(n){let{aptosConfig:t,options:e,creator:r}=n;return h({aptosConfig:t,sender:r.accountAddress,data:{function:"0x4::aptos_token::create_collection",functionArguments:[new b(n.description),new O(_nullishCoalesce(n.maxSupply, () => ($e))),new b(n.name),new b(n.uri),new E(_nullishCoalesce(n.mutableDescription, () => (!0))),new E(_nullishCoalesce(n.mutableRoyalty, () => (!0))),new E(_nullishCoalesce(n.mutableURI, () => (!0))),new E(_nullishCoalesce(n.mutableTokenDescription, () => (!0))),new E(_nullishCoalesce(n.mutableTokenName, () => (!0))),new E(_nullishCoalesce(n.mutableTokenProperties, () => (!0))),new E(_nullishCoalesce(n.mutableTokenURI, () => (!0))),new E(_nullishCoalesce(n.tokensBurnableByCreator, () => (!0))),new E(_nullishCoalesce(n.tokensFreezableByCreator, () => (!0))),new O(_nullishCoalesce(n.royaltyNumerator, () => (0))),new O(_nullishCoalesce(n.royaltyDenominator, () => (1)))],abi:Tc},options:e})}async function ni(n){let{aptosConfig:t,creatorAddress:e,collectionName:r,options:i}=n,o=u.from(e),s={collection_name:{_eq:r},creator_address:{_eq:o.toStringLong()}};return _optionalChain([i, 'optionalAccess', _120 => _120.tokenStandard])&&(s.token_standard={_eq:_nullishCoalesce(_optionalChain([i, 'optionalAccess', _121 => _121.tokenStandard]), () => ("v2"))}),(await f({aptosConfig:t,query:{query:Kr,variables:{where_condition:s}},originMethod:"getCollectionData"})).current_collections_v2[0]}async function rs(n){let{aptosConfig:t,collectionId:e}=n,i={collection_id:{_eq:u.from(e).toStringLong()}};return(await f({aptosConfig:t,query:{query:Kr,variables:{where_condition:i}},originMethod:"getCollectionData"})).current_collections_v2[0]}async function is(n){return(await ni(n)).collection_id}var bc={typeParameters:[],parameters:[new y(_()),new y(_()),new y(_()),new y(_()),new v(new y(_())),new v(new y(_())),new v(v.u8())]};async function os(n){let{aptosConfig:t,options:e,creator:r,collection:i,description:o,name:s,uri:a,propertyKeys:c,propertyTypes:p,propertyValues:m}=n,P=_optionalChain([p, 'optionalAccess', _122 => _122.map, 'call', _123 => _123(U=>Fe[U])]);return h({aptosConfig:t,sender:r.accountAddress,data:{function:"0x4::aptos_token::mint",functionArguments:[new b(i),new b(o),new b(s),new b(a),T.MoveString(_nullishCoalesce(c, () => ([]))),T.MoveString(_nullishCoalesce(P, () => ([]))),Ts(_nullishCoalesce(m, () => ([])),_nullishCoalesce(P, () => ([])))],abi:bc},options:e})}var wc={typeParameters:[{constraints:["key"]}],parameters:[new y(ee(new D(0))),new J]};async function ss(n){let{aptosConfig:t,sender:e,digitalAssetAddress:r,recipient:i,digitalAssetType:o,options:s}=n;return h({aptosConfig:t,sender:e.accountAddress,data:{function:"0x1::object::transfer",typeArguments:[_nullishCoalesce(o, () => (ue))],functionArguments:[u.from(r),u.from(i)],abi:wc},options:s})}var Sc={typeParameters:[],parameters:[new y(_()),new y(_()),new y(_()),new y(_()),new v(new y(_())),new v(new y(_())),new v(v.u8()),new J]};async function as(n){let{aptosConfig:t,account:e,collection:r,description:i,name:o,uri:s,recipient:a,propertyKeys:c,propertyTypes:p,propertyValues:m,options:P}=n;if(_optionalChain([c, 'optionalAccess', _124 => _124.length])!==_optionalChain([m, 'optionalAccess', _125 => _125.length]))throw new Error("Property keys and property values counts do not match");if(_optionalChain([p, 'optionalAccess', _126 => _126.length])!==_optionalChain([m, 'optionalAccess', _127 => _127.length]))throw new Error("Property types and property values counts do not match");let U=_optionalChain([p, 'optionalAccess', _128 => _128.map, 'call', _129 => _129(l=>Fe[l])]);return h({aptosConfig:t,sender:e.accountAddress,data:{function:"0x4::aptos_token::mint_soul_bound",functionArguments:[r,i,o,s,T.MoveString(_nullishCoalesce(c, () => ([]))),T.MoveString(_nullishCoalesce(U, () => ([]))),Ts(_nullishCoalesce(m, () => ([])),_nullishCoalesce(U, () => ([]))),a],abi:Sc},options:P})}var xc={typeParameters:[{constraints:["key"]}],parameters:[new y(ee(new D(0)))]};async function cs(n){let{aptosConfig:t,creator:e,digitalAssetAddress:r,digitalAssetType:i,options:o}=n;return h({aptosConfig:t,sender:e.accountAddress,data:{function:"0x4::aptos_token::burn",typeArguments:[_nullishCoalesce(i, () => (ue))],functionArguments:[u.from(r)],abi:xc},options:o})}var _c={typeParameters:[{constraints:["key"]}],parameters:[new y(ee(new D(0)))]};async function us(n){let{aptosConfig:t,creator:e,digitalAssetAddress:r,digitalAssetType:i,options:o}=n;return h({aptosConfig:t,sender:e.accountAddress,data:{function:"0x4::aptos_token::freeze_transfer",typeArguments:[_nullishCoalesce(i, () => (ue))],functionArguments:[r],abi:_c},options:o})}var vc={typeParameters:[{constraints:["key"]}],parameters:[new y(ee(new D(0)))]};async function ps(n){let{aptosConfig:t,creator:e,digitalAssetAddress:r,digitalAssetType:i,options:o}=n;return h({aptosConfig:t,sender:e.accountAddress,data:{function:"0x4::aptos_token::unfreeze_transfer",typeArguments:[_nullishCoalesce(i, () => (ue))],functionArguments:[r],abi:vc},options:o})}var Pc={typeParameters:[{constraints:["key"]}],parameters:[new y(ee(new D(0))),new y(_())]};async function ds(n){let{aptosConfig:t,creator:e,description:r,digitalAssetAddress:i,digitalAssetType:o,options:s}=n;return h({aptosConfig:t,sender:e.accountAddress,data:{function:"0x4::aptos_token::set_description",typeArguments:[_nullishCoalesce(o, () => (ue))],functionArguments:[u.from(i),new b(r)],abi:Pc},options:s})}var Cc={typeParameters:[{constraints:["key"]}],parameters:[new y(ee(new D(0))),new y(_())]};async function ls(n){let{aptosConfig:t,creator:e,name:r,digitalAssetAddress:i,digitalAssetType:o,options:s}=n;return h({aptosConfig:t,sender:e.accountAddress,data:{function:"0x4::aptos_token::set_name",typeArguments:[_nullishCoalesce(o, () => (ue))],functionArguments:[u.from(i),new b(r)],abi:Cc},options:s})}var Ec={typeParameters:[{constraints:["key"]}],parameters:[new y(ee(new D(0))),new y(_())]};async function gs(n){let{aptosConfig:t,creator:e,uri:r,digitalAssetAddress:i,digitalAssetType:o,options:s}=n;return h({aptosConfig:t,sender:e.accountAddress,data:{function:"0x4::aptos_token::set_uri",typeArguments:[_nullishCoalesce(o, () => (ue))],functionArguments:[u.from(i),new b(r)],abi:Ec},options:s})}var Ic={typeParameters:[{constraints:["key"]}],parameters:[new y(ee(new D(0))),new y(_()),new y(_()),v.u8()]};async function ms(n){let{aptosConfig:t,creator:e,propertyKey:r,propertyType:i,propertyValue:o,digitalAssetAddress:s,digitalAssetType:a,options:c}=n;return h({aptosConfig:t,sender:e.accountAddress,data:{function:"0x4::aptos_token::add_property",typeArguments:[_nullishCoalesce(a, () => (ue))],functionArguments:[u.from(s),new b(r),new b(Fe[i]),T.U8(ri(o,Fe[i]))],abi:Ic},options:c})}var Uc={typeParameters:[{constraints:["key"]}],parameters:[new y(ee(new D(0))),new y(_())]};async function ys(n){let{aptosConfig:t,creator:e,propertyKey:r,digitalAssetAddress:i,digitalAssetType:o,options:s}=n;return h({aptosConfig:t,sender:e.accountAddress,data:{function:"0x4::aptos_token::remove_property",typeArguments:[_nullishCoalesce(o, () => (ue))],functionArguments:[u.from(i),new b(r)],abi:Uc},options:s})}var Rc={typeParameters:[{constraints:["key"]}],parameters:[new y(ee(new D(0))),new y(_()),new y(_()),v.u8()]};async function fs(n){let{aptosConfig:t,creator:e,propertyKey:r,propertyType:i,propertyValue:o,digitalAssetAddress:s,digitalAssetType:a,options:c}=n;return h({aptosConfig:t,sender:e.accountAddress,data:{function:"0x4::aptos_token::update_property",typeArguments:[_nullishCoalesce(a, () => (ue))],functionArguments:[u.from(s),new b(r),new b(Fe[i]),ri(o,Fe[i])],abi:Rc},options:c})}var zc={typeParameters:[{constraints:["key"]},{constraints:[]}],parameters:[new y(ee(new D(0))),new y(_()),new D(1)]};async function As(n){let{aptosConfig:t,creator:e,propertyKey:r,propertyType:i,propertyValue:o,digitalAssetAddress:s,digitalAssetType:a,options:c}=n;return h({aptosConfig:t,sender:e.accountAddress,data:{function:"0x4::aptos_token::add_typed_property",typeArguments:[_nullishCoalesce(a, () => (ue)),Fe[i]],functionArguments:[u.from(s),new b(r),o],abi:zc},options:c})}var Dc={typeParameters:[{constraints:["key"]},{constraints:[]}],parameters:[new y(ee(new D(0))),new y(_()),new D(1)]};async function hs(n){let{aptosConfig:t,creator:e,propertyKey:r,propertyType:i,propertyValue:o,digitalAssetAddress:s,digitalAssetType:a,options:c}=n;return h({aptosConfig:t,sender:e.accountAddress,data:{function:"0x4::aptos_token::update_typed_property",typeArguments:[_nullishCoalesce(a, () => (ue)),Fe[i]],functionArguments:[u.from(s),new b(r),o],abi:Dc},options:c})}function Ts(n,t){let e=new Array;return t.forEach((r,i)=>{e.push(ri(n[i],r))}),e}function ri(n,t){let e=Ue(t);return Kt(n,e,0,[]).bcsToBytes()}var un=class{constructor(t){this.config=t}async getCollectionData(t){return await A({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),ni({aptosConfig:this.config,...t})}async getCollectionDataByCollectionId(t){return await A({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),rs({aptosConfig:this.config,...t})}async getCollectionId(t){return await A({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),is({aptosConfig:this.config,...t})}async getDigitalAssetData(t){return await A({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),Zo({aptosConfig:this.config,...t})}async getCurrentDigitalAssetOwnership(t){return await A({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),Jo({aptosConfig:this.config,...t})}async getOwnedDigitalAssets(t){return await A({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),es({aptosConfig:this.config,...t})}async getDigitalAssetActivity(t){return await A({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),ts({aptosConfig:this.config,...t})}async createCollectionTransaction(t){return ns({aptosConfig:this.config,...t})}async mintDigitalAssetTransaction(t){return os({aptosConfig:this.config,...t})}async transferDigitalAssetTransaction(t){return ss({aptosConfig:this.config,...t})}async mintSoulBoundTransaction(t){return as({aptosConfig:this.config,...t})}async burnDigitalAssetTransaction(t){return cs({aptosConfig:this.config,...t})}async freezeDigitalAssetTransaferTransaction(t){return us({aptosConfig:this.config,...t})}async unfreezeDigitalAssetTransaferTransaction(t){return ps({aptosConfig:this.config,...t})}async setDigitalAssetDescriptionTransaction(t){return ds({aptosConfig:this.config,...t})}async setDigitalAssetNameTransaction(t){return ls({aptosConfig:this.config,...t})}async setDigitalAssetURITransaction(t){return gs({aptosConfig:this.config,...t})}async addDigitalAssetPropertyTransaction(t){return ms({aptosConfig:this.config,...t})}async removeDigitalAssetPropertyTransaction(t){return ys({aptosConfig:this.config,...t})}async updateDigitalAssetPropertyTransaction(t){return fs({aptosConfig:this.config,...t})}async addDigitalAssetTypedPropertyTransaction(t){return As({aptosConfig:this.config,...t})}async updateDigitalAssetTypedPropertyTransaction(t){return hs({aptosConfig:this.config,...t})}};var bs=300,Kc=n=>{if(n&&n.length>bs)throw new Error(`Event type length exceeds the maximum length of ${bs}`)};async function ws(n){let{aptosConfig:t,eventType:e,options:r}=n,o={where:{account_address:{_eq:"0x0000000000000000000000000000000000000000000000000000000000000000"},creation_number:{_eq:"0"},sequence_number:{_eq:"0"},indexed_type:{_eq:e}},pagination:r,orderBy:_optionalChain([r, 'optionalAccess', _130 => _130.orderBy])};return pn({aptosConfig:t,options:o})}async function Ss(n){let{accountAddress:t,aptosConfig:e,creationNumber:r,options:i}=n,a={where:{account_address:{_eq:u.from(t).toStringLong()},creation_number:{_eq:r}},pagination:i,orderBy:_optionalChain([i, 'optionalAccess', _131 => _131.orderBy])};return pn({aptosConfig:e,options:a})}async function xs(n){let{accountAddress:t,aptosConfig:e,eventType:r,options:i}=n,a={where:{account_address:{_eq:u.from(t).toStringLong()},indexed_type:{_eq:r}},pagination:i,orderBy:_optionalChain([i, 'optionalAccess', _132 => _132.orderBy])};return pn({aptosConfig:e,options:a})}async function pn(n){let{aptosConfig:t,options:e}=n;Kc(_optionalChain([e, 'optionalAccess', _133 => _133.where, 'optionalAccess', _134 => _134.indexed_type, 'optionalAccess', _135 => _135._eq]));let r={query:io,variables:{where_condition:_optionalChain([e, 'optionalAccess', _136 => _136.where]),offset:_optionalChain([e, 'optionalAccess', _137 => _137.offset]),limit:_optionalChain([e, 'optionalAccess', _138 => _138.limit]),order_by:_optionalChain([e, 'optionalAccess', _139 => _139.orderBy])}};return(await f({aptosConfig:t,query:r,originMethod:"getEvents"})).events}var dn=class{constructor(t){this.config=t}async getModuleEventsByEventType(t){return await A({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"events_processor"}),ws({aptosConfig:this.config,...t})}async getAccountEventsByCreationNumber(t){return await A({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"events_processor"}),Ss({aptosConfig:this.config,...t})}async getAccountEventsByEventType(t){return await A({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"events_processor"}),xs({aptosConfig:this.config,...t})}async getEvents(t){return await A({config:this.config,minimumLedgerVersion:_optionalChain([t, 'optionalAccess', _140 => _140.minimumLedgerVersion]),processorType:"events_processor"}),pn({aptosConfig:this.config,...t})}};async function _s(n){let{aptosConfig:t,accountAddress:e,amount:r,options:i}=n,o=_optionalChain([i, 'optionalAccess', _141 => _141.timeoutSecs])||20,{data:s}=await Vi({aptosConfig:t,path:"fund",body:{address:u.from(e).toString(),amount:r},originMethod:"fundAccount"}),a=s.txn_hashes[0],c=await Dt({aptosConfig:t,transactionHash:a,options:{timeoutSecs:o,checkSuccess:_optionalChain([i, 'optionalAccess', _142 => _142.checkSuccess])}});if(c.type==="user_transaction")return c;throw new Error(`Unexpected transaction received for fund account: ${c.type}`)}var ln=class{constructor(t){this.config=t}async fundAccount(t){let e=await _s({aptosConfig:this.config,...t});return _optionalChain([t, 'access', _143 => _143.options, 'optionalAccess', _144 => _144.waitForIndexer])!==!1&&await Yn({aptosConfig:this.config,minimumLedgerVersion:BigInt(e.version)}),e}};async function ii(n){let{aptosConfig:t,options:e}=n,r={query:so,variables:{where_condition:_optionalChain([e, 'optionalAccess', _145 => _145.where]),limit:_optionalChain([e, 'optionalAccess', _146 => _146.limit]),offset:_optionalChain([e, 'optionalAccess', _147 => _147.offset])}};return(await f({aptosConfig:t,query:r,originMethod:"getFungibleAssetMetadata"})).fungible_asset_metadata}async function vs(n){let{aptosConfig:t,options:e}=n,r={query:oo,variables:{where_condition:_optionalChain([e, 'optionalAccess', _148 => _148.where]),limit:_optionalChain([e, 'optionalAccess', _149 => _149.limit]),offset:_optionalChain([e, 'optionalAccess', _150 => _150.offset])}};return(await f({aptosConfig:t,query:r,originMethod:"getFungibleAssetActivities"})).fungible_asset_activities}async function Ps(n){let{aptosConfig:t,options:e}=n,r={query:no,variables:{where_condition:_optionalChain([e, 'optionalAccess', _151 => _151.where]),limit:_optionalChain([e, 'optionalAccess', _152 => _152.limit]),offset:_optionalChain([e, 'optionalAccess', _153 => _153.offset])}};return(await f({aptosConfig:t,query:r,originMethod:"getCurrentFungibleAssetBalances"})).current_fungible_asset_balances}var Gc={typeParameters:[{constraints:[]}],parameters:[Ue("0x1::object::Object"),new J,new j]};async function Cs(n){let{aptosConfig:t,sender:e,fungibleAssetMetadataAddress:r,recipient:i,amount:o,options:s}=n;return h({aptosConfig:t,sender:e.accountAddress,data:{function:"0x1::primary_fungible_store::transfer",typeArguments:["0x1::fungible_asset::Metadata"],functionArguments:[r,i,o],abi:Gc},options:s})}var gn=class{constructor(t){this.config=t}async getFungibleAssetMetadata(t){return await A({config:this.config,minimumLedgerVersion:_optionalChain([t, 'optionalAccess', _154 => _154.minimumLedgerVersion]),processorType:"fungible_asset_processor"}),ii({aptosConfig:this.config,...t})}async getFungibleAssetMetadataByAssetType(t){return await A({config:this.config,minimumLedgerVersion:_optionalChain([t, 'optionalAccess', _155 => _155.minimumLedgerVersion]),processorType:"fungible_asset_processor"}),(await ii({aptosConfig:this.config,options:{where:{asset_type:{_eq:t.assetType}}}}))[0]}async getFungibleAssetActivities(t){return await A({config:this.config,minimumLedgerVersion:_optionalChain([t, 'optionalAccess', _156 => _156.minimumLedgerVersion]),processorType:"fungible_asset_processor"}),vs({aptosConfig:this.config,...t})}async getCurrentFungibleAssetBalances(t){return await A({config:this.config,minimumLedgerVersion:_optionalChain([t, 'optionalAccess', _157 => _157.minimumLedgerVersion]),processorType:"fungible_asset_processor"}),Ps({aptosConfig:this.config,...t})}async transferFungibleAsset(t){return Cs({aptosConfig:this.config,...t})}};async function Me(n){let{aptosConfig:t,payload:e,options:r}=n,i=await Vo({...e,aptosConfig:t}),o=new W;i.serialize(o);let s=o.toUint8Array(),{data:a}=await ut({aptosConfig:t,path:"view",originMethod:"view",contentType:"application/x.aptos.view_function+bcs",params:{ledger_version:_optionalChain([r, 'optionalAccess', _158 => _158.ledgerVersion])},body:s});return a}var mn=class{constructor(t){this.config=t}async getLedgerInfo(){return Vn({aptosConfig:this.config})}async getChainId(){return(await this.getLedgerInfo()).chain_id}async getBlockByVersion(t){return lo({aptosConfig:this.config,...t})}async getBlockByHeight(t){return go({aptosConfig:this.config,...t})}async view(t){return Me({aptosConfig:this.config,...t})}async getChainTopUserTransactions(t){return mo({aptosConfig:this.config,...t})}async queryIndexer(t){return f({aptosConfig:this.config,...t})}async getIndexerLastSuccessVersion(){return Ln({aptosConfig:this.config})}async getProcessorStatus(t){return Hn({aptosConfig:this.config,processorType:t})}};var Es=["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 Is(n){return!(!n||n.length<3||n.length>63||!/^[a-z\d][a-z\d-]{1,61}[a-z\d]$/.test(n))}function qe(n){let[t,e,...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(!Is(t))throw new Error(`${t} is not valid. ${Es}`);if(e&&!Is(e))throw new Error(`${e} is not valid. ${Es}`);return{domainName:e||t,subdomainName:e?t:void 0}}var kc="0x585fc9f0f0c54183b039ffc770ca282ebd87307916c215a3e692f2f8e4305e82",Nc={testnet:"0x5f8fd2347449685cf41d4db97926ec3a096eaf381332be4f1318ad4d16a8497c",mainnet:"0x867ed1f6bf916171b1de3ee92849b8978b7d1b9e0a8cc982a3d19d535dfd9c0c",local:kc,custom:null,devnet:null};function Re(n){let t=Nc[n.network];if(!t)throw new Error(`The ANS contract is not deployed to ${n.network}`);return t}var ar=n=>{if(n&&typeof n=="object"&&"vec"in n&&Array.isArray(n.vec))return n.vec[0]};async function Us(n){let{aptosConfig:t,name:e}=n,r=Re(t),{domainName:i,subdomainName:o}=qe(e),s=await Me({aptosConfig:t,payload:{function:`${r}::router::get_owner_addr`,functionArguments:[i,o]}}),a=ar(s[0]);return a?u.from(a):void 0}async function Rs(n){let{aptosConfig:t,expiration:e,name:r,sender:i,targetAddress:o,toAddress:s,options:a,transferable:c}=n,p=Re(t),{domainName:m,subdomainName:P}=qe(r),U=e.policy==="subdomain:independent"||e.policy==="subdomain:follow-domain";if(P&&!U)throw new Error("Subdomains must have an expiration policy of either 'subdomain:independent' or 'subdomain:follow-domain'");if(U&&!P)throw new Error(`Policy is set to ${e.policy} but no subdomain was provided`);if(e.policy==="domain"){let gr=_nullishCoalesce(e.years, () => (1));if(gr!==1)throw new Error("For now, names can only be registered for 1 year at a time");let js=gr*31536e3;return await h({aptosConfig:t,sender:i.accountAddress.toString(),data:{function:`${p}::router::register_domain`,functionArguments:[m,js,o,s]},options:a})}if(!P)throw new Error(`${e.policy} requires a subdomain to be provided.`);let l=await oi({aptosConfig:t,name:m});if(!l)throw new Error("The domain does not exist");let C=e.policy==="subdomain:independent"?e.expirationDate:l;if(C>l)throw new Error("The subdomain expiration time cannot be greater than the domain expiration time");return await h({aptosConfig:t,sender:i.accountAddress.toString(),data:{function:`${p}::router::register_subdomain`,functionArguments:[m,P,Math.round(C/1e3),e.policy==="subdomain:follow-domain"?1:0,!!c,o,s]},options:a})}async function oi(n){let{aptosConfig:t,name:e}=n,r=Re(t),{domainName:i,subdomainName:o}=qe(e);try{let s=await Me({aptosConfig:t,payload:{function:`${r}::router::get_expiration`,functionArguments:[i,o]}});return Number(s[0])*1e3}catch (e4){return}}async function zs(n){let{aptosConfig:t,address:e}=n,r=Re(t),i=await Me({aptosConfig:t,payload:{function:`${r}::router::get_primary_name`,functionArguments:[u.from(e).toString()]}}),o=ar(i[1]),s=ar(i[0]);if(o)return[s,o].filter(Boolean).join(".")}async function Ds(n){let{aptosConfig:t,sender:e,name:r,options:i}=n,o=Re(t);if(!r)return await h({aptosConfig:t,sender:e.accountAddress.toString(),data:{function:`${o}::router::clear_primary_name`,functionArguments:[]},options:i});let{domainName:s,subdomainName:a}=qe(r);return await h({aptosConfig:t,sender:e.accountAddress.toString(),data:{function:`${o}::router::set_primary_name`,functionArguments:[s,a]},options:i})}async function Ks(n){let{aptosConfig:t,name:e}=n,r=Re(t),{domainName:i,subdomainName:o}=qe(e),s=await Me({aptosConfig:t,payload:{function:`${r}::router::get_target_addr`,functionArguments:[i,o]}}),a=ar(s[0]);return a?u.from(a):void 0}async function Gs(n){let{aptosConfig:t,sender:e,name:r,address:i,options:o}=n,s=Re(t),{domainName:a,subdomainName:c}=qe(r);return await h({aptosConfig:t,sender:e.accountAddress.toString(),data:{function:`${s}::router::set_target_addr`,functionArguments:[a,c,i]},options:o})}async function ks(n){let{aptosConfig:t,name:e}=n,{domainName:r,subdomainName:i=""}=qe(e),a=(await f({aptosConfig:t,query:{query:zt,variables:{where_condition:{domain:{_eq:r},subdomain:{_eq:i},is_active:{_eq:!0}},limit:1}},originMethod:"getName"})).current_aptos_names[0];return a&&(a=yn(a)),a}async function Ns(n){let{aptosConfig:t,options:e,accountAddress:r}=n,i=await si({aptosConfig:t});return(await f({aptosConfig:t,originMethod:"getAccountNames",query:{query:zt,variables:{limit:_optionalChain([e, 'optionalAccess', _159 => _159.limit]),offset:_optionalChain([e, 'optionalAccess', _160 => _160.offset]),order_by:_optionalChain([e, 'optionalAccess', _161 => _161.orderBy]),where_condition:{..._nullishCoalesce(_optionalChain([n, 'access', _162 => _162.options, 'optionalAccess', _163 => _163.where]), () => ({})),owner_address:{_eq:r.toString()},expiration_timestamp:{_gte:i}}}}})).current_aptos_names.map(yn)}async function Bs(n){let{aptosConfig:t,options:e,accountAddress:r}=n,i=await si({aptosConfig:t});return(await f({aptosConfig:t,originMethod:"getAccountDomains",query:{query:zt,variables:{limit:_optionalChain([e, 'optionalAccess', _164 => _164.limit]),offset:_optionalChain([e, 'optionalAccess', _165 => _165.offset]),order_by:_optionalChain([e, 'optionalAccess', _166 => _166.orderBy]),where_condition:{..._nullishCoalesce(_optionalChain([n, 'access', _167 => _167.options, 'optionalAccess', _168 => _168.where]), () => ({})),owner_address:{_eq:r.toString()},expiration_timestamp:{_gte:i},subdomain:{_eq:""}}}}})).current_aptos_names.map(yn)}async function Os(n){let{aptosConfig:t,options:e,accountAddress:r}=n,i=await si({aptosConfig:t});return(await f({aptosConfig:t,originMethod:"getAccountSubdomains",query:{query:zt,variables:{limit:_optionalChain([e, 'optionalAccess', _169 => _169.limit]),offset:_optionalChain([e, 'optionalAccess', _170 => _170.offset]),order_by:_optionalChain([e, 'optionalAccess', _171 => _171.orderBy]),where_condition:{..._nullishCoalesce(_optionalChain([n, 'access', _172 => _172.options, 'optionalAccess', _173 => _173.where]), () => ({})),owner_address:{_eq:r.toString()},expiration_timestamp:{_gte:i},subdomain:{_neq:""}}}}})).current_aptos_names.map(yn)}async function Fs(n){let{aptosConfig:t,options:e,domain:r}=n;return(await f({aptosConfig:t,originMethod:"getDomainSubdomains",query:{query:zt,variables:{limit:_optionalChain([e, 'optionalAccess', _174 => _174.limit]),offset:_optionalChain([e, 'optionalAccess', _175 => _175.offset]),order_by:_optionalChain([e, 'optionalAccess', _176 => _176.orderBy]),where_condition:{..._nullishCoalesce(_optionalChain([n, 'access', _177 => _177.options, 'optionalAccess', _178 => _178.where]), () => ({})),domain:{_eq:r},subdomain:{_neq:""},is_active:{_eq:!0}}}}})).current_aptos_names.map(yn)}async function si(n){let{aptosConfig:t}=n,e=Re(t),[r]=await Me({aptosConfig:t,payload:{function:`${e}::config::reregistration_grace_sec`,functionArguments:[]}}),i=r/60/60/24,o=()=>new Date;return new Date(o().setDate(o().getDate()-i)).toISOString()}async function Ms(n){let{aptosConfig:t,sender:e,name:r,years:i=1,options:o}=n,s=Re(t),a=i*31536e3,{domainName:c,subdomainName:p}=qe(r);if(p)throw new Error("Subdomains cannot be renewed");if(i!==1)throw new Error("Currently, only 1 year renewals are supported");return await h({aptosConfig:t,sender:e.accountAddress.toString(),data:{function:`${s}::router::renew_domain`,functionArguments:[c,a]},options:o})}function yn(n){return{...n,expiration_timestamp:new Date(n.expiration_timestamp).getTime()}}var fn=class{constructor(t){this.config=t}async getOwnerAddress(t){return Us({aptosConfig:this.config,...t})}async getExpiration(t){return oi({aptosConfig:this.config,...t})}async getTargetAddress(t){return Ks({aptosConfig:this.config,...t})}async setTargetAddress(t){return Gs({aptosConfig:this.config,...t})}async getPrimaryName(t){return zs({aptosConfig:this.config,...t})}async setPrimaryName(t){return Ds({aptosConfig:this.config,...t})}async registerName(t){return Rs({aptosConfig:this.config,...t})}async renewDomain(t){return Ms({aptosConfig:this.config,...t})}async getName(t){return ks({aptosConfig:this.config,...t})}async getAccountNames(t){return Ns({aptosConfig:this.config,...t})}async getAccountDomains(t){return Bs({aptosConfig:this.config,...t})}async getAccountSubdomains(t){return Os({aptosConfig:this.config,...t})}async getDomainSubdomains(t){return Fs({aptosConfig:this.config,...t})}};async function qs(n){let{aptosConfig:t,poolAddress:e}=n,r=u.from(e).toStringLong(),o=await f({aptosConfig:t,query:{query:Gr,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 $s(n){let{aptosConfig:t,options:e}=n,r={query:Gr,variables:{order_by:_optionalChain([e, 'optionalAccess', _179 => _179.orderBy])}};return(await f({aptosConfig:t,query:r})).num_active_delegator_per_pool}async function Vs(n){let{aptosConfig:t,delegatorAddress:e,poolAddress:r}=n,i={query:ro,variables:{delegatorAddress:u.from(e).toStringLong(),poolAddress:u.from(r).toStringLong()}};return(await f({aptosConfig:t,query:i})).delegated_staking_activities}var An=class{constructor(t){this.config=t}async getNumberOfDelegators(t){return await A({config:this.config,minimumLedgerVersion:_optionalChain([t, 'optionalAccess', _180 => _180.minimumLedgerVersion]),processorType:"stake_processor"}),qs({aptosConfig:this.config,...t})}async getNumberOfDelegatorsForAllPools(t){return await A({config:this.config,minimumLedgerVersion:_optionalChain([t, 'optionalAccess', _181 => _181.minimumLedgerVersion]),processorType:"stake_processor"}),$s({aptosConfig:this.config,...t})}async getDelegatedStakingActivities(t){return await A({config:this.config,minimumLedgerVersion:_optionalChain([t, 'optionalAccess', _182 => _182.minimumLedgerVersion]),processorType:"stake_processor"}),Vs({aptosConfig:this.config,...t})}};var cr=class{constructor(t){this.config=t}async simple(t){return h({aptosConfig:this.config,...t})}async multiAgent(t){return h({aptosConfig:this.config,...t})}};function ai(n,t,e){let r=e.value;return e.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)},e}function ci(n,t,e){let r=e.value;return e.value=async function(...i){let[o]=i;if(o.transaction.feePayerAddress&&!o.feePayerPublicKey)throw new Error("You are simulating a Fee Payer transaction but missing the feePayerPublicKey");return r.apply(this,i)},e}var Gt=class{constructor(t){this.config=t}async simple(t){return ti({aptosConfig:this.config,...t})}async multiAgent(t){return ti({aptosConfig:this.config,...t})}};_chunkVLEH6QBRjs.a.call(void 0, [ci],Gt.prototype,"simple",1),_chunkVLEH6QBRjs.a.call(void 0, [ci],Gt.prototype,"multiAgent",1);var kt=class{constructor(t){this.config=t}async simple(t){return sr({aptosConfig:this.config,...t})}async multiAgent(t){return sr({aptosConfig:this.config,...t})}};_chunkVLEH6QBRjs.a.call(void 0, [ai],kt.prototype,"simple",1),_chunkVLEH6QBRjs.a.call(void 0, [ai],kt.prototype,"multiAgent",1);var ur=()=>Math.floor(Date.now()/1e3),pr= exports.AccountSequenceNumber =class{constructor(t,e,r,i,o){this.lastUncommintedNumber=null;this.currentNumber=null;this.lock=!1;this.aptosConfig=t,this.account=e,this.maxWaitTime=r,this.maximumInFlight=i,this.sleepTime=o}async nextSequenceNumber(){for(;this.lock;)await _chunkVLEH6QBRjs.b.call(void 0, this.sleepTime);this.lock=!0;let t=BigInt(0);try{if((this.lastUncommintedNumber===null||this.currentNumber===null)&&await this.initialize(),this.currentNumber-this.lastUncommintedNumber>=this.maximumInFlight){await this.update();let e=ur();for(;this.currentNumber-this.lastUncommintedNumber>=this.maximumInFlight;)await _chunkVLEH6QBRjs.b.call(void 0, this.sleepTime),ur()-e>this.maxWaitTime?(console.warn(`Waited over 30 seconds for a transaction to commit, resyncing ${this.account.accountAddress.toString()}`),await this.initialize()):await this.update()}t=this.currentNumber,this.currentNumber+=BigInt(1)}catch(e){console.error("error in getting next sequence number for this account",e)}finally{this.lock=!1}return t}async initialize(){let{sequence_number:t}=await we({aptosConfig:this.aptosConfig,accountAddress:this.account.accountAddress});this.currentNumber=BigInt(t),this.lastUncommintedNumber=BigInt(t)}async update(){let{sequence_number:t}=await we({aptosConfig:this.aptosConfig,accountAddress:this.account.accountAddress});return this.lastUncommintedNumber=BigInt(t),this.lastUncommintedNumber}async synchronize(){if(this.lastUncommintedNumber!==this.currentNumber){for(;this.lock;)await _chunkVLEH6QBRjs.b.call(void 0, this.sleepTime);this.lock=!0;try{await this.update();let t=ur();for(;this.lastUncommintedNumber!==this.currentNumber;)ur()-t>this.maxWaitTime?(console.warn(`Waited over 30 seconds for a transaction to commit, resyncing ${this.account.accountAddress.toString()}`),await this.initialize()):(await _chunkVLEH6QBRjs.b.call(void 0, this.sleepTime),await this.update())}catch(t){console.error("error in synchronizing this account sequence number with the one on chain",t)}finally{this.lock=!1}}}};var Nt=class{constructor(){this.queue=[];this.pendingDequeue=[];this.cancelled=!1}enqueue(t){if(this.cancelled=!1,this.pendingDequeue.length>0){_optionalChain([this, 'access', _183 => _183.pendingDequeue, 'access', _184 => _184.shift, 'call', _185 => _185(), 'optionalAccess', _186 => _186.resolve, 'call', _187 => _187(t)]);return}this.queue.push(t)}async dequeue(){return this.queue.length>0?Promise.resolve(this.queue.shift()):new Promise((t,e)=>{this.pendingDequeue.push({resolve:t,reject:e})})}isEmpty(){return this.queue.length===0}cancel(){this.cancelled=!0,this.pendingDequeue.forEach(async({reject:t})=>{t(new Bt("Task cancelled"))}),this.pendingDequeue=[],this.queue.length=0}isCancelled(){return this.cancelled}pendingDequeueLength(){return this.pendingDequeue.length}},Bt=class extends Error{};var Ls="fulfilled",Hs= exports.TransactionWorkerEventsEnum =(o=>(o.TransactionSent="transactionSent",o.TransactionSendFailed="transactionSendFailed",o.TransactionExecuted="transactionExecuted",o.TransactionExecutionFailed="transactionExecutionFailed",o.ExecutionFinish="executionFinish",o))(Hs||{}),dr= exports.TransactionWorker =class extends _eventemitter32.default{constructor(e,r,i=30,o=100,s=10){super();this.taskQueue=new Nt;this.transactionsQueue=new Nt;this.outstandingTransactions=new Nt;this.sentTransactions=[];this.executedTransactions=[];this.aptosConfig=e,this.account=r,this.started=!1,this.accountSequnceNumber=new pr(e,r,i,o,s)}async submitNextTransaction(){try{for(;;){let e=await this.accountSequnceNumber.nextSequenceNumber();if(e===null)return;let r=await this.generateNextTransaction(this.account,e);if(!r)return;let i=an({aptosConfig:this.aptosConfig,transaction:r,signer:this.account});await this.outstandingTransactions.enqueue([i,e])}}catch(e){if(e instanceof Bt)return;throw new Error(`Submit transaction failed for ${this.account.accountAddress.toString()} with error ${e}`)}}async processTransactions(){try{for(;;){let e=[],r=[],[i,o]=await this.outstandingTransactions.dequeue();for(e.push(i),r.push(o);!this.outstandingTransactions.isEmpty();)[i,o]=await this.outstandingTransactions.dequeue(),e.push(i),r.push(o);let s=await Promise.allSettled(e);for(let a=0;a<s.length&&a<r.length;a+=1){let c=s[a];o=r[a],c.status===Ls?(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(e){if(e instanceof Bt)return;throw new Error(`Process execution failed for ${this.account.accountAddress.toString()} with error ${e}`)}}async checkTransaction(e,r){try{let i=[];i.push(Dt({aptosConfig:this.aptosConfig,transactionHash:e.value.hash}));let o=await Promise.allSettled(i);for(let s=0;s<o.length;s+=1){let a=o[s];a.status===Ls?(this.executedTransactions.push([a.value.hash,r,null]),this.emit("transactionExecuted",{message:`transaction hash ${a.value.hash} has been executed on chain`,transactionHash:e.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(e,r){this.transactionsQueue.enqueue([e,r])}async generateNextTransaction(e,r){if(this.transactionsQueue.isEmpty())return;let[i,o]=await this.transactionsQueue.dequeue();return h({aptosConfig:this.aptosConfig,sender:e.accountAddress,data:i,options:{...o,accountSequenceNumber:r}})}async run(){try{for(;!this.taskQueue.isCancelled();)await(await this.taskQueue.dequeue())()}catch(e){throw new Error(`Unable to start transaction batching: ${e}`)}}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 lr=class extends _eventemitter32.default{constructor(e){super();this.config=e}start(e){let{sender:r}=e;this.account=r,this.transactionWorker=new dr(this.config,r),this.transactionWorker.start(),this.registerToEvents()}push(e){let{data:r,options:i}=e;for(let o of r)this.transactionWorker.push(o,i)}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:r,data:i,options:o}=e;this.start({sender:r}),this.push({data:i,options:o})}catch(r){throw new Error(`failed to submit transactions with error: ${r}`)}}};var hn=class{constructor(t){this.config=t,this.build=new cr(this.config),this.simulate=new Gt(this.config),this.submit=new kt(this.config),this.batch=new lr(this.config)}async getTransactions(t){return Ro({aptosConfig:this.config,...t})}async getTransactionByVersion(t){return zo({aptosConfig:this.config,...t})}async getTransactionByHash(t){return nn({aptosConfig:this.config,...t})}async isPendingTransaction(t){return Do({aptosConfig:this.config,...t})}async waitForTransaction(t){return Dt({aptosConfig:this.config,...t})}async getGasPriceEstimation(){return Xn({aptosConfig:this.config})}getSigningMessage(t){return Wo(t)}async publishPackageTransaction(t){return jo({aptosConfig:this.config,...t})}async rotateAuthKey(t){return Xo({aptosConfig:this.config,...t})}sign(t){return or({...t})}signAsFeePayer(t){let{signer:e,transaction:r}=t;if(!r.feePayerAddress)throw new Error(`Transaction ${r} is not a Fee Payer transaction`);return r.feePayerAddress=e.accountAddress,or({signer:e,transaction:r})}async batchTransactionsForSingleAccount(t){try{let{sender:e,data:r,options:i}=t;this.batch.forSingleAccount({sender:e,data:r,options:i})}catch(e){throw new Error(`failed to submit transactions with error: ${e}`)}}async signAndSubmitTransaction(t){let{signer:e,transaction:r}=t;return an({aptosConfig:this.config,signer:e,transaction:r})}};var Tn=class{constructor(t){this.config=t}async getTableItem(t){return Qn({aptosConfig:this.config,...t})}async getTableItemsData(t){return await A({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"default_processor"}),yo({aptosConfig:this.config,...t})}async getTableItemsMetadata(t){return await A({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"default_processor"}),fo({aptosConfig:this.config,...t})}};async function Qs(n){let{aptosConfig:t}=n;return Oe(async()=>{let e=await Fc(n),r=await Mc(n);return Rn.create(r,Number(e.max_exp_horizon_secs))},`keyless-configuration-${t.network}`,1e3*60*5)()}async function Fc(n){let{aptosConfig:t,options:e}=n,r="0x1::keyless_account::Configuration",{data:i}=await q({aptosConfig:t,originMethod:"getKeylessConfiguration",path:`accounts/${u.from("0x1").toString()}/resource/${r}`,params:{ledger_version:_optionalChain([e, 'optionalAccess', _188 => _188.ledgerVersion])}});return i.data}async function Mc(n){let{aptosConfig:t,options:e}=n,r="0x1::keyless_account::Groth16VerificationKey",{data:i}=await q({aptosConfig:t,originMethod:"getGroth16VerificationKey",path:`accounts/${u.from("0x1").toString()}/resource/${r}`,params:{ledger_version:_optionalChain([e, 'optionalAccess', _189 => _189.ledgerVersion])}});return i.data}async function ui(n){let{aptosConfig:t,jwt:e,ephemeralKeyPair:r,uidKey:i,derivationPath:o}=n,s={jwt_b64:e,epk:r.getPublicKey().bcsToHex().toStringWithoutPrefix(),exp_date_secs:r.expiryDateSecs,epk_blinder:g.fromHexInput(r.blinder).toStringWithoutPrefix(),uid_key:i||"sub",derivation_path:o},{data:a}=await Li({aptosConfig:t,path:"fetch",body:s,originMethod:"getPepper",overrides:{WITH_CREDENTIALS:!1}});return g.fromHexInput(a.pepper).toUint8Array()}async function qc(n){let{aptosConfig:t,jwt:e,ephemeralKeyPair:r,pepper:i,uidKey:o}=n,s={jwt_b64:e,epk:r.getPublicKey().bcsToHex().toStringWithoutPrefix(),epk_blinder:g.fromHexInput(r.blinder).toStringWithoutPrefix(),exp_date_secs:r.expiryDateSecs,exp_horizon_secs:$t,pepper:g.fromHexInput(i).toStringWithoutPrefix(),uid_key:o||"sub"},{data:a}=await Hi({aptosConfig:t,path:"prove",body:s,originMethod:"getProof",overrides:{WITH_CREDENTIALS:!1}}),c=a.proof,p=new yt({a:c.a,b:c.b,c:c.c});return new Ce({proof:new et(p,0),trainingWheelsSignature:ae.fromHex(a.training_wheels_signature)})}async function Ws(n){let{proofFetchCallback:t}=n,{pepper:e}=n;if(e===void 0?e=await ui(n):e=g.fromHexInput(e).toUint8Array(),e.length!==be.PEPPER_LENGTH)throw new Error(`Pepper needs to be ${be.PEPPER_LENGTH} bytes`);let r=qc({...n,pepper:e}),i=t?r:await r;return be.fromJWTAndProof({...n,proof:i,pepper:e,proofFetchCallback:t})}var bn=class{constructor(t){this.config=t}async getKeylessConfig(t){return Qs({aptosConfig:this.config,options:t})}async getPepper(t){return ui({aptosConfig:this.config,...t})}async deriveKeylessAccount(t){return Ws({aptosConfig:this.config,...t})}};var X=class{constructor(t){this.config=new Zn(t),this.account=new rn(this.config),this.ans=new fn(this.config),this.coin=new cn(this.config),this.digitalAsset=new un(this.config),this.event=new dn(this.config),this.faucet=new ln(this.config),this.fungibleAsset=new gn(this.config),this.general=new mn(this.config),this.staking=new An(this.config),this.transaction=new hn(this.config),this.table=new Tn(this.config),this.keyless=new bn(this.config)}};function pe(n,t,e){Object.getOwnPropertyNames(t.prototype).forEach(r=>{let i=Object.getOwnPropertyDescriptor(t.prototype,r);i&&(i.value=function(...o){return this[e][r](...o)},Object.defineProperty(n.prototype,r,i))})}pe(X,rn,"account");pe(X,fn,"ans");pe(X,cn,"coin");pe(X,un,"digitalAsset");pe(X,dn,"event");pe(X,ln,"faucet");pe(X,gn,"fungibleAsset");pe(X,mn,"general");pe(X,An,"staking");pe(X,hn,"transaction");pe(X,Tn,"table");pe(X,bn,"keyless");exports.APTOS_BIP44_REGEX = ua; exports.APTOS_COIN = Kn; exports.APTOS_HARDENED_REGEX = ca; exports.Account = Ne; exports.AccountAddress = u; exports.AccountAuthenticator = V; exports.AccountAuthenticatorEd25519 = me; exports.AccountAuthenticatorMultiEd25519 = zn; exports.AccountAuthenticatorMultiKey = nt; exports.AccountAuthenticatorSingleKey = L; exports.AccountAuthenticatorVariant = Ai; exports.AccountPublicKey = ie; exports.AccountSequenceNumber = pr; exports.AddressInvalidReason = ia; exports.AnyPublicKey = K; exports.AnyPublicKeyVariant = yr; exports.AnySignature = k; exports.AnySignatureVariant = hi; exports.Aptos = X; exports.AptosApiError = ye; exports.AptosApiType = Vt; exports.AptosConfig = Zn; exports.AuthenticationKey = F; exports.Bool = E; exports.CKDPriv = Pi; exports.ChainId = At; exports.DEFAULT_MAX_GAS_AMOUNT = Ki; exports.DEFAULT_TXN_EXP_SEC_FROM_NOW = Gi; exports.DEFAULT_TXN_TIMEOUT_SEC = Dn; exports.DeriveScheme = na; exports.Deserializer = te; exports.EPK_HORIZON_SECS = $t; exports.Ed25519Account = Et; exports.Ed25519PrivateKey = $; exports.Ed25519PublicKey = x; exports.Ed25519Signature = S; exports.EntryFunction = ot; exports.EntryFunctionBytes = _n; exports.EphemeralCertificate = Ye; exports.EphemeralCertificateVariant = Ar; exports.EphemeralKeyPair = Jt; exports.EphemeralPublicKey = ke; exports.EphemeralPublicKeyVariant = fr; exports.EphemeralSignature = ae; exports.EphemeralSignatureVariant = Ti; exports.FeePayerRawTransaction = at; exports.FixedBytes = Le; exports.Groth16Zkp = yt; exports.HARDENED_OFFSET = xi; exports.Hex = g; exports.HexInvalidReason = Zs; exports.Identifier = R; exports.IssuerToJwkEndpoint = ry; exports.KeyType = pa; exports.KeylessAccount = be; exports.KeylessConfiguration = Rn; exports.KeylessError = en; exports.KeylessErrorType = La; exports.KeylessPublicKey = ge; exports.KeylessSignature = Je; exports.MAX_AUD_VAL_BYTES = Ga; exports.MAX_COMMITED_EPK_BYTES = Cd; exports.MAX_EXTRA_FIELD_BYTES = vd; exports.MAX_ISS_VAL_BYTES = _d; exports.MAX_JWT_HEADER_B64_BYTES = Pd; exports.MAX_UID_KEY_BYTES = ka; exports.MAX_UID_VAL_BYTES = Na; exports.MimeType = vn; exports.ModuleId = Lt; exports.MoveAbility = bi; exports.MoveFunctionVisibility = ea; exports.MoveOption = Ke; exports.MoveString = b; exports.MoveVector = T; exports.MultiAgentRawTransaction = st; exports.MultiAgentTransaction = On; exports.MultiEd25519PublicKey = gt; exports.MultiEd25519Signature = We; exports.MultiKey = ft; exports.MultiKeyAccount = Mn; exports.MultiKeySignature = tt; exports.MultiSig = Xt; exports.MultiSigTransactionPayload = Yt; exports.Network = Rr; exports.NetworkToChainId = zr; exports.NetworkToFaucetAPI = Fi; exports.NetworkToIndexerAPI = Bi; exports.NetworkToNetworkName = wy; exports.NetworkToNodeAPI = Oi; exports.NetworkToPepperAPI = Ir; exports.NetworkToProverAPI = Ur; exports.ParsingError = Q; exports.ProcessorType = rt; exports.PublicKey = He; exports.RAW_TRANSACTION_SALT = ki; exports.RAW_TRANSACTION_WITH_DATA_SALT = vr; exports.RawTransaction = ce; exports.RawTransactionWithData = kn; exports.RoleType = ta; exports.RotationProofChallenge = Nn; exports.Script = jt; exports.ScriptTransactionArgumentVariants = Ft; exports.Secp256k1PrivateKey = Xe; exports.Secp256k1PublicKey = he; exports.Secp256k1Signature = _e; exports.Serializable = d; exports.Serializer = W; exports.Signature = G; exports.SignedTransaction = ct; exports.SigningScheme = fe; exports.SigningSchemeInput = br; exports.SimpleTransaction = Bn; exports.SingleKeyAccount = It; exports.StructTag = Ee; exports.TransactionAndProof = Er; exports.TransactionAuthenticator = Ie; exports.TransactionAuthenticatorEd25519 = xt; exports.TransactionAuthenticatorFeePayer = vt; exports.TransactionAuthenticatorMultiAgent = _t; exports.TransactionAuthenticatorMultiEd25519 = Pr; exports.TransactionAuthenticatorSingleSender = Pt; exports.TransactionAuthenticatorVariant = fi; exports.TransactionPayload = it; exports.TransactionPayloadEntryFunction = Qt; exports.TransactionPayloadMultiSig = Wt; exports.TransactionPayloadScript = Ht; exports.TransactionPayloadVariants = mi; exports.TransactionResponseType = Tr; exports.TransactionVariants = yi; exports.TransactionWorker = dr; exports.TransactionWorkerEventsEnum = Hs; exports.TypeTag = z; exports.TypeTagAddress = J; exports.TypeTagBool = M; exports.TypeTagGeneric = D; exports.TypeTagParserError = N; exports.TypeTagParserErrorType = nc; exports.TypeTagReference = Gn; exports.TypeTagSigner = St; exports.TypeTagStruct = y; exports.TypeTagU128 = bt; exports.TypeTagU16 = ht; exports.TypeTagU256 = wt; exports.TypeTagU32 = Tt; exports.TypeTagU64 = j; exports.TypeTagU8 = Te; exports.TypeTagVariants = gi; exports.TypeTagVector = v; exports.U128 = de; exports.U16 = ne; exports.U256 = le; exports.U32 = re; exports.U64 = O; exports.U8 = B; exports.ZeroKnowledgeSig = Ce; exports.ZkProof = et; exports.ZkpVariant = hr; exports.aptosCoinStructTag = Nl; exports.aptosRequest = qn; exports.buildTransaction = Jr; exports.checkOrConvertArgument = Kt; exports.convertArgument = Zr; exports.deriveKey = wr; exports.deriveTransactionType = Cr; exports.deserializeFromScriptArgument = Oa; exports.ensureBoolean = mr; exports.fetchEntryFunctionAbi = qo; exports.fetchFunctionAbi = Mo; exports.fetchViewFunctionAbi = $o; exports.findFirstNonSignerArg = Fo; exports.generateRawTransaction = pc; exports.generateSignedTransaction = ei; exports.generateSignedTransactionForSimulation = Lo; exports.generateSigningMessage = Zt; exports.generateSigningMessageForTransaction = Ct; exports.generateTransactionPayload = ir; exports.generateTransactionPayloadWithABI = ac; exports.generateUserTransactionHash = CA; exports.generateViewFunctionPayload = Vo; exports.generateViewFunctionPayloadWithABI = cc; exports.get = Dr; exports.getAptosFullNode = q; exports.getAptosPepperService = $y; exports.getAuthenticatorForSimulation = rr; exports.getFunctionParts = sn; exports.hashValues = Ho; exports.isBcsAddress = tr; exports.isBcsBool = $r; exports.isBcsFixedBytes = rc; exports.isBcsString = Vr; exports.isBcsU128 = jr; exports.isBcsU16 = Hr; exports.isBcsU256 = Xr; exports.isBcsU32 = Qr; exports.isBcsU64 = Wr; exports.isBcsU8 = Lr; exports.isBlockMetadataTransactionResponse = mu; exports.isBool = ko; exports.isEd25519Signature = Au; exports.isEncodedEntryFunctionArgument = Bo; exports.isFeePayerSignature = bu; exports.isGenesisTransactionResponse = gu; exports.isLargeNumber = er; exports.isMultiAgentSignature = Tu; exports.isMultiEd25519Signature = wu; exports.isNull = No; exports.isNumber = Jn; exports.isPendingTransactionResponse = du; exports.isScriptDataInput = Oo; exports.isSecp256k1Signature = hu; exports.isStateCheckpointTransactionResponse = yu; exports.isString = Se; exports.isUserTransactionResponse = lu; exports.isValidBIP44Path = _i; exports.isValidHardenedPath = vi; exports.isValidatorTransactionResponse = fu; exports.mnemonicToSeed = Pn; exports.normalizeBundle = Mi; exports.objectStructTag = ee; exports.optionStructTag = Bl; exports.outOfRangeErrorMessage = Js; exports.paginateWithCursor = Rt; exports.parseTypeTag = Ue; exports.post = tn; exports.postAptosFaucet = Vi; exports.postAptosFullNode = ut; exports.postAptosIndexer = $i; exports.postAptosPepperService = Li; exports.postAptosProvingService = Hi; exports.promiseFulfilledStatus = Ls; exports.request = Ha; exports.splitPath = Ci; exports.standardizeTypeTags = nr; exports.stringStructTag = _; exports.throwTypeMismatch = I; exports.validateNumberInRange = De;
|
|
458
458
|
//# sourceMappingURL=index.js.map
|