@aptos-labs/ts-sdk 1.11.0 → 1.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -6
- package/dist/common/index.d.ts +73 -31
- package/dist/common/index.js +26 -26
- package/dist/common/index.js.map +1 -1
- package/dist/esm/api/account.mjs +1 -1
- package/dist/esm/api/ans.d.mts +13 -11
- package/dist/esm/api/ans.mjs +1 -1
- package/dist/esm/api/aptos.d.mts +6 -4
- package/dist/esm/api/aptos.mjs +1 -1
- package/dist/esm/api/coin.d.mts +9 -7
- package/dist/esm/api/coin.mjs +1 -1
- package/dist/esm/api/digitalAsset.d.mts +3 -1
- 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 +6 -4
- package/dist/esm/api/fungibleAsset.mjs +1 -1
- package/dist/esm/api/general.d.mts +2 -0
- package/dist/esm/api/general.mjs +1 -1
- package/dist/esm/api/index.d.mts +6 -4
- package/dist/esm/api/index.mjs +1 -1
- package/dist/esm/api/staking.mjs +1 -1
- package/dist/esm/api/transaction.d.mts +6 -4
- package/dist/esm/api/transaction.mjs +1 -1
- package/dist/esm/api/transactionSubmission/build.d.mts +9 -7
- package/dist/esm/api/transactionSubmission/build.mjs +1 -1
- package/dist/esm/api/transactionSubmission/management.d.mts +5 -3
- package/dist/esm/api/transactionSubmission/management.mjs +1 -1
- package/dist/esm/api/transactionSubmission/sign.d.mts +2 -0
- package/dist/esm/api/transactionSubmission/sign.mjs +1 -1
- package/dist/esm/api/transactionSubmission/sign.mjs.map +1 -1
- package/dist/esm/api/transactionSubmission/simulate.d.mts +2 -0
- package/dist/esm/api/transactionSubmission/simulate.mjs +1 -1
- package/dist/esm/api/transactionSubmission/submit.d.mts +2 -0
- package/dist/esm/api/transactionSubmission/submit.mjs +1 -1
- package/dist/esm/api/utils.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.mjs +1 -1
- package/dist/esm/{chunk-VNNLHEJ4.mjs → chunk-2MRYBOYC.mjs} +2 -2
- package/dist/esm/{chunk-TTM66JZ4.mjs → chunk-2XVDVF5C.mjs} +2 -2
- package/dist/esm/chunk-3D7GOEFD.mjs +2 -0
- package/dist/esm/chunk-3D7GOEFD.mjs.map +1 -0
- package/dist/esm/{chunk-3RRZ4MSV.mjs → chunk-3GTT6K3X.mjs} +2 -2
- package/dist/esm/{chunk-Y3CHPF6X.mjs → chunk-4J5V4M3P.mjs} +2 -2
- package/dist/esm/{chunk-VKWPCOZA.mjs → chunk-4KMISR2H.mjs} +2 -2
- package/dist/esm/{chunk-BWG5NCHC.mjs → chunk-5LI6PUQN.mjs} +2 -2
- package/dist/esm/{chunk-QDD2MDJZ.mjs → chunk-5NSXEM3O.mjs} +2 -2
- package/dist/esm/{chunk-Q5GNCAA6.mjs → chunk-6F7X2C22.mjs} +2 -2
- package/dist/esm/{chunk-XXKA2GO7.mjs → chunk-6MLNYBCP.mjs} +2 -2
- package/dist/esm/chunk-6MLNYBCP.mjs.map +1 -0
- package/dist/esm/{chunk-U5CKFPSM.mjs → chunk-6X6G2RC3.mjs} +2 -2
- package/dist/esm/chunk-6X6G2RC3.mjs.map +1 -0
- package/dist/esm/{chunk-T43CJS4C.mjs → chunk-7JZWCHLH.mjs} +2 -2
- package/dist/esm/{chunk-W5PK4QCX.mjs → chunk-7PNFDDIG.mjs} +2 -2
- package/dist/esm/chunk-AFTMLXYT.mjs +2 -0
- package/dist/esm/chunk-BCUSI3N6.mjs +2 -0
- package/dist/esm/chunk-BCUSI3N6.mjs.map +1 -0
- package/dist/esm/{chunk-HSITRYZ5.mjs → chunk-C67SYOXM.mjs} +2 -2
- package/dist/esm/{chunk-HYQSORWM.mjs → chunk-CHVWOPVA.mjs} +2 -2
- package/dist/esm/{chunk-JKXSSRNT.mjs → chunk-CPQPVRKV.mjs} +2 -2
- package/dist/esm/{chunk-P434YHBQ.mjs → chunk-D5Q7BI3J.mjs} +2 -2
- package/dist/esm/chunk-DAC5J2BG.mjs +2 -0
- package/dist/esm/chunk-DAC5J2BG.mjs.map +1 -0
- package/dist/esm/{chunk-O5L7WGNH.mjs → chunk-EIXGNR6D.mjs} +2 -2
- package/dist/esm/{chunk-OWEAY3N3.mjs → chunk-EOQOTFO7.mjs} +2 -2
- package/dist/esm/chunk-F7EMGK4M.mjs +2 -0
- package/dist/esm/chunk-F7EMGK4M.mjs.map +1 -0
- package/dist/esm/chunk-F7J7ZW4H.mjs +2 -0
- package/dist/esm/{chunk-2BGOMPDV.mjs → chunk-FNKDXPPQ.mjs} +2 -2
- package/dist/esm/{chunk-VBSAEAWA.mjs → chunk-HOTGXRPG.mjs} +2 -2
- package/dist/esm/{chunk-O22J7RER.mjs → chunk-HTTPFWYL.mjs} +2 -2
- package/dist/esm/chunk-HTWJVZZ5.mjs +2 -0
- package/dist/esm/chunk-HTWJVZZ5.mjs.map +1 -0
- package/dist/esm/chunk-ICXA3DZH.mjs +1 -0
- package/dist/esm/{chunk-2NC32JRF.mjs → chunk-IQSAG5Y5.mjs} +2 -2
- package/dist/esm/{chunk-4P6KFDXF.mjs → chunk-J43BXPJ3.mjs} +2 -2
- package/dist/esm/chunk-J43BXPJ3.mjs.map +1 -0
- package/dist/esm/{chunk-JX3IRXNX.mjs → chunk-JE7INUQ2.mjs} +2 -2
- package/dist/esm/chunk-JNDRFTEA.mjs +2 -0
- package/dist/esm/chunk-JNDRFTEA.mjs.map +1 -0
- package/dist/esm/{chunk-27ML4NFD.mjs → chunk-JV2PBG6G.mjs} +2 -2
- package/dist/esm/{chunk-3EKNELIS.mjs → chunk-JV2UOHGR.mjs} +2 -2
- package/dist/esm/{chunk-43QJL2AV.mjs → chunk-JVBXZ6OJ.mjs} +2 -2
- package/dist/esm/{chunk-RWBAKP5G.mjs → chunk-KJI5PY5Z.mjs} +2 -2
- package/dist/esm/chunk-KPDWT3LC.mjs +2 -0
- package/dist/esm/chunk-KPDWT3LC.mjs.map +1 -0
- package/dist/esm/{chunk-PAY4TBCF.mjs → chunk-L54P6EGN.mjs} +2 -2
- package/dist/esm/{chunk-PAY4TBCF.mjs.map → chunk-L54P6EGN.mjs.map} +1 -1
- package/dist/esm/{chunk-Y3R5DLBS.mjs → chunk-L6KXN3YD.mjs} +2 -2
- package/dist/esm/{chunk-SQW7K56J.mjs → chunk-LF6IQT54.mjs} +2 -2
- package/dist/esm/{chunk-JF4E53MH.mjs → chunk-LSKVPMOF.mjs} +2 -2
- package/dist/esm/{chunk-JF4E53MH.mjs.map → chunk-LSKVPMOF.mjs.map} +1 -1
- package/dist/esm/{chunk-Y7G5W2QZ.mjs → chunk-MS76A6LX.mjs} +2 -2
- package/dist/esm/{chunk-JLDOXN33.mjs → chunk-MV7RDJFK.mjs} +2 -2
- package/dist/esm/{chunk-LD7YBNH5.mjs → chunk-NLMMCXLR.mjs} +2 -2
- package/dist/esm/{chunk-A5ACWD7S.mjs → chunk-NLPPL42P.mjs} +2 -2
- package/dist/esm/chunk-NMASPJTH.mjs +2 -0
- package/dist/esm/chunk-NMASPJTH.mjs.map +1 -0
- package/dist/esm/{chunk-OH6HD5SF.mjs → chunk-O3YFW4T3.mjs} +2 -2
- package/dist/esm/chunk-O3YFW4T3.mjs.map +1 -0
- package/dist/esm/{chunk-4LQNMXX3.mjs → chunk-P2CIREOD.mjs} +2 -2
- package/dist/esm/{chunk-H4Q7YQD3.mjs → chunk-PE6R6XQV.mjs} +2 -2
- package/dist/esm/chunk-QAMK2MSI.mjs +2 -0
- package/dist/esm/chunk-QAMK2MSI.mjs.map +1 -0
- package/dist/esm/{chunk-AVQSQJUO.mjs → chunk-QMFBU2CG.mjs} +2 -2
- package/dist/esm/{chunk-HEDMDM2U.mjs → chunk-R3ELNYY5.mjs} +2 -2
- package/dist/esm/chunk-R3ELNYY5.mjs.map +1 -0
- package/dist/esm/{chunk-C62XI6VN.mjs → chunk-R4ERAOCM.mjs} +2 -2
- package/dist/esm/{chunk-2TRSGKMS.mjs → chunk-RP66QS6R.mjs} +2 -2
- package/dist/esm/chunk-RVUPGO4R.mjs +2 -0
- package/dist/esm/chunk-RVUPGO4R.mjs.map +1 -0
- package/dist/esm/{chunk-WHNLDDPT.mjs → chunk-S5AGI7RQ.mjs} +2 -2
- package/dist/esm/{chunk-NDV4GZ5U.mjs → chunk-UCDLUHVW.mjs} +2 -2
- package/dist/esm/chunk-UCDLUHVW.mjs.map +1 -0
- package/dist/esm/{chunk-GHMYWL3R.mjs → chunk-UEI62FBQ.mjs} +2 -2
- package/dist/esm/chunk-VU2W3ZLX.mjs +2 -0
- package/dist/esm/{chunk-LNS5RI5S.mjs.map → chunk-VU2W3ZLX.mjs.map} +1 -1
- package/dist/esm/{chunk-AT2HAXSH.mjs → chunk-VUZDLGDK.mjs} +2 -2
- package/dist/esm/{chunk-XDZF5IUF.mjs → chunk-WNVUG2UF.mjs} +2 -2
- package/dist/esm/{chunk-CIMZIZY3.mjs → chunk-WXXASZQ4.mjs} +2 -2
- package/dist/esm/{chunk-EBCIZ4D6.mjs → chunk-WZSVQBPA.mjs} +2 -2
- package/dist/esm/{chunk-HYOPI6T2.mjs → chunk-X3QW43I2.mjs} +2 -2
- package/dist/esm/{chunk-VK3H7DMJ.mjs → chunk-XMJEWG3I.mjs} +2 -2
- package/dist/esm/{chunk-JEQSSMDK.mjs → chunk-XQMUVQI3.mjs} +2 -2
- package/dist/esm/chunk-Y2AFC3E6.mjs +2 -0
- package/dist/esm/chunk-Y2AFC3E6.mjs.map +1 -0
- package/dist/esm/{chunk-AE2K65NN.mjs → chunk-Y52TZMRO.mjs} +2 -2
- package/dist/esm/chunk-Y52TZMRO.mjs.map +1 -0
- package/dist/esm/{chunk-RP4FMC6O.mjs → chunk-YJIRT3GJ.mjs} +2 -2
- package/dist/esm/{chunk-CJLZV5JK.mjs → chunk-YMFCBU4L.mjs} +2 -2
- package/dist/esm/{chunk-NHVLEE5G.mjs → chunk-ZPS4RIFU.mjs} +2 -2
- package/dist/esm/chunk-ZPS4RIFU.mjs.map +1 -0
- package/dist/esm/cli/index.mjs +1 -1
- package/dist/esm/cli/localNode.d.mts +1 -1
- package/dist/esm/cli/localNode.mjs +1 -1
- package/dist/esm/client/core.mjs +1 -1
- package/dist/esm/client/get.mjs +1 -1
- package/dist/esm/client/index.mjs +1 -1
- package/dist/esm/client/post.mjs +1 -1
- package/dist/esm/core/account/Account.mjs +1 -1
- package/dist/esm/core/account/Ed25519Account.mjs +1 -1
- package/dist/esm/core/account/SingleKeyAccount.mjs +1 -1
- package/dist/esm/core/account/index.d.mts +1 -1
- package/dist/esm/core/account/index.mjs +1 -1
- package/dist/esm/core/account/utils/address.d.mts +10 -1
- package/dist/esm/core/account/utils/address.mjs +1 -1
- package/dist/esm/core/account/utils/index.d.mts +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.mjs +1 -1
- package/dist/esm/core/crypto/ed25519.d.mts +2 -2
- package/dist/esm/core/crypto/ed25519.mjs +1 -1
- package/dist/esm/core/crypto/index.mjs +1 -1
- package/dist/esm/core/crypto/multiEd25519.mjs +1 -1
- package/dist/esm/core/crypto/multiKey.mjs +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.mjs +1 -1
- package/dist/esm/core/crypto/utils.d.mts +16 -0
- package/dist/esm/core/crypto/utils.mjs +2 -0
- package/dist/esm/core/crypto/utils.mjs.map +1 -0
- package/dist/esm/core/hex.d.mts +2 -2
- package/dist/esm/core/hex.mjs +1 -1
- package/dist/esm/core/index.d.mts +1 -1
- package/dist/esm/core/index.mjs +1 -1
- package/dist/esm/index.d.mts +5 -3
- package/dist/esm/index.mjs +1 -1
- package/dist/esm/internal/account.mjs +1 -1
- package/dist/esm/internal/ans.d.mts +7 -5
- package/dist/esm/internal/ans.mjs +1 -1
- package/dist/esm/internal/coin.d.mts +3 -1
- package/dist/esm/internal/coin.mjs +1 -1
- package/dist/esm/internal/digitalAsset.d.mts +3 -1
- 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 +6 -4
- package/dist/esm/internal/fungibleAsset.mjs +1 -1
- package/dist/esm/internal/general.mjs +1 -1
- package/dist/esm/internal/staking.mjs +1 -1
- package/dist/esm/internal/transaction.mjs +1 -1
- package/dist/esm/internal/transactionSubmission.d.mts +3 -1
- package/dist/esm/internal/transactionSubmission.mjs +1 -1
- package/dist/esm/internal/view.d.mts +2 -0
- package/dist/esm/internal/view.mjs +1 -1
- package/dist/esm/transactions/authenticator/account.mjs +1 -1
- package/dist/esm/transactions/authenticator/index.mjs +1 -1
- package/dist/esm/transactions/authenticator/transaction.mjs +1 -1
- package/dist/esm/transactions/index.d.mts +4 -2
- 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 -0
- package/dist/esm/transactions/instances/index.mjs +1 -1
- package/dist/esm/transactions/instances/moduleId.mjs +1 -1
- package/dist/esm/transactions/instances/multiAgentTransaction.d.mts +41 -0
- package/dist/esm/transactions/instances/multiAgentTransaction.mjs +2 -0
- package/dist/esm/transactions/instances/multiAgentTransaction.mjs.map +1 -0
- package/dist/esm/transactions/instances/rawTransaction.mjs +1 -1
- package/dist/esm/transactions/instances/rotationProofChallenge.mjs +1 -1
- package/dist/esm/transactions/instances/signedTransaction.mjs +1 -1
- package/dist/esm/transactions/instances/simpleTransaction.d.mts +41 -0
- package/dist/esm/transactions/instances/simpleTransaction.mjs +2 -0
- package/dist/esm/transactions/instances/simpleTransaction.mjs.map +1 -0
- package/dist/esm/transactions/instances/transactionPayload.mjs +1 -1
- package/dist/esm/transactions/management/accountSequenceNumber.mjs +1 -1
- package/dist/esm/transactions/management/index.d.mts +2 -0
- package/dist/esm/transactions/management/index.mjs +1 -1
- package/dist/esm/transactions/management/transactionWorker.d.mts +3 -1
- package/dist/esm/transactions/management/transactionWorker.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/helpers.d.mts +2 -0
- package/dist/esm/transactions/transactionBuilder/helpers.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/index.d.mts +3 -1
- package/dist/esm/transactions/transactionBuilder/index.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/remoteAbi.d.mts +2 -0
- package/dist/esm/transactions/transactionBuilder/remoteAbi.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/transactionBuilder.d.mts +14 -2
- package/dist/esm/transactions/transactionBuilder/transactionBuilder.mjs +1 -1
- package/dist/esm/transactions/typeTag/index.mjs +1 -1
- package/dist/esm/transactions/typeTag/parser.mjs +1 -1
- package/dist/esm/transactions/types.d.mts +3 -22
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +1 -1
- package/src/api/ans.ts +8 -7
- package/src/api/coin.ts +2 -1
- package/src/api/digitalAsset.ts +2 -1
- package/src/api/fungibleAsset.ts +2 -1
- package/src/api/transaction.ts +1 -1
- package/src/api/transactionSubmission/build.ts +3 -6
- package/src/cli/localNode.ts +1 -1
- package/src/core/account/utils/address.ts +18 -0
- package/src/core/crypto/ed25519.ts +7 -5
- package/src/core/crypto/secp256k1.ts +6 -4
- package/src/core/crypto/utils.ts +24 -0
- package/src/core/hex.ts +4 -4
- package/src/internal/ans.ts +9 -5
- package/src/internal/coin.ts +2 -1
- package/src/internal/digitalAsset.ts +2 -1
- package/src/internal/fungibleAsset.ts +1 -1
- package/src/internal/transactionSubmission.ts +2 -2
- package/src/transactions/instances/index.ts +1 -0
- package/src/transactions/instances/multiAgentTransaction.ts +68 -0
- package/src/transactions/instances/simpleTransaction.ts +60 -0
- package/src/transactions/management/transactionWorker.ts +2 -1
- package/src/transactions/transactionBuilder/transactionBuilder.ts +38 -11
- package/src/transactions/types.ts +2 -23
- package/src/version.ts +1 -1
- package/dist/esm/chunk-3OOOAQJG.mjs +0 -2
- package/dist/esm/chunk-3OOOAQJG.mjs.map +0 -1
- package/dist/esm/chunk-4P6KFDXF.mjs.map +0 -1
- package/dist/esm/chunk-4UMTUJL5.mjs +0 -2
- package/dist/esm/chunk-4UMTUJL5.mjs.map +0 -1
- package/dist/esm/chunk-AE2K65NN.mjs.map +0 -1
- package/dist/esm/chunk-BZMO6Q6L.mjs +0 -2
- package/dist/esm/chunk-BZMO6Q6L.mjs.map +0 -1
- package/dist/esm/chunk-D2XKVVEN.mjs +0 -2
- package/dist/esm/chunk-D2XKVVEN.mjs.map +0 -1
- package/dist/esm/chunk-EXX55N2B.mjs +0 -2
- package/dist/esm/chunk-EXX55N2B.mjs.map +0 -1
- package/dist/esm/chunk-GQTC6QIS.mjs +0 -2
- package/dist/esm/chunk-GQTC6QIS.mjs.map +0 -1
- package/dist/esm/chunk-HEDMDM2U.mjs.map +0 -1
- package/dist/esm/chunk-HTZTTZQJ.mjs +0 -1
- package/dist/esm/chunk-IWPVPIKD.mjs +0 -2
- package/dist/esm/chunk-LG6SZTWR.mjs +0 -2
- package/dist/esm/chunk-LG6SZTWR.mjs.map +0 -1
- package/dist/esm/chunk-LNS5RI5S.mjs +0 -2
- package/dist/esm/chunk-NDV4GZ5U.mjs.map +0 -1
- package/dist/esm/chunk-NHVLEE5G.mjs.map +0 -1
- package/dist/esm/chunk-OH5ADEJO.mjs +0 -2
- package/dist/esm/chunk-OH6HD5SF.mjs.map +0 -1
- package/dist/esm/chunk-TBSPLLCB.mjs +0 -2
- package/dist/esm/chunk-TBSPLLCB.mjs.map +0 -1
- package/dist/esm/chunk-U5CKFPSM.mjs.map +0 -1
- package/dist/esm/chunk-XXKA2GO7.mjs.map +0 -1
- /package/dist/esm/{chunk-VNNLHEJ4.mjs.map → chunk-2MRYBOYC.mjs.map} +0 -0
- /package/dist/esm/{chunk-TTM66JZ4.mjs.map → chunk-2XVDVF5C.mjs.map} +0 -0
- /package/dist/esm/{chunk-3RRZ4MSV.mjs.map → chunk-3GTT6K3X.mjs.map} +0 -0
- /package/dist/esm/{chunk-Y3CHPF6X.mjs.map → chunk-4J5V4M3P.mjs.map} +0 -0
- /package/dist/esm/{chunk-VKWPCOZA.mjs.map → chunk-4KMISR2H.mjs.map} +0 -0
- /package/dist/esm/{chunk-BWG5NCHC.mjs.map → chunk-5LI6PUQN.mjs.map} +0 -0
- /package/dist/esm/{chunk-QDD2MDJZ.mjs.map → chunk-5NSXEM3O.mjs.map} +0 -0
- /package/dist/esm/{chunk-Q5GNCAA6.mjs.map → chunk-6F7X2C22.mjs.map} +0 -0
- /package/dist/esm/{chunk-T43CJS4C.mjs.map → chunk-7JZWCHLH.mjs.map} +0 -0
- /package/dist/esm/{chunk-W5PK4QCX.mjs.map → chunk-7PNFDDIG.mjs.map} +0 -0
- /package/dist/esm/{chunk-OH5ADEJO.mjs.map → chunk-AFTMLXYT.mjs.map} +0 -0
- /package/dist/esm/{chunk-HSITRYZ5.mjs.map → chunk-C67SYOXM.mjs.map} +0 -0
- /package/dist/esm/{chunk-HYQSORWM.mjs.map → chunk-CHVWOPVA.mjs.map} +0 -0
- /package/dist/esm/{chunk-JKXSSRNT.mjs.map → chunk-CPQPVRKV.mjs.map} +0 -0
- /package/dist/esm/{chunk-P434YHBQ.mjs.map → chunk-D5Q7BI3J.mjs.map} +0 -0
- /package/dist/esm/{chunk-O5L7WGNH.mjs.map → chunk-EIXGNR6D.mjs.map} +0 -0
- /package/dist/esm/{chunk-OWEAY3N3.mjs.map → chunk-EOQOTFO7.mjs.map} +0 -0
- /package/dist/esm/{chunk-IWPVPIKD.mjs.map → chunk-F7J7ZW4H.mjs.map} +0 -0
- /package/dist/esm/{chunk-2BGOMPDV.mjs.map → chunk-FNKDXPPQ.mjs.map} +0 -0
- /package/dist/esm/{chunk-VBSAEAWA.mjs.map → chunk-HOTGXRPG.mjs.map} +0 -0
- /package/dist/esm/{chunk-O22J7RER.mjs.map → chunk-HTTPFWYL.mjs.map} +0 -0
- /package/dist/esm/{chunk-HTZTTZQJ.mjs.map → chunk-ICXA3DZH.mjs.map} +0 -0
- /package/dist/esm/{chunk-2NC32JRF.mjs.map → chunk-IQSAG5Y5.mjs.map} +0 -0
- /package/dist/esm/{chunk-JX3IRXNX.mjs.map → chunk-JE7INUQ2.mjs.map} +0 -0
- /package/dist/esm/{chunk-27ML4NFD.mjs.map → chunk-JV2PBG6G.mjs.map} +0 -0
- /package/dist/esm/{chunk-3EKNELIS.mjs.map → chunk-JV2UOHGR.mjs.map} +0 -0
- /package/dist/esm/{chunk-43QJL2AV.mjs.map → chunk-JVBXZ6OJ.mjs.map} +0 -0
- /package/dist/esm/{chunk-RWBAKP5G.mjs.map → chunk-KJI5PY5Z.mjs.map} +0 -0
- /package/dist/esm/{chunk-Y3R5DLBS.mjs.map → chunk-L6KXN3YD.mjs.map} +0 -0
- /package/dist/esm/{chunk-SQW7K56J.mjs.map → chunk-LF6IQT54.mjs.map} +0 -0
- /package/dist/esm/{chunk-Y7G5W2QZ.mjs.map → chunk-MS76A6LX.mjs.map} +0 -0
- /package/dist/esm/{chunk-JLDOXN33.mjs.map → chunk-MV7RDJFK.mjs.map} +0 -0
- /package/dist/esm/{chunk-LD7YBNH5.mjs.map → chunk-NLMMCXLR.mjs.map} +0 -0
- /package/dist/esm/{chunk-A5ACWD7S.mjs.map → chunk-NLPPL42P.mjs.map} +0 -0
- /package/dist/esm/{chunk-4LQNMXX3.mjs.map → chunk-P2CIREOD.mjs.map} +0 -0
- /package/dist/esm/{chunk-H4Q7YQD3.mjs.map → chunk-PE6R6XQV.mjs.map} +0 -0
- /package/dist/esm/{chunk-AVQSQJUO.mjs.map → chunk-QMFBU2CG.mjs.map} +0 -0
- /package/dist/esm/{chunk-C62XI6VN.mjs.map → chunk-R4ERAOCM.mjs.map} +0 -0
- /package/dist/esm/{chunk-2TRSGKMS.mjs.map → chunk-RP66QS6R.mjs.map} +0 -0
- /package/dist/esm/{chunk-WHNLDDPT.mjs.map → chunk-S5AGI7RQ.mjs.map} +0 -0
- /package/dist/esm/{chunk-GHMYWL3R.mjs.map → chunk-UEI62FBQ.mjs.map} +0 -0
- /package/dist/esm/{chunk-AT2HAXSH.mjs.map → chunk-VUZDLGDK.mjs.map} +0 -0
- /package/dist/esm/{chunk-XDZF5IUF.mjs.map → chunk-WNVUG2UF.mjs.map} +0 -0
- /package/dist/esm/{chunk-CIMZIZY3.mjs.map → chunk-WXXASZQ4.mjs.map} +0 -0
- /package/dist/esm/{chunk-EBCIZ4D6.mjs.map → chunk-WZSVQBPA.mjs.map} +0 -0
- /package/dist/esm/{chunk-HYOPI6T2.mjs.map → chunk-X3QW43I2.mjs.map} +0 -0
- /package/dist/esm/{chunk-VK3H7DMJ.mjs.map → chunk-XMJEWG3I.mjs.map} +0 -0
- /package/dist/esm/{chunk-JEQSSMDK.mjs.map → chunk-XQMUVQI3.mjs.map} +0 -0
- /package/dist/esm/{chunk-RP4FMC6O.mjs.map → chunk-YJIRT3GJ.mjs.map} +0 -0
- /package/dist/esm/{chunk-CJLZV5JK.mjs.map → chunk-YMFCBU4L.mjs.map} +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 Wi=Object.defineProperty;var ji=Object.getOwnPropertyDescriptor;var F=(n,e,t,r)=>{for(var o=r>1?void 0:r?ji(e,t):e,i=n.length-1,s;i>=0;i--)(s=n[i])&&(o=(r?s(e,t,o):s(o))||o);return r&&o&&Wi(e,t,o),o};var ce=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 hr="1.11.0";var Lt=(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))(Lt||{}),Tr= exports.TypeTagVariants =(g=>(g[g.Bool=0]="Bool",g[g.U8=1]="U8",g[g.U64=2]="U64",g[g.U128=3]="U128",g[g.Address=4]="Address",g[g.Signer=5]="Signer",g[g.Vector=6]="Vector",g[g.Struct=7]="Struct",g[g.U16=8]="U16",g[g.U32=9]="U32",g[g.U256=10]="U256",g[g.Reference=254]="Reference",g[g.Generic=255]="Generic",g))(Tr||{}),Tt= 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))(Tt||{}),br= exports.TransactionPayloadVariants =(r=>(r[r.Script=0]="Script",r[r.EntryFunction=2]="EntryFunction",r[r.Multisig=3]="Multisig",r))(br||{}),wr= exports.TransactionVariants =(t=>(t[t.MultiAgentTransaction=0]="MultiAgentTransaction",t[t.FeePayerTransaction=1]="FeePayerTransaction",t))(wr||{}),_r= 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))(_r||{}),Sr= exports.AccountAuthenticatorVariant =(o=>(o[o.Ed25519=0]="Ed25519",o[o.MultiEd25519=1]="MultiEd25519",o[o.SingleKey=2]="SingleKey",o[o.MultiKey=3]="MultiKey",o))(Sr||{}),xr= exports.AnyPublicKeyVariant =(t=>(t[t.Ed25519=0]="Ed25519",t[t.Secp256k1=1]="Secp256k1",t))(xr||{}),vr= exports.AnySignatureVariant =(t=>(t[t.Ed25519=0]="Ed25519",t[t.Secp256k1=1]="Secp256k1",t))(vr||{}),Nn= 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))(Nn||{});function da(n){return n.type==="pending_transaction"}function la(n){return n.type==="user_transaction"}function ga(n){return n.type==="genesis_transaction"}function ma(n){return n.type==="block_metadata_transaction"}function ya(n){return n.type==="state_checkpoint_transaction"}function Aa(n){return n.type==="validator_transaction"}function fa(n){return"signature"in n&&n.signature==="ed25519_signature"}function ha(n){return"signature"in n&&n.signature==="secp256k1_ecdsa_signature"}function Ta(n){return n.type==="multi_agent_signature"}function ba(n){return n.type==="fee_payer_signature"}function wa(n){return n.type==="multi_ed25519_signature"}var Xi=(r=>(r.PRIVATE="private",r.PUBLIC="public",r.FRIEND="friend",r))(Xi||{}),Cr= exports.MoveAbility =(o=>(o.STORE="store",o.DROP="drop",o.KEY="key",o.COPY="copy",o))(Cr||{}),Yi= exports.RoleType =(t=>(t.VALIDATOR="validator",t.FULL_NODE="full_node",t))(Yi||{}),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||{}),Gn= exports.SigningSchemeInput =(t=>(t[t.Ed25519=0]="Ed25519",t[t.Secp256k1Ecdsa=2]="Secp256k1Ecdsa",t))(Gn||{}),Pr= 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))(Pr||{});var Er={mainnet:"https://api.mainnet.aptoslabs.com/v1/graphql",testnet:"https://api.testnet.aptoslabs.com/v1/graphql",devnet:"https://api.devnet.aptoslabs.com/v1/graphql",randomnet:"https://indexer-randomnet.hasura.app/v1/graphql",local:"http://127.0.0.1:8090/v1/graphql"},Ir= exports.NetworkToNodeAPI ={mainnet:"https://api.mainnet.aptoslabs.com/v1",testnet:"https://api.testnet.aptoslabs.com/v1",devnet:"https://api.devnet.aptoslabs.com/v1",randomnet:"https://fullnode.random.aptoslabs.com/v1",local:"http://127.0.0.1:8080/v1"},Ur= exports.NetworkToFaucetAPI ={mainnet:"https://faucet.mainnet.aptoslabs.com",testnet:"https://faucet.testnet.aptoslabs.com",devnet:"https://faucet.devnet.aptoslabs.com",randomnet:"https://faucet.random.aptoslabs.com",local:"http://127.0.0.1:8081"},zn= exports.Network =(s=>(s.MAINNET="mainnet",s.TESTNET="testnet",s.DEVNET="devnet",s.RANDOMNET="randomnet",s.LOCAL="local",s.CUSTOM="custom",s))(zn||{}),kn= exports.NetworkToChainId ={mainnet:1,testnet:2,randomnet:70},xa= exports.NetworkToNetworkName ={mainnet:"mainnet",testnet:"testnet",devnet:"devnet",randomnet:"randomnet",local:"local",custom:"custom"};var bt=(r=>(r.FULLNODE="Fullnode",r.INDEXER="Indexer",r.FAUCET="Faucet",r))(bt||{}),Rr= exports.DEFAULT_MAX_GAS_AMOUNT =2e5,Nr= exports.DEFAULT_TXN_EXP_SEC_FROM_NOW =20,Vt= exports.DEFAULT_TXN_TIMEOUT_SEC =20,Ht= exports.APTOS_COIN ="0x1::aptos_coin::AptosCoin",Gr= exports.RAW_TRANSACTION_SALT ="APTOS::RawTransaction",On= exports.RAW_TRANSACTION_WITH_DATA_SALT ="APTOS::RawTransactionWithData",He= 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))(He||{});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 Zi(n,e){let{url:t,method:r,body:o,contentType:i,params:s,overrides:a}=n,c={..._optionalChain([a, 'optionalAccess', _2 => _2.HEADERS]),"x-aptos-client":`aptos-typescript-sdk/${hr}`,"content-type":_nullishCoalesce(i, () => ("application/json"))};return _optionalChain([a, 'optionalAccess', _3 => _3.AUTH_TOKEN])&&(c.Authorization=`Bearer ${_optionalChain([a, 'optionalAccess', _4 => _4.AUTH_TOKEN])}`),_optionalChain([a, 'optionalAccess', _5 => _5.API_KEY])&&(c.Authorization=`Bearer ${_optionalChain([a, 'optionalAccess', _6 => _6.API_KEY])}`),e.provider({url:t,method:r,body:o,params:s,headers:c,overrides:a})}async function Qt(n,e,t){let{url:r,path:o}=n,i=o?`${r}/${o}`:r,s=await Zi({...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 ce(n,a,`Error: ${a.data}`);if(t==="Indexer"){let p=a.data;if(p.errors)throw new ce(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 ce(n,a,`${t} error: ${c}`)}async function kr(n){let{aptosConfig:e,overrides:t,params:r,contentType:o,acceptType:i,path:s,originMethod:a,type:c}=n,p=e.getRequestUrl(c);return Qt({url:p,method:"GET",originMethod:a,path:s,contentType:o,acceptType:i,params:r,overrides:{...e.clientConfig,...t}},e,n.type)}async function j(n){let{aptosConfig:e}=n;return kr({...n,type:"Fullnode",overrides:{...e.clientConfig,...e.fullnodeConfig,...n.overrides,HEADERS:{..._optionalChain([e, 'access', _7 => _7.clientConfig, 'optionalAccess', _8 => _8.HEADERS]),..._optionalChain([e, 'access', _9 => _9.fullnodeConfig, 'optionalAccess', _10 => _10.HEADERS])}}})}async function Qe(n){let e=[],t,r=n.params;do{let o=await kr({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 Dn(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 Qt({url:f,method:"POST",originMethod:t,path:r,body:o,contentType:s,acceptType:i,params:a,overrides:p},c,n.type)}async function ke(n){let{aptosConfig:e}=n;return Dn({...n,type:"Fullnode",overrides:{...e.clientConfig,...e.fullnodeConfig,...n.overrides,HEADERS:{..._optionalChain([e, 'access', _11 => _11.clientConfig, 'optionalAccess', _12 => _12.HEADERS]),..._optionalChain([e, 'access', _13 => _13.fullnodeConfig, 'optionalAccess', _14 => _14.HEADERS])}}})}async function Or(n){let{aptosConfig:e}=n;return Dn({...n,type:"Indexer",overrides:{...e.clientConfig,...e.indexerConfig,...n.overrides,HEADERS:{..._optionalChain([e, 'access', _15 => _15.clientConfig, 'optionalAccess', _16 => _16.HEADERS]),..._optionalChain([e, 'access', _17 => _17.indexerConfig, 'optionalAccess', _18 => _18.HEADERS])}}})}async function Dr(n){let{aptosConfig:e}=n,t={...e,clientConfig:{...e.clientConfig}};return _optionalChainDelete([t, 'optionalAccess', _19 => _19.clientConfig, 'optionalAccess', _20 => delete _20.API_KEY]),Dn({...n,type:"Faucet",overrides:{...t.clientConfig,...t.faucetConfig,...n.overrides,HEADERS:{..._optionalChain([t, 'access', _21 => _21.clientConfig, 'optionalAccess', _22 => _22.HEADERS]),..._optionalChain([t, 'access', _23 => _23.faucetConfig, 'optionalAccess', _24 => _24.HEADERS])}}})}var _utils = require('@noble/hashes/utils');var Wt=255,jt=65535,Ae=4294967295,Oe=18446744073709551615n,wt=340282366920938463463374607431768211455n,Xt=115792089237316195423570985008687907853269984665640564039457584007913129639935n;var M=class extends Error{constructor(e,t){super(e),this.invalidReason=t}};var ts=(r=>(r.TOO_SHORT="too_short",r.INVALID_LENGTH="invalid_length",r.INVALID_HEX_CHARS="invalid_hex_chars",r))(ts||{}),b= 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 fromString(e){let t=e;if(t.startsWith("0x")&&(t=t.slice(2)),t.length===0)throw new M("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 M("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 M(`Hex string contains invalid hex characters: ${_optionalChain([r, 'optionalAccess', _25 => _25.message])}`,"invalid_hex_chars")}}static fromHexInput(e){return e instanceof Uint8Array?new n(e):n.fromString(e)}static isValid(e){try{return n.fromString(e),{valid:!0}}catch(t){return{valid:!1,invalidReason:_optionalChain([t, 'optionalAccess', _26 => _26.invalidReason]),invalidReasonMessage:_optionalChain([t, 'optionalAccess', _27 => _27.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 b.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){Bn(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)&Oe,r=BigInt(e)>>BigInt(64);this.serializeU64(t),this.serializeU64(r)}serializeU256(e){let t=BigInt(e)&wt,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)})}};F([De(0,Wt)],X.prototype,"serializeU8",1),F([De(0,jt)],X.prototype,"serializeU16",1),F([De(0,Ae)],X.prototype,"serializeU32",1),F([De(BigInt(0),Oe)],X.prototype,"serializeU64",1),F([De(BigInt(0),wt)],X.prototype,"serializeU128",1),F([De(BigInt(0),Xt)],X.prototype,"serializeU256",1),F([De(0,Ae)],X.prototype,"serializeU32AsUleb128",1);function Bn(n){if(typeof n!="boolean")throw new Error(`${n} is not a boolean value`)}var ns=(n,e,t)=>`${n} is out of range: [${e}, ${t}]`;function Ce(n,e,t){let r=BigInt(n);if(r>BigInt(t)||r<BigInt(e))throw new Error(ns(n,e,t))}function De(n,e){return(t,r,o)=>{let i=o.value;return o.value=function(a){return Ce(a,n,e),i.apply(this,[a])},o}}var os=(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))(os||{}),_=class _ extends d{constructor(e){if(super(),e.length!==_.LENGTH)throw new M("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 M("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 M(`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 M(`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 M("Hex string is too short, must be 1 to 64 chars long, excluding the leading 0x.","too_short");if(t.length>64)throw new M("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 M(`Hex characters are invalid: ${_optionalChain([o, 'optionalAccess', _28 => _28.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', _29 => _29.invalidReason]),invalidReasonMessage:_optionalChain([t, 'optionalAccess', _30 => _30.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 Fr=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 Be=class n extends d{constructor(e){super(),this.value=b.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 Yt=class n extends d{constructor(e){super(),this.value=new Be(e)}serialize(e){e.serialize(this.value)}serializeForEntryFunction(e){e.serializeU32AsUleb128(this.value.value.length),e.serialize(this)}static deserialize(e,t){let r=Be.deserialize(e,t);return new n(r.value)}};var I=class n extends d{constructor(e){super(),Bn(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())}},k= exports.U8 =class n extends d{constructor(e){super(),Ce(e,0,Wt),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())}},ne= exports.U16 =class n extends d{constructor(e){super(),Ce(e,0,jt),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())}},re= exports.U32 =class n extends d{constructor(e){super(),Ce(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())}},z= exports.U64 =class n extends d{constructor(e){super(),Ce(e,BigInt(0),Oe),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())}},oe= exports.U128 =class n extends d{constructor(e){super(),Ce(e,BigInt(0),wt),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())}},ie= exports.U256 =class n extends d{constructor(e){super(),Ce(e,BigInt(0),Xt),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 h=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 k)&&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=b.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 k(r)))}static U16(e){return new n(e.map(t=>new ne(t)))}static U32(e){return new n(e.map(t=>new re(t)))}static U64(e){return new n(e.map(t=>new z(t)))}static U128(e){return new n(e.map(t=>new oe(t)))}static U256(e){return new n(e.map(t=>new ie(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);h.U8(t).serializeForScriptFunction(e)}static deserialize(e){return new n(e.deserializeStr())}},Pe= exports.MoveOption =class n extends d{constructor(e){super(),typeof e<"u"&&e!==null?this.vec=new h([e]):this.vec=new h([]),[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 k(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 z(e):void 0)}static U128(e){return new n(e!=null?new oe(e):void 0)}static U256(e){return new n(e!=null?new ie(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=h.deserialize(e,t);return new n(r.values[0])}};var _tweetnacl = require('tweetnacl'); var _tweetnacl2 = _interopRequireDefault(_tweetnacl);var _sha3 = require('@noble/hashes/sha3');var Ee=class Ee extends d{constructor(e){super();let{data:t}=e,r=b.fromHexInput(t);if(r.toUint8Array().length!==Ee.LENGTH)throw new Error(`Authentication Key length should be ${Ee.LENGTH}`);this.data=r}serialize(e){e.serializeFixedBytes(this.data.toUint8Array())}static deserialize(e){let t=e.deserializeFixedBytes(Ee.LENGTH);return new Ee({data:t})}toString(){return this.data.toString()}toUint8Array(){return this.data.toUint8Array()}static fromSchemeAndBytes(e){let{scheme:t,input:r}=e,o=b.fromHexInput(r).toUint8Array(),i=new Uint8Array([...o,t]),s=_sha3.sha3_256.create();s.update(i);let a=s.digest();return new Ee({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())}};Ee.LENGTH=32;var K=Ee;var _hmac = require('@noble/hashes/hmac');var _sha512 = require('@noble/hashes/sha512');var _bip39 = require('@scure/bip39'); var Mr = _interopRequireWildcard(_bip39);var cs=/^m\/44'\/637'\/[0-9]+'\/[0-9]+'\/[0-9]+'?$/,us= exports.APTOS_BIP44_REGEX =/^m\/44'\/637'\/[0-9]+'\/[0-9]+\/[0-9]+$/,ps= exports.KeyType =(e=>(e.ED25519="ed25519 seed",e))(ps||{}),Kr= exports.HARDENED_OFFSET =2147483648;function qr(n){return us.test(n)}function $r(n){return cs.test(n)}var Fn=(n,e)=>{let t=_hmac.hmac.create(_sha512.sha512,n).update(e).digest();return{key:t.slice(0,32),chainCode:t.slice(32)}},Lr= 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 Fn(e,s)},ds=n=>n.replace("'",""),Vr= exports.splitPath =n=>n.split("/").slice(1).map(ds),Zt= exports.mnemonicToSeed =n=>{let e=n.trim().split(/\s+/).map(t=>t.toLowerCase()).join(" ");return Mr.mnemonicToSeedSync(e)};var _t=class extends d{toString(){let e=this.toUint8Array();return b.fromHexInput(e).toString()}},ue= exports.AccountPublicKey =class extends _t{};var Y=class extends d{toString(){let e=this.toUint8Array();return b.fromHexInput(e).toString()}};var Fe=class Fe extends ue{constructor(e){super();let t=b.fromHexInput(e);if(t.toUint8Array().length!==Fe.LENGTH)throw new Error(`PublicKey length should be ${Fe.LENGTH}`);this.key=t}verifySignature(e){let{message:t,signature:r}=e;if(!(r instanceof R))return!1;let o=b.fromHexInput(t).toUint8Array(),i=r.toUint8Array(),s=this.key.toUint8Array();return _tweetnacl2.default.sign.detached.verify(o,i,s)}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 Fe(t)}static isPublicKey(e){return e instanceof Fe}};Fe.LENGTH=32;var U=Fe,D=class D extends d{constructor(e){super();let t=b.fromHexInput(e);if(t.toUint8Array().length!==D.LENGTH)throw new Error(`PrivateKey length should be ${D.LENGTH}`);this.signingKeyPair=_tweetnacl2.default.sign.keyPair.fromSeed(t.toUint8Array().slice(0,D.LENGTH))}static generate(){let e=_tweetnacl2.default.sign.keyPair();return new D(e.secretKey.slice(0,D.LENGTH))}static fromDerivationPath(e,t){if(!$r(e))throw new Error(`Invalid derivation path ${e}`);return D.fromDerivationPathInner(e,Zt(t))}static fromDerivationPathInner(e,t,r=Kr){let{key:o,chainCode:i}=Fn(D.SLIP_0010_SEED,t),s=Vr(e).map(c=>parseInt(c,10)),{key:a}=s.reduce((c,p)=>Lr(c,p+r),{key:o,chainCode:i});return new D(a)}publicKey(){let e=this.signingKeyPair.publicKey;return new U(e)}sign(e){let t=b.fromHexInput(e).toUint8Array(),r=_tweetnacl2.default.sign.detached(t,this.signingKeyPair.secretKey);return new R(r)}toUint8Array(){return this.signingKeyPair.secretKey.slice(0,D.LENGTH)}toString(){return b.fromHexInput(this.toUint8Array()).toString()}serialize(e){e.serializeBytes(this.toUint8Array())}static deserialize(e){let t=e.deserializeBytes();return new D(t)}static isPrivateKey(e){return e instanceof D}};D.LENGTH=32,D.SLIP_0010_SEED="ed25519 seed";var Z=D,We=class We extends Y{constructor(e){super();let t=b.fromHexInput(e);if(t.toUint8Array().length!==We.LENGTH)throw new Error(`Signature length should be ${We.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 We(t)}};We.LENGTH=64;var R=We;var J=class J extends ue{constructor(e){super();let{publicKeys:t,threshold:r}=e;if(t.length>J.MAX_KEYS||t.length<J.MIN_KEYS)throw new Error(`Must have between ${J.MIN_KEYS} and ${J.MAX_KEYS} public keys, inclusive`);if(r<J.MIN_THRESHOLD||r>t.length)throw new Error(`Threshold must be between ${J.MIN_THRESHOLD} and ${t.length}, inclusive`);this.publicKeys=t,this.threshold=r}verifySignature(e){let{message:t,signature:r}=e;if(!(r instanceof Me))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*U.LENGTH+1);return this.publicKeys.forEach((t,r)=>{e.set(t.toUint8Array(),r*U.LENGTH)}),e[this.publicKeys.length*U.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+=U.LENGTH){let s=i;o.push(new U(t.subarray(s,s+U.LENGTH)))}return new J({publicKeys:o,threshold:r})}};J.MAX_KEYS=32,J.MIN_KEYS=2,J.MIN_THRESHOLD=1;var je=J,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,!(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}}toUint8Array(){let e=new Uint8Array(this.signatures.length*R.LENGTH+L.BITMAP_LEN);return this.signatures.forEach((t,r)=>{e.set(t.toUint8Array(),r*R.LENGTH)}),e.set(this.bitmap,this.signatures.length*R.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+=R.LENGTH){let s=i;o.push(new R(t.subarray(s,s+R.LENGTH)))}return new L({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>=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.");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}};L.MAX_SIGNATURES_SUPPORTED=32,L.BITMAP_LEN=4;var Me=L;var _secp256k1 = require('@noble/curves/secp256k1');var _bip32 = require('@scure/bip32');var Ke=class Ke extends _t{constructor(e){super();let t=b.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=b.fromHexInput(t).toUint8Array(),i=_sha3.sha3_256.call(void 0, o),s=r.toUint8Array();return _secp256k1.secp256k1.verify(s,i,this.key.toUint8Array())}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,pe=class pe extends d{constructor(e){super();let t=b.fromHexInput(e);if(t.toUint8Array().length!==pe.LENGTH)throw new Error(`PrivateKey length should be ${pe.LENGTH}`);this.key=t}static generate(){let e=_secp256k1.secp256k1.utils.randomPrivateKey();return new pe(e)}static fromDerivationPath(e,t){if(!qr(e))throw new Error(`Invalid derivation path ${e}`);return pe.fromDerivationPathInner(e,Zt(t))}static fromDerivationPathInner(e,t){let{privateKey:r}=_bip32.HDKey.fromMasterSeed(t).derive(e);if(r===null)throw new Error("Invalid key");return new pe(r)}sign(e){let t=b.fromHexInput(e),r=_sha3.sha3_256.call(void 0, t.toUint8Array()),o=_secp256k1.secp256k1.sign(r,this.key.toUint8Array());return new he(o.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 pe(t)}static isPrivateKey(e){return e instanceof pe}};pe.LENGTH=32;var qe=pe,Xe=class Xe extends Y{constructor(e){super();let t=b.fromHexInput(e);if(t.toUint8Array().length!==Xe.LENGTH)throw new Error(`Signature length should be ${Xe.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 Xe(t)}};Xe.LENGTH=64;var he=Xe;var q=class n extends ue{constructor(e){if(super(),this.publicKey=e,e instanceof U)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 B?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=U.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 U}isSecp256k1PublicKey(){return this.publicKey instanceof fe}},B= exports.AnySignature =class n extends Y{constructor(e){if(super(),this.signature=e,e instanceof R)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=R.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 Qr(n){let e=n;return e-=e>>1&1431655765,e=(e&858993459)+(e>>2&858993459),(e+(e>>4)&252645135)*16843009>>24}var tn=class n extends ue{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 q?o:new q(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(q),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}},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.map(i=>i instanceof B?i:new B(i)),!(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}let o=this.bitmap.reduce((i,s)=>i+Qr(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>=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.");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.deserializeBytes(),r=t.reduce((i,s)=>i+Qr(s),0),o=[];for(let i=0;i<r;i+=1){let s=B.deserialize(e);o.push(s)}return new V({signatures:o,bitmap:t})}};V.BITMAP_LEN=4,V.MAX_SIGNATURES_SUPPORTED=V.BITMAP_LEN*8;var Wr=V;var H=class extends d{static deserialize(e){let t=e.deserializeUleb128AsU32();switch(t){case 0:return de.load(e);case 1:return nn.load(e);case 2:return se.load(e);case 3:return Ye.load(e);default:throw new Error(`Unknown variant index for AccountAuthenticator: ${t}`)}}isEd25519(){return this instanceof de}isMultiEd25519(){return this instanceof nn}isSingleKey(){return this instanceof se}isMultiKey(){return this instanceof Ye}},de= exports.AccountAuthenticatorEd25519 =class n extends H{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=U.deserialize(e),r=R.deserialize(e);return new n(t,r)}},nn= exports.AccountAuthenticatorMultiEd25519 =class n extends H{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=je.deserialize(e),r=Me.deserialize(e);return new n(t,r)}},se= exports.AccountAuthenticatorSingleKey =class n extends H{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=q.deserialize(e),r=B.deserialize(e);return new n(t,r)}},Ye= exports.AccountAuthenticatorMultiKey =class n extends H{constructor(e,t,r){super(),this.public_keys=e,this.signatures=t,this.signatures_bitmap=r}serialize(e){e.serializeU32AsUleb128(3),this.public_keys.serialize(e),e.serializeVector(this.signatures),e.serializeBytes(this.signatures_bitmap)}static load(e){let t=tn.deserialize(e),r=e.deserializeVector(B),o=e.deserializeBytes();return new n(t,r,o)}};var Ze=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=Z.generate();return new n({privateKey:e})}static fromDerivationPath(e){let{path:t,mnemonic:r}=e,o=Z.fromDerivationPath(t,r);return new n({privateKey:o})}verifySignature(e){return this.publicKey.verifySignature(e)}signWithAuthenticator(e){let t=this.privateKey.sign(e);return new de(this.publicKey,t)}sign(e){return this.signWithAuthenticator(e).signature}};var Je=class n{constructor(e){this.signingScheme=2;let{privateKey:t,address:r}=e;this.privateKey=t,this.publicKey=new q(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=Z.generate();break;case 2:r=qe.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=Z.fromDerivationPath(r,o);break;case 2:i=qe.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){let t=this.privateKey.sign(e),r=new B(t);return new se(this.publicKey,r)}sign(e){return this.signWithAuthenticator(e).signature}};var Ie=class{static generate(e={}){let{scheme:t=0,legacy:r=!0}=e;return t===0&&r?Ze.generate():Je.generate({scheme:t})}static fromPrivateKey(e){let{privateKey:t,address:r,legacy:o=!0}=e;return t instanceof Z&&o?new Ze({privateKey:t,address:r}):new Je({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?Ze.fromDerivationPath({mnemonic:r,path:o}):Je.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 ms=(n,e)=>{let t=n.bcsToBytes(),r=typeof e=="string"?Buffer.from(e,"utf8"):e,o=new Uint8Array([...t,...r,254]);return new u(_sha3.sha3_256.call(void 0, o))},ed= exports.createTokenAddress =(n,e,t)=>{let r=`${e}::${t}`;return ms(n,r)};var ys=`
|
|
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 es=Object.defineProperty;var ts=Object.getOwnPropertyDescriptor;var M=(n,e,t,r)=>{for(var o=r>1?void 0:r?ts(e,t):e,i=n.length-1,s;i>=0;i--)(s=n[i])&&(o=(r?s(e,t,o):s(o))||o);return r&&o&&es(e,t,o),o};var ce=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 _r="1.12.0";var Vt=(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))(Vt||{}),Sr= exports.TypeTagVariants =(g=>(g[g.Bool=0]="Bool",g[g.U8=1]="U8",g[g.U64=2]="U64",g[g.U128=3]="U128",g[g.Address=4]="Address",g[g.Signer=5]="Signer",g[g.Vector=6]="Vector",g[g.Struct=7]="Struct",g[g.U16=8]="U16",g[g.U32=9]="U32",g[g.U256=10]="U256",g[g.Reference=254]="Reference",g[g.Generic=255]="Generic",g))(Sr||{}),bt= 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))(bt||{}),xr= exports.TransactionPayloadVariants =(r=>(r[r.Script=0]="Script",r[r.EntryFunction=2]="EntryFunction",r[r.Multisig=3]="Multisig",r))(xr||{}),vr= exports.TransactionVariants =(t=>(t[t.MultiAgentTransaction=0]="MultiAgentTransaction",t[t.FeePayerTransaction=1]="FeePayerTransaction",t))(vr||{}),Cr= 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))(Cr||{}),Pr= exports.AccountAuthenticatorVariant =(o=>(o[o.Ed25519=0]="Ed25519",o[o.MultiEd25519=1]="MultiEd25519",o[o.SingleKey=2]="SingleKey",o[o.MultiKey=3]="MultiKey",o))(Pr||{}),Er= exports.AnyPublicKeyVariant =(t=>(t[t.Ed25519=0]="Ed25519",t[t.Secp256k1=1]="Secp256k1",t))(Er||{}),Ir= exports.AnySignatureVariant =(t=>(t[t.Ed25519=0]="Ed25519",t[t.Secp256k1=1]="Secp256k1",t))(Ir||{}),kn= 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))(kn||{});function Aa(n){return n.type==="pending_transaction"}function fa(n){return n.type==="user_transaction"}function ha(n){return n.type==="genesis_transaction"}function Ta(n){return n.type==="block_metadata_transaction"}function ba(n){return n.type==="state_checkpoint_transaction"}function wa(n){return n.type==="validator_transaction"}function _a(n){return"signature"in n&&n.signature==="ed25519_signature"}function Sa(n){return"signature"in n&&n.signature==="secp256k1_ecdsa_signature"}function xa(n){return n.type==="multi_agent_signature"}function va(n){return n.type==="fee_payer_signature"}function Ca(n){return n.type==="multi_ed25519_signature"}var ns=(r=>(r.PRIVATE="private",r.PUBLIC="public",r.FRIEND="friend",r))(ns||{}),Ur= exports.MoveAbility =(o=>(o.STORE="store",o.DROP="drop",o.KEY="key",o.COPY="copy",o))(Ur||{}),rs= exports.RoleType =(t=>(t.VALIDATOR="validator",t.FULL_NODE="full_node",t))(rs||{}),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||{}),Dn= exports.SigningSchemeInput =(t=>(t[t.Ed25519=0]="Ed25519",t[t.Secp256k1Ecdsa=2]="Secp256k1Ecdsa",t))(Dn||{}),Rr= 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))(Rr||{});var Nr={mainnet:"https://api.mainnet.aptoslabs.com/v1/graphql",testnet:"https://api.testnet.aptoslabs.com/v1/graphql",devnet:"https://api.devnet.aptoslabs.com/v1/graphql",randomnet:"https://indexer-randomnet.hasura.app/v1/graphql",local:"http://127.0.0.1:8090/v1/graphql"},zr= exports.NetworkToNodeAPI ={mainnet:"https://api.mainnet.aptoslabs.com/v1",testnet:"https://api.testnet.aptoslabs.com/v1",devnet:"https://api.devnet.aptoslabs.com/v1",randomnet:"https://fullnode.random.aptoslabs.com/v1",local:"http://127.0.0.1:8080/v1"},Gr= exports.NetworkToFaucetAPI ={mainnet:"https://faucet.mainnet.aptoslabs.com",testnet:"https://faucet.testnet.aptoslabs.com",devnet:"https://faucet.devnet.aptoslabs.com",randomnet:"https://faucet.random.aptoslabs.com",local:"http://127.0.0.1:8081"},On= exports.Network =(s=>(s.MAINNET="mainnet",s.TESTNET="testnet",s.DEVNET="devnet",s.RANDOMNET="randomnet",s.LOCAL="local",s.CUSTOM="custom",s))(On||{}),Bn= exports.NetworkToChainId ={mainnet:1,testnet:2,randomnet:70},Ia= exports.NetworkToNetworkName ={mainnet:"mainnet",testnet:"testnet",devnet:"devnet",randomnet:"randomnet",local:"local",custom:"custom"};var wt=(r=>(r.FULLNODE="Fullnode",r.INDEXER="Indexer",r.FAUCET="Faucet",r))(wt||{}),kr= exports.DEFAULT_MAX_GAS_AMOUNT =2e5,Dr= exports.DEFAULT_TXN_EXP_SEC_FROM_NOW =20,Ht= exports.DEFAULT_TXN_TIMEOUT_SEC =20,Qt= exports.APTOS_COIN ="0x1::aptos_coin::AptosCoin",Or= exports.RAW_TRANSACTION_SALT ="APTOS::RawTransaction",Fn= exports.RAW_TRANSACTION_WITH_DATA_SALT ="APTOS::RawTransactionWithData",He= 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))(He||{});var Br={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 os(n,e){let{url:t,method:r,body:o,contentType:i,params:s,overrides:a}=n,c={..._optionalChain([a, 'optionalAccess', _2 => _2.HEADERS]),"x-aptos-client":`aptos-typescript-sdk/${_r}`,"content-type":_nullishCoalesce(i, () => ("application/json"))};return _optionalChain([a, 'optionalAccess', _3 => _3.AUTH_TOKEN])&&(c.Authorization=`Bearer ${_optionalChain([a, 'optionalAccess', _4 => _4.AUTH_TOKEN])}`),_optionalChain([a, 'optionalAccess', _5 => _5.API_KEY])&&(c.Authorization=`Bearer ${_optionalChain([a, 'optionalAccess', _6 => _6.API_KEY])}`),e.provider({url:t,method:r,body:o,params:s,headers:c,overrides:a})}async function Wt(n,e,t){let{url:r,path:o}=n,i=o?`${r}/${o}`:r,s=await os({...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 ce(n,a,`Error: ${a.data}`);if(t==="Indexer"){let p=a.data;if(p.errors)throw new ce(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 Br?c=Br[a.status]:c=`Unhandled Error ${a.status} : ${a.statusText}`,new ce(n,a,`${t} error: ${c}`)}async function Fr(n){let{aptosConfig:e,overrides:t,params:r,contentType:o,acceptType:i,path:s,originMethod:a,type:c}=n,p=e.getRequestUrl(c);return Wt({url:p,method:"GET",originMethod:a,path:s,contentType:o,acceptType:i,params:r,overrides:{...e.clientConfig,...t}},e,n.type)}async function X(n){let{aptosConfig:e}=n;return Fr({...n,type:"Fullnode",overrides:{...e.clientConfig,...e.fullnodeConfig,...n.overrides,HEADERS:{..._optionalChain([e, 'access', _7 => _7.clientConfig, 'optionalAccess', _8 => _8.HEADERS]),..._optionalChain([e, 'access', _9 => _9.fullnodeConfig, 'optionalAccess', _10 => _10.HEADERS])}}})}async function Qe(n){let e=[],t,r=n.params;do{let o=await Fr({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 Mn(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 Wt({url:f,method:"POST",originMethod:t,path:r,body:o,contentType:s,acceptType:i,params:a,overrides:p},c,n.type)}async function ke(n){let{aptosConfig:e}=n;return Mn({...n,type:"Fullnode",overrides:{...e.clientConfig,...e.fullnodeConfig,...n.overrides,HEADERS:{..._optionalChain([e, 'access', _11 => _11.clientConfig, 'optionalAccess', _12 => _12.HEADERS]),..._optionalChain([e, 'access', _13 => _13.fullnodeConfig, 'optionalAccess', _14 => _14.HEADERS])}}})}async function Mr(n){let{aptosConfig:e}=n;return Mn({...n,type:"Indexer",overrides:{...e.clientConfig,...e.indexerConfig,...n.overrides,HEADERS:{..._optionalChain([e, 'access', _15 => _15.clientConfig, 'optionalAccess', _16 => _16.HEADERS]),..._optionalChain([e, 'access', _17 => _17.indexerConfig, 'optionalAccess', _18 => _18.HEADERS])}}})}async function Kr(n){let{aptosConfig:e}=n,t={...e,clientConfig:{...e.clientConfig}};return _optionalChainDelete([t, 'optionalAccess', _19 => _19.clientConfig, 'optionalAccess', _20 => delete _20.API_KEY]),Mn({...n,type:"Faucet",overrides:{...t.clientConfig,...t.faucetConfig,...n.overrides,HEADERS:{..._optionalChain([t, 'access', _21 => _21.clientConfig, 'optionalAccess', _22 => _22.HEADERS]),..._optionalChain([t, 'access', _23 => _23.faucetConfig, 'optionalAccess', _24 => _24.HEADERS])}}})}var _utils = require('@noble/hashes/utils');var jt=255,Xt=65535,Ae=4294967295,De=18446744073709551615n,_t=340282366920938463463374607431768211455n,Yt=115792089237316195423570985008687907853269984665640564039457584007913129639935n;var K=class extends Error{constructor(e,t){super(e),this.invalidReason=t}};var as=(r=>(r.TOO_SHORT="too_short",r.INVALID_LENGTH="invalid_length",r.INVALID_HEX_CHARS="invalid_hex_chars",r))(as||{}),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 K("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 K("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 K(`Hex string contains invalid hex characters: ${_optionalChain([r, 'optionalAccess', _25 => _25.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', _26 => _26.invalidReason]),invalidReasonMessage:_optionalChain([t, 'optionalAccess', _27 => _27.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 Y;return this.serialize(e),e.toUint8Array()}bcsToHex(){let e=this.bcsToBytes();return h.fromHexInput(e)}},Y= 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)&De,r=BigInt(e)>>BigInt(64);this.serializeU64(t),this.serializeU64(r)}serializeU256(e){let t=BigInt(e)&_t,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)})}};M([Oe(0,jt)],Y.prototype,"serializeU8",1),M([Oe(0,Xt)],Y.prototype,"serializeU16",1),M([Oe(0,Ae)],Y.prototype,"serializeU32",1),M([Oe(BigInt(0),De)],Y.prototype,"serializeU64",1),M([Oe(BigInt(0),_t)],Y.prototype,"serializeU128",1),M([Oe(BigInt(0),Yt)],Y.prototype,"serializeU256",1),M([Oe(0,Ae)],Y.prototype,"serializeU32AsUleb128",1);function Kn(n){if(typeof n!="boolean")throw new Error(`${n} is not a boolean value`)}var cs=(n,e,t)=>`${n} is out of range: [${e}, ${t}]`;function Ce(n,e,t){let r=BigInt(n);if(r>BigInt(t)||r<BigInt(e))throw new Error(cs(n,e,t))}function Oe(n,e){return(t,r,o)=>{let i=o.value;return o.value=function(a){return Ce(a,n,e),i.apply(this,[a])},o}}var ps=(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))(ps||{}),_=class _ extends d{constructor(e){if(super(),e.length!==_.LENGTH)throw new K("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 K("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 K(`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 K(`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 K("Hex string is too short, must be 1 to 64 chars long, excluding the leading 0x.","too_short");if(t.length>64)throw new K("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 K(`Hex characters are invalid: ${_optionalChain([o, 'optionalAccess', _28 => _28.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', _29 => _29.invalidReason]),invalidReasonMessage:_optionalChain([t, 'optionalAccess', _30 => _30.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 $r=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 Be=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 Zt=class n extends d{constructor(e){super(),this.value=new Be(e)}serialize(e){e.serialize(this.value)}serializeForEntryFunction(e){e.serializeU32AsUleb128(this.value.value.length),e.serialize(this)}static deserialize(e,t){let r=Be.deserialize(e,t);return new n(r.value)}};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())}},k= exports.U8 =class n extends d{constructor(e){super(),Ce(e,0,jt),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(),Ce(e,0,Xt),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(),Ce(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())}},G= exports.U64 =class n extends d{constructor(e){super(),Ce(e,BigInt(0),De),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(),Ce(e,BigInt(0),_t),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(),Ce(e,BigInt(0),Yt),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 k)&&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 k(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 G(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())}},Pe= 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 k(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 G(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 _tweetnacl = require('tweetnacl'); var _tweetnacl2 = _interopRequireDefault(_tweetnacl);var _sha3 = require('@noble/hashes/sha3');var Ee=class Ee extends d{constructor(e){super();let{data:t}=e,r=h.fromHexInput(t);if(r.toUint8Array().length!==Ee.LENGTH)throw new Error(`Authentication Key length should be ${Ee.LENGTH}`);this.data=r}serialize(e){e.serializeFixedBytes(this.data.toUint8Array())}static deserialize(e){let t=e.deserializeFixedBytes(Ee.LENGTH);return new Ee({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 Ee({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())}};Ee.LENGTH=32;var q=Ee;var _hmac = require('@noble/hashes/hmac');var _sha512 = require('@noble/hashes/sha512');var _bip39 = require('@scure/bip39'); var Lr = _interopRequireWildcard(_bip39);var ms=/^m\/44'\/637'\/[0-9]+'\/[0-9]+'\/[0-9]+'?$/,ys= exports.APTOS_BIP44_REGEX =/^m\/44'\/637'\/[0-9]+'\/[0-9]+\/[0-9]+$/,As= exports.KeyType =(e=>(e.ED25519="ed25519 seed",e))(As||{}),Vr= exports.HARDENED_OFFSET =2147483648;function Hr(n){return ys.test(n)}function Qr(n){return ms.test(n)}var qn=(n,e)=>{let t=_hmac.hmac.create(_sha512.sha512,n).update(e).digest();return{key:t.slice(0,32),chainCode:t.slice(32)}},Wr= 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 qn(e,s)},fs=n=>n.replace("'",""),jr= exports.splitPath =n=>n.split("/").slice(1).map(fs),Jt= exports.mnemonicToSeed =n=>{let e=n.trim().split(/\s+/).map(t=>t.toLowerCase()).join(" ");return Lr.mnemonicToSeedSync(e)};var St=class extends d{toString(){let e=this.toUint8Array();return h.fromHexInput(e).toString()}},ue= exports.AccountPublicKey =class extends St{};var Z=class extends d{toString(){let e=this.toUint8Array();return h.fromHexInput(e).toString()}};var We=n=>typeof n=="string"?h.isValid(n).valid?n:Buffer.from(n,"utf8"):n;var Fe=class Fe extends ue{constructor(e){super();let t=h.fromHexInput(e);if(t.toUint8Array().length!==Fe.LENGTH)throw new Error(`PublicKey length should be ${Fe.LENGTH}`);this.key=t}verifySignature(e){let{message:t,signature:r}=e;if(!(r instanceof R))return!1;let o=We(t),i=h.fromHexInput(o).toUint8Array(),s=r.toUint8Array(),a=this.key.toUint8Array();return _tweetnacl2.default.sign.detached.verify(i,s,a)}authKey(){return q.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 Fe(t)}static isPublicKey(e){return e instanceof Fe}};Fe.LENGTH=32;var U=Fe,O=class O extends d{constructor(e){super();let t=h.fromHexInput(e);if(t.toUint8Array().length!==O.LENGTH)throw new Error(`PrivateKey length should be ${O.LENGTH}`);this.signingKeyPair=_tweetnacl2.default.sign.keyPair.fromSeed(t.toUint8Array().slice(0,O.LENGTH))}static generate(){let e=_tweetnacl2.default.sign.keyPair();return new O(e.secretKey.slice(0,O.LENGTH))}static fromDerivationPath(e,t){if(!Qr(e))throw new Error(`Invalid derivation path ${e}`);return O.fromDerivationPathInner(e,Jt(t))}static fromDerivationPathInner(e,t,r=Vr){let{key:o,chainCode:i}=qn(O.SLIP_0010_SEED,t),s=jr(e).map(c=>parseInt(c,10)),{key:a}=s.reduce((c,p)=>Wr(c,p+r),{key:o,chainCode:i});return new O(a)}publicKey(){let e=this.signingKeyPair.publicKey;return new U(e)}sign(e){let t=We(e),r=h.fromHexInput(t).toUint8Array(),o=_tweetnacl2.default.sign.detached(r,this.signingKeyPair.secretKey);return new R(o)}toUint8Array(){return this.signingKeyPair.secretKey.slice(0,O.LENGTH)}toString(){return h.fromHexInput(this.toUint8Array()).toString()}serialize(e){e.serializeBytes(this.toUint8Array())}static deserialize(e){let t=e.deserializeBytes();return new O(t)}static isPrivateKey(e){return e instanceof O}};O.LENGTH=32,O.SLIP_0010_SEED="ed25519 seed";var J=O,je=class je extends Z{constructor(e){super();let t=h.fromHexInput(e);if(t.toUint8Array().length!==je.LENGTH)throw new Error(`Signature length should be ${je.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 R=je;var ee=class ee extends ue{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 Me))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 q.fromSchemeAndBytes({scheme:1,input:this.toUint8Array()})}toUint8Array(){let e=new Uint8Array(this.publicKeys.length*U.LENGTH+1);return this.publicKeys.forEach((t,r)=>{e.set(t.toUint8Array(),r*U.LENGTH)}),e[this.publicKeys.length*U.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+=U.LENGTH){let s=i;o.push(new U(t.subarray(s,s+U.LENGTH)))}return new ee({publicKeys:o,threshold:r})}};ee.MAX_KEYS=32,ee.MIN_KEYS=2,ee.MIN_THRESHOLD=1;var Xe=ee,V=class V extends Z{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*R.LENGTH+V.BITMAP_LEN);return this.signatures.forEach((t,r)=>{e.set(t.toUint8Array(),r*R.LENGTH)}),e.set(this.bitmap,this.signatures.length*R.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+=R.LENGTH){let s=i;o.push(new R(t.subarray(s,s+R.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 Me=V;var _secp256k1 = require('@noble/curves/secp256k1');var _bip32 = require('@scure/bip32');var Ke=class Ke extends St{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=We(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())}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,pe=class pe extends d{constructor(e){super();let t=h.fromHexInput(e);if(t.toUint8Array().length!==pe.LENGTH)throw new Error(`PrivateKey length should be ${pe.LENGTH}`);this.key=t}static generate(){let e=_secp256k1.secp256k1.utils.randomPrivateKey();return new pe(e)}static fromDerivationPath(e,t){if(!Hr(e))throw new Error(`Invalid derivation path ${e}`);return pe.fromDerivationPathInner(e,Jt(t))}static fromDerivationPathInner(e,t){let{privateKey:r}=_bip32.HDKey.fromMasterSeed(t).derive(e);if(r===null)throw new Error("Invalid key");return new pe(r)}sign(e){let t=We(e),r=h.fromHexInput(t),o=_sha3.sha3_256.call(void 0, r.toUint8Array()),i=_secp256k1.secp256k1.sign(o,this.key.toUint8Array());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 pe(t)}static isPrivateKey(e){return e instanceof pe}};pe.LENGTH=32;var qe=pe,Ye=class Ye extends Z{constructor(e){super();let t=h.fromHexInput(e);if(t.toUint8Array().length!==Ye.LENGTH)throw new Error(`Signature length should be ${Ye.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 Ye(t)}};Ye.LENGTH=64;var he=Ye;var $=class n extends ue{constructor(e){if(super(),this.publicKey=e,e instanceof U)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 B?this.publicKey.verifySignature({message:t,signature:r.signature}):!1}authKey(){return q.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=U.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 U}isSecp256k1PublicKey(){return this.publicKey instanceof fe}},B= exports.AnySignature =class n extends Z{constructor(e){if(super(),this.signature=e,e instanceof R)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=R.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 Yr(n){let e=n;return e-=e>>1&1431655765,e=(e&858993459)+(e>>2&858993459),(e+(e>>4)&252645135)*16843009>>24}var nn=class n extends ue{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 $?o:new $(o)),this.signaturesRequired=r}verifySignature(e){throw new Error("not implemented")}authKey(){return q.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($),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}},H=class H extends Z{constructor(e){super();let{signatures:t,bitmap:r}=e;if(t.length>H.MAX_SIGNATURES_SUPPORTED)throw new Error(`The number of signatures cannot be greater than ${H.MAX_SIGNATURES_SUPPORTED}`);if(this.signatures=t.map(i=>i instanceof B?i:new B(i)),!(r instanceof Uint8Array))this.bitmap=H.createBitmap({bits:r});else{if(r.length!==H.BITMAP_LEN)throw new Error(`"bitmap" length should be ${H.BITMAP_LEN}`);this.bitmap=r}let o=this.bitmap.reduce((i,s)=>i+Yr(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>=H.MAX_SIGNATURES_SUPPORTED)throw new Error(`Cannot have a signature larger than ${H.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.deserializeBytes(),r=t.reduce((i,s)=>i+Yr(s),0),o=[];for(let i=0;i<r;i+=1){let s=B.deserialize(e);o.push(s)}return new H({signatures:o,bitmap:t})}};H.BITMAP_LEN=4,H.MAX_SIGNATURES_SUPPORTED=H.BITMAP_LEN*8;var Zr=H;var Q=class extends d{static deserialize(e){let t=e.deserializeUleb128AsU32();switch(t){case 0:return de.load(e);case 1:return rn.load(e);case 2:return ae.load(e);case 3:return Ze.load(e);default:throw new Error(`Unknown variant index for AccountAuthenticator: ${t}`)}}isEd25519(){return this instanceof de}isMultiEd25519(){return this instanceof rn}isSingleKey(){return this instanceof ae}isMultiKey(){return this instanceof Ze}},de= exports.AccountAuthenticatorEd25519 =class n extends Q{constructor(e,t){super(),this.public_key=e,this.signature=t}serialize(e){e.serializeU32AsUleb128(0),this.public_key.serialize(e),this.signature.serialize(e)}static load(e){let t=U.deserialize(e),r=R.deserialize(e);return new n(t,r)}},rn= exports.AccountAuthenticatorMultiEd25519 =class n extends Q{constructor(e,t){super(),this.public_key=e,this.signature=t}serialize(e){e.serializeU32AsUleb128(1),this.public_key.serialize(e),this.signature.serialize(e)}static load(e){let t=Xe.deserialize(e),r=Me.deserialize(e);return new n(t,r)}},ae= exports.AccountAuthenticatorSingleKey =class n extends Q{constructor(e,t){super(),this.public_key=e,this.signature=t}serialize(e){e.serializeU32AsUleb128(2),this.public_key.serialize(e),this.signature.serialize(e)}static load(e){let t=$.deserialize(e),r=B.deserialize(e);return new n(t,r)}},Ze= exports.AccountAuthenticatorMultiKey =class n extends Q{constructor(e,t,r){super(),this.public_keys=e,this.signatures=t,this.signatures_bitmap=r}serialize(e){e.serializeU32AsUleb128(3),this.public_keys.serialize(e),e.serializeVector(this.signatures),e.serializeBytes(this.signatures_bitmap)}static load(e){let t=nn.deserialize(e),r=e.deserializeVector(B),o=e.deserializeBytes();return new n(t,r,o)}};var Je=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){let t=this.privateKey.sign(e);return new de(this.publicKey,t)}sign(e){return this.signWithAuthenticator(e).signature}};var et=class n{constructor(e){this.signingScheme=2;let{privateKey:t,address:r}=e;this.privateKey=t,this.publicKey=new $(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=qe.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=qe.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){let t=this.privateKey.sign(e),r=new B(t);return new ae(this.publicKey,r)}sign(e){return this.signWithAuthenticator(e).signature}};var Ie=class{static generate(e={}){let{scheme:t=0,legacy:r=!0}=e;return t===0&&r?Je.generate():et.generate({scheme:t})}static fromPrivateKey(e){let{privateKey:t,address:r,legacy:o=!0}=e;return t instanceof J&&o?new Je({privateKey:t,address:r}):new et({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?Je.fromDerivationPath({mnemonic:r,path:o}):et.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 Ts=(n,e)=>{let t=n.bcsToBytes(),r=typeof e=="string"?Buffer.from(e,"utf8"):e,o=new Uint8Array([...t,...r,254]);return new u(_sha3.sha3_256.call(void 0, o))},ud= exports.createResourceAddress =(n,e)=>{let t=n.bcsToBytes(),r=typeof e=="string"?Buffer.from(e,"utf8"):e,o=new Uint8Array([...t,...r,255]);return new u(_sha3.sha3_256.call(void 0, o))},pd= exports.createTokenAddress =(n,e,t)=>{let r=`${e}::${t}`;return Ts(n,r)};var bs=`
|
|
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
|
+
`,ws=`
|
|
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
|
+
`,on=`
|
|
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
|
+
`,eo=`
|
|
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
|
+
`,to=`
|
|
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
|
+
`,no=`
|
|
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
|
+
`,ro=`
|
|
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
|
+
`,oo=`
|
|
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
|
+
${on}`,Td=`
|
|
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
|
+
${on}`,io=`
|
|
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
|
+
${on}`,so=`
|
|
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
|
+
`,ao=`
|
|
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
|
+
`,co=`
|
|
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
|
+
`,$n=`
|
|
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
|
+
`,uo=`
|
|
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
|
+
`,po=`
|
|
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
|
+
`,lo=`
|
|
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
|
+
`,go=`
|
|
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
|
+
`,mo=`
|
|
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
|
+
`,tt=`
|
|
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
|
+
${ws}`,Ln=`
|
|
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
|
+
`,Vn=`
|
|
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
|
+
`,yo=`
|
|
367
367
|
query getTokenActivity($where_condition: token_activities_v2_bool_exp!, $offset: Int, $limit: Int, $order_by: [token_activities_v2_order_by!]) {
|
|
368
368
|
token_activities_v2(
|
|
369
369
|
where: $where_condition
|
|
@@ -374,7 +374,7 @@
|
|
|
374
374
|
...TokenActivitiesFields
|
|
375
375
|
}
|
|
376
376
|
}
|
|
377
|
-
${
|
|
377
|
+
${bs}`,Hn=`
|
|
378
378
|
query getCurrentTokenOwnership($where_condition: current_token_ownerships_v2_bool_exp!, $offset: Int, $limit: Int, $order_by: [current_token_ownerships_v2_order_by!]) {
|
|
379
379
|
current_token_ownerships_v2(
|
|
380
380
|
where: $where_condition
|
|
@@ -385,7 +385,7 @@
|
|
|
385
385
|
...CurrentTokenOwnershipFields
|
|
386
386
|
}
|
|
387
387
|
}
|
|
388
|
-
${
|
|
388
|
+
${on}`,Ao=`
|
|
389
389
|
query getTokenData($where_condition: current_token_datas_v2_bool_exp, $offset: Int, $limit: Int, $order_by: [current_token_datas_v2_order_by!]) {
|
|
390
390
|
current_token_datas_v2(
|
|
391
391
|
where: $where_condition
|
|
@@ -425,5 +425,5 @@
|
|
|
425
425
|
}
|
|
426
426
|
}
|
|
427
427
|
}
|
|
428
|
-
`;async function on(n){let{aptosConfig:e}=n,{data:t}=await j({aptosConfig:e,originMethod:"getLedgerInfo",path:""});return t}async function lo(n){let{aptosConfig:e,ledgerVersion:t,options:r}=n,{data:o}=await j({aptosConfig:e,originMethod:"getBlockByVersion",path:`blocks/by_version/${t}`,params:{with_transactions:_optionalChain([r, 'optionalAccess', _31 => _31.withTransactions])}});return o}async function go(n){let{aptosConfig:e,blockHeight:t,options:r}=n,{data:o}=await j({aptosConfig:e,originMethod:"getBlockByHeight",path:`blocks/by_height/${t}`,params:{with_transactions:_optionalChain([r, 'optionalAccess', _32 => _32.withTransactions])}});return o}async function sn(n){let{aptosConfig:e,handle:t,data:r,options:o}=n;return(await ke({aptosConfig:e,originMethod:"getTableItem",path:`tables/${t}/item`,params:{ledger_version:_optionalChain([o, 'optionalAccess', _33 => _33.ledgerVersion])},body:r})).data}async function mo(n){let{aptosConfig:e,limit:t}=n;return(await m({aptosConfig:e,query:{query:ro,variables:{limit:t}},originMethod:"getChainTopUserTransactions"})).user_transactions}async function m(n){let{aptosConfig:e,query:t,originMethod:r}=n,{data:o}=await Or({aptosConfig:e,originMethod:_nullishCoalesce(r, () => ("queryIndexer")),path:"",body:t,overrides:{WITH_CREDENTIALS:!1}});return o}async function fs(n){let{aptosConfig:e}=n;return(await m({aptosConfig:e,query:{query:qn},originMethod:"getProcessorStatuses"})).processor_status}async function an(n){let e=await fs({aptosConfig:n.aptosConfig});return BigInt(e[0].last_success_version)}async function cn(n){let{aptosConfig:e,processorType:t}=n;return(await m({aptosConfig:e,query:{query:qn,variables:{where_condition:{processor:{_eq:t}}}},originMethod:"getProcessorStatus"})).processor_status[0]}var Ln=new Map;function tt(n,e,t){return async(...r)=>{if(Ln.has(e)){let{value:i,timestamp:s}=Ln.get(e);if(t===void 0||Date.now()-s<=t)return i}let o=await n(...r);return Ln.set(e,{value:o,timestamp:Date.now()}),o}}async function le(n){let{aptosConfig:e,accountAddress:t}=n,{data:r}=await j({aptosConfig:e,originMethod:"getInfo",path:`accounts/${u.from(t).toString()}`});return r}async function fo(n){let{aptosConfig:e,accountAddress:t,options:r}=n;return Qe({aptosConfig:e,originMethod:"getModules",path:`accounts/${u.from(t).toString()}/modules`,params:{ledger_version:_optionalChain([r, 'optionalAccess', _34 => _34.ledgerVersion]),start:_optionalChain([r, 'optionalAccess', _35 => _35.offset]),limit:_nullishCoalesce(_optionalChain([r, 'optionalAccess', _36 => _36.limit]), () => (1e3))}})}async function un(n){return _optionalChain([n, 'access', _37 => _37.options, 'optionalAccess', _38 => _38.ledgerVersion])!==void 0?yo(n):tt(async()=>yo(n),`module-${n.accountAddress}-${n.moduleName}`,1e3*60*5)()}async function yo(n){let{aptosConfig:e,accountAddress:t,moduleName:r,options:o}=n,{data:i}=await j({aptosConfig:e,originMethod:"getModule",path:`accounts/${u.from(t).toString()}/module/${r}`,params:{ledger_version:_optionalChain([o, 'optionalAccess', _39 => _39.ledgerVersion])}});return i}async function ho(n){let{aptosConfig:e,accountAddress:t,options:r}=n;return Qe({aptosConfig:e,originMethod:"getTransactions",path:`accounts/${u.from(t).toString()}/transactions`,params:{start:_optionalChain([r, 'optionalAccess', _40 => _40.offset]),limit:_optionalChain([r, 'optionalAccess', _41 => _41.limit])}})}async function To(n){let{aptosConfig:e,accountAddress:t,options:r}=n;return Qe({aptosConfig:e,originMethod:"getResources",path:`accounts/${u.from(t).toString()}/resources`,params:{ledger_version:_optionalChain([r, 'optionalAccess', _42 => _42.ledgerVersion]),start:_optionalChain([r, 'optionalAccess', _43 => _43.offset]),limit:_nullishCoalesce(_optionalChain([r, 'optionalAccess', _44 => _44.limit]), () => (999))}})}async function Vn(n){let{aptosConfig:e,accountAddress:t,resourceType:r,options:o}=n,{data:i}=await j({aptosConfig:e,originMethod:"getResource",path:`accounts/${u.from(t).toString()}/resource/${r}`,params:{ledger_version:_optionalChain([o, 'optionalAccess', _45 => _45.ledgerVersion])}});return i.data}async function Hn(n){let{aptosConfig:e,authenticationKey:t,options:r}=n,o=await Vn({aptosConfig:e,accountAddress:"0x1",resourceType:"0x1::account::OriginatingAddress",options:r}),{address_map:{handle:i}}=o,s=u.from(t);try{let a=await sn({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 ce&&a.data.error_code==="table_item_not_found")return s;throw a}}async function bo(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:to,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 wo(n){let{aptosConfig:e,accountAddress:t,options:r}=n,i={owner_address:{_eq:u.from(t).toStringLong()},amount:{_gt:0}};_optionalChain([r, 'optionalAccess', _46 => _46.tokenStandard])&&(i.token_standard={_eq:_optionalChain([r, 'optionalAccess', _47 => _47.tokenStandard])});let s={query:Jr,variables:{where_condition:i,offset:_optionalChain([r, 'optionalAccess', _48 => _48.offset]),limit:_optionalChain([r, 'optionalAccess', _49 => _49.limit]),order_by:_optionalChain([r, 'optionalAccess', _50 => _50.orderBy])}};return(await m({aptosConfig:e,query:s,originMethod:"getAccountOwnedTokens"})).current_token_ownerships_v2}async function _o(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', _51 => _51.tokenStandard])&&(a.token_standard={_eq:_optionalChain([o, 'optionalAccess', _52 => _52.tokenStandard])});let c={query:eo,variables:{where_condition:a,offset:_optionalChain([o, 'optionalAccess', _53 => _53.offset]),limit:_optionalChain([o, 'optionalAccess', _54 => _54.limit]),order_by:_optionalChain([o, 'optionalAccess', _55 => _55.orderBy])}};return(await m({aptosConfig:e,query:c,originMethod:"getAccountOwnedTokensFromCollectionAddress"})).current_token_ownerships_v2}async function So(n){let{aptosConfig:e,accountAddress:t,options:r}=n,i={owner_address:{_eq:u.from(t).toStringLong()},amount:{_gt:0}};_optionalChain([r, 'optionalAccess', _56 => _56.tokenStandard])&&(i.current_collection={token_standard:{_eq:_optionalChain([r, 'optionalAccess', _57 => _57.tokenStandard])}});let s={query:Yr,variables:{where_condition:i,offset:_optionalChain([r, 'optionalAccess', _58 => _58.offset]),limit:_optionalChain([r, 'optionalAccess', _59 => _59.limit]),order_by:_optionalChain([r, 'optionalAccess', _60 => _60.orderBy])}};return(await m({aptosConfig:e,query:s,originMethod:"getAccountCollectionsWithOwnedTokens"})).current_collection_ownership_v2_view}async function xo(n){let{aptosConfig:e,accountAddress:t}=n,r=u.from(t).toStringLong(),i=await m({aptosConfig:e,query:{query:no,variables:{address:r}},originMethod:"getAccountTransactionsCount"});return i.account_transactions_aggregate.aggregate?i.account_transactions_aggregate.aggregate.count:0}async function vo(n){let{aptosConfig:e,accountAddress:t,coinType:r}=n,o=u.from(t).toStringLong(),i=await Qn({aptosConfig:e,accountAddress:o,options:{where:{asset_type:{_eq:r}}}});return i[0]?i[0].amount:0}async function Qn(n){let{aptosConfig:e,accountAddress:t,options:r}=n,o=u.from(t).toStringLong(),i={..._optionalChain([r, 'optionalAccess', _61 => _61.where]),owner_address:{_eq:o}},s={query:Xr,variables:{where_condition:i,offset:_optionalChain([r, 'optionalAccess', _62 => _62.offset]),limit:_optionalChain([r, 'optionalAccess', _63 => _63.limit]),order_by:_optionalChain([r, 'optionalAccess', _64 => _64.orderBy])}};return(await m({aptosConfig:e,query:s,originMethod:"getAccountCoinsData"})).current_fungible_asset_balances}async function Co(n){let{aptosConfig:e,accountAddress:t}=n,r=u.from(t).toStringLong(),i=await m({aptosConfig:e,query:{query:jr,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 Po(n){let{aptosConfig:e,accountAddress:t,options:r}=n,i={owner_address:{_eq:u.from(t).toStringLong()}},s={query:Zr,variables:{where_condition:i,offset:_optionalChain([r, 'optionalAccess', _65 => _65.offset]),limit:_optionalChain([r, 'optionalAccess', _66 => _66.limit]),order_by:_optionalChain([r, 'optionalAccess', _67 => _67.orderBy])}};return(await m({aptosConfig:e,query:s,originMethod:"getAccountOwnedObjects"})).current_objects}async function Eo(n){let{aptosConfig:e,privateKey:t}=n,r=new q(t.publicKey());if(t instanceof qe){let i=K.fromPublicKeyAndScheme({publicKey:r,scheme:2}).derivedAddress();return Ie.fromPrivateKeyAndAddress({privateKey:t,address:i})}if(t instanceof Z){let o=K.fromPublicKeyAndScheme({publicKey:r,scheme:2});if(await Ao({authKey:o,aptosConfig:e})){let c=o.derivedAddress();return Ie.fromPrivateKeyAndAddress({privateKey:t,address:c,legacy:!1})}let s=K.fromPublicKeyAndScheme({publicKey:r.publicKey,scheme:0});if(await Ao({authKey:s,aptosConfig:e})){let c=s.derivedAddress();return Ie.fromPrivateKeyAndAddress({privateKey:t,address:c,legacy:!0})}}throw new Error(`Can't derive account from private key ${t}`)}async function Ao(n){let{aptosConfig:e,authKey:t}=n,r=await Hn({aptosConfig:e,authenticationKey:t.derivedAddress()});try{return await le({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 Ue(n){return new Promise(e=>{setTimeout(e,n)})}async function Io(n){let{aptosConfig:e,options:t}=n;return Qe({aptosConfig:e,originMethod:"getTransactions",path:"transactions",params:{start:_optionalChain([t, 'optionalAccess', _68 => _68.offset]),limit:_optionalChain([t, 'optionalAccess', _69 => _69.limit])}})}async function dn(n){let{aptosConfig:e}=n;return tt(async()=>{let{data:t}=await j({aptosConfig:e,originMethod:"getGasPriceEstimation",path:"estimate_gas_price"});return t},`gas-price-${e.network}`,1e3*60*5)()}async function Uo(n){let{aptosConfig:e,ledgerVersion:t}=n,{data:r}=await j({aptosConfig:e,originMethod:"getTransactionByVersion",path:`transactions/by_version/${t}`});return r}async function ln(n){let{aptosConfig:e,transactionHash:t}=n,{data:r}=await j({aptosConfig:e,path:`transactions/by_hash/${t}`,originMethod:"getTransactionByHash"});return r}async function Ro(n){let{aptosConfig:e,transactionHash:t}=n;try{return(await ln({aptosConfig:e,transactionHash:t})).type==="pending_transaction"}catch(r){if(_optionalChain([r, 'optionalAccess', _70 => _70.status])===404)return!0;throw r}}async function nt(n){let{aptosConfig:e,transactionHash:t,options:r}=n,o=_nullishCoalesce(_optionalChain([r, 'optionalAccess', _71 => _71.timeoutSecs]), () => (20)),i=_nullishCoalesce(_optionalChain([r, 'optionalAccess', _72 => _72.checkSuccess]), () => (!0)),s=!0,a=0,c,p,f=200,C=1.5;for(;s&&!(a>=o);){try{if(c=await ln({aptosConfig:e,transactionHash:t}),s=c.type==="pending_transaction",!s)break}catch(y){if(!(y instanceof ce)||(p=y,y.status!==404&&y.status>=400&&y.status<500))throw y}await Ue(f),a+=f/1e3,f*=C}if(c===void 0)throw p||new pn(`Fetching transaction ${t} failed and timed out after ${o} seconds`,c);if(c.type==="pending_transaction")throw new pn(`Transaction ${t} timed out in pending state after ${o} seconds`,c);if(!i)return c;if(!c.success)throw new Wn(`Transaction ${t} failed with an error: ${c.vm_status}`,c);return c}async function gn(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 an({aptosConfig:e}):s=(await cn({aptosConfig:e,processorType:t})).last_success_version,s>=r)break;await Ue(200)}}var pn=class extends Error{constructor(e,t){super(e),this.lastSubmittedTransaction=t}},Wn=class extends Error{constructor(e,t){super(e),this.transaction=t}};async function T(n){n.minimumLedgerVersion!==void 0&&await gn({aptosConfig:n.config,minimumLedgerVersion:n.minimumLedgerVersion,processorType:n.processorType})}var St=class{constructor(e){this.config=e}async getAccountInfo(e){return le({aptosConfig:this.config,...e})}async getAccountModules(e){return fo({aptosConfig:this.config,...e})}async getAccountModule(e){return un({aptosConfig:this.config,...e})}async getAccountTransactions(e){return ho({aptosConfig:this.config,...e})}async getAccountResources(e){return To({aptosConfig:this.config,...e})}async getAccountResource(e){return Vn({aptosConfig:this.config,...e})}async lookupOriginalAccountAddress(e){return Hn({aptosConfig:this.config,...e})}async getAccountTokensCount(e){return await T({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"account_transactions_processor"}),bo({aptosConfig:this.config,...e})}async getAccountOwnedTokens(e){return await T({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),wo({aptosConfig:this.config,...e})}async getAccountOwnedTokensFromCollectionAddress(e){return await T({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),_o({aptosConfig:this.config,...e})}async getAccountCollectionsWithOwnedTokens(e){return await T({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),So({aptosConfig:this.config,...e})}async getAccountTransactionsCount(e){return await T({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"account_transactions_processor"}),xo({aptosConfig:this.config,...e})}async getAccountCoinsData(e){return await T({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"fungible_asset_processor"}),Qn({aptosConfig:this.config,...e})}async getAccountCoinsCount(e){return await T({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"fungible_asset_processor"}),Co({aptosConfig:this.config,...e})}async getAccountAPTAmount(e){return this.getAccountCoinAmount({coinType:Ht,...e})}async getAccountCoinAmount(e){return await T({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"fungible_asset_processor"}),vo({aptosConfig:this.config,...e})}async getAccountOwnedObjects(e){return await T({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"default_processor"}),Po({aptosConfig:this.config,...e})}async deriveAccountFromPrivateKey(e){return Eo({aptosConfig:this.config,...e})}};var _aptosclient = require('@aptos-labs/aptos-client'); var _aptosclient2 = _interopRequireDefault(_aptosclient);var mn=class{constructor(e){this.network=_nullishCoalesce(_optionalChain([e, 'optionalAccess', _73 => _73.network]), () => ("devnet")),this.fullnode=_optionalChain([e, 'optionalAccess', _74 => _74.fullnode]),this.faucet=_optionalChain([e, 'optionalAccess', _75 => _75.faucet]),this.indexer=_optionalChain([e, 'optionalAccess', _76 => _76.indexer]),this.client=_nullishCoalesce(_optionalChain([e, 'optionalAccess', _77 => _77.client]), () => ({provider:_aptosclient2.default})),this.clientConfig=_nullishCoalesce(_optionalChain([e, 'optionalAccess', _78 => _78.clientConfig]), () => ({})),this.fullnodeConfig=_nullishCoalesce(_optionalChain([e, 'optionalAccess', _79 => _79.fullnodeConfig]), () => ({})),this.indexerConfig=_nullishCoalesce(_optionalChain([e, 'optionalAccess', _80 => _80.indexerConfig]), () => ({})),this.faucetConfig=_nullishCoalesce(_optionalChain([e, 'optionalAccess', _81 => _81.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 Ir[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 Ur[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 Er[this.network];default:throw Error(`apiType ${e} is not supported`)}}};var yn=class extends d{constructor(t){super();this.accountAddress=u.ONE;this.moduleName=new w("account");this.structName=new w("RotationProofChallenge");this.sequenceNumber=new z(t.sequenceNumber),this.originator=t.originator,this.currentAuthKey=t.currentAuthKey,this.newPublicKey=h.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 Te=class extends d{static deserialize(e){let t=e.deserializeUleb128AsU32();switch(t){case 0:return rt.load(e);case 1:return jn.load(e);case 2:return ot.load(e);case 3:return it.load(e);case 4:return st.load(e);default:throw new Error(`Unknown variant index for TransactionAuthenticator: ${t}`)}}},rt= exports.TransactionAuthenticatorEd25519 =class n extends Te{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=U.deserialize(e),r=R.deserialize(e);return new n(t,r)}},jn= exports.TransactionAuthenticatorMultiEd25519 =class n extends Te{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=je.deserialize(e),r=Me.deserialize(e);return new n(t,r)}},ot= exports.TransactionAuthenticatorMultiAgent =class n extends Te{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=H.deserialize(e),r=e.deserializeVector(u),o=e.deserializeVector(H);return new n(t,r,o)}},it= exports.TransactionAuthenticatorFeePayer =class n extends Te{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=H.deserialize(e),r=e.deserializeVector(u),o=e.deserializeVector(H),i=u.deserialize(e),s=H.deserialize(e),a={address:i,authenticator:s};return new n(t,r,o,a)}},st= exports.TransactionAuthenticatorSingleSender =class n extends Te{constructor(e){super(),this.sender=e}serialize(e){e.serializeU32AsUleb128(4),this.sender.serialize(e)}static load(e){let t=H.deserialize(e);return new n(t)}};var at=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 E=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 xt=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 E(t[1]))}serialize(e){this.address.serialize(e),this.name.serialize(e)}static deserialize(e){let t=u.deserialize(e),r=E.deserialize(e);return new n(t,r)}};var N=class extends d{static deserialize(e){let t=e.deserializeUleb128AsU32();switch(t){case 0:return O.load(e);case 1:return ge.load(e);case 2:return $.load(e);case 3:return pt.load(e);case 4:return Q.load(e);case 5:return $e.load(e);case 6:return x.load(e);case 7:return l.load(e);case 8:return ct.load(e);case 9:return ut.load(e);case 10:return dt.load(e);case 255:return G.load(e);default:throw new Error(`Unknown variant index for TypeTag: ${t}`)}}isBool(){return this instanceof O}isAddress(){return this instanceof Q}isGeneric(){return this instanceof G}isSigner(){return this instanceof $e}isVector(){return this instanceof x}isStruct(){return this instanceof l}isU8(){return this instanceof ge}isU16(){return this instanceof ct}isU32(){return this instanceof ut}isU64(){return this instanceof $}isU128(){return this instanceof pt}isU256(){return this instanceof dt}},O= exports.TypeTagBool =class n extends N{toString(){return"bool"}serialize(e){e.serializeU32AsUleb128(0)}static load(e){return new n}},ge= exports.TypeTagU8 =class n extends N{toString(){return"u8"}serialize(e){e.serializeU32AsUleb128(1)}static load(e){return new n}},ct= exports.TypeTagU16 =class n extends N{toString(){return"u16"}serialize(e){e.serializeU32AsUleb128(8)}static load(e){return new n}},ut= exports.TypeTagU32 =class n extends N{toString(){return"u32"}serialize(e){e.serializeU32AsUleb128(9)}static load(e){return new n}},$= exports.TypeTagU64 =class n extends N{toString(){return"u64"}serialize(e){e.serializeU32AsUleb128(2)}static load(e){return new n}},pt= exports.TypeTagU128 =class n extends N{toString(){return"u128"}serialize(e){e.serializeU32AsUleb128(3)}static load(e){return new n}},dt= exports.TypeTagU256 =class n extends N{toString(){return"u256"}serialize(e){e.serializeU32AsUleb128(10)}static load(e){return new n}},Q= exports.TypeTagAddress =class n extends N{toString(){return"address"}serialize(e){e.serializeU32AsUleb128(4)}static load(e){return new n}},$e= exports.TypeTagSigner =class n extends N{toString(){return"signer"}serialize(e){e.serializeU32AsUleb128(5)}static load(e){return new n}},An= exports.TypeTagReference =class n extends N{constructor(t){super();this.value=t}toString(){return`&${this.value.toString()}`}serialize(t){t.serializeU32AsUleb128(254)}static load(t){let r=N.deserialize(t);return new n(r)}},G= exports.TypeTagGeneric =class n extends N{constructor(t){super();this.value=t;if(t<0)throw new Error("Generic type parameter index cannot be negative")}toString(){return`T${this.value}`}serialize(t){t.serializeU32AsUleb128(255),t.serializeU32(this.value)}static load(t){let r=t.deserializeU32();return new n(r)}},x= exports.TypeTagVector =class n extends N{constructor(t){super();this.value=t}toString(){return`vector<${this.value.toString()}>`}static u8(){return new n(new ge)}serialize(t){t.serializeU32AsUleb128(6),this.value.serialize(t)}static load(t){let r=N.deserialize(t);return new n(r)}},l= exports.TypeTagStruct =class n extends N{constructor(t){super();this.value=t}toString(){let t="";return this.value.typeArgs.length>0&&(t=`<${this.value.typeArgs.map(r=>r.toString()).join(", ")}>`),`${this.value.address.toString()}::${this.value.moduleName.identifier}::${this.value.name.identifier}${t}`}serialize(t){t.serializeU32AsUleb128(7),this.value.serialize(t)}static load(t){let r=be.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")}},be= 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=E.deserialize(e),o=E.deserialize(e),i=e.deserializeVector(N);return new n(t,r,o,i)}};function Wl(){return new be(u.ONE,new E("aptos_coin"),new E("AptosCoin"),[])}function S(){return new be(u.ONE,new E("string"),new E("String"),[])}function jl(n){return new be(u.ONE,new E("option"),new E("Option"),[n])}function W(n){return new be(u.ONE,new E("object"),new E("Object"),[n])}function Ts(n){let e=n.deserializeUleb128AsU32();switch(e){case 0:return k.deserialize(n);case 1:return z.deserialize(n);case 2:return oe.deserialize(n);case 3:return u.deserialize(n);case 4:return h.deserialize(n,k);case 5:return I.deserialize(n);case 6:return ne.deserialize(n);case 7:return re.deserialize(n);case 8:return ie.deserialize(n);default:throw new Error(`Unknown variant index for ScriptTransactionArgument: ${e}`)}}var Le=class extends d{static deserialize(e){let t=e.deserializeUleb128AsU32();switch(t){case 0:return vt.load(e);case 2:return Ct.load(e);case 3:return Pt.load(e);default:throw new Error(`Unknown variant index for TransactionPayload: ${t}`)}}},vt= exports.TransactionPayloadScript =class n extends Le{constructor(e){super(),this.script=e}serialize(e){e.serializeU32AsUleb128(0),this.script.serialize(e)}static load(e){let t=Et.deserialize(e);return new n(t)}},Ct= exports.TransactionPayloadEntryFunction =class n extends Le{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)}},Pt= exports.TransactionPayloadMultiSig =class n extends Le{constructor(e){super(),this.multiSig=e}serialize(e){e.serializeU32AsUleb128(3),this.multiSig.serialize(e)}static load(e){let t=It.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(xt.fromStr(e),new E(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=xt.deserialize(e),r=E.deserialize(e),o=e.deserializeVector(N),i=e.deserializeUleb128AsU32(),s=new Array;for(let a=0;a<i;a+=1){let c=e.deserializeUleb128AsU32(),p=Yt.deserialize(e,c);s.push(p)}return new n(t,r,o,s)}},Et= exports.Script =class n{constructor(e,t,r){this.bytecode=e,this.type_args=t,this.args=r}serialize(e){e.serializeBytes(this.bytecode),e.serializeVector(this.type_args),e.serializeU32AsUleb128(this.args.length),this.args.forEach(t=>{t.serializeForScriptFunction(e)})}static deserialize(e){let t=e.deserializeBytes(),r=e.deserializeVector(N),o=e.deserializeUleb128AsU32(),i=new Array;for(let s=0;s<o;s+=1){let a=Ts(e);i.push(a)}return new n(t,r,i)}},It= 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=Ut.deserialize(e)),new n(t,o)}},Ut= 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 ae=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=Le.deserialize(e),i=e.deserializeU64(),s=e.deserializeU64(),a=e.deserializeU64(),c=at.deserialize(e);return new n(t,r,o,i,s,a,c)}},fn= exports.RawTransactionWithData =class extends d{static deserialize(e){let t=e.deserializeUleb128AsU32();switch(t){case 0:return we.load(e);case 1:return _e.load(e);default:throw new Error(`Unknown variant index for RawTransactionWithData: ${t}`)}}},we= exports.MultiAgentRawTransaction =class n extends fn{constructor(e,t){super(),this.raw_txn=e,this.secondary_signer_addresses=t}serialize(e){e.serializeU32AsUleb128(0),this.raw_txn.serialize(e),e.serializeVector(this.secondary_signer_addresses)}static load(e){let t=ae.deserialize(e),r=e.deserializeVector(u);return new n(t,r)}},_e= exports.FeePayerRawTransaction =class n extends fn{constructor(e,t,r){super(),this.raw_txn=e,this.secondary_signer_addresses=t,this.fee_payer_address=r}serialize(e){e.serializeU32AsUleb128(1),this.raw_txn.serialize(e),e.serializeVector(this.secondary_signer_addresses),this.fee_payer_address.serialize(e)}static load(e){let t=ae.deserialize(e),r=e.deserializeVector(u),o=u.deserialize(e);return new n(t,r,o)}};var me=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=ae.deserialize(e),r=Te.deserialize(e);return new n(t,r)}};function No(n){return!!n.match(/^[_a-zA-Z0-9]+$/)}function Go(n){return!!n.match(/\s/)}function bs(n){return!!n.match(/^T[0-9]+$/)}function ws(n,e){let t=e;for(;t<n.length;t+=1){let r=n[t];if(!Go(r))break}return t}var _s=(y=>(y.InvalidTypeTag="unknown type",y.UnexpectedGenericType="unexpected generic type",y.UnexpectedTypeArgumentClose="unexpected '>'",y.UnexpectedWhitespaceCharacter="unexpected whitespace character",y.UnexpectedComma="unexpected ','",y.TypeArgumentCountMismatch="type argument count doesn't match expected amount",y.MissingTypeArgumentClose="no matching '>' for '<'",y.UnexpectedPrimitiveTypeArguments="primitive types not expected to have type arguments",y.UnexpectedVectorTypeArgumentCount="vector type expected to have exactly one type argument",y.UnexpectedStructFormat="unexpected struct format, must be of the form 0xaddress::module_name::struct_name",y.InvalidModuleNameCharacter="module name must only contain alphanumeric or '_' characters",y.InvalidStructNameCharacter="struct name must only contain alphanumeric or '_' characters",y))(_s||{}),v= exports.TypeTagParserError =class extends Error{constructor(e,t){super(`Failed to parse typeTag '${e}', ${t}`)}};function Se(n,e){let t=_nullishCoalesce(_optionalChain([e, 'optionalAccess', _82 => _82.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 ze=hn(a,o,t);i.push(ze)}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:C,savedTypes:y,savedExpectedTypes:g}=f;o=i,i=y,a=C,c=g}else if(p===","){if(a.length!==0){let f=hn(a,o,t);o=[],i.push(f),a="",c+=1}}else if(Go(p)){let f=!1;if(a.length!==0){let y=hn(a,o,t);o=[],i.push(y),a="",f=!0}s=ws(n,s);let C=n[s];if(s<n.length&&f&&C!==","&&C!==">")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 hn(a,o,t);case 1:if(a==="")return i[0];throw new v(n,"unexpected ','");default:throw new v(n,"unexpected whitespace character")}}function hn(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 An(new $e);case"signer":if(e.length>0)throw new v(n,"primitive types not expected to have type arguments");return new $e;case"bool":if(e.length>0)throw new v(n,"primitive types not expected to have type arguments");return new O;case"address":if(e.length>0)throw new v(n,"primitive types not expected to have type arguments");return new Q;case"u8":if(e.length>0)throw new v(n,"primitive types not expected to have type arguments");return new ge;case"u16":if(e.length>0)throw new v(n,"primitive types not expected to have type arguments");return new ct;case"u32":if(e.length>0)throw new v(n,"primitive types not expected to have type arguments");return new ut;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 pt;case"u256":if(e.length>0)throw new v(n,"primitive types not expected to have type arguments");return new dt;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(bs(n)){if(t)return new G(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(!No(r[1]))throw new v(n,"module name must only contain alphanumeric or '_' characters");if(!No(r[2]))throw new v(n,"struct name must only contain alphanumeric or '_' characters");return new l(new be(u.fromString(r[0]),new E(r[1]),new E(r[2]),e))}}function zo(n){return typeof n=="boolean"}function lt(n){return typeof n=="string"}function Tn(n){return typeof n=="number"}function bn(n){return typeof n=="number"||typeof n=="bigint"||typeof n=="string"}function ko(n){return n==null}function Oo(n){return Xn(n)||Zn(n)||Jn(n)||er(n)||tr(n)||nr(n)||rr(n)||wn(n)||Yn(n)||Ss(n)||n instanceof h||n instanceof Pe}function Xn(n){return n instanceof I}function wn(n){return n instanceof u}function Yn(n){return n instanceof w}function Ss(n){return n instanceof Be}function Zn(n){return n instanceof k}function Jn(n){return n instanceof ne}function er(n){return n instanceof re}function tr(n){return n instanceof z}function nr(n){return n instanceof oe}function rr(n){return n instanceof ie}function Do(n){return"bytecode"in n}function P(n,e){throw new Error(`Type mismatch for argument ${e}, expected '${n}'`)}function Bo(n){let e=n.params.findIndex(t=>t!=="signer"&&t!=="&signer");return e<0?n.params.length:e}function Rt(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 xs=new TextEncoder;function ir(n){return _nullishCoalesce(_optionalChain([n, 'optionalAccess', _83 => _83.map, 'call', _84 => _84(e=>lt(e)?Se(e):e)]), () => ([]))}async function Fo(n,e,t,r){let o=await un({aptosConfig:r,accountAddress:n,moduleName:e});if(o.abi)return o.abi.exposed_functions.find(i=>i.name===t)}async function Mo(n,e,t,r){let o=await Fo(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=Bo(o),s=[];for(let a=i;a<o.params.length;a+=1)s.push(Se(o.params[a],{allowGenerics:!0}));return{signers:i,typeParameters:o.generic_type_params,parameters:s}}async function Ko(n,e,t,r){let o=await Fo(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(Se(o.params[a],{allowGenerics:!0}));let s=[];for(let a=0;a<o.return.length;a+=1)s.push(Se(o.return[a],{allowGenerics:!0}));return{typeParameters:o.generic_type_params,parameters:i,returnTypes:s}}function sr(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 gt(t,i,r,o)}function gt(n,e,t,r){return Oo(n)?(or(e,n,t),n):vs(n,e,t,r)}function vs(n,e,t,r){if(e.isBool()){if(zo(n))return new I(n);P("boolean",t)}if(e.isAddress()){if(lt(n))return u.fromString(n);P("string | AccountAddress",t)}if(e.isU8()){if(Tn(n))return new k(n);P("number",t)}if(e.isU16()){if(Tn(n))return new ne(n);P("number",t)}if(e.isU32()){if(Tn(n))return new re(n);P("number",t)}if(e.isU64()){if(bn(n))return new z(BigInt(n));P("bigint | number | string",t)}if(e.isU128()){if(bn(n))return new oe(BigInt(n));P("bigint | number | string",t)}if(e.isU256()){if(bn(n))return new ie(BigInt(n));P("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 gt(n,r[o],t,r)}if(e.isVector()){if(e.value.isU8()){if(lt(n))return h.U8(xs.encode(n));if(n instanceof Uint8Array)return h.U8(n);if(n instanceof ArrayBuffer)return h.U8(new Uint8Array(n))}if(Array.isArray(n))return new h(n.map(o=>gt(o,e.value,t,r)));throw new Error(`Type mismatch for argument ${t}, type '${e.toString()}'`)}if(e.isStruct()){if(e.isString()){if(lt(n))return new w(n);P("string",t)}if(e.isObject()){if(lt(n))return u.fromString(n);P("string | AccountAddress",t)}if(e.isOption())return ko(n)?new Pe(null):new Pe(gt(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 or(n,e,t){if(n.isBool()){if(Xn(e))return;P("Bool",t)}if(n.isAddress()){if(wn(e))return;P("AccountAddress",t)}if(n.isU8()){if(Zn(e))return;P("U8",t)}if(n.isU16()){if(Jn(e))return;P("U16",t)}if(n.isU32()){if(er(e))return;P("U32",t)}if(n.isU64()){if(tr(e))return;P("U64",t)}if(n.isU128()){if(nr(e))return;P("U128",t)}if(n.isU256()){if(rr(e))return;P("U256",t)}if(n.isVector()){if(e instanceof h){e.values.length>0&&or(n.value,e.values[0],t);return}P("MoveVector",t)}if(n instanceof l){if(n.isString()){if(Yn(e))return;P("MoveString",t)}if(n.isObject()){if(wn(e))return;P("AccountAddress",t)}if(n.isOption()){if(e instanceof Pe){e.value!==void 0&&or(n.value.typeArgs[0],e.value,t);return}P("MoveOption",t)}}throw new Error(`Type mismatch for argument ${t}, expected '${n.toString()}'`)}async function Sn(n){if(Do(n))return Is(n);let{moduleAddress:e,moduleName:t,functionName:r}=Rt(n.function),o=await Qo({key:"entry-function",moduleAddress:e,moduleName:t,functionName:r,aptosConfig:n.aptosConfig,abi:n.abi,fetch:Mo});return Ps({abi:o,...n})}function Ps(n){let e=n.abi,{moduleAddress:t,moduleName:r,functionName:o}=Rt(n.function),i=ir(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)=>sr(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 Pt(new It(c,new Ut(a)))}return new Ct(a)}async function qo(n){let{moduleAddress:e,moduleName:t,functionName:r}=Rt(n.function),o=await Qo({key:"view-function",moduleAddress:e,moduleName:t,functionName:r,aptosConfig:n.aptosConfig,abi:n.abi,fetch:Ko});return Es({abi:o,...n})}function Es(n){let e=n.abi,{moduleAddress:t,moduleName:r,functionName:o}=Rt(n.function),i=ir(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', _85 => _85.functionArguments, 'optionalAccess', _86 => _86.map, 'call', _87 => _87((a,c)=>sr(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 Is(n){return new vt(new Et(b.fromHexInput(n.bytecode).toUint8Array(),_nullishCoalesce(n.typeArguments, () => ([])),n.functionArguments))}async function Us(n){let{aptosConfig:e,sender:t,payload:r,options:o,feePayerAddress:i}=n,s=kn[e.network]?Promise.resolve({chain_id:kn[e.network]}):on({aptosConfig:e}),a=_optionalChain([o, 'optionalAccess', _88 => _88.gasUnitPrice])?Promise.resolve({gas_estimate:o.gasUnitPrice}):dn({aptosConfig:e}),[{chain_id:c},{gas_estimate:p}]=await Promise.all([s,a]),f=_optionalChain([o, 'optionalAccess', _89 => _89.accountSequenceNumber])!==void 0?Promise.resolve({sequence_number:o.accountSequenceNumber}):le({aptosConfig:e,accountAddress:t}),C;if(i&&u.from(i).equals(u.ZERO))try{let{sequence_number:ht}=await f;C=ht}catch (e2){C="0"}else{let{sequence_number:ht}=await f;C=ht}let{maxGasAmount:y,gasUnitPrice:g,expireTimestamp:ze}={maxGasAmount:_optionalChain([o, 'optionalAccess', _90 => _90.maxGasAmount])?BigInt(o.maxGasAmount):BigInt(2e5),gasUnitPrice:BigInt(p),expireTimestamp:BigInt(Math.floor(Date.now()/1e3)+20),...o};return new ae(u.from(t),BigInt(C),r,BigInt(y),BigInt(g),BigInt(ze),new at(c))}async function ar(n){let{aptosConfig:e,sender:t,payload:r,options:o,feePayerAddress:i}=n,s=await Us({aptosConfig:e,sender:t,payload:r,options:o,feePayerAddress:i});if("secondarySignerAddresses"in n){let a=_nullishCoalesce(_optionalChain([n, 'access', _91 => _91.secondarySignerAddresses, 'optionalAccess', _92 => _92.map, 'call', _93 => _93(c=>u.from(c))]), () => ([]));return{rawTransaction:s,secondarySignerAddresses:a,feePayerAddress:n.feePayerAddress?u.from(n.feePayerAddress):void 0}}return{rawTransaction:s,feePayerAddress:n.feePayerAddress?u.from(n.feePayerAddress):void 0}}function $o(n){let{signerPublicKey:e,transaction:t,secondarySignersPublicKeys:r,feePayerPublicKey:o}=n,i=_n(e);if(t.feePayerAddress){let a=new _e(t.rawTransaction,_nullishCoalesce(t.secondarySignerAddresses, () => ([])),t.feePayerAddress),c=[];r&&(c=r.map(C=>_n(C)));let p=_n(o),f=new it(i,_nullishCoalesce(t.secondarySignerAddresses, () => ([])),c,{address:t.feePayerAddress,authenticator:p});return new me(a.raw_txn,f).bcsToBytes()}if(t.secondarySignerAddresses){let a=new we(t.rawTransaction,t.secondarySignerAddresses),c=[];c=r.map(f=>_n(f));let p=new ot(i,t.secondarySignerAddresses,c);return new me(a.raw_txn,p).bcsToBytes()}let s;if(i instanceof de)s=new rt(i.public_key,i.signature);else if(i instanceof se)s=new st(i);else throw new Error("Invalid public key");return new me(t.rawTransaction,s).bcsToBytes()}function _n(n){if(n instanceof q){if(n.publicKey instanceof U)return new se(n,new B(new R(new Uint8Array(64))));if(n.publicKey instanceof fe)return new se(n,new B(new he(new Uint8Array(64))))}return new de(new U(n.toUint8Array()),new R(new Uint8Array(64)))}function Lo(n){let{signer:e,transaction:t}=n,r=cr(t);return e.signWithAuthenticator(r)}function Vo(n){let{transaction:e,senderAuthenticator:t,feePayerAuthenticator:r,additionalSignersAuthenticators:o}=n,i=Ho(e);if((r||o)&&(i instanceof we||i instanceof _e))return Rs(i,t,r,o);if(t instanceof de&&i instanceof ae){let s=new rt(t.public_key,t.signature);return new me(i,s).bcsToBytes()}if((t instanceof se||t instanceof Ye)&&i instanceof ae){let s=new st(t);return new me(i,s).bcsToBytes()}throw new Error(`Cannot generate a signed transaction, ${t} is not a supported account authentication scheme`)}function Ho(n){return n.feePayerAddress?new _e(n.rawTransaction,_nullishCoalesce(n.secondarySignerAddresses, () => ([])),n.feePayerAddress):n.secondarySignerAddresses?new we(n.rawTransaction,n.secondarySignerAddresses):n.rawTransaction}function Rs(n,e,t,r){if(n instanceof _e){if(!t)throw new Error("Must provide a feePayerAuthenticator argument to generate a signed fee payer transaction");let o=new it(e,n.secondary_signer_addresses,_nullishCoalesce(r, () => ([])),{address:n.fee_payer_address,authenticator:t});return new me(n.raw_txn,o).bcsToBytes()}if(n instanceof we){if(!r)throw new Error("Must provide a additionalSignersAuthenticators argument to generate a signed multi agent transaction");let o=new ot(e,n.secondary_signer_addresses,_nullishCoalesce(r, () => ([])));return new me(n.raw_txn,o).bcsToBytes()}throw new Error(`Cannot prepare multi signers transaction to submission, ${typeof n} transaction is not supported`)}function cr(n){let e=Ho(n),t=_sha3.sha3_256.create();if(e instanceof ae)t.update(Gr);else if(e instanceof we)t.update(On);else if(e instanceof _e)t.update(On);else throw new Error(`Unknown transaction type to sign on: ${e}`);let r=t.digest(),o=e.bcsToBytes(),i=new Uint8Array(r.length+o.length);return i.set(r),i.set(o,r.length),i}async function Qo({key:n,moduleAddress:e,moduleName:t,functionName:r,aptosConfig:o,abi:i,fetch:s}){return i||tt(async()=>s(e,t,r,o),`${n}-${o.network}-${e}-${t}-${r}`,1e3*60*5)()}async function A(n){let e=await Ns(n);return Gs(n,e)}async function Ns(n){let{aptosConfig:e,data:t}=n,r,o;return"bytecode"in t?o=await Sn(t):"multisigAddress"in t?(r={aptosConfig:e,multisigAddress:t.multisigAddress,function:t.function,functionArguments:t.functionArguments,typeArguments:t.typeArguments},o=await Sn(r)):(r={aptosConfig:e,function:t.function,functionArguments:t.functionArguments,typeArguments:t.typeArguments},o=await Sn(r)),o}async function Gs(n,e){let{aptosConfig:t,sender:r,options:o}=n,i;if(zs(n)&&(i=u.ZERO.toString()),ks(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 zs(n){return n.withFeePayer===!0}function ks(n){return"secondarySignerAddresses"in n}function Wo(n){let{transaction:e}=n;return cr(e)}function xn(n){return Lo({...n})}async function ur(n){let{aptosConfig:e,transaction:t,signerPublicKey:r,secondarySignersPublicKeys:o,feePayerPublicKey:i,options:s}=n,a=$o({transaction:t,signerPublicKey:r,secondarySignersPublicKeys:o,feePayerPublicKey:i,options:s}),{data:c}=await ke({aptosConfig:e,body:a,path:"transactions/simulate",params:{estimate_gas_unit_price:_nullishCoalesce(_optionalChain([n, 'access', _94 => _94.options, 'optionalAccess', _95 => _95.estimateGasUnitPrice]), () => (!1)),estimate_max_gas_amount:_nullishCoalesce(_optionalChain([n, 'access', _96 => _96.options, 'optionalAccess', _97 => _97.estimateMaxGasAmount]), () => (!1)),estimate_prioritized_gas_unit_price:_nullishCoalesce(_optionalChain([n, 'access', _98 => _98.options, 'optionalAccess', _99 => _99.estimatePrioritizedGasUnitPrice]), () => (!1))},originMethod:"simulateTransaction",contentType:"application/x.aptos.signed_transaction+bcs"});return c}async function vn(n){let{aptosConfig:e}=n,t=Vo({...n}),{data:r}=await ke({aptosConfig:e,body:t,path:"transactions",originMethod:"submitTransaction",contentType:"application/x.aptos.signed_transaction+bcs"});return r}async function Nt(n){let{aptosConfig:e,signer:t,transaction:r}=n,o=xn({signer:t,transaction:r});return vn({aptosConfig:e,transaction:r,senderAuthenticator:o})}var Os={typeParameters:[],parameters:[x.u8(),new x(x.u8())]};async function jo(n){let{aptosConfig:e,account:t,metadataBytes:r,moduleBytecode:o,options:i}=n,s=o.map(a=>h.U8(a));return A({aptosConfig:e,sender:u.from(t),data:{function:"0x1::code::publish_package_txn",functionArguments:[h.U8(r),new h(s)],abi:Os},options:i})}var Ds={typeParameters:[],parameters:[new ge,x.u8(),new ge,x.u8(),x.u8(),x.u8()]};async function Xo(n){let{aptosConfig:e,fromAccount:t,toNewPrivateKey:r}=n,o=await le({aptosConfig:e,accountAddress:t.accountAddress}),i=Ie.fromPrivateKey({privateKey:r,legacy:!0}),a=new yn({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 k(t.signingScheme),h.U8(t.publicKey.toUint8Array()),new k(i.signingScheme),h.U8(i.publicKey.toUint8Array()),h.U8(c.toUint8Array()),h.U8(p.toUint8Array())],abi:Ds}});return Nt({aptosConfig:e,signer:t,transaction:f})}var Bs={typeParameters:[{constraints:[]}],parameters:[new Q,new $]};async function Yo(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, () => (Ht))],functionArguments:[r,o],abi:Bs},options:s})}var Gt=class{constructor(e){this.config=e}async transferCoinTransaction(e){return Yo({aptosConfig:this.config,...e})}};var Re={BOOLEAN:"bool",U8:"u8",U16:"u16",U32:"u32",U64:"u64",U128:"u128",U256:"u256",ADDRESS:"address",STRING:"0x1::string::String",ARRAY:"vector<u8>"},ee="0x4::token::Token";async function Zo(n){let{aptosConfig:e,digitalAssetAddress:t}=n,r={token_data_id:{_eq:u.from(t).toStringLong()}};return(await m({aptosConfig:e,query:{query:po,variables:{where_condition:r}},originMethod:"getDigitalAssetData"})).current_token_datas_v2[0]}async function Jo(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:$n,variables:{where_condition:r}},originMethod:"getCurrentDigitalAssetOwnership"})).current_token_ownerships_v2[0]}async function ei(n){let{aptosConfig:e,ownerAddress:t,options:r}=n,o={owner_address:{_eq:u.from(t).toStringLong()},amount:{_gt:0}},i={query:$n,variables:{where_condition:o,offset:_optionalChain([r, 'optionalAccess', _100 => _100.offset]),limit:_optionalChain([r, 'optionalAccess', _101 => _101.limit]),order_by:_optionalChain([r, 'optionalAccess', _102 => _102.orderBy])}};return(await m({aptosConfig:e,query:i,originMethod:"getOwnedDigitalAssets"})).current_token_ownerships_v2}async function ti(n){let{aptosConfig:e,digitalAssetAddress:t,options:r}=n,o={token_data_id:{_eq:u.from(t).toStringLong()}},i={query:uo,variables:{where_condition:o,offset:_optionalChain([r, 'optionalAccess', _103 => _103.offset]),limit:_optionalChain([r, 'optionalAccess', _104 => _104.limit]),order_by:_optionalChain([r, 'optionalAccess', _105 => _105.orderBy])}};return(await m({aptosConfig:e,query:i,originMethod:"getDigitalAssetActivity"})).token_activities_v2}var Fs={typeParameters:[],parameters:[new l(S()),new $,new l(S()),new l(S()),new O,new O,new O,new O,new O,new O,new O,new O,new O,new $,new $]};async function ni(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 z(_nullishCoalesce(n.maxSupply, () => (Oe))),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 z(_nullishCoalesce(n.royaltyNumerator, () => (0))),new z(_nullishCoalesce(n.royaltyDenominator, () => (1)))],abi:Fs},options:t})}async function pr(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', _106 => _106.tokenStandard])&&(s.token_standard={_eq:_nullishCoalesce(_optionalChain([o, 'optionalAccess', _107 => _107.tokenStandard]), () => ("v2"))}),(await m({aptosConfig:e,query:{query:Mn,variables:{where_condition:s}},originMethod:"getCollectionData"})).current_collections_v2[0]}async function ri(n){let{aptosConfig:e,collectionId:t}=n,o={collection_id:{_eq:u.from(t).toStringLong()}};return(await m({aptosConfig:e,query:{query:Mn,variables:{where_condition:o}},originMethod:"getCollectionData"})).current_collections_v2[0]}async function oi(n){return(await pr(n)).collection_id}var Ms={typeParameters:[],parameters:[new l(S()),new l(S()),new l(S()),new l(S()),new x(new l(S())),new x(new l(S())),new x(x.u8())]};async function ii(n){let{aptosConfig:e,options:t,creator:r,collection:o,description:i,name:s,uri:a,propertyKeys:c,propertyTypes:p,propertyValues:f}=n,C=_optionalChain([p, 'optionalAccess', _108 => _108.map, 'call', _109 => _109(y=>Re[y])]);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),h.MoveString(_nullishCoalesce(c, () => ([]))),h.MoveString(_nullishCoalesce(C, () => ([]))),Ti(_nullishCoalesce(f, () => ([])),_nullishCoalesce(C, () => ([])))],abi:Ms},options:t})}var Ks={typeParameters:[{constraints:["key"]}],parameters:[new l(W(new G(0))),new Q]};async function si(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, () => (ee))],functionArguments:[u.from(r),u.from(o)],abi:Ks},options:s})}var qs={typeParameters:[],parameters:[new l(S()),new l(S()),new l(S()),new l(S()),new x(new l(S())),new x(new l(S())),new x(x.u8()),new Q]};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:C}=n;if(_optionalChain([c, 'optionalAccess', _110 => _110.length])!==_optionalChain([f, 'optionalAccess', _111 => _111.length]))throw new Error("Property keys and property values counts do not match");if(_optionalChain([p, 'optionalAccess', _112 => _112.length])!==_optionalChain([f, 'optionalAccess', _113 => _113.length]))throw new Error("Property types and property values counts do not match");let y=_optionalChain([p, 'optionalAccess', _114 => _114.map, 'call', _115 => _115(g=>Re[g])]);return A({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::mint_soul_bound",functionArguments:[r,o,i,s,h.MoveString(_nullishCoalesce(c, () => ([]))),h.MoveString(_nullishCoalesce(y, () => ([]))),Ti(_nullishCoalesce(f, () => ([])),_nullishCoalesce(y, () => ([]))),a],abi:qs},options:C})}var $s={typeParameters:[{constraints:["key"]}],parameters:[new l(W(new G(0)))]};async function ci(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, () => (ee))],functionArguments:[u.from(r)],abi:$s},options:i})}var Ls={typeParameters:[{constraints:["key"]}],parameters:[new l(W(new G(0)))]};async function ui(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, () => (ee))],functionArguments:[r],abi:Ls},options:i})}var Vs={typeParameters:[{constraints:["key"]}],parameters:[new l(W(new G(0)))]};async function pi(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, () => (ee))],functionArguments:[r],abi:Vs},options:i})}var Hs={typeParameters:[{constraints:["key"]}],parameters:[new l(W(new G(0))),new l(S())]};async function di(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, () => (ee))],functionArguments:[u.from(o),new w(r)],abi:Hs},options:s})}var Qs={typeParameters:[{constraints:["key"]}],parameters:[new l(W(new G(0))),new l(S())]};async function li(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, () => (ee))],functionArguments:[u.from(o),new w(r)],abi:Qs},options:s})}var Ws={typeParameters:[{constraints:["key"]}],parameters:[new l(W(new G(0))),new l(S())]};async function gi(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, () => (ee))],functionArguments:[u.from(o),new w(r)],abi:Ws},options:s})}var js={typeParameters:[{constraints:["key"]}],parameters:[new l(W(new G(0))),new l(S()),new l(S()),x.u8()]};async function mi(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, () => (ee))],functionArguments:[u.from(s),new w(r),new w(Re[o]),h.U8(dr(i,Re[o]))],abi:js},options:c})}var Xs={typeParameters:[{constraints:["key"]}],parameters:[new l(W(new G(0))),new l(S())]};async function yi(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, () => (ee))],functionArguments:[u.from(o),new w(r)],abi:Xs},options:s})}var Ys={typeParameters:[{constraints:["key"]}],parameters:[new l(W(new G(0))),new l(S()),new l(S()),x.u8()]};async function Ai(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, () => (ee))],functionArguments:[u.from(s),new w(r),new w(Re[o]),dr(i,Re[o])],abi:Ys},options:c})}var Zs={typeParameters:[{constraints:["key"]},{constraints:[]}],parameters:[new l(W(new G(0))),new l(S()),new G(1)]};async function fi(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, () => (ee)),Re[o]],functionArguments:[u.from(s),new w(r),i],abi:Zs},options:c})}var Js={typeParameters:[{constraints:["key"]},{constraints:[]}],parameters:[new l(W(new G(0))),new l(S()),new G(1)]};async function hi(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, () => (ee)),Re[o]],functionArguments:[u.from(s),new w(r),i],abi:Js},options:c})}function Ti(n,e){let t=new Array;return e.forEach((r,o)=>{t.push(dr(n[o],r))}),t}function dr(n,e){let t=Se(e);return gt(n,t,0,[]).bcsToBytes()}var zt=class{constructor(e){this.config=e}async getCollectionData(e){return await T({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),pr({aptosConfig:this.config,...e})}async getCollectionDataByCollectionId(e){return await T({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),ri({aptosConfig:this.config,...e})}async getCollectionId(e){return await T({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),oi({aptosConfig:this.config,...e})}async getDigitalAssetData(e){return await T({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),Zo({aptosConfig:this.config,...e})}async getCurrentDigitalAssetOwnership(e){return await T({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),Jo({aptosConfig:this.config,...e})}async getOwnedDigitalAssets(e){return await T({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),ei({aptosConfig:this.config,...e})}async getDigitalAssetActivity(e){return await T({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),ti({aptosConfig:this.config,...e})}async createCollectionTransaction(e){return ni({aptosConfig:this.config,...e})}async mintDigitalAssetTransaction(e){return ii({aptosConfig:this.config,...e})}async transferDigitalAssetTransaction(e){return si({aptosConfig:this.config,...e})}async mintSoulBoundTransaction(e){return ai({aptosConfig:this.config,...e})}async burnDigitalAssetTransaction(e){return ci({aptosConfig:this.config,...e})}async freezeDigitalAssetTransaferTransaction(e){return ui({aptosConfig:this.config,...e})}async unfreezeDigitalAssetTransaferTransaction(e){return pi({aptosConfig:this.config,...e})}async setDigitalAssetDescriptionTransaction(e){return di({aptosConfig:this.config,...e})}async setDigitalAssetNameTransaction(e){return li({aptosConfig:this.config,...e})}async setDigitalAssetURITransaction(e){return gi({aptosConfig:this.config,...e})}async addDigitalAssetPropertyTransaction(e){return mi({aptosConfig:this.config,...e})}async removeDigitalAssetPropertyTransaction(e){return yi({aptosConfig:this.config,...e})}async updateDigitalAssetPropertyTransaction(e){return Ai({aptosConfig:this.config,...e})}async addDigitalAssetTypedPropertyTransaction(e){return fi({aptosConfig:this.config,...e})}async updateDigitalAssetTypedPropertyTransaction(e){return hi({aptosConfig:this.config,...e})}};var bi=300,ea=n=>{if(n&&n.length>bi)throw new Error(`Event type length exceeds the maximum length of ${bi}`)};async function wi(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', _116 => _116.orderBy])};return kt({aptosConfig:e,options:i})}async function _i(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', _117 => _117.orderBy])};return kt({aptosConfig:t,options:a})}async function Si(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', _118 => _118.orderBy])};return kt({aptosConfig:t,options:a})}async function kt(n){let{aptosConfig:e,options:t}=n;ea(_optionalChain([t, 'optionalAccess', _119 => _119.where, 'optionalAccess', _120 => _120.indexed_type, 'optionalAccess', _121 => _121._eq]));let r={query:so,variables:{where_condition:_optionalChain([t, 'optionalAccess', _122 => _122.where]),offset:_optionalChain([t, 'optionalAccess', _123 => _123.offset]),limit:_optionalChain([t, 'optionalAccess', _124 => _124.limit]),order_by:_optionalChain([t, 'optionalAccess', _125 => _125.orderBy])}};return(await m({aptosConfig:e,query:r,originMethod:"getEvents"})).events}var Ot=class{constructor(e){this.config=e}async getModuleEventsByEventType(e){return await T({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"events_processor"}),wi({aptosConfig:this.config,...e})}async getAccountEventsByCreationNumber(e){return await T({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"events_processor"}),_i({aptosConfig:this.config,...e})}async getAccountEventsByEventType(e){return await T({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"events_processor"}),Si({aptosConfig:this.config,...e})}async getEvents(e){return await T({config:this.config,minimumLedgerVersion:_optionalChain([e, 'optionalAccess', _126 => _126.minimumLedgerVersion]),processorType:"events_processor"}),kt({aptosConfig:this.config,...e})}};async function xi(n){let{aptosConfig:e,accountAddress:t,amount:r,options:o}=n,i=_optionalChain([o, 'optionalAccess', _127 => _127.timeoutSecs])||20,{data:s}=await Dr({aptosConfig:e,path:"fund",body:{address:u.from(t).toString(),amount:r},originMethod:"fundAccount"}),a=s.txn_hashes[0],c=await nt({aptosConfig:e,transactionHash:a,options:{timeoutSecs:i,checkSuccess:_optionalChain([o, 'optionalAccess', _128 => _128.checkSuccess])}});if(c.type==="user_transaction")return c;throw new Error(`Unexpected transaction received for fund account: ${c.type}`)}var Dt=class{constructor(e){this.config=e}async fundAccount(e){let t=await xi({aptosConfig:this.config,...e});return _optionalChain([e, 'access', _129 => _129.options, 'optionalAccess', _130 => _130.waitForIndexer])!==!1&&await gn({aptosConfig:this.config,minimumLedgerVersion:BigInt(t.version)}),t}};async function lr(n){let{aptosConfig:e,options:t}=n,r={query:co,variables:{where_condition:_optionalChain([t, 'optionalAccess', _131 => _131.where]),limit:_optionalChain([t, 'optionalAccess', _132 => _132.limit]),offset:_optionalChain([t, 'optionalAccess', _133 => _133.offset])}};return(await m({aptosConfig:e,query:r,originMethod:"getFungibleAssetMetadata"})).fungible_asset_metadata}async function vi(n){let{aptosConfig:e,options:t}=n,r={query:ao,variables:{where_condition:_optionalChain([t, 'optionalAccess', _134 => _134.where]),limit:_optionalChain([t, 'optionalAccess', _135 => _135.limit]),offset:_optionalChain([t, 'optionalAccess', _136 => _136.offset])}};return(await m({aptosConfig:e,query:r,originMethod:"getFungibleAssetActivities"})).fungible_asset_activities}async function Ci(n){let{aptosConfig:e,options:t}=n,r={query:oo,variables:{where_condition:_optionalChain([t, 'optionalAccess', _137 => _137.where]),limit:_optionalChain([t, 'optionalAccess', _138 => _138.limit]),offset:_optionalChain([t, 'optionalAccess', _139 => _139.offset])}};return(await m({aptosConfig:e,query:r,originMethod:"getCurrentFungibleAssetBalances"})).current_fungible_asset_balances}var ta={typeParameters:[],parameters:[Se("0x1::object::Object"),new Q,new $]};async function Pi(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:ta},options:s})}var Bt=class{constructor(e){this.config=e}async getFungibleAssetMetadata(e){return await T({config:this.config,minimumLedgerVersion:_optionalChain([e, 'optionalAccess', _140 => _140.minimumLedgerVersion]),processorType:"fungible_asset_processor"}),lr({aptosConfig:this.config,...e})}async getFungibleAssetMetadataByAssetType(e){return await T({config:this.config,minimumLedgerVersion:_optionalChain([e, 'optionalAccess', _141 => _141.minimumLedgerVersion]),processorType:"fungible_asset_processor"}),(await lr({aptosConfig:this.config,options:{where:{asset_type:{_eq:e.assetType}}}}))[0]}async getFungibleAssetActivities(e){return await T({config:this.config,minimumLedgerVersion:_optionalChain([e, 'optionalAccess', _142 => _142.minimumLedgerVersion]),processorType:"fungible_asset_processor"}),vi({aptosConfig:this.config,...e})}async getCurrentFungibleAssetBalances(e){return await T({config:this.config,minimumLedgerVersion:_optionalChain([e, 'optionalAccess', _143 => _143.minimumLedgerVersion]),processorType:"fungible_asset_processor"}),Ci({aptosConfig:this.config,...e})}async transferFungibleAsset(e){return Pi({aptosConfig:this.config,...e})}};async function Ne(n){let{aptosConfig:e,payload:t,options:r}=n,o=await qo({...t,aptosConfig:e}),i=new X;o.serialize(i);let s=i.toUint8Array(),{data:a}=await ke({aptosConfig:e,path:"view",originMethod:"view",contentType:"application/x.aptos.view_function+bcs",params:{ledger_version:_optionalChain([r, 'optionalAccess', _144 => _144.ledgerVersion])},body:s});return a}var Ft=class{constructor(e){this.config=e}async getLedgerInfo(){return on({aptosConfig:this.config})}async getChainId(){return(await this.getLedgerInfo()).chain_id}async getBlockByVersion(e){return lo({aptosConfig:this.config,...e})}async getBlockByHeight(e){return go({aptosConfig:this.config,...e})}async getTableItem(e){return sn({aptosConfig:this.config,...e})}async view(e){return Ne({aptosConfig:this.config,...e})}async getChainTopUserTransactions(e){return mo({aptosConfig:this.config,...e})}async queryIndexer(e){return m({aptosConfig:this.config,...e})}async getIndexerLastSuccessVersion(){return an({aptosConfig:this.config})}async getProcessorStatus(e){return cn({aptosConfig:this.config,processorType:e})}};var Ei=["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 Ii(n){return!(!n||n.length<3||n.length>63||!/^[a-z\d][a-z\d-]{1,61}[a-z\d]$/.test(n))}function Ge(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(!Ii(e))throw new Error(`${e} is not valid. ${Ei}`);if(t&&!Ii(t))throw new Error(`${t} is not valid. ${Ei}`);return{domainName:t||e,subdomainName:t?e:void 0}}var na="0x585fc9f0f0c54183b039ffc770ca282ebd87307916c215a3e692f2f8e4305e82",ra={testnet:"0x5f8fd2347449685cf41d4db97926ec3a096eaf381332be4f1318ad4d16a8497c",mainnet:"0x867ed1f6bf916171b1de3ee92849b8978b7d1b9e0a8cc982a3d19d535dfd9c0c",local:na,custom:null,devnet:null,randomnet:null};function xe(n){let e=ra[n.network];if(!e)throw new Error(`The ANS contract is not deployed to ${n.network}`);return e}var Cn=n=>{if(n&&typeof n=="object"&&"vec"in n&&Array.isArray(n.vec))return n.vec[0]};async function Ui(n){let{aptosConfig:e,name:t}=n,r=xe(e),{domainName:o,subdomainName:i}=Ge(t),s=await Ne({aptosConfig:e,payload:{function:`${r}::router::get_owner_addr`,functionArguments:[o,i]}}),a=Cn(s[0]);return a?u.from(a).toString():void 0}async function Ri(n){let{aptosConfig:e,expiration:t,name:r,sender:o,targetAddress:i,toAddress:s,options:a,transferable:c}=n,p=xe(e),{domainName:f,subdomainName:C}=Ge(r),y=t.policy==="subdomain:independent"||t.policy==="subdomain:follow-domain";if(C&&!y)throw new Error("Subdomains must have an expiration policy of either 'subdomain:independent' or 'subdomain:follow-domain'");if(y&&!C)throw new Error(`Policy is set to ${t.policy} but no subdomain was provided`);if(t.policy==="domain"){let fr=_nullishCoalesce(t.years, () => (1));if(fr!==1)throw new Error("For now, names can only be registered for 1 year at a time");let Qi=fr*31536e3;return await A({aptosConfig:e,sender:o.accountAddress.toString(),data:{function:`${p}::router::register_domain`,functionArguments:[f,Qi,i,s]},options:a})}if(!C)throw new Error(`${t.policy} requires a subdomain to be provided.`);let g=await gr({aptosConfig:e,name:f});if(!g)throw new Error("The domain does not exist");let ze=t.policy==="subdomain:independent"?t.expirationDate:g;if(ze>g)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,C,Math.round(ze/1e3),t.policy==="subdomain:follow-domain"?1:0,!!c,i,s]},options:a})}async function gr(n){let{aptosConfig:e,name:t}=n,r=xe(e),{domainName:o,subdomainName:i}=Ge(t);try{let s=await Ne({aptosConfig:e,payload:{function:`${r}::router::get_expiration`,functionArguments:[o,i]}});return Number(s[0])*1e3}catch (e3){return}}async function Ni(n){let{aptosConfig:e,address:t}=n,r=xe(e),o=await Ne({aptosConfig:e,payload:{function:`${r}::router::get_primary_name`,functionArguments:[u.from(t).toString()]}}),i=Cn(o[1]),s=Cn(o[0]);if(i)return[s,i].filter(Boolean).join(".")}async function Gi(n){let{aptosConfig:e,sender:t,name:r,options:o}=n,i=xe(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}=Ge(r);return await A({aptosConfig:e,sender:t.accountAddress.toString(),data:{function:`${i}::router::set_primary_name`,functionArguments:[s,a]},options:o})}async function zi(n){let{aptosConfig:e,name:t}=n,r=xe(e),{domainName:o,subdomainName:i}=Ge(t),s=await Ne({aptosConfig:e,payload:{function:`${r}::router::get_target_addr`,functionArguments:[o,i]}}),a=Cn(s[0]);return a?u.from(a).toString():void 0}async function ki(n){let{aptosConfig:e,sender:t,name:r,address:o,options:i}=n,s=xe(e),{domainName:a,subdomainName:c}=Ge(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 Oi(n){let{aptosConfig:e,name:t}=n,{domainName:r,subdomainName:o=""}=Ge(t),a=(await m({aptosConfig:e,query:{query:et,variables:{where_condition:{domain:{_eq:r},subdomain:{_eq:o},is_active:{_eq:!0}},limit:1}},originMethod:"getName"})).current_aptos_names[0];return a&&(a=Mt(a)),a}async function Di(n){let{aptosConfig:e,options:t,accountAddress:r}=n,o=await mr({aptosConfig:e});return(await m({aptosConfig:e,originMethod:"getAccountNames",query:{query:et,variables:{limit:_optionalChain([t, 'optionalAccess', _145 => _145.limit]),offset:_optionalChain([t, 'optionalAccess', _146 => _146.offset]),order_by:_optionalChain([t, 'optionalAccess', _147 => _147.orderBy]),where_condition:{..._nullishCoalesce(_optionalChain([n, 'access', _148 => _148.options, 'optionalAccess', _149 => _149.where]), () => ({})),owner_address:{_eq:r.toString()},expiration_timestamp:{_gte:o}}}}})).current_aptos_names.map(Mt)}async function Bi(n){let{aptosConfig:e,options:t,accountAddress:r}=n,o=await mr({aptosConfig:e});return(await m({aptosConfig:e,originMethod:"getAccountDomains",query:{query:et,variables:{limit:_optionalChain([t, 'optionalAccess', _150 => _150.limit]),offset:_optionalChain([t, 'optionalAccess', _151 => _151.offset]),order_by:_optionalChain([t, 'optionalAccess', _152 => _152.orderBy]),where_condition:{..._nullishCoalesce(_optionalChain([n, 'access', _153 => _153.options, 'optionalAccess', _154 => _154.where]), () => ({})),owner_address:{_eq:r.toString()},expiration_timestamp:{_gte:o},subdomain:{_eq:""}}}}})).current_aptos_names.map(Mt)}async function Fi(n){let{aptosConfig:e,options:t,accountAddress:r}=n,o=await mr({aptosConfig:e});return(await m({aptosConfig:e,originMethod:"getAccountSubdomains",query:{query:et,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},subdomain:{_neq:""}}}}})).current_aptos_names.map(Mt)}async function Mi(n){let{aptosConfig:e,options:t,domain:r}=n;return(await m({aptosConfig:e,originMethod:"getDomainSubdomains",query:{query:et,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]), () => ({})),domain:{_eq:r},subdomain:{_neq:""},is_active:{_eq:!0}}}}})).current_aptos_names.map(Mt)}async function mr(n){let{aptosConfig:e}=n,t=xe(e),[r]=await Ne({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 Ki(n){let{aptosConfig:e,sender:t,name:r,years:o=1,options:i}=n,s=xe(e),a=o*31536e3,{domainName:c,subdomainName:p}=Ge(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 Mt(n){return{...n,expiration_timestamp:new Date(n.expiration_timestamp).getTime()}}var Kt=class{constructor(e){this.config=e}async getOwnerAddress(e){return Ui({aptosConfig:this.config,...e})}async getExpiration(e){return gr({aptosConfig:this.config,...e})}async getTargetAddress(e){return zi({aptosConfig:this.config,...e})}async setTargetAddress(e){return ki({aptosConfig:this.config,...e})}async getPrimaryName(e){return Ni({aptosConfig:this.config,...e})}async setPrimaryName(e){return Gi({aptosConfig:this.config,...e})}async registerName(e){return Ri({aptosConfig:this.config,...e})}async renewDomain(e){return Ki({aptosConfig:this.config,...e})}async getName(e){return Oi({aptosConfig:this.config,...e})}async getAccountNames(e){return Di({aptosConfig:this.config,...e})}async getAccountDomains(e){return Bi({aptosConfig:this.config,...e})}async getAccountSubdomains(e){return Fi({aptosConfig:this.config,...e})}async getDomainSubdomains(e){return Mi({aptosConfig:this.config,...e})}};async function qi(n){let{aptosConfig:e,poolAddress:t}=n,r=u.from(t).toStringLong(),i=await m({aptosConfig:e,query:{query:Kn,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 $i(n){let{aptosConfig:e,options:t}=n,r={query:Kn,variables:{order_by:_optionalChain([t, 'optionalAccess', _165 => _165.orderBy])}};return(await m({aptosConfig:e,query:r})).num_active_delegator_per_pool}async function Li(n){let{aptosConfig:e,delegatorAddress:t,poolAddress:r}=n,o={query:io,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 T({config:this.config,minimumLedgerVersion:_optionalChain([e, 'optionalAccess', _166 => _166.minimumLedgerVersion]),processorType:"stake_processor"}),qi({aptosConfig:this.config,...e})}async getNumberOfDelegatorsForAllPools(e){return await T({config:this.config,minimumLedgerVersion:_optionalChain([e, 'optionalAccess', _167 => _167.minimumLedgerVersion]),processorType:"stake_processor"}),$i({aptosConfig:this.config,...e})}async getDelegatedStakingActivities(e){return await T({config:this.config,minimumLedgerVersion:_optionalChain([e, 'optionalAccess', _168 => _168.minimumLedgerVersion]),processorType:"stake_processor"}),Li({aptosConfig:this.config,...e})}};var Pn=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 yr(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 Ar(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 mt=class{constructor(e){this.config=e}async simple(e){return ur({aptosConfig:this.config,...e})}async multiAgent(e){return ur({aptosConfig:this.config,...e})}};F([Ar],mt.prototype,"simple",1),F([Ar],mt.prototype,"multiAgent",1);var yt=class{constructor(e){this.config=e}async simple(e){return vn({aptosConfig:this.config,...e})}async multiAgent(e){return vn({aptosConfig:this.config,...e})}};F([yr],yt.prototype,"simple",1),F([yr],yt.prototype,"multiAgent",1);var _eventemitter3 = require('eventemitter3'); var _eventemitter32 = _interopRequireDefault(_eventemitter3);var En=()=>Math.floor(Date.now()/1e3),In= 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 Ue(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=En();for(;this.currentNumber-this.lastUncommintedNumber>=this.maximumInFlight;)await Ue(this.sleepTime),En()-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 le({aptosConfig:this.aptosConfig,accountAddress:this.account.accountAddress});this.currentNumber=BigInt(e),this.lastUncommintedNumber=BigInt(e)}async update(){let{sequence_number:e}=await le({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 Ue(this.sleepTime);this.lock=!0;try{await this.update();let e=En();for(;this.lastUncommintedNumber!==this.currentNumber;)En()-e>this.maxWaitTime?(console.warn(`Waited over 30 seconds for a transaction to commit, resyncing ${this.account.accountAddress.toString()}`),await this.initialize()):(await Ue(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 At=class{constructor(){this.queue=[];this.pendingDequeue=[];this.cancelled=!1}enqueue(e){if(this.cancelled=!1,this.pendingDequeue.length>0){_optionalChain([this, 'access', _169 => _169.pendingDequeue, 'access', _170 => _170.shift, 'call', _171 => _171(), 'optionalAccess', _172 => _172.resolve, 'call', _173 => _173(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 ft("Task cancelled"))}),this.pendingDequeue=[],this.queue.length=0}isCancelled(){return this.cancelled}pendingDequeueLength(){return this.pendingDequeue.length}},ft=class extends Error{};var Vi="fulfilled",Hi= exports.TransactionWorkerEventsEnum =(i=>(i.TransactionSent="transactionSent",i.TransactionSendFailed="transactionSendFailed",i.TransactionExecuted="transactionExecuted",i.TransactionExecutionFailed="transactionExecutionFailed",i.ExecutionFinish="executionFinish",i))(Hi||{}),Un= exports.TransactionWorker =class extends _eventemitter32.default{constructor(t,r,o=30,i=100,s=10){super();this.taskQueue=new At;this.transactionsQueue=new At;this.outstandingTransactions=new At;this.sentTransactions=[];this.executedTransactions=[];this.aptosConfig=t,this.account=r,this.started=!1,this.accountSequnceNumber=new In(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=Nt({aptosConfig:this.aptosConfig,transaction:r,signer:this.account});await this.outstandingTransactions.enqueue([o,t])}}catch(t){if(t instanceof ft)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===Vi?(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 ft)return;throw new Error(`Process execution failed for ${this.account.accountAddress.toString()} with error ${t}`)}}async checkTransaction(t,r){try{let o=[];o.push(nt({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===Vi?(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 Rn=class extends _eventemitter32.default{constructor(e){super(),this.config=e}start(e){let{sender:t}=e;this.account=t,this.transactionWorker=new Un(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 $t=class{constructor(e){this.config=e,this.build=new Pn(this.config),this.simulate=new mt(this.config),this.submit=new yt(this.config),this.batch=new Rn(this.config)}async getTransactions(e){return Io({aptosConfig:this.config,...e})}async getTransactionByVersion(e){return Uo({aptosConfig:this.config,...e})}async getTransactionByHash(e){return ln({aptosConfig:this.config,...e})}async isPendingTransaction(e){return Ro({aptosConfig:this.config,...e})}async waitForTransaction(e){return nt({aptosConfig:this.config,...e})}async getGasPriceEstimation(){return dn({aptosConfig:this.config})}getSigningMessage(e){return Wo(e)}async publishPackageTransaction(e){return jo({aptosConfig:this.config,...e})}async rotateAuthKey(e){return Xo({aptosConfig:this.config,...e})}sign(e){return xn({...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,xn({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 Nt({aptosConfig:this.config,signer:t,transaction:r})}};var te=class{constructor(e){this.config=new mn(e),this.account=new St(this.config),this.ans=new Kt(this.config),this.coin=new Gt(this.config),this.digitalAsset=new zt(this.config),this.event=new Ot(this.config),this.faucet=new Dt(this.config),this.fungibleAsset=new Bt(this.config),this.general=new Ft(this.config),this.staking=new qt(this.config),this.transaction=new $t(this.config)}};function ye(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))})}ye(te,St,"account");ye(te,Kt,"ans");ye(te,Gt,"coin");ye(te,zt,"digitalAsset");ye(te,Ot,"event");ye(te,Dt,"faucet");ye(te,Bt,"fungibleAsset");ye(te,Ft,"general");ye(te,qt,"staking");ye(te,$t,"transaction");exports.APTOS_BIP44_REGEX = us; exports.APTOS_COIN = Ht; exports.APTOS_HARDENED_REGEX = cs; exports.Account = Ie; exports.AccountAddress = u; exports.AccountAuthenticator = H; exports.AccountAuthenticatorEd25519 = de; exports.AccountAuthenticatorMultiEd25519 = nn; exports.AccountAuthenticatorMultiKey = Ye; exports.AccountAuthenticatorSingleKey = se; exports.AccountAuthenticatorVariant = Sr; exports.AccountPublicKey = ue; exports.AccountSequenceNumber = In; exports.AddressInvalidReason = os; exports.AnyPublicKey = q; exports.AnyPublicKeyVariant = xr; exports.AnySignature = B; exports.AnySignatureVariant = vr; exports.Aptos = te; exports.AptosApiError = ce; exports.AptosApiType = bt; exports.AptosConfig = mn; exports.AuthenticationKey = K; exports.Bool = I; exports.CKDPriv = Lr; exports.ChainId = at; exports.DEFAULT_MAX_GAS_AMOUNT = Rr; exports.DEFAULT_TXN_EXP_SEC_FROM_NOW = Nr; exports.DEFAULT_TXN_TIMEOUT_SEC = Vt; exports.DeriveScheme = Pr; exports.Deserializer = Fr; exports.Ed25519Account = Ze; exports.Ed25519PrivateKey = Z; exports.Ed25519PublicKey = U; exports.Ed25519Signature = R; exports.EntryFunction = Ve; exports.EntryFunctionBytes = Yt; exports.FeePayerRawTransaction = _e; exports.FixedBytes = Be; exports.HARDENED_OFFSET = Kr; exports.Hex = b; exports.HexInvalidReason = ts; exports.Identifier = E; exports.KeyType = ps; exports.MimeType = Lt; exports.ModuleId = xt; exports.MoveAbility = Cr; exports.MoveFunctionVisibility = Xi; exports.MoveOption = Pe; exports.MoveString = w; exports.MoveVector = h; exports.MultiAgentRawTransaction = we; exports.MultiEd25519PublicKey = je; exports.MultiEd25519Signature = Me; exports.MultiKey = tn; exports.MultiKeySignature = Wr; exports.MultiSig = It; exports.MultiSigTransactionPayload = Ut; exports.Network = zn; exports.NetworkToChainId = kn; exports.NetworkToFaucetAPI = Ur; exports.NetworkToIndexerAPI = Er; exports.NetworkToNetworkName = xa; exports.NetworkToNodeAPI = Ir; exports.ParsingError = M; exports.ProcessorType = He; exports.PublicKey = _t; exports.RAW_TRANSACTION_SALT = Gr; exports.RAW_TRANSACTION_WITH_DATA_SALT = On; exports.RawTransaction = ae; exports.RawTransactionWithData = fn; exports.RoleType = Yi; exports.RotationProofChallenge = yn; exports.Script = Et; exports.ScriptTransactionArgumentVariants = Tt; exports.Secp256k1PrivateKey = qe; exports.Secp256k1PublicKey = fe; exports.Secp256k1Signature = he; exports.Serializable = d; exports.Serializer = X; exports.Signature = Y; exports.SignedTransaction = me; exports.SigningScheme = ve; exports.SigningSchemeInput = Gn; exports.SingleKeyAccount = Je; exports.StructTag = be; exports.TransactionAuthenticator = Te; exports.TransactionAuthenticatorEd25519 = rt; exports.TransactionAuthenticatorFeePayer = it; exports.TransactionAuthenticatorMultiAgent = ot; exports.TransactionAuthenticatorMultiEd25519 = jn; exports.TransactionAuthenticatorSingleSender = st; exports.TransactionAuthenticatorVariant = _r; exports.TransactionPayload = Le; exports.TransactionPayloadEntryFunction = Ct; exports.TransactionPayloadMultiSig = Pt; exports.TransactionPayloadScript = vt; exports.TransactionPayloadVariants = br; exports.TransactionResponseType = Nn; exports.TransactionVariants = wr; exports.TransactionWorker = Un; exports.TransactionWorkerEventsEnum = Hi; exports.TypeTag = N; exports.TypeTagAddress = Q; exports.TypeTagBool = O; exports.TypeTagGeneric = G; exports.TypeTagParserError = v; exports.TypeTagParserErrorType = _s; exports.TypeTagReference = An; exports.TypeTagSigner = $e; exports.TypeTagStruct = l; exports.TypeTagU128 = pt; exports.TypeTagU16 = ct; exports.TypeTagU256 = dt; exports.TypeTagU32 = ut; exports.TypeTagU64 = $; exports.TypeTagU8 = ge; exports.TypeTagVariants = Tr; exports.TypeTagVector = x; exports.U128 = oe; exports.U16 = ne; exports.U256 = ie; exports.U32 = re; exports.U64 = z; exports.U8 = k; exports.aptosCoinStructTag = Wl; exports.aptosRequest = Qt; exports.buildTransaction = ar; exports.checkOrConvertArgument = gt; exports.convertArgument = sr; exports.createObjectAddress = ms; exports.createTokenAddress = ed; exports.deriveKey = Fn; exports.deriveTransactionType = Ho; exports.deserializeFromScriptArgument = Ts; exports.ensureBoolean = Bn; exports.fetchEntryFunctionAbi = Mo; exports.fetchFunctionAbi = Fo; exports.fetchViewFunctionAbi = Ko; exports.findFirstNonSignerArg = Bo; exports.generateMultiSignersSignedTransaction = Rs; exports.generateRawTransaction = Us; exports.generateSignedTransaction = Vo; exports.generateSignedTransactionForSimulation = $o; exports.generateSigningMessage = cr; exports.generateTransactionPayload = Sn; exports.generateTransactionPayloadWithABI = Ps; exports.generateViewFunctionPayload = qo; exports.generateViewFunctionPayloadWithABI = Es; exports.get = kr; exports.getAptosFullNode = j; exports.getAuthenticatorForSimulation = _n; exports.getFunctionParts = Rt; exports.isBcsAddress = wn; exports.isBcsBool = Xn; exports.isBcsFixedBytes = Ss; exports.isBcsString = Yn; exports.isBcsU128 = nr; exports.isBcsU16 = Jn; exports.isBcsU256 = rr; exports.isBcsU32 = er; exports.isBcsU64 = tr; exports.isBcsU8 = Zn; exports.isBlockMetadataTransactionResponse = ma; exports.isBool = zo; exports.isEd25519Signature = fa; exports.isEncodedEntryFunctionArgument = Oo; exports.isFeePayerSignature = ba; exports.isGenesisTransactionResponse = ga; exports.isLargeNumber = bn; exports.isMultiAgentSignature = Ta; exports.isMultiEd25519Signature = wa; exports.isNull = ko; exports.isNumber = Tn; exports.isPendingTransactionResponse = da; exports.isScriptDataInput = Do; exports.isSecp256k1Signature = ha; exports.isStateCheckpointTransactionResponse = ya; exports.isString = lt; exports.isUserTransactionResponse = la; exports.isValidBIP44Path = qr; exports.isValidHardenedPath = $r; exports.isValidatorTransactionResponse = Aa; exports.mnemonicToSeed = Zt; exports.objectStructTag = W; exports.optionStructTag = jl; exports.outOfRangeErrorMessage = ns; exports.paginateWithCursor = Qe; exports.parseTypeTag = Se; exports.post = Dn; exports.postAptosFaucet = Dr; exports.postAptosFullNode = ke; exports.postAptosIndexer = Or; exports.promiseFulfilledStatus = Vi; exports.request = Zi; exports.sign = Lo; exports.splitPath = Vr; exports.standardizeTypeTags = ir; exports.stringStructTag = S; exports.throwTypeMismatch = P; exports.validateNumberInRange = Ce;
|
|
428
|
+
`;async function sn(n){let{aptosConfig:e}=n,{data:t}=await X({aptosConfig:e,originMethod:"getLedgerInfo",path:""});return t}async function fo(n){let{aptosConfig:e,ledgerVersion:t,options:r}=n,{data:o}=await X({aptosConfig:e,originMethod:"getBlockByVersion",path:`blocks/by_version/${t}`,params:{with_transactions:_optionalChain([r, 'optionalAccess', _31 => _31.withTransactions])}});return o}async function ho(n){let{aptosConfig:e,blockHeight:t,options:r}=n,{data:o}=await X({aptosConfig:e,originMethod:"getBlockByHeight",path:`blocks/by_height/${t}`,params:{with_transactions:_optionalChain([r, 'optionalAccess', _32 => _32.withTransactions])}});return o}async function an(n){let{aptosConfig:e,handle:t,data:r,options:o}=n;return(await ke({aptosConfig:e,originMethod:"getTableItem",path:`tables/${t}/item`,params:{ledger_version:_optionalChain([o, 'optionalAccess', _33 => _33.ledgerVersion])},body:r})).data}async function To(n){let{aptosConfig:e,limit:t}=n;return(await m({aptosConfig:e,query:{query:co,variables:{limit:t}},originMethod:"getChainTopUserTransactions"})).user_transactions}async function m(n){let{aptosConfig:e,query:t,originMethod:r}=n,{data:o}=await Mr({aptosConfig:e,originMethod:_nullishCoalesce(r, () => ("queryIndexer")),path:"",body:t,overrides:{WITH_CREDENTIALS:!1}});return o}async function _s(n){let{aptosConfig:e}=n;return(await m({aptosConfig:e,query:{query:Vn},originMethod:"getProcessorStatuses"})).processor_status}async function cn(n){let e=await _s({aptosConfig:n.aptosConfig});return BigInt(e[0].last_success_version)}async function un(n){let{aptosConfig:e,processorType:t}=n;return(await m({aptosConfig:e,query:{query:Vn,variables:{where_condition:{processor:{_eq:t}}}},originMethod:"getProcessorStatus"})).processor_status[0]}var Qn=new Map;function nt(n,e,t){return async(...r)=>{if(Qn.has(e)){let{value:i,timestamp:s}=Qn.get(e);if(t===void 0||Date.now()-s<=t)return i}let o=await n(...r);return Qn.set(e,{value:o,timestamp:Date.now()}),o}}async function le(n){let{aptosConfig:e,accountAddress:t}=n,{data:r}=await X({aptosConfig:e,originMethod:"getInfo",path:`accounts/${u.from(t).toString()}`});return r}async function _o(n){let{aptosConfig:e,accountAddress:t,options:r}=n;return Qe({aptosConfig:e,originMethod:"getModules",path:`accounts/${u.from(t).toString()}/modules`,params:{ledger_version:_optionalChain([r, 'optionalAccess', _34 => _34.ledgerVersion]),start:_optionalChain([r, 'optionalAccess', _35 => _35.offset]),limit:_nullishCoalesce(_optionalChain([r, 'optionalAccess', _36 => _36.limit]), () => (1e3))}})}async function pn(n){return _optionalChain([n, 'access', _37 => _37.options, 'optionalAccess', _38 => _38.ledgerVersion])!==void 0?bo(n):nt(async()=>bo(n),`module-${n.accountAddress}-${n.moduleName}`,1e3*60*5)()}async function bo(n){let{aptosConfig:e,accountAddress:t,moduleName:r,options:o}=n,{data:i}=await X({aptosConfig:e,originMethod:"getModule",path:`accounts/${u.from(t).toString()}/module/${r}`,params:{ledger_version:_optionalChain([o, 'optionalAccess', _39 => _39.ledgerVersion])}});return i}async function So(n){let{aptosConfig:e,accountAddress:t,options:r}=n;return Qe({aptosConfig:e,originMethod:"getTransactions",path:`accounts/${u.from(t).toString()}/transactions`,params:{start:_optionalChain([r, 'optionalAccess', _40 => _40.offset]),limit:_optionalChain([r, 'optionalAccess', _41 => _41.limit])}})}async function xo(n){let{aptosConfig:e,accountAddress:t,options:r}=n;return Qe({aptosConfig:e,originMethod:"getResources",path:`accounts/${u.from(t).toString()}/resources`,params:{ledger_version:_optionalChain([r, 'optionalAccess', _42 => _42.ledgerVersion]),start:_optionalChain([r, 'optionalAccess', _43 => _43.offset]),limit:_nullishCoalesce(_optionalChain([r, 'optionalAccess', _44 => _44.limit]), () => (999))}})}async function Wn(n){let{aptosConfig:e,accountAddress:t,resourceType:r,options:o}=n,{data:i}=await X({aptosConfig:e,originMethod:"getResource",path:`accounts/${u.from(t).toString()}/resource/${r}`,params:{ledger_version:_optionalChain([o, 'optionalAccess', _45 => _45.ledgerVersion])}});return i.data}async function jn(n){let{aptosConfig:e,authenticationKey:t,options:r}=n,o=await Wn({aptosConfig:e,accountAddress:"0x1",resourceType:"0x1::account::OriginatingAddress",options:r}),{address_map:{handle:i}}=o,s=u.from(t);try{let a=await an({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 ce&&a.data.error_code==="table_item_not_found")return s;throw a}}async function vo(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:so,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 Co(n){let{aptosConfig:e,accountAddress:t,options:r}=n,i={owner_address:{_eq:u.from(t).toStringLong()},amount:{_gt:0}};_optionalChain([r, 'optionalAccess', _46 => _46.tokenStandard])&&(i.token_standard={_eq:_optionalChain([r, 'optionalAccess', _47 => _47.tokenStandard])});let s={query:oo,variables:{where_condition:i,offset:_optionalChain([r, 'optionalAccess', _48 => _48.offset]),limit:_optionalChain([r, 'optionalAccess', _49 => _49.limit]),order_by:_optionalChain([r, 'optionalAccess', _50 => _50.orderBy])}};return(await m({aptosConfig:e,query:s,originMethod:"getAccountOwnedTokens"})).current_token_ownerships_v2}async function Po(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', _51 => _51.tokenStandard])&&(a.token_standard={_eq:_optionalChain([o, 'optionalAccess', _52 => _52.tokenStandard])});let c={query:io,variables:{where_condition:a,offset:_optionalChain([o, 'optionalAccess', _53 => _53.offset]),limit:_optionalChain([o, 'optionalAccess', _54 => _54.limit]),order_by:_optionalChain([o, 'optionalAccess', _55 => _55.orderBy])}};return(await m({aptosConfig:e,query:c,originMethod:"getAccountOwnedTokensFromCollectionAddress"})).current_token_ownerships_v2}async function Eo(n){let{aptosConfig:e,accountAddress:t,options:r}=n,i={owner_address:{_eq:u.from(t).toStringLong()},amount:{_gt:0}};_optionalChain([r, 'optionalAccess', _56 => _56.tokenStandard])&&(i.current_collection={token_standard:{_eq:_optionalChain([r, 'optionalAccess', _57 => _57.tokenStandard])}});let s={query:no,variables:{where_condition:i,offset:_optionalChain([r, 'optionalAccess', _58 => _58.offset]),limit:_optionalChain([r, 'optionalAccess', _59 => _59.limit]),order_by:_optionalChain([r, 'optionalAccess', _60 => _60.orderBy])}};return(await m({aptosConfig:e,query:s,originMethod:"getAccountCollectionsWithOwnedTokens"})).current_collection_ownership_v2_view}async function Io(n){let{aptosConfig:e,accountAddress:t}=n,r=u.from(t).toStringLong(),i=await m({aptosConfig:e,query:{query:ao,variables:{address:r}},originMethod:"getAccountTransactionsCount"});return i.account_transactions_aggregate.aggregate?i.account_transactions_aggregate.aggregate.count:0}async function Uo(n){let{aptosConfig:e,accountAddress:t,coinType:r}=n,o=u.from(t).toStringLong(),i=await Xn({aptosConfig:e,accountAddress:o,options:{where:{asset_type:{_eq:r}}}});return i[0]?i[0].amount:0}async function Xn(n){let{aptosConfig:e,accountAddress:t,options:r}=n,o=u.from(t).toStringLong(),i={..._optionalChain([r, 'optionalAccess', _61 => _61.where]),owner_address:{_eq:o}},s={query:to,variables:{where_condition:i,offset:_optionalChain([r, 'optionalAccess', _62 => _62.offset]),limit:_optionalChain([r, 'optionalAccess', _63 => _63.limit]),order_by:_optionalChain([r, 'optionalAccess', _64 => _64.orderBy])}};return(await m({aptosConfig:e,query:s,originMethod:"getAccountCoinsData"})).current_fungible_asset_balances}async function Ro(n){let{aptosConfig:e,accountAddress:t}=n,r=u.from(t).toStringLong(),i=await m({aptosConfig:e,query:{query:eo,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 No(n){let{aptosConfig:e,accountAddress:t,options:r}=n,i={owner_address:{_eq:u.from(t).toStringLong()}},s={query:ro,variables:{where_condition:i,offset:_optionalChain([r, 'optionalAccess', _65 => _65.offset]),limit:_optionalChain([r, 'optionalAccess', _66 => _66.limit]),order_by:_optionalChain([r, 'optionalAccess', _67 => _67.orderBy])}};return(await m({aptosConfig:e,query:s,originMethod:"getAccountOwnedObjects"})).current_objects}async function zo(n){let{aptosConfig:e,privateKey:t}=n,r=new $(t.publicKey());if(t instanceof qe){let i=q.fromPublicKeyAndScheme({publicKey:r,scheme:2}).derivedAddress();return Ie.fromPrivateKeyAndAddress({privateKey:t,address:i})}if(t instanceof J){let o=q.fromPublicKeyAndScheme({publicKey:r,scheme:2});if(await wo({authKey:o,aptosConfig:e})){let c=o.derivedAddress();return Ie.fromPrivateKeyAndAddress({privateKey:t,address:c,legacy:!1})}let s=q.fromPublicKeyAndScheme({publicKey:r.publicKey,scheme:0});if(await wo({authKey:s,aptosConfig:e})){let c=s.derivedAddress();return Ie.fromPrivateKeyAndAddress({privateKey:t,address:c,legacy:!0})}}throw new Error(`Can't derive account from private key ${t}`)}async function wo(n){let{aptosConfig:e,authKey:t}=n,r=await jn({aptosConfig:e,authenticationKey:t.derivedAddress()});try{return await le({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 Ue(n){return new Promise(e=>{setTimeout(e,n)})}async function Go(n){let{aptosConfig:e,options:t}=n;return Qe({aptosConfig:e,originMethod:"getTransactions",path:"transactions",params:{start:_optionalChain([t, 'optionalAccess', _68 => _68.offset]),limit:_optionalChain([t, 'optionalAccess', _69 => _69.limit])}})}async function ln(n){let{aptosConfig:e}=n;return nt(async()=>{let{data:t}=await X({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 X({aptosConfig:e,originMethod:"getTransactionByVersion",path:`transactions/by_version/${t}`});return r}async function gn(n){let{aptosConfig:e,transactionHash:t}=n,{data:r}=await X({aptosConfig:e,path:`transactions/by_hash/${t}`,originMethod:"getTransactionByHash"});return r}async function Do(n){let{aptosConfig:e,transactionHash:t}=n;try{return(await gn({aptosConfig:e,transactionHash:t})).type==="pending_transaction"}catch(r){if(_optionalChain([r, 'optionalAccess', _70 => _70.status])===404)return!0;throw r}}async function rt(n){let{aptosConfig:e,transactionHash:t,options:r}=n,o=_nullishCoalesce(_optionalChain([r, 'optionalAccess', _71 => _71.timeoutSecs]), () => (20)),i=_nullishCoalesce(_optionalChain([r, 'optionalAccess', _72 => _72.checkSuccess]), () => (!0)),s=!0,a=0,c,p,f=200,C=1.5;for(;s&&!(a>=o);){try{if(c=await gn({aptosConfig:e,transactionHash:t}),s=c.type==="pending_transaction",!s)break}catch(y){if(!(y instanceof ce)||(p=y,y.status!==404&&y.status>=400&&y.status<500))throw y}await Ue(f),a+=f/1e3,f*=C}if(c===void 0)throw p||new dn(`Fetching transaction ${t} failed and timed out after ${o} seconds`,c);if(c.type==="pending_transaction")throw new dn(`Transaction ${t} timed out in pending state after ${o} seconds`,c);if(!i)return c;if(!c.success)throw new Yn(`Transaction ${t} failed with an error: ${c.vm_status}`,c);return c}async function mn(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 cn({aptosConfig:e}):s=(await un({aptosConfig:e,processorType:t})).last_success_version,s>=r)break;await Ue(200)}}var dn=class extends Error{constructor(e,t){super(e),this.lastSubmittedTransaction=t}},Yn=class extends Error{constructor(e,t){super(e),this.transaction=t}};async function b(n){n.minimumLedgerVersion!==void 0&&await mn({aptosConfig:n.config,minimumLedgerVersion:n.minimumLedgerVersion,processorType:n.processorType})}var xt=class{constructor(e){this.config=e}async getAccountInfo(e){return le({aptosConfig:this.config,...e})}async getAccountModules(e){return _o({aptosConfig:this.config,...e})}async getAccountModule(e){return pn({aptosConfig:this.config,...e})}async getAccountTransactions(e){return So({aptosConfig:this.config,...e})}async getAccountResources(e){return xo({aptosConfig:this.config,...e})}async getAccountResource(e){return Wn({aptosConfig:this.config,...e})}async lookupOriginalAccountAddress(e){return jn({aptosConfig:this.config,...e})}async getAccountTokensCount(e){return await b({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"account_transactions_processor"}),vo({aptosConfig:this.config,...e})}async getAccountOwnedTokens(e){return await b({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),Co({aptosConfig:this.config,...e})}async getAccountOwnedTokensFromCollectionAddress(e){return await b({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),Po({aptosConfig:this.config,...e})}async getAccountCollectionsWithOwnedTokens(e){return await b({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),Eo({aptosConfig:this.config,...e})}async getAccountTransactionsCount(e){return await b({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"account_transactions_processor"}),Io({aptosConfig:this.config,...e})}async getAccountCoinsData(e){return await b({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"fungible_asset_processor"}),Xn({aptosConfig:this.config,...e})}async getAccountCoinsCount(e){return await b({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"fungible_asset_processor"}),Ro({aptosConfig:this.config,...e})}async getAccountAPTAmount(e){return this.getAccountCoinAmount({coinType:Qt,...e})}async getAccountCoinAmount(e){return await b({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"fungible_asset_processor"}),Uo({aptosConfig:this.config,...e})}async getAccountOwnedObjects(e){return await b({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"default_processor"}),No({aptosConfig:this.config,...e})}async deriveAccountFromPrivateKey(e){return zo({aptosConfig:this.config,...e})}};var _aptosclient = require('@aptos-labs/aptos-client'); var _aptosclient2 = _interopRequireDefault(_aptosclient);var yn=class{constructor(e){this.network=_nullishCoalesce(_optionalChain([e, 'optionalAccess', _73 => _73.network]), () => ("devnet")),this.fullnode=_optionalChain([e, 'optionalAccess', _74 => _74.fullnode]),this.faucet=_optionalChain([e, 'optionalAccess', _75 => _75.faucet]),this.indexer=_optionalChain([e, 'optionalAccess', _76 => _76.indexer]),this.client=_nullishCoalesce(_optionalChain([e, 'optionalAccess', _77 => _77.client]), () => ({provider:_aptosclient2.default})),this.clientConfig=_nullishCoalesce(_optionalChain([e, 'optionalAccess', _78 => _78.clientConfig]), () => ({})),this.fullnodeConfig=_nullishCoalesce(_optionalChain([e, 'optionalAccess', _79 => _79.fullnodeConfig]), () => ({})),this.indexerConfig=_nullishCoalesce(_optionalChain([e, 'optionalAccess', _80 => _80.indexerConfig]), () => ({})),this.faucetConfig=_nullishCoalesce(_optionalChain([e, 'optionalAccess', _81 => _81.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 zr[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 Gr[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 Nr[this.network];default:throw Error(`apiType ${e} is not supported`)}}};var An=class extends d{constructor(t){super();this.accountAddress=u.ONE;this.moduleName=new w("account");this.structName=new w("RotationProofChallenge");this.sequenceNumber=new G(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 Te=class extends d{static deserialize(e){let t=e.deserializeUleb128AsU32();switch(t){case 0:return ot.load(e);case 1:return Zn.load(e);case 2:return it.load(e);case 3:return st.load(e);case 4:return at.load(e);default:throw new Error(`Unknown variant index for TransactionAuthenticator: ${t}`)}}},ot= exports.TransactionAuthenticatorEd25519 =class n extends Te{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=U.deserialize(e),r=R.deserialize(e);return new n(t,r)}},Zn= exports.TransactionAuthenticatorMultiEd25519 =class n extends Te{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=Xe.deserialize(e),r=Me.deserialize(e);return new n(t,r)}},it= exports.TransactionAuthenticatorMultiAgent =class n extends Te{constructor(e,t,r){super(),this.sender=e,this.secondary_signer_addresses=t,this.secondary_signers=r}serialize(e){e.serializeU32AsUleb128(2),this.sender.serialize(e),e.serializeVector(this.secondary_signer_addresses),e.serializeVector(this.secondary_signers)}static load(e){let t=Q.deserialize(e),r=e.deserializeVector(u),o=e.deserializeVector(Q);return new n(t,r,o)}},st= exports.TransactionAuthenticatorFeePayer =class n extends Te{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=Q.deserialize(e),r=e.deserializeVector(u),o=e.deserializeVector(Q),i=u.deserialize(e),s=Q.deserialize(e),a={address:i,authenticator:s};return new n(t,r,o,a)}},at= exports.TransactionAuthenticatorSingleSender =class n extends Te{constructor(e){super(),this.sender=e}serialize(e){e.serializeU32AsUleb128(4),this.sender.serialize(e)}static load(e){let t=Q.deserialize(e);return new n(t)}};var ct=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 E=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 vt=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 E(t[1]))}serialize(e){this.address.serialize(e),this.name.serialize(e)}static deserialize(e){let t=u.deserialize(e),r=E.deserialize(e);return new n(t,r)}};var N=class extends d{static deserialize(e){let t=e.deserializeUleb128AsU32();switch(t){case 0:return D.load(e);case 1:return ge.load(e);case 2:return L.load(e);case 3:return dt.load(e);case 4:return W.load(e);case 5:return $e.load(e);case 6:return x.load(e);case 7:return l.load(e);case 8:return ut.load(e);case 9:return pt.load(e);case 10:return lt.load(e);case 255:return z.load(e);default:throw new Error(`Unknown variant index for TypeTag: ${t}`)}}isBool(){return this instanceof D}isAddress(){return this instanceof W}isGeneric(){return this instanceof z}isSigner(){return this instanceof $e}isVector(){return this instanceof x}isStruct(){return this instanceof l}isU8(){return this instanceof ge}isU16(){return this instanceof ut}isU32(){return this instanceof pt}isU64(){return this instanceof L}isU128(){return this instanceof dt}isU256(){return this instanceof lt}},D= exports.TypeTagBool =class n extends N{toString(){return"bool"}serialize(e){e.serializeU32AsUleb128(0)}static load(e){return new n}},ge= exports.TypeTagU8 =class n extends N{toString(){return"u8"}serialize(e){e.serializeU32AsUleb128(1)}static load(e){return new n}},ut= exports.TypeTagU16 =class n extends N{toString(){return"u16"}serialize(e){e.serializeU32AsUleb128(8)}static load(e){return new n}},pt= exports.TypeTagU32 =class n extends N{toString(){return"u32"}serialize(e){e.serializeU32AsUleb128(9)}static load(e){return new n}},L= exports.TypeTagU64 =class n extends N{toString(){return"u64"}serialize(e){e.serializeU32AsUleb128(2)}static load(e){return new n}},dt= exports.TypeTagU128 =class n extends N{toString(){return"u128"}serialize(e){e.serializeU32AsUleb128(3)}static load(e){return new n}},lt= exports.TypeTagU256 =class n extends N{toString(){return"u256"}serialize(e){e.serializeU32AsUleb128(10)}static load(e){return new n}},W= exports.TypeTagAddress =class n extends N{toString(){return"address"}serialize(e){e.serializeU32AsUleb128(4)}static load(e){return new n}},$e= exports.TypeTagSigner =class n extends N{toString(){return"signer"}serialize(e){e.serializeU32AsUleb128(5)}static load(e){return new n}},fn= exports.TypeTagReference =class n extends N{constructor(t){super();this.value=t}toString(){return`&${this.value.toString()}`}serialize(t){t.serializeU32AsUleb128(254)}static load(t){let r=N.deserialize(t);return new n(r)}},z= exports.TypeTagGeneric =class n extends N{constructor(t){super();this.value=t;if(t<0)throw new Error("Generic type parameter index cannot be negative")}toString(){return`T${this.value}`}serialize(t){t.serializeU32AsUleb128(255),t.serializeU32(this.value)}static load(t){let r=t.deserializeU32();return new n(r)}},x= exports.TypeTagVector =class n extends N{constructor(t){super();this.value=t}toString(){return`vector<${this.value.toString()}>`}static u8(){return new n(new ge)}serialize(t){t.serializeU32AsUleb128(6),this.value.serialize(t)}static load(t){let r=N.deserialize(t);return new n(r)}},l= exports.TypeTagStruct =class n extends N{constructor(t){super();this.value=t}toString(){let t="";return this.value.typeArgs.length>0&&(t=`<${this.value.typeArgs.map(r=>r.toString()).join(", ")}>`),`${this.value.address.toString()}::${this.value.moduleName.identifier}::${this.value.name.identifier}${t}`}serialize(t){t.serializeU32AsUleb128(7),this.value.serialize(t)}static load(t){let r=be.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")}},be= 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=E.deserialize(e),o=E.deserialize(e),i=e.deserializeVector(N);return new n(t,r,o,i)}};function og(){return new be(u.ONE,new E("aptos_coin"),new E("AptosCoin"),[])}function S(){return new be(u.ONE,new E("string"),new E("String"),[])}function ig(n){return new be(u.ONE,new E("option"),new E("Option"),[n])}function j(n){return new be(u.ONE,new E("object"),new E("Object"),[n])}function xs(n){let e=n.deserializeUleb128AsU32();switch(e){case 0:return k.deserialize(n);case 1:return G.deserialize(n);case 2:return ie.deserialize(n);case 3:return u.deserialize(n);case 4:return T.deserialize(n,k);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 Le=class extends d{static deserialize(e){let t=e.deserializeUleb128AsU32();switch(t){case 0:return Ct.load(e);case 2:return Pt.load(e);case 3:return Et.load(e);default:throw new Error(`Unknown variant index for TransactionPayload: ${t}`)}}},Ct= exports.TransactionPayloadScript =class n extends Le{constructor(e){super(),this.script=e}serialize(e){e.serializeU32AsUleb128(0),this.script.serialize(e)}static load(e){let t=It.deserialize(e);return new n(t)}},Pt= exports.TransactionPayloadEntryFunction =class n extends Le{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)}},Et= exports.TransactionPayloadMultiSig =class n extends Le{constructor(e){super(),this.multiSig=e}serialize(e){e.serializeU32AsUleb128(3),this.multiSig.serialize(e)}static load(e){let t=Ut.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(vt.fromStr(e),new E(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=vt.deserialize(e),r=E.deserialize(e),o=e.deserializeVector(N),i=e.deserializeUleb128AsU32(),s=new Array;for(let a=0;a<i;a+=1){let c=e.deserializeUleb128AsU32(),p=Zt.deserialize(e,c);s.push(p)}return new n(t,r,o,s)}},It= exports.Script =class n{constructor(e,t,r){this.bytecode=e,this.type_args=t,this.args=r}serialize(e){e.serializeBytes(this.bytecode),e.serializeVector(this.type_args),e.serializeU32AsUleb128(this.args.length),this.args.forEach(t=>{t.serializeForScriptFunction(e)})}static deserialize(e){let t=e.deserializeBytes(),r=e.deserializeVector(N),o=e.deserializeUleb128AsU32(),i=new Array;for(let s=0;s<o;s+=1){let a=xs(e);i.push(a)}return new n(t,r,i)}},Ut= 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=Rt.deserialize(e)),new n(t,o)}},Rt= 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 F=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=Le.deserialize(e),i=e.deserializeU64(),s=e.deserializeU64(),a=e.deserializeU64(),c=ct.deserialize(e);return new n(t,r,o,i,s,a,c)}},hn= exports.RawTransactionWithData =class extends d{static deserialize(e){let t=e.deserializeUleb128AsU32();switch(t){case 0:return we.load(e);case 1:return _e.load(e);default:throw new Error(`Unknown variant index for RawTransactionWithData: ${t}`)}}},we= exports.MultiAgentRawTransaction =class n extends hn{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=F.deserialize(e),r=e.deserializeVector(u);return new n(t,r)}},_e= exports.FeePayerRawTransaction =class n extends hn{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=F.deserialize(e),r=e.deserializeVector(u),o=u.deserialize(e);return new n(t,r,o)}};var me=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=F.deserialize(e),r=Te.deserialize(e);return new n(t,r)}};var Tn=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=F.deserialize(e),r=e.deserializeBool(),o;return r&&(o=u.deserialize(e)),new n(t,o)}};function Oo(n){return!!n.match(/^[_a-zA-Z0-9]+$/)}function Bo(n){return!!n.match(/\s/)}function vs(n){return!!n.match(/^T[0-9]+$/)}function Cs(n,e){let t=e;for(;t<n.length;t+=1){let r=n[t];if(!Bo(r))break}return t}var Ps=(y=>(y.InvalidTypeTag="unknown type",y.UnexpectedGenericType="unexpected generic type",y.UnexpectedTypeArgumentClose="unexpected '>'",y.UnexpectedWhitespaceCharacter="unexpected whitespace character",y.UnexpectedComma="unexpected ','",y.TypeArgumentCountMismatch="type argument count doesn't match expected amount",y.MissingTypeArgumentClose="no matching '>' for '<'",y.UnexpectedPrimitiveTypeArguments="primitive types not expected to have type arguments",y.UnexpectedVectorTypeArgumentCount="vector type expected to have exactly one type argument",y.UnexpectedStructFormat="unexpected struct format, must be of the form 0xaddress::module_name::struct_name",y.InvalidModuleNameCharacter="module name must only contain alphanumeric or '_' characters",y.InvalidStructNameCharacter="struct name must only contain alphanumeric or '_' characters",y))(Ps||{}),v= exports.TypeTagParserError =class extends Error{constructor(e,t){super(`Failed to parse typeTag '${e}', ${t}`)}};function Se(n,e){let t=_nullishCoalesce(_optionalChain([e, 'optionalAccess', _82 => _82.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 Ge=bn(a,o,t);i.push(Ge)}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:C,savedTypes:y,savedExpectedTypes:g}=f;o=i,i=y,a=C,c=g}else if(p===","){if(a.length!==0){let f=bn(a,o,t);o=[],i.push(f),a="",c+=1}}else if(Bo(p)){let f=!1;if(a.length!==0){let y=bn(a,o,t);o=[],i.push(y),a="",f=!0}s=Cs(n,s);let C=n[s];if(s<n.length&&f&&C!==","&&C!==">")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 bn(a,o,t);case 1:if(a==="")return i[0];throw new v(n,"unexpected ','");default:throw new v(n,"unexpected whitespace character")}}function bn(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 fn(new $e);case"signer":if(e.length>0)throw new v(n,"primitive types not expected to have type arguments");return new $e;case"bool":if(e.length>0)throw new v(n,"primitive types not expected to have type arguments");return new D;case"address":if(e.length>0)throw new v(n,"primitive types not expected to have type arguments");return new W;case"u8":if(e.length>0)throw new v(n,"primitive types not expected to have type arguments");return new ge;case"u16":if(e.length>0)throw new v(n,"primitive types not expected to have type arguments");return new ut;case"u32":if(e.length>0)throw new v(n,"primitive types not expected to have type arguments");return new pt;case"u64":if(e.length>0)throw new v(n,"primitive types not expected to have type arguments");return new L;case"u128":if(e.length>0)throw new v(n,"primitive types not expected to have type arguments");return new dt;case"u256":if(e.length>0)throw new v(n,"primitive types not expected to have type arguments");return new lt;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(vs(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(!Oo(r[1]))throw new v(n,"module name must only contain alphanumeric or '_' characters");if(!Oo(r[2]))throw new v(n,"struct name must only contain alphanumeric or '_' characters");return new l(new be(u.fromString(r[0]),new E(r[1]),new E(r[2]),e))}}function Fo(n){return typeof n=="boolean"}function gt(n){return typeof n=="string"}function wn(n){return typeof n=="number"}function _n(n){return typeof n=="number"||typeof n=="bigint"||typeof n=="string"}function Mo(n){return n==null}function Ko(n){return Jn(n)||tr(n)||nr(n)||rr(n)||or(n)||ir(n)||sr(n)||Sn(n)||er(n)||Es(n)||n instanceof T||n instanceof Pe}function Jn(n){return n instanceof I}function Sn(n){return n instanceof u}function er(n){return n instanceof w}function Es(n){return n instanceof Be}function tr(n){return n instanceof k}function nr(n){return n instanceof re}function rr(n){return n instanceof oe}function or(n){return n instanceof G}function ir(n){return n instanceof ie}function sr(n){return n instanceof se}function qo(n){return"bytecode"in n}function P(n,e){throw new Error(`Type mismatch for argument ${e}, expected '${n}'`)}function $o(n){let e=n.params.findIndex(t=>t!=="signer"&&t!=="&signer");return e<0?n.params.length:e}function Nt(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 Is=new TextEncoder;function cr(n){return _nullishCoalesce(_optionalChain([n, 'optionalAccess', _83 => _83.map, 'call', _84 => _84(e=>gt(e)?Se(e):e)]), () => ([]))}async function Lo(n,e,t,r){let o=await pn({aptosConfig:r,accountAddress:n,moduleName:e});if(o.abi)return o.abi.exposed_functions.find(i=>i.name===t)}async function Vo(n,e,t,r){let o=await Lo(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=$o(o),s=[];for(let a=i;a<o.params.length;a+=1)s.push(Se(o.params[a],{allowGenerics:!0}));return{signers:i,typeParameters:o.generic_type_params,parameters:s}}async function Ho(n,e,t,r){let o=await Lo(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(Se(o.params[a],{allowGenerics:!0}));let s=[];for(let a=0;a<o.return.length;a+=1)s.push(Se(o.return[a],{allowGenerics:!0}));return{typeParameters:o.generic_type_params,parameters:i,returnTypes:s}}function ur(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 mt(t,i,r,o)}function mt(n,e,t,r){return Ko(n)?(ar(e,n,t),n):Us(n,e,t,r)}function Us(n,e,t,r){if(e.isBool()){if(Fo(n))return new I(n);P("boolean",t)}if(e.isAddress()){if(gt(n))return u.fromString(n);P("string | AccountAddress",t)}if(e.isU8()){if(wn(n))return new k(n);P("number",t)}if(e.isU16()){if(wn(n))return new re(n);P("number",t)}if(e.isU32()){if(wn(n))return new oe(n);P("number",t)}if(e.isU64()){if(_n(n))return new G(BigInt(n));P("bigint | number | string",t)}if(e.isU128()){if(_n(n))return new ie(BigInt(n));P("bigint | number | string",t)}if(e.isU256()){if(_n(n))return new se(BigInt(n));P("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 mt(n,r[o],t,r)}if(e.isVector()){if(e.value.isU8()){if(gt(n))return T.U8(Is.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=>mt(o,e.value,t,r)));throw new Error(`Type mismatch for argument ${t}, type '${e.toString()}'`)}if(e.isStruct()){if(e.isString()){if(gt(n))return new w(n);P("string",t)}if(e.isObject()){if(gt(n))return u.fromString(n);P("string | AccountAddress",t)}if(e.isOption())return Mo(n)?new Pe(null):new Pe(mt(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 ar(n,e,t){if(n.isBool()){if(Jn(e))return;P("Bool",t)}if(n.isAddress()){if(Sn(e))return;P("AccountAddress",t)}if(n.isU8()){if(tr(e))return;P("U8",t)}if(n.isU16()){if(nr(e))return;P("U16",t)}if(n.isU32()){if(rr(e))return;P("U32",t)}if(n.isU64()){if(or(e))return;P("U64",t)}if(n.isU128()){if(ir(e))return;P("U128",t)}if(n.isU256()){if(sr(e))return;P("U256",t)}if(n.isVector()){if(e instanceof T){e.values.length>0&&ar(n.value,e.values[0],t);return}P("MoveVector",t)}if(n instanceof l){if(n.isString()){if(er(e))return;P("MoveString",t)}if(n.isObject()){if(Sn(e))return;P("AccountAddress",t)}if(n.isOption()){if(e instanceof Pe){e.value!==void 0&&ar(n.value.typeArgs[0],e.value,t);return}P("MoveOption",t)}}throw new Error(`Type mismatch for argument ${t}, expected '${n.toString()}'`)}var xn=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=F.deserialize(e),r=e.deserializeVector(u),o=e.deserializeBool(),i;return o&&(i=u.deserialize(e)),new n(t,r,i)}};async function Cn(n){if(qo(n))return zs(n);let{moduleAddress:e,moduleName:t,functionName:r}=Nt(n.function),o=await Jo({key:"entry-function",moduleAddress:e,moduleName:t,functionName:r,aptosConfig:n.aptosConfig,abi:n.abi,fetch:Vo});return Rs({abi:o,...n})}function Rs(n){let e=n.abi,{moduleAddress:t,moduleName:r,functionName:o}=Nt(n.function),i=cr(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)=>ur(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 Et(new Ut(c,new Rt(a)))}return new Pt(a)}async function Wo(n){let{moduleAddress:e,moduleName:t,functionName:r}=Nt(n.function),o=await Jo({key:"view-function",moduleAddress:e,moduleName:t,functionName:r,aptosConfig:n.aptosConfig,abi:n.abi,fetch:Ho});return Ns({abi:o,...n})}function Ns(n){let e=n.abi,{moduleAddress:t,moduleName:r,functionName:o}=Nt(n.function),i=cr(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', _85 => _85.functionArguments, 'optionalAccess', _86 => _86.map, 'call', _87 => _87((a,c)=>ur(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 zs(n){return new Ct(new It(h.fromHexInput(n.bytecode).toUint8Array(),_nullishCoalesce(n.typeArguments, () => ([])),n.functionArguments))}async function Gs(n){let{aptosConfig:e,sender:t,payload:r,options:o,feePayerAddress:i}=n,s=Bn[e.network]?Promise.resolve({chain_id:Bn[e.network]}):sn({aptosConfig:e}),a=_optionalChain([o, 'optionalAccess', _88 => _88.gasUnitPrice])?Promise.resolve({gas_estimate:o.gasUnitPrice}):ln({aptosConfig:e}),[{chain_id:c},{gas_estimate:p}]=await Promise.all([s,a]),f=_optionalChain([o, 'optionalAccess', _89 => _89.accountSequenceNumber])!==void 0?Promise.resolve({sequence_number:o.accountSequenceNumber}):le({aptosConfig:e,accountAddress:t}),C;if(i&&u.from(i).equals(u.ZERO))try{let{sequence_number:Tt}=await f;C=Tt}catch (e2){C="0"}else{let{sequence_number:Tt}=await f;C=Tt}let{maxGasAmount:y,gasUnitPrice:g,expireTimestamp:Ge}={maxGasAmount:_optionalChain([o, 'optionalAccess', _90 => _90.maxGasAmount])?BigInt(o.maxGasAmount):BigInt(2e5),gasUnitPrice:BigInt(p),expireTimestamp:BigInt(Math.floor(Date.now()/1e3)+20),...o};return new F(u.from(t),BigInt(C),r,BigInt(y),BigInt(g),BigInt(Ge),new ct(c))}async function pr(n){let{aptosConfig:e,sender:t,payload:r,options:o,feePayerAddress:i}=n,s=await Gs({aptosConfig:e,sender:t,payload:r,options:o,feePayerAddress:i});if("secondarySignerAddresses"in n){let a=_nullishCoalesce(_optionalChain([n, 'access', _91 => _91.secondarySignerAddresses, 'optionalAccess', _92 => _92.map, 'call', _93 => _93(c=>u.from(c))]), () => ([]));return new xn(s,a,n.feePayerAddress?u.from(n.feePayerAddress):void 0)}return new Tn(s,n.feePayerAddress?u.from(n.feePayerAddress):void 0)}function jo(n){let{signerPublicKey:e,transaction:t,secondarySignersPublicKeys:r,feePayerPublicKey:o}=n,i=vn(e);if(t.feePayerAddress){let a=new _e(t.rawTransaction,_nullishCoalesce(t.secondarySignerAddresses, () => ([])),t.feePayerAddress),c=[];r&&(c=r.map(C=>vn(C)));let p=vn(o),f=new st(i,_nullishCoalesce(t.secondarySignerAddresses, () => ([])),c,{address:t.feePayerAddress,authenticator:p});return new me(a.raw_txn,f).bcsToBytes()}if(t.secondarySignerAddresses){let a=new we(t.rawTransaction,t.secondarySignerAddresses),c=[];c=r.map(f=>vn(f));let p=new it(i,t.secondarySignerAddresses,c);return new me(a.raw_txn,p).bcsToBytes()}let s;if(i instanceof de)s=new ot(i.public_key,i.signature);else if(i instanceof ae)s=new at(i);else throw new Error("Invalid public key");return new me(t.rawTransaction,s).bcsToBytes()}function vn(n){if(n instanceof $){if(n.publicKey instanceof U)return new ae(n,new B(new R(new Uint8Array(64))));if(n.publicKey instanceof fe)return new ae(n,new B(new he(new Uint8Array(64))))}return new de(new U(n.toUint8Array()),new R(new Uint8Array(64)))}function Xo(n){let{signer:e,transaction:t}=n,r=lr(t);return e.signWithAuthenticator(r)}function dr(n){let{transaction:e,senderAuthenticator:t,feePayerAuthenticator:r,additionalSignersAuthenticators:o}=n,i=Zo(e);if((r||o)&&(i instanceof we||i instanceof _e))return Ds(i,t,r,o);if(t instanceof de&&i instanceof F){let s=new ot(t.public_key,t.signature);return new me(i,s).bcsToBytes()}if((t instanceof ae||t instanceof Ze)&&i instanceof F){let s=new at(t);return new me(i,s).bcsToBytes()}throw new Error(`Cannot generate a signed transaction, ${t} is not a supported account authentication scheme`)}function Yo(n){let e=_sha3.sha3_256.create();for(let t of n)e.update(t);return e.digest()}var ks=Yo(["APTOS::Transaction"]);function km(n){let e=dr(n);return new h(Yo([ks,new Uint8Array([0]),e])).toString()}function Zo(n){return n.feePayerAddress?new _e(n.rawTransaction,_nullishCoalesce(n.secondarySignerAddresses, () => ([])),n.feePayerAddress):n.secondarySignerAddresses?new we(n.rawTransaction,n.secondarySignerAddresses):n.rawTransaction}function Ds(n,e,t,r){if(n instanceof _e){if(!t)throw new Error("Must provide a feePayerAuthenticator argument to generate a signed fee payer transaction");let o=new st(e,n.secondary_signer_addresses,_nullishCoalesce(r, () => ([])),{address:n.fee_payer_address,authenticator:t});return new me(n.raw_txn,o).bcsToBytes()}if(n instanceof we){if(!r)throw new Error("Must provide a additionalSignersAuthenticators argument to generate a signed multi agent transaction");let o=new it(e,n.secondary_signer_addresses,_nullishCoalesce(r, () => ([])));return new me(n.raw_txn,o).bcsToBytes()}throw new Error(`Cannot prepare multi signers transaction to submission, ${typeof n} transaction is not supported`)}function lr(n){let e=Zo(n),t=_sha3.sha3_256.create();if(e instanceof F)t.update(Or);else if(e instanceof we)t.update(Fn);else if(e instanceof _e)t.update(Fn);else throw new Error(`Unknown transaction type to sign on: ${e}`);let r=t.digest(),o=e.bcsToBytes(),i=new Uint8Array(r.length+o.length);return i.set(r),i.set(o,r.length),i}async function Jo({key:n,moduleAddress:e,moduleName:t,functionName:r,aptosConfig:o,abi:i,fetch:s}){return i||nt(async()=>s(e,t,r,o),`${n}-${o.network}-${e}-${t}-${r}`,1e3*60*5)()}async function A(n){let e=await Os(n);return Bs(n,e)}async function Os(n){let{aptosConfig:e,data:t}=n,r,o;return"bytecode"in t?o=await Cn(t):"multisigAddress"in t?(r={aptosConfig:e,multisigAddress:t.multisigAddress,function:t.function,functionArguments:t.functionArguments,typeArguments:t.typeArguments},o=await Cn(r)):(r={aptosConfig:e,function:t.function,functionArguments:t.functionArguments,typeArguments:t.typeArguments},o=await Cn(r)),o}async function Bs(n,e){let{aptosConfig:t,sender:r,options:o}=n,i;if(Fs(n)&&(i=u.ZERO.toString()),Ms(n)){let{secondarySignerAddresses:s}=n;return pr({aptosConfig:t,sender:r,payload:e,options:o,secondarySignerAddresses:s,feePayerAddress:i})}return pr({aptosConfig:t,sender:r,payload:e,options:o,feePayerAddress:i})}function Fs(n){return n.withFeePayer===!0}function Ms(n){return"secondarySignerAddresses"in n}function ei(n){let{transaction:e}=n;return lr(e)}function Pn(n){return Xo({...n})}async function gr(n){let{aptosConfig:e,transaction:t,signerPublicKey:r,secondarySignersPublicKeys:o,feePayerPublicKey:i,options:s}=n,a=jo({transaction:t,signerPublicKey:r,secondarySignersPublicKeys:o,feePayerPublicKey:i,options:s}),{data:c}=await ke({aptosConfig:e,body:a,path:"transactions/simulate",params:{estimate_gas_unit_price:_nullishCoalesce(_optionalChain([n, 'access', _94 => _94.options, 'optionalAccess', _95 => _95.estimateGasUnitPrice]), () => (!1)),estimate_max_gas_amount:_nullishCoalesce(_optionalChain([n, 'access', _96 => _96.options, 'optionalAccess', _97 => _97.estimateMaxGasAmount]), () => (!1)),estimate_prioritized_gas_unit_price:_nullishCoalesce(_optionalChain([n, 'access', _98 => _98.options, 'optionalAccess', _99 => _99.estimatePrioritizedGasUnitPrice]), () => (!1))},originMethod:"simulateTransaction",contentType:"application/x.aptos.signed_transaction+bcs"});return c}async function En(n){let{aptosConfig:e}=n,t=dr({...n}),{data:r}=await ke({aptosConfig:e,body:t,path:"transactions",originMethod:"submitTransaction",contentType:"application/x.aptos.signed_transaction+bcs"});return r}async function zt(n){let{aptosConfig:e,signer:t,transaction:r}=n,o=Pn({signer:t,transaction:r});return En({aptosConfig:e,transaction:r,senderAuthenticator:o})}var Ks={typeParameters:[],parameters:[x.u8(),new x(x.u8())]};async function ti(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:Ks},options:i})}var qs={typeParameters:[],parameters:[new ge,x.u8(),new ge,x.u8(),x.u8(),x.u8()]};async function ni(n){let{aptosConfig:e,fromAccount:t,toNewPrivateKey:r}=n,o=await le({aptosConfig:e,accountAddress:t.accountAddress}),i=Ie.fromPrivateKey({privateKey:r,legacy:!0}),a=new An({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 k(t.signingScheme),T.U8(t.publicKey.toUint8Array()),new k(i.signingScheme),T.U8(i.publicKey.toUint8Array()),T.U8(c.toUint8Array()),T.U8(p.toUint8Array())],abi:qs}});return zt({aptosConfig:e,signer:t,transaction:f})}var $s={typeParameters:[{constraints:[]}],parameters:[new W,new L]};async function ri(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, () => (Qt))],functionArguments:[r,o],abi:$s},options:s})}var Gt=class{constructor(e){this.config=e}async transferCoinTransaction(e){return ri({aptosConfig:this.config,...e})}};var Re={BOOLEAN:"bool",U8:"u8",U16:"u16",U32:"u32",U64:"u64",U128:"u128",U256:"u256",ADDRESS:"address",STRING:"0x1::string::String",ARRAY:"vector<u8>"},te="0x4::token::Token";async function oi(n){let{aptosConfig:e,digitalAssetAddress:t}=n,r={token_data_id:{_eq:u.from(t).toStringLong()}};return(await m({aptosConfig:e,query:{query:Ao,variables:{where_condition:r}},originMethod:"getDigitalAssetData"})).current_token_datas_v2[0]}async function ii(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:Hn,variables:{where_condition:r}},originMethod:"getCurrentDigitalAssetOwnership"})).current_token_ownerships_v2[0]}async function si(n){let{aptosConfig:e,ownerAddress:t,options:r}=n,o={owner_address:{_eq:u.from(t).toStringLong()},amount:{_gt:0}},i={query:Hn,variables:{where_condition:o,offset:_optionalChain([r, 'optionalAccess', _100 => _100.offset]),limit:_optionalChain([r, 'optionalAccess', _101 => _101.limit]),order_by:_optionalChain([r, 'optionalAccess', _102 => _102.orderBy])}};return(await m({aptosConfig:e,query:i,originMethod:"getOwnedDigitalAssets"})).current_token_ownerships_v2}async function ai(n){let{aptosConfig:e,digitalAssetAddress:t,options:r}=n,o={token_data_id:{_eq:u.from(t).toStringLong()}},i={query:yo,variables:{where_condition:o,offset:_optionalChain([r, 'optionalAccess', _103 => _103.offset]),limit:_optionalChain([r, 'optionalAccess', _104 => _104.limit]),order_by:_optionalChain([r, 'optionalAccess', _105 => _105.orderBy])}};return(await m({aptosConfig:e,query:i,originMethod:"getDigitalAssetActivity"})).token_activities_v2}var Ls={typeParameters:[],parameters:[new l(S()),new L,new l(S()),new l(S()),new D,new D,new D,new D,new D,new D,new D,new D,new D,new L,new L]};async function ci(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 G(_nullishCoalesce(n.maxSupply, () => (De))),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 G(_nullishCoalesce(n.royaltyNumerator, () => (0))),new G(_nullishCoalesce(n.royaltyDenominator, () => (1)))],abi:Ls},options:t})}async function mr(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', _106 => _106.tokenStandard])&&(s.token_standard={_eq:_nullishCoalesce(_optionalChain([o, 'optionalAccess', _107 => _107.tokenStandard]), () => ("v2"))}),(await m({aptosConfig:e,query:{query:$n,variables:{where_condition:s}},originMethod:"getCollectionData"})).current_collections_v2[0]}async function ui(n){let{aptosConfig:e,collectionId:t}=n,o={collection_id:{_eq:u.from(t).toStringLong()}};return(await m({aptosConfig:e,query:{query:$n,variables:{where_condition:o}},originMethod:"getCollectionData"})).current_collections_v2[0]}async function pi(n){return(await mr(n)).collection_id}var Vs={typeParameters:[],parameters:[new l(S()),new l(S()),new l(S()),new l(S()),new x(new l(S())),new x(new l(S())),new x(x.u8())]};async function di(n){let{aptosConfig:e,options:t,creator:r,collection:o,description:i,name:s,uri:a,propertyKeys:c,propertyTypes:p,propertyValues:f}=n,C=_optionalChain([p, 'optionalAccess', _108 => _108.map, 'call', _109 => _109(y=>Re[y])]);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(C, () => ([]))),vi(_nullishCoalesce(f, () => ([])),_nullishCoalesce(C, () => ([])))],abi:Vs},options:t})}var Hs={typeParameters:[{constraints:["key"]}],parameters:[new l(j(new z(0))),new W]};async function li(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, () => (te))],functionArguments:[u.from(r),u.from(o)],abi:Hs},options:s})}var Qs={typeParameters:[],parameters:[new l(S()),new l(S()),new l(S()),new l(S()),new x(new l(S())),new x(new l(S())),new x(x.u8()),new W]};async function gi(n){let{aptosConfig:e,account:t,collection:r,description:o,name:i,uri:s,recipient:a,propertyKeys:c,propertyTypes:p,propertyValues:f,options:C}=n;if(_optionalChain([c, 'optionalAccess', _110 => _110.length])!==_optionalChain([f, 'optionalAccess', _111 => _111.length]))throw new Error("Property keys and property values counts do not match");if(_optionalChain([p, 'optionalAccess', _112 => _112.length])!==_optionalChain([f, 'optionalAccess', _113 => _113.length]))throw new Error("Property types and property values counts do not match");let y=_optionalChain([p, 'optionalAccess', _114 => _114.map, 'call', _115 => _115(g=>Re[g])]);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(y, () => ([]))),vi(_nullishCoalesce(f, () => ([])),_nullishCoalesce(y, () => ([]))),a],abi:Qs},options:C})}var Ws={typeParameters:[{constraints:["key"]}],parameters:[new l(j(new z(0)))]};async function mi(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, () => (te))],functionArguments:[u.from(r)],abi:Ws},options:i})}var js={typeParameters:[{constraints:["key"]}],parameters:[new l(j(new z(0)))]};async function yi(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, () => (te))],functionArguments:[r],abi:js},options:i})}var Xs={typeParameters:[{constraints:["key"]}],parameters:[new l(j(new z(0)))]};async function Ai(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, () => (te))],functionArguments:[r],abi:Xs},options:i})}var Ys={typeParameters:[{constraints:["key"]}],parameters:[new l(j(new z(0))),new l(S())]};async function fi(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, () => (te))],functionArguments:[u.from(o),new w(r)],abi:Ys},options:s})}var Zs={typeParameters:[{constraints:["key"]}],parameters:[new l(j(new z(0))),new l(S())]};async function hi(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, () => (te))],functionArguments:[u.from(o),new w(r)],abi:Zs},options:s})}var Js={typeParameters:[{constraints:["key"]}],parameters:[new l(j(new z(0))),new l(S())]};async function Ti(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, () => (te))],functionArguments:[u.from(o),new w(r)],abi:Js},options:s})}var ea={typeParameters:[{constraints:["key"]}],parameters:[new l(j(new z(0))),new l(S()),new l(S()),x.u8()]};async function bi(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, () => (te))],functionArguments:[u.from(s),new w(r),new w(Re[o]),T.U8(yr(i,Re[o]))],abi:ea},options:c})}var ta={typeParameters:[{constraints:["key"]}],parameters:[new l(j(new z(0))),new l(S())]};async function wi(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, () => (te))],functionArguments:[u.from(o),new w(r)],abi:ta},options:s})}var na={typeParameters:[{constraints:["key"]}],parameters:[new l(j(new z(0))),new l(S()),new l(S()),x.u8()]};async function _i(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, () => (te))],functionArguments:[u.from(s),new w(r),new w(Re[o]),yr(i,Re[o])],abi:na},options:c})}var ra={typeParameters:[{constraints:["key"]},{constraints:[]}],parameters:[new l(j(new z(0))),new l(S()),new z(1)]};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_typed_property",typeArguments:[_nullishCoalesce(a, () => (te)),Re[o]],functionArguments:[u.from(s),new w(r),i],abi:ra},options:c})}var oa={typeParameters:[{constraints:["key"]},{constraints:[]}],parameters:[new l(j(new z(0))),new l(S()),new z(1)]};async function xi(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, () => (te)),Re[o]],functionArguments:[u.from(s),new w(r),i],abi:oa},options:c})}function vi(n,e){let t=new Array;return e.forEach((r,o)=>{t.push(yr(n[o],r))}),t}function yr(n,e){let t=Se(e);return mt(n,t,0,[]).bcsToBytes()}var kt=class{constructor(e){this.config=e}async getCollectionData(e){return await b({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),mr({aptosConfig:this.config,...e})}async getCollectionDataByCollectionId(e){return await b({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),ui({aptosConfig:this.config,...e})}async getCollectionId(e){return await b({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),pi({aptosConfig:this.config,...e})}async getDigitalAssetData(e){return await b({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),oi({aptosConfig:this.config,...e})}async getCurrentDigitalAssetOwnership(e){return await b({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),ii({aptosConfig:this.config,...e})}async getOwnedDigitalAssets(e){return await b({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),si({aptosConfig:this.config,...e})}async getDigitalAssetActivity(e){return await b({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),ai({aptosConfig:this.config,...e})}async createCollectionTransaction(e){return ci({aptosConfig:this.config,...e})}async mintDigitalAssetTransaction(e){return di({aptosConfig:this.config,...e})}async transferDigitalAssetTransaction(e){return li({aptosConfig:this.config,...e})}async mintSoulBoundTransaction(e){return gi({aptosConfig:this.config,...e})}async burnDigitalAssetTransaction(e){return mi({aptosConfig:this.config,...e})}async freezeDigitalAssetTransaferTransaction(e){return yi({aptosConfig:this.config,...e})}async unfreezeDigitalAssetTransaferTransaction(e){return Ai({aptosConfig:this.config,...e})}async setDigitalAssetDescriptionTransaction(e){return fi({aptosConfig:this.config,...e})}async setDigitalAssetNameTransaction(e){return hi({aptosConfig:this.config,...e})}async setDigitalAssetURITransaction(e){return Ti({aptosConfig:this.config,...e})}async addDigitalAssetPropertyTransaction(e){return bi({aptosConfig:this.config,...e})}async removeDigitalAssetPropertyTransaction(e){return wi({aptosConfig:this.config,...e})}async updateDigitalAssetPropertyTransaction(e){return _i({aptosConfig:this.config,...e})}async addDigitalAssetTypedPropertyTransaction(e){return Si({aptosConfig:this.config,...e})}async updateDigitalAssetTypedPropertyTransaction(e){return xi({aptosConfig:this.config,...e})}};var Ci=300,ia=n=>{if(n&&n.length>Ci)throw new Error(`Event type length exceeds the maximum length of ${Ci}`)};async function Pi(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', _116 => _116.orderBy])};return Dt({aptosConfig:e,options:i})}async function Ei(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', _117 => _117.orderBy])};return Dt({aptosConfig:t,options:a})}async function Ii(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', _118 => _118.orderBy])};return Dt({aptosConfig:t,options:a})}async function Dt(n){let{aptosConfig:e,options:t}=n;ia(_optionalChain([t, 'optionalAccess', _119 => _119.where, 'optionalAccess', _120 => _120.indexed_type, 'optionalAccess', _121 => _121._eq]));let r={query:lo,variables:{where_condition:_optionalChain([t, 'optionalAccess', _122 => _122.where]),offset:_optionalChain([t, 'optionalAccess', _123 => _123.offset]),limit:_optionalChain([t, 'optionalAccess', _124 => _124.limit]),order_by:_optionalChain([t, 'optionalAccess', _125 => _125.orderBy])}};return(await m({aptosConfig:e,query:r,originMethod:"getEvents"})).events}var Ot=class{constructor(e){this.config=e}async getModuleEventsByEventType(e){return await b({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"events_processor"}),Pi({aptosConfig:this.config,...e})}async getAccountEventsByCreationNumber(e){return await b({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"events_processor"}),Ei({aptosConfig:this.config,...e})}async getAccountEventsByEventType(e){return await b({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"events_processor"}),Ii({aptosConfig:this.config,...e})}async getEvents(e){return await b({config:this.config,minimumLedgerVersion:_optionalChain([e, 'optionalAccess', _126 => _126.minimumLedgerVersion]),processorType:"events_processor"}),Dt({aptosConfig:this.config,...e})}};async function Ui(n){let{aptosConfig:e,accountAddress:t,amount:r,options:o}=n,i=_optionalChain([o, 'optionalAccess', _127 => _127.timeoutSecs])||20,{data:s}=await Kr({aptosConfig:e,path:"fund",body:{address:u.from(t).toString(),amount:r},originMethod:"fundAccount"}),a=s.txn_hashes[0],c=await rt({aptosConfig:e,transactionHash:a,options:{timeoutSecs:i,checkSuccess:_optionalChain([o, 'optionalAccess', _128 => _128.checkSuccess])}});if(c.type==="user_transaction")return c;throw new Error(`Unexpected transaction received for fund account: ${c.type}`)}var Bt=class{constructor(e){this.config=e}async fundAccount(e){let t=await Ui({aptosConfig:this.config,...e});return _optionalChain([e, 'access', _129 => _129.options, 'optionalAccess', _130 => _130.waitForIndexer])!==!1&&await mn({aptosConfig:this.config,minimumLedgerVersion:BigInt(t.version)}),t}};async function Ar(n){let{aptosConfig:e,options:t}=n,r={query:mo,variables:{where_condition:_optionalChain([t, 'optionalAccess', _131 => _131.where]),limit:_optionalChain([t, 'optionalAccess', _132 => _132.limit]),offset:_optionalChain([t, 'optionalAccess', _133 => _133.offset])}};return(await m({aptosConfig:e,query:r,originMethod:"getFungibleAssetMetadata"})).fungible_asset_metadata}async function Ri(n){let{aptosConfig:e,options:t}=n,r={query:go,variables:{where_condition:_optionalChain([t, 'optionalAccess', _134 => _134.where]),limit:_optionalChain([t, 'optionalAccess', _135 => _135.limit]),offset:_optionalChain([t, 'optionalAccess', _136 => _136.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:uo,variables:{where_condition:_optionalChain([t, 'optionalAccess', _137 => _137.where]),limit:_optionalChain([t, 'optionalAccess', _138 => _138.limit]),offset:_optionalChain([t, 'optionalAccess', _139 => _139.offset])}};return(await m({aptosConfig:e,query:r,originMethod:"getCurrentFungibleAssetBalances"})).current_fungible_asset_balances}var sa={typeParameters:[],parameters:[Se("0x1::object::Object"),new W,new L]};async function zi(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:sa},options:s})}var Ft=class{constructor(e){this.config=e}async getFungibleAssetMetadata(e){return await b({config:this.config,minimumLedgerVersion:_optionalChain([e, 'optionalAccess', _140 => _140.minimumLedgerVersion]),processorType:"fungible_asset_processor"}),Ar({aptosConfig:this.config,...e})}async getFungibleAssetMetadataByAssetType(e){return await b({config:this.config,minimumLedgerVersion:_optionalChain([e, 'optionalAccess', _141 => _141.minimumLedgerVersion]),processorType:"fungible_asset_processor"}),(await Ar({aptosConfig:this.config,options:{where:{asset_type:{_eq:e.assetType}}}}))[0]}async getFungibleAssetActivities(e){return await b({config:this.config,minimumLedgerVersion:_optionalChain([e, 'optionalAccess', _142 => _142.minimumLedgerVersion]),processorType:"fungible_asset_processor"}),Ri({aptosConfig:this.config,...e})}async getCurrentFungibleAssetBalances(e){return await b({config:this.config,minimumLedgerVersion:_optionalChain([e, 'optionalAccess', _143 => _143.minimumLedgerVersion]),processorType:"fungible_asset_processor"}),Ni({aptosConfig:this.config,...e})}async transferFungibleAsset(e){return zi({aptosConfig:this.config,...e})}};async function Ne(n){let{aptosConfig:e,payload:t,options:r}=n,o=await Wo({...t,aptosConfig:e}),i=new Y;o.serialize(i);let s=i.toUint8Array(),{data:a}=await ke({aptosConfig:e,path:"view",originMethod:"view",contentType:"application/x.aptos.view_function+bcs",params:{ledger_version:_optionalChain([r, 'optionalAccess', _144 => _144.ledgerVersion])},body:s});return a}var Mt=class{constructor(e){this.config=e}async getLedgerInfo(){return sn({aptosConfig:this.config})}async getChainId(){return(await this.getLedgerInfo()).chain_id}async getBlockByVersion(e){return fo({aptosConfig:this.config,...e})}async getBlockByHeight(e){return ho({aptosConfig:this.config,...e})}async getTableItem(e){return an({aptosConfig:this.config,...e})}async view(e){return Ne({aptosConfig:this.config,...e})}async getChainTopUserTransactions(e){return To({aptosConfig:this.config,...e})}async queryIndexer(e){return m({aptosConfig:this.config,...e})}async getIndexerLastSuccessVersion(){return cn({aptosConfig:this.config})}async getProcessorStatus(e){return un({aptosConfig:this.config,processorType:e})}};var Gi=["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 ki(n){return!(!n||n.length<3||n.length>63||!/^[a-z\d][a-z\d-]{1,61}[a-z\d]$/.test(n))}function ze(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(!ki(e))throw new Error(`${e} is not valid. ${Gi}`);if(t&&!ki(t))throw new Error(`${t} is not valid. ${Gi}`);return{domainName:t||e,subdomainName:t?e:void 0}}var aa="0x585fc9f0f0c54183b039ffc770ca282ebd87307916c215a3e692f2f8e4305e82",ca={testnet:"0x5f8fd2347449685cf41d4db97926ec3a096eaf381332be4f1318ad4d16a8497c",mainnet:"0x867ed1f6bf916171b1de3ee92849b8978b7d1b9e0a8cc982a3d19d535dfd9c0c",local:aa,custom:null,devnet:null,randomnet:null};function xe(n){let e=ca[n.network];if(!e)throw new Error(`The ANS contract is not deployed to ${n.network}`);return e}var In=n=>{if(n&&typeof n=="object"&&"vec"in n&&Array.isArray(n.vec))return n.vec[0]};async function Di(n){let{aptosConfig:e,name:t}=n,r=xe(e),{domainName:o,subdomainName:i}=ze(t),s=await Ne({aptosConfig:e,payload:{function:`${r}::router::get_owner_addr`,functionArguments:[o,i]}}),a=In(s[0]);return a?u.from(a):void 0}async function Oi(n){let{aptosConfig:e,expiration:t,name:r,sender:o,targetAddress:i,toAddress:s,options:a,transferable:c}=n,p=xe(e),{domainName:f,subdomainName:C}=ze(r),y=t.policy==="subdomain:independent"||t.policy==="subdomain:follow-domain";if(C&&!y)throw new Error("Subdomains must have an expiration policy of either 'subdomain:independent' or 'subdomain:follow-domain'");if(y&&!C)throw new Error(`Policy is set to ${t.policy} but no subdomain was provided`);if(t.policy==="domain"){let wr=_nullishCoalesce(t.years, () => (1));if(wr!==1)throw new Error("For now, names can only be registered for 1 year at a time");let Ji=wr*31536e3;return await A({aptosConfig:e,sender:o.accountAddress.toString(),data:{function:`${p}::router::register_domain`,functionArguments:[f,Ji,i,s]},options:a})}if(!C)throw new Error(`${t.policy} requires a subdomain to be provided.`);let g=await fr({aptosConfig:e,name:f});if(!g)throw new Error("The domain does not exist");let Ge=t.policy==="subdomain:independent"?t.expirationDate:g;if(Ge>g)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,C,Math.round(Ge/1e3),t.policy==="subdomain:follow-domain"?1:0,!!c,i,s]},options:a})}async function fr(n){let{aptosConfig:e,name:t}=n,r=xe(e),{domainName:o,subdomainName:i}=ze(t);try{let s=await Ne({aptosConfig:e,payload:{function:`${r}::router::get_expiration`,functionArguments:[o,i]}});return Number(s[0])*1e3}catch (e3){return}}async function Bi(n){let{aptosConfig:e,address:t}=n,r=xe(e),o=await Ne({aptosConfig:e,payload:{function:`${r}::router::get_primary_name`,functionArguments:[u.from(t).toString()]}}),i=In(o[1]),s=In(o[0]);if(i)return[s,i].filter(Boolean).join(".")}async function Fi(n){let{aptosConfig:e,sender:t,name:r,options:o}=n,i=xe(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}=ze(r);return await A({aptosConfig:e,sender:t.accountAddress.toString(),data:{function:`${i}::router::set_primary_name`,functionArguments:[s,a]},options:o})}async function Mi(n){let{aptosConfig:e,name:t}=n,r=xe(e),{domainName:o,subdomainName:i}=ze(t),s=await Ne({aptosConfig:e,payload:{function:`${r}::router::get_target_addr`,functionArguments:[o,i]}}),a=In(s[0]);return a?u.from(a):void 0}async function Ki(n){let{aptosConfig:e,sender:t,name:r,address:o,options:i}=n,s=xe(e),{domainName:a,subdomainName:c}=ze(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 qi(n){let{aptosConfig:e,name:t}=n,{domainName:r,subdomainName:o=""}=ze(t),a=(await m({aptosConfig:e,query:{query:tt,variables:{where_condition:{domain:{_eq:r},subdomain:{_eq:o},is_active:{_eq:!0}},limit:1}},originMethod:"getName"})).current_aptos_names[0];return a&&(a=Kt(a)),a}async function $i(n){let{aptosConfig:e,options:t,accountAddress:r}=n,o=await hr({aptosConfig:e});return(await m({aptosConfig:e,originMethod:"getAccountNames",query:{query:tt,variables:{limit:_optionalChain([t, 'optionalAccess', _145 => _145.limit]),offset:_optionalChain([t, 'optionalAccess', _146 => _146.offset]),order_by:_optionalChain([t, 'optionalAccess', _147 => _147.orderBy]),where_condition:{..._nullishCoalesce(_optionalChain([n, 'access', _148 => _148.options, 'optionalAccess', _149 => _149.where]), () => ({})),owner_address:{_eq:r.toString()},expiration_timestamp:{_gte:o}}}}})).current_aptos_names.map(Kt)}async function Li(n){let{aptosConfig:e,options:t,accountAddress:r}=n,o=await hr({aptosConfig:e});return(await m({aptosConfig:e,originMethod:"getAccountDomains",query:{query:tt,variables:{limit:_optionalChain([t, 'optionalAccess', _150 => _150.limit]),offset:_optionalChain([t, 'optionalAccess', _151 => _151.offset]),order_by:_optionalChain([t, 'optionalAccess', _152 => _152.orderBy]),where_condition:{..._nullishCoalesce(_optionalChain([n, 'access', _153 => _153.options, 'optionalAccess', _154 => _154.where]), () => ({})),owner_address:{_eq:r.toString()},expiration_timestamp:{_gte:o},subdomain:{_eq:""}}}}})).current_aptos_names.map(Kt)}async function Vi(n){let{aptosConfig:e,options:t,accountAddress:r}=n,o=await hr({aptosConfig:e});return(await m({aptosConfig:e,originMethod:"getAccountSubdomains",query:{query:tt,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},subdomain:{_neq:""}}}}})).current_aptos_names.map(Kt)}async function Hi(n){let{aptosConfig:e,options:t,domain:r}=n;return(await m({aptosConfig:e,originMethod:"getDomainSubdomains",query:{query:tt,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]), () => ({})),domain:{_eq:r},subdomain:{_neq:""},is_active:{_eq:!0}}}}})).current_aptos_names.map(Kt)}async function hr(n){let{aptosConfig:e}=n,t=xe(e),[r]=await Ne({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 Qi(n){let{aptosConfig:e,sender:t,name:r,years:o=1,options:i}=n,s=xe(e),a=o*31536e3,{domainName:c,subdomainName:p}=ze(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 Kt(n){return{...n,expiration_timestamp:new Date(n.expiration_timestamp).getTime()}}var qt=class{constructor(e){this.config=e}async getOwnerAddress(e){return Di({aptosConfig:this.config,...e})}async getExpiration(e){return fr({aptosConfig:this.config,...e})}async getTargetAddress(e){return Mi({aptosConfig:this.config,...e})}async setTargetAddress(e){return Ki({aptosConfig:this.config,...e})}async getPrimaryName(e){return Bi({aptosConfig:this.config,...e})}async setPrimaryName(e){return Fi({aptosConfig:this.config,...e})}async registerName(e){return Oi({aptosConfig:this.config,...e})}async renewDomain(e){return Qi({aptosConfig:this.config,...e})}async getName(e){return qi({aptosConfig:this.config,...e})}async getAccountNames(e){return $i({aptosConfig:this.config,...e})}async getAccountDomains(e){return Li({aptosConfig:this.config,...e})}async getAccountSubdomains(e){return Vi({aptosConfig:this.config,...e})}async getDomainSubdomains(e){return Hi({aptosConfig:this.config,...e})}};async function Wi(n){let{aptosConfig:e,poolAddress:t}=n,r=u.from(t).toStringLong(),i=await m({aptosConfig:e,query:{query:Ln,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 ji(n){let{aptosConfig:e,options:t}=n,r={query:Ln,variables:{order_by:_optionalChain([t, 'optionalAccess', _165 => _165.orderBy])}};return(await m({aptosConfig:e,query:r})).num_active_delegator_per_pool}async function Xi(n){let{aptosConfig:e,delegatorAddress:t,poolAddress:r}=n,o={query:po,variables:{delegatorAddress:u.from(t).toStringLong(),poolAddress:u.from(r).toStringLong()}};return(await m({aptosConfig:e,query:o})).delegated_staking_activities}var $t=class{constructor(e){this.config=e}async getNumberOfDelegators(e){return await b({config:this.config,minimumLedgerVersion:_optionalChain([e, 'optionalAccess', _166 => _166.minimumLedgerVersion]),processorType:"stake_processor"}),Wi({aptosConfig:this.config,...e})}async getNumberOfDelegatorsForAllPools(e){return await b({config:this.config,minimumLedgerVersion:_optionalChain([e, 'optionalAccess', _167 => _167.minimumLedgerVersion]),processorType:"stake_processor"}),ji({aptosConfig:this.config,...e})}async getDelegatedStakingActivities(e){return await b({config:this.config,minimumLedgerVersion:_optionalChain([e, 'optionalAccess', _168 => _168.minimumLedgerVersion]),processorType:"stake_processor"}),Xi({aptosConfig:this.config,...e})}};var Un=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 Tr(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 br(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 yt=class{constructor(e){this.config=e}async simple(e){return gr({aptosConfig:this.config,...e})}async multiAgent(e){return gr({aptosConfig:this.config,...e})}};M([br],yt.prototype,"simple",1),M([br],yt.prototype,"multiAgent",1);var At=class{constructor(e){this.config=e}async simple(e){return En({aptosConfig:this.config,...e})}async multiAgent(e){return En({aptosConfig:this.config,...e})}};M([Tr],At.prototype,"simple",1),M([Tr],At.prototype,"multiAgent",1);var _eventemitter3 = require('eventemitter3'); var _eventemitter32 = _interopRequireDefault(_eventemitter3);var Rn=()=>Math.floor(Date.now()/1e3),Nn= 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 Ue(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=Rn();for(;this.currentNumber-this.lastUncommintedNumber>=this.maximumInFlight;)await Ue(this.sleepTime),Rn()-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 le({aptosConfig:this.aptosConfig,accountAddress:this.account.accountAddress});this.currentNumber=BigInt(e),this.lastUncommintedNumber=BigInt(e)}async update(){let{sequence_number:e}=await le({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 Ue(this.sleepTime);this.lock=!0;try{await this.update();let e=Rn();for(;this.lastUncommintedNumber!==this.currentNumber;)Rn()-e>this.maxWaitTime?(console.warn(`Waited over 30 seconds for a transaction to commit, resyncing ${this.account.accountAddress.toString()}`),await this.initialize()):(await Ue(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 ft=class{constructor(){this.queue=[];this.pendingDequeue=[];this.cancelled=!1}enqueue(e){if(this.cancelled=!1,this.pendingDequeue.length>0){_optionalChain([this, 'access', _169 => _169.pendingDequeue, 'access', _170 => _170.shift, 'call', _171 => _171(), 'optionalAccess', _172 => _172.resolve, 'call', _173 => _173(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 ht("Task cancelled"))}),this.pendingDequeue=[],this.queue.length=0}isCancelled(){return this.cancelled}pendingDequeueLength(){return this.pendingDequeue.length}},ht=class extends Error{};var Yi="fulfilled",Zi= exports.TransactionWorkerEventsEnum =(i=>(i.TransactionSent="transactionSent",i.TransactionSendFailed="transactionSendFailed",i.TransactionExecuted="transactionExecuted",i.TransactionExecutionFailed="transactionExecutionFailed",i.ExecutionFinish="executionFinish",i))(Zi||{}),zn= exports.TransactionWorker =class extends _eventemitter32.default{constructor(t,r,o=30,i=100,s=10){super();this.taskQueue=new ft;this.transactionsQueue=new ft;this.outstandingTransactions=new ft;this.sentTransactions=[];this.executedTransactions=[];this.aptosConfig=t,this.account=r,this.started=!1,this.accountSequnceNumber=new Nn(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=zt({aptosConfig:this.aptosConfig,transaction:r,signer:this.account});await this.outstandingTransactions.enqueue([o,t])}}catch(t){if(t instanceof ht)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===Yi?(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 ht)return;throw new Error(`Process execution failed for ${this.account.accountAddress.toString()} with error ${t}`)}}async checkTransaction(t,r){try{let o=[];o.push(rt({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===Yi?(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 Gn=class extends _eventemitter32.default{constructor(e){super(),this.config=e}start(e){let{sender:t}=e;this.account=t,this.transactionWorker=new zn(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 Lt=class{constructor(e){this.config=e,this.build=new Un(this.config),this.simulate=new yt(this.config),this.submit=new At(this.config),this.batch=new Gn(this.config)}async getTransactions(e){return Go({aptosConfig:this.config,...e})}async getTransactionByVersion(e){return ko({aptosConfig:this.config,...e})}async getTransactionByHash(e){return gn({aptosConfig:this.config,...e})}async isPendingTransaction(e){return Do({aptosConfig:this.config,...e})}async waitForTransaction(e){return rt({aptosConfig:this.config,...e})}async getGasPriceEstimation(){return ln({aptosConfig:this.config})}getSigningMessage(e){return ei(e)}async publishPackageTransaction(e){return ti({aptosConfig:this.config,...e})}async rotateAuthKey(e){return ni({aptosConfig:this.config,...e})}sign(e){return Pn({...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,Pn({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 zt({aptosConfig:this.config,signer:t,transaction:r})}};var ne=class{constructor(e){this.config=new yn(e),this.account=new xt(this.config),this.ans=new qt(this.config),this.coin=new Gt(this.config),this.digitalAsset=new kt(this.config),this.event=new Ot(this.config),this.faucet=new Bt(this.config),this.fungibleAsset=new Ft(this.config),this.general=new Mt(this.config),this.staking=new $t(this.config),this.transaction=new Lt(this.config)}};function ye(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))})}ye(ne,xt,"account");ye(ne,qt,"ans");ye(ne,Gt,"coin");ye(ne,kt,"digitalAsset");ye(ne,Ot,"event");ye(ne,Bt,"faucet");ye(ne,Ft,"fungibleAsset");ye(ne,Mt,"general");ye(ne,$t,"staking");ye(ne,Lt,"transaction");exports.APTOS_BIP44_REGEX = ys; exports.APTOS_COIN = Qt; exports.APTOS_HARDENED_REGEX = ms; exports.Account = Ie; exports.AccountAddress = u; exports.AccountAuthenticator = Q; exports.AccountAuthenticatorEd25519 = de; exports.AccountAuthenticatorMultiEd25519 = rn; exports.AccountAuthenticatorMultiKey = Ze; exports.AccountAuthenticatorSingleKey = ae; exports.AccountAuthenticatorVariant = Pr; exports.AccountPublicKey = ue; exports.AccountSequenceNumber = Nn; exports.AddressInvalidReason = ps; exports.AnyPublicKey = $; exports.AnyPublicKeyVariant = Er; exports.AnySignature = B; exports.AnySignatureVariant = Ir; exports.Aptos = ne; exports.AptosApiError = ce; exports.AptosApiType = wt; exports.AptosConfig = yn; exports.AuthenticationKey = q; exports.Bool = I; exports.CKDPriv = Wr; exports.ChainId = ct; exports.DEFAULT_MAX_GAS_AMOUNT = kr; exports.DEFAULT_TXN_EXP_SEC_FROM_NOW = Dr; exports.DEFAULT_TXN_TIMEOUT_SEC = Ht; exports.DeriveScheme = Rr; exports.Deserializer = $r; exports.Ed25519Account = Je; exports.Ed25519PrivateKey = J; exports.Ed25519PublicKey = U; exports.Ed25519Signature = R; exports.EntryFunction = Ve; exports.EntryFunctionBytes = Zt; exports.FeePayerRawTransaction = _e; exports.FixedBytes = Be; exports.HARDENED_OFFSET = Vr; exports.Hex = h; exports.HexInvalidReason = as; exports.Identifier = E; exports.KeyType = As; exports.MimeType = Vt; exports.ModuleId = vt; exports.MoveAbility = Ur; exports.MoveFunctionVisibility = ns; exports.MoveOption = Pe; exports.MoveString = w; exports.MoveVector = T; exports.MultiAgentRawTransaction = we; exports.MultiEd25519PublicKey = Xe; exports.MultiEd25519Signature = Me; exports.MultiKey = nn; exports.MultiKeySignature = Zr; exports.MultiSig = Ut; exports.MultiSigTransactionPayload = Rt; exports.Network = On; exports.NetworkToChainId = Bn; exports.NetworkToFaucetAPI = Gr; exports.NetworkToIndexerAPI = Nr; exports.NetworkToNetworkName = Ia; exports.NetworkToNodeAPI = zr; exports.ParsingError = K; exports.ProcessorType = He; exports.PublicKey = St; exports.RAW_TRANSACTION_SALT = Or; exports.RAW_TRANSACTION_WITH_DATA_SALT = Fn; exports.RawTransaction = F; exports.RawTransactionWithData = hn; exports.RoleType = rs; exports.RotationProofChallenge = An; exports.Script = It; exports.ScriptTransactionArgumentVariants = bt; exports.Secp256k1PrivateKey = qe; exports.Secp256k1PublicKey = fe; exports.Secp256k1Signature = he; exports.Serializable = d; exports.Serializer = Y; exports.Signature = Z; exports.SignedTransaction = me; exports.SigningScheme = ve; exports.SigningSchemeInput = Dn; exports.SimpleTransaction = Tn; exports.SingleKeyAccount = et; exports.StructTag = be; exports.TransactionAuthenticator = Te; exports.TransactionAuthenticatorEd25519 = ot; exports.TransactionAuthenticatorFeePayer = st; exports.TransactionAuthenticatorMultiAgent = it; exports.TransactionAuthenticatorMultiEd25519 = Zn; exports.TransactionAuthenticatorSingleSender = at; exports.TransactionAuthenticatorVariant = Cr; exports.TransactionPayload = Le; exports.TransactionPayloadEntryFunction = Pt; exports.TransactionPayloadMultiSig = Et; exports.TransactionPayloadScript = Ct; exports.TransactionPayloadVariants = xr; exports.TransactionResponseType = kn; exports.TransactionVariants = vr; exports.TransactionWorker = zn; exports.TransactionWorkerEventsEnum = Zi; exports.TypeTag = N; exports.TypeTagAddress = W; exports.TypeTagBool = D; exports.TypeTagGeneric = z; exports.TypeTagParserError = v; exports.TypeTagParserErrorType = Ps; exports.TypeTagReference = fn; exports.TypeTagSigner = $e; exports.TypeTagStruct = l; exports.TypeTagU128 = dt; exports.TypeTagU16 = ut; exports.TypeTagU256 = lt; exports.TypeTagU32 = pt; exports.TypeTagU64 = L; exports.TypeTagU8 = ge; exports.TypeTagVariants = Sr; exports.TypeTagVector = x; exports.U128 = ie; exports.U16 = re; exports.U256 = se; exports.U32 = oe; exports.U64 = G; exports.U8 = k; exports.aptosCoinStructTag = og; exports.aptosRequest = Wt; exports.buildTransaction = pr; exports.checkOrConvertArgument = mt; exports.convertArgument = ur; exports.createObjectAddress = Ts; exports.createResourceAddress = ud; exports.createTokenAddress = pd; exports.deriveKey = qn; exports.deriveTransactionType = Zo; exports.deserializeFromScriptArgument = xs; exports.ensureBoolean = Kn; exports.fetchEntryFunctionAbi = Vo; exports.fetchFunctionAbi = Lo; exports.fetchViewFunctionAbi = Ho; exports.findFirstNonSignerArg = $o; exports.generateMultiSignersSignedTransaction = Ds; exports.generateRawTransaction = Gs; exports.generateSignedTransaction = dr; exports.generateSignedTransactionForSimulation = jo; exports.generateSigningMessage = lr; exports.generateTransactionPayload = Cn; exports.generateTransactionPayloadWithABI = Rs; exports.generateUserTransactionHash = km; exports.generateViewFunctionPayload = Wo; exports.generateViewFunctionPayloadWithABI = Ns; exports.get = Fr; exports.getAptosFullNode = X; exports.getAuthenticatorForSimulation = vn; exports.getFunctionParts = Nt; exports.hashValues = Yo; exports.isBcsAddress = Sn; exports.isBcsBool = Jn; exports.isBcsFixedBytes = Es; exports.isBcsString = er; exports.isBcsU128 = ir; exports.isBcsU16 = nr; exports.isBcsU256 = sr; exports.isBcsU32 = rr; exports.isBcsU64 = or; exports.isBcsU8 = tr; exports.isBlockMetadataTransactionResponse = Ta; exports.isBool = Fo; exports.isEd25519Signature = _a; exports.isEncodedEntryFunctionArgument = Ko; exports.isFeePayerSignature = va; exports.isGenesisTransactionResponse = ha; exports.isLargeNumber = _n; exports.isMultiAgentSignature = xa; exports.isMultiEd25519Signature = Ca; exports.isNull = Mo; exports.isNumber = wn; exports.isPendingTransactionResponse = Aa; exports.isScriptDataInput = qo; exports.isSecp256k1Signature = Sa; exports.isStateCheckpointTransactionResponse = ba; exports.isString = gt; exports.isUserTransactionResponse = fa; exports.isValidBIP44Path = Hr; exports.isValidHardenedPath = Qr; exports.isValidatorTransactionResponse = wa; exports.mnemonicToSeed = Jt; exports.objectStructTag = j; exports.optionStructTag = ig; exports.outOfRangeErrorMessage = cs; exports.paginateWithCursor = Qe; exports.parseTypeTag = Se; exports.post = Mn; exports.postAptosFaucet = Kr; exports.postAptosFullNode = ke; exports.postAptosIndexer = Mr; exports.promiseFulfilledStatus = Yi; exports.request = os; exports.sign = Xo; exports.splitPath = jr; exports.standardizeTypeTags = cr; exports.stringStructTag = S; exports.throwTypeMismatch = P; exports.validateNumberInRange = Ce;
|
|
429
429
|
//# sourceMappingURL=index.js.map
|