@aptos-labs/ts-sdk 1.27.1 → 1.28.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/dist/common/{accountAddress-LOYE4_sG.d.ts → accountAddress-OVl7-qVN.d.ts} +2 -1
- package/dist/common/chunk-HBPH2AD3.js +2 -0
- package/dist/common/chunk-HBPH2AD3.js.map +1 -0
- package/dist/common/cli/index.d.ts +1 -1
- package/dist/common/cli/index.js +1 -1
- package/dist/common/cli/index.js.map +1 -1
- package/dist/common/index.d.ts +51 -5
- package/dist/common/index.js +27 -27
- package/dist/common/index.js.map +1 -1
- package/dist/esm/account/Account.mjs +1 -1
- package/dist/esm/account/Ed25519Account.mjs +1 -1
- package/dist/esm/account/EphemeralKeyPair.mjs +1 -1
- package/dist/esm/account/KeylessAccount.mjs +1 -1
- package/dist/esm/account/MultiKeyAccount.d.mts +2 -1
- package/dist/esm/account/MultiKeyAccount.mjs +1 -1
- package/dist/esm/account/SingleKeyAccount.mjs +1 -1
- package/dist/esm/account/index.mjs +1 -1
- package/dist/esm/api/account.d.mts +2 -1
- package/dist/esm/api/account.mjs +1 -1
- package/dist/esm/api/ans.mjs +1 -1
- package/dist/esm/api/aptos.mjs +1 -1
- package/dist/esm/api/aptosConfig.mjs +1 -1
- package/dist/esm/api/coin.mjs +1 -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.mjs +1 -1
- package/dist/esm/api/general.mjs +1 -1
- package/dist/esm/api/index.mjs +1 -1
- package/dist/esm/api/keyless.mjs +1 -1
- package/dist/esm/api/object.mjs +1 -1
- package/dist/esm/api/staking.mjs +1 -1
- package/dist/esm/api/table.mjs +1 -1
- package/dist/esm/api/transaction.mjs +1 -1
- package/dist/esm/api/transactionSubmission/build.mjs +1 -1
- package/dist/esm/api/transactionSubmission/management.mjs +1 -1
- package/dist/esm/api/transactionSubmission/sign.mjs +1 -1
- package/dist/esm/api/transactionSubmission/simulate.mjs +1 -1
- package/dist/esm/api/transactionSubmission/submit.mjs +1 -1
- package/dist/esm/api/utils.mjs +1 -1
- package/dist/esm/bcs/index.d.mts +1 -1
- package/dist/esm/bcs/index.mjs +1 -1
- package/dist/esm/bcs/serializable/movePrimitives.mjs +1 -1
- package/dist/esm/bcs/serializable/moveStructs.d.mts +10 -1
- package/dist/esm/bcs/serializable/moveStructs.mjs +1 -1
- package/dist/esm/{chunk-NCWD4NA3.mjs → chunk-2CAGPXCX.mjs} +2 -2
- package/dist/esm/{chunk-Q67DUNMI.mjs → chunk-2XYA7NOU.mjs} +2 -2
- package/dist/esm/{chunk-2N2VEGT6.mjs → chunk-3F3FCWT5.mjs} +2 -2
- package/dist/esm/{chunk-3SPU4V2B.mjs → chunk-3GOJQ5JD.mjs} +2 -2
- package/dist/esm/{chunk-G7UNU5GI.mjs → chunk-3HTSCV3R.mjs} +2 -2
- package/dist/esm/{chunk-H33YIMTU.mjs → chunk-4ENUSVZB.mjs} +2 -2
- package/dist/esm/chunk-52HZTDBB.mjs +2 -0
- package/dist/esm/chunk-52HZTDBB.mjs.map +1 -0
- package/dist/esm/{chunk-76HTG7Z7.mjs → chunk-53DBMWMU.mjs} +2 -2
- package/dist/esm/{chunk-I5XQKNOK.mjs → chunk-54QUDAAC.mjs} +2 -2
- package/dist/esm/{chunk-7AIKM3UF.mjs → chunk-56F7EYFE.mjs} +2 -2
- package/dist/esm/{chunk-JKNTGRSQ.mjs → chunk-5L3UXSQI.mjs} +2 -2
- package/dist/esm/{chunk-PY4TS34X.mjs → chunk-5P7MXLZA.mjs} +2 -2
- package/dist/esm/{chunk-6BYVG7H4.mjs → chunk-5TBIWC7N.mjs} +2 -2
- package/dist/esm/{chunk-ZQFFRZJ4.mjs → chunk-6CHBLB3V.mjs} +2 -2
- package/dist/esm/{chunk-NRRADUK4.mjs → chunk-AVSM2BJR.mjs} +2 -2
- package/dist/esm/{chunk-52KPINA4.mjs → chunk-B5NYEWNM.mjs} +2 -2
- package/dist/esm/{chunk-74YFNJ7A.mjs → chunk-BIGX2RJL.mjs} +2 -2
- package/dist/esm/chunk-DCNBMUKN.mjs +2 -0
- package/dist/esm/chunk-DCNBMUKN.mjs.map +1 -0
- package/dist/esm/{chunk-AYX5JMB4.mjs → chunk-DVIRUFCY.mjs} +2 -2
- package/dist/esm/{chunk-UV7M72QD.mjs → chunk-EJMPY5MF.mjs} +2 -2
- package/dist/esm/{chunk-F7NVDHR2.mjs → chunk-EQSON7Y5.mjs} +2 -2
- package/dist/esm/{chunk-GNFEBKFV.mjs → chunk-EXMQBH3I.mjs} +2 -2
- package/dist/esm/chunk-EXP5STXZ.mjs +2 -0
- package/dist/esm/chunk-EXP5STXZ.mjs.map +1 -0
- package/dist/esm/{chunk-UO52TECC.mjs → chunk-F5PNGH44.mjs} +2 -2
- package/dist/esm/chunk-G773HST5.mjs +2 -0
- package/dist/esm/chunk-G773HST5.mjs.map +1 -0
- package/dist/esm/{chunk-FOHGSNYZ.mjs → chunk-GGPA6QTN.mjs} +2 -2
- package/dist/esm/{chunk-QV6EZL2G.mjs → chunk-GKERWKMB.mjs} +2 -2
- package/dist/esm/{chunk-Y3HLYCF3.mjs → chunk-GR4PHW7K.mjs} +2 -2
- package/dist/esm/{chunk-MLL54PYO.mjs → chunk-HAT5S2XX.mjs} +2 -2
- package/dist/esm/{chunk-MLL54PYO.mjs.map → chunk-HAT5S2XX.mjs.map} +1 -1
- package/dist/esm/{chunk-ZXPBRVOA.mjs → chunk-HBQLX5QF.mjs} +2 -2
- package/dist/esm/{chunk-RA3YPQG2.mjs → chunk-IVOEXGOG.mjs} +2 -2
- package/dist/esm/{chunk-5L3PLK3W.mjs → chunk-JOROI7FE.mjs} +2 -2
- package/dist/esm/chunk-JUNVPIW4.mjs +2 -0
- package/dist/esm/chunk-JUNVPIW4.mjs.map +1 -0
- package/dist/esm/{chunk-T2NJUIOQ.mjs → chunk-KRIIRH5L.mjs} +2 -2
- package/dist/esm/{chunk-7Y3MRBG6.mjs → chunk-LFUBUXHD.mjs} +2 -2
- package/dist/esm/{chunk-YXITAP46.mjs → chunk-LJZPPBTH.mjs} +2 -2
- package/dist/esm/{chunk-5IUXBOS5.mjs → chunk-LS6G4DZV.mjs} +2 -2
- package/dist/esm/{chunk-GXTEJ7NO.mjs → chunk-MNVDBUF3.mjs} +2 -2
- package/dist/esm/{chunk-ORXEFE6X.mjs → chunk-NBO2BDDZ.mjs} +2 -2
- package/dist/esm/{chunk-2CC67KW5.mjs → chunk-NDJKEFNU.mjs} +2 -2
- package/dist/esm/{chunk-A4T373F3.mjs → chunk-NKDHR2DA.mjs} +2 -2
- package/dist/esm/{chunk-FNT3VLRD.mjs → chunk-NPFW6ZFY.mjs} +2 -2
- package/dist/esm/{chunk-KEN2VRIM.mjs → chunk-OPTI3MH2.mjs} +2 -2
- package/dist/esm/{chunk-QE5OL6KN.mjs → chunk-ORGMRM5K.mjs} +2 -2
- package/dist/esm/{chunk-SONTIUAM.mjs → chunk-OTNGLTKS.mjs} +2 -2
- package/dist/esm/{chunk-CTJX4CUF.mjs → chunk-P2EKDA7R.mjs} +2 -2
- package/dist/esm/{chunk-GHKMF253.mjs → chunk-PDNA4H34.mjs} +2 -2
- package/dist/esm/{chunk-ECKJI2TV.mjs → chunk-QQHA2Y46.mjs} +2 -2
- package/dist/esm/chunk-QQU4IQ27.mjs +2 -0
- package/dist/esm/chunk-QQU4IQ27.mjs.map +1 -0
- package/dist/esm/{chunk-WHW4Z7TK.mjs → chunk-SCYGW3VV.mjs} +2 -2
- package/dist/esm/{chunk-3NRBTP3S.mjs → chunk-SUAA25UP.mjs} +2 -2
- package/dist/esm/{chunk-YY2XW5R4.mjs → chunk-T53MZO2U.mjs} +2 -2
- package/dist/esm/chunk-UAL27G6B.mjs +2 -0
- package/dist/esm/chunk-UAL27G6B.mjs.map +1 -0
- package/dist/esm/{chunk-MEKXPGK7.mjs → chunk-VQVNUN5Y.mjs} +2 -2
- package/dist/esm/{chunk-WFOYGJS5.mjs → chunk-VTEZ6TBO.mjs} +2 -2
- package/dist/esm/{chunk-OEOUZFHD.mjs → chunk-VYXJ7FUF.mjs} +2 -2
- package/dist/esm/{chunk-4ZMI5G5L.mjs → chunk-VYXS7TLB.mjs} +2 -2
- package/dist/esm/{chunk-HKMG3LZX.mjs → chunk-WLZYSLHP.mjs} +2 -2
- package/dist/esm/{chunk-6ERHGCK2.mjs → chunk-WX6P3Q4I.mjs} +2 -2
- package/dist/esm/{chunk-USOIC4HO.mjs → chunk-WYQLUB4H.mjs} +2 -2
- package/dist/esm/{chunk-HHU7UCFI.mjs → chunk-XSTCHOUI.mjs} +2 -2
- package/dist/esm/chunk-XSTCHOUI.mjs.map +1 -0
- package/dist/esm/{chunk-ZZRSKHWS.mjs → chunk-YFMFXRJX.mjs} +2 -2
- package/dist/esm/{chunk-PO33LVUF.mjs → chunk-YPQZJ72F.mjs} +2 -2
- package/dist/esm/chunk-Z2AJWV6D.mjs +2 -0
- package/dist/esm/chunk-Z2AJWV6D.mjs.map +1 -0
- package/dist/esm/{chunk-HRIYZBXY.mjs → chunk-ZNC3FRSK.mjs} +2 -2
- package/dist/esm/{chunk-NU55IEL4.mjs → chunk-ZWX3NHGU.mjs} +2 -2
- package/dist/esm/chunk-ZXVQ2OBJ.mjs +2 -0
- package/dist/esm/{chunk-ZEYOFDIO.mjs.map → chunk-ZXVQ2OBJ.mjs.map} +1 -1
- package/dist/esm/cli/index.mjs +1 -1
- package/dist/esm/cli/localNode.mjs +1 -1
- package/dist/esm/cli/move.mjs +1 -1
- package/dist/esm/client/core.mjs +1 -1
- package/dist/esm/client/get.mjs +1 -1
- package/dist/esm/client/index.mjs +1 -1
- package/dist/esm/client/post.mjs +1 -1
- package/dist/esm/client/types.mjs +1 -1
- package/dist/esm/core/account/index.mjs +1 -1
- package/dist/esm/core/account/utils/address.mjs +1 -1
- package/dist/esm/core/account/utils/index.mjs +1 -1
- package/dist/esm/core/accountAddress.mjs +1 -1
- package/dist/esm/core/authenticationKey.mjs +1 -1
- package/dist/esm/core/crypto/ed25519.mjs +1 -1
- package/dist/esm/core/crypto/ephemeral.mjs +1 -1
- package/dist/esm/core/crypto/index.mjs +1 -1
- package/dist/esm/core/crypto/keyless.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/proof.mjs +1 -1
- package/dist/esm/core/crypto/publicKey.mjs +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/index.mjs +1 -1
- package/dist/esm/index.d.mts +3 -3
- package/dist/esm/index.mjs +1 -1
- package/dist/esm/internal/account.mjs +1 -1
- package/dist/esm/internal/ans.mjs +1 -1
- package/dist/esm/internal/coin.mjs +1 -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.mjs +1 -1
- package/dist/esm/internal/general.mjs +1 -1
- package/dist/esm/internal/keyless.mjs +1 -1
- package/dist/esm/internal/object.mjs +1 -1
- package/dist/esm/internal/staking.mjs +1 -1
- package/dist/esm/internal/table.mjs +1 -1
- package/dist/esm/internal/transaction.mjs +1 -1
- package/dist/esm/internal/transactionSubmission.mjs +1 -1
- 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.mjs +1 -1
- package/dist/esm/transactions/instances/index.mjs +1 -1
- package/dist/esm/transactions/instances/moduleId.mjs +1 -1
- package/dist/esm/transactions/instances/multiAgentTransaction.mjs +1 -1
- package/dist/esm/transactions/instances/rawTransaction.mjs +1 -1
- package/dist/esm/transactions/instances/rotationProofChallenge.mjs +1 -1
- package/dist/esm/transactions/instances/signedTransaction.mjs +1 -1
- package/dist/esm/transactions/instances/simpleTransaction.mjs +1 -1
- package/dist/esm/transactions/instances/transactionPayload.mjs +1 -1
- package/dist/esm/transactions/management/accountSequenceNumber.mjs +1 -1
- package/dist/esm/transactions/management/index.mjs +1 -1
- package/dist/esm/transactions/management/transactionWorker.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/helpers.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/index.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/remoteAbi.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/signingMessage.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/transactionBuilder.mjs +1 -1
- package/dist/esm/transactions/typeTag/index.mjs +1 -1
- package/dist/esm/transactions/typeTag/parser.mjs +1 -1
- package/dist/esm/transactions/types.d.mts +2 -2
- package/dist/esm/types/index.d.mts +2 -1
- package/dist/esm/types/index.mjs +1 -1
- package/dist/esm/utils/const.d.mts +2 -1
- package/dist/esm/utils/const.mjs +1 -1
- package/dist/esm/utils/helpers.d.mts +41 -1
- package/dist/esm/utils/helpers.mjs +1 -1
- package/dist/esm/utils/index.d.mts +2 -2
- package/dist/esm/utils/index.mjs +1 -1
- package/dist/esm/utils/normalizeBundle.mjs +1 -1
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +1 -1
- package/src/account/MultiKeyAccount.ts +4 -4
- package/src/api/account.ts +31 -4
- package/src/bcs/serializable/moveStructs.ts +41 -8
- package/src/cli/move.ts +1 -1
- package/src/internal/account.ts +6 -5
- package/src/internal/event.ts +10 -3
- package/src/transactions/instances/transactionPayload.ts +3 -1
- package/src/transactions/types.ts +4 -2
- package/src/types/index.ts +1 -0
- package/src/utils/const.ts +1 -0
- package/src/utils/helpers.ts +70 -0
- package/src/version.ts +1 -1
- package/dist/common/chunk-J4IUXT5W.js +0 -2
- package/dist/common/chunk-J4IUXT5W.js.map +0 -1
- package/dist/esm/chunk-4SDUQ7AS.mjs +0 -2
- package/dist/esm/chunk-4SDUQ7AS.mjs.map +0 -1
- package/dist/esm/chunk-EZIF26UH.mjs +0 -2
- package/dist/esm/chunk-EZIF26UH.mjs.map +0 -1
- package/dist/esm/chunk-HHU7UCFI.mjs.map +0 -1
- package/dist/esm/chunk-KMJ6TF6Y.mjs +0 -2
- package/dist/esm/chunk-KMJ6TF6Y.mjs.map +0 -1
- package/dist/esm/chunk-L36ZHC7J.mjs +0 -2
- package/dist/esm/chunk-L36ZHC7J.mjs.map +0 -1
- package/dist/esm/chunk-LDTF3ABK.mjs +0 -2
- package/dist/esm/chunk-LDTF3ABK.mjs.map +0 -1
- package/dist/esm/chunk-THRXIXIO.mjs +0 -2
- package/dist/esm/chunk-THRXIXIO.mjs.map +0 -1
- package/dist/esm/chunk-WABFFJGI.mjs +0 -2
- package/dist/esm/chunk-WABFFJGI.mjs.map +0 -1
- package/dist/esm/chunk-ZEYOFDIO.mjs +0 -2
- package/dist/esm/chunk-ZOMXBB6Z.mjs +0 -2
- package/dist/esm/chunk-ZOMXBB6Z.mjs.map +0 -1
- /package/dist/esm/{chunk-NCWD4NA3.mjs.map → chunk-2CAGPXCX.mjs.map} +0 -0
- /package/dist/esm/{chunk-Q67DUNMI.mjs.map → chunk-2XYA7NOU.mjs.map} +0 -0
- /package/dist/esm/{chunk-2N2VEGT6.mjs.map → chunk-3F3FCWT5.mjs.map} +0 -0
- /package/dist/esm/{chunk-3SPU4V2B.mjs.map → chunk-3GOJQ5JD.mjs.map} +0 -0
- /package/dist/esm/{chunk-G7UNU5GI.mjs.map → chunk-3HTSCV3R.mjs.map} +0 -0
- /package/dist/esm/{chunk-H33YIMTU.mjs.map → chunk-4ENUSVZB.mjs.map} +0 -0
- /package/dist/esm/{chunk-76HTG7Z7.mjs.map → chunk-53DBMWMU.mjs.map} +0 -0
- /package/dist/esm/{chunk-I5XQKNOK.mjs.map → chunk-54QUDAAC.mjs.map} +0 -0
- /package/dist/esm/{chunk-7AIKM3UF.mjs.map → chunk-56F7EYFE.mjs.map} +0 -0
- /package/dist/esm/{chunk-JKNTGRSQ.mjs.map → chunk-5L3UXSQI.mjs.map} +0 -0
- /package/dist/esm/{chunk-PY4TS34X.mjs.map → chunk-5P7MXLZA.mjs.map} +0 -0
- /package/dist/esm/{chunk-6BYVG7H4.mjs.map → chunk-5TBIWC7N.mjs.map} +0 -0
- /package/dist/esm/{chunk-ZQFFRZJ4.mjs.map → chunk-6CHBLB3V.mjs.map} +0 -0
- /package/dist/esm/{chunk-NRRADUK4.mjs.map → chunk-AVSM2BJR.mjs.map} +0 -0
- /package/dist/esm/{chunk-52KPINA4.mjs.map → chunk-B5NYEWNM.mjs.map} +0 -0
- /package/dist/esm/{chunk-74YFNJ7A.mjs.map → chunk-BIGX2RJL.mjs.map} +0 -0
- /package/dist/esm/{chunk-AYX5JMB4.mjs.map → chunk-DVIRUFCY.mjs.map} +0 -0
- /package/dist/esm/{chunk-UV7M72QD.mjs.map → chunk-EJMPY5MF.mjs.map} +0 -0
- /package/dist/esm/{chunk-F7NVDHR2.mjs.map → chunk-EQSON7Y5.mjs.map} +0 -0
- /package/dist/esm/{chunk-GNFEBKFV.mjs.map → chunk-EXMQBH3I.mjs.map} +0 -0
- /package/dist/esm/{chunk-UO52TECC.mjs.map → chunk-F5PNGH44.mjs.map} +0 -0
- /package/dist/esm/{chunk-FOHGSNYZ.mjs.map → chunk-GGPA6QTN.mjs.map} +0 -0
- /package/dist/esm/{chunk-QV6EZL2G.mjs.map → chunk-GKERWKMB.mjs.map} +0 -0
- /package/dist/esm/{chunk-Y3HLYCF3.mjs.map → chunk-GR4PHW7K.mjs.map} +0 -0
- /package/dist/esm/{chunk-ZXPBRVOA.mjs.map → chunk-HBQLX5QF.mjs.map} +0 -0
- /package/dist/esm/{chunk-RA3YPQG2.mjs.map → chunk-IVOEXGOG.mjs.map} +0 -0
- /package/dist/esm/{chunk-5L3PLK3W.mjs.map → chunk-JOROI7FE.mjs.map} +0 -0
- /package/dist/esm/{chunk-T2NJUIOQ.mjs.map → chunk-KRIIRH5L.mjs.map} +0 -0
- /package/dist/esm/{chunk-7Y3MRBG6.mjs.map → chunk-LFUBUXHD.mjs.map} +0 -0
- /package/dist/esm/{chunk-YXITAP46.mjs.map → chunk-LJZPPBTH.mjs.map} +0 -0
- /package/dist/esm/{chunk-5IUXBOS5.mjs.map → chunk-LS6G4DZV.mjs.map} +0 -0
- /package/dist/esm/{chunk-GXTEJ7NO.mjs.map → chunk-MNVDBUF3.mjs.map} +0 -0
- /package/dist/esm/{chunk-ORXEFE6X.mjs.map → chunk-NBO2BDDZ.mjs.map} +0 -0
- /package/dist/esm/{chunk-2CC67KW5.mjs.map → chunk-NDJKEFNU.mjs.map} +0 -0
- /package/dist/esm/{chunk-A4T373F3.mjs.map → chunk-NKDHR2DA.mjs.map} +0 -0
- /package/dist/esm/{chunk-FNT3VLRD.mjs.map → chunk-NPFW6ZFY.mjs.map} +0 -0
- /package/dist/esm/{chunk-KEN2VRIM.mjs.map → chunk-OPTI3MH2.mjs.map} +0 -0
- /package/dist/esm/{chunk-QE5OL6KN.mjs.map → chunk-ORGMRM5K.mjs.map} +0 -0
- /package/dist/esm/{chunk-SONTIUAM.mjs.map → chunk-OTNGLTKS.mjs.map} +0 -0
- /package/dist/esm/{chunk-CTJX4CUF.mjs.map → chunk-P2EKDA7R.mjs.map} +0 -0
- /package/dist/esm/{chunk-GHKMF253.mjs.map → chunk-PDNA4H34.mjs.map} +0 -0
- /package/dist/esm/{chunk-ECKJI2TV.mjs.map → chunk-QQHA2Y46.mjs.map} +0 -0
- /package/dist/esm/{chunk-WHW4Z7TK.mjs.map → chunk-SCYGW3VV.mjs.map} +0 -0
- /package/dist/esm/{chunk-3NRBTP3S.mjs.map → chunk-SUAA25UP.mjs.map} +0 -0
- /package/dist/esm/{chunk-YY2XW5R4.mjs.map → chunk-T53MZO2U.mjs.map} +0 -0
- /package/dist/esm/{chunk-MEKXPGK7.mjs.map → chunk-VQVNUN5Y.mjs.map} +0 -0
- /package/dist/esm/{chunk-WFOYGJS5.mjs.map → chunk-VTEZ6TBO.mjs.map} +0 -0
- /package/dist/esm/{chunk-OEOUZFHD.mjs.map → chunk-VYXJ7FUF.mjs.map} +0 -0
- /package/dist/esm/{chunk-4ZMI5G5L.mjs.map → chunk-VYXS7TLB.mjs.map} +0 -0
- /package/dist/esm/{chunk-HKMG3LZX.mjs.map → chunk-WLZYSLHP.mjs.map} +0 -0
- /package/dist/esm/{chunk-6ERHGCK2.mjs.map → chunk-WX6P3Q4I.mjs.map} +0 -0
- /package/dist/esm/{chunk-USOIC4HO.mjs.map → chunk-WYQLUB4H.mjs.map} +0 -0
- /package/dist/esm/{chunk-ZZRSKHWS.mjs.map → chunk-YFMFXRJX.mjs.map} +0 -0
- /package/dist/esm/{chunk-PO33LVUF.mjs.map → chunk-YPQZJ72F.mjs.map} +0 -0
- /package/dist/esm/{chunk-HRIYZBXY.mjs.map → chunk-ZNC3FRSK.mjs.map} +0 -0
- /package/dist/esm/{chunk-NU55IEL4.mjs.map → chunk-ZWX3NHGU.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 _chunkJ4IUXT5Wjs = require('./chunk-J4IUXT5W.js');var xn=255,Pn=65535,xe=4294967295,Ye=18446744073709551615n,$t=340282366920938463463374607431768211455n,vn=115792089237316195423570985008687907853269984665640564039457584007913129639935n;var oe=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}remaining(){return this.buffer.byteLength-this.offset}deserializeStr(){let e=this.deserializeBytes();return new TextDecoder().decode(e)}deserializeOptionStr(){return this.deserializeBool()?this.deserializeStr():void 0}deserializeOption(e){return this.deserializeBool()?this.deserialize(e):void 0}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<xe;){let r=this.deserializeU8();if(e|=BigInt(r&127)<<BigInt(t),!(r&128))break;t+=7}if(e>xe)throw new Error("Overflow while parsing uleb128-encoded uint32 value");return Number(e)}deserialize(e){return e.deserialize(this)}deserializeVector(e){let t=this.deserializeUleb128AsU32(),r=new Array;for(let o=0;o<t;o+=1)r.push(this.deserialize(e));return r}};var _utils = require('@noble/hashes/utils');var Y=class extends Error{constructor(e,t){super(e),this.invalidReason=t}};var ia=(r=>(r.TOO_SHORT="too_short",r.INVALID_LENGTH="invalid_length",r.INVALID_HEX_CHARS="invalid_hex_chars",r))(ia||{}),l= 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 Y("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 Y("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 Y(`Hex string contains invalid hex characters: ${_optionalChain([r, 'optionalAccess', _2 => _2.message])}`,"invalid_hex_chars")}}static fromHexInput(e){return e instanceof Uint8Array?new n(e):n.fromHexString(e)}static isValid(e){try{return n.fromHexString(e),{valid:!0}}catch(t){return{valid:!1,invalidReason:_optionalChain([t, 'optionalAccess', _3 => _3.invalidReason]),invalidReasonMessage:_optionalChain([t, 'optionalAccess', _4 => _4.message])}}}equals(e){return this.data.length!==e.data.length?!1:this.data.every((t,r)=>t===e.data[r])}};var d=class{bcsToBytes(){let e=new Z;return this.serialize(e),e.toUint8Array()}bcsToHex(){let e=this.bcsToBytes();return l.fromHexInput(e)}},Z= 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){fr(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(xe),r=BigInt(e)>>BigInt(32);this.serializeU32(Number(t)),this.serializeU32(Number(r))}serializeU128(e){let t=BigInt(e)&Ye,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)})}serializeOption(e){let t=e!==void 0;this.serializeBool(t),t&&e.serialize(this)}serializeOptionStr(e){e===void 0?this.serializeU32AsUleb128(0):(this.serializeU32AsUleb128(1),this.serializeStr(e))}};_chunkJ4IUXT5Wjs.a.call(void 0, [Ze(0,xn)],Z.prototype,"serializeU8",1),_chunkJ4IUXT5Wjs.a.call(void 0, [Ze(0,Pn)],Z.prototype,"serializeU16",1),_chunkJ4IUXT5Wjs.a.call(void 0, [Ze(0,xe)],Z.prototype,"serializeU32",1),_chunkJ4IUXT5Wjs.a.call(void 0, [Ze(BigInt(0),Ye)],Z.prototype,"serializeU64",1),_chunkJ4IUXT5Wjs.a.call(void 0, [Ze(BigInt(0),$t)],Z.prototype,"serializeU128",1),_chunkJ4IUXT5Wjs.a.call(void 0, [Ze(BigInt(0),vn)],Z.prototype,"serializeU256",1),_chunkJ4IUXT5Wjs.a.call(void 0, [Ze(0,xe)],Z.prototype,"serializeU32AsUleb128",1);function fr(n){if(typeof n!="boolean")throw new Error(`${n} is not a boolean value`)}var sa=(n,e,t)=>`${n} is out of range: [${e}, ${t}]`;function Be(n,e,t){let r=BigInt(n);if(r>BigInt(t)||r<BigInt(e))throw new Error(sa(n,e,t))}function Ze(n,e){return(t,r,o)=>{let i=o.value;return o.value=function(a){return Be(a,n,e),i.apply(this,[a])},o}}var Je=class n extends d{constructor(e){super(),this.value=l.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 Cn=class n extends d{constructor(e){super(),this.value=new Je(e)}serialize(e){e.serialize(this.value)}serializeForEntryFunction(e){e.serializeU32AsUleb128(this.value.value.length),e.serialize(this)}static deserialize(e,t){let r=Je.deserialize(e,t);return new n(r.value)}};var En=(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))(En||{}),fo= 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))(fo||{}),Lt= 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))(Lt||{}),Ao= exports.TransactionPayloadVariants =(r=>(r[r.Script=0]="Script",r[r.EntryFunction=2]="EntryFunction",r[r.Multisig=3]="Multisig",r))(Ao||{}),ho= exports.TransactionVariants =(t=>(t[t.MultiAgentTransaction=0]="MultiAgentTransaction",t[t.FeePayerTransaction=1]="FeePayerTransaction",t))(ho||{}),To= 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))(To||{}),bo= exports.AccountAuthenticatorVariant =(o=>(o[o.Ed25519=0]="Ed25519",o[o.MultiEd25519=1]="MultiEd25519",o[o.SingleKey=2]="SingleKey",o[o.MultiKey=3]="MultiKey",o))(bo||{}),Ar= exports.AnyPublicKeyVariant =(r=>(r[r.Ed25519=0]="Ed25519",r[r.Secp256k1=1]="Secp256k1",r[r.Keyless=3]="Keyless",r))(Ar||{}),wo= exports.AnySignatureVariant =(r=>(r[r.Ed25519=0]="Ed25519",r[r.Secp256k1=1]="Secp256k1",r[r.Keyless=3]="Keyless",r))(wo||{}),hr= exports.EphemeralPublicKeyVariant =(e=>(e[e.Ed25519=0]="Ed25519",e))(hr||{}),So= exports.EphemeralSignatureVariant =(e=>(e[e.Ed25519=0]="Ed25519",e))(So||{}),Tr= exports.EphemeralCertificateVariant =(e=>(e[e.ZkProof=0]="ZkProof",e))(Tr||{}),br= exports.ZkpVariant =(e=>(e[e.Groth16=0]="Groth16",e))(br||{}),wr= exports.TransactionResponseType =(a=>(a.Pending="pending_transaction",a.User="user_transaction",a.Genesis="genesis_transaction",a.BlockMetadata="block_metadata_transaction",a.StateCheckpoint="state_checkpoint_transaction",a.Validator="validator_transaction",a.BlockEpilogue="block_epilogue_transaction",a))(wr||{});function xu(n){return n.type==="pending_transaction"}function Pu(n){return n.type==="user_transaction"}function vu(n){return n.type==="genesis_transaction"}function Cu(n){return n.type==="block_metadata_transaction"}function Eu(n){return n.type==="state_checkpoint_transaction"}function Iu(n){return n.type==="validator_transaction"}function Uu(n){return n.type==="block_epilogue_transaction"}function Ru(n){return"signature"in n&&n.signature==="ed25519_signature"}function zu(n){return"signature"in n&&n.signature==="secp256k1_ecdsa_signature"}function ku(n){return n.type==="multi_agent_signature"}function Du(n){return n.type==="fee_payer_signature"}function Bu(n){return n.type==="multi_ed25519_signature"}var aa=(r=>(r.PRIVATE="private",r.PUBLIC="public",r.FRIEND="friend",r))(aa||{}),_o= exports.MoveAbility =(o=>(o.STORE="store",o.DROP="drop",o.KEY="key",o.COPY="copy",o))(_o||{}),ca= exports.RoleType =(t=>(t.VALIDATOR="validator",t.FULL_NODE="full_node",t))(ca||{}),Ae= exports.SigningScheme =(o=>(o[o.Ed25519=0]="Ed25519",o[o.MultiEd25519=1]="MultiEd25519",o[o.SingleKey=2]="SingleKey",o[o.MultiKey=3]="MultiKey",o))(Ae||{}),Sr= exports.SigningSchemeInput =(t=>(t[t.Ed25519=0]="Ed25519",t[t.Secp256k1Ecdsa=2]="Secp256k1Ecdsa",t))(Sr||{}),xo= 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))(xo||{});var I=class n extends d{constructor(e){super(),fr(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())}},F= exports.U8 =class n extends d{constructor(e){super(),Be(e,0,xn),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())}},de= exports.U16 =class n extends d{constructor(e){super(),Be(e,0,Pn),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())}},le= exports.U32 =class n extends d{constructor(e){super(),Be(e,0,xe),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())}},O= exports.U64 =class n extends d{constructor(e){super(),Be(e,BigInt(0),Ye),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())}},ge= exports.U128 =class n extends d{constructor(e){super(),Be(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())}},me= exports.U256 =class n extends d{constructor(e){super(),Be(e,BigInt(0),vn),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 F)&&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)&&e.length===0)t=[];else if(Array.isArray(e)&&typeof e[0]=="number")t=e;else if(typeof e=="string"){let r=l.fromHexInput(e);t=Array.from(r.toUint8Array())}else if(e instanceof Uint8Array)t=Array.from(e);else throw new Error("Invalid input type, must be an number[], Uint8Array, or hex string");return new n(t.map(r=>new F(r)))}static U16(e){return new n(e.map(t=>new de(t)))}static U32(e){return new n(e.map(t=>new le(t)))}static U64(e){return new n(e.map(t=>new O(t)))}static U128(e){return new n(e.map(t=>new ge(t)))}static U256(e){return new n(e.map(t=>new me(t)))}static Bool(e){return new n(e.map(t=>new I(t)))}static MoveString(e){return new n(e.map(t=>new b(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)}},b= 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())}},M= 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 F(e):void 0)}static U16(e){return new n(e!=null?new de(e):void 0)}static U32(e){return new n(e!=null?new le(e):void 0)}static U64(e){return new n(e!=null?new O(e):void 0)}static U128(e){return new n(e!=null?new ge(e):void 0)}static U256(e){return new n(e!=null?new me(e):void 0)}static Bool(e){return new n(e!=null?new I(e):void 0)}static MoveString(e){return new n(e!=null?new b(e):void 0)}static deserialize(e,t){let r=T.deserialize(e,t);return new n(r.values[0])}};var _ed25519 = require('@noble/curves/ed25519');var _sha3 = require('@noble/hashes/sha3');var pa=(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))(pa||{}),_=class _ extends d{constructor(e){if(super(),e.length!==_.LENGTH)throw new Y("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 Y("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 Y(`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 Y(`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 Y("Hex string is too short, must be 1 to 64 chars long, excluding the leading 0x.","too_short");if(t.length>64)throw new Y("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 Y(`Hex characters are invalid: ${_optionalChain([o, 'optionalAccess', _5 => _5.message])}`,"invalid_hex_chars")}return new _(r)}static from(e){return typeof e=="string"?_.fromString(e):e instanceof Uint8Array?new _(e):e}static fromStrict(e){return typeof e=="string"?_.fromStringStrict(e):e instanceof Uint8Array?new _(e):e}static isValid(e){try{return e.strict?_.fromStrict(e.input):_.from(e.input),{valid:!0}}catch(t){return{valid:!1,invalidReason:_optionalChain([t, 'optionalAccess', _6 => _6.invalidReason]),invalidReasonMessage:_optionalChain([t, 'optionalAccess', _7 => _7.message])}}}equals(e){return this.data.length!==e.data.length?!1:this.data.every((t,r)=>t===e.data[r])}};_.LENGTH=32,_.LONG_STRING_LENGTH=64,_.ZERO=_.from("0x0"),_.ONE=_.from("0x1"),_.TWO=_.from("0x2"),_.THREE=_.from("0x3"),_.FOUR=_.from("0x4"),_.A=_.from("0xA");var u=_;var Ge=class Ge extends d{constructor(e){super();let{data:t}=e,r=l.fromHexInput(t);if(r.toUint8Array().length!==Ge.LENGTH)throw new Error(`Authentication Key length should be ${Ge.LENGTH}`);this.data=r}serialize(e){e.serializeFixedBytes(this.data.toUint8Array())}static deserialize(e){let t=e.deserializeFixedBytes(Ge.LENGTH);return new Ge({data:t})}toString(){return this.data.toString()}toUint8Array(){return this.data.toUint8Array()}static fromSchemeAndBytes(e){let{scheme:t,input:r}=e,o=l.fromHexInput(r).toUint8Array(),i=new Uint8Array([...o,t]),s=_sha3.sha3_256.create();s.update(i);let a=s.digest();return new Ge({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())}};Ge.LENGTH=32;var q=Ge;var _hmac = require('@noble/hashes/hmac');var _sha512 = require('@noble/hashes/sha512');var _bip39 = require('@scure/bip39'); var vo = _interopRequireWildcard(_bip39);var ma=/^m\/44'\/637'\/[0-9]+'\/[0-9]+'\/[0-9]+'?$/,ya= exports.APTOS_BIP44_REGEX =/^m\/44'\/637'\/[0-9]+'\/[0-9]+\/[0-9]+$/,fa= exports.KeyType =(e=>(e.ED25519="ed25519 seed",e))(fa||{}),Co= exports.HARDENED_OFFSET =2147483648;function Eo(n){return ya.test(n)}function Io(n){return ma.test(n)}var _r=(n,e)=>{let t=_hmac.hmac.create(_sha512.sha512,n).update(e).digest();return{key:t.slice(0,32),chainCode:t.slice(32)}},Uo= 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 _r(e,s)},Aa=n=>n.replace("'",""),Ro= exports.splitPath =n=>n.split("/").slice(1).map(Aa),In= exports.mnemonicToSeed =n=>{let e=n.trim().split(/\s+/).map(t=>t.toLowerCase()).join(" ");return vo.mnemonicToSeedSync(e)};var et=class extends d{toString(){let e=this.toUint8Array();return l.fromHexInput(e).toString()}},ie= exports.AccountPublicKey =class extends et{};var B=class extends d{toString(){let e=this.toUint8Array();return l.fromHexInput(e).toString()}};var mt=n=>typeof n=="string"?l.isValid(n).valid?n:Buffer.from(n,"utf8"):n;var xr=[237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16];function ha(n){let e=n.toUint8Array().slice(32);for(let t=xr.length-1;t>=0;t-=1){if(e[t]<xr[t])return!0;if(e[t]>xr[t])return!1}return!1}var Ke=class Ke extends ie{constructor(e){super();let t=l.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(!ha(r))return!1;let o=mt(t),i=l.fromHexInput(o).toUint8Array(),s=r.toUint8Array(),a=this.key.toUint8Array();return _ed25519.ed25519.verify(s,i,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 Ke(t)}static isPublicKey(e){return e instanceof Ke}static isInstance(e){return"key"in e&&_optionalChain([e, 'access', _8 => _8.key, 'optionalAccess', _9 => _9.data, 'optionalAccess', _10 => _10.length])===Ke.LENGTH}};Ke.LENGTH=32;var x=Ke,se=class se extends d{constructor(e){super();let t=l.fromHexInput(e);if(t.toUint8Array().length!==se.LENGTH)throw new Error(`PrivateKey length should be ${se.LENGTH}`);this.signingKey=t}static generate(){let e=_ed25519.ed25519.utils.randomPrivateKey();return new se(e)}static fromDerivationPath(e,t){if(!Io(e))throw new Error(`Invalid derivation path ${e}`);return se.fromDerivationPathInner(e,In(t))}static fromDerivationPathInner(e,t,r=Co){let{key:o,chainCode:i}=_r(se.SLIP_0010_SEED,t),s=Ro(e).map(c=>parseInt(c,10)),{key:a}=s.reduce((c,p)=>Uo(c,p+r),{key:o,chainCode:i});return new se(a)}publicKey(){let e=_ed25519.ed25519.getPublicKey(this.signingKey.toUint8Array());return new x(e)}sign(e){let t=mt(e),r=l.fromHexInput(t).toUint8Array(),o=_ed25519.ed25519.sign(r,this.signingKey.toUint8Array());return new v(o)}toUint8Array(){return this.signingKey.toUint8Array()}toString(){return this.signingKey.toString()}serialize(e){e.serializeBytes(this.toUint8Array())}static deserialize(e){let t=e.deserializeBytes();return new se(t)}static isPrivateKey(e){return e instanceof se}};se.LENGTH=32,se.SLIP_0010_SEED="ed25519 seed";var L=se,yt=class yt extends B{constructor(e){super();let t=l.fromHexInput(e);if(t.toUint8Array().length!==yt.LENGTH)throw new Error(`Signature length should be ${yt.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 yt(t)}};yt.LENGTH=64;var v=yt;var ae=class ae extends ie{constructor(e){super();let{publicKeys:t,threshold:r}=e;if(t.length>ae.MAX_KEYS||t.length<ae.MIN_KEYS)throw new Error(`Must have between ${ae.MIN_KEYS} and ${ae.MAX_KEYS} public keys, inclusive`);if(r<ae.MIN_THRESHOLD||r>t.length)throw new Error(`Threshold must be between ${ae.MIN_THRESHOLD} and ${t.length}, inclusive`);this.publicKeys=t,this.threshold=r}verifySignature(e){let{message:t,signature:r}=e;if(!(r instanceof tt))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*x.LENGTH+1);return this.publicKeys.forEach((t,r)=>{e.set(t.toUint8Array(),r*x.LENGTH)}),e[this.publicKeys.length*x.LENGTH]=this.threshold,e}serialize(e){e.serializeBytes(this.toUint8Array())}static deserialize(e){let t=e.deserializeBytes(),r=t[t.length-1],o=[];for(let i=0;i<t.length-1;i+=x.LENGTH){let s=i;o.push(new x(t.subarray(s,s+x.LENGTH)))}return new ae({publicKeys:o,threshold:r})}};ae.MAX_KEYS=32,ae.MIN_KEYS=2,ae.MIN_THRESHOLD=1;var ft=ae,J=class J extends B{constructor(e){super();let{signatures:t,bitmap:r}=e;if(t.length>J.MAX_SIGNATURES_SUPPORTED)throw new Error(`The number of signatures cannot be greater than ${J.MAX_SIGNATURES_SUPPORTED}`);if(this.signatures=t,!(r instanceof Uint8Array))this.bitmap=J.createBitmap({bits:r});else{if(r.length!==J.BITMAP_LEN)throw new Error(`"bitmap" length should be ${J.BITMAP_LEN}`);this.bitmap=r}}toUint8Array(){let e=new Uint8Array(this.signatures.length*v.LENGTH+J.BITMAP_LEN);return this.signatures.forEach((t,r)=>{e.set(t.toUint8Array(),r*v.LENGTH)}),e.set(this.bitmap,this.signatures.length*v.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+=v.LENGTH){let s=i;o.push(new v(t.subarray(s,s+v.LENGTH)))}return new J({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>=J.MAX_SIGNATURES_SUPPORTED)throw new Error(`Cannot have a signature larger than ${J.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}};J.MAX_SIGNATURES_SUPPORTED=32,J.BITMAP_LEN=4;var tt=J;var _secp256k1 = require('@noble/curves/secp256k1');var _bip32 = require('@scure/bip32');var Ne=class Ne extends et{constructor(e){super();let t=l.fromHexInput(e);if(t.toUint8Array().length!==Ne.LENGTH)throw new Error(`PublicKey length should be ${Ne.LENGTH}`);this.key=t}verifySignature(e){let{message:t,signature:r}=e,o=mt(t),i=l.fromHexInput(o).toUint8Array(),s=_sha3.sha3_256.call(void 0, i),a=r.toUint8Array();return _secp256k1.secp256k1.verify(a,s,this.key.toUint8Array(),{lowS:!0})}toUint8Array(){return this.key.toUint8Array()}serialize(e){e.serializeBytes(this.key.toUint8Array())}static deserialize(e){let t=e.deserializeBytes();return new Ne(t)}static isPublicKey(e){return e instanceof Ne}static isInstance(e){return"key"in e&&_optionalChain([e, 'access', _11 => _11.key, 'optionalAccess', _12 => _12.data, 'optionalAccess', _13 => _13.length])===Ne.LENGTH}};Ne.LENGTH=65;var Pe=Ne,he=class he extends d{constructor(e){super();let t=l.fromHexInput(e);if(t.toUint8Array().length!==he.LENGTH)throw new Error(`PrivateKey length should be ${he.LENGTH}`);this.key=t}static generate(){let e=_secp256k1.secp256k1.utils.randomPrivateKey();return new he(e)}static fromDerivationPath(e,t){if(!Eo(e))throw new Error(`Invalid derivation path ${e}`);return he.fromDerivationPathInner(e,In(t))}static fromDerivationPathInner(e,t){let{privateKey:r}=_bip32.HDKey.fromMasterSeed(t).derive(e);if(r===null)throw new Error("Invalid key");return new he(r)}sign(e){let t=mt(e),r=l.fromHexInput(t),o=_sha3.sha3_256.call(void 0, r.toUint8Array()),i=_secp256k1.secp256k1.sign(o,this.key.toUint8Array(),{lowS:!0});return new ht(i.toCompactRawBytes())}publicKey(){let e=_secp256k1.secp256k1.getPublicKey(this.key.toUint8Array(),!1);return new Pe(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 he(t)}static isPrivateKey(e){return e instanceof he}};he.LENGTH=32;var nt=he,At=class At extends B{constructor(e){super();let t=l.fromHexInput(e);if(t.toUint8Array().length!==At.LENGTH)throw new Error(`Signature length should be ${At.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 At(t)}};At.LENGTH=64;var ht=At;var _jwtdecode = require('jwt-decode');var rt=class n extends et{constructor(e){super();let t=e.constructor.name;switch(t){case x.name:this.publicKey=e,this.variant=0;break;default:throw new Error(`Unsupported key for EphemeralPublicKey - ${t}`)}}toUint8Array(){return this.bcsToBytes()}verifySignature(e){let{message:t,signature:r}=e;return this.publicKey.verifySignature({message:t,signature:r.signature})}serialize(e){if(this.publicKey instanceof x)e.serializeU32AsUleb128(0),this.publicKey.serialize(e);else throw new Error("Unknown public key type")}static deserialize(e){let t=e.deserializeUleb128AsU32();switch(t){case 0:return new n(x.deserialize(e));default:throw new Error(`Unknown variant index for EphemeralPublicKey: ${t}`)}}static isPublicKey(e){return e instanceof n}},Te= exports.EphemeralSignature =class n extends B{constructor(e){super();let t=e.constructor.name;switch(t){case v.name:this.signature=e;break;default:throw new Error(`Unsupported signature for EphemeralSignature - ${t}`)}}toUint8Array(){return this.bcsToBytes()}static fromHex(e){let t=l.fromHexInput(e),r=new oe(t.toUint8Array());return n.deserialize(r)}serialize(e){if(this.signature instanceof v)e.serializeU32AsUleb128(0),this.signature.serialize(e);else throw new Error("Unknown signature type")}static deserialize(e){let t=e.deserializeUleb128AsU32();switch(t){case 0:return new n(v.deserialize(e));default:throw new Error(`Unknown variant index for EphemeralSignature: ${t}`)}}};var _poseidonlite = require('poseidon-lite');var Pr=[_poseidonlite.poseidon1,_poseidonlite.poseidon2,_poseidonlite.poseidon3,_poseidonlite.poseidon4,_poseidonlite.poseidon5,_poseidonlite.poseidon6,_poseidonlite.poseidon7,_poseidonlite.poseidon8,_poseidonlite.poseidon9,_poseidonlite.poseidon10,_poseidonlite.poseidon11,_poseidonlite.poseidon12,_poseidonlite.poseidon13,_poseidonlite.poseidon14,_poseidonlite.poseidon15,_poseidonlite.poseidon16],Do=31,Ga=16,ko=(Ga-1)*Do;function zn(n,e){let r=new TextEncoder().encode(n);return Ka(r,e)}function Ka(n,e){if(n.length>e)throw new Error(`Inputted bytes of length ${n} is longer than ${e}`);let t=vr(n,e);return Qt(t)}function Na(n,e){if(n.length>e)throw new Error(`Input bytes of length ${n} is longer than ${e}`);let t=Ma(n,e);return Oa(t)}function vr(n,e){if(n.length>e)throw new Error(`Input bytes of length ${n} is longer than ${e}`);return Na(n,e).concat([BigInt(n.length)])}function Oa(n){if(n.length>ko)throw new Error(`Can't pack more than ${ko}. Was given ${n.length} bytes`);return Fa(n,Do).map(e=>Ht(e))}function Fa(n,e){let t=[];for(let r=0;r<n.length;r+=e)t.push(n.subarray(r,r+e));return t}function Ht(n){let e=BigInt(0);for(let t=n.length-1;t>=0;t-=1)e=e<<BigInt(8)|BigInt(n[t]);return e}function Bo(n,e){let t=new Uint8Array(e);for(let r=0;r<e;r+=1)t[r]=Number(n&BigInt(255)),n>>=BigInt(8);return t}function Ma(n,e){if(e<n.length)throw new Error("Padded size must be greater than or equal to the input array size.");let t=new Uint8Array(e);t.set(n);for(let r=n.length;r<e;r+=1)t[r]=0;return t}function Qt(n){if(n.length>Pr.length)throw new Error(`Unable to hash input of length ${n.length}. Max input length is ${Pr.length}`);return Pr[n.length-1](n)}var kn=class extends d{toString(){let e=this.bcsToBytes();return l.fromHexInput(e).toString()}};var Tt=(i=>(i.FULLNODE="Fullnode",i.INDEXER="Indexer",i.FAUCET="Faucet",i.PEPPER="Pepper",i.PROVER="Prover",i))(Tt||{}),Go= exports.DEFAULT_MAX_GAS_AMOUNT =2e5,Ko= exports.DEFAULT_TXN_EXP_SEC_FROM_NOW =20,Dn= exports.DEFAULT_TXN_TIMEOUT_SEC =20,ot= exports.APTOS_COIN ="0x1::aptos_coin::AptosCoin",No= exports.RAW_TRANSACTION_SALT ="APTOS::RawTransaction",Cr= exports.RAW_TRANSACTION_WITH_DATA_SALT ="APTOS::RawTransactionWithData",ve= exports.ProcessorType =(c=>(c.ACCOUNT_TRANSACTION_PROCESSOR="account_transactions_processor",c.DEFAULT="default_processor",c.EVENTS_PROCESSOR="events_processor",c.FUNGIBLE_ASSET_PROCESSOR="fungible_asset_processor",c.STAKE_PROCESSOR="stake_processor",c.TOKEN_V2_PROCESSOR="token_v2_processor",c.USER_TRANSACTION_PROCESSOR="user_transaction_processor",c.OBJECT_PROCESSOR="objects_processor",c))(ve||{});var ye=class extends Error{constructor({apiType:e,aptosRequest:t,aptosResponse:r}){super(qa({apiType:e,aptosRequest:t,aptosResponse:r})),this.name="AptosApiError",this.url=r.url,this.status=r.status,this.statusText=r.statusText,this.data=r.data,this.request=t}};function qa({apiType:n,aptosRequest:e,aptosResponse:t}){let r=_optionalChain([t, 'access', _14 => _14.headers, 'optionalAccess', _15 => _15.traceparent, 'optionalAccess', _16 => _16.split, 'call', _17 => _17("-"), 'access', _18 => _18[1]]),o=r?`(trace_id:${r}) `:"",i=`Request to [${n}]: ${e.method} ${_nullishCoalesce(t.url, () => (e.url))} ${o}failed with`;return n==="Indexer"&&_optionalChain([t, 'access', _19 => _19.data, 'optionalAccess', _20 => _20.errors, 'optionalAccess', _21 => _21[0], 'optionalAccess', _22 => _22.message])!=null?`${i}: ${t.data.errors[0].message}`:_optionalChain([t, 'access', _23 => _23.data, 'optionalAccess', _24 => _24.message])!=null&&_optionalChain([t, 'access', _25 => _25.data, 'optionalAccess', _26 => _26.error_code])!=null?`${i}: ${JSON.stringify(t.data)}`:`${i} status: ${t.statusText}(code:${t.status}) and response body: ${Va(t.data)}`}var Er=400;function Va(n){let e=JSON.stringify(n);return e.length<=Er?e:`truncated(original_size:${e.length}): ${e.slice(0,Er/2)}...${e.slice(-Er/2)}`}var Oo="1.27.1";var Fo={mainnet:"https://api.mainnet.aptoslabs.com/v1/graphql",testnet:"https://api.testnet.aptoslabs.com/v1/graphql",devnet:"https://api.devnet.aptoslabs.com/v1/graphql",local:"http://127.0.0.1:8090/v1/graphql"},Mo= exports.NetworkToNodeAPI ={mainnet:"https://api.mainnet.aptoslabs.com/v1",testnet:"https://api.testnet.aptoslabs.com/v1",devnet:"https://api.devnet.aptoslabs.com/v1",local:"http://127.0.0.1:8080/v1"},qo= exports.NetworkToFaucetAPI ={mainnet:"https://faucet.mainnet.aptoslabs.com",testnet:"https://faucet.testnet.aptoslabs.com",devnet:"https://faucet.devnet.aptoslabs.com",local:"http://127.0.0.1:8081"},Ir= exports.NetworkToPepperAPI ={mainnet:"https://api.mainnet.aptoslabs.com/keyless/pepper/v0",testnet:"https://api.testnet.aptoslabs.com/keyless/pepper/v0",devnet:"https://api.devnet.aptoslabs.com/keyless/pepper/v0",local:"https://api.devnet.aptoslabs.com/keyless/pepper/v0"},Ur= exports.NetworkToProverAPI ={mainnet:"https://api.mainnet.aptoslabs.com/keyless/prover/v0",testnet:"https://api.testnet.aptoslabs.com/keyless/prover/v0",devnet:"https://api.devnet.aptoslabs.com/keyless/prover/v0",local:"https://api.devnet.aptoslabs.com/keyless/prover/v0"},Rr= exports.Network =(i=>(i.MAINNET="mainnet",i.TESTNET="testnet",i.DEVNET="devnet",i.LOCAL="local",i.CUSTOM="custom",i))(Rr||{}),zr= exports.NetworkToChainId ={mainnet:1,testnet:2,local:4},Rd= exports.NetworkToNetworkName ={mainnet:"mainnet",testnet:"testnet",devnet:"devnet",local:"local",custom:"custom"};function Vo(n,e){let t=e.bcsToBytes(),r=new oe(t);return n.deserialize(r)}async function $a(n,e){let{url:t,method:r,body:o,contentType:i,params:s,overrides:a,originMethod:c}=n,p={..._optionalChain([a, 'optionalAccess', _27 => _27.HEADERS]),"x-aptos-client":`aptos-typescript-sdk/${Oo}`,"content-type":_nullishCoalesce(i, () => ("application/json")),"x-aptos-typescript-sdk-origin-method":c};return _optionalChain([a, 'optionalAccess', _28 => _28.AUTH_TOKEN])&&(p.Authorization=`Bearer ${_optionalChain([a, 'optionalAccess', _29 => _29.AUTH_TOKEN])}`),_optionalChain([a, 'optionalAccess', _30 => _30.API_KEY])&&(p.Authorization=`Bearer ${_optionalChain([a, 'optionalAccess', _31 => _31.API_KEY])}`),e.provider({url:t,method:r,body:o,params:s,headers:p,overrides:a})}async function Bn(n,e,t){let{url:r,path:o}=n,i=o?`${r}/${o}`:r,s=await $a({...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 ye({apiType:t,aptosRequest:n,aptosResponse:a});if(t==="Indexer"){let c=a.data;if(c.errors)throw new ye({apiType:t,aptosRequest:n,aptosResponse:a});a.data=c.data}else if((t==="Pepper"||t==="Prover")&&a.status>=400)throw new ye({apiType:t,aptosRequest:n,aptosResponse:a});if(a.status>=200&&a.status<300)return a;throw new ye({apiType:t,aptosRequest:n,aptosResponse:a})}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 Bn({url:p,method:"GET",originMethod:a,path:s,contentType:o,acceptType:i,params:r,overrides:{...e.clientConfig,...t}},e,n.type)}async function V(n){let{aptosConfig:e}=n;return kr({...n,type:"Fullnode",overrides:{...e.clientConfig,...e.fullnodeConfig,...n.overrides,HEADERS:{..._optionalChain([e, 'access', _32 => _32.clientConfig, 'optionalAccess', _33 => _33.HEADERS]),..._optionalChain([e, 'access', _34 => _34.fullnodeConfig, 'optionalAccess', _35 => _35.HEADERS])}}})}async function el(n){return kr({...n,type:"Pepper"})}async function bt(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 Wt(n){let{type:e,originMethod:t,path:r,body:o,acceptType:i,contentType:s,params:a,aptosConfig:c,overrides:p}=n,y=c.getRequestUrl(e);return Bn({url:y,method:"POST",originMethod:t,path:r,body:o,contentType:s,acceptType:i,params:a,overrides:p},c,n.type)}async function Oe(n){let{aptosConfig:e}=n;return Wt({...n,type:"Fullnode",overrides:{...e.clientConfig,...e.fullnodeConfig,...n.overrides,HEADERS:{..._optionalChain([e, 'access', _36 => _36.clientConfig, 'optionalAccess', _37 => _37.HEADERS]),..._optionalChain([e, 'access', _38 => _38.fullnodeConfig, 'optionalAccess', _39 => _39.HEADERS])}}})}async function $o(n){let{aptosConfig:e}=n;return Wt({...n,type:"Indexer",overrides:{...e.clientConfig,...e.indexerConfig,...n.overrides,HEADERS:{..._optionalChain([e, 'access', _40 => _40.clientConfig, 'optionalAccess', _41 => _41.HEADERS]),..._optionalChain([e, 'access', _42 => _42.indexerConfig, 'optionalAccess', _43 => _43.HEADERS])}}})}async function Lo(n){let{aptosConfig:e}=n,t={...e,clientConfig:{...e.clientConfig}};return _optionalChainDelete([t, 'optionalAccess', _44 => _44.clientConfig, 'optionalAccess', _45 => delete _45.API_KEY]),Wt({...n,type:"Faucet",overrides:{...t.clientConfig,...t.faucetConfig,...n.overrides,HEADERS:{..._optionalChain([t, 'access', _46 => _46.clientConfig, 'optionalAccess', _47 => _47.HEADERS]),..._optionalChain([t, 'access', _48 => _48.faucetConfig, 'optionalAccess', _49 => _49.HEADERS])}}})}async function Ho(n){return Wt({...n,type:"Pepper"})}async function Qo(n){return Wt({...n,type:"Prover"})}var Dr=new Map;function Fe(n,e,t){return async(...r)=>{if(Dr.has(e)){let{value:i,timestamp:s}=Dr.get(e);if(t===void 0||Date.now()-s<=t)return i}let o=await n(...r);return Dr.set(e,{value:o,timestamp:Date.now()}),o}}var Ul=1e7,Ha= exports.MAX_AUD_VAL_BYTES =120,Qa= exports.MAX_UID_KEY_BYTES =30,Wa= exports.MAX_UID_VAL_BYTES =330,Rl= exports.MAX_ISS_VAL_BYTES =120,zl= exports.MAX_EXTRA_FIELD_BYTES =350,kl= exports.MAX_JWT_HEADER_B64_BYTES =300,Dl= exports.MAX_COMMITED_EPK_BYTES =93,be=class be extends ie{constructor(e,t){super();let r=l.fromHexInput(t).toUint8Array();if(r.length!==be.ID_COMMITMENT_LENGTH)throw new Error(`Id Commitment length in bytes should be ${be.ID_COMMITMENT_LENGTH}`);this.iss=e,this.idCommitment=r}authKey(){let e=new Z;return e.serializeU32AsUleb128(3),e.serializeFixedBytes(this.bcsToBytes()),q.fromSchemeAndBytes({scheme:2,input:e.toUint8Array()})}toUint8Array(){return this.bcsToBytes()}toString(){return l.fromHexInput(this.toUint8Array()).toString()}verifySignature(e){throw new Error("Not yet implemented")}serialize(e){e.serializeStr(this.iss),e.serializeBytes(this.idCommitment)}static deserialize(e){let t=e.deserializeStr(),r=e.deserializeBytes();return new be(t,r)}static load(e){let t=e.deserializeStr(),r=e.deserializeBytes();return new be(t,r)}static isPublicKey(e){return e instanceof be}static create(e){return Wo(e),new be(e.iss,Wo(e))}static fromJwtAndPepper(e){let{jwt:t,pepper:r,uidKey:o="sub"}=e,i=_jwtdecode.jwtDecode.call(void 0, t),s=i.iss;if(typeof i.aud!="string")throw new Error("aud was not found or an array of values");let a=i.aud,c=i[o];return be.create({iss:s,uidKey:o,uidVal:c,aud:a,pepper:r})}static isInstance(e){return"iss"in e&&typeof e.iss=="string"&&"idCommitment"in e&&e.idCommitment instanceof Uint8Array}};be.ID_COMMITMENT_LENGTH=32;var ee=be;function Wo(n){let{uidKey:e,uidVal:t,aud:r,pepper:o}=n,i=[Ht(l.fromHexInput(o).toUint8Array()),zn(r,Ha),zn(t,Wa),zn(e,Qa)];return Bo(Qt(i),ee.ID_COMMITMENT_LENGTH)}var Ee=class n extends B{constructor(e){super();let{jwtHeader:t,ephemeralCertificate:r,expiryDateSecs:o,ephemeralPublicKey:i,ephemeralSignature:s}=e;this.jwtHeader=t,this.ephemeralCertificate=r,this.expiryDateSecs=o,this.ephemeralPublicKey=i,this.ephemeralSignature=s}toUint8Array(){return this.bcsToBytes()}serialize(e){this.ephemeralCertificate.serialize(e),e.serializeStr(this.jwtHeader),e.serializeU64(this.expiryDateSecs),this.ephemeralPublicKey.serialize(e),this.ephemeralSignature.serialize(e)}static deserialize(e){let t=wt.deserialize(e),r=e.deserializeStr(),o=e.deserializeU64(),i=rt.deserialize(e),s=Te.deserialize(e);return new n({jwtHeader:r,expiryDateSecs:Number(o),ephemeralCertificate:t,ephemeralPublicKey:i,ephemeralSignature:s})}static getSimulationSignature(){return new n({jwtHeader:"{}",ephemeralCertificate:new wt(new Ie({proof:new _t(new St({a:new Uint8Array(32),b:new Uint8Array(64),c:new Uint8Array(32)}),0),expHorizonSecs:0}),0),expiryDateSecs:0,ephemeralPublicKey:new rt(new x(new Uint8Array(32))),ephemeralSignature:new Te(new v(new Uint8Array(64)))})}static isSignature(e){return e instanceof n}},wt= exports.EphemeralCertificate =class n extends B{constructor(e,t){super(),this.signature=e,this.variant=t}toUint8Array(){return this.signature.toUint8Array()}serialize(e){e.serializeU32AsUleb128(this.variant),this.signature.serialize(e)}static deserialize(e){let t=e.deserializeUleb128AsU32();switch(t){case 0:return new n(Ie.deserialize(e),t);default:throw new Error(`Unknown variant index for EphemeralCertificate: ${t}`)}}},Ce=class n extends d{constructor(e){if(super(),this.data=l.fromHexInput(e).toUint8Array(),this.data.length!==32)throw new Error("Input needs to be 32 bytes")}serialize(e){e.serializeFixedBytes(this.data)}static deserialize(e){let t=e.deserializeFixedBytes(32);return new n(t)}},it=class n extends d{constructor(e){if(super(),this.data=l.fromHexInput(e).toUint8Array(),this.data.length!==64)throw new Error("Input needs to be 64 bytes")}serialize(e){e.serializeFixedBytes(this.data)}static deserialize(e){let t=e.deserializeFixedBytes(64);return new n(t)}},St= exports.Groth16Zkp =class n extends kn{constructor(e){super();let{a:t,b:r,c:o}=e;this.a=new Ce(t),this.b=new it(r),this.c=new Ce(o)}serialize(e){this.a.serialize(e),this.b.serialize(e),this.c.serialize(e)}static deserialize(e){let t=Ce.deserialize(e).bcsToBytes(),r=it.deserialize(e).bcsToBytes(),o=Ce.deserialize(e).bcsToBytes();return new n({a:t,b:r,c:o})}},_t= exports.ZkProof =class n extends d{constructor(e,t){super(),this.proof=e,this.variant=t}serialize(e){e.serializeU32AsUleb128(this.variant),this.proof.serialize(e)}static deserialize(e){let t=e.deserializeUleb128AsU32();switch(t){case 0:return new n(St.deserialize(e),t);default:throw new Error(`Unknown variant index for ZkProof: ${t}`)}}},Ie= exports.ZeroKnowledgeSig =class n extends B{constructor(e){super();let{proof:t,expHorizonSecs:r,trainingWheelsSignature:o,extraField:i,overrideAudVal:s}=e;this.proof=t,this.expHorizonSecs=r,this.trainingWheelsSignature=o,this.extraField=i,this.overrideAudVal=s}toUint8Array(){return this.bcsToBytes()}static fromBytes(e){return n.deserialize(new oe(e))}serialize(e){this.proof.serialize(e),e.serializeU64(this.expHorizonSecs),e.serializeOptionStr(this.extraField),e.serializeOptionStr(this.overrideAudVal),e.serializeOption(this.trainingWheelsSignature)}static deserialize(e){let t=_t.deserialize(e),r=Number(e.deserializeU64()),o=e.deserializeOptionStr(),i=e.deserializeOptionStr(),s=e.deserializeOption(Te);return new n({proof:t,expHorizonSecs:r,trainingWheelsSignature:s,extraField:o,overrideAudVal:i})}},Br= exports.KeylessConfiguration =class n{constructor(e,t){this.verficationKey=e,this.maxExpHorizonSecs=t}static create(e,t){return new n(new Gr({alphaG1:e.alpha_g1,betaG2:e.beta_g2,deltaG2:e.delta_g2,gammaAbcG1:e.gamma_abc_g1,gammaG2:e.gamma_g2}),t)}},Gr=class n{constructor(e){let{alphaG1:t,betaG2:r,deltaG2:o,gammaAbcG1:i,gammaG2:s}=e;this.alphaG1=new Ce(t),this.betaG2=new it(r),this.deltaG2=new it(o),this.gammaAbcG1=[new Ce(i[0]),new Ce(i[1])],this.gammaG2=new it(s)}static fromGroth16VerificationKeyResponse(e){return new n({alphaG1:e.alpha_g1,betaG2:e.beta_g2,deltaG2:e.delta_g2,gammaAbcG1:e.gamma_abc_g1,gammaG2:e.gamma_g2})}};async function jo(n){let{aptosConfig:e}=n;return Fe(async()=>{let t=await ja(n),r=await Xa(n);return Br.create(r,Number(t.max_exp_horizon_secs))},`keyless-configuration-${e.network}`,1e3*60*5)()}async function ja(n){let{aptosConfig:e,options:t}=n,r="0x1::keyless_account::Configuration",{data:o}=await V({aptosConfig:e,originMethod:"getKeylessConfigurationResource",path:`accounts/${u.from("0x1").toString()}/resource/${r}`,params:{ledger_version:_optionalChain([t, 'optionalAccess', _50 => _50.ledgerVersion])}});return o.data}async function Xa(n){let{aptosConfig:e,options:t}=n,r="0x1::keyless_account::Groth16VerificationKey",{data:o}=await V({aptosConfig:e,originMethod:"getGroth16VerificationKeyResource",path:`accounts/${u.from("0x1").toString()}/resource/${r}`,params:{ledger_version:_optionalChain([t, 'optionalAccess', _51 => _51.ledgerVersion])}});return o.data}var D=class n extends ie{constructor(e){if(super(),this.publicKey=e,e instanceof x)this.variant=0;else if(e instanceof Pe)this.variant=1;else if(e instanceof ee)this.variant=3;else throw new Error("Unsupported public key type")}verifySignature(e){let{message:t,signature:r}=e;return G.isInstance(r)?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=x.deserialize(e);break;case 1:r=Pe.deserialize(e);break;case 3:r=ee.deserialize(e);break;default:throw new Error(`Unknown variant index for AnyPublicKey: ${t}`)}return new n(r)}static isPublicKey(e){return e instanceof n}isEd25519(){return this.publicKey instanceof x}isSecp256k1PublicKey(){return this.publicKey instanceof Pe}static isInstance(e){return"publicKey"in e&&"variant"in e}},G= exports.AnySignature =class n extends B{constructor(e){if(super(),this.signature=e,e instanceof v)this.variant=0;else if(e instanceof ht)this.variant=1;else if(e instanceof Ee)this.variant=3;else throw new Error("Unsupported signature type")}toUint8Array(){return console.warn("[Aptos SDK] Calls to AnySignature.toUint8Array() will soon return the underlying signature bytes. Use AnySignature.bcsToBytes() instead."),this.bcsToBytes()}serialize(e){e.serializeU32AsUleb128(this.variant),this.signature.serialize(e)}static deserialize(e){let t=e.deserializeUleb128AsU32(),r;switch(t){case 0:r=v.deserialize(e);break;case 1:r=ht.deserialize(e);break;case 3:r=Ee.deserialize(e);break;default:throw new Error(`Unknown variant index for AnySignature: ${t}`)}return new n(r)}static isInstance(e){return"signature"in e&&typeof e.signature=="object"&&e.signature!==null&&"toUint8Array"in e.signature}};function Ya(n){let e=n;return e-=e>>1&1431655765,e=(e&858993459)+(e>>2&858993459),(e+(e>>4)&252645135)*16843009>>24}var xt=class n extends ie{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 D?o:new D(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(D),r=e.deserializeU8();return new n({publicKeys:t,signaturesRequired:r})}createBitmap(e){let{bits:t}=e,r=128,o=new Uint8Array([0,0,0,0]),i=new Set;return t.forEach((s,a)=>{if(a+1>this.publicKeys.length)throw new Error(`Signature index ${a+1} is out of public keys range, ${this.publicKeys.length}.`);if(i.has(s))throw new Error(`Duplicate bit ${s} detected.`);i.add(s);let c=Math.floor(s/8),p=o[c];p|=r>>s%8,o[c]=p}),o}getIndex(e){let t=e instanceof D?e:new D(e),r=this.publicKeys.findIndex(o=>o.toString()===t.toString());if(r!==-1)return r;throw new Error("Public key not found in MultiKey")}},te=class te extends B{constructor(e){super();let{signatures:t,bitmap:r}=e;if(t.length>te.MAX_SIGNATURES_SUPPORTED)throw new Error(`The number of signatures cannot be greater than ${te.MAX_SIGNATURES_SUPPORTED}`);if(this.signatures=t.map(i=>i instanceof G?i:new G(i)),!(r instanceof Uint8Array))this.bitmap=te.createBitmap({bits:r});else{if(r.length!==te.BITMAP_LEN)throw new Error(`"bitmap" length should be ${te.BITMAP_LEN}`);this.bitmap=r}let o=this.bitmap.reduce((i,s)=>i+Ya(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>=te.MAX_SIGNATURES_SUPPORTED)throw new Error(`Cannot have a signature larger than ${te.MAX_SIGNATURES_SUPPORTED-1}.`);if(i.has(s))throw new Error("Duplicate bits detected.");i.add(s);let a=Math.floor(s/8),c=o[a];c|=r>>s%8,o[a]=c}),o}toUint8Array(){return this.bcsToBytes()}serialize(e){e.serializeVector(this.signatures),e.serializeBytes(this.bitmap)}static deserialize(e){let t=e.deserializeVector(G),r=e.deserializeBytes();return new te({signatures:t,bitmap:r})}};te.BITMAP_LEN=4,te.MAX_SIGNATURES_SUPPORTED=te.BITMAP_LEN*8;var st=te;var H=class extends d{static deserialize(e){let t=e.deserializeUleb128AsU32();switch(t){case 0:return fe.load(e);case 1:return Gn.load(e);case 2:return Q.load(e);case 3:return at.load(e);default:throw new Error(`Unknown variant index for AccountAuthenticator: ${t}`)}}isEd25519(){return this instanceof fe}isMultiEd25519(){return this instanceof Gn}isSingleKey(){return this instanceof Q}isMultiKey(){return this instanceof at}},fe= 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=x.deserialize(e),r=v.deserialize(e);return new n(t,r)}},Gn= 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=ft.deserialize(e),r=tt.deserialize(e);return new n(t,r)}},Q= 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=D.deserialize(e),r=G.deserialize(e);return new n(t,r)}},at= exports.AccountAuthenticatorMultiKey =class n extends H{constructor(e,t){super(),this.public_keys=e,this.signatures=t}serialize(e){e.serializeU32AsUleb128(3),this.public_keys.serialize(e),this.signatures.serialize(e)}static load(e){let t=xt.deserialize(e),r=st.deserialize(e);return new n(t,r)}};var Pt=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 R=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 Kr=(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))},Ug= 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))},Rg= exports.createTokenAddress =(n,e,t)=>{let r=`${e}::${t}`;return Kr(n,r)};var jt=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 R(t[1]))}serialize(e){this.address.serialize(e),this.name.serialize(e)}static deserialize(e){let t=u.deserialize(e),r=R.deserialize(e);return new n(t,r)}};var z=class extends d{static deserialize(e){let t=e.deserializeUleb128AsU32();switch(t){case 0:return K.load(e);case 1:return ce.load(e);case 2:return $.load(e);case 3:return Ve.load(e);case 4:return W.load(e);case 5:return vt.load(e);case 6:return C.load(e);case 7:return m.load(e);case 8:return Me.load(e);case 9:return qe.load(e);case 10:return $e.load(e);case 255:return k.load(e);default:throw new Error(`Unknown variant index for TypeTag: ${t}`)}}isBool(){return this instanceof K}isAddress(){return this instanceof W}isGeneric(){return this instanceof k}isSigner(){return this instanceof vt}isVector(){return this instanceof C}isStruct(){return this instanceof m}isU8(){return this instanceof ce}isU16(){return this instanceof Me}isU32(){return this instanceof qe}isU64(){return this instanceof $}isU128(){return this instanceof Ve}isU256(){return this instanceof $e}},K= exports.TypeTagBool =class n extends z{toString(){return"bool"}serialize(e){e.serializeU32AsUleb128(0)}static load(e){return new n}},ce= exports.TypeTagU8 =class n extends z{toString(){return"u8"}serialize(e){e.serializeU32AsUleb128(1)}static load(e){return new n}},Me= exports.TypeTagU16 =class n extends z{toString(){return"u16"}serialize(e){e.serializeU32AsUleb128(8)}static load(e){return new n}},qe= exports.TypeTagU32 =class n extends z{toString(){return"u32"}serialize(e){e.serializeU32AsUleb128(9)}static load(e){return new n}},$= exports.TypeTagU64 =class n extends z{toString(){return"u64"}serialize(e){e.serializeU32AsUleb128(2)}static load(e){return new n}},Ve= exports.TypeTagU128 =class n extends z{toString(){return"u128"}serialize(e){e.serializeU32AsUleb128(3)}static load(e){return new n}},$e= exports.TypeTagU256 =class n extends z{toString(){return"u256"}serialize(e){e.serializeU32AsUleb128(10)}static load(e){return new n}},W= exports.TypeTagAddress =class n extends z{toString(){return"address"}serialize(e){e.serializeU32AsUleb128(4)}static load(e){return new n}},vt= exports.TypeTagSigner =class n extends z{toString(){return"signer"}serialize(e){e.serializeU32AsUleb128(5)}static load(e){return new n}},Kn= exports.TypeTagReference =class n extends z{constructor(t){super();this.value=t}toString(){return`&${this.value.toString()}`}serialize(t){t.serializeU32AsUleb128(254)}static load(t){let r=z.deserialize(t);return new n(r)}},k= exports.TypeTagGeneric =class n extends z{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)}},C= exports.TypeTagVector =class n extends z{constructor(t){super();this.value=t}toString(){return`vector<${this.value.toString()}>`}static u8(){return new n(new ce)}serialize(t){t.serializeU32AsUleb128(6),this.value.serialize(t)}static load(t){let r=z.deserialize(t);return new n(r)}},m= exports.TypeTagStruct =class n extends z{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=Ue.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")}},Ue= 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=R.deserialize(e),o=R.deserialize(e),i=e.deserializeVector(z);return new n(t,r,o,i)}};function em(){return new Ue(u.ONE,new R("aptos_coin"),new R("AptosCoin"),[])}function P(){return new Ue(u.ONE,new R("string"),new R("String"),[])}function tm(n){return new Ue(u.ONE,new R("option"),new R("Option"),[n])}function ne(n){return new Ue(u.ONE,new R("object"),new R("Object"),[n])}function Za(n){let e=n.deserializeUleb128AsU32();switch(e){case 0:return F.deserialize(n);case 1:return O.deserialize(n);case 2:return ge.deserialize(n);case 3:return u.deserialize(n);case 4:return T.deserialize(n,F);case 5:return I.deserialize(n);case 6:return de.deserialize(n);case 7:return le.deserialize(n);case 8:return me.deserialize(n);default:throw new Error(`Unknown variant index for ScriptTransactionArgument: ${e}`)}}var ct=class extends d{static deserialize(e){let t=e.deserializeUleb128AsU32();switch(t){case 0:return Xt.load(e);case 2:return Yt.load(e);case 3:return Zt.load(e);default:throw new Error(`Unknown variant index for TransactionPayload: ${t}`)}}},Xt= exports.TransactionPayloadScript =class n extends ct{constructor(e){super(),this.script=e}serialize(e){e.serializeU32AsUleb128(0),this.script.serialize(e)}static load(e){let t=Jt.deserialize(e);return new n(t)}},Yt= exports.TransactionPayloadEntryFunction =class n extends ct{constructor(e){super(),this.entryFunction=e}serialize(e){e.serializeU32AsUleb128(2),this.entryFunction.serialize(e)}static load(e){let t=ut.deserialize(e);return new n(t)}},Zt= exports.TransactionPayloadMultiSig =class n extends ct{constructor(e){super(),this.multiSig=e}serialize(e){e.serializeU32AsUleb128(3),this.multiSig.serialize(e)}static load(e){let t=en.deserialize(e);return new n(t)}},ut= 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(jt.fromStr(e),new R(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=jt.deserialize(e),r=R.deserialize(e),o=e.deserializeVector(z),i=e.deserializeUleb128AsU32(),s=new Array;for(let a=0;a<i;a+=1){let c=e.deserializeUleb128AsU32(),p=Cn.deserialize(e,c);s.push(p)}return new n(t,r,o,s)}},Jt= 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(z),o=e.deserializeUleb128AsU32(),i=new Array;for(let s=0;s<o;s+=1){let a=Za(e);i.push(a)}return new n(t,r,i)}},en= 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=tn.deserialize(e)),new n(t,o)}},tn= 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(ut.deserialize(e))}};var ue=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=ct.deserialize(e),i=e.deserializeU64(),s=e.deserializeU64(),a=e.deserializeU64(),c=Pt.deserialize(e);return new n(t,r,o,i,s,a,c)}},Nn= exports.RawTransactionWithData =class extends d{static deserialize(e){let t=e.deserializeUleb128AsU32();switch(t){case 0:return pt.load(e);case 1:return dt.load(e);default:throw new Error(`Unknown variant index for RawTransactionWithData: ${t}`)}}},pt= exports.MultiAgentRawTransaction =class n extends Nn{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=ue.deserialize(e),r=e.deserializeVector(u);return new n(t,r)}},dt= exports.FeePayerRawTransaction =class n extends Nn{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=ue.deserialize(e),r=e.deserializeVector(u),o=u.deserialize(e);return new n(t,r,o)}};var On=class extends d{constructor(t){super();this.accountAddress=u.ONE;this.moduleName=new b("account");this.structName=new b("RotationProofChallenge");this.sequenceNumber=new O(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 Re=class extends d{static deserialize(e){let t=e.deserializeUleb128AsU32();switch(t){case 0:return Ct.load(e);case 1:return Nr.load(e);case 2:return Et.load(e);case 3:return It.load(e);case 4:return Ut.load(e);default:throw new Error(`Unknown variant index for TransactionAuthenticator: ${t}`)}}},Ct= exports.TransactionAuthenticatorEd25519 =class n extends Re{constructor(e,t){super(),this.public_key=e,this.signature=t}serialize(e){e.serializeU32AsUleb128(0),this.public_key.serialize(e),this.signature.serialize(e)}static load(e){let t=x.deserialize(e),r=v.deserialize(e);return new n(t,r)}},Nr= exports.TransactionAuthenticatorMultiEd25519 =class n extends Re{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=ft.deserialize(e),r=tt.deserialize(e);return new n(t,r)}},Et= exports.TransactionAuthenticatorMultiAgent =class n extends Re{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 Re{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)}},Ut= exports.TransactionAuthenticatorSingleSender =class n extends Re{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 lt=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=ue.deserialize(e),r=Re.deserialize(e);return new n(t,r)}};var Fn=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=ue.deserialize(e),r=e.deserializeBool(),o;return r&&(o=u.deserialize(e)),new n(t,o)}};var Mn=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=ue.deserialize(e),r=e.deserializeVector(u),o=e.deserializeBool(),i;return o&&(i=u.deserialize(e)),new n(t,r,i)}};function Or(n){return n.feePayerAddress?new dt(n.rawTransaction,_nullishCoalesce(n.secondarySignerAddresses, () => ([])),n.feePayerAddress):n.secondarySignerAddresses?new pt(n.rawTransaction,n.secondarySignerAddresses):n.rawTransaction}function Rt(n,e){let t=_sha3.sha3_256.create();if(!e.startsWith("APTOS::"))throw new Error(`Domain separator needs to start with 'APTOS::'. Provided - ${e}`);t.update(e);let r=t.digest(),o=n,i=new Uint8Array(r.length+o.length);return i.set(r),i.set(o,r.length),i}function ly(n){return Rt(n.bcsToBytes(),`APTOS::${n.constructor.name}`)}function zt(n){let e=Or(n);return n.feePayerAddress?Rt(e.bcsToBytes(),Cr):n.secondarySignerAddresses?Rt(e.bcsToBytes(),Cr):Rt(e.bcsToBytes(),No)}var kt=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=L.generate();return new n({privateKey:e})}static fromDerivationPath(e){let{path:t,mnemonic:r}=e,o=L.fromDerivationPath(t,r);return new n({privateKey:o})}verifySignature(e){return this.publicKey.verifySignature(e)}signWithAuthenticator(e){return new fe(this.publicKey,this.privateKey.sign(e))}signTransactionWithAuthenticator(e){return new fe(this.publicKey,this.signTransaction(e))}sign(e){return this.privateKey.sign(e)}signTransaction(e){return this.sign(zt(e))}};var Dt=class n{constructor(e){this.signingScheme=2;let{privateKey:t,address:r}=e;this.privateKey=t,this.publicKey=new D(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=L.generate();break;case 2:r=nt.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=L.fromDerivationPath(r,o);break;case 2:i=nt.fromDerivationPath(r,o);break;default:throw new Error(`Unsupported signature scheme ${t}`)}return new n({privateKey:i})}verifySignature(e){return this.publicKey.verifySignature(e)}signWithAuthenticator(e){return new Q(this.publicKey,this.sign(e))}signTransactionWithAuthenticator(e){return new Q(this.publicKey,this.signTransaction(e))}sign(e){return new G(this.privateKey.sign(e))}signTransaction(e){return this.sign(zt(e))}};var Le=class{static generate(e={}){let{scheme:t=0,legacy:r=!0}=e;return t===0&&r?kt.generate():Dt.generate({scheme:t})}static fromPrivateKey(e){let{privateKey:t,address:r,legacy:o=!0}=e;return t instanceof L&&o?new kt({privateKey:t,address:r}):new Dt({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?kt.fromDerivationPath({mnemonic:r,path:o}):Dt.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 tc=1209600,Bt=class Bt extends d{constructor(e){super();let{privateKey:t,expiryDateSecs:r,blinder:o}=e;this.privateKey=t,this.publicKey=new rt(t.publicKey()),this.expiryDateSecs=r||_chunkJ4IUXT5Wjs.d.call(void 0, _chunkJ4IUXT5Wjs.c.call(void 0, )+tc),this.blinder=o!==void 0?l.fromHexInput(o).toUint8Array():nc();let i=vr(this.publicKey.bcsToBytes(),93);i.push(BigInt(this.expiryDateSecs)),i.push(Ht(this.blinder));let s=Qt(i);this.nonce=s.toString()}getPublicKey(){return this.publicKey}isExpired(){return Math.floor(Date.now()/1e3)>this.expiryDateSecs}serialize(e){e.serializeU32AsUleb128(this.publicKey.variant),e.serializeBytes(this.privateKey.toUint8Array()),e.serializeU64(this.expiryDateSecs),e.serializeFixedBytes(this.blinder)}static deserialize(e){let t=e.deserializeUleb128AsU32(),r;switch(t){case 0:r=L.deserialize(e);break;default:throw new Error(`Unknown variant index for EphemeralPublicKey: ${t}`)}let o=e.deserializeU64(),i=e.deserializeFixedBytes(31);return new Bt({privateKey:r,expiryDateSecs:Number(o),blinder:i})}static fromBytes(e){return Bt.deserialize(new oe(e))}static generate(e){let t;switch(_optionalChain([e, 'optionalAccess', _52 => _52.scheme])){case 0:default:t=L.generate()}return new Bt({privateKey:t,expiryDateSecs:_optionalChain([e, 'optionalAccess', _53 => _53.expiryDateSecs])})}sign(e){if(this.isExpired())throw new Error("EphemeralKeyPair has expired");return new Te(this.privateKey.sign(e))}};Bt.BLINDER_LENGTH=31;var nn=Bt;function nc(){return _utils.randomBytes.call(void 0, nn.BLINDER_LENGTH)}var _eventemitter3 = require('eventemitter3'); var _eventemitter32 = _interopRequireDefault(_eventemitter3);var He=class He extends d{constructor(e){super();let{address:t,ephemeralKeyPair:r,uidKey:o,uidVal:i,aud:s,pepper:a,proof:c,proofFetchCallback:p,jwt:y}=e;if(this.ephemeralKeyPair=r,this.publicKey=ee.create(e),this.accountAddress=t?u.from(t):this.publicKey.authKey().derivedAddress(),this.uidKey=o,this.uidVal=i,this.aud=s,this.jwt=y,this.emitter=new _eventemitter32.default,this.proofOrPromise=c,c instanceof Ie)this.proof=c;else{if(p===void 0)throw new Error("Must provide callback for async proof fetch");this.emitter.on("proofFetchFinish",async S=>{await p(S),this.emitter.removeAllListeners()}),this.init(c)}this.signingScheme=2;let w=l.fromHexInput(a).toUint8Array();if(w.length!==He.PEPPER_LENGTH)throw new Error(`Pepper length in bytes should be ${He.PEPPER_LENGTH}`);this.pepper=w}async init(e){try{this.proof=await e,this.emitter.emit("proofFetchFinish",{status:"Success"})}catch(t){t instanceof Error?this.emitter.emit("proofFetchFinish",{status:"Failed",error:t.toString()}):this.emitter.emit("proofFetchFinish",{status:"Failed",error:"Unknown"})}}serialize(e){if(e.serializeStr(this.jwt),e.serializeStr(this.uidKey),e.serializeFixedBytes(this.pepper),this.ephemeralKeyPair.serialize(e),this.proof===void 0)throw new Error("Connot serialize - proof undefined");this.proof.serialize(e)}static deserialize(e){let t=e.deserializeStr(),r=e.deserializeStr(),o=e.deserializeFixedBytes(31),i=nn.deserialize(e),s=Ie.deserialize(e);return He.create({proof:s,pepper:o,uidKey:r,jwt:t,ephemeralKeyPair:i})}isExpired(){return this.ephemeralKeyPair.isExpired()}signWithAuthenticator(e){let t=new G(this.sign(e)),r=new D(this.publicKey);return new Q(r,t)}signTransactionWithAuthenticator(e){let t=new G(this.signTransaction(e)),r=new D(this.publicKey);return new Q(r,t)}async waitForProofFetch(){this.proofOrPromise instanceof Promise&&await this.proofOrPromise}sign(e){let{expiryDateSecs:t}=this.ephemeralKeyPair;if(this.isExpired())throw new Error("EphemeralKeyPair is expired");if(this.proof===void 0)throw new Error("Proof not defined");let r=this.ephemeralKeyPair.getPublicKey(),o=this.ephemeralKeyPair.sign(e);return new Ee({jwtHeader:_chunkJ4IUXT5Wjs.e.call(void 0, this.jwt.split(".")[0]),ephemeralCertificate:new wt(this.proof,0),expiryDateSecs:t,ephemeralPublicKey:r,ephemeralSignature:o})}signTransaction(e){if(this.proof===void 0)throw new Error("Proof not found");let t=Or(e),o=new Fr(t,this.proof.proof).hash();return this.sign(o)}verifySignature(e){let{message:t,signature:r}=e;return!(this.isExpired()||!this.ephemeralKeyPair.getPublicKey().verifySignature({message:t,signature:r.ephemeralSignature}))}static fromBytes(e){return He.deserialize(new oe(e))}static create(e){let{address:t,proof:r,jwt:o,ephemeralKeyPair:i,pepper:s,uidKey:a="sub",proofFetchCallback:c}=e,p=_jwtdecode.jwtDecode.call(void 0, o),y=p.iss;if(typeof p.aud!="string")throw new Error("aud was not found or an array of values");let w=p.aud,S=p[a];return new He({address:t,proof:r,ephemeralKeyPair:i,iss:y,uidKey:a,uidVal:S,aud:w,pepper:s,jwt:o,proofFetchCallback:c})}};He.PEPPER_LENGTH=31;var we=He,Fr=class extends d{constructor(t,r){super();this.domainSeparator="APTOS::TransactionAndProof";this.transaction=t,this.proof=r}serialize(t){t.serializeFixedBytes(this.transaction.bcsToBytes()),t.serializeOption(this.proof)}hash(){return Rt(this.bcsToBytes(),this.domainSeparator)}};var qn=class n{constructor(e){let{multiKey:t,signers:r}=e;this.publicKey=t,this.signingScheme=3,this.accountAddress=this.publicKey.authKey().derivedAddress();let o=[];for(let s of r)o.push(this.publicKey.getIndex(s.publicKey));let i=r.map((s,a)=>[s,o[a]]);i.sort((s,a)=>s[1]-a[1]),this.signers=i.map(s=>s[0]),this.signerIndicies=i.map(s=>s[1]),this.signaturesBitmap=this.publicKey.createBitmap({bits:o})}static fromPublicKeysAndSigners(e){let{publicKeys:t,signaturesRequired:r,signers:o}=e,i=new xt({publicKeys:t,signaturesRequired:r});return new n({multiKey:i,signers:o})}static isMultiKeySigner(e){return e instanceof n}signWithAuthenticator(e){return new at(this.publicKey,this.sign(e))}signTransactionWithAuthenticator(e){return new at(this.publicKey,this.signTransaction(e))}async waitForProofFetch(){let t=this.signers.filter(r=>r instanceof we).map(async r=>r.waitForProofFetch());await Promise.all(t)}sign(e){let t=[];for(let r of this.signers)t.push(r.sign(e));return new st({signatures:t,bitmap:this.signaturesBitmap})}signTransaction(e){let t=[];for(let r of this.signers)t.push(r.signTransaction(e));return new st({signatures:t,bitmap:this.signaturesBitmap})}verifySignature(e){let{message:t,signature:r}=e;if(!this.signerIndicies.every((i,s)=>s===0||i>=this.signerIndicies[s-1]))return!1;for(let i=0;i<r.signatures.length;i+=1){let s=r.signatures[i];if(!this.publicKey.publicKeys[this.signerIndicies[i]].verifySignature({message:t,signature:s}))return!1}return!0}};var ic=`
|
|
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 _chunkHBPH2AD3js = require('./chunk-HBPH2AD3.js');var vn=255,Pn=65535,ve=4294967295,Ye=18446744073709551615n,$t=340282366920938463463374607431768211455n,Cn=115792089237316195423570985008687907853269984665640564039457584007913129639935n;var Y=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}remaining(){return this.buffer.byteLength-this.offset}deserializeStr(){let e=this.deserializeBytes();return new TextDecoder().decode(e)}deserializeOptionStr(){return this.deserializeBool()?this.deserializeStr():void 0}deserializeOption(e){return this.deserializeBool()?this.deserialize(e):void 0}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<ve;){let r=this.deserializeU8();if(e|=BigInt(r&127)<<BigInt(t),!(r&128))break;t+=7}if(e>ve)throw new Error("Overflow while parsing uleb128-encoded uint32 value");return Number(e)}deserialize(e){return e.deserialize(this)}deserializeVector(e){let t=this.deserializeUleb128AsU32(),r=new Array;for(let i=0;i<t;i+=1)r.push(this.deserialize(e));return r}};var _utils = require('@noble/hashes/utils');var Z=class extends Error{constructor(e,t){super(e),this.invalidReason=t}};var ua=(r=>(r.TOO_SHORT="too_short",r.INVALID_LENGTH="invalid_length",r.INVALID_HEX_CHARS="invalid_hex_chars",r))(ua||{}),g= 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 Z("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 Z("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 Z(`Hex string contains invalid hex characters: ${_optionalChain([r, 'optionalAccess', _2 => _2.message])}`,"invalid_hex_chars")}}static fromHexInput(e){return e instanceof Uint8Array?new n(e):n.fromHexString(e)}static isValid(e){try{return n.fromHexString(e),{valid:!0}}catch(t){return{valid:!1,invalidReason:_optionalChain([t, 'optionalAccess', _3 => _3.invalidReason]),invalidReasonMessage:_optionalChain([t, 'optionalAccess', _4 => _4.message])}}}equals(e){return this.data.length!==e.data.length?!1:this.data.every((t,r)=>t===e.data[r])}};var d=class{bcsToBytes(){let e=new J;return this.serialize(e),e.toUint8Array()}bcsToHex(){let e=this.bcsToBytes();return g.fromHexInput(e)}},J= 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 i=new DataView(this.buffer,this.offset);e.apply(i,[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){Ar(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(ve),r=BigInt(e)>>BigInt(32);this.serializeU32(Number(t)),this.serializeU32(Number(r))}serializeU128(e){let t=BigInt(e)&Ye,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)})}serializeOption(e){let t=e!==void 0;this.serializeBool(t),t&&e.serialize(this)}serializeOptionStr(e){e===void 0?this.serializeU32AsUleb128(0):(this.serializeU32AsUleb128(1),this.serializeStr(e))}};_chunkHBPH2AD3js.a.call(void 0, [Ze(0,vn)],J.prototype,"serializeU8",1),_chunkHBPH2AD3js.a.call(void 0, [Ze(0,Pn)],J.prototype,"serializeU16",1),_chunkHBPH2AD3js.a.call(void 0, [Ze(0,ve)],J.prototype,"serializeU32",1),_chunkHBPH2AD3js.a.call(void 0, [Ze(BigInt(0),Ye)],J.prototype,"serializeU64",1),_chunkHBPH2AD3js.a.call(void 0, [Ze(BigInt(0),$t)],J.prototype,"serializeU128",1),_chunkHBPH2AD3js.a.call(void 0, [Ze(BigInt(0),Cn)],J.prototype,"serializeU256",1),_chunkHBPH2AD3js.a.call(void 0, [Ze(0,ve)],J.prototype,"serializeU32AsUleb128",1);function Ar(n){if(typeof n!="boolean")throw new Error(`${n} is not a boolean value`)}var pa=(n,e,t)=>`${n} is out of range: [${e}, ${t}]`;function Ge(n,e,t){let r=BigInt(n);if(r>BigInt(t)||r<BigInt(e))throw new Error(pa(n,e,t))}function Ze(n,e){return(t,r,i)=>{let o=i.value;return i.value=function(a){return Ge(a,n,e),o.apply(this,[a])},i}}var Je=class n extends d{constructor(e){super(),this.value=g.fromHexInput(e).toUint8Array()}serialize(e){e.serializeFixedBytes(this.value)}serializeForEntryFunction(e){e.serialize(this)}serializeForScriptFunction(e){e.serialize(this)}static deserialize(e,t){let r=e.deserializeFixedBytes(t);return new n(r)}};var En=class n extends d{constructor(e){super(),this.value=new Je(e)}serialize(e){e.serialize(this.value)}serializeForEntryFunction(e){e.serializeU32AsUleb128(this.value.value.length),e.serialize(this)}static deserialize(e,t){let r=Je.deserialize(e,t);return new n(r.value)}};var In=(i=>(i.JSON="application/json",i.BCS="application/x-bcs",i.BCS_SIGNED_TRANSACTION="application/x.aptos.signed_transaction+bcs",i.BCS_VIEW_FUNCTION="application/x.aptos.view_function+bcs",i))(In||{}),hi= exports.TypeTagVariants =(m=>(m[m.Bool=0]="Bool",m[m.U8=1]="U8",m[m.U64=2]="U64",m[m.U128=3]="U128",m[m.Address=4]="Address",m[m.Signer=5]="Signer",m[m.Vector=6]="Vector",m[m.Struct=7]="Struct",m[m.U16=8]="U16",m[m.U32=9]="U32",m[m.U256=10]="U256",m[m.Reference=254]="Reference",m[m.Generic=255]="Generic",m))(hi||{}),Lt= exports.ScriptTransactionArgumentVariants =(l=>(l[l.U8=0]="U8",l[l.U64=1]="U64",l[l.U128=2]="U128",l[l.Address=3]="Address",l[l.U8Vector=4]="U8Vector",l[l.Bool=5]="Bool",l[l.U16=6]="U16",l[l.U32=7]="U32",l[l.U256=8]="U256",l[l.Serialized=9]="Serialized",l))(Lt||{}),Ti= exports.TransactionPayloadVariants =(r=>(r[r.Script=0]="Script",r[r.EntryFunction=2]="EntryFunction",r[r.Multisig=3]="Multisig",r))(Ti||{}),bi= exports.TransactionVariants =(t=>(t[t.MultiAgentTransaction=0]="MultiAgentTransaction",t[t.FeePayerTransaction=1]="FeePayerTransaction",t))(bi||{}),wi= exports.TransactionAuthenticatorVariant =(o=>(o[o.Ed25519=0]="Ed25519",o[o.MultiEd25519=1]="MultiEd25519",o[o.MultiAgent=2]="MultiAgent",o[o.FeePayer=3]="FeePayer",o[o.SingleSender=4]="SingleSender",o))(wi||{}),Si= exports.AccountAuthenticatorVariant =(i=>(i[i.Ed25519=0]="Ed25519",i[i.MultiEd25519=1]="MultiEd25519",i[i.SingleKey=2]="SingleKey",i[i.MultiKey=3]="MultiKey",i))(Si||{}),hr= exports.AnyPublicKeyVariant =(r=>(r[r.Ed25519=0]="Ed25519",r[r.Secp256k1=1]="Secp256k1",r[r.Keyless=3]="Keyless",r))(hr||{}),_i= exports.AnySignatureVariant =(r=>(r[r.Ed25519=0]="Ed25519",r[r.Secp256k1=1]="Secp256k1",r[r.Keyless=3]="Keyless",r))(_i||{}),Tr= exports.EphemeralPublicKeyVariant =(e=>(e[e.Ed25519=0]="Ed25519",e))(Tr||{}),xi= exports.EphemeralSignatureVariant =(e=>(e[e.Ed25519=0]="Ed25519",e))(xi||{}),br= exports.EphemeralCertificateVariant =(e=>(e[e.ZkProof=0]="ZkProof",e))(br||{}),wr= exports.ZkpVariant =(e=>(e[e.Groth16=0]="Groth16",e))(wr||{}),Sr= exports.TransactionResponseType =(a=>(a.Pending="pending_transaction",a.User="user_transaction",a.Genesis="genesis_transaction",a.BlockMetadata="block_metadata_transaction",a.StateCheckpoint="state_checkpoint_transaction",a.Validator="validator_transaction",a.BlockEpilogue="block_epilogue_transaction",a))(Sr||{});function Eu(n){return n.type==="pending_transaction"}function Iu(n){return n.type==="user_transaction"}function Uu(n){return n.type==="genesis_transaction"}function Ru(n){return n.type==="block_metadata_transaction"}function zu(n){return n.type==="state_checkpoint_transaction"}function ku(n){return n.type==="validator_transaction"}function Du(n){return n.type==="block_epilogue_transaction"}function Bu(n){return"signature"in n&&n.signature==="ed25519_signature"}function Gu(n){return"signature"in n&&n.signature==="secp256k1_ecdsa_signature"}function Ku(n){return n.type==="multi_agent_signature"}function Nu(n){return n.type==="fee_payer_signature"}function Ou(n){return n.type==="multi_ed25519_signature"}var da=(r=>(r.PRIVATE="private",r.PUBLIC="public",r.FRIEND="friend",r))(da||{}),vi= exports.MoveAbility =(i=>(i.STORE="store",i.DROP="drop",i.KEY="key",i.COPY="copy",i))(vi||{}),la= exports.RoleType =(t=>(t.VALIDATOR="validator",t.FULL_NODE="full_node",t))(la||{}),Ae= exports.SigningScheme =(i=>(i[i.Ed25519=0]="Ed25519",i[i.MultiEd25519=1]="MultiEd25519",i[i.SingleKey=2]="SingleKey",i[i.MultiKey=3]="MultiKey",i))(Ae||{}),_r= exports.SigningSchemeInput =(t=>(t[t.Ed25519=0]="Ed25519",t[t.Secp256k1Ecdsa=2]="Secp256k1Ecdsa",t))(_r||{}),Pi= exports.DeriveScheme =(o=>(o[o.DeriveAuid=251]="DeriveAuid",o[o.DeriveObjectAddressFromObject=252]="DeriveObjectAddressFromObject",o[o.DeriveObjectAddressFromGuid=253]="DeriveObjectAddressFromGuid",o[o.DeriveObjectAddressFromSeed=254]="DeriveObjectAddressFromSeed",o[o.DeriveResourceAccountAddress=255]="DeriveResourceAccountAddress",o))(Pi||{});var I=class n extends d{constructor(e){super(),Ar(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())}},F= exports.U8 =class n extends d{constructor(e){super(),Ge(e,0,vn),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())}},de= exports.U16 =class n extends d{constructor(e){super(),Ge(e,0,Pn),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())}},le= exports.U32 =class n extends d{constructor(e){super(),Ge(e,0,ve),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())}},O= exports.U64 =class n extends d{constructor(e){super(),Ge(e,BigInt(0),Ye),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())}},ge= exports.U128 =class n extends d{constructor(e){super(),Ge(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())}},me= exports.U256 =class n extends d{constructor(e){super(),Ge(e,BigInt(0),Cn),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]!==void 0&&!(this.values[0]instanceof F)){new Ht(this.bcsToBytes()).serializeForScriptFunction(e);return}e.serializeU32AsUleb128(4),e.serialize(this)}static U8(e){let t;if(Array.isArray(e)&&e.length===0)t=[];else if(Array.isArray(e)&&typeof e[0]=="number")t=e;else if(typeof e=="string"){let r=g.fromHexInput(e);t=Array.from(r.toUint8Array())}else if(e instanceof Uint8Array)t=Array.from(e);else throw new Error("Invalid input type, must be an number[], Uint8Array, or hex string");return new n(t.map(r=>new F(r)))}static U16(e){return new n(e.map(t=>new de(t)))}static U32(e){return new n(e.map(t=>new le(t)))}static U64(e){return new n(e.map(t=>new O(t)))}static U128(e){return new n(e.map(t=>new ge(t)))}static U256(e){return new n(e.map(t=>new me(t)))}static Bool(e){return new n(e.map(t=>new I(t)))}static MoveString(e){return new n(e.map(t=>new b(t)))}serialize(e){e.serializeVector(this.values)}static deserialize(e,t){let r=e.deserializeUleb128AsU32(),i=new Array;for(let o=0;o<r;o+=1)i.push(t.deserialize(e));return new n(i)}},Ht= exports.Serialized =class n extends d{constructor(e){super(),this.value=g.fromHexInput(e).toUint8Array()}serialize(e){e.serializeBytes(this.value)}serializeForEntryFunction(e){this.serialize(e)}serializeForScriptFunction(e){e.serializeU32AsUleb128(9),this.serialize(e)}static deserialize(e){return new n(e.deserializeBytes())}toMoveVector(e){let t=new Y(this.bcsToBytes());t.deserializeUleb128AsU32();let r=t.deserializeVector(e);return new T(r)}},b= 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 r=new TextEncoder().encode(this.value);T.U8(r).serializeForScriptFunction(e)}static deserialize(e){return new n(e.deserializeStr())}},M= 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 F(e):void 0)}static U16(e){return new n(e!=null?new de(e):void 0)}static U32(e){return new n(e!=null?new le(e):void 0)}static U64(e){return new n(e!=null?new O(e):void 0)}static U128(e){return new n(e!=null?new ge(e):void 0)}static U256(e){return new n(e!=null?new me(e):void 0)}static Bool(e){return new n(e!=null?new I(e):void 0)}static MoveString(e){return new n(e!=null?new b(e):void 0)}static deserialize(e,t){let r=T.deserialize(e,t);return new n(r.values[0])}};var _ed25519 = require('@noble/curves/ed25519');var _sha3 = require('@noble/hashes/sha3');var ma=(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))(ma||{}),_=class _ extends d{constructor(e){if(super(),e.length!==_.LENGTH)throw new Z("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 Z("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 Z(`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 Z(`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 Z("Hex string is too short, must be 1 to 64 chars long, excluding the leading 0x.","too_short");if(t.length>64)throw new Z("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(i){throw new Z(`Hex characters are invalid: ${_optionalChain([i, 'optionalAccess', _5 => _5.message])}`,"invalid_hex_chars")}return new _(r)}static from(e){return typeof e=="string"?_.fromString(e):e instanceof Uint8Array?new _(e):e}static fromStrict(e){return typeof e=="string"?_.fromStringStrict(e):e instanceof Uint8Array?new _(e):e}static isValid(e){try{return e.strict?_.fromStrict(e.input):_.from(e.input),{valid:!0}}catch(t){return{valid:!1,invalidReason:_optionalChain([t, 'optionalAccess', _6 => _6.invalidReason]),invalidReasonMessage:_optionalChain([t, 'optionalAccess', _7 => _7.message])}}}equals(e){return this.data.length!==e.data.length?!1:this.data.every((t,r)=>t===e.data[r])}};_.LENGTH=32,_.LONG_STRING_LENGTH=64,_.ZERO=_.from("0x0"),_.ONE=_.from("0x1"),_.TWO=_.from("0x2"),_.THREE=_.from("0x3"),_.FOUR=_.from("0x4"),_.A=_.from("0xA");var u=_;var Ke=class Ke extends d{constructor(e){super();let{data:t}=e,r=g.fromHexInput(t);if(r.toUint8Array().length!==Ke.LENGTH)throw new Error(`Authentication Key length should be ${Ke.LENGTH}`);this.data=r}serialize(e){e.serializeFixedBytes(this.data.toUint8Array())}static deserialize(e){let t=e.deserializeFixedBytes(Ke.LENGTH);return new Ke({data:t})}toString(){return this.data.toString()}toUint8Array(){return this.data.toUint8Array()}static fromSchemeAndBytes(e){let{scheme:t,input:r}=e,i=g.fromHexInput(r).toUint8Array(),o=new Uint8Array([...i,t]),s=_sha3.sha3_256.create();s.update(o);let a=s.digest();return new Ke({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())}};Ke.LENGTH=32;var q=Ke;var _hmac = require('@noble/hashes/hmac');var _sha512 = require('@noble/hashes/sha512');var _bip39 = require('@scure/bip39'); var Ei = _interopRequireWildcard(_bip39);var ha=/^m\/44'\/637'\/[0-9]+'\/[0-9]+'\/[0-9]+'?$/,Ta= exports.APTOS_BIP44_REGEX =/^m\/44'\/637'\/[0-9]+'\/[0-9]+\/[0-9]+$/,ba= exports.KeyType =(e=>(e.ED25519="ed25519 seed",e))(ba||{}),Ii= exports.HARDENED_OFFSET =2147483648;function Ui(n){return Ta.test(n)}function Ri(n){return ha.test(n)}var xr=(n,e)=>{let t=_hmac.hmac.create(_sha512.sha512,n).update(e).digest();return{key:t.slice(0,32),chainCode:t.slice(32)}},zi= exports.CKDPriv =({key:n,chainCode:e},t)=>{let r=new ArrayBuffer(4);new DataView(r).setUint32(0,t);let i=new Uint8Array(r),o=new Uint8Array([0]),s=new Uint8Array([...o,...n,...i]);return xr(e,s)},wa=n=>n.replace("'",""),ki= exports.splitPath =n=>n.split("/").slice(1).map(wa),Un= exports.mnemonicToSeed =n=>{let e=n.trim().split(/\s+/).map(t=>t.toLowerCase()).join(" ");return Ei.mnemonicToSeedSync(e)};var et=class extends d{toString(){let e=this.toUint8Array();return g.fromHexInput(e).toString()}},oe= exports.AccountPublicKey =class extends et{};var B=class extends d{toString(){let e=this.toUint8Array();return g.fromHexInput(e).toString()}};var mt=n=>typeof n=="string"?g.isValid(n).valid?n:Buffer.from(n,"utf8"):n;var vr=[237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16];function Sa(n){let e=n.toUint8Array().slice(32);for(let t=vr.length-1;t>=0;t-=1){if(e[t]<vr[t])return!0;if(e[t]>vr[t])return!1}return!1}var Ne=class Ne extends oe{constructor(e){super();let t=g.fromHexInput(e);if(t.toUint8Array().length!==Ne.LENGTH)throw new Error(`PublicKey length should be ${Ne.LENGTH}`);this.key=t}verifySignature(e){let{message:t,signature:r}=e;if(!Sa(r))return!1;let i=mt(t),o=g.fromHexInput(i).toUint8Array(),s=r.toUint8Array(),a=this.key.toUint8Array();return _ed25519.ed25519.verify(s,o,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 Ne(t)}static isPublicKey(e){return e instanceof Ne}static isInstance(e){return"key"in e&&_optionalChain([e, 'access', _8 => _8.key, 'optionalAccess', _9 => _9.data, 'optionalAccess', _10 => _10.length])===Ne.LENGTH}};Ne.LENGTH=32;var x=Ne,se=class se extends d{constructor(e){super();let t=g.fromHexInput(e);if(t.toUint8Array().length!==se.LENGTH)throw new Error(`PrivateKey length should be ${se.LENGTH}`);this.signingKey=t}static generate(){let e=_ed25519.ed25519.utils.randomPrivateKey();return new se(e)}static fromDerivationPath(e,t){if(!Ri(e))throw new Error(`Invalid derivation path ${e}`);return se.fromDerivationPathInner(e,Un(t))}static fromDerivationPathInner(e,t,r=Ii){let{key:i,chainCode:o}=xr(se.SLIP_0010_SEED,t),s=ki(e).map(c=>parseInt(c,10)),{key:a}=s.reduce((c,p)=>zi(c,p+r),{key:i,chainCode:o});return new se(a)}publicKey(){let e=_ed25519.ed25519.getPublicKey(this.signingKey.toUint8Array());return new x(e)}sign(e){let t=mt(e),r=g.fromHexInput(t).toUint8Array(),i=_ed25519.ed25519.sign(r,this.signingKey.toUint8Array());return new P(i)}toUint8Array(){return this.signingKey.toUint8Array()}toString(){return this.signingKey.toString()}serialize(e){e.serializeBytes(this.toUint8Array())}static deserialize(e){let t=e.deserializeBytes();return new se(t)}static isPrivateKey(e){return e instanceof se}};se.LENGTH=32,se.SLIP_0010_SEED="ed25519 seed";var L=se,yt=class yt extends B{constructor(e){super();let t=g.fromHexInput(e);if(t.toUint8Array().length!==yt.LENGTH)throw new Error(`Signature length should be ${yt.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 yt(t)}};yt.LENGTH=64;var P=yt;var ae=class ae extends oe{constructor(e){super();let{publicKeys:t,threshold:r}=e;if(t.length>ae.MAX_KEYS||t.length<ae.MIN_KEYS)throw new Error(`Must have between ${ae.MIN_KEYS} and ${ae.MAX_KEYS} public keys, inclusive`);if(r<ae.MIN_THRESHOLD||r>t.length)throw new Error(`Threshold must be between ${ae.MIN_THRESHOLD} and ${t.length}, inclusive`);this.publicKeys=t,this.threshold=r}verifySignature(e){let{message:t,signature:r}=e;if(!(r instanceof tt))return!1;let i=[];for(let o=0;o<4;o+=1)for(let s=0;s<8;s+=1)if((r.bitmap[o]&1<<7-s)!==0){let c=o*8+s;i.push(c)}if(i.length!==r.signatures.length)throw new Error("Bitmap and signatures length mismatch");if(i.length<this.threshold)throw new Error("Not enough signatures");for(let o=0;o<i.length;o+=1)if(!this.publicKeys[i[o]].verifySignature({message:t,signature:r.signatures[o]}))return!1;return!0}authKey(){return q.fromSchemeAndBytes({scheme:1,input:this.toUint8Array()})}toUint8Array(){let e=new Uint8Array(this.publicKeys.length*x.LENGTH+1);return this.publicKeys.forEach((t,r)=>{e.set(t.toUint8Array(),r*x.LENGTH)}),e[this.publicKeys.length*x.LENGTH]=this.threshold,e}serialize(e){e.serializeBytes(this.toUint8Array())}static deserialize(e){let t=e.deserializeBytes(),r=t[t.length-1],i=[];for(let o=0;o<t.length-1;o+=x.LENGTH){let s=o;i.push(new x(t.subarray(s,s+x.LENGTH)))}return new ae({publicKeys:i,threshold:r})}};ae.MAX_KEYS=32,ae.MIN_KEYS=2,ae.MIN_THRESHOLD=1;var ft=ae,ee=class ee extends B{constructor(e){super();let{signatures:t,bitmap:r}=e;if(t.length>ee.MAX_SIGNATURES_SUPPORTED)throw new Error(`The number of signatures cannot be greater than ${ee.MAX_SIGNATURES_SUPPORTED}`);if(this.signatures=t,!(r instanceof Uint8Array))this.bitmap=ee.createBitmap({bits:r});else{if(r.length!==ee.BITMAP_LEN)throw new Error(`"bitmap" length should be ${ee.BITMAP_LEN}`);this.bitmap=r}}toUint8Array(){let e=new Uint8Array(this.signatures.length*P.LENGTH+ee.BITMAP_LEN);return this.signatures.forEach((t,r)=>{e.set(t.toUint8Array(),r*P.LENGTH)}),e.set(this.bitmap,this.signatures.length*P.LENGTH),e}serialize(e){e.serializeBytes(this.toUint8Array())}static deserialize(e){let t=e.deserializeBytes(),r=t.subarray(t.length-4),i=[];for(let o=0;o<t.length-r.length;o+=P.LENGTH){let s=o;i.push(new P(t.subarray(s,s+P.LENGTH)))}return new ee({signatures:i,bitmap:r})}static createBitmap(e){let{bits:t}=e,r=128,i=new Uint8Array([0,0,0,0]),o=new Set;return t.forEach((s,a)=>{if(s>=ee.MAX_SIGNATURES_SUPPORTED)throw new Error(`Cannot have a signature larger than ${ee.MAX_SIGNATURES_SUPPORTED-1}.`);if(o.has(s))throw new Error("Duplicate bits detected.");if(a>0&&s<=t[a-1])throw new Error("The bits need to be sorted in ascending order.");o.add(s);let c=Math.floor(s/8),p=i[c];p|=r>>s%8,i[c]=p}),i}};ee.MAX_SIGNATURES_SUPPORTED=32,ee.BITMAP_LEN=4;var tt=ee;var _secp256k1 = require('@noble/curves/secp256k1');var _bip32 = require('@scure/bip32');var Oe=class Oe extends et{constructor(e){super();let t=g.fromHexInput(e);if(t.toUint8Array().length!==Oe.LENGTH)throw new Error(`PublicKey length should be ${Oe.LENGTH}`);this.key=t}verifySignature(e){let{message:t,signature:r}=e,i=mt(t),o=g.fromHexInput(i).toUint8Array(),s=_sha3.sha3_256.call(void 0, o),a=r.toUint8Array();return _secp256k1.secp256k1.verify(a,s,this.key.toUint8Array(),{lowS:!0})}toUint8Array(){return this.key.toUint8Array()}serialize(e){e.serializeBytes(this.key.toUint8Array())}static deserialize(e){let t=e.deserializeBytes();return new Oe(t)}static isPublicKey(e){return e instanceof Oe}static isInstance(e){return"key"in e&&_optionalChain([e, 'access', _11 => _11.key, 'optionalAccess', _12 => _12.data, 'optionalAccess', _13 => _13.length])===Oe.LENGTH}};Oe.LENGTH=65;var Pe=Oe,he=class he extends d{constructor(e){super();let t=g.fromHexInput(e);if(t.toUint8Array().length!==he.LENGTH)throw new Error(`PrivateKey length should be ${he.LENGTH}`);this.key=t}static generate(){let e=_secp256k1.secp256k1.utils.randomPrivateKey();return new he(e)}static fromDerivationPath(e,t){if(!Ui(e))throw new Error(`Invalid derivation path ${e}`);return he.fromDerivationPathInner(e,Un(t))}static fromDerivationPathInner(e,t){let{privateKey:r}=_bip32.HDKey.fromMasterSeed(t).derive(e);if(r===null)throw new Error("Invalid key");return new he(r)}sign(e){let t=mt(e),r=g.fromHexInput(t),i=_sha3.sha3_256.call(void 0, r.toUint8Array()),o=_secp256k1.secp256k1.sign(i,this.key.toUint8Array(),{lowS:!0});return new ht(o.toCompactRawBytes())}publicKey(){let e=_secp256k1.secp256k1.getPublicKey(this.key.toUint8Array(),!1);return new Pe(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 he(t)}static isPrivateKey(e){return e instanceof he}};he.LENGTH=32;var nt=he,At=class At extends B{constructor(e){super();let t=g.fromHexInput(e);if(t.toUint8Array().length!==At.LENGTH)throw new Error(`Signature length should be ${At.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 At(t)}};At.LENGTH=64;var ht=At;var _jwtdecode = require('jwt-decode');var rt=class n extends et{constructor(e){super();let t=e.constructor.name;switch(t){case x.name:this.publicKey=e,this.variant=0;break;default:throw new Error(`Unsupported key for EphemeralPublicKey - ${t}`)}}toUint8Array(){return this.bcsToBytes()}verifySignature(e){let{message:t,signature:r}=e;return this.publicKey.verifySignature({message:t,signature:r.signature})}serialize(e){if(this.publicKey instanceof x)e.serializeU32AsUleb128(0),this.publicKey.serialize(e);else throw new Error("Unknown public key type")}static deserialize(e){let t=e.deserializeUleb128AsU32();switch(t){case 0:return new n(x.deserialize(e));default:throw new Error(`Unknown variant index for EphemeralPublicKey: ${t}`)}}static isPublicKey(e){return e instanceof n}},Te= exports.EphemeralSignature =class n extends B{constructor(e){super();let t=e.constructor.name;switch(t){case P.name:this.signature=e;break;default:throw new Error(`Unsupported signature for EphemeralSignature - ${t}`)}}toUint8Array(){return this.bcsToBytes()}static fromHex(e){let t=g.fromHexInput(e),r=new Y(t.toUint8Array());return n.deserialize(r)}serialize(e){if(this.signature instanceof P)e.serializeU32AsUleb128(0),this.signature.serialize(e);else throw new Error("Unknown signature type")}static deserialize(e){let t=e.deserializeUleb128AsU32();switch(t){case 0:return new n(P.deserialize(e));default:throw new Error(`Unknown variant index for EphemeralSignature: ${t}`)}}};var _poseidonlite = require('poseidon-lite');var Pr=[_poseidonlite.poseidon1,_poseidonlite.poseidon2,_poseidonlite.poseidon3,_poseidonlite.poseidon4,_poseidonlite.poseidon5,_poseidonlite.poseidon6,_poseidonlite.poseidon7,_poseidonlite.poseidon8,_poseidonlite.poseidon9,_poseidonlite.poseidon10,_poseidonlite.poseidon11,_poseidonlite.poseidon12,_poseidonlite.poseidon13,_poseidonlite.poseidon14,_poseidonlite.poseidon15,_poseidonlite.poseidon16],Gi=31,Fa=16,Bi=(Fa-1)*Gi;function kn(n,e){let r=new TextEncoder().encode(n);return Ma(r,e)}function Ma(n,e){if(n.length>e)throw new Error(`Inputted bytes of length ${n} is longer than ${e}`);let t=Cr(n,e);return Wt(t)}function qa(n,e){if(n.length>e)throw new Error(`Input bytes of length ${n} is longer than ${e}`);let t=La(n,e);return Va(t)}function Cr(n,e){if(n.length>e)throw new Error(`Input bytes of length ${n} is longer than ${e}`);return qa(n,e).concat([BigInt(n.length)])}function Va(n){if(n.length>Bi)throw new Error(`Can't pack more than ${Bi}. Was given ${n.length} bytes`);return $a(n,Gi).map(e=>Qt(e))}function $a(n,e){let t=[];for(let r=0;r<n.length;r+=e)t.push(n.subarray(r,r+e));return t}function Qt(n){let e=BigInt(0);for(let t=n.length-1;t>=0;t-=1)e=e<<BigInt(8)|BigInt(n[t]);return e}function Ki(n,e){let t=new Uint8Array(e);for(let r=0;r<e;r+=1)t[r]=Number(n&BigInt(255)),n>>=BigInt(8);return t}function La(n,e){if(e<n.length)throw new Error("Padded size must be greater than or equal to the input array size.");let t=new Uint8Array(e);t.set(n);for(let r=n.length;r<e;r+=1)t[r]=0;return t}function Wt(n){if(n.length>Pr.length)throw new Error(`Unable to hash input of length ${n.length}. Max input length is ${Pr.length}`);return Pr[n.length-1](n)}var Dn=class extends d{toString(){let e=this.bcsToBytes();return g.fromHexInput(e).toString()}};var Tt=(o=>(o.FULLNODE="Fullnode",o.INDEXER="Indexer",o.FAUCET="Faucet",o.PEPPER="Pepper",o.PROVER="Prover",o))(Tt||{}),Ni= exports.DEFAULT_MAX_GAS_AMOUNT =2e5,Oi= exports.DEFAULT_TXN_EXP_SEC_FROM_NOW =20,Bn= exports.DEFAULT_TXN_TIMEOUT_SEC =20,it= exports.APTOS_COIN ="0x1::aptos_coin::AptosCoin",Fi= exports.APTOS_FA ="0x000000000000000000000000000000000000000000000000000000000000000a",Mi= exports.RAW_TRANSACTION_SALT ="APTOS::RawTransaction",Er= exports.RAW_TRANSACTION_WITH_DATA_SALT ="APTOS::RawTransactionWithData",Ce= exports.ProcessorType =(c=>(c.ACCOUNT_TRANSACTION_PROCESSOR="account_transactions_processor",c.DEFAULT="default_processor",c.EVENTS_PROCESSOR="events_processor",c.FUNGIBLE_ASSET_PROCESSOR="fungible_asset_processor",c.STAKE_PROCESSOR="stake_processor",c.TOKEN_V2_PROCESSOR="token_v2_processor",c.USER_TRANSACTION_PROCESSOR="user_transaction_processor",c.OBJECT_PROCESSOR="objects_processor",c))(Ce||{});var ye=class extends Error{constructor({apiType:e,aptosRequest:t,aptosResponse:r}){super(Ha({apiType:e,aptosRequest:t,aptosResponse:r})),this.name="AptosApiError",this.url=r.url,this.status=r.status,this.statusText=r.statusText,this.data=r.data,this.request=t}};function Ha({apiType:n,aptosRequest:e,aptosResponse:t}){let r=_optionalChain([t, 'access', _14 => _14.headers, 'optionalAccess', _15 => _15.traceparent, 'optionalAccess', _16 => _16.split, 'call', _17 => _17("-"), 'access', _18 => _18[1]]),i=r?`(trace_id:${r}) `:"",o=`Request to [${n}]: ${e.method} ${_nullishCoalesce(t.url, () => (e.url))} ${i}failed with`;return n==="Indexer"&&_optionalChain([t, 'access', _19 => _19.data, 'optionalAccess', _20 => _20.errors, 'optionalAccess', _21 => _21[0], 'optionalAccess', _22 => _22.message])!=null?`${o}: ${t.data.errors[0].message}`:_optionalChain([t, 'access', _23 => _23.data, 'optionalAccess', _24 => _24.message])!=null&&_optionalChain([t, 'access', _25 => _25.data, 'optionalAccess', _26 => _26.error_code])!=null?`${o}: ${JSON.stringify(t.data)}`:`${o} status: ${t.statusText}(code:${t.status}) and response body: ${Qa(t.data)}`}var Ir=400;function Qa(n){let e=JSON.stringify(n);return e.length<=Ir?e:`truncated(original_size:${e.length}): ${e.slice(0,Ir/2)}...${e.slice(-Ir/2)}`}var qi="1.28.0";var Vi={mainnet:"https://api.mainnet.aptoslabs.com/v1/graphql",testnet:"https://api.testnet.aptoslabs.com/v1/graphql",devnet:"https://api.devnet.aptoslabs.com/v1/graphql",local:"http://127.0.0.1:8090/v1/graphql"},$i= exports.NetworkToNodeAPI ={mainnet:"https://api.mainnet.aptoslabs.com/v1",testnet:"https://api.testnet.aptoslabs.com/v1",devnet:"https://api.devnet.aptoslabs.com/v1",local:"http://127.0.0.1:8080/v1"},Li= exports.NetworkToFaucetAPI ={mainnet:"https://faucet.mainnet.aptoslabs.com",testnet:"https://faucet.testnet.aptoslabs.com",devnet:"https://faucet.devnet.aptoslabs.com",local:"http://127.0.0.1:8081"},Ur= exports.NetworkToPepperAPI ={mainnet:"https://api.mainnet.aptoslabs.com/keyless/pepper/v0",testnet:"https://api.testnet.aptoslabs.com/keyless/pepper/v0",devnet:"https://api.devnet.aptoslabs.com/keyless/pepper/v0",local:"https://api.devnet.aptoslabs.com/keyless/pepper/v0"},Rr= exports.NetworkToProverAPI ={mainnet:"https://api.mainnet.aptoslabs.com/keyless/prover/v0",testnet:"https://api.testnet.aptoslabs.com/keyless/prover/v0",devnet:"https://api.devnet.aptoslabs.com/keyless/prover/v0",local:"https://api.devnet.aptoslabs.com/keyless/prover/v0"},zr= exports.Network =(o=>(o.MAINNET="mainnet",o.TESTNET="testnet",o.DEVNET="devnet",o.LOCAL="local",o.CUSTOM="custom",o))(zr||{}),kr= exports.NetworkToChainId ={mainnet:1,testnet:2,local:4},Kd= exports.NetworkToNetworkName ={mainnet:"mainnet",testnet:"testnet",devnet:"devnet",local:"local",custom:"custom"};function Hi(n,e){let t=e.bcsToBytes(),r=new Y(t);return n.deserialize(r)}async function Wa(n,e){let{url:t,method:r,body:i,contentType:o,params:s,overrides:a,originMethod:c}=n,p={..._optionalChain([a, 'optionalAccess', _27 => _27.HEADERS]),"x-aptos-client":`aptos-typescript-sdk/${qi}`,"content-type":_nullishCoalesce(o, () => ("application/json")),"x-aptos-typescript-sdk-origin-method":c};return _optionalChain([a, 'optionalAccess', _28 => _28.AUTH_TOKEN])&&(p.Authorization=`Bearer ${_optionalChain([a, 'optionalAccess', _29 => _29.AUTH_TOKEN])}`),_optionalChain([a, 'optionalAccess', _30 => _30.API_KEY])&&(p.Authorization=`Bearer ${_optionalChain([a, 'optionalAccess', _31 => _31.API_KEY])}`),e.provider({url:t,method:r,body:i,params:s,headers:p,overrides:a})}async function Gn(n,e,t){let{url:r,path:i}=n,o=i?`${r}/${i}`:r,s=await Wa({...n,url:o},e.client),a={status:s.status,statusText:s.statusText,data:s.data,headers:s.headers,config:s.config,request:s.request,url:o};if(a.status===401)throw new ye({apiType:t,aptosRequest:n,aptosResponse:a});if(t==="Indexer"){let c=a.data;if(c.errors)throw new ye({apiType:t,aptosRequest:n,aptosResponse:a});a.data=c.data}else if((t==="Pepper"||t==="Prover")&&a.status>=400)throw new ye({apiType:t,aptosRequest:n,aptosResponse:a});if(a.status>=200&&a.status<300)return a;throw new ye({apiType:t,aptosRequest:n,aptosResponse:a})}async function Dr(n){let{aptosConfig:e,overrides:t,params:r,contentType:i,acceptType:o,path:s,originMethod:a,type:c}=n,p=e.getRequestUrl(c);return Gn({url:p,method:"GET",originMethod:a,path:s,contentType:i,acceptType:o,params:r,overrides:{...e.clientConfig,...t}},e,n.type)}async function V(n){let{aptosConfig:e}=n;return Dr({...n,type:"Fullnode",overrides:{...e.clientConfig,...e.fullnodeConfig,...n.overrides,HEADERS:{..._optionalChain([e, 'access', _32 => _32.clientConfig, 'optionalAccess', _33 => _33.HEADERS]),..._optionalChain([e, 'access', _34 => _34.fullnodeConfig, 'optionalAccess', _35 => _35.HEADERS])}}})}async function sl(n){return Dr({...n,type:"Pepper"})}async function bt(n){let e=[],t,r=n.params;do{let i=await Dr({type:"Fullnode",aptosConfig:n.aptosConfig,originMethod:n.originMethod,path:n.path,params:r,overrides:n.overrides});t=i.headers["x-aptos-cursor"],delete i.headers,e.push(...i.data),r.start=t}while(t!=null);return e}async function jt(n){let{type:e,originMethod:t,path:r,body:i,acceptType:o,contentType:s,params:a,aptosConfig:c,overrides:p}=n,l=c.getRequestUrl(e);return Gn({url:l,method:"POST",originMethod:t,path:r,body:i,contentType:s,acceptType:o,params:a,overrides:p},c,n.type)}async function Fe(n){let{aptosConfig:e}=n;return jt({...n,type:"Fullnode",overrides:{...e.clientConfig,...e.fullnodeConfig,...n.overrides,HEADERS:{..._optionalChain([e, 'access', _36 => _36.clientConfig, 'optionalAccess', _37 => _37.HEADERS]),..._optionalChain([e, 'access', _38 => _38.fullnodeConfig, 'optionalAccess', _39 => _39.HEADERS])}}})}async function Qi(n){let{aptosConfig:e}=n;return jt({...n,type:"Indexer",overrides:{...e.clientConfig,...e.indexerConfig,...n.overrides,HEADERS:{..._optionalChain([e, 'access', _40 => _40.clientConfig, 'optionalAccess', _41 => _41.HEADERS]),..._optionalChain([e, 'access', _42 => _42.indexerConfig, 'optionalAccess', _43 => _43.HEADERS])}}})}async function Wi(n){let{aptosConfig:e}=n,t={...e,clientConfig:{...e.clientConfig}};return _optionalChainDelete([t, 'optionalAccess', _44 => _44.clientConfig, 'optionalAccess', _45 => delete _45.API_KEY]),jt({...n,type:"Faucet",overrides:{...t.clientConfig,...t.faucetConfig,...n.overrides,HEADERS:{..._optionalChain([t, 'access', _46 => _46.clientConfig, 'optionalAccess', _47 => _47.HEADERS]),..._optionalChain([t, 'access', _48 => _48.faucetConfig, 'optionalAccess', _49 => _49.HEADERS])}}})}async function ji(n){return jt({...n,type:"Pepper"})}async function Xi(n){return jt({...n,type:"Prover"})}var Br=new Map;function Me(n,e,t){return async(...r)=>{if(Br.has(e)){let{value:o,timestamp:s}=Br.get(e);if(t===void 0||Date.now()-s<=t)return o}let i=await n(...r);return Br.set(e,{value:i,timestamp:Date.now()}),i}}var Gl=1e7,Xa= exports.MAX_AUD_VAL_BYTES =120,Ya= exports.MAX_UID_KEY_BYTES =30,Za= exports.MAX_UID_VAL_BYTES =330,Kl= exports.MAX_ISS_VAL_BYTES =120,Nl= exports.MAX_EXTRA_FIELD_BYTES =350,Ol= exports.MAX_JWT_HEADER_B64_BYTES =300,Fl= exports.MAX_COMMITED_EPK_BYTES =93,be=class be extends oe{constructor(e,t){super();let r=g.fromHexInput(t).toUint8Array();if(r.length!==be.ID_COMMITMENT_LENGTH)throw new Error(`Id Commitment length in bytes should be ${be.ID_COMMITMENT_LENGTH}`);this.iss=e,this.idCommitment=r}authKey(){let e=new J;return e.serializeU32AsUleb128(3),e.serializeFixedBytes(this.bcsToBytes()),q.fromSchemeAndBytes({scheme:2,input:e.toUint8Array()})}toUint8Array(){return this.bcsToBytes()}toString(){return g.fromHexInput(this.toUint8Array()).toString()}verifySignature(e){throw new Error("Not yet implemented")}serialize(e){e.serializeStr(this.iss),e.serializeBytes(this.idCommitment)}static deserialize(e){let t=e.deserializeStr(),r=e.deserializeBytes();return new be(t,r)}static load(e){let t=e.deserializeStr(),r=e.deserializeBytes();return new be(t,r)}static isPublicKey(e){return e instanceof be}static create(e){return Yi(e),new be(e.iss,Yi(e))}static fromJwtAndPepper(e){let{jwt:t,pepper:r,uidKey:i="sub"}=e,o=_jwtdecode.jwtDecode.call(void 0, t),s=o.iss;if(typeof o.aud!="string")throw new Error("aud was not found or an array of values");let a=o.aud,c=o[i];return be.create({iss:s,uidKey:i,uidVal:c,aud:a,pepper:r})}static isInstance(e){return"iss"in e&&typeof e.iss=="string"&&"idCommitment"in e&&e.idCommitment instanceof Uint8Array}};be.ID_COMMITMENT_LENGTH=32;var te=be;function Yi(n){let{uidKey:e,uidVal:t,aud:r,pepper:i}=n,o=[Qt(g.fromHexInput(i).toUint8Array()),kn(r,Xa),kn(t,Za),kn(e,Ya)];return Ki(Wt(o),te.ID_COMMITMENT_LENGTH)}var Ie=class n extends B{constructor(e){super();let{jwtHeader:t,ephemeralCertificate:r,expiryDateSecs:i,ephemeralPublicKey:o,ephemeralSignature:s}=e;this.jwtHeader=t,this.ephemeralCertificate=r,this.expiryDateSecs=i,this.ephemeralPublicKey=o,this.ephemeralSignature=s}toUint8Array(){return this.bcsToBytes()}serialize(e){this.ephemeralCertificate.serialize(e),e.serializeStr(this.jwtHeader),e.serializeU64(this.expiryDateSecs),this.ephemeralPublicKey.serialize(e),this.ephemeralSignature.serialize(e)}static deserialize(e){let t=wt.deserialize(e),r=e.deserializeStr(),i=e.deserializeU64(),o=rt.deserialize(e),s=Te.deserialize(e);return new n({jwtHeader:r,expiryDateSecs:Number(i),ephemeralCertificate:t,ephemeralPublicKey:o,ephemeralSignature:s})}static getSimulationSignature(){return new n({jwtHeader:"{}",ephemeralCertificate:new wt(new Ue({proof:new _t(new St({a:new Uint8Array(32),b:new Uint8Array(64),c:new Uint8Array(32)}),0),expHorizonSecs:0}),0),expiryDateSecs:0,ephemeralPublicKey:new rt(new x(new Uint8Array(32))),ephemeralSignature:new Te(new P(new Uint8Array(64)))})}static isSignature(e){return e instanceof n}},wt= exports.EphemeralCertificate =class n extends B{constructor(e,t){super(),this.signature=e,this.variant=t}toUint8Array(){return this.signature.toUint8Array()}serialize(e){e.serializeU32AsUleb128(this.variant),this.signature.serialize(e)}static deserialize(e){let t=e.deserializeUleb128AsU32();switch(t){case 0:return new n(Ue.deserialize(e),t);default:throw new Error(`Unknown variant index for EphemeralCertificate: ${t}`)}}},Ee=class n extends d{constructor(e){if(super(),this.data=g.fromHexInput(e).toUint8Array(),this.data.length!==32)throw new Error("Input needs to be 32 bytes")}serialize(e){e.serializeFixedBytes(this.data)}static deserialize(e){let t=e.deserializeFixedBytes(32);return new n(t)}},ot=class n extends d{constructor(e){if(super(),this.data=g.fromHexInput(e).toUint8Array(),this.data.length!==64)throw new Error("Input needs to be 64 bytes")}serialize(e){e.serializeFixedBytes(this.data)}static deserialize(e){let t=e.deserializeFixedBytes(64);return new n(t)}},St= exports.Groth16Zkp =class n extends Dn{constructor(e){super();let{a:t,b:r,c:i}=e;this.a=new Ee(t),this.b=new ot(r),this.c=new Ee(i)}serialize(e){this.a.serialize(e),this.b.serialize(e),this.c.serialize(e)}static deserialize(e){let t=Ee.deserialize(e).bcsToBytes(),r=ot.deserialize(e).bcsToBytes(),i=Ee.deserialize(e).bcsToBytes();return new n({a:t,b:r,c:i})}},_t= exports.ZkProof =class n extends d{constructor(e,t){super(),this.proof=e,this.variant=t}serialize(e){e.serializeU32AsUleb128(this.variant),this.proof.serialize(e)}static deserialize(e){let t=e.deserializeUleb128AsU32();switch(t){case 0:return new n(St.deserialize(e),t);default:throw new Error(`Unknown variant index for ZkProof: ${t}`)}}},Ue= exports.ZeroKnowledgeSig =class n extends B{constructor(e){super();let{proof:t,expHorizonSecs:r,trainingWheelsSignature:i,extraField:o,overrideAudVal:s}=e;this.proof=t,this.expHorizonSecs=r,this.trainingWheelsSignature=i,this.extraField=o,this.overrideAudVal=s}toUint8Array(){return this.bcsToBytes()}static fromBytes(e){return n.deserialize(new Y(e))}serialize(e){this.proof.serialize(e),e.serializeU64(this.expHorizonSecs),e.serializeOptionStr(this.extraField),e.serializeOptionStr(this.overrideAudVal),e.serializeOption(this.trainingWheelsSignature)}static deserialize(e){let t=_t.deserialize(e),r=Number(e.deserializeU64()),i=e.deserializeOptionStr(),o=e.deserializeOptionStr(),s=e.deserializeOption(Te);return new n({proof:t,expHorizonSecs:r,trainingWheelsSignature:s,extraField:i,overrideAudVal:o})}},Gr= exports.KeylessConfiguration =class n{constructor(e,t){this.verficationKey=e,this.maxExpHorizonSecs=t}static create(e,t){return new n(new Kr({alphaG1:e.alpha_g1,betaG2:e.beta_g2,deltaG2:e.delta_g2,gammaAbcG1:e.gamma_abc_g1,gammaG2:e.gamma_g2}),t)}},Kr=class n{constructor(e){let{alphaG1:t,betaG2:r,deltaG2:i,gammaAbcG1:o,gammaG2:s}=e;this.alphaG1=new Ee(t),this.betaG2=new ot(r),this.deltaG2=new ot(i),this.gammaAbcG1=[new Ee(o[0]),new Ee(o[1])],this.gammaG2=new ot(s)}static fromGroth16VerificationKeyResponse(e){return new n({alphaG1:e.alpha_g1,betaG2:e.beta_g2,deltaG2:e.delta_g2,gammaAbcG1:e.gamma_abc_g1,gammaG2:e.gamma_g2})}};async function Zi(n){let{aptosConfig:e}=n;return Me(async()=>{let t=await Ja(n),r=await ec(n);return Gr.create(r,Number(t.max_exp_horizon_secs))},`keyless-configuration-${e.network}`,1e3*60*5)()}async function Ja(n){let{aptosConfig:e,options:t}=n,r="0x1::keyless_account::Configuration",{data:i}=await V({aptosConfig:e,originMethod:"getKeylessConfigurationResource",path:`accounts/${u.from("0x1").toString()}/resource/${r}`,params:{ledger_version:_optionalChain([t, 'optionalAccess', _50 => _50.ledgerVersion])}});return i.data}async function ec(n){let{aptosConfig:e,options:t}=n,r="0x1::keyless_account::Groth16VerificationKey",{data:i}=await V({aptosConfig:e,originMethod:"getGroth16VerificationKeyResource",path:`accounts/${u.from("0x1").toString()}/resource/${r}`,params:{ledger_version:_optionalChain([t, 'optionalAccess', _51 => _51.ledgerVersion])}});return i.data}var D=class n extends oe{constructor(e){if(super(),this.publicKey=e,e instanceof x)this.variant=0;else if(e instanceof Pe)this.variant=1;else if(e instanceof te)this.variant=3;else throw new Error("Unsupported public key type")}verifySignature(e){let{message:t,signature:r}=e;return G.isInstance(r)?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=x.deserialize(e);break;case 1:r=Pe.deserialize(e);break;case 3:r=te.deserialize(e);break;default:throw new Error(`Unknown variant index for AnyPublicKey: ${t}`)}return new n(r)}static isPublicKey(e){return e instanceof n}isEd25519(){return this.publicKey instanceof x}isSecp256k1PublicKey(){return this.publicKey instanceof Pe}static isInstance(e){return"publicKey"in e&&"variant"in e}},G= exports.AnySignature =class n extends B{constructor(e){if(super(),this.signature=e,e instanceof P)this.variant=0;else if(e instanceof ht)this.variant=1;else if(e instanceof Ie)this.variant=3;else throw new Error("Unsupported signature type")}toUint8Array(){return console.warn("[Aptos SDK] Calls to AnySignature.toUint8Array() will soon return the underlying signature bytes. Use AnySignature.bcsToBytes() instead."),this.bcsToBytes()}serialize(e){e.serializeU32AsUleb128(this.variant),this.signature.serialize(e)}static deserialize(e){let t=e.deserializeUleb128AsU32(),r;switch(t){case 0:r=P.deserialize(e);break;case 1:r=ht.deserialize(e);break;case 3:r=Ie.deserialize(e);break;default:throw new Error(`Unknown variant index for AnySignature: ${t}`)}return new n(r)}static isInstance(e){return"signature"in e&&typeof e.signature=="object"&&e.signature!==null&&"toUint8Array"in e.signature}};function tc(n){let e=n;return e-=e>>1&1431655765,e=(e&858993459)+(e>>2&858993459),(e+(e>>4)&252645135)*16843009>>24}var xt=class n extends oe{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(i=>i instanceof D?i:new D(i)),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(D),r=e.deserializeU8();return new n({publicKeys:t,signaturesRequired:r})}createBitmap(e){let{bits:t}=e,r=128,i=new Uint8Array([0,0,0,0]),o=new Set;return t.forEach((s,a)=>{if(a+1>this.publicKeys.length)throw new Error(`Signature index ${a+1} is out of public keys range, ${this.publicKeys.length}.`);if(o.has(s))throw new Error(`Duplicate bit ${s} detected.`);o.add(s);let c=Math.floor(s/8),p=i[c];p|=r>>s%8,i[c]=p}),i}getIndex(e){let t=e instanceof D?e:new D(e),r=this.publicKeys.findIndex(i=>i.toString()===t.toString());if(r!==-1)return r;throw new Error("Public key not found in MultiKey")}},ne=class ne extends B{constructor(e){super();let{signatures:t,bitmap:r}=e;if(t.length>ne.MAX_SIGNATURES_SUPPORTED)throw new Error(`The number of signatures cannot be greater than ${ne.MAX_SIGNATURES_SUPPORTED}`);if(this.signatures=t.map(o=>o instanceof G?o:new G(o)),!(r instanceof Uint8Array))this.bitmap=ne.createBitmap({bits:r});else{if(r.length!==ne.BITMAP_LEN)throw new Error(`"bitmap" length should be ${ne.BITMAP_LEN}`);this.bitmap=r}let i=this.bitmap.reduce((o,s)=>o+tc(s),0);if(i!==this.signatures.length)throw new Error(`Expecting ${i} signatures from the bitmap, but got ${this.signatures.length}`)}static createBitmap(e){let{bits:t}=e,r=128,i=new Uint8Array([0,0,0,0]),o=new Set;return t.forEach(s=>{if(s>=ne.MAX_SIGNATURES_SUPPORTED)throw new Error(`Cannot have a signature larger than ${ne.MAX_SIGNATURES_SUPPORTED-1}.`);if(o.has(s))throw new Error("Duplicate bits detected.");o.add(s);let a=Math.floor(s/8),c=i[a];c|=r>>s%8,i[a]=c}),i}toUint8Array(){return this.bcsToBytes()}serialize(e){e.serializeVector(this.signatures),e.serializeBytes(this.bitmap)}static deserialize(e){let t=e.deserializeVector(G),r=e.deserializeBytes();return new ne({signatures:t,bitmap:r})}};ne.BITMAP_LEN=4,ne.MAX_SIGNATURES_SUPPORTED=ne.BITMAP_LEN*8;var st=ne;var H=class extends d{static deserialize(e){let t=e.deserializeUleb128AsU32();switch(t){case 0:return fe.load(e);case 1:return Kn.load(e);case 2:return Q.load(e);case 3:return at.load(e);default:throw new Error(`Unknown variant index for AccountAuthenticator: ${t}`)}}isEd25519(){return this instanceof fe}isMultiEd25519(){return this instanceof Kn}isSingleKey(){return this instanceof Q}isMultiKey(){return this instanceof at}},fe= 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=x.deserialize(e),r=P.deserialize(e);return new n(t,r)}},Kn= 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=ft.deserialize(e),r=tt.deserialize(e);return new n(t,r)}},Q= 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=D.deserialize(e),r=G.deserialize(e);return new n(t,r)}},at= exports.AccountAuthenticatorMultiKey =class n extends H{constructor(e,t){super(),this.public_keys=e,this.signatures=t}serialize(e){e.serializeU32AsUleb128(3),this.public_keys.serialize(e),this.signatures.serialize(e)}static load(e){let t=xt.deserialize(e),r=st.deserialize(e);return new n(t,r)}};var vt=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 R=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 Nr=(n,e)=>{let t=n.bcsToBytes(),r=typeof e=="string"?Buffer.from(e,"utf8"):e,i=new Uint8Array([...t,...r,254]);return new u(_sha3.sha3_256.call(void 0, i))},Gg= exports.createResourceAddress =(n,e)=>{let t=n.bcsToBytes(),r=typeof e=="string"?Buffer.from(e,"utf8"):e,i=new Uint8Array([...t,...r,255]);return new u(_sha3.sha3_256.call(void 0, i))},Kg= exports.createTokenAddress =(n,e,t)=>{let r=`${e}::${t}`;return Nr(n,r)};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 R(t[1]))}serialize(e){this.address.serialize(e),this.name.serialize(e)}static deserialize(e){let t=u.deserialize(e),r=R.deserialize(e);return new n(t,r)}};var z=class extends d{static deserialize(e){let t=e.deserializeUleb128AsU32();switch(t){case 0:return K.load(e);case 1:return ce.load(e);case 2:return $.load(e);case 3:return $e.load(e);case 4:return W.load(e);case 5:return Pt.load(e);case 6:return C.load(e);case 7:return y.load(e);case 8:return qe.load(e);case 9:return Ve.load(e);case 10:return Le.load(e);case 255:return k.load(e);default:throw new Error(`Unknown variant index for TypeTag: ${t}`)}}isBool(){return this instanceof K}isAddress(){return this instanceof W}isGeneric(){return this instanceof k}isSigner(){return this instanceof Pt}isVector(){return this instanceof C}isStruct(){return this instanceof y}isU8(){return this instanceof ce}isU16(){return this instanceof qe}isU32(){return this instanceof Ve}isU64(){return this instanceof $}isU128(){return this instanceof $e}isU256(){return this instanceof Le}},K= exports.TypeTagBool =class n extends z{toString(){return"bool"}serialize(e){e.serializeU32AsUleb128(0)}static load(e){return new n}},ce= exports.TypeTagU8 =class n extends z{toString(){return"u8"}serialize(e){e.serializeU32AsUleb128(1)}static load(e){return new n}},qe= exports.TypeTagU16 =class n extends z{toString(){return"u16"}serialize(e){e.serializeU32AsUleb128(8)}static load(e){return new n}},Ve= exports.TypeTagU32 =class n extends z{toString(){return"u32"}serialize(e){e.serializeU32AsUleb128(9)}static load(e){return new n}},$= exports.TypeTagU64 =class n extends z{toString(){return"u64"}serialize(e){e.serializeU32AsUleb128(2)}static load(e){return new n}},$e= exports.TypeTagU128 =class n extends z{toString(){return"u128"}serialize(e){e.serializeU32AsUleb128(3)}static load(e){return new n}},Le= exports.TypeTagU256 =class n extends z{toString(){return"u256"}serialize(e){e.serializeU32AsUleb128(10)}static load(e){return new n}},W= exports.TypeTagAddress =class n extends z{toString(){return"address"}serialize(e){e.serializeU32AsUleb128(4)}static load(e){return new n}},Pt= exports.TypeTagSigner =class n extends z{toString(){return"signer"}serialize(e){e.serializeU32AsUleb128(5)}static load(e){return new n}},Nn= exports.TypeTagReference =class n extends z{constructor(t){super();this.value=t}toString(){return`&${this.value.toString()}`}serialize(t){t.serializeU32AsUleb128(254)}static load(t){let r=z.deserialize(t);return new n(r)}},k= exports.TypeTagGeneric =class n extends z{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)}},C= exports.TypeTagVector =class n extends z{constructor(t){super();this.value=t}toString(){return`vector<${this.value.toString()}>`}static u8(){return new n(new ce)}serialize(t){t.serializeU32AsUleb128(6),this.value.serialize(t)}static load(t){let r=z.deserialize(t);return new n(r)}},y= exports.TypeTagStruct =class n extends z{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=Re.deserialize(t);return new n(r)}isTypeTag(t,r,i){return this.value.moduleName.identifier===r&&this.value.name.identifier===i&&this.value.address.equals(t)}isString(){return this.isTypeTag(u.ONE,"string","String")}isOption(){return this.isTypeTag(u.ONE,"option","Option")}isObject(){return this.isTypeTag(u.ONE,"object","Object")}},Re= exports.StructTag =class n extends d{constructor(e,t,r,i){super(),this.address=e,this.moduleName=t,this.name=r,this.typeArgs=i}serialize(e){e.serialize(this.address),e.serialize(this.moduleName),e.serialize(this.name),e.serializeVector(this.typeArgs)}static deserialize(e){let t=u.deserialize(e),r=R.deserialize(e),i=R.deserialize(e),o=e.deserializeVector(z);return new n(t,r,i,o)}};function sm(){return new Re(u.ONE,new R("aptos_coin"),new R("AptosCoin"),[])}function v(){return new Re(u.ONE,new R("string"),new R("String"),[])}function am(n){return new Re(u.ONE,new R("option"),new R("Option"),[n])}function re(n){return new Re(u.ONE,new R("object"),new R("Object"),[n])}function nc(n){let e=n.deserializeUleb128AsU32();switch(e){case 0:return F.deserialize(n);case 1:return O.deserialize(n);case 2:return ge.deserialize(n);case 3:return u.deserialize(n);case 4:return T.deserialize(n,F);case 5:return I.deserialize(n);case 6:return de.deserialize(n);case 7:return le.deserialize(n);case 8:return me.deserialize(n);case 9:return Ht.deserialize(n);default:throw new Error(`Unknown variant index for ScriptTransactionArgument: ${e}`)}}var ct=class extends d{static deserialize(e){let t=e.deserializeUleb128AsU32();switch(t){case 0:return Yt.load(e);case 2:return Zt.load(e);case 3:return Jt.load(e);default:throw new Error(`Unknown variant index for TransactionPayload: ${t}`)}}},Yt= exports.TransactionPayloadScript =class n extends ct{constructor(e){super(),this.script=e}serialize(e){e.serializeU32AsUleb128(0),this.script.serialize(e)}static load(e){let t=en.deserialize(e);return new n(t)}},Zt= exports.TransactionPayloadEntryFunction =class n extends ct{constructor(e){super(),this.entryFunction=e}serialize(e){e.serializeU32AsUleb128(2),this.entryFunction.serialize(e)}static load(e){let t=ut.deserialize(e);return new n(t)}},Jt= exports.TransactionPayloadMultiSig =class n extends ct{constructor(e){super(),this.multiSig=e}serialize(e){e.serializeU32AsUleb128(3),this.multiSig.serialize(e)}static load(e){let t=tn.deserialize(e);return new n(t)}},ut= exports.EntryFunction =class n{constructor(e,t,r,i){this.module_name=e,this.function_name=t,this.type_args=r,this.args=i}static build(e,t,r,i){return new n(Xt.fromStr(e),new R(t),r,i)}serialize(e){this.module_name.serialize(e),this.function_name.serialize(e),e.serializeVector(this.type_args),e.serializeU32AsUleb128(this.args.length),this.args.forEach(t=>{t.serializeForEntryFunction(e)})}static deserialize(e){let t=Xt.deserialize(e),r=R.deserialize(e),i=e.deserializeVector(z),o=e.deserializeUleb128AsU32(),s=new Array;for(let a=0;a<o;a+=1){let c=e.deserializeUleb128AsU32(),p=En.deserialize(e,c);s.push(p)}return new n(t,r,i,s)}},en= 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(z),i=e.deserializeUleb128AsU32(),o=new Array;for(let s=0;s<i;s+=1){let a=nc(e);o.push(a)}return new n(t,r,o)}},tn= 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(),i;return r&&(i=nn.deserialize(e)),new n(t,i)}},nn= 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(ut.deserialize(e))}};var ue=class n extends d{constructor(e,t,r,i,o,s,a){super(),this.sender=e,this.sequence_number=t,this.payload=r,this.max_gas_amount=i,this.gas_unit_price=o,this.expiration_timestamp_secs=s,this.chain_id=a}serialize(e){this.sender.serialize(e),e.serializeU64(this.sequence_number),this.payload.serialize(e),e.serializeU64(this.max_gas_amount),e.serializeU64(this.gas_unit_price),e.serializeU64(this.expiration_timestamp_secs),this.chain_id.serialize(e)}static deserialize(e){let t=u.deserialize(e),r=e.deserializeU64(),i=ct.deserialize(e),o=e.deserializeU64(),s=e.deserializeU64(),a=e.deserializeU64(),c=vt.deserialize(e);return new n(t,r,i,o,s,a,c)}},On= exports.RawTransactionWithData =class extends d{static deserialize(e){let t=e.deserializeUleb128AsU32();switch(t){case 0:return pt.load(e);case 1:return dt.load(e);default:throw new Error(`Unknown variant index for RawTransactionWithData: ${t}`)}}},pt= exports.MultiAgentRawTransaction =class n extends On{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=ue.deserialize(e),r=e.deserializeVector(u);return new n(t,r)}},dt= exports.FeePayerRawTransaction =class n extends On{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=ue.deserialize(e),r=e.deserializeVector(u),i=u.deserialize(e);return new n(t,r,i)}};var Fn=class extends d{constructor(t){super();this.accountAddress=u.ONE;this.moduleName=new b("account");this.structName=new b("RotationProofChallenge");this.sequenceNumber=new O(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 ze=class extends d{static deserialize(e){let t=e.deserializeUleb128AsU32();switch(t){case 0:return Ct.load(e);case 1:return Or.load(e);case 2:return Et.load(e);case 3:return It.load(e);case 4:return Ut.load(e);default:throw new Error(`Unknown variant index for TransactionAuthenticator: ${t}`)}}},Ct= exports.TransactionAuthenticatorEd25519 =class n extends ze{constructor(e,t){super(),this.public_key=e,this.signature=t}serialize(e){e.serializeU32AsUleb128(0),this.public_key.serialize(e),this.signature.serialize(e)}static load(e){let t=x.deserialize(e),r=P.deserialize(e);return new n(t,r)}},Or= exports.TransactionAuthenticatorMultiEd25519 =class n extends ze{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=ft.deserialize(e),r=tt.deserialize(e);return new n(t,r)}},Et= exports.TransactionAuthenticatorMultiAgent =class n extends ze{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),i=e.deserializeVector(H);return new n(t,r,i)}},It= exports.TransactionAuthenticatorFeePayer =class n extends ze{constructor(e,t,r,i){super(),this.sender=e,this.secondary_signer_addresses=t,this.secondary_signers=r,this.fee_payer=i}serialize(e){e.serializeU32AsUleb128(3),this.sender.serialize(e),e.serializeVector(this.secondary_signer_addresses),e.serializeVector(this.secondary_signers),this.fee_payer.address.serialize(e),this.fee_payer.authenticator.serialize(e)}static load(e){let t=H.deserialize(e),r=e.deserializeVector(u),i=e.deserializeVector(H),o=u.deserialize(e),s=H.deserialize(e),a={address:o,authenticator:s};return new n(t,r,i,a)}},Ut= exports.TransactionAuthenticatorSingleSender =class n extends ze{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 lt=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=ue.deserialize(e),r=ze.deserialize(e);return new n(t,r)}};var Mn=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=ue.deserialize(e),r=e.deserializeBool(),i;return r&&(i=u.deserialize(e)),new n(t,i)}};var qn=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=ue.deserialize(e),r=e.deserializeVector(u),i=e.deserializeBool(),o;return i&&(o=u.deserialize(e)),new n(t,r,o)}};function Fr(n){return n.feePayerAddress?new dt(n.rawTransaction,_nullishCoalesce(n.secondarySignerAddresses, () => ([])),n.feePayerAddress):n.secondarySignerAddresses?new pt(n.rawTransaction,n.secondarySignerAddresses):n.rawTransaction}function Rt(n,e){let t=_sha3.sha3_256.create();if(!e.startsWith("APTOS::"))throw new Error(`Domain separator needs to start with 'APTOS::'. Provided - ${e}`);t.update(e);let r=t.digest(),i=n,o=new Uint8Array(r.length+i.length);return o.set(r),o.set(i,r.length),o}function hy(n){return Rt(n.bcsToBytes(),`APTOS::${n.constructor.name}`)}function zt(n){let e=Fr(n);return n.feePayerAddress?Rt(e.bcsToBytes(),Er):n.secondarySignerAddresses?Rt(e.bcsToBytes(),Er):Rt(e.bcsToBytes(),Mi)}var kt=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=L.generate();return new n({privateKey:e})}static fromDerivationPath(e){let{path:t,mnemonic:r}=e,i=L.fromDerivationPath(t,r);return new n({privateKey:i})}verifySignature(e){return this.publicKey.verifySignature(e)}signWithAuthenticator(e){return new fe(this.publicKey,this.privateKey.sign(e))}signTransactionWithAuthenticator(e){return new fe(this.publicKey,this.signTransaction(e))}sign(e){return this.privateKey.sign(e)}signTransaction(e){return this.sign(zt(e))}};var Dt=class n{constructor(e){this.signingScheme=2;let{privateKey:t,address:r}=e;this.privateKey=t,this.publicKey=new D(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=L.generate();break;case 2:r=nt.generate();break;default:throw new Error(`Unsupported signature scheme ${t}`)}return new n({privateKey:r})}static fromDerivationPath(e){let{scheme:t=0,path:r,mnemonic:i}=e,o;switch(t){case 0:o=L.fromDerivationPath(r,i);break;case 2:o=nt.fromDerivationPath(r,i);break;default:throw new Error(`Unsupported signature scheme ${t}`)}return new n({privateKey:o})}verifySignature(e){return this.publicKey.verifySignature(e)}signWithAuthenticator(e){return new Q(this.publicKey,this.sign(e))}signTransactionWithAuthenticator(e){return new Q(this.publicKey,this.signTransaction(e))}sign(e){return new G(this.privateKey.sign(e))}signTransaction(e){return this.sign(zt(e))}};var He=class{static generate(e={}){let{scheme:t=0,legacy:r=!0}=e;return t===0&&r?kt.generate():Dt.generate({scheme:t})}static fromPrivateKey(e){let{privateKey:t,address:r,legacy:i=!0}=e;return t instanceof L&&i?new kt({privateKey:t,address:r}):new Dt({privateKey:t,address:r})}static fromPrivateKeyAndAddress(e){return this.fromPrivateKey(e)}static fromDerivationPath(e){let{scheme:t=0,mnemonic:r,path:i,legacy:o=!0}=e;return t===0&&o?kt.fromDerivationPath({mnemonic:r,path:i}):Dt.fromDerivationPath({scheme:t,mnemonic:r,path:i})}static authKey(e){let{publicKey:t}=e;return t.authKey()}verifySignature(e){return this.publicKey.verifySignature(e)}};var oc=1209600,Bt=class Bt extends d{constructor(e){super();let{privateKey:t,expiryDateSecs:r,blinder:i}=e;this.privateKey=t,this.publicKey=new rt(t.publicKey()),this.expiryDateSecs=r||_chunkHBPH2AD3js.d.call(void 0, _chunkHBPH2AD3js.c.call(void 0, )+oc),this.blinder=i!==void 0?g.fromHexInput(i).toUint8Array():sc();let o=Cr(this.publicKey.bcsToBytes(),93);o.push(BigInt(this.expiryDateSecs)),o.push(Qt(this.blinder));let s=Wt(o);this.nonce=s.toString()}getPublicKey(){return this.publicKey}isExpired(){return Math.floor(Date.now()/1e3)>this.expiryDateSecs}serialize(e){e.serializeU32AsUleb128(this.publicKey.variant),e.serializeBytes(this.privateKey.toUint8Array()),e.serializeU64(this.expiryDateSecs),e.serializeFixedBytes(this.blinder)}static deserialize(e){let t=e.deserializeUleb128AsU32(),r;switch(t){case 0:r=L.deserialize(e);break;default:throw new Error(`Unknown variant index for EphemeralPublicKey: ${t}`)}let i=e.deserializeU64(),o=e.deserializeFixedBytes(31);return new Bt({privateKey:r,expiryDateSecs:Number(i),blinder:o})}static fromBytes(e){return Bt.deserialize(new Y(e))}static generate(e){let t;switch(_optionalChain([e, 'optionalAccess', _52 => _52.scheme])){case 0:default:t=L.generate()}return new Bt({privateKey:t,expiryDateSecs:_optionalChain([e, 'optionalAccess', _53 => _53.expiryDateSecs])})}sign(e){if(this.isExpired())throw new Error("EphemeralKeyPair has expired");return new Te(this.privateKey.sign(e))}};Bt.BLINDER_LENGTH=31;var rn=Bt;function sc(){return _utils.randomBytes.call(void 0, rn.BLINDER_LENGTH)}var _eventemitter3 = require('eventemitter3'); var _eventemitter32 = _interopRequireDefault(_eventemitter3);var Qe=class Qe extends d{constructor(e){super();let{address:t,ephemeralKeyPair:r,uidKey:i,uidVal:o,aud:s,pepper:a,proof:c,proofFetchCallback:p,jwt:l}=e;if(this.ephemeralKeyPair=r,this.publicKey=te.create(e),this.accountAddress=t?u.from(t):this.publicKey.authKey().derivedAddress(),this.uidKey=i,this.uidVal=o,this.aud=s,this.jwt=l,this.emitter=new _eventemitter32.default,this.proofOrPromise=c,c instanceof Ue)this.proof=c;else{if(p===void 0)throw new Error("Must provide callback for async proof fetch");this.emitter.on("proofFetchFinish",async S=>{await p(S),this.emitter.removeAllListeners()}),this.init(c)}this.signingScheme=2;let w=g.fromHexInput(a).toUint8Array();if(w.length!==Qe.PEPPER_LENGTH)throw new Error(`Pepper length in bytes should be ${Qe.PEPPER_LENGTH}`);this.pepper=w}async init(e){try{this.proof=await e,this.emitter.emit("proofFetchFinish",{status:"Success"})}catch(t){t instanceof Error?this.emitter.emit("proofFetchFinish",{status:"Failed",error:t.toString()}):this.emitter.emit("proofFetchFinish",{status:"Failed",error:"Unknown"})}}serialize(e){if(e.serializeStr(this.jwt),e.serializeStr(this.uidKey),e.serializeFixedBytes(this.pepper),this.ephemeralKeyPair.serialize(e),this.proof===void 0)throw new Error("Connot serialize - proof undefined");this.proof.serialize(e)}static deserialize(e){let t=e.deserializeStr(),r=e.deserializeStr(),i=e.deserializeFixedBytes(31),o=rn.deserialize(e),s=Ue.deserialize(e);return Qe.create({proof:s,pepper:i,uidKey:r,jwt:t,ephemeralKeyPair:o})}isExpired(){return this.ephemeralKeyPair.isExpired()}signWithAuthenticator(e){let t=new G(this.sign(e)),r=new D(this.publicKey);return new Q(r,t)}signTransactionWithAuthenticator(e){let t=new G(this.signTransaction(e)),r=new D(this.publicKey);return new Q(r,t)}async waitForProofFetch(){this.proofOrPromise instanceof Promise&&await this.proofOrPromise}sign(e){let{expiryDateSecs:t}=this.ephemeralKeyPair;if(this.isExpired())throw new Error("EphemeralKeyPair is expired");if(this.proof===void 0)throw new Error("Proof not defined");let r=this.ephemeralKeyPair.getPublicKey(),i=this.ephemeralKeyPair.sign(e);return new Ie({jwtHeader:_chunkHBPH2AD3js.e.call(void 0, this.jwt.split(".")[0]),ephemeralCertificate:new wt(this.proof,0),expiryDateSecs:t,ephemeralPublicKey:r,ephemeralSignature:i})}signTransaction(e){if(this.proof===void 0)throw new Error("Proof not found");let t=Fr(e),i=new Mr(t,this.proof.proof).hash();return this.sign(i)}verifySignature(e){let{message:t,signature:r}=e;return!(this.isExpired()||!this.ephemeralKeyPair.getPublicKey().verifySignature({message:t,signature:r.ephemeralSignature}))}static fromBytes(e){return Qe.deserialize(new Y(e))}static create(e){let{address:t,proof:r,jwt:i,ephemeralKeyPair:o,pepper:s,uidKey:a="sub",proofFetchCallback:c}=e,p=_jwtdecode.jwtDecode.call(void 0, i),l=p.iss;if(typeof p.aud!="string")throw new Error("aud was not found or an array of values");let w=p.aud,S=p[a];return new Qe({address:t,proof:r,ephemeralKeyPair:o,iss:l,uidKey:a,uidVal:S,aud:w,pepper:s,jwt:i,proofFetchCallback:c})}};Qe.PEPPER_LENGTH=31;var we=Qe,Mr=class extends d{constructor(t,r){super();this.domainSeparator="APTOS::TransactionAndProof";this.transaction=t,this.proof=r}serialize(t){t.serializeFixedBytes(this.transaction.bcsToBytes()),t.serializeOption(this.proof)}hash(){return Rt(this.bcsToBytes(),this.domainSeparator)}};var Vn=class n{constructor(e){let{multiKey:t,signers:r,address:i}=e;this.publicKey=t,this.signingScheme=3,this.accountAddress=i?u.from(i):this.publicKey.authKey().derivedAddress();let o=[];for(let a of r)o.push(this.publicKey.getIndex(a.publicKey));let s=r.map((a,c)=>[a,o[c]]);s.sort((a,c)=>a[1]-c[1]),this.signers=s.map(a=>a[0]),this.signerIndicies=s.map(a=>a[1]),this.signaturesBitmap=this.publicKey.createBitmap({bits:o})}static fromPublicKeysAndSigners(e){let{publicKeys:t,signaturesRequired:r,signers:i}=e,o=new xt({publicKeys:t,signaturesRequired:r});return new n({multiKey:o,signers:i})}static isMultiKeySigner(e){return e instanceof n}signWithAuthenticator(e){return new at(this.publicKey,this.sign(e))}signTransactionWithAuthenticator(e){return new at(this.publicKey,this.signTransaction(e))}async waitForProofFetch(){let t=this.signers.filter(r=>r instanceof we).map(async r=>r.waitForProofFetch());await Promise.all(t)}sign(e){let t=[];for(let r of this.signers)t.push(r.sign(e));return new st({signatures:t,bitmap:this.signaturesBitmap})}signTransaction(e){let t=[];for(let r of this.signers)t.push(r.signTransaction(e));return new st({signatures:t,bitmap:this.signaturesBitmap})}verifySignature(e){let{message:t,signature:r}=e;if(!this.signerIndicies.every((o,s)=>s===0||o>=this.signerIndicies[s-1]))return!1;for(let o=0;o<r.signatures.length;o+=1){let s=r.signatures[o];if(!this.publicKey.publicKeys[this.signerIndicies[o]].verifySignature({message:t,signature:s}))return!1}return!0}};var uc=`
|
|
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
|
+
`,pc=`
|
|
20
20
|
fragment AnsTokenFragment on current_aptos_names {
|
|
21
21
|
domain
|
|
22
22
|
expiration_timestamp
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
subdomain_expiration_policy
|
|
29
29
|
domain_expiration_timestamp
|
|
30
30
|
}
|
|
31
|
-
|
|
31
|
+
`,$n=`
|
|
32
32
|
fragment CurrentTokenOwnershipFields on current_token_ownerships_v2 {
|
|
33
33
|
token_standard
|
|
34
34
|
token_properties_mutated_v1
|
|
@@ -75,7 +75,7 @@
|
|
|
75
75
|
}
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
|
-
`,
|
|
78
|
+
`,eo=`
|
|
79
79
|
query getAccountCoinsCount($address: String) {
|
|
80
80
|
current_fungible_asset_balances_aggregate(
|
|
81
81
|
where: {owner_address: {_eq: $address}}
|
|
@@ -85,7 +85,7 @@
|
|
|
85
85
|
}
|
|
86
86
|
}
|
|
87
87
|
}
|
|
88
|
-
`,
|
|
88
|
+
`,to=`
|
|
89
89
|
query getAccountCoinsData($where_condition: current_fungible_asset_balances_bool_exp!, $offset: Int, $limit: Int, $order_by: [current_fungible_asset_balances_order_by!]) {
|
|
90
90
|
current_fungible_asset_balances(
|
|
91
91
|
where: $where_condition
|
|
@@ -118,7 +118,7 @@
|
|
|
118
118
|
}
|
|
119
119
|
}
|
|
120
120
|
}
|
|
121
|
-
`,
|
|
121
|
+
`,no=`
|
|
122
122
|
query getAccountCollectionsWithOwnedTokens($where_condition: current_collection_ownership_v2_view_bool_exp!, $offset: Int, $limit: Int, $order_by: [current_collection_ownership_v2_view_order_by!]) {
|
|
123
123
|
current_collection_ownership_v2_view(
|
|
124
124
|
where: $where_condition
|
|
@@ -152,7 +152,7 @@
|
|
|
152
152
|
single_token_uri
|
|
153
153
|
}
|
|
154
154
|
}
|
|
155
|
-
`,
|
|
155
|
+
`,ro=`
|
|
156
156
|
query getAccountOwnedTokens($where_condition: current_token_ownerships_v2_bool_exp!, $offset: Int, $limit: Int, $order_by: [current_token_ownerships_v2_order_by!]) {
|
|
157
157
|
current_token_ownerships_v2(
|
|
158
158
|
where: $where_condition
|
|
@@ -163,7 +163,7 @@
|
|
|
163
163
|
...CurrentTokenOwnershipFields
|
|
164
164
|
}
|
|
165
165
|
}
|
|
166
|
-
${
|
|
166
|
+
${$n}`,Of=`
|
|
167
167
|
query getAccountOwnedTokensByTokenData($where_condition: current_token_ownerships_v2_bool_exp!, $offset: Int, $limit: Int, $order_by: [current_token_ownerships_v2_order_by!]) {
|
|
168
168
|
current_token_ownerships_v2(
|
|
169
169
|
where: $where_condition
|
|
@@ -174,7 +174,7 @@
|
|
|
174
174
|
...CurrentTokenOwnershipFields
|
|
175
175
|
}
|
|
176
176
|
}
|
|
177
|
-
${
|
|
177
|
+
${$n}`,io=`
|
|
178
178
|
query getAccountOwnedTokensFromCollection($where_condition: current_token_ownerships_v2_bool_exp!, $offset: Int, $limit: Int, $order_by: [current_token_ownerships_v2_order_by!]) {
|
|
179
179
|
current_token_ownerships_v2(
|
|
180
180
|
where: $where_condition
|
|
@@ -185,7 +185,7 @@
|
|
|
185
185
|
...CurrentTokenOwnershipFields
|
|
186
186
|
}
|
|
187
187
|
}
|
|
188
|
-
${
|
|
188
|
+
${$n}`,oo=`
|
|
189
189
|
query getAccountTokensCount($where_condition: current_token_ownerships_v2_bool_exp, $offset: Int, $limit: Int) {
|
|
190
190
|
current_token_ownerships_v2_aggregate(
|
|
191
191
|
where: $where_condition
|
|
@@ -197,7 +197,7 @@
|
|
|
197
197
|
}
|
|
198
198
|
}
|
|
199
199
|
}
|
|
200
|
-
`,
|
|
200
|
+
`,so=`
|
|
201
201
|
query getAccountTransactionsCount($address: String) {
|
|
202
202
|
account_transactions_aggregate(where: {account_address: {_eq: $address}}) {
|
|
203
203
|
aggregate {
|
|
@@ -205,13 +205,13 @@
|
|
|
205
205
|
}
|
|
206
206
|
}
|
|
207
207
|
}
|
|
208
|
-
`,
|
|
208
|
+
`,ao=`
|
|
209
209
|
query getChainTopUserTransactions($limit: Int) {
|
|
210
210
|
user_transactions(limit: $limit, order_by: {version: desc}) {
|
|
211
211
|
version
|
|
212
212
|
}
|
|
213
213
|
}
|
|
214
|
-
`,
|
|
214
|
+
`,co=`
|
|
215
215
|
query getCollectionData($where_condition: current_collections_v2_bool_exp!) {
|
|
216
216
|
current_collections_v2(where: $where_condition) {
|
|
217
217
|
uri
|
|
@@ -241,7 +241,7 @@
|
|
|
241
241
|
}
|
|
242
242
|
}
|
|
243
243
|
}
|
|
244
|
-
`,
|
|
244
|
+
`,uo=`
|
|
245
245
|
query getCurrentFungibleAssetBalances($where_condition: current_fungible_asset_balances_bool_exp, $offset: Int, $limit: Int) {
|
|
246
246
|
current_fungible_asset_balances(
|
|
247
247
|
where: $where_condition
|
|
@@ -259,7 +259,7 @@
|
|
|
259
259
|
token_standard
|
|
260
260
|
}
|
|
261
261
|
}
|
|
262
|
-
`,
|
|
262
|
+
`,po=`
|
|
263
263
|
query getDelegatedStakingActivities($delegatorAddress: String, $poolAddress: String) {
|
|
264
264
|
delegated_staking_activities(
|
|
265
265
|
where: {delegator_address: {_eq: $delegatorAddress}, pool_address: {_eq: $poolAddress}}
|
|
@@ -272,7 +272,7 @@
|
|
|
272
272
|
transaction_version
|
|
273
273
|
}
|
|
274
274
|
}
|
|
275
|
-
`,
|
|
275
|
+
`,lo=`
|
|
276
276
|
query getEvents($where_condition: events_bool_exp, $offset: Int, $limit: Int, $order_by: [events_order_by!]) {
|
|
277
277
|
events(
|
|
278
278
|
where: $where_condition
|
|
@@ -291,7 +291,7 @@
|
|
|
291
291
|
indexed_type
|
|
292
292
|
}
|
|
293
293
|
}
|
|
294
|
-
`,
|
|
294
|
+
`,go=`
|
|
295
295
|
query getFungibleAssetActivities($where_condition: fungible_asset_activities_bool_exp, $offset: Int, $limit: Int) {
|
|
296
296
|
fungible_asset_activities(
|
|
297
297
|
where: $where_condition
|
|
@@ -316,7 +316,7 @@
|
|
|
316
316
|
type
|
|
317
317
|
}
|
|
318
318
|
}
|
|
319
|
-
`,
|
|
319
|
+
`,mo=`
|
|
320
320
|
query getFungibleAssetMetadata($where_condition: fungible_asset_metadata_bool_exp, $offset: Int, $limit: Int) {
|
|
321
321
|
fungible_asset_metadata(where: $where_condition, offset: $offset, limit: $limit) {
|
|
322
322
|
icon_uri
|
|
@@ -346,14 +346,14 @@
|
|
|
346
346
|
...AnsTokenFragment
|
|
347
347
|
}
|
|
348
348
|
}
|
|
349
|
-
${
|
|
349
|
+
${pc}`,qr=`
|
|
350
350
|
query getNumberOfDelegators($where_condition: num_active_delegator_per_pool_bool_exp, $order_by: [num_active_delegator_per_pool_order_by!]) {
|
|
351
351
|
num_active_delegator_per_pool(where: $where_condition, order_by: $order_by) {
|
|
352
352
|
num_active_delegator
|
|
353
353
|
pool_address
|
|
354
354
|
}
|
|
355
355
|
}
|
|
356
|
-
|
|
356
|
+
`,Ln=`
|
|
357
357
|
query getObjectData($where_condition: current_objects_bool_exp, $offset: Int, $limit: Int, $order_by: [current_objects_order_by!]) {
|
|
358
358
|
current_objects(
|
|
359
359
|
where: $where_condition
|
|
@@ -370,7 +370,7 @@
|
|
|
370
370
|
is_deleted
|
|
371
371
|
}
|
|
372
372
|
}
|
|
373
|
-
`,
|
|
373
|
+
`,Vr=`
|
|
374
374
|
query getProcessorStatus($where_condition: processor_status_bool_exp) {
|
|
375
375
|
processor_status(where: $where_condition) {
|
|
376
376
|
last_success_version
|
|
@@ -378,7 +378,7 @@
|
|
|
378
378
|
last_updated
|
|
379
379
|
}
|
|
380
380
|
}
|
|
381
|
-
`,
|
|
381
|
+
`,yo=`
|
|
382
382
|
query getTableItemsData($where_condition: table_items_bool_exp!, $offset: Int, $limit: Int, $order_by: [table_items_order_by!]) {
|
|
383
383
|
table_items(
|
|
384
384
|
where: $where_condition
|
|
@@ -394,7 +394,7 @@
|
|
|
394
394
|
write_set_change_index
|
|
395
395
|
}
|
|
396
396
|
}
|
|
397
|
-
`,
|
|
397
|
+
`,fo=`
|
|
398
398
|
query getTableItemsMetadata($where_condition: table_metadatas_bool_exp!, $offset: Int, $limit: Int, $order_by: [table_metadatas_order_by!]) {
|
|
399
399
|
table_metadatas(
|
|
400
400
|
where: $where_condition
|
|
@@ -407,7 +407,7 @@
|
|
|
407
407
|
value_type
|
|
408
408
|
}
|
|
409
409
|
}
|
|
410
|
-
`,
|
|
410
|
+
`,Ao=`
|
|
411
411
|
query getTokenActivity($where_condition: token_activities_v2_bool_exp!, $offset: Int, $limit: Int, $order_by: [token_activities_v2_order_by!]) {
|
|
412
412
|
token_activities_v2(
|
|
413
413
|
where: $where_condition
|
|
@@ -418,7 +418,7 @@
|
|
|
418
418
|
...TokenActivitiesFields
|
|
419
419
|
}
|
|
420
420
|
}
|
|
421
|
-
${
|
|
421
|
+
${uc}`,$r=`
|
|
422
422
|
query getCurrentTokenOwnership($where_condition: current_token_ownerships_v2_bool_exp!, $offset: Int, $limit: Int, $order_by: [current_token_ownerships_v2_order_by!]) {
|
|
423
423
|
current_token_ownerships_v2(
|
|
424
424
|
where: $where_condition
|
|
@@ -429,7 +429,7 @@
|
|
|
429
429
|
...CurrentTokenOwnershipFields
|
|
430
430
|
}
|
|
431
431
|
}
|
|
432
|
-
${
|
|
432
|
+
${$n}`,ho=`
|
|
433
433
|
query getTokenData($where_condition: current_token_datas_v2_bool_exp, $offset: Int, $limit: Int, $order_by: [current_token_datas_v2_order_by!]) {
|
|
434
434
|
current_token_datas_v2(
|
|
435
435
|
where: $where_condition
|
|
@@ -469,5 +469,5 @@
|
|
|
469
469
|
}
|
|
470
470
|
}
|
|
471
471
|
}
|
|
472
|
-
`;async function Ln(n){let{aptosConfig:e}=n,{data:t}=await V({aptosConfig:e,originMethod:"getLedgerInfo",path:""});return t}async function yi(n){let{aptosConfig:e,limit:t}=n;return(await f({aptosConfig:e,query:{query:oi,variables:{limit:t}},originMethod:"getChainTopUserTransactions"})).user_transactions}async function f(n){let{aptosConfig:e,query:t,originMethod:r}=n,{data:o}=await $o({aptosConfig:e,originMethod:_nullishCoalesce(r, () => ("queryIndexer")),path:"",body:t,overrides:{WITH_CREDENTIALS:!1}});return o}async function ac(n){let{aptosConfig:e}=n;return(await f({aptosConfig:e,query:{query:qr},originMethod:"getProcessorStatuses"})).processor_status}async function Hn(n){let e=await ac({aptosConfig:n.aptosConfig});return BigInt(e[0].last_success_version)}async function Qn(n){let{aptosConfig:e,processorType:t}=n;return(await f({aptosConfig:e,query:{query:qr,variables:{where_condition:{processor:{_eq:t}}}},originMethod:"getProcessorStatus"})).processor_status[0]}async function Wn(n){let{aptosConfig:e,handle:t,data:r,options:o}=n;return(await Oe({aptosConfig:e,originMethod:"getTableItem",path:`tables/${t}/item`,params:{ledger_version:_optionalChain([o, 'optionalAccess', _54 => _54.ledgerVersion])},body:r})).data}async function fi(n){let{aptosConfig:e,options:t}=n,r={query:di,variables:{where_condition:_optionalChain([t, 'optionalAccess', _55 => _55.where]),offset:_optionalChain([t, 'optionalAccess', _56 => _56.offset]),limit:_optionalChain([t, 'optionalAccess', _57 => _57.limit]),order_by:_optionalChain([t, 'optionalAccess', _58 => _58.orderBy])}};return(await f({aptosConfig:e,query:r,originMethod:"getTableItemsData"})).table_items}async function Ai(n){let{aptosConfig:e,options:t}=n,r={query:li,variables:{where_condition:_optionalChain([t, 'optionalAccess', _59 => _59.where]),offset:_optionalChain([t, 'optionalAccess', _60 => _60.offset]),limit:_optionalChain([t, 'optionalAccess', _61 => _61.limit]),order_by:_optionalChain([t, 'optionalAccess', _62 => _62.orderBy])}};return(await f({aptosConfig:e,query:r,originMethod:"getTableItemsMetadata"})).table_metadatas}async function Se(n){let{aptosConfig:e,accountAddress:t}=n,{data:r}=await V({aptosConfig:e,originMethod:"getInfo",path:`accounts/${u.from(t).toString()}`});return r}async function bi(n){let{aptosConfig:e,accountAddress:t,options:r}=n;return bt({aptosConfig:e,originMethod:"getModules",path:`accounts/${u.from(t).toString()}/modules`,params:{ledger_version:_optionalChain([r, 'optionalAccess', _63 => _63.ledgerVersion]),start:_optionalChain([r, 'optionalAccess', _64 => _64.offset]),limit:_nullishCoalesce(_optionalChain([r, 'optionalAccess', _65 => _65.limit]), () => (1e3))}})}async function jn(n){return _optionalChain([n, 'access', _66 => _66.options, 'optionalAccess', _67 => _67.ledgerVersion])!==void 0?hi(n):Fe(async()=>hi(n),`module-${n.accountAddress}-${n.moduleName}`,1e3*60*5)()}async function hi(n){let{aptosConfig:e,accountAddress:t,moduleName:r,options:o}=n,{data:i}=await V({aptosConfig:e,originMethod:"getModule",path:`accounts/${u.from(t).toString()}/module/${r}`,params:{ledger_version:_optionalChain([o, 'optionalAccess', _68 => _68.ledgerVersion])}});return i}async function wi(n){let{aptosConfig:e,accountAddress:t,options:r}=n;return bt({aptosConfig:e,originMethod:"getTransactions",path:`accounts/${u.from(t).toString()}/transactions`,params:{start:_optionalChain([r, 'optionalAccess', _69 => _69.offset]),limit:_optionalChain([r, 'optionalAccess', _70 => _70.limit])}})}async function Si(n){let{aptosConfig:e,accountAddress:t,options:r}=n;return bt({aptosConfig:e,originMethod:"getResources",path:`accounts/${u.from(t).toString()}/resources`,params:{ledger_version:_optionalChain([r, 'optionalAccess', _71 => _71.ledgerVersion]),start:_optionalChain([r, 'optionalAccess', _72 => _72.offset]),limit:_nullishCoalesce(_optionalChain([r, 'optionalAccess', _73 => _73.limit]), () => (999))}})}async function $r(n){let{aptosConfig:e,accountAddress:t,resourceType:r,options:o}=n,{data:i}=await V({aptosConfig:e,originMethod:"getResource",path:`accounts/${u.from(t).toString()}/resource/${r}`,params:{ledger_version:_optionalChain([o, 'optionalAccess', _74 => _74.ledgerVersion])}});return i.data}async function rn(n){let{aptosConfig:e,authenticationKey:t,options:r}=n,o=await $r({aptosConfig:e,accountAddress:"0x1",resourceType:"0x1::account::OriginatingAddress",options:r}),{address_map:{handle:i}}=o,s=u.from(t);try{let a=await Wn({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 ye&&a.data.error_code==="table_item_not_found")return s;throw a}}async function _i(n){let{aptosConfig:e,accountAddress:t}=n,o={owner_address:{_eq:u.from(t).toStringLong()},amount:{_gt:0}},s=await f({aptosConfig:e,query:{query:ni,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 xi(n){let{aptosConfig:e,accountAddress:t,options:r}=n,i={owner_address:{_eq:u.from(t).toStringLong()},amount:{_gt:0}};_optionalChain([r, 'optionalAccess', _75 => _75.tokenStandard])&&(i.token_standard={_eq:_optionalChain([r, 'optionalAccess', _76 => _76.tokenStandard])});let s={query:ei,variables:{where_condition:i,offset:_optionalChain([r, 'optionalAccess', _77 => _77.offset]),limit:_optionalChain([r, 'optionalAccess', _78 => _78.limit]),order_by:_optionalChain([r, 'optionalAccess', _79 => _79.orderBy])}};return(await f({aptosConfig:e,query:s,originMethod:"getAccountOwnedTokens"})).current_token_ownerships_v2}async function Pi(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', _80 => _80.tokenStandard])&&(a.token_standard={_eq:_optionalChain([o, 'optionalAccess', _81 => _81.tokenStandard])});let c={query:ti,variables:{where_condition:a,offset:_optionalChain([o, 'optionalAccess', _82 => _82.offset]),limit:_optionalChain([o, 'optionalAccess', _83 => _83.limit]),order_by:_optionalChain([o, 'optionalAccess', _84 => _84.orderBy])}};return(await f({aptosConfig:e,query:c,originMethod:"getAccountOwnedTokensFromCollectionAddress"})).current_token_ownerships_v2}async function vi(n){let{aptosConfig:e,accountAddress:t,options:r}=n,i={owner_address:{_eq:u.from(t).toStringLong()}};_optionalChain([r, 'optionalAccess', _85 => _85.tokenStandard])&&(i.current_collection={token_standard:{_eq:_optionalChain([r, 'optionalAccess', _86 => _86.tokenStandard])}});let s={query:Jo,variables:{where_condition:i,offset:_optionalChain([r, 'optionalAccess', _87 => _87.offset]),limit:_optionalChain([r, 'optionalAccess', _88 => _88.limit]),order_by:_optionalChain([r, 'optionalAccess', _89 => _89.orderBy])}};return(await f({aptosConfig:e,query:s,originMethod:"getAccountCollectionsWithOwnedTokens"})).current_collection_ownership_v2_view}async function Ci(n){let{aptosConfig:e,accountAddress:t}=n,r=u.from(t).toStringLong(),i=await f({aptosConfig:e,query:{query:ri,variables:{address:r}},originMethod:"getAccountTransactionsCount"});return i.account_transactions_aggregate.aggregate?i.account_transactions_aggregate.aggregate.count:0}async function Ei(n){let{aptosConfig:e,accountAddress:t,coinType:r,faMetadataAddress:o}=n,i,s;if(r!==void 0&&o!==void 0)s=u.from(o).toStringLong();else if(r!==void 0&&o===void 0)i=r,n.coinType===ot?s=u.A.toStringLong():s=Kr(u.A,r).toStringLong();else if(r===void 0&&o!==void 0){let y=u.from(o);s=y.toStringLong(),y===u.A&&(i=ot)}else throw new Error("Either coinType, fungibleAssetAddress, or both must be provided");let a=u.from(t).toStringLong(),c={asset_type:{_eq:s}};r!==void 0&&(c={asset_type:{_in:[i,s]}});let p=await Lr({aptosConfig:e,accountAddress:a,options:{where:c}});return p[0]?p[0].amount:0}async function Lr(n){let{aptosConfig:e,accountAddress:t,options:r}=n,o=u.from(t).toStringLong(),i={..._optionalChain([r, 'optionalAccess', _90 => _90.where]),owner_address:{_eq:o}},s={query:Zo,variables:{where_condition:i,offset:_optionalChain([r, 'optionalAccess', _91 => _91.offset]),limit:_optionalChain([r, 'optionalAccess', _92 => _92.limit]),order_by:_optionalChain([r, 'optionalAccess', _93 => _93.orderBy])}};return(await f({aptosConfig:e,query:s,originMethod:"getAccountCoinsData"})).current_fungible_asset_balances}async function Ii(n){let{aptosConfig:e,accountAddress:t}=n,r=u.from(t).toStringLong(),i=await f({aptosConfig:e,query:{query:Yo,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 Ui(n){let{aptosConfig:e,accountAddress:t,options:r}=n,i={owner_address:{_eq:u.from(t).toStringLong()}},s={query:$n,variables:{where_condition:i,offset:_optionalChain([r, 'optionalAccess', _94 => _94.offset]),limit:_optionalChain([r, 'optionalAccess', _95 => _95.limit]),order_by:_optionalChain([r, 'optionalAccess', _96 => _96.orderBy])}};return(await f({aptosConfig:e,query:s,originMethod:"getAccountOwnedObjects"})).current_objects}async function Ri(n){let{aptosConfig:e,privateKey:t}=n,r=new D(t.publicKey());if(t instanceof nt){let i=q.fromPublicKey({publicKey:r}).derivedAddress();return Le.fromPrivateKey({privateKey:t,address:i})}if(t instanceof L){let o=q.fromPublicKey({publicKey:r});if(await Ti({authKey:o,aptosConfig:e})){let c=o.derivedAddress();return Le.fromPrivateKey({privateKey:t,address:c,legacy:!1})}let s=q.fromPublicKey({publicKey:r.publicKey});if(await Ti({authKey:s,aptosConfig:e})){let c=s.derivedAddress();return Le.fromPrivateKey({privateKey:t,address:c,legacy:!0})}}throw new Error(`Can't derive account from private key ${t}`)}async function Ti(n){let{aptosConfig:e,authKey:t}=n,r=await rn({aptosConfig:e,authenticationKey:t.derivedAddress()});try{return await Se({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 Qr(n){let{aptosConfig:e,options:t}=n;return bt({aptosConfig:e,originMethod:"getTransactions",path:"transactions",params:{start:_optionalChain([t, 'optionalAccess', _97 => _97.offset]),limit:_optionalChain([t, 'optionalAccess', _98 => _98.limit])}})}async function Yn(n){let{aptosConfig:e}=n;return Fe(async()=>{let{data:t}=await V({aptosConfig:e,originMethod:"getGasPriceEstimation",path:"estimate_gas_price"});return t},`gas-price-${e.network}`,1e3*60*5)()}async function zi(n){let{aptosConfig:e,ledgerVersion:t}=n,{data:r}=await V({aptosConfig:e,originMethod:"getTransactionByVersion",path:`transactions/by_version/${t}`});return r}async function on(n){let{aptosConfig:e,transactionHash:t}=n,{data:r}=await V({aptosConfig:e,path:`transactions/by_hash/${t}`,originMethod:"getTransactionByHash"});return r}async function ki(n){let{aptosConfig:e,transactionHash:t}=n;try{return(await on({aptosConfig:e,transactionHash:t})).type==="pending_transaction"}catch(r){if(_optionalChain([r, 'optionalAccess', _99 => _99.status])===404)return!0;throw r}}async function cc(n){let{aptosConfig:e,transactionHash:t}=n,{data:r}=await V({aptosConfig:e,path:`transactions/wait_by_hash/${t}`,originMethod:"longWaitForTransaction"});return r}async function Kt(n){let{aptosConfig:e,transactionHash:t,options:r}=n,o=_nullishCoalesce(_optionalChain([r, 'optionalAccess', _100 => _100.timeoutSecs]), () => (20)),i=_nullishCoalesce(_optionalChain([r, 'optionalAccess', _101 => _101.checkSuccess]), () => (!0)),s=!0,a=0,c,p,y=200,w=1.5;function S(g){if(!(g instanceof ye)||(p=g,g.status!==404&&g.status>=400&&g.status<500))throw g}try{c=await on({aptosConfig:e,transactionHash:t}),s=c.type==="pending_transaction"}catch(g){S(g)}if(s){let g=Date.now();try{c=await cc({aptosConfig:e,transactionHash:t}),s=c.type==="pending_transaction"}catch(E){S(E)}a=(Date.now()-g)/1e3}for(;s&&!(a>=o);){try{if(c=await on({aptosConfig:e,transactionHash:t}),s=c.type==="pending_transaction",!s)break}catch(g){S(g)}await _chunkJ4IUXT5Wjs.b.call(void 0, y),a+=y/1e3,y*=w}if(c===void 0)throw p||new Xn(`Fetching transaction ${t} failed and timed out after ${o} seconds`,c);if(c.type==="pending_transaction")throw new Xn(`Transaction ${t} timed out in pending state after ${o} seconds`,c);if(!i)return c;if(!c.success)throw new Hr(`Transaction ${t} failed with an error: ${c.vm_status}`,c);return c}async function Zn(n){let{aptosConfig:e,processorType:t}=n,r=BigInt(n.minimumLedgerVersion),o=3e3,i=new Date().getTime(),s=BigInt(-1);for(;s<r;){if(new Date().getTime()-i>o)throw new Error("waitForLastSuccessIndexerVersionSync timeout");if(t===void 0?s=await Hn({aptosConfig:e}):s=(await Qn({aptosConfig:e,processorType:t})).last_success_version,s>=r)break;await _chunkJ4IUXT5Wjs.b.call(void 0, 200)}}var Xn=class extends Error{constructor(e,t){super(e),this.lastSubmittedTransaction=t}},Hr=class extends Error{constructor(e,t){super(e),this.transaction=t}};async function Di(n){let{aptosConfig:e,ledgerVersion:t,options:r}=n,{data:o}=await V({aptosConfig:e,originMethod:"getBlockByVersion",path:`blocks/by_version/${t}`,params:{with_transactions:_optionalChain([r, 'optionalAccess', _102 => _102.withTransactions])}});return Gi({block:o,...n})}async function Bi(n){let{aptosConfig:e,blockHeight:t,options:r}=n,{data:o}=await V({aptosConfig:e,originMethod:"getBlockByHeight",path:`blocks/by_height/${t}`,params:{with_transactions:_optionalChain([r, 'optionalAccess', _103 => _103.withTransactions])}});return Gi({block:o,...n})}async function Gi(n){let{aptosConfig:e,block:t,options:r}=n;if(_optionalChain([r, 'optionalAccess', _104 => _104.withTransactions])){t.transactions=_nullishCoalesce(t.transactions, () => ([]));let o=t.transactions[t.transactions.length-1],i=BigInt(t.first_version),s=BigInt(t.last_version),a=_optionalChain([o, 'optionalAccess', _105 => _105.version]),c;if(a===void 0?c=i-1n:c=BigInt(a),c===s)return t;let p=[],y=100n;for(let S=c+1n;S<s;S+=BigInt(100))p.push(Qr({aptosConfig:e,options:{offset:S,limit:Math.min(Number(y),Number(s-S+1n))}}));let w=await Promise.all(p);for(let S of w)t.transactions.push(...S)}return t}async function A(n){n.minimumLedgerVersion!==void 0&&await Zn({aptosConfig:n.config,minimumLedgerVersion:n.minimumLedgerVersion,processorType:n.processorType})}var sn=class{constructor(e){this.config=e}async getAccountInfo(e){return Se({aptosConfig:this.config,...e})}async getAccountModules(e){return bi({aptosConfig:this.config,...e})}async getAccountModule(e){return jn({aptosConfig:this.config,...e})}async getAccountTransactions(e){return wi({aptosConfig:this.config,...e})}async getAccountResources(e){return Si({aptosConfig:this.config,...e})}async getAccountResource(e){return $r({aptosConfig:this.config,...e})}async lookupOriginalAccountAddress(e){return rn({aptosConfig:this.config,...e})}async getAccountTokensCount(e){return await A({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"account_transactions_processor"}),_i({aptosConfig:this.config,...e})}async getAccountOwnedTokens(e){return await A({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),xi({aptosConfig:this.config,...e})}async getAccountOwnedTokensFromCollectionAddress(e){return await A({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),Pi({aptosConfig:this.config,...e})}async getAccountCollectionsWithOwnedTokens(e){return await A({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),vi({aptosConfig:this.config,...e})}async getAccountTransactionsCount(e){return await A({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"account_transactions_processor"}),Ci({aptosConfig:this.config,...e})}async getAccountCoinsData(e){return await A({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"fungible_asset_processor"}),Lr({aptosConfig:this.config,...e})}async getAccountCoinsCount(e){return await A({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"fungible_asset_processor"}),Ii({aptosConfig:this.config,...e})}async getAccountAPTAmount(e){return this.getAccountCoinAmount({coinType:ot,...e})}async getAccountCoinAmount(e){return await A({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"fungible_asset_processor"}),Ei({aptosConfig:this.config,...e})}async getAccountOwnedObjects(e){return await A({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"default_processor"}),Ui({aptosConfig:this.config,...e})}async deriveAccountFromPrivateKey(e){return Ri({aptosConfig:this.config,...e})}};var _aptosclient = require('@aptos-labs/aptos-client'); var _aptosclient2 = _interopRequireDefault(_aptosclient);var Jn=class{constructor(e){this.network=_nullishCoalesce(_optionalChain([e, 'optionalAccess', _106 => _106.network]), () => ("devnet")),this.fullnode=_optionalChain([e, 'optionalAccess', _107 => _107.fullnode]),this.faucet=_optionalChain([e, 'optionalAccess', _108 => _108.faucet]),this.pepper=_optionalChain([e, 'optionalAccess', _109 => _109.pepper]),this.prover=_optionalChain([e, 'optionalAccess', _110 => _110.prover]),this.indexer=_optionalChain([e, 'optionalAccess', _111 => _111.indexer]),this.client=_nullishCoalesce(_optionalChain([e, 'optionalAccess', _112 => _112.client]), () => ({provider:_aptosclient2.default})),this.clientConfig=_nullishCoalesce(_optionalChain([e, 'optionalAccess', _113 => _113.clientConfig]), () => ({})),this.fullnodeConfig=_nullishCoalesce(_optionalChain([e, 'optionalAccess', _114 => _114.fullnodeConfig]), () => ({})),this.indexerConfig=_nullishCoalesce(_optionalChain([e, 'optionalAccess', _115 => _115.indexerConfig]), () => ({})),this.faucetConfig=_nullishCoalesce(_optionalChain([e, 'optionalAccess', _116 => _116.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 Mo[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 qo[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 Fo[this.network];case"Pepper":if(this.pepper!==void 0)return this.pepper;if(this.network==="custom")throw new Error("Please provide a custom pepper service url");return Ir[this.network];case"Prover":if(this.prover!==void 0)return this.prover;if(this.network==="custom")throw new Error("Please provide a custom prover service url");return Ur[this.network];default:throw Error(`apiType ${e} is not supported`)}}isPepperServiceRequest(e){return Ir[this.network]===e}isProverServiceRequest(e){return Ur[this.network]===e}};function Ki(n){return!!n.match(/^[_a-zA-Z0-9]+$/)}function Ni(n){return!!n.match(/\s/)}function pc(n){return!!n.match(/^T[0-9]+$/)}function dc(n){return!!n.match(/^&.+$/)}function lc(n){switch(n){case"signer":case"address":case"bool":case"u8":case"u16":case"u32":case"u64":case"u128":case"u256":return!0;default:return!1}}function gc(n,e){let t=e;for(;t<n.length;t+=1){let r=n[t];if(!Ni(r))break}return t}var mc=(E=>(E.InvalidTypeTag="unknown type",E.UnexpectedGenericType="unexpected generic type",E.UnexpectedTypeArgumentClose="unexpected '>'",E.UnexpectedWhitespaceCharacter="unexpected whitespace character",E.UnexpectedComma="unexpected ','",E.TypeArgumentCountMismatch="type argument count doesn't match expected amount",E.MissingTypeArgumentClose="no matching '>' for '<'",E.MissingTypeArgument="no type argument before ','",E.UnexpectedPrimitiveTypeArguments="primitive types not expected to have type arguments",E.UnexpectedVectorTypeArgumentCount="vector type expected to have exactly one type argument",E.UnexpectedStructFormat="unexpected struct format, must be of the form 0xaddress::module_name::struct_name",E.InvalidModuleNameCharacter="module name must only contain alphanumeric or '_' characters",E.InvalidStructNameCharacter="struct name must only contain alphanumeric or '_' characters",E.InvalidAddress="struct address must be valid",E))(mc||{}),N= exports.TypeTagParserError =class extends Error{constructor(e,t){super(`Failed to parse typeTag '${e}', ${t}`)}};function ze(n,e){let t=_nullishCoalesce(_optionalChain([e, 'optionalAccess', _117 => _117.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 E=an(a,o,t);i.push(E)}let y=r.pop();if(y===void 0)throw new N(n,"unexpected '>'");if(c!==i.length)throw new N(n,"type argument count doesn't match expected amount");let{savedStr:w,savedTypes:S,savedExpectedTypes:g}=y;o=i,i=S,a=w,c=g}else if(p===","){if(r.length===0)throw new N(n,"unexpected ','");if(a.length===0)throw new N(n,"no type argument before ','");let y=an(a,o,t);o=[],i.push(y),a="",c+=1}else if(Ni(p)){let y=!1;if(a.length!==0){let S=an(a,o,t);o=[],i.push(S),a="",y=!0}s=gc(n,s);let w=n[s];if(s<n.length&&y&&w!==","&&w!==">")throw new N(n,"unexpected whitespace character");continue}else a+=p;s+=1}if(r.length>0)throw new N(n,"no matching '>' for '<'");switch(i.length){case 0:return an(a,o,t);case 1:if(a==="")return i[0];throw new N(n,"unexpected ','");default:throw new N(n,"unexpected whitespace character")}}function an(n,e,t){let r=n.trim(),o=r.toLowerCase();if(lc(o)&&e.length>0)throw new N(n,"primitive types not expected to have type arguments");switch(r.toLowerCase()){case"signer":return new vt;case"bool":return new K;case"address":return new W;case"u8":return new ce;case"u16":return new Me;case"u32":return new qe;case"u64":return new $;case"u128":return new Ve;case"u256":return new $e;case"vector":if(e.length!==1)throw new N(n,"vector type expected to have exactly one type argument");return new C(e[0]);default:if(dc(r)){let a=r.substring(1);return new Kn(an(a,e,t))}if(pc(r)){if(t)return new k(Number(r.split("T")[1]));throw new N(n,"unexpected generic type")}if(!r.match(/:/))throw new N(n,"unknown type");let i=r.split("::");if(i.length!==3)throw new N(n,"unexpected struct format, must be of the form 0xaddress::module_name::struct_name");let s;try{s=u.fromString(i[0])}catch (e2){throw new N(n,"struct address must be valid")}if(!Ki(i[1]))throw new N(n,"module name must only contain alphanumeric or '_' characters");if(!Ki(i[2]))throw new N(n,"struct name must only contain alphanumeric or '_' characters");return new m(new Ue(s,new R(i[1]),new R(i[2]),e))}}function Oi(n){return typeof n=="boolean"}function Qe(n){return typeof n=="string"}function yc(n){return typeof n=="number"}function er(n){if(yc(n))return n;if(Qe(n)&&n!=="")return Number.parseInt(n,10)}function tr(n){return typeof n=="number"||typeof n=="bigint"||typeof n=="string"}function Fi(n){return n==null}function Mi(n){return Wr(n)||Xr(n)||Yr(n)||Zr(n)||Jr(n)||eo(n)||to(n)||nr(n)||jr(n)||fc(n)||n instanceof T||n instanceof M}function Wr(n){return n instanceof I}function nr(n){return n instanceof u}function jr(n){return n instanceof b}function fc(n){return n instanceof Je}function Xr(n){return n instanceof F}function Yr(n){return n instanceof de}function Zr(n){return n instanceof le}function Jr(n){return n instanceof O}function eo(n){return n instanceof ge}function to(n){return n instanceof me}function qi(n){return"bytecode"in n}function U(n,e){throw new Error(`Type mismatch for argument ${e}, expected '${n}'`)}function Vi(n){let e=n.params.findIndex(t=>t!=="signer"&&t!=="&signer");return e<0?n.params.length:e}function cn(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 Ac=new TextEncoder;function rr(n){return _nullishCoalesce(_optionalChain([n, 'optionalAccess', _118 => _118.map, 'call', _119 => _119(e=>Qe(e)?ze(e):e)]), () => ([]))}async function $i(n,e,t,r){let o=await jn({aptosConfig:r,accountAddress:n,moduleName:e});if(o.abi)return o.abi.exposed_functions.find(i=>i.name===t)}async function Li(n,e,t,r){let o=await $i(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=Vi(o),s=[];for(let a=i;a<o.params.length;a+=1)s.push(ze(o.params[a],{allowGenerics:!0}));return{signers:i,typeParameters:o.generic_type_params,parameters:s}}async function Hi(n,e,t,r){let o=await $i(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(ze(o.params[a],{allowGenerics:!0}));let s=[];for(let a=0;a<o.return.length;a+=1)s.push(ze(o.return[a],{allowGenerics:!0}));return{typeParameters:o.generic_type_params,parameters:i,returnTypes:s}}function ro(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 Nt(t,i,r,o)}function Nt(n,e,t,r){return Mi(n)?(no(e,n,t),n):hc(n,e,t,r)}function hc(n,e,t,r){if(e.isBool()){if(Oi(n))return new I(n);if(Qe(n)){if(n==="true")return new I(!0);if(n==="false")return new I(!1)}U("boolean",t)}if(e.isAddress()){if(Qe(n))return u.fromString(n);U("string | AccountAddress",t)}if(e.isU8()){let o=er(n);if(o!==void 0)return new F(o);U("number | string",t)}if(e.isU16()){let o=er(n);if(o!==void 0)return new de(o);U("number | string",t)}if(e.isU32()){let o=er(n);if(o!==void 0)return new le(o);U("number | string",t)}if(e.isU64()){if(tr(n))return new O(BigInt(n));U("bigint | number | string",t)}if(e.isU128()){if(tr(n))return new ge(BigInt(n));U("bigint | number | string",t)}if(e.isU256()){if(tr(n))return new me(BigInt(n));U("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 Nt(n,r[o],t,r)}if(e.isVector()){if(e.value.isU8()){if(Qe(n))return T.U8(Ac.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=>Nt(o,e.value,t,r)));throw new Error(`Type mismatch for argument ${t}, type '${e.toString()}'`)}if(e.isStruct()){if(e.isString()){if(Qe(n))return new b(n);U("string",t)}if(e.isObject()){if(Qe(n))return u.fromString(n);U("string | AccountAddress",t)}if(e.isOption()){if(Fi(n)){let o=e.value.typeArgs[0];return o instanceof K?new M(null):o instanceof W?new M(null):o instanceof ce?new M(null):o instanceof Me?new M(null):o instanceof qe?new M(null):o instanceof $?new M(null):o instanceof Ve?new M(null):o instanceof $e?new M(null):new M(null)}return new M(Nt(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 no(n,e,t){if(n.isBool()){if(Wr(e))return;U("Bool",t)}if(n.isAddress()){if(nr(e))return;U("AccountAddress",t)}if(n.isU8()){if(Xr(e))return;U("U8",t)}if(n.isU16()){if(Yr(e))return;U("U16",t)}if(n.isU32()){if(Zr(e))return;U("U32",t)}if(n.isU64()){if(Jr(e))return;U("U64",t)}if(n.isU128()){if(eo(e))return;U("U128",t)}if(n.isU256()){if(to(e))return;U("U256",t)}if(n.isVector()){if(e instanceof T){e.values.length>0&&no(n.value,e.values[0],t);return}U("MoveVector",t)}if(n instanceof m){if(n.isString()){if(jr(e))return;U("MoveString",t)}if(n.isObject()){if(nr(e))return;U("AccountAddress",t)}if(n.isOption()){if(e instanceof M){e.value!==void 0&&no(n.value.typeArgs[0],e.value,t);return}U("MoveOption",t)}}throw new Error(`Type mismatch for argument ${t}, expected '${n.toString()}'`)}async function ir(n){if(qi(n))return Sc(n);let{moduleAddress:e,moduleName:t,functionName:r}=cn(n.function),o=await Xi({key:"entry-function",moduleAddress:e,moduleName:t,functionName:r,aptosConfig:n.aptosConfig,abi:n.abi,fetch:Li});return bc({...n,abi:o})}function bc(n){let e=n.abi,{moduleAddress:t,moduleName:r,functionName:o}=cn(n.function),i=rr(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)=>ro(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=ut.build(`${t}::${r}`,o,i,s);if("multisigAddress"in n){let c=u.from(n.multisigAddress);return new Zt(new en(c,new tn(a)))}return new Yt(a)}async function Qi(n){let{moduleAddress:e,moduleName:t,functionName:r}=cn(n.function),o=await Xi({key:"view-function",moduleAddress:e,moduleName:t,functionName:r,aptosConfig:n.aptosConfig,abi:n.abi,fetch:Hi});return wc({abi:o,...n})}function wc(n){let e=n.abi,{moduleAddress:t,moduleName:r,functionName:o}=cn(n.function),i=rr(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', _120 => _120.functionArguments, 'optionalAccess', _121 => _121.map, 'call', _122 => _122((a,c)=>ro(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 ut.build(`${t}::${r}`,o,i,s)}function Sc(n){return new Xt(new Jt(l.fromHexInput(n.bytecode).toUint8Array(),rr(n.typeArguments),n.functionArguments))}async function _c(n){let{aptosConfig:e,sender:t,payload:r,options:o,feePayerAddress:i}=n,s=async()=>zr[e.network]?{chainId:zr[e.network]}:{chainId:(await Ln({aptosConfig:e})).chain_id},a=async()=>_optionalChain([o, 'optionalAccess', _123 => _123.gasUnitPrice])?{gasEstimate:o.gasUnitPrice}:{gasEstimate:(await Yn({aptosConfig:e})).gas_estimate},c=async()=>{let gt=async()=>_optionalChain([o, 'optionalAccess', _124 => _124.accountSequenceNumber])!==void 0?o.accountSequenceNumber:(await Se({aptosConfig:e,accountAddress:t})).sequence_number;if(i&&u.from(i).equals(u.ZERO))try{return await gt()}catch (e3){return 0}else return gt()},[{chainId:p},{gasEstimate:y},w]=await Promise.all([s(),a(),c()]),{maxGasAmount:S,gasUnitPrice:g,expireTimestamp:E}={maxGasAmount:_optionalChain([o, 'optionalAccess', _125 => _125.maxGasAmount])?BigInt(o.maxGasAmount):BigInt(2e5),gasUnitPrice:_nullishCoalesce(_optionalChain([o, 'optionalAccess', _126 => _126.gasUnitPrice]), () => (BigInt(y))),expireTimestamp:_nullishCoalesce(_optionalChain([o, 'optionalAccess', _127 => _127.expireTimestamp]), () => (BigInt(Math.floor(Date.now()/1e3)+20)))};return new ue(u.from(t),BigInt(w),r,BigInt(S),BigInt(g),BigInt(E),new Pt(p))}async function oo(n){let{aptosConfig:e,sender:t,payload:r,options:o,feePayerAddress:i}=n,s=await _c({aptosConfig:e,sender:t,payload:r,options:o,feePayerAddress:i});if("secondarySignerAddresses"in n){let a=_nullishCoalesce(_optionalChain([n, 'access', _128 => _128.secondarySignerAddresses, 'optionalAccess', _129 => _129.map, 'call', _130 => _130(c=>u.from(c))]), () => ([]));return new Mn(s,a,n.feePayerAddress?u.from(n.feePayerAddress):void 0)}return new Fn(s,n.feePayerAddress?u.from(n.feePayerAddress):void 0)}function Wi(n){let{signerPublicKey:e,transaction:t,secondarySignersPublicKeys:r,feePayerPublicKey:o}=n,i=or(e);if(t.feePayerAddress){let a=new dt(t.rawTransaction,_nullishCoalesce(t.secondarySignerAddresses, () => ([])),t.feePayerAddress),c=[];r&&(c=r.map(w=>or(w)));let p=or(o),y=new It(i,_nullishCoalesce(t.secondarySignerAddresses, () => ([])),c,{address:t.feePayerAddress,authenticator:p});return new lt(a.raw_txn,y).bcsToBytes()}if(t.secondarySignerAddresses){let a=new pt(t.rawTransaction,t.secondarySignerAddresses),c=[];c=r.map(y=>or(y));let p=new Et(i,t.secondarySignerAddresses,c);return new lt(a.raw_txn,p).bcsToBytes()}let s;if(i instanceof fe)s=new Ct(i.public_key,i.signature);else if(i instanceof Q)s=new Ut(i);else throw new Error("Invalid public key");return new lt(t.rawTransaction,s).bcsToBytes()}function or(n){let e=new v(new Uint8Array(64));if(x.isInstance(n))return new fe(n,e);if(D.isInstance(n))return ee.isInstance(n.publicKey)?new Q(n,new G(Ee.getSimulationSignature())):new Q(n,new G(e));if(ee.isInstance(n)||Pe.isInstance(n))return console.warn("Expected AccountPublicKey, but got PublicKey. Please wrap your public key with AnyPublicKey."),new Q(new D(n),new G(e));throw new Error("Unsupported public key")}function io(n){let{transaction:e,feePayerAuthenticator:t,additionalSignersAuthenticators:r}=n,o=Vo(H,n.senderAuthenticator),i;if(e.feePayerAddress){if(!t)throw new Error("Must provide a feePayerAuthenticator argument to generate a signed fee payer transaction");i=new It(o,_nullishCoalesce(e.secondarySignerAddresses, () => ([])),_nullishCoalesce(r, () => ([])),{address:e.feePayerAddress,authenticator:t})}else if(e.secondarySignerAddresses){if(!r)throw new Error("Must provide a additionalSignersAuthenticators argument to generate a signed multi agent transaction");i=new Et(o,e.secondarySignerAddresses,r)}else o instanceof fe?i=new Ct(o.public_key,o.signature):i=new Ut(o);return new lt(e.rawTransaction,i).bcsToBytes()}function ji(n){let e=_sha3.sha3_256.create();for(let t of n)e.update(t);return e.digest()}var xc=ji(["APTOS::Transaction"]);function ih(n){let e=io(n);return new l(ji([xc,new Uint8Array([0]),e])).toString()}async function Xi({key:n,moduleAddress:e,moduleName:t,functionName:r,aptosConfig:o,abi:i,fetch:s}){return i!==void 0?i:Fe(async()=>s(e,t,r,o),`${n}-${o.network}-${e}-${t}-${r}`,1e3*60*5)()}async function h(n){let e=await Pc(n);return vc(n,e)}async function Pc(n){let{aptosConfig:e,data:t}=n,r,o;return"bytecode"in t?o=await ir(t):"multisigAddress"in t?(r={aptosConfig:e,multisigAddress:t.multisigAddress,function:t.function,functionArguments:t.functionArguments,typeArguments:t.typeArguments,abi:t.abi},o=await ir(r)):(r={aptosConfig:e,function:t.function,functionArguments:t.functionArguments,typeArguments:t.typeArguments,abi:t.abi},o=await ir(r)),o}async function vc(n,e){let{aptosConfig:t,sender:r,options:o}=n,i;if(Cc(n)&&(i=u.ZERO.toString()),Ec(n)){let{secondarySignerAddresses:s}=n;return oo({aptosConfig:t,sender:r,payload:e,options:o,secondarySignerAddresses:s,feePayerAddress:i})}return oo({aptosConfig:t,sender:r,payload:e,options:o,feePayerAddress:i})}function Cc(n){return n.withFeePayer===!0}function Ec(n){return"secondarySignerAddresses"in n}function Yi(n){let{transaction:e}=n;return zt(e)}function sr(n){let{signer:e,transaction:t}=n;return e.signTransactionWithAuthenticator(t)}async function so(n){let{aptosConfig:e,transaction:t,signerPublicKey:r,secondarySignersPublicKeys:o,feePayerPublicKey:i,options:s}=n,a=Wi({transaction:t,signerPublicKey:r,secondarySignersPublicKeys:o,feePayerPublicKey:i,options:s}),{data:c}=await Oe({aptosConfig:e,body:a,path:"transactions/simulate",params:{estimate_gas_unit_price:_nullishCoalesce(_optionalChain([n, 'access', _131 => _131.options, 'optionalAccess', _132 => _132.estimateGasUnitPrice]), () => (!1)),estimate_max_gas_amount:_nullishCoalesce(_optionalChain([n, 'access', _133 => _133.options, 'optionalAccess', _134 => _134.estimateMaxGasAmount]), () => (!1)),estimate_prioritized_gas_unit_price:_nullishCoalesce(_optionalChain([n, 'access', _135 => _135.options, 'optionalAccess', _136 => _136.estimatePrioritizedGasUnitPrice]), () => (!1))},originMethod:"simulateTransaction",contentType:"application/x.aptos.signed_transaction+bcs"});return c}async function ar(n){let{aptosConfig:e}=n,t=io({...n}),{data:r}=await Oe({aptosConfig:e,body:t,path:"transactions",originMethod:"submitTransaction",contentType:"application/x.aptos.signed_transaction+bcs"});return r}async function un(n){let{aptosConfig:e,signer:t,transaction:r}=n;(t instanceof we||t instanceof qn)&&await t.waitForProofFetch();let o=sr({signer:t,transaction:r});return ar({aptosConfig:e,transaction:r,senderAuthenticator:o})}var Ic={typeParameters:[],parameters:[C.u8(),new C(C.u8())]};async function Zi(n){let{aptosConfig:e,account:t,metadataBytes:r,moduleBytecode:o,options:i}=n,s=o.map(a=>T.U8(a));return h({aptosConfig:e,sender:u.from(t),data:{function:"0x1::code::publish_package_txn",functionArguments:[T.U8(r),new T(s)],abi:Ic},options:i})}var Uc={typeParameters:[],parameters:[new ce,C.u8(),new ce,C.u8(),C.u8(),C.u8()]};async function Ji(n){let{aptosConfig:e,fromAccount:t,toNewPrivateKey:r}=n,o=await Se({aptosConfig:e,accountAddress:t.accountAddress}),i=Le.fromPrivateKey({privateKey:r,legacy:!0}),a=new On({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),y=await h({aptosConfig:e,sender:t.accountAddress,data:{function:"0x1::account::rotate_authentication_key",functionArguments:[new F(t.signingScheme),T.U8(t.publicKey.toUint8Array()),new F(i.signingScheme),T.U8(i.publicKey.toUint8Array()),T.U8(c.toUint8Array()),T.U8(p.toUint8Array())],abi:Uc}});return un({aptosConfig:e,signer:t,transaction:y})}var Rc={typeParameters:[{constraints:[]}],parameters:[new W,new $]};async function es(n){let{aptosConfig:e,sender:t,recipient:r,amount:o,coinType:i,options:s}=n;return h({aptosConfig:e,sender:t,data:{function:"0x1::aptos_account::transfer_coins",typeArguments:[_nullishCoalesce(i, () => (ot))],functionArguments:[r,o],abi:Rc},options:s})}var pn=class{constructor(e){this.config=e}async transferCoinTransaction(e){return es({aptosConfig:this.config,...e})}};var We={BOOLEAN:"bool",U8:"u8",U16:"u16",U32:"u32",U64:"u64",U128:"u128",U256:"u256",ADDRESS:"address",STRING:"0x1::string::String",ARRAY:"vector<u8>"},pe="0x4::token::Token";async function ts(n){let{aptosConfig:e,digitalAssetAddress:t}=n,r={token_data_id:{_eq:u.from(t).toStringLong()}};return(await f({aptosConfig:e,query:{query:mi,variables:{where_condition:r}},originMethod:"getDigitalAssetData"})).current_token_datas_v2[0]}async function ns(n){let{aptosConfig:e,digitalAssetAddress:t}=n,r={token_data_id:{_eq:u.from(t).toStringLong()},amount:{_gt:0}};return(await f({aptosConfig:e,query:{query:Vr,variables:{where_condition:r}},originMethod:"getCurrentDigitalAssetOwnership"})).current_token_ownerships_v2[0]}async function rs(n){let{aptosConfig:e,ownerAddress:t,options:r}=n,o={owner_address:{_eq:u.from(t).toStringLong()},amount:{_gt:0}},i={query:Vr,variables:{where_condition:o,offset:_optionalChain([r, 'optionalAccess', _137 => _137.offset]),limit:_optionalChain([r, 'optionalAccess', _138 => _138.limit]),order_by:_optionalChain([r, 'optionalAccess', _139 => _139.orderBy])}};return(await f({aptosConfig:e,query:i,originMethod:"getOwnedDigitalAssets"})).current_token_ownerships_v2}async function os(n){let{aptosConfig:e,digitalAssetAddress:t,options:r}=n,o={token_data_id:{_eq:u.from(t).toStringLong()}},i={query:gi,variables:{where_condition:o,offset:_optionalChain([r, 'optionalAccess', _140 => _140.offset]),limit:_optionalChain([r, 'optionalAccess', _141 => _141.limit]),order_by:_optionalChain([r, 'optionalAccess', _142 => _142.orderBy])}};return(await f({aptosConfig:e,query:i,originMethod:"getDigitalAssetActivity"})).token_activities_v2}var zc={typeParameters:[],parameters:[new m(P()),new $,new m(P()),new m(P()),new K,new K,new K,new K,new K,new K,new K,new K,new K,new $,new $]};async function is(n){let{aptosConfig:e,options:t,creator:r}=n;return h({aptosConfig:e,sender:r.accountAddress,data:{function:"0x4::aptos_token::create_collection",functionArguments:[new b(n.description),new O(_nullishCoalesce(n.maxSupply, () => (Ye))),new b(n.name),new b(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 O(_nullishCoalesce(n.royaltyNumerator, () => (0))),new O(_nullishCoalesce(n.royaltyDenominator, () => (1)))],abi:zc},options:t})}async function Ot(n){let{aptosConfig:e,options:t}=n,r=_optionalChain([t, 'optionalAccess', _143 => _143.where]);_optionalChain([t, 'optionalAccess', _144 => _144.tokenStandard])&&(r.token_standard={_eq:_nullishCoalesce(_optionalChain([t, 'optionalAccess', _145 => _145.tokenStandard]), () => ("v2"))});let o={query:ii,variables:{where_condition:r,offset:_optionalChain([t, 'optionalAccess', _146 => _146.offset]),limit:_optionalChain([t, 'optionalAccess', _147 => _147.limit])}};return(await f({aptosConfig:e,query:o,originMethod:"getCollectionData"})).current_collections_v2[0]}async function ss(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', _148 => _148.tokenStandard])&&(s.token_standard={_eq:_nullishCoalesce(_optionalChain([o, 'optionalAccess', _149 => _149.tokenStandard]), () => ("v2"))}),Ot({aptosConfig:e,options:{...o,where:s}})}async function as(n){let{aptosConfig:e,creatorAddress:t,options:r}=n,i={creator_address:{_eq:u.from(t).toStringLong()}};return _optionalChain([r, 'optionalAccess', _150 => _150.tokenStandard])&&(i.token_standard={_eq:_nullishCoalesce(_optionalChain([r, 'optionalAccess', _151 => _151.tokenStandard]), () => ("v2"))}),Ot({aptosConfig:e,options:{...r,where:i}})}async function cs(n){let{aptosConfig:e,collectionId:t,options:r}=n,i={collection_id:{_eq:u.from(t).toStringLong()}};return _optionalChain([r, 'optionalAccess', _152 => _152.tokenStandard])&&(i.token_standard={_eq:_nullishCoalesce(_optionalChain([r, 'optionalAccess', _153 => _153.tokenStandard]), () => ("v2"))}),Ot({aptosConfig:e,options:{...r,where:i}})}async function us(n){let{creatorAddress:e,collectionName:t,options:r,aptosConfig:o}=n,i=u.from(e),s={collection_name:{_eq:t},creator_address:{_eq:i.toStringLong()}};return _optionalChain([r, 'optionalAccess', _154 => _154.tokenStandard])&&(s.token_standard={_eq:_nullishCoalesce(_optionalChain([r, 'optionalAccess', _155 => _155.tokenStandard]), () => ("v2"))}),(await Ot({aptosConfig:o,options:{where:s}})).collection_id}var kc={typeParameters:[],parameters:[new m(P()),new m(P()),new m(P()),new m(P()),new C(new m(P())),new C(new m(P())),new C(C.u8())]};async function ps(n){let{aptosConfig:e,options:t,creator:r,collection:o,description:i,name:s,uri:a,propertyKeys:c,propertyTypes:p,propertyValues:y}=n,w=_optionalChain([p, 'optionalAccess', _156 => _156.map, 'call', _157 => _157(S=>We[S])]);return h({aptosConfig:e,sender:r.accountAddress,data:{function:"0x4::aptos_token::mint",functionArguments:[new b(o),new b(i),new b(s),new b(a),T.MoveString(_nullishCoalesce(c, () => ([]))),T.MoveString(_nullishCoalesce(w, () => ([]))),xs(_nullishCoalesce(y, () => ([])),_nullishCoalesce(w, () => ([])))],abi:kc},options:t})}var Dc={typeParameters:[{constraints:["key"]}],parameters:[new m(ne(new k(0))),new W]};async function ds(n){let{aptosConfig:e,sender:t,digitalAssetAddress:r,recipient:o,digitalAssetType:i,options:s}=n;return h({aptosConfig:e,sender:t.accountAddress,data:{function:"0x1::object::transfer",typeArguments:[_nullishCoalesce(i, () => (pe))],functionArguments:[u.from(r),u.from(o)],abi:Dc},options:s})}var Bc={typeParameters:[],parameters:[new m(P()),new m(P()),new m(P()),new m(P()),new C(new m(P())),new C(new m(P())),new C(C.u8()),new W]};async function ls(n){let{aptosConfig:e,account:t,collection:r,description:o,name:i,uri:s,recipient:a,propertyKeys:c,propertyTypes:p,propertyValues:y,options:w}=n;if(_optionalChain([c, 'optionalAccess', _158 => _158.length])!==_optionalChain([y, 'optionalAccess', _159 => _159.length]))throw new Error("Property keys and property values counts do not match");if(_optionalChain([p, 'optionalAccess', _160 => _160.length])!==_optionalChain([y, 'optionalAccess', _161 => _161.length]))throw new Error("Property types and property values counts do not match");let S=_optionalChain([p, 'optionalAccess', _162 => _162.map, 'call', _163 => _163(g=>We[g])]);return h({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(S, () => ([]))),xs(_nullishCoalesce(y, () => ([])),_nullishCoalesce(S, () => ([]))),a],abi:Bc},options:w})}var Gc={typeParameters:[{constraints:["key"]}],parameters:[new m(ne(new k(0)))]};async function gs(n){let{aptosConfig:e,creator:t,digitalAssetAddress:r,digitalAssetType:o,options:i}=n;return h({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::burn",typeArguments:[_nullishCoalesce(o, () => (pe))],functionArguments:[u.from(r)],abi:Gc},options:i})}var Kc={typeParameters:[{constraints:["key"]}],parameters:[new m(ne(new k(0)))]};async function ms(n){let{aptosConfig:e,creator:t,digitalAssetAddress:r,digitalAssetType:o,options:i}=n;return h({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::freeze_transfer",typeArguments:[_nullishCoalesce(o, () => (pe))],functionArguments:[r],abi:Kc},options:i})}var Nc={typeParameters:[{constraints:["key"]}],parameters:[new m(ne(new k(0)))]};async function ys(n){let{aptosConfig:e,creator:t,digitalAssetAddress:r,digitalAssetType:o,options:i}=n;return h({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::unfreeze_transfer",typeArguments:[_nullishCoalesce(o, () => (pe))],functionArguments:[r],abi:Nc},options:i})}var Oc={typeParameters:[{constraints:["key"]}],parameters:[new m(ne(new k(0))),new m(P())]};async function fs(n){let{aptosConfig:e,creator:t,description:r,digitalAssetAddress:o,digitalAssetType:i,options:s}=n;return h({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::set_description",typeArguments:[_nullishCoalesce(i, () => (pe))],functionArguments:[u.from(o),new b(r)],abi:Oc},options:s})}var Fc={typeParameters:[{constraints:["key"]}],parameters:[new m(ne(new k(0))),new m(P())]};async function As(n){let{aptosConfig:e,creator:t,name:r,digitalAssetAddress:o,digitalAssetType:i,options:s}=n;return h({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::set_name",typeArguments:[_nullishCoalesce(i, () => (pe))],functionArguments:[u.from(o),new b(r)],abi:Fc},options:s})}var Mc={typeParameters:[{constraints:["key"]}],parameters:[new m(ne(new k(0))),new m(P())]};async function hs(n){let{aptosConfig:e,creator:t,uri:r,digitalAssetAddress:o,digitalAssetType:i,options:s}=n;return h({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::set_uri",typeArguments:[_nullishCoalesce(i, () => (pe))],functionArguments:[u.from(o),new b(r)],abi:Mc},options:s})}var qc={typeParameters:[{constraints:["key"]}],parameters:[new m(ne(new k(0))),new m(P()),new m(P()),C.u8()]};async function Ts(n){let{aptosConfig:e,creator:t,propertyKey:r,propertyType:o,propertyValue:i,digitalAssetAddress:s,digitalAssetType:a,options:c}=n;return h({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::add_property",typeArguments:[_nullishCoalesce(a, () => (pe))],functionArguments:[u.from(s),new b(r),new b(We[o]),T.U8(ao(i,We[o]))],abi:qc},options:c})}var Vc={typeParameters:[{constraints:["key"]}],parameters:[new m(ne(new k(0))),new m(P())]};async function bs(n){let{aptosConfig:e,creator:t,propertyKey:r,digitalAssetAddress:o,digitalAssetType:i,options:s}=n;return h({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::remove_property",typeArguments:[_nullishCoalesce(i, () => (pe))],functionArguments:[u.from(o),new b(r)],abi:Vc},options:s})}var $c={typeParameters:[{constraints:["key"]}],parameters:[new m(ne(new k(0))),new m(P()),new m(P()),C.u8()]};async function ws(n){let{aptosConfig:e,creator:t,propertyKey:r,propertyType:o,propertyValue:i,digitalAssetAddress:s,digitalAssetType:a,options:c}=n;return h({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::update_property",typeArguments:[_nullishCoalesce(a, () => (pe))],functionArguments:[u.from(s),new b(r),new b(We[o]),ao(i,We[o])],abi:$c},options:c})}var Lc={typeParameters:[{constraints:["key"]},{constraints:[]}],parameters:[new m(ne(new k(0))),new m(P()),new k(1)]};async function Ss(n){let{aptosConfig:e,creator:t,propertyKey:r,propertyType:o,propertyValue:i,digitalAssetAddress:s,digitalAssetType:a,options:c}=n;return h({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::add_typed_property",typeArguments:[_nullishCoalesce(a, () => (pe)),We[o]],functionArguments:[u.from(s),new b(r),i],abi:Lc},options:c})}var Hc={typeParameters:[{constraints:["key"]},{constraints:[]}],parameters:[new m(ne(new k(0))),new m(P()),new k(1)]};async function _s(n){let{aptosConfig:e,creator:t,propertyKey:r,propertyType:o,propertyValue:i,digitalAssetAddress:s,digitalAssetType:a,options:c}=n;return h({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::update_typed_property",typeArguments:[_nullishCoalesce(a, () => (pe)),We[o]],functionArguments:[u.from(s),new b(r),i],abi:Hc},options:c})}function xs(n,e){let t=new Array;return e.forEach((r,o)=>{t.push(ao(n[o],r))}),t}function ao(n,e){let t=ze(e);return Nt(n,t,0,[]).bcsToBytes()}var dn=class{constructor(e){this.config=e}async getCollectionData(e){await A({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"});let{creatorAddress:t,collectionName:r,options:o}=e,i=u.from(t),s={collection_name:{_eq:r},creator_address:{_eq:i.toStringLong()}};return _optionalChain([o, 'optionalAccess', _164 => _164.tokenStandard])&&(s.token_standard={_eq:_nullishCoalesce(_optionalChain([o, 'optionalAccess', _165 => _165.tokenStandard]), () => ("v2"))}),Ot({aptosConfig:this.config,options:{where:s}})}async getCollectionDataByCreatorAddressAndCollectionName(e){return await A({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),ss({aptosConfig:this.config,...e})}async getCollectionDataByCreatorAddress(e){return await A({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),as({aptosConfig:this.config,...e})}async getCollectionDataByCollectionId(e){return await A({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),cs({aptosConfig:this.config,...e})}async getCollectionId(e){return await A({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),us({aptosConfig:this.config,...e})}async getDigitalAssetData(e){return await A({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),ts({aptosConfig:this.config,...e})}async getCurrentDigitalAssetOwnership(e){return await A({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),ns({aptosConfig:this.config,...e})}async getOwnedDigitalAssets(e){return await A({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),rs({aptosConfig:this.config,...e})}async getDigitalAssetActivity(e){return await A({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),os({aptosConfig:this.config,...e})}async createCollectionTransaction(e){return is({aptosConfig:this.config,...e})}async mintDigitalAssetTransaction(e){return ps({aptosConfig:this.config,...e})}async transferDigitalAssetTransaction(e){return ds({aptosConfig:this.config,...e})}async mintSoulBoundTransaction(e){return ls({aptosConfig:this.config,...e})}async burnDigitalAssetTransaction(e){return gs({aptosConfig:this.config,...e})}async freezeDigitalAssetTransaferTransaction(e){return ms({aptosConfig:this.config,...e})}async unfreezeDigitalAssetTransaferTransaction(e){return ys({aptosConfig:this.config,...e})}async setDigitalAssetDescriptionTransaction(e){return fs({aptosConfig:this.config,...e})}async setDigitalAssetNameTransaction(e){return As({aptosConfig:this.config,...e})}async setDigitalAssetURITransaction(e){return hs({aptosConfig:this.config,...e})}async addDigitalAssetPropertyTransaction(e){return Ts({aptosConfig:this.config,...e})}async removeDigitalAssetPropertyTransaction(e){return bs({aptosConfig:this.config,...e})}async updateDigitalAssetPropertyTransaction(e){return ws({aptosConfig:this.config,...e})}async addDigitalAssetTypedPropertyTransaction(e){return Ss({aptosConfig:this.config,...e})}async updateDigitalAssetTypedPropertyTransaction(e){return _s({aptosConfig:this.config,...e})}};var Ps=300,Qc=n=>{if(n&&n.length>Ps)throw new Error(`Event type length exceeds the maximum length of ${Ps}`)};async function vs(n){let{aptosConfig:e,eventType:t,options:r}=n;return ln({aptosConfig:e,options:{...r,where:{account_address:{_eq:"0x0000000000000000000000000000000000000000000000000000000000000000"},creation_number:{_eq:"0"},sequence_number:{_eq:"0"},indexed_type:{_eq:t}}}})}async function Cs(n){let{accountAddress:e,aptosConfig:t,creationNumber:r,options:o}=n,s={account_address:{_eq:u.from(e).toStringLong()},creation_number:{_eq:r}};return ln({aptosConfig:t,options:{...o,where:s}})}async function Es(n){let{accountAddress:e,aptosConfig:t,eventType:r,options:o}=n,s={account_address:{_eq:u.from(e).toStringLong()},indexed_type:{_eq:r}};return ln({aptosConfig:t,options:{...o,where:s}})}async function ln(n){let{aptosConfig:e,options:t}=n;Qc(_optionalChain([t, 'optionalAccess', _166 => _166.where, 'optionalAccess', _167 => _167.indexed_type, 'optionalAccess', _168 => _168._eq]));let r={query:ci,variables:{where_condition:_optionalChain([t, 'optionalAccess', _169 => _169.where]),offset:_optionalChain([t, 'optionalAccess', _170 => _170.offset]),limit:_optionalChain([t, 'optionalAccess', _171 => _171.limit]),order_by:_optionalChain([t, 'optionalAccess', _172 => _172.orderBy])}};return(await f({aptosConfig:e,query:r,originMethod:"getEvents"})).events}var gn=class{constructor(e){this.config=e}async getModuleEventsByEventType(e){return await A({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"events_processor"}),vs({aptosConfig:this.config,...e})}async getAccountEventsByCreationNumber(e){return await A({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"events_processor"}),Cs({aptosConfig:this.config,...e})}async getAccountEventsByEventType(e){return await A({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"events_processor"}),Es({aptosConfig:this.config,...e})}async getEvents(e){return await A({config:this.config,minimumLedgerVersion:_optionalChain([e, 'optionalAccess', _173 => _173.minimumLedgerVersion]),processorType:"events_processor"}),ln({aptosConfig:this.config,...e})}};async function Is(n){let{aptosConfig:e,accountAddress:t,amount:r,options:o}=n,i=_optionalChain([o, 'optionalAccess', _174 => _174.timeoutSecs])||20,{data:s}=await Lo({aptosConfig:e,path:"fund",body:{address:u.from(t).toString(),amount:r},originMethod:"fundAccount"}),a=s.txn_hashes[0],c=await Kt({aptosConfig:e,transactionHash:a,options:{timeoutSecs:i,checkSuccess:_optionalChain([o, 'optionalAccess', _175 => _175.checkSuccess])}});if(c.type==="user_transaction")return c;throw new Error(`Unexpected transaction received for fund account: ${c.type}`)}var mn=class{constructor(e){this.config=e}async fundAccount(e){let t=await Is({aptosConfig:this.config,...e});return(_optionalChain([e, 'access', _176 => _176.options, 'optionalAccess', _177 => _177.waitForIndexer])===void 0||_optionalChain([e, 'access', _178 => _178.options, 'optionalAccess', _179 => _179.waitForIndexer]))&&await Zn({aptosConfig:this.config,minimumLedgerVersion:BigInt(t.version),processorType:"fungible_asset_processor"}),t}};async function cr(n){let{aptosConfig:e,options:t}=n,r={query:pi,variables:{where_condition:_optionalChain([t, 'optionalAccess', _180 => _180.where]),limit:_optionalChain([t, 'optionalAccess', _181 => _181.limit]),offset:_optionalChain([t, 'optionalAccess', _182 => _182.offset])}};return(await f({aptosConfig:e,query:r,originMethod:"getFungibleAssetMetadata"})).fungible_asset_metadata}async function Us(n){let{aptosConfig:e,options:t}=n,r={query:ui,variables:{where_condition:_optionalChain([t, 'optionalAccess', _183 => _183.where]),limit:_optionalChain([t, 'optionalAccess', _184 => _184.limit]),offset:_optionalChain([t, 'optionalAccess', _185 => _185.offset])}};return(await f({aptosConfig:e,query:r,originMethod:"getFungibleAssetActivities"})).fungible_asset_activities}async function Rs(n){let{aptosConfig:e,options:t}=n,r={query:si,variables:{where_condition:_optionalChain([t, 'optionalAccess', _186 => _186.where]),limit:_optionalChain([t, 'optionalAccess', _187 => _187.limit]),offset:_optionalChain([t, 'optionalAccess', _188 => _188.offset])}};return(await f({aptosConfig:e,query:r,originMethod:"getCurrentFungibleAssetBalances"})).current_fungible_asset_balances}var Wc={typeParameters:[{constraints:[]}],parameters:[ze("0x1::object::Object"),new W,new $]};async function zs(n){let{aptosConfig:e,sender:t,fungibleAssetMetadataAddress:r,recipient:o,amount:i,options:s}=n;return h({aptosConfig:e,sender:t.accountAddress,data:{function:"0x1::primary_fungible_store::transfer",typeArguments:["0x1::fungible_asset::Metadata"],functionArguments:[r,o,i],abi:Wc},options:s})}var yn=class{constructor(e){this.config=e}async getFungibleAssetMetadata(e){return await A({config:this.config,minimumLedgerVersion:_optionalChain([e, 'optionalAccess', _189 => _189.minimumLedgerVersion]),processorType:"fungible_asset_processor"}),cr({aptosConfig:this.config,...e})}async getFungibleAssetMetadataByAssetType(e){return await A({config:this.config,minimumLedgerVersion:_optionalChain([e, 'optionalAccess', _190 => _190.minimumLedgerVersion]),processorType:"fungible_asset_processor"}),(await cr({aptosConfig:this.config,options:{where:{asset_type:{_eq:e.assetType}}}}))[0]}async getFungibleAssetMetadataByCreatorAddress(e){return await A({config:this.config,minimumLedgerVersion:_optionalChain([e, 'optionalAccess', _191 => _191.minimumLedgerVersion]),processorType:"fungible_asset_processor"}),await cr({aptosConfig:this.config,options:{where:{creator_address:{_eq:u.from(e.creatorAddress).toStringLong()}}}})}async getFungibleAssetActivities(e){return await A({config:this.config,minimumLedgerVersion:_optionalChain([e, 'optionalAccess', _192 => _192.minimumLedgerVersion]),processorType:"fungible_asset_processor"}),Us({aptosConfig:this.config,...e})}async getCurrentFungibleAssetBalances(e){return await A({config:this.config,minimumLedgerVersion:_optionalChain([e, 'optionalAccess', _193 => _193.minimumLedgerVersion]),processorType:"fungible_asset_processor"}),Rs({aptosConfig:this.config,...e})}async transferFungibleAsset(e){return zs({aptosConfig:this.config,...e})}};async function je(n){let{aptosConfig:e,payload:t,options:r}=n,o=await Qi({...t,aptosConfig:e}),i=new Z;o.serialize(i);let s=i.toUint8Array(),{data:a}=await Oe({aptosConfig:e,path:"view",originMethod:"view",contentType:"application/x.aptos.view_function+bcs",params:{ledger_version:_optionalChain([r, 'optionalAccess', _194 => _194.ledgerVersion])},body:s});return a}async function ks(n){let{aptosConfig:e,payload:t,options:r}=n,{data:o}=await Oe({aptosConfig:e,originMethod:"viewJson",path:"view",params:{ledger_version:_optionalChain([r, 'optionalAccess', _195 => _195.ledgerVersion])},body:{function:t.function,type_arguments:_nullishCoalesce(t.typeArguments, () => ([])),arguments:_nullishCoalesce(t.functionArguments, () => ([]))}});return o}var fn=class{constructor(e){this.config=e}async getLedgerInfo(){return Ln({aptosConfig:this.config})}async getChainId(){return(await this.getLedgerInfo()).chain_id}async getBlockByVersion(e){return Di({aptosConfig:this.config,...e})}async getBlockByHeight(e){return Bi({aptosConfig:this.config,...e})}async view(e){return je({aptosConfig:this.config,...e})}async viewJson(e){return ks({aptosConfig:this.config,...e})}async getChainTopUserTransactions(e){return yi({aptosConfig:this.config,...e})}async queryIndexer(e){return f({aptosConfig:this.config,...e})}async getIndexerLastSuccessVersion(){return Hn({aptosConfig:this.config})}async getProcessorStatus(e){return Qn({aptosConfig:this.config,processorType:e})}};var Ds=["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 Bs(n){return!(!n||n.length<3||n.length>63||!/^[a-z\d][a-z\d-]{1,61}[a-z\d]$/.test(n))}function Xe(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(!Bs(e))throw new Error(`${e} is not valid. ${Ds}`);if(t&&!Bs(t))throw new Error(`${t} is not valid. ${Ds}`);return{domainName:t||e,subdomainName:t?e:void 0}}function Gs(n){if(!n)return!1;let e=new Date(n.domain_expiration_timestamp).getTime()<Date.now(),t=new Date(n.expiration_timestamp).getTime()<Date.now();return n.subdomain&&e?!1:n.subdomain&&n.subdomain_expiration_policy===1?!0:!t}var jc="0x585fc9f0f0c54183b039ffc770ca282ebd87307916c215a3e692f2f8e4305e82",Xc={testnet:"0x5f8fd2347449685cf41d4db97926ec3a096eaf381332be4f1318ad4d16a8497c",mainnet:"0x867ed1f6bf916171b1de3ee92849b8978b7d1b9e0a8cc982a3d19d535dfd9c0c",local:jc,custom:null,devnet:null};function ke(n){let e=Xc[n.network];if(!e)throw new Error(`The ANS contract is not deployed to ${n.network}`);return e}var ur=n=>{if(n&&typeof n=="object"&&"vec"in n&&Array.isArray(n.vec))return n.vec[0]};async function Ks(n){let{aptosConfig:e,name:t}=n,r=ke(e),{domainName:o,subdomainName:i}=Xe(t),s=await je({aptosConfig:e,payload:{function:`${r}::router::get_owner_addr`,functionArguments:[o,i]}}),a=ur(s[0]);return a?u.from(a):void 0}async function Ns(n){let{aptosConfig:e,expiration:t,name:r,sender:o,targetAddress:i,toAddress:s,options:a,transferable:c}=n,p=ke(e),{domainName:y,subdomainName:w}=Xe(r),S=t.policy==="subdomain:independent"||t.policy==="subdomain:follow-domain";if(w&&!S)throw new Error("Subdomains must have an expiration policy of either 'subdomain:independent' or 'subdomain:follow-domain'");if(S&&!w)throw new Error(`Policy is set to ${t.policy} but no subdomain was provided`);if(t.policy==="domain"){let yr=_nullishCoalesce(t.years, () => (1));if(yr!==1)throw new Error("For now, names can only be registered for 1 year at a time");let na=yr*31536e3;return await h({aptosConfig:e,sender:o.accountAddress.toString(),data:{function:`${p}::router::register_domain`,functionArguments:[y,na,i,s]},options:a})}if(!w)throw new Error(`${t.policy} requires a subdomain to be provided.`);let g=await co({aptosConfig:e,name:y});if(!g)throw new Error("The domain does not exist");let E=t.policy==="subdomain:independent"?t.expirationDate:g;if(E>g)throw new Error("The subdomain expiration time cannot be greater than the domain expiration time");return await h({aptosConfig:e,sender:o.accountAddress.toString(),data:{function:`${p}::router::register_subdomain`,functionArguments:[y,w,Math.round(E/1e3),t.policy==="subdomain:follow-domain"?1:0,!!c,i,s]},options:a})}async function co(n){let{aptosConfig:e,name:t}=n,r=ke(e),{domainName:o,subdomainName:i}=Xe(t);try{let s=await je({aptosConfig:e,payload:{function:`${r}::router::get_expiration`,functionArguments:[o,i]}});return Number(s[0])*1e3}catch (e4){return}}async function Os(n){let{aptosConfig:e,address:t}=n,r=ke(e),o=await je({aptosConfig:e,payload:{function:`${r}::router::get_primary_name`,functionArguments:[u.from(t).toString()]}}),i=ur(o[1]),s=ur(o[0]);if(i)return[s,i].filter(Boolean).join(".")}async function Fs(n){let{aptosConfig:e,sender:t,name:r,options:o}=n,i=ke(e);if(!r)return await h({aptosConfig:e,sender:t.accountAddress.toString(),data:{function:`${i}::router::clear_primary_name`,functionArguments:[]},options:o});let{domainName:s,subdomainName:a}=Xe(r);return await h({aptosConfig:e,sender:t.accountAddress.toString(),data:{function:`${i}::router::set_primary_name`,functionArguments:[s,a]},options:o})}async function Ms(n){let{aptosConfig:e,name:t}=n,r=ke(e),{domainName:o,subdomainName:i}=Xe(t),s=await je({aptosConfig:e,payload:{function:`${r}::router::get_target_addr`,functionArguments:[o,i]}}),a=ur(s[0]);return a?u.from(a):void 0}async function qs(n){let{aptosConfig:e,sender:t,name:r,address:o,options:i}=n,s=ke(e),{domainName:a,subdomainName:c}=Xe(r);return await h({aptosConfig:e,sender:t.accountAddress.toString(),data:{function:`${s}::router::set_target_addr`,functionArguments:[a,c,o]},options:i})}async function Vs(n){let{aptosConfig:e,name:t}=n,{domainName:r,subdomainName:o=""}=Xe(t),a=(await f({aptosConfig:e,query:{query:Gt,variables:{where_condition:{domain:{_eq:r},subdomain:{_eq:o}},limit:1}},originMethod:"getName"})).current_aptos_names[0];return a&&(a=An(a)),Gs(a)?a:void 0}async function $s(n){let{aptosConfig:e,options:t,accountAddress:r}=n,o=await uo({aptosConfig:e});return(await f({aptosConfig:e,originMethod:"getAccountNames",query:{query:Gt,variables:{limit:_optionalChain([t, 'optionalAccess', _196 => _196.limit]),offset:_optionalChain([t, 'optionalAccess', _197 => _197.offset]),order_by:_optionalChain([t, 'optionalAccess', _198 => _198.orderBy]),where_condition:{..._nullishCoalesce(_optionalChain([n, 'access', _199 => _199.options, 'optionalAccess', _200 => _200.where]), () => ({})),owner_address:{_eq:r.toString()},expiration_timestamp:{_gte:o}}}}})).current_aptos_names.map(An)}async function Ls(n){let{aptosConfig:e,options:t,accountAddress:r}=n,o=await uo({aptosConfig:e});return(await f({aptosConfig:e,originMethod:"getAccountDomains",query:{query:Gt,variables:{limit:_optionalChain([t, 'optionalAccess', _201 => _201.limit]),offset:_optionalChain([t, 'optionalAccess', _202 => _202.offset]),order_by:_optionalChain([t, 'optionalAccess', _203 => _203.orderBy]),where_condition:{..._nullishCoalesce(_optionalChain([n, 'access', _204 => _204.options, 'optionalAccess', _205 => _205.where]), () => ({})),owner_address:{_eq:r.toString()},expiration_timestamp:{_gte:o},subdomain:{_eq:""}}}}})).current_aptos_names.map(An)}async function Hs(n){let{aptosConfig:e,options:t,accountAddress:r}=n,o=await uo({aptosConfig:e});return(await f({aptosConfig:e,originMethod:"getAccountSubdomains",query:{query:Gt,variables:{limit:_optionalChain([t, 'optionalAccess', _206 => _206.limit]),offset:_optionalChain([t, 'optionalAccess', _207 => _207.offset]),order_by:_optionalChain([t, 'optionalAccess', _208 => _208.orderBy]),where_condition:{..._nullishCoalesce(_optionalChain([n, 'access', _209 => _209.options, 'optionalAccess', _210 => _210.where]), () => ({})),owner_address:{_eq:r.toString()},expiration_timestamp:{_gte:o},subdomain:{_neq:""}}}}})).current_aptos_names.map(An)}async function Qs(n){let{aptosConfig:e,options:t,domain:r}=n;return(await f({aptosConfig:e,originMethod:"getDomainSubdomains",query:{query:Gt,variables:{limit:_optionalChain([t, 'optionalAccess', _211 => _211.limit]),offset:_optionalChain([t, 'optionalAccess', _212 => _212.offset]),order_by:_optionalChain([t, 'optionalAccess', _213 => _213.orderBy]),where_condition:{..._nullishCoalesce(_optionalChain([n, 'access', _214 => _214.options, 'optionalAccess', _215 => _215.where]), () => ({})),domain:{_eq:r},subdomain:{_neq:""}}}}})).current_aptos_names.map(An).filter(Gs)}async function uo(n){let{aptosConfig:e}=n,t=ke(e),[r]=await je({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 Ws(n){let{aptosConfig:e,sender:t,name:r,years:o=1,options:i}=n,s=ke(e),a=o*31536e3,{domainName:c,subdomainName:p}=Xe(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 h({aptosConfig:e,sender:t.accountAddress.toString(),data:{function:`${s}::router::renew_domain`,functionArguments:[c,a]},options:i})}function An(n){return{...n,expiration_timestamp:new Date(n.expiration_timestamp).getTime()}}var hn=class{constructor(e){this.config=e}async getOwnerAddress(e){return Ks({aptosConfig:this.config,...e})}async getExpiration(e){return co({aptosConfig:this.config,...e})}async getTargetAddress(e){return Ms({aptosConfig:this.config,...e})}async setTargetAddress(e){return qs({aptosConfig:this.config,...e})}async getPrimaryName(e){return Os({aptosConfig:this.config,...e})}async setPrimaryName(e){return Fs({aptosConfig:this.config,...e})}async registerName(e){return Ns({aptosConfig:this.config,...e})}async renewDomain(e){return Ws({aptosConfig:this.config,...e})}async getName(e){return Vs({aptosConfig:this.config,...e})}async getAccountNames(e){return $s({aptosConfig:this.config,...e})}async getAccountDomains(e){return Ls({aptosConfig:this.config,...e})}async getAccountSubdomains(e){return Hs({aptosConfig:this.config,...e})}async getDomainSubdomains(e){return Qs({aptosConfig:this.config,...e})}};async function js(n){let{aptosConfig:e,poolAddress:t}=n,r=u.from(t).toStringLong(),i=await f({aptosConfig:e,query:{query:Mr,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 Xs(n){let{aptosConfig:e,options:t}=n,r={query:Mr,variables:{order_by:_optionalChain([t, 'optionalAccess', _216 => _216.orderBy])}};return(await f({aptosConfig:e,query:r})).num_active_delegator_per_pool}async function Ys(n){let{aptosConfig:e,delegatorAddress:t,poolAddress:r}=n,o={query:ai,variables:{delegatorAddress:u.from(t).toStringLong(),poolAddress:u.from(r).toStringLong()}};return(await f({aptosConfig:e,query:o})).delegated_staking_activities}var Tn=class{constructor(e){this.config=e}async getNumberOfDelegators(e){return await A({config:this.config,minimumLedgerVersion:_optionalChain([e, 'optionalAccess', _217 => _217.minimumLedgerVersion]),processorType:"stake_processor"}),js({aptosConfig:this.config,...e})}async getNumberOfDelegatorsForAllPools(e){return await A({config:this.config,minimumLedgerVersion:_optionalChain([e, 'optionalAccess', _218 => _218.minimumLedgerVersion]),processorType:"stake_processor"}),Xs({aptosConfig:this.config,...e})}async getDelegatedStakingActivities(e){return await A({config:this.config,minimumLedgerVersion:_optionalChain([e, 'optionalAccess', _219 => _219.minimumLedgerVersion]),processorType:"stake_processor"}),Ys({aptosConfig:this.config,...e})}};var pr=class{constructor(e){this.config=e}async simple(e){return h({aptosConfig:this.config,...e})}async multiAgent(e){return h({aptosConfig:this.config,...e})}};function po(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 lo(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 Ft=class{constructor(e){this.config=e}async simple(e){return so({aptosConfig:this.config,...e})}async multiAgent(e){return so({aptosConfig:this.config,...e})}};_chunkJ4IUXT5Wjs.a.call(void 0, [lo],Ft.prototype,"simple",1),_chunkJ4IUXT5Wjs.a.call(void 0, [lo],Ft.prototype,"multiAgent",1);var Mt=class{constructor(e){this.config=e}async simple(e){return ar({aptosConfig:this.config,...e})}async multiAgent(e){return ar({aptosConfig:this.config,...e})}};_chunkJ4IUXT5Wjs.a.call(void 0, [po],Mt.prototype,"simple",1),_chunkJ4IUXT5Wjs.a.call(void 0, [po],Mt.prototype,"multiAgent",1);var dr=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 _chunkJ4IUXT5Wjs.b.call(void 0, this.sleepTime);this.lock=!0;let e=BigInt(0);try{if((this.lastUncommintedNumber===null||this.currentNumber===null)&&await this.initialize(),this.currentNumber-this.lastUncommintedNumber>=this.maximumInFlight){await this.update();let t=_chunkJ4IUXT5Wjs.c.call(void 0, );for(;this.currentNumber-this.lastUncommintedNumber>=this.maximumInFlight;)await _chunkJ4IUXT5Wjs.b.call(void 0, this.sleepTime),_chunkJ4IUXT5Wjs.c.call(void 0, )-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 Se({aptosConfig:this.aptosConfig,accountAddress:this.account.accountAddress});this.currentNumber=BigInt(e),this.lastUncommintedNumber=BigInt(e)}async update(){let{sequence_number:e}=await Se({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 _chunkJ4IUXT5Wjs.b.call(void 0, this.sleepTime);this.lock=!0;try{await this.update();let e=_chunkJ4IUXT5Wjs.c.call(void 0, );for(;this.lastUncommintedNumber!==this.currentNumber;)_chunkJ4IUXT5Wjs.c.call(void 0, )-e>this.maxWaitTime?(console.warn(`Waited over 30 seconds for a transaction to commit, resyncing ${this.account.accountAddress.toString()}`),await this.initialize()):(await _chunkJ4IUXT5Wjs.b.call(void 0, this.sleepTime),await this.update())}catch(e){console.error("error in synchronizing this account sequence number with the one on chain",e)}finally{this.lock=!1}}}};var qt=class{constructor(){this.queue=[];this.pendingDequeue=[];this.cancelled=!1}enqueue(e){if(this.cancelled=!1,this.pendingDequeue.length>0){_optionalChain([this, 'access', _220 => _220.pendingDequeue, 'access', _221 => _221.shift, 'call', _222 => _222(), 'optionalAccess', _223 => _223.resolve, 'call', _224 => _224(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 Vt("Task cancelled"))}),this.pendingDequeue=[],this.queue.length=0}isCancelled(){return this.cancelled}pendingDequeueLength(){return this.pendingDequeue.length}},Vt=class extends Error{};var Zs="fulfilled",Js= exports.TransactionWorkerEventsEnum =(i=>(i.TransactionSent="transactionSent",i.TransactionSendFailed="transactionSendFailed",i.TransactionExecuted="transactionExecuted",i.TransactionExecutionFailed="transactionExecutionFailed",i.ExecutionFinish="executionFinish",i))(Js||{}),lr= exports.TransactionWorker =class extends _eventemitter32.default{constructor(t,r,o=30,i=100,s=10){super();this.taskQueue=new qt;this.transactionsQueue=new qt;this.outstandingTransactions=new qt;this.sentTransactions=[];this.executedTransactions=[];this.aptosConfig=t,this.account=r,this.started=!1,this.accountSequnceNumber=new dr(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=un({aptosConfig:this.aptosConfig,transaction:r,signer:this.account});await this.outstandingTransactions.enqueue([o,t])}}catch(t){if(t instanceof Vt)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===Zs?(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 Vt)return;throw new Error(`Process execution failed for ${this.account.accountAddress.toString()} with error ${t}`)}}async checkTransaction(t,r){try{let o=[];o.push(Kt({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===Zs?(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 h({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 gr=class extends _eventemitter32.default{constructor(e){super(),this.config=e}start(e){let{sender:t}=e;this.account=t,this.transactionWorker=new lr(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 bn=class{constructor(e){this.config=e,this.build=new pr(this.config),this.simulate=new Ft(this.config),this.submit=new Mt(this.config),this.batch=new gr(this.config)}async getTransactions(e){return Qr({aptosConfig:this.config,...e})}async getTransactionByVersion(e){return zi({aptosConfig:this.config,...e})}async getTransactionByHash(e){return on({aptosConfig:this.config,...e})}async isPendingTransaction(e){return ki({aptosConfig:this.config,...e})}async waitForTransaction(e){return Kt({aptosConfig:this.config,...e})}async getGasPriceEstimation(){return Yn({aptosConfig:this.config})}getSigningMessage(e){return Yi(e)}async publishPackageTransaction(e){return Zi({aptosConfig:this.config,...e})}async rotateAuthKey(e){return Ji({aptosConfig:this.config,...e})}sign(e){return sr({...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,sr({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 un({aptosConfig:this.config,signer:t,transaction:r})}};var wn=class{constructor(e){this.config=e}async getTableItem(e){return Wn({aptosConfig:this.config,...e})}async getTableItemsData(e){return await A({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"default_processor"}),fi({aptosConfig:this.config,...e})}async getTableItemsMetadata(e){return await A({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"default_processor"}),Ai({aptosConfig:this.config,...e})}};async function mr(n){let{aptosConfig:e,jwt:t,ephemeralKeyPair:r,uidKey:o="sub",derivationPath:i}=n,s={jwt_b64:t,epk:r.getPublicKey().bcsToHex().toStringWithoutPrefix(),exp_date_secs:r.expiryDateSecs,epk_blinder:l.fromHexInput(r.blinder).toStringWithoutPrefix(),uid_key:o,derivation_path:i},{data:a}=await Ho({aptosConfig:e,path:"fetch",body:s,originMethod:"getPepper",overrides:{WITH_CREDENTIALS:!1}});return l.fromHexInput(a.pepper).toUint8Array()}async function go(n){let{aptosConfig:e,jwt:t,ephemeralKeyPair:r,pepper:o=await mr(n),uidKey:i="sub"}=n;if(l.fromHexInput(o).toUint8Array().length!==we.PEPPER_LENGTH)throw new Error(`Pepper needs to be ${we.PEPPER_LENGTH} bytes`);let{maxExpHorizonSecs:s}=await jo({aptosConfig:e});if(s<r.expiryDateSecs-_chunkJ4IUXT5Wjs.c.call(void 0, ))throw Error(`The EphemeralKeyPair is too long lived. It's lifespan must be less than ${s}`);let a={jwt_b64:t,epk:r.getPublicKey().bcsToHex().toStringWithoutPrefix(),epk_blinder:l.fromHexInput(r.blinder).toStringWithoutPrefix(),exp_date_secs:r.expiryDateSecs,exp_horizon_secs:s,pepper:l.fromHexInput(o).toStringWithoutPrefix(),uid_key:i},{data:c}=await Qo({aptosConfig:e,path:"prove",body:a,originMethod:"getProof",overrides:{WITH_CREDENTIALS:!1}}),p=c.proof,y=new St({a:p.a,b:p.b,c:p.c});return new Ie({proof:new _t(y,0),trainingWheelsSignature:Te.fromHex(c.training_wheels_signature),expHorizonSecs:s})}async function ea(n){let{aptosConfig:e,jwt:t,uidKey:r,proofFetchCallback:o,pepper:i=await mr(n)}=n,s=go({...n,pepper:i}),a=o?s:await s,c=ee.fromJwtAndPepper({jwt:t,pepper:i,uidKey:r}),p=await rn({aptosConfig:e,authenticationKey:c.authKey().derivedAddress()});return we.create({...n,address:p,proof:a,pepper:i,proofFetchCallback:o})}var Sn=class{constructor(e){this.config=e}async getPepper(e){return mr({aptosConfig:this.config,...e})}async getProof(e){return go({aptosConfig:this.config,...e})}async deriveKeylessAccount(e){return ea({aptosConfig:this.config,...e})}};async function Jc(n){let{aptosConfig:e,options:t}=n,r={query:$n,variables:{where_condition:_optionalChain([t, 'optionalAccess', _225 => _225.where]),offset:_optionalChain([t, 'optionalAccess', _226 => _226.offset]),limit:_optionalChain([t, 'optionalAccess', _227 => _227.limit]),order_by:_optionalChain([t, 'optionalAccess', _228 => _228.orderBy])}};return(await f({aptosConfig:e,query:r,originMethod:"getObjectData"})).current_objects}async function ta(n){let{aptosConfig:e,objectAddress:t,options:r}=n,i={object_address:{_eq:u.from(t).toStringLong()}};return(await Jc({aptosConfig:e,options:{...r,where:i}}))[0]}var _n=class{constructor(e){this.config=e}async getObjectDataByObjectAddress(e){return await A({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"objects_processor"}),ta({aptosConfig:this.config,...e})}};var j=class{constructor(e){this.config=new Jn(e),this.account=new sn(this.config),this.ans=new hn(this.config),this.coin=new pn(this.config),this.digitalAsset=new dn(this.config),this.event=new gn(this.config),this.faucet=new mn(this.config),this.fungibleAsset=new yn(this.config),this.general=new fn(this.config),this.staking=new Tn(this.config),this.transaction=new bn(this.config),this.table=new wn(this.config),this.keyless=new Sn(this.config),this.object=new _n(this.config)}};function re(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))})}re(j,sn,"account");re(j,hn,"ans");re(j,pn,"coin");re(j,dn,"digitalAsset");re(j,gn,"event");re(j,mn,"faucet");re(j,yn,"fungibleAsset");re(j,fn,"general");re(j,Tn,"staking");re(j,bn,"transaction");re(j,wn,"table");re(j,Sn,"keyless");re(j,_n,"object");exports.APTOS_BIP44_REGEX = ya; exports.APTOS_COIN = ot; exports.APTOS_HARDENED_REGEX = ma; exports.Account = Le; exports.AccountAddress = u; exports.AccountAuthenticator = H; exports.AccountAuthenticatorEd25519 = fe; exports.AccountAuthenticatorMultiEd25519 = Gn; exports.AccountAuthenticatorMultiKey = at; exports.AccountAuthenticatorSingleKey = Q; exports.AccountAuthenticatorVariant = bo; exports.AccountPublicKey = ie; exports.AccountSequenceNumber = dr; exports.AddressInvalidReason = pa; exports.AnyPublicKey = D; exports.AnyPublicKeyVariant = Ar; exports.AnySignature = G; exports.AnySignatureVariant = wo; exports.Aptos = j; exports.AptosApiError = ye; exports.AptosApiType = Tt; exports.AptosConfig = Jn; exports.AuthenticationKey = q; exports.Bool = I; exports.CKDPriv = Uo; exports.ChainId = Pt; exports.DEFAULT_MAX_GAS_AMOUNT = Go; exports.DEFAULT_TXN_EXP_SEC_FROM_NOW = Ko; exports.DEFAULT_TXN_TIMEOUT_SEC = Dn; exports.DeriveScheme = xo; exports.Deserializer = oe; exports.EPK_HORIZON_SECS = Ul; exports.Ed25519Account = kt; exports.Ed25519PrivateKey = L; exports.Ed25519PublicKey = x; exports.Ed25519Signature = v; exports.EntryFunction = ut; exports.EntryFunctionBytes = Cn; exports.EphemeralCertificate = wt; exports.EphemeralCertificateVariant = Tr; exports.EphemeralKeyPair = nn; exports.EphemeralPublicKey = rt; exports.EphemeralPublicKeyVariant = hr; exports.EphemeralSignature = Te; exports.EphemeralSignatureVariant = So; exports.FeePayerRawTransaction = dt; exports.FixedBytes = Je; exports.Groth16Zkp = St; exports.HARDENED_OFFSET = Co; exports.Hex = l; exports.HexInvalidReason = ia; exports.Identifier = R; exports.KeyType = fa; exports.KeylessAccount = we; exports.KeylessConfiguration = Br; exports.KeylessPublicKey = ee; exports.KeylessSignature = Ee; exports.MAX_AUD_VAL_BYTES = Ha; exports.MAX_COMMITED_EPK_BYTES = Dl; exports.MAX_EXTRA_FIELD_BYTES = zl; exports.MAX_ISS_VAL_BYTES = Rl; exports.MAX_JWT_HEADER_B64_BYTES = kl; exports.MAX_UID_KEY_BYTES = Qa; exports.MAX_UID_VAL_BYTES = Wa; exports.MimeType = En; exports.ModuleId = jt; exports.MoveAbility = _o; exports.MoveFunctionVisibility = aa; exports.MoveOption = M; exports.MoveString = b; exports.MoveVector = T; exports.MultiAgentRawTransaction = pt; exports.MultiAgentTransaction = Mn; exports.MultiEd25519PublicKey = ft; exports.MultiEd25519Signature = tt; exports.MultiKey = xt; exports.MultiKeyAccount = qn; exports.MultiKeySignature = st; exports.MultiSig = en; exports.MultiSigTransactionPayload = tn; exports.Network = Rr; exports.NetworkToChainId = zr; exports.NetworkToFaucetAPI = qo; exports.NetworkToIndexerAPI = Fo; exports.NetworkToNetworkName = Rd; exports.NetworkToNodeAPI = Mo; exports.NetworkToPepperAPI = Ir; exports.NetworkToProverAPI = Ur; exports.ParsingError = Y; exports.ProcessorType = ve; exports.PublicKey = et; exports.RAW_TRANSACTION_SALT = No; exports.RAW_TRANSACTION_WITH_DATA_SALT = Cr; exports.RawTransaction = ue; exports.RawTransactionWithData = Nn; exports.RoleType = ca; exports.RotationProofChallenge = On; exports.Script = Jt; exports.ScriptTransactionArgumentVariants = Lt; exports.Secp256k1PrivateKey = nt; exports.Secp256k1PublicKey = Pe; exports.Secp256k1Signature = ht; exports.Serializable = d; exports.Serializer = Z; exports.Signature = B; exports.SignedTransaction = lt; exports.SigningScheme = Ae; exports.SigningSchemeInput = Sr; exports.SimpleTransaction = Fn; exports.SingleKeyAccount = Dt; exports.StructTag = Ue; exports.TransactionAuthenticator = Re; exports.TransactionAuthenticatorEd25519 = Ct; exports.TransactionAuthenticatorFeePayer = It; exports.TransactionAuthenticatorMultiAgent = Et; exports.TransactionAuthenticatorMultiEd25519 = Nr; exports.TransactionAuthenticatorSingleSender = Ut; exports.TransactionAuthenticatorVariant = To; exports.TransactionPayload = ct; exports.TransactionPayloadEntryFunction = Yt; exports.TransactionPayloadMultiSig = Zt; exports.TransactionPayloadScript = Xt; exports.TransactionPayloadVariants = Ao; exports.TransactionResponseType = wr; exports.TransactionVariants = ho; exports.TransactionWorker = lr; exports.TransactionWorkerEventsEnum = Js; exports.TypeTag = z; exports.TypeTagAddress = W; exports.TypeTagBool = K; exports.TypeTagGeneric = k; exports.TypeTagParserError = N; exports.TypeTagParserErrorType = mc; exports.TypeTagReference = Kn; exports.TypeTagSigner = vt; exports.TypeTagStruct = m; exports.TypeTagU128 = Ve; exports.TypeTagU16 = Me; exports.TypeTagU256 = $e; exports.TypeTagU32 = qe; exports.TypeTagU64 = $; exports.TypeTagU8 = ce; exports.TypeTagVariants = fo; exports.TypeTagVector = C; exports.U128 = ge; exports.U16 = de; exports.U256 = me; exports.U32 = le; exports.U64 = O; exports.U8 = F; exports.ZeroKnowledgeSig = Ie; exports.ZkProof = _t; exports.ZkpVariant = br; exports.aptosCoinStructTag = em; exports.aptosRequest = Bn; exports.base64UrlDecode = _chunkJ4IUXT5Wjs.e; exports.buildTransaction = oo; exports.checkOrConvertArgument = Nt; exports.convertAmountFromHumanReadableToOnChain = _chunkJ4IUXT5Wjs.f; exports.convertAmountFromOnChainToHumanReadable = _chunkJ4IUXT5Wjs.g; exports.convertArgument = ro; exports.convertNumber = er; exports.createObjectAddress = Kr; exports.createResourceAddress = Ug; exports.createTokenAddress = Rg; exports.deriveKey = _r; exports.deriveTransactionType = Or; exports.deserializeFromScriptArgument = Za; exports.ensureBoolean = fr; exports.fetchEntryFunctionAbi = Li; exports.fetchFunctionAbi = $i; exports.fetchViewFunctionAbi = Hi; exports.findFirstNonSignerArg = Vi; exports.floorToWholeHour = _chunkJ4IUXT5Wjs.d; exports.generateRawTransaction = _c; exports.generateSignedTransaction = io; exports.generateSignedTransactionForSimulation = Wi; exports.generateSigningMessage = Rt; exports.generateSigningMessageForSerializable = ly; exports.generateSigningMessageForTransaction = zt; exports.generateTransactionPayload = ir; exports.generateTransactionPayloadWithABI = bc; exports.generateUserTransactionHash = ih; exports.generateViewFunctionPayload = Qi; exports.generateViewFunctionPayloadWithABI = wc; exports.get = kr; exports.getAptosFullNode = V; exports.getAptosPepperService = el; exports.getAuthenticatorForSimulation = or; exports.getFunctionParts = cn; exports.getKeylessConfig = jo; exports.hashValues = ji; exports.isBcsAddress = nr; exports.isBcsBool = Wr; exports.isBcsFixedBytes = fc; exports.isBcsString = jr; exports.isBcsU128 = eo; exports.isBcsU16 = Yr; exports.isBcsU256 = to; exports.isBcsU32 = Zr; exports.isBcsU64 = Jr; exports.isBcsU8 = Xr; exports.isBlockEpilogueTransactionResponse = Uu; exports.isBlockMetadataTransactionResponse = Cu; exports.isBool = Oi; exports.isCanonicalEd25519Signature = ha; exports.isEd25519Signature = Ru; exports.isEmptyOption = Fi; exports.isEncodedEntryFunctionArgument = Mi; exports.isFeePayerSignature = Du; exports.isGenesisTransactionResponse = vu; exports.isLargeNumber = tr; exports.isMultiAgentSignature = ku; exports.isMultiEd25519Signature = Bu; exports.isNumber = yc; exports.isPendingTransactionResponse = xu; exports.isScriptDataInput = qi; exports.isSecp256k1Signature = zu; exports.isStateCheckpointTransactionResponse = Eu; exports.isString = Qe; exports.isUserTransactionResponse = Pu; exports.isValidBIP44Path = Eo; exports.isValidHardenedPath = Io; exports.isValidatorTransactionResponse = Iu; exports.mnemonicToSeed = In; exports.normalizeBundle = Vo; exports.nowInSeconds = _chunkJ4IUXT5Wjs.c; exports.objectStructTag = ne; exports.optionStructTag = tm; exports.outOfRangeErrorMessage = sa; exports.paginateWithCursor = bt; exports.parseTypeTag = ze; exports.post = Wt; exports.postAptosFaucet = Lo; exports.postAptosFullNode = Oe; exports.postAptosIndexer = $o; exports.postAptosPepperService = Ho; exports.postAptosProvingService = Qo; exports.promiseFulfilledStatus = Zs; exports.request = $a; exports.sleep = _chunkJ4IUXT5Wjs.b; exports.splitPath = Ro; exports.standardizeTypeTags = rr; exports.stringStructTag = P; exports.throwTypeMismatch = U; exports.validateNumberInRange = Be;
|
|
472
|
+
`;async function Hn(n){let{aptosConfig:e}=n,{data:t}=await V({aptosConfig:e,originMethod:"getLedgerInfo",path:""});return t}async function To(n){let{aptosConfig:e,limit:t}=n;return(await f({aptosConfig:e,query:{query:ao,variables:{limit:t}},originMethod:"getChainTopUserTransactions"})).user_transactions}async function f(n){let{aptosConfig:e,query:t,originMethod:r}=n,{data:i}=await Qi({aptosConfig:e,originMethod:_nullishCoalesce(r, () => ("queryIndexer")),path:"",body:t,overrides:{WITH_CREDENTIALS:!1}});return i}async function dc(n){let{aptosConfig:e}=n;return(await f({aptosConfig:e,query:{query:Vr},originMethod:"getProcessorStatuses"})).processor_status}async function Qn(n){let e=await dc({aptosConfig:n.aptosConfig});return BigInt(e[0].last_success_version)}async function Wn(n){let{aptosConfig:e,processorType:t}=n;return(await f({aptosConfig:e,query:{query:Vr,variables:{where_condition:{processor:{_eq:t}}}},originMethod:"getProcessorStatus"})).processor_status[0]}async function jn(n){let{aptosConfig:e,handle:t,data:r,options:i}=n;return(await Fe({aptosConfig:e,originMethod:"getTableItem",path:`tables/${t}/item`,params:{ledger_version:_optionalChain([i, 'optionalAccess', _54 => _54.ledgerVersion])},body:r})).data}async function bo(n){let{aptosConfig:e,options:t}=n,r={query:yo,variables:{where_condition:_optionalChain([t, 'optionalAccess', _55 => _55.where]),offset:_optionalChain([t, 'optionalAccess', _56 => _56.offset]),limit:_optionalChain([t, 'optionalAccess', _57 => _57.limit]),order_by:_optionalChain([t, 'optionalAccess', _58 => _58.orderBy])}};return(await f({aptosConfig:e,query:r,originMethod:"getTableItemsData"})).table_items}async function wo(n){let{aptosConfig:e,options:t}=n,r={query:fo,variables:{where_condition:_optionalChain([t, 'optionalAccess', _59 => _59.where]),offset:_optionalChain([t, 'optionalAccess', _60 => _60.offset]),limit:_optionalChain([t, 'optionalAccess', _61 => _61.limit]),order_by:_optionalChain([t, 'optionalAccess', _62 => _62.orderBy])}};return(await f({aptosConfig:e,query:r,originMethod:"getTableItemsMetadata"})).table_metadatas}async function Se(n){let{aptosConfig:e,accountAddress:t}=n,{data:r}=await V({aptosConfig:e,originMethod:"getInfo",path:`accounts/${u.from(t).toString()}`});return r}async function xo(n){let{aptosConfig:e,accountAddress:t,options:r}=n;return bt({aptosConfig:e,originMethod:"getModules",path:`accounts/${u.from(t).toString()}/modules`,params:{ledger_version:_optionalChain([r, 'optionalAccess', _63 => _63.ledgerVersion]),start:_optionalChain([r, 'optionalAccess', _64 => _64.offset]),limit:_nullishCoalesce(_optionalChain([r, 'optionalAccess', _65 => _65.limit]), () => (1e3))}})}async function Xn(n){return _optionalChain([n, 'access', _66 => _66.options, 'optionalAccess', _67 => _67.ledgerVersion])!==void 0?So(n):Me(async()=>So(n),`module-${n.accountAddress}-${n.moduleName}`,1e3*60*5)()}async function So(n){let{aptosConfig:e,accountAddress:t,moduleName:r,options:i}=n,{data:o}=await V({aptosConfig:e,originMethod:"getModule",path:`accounts/${u.from(t).toString()}/module/${r}`,params:{ledger_version:_optionalChain([i, 'optionalAccess', _68 => _68.ledgerVersion])}});return o}async function vo(n){let{aptosConfig:e,accountAddress:t,options:r}=n;return bt({aptosConfig:e,originMethod:"getTransactions",path:`accounts/${u.from(t).toString()}/transactions`,params:{start:_optionalChain([r, 'optionalAccess', _69 => _69.offset]),limit:_optionalChain([r, 'optionalAccess', _70 => _70.limit])}})}async function Po(n){let{aptosConfig:e,accountAddress:t,options:r}=n;return bt({aptosConfig:e,originMethod:"getResources",path:`accounts/${u.from(t).toString()}/resources`,params:{ledger_version:_optionalChain([r, 'optionalAccess', _71 => _71.ledgerVersion]),start:_optionalChain([r, 'optionalAccess', _72 => _72.offset]),limit:_nullishCoalesce(_optionalChain([r, 'optionalAccess', _73 => _73.limit]), () => (999))}})}async function Lr(n){let{aptosConfig:e,accountAddress:t,resourceType:r,options:i}=n,{data:o}=await V({aptosConfig:e,originMethod:"getResource",path:`accounts/${u.from(t).toString()}/resource/${r}`,params:{ledger_version:_optionalChain([i, 'optionalAccess', _74 => _74.ledgerVersion])}});return o.data}async function on(n){let{aptosConfig:e,authenticationKey:t,options:r}=n,i=await Lr({aptosConfig:e,accountAddress:"0x1",resourceType:"0x1::account::OriginatingAddress",options:r}),{address_map:{handle:o}}=i,s=u.from(t);try{let a=await jn({aptosConfig:e,handle:o,data:{key:s.toString(),key_type:"address",value_type:"address"},options:r});return u.from(a)}catch(a){if(a instanceof ye&&a.data.error_code==="table_item_not_found")return s;throw a}}async function Co(n){let{aptosConfig:e,accountAddress:t}=n,i={owner_address:{_eq:u.from(t).toStringLong()},amount:{_gt:0}},s=await f({aptosConfig:e,query:{query:oo,variables:{where_condition:i}},originMethod:"getAccountTokensCount"});return s.current_token_ownerships_v2_aggregate.aggregate?s.current_token_ownerships_v2_aggregate.aggregate.count:0}async function Eo(n){let{aptosConfig:e,accountAddress:t,options:r}=n,o={owner_address:{_eq:u.from(t).toStringLong()},amount:{_gt:0}};_optionalChain([r, 'optionalAccess', _75 => _75.tokenStandard])&&(o.token_standard={_eq:_optionalChain([r, 'optionalAccess', _76 => _76.tokenStandard])});let s={query:ro,variables:{where_condition:o,offset:_optionalChain([r, 'optionalAccess', _77 => _77.offset]),limit:_optionalChain([r, 'optionalAccess', _78 => _78.limit]),order_by:_optionalChain([r, 'optionalAccess', _79 => _79.orderBy])}};return(await f({aptosConfig:e,query:s,originMethod:"getAccountOwnedTokens"})).current_token_ownerships_v2}async function Io(n){let{aptosConfig:e,accountAddress:t,collectionAddress:r,options:i}=n,o=u.from(t).toStringLong(),s=u.from(r).toStringLong(),a={owner_address:{_eq:o},current_token_data:{collection_id:{_eq:s}},amount:{_gt:0}};_optionalChain([i, 'optionalAccess', _80 => _80.tokenStandard])&&(a.token_standard={_eq:_optionalChain([i, 'optionalAccess', _81 => _81.tokenStandard])});let c={query:io,variables:{where_condition:a,offset:_optionalChain([i, 'optionalAccess', _82 => _82.offset]),limit:_optionalChain([i, 'optionalAccess', _83 => _83.limit]),order_by:_optionalChain([i, 'optionalAccess', _84 => _84.orderBy])}};return(await f({aptosConfig:e,query:c,originMethod:"getAccountOwnedTokensFromCollectionAddress"})).current_token_ownerships_v2}async function Uo(n){let{aptosConfig:e,accountAddress:t,options:r}=n,o={owner_address:{_eq:u.from(t).toStringLong()}};_optionalChain([r, 'optionalAccess', _85 => _85.tokenStandard])&&(o.current_collection={token_standard:{_eq:_optionalChain([r, 'optionalAccess', _86 => _86.tokenStandard])}});let s={query:no,variables:{where_condition:o,offset:_optionalChain([r, 'optionalAccess', _87 => _87.offset]),limit:_optionalChain([r, 'optionalAccess', _88 => _88.limit]),order_by:_optionalChain([r, 'optionalAccess', _89 => _89.orderBy])}};return(await f({aptosConfig:e,query:s,originMethod:"getAccountCollectionsWithOwnedTokens"})).current_collection_ownership_v2_view}async function Ro(n){let{aptosConfig:e,accountAddress:t}=n,r=u.from(t).toStringLong(),o=await f({aptosConfig:e,query:{query:so,variables:{address:r}},originMethod:"getAccountTransactionsCount"});return o.account_transactions_aggregate.aggregate?o.account_transactions_aggregate.aggregate.count:0}async function zo(n){let{aptosConfig:e,accountAddress:t,coinType:r,faMetadataAddress:i}=n,o=r,s;if(r!==void 0&&i!==void 0)s=u.from(i).toStringLong();else if(r!==void 0&&i===void 0)r===it?s=u.A.toStringLong():s=Nr(u.A,r).toStringLong();else if(r===void 0&&i!==void 0){let l=u.from(i);s=l.toStringLong(),l===u.A&&(o=it)}else throw new Error("Either coinType, fungibleAssetAddress, or both must be provided");let a=u.from(t).toStringLong(),c={asset_type:{_eq:s}};o!==void 0&&(c={asset_type:{_in:[o,s]}});let p=await Hr({aptosConfig:e,accountAddress:a,options:{where:c}});return p[0]?p[0].amount:0}async function Hr(n){let{aptosConfig:e,accountAddress:t,options:r}=n,i=u.from(t).toStringLong(),o={..._optionalChain([r, 'optionalAccess', _90 => _90.where]),owner_address:{_eq:i}},s={query:to,variables:{where_condition:o,offset:_optionalChain([r, 'optionalAccess', _91 => _91.offset]),limit:_optionalChain([r, 'optionalAccess', _92 => _92.limit]),order_by:_optionalChain([r, 'optionalAccess', _93 => _93.orderBy])}};return(await f({aptosConfig:e,query:s,originMethod:"getAccountCoinsData"})).current_fungible_asset_balances}async function ko(n){let{aptosConfig:e,accountAddress:t}=n,r=u.from(t).toStringLong(),o=await f({aptosConfig:e,query:{query:eo,variables:{address:r}},originMethod:"getAccountCoinsCount"});if(!o.current_fungible_asset_balances_aggregate.aggregate)throw Error("Failed to get the count of account coins");return o.current_fungible_asset_balances_aggregate.aggregate.count}async function Do(n){let{aptosConfig:e,accountAddress:t,options:r}=n,o={owner_address:{_eq:u.from(t).toStringLong()}},s={query:Ln,variables:{where_condition:o,offset:_optionalChain([r, 'optionalAccess', _94 => _94.offset]),limit:_optionalChain([r, 'optionalAccess', _95 => _95.limit]),order_by:_optionalChain([r, 'optionalAccess', _96 => _96.orderBy])}};return(await f({aptosConfig:e,query:s,originMethod:"getAccountOwnedObjects"})).current_objects}async function Bo(n){let{aptosConfig:e,privateKey:t}=n,r=new D(t.publicKey());if(t instanceof nt){let o=q.fromPublicKey({publicKey:r}).derivedAddress();return He.fromPrivateKey({privateKey:t,address:o})}if(t instanceof L){let i=q.fromPublicKey({publicKey:r});if(await _o({authKey:i,aptosConfig:e})){let c=i.derivedAddress();return He.fromPrivateKey({privateKey:t,address:c,legacy:!1})}let s=q.fromPublicKey({publicKey:r.publicKey});if(await _o({authKey:s,aptosConfig:e})){let c=s.derivedAddress();return He.fromPrivateKey({privateKey:t,address:c,legacy:!0})}}throw new Error(`Can't derive account from private key ${t}`)}async function _o(n){let{aptosConfig:e,authKey:t}=n,r=await on({aptosConfig:e,authenticationKey:t.derivedAddress()});try{return await Se({aptosConfig:e,accountAddress:r}),!0}catch(i){if(i.status===404)return!1;throw new Error(`Error while looking for an account info ${r.toString()}`)}}async function Wr(n){let{aptosConfig:e,options:t}=n;return bt({aptosConfig:e,originMethod:"getTransactions",path:"transactions",params:{start:_optionalChain([t, 'optionalAccess', _97 => _97.offset]),limit:_optionalChain([t, 'optionalAccess', _98 => _98.limit])}})}async function Zn(n){let{aptosConfig:e}=n;return Me(async()=>{let{data:t}=await V({aptosConfig:e,originMethod:"getGasPriceEstimation",path:"estimate_gas_price"});return t},`gas-price-${e.network}`,1e3*60*5)()}async function Go(n){let{aptosConfig:e,ledgerVersion:t}=n,{data:r}=await V({aptosConfig:e,originMethod:"getTransactionByVersion",path:`transactions/by_version/${t}`});return r}async function sn(n){let{aptosConfig:e,transactionHash:t}=n,{data:r}=await V({aptosConfig:e,path:`transactions/by_hash/${t}`,originMethod:"getTransactionByHash"});return r}async function Ko(n){let{aptosConfig:e,transactionHash:t}=n;try{return(await sn({aptosConfig:e,transactionHash:t})).type==="pending_transaction"}catch(r){if(_optionalChain([r, 'optionalAccess', _99 => _99.status])===404)return!0;throw r}}async function lc(n){let{aptosConfig:e,transactionHash:t}=n,{data:r}=await V({aptosConfig:e,path:`transactions/wait_by_hash/${t}`,originMethod:"longWaitForTransaction"});return r}async function Kt(n){let{aptosConfig:e,transactionHash:t,options:r}=n,i=_nullishCoalesce(_optionalChain([r, 'optionalAccess', _100 => _100.timeoutSecs]), () => (20)),o=_nullishCoalesce(_optionalChain([r, 'optionalAccess', _101 => _101.checkSuccess]), () => (!0)),s=!0,a=0,c,p,l=200,w=1.5;function S(m){if(!(m instanceof ye)||(p=m,m.status!==404&&m.status>=400&&m.status<500))throw m}try{c=await sn({aptosConfig:e,transactionHash:t}),s=c.type==="pending_transaction"}catch(m){S(m)}if(s){let m=Date.now();try{c=await lc({aptosConfig:e,transactionHash:t}),s=c.type==="pending_transaction"}catch(E){S(E)}a=(Date.now()-m)/1e3}for(;s&&!(a>=i);){try{if(c=await sn({aptosConfig:e,transactionHash:t}),s=c.type==="pending_transaction",!s)break}catch(m){S(m)}await _chunkHBPH2AD3js.b.call(void 0, l),a+=l/1e3,l*=w}if(c===void 0)throw p||new Yn(`Fetching transaction ${t} failed and timed out after ${i} seconds`,c);if(c.type==="pending_transaction")throw new Yn(`Transaction ${t} timed out in pending state after ${i} seconds`,c);if(!o)return c;if(!c.success)throw new Qr(`Transaction ${t} failed with an error: ${c.vm_status}`,c);return c}async function Jn(n){let{aptosConfig:e,processorType:t}=n,r=BigInt(n.minimumLedgerVersion),i=3e3,o=new Date().getTime(),s=BigInt(-1);for(;s<r;){if(new Date().getTime()-o>i)throw new Error("waitForLastSuccessIndexerVersionSync timeout");if(t===void 0?s=await Qn({aptosConfig:e}):s=(await Wn({aptosConfig:e,processorType:t})).last_success_version,s>=r)break;await _chunkHBPH2AD3js.b.call(void 0, 200)}}var Yn=class extends Error{constructor(e,t){super(e),this.lastSubmittedTransaction=t}},Qr=class extends Error{constructor(e,t){super(e),this.transaction=t}};async function No(n){let{aptosConfig:e,ledgerVersion:t,options:r}=n,{data:i}=await V({aptosConfig:e,originMethod:"getBlockByVersion",path:`blocks/by_version/${t}`,params:{with_transactions:_optionalChain([r, 'optionalAccess', _102 => _102.withTransactions])}});return Fo({block:i,...n})}async function Oo(n){let{aptosConfig:e,blockHeight:t,options:r}=n,{data:i}=await V({aptosConfig:e,originMethod:"getBlockByHeight",path:`blocks/by_height/${t}`,params:{with_transactions:_optionalChain([r, 'optionalAccess', _103 => _103.withTransactions])}});return Fo({block:i,...n})}async function Fo(n){let{aptosConfig:e,block:t,options:r}=n;if(_optionalChain([r, 'optionalAccess', _104 => _104.withTransactions])){t.transactions=_nullishCoalesce(t.transactions, () => ([]));let i=t.transactions[t.transactions.length-1],o=BigInt(t.first_version),s=BigInt(t.last_version),a=_optionalChain([i, 'optionalAccess', _105 => _105.version]),c;if(a===void 0?c=o-1n:c=BigInt(a),c===s)return t;let p=[],l=100n;for(let S=c+1n;S<s;S+=BigInt(100))p.push(Wr({aptosConfig:e,options:{offset:S,limit:Math.min(Number(l),Number(s-S+1n))}}));let w=await Promise.all(p);for(let S of w)t.transactions.push(...S)}return t}async function A(n){n.minimumLedgerVersion!==void 0&&await Jn({aptosConfig:n.config,minimumLedgerVersion:n.minimumLedgerVersion,processorType:n.processorType})}function Mo(n){return typeof n=="boolean"}function We(n){return typeof n=="string"}function gc(n){return typeof n=="number"}function er(n){if(gc(n))return n;if(We(n)&&n!=="")return Number.parseInt(n,10)}function tr(n){return typeof n=="number"||typeof n=="bigint"||typeof n=="string"}function qo(n){return n==null}function Vo(n){return jr(n)||Yr(n)||Zr(n)||Jr(n)||ei(n)||ti(n)||ni(n)||nr(n)||Xr(n)||mc(n)||n instanceof T||n instanceof M}function jr(n){return n instanceof I}function nr(n){return n instanceof u}function Xr(n){return n instanceof b}function mc(n){return n instanceof Je}function Yr(n){return n instanceof F}function Zr(n){return n instanceof de}function Jr(n){return n instanceof le}function ei(n){return n instanceof O}function ti(n){return n instanceof ge}function ni(n){return n instanceof me}function $o(n){return"bytecode"in n}function U(n,e){throw new Error(`Type mismatch for argument ${e}, expected '${n}'`)}function Lo(n){let e=n.params.findIndex(t=>t!=="signer"&&t!=="&signer");return e<0?n.params.length:e}function an(n){let e=n.split("::");if(e.length!==3)throw new Error(`Invalid function ${n}`);let t=e[0],r=e[1],i=e[2];return{moduleAddress:t,moduleName:r,functionName:i}}function Ho(n){return!!n.match(/^[_a-zA-Z0-9]+$/)}function Qo(n){return!!n.match(/\s/)}function yc(n){return!!n.match(/^T[0-9]+$/)}function fc(n){return!!n.match(/^&.+$/)}function Ac(n){switch(n){case"signer":case"address":case"bool":case"u8":case"u16":case"u32":case"u64":case"u128":case"u256":return!0;default:return!1}}function hc(n,e){let t=e;for(;t<n.length;t+=1){let r=n[t];if(!Qo(r))break}return t}var Tc=(E=>(E.InvalidTypeTag="unknown type",E.UnexpectedGenericType="unexpected generic type",E.UnexpectedTypeArgumentClose="unexpected '>'",E.UnexpectedWhitespaceCharacter="unexpected whitespace character",E.UnexpectedComma="unexpected ','",E.TypeArgumentCountMismatch="type argument count doesn't match expected amount",E.MissingTypeArgumentClose="no matching '>' for '<'",E.MissingTypeArgument="no type argument before ','",E.UnexpectedPrimitiveTypeArguments="primitive types not expected to have type arguments",E.UnexpectedVectorTypeArgumentCount="vector type expected to have exactly one type argument",E.UnexpectedStructFormat="unexpected struct format, must be of the form 0xaddress::module_name::struct_name",E.InvalidModuleNameCharacter="module name must only contain alphanumeric or '_' characters",E.InvalidStructNameCharacter="struct name must only contain alphanumeric or '_' characters",E.InvalidAddress="struct address must be valid",E))(Tc||{}),N= exports.TypeTagParserError =class extends Error{constructor(e,t){super(`Failed to parse typeTag '${e}', ${t}`)}};function ke(n,e){let t=_nullishCoalesce(_optionalChain([e, 'optionalAccess', _106 => _106.allowGenerics]), () => (!1)),r=[],i=[],o=[],s=0,a="",c=1;for(;s<n.length;){let p=n[s];if(p==="<")r.push({savedExpectedTypes:c,savedStr:a,savedTypes:o}),a="",o=[],c=1;else if(p===">"){if(a!==""){let E=cn(a,i,t);o.push(E)}let l=r.pop();if(l===void 0)throw new N(n,"unexpected '>'");if(c!==o.length)throw new N(n,"type argument count doesn't match expected amount");let{savedStr:w,savedTypes:S,savedExpectedTypes:m}=l;i=o,o=S,a=w,c=m}else if(p===","){if(r.length===0)throw new N(n,"unexpected ','");if(a.length===0)throw new N(n,"no type argument before ','");let l=cn(a,i,t);i=[],o.push(l),a="",c+=1}else if(Qo(p)){let l=!1;if(a.length!==0){let S=cn(a,i,t);i=[],o.push(S),a="",l=!0}s=hc(n,s);let w=n[s];if(s<n.length&&l&&w!==","&&w!==">")throw new N(n,"unexpected whitespace character");continue}else a+=p;s+=1}if(r.length>0)throw new N(n,"no matching '>' for '<'");switch(o.length){case 0:return cn(a,i,t);case 1:if(a==="")return o[0];throw new N(n,"unexpected ','");default:throw new N(n,"unexpected whitespace character")}}function cn(n,e,t){let r=n.trim(),i=r.toLowerCase();if(Ac(i)&&e.length>0)throw new N(n,"primitive types not expected to have type arguments");switch(r.toLowerCase()){case"signer":return new Pt;case"bool":return new K;case"address":return new W;case"u8":return new ce;case"u16":return new qe;case"u32":return new Ve;case"u64":return new $;case"u128":return new $e;case"u256":return new Le;case"vector":if(e.length!==1)throw new N(n,"vector type expected to have exactly one type argument");return new C(e[0]);default:if(fc(r)){let a=r.substring(1);return new Nn(cn(a,e,t))}if(yc(r)){if(t)return new k(Number(r.split("T")[1]));throw new N(n,"unexpected generic type")}if(!r.match(/:/))throw new N(n,"unknown type");let o=r.split("::");if(o.length!==3)throw new N(n,"unexpected struct format, must be of the form 0xaddress::module_name::struct_name");let s;try{s=u.fromString(o[0])}catch (e2){throw new N(n,"struct address must be valid")}if(!Ho(o[1]))throw new N(n,"module name must only contain alphanumeric or '_' characters");if(!Ho(o[2]))throw new N(n,"struct name must only contain alphanumeric or '_' characters");return new y(new Re(s,new R(o[1]),new R(o[2]),e))}}var bc=new TextEncoder;function rr(n){return _nullishCoalesce(_optionalChain([n, 'optionalAccess', _107 => _107.map, 'call', _108 => _108(e=>We(e)?ke(e):e)]), () => ([]))}async function Wo(n,e,t,r){let i=await Xn({aptosConfig:r,accountAddress:n,moduleName:e});if(i.abi)return i.abi.exposed_functions.find(o=>o.name===t)}async function jo(n,e,t,r){let i=await Wo(n,e,t,r);if(!i)throw new Error(`Could not find entry function ABI for '${n}::${e}::${t}'`);if(!i.is_entry)throw new Error(`'${n}::${e}::${t}' is not an entry function`);let o=Lo(i),s=[];for(let a=o;a<i.params.length;a+=1)s.push(ke(i.params[a],{allowGenerics:!0}));return{signers:o,typeParameters:i.generic_type_params,parameters:s}}async function Xo(n,e,t,r){let i=await Wo(n,e,t,r);if(!i)throw new Error(`Could not find view function ABI for '${n}::${e}::${t}'`);if(!i.is_view)throw new Error(`'${n}::${e}::${t}' is not an view function`);let o=[];for(let a=0;a<i.params.length;a+=1)o.push(ke(i.params[a],{allowGenerics:!0}));let s=[];for(let a=0;a<i.return.length;a+=1)s.push(ke(i.return[a],{allowGenerics:!0}));return{typeParameters:i.generic_type_params,parameters:o,returnTypes:s}}function ii(n,e,t,r,i){if(r>=e.parameters.length)throw new Error(`Too many arguments for '${n}', expected ${e.parameters.length}`);let o=e.parameters[r];return Nt(t,o,r,i)}function Nt(n,e,t,r){return Vo(n)?(ri(e,n,t),n):wc(n,e,t,r)}function wc(n,e,t,r){if(e.isBool()){if(Mo(n))return new I(n);if(We(n)){if(n==="true")return new I(!0);if(n==="false")return new I(!1)}U("boolean",t)}if(e.isAddress()){if(We(n))return u.fromString(n);U("string | AccountAddress",t)}if(e.isU8()){let i=er(n);if(i!==void 0)return new F(i);U("number | string",t)}if(e.isU16()){let i=er(n);if(i!==void 0)return new de(i);U("number | string",t)}if(e.isU32()){let i=er(n);if(i!==void 0)return new le(i);U("number | string",t)}if(e.isU64()){if(tr(n))return new O(BigInt(n));U("bigint | number | string",t)}if(e.isU128()){if(tr(n))return new ge(BigInt(n));U("bigint | number | string",t)}if(e.isU256()){if(tr(n))return new me(BigInt(n));U("bigint | number | string",t)}if(e.isGeneric()){let i=e.value;if(i<0||i>=r.length)throw new Error(`Generic argument ${e.toString()} is invalid for argument ${t}`);return Nt(n,r[i],t,r)}if(e.isVector()){if(e.value.isU8()){if(We(n))return T.U8(bc.encode(n));if(n instanceof Uint8Array)return T.U8(n);if(n instanceof ArrayBuffer)return T.U8(new Uint8Array(n))}if(Array.isArray(n))return new T(n.map(i=>Nt(i,e.value,t,r)));throw new Error(`Type mismatch for argument ${t}, type '${e.toString()}'`)}if(e.isStruct()){if(e.isString()){if(We(n))return new b(n);U("string",t)}if(e.isObject()){if(We(n))return u.fromString(n);U("string | AccountAddress",t)}if(e.isOption()){if(qo(n)){let i=e.value.typeArgs[0];return i instanceof K?new M(null):i instanceof W?new M(null):i instanceof ce?new M(null):i instanceof qe?new M(null):i instanceof Ve?new M(null):i instanceof $?new M(null):i instanceof $e?new M(null):i instanceof Le?new M(null):new M(null)}return new M(Nt(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 ri(n,e,t){if(n.isBool()){if(jr(e))return;U("Bool",t)}if(n.isAddress()){if(nr(e))return;U("AccountAddress",t)}if(n.isU8()){if(Yr(e))return;U("U8",t)}if(n.isU16()){if(Zr(e))return;U("U16",t)}if(n.isU32()){if(Jr(e))return;U("U32",t)}if(n.isU64()){if(ei(e))return;U("U64",t)}if(n.isU128()){if(ti(e))return;U("U128",t)}if(n.isU256()){if(ni(e))return;U("U256",t)}if(n.isVector()){if(e instanceof T){e.values.length>0&&ri(n.value,e.values[0],t);return}U("MoveVector",t)}if(n instanceof y){if(n.isString()){if(Xr(e))return;U("MoveString",t)}if(n.isObject()){if(nr(e))return;U("AccountAddress",t)}if(n.isOption()){if(e instanceof M){e.value!==void 0&&ri(n.value.typeArgs[0],e.value,t);return}U("MoveOption",t)}}throw new Error(`Type mismatch for argument ${t}, expected '${n.toString()}'`)}async function or(n){if($o(n))return vc(n);let{moduleAddress:e,moduleName:t,functionName:r}=an(n.function),i=await es({key:"entry-function",moduleAddress:e,moduleName:t,functionName:r,aptosConfig:n.aptosConfig,abi:n.abi,fetch:jo});return _c({...n,abi:i})}function _c(n){let e=n.abi,{moduleAddress:t,moduleName:r,functionName:i}=an(n.function),o=rr(n.typeArguments);if(o.length!==e.typeParameters.length)throw new Error(`Type argument count mismatch, expected ${e.typeParameters.length}, received ${o.length}`);let s=n.functionArguments.map((c,p)=>ii(n.function,e,c,p,o));if(s.length!==e.parameters.length)throw new Error(`Too few arguments for '${t}::${r}::${i}', expected ${e.parameters.length} but got ${s.length}`);let a=ut.build(`${t}::${r}`,i,o,s);if("multisigAddress"in n){let c=u.from(n.multisigAddress);return new Jt(new tn(c,new nn(a)))}return new Zt(a)}async function Yo(n){let{moduleAddress:e,moduleName:t,functionName:r}=an(n.function),i=await es({key:"view-function",moduleAddress:e,moduleName:t,functionName:r,aptosConfig:n.aptosConfig,abi:n.abi,fetch:Xo});return xc({abi:i,...n})}function xc(n){let e=n.abi,{moduleAddress:t,moduleName:r,functionName:i}=an(n.function),o=rr(n.typeArguments);if(o.length!==e.typeParameters.length)throw new Error(`Type argument count mismatch, expected ${e.typeParameters.length}, received ${o.length}`);let s=_nullishCoalesce(_optionalChain([n, 'optionalAccess', _109 => _109.functionArguments, 'optionalAccess', _110 => _110.map, 'call', _111 => _111((a,c)=>ii(n.function,e,a,c,o))]), () => ([]));if(s.length!==e.parameters.length)throw new Error(`Too few arguments for '${t}::${r}::${i}', expected ${e.parameters.length} but got ${s.length}`);return ut.build(`${t}::${r}`,i,o,s)}function vc(n){return new Yt(new en(g.fromHexInput(n.bytecode).toUint8Array(),rr(n.typeArguments),n.functionArguments))}async function Pc(n){let{aptosConfig:e,sender:t,payload:r,options:i,feePayerAddress:o}=n,s=async()=>kr[e.network]?{chainId:kr[e.network]}:{chainId:(await Hn({aptosConfig:e})).chain_id},a=async()=>_optionalChain([i, 'optionalAccess', _112 => _112.gasUnitPrice])?{gasEstimate:i.gasUnitPrice}:{gasEstimate:(await Zn({aptosConfig:e})).gas_estimate},c=async()=>{let gt=async()=>_optionalChain([i, 'optionalAccess', _113 => _113.accountSequenceNumber])!==void 0?i.accountSequenceNumber:(await Se({aptosConfig:e,accountAddress:t})).sequence_number;if(o&&u.from(o).equals(u.ZERO))try{return await gt()}catch (e3){return 0}else return gt()},[{chainId:p},{gasEstimate:l},w]=await Promise.all([s(),a(),c()]),{maxGasAmount:S,gasUnitPrice:m,expireTimestamp:E}={maxGasAmount:_optionalChain([i, 'optionalAccess', _114 => _114.maxGasAmount])?BigInt(i.maxGasAmount):BigInt(2e5),gasUnitPrice:_nullishCoalesce(_optionalChain([i, 'optionalAccess', _115 => _115.gasUnitPrice]), () => (BigInt(l))),expireTimestamp:_nullishCoalesce(_optionalChain([i, 'optionalAccess', _116 => _116.expireTimestamp]), () => (BigInt(Math.floor(Date.now()/1e3)+20)))};return new ue(u.from(t),BigInt(w),r,BigInt(S),BigInt(m),BigInt(E),new vt(p))}async function oi(n){let{aptosConfig:e,sender:t,payload:r,options:i,feePayerAddress:o}=n,s=await Pc({aptosConfig:e,sender:t,payload:r,options:i,feePayerAddress:o});if("secondarySignerAddresses"in n){let a=_nullishCoalesce(_optionalChain([n, 'access', _117 => _117.secondarySignerAddresses, 'optionalAccess', _118 => _118.map, 'call', _119 => _119(c=>u.from(c))]), () => ([]));return new qn(s,a,n.feePayerAddress?u.from(n.feePayerAddress):void 0)}return new Mn(s,n.feePayerAddress?u.from(n.feePayerAddress):void 0)}function Zo(n){let{signerPublicKey:e,transaction:t,secondarySignersPublicKeys:r,feePayerPublicKey:i}=n,o=ir(e);if(t.feePayerAddress){let a=new dt(t.rawTransaction,_nullishCoalesce(t.secondarySignerAddresses, () => ([])),t.feePayerAddress),c=[];r&&(c=r.map(w=>ir(w)));let p=ir(i),l=new It(o,_nullishCoalesce(t.secondarySignerAddresses, () => ([])),c,{address:t.feePayerAddress,authenticator:p});return new lt(a.raw_txn,l).bcsToBytes()}if(t.secondarySignerAddresses){let a=new pt(t.rawTransaction,t.secondarySignerAddresses),c=[];c=r.map(l=>ir(l));let p=new Et(o,t.secondarySignerAddresses,c);return new lt(a.raw_txn,p).bcsToBytes()}let s;if(o instanceof fe)s=new Ct(o.public_key,o.signature);else if(o instanceof Q)s=new Ut(o);else throw new Error("Invalid public key");return new lt(t.rawTransaction,s).bcsToBytes()}function ir(n){let e=new P(new Uint8Array(64));if(x.isInstance(n))return new fe(n,e);if(D.isInstance(n))return te.isInstance(n.publicKey)?new Q(n,new G(Ie.getSimulationSignature())):new Q(n,new G(e));if(te.isInstance(n)||Pe.isInstance(n))return console.warn("Expected AccountPublicKey, but got PublicKey. Please wrap your public key with AnyPublicKey."),new Q(new D(n),new G(e));throw new Error("Unsupported public key")}function si(n){let{transaction:e,feePayerAuthenticator:t,additionalSignersAuthenticators:r}=n,i=Hi(H,n.senderAuthenticator),o;if(e.feePayerAddress){if(!t)throw new Error("Must provide a feePayerAuthenticator argument to generate a signed fee payer transaction");o=new It(i,_nullishCoalesce(e.secondarySignerAddresses, () => ([])),_nullishCoalesce(r, () => ([])),{address:e.feePayerAddress,authenticator:t})}else if(e.secondarySignerAddresses){if(!r)throw new Error("Must provide a additionalSignersAuthenticators argument to generate a signed multi agent transaction");o=new Et(i,e.secondarySignerAddresses,r)}else i instanceof fe?o=new Ct(i.public_key,i.signature):o=new Ut(i);return new lt(e.rawTransaction,o).bcsToBytes()}function Jo(n){let e=_sha3.sha3_256.create();for(let t of n)e.update(t);return e.digest()}var Cc=Jo(["APTOS::Transaction"]);function ch(n){let e=si(n);return new g(Jo([Cc,new Uint8Array([0]),e])).toString()}async function es({key:n,moduleAddress:e,moduleName:t,functionName:r,aptosConfig:i,abi:o,fetch:s}){return o!==void 0?o:Me(async()=>s(e,t,r,i),`${n}-${i.network}-${e}-${t}-${r}`,1e3*60*5)()}async function _e(n){let{aptosConfig:e,payload:t,options:r}=n,i=await Yo({...t,aptosConfig:e}),o=new J;i.serialize(o);let s=o.toUint8Array(),{data:a}=await Fe({aptosConfig:e,path:"view",originMethod:"view",contentType:"application/x.aptos.view_function+bcs",params:{ledger_version:_optionalChain([r, 'optionalAccess', _120 => _120.ledgerVersion])},body:s});return a}async function ts(n){let{aptosConfig:e,payload:t,options:r}=n,{data:i}=await Fe({aptosConfig:e,originMethod:"viewJson",path:"view",params:{ledger_version:_optionalChain([r, 'optionalAccess', _121 => _121.ledgerVersion])},body:{function:t.function,type_arguments:_nullishCoalesce(t.typeArguments, () => ([])),arguments:_nullishCoalesce(t.functionArguments, () => ([]))}});return i}var un=class{constructor(e){this.config=e}async getAccountInfo(e){return Se({aptosConfig:this.config,...e})}async getAccountModules(e){return xo({aptosConfig:this.config,...e})}async getAccountModule(e){return Xn({aptosConfig:this.config,...e})}async getAccountTransactions(e){return vo({aptosConfig:this.config,...e})}async getAccountResources(e){return Po({aptosConfig:this.config,...e})}async getAccountResource(e){return Lr({aptosConfig:this.config,...e})}async lookupOriginalAccountAddress(e){return on({aptosConfig:this.config,...e})}async getAccountTokensCount(e){return await A({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"account_transactions_processor"}),Co({aptosConfig:this.config,...e})}async getAccountOwnedTokens(e){return await A({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),Eo({aptosConfig:this.config,...e})}async getAccountOwnedTokensFromCollectionAddress(e){return await A({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),Io({aptosConfig:this.config,...e})}async getAccountCollectionsWithOwnedTokens(e){return await A({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),Uo({aptosConfig:this.config,...e})}async getAccountTransactionsCount(e){return await A({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"account_transactions_processor"}),Ro({aptosConfig:this.config,...e})}async getAccountCoinsData(e){return await A({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"fungible_asset_processor"}),Hr({aptosConfig:this.config,...e})}async getAccountCoinsCount(e){return await A({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"fungible_asset_processor"}),ko({aptosConfig:this.config,...e})}async getAccountAPTAmount(e){return this.getAccountCoinAmount({coinType:it,faMetadataAddress:Fi,...e})}async getAccountCoinAmount(e){let{coinType:t,faMetadataAddress:r}=e;await A({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"fungible_asset_processor"});let i=t;if(t===void 0&&r!==void 0)try{let o=(await _e({aptosConfig:this.config,payload:{function:"0x1::coin::paired_coin",functionArguments:[r]}})).at(0);o.vec.length>0&&_chunkHBPH2AD3js.i.call(void 0, o.vec[0])&&(i=_chunkHBPH2AD3js.h.call(void 0, o.vec[0]))}catch (e4){}return zo({aptosConfig:this.config,...e,coinType:i})}async getAccountOwnedObjects(e){return await A({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"default_processor"}),Do({aptosConfig:this.config,...e})}async deriveAccountFromPrivateKey(e){return Bo({aptosConfig:this.config,...e})}};var _aptosclient = require('@aptos-labs/aptos-client'); var _aptosclient2 = _interopRequireDefault(_aptosclient);var sr=class{constructor(e){this.network=_nullishCoalesce(_optionalChain([e, 'optionalAccess', _122 => _122.network]), () => ("devnet")),this.fullnode=_optionalChain([e, 'optionalAccess', _123 => _123.fullnode]),this.faucet=_optionalChain([e, 'optionalAccess', _124 => _124.faucet]),this.pepper=_optionalChain([e, 'optionalAccess', _125 => _125.pepper]),this.prover=_optionalChain([e, 'optionalAccess', _126 => _126.prover]),this.indexer=_optionalChain([e, 'optionalAccess', _127 => _127.indexer]),this.client=_nullishCoalesce(_optionalChain([e, 'optionalAccess', _128 => _128.client]), () => ({provider:_aptosclient2.default})),this.clientConfig=_nullishCoalesce(_optionalChain([e, 'optionalAccess', _129 => _129.clientConfig]), () => ({})),this.fullnodeConfig=_nullishCoalesce(_optionalChain([e, 'optionalAccess', _130 => _130.fullnodeConfig]), () => ({})),this.indexerConfig=_nullishCoalesce(_optionalChain([e, 'optionalAccess', _131 => _131.indexerConfig]), () => ({})),this.faucetConfig=_nullishCoalesce(_optionalChain([e, 'optionalAccess', _132 => _132.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 $i[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 Li[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 Vi[this.network];case"Pepper":if(this.pepper!==void 0)return this.pepper;if(this.network==="custom")throw new Error("Please provide a custom pepper service url");return Ur[this.network];case"Prover":if(this.prover!==void 0)return this.prover;if(this.network==="custom")throw new Error("Please provide a custom prover service url");return Rr[this.network];default:throw Error(`apiType ${e} is not supported`)}}isPepperServiceRequest(e){return Ur[this.network]===e}isProverServiceRequest(e){return Rr[this.network]===e}};async function h(n){let e=await Ic(n);return Uc(n,e)}async function Ic(n){let{aptosConfig:e,data:t}=n,r,i;return"bytecode"in t?i=await or(t):"multisigAddress"in t?(r={aptosConfig:e,multisigAddress:t.multisigAddress,function:t.function,functionArguments:t.functionArguments,typeArguments:t.typeArguments,abi:t.abi},i=await or(r)):(r={aptosConfig:e,function:t.function,functionArguments:t.functionArguments,typeArguments:t.typeArguments,abi:t.abi},i=await or(r)),i}async function Uc(n,e){let{aptosConfig:t,sender:r,options:i}=n,o;if(Rc(n)&&(o=u.ZERO.toString()),zc(n)){let{secondarySignerAddresses:s}=n;return oi({aptosConfig:t,sender:r,payload:e,options:i,secondarySignerAddresses:s,feePayerAddress:o})}return oi({aptosConfig:t,sender:r,payload:e,options:i,feePayerAddress:o})}function Rc(n){return n.withFeePayer===!0}function zc(n){return"secondarySignerAddresses"in n}function ns(n){let{transaction:e}=n;return zt(e)}function ar(n){let{signer:e,transaction:t}=n;return e.signTransactionWithAuthenticator(t)}async function ai(n){let{aptosConfig:e,transaction:t,signerPublicKey:r,secondarySignersPublicKeys:i,feePayerPublicKey:o,options:s}=n,a=Zo({transaction:t,signerPublicKey:r,secondarySignersPublicKeys:i,feePayerPublicKey:o,options:s}),{data:c}=await Fe({aptosConfig:e,body:a,path:"transactions/simulate",params:{estimate_gas_unit_price:_nullishCoalesce(_optionalChain([n, 'access', _133 => _133.options, 'optionalAccess', _134 => _134.estimateGasUnitPrice]), () => (!1)),estimate_max_gas_amount:_nullishCoalesce(_optionalChain([n, 'access', _135 => _135.options, 'optionalAccess', _136 => _136.estimateMaxGasAmount]), () => (!1)),estimate_prioritized_gas_unit_price:_nullishCoalesce(_optionalChain([n, 'access', _137 => _137.options, 'optionalAccess', _138 => _138.estimatePrioritizedGasUnitPrice]), () => (!1))},originMethod:"simulateTransaction",contentType:"application/x.aptos.signed_transaction+bcs"});return c}async function cr(n){let{aptosConfig:e}=n,t=si({...n}),{data:r}=await Fe({aptosConfig:e,body:t,path:"transactions",originMethod:"submitTransaction",contentType:"application/x.aptos.signed_transaction+bcs"});return r}async function pn(n){let{aptosConfig:e,signer:t,transaction:r}=n;(t instanceof we||t instanceof Vn)&&await t.waitForProofFetch();let i=ar({signer:t,transaction:r});return cr({aptosConfig:e,transaction:r,senderAuthenticator:i})}var kc={typeParameters:[],parameters:[C.u8(),new C(C.u8())]};async function rs(n){let{aptosConfig:e,account:t,metadataBytes:r,moduleBytecode:i,options:o}=n,s=i.map(a=>T.U8(a));return h({aptosConfig:e,sender:u.from(t),data:{function:"0x1::code::publish_package_txn",functionArguments:[T.U8(r),new T(s)],abi:kc},options:o})}var Dc={typeParameters:[],parameters:[new ce,C.u8(),new ce,C.u8(),C.u8(),C.u8()]};async function is(n){let{aptosConfig:e,fromAccount:t,toNewPrivateKey:r}=n,i=await Se({aptosConfig:e,accountAddress:t.accountAddress}),o=He.fromPrivateKey({privateKey:r,legacy:!0}),a=new Fn({sequenceNumber:BigInt(i.sequence_number),originator:t.accountAddress,currentAuthKey:u.from(i.authentication_key),newPublicKey:o.publicKey}).bcsToBytes(),c=t.sign(a),p=o.sign(a),l=await h({aptosConfig:e,sender:t.accountAddress,data:{function:"0x1::account::rotate_authentication_key",functionArguments:[new F(t.signingScheme),T.U8(t.publicKey.toUint8Array()),new F(o.signingScheme),T.U8(o.publicKey.toUint8Array()),T.U8(c.toUint8Array()),T.U8(p.toUint8Array())],abi:Dc}});return pn({aptosConfig:e,signer:t,transaction:l})}var Bc={typeParameters:[{constraints:[]}],parameters:[new W,new $]};async function os(n){let{aptosConfig:e,sender:t,recipient:r,amount:i,coinType:o,options:s}=n;return h({aptosConfig:e,sender:t,data:{function:"0x1::aptos_account::transfer_coins",typeArguments:[_nullishCoalesce(o, () => (it))],functionArguments:[r,i],abi:Bc},options:s})}var dn=class{constructor(e){this.config=e}async transferCoinTransaction(e){return os({aptosConfig:this.config,...e})}};var je={BOOLEAN:"bool",U8:"u8",U16:"u16",U32:"u32",U64:"u64",U128:"u128",U256:"u256",ADDRESS:"address",STRING:"0x1::string::String",ARRAY:"vector<u8>"},pe="0x4::token::Token";async function ss(n){let{aptosConfig:e,digitalAssetAddress:t}=n,r={token_data_id:{_eq:u.from(t).toStringLong()}};return(await f({aptosConfig:e,query:{query:ho,variables:{where_condition:r}},originMethod:"getDigitalAssetData"})).current_token_datas_v2[0]}async function as(n){let{aptosConfig:e,digitalAssetAddress:t}=n,r={token_data_id:{_eq:u.from(t).toStringLong()},amount:{_gt:0}};return(await f({aptosConfig:e,query:{query:$r,variables:{where_condition:r}},originMethod:"getCurrentDigitalAssetOwnership"})).current_token_ownerships_v2[0]}async function cs(n){let{aptosConfig:e,ownerAddress:t,options:r}=n,i={owner_address:{_eq:u.from(t).toStringLong()},amount:{_gt:0}},o={query:$r,variables:{where_condition:i,offset:_optionalChain([r, 'optionalAccess', _139 => _139.offset]),limit:_optionalChain([r, 'optionalAccess', _140 => _140.limit]),order_by:_optionalChain([r, 'optionalAccess', _141 => _141.orderBy])}};return(await f({aptosConfig:e,query:o,originMethod:"getOwnedDigitalAssets"})).current_token_ownerships_v2}async function us(n){let{aptosConfig:e,digitalAssetAddress:t,options:r}=n,i={token_data_id:{_eq:u.from(t).toStringLong()}},o={query:Ao,variables:{where_condition:i,offset:_optionalChain([r, 'optionalAccess', _142 => _142.offset]),limit:_optionalChain([r, 'optionalAccess', _143 => _143.limit]),order_by:_optionalChain([r, 'optionalAccess', _144 => _144.orderBy])}};return(await f({aptosConfig:e,query:o,originMethod:"getDigitalAssetActivity"})).token_activities_v2}var Gc={typeParameters:[],parameters:[new y(v()),new $,new y(v()),new y(v()),new K,new K,new K,new K,new K,new K,new K,new K,new K,new $,new $]};async function ps(n){let{aptosConfig:e,options:t,creator:r}=n;return h({aptosConfig:e,sender:r.accountAddress,data:{function:"0x4::aptos_token::create_collection",functionArguments:[new b(n.description),new O(_nullishCoalesce(n.maxSupply, () => (Ye))),new b(n.name),new b(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 O(_nullishCoalesce(n.royaltyNumerator, () => (0))),new O(_nullishCoalesce(n.royaltyDenominator, () => (1)))],abi:Gc},options:t})}async function Ot(n){let{aptosConfig:e,options:t}=n,r=_optionalChain([t, 'optionalAccess', _145 => _145.where]);_optionalChain([t, 'optionalAccess', _146 => _146.tokenStandard])&&(r.token_standard={_eq:_nullishCoalesce(_optionalChain([t, 'optionalAccess', _147 => _147.tokenStandard]), () => ("v2"))});let i={query:co,variables:{where_condition:r,offset:_optionalChain([t, 'optionalAccess', _148 => _148.offset]),limit:_optionalChain([t, 'optionalAccess', _149 => _149.limit])}};return(await f({aptosConfig:e,query:i,originMethod:"getCollectionData"})).current_collections_v2[0]}async function ds(n){let{aptosConfig:e,creatorAddress:t,collectionName:r,options:i}=n,o=u.from(t),s={collection_name:{_eq:r},creator_address:{_eq:o.toStringLong()}};return _optionalChain([i, 'optionalAccess', _150 => _150.tokenStandard])&&(s.token_standard={_eq:_nullishCoalesce(_optionalChain([i, 'optionalAccess', _151 => _151.tokenStandard]), () => ("v2"))}),Ot({aptosConfig:e,options:{...i,where:s}})}async function ls(n){let{aptosConfig:e,creatorAddress:t,options:r}=n,o={creator_address:{_eq:u.from(t).toStringLong()}};return _optionalChain([r, 'optionalAccess', _152 => _152.tokenStandard])&&(o.token_standard={_eq:_nullishCoalesce(_optionalChain([r, 'optionalAccess', _153 => _153.tokenStandard]), () => ("v2"))}),Ot({aptosConfig:e,options:{...r,where:o}})}async function gs(n){let{aptosConfig:e,collectionId:t,options:r}=n,o={collection_id:{_eq:u.from(t).toStringLong()}};return _optionalChain([r, 'optionalAccess', _154 => _154.tokenStandard])&&(o.token_standard={_eq:_nullishCoalesce(_optionalChain([r, 'optionalAccess', _155 => _155.tokenStandard]), () => ("v2"))}),Ot({aptosConfig:e,options:{...r,where:o}})}async function ms(n){let{creatorAddress:e,collectionName:t,options:r,aptosConfig:i}=n,o=u.from(e),s={collection_name:{_eq:t},creator_address:{_eq:o.toStringLong()}};return _optionalChain([r, 'optionalAccess', _156 => _156.tokenStandard])&&(s.token_standard={_eq:_nullishCoalesce(_optionalChain([r, 'optionalAccess', _157 => _157.tokenStandard]), () => ("v2"))}),(await Ot({aptosConfig:i,options:{where:s}})).collection_id}var Kc={typeParameters:[],parameters:[new y(v()),new y(v()),new y(v()),new y(v()),new C(new y(v())),new C(new y(v())),new C(C.u8())]};async function ys(n){let{aptosConfig:e,options:t,creator:r,collection:i,description:o,name:s,uri:a,propertyKeys:c,propertyTypes:p,propertyValues:l}=n,w=_optionalChain([p, 'optionalAccess', _158 => _158.map, 'call', _159 => _159(S=>je[S])]);return h({aptosConfig:e,sender:r.accountAddress,data:{function:"0x4::aptos_token::mint",functionArguments:[new b(i),new b(o),new b(s),new b(a),T.MoveString(_nullishCoalesce(c, () => ([]))),T.MoveString(_nullishCoalesce(w, () => ([]))),Is(_nullishCoalesce(l, () => ([])),_nullishCoalesce(w, () => ([])))],abi:Kc},options:t})}var Nc={typeParameters:[{constraints:["key"]}],parameters:[new y(re(new k(0))),new W]};async function fs(n){let{aptosConfig:e,sender:t,digitalAssetAddress:r,recipient:i,digitalAssetType:o,options:s}=n;return h({aptosConfig:e,sender:t.accountAddress,data:{function:"0x1::object::transfer",typeArguments:[_nullishCoalesce(o, () => (pe))],functionArguments:[u.from(r),u.from(i)],abi:Nc},options:s})}var Oc={typeParameters:[],parameters:[new y(v()),new y(v()),new y(v()),new y(v()),new C(new y(v())),new C(new y(v())),new C(C.u8()),new W]};async function As(n){let{aptosConfig:e,account:t,collection:r,description:i,name:o,uri:s,recipient:a,propertyKeys:c,propertyTypes:p,propertyValues:l,options:w}=n;if(_optionalChain([c, 'optionalAccess', _160 => _160.length])!==_optionalChain([l, 'optionalAccess', _161 => _161.length]))throw new Error("Property keys and property values counts do not match");if(_optionalChain([p, 'optionalAccess', _162 => _162.length])!==_optionalChain([l, 'optionalAccess', _163 => _163.length]))throw new Error("Property types and property values counts do not match");let S=_optionalChain([p, 'optionalAccess', _164 => _164.map, 'call', _165 => _165(m=>je[m])]);return h({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::mint_soul_bound",functionArguments:[r,i,o,s,T.MoveString(_nullishCoalesce(c, () => ([]))),T.MoveString(_nullishCoalesce(S, () => ([]))),Is(_nullishCoalesce(l, () => ([])),_nullishCoalesce(S, () => ([]))),a],abi:Oc},options:w})}var Fc={typeParameters:[{constraints:["key"]}],parameters:[new y(re(new k(0)))]};async function hs(n){let{aptosConfig:e,creator:t,digitalAssetAddress:r,digitalAssetType:i,options:o}=n;return h({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::burn",typeArguments:[_nullishCoalesce(i, () => (pe))],functionArguments:[u.from(r)],abi:Fc},options:o})}var Mc={typeParameters:[{constraints:["key"]}],parameters:[new y(re(new k(0)))]};async function Ts(n){let{aptosConfig:e,creator:t,digitalAssetAddress:r,digitalAssetType:i,options:o}=n;return h({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::freeze_transfer",typeArguments:[_nullishCoalesce(i, () => (pe))],functionArguments:[r],abi:Mc},options:o})}var qc={typeParameters:[{constraints:["key"]}],parameters:[new y(re(new k(0)))]};async function bs(n){let{aptosConfig:e,creator:t,digitalAssetAddress:r,digitalAssetType:i,options:o}=n;return h({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::unfreeze_transfer",typeArguments:[_nullishCoalesce(i, () => (pe))],functionArguments:[r],abi:qc},options:o})}var Vc={typeParameters:[{constraints:["key"]}],parameters:[new y(re(new k(0))),new y(v())]};async function ws(n){let{aptosConfig:e,creator:t,description:r,digitalAssetAddress:i,digitalAssetType:o,options:s}=n;return h({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::set_description",typeArguments:[_nullishCoalesce(o, () => (pe))],functionArguments:[u.from(i),new b(r)],abi:Vc},options:s})}var $c={typeParameters:[{constraints:["key"]}],parameters:[new y(re(new k(0))),new y(v())]};async function Ss(n){let{aptosConfig:e,creator:t,name:r,digitalAssetAddress:i,digitalAssetType:o,options:s}=n;return h({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::set_name",typeArguments:[_nullishCoalesce(o, () => (pe))],functionArguments:[u.from(i),new b(r)],abi:$c},options:s})}var Lc={typeParameters:[{constraints:["key"]}],parameters:[new y(re(new k(0))),new y(v())]};async function _s(n){let{aptosConfig:e,creator:t,uri:r,digitalAssetAddress:i,digitalAssetType:o,options:s}=n;return h({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::set_uri",typeArguments:[_nullishCoalesce(o, () => (pe))],functionArguments:[u.from(i),new b(r)],abi:Lc},options:s})}var Hc={typeParameters:[{constraints:["key"]}],parameters:[new y(re(new k(0))),new y(v()),new y(v()),C.u8()]};async function xs(n){let{aptosConfig:e,creator:t,propertyKey:r,propertyType:i,propertyValue:o,digitalAssetAddress:s,digitalAssetType:a,options:c}=n;return h({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::add_property",typeArguments:[_nullishCoalesce(a, () => (pe))],functionArguments:[u.from(s),new b(r),new b(je[i]),T.U8(ci(o,je[i]))],abi:Hc},options:c})}var Qc={typeParameters:[{constraints:["key"]}],parameters:[new y(re(new k(0))),new y(v())]};async function vs(n){let{aptosConfig:e,creator:t,propertyKey:r,digitalAssetAddress:i,digitalAssetType:o,options:s}=n;return h({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::remove_property",typeArguments:[_nullishCoalesce(o, () => (pe))],functionArguments:[u.from(i),new b(r)],abi:Qc},options:s})}var Wc={typeParameters:[{constraints:["key"]}],parameters:[new y(re(new k(0))),new y(v()),new y(v()),C.u8()]};async function Ps(n){let{aptosConfig:e,creator:t,propertyKey:r,propertyType:i,propertyValue:o,digitalAssetAddress:s,digitalAssetType:a,options:c}=n;return h({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::update_property",typeArguments:[_nullishCoalesce(a, () => (pe))],functionArguments:[u.from(s),new b(r),new b(je[i]),ci(o,je[i])],abi:Wc},options:c})}var jc={typeParameters:[{constraints:["key"]},{constraints:[]}],parameters:[new y(re(new k(0))),new y(v()),new k(1)]};async function Cs(n){let{aptosConfig:e,creator:t,propertyKey:r,propertyType:i,propertyValue:o,digitalAssetAddress:s,digitalAssetType:a,options:c}=n;return h({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::add_typed_property",typeArguments:[_nullishCoalesce(a, () => (pe)),je[i]],functionArguments:[u.from(s),new b(r),o],abi:jc},options:c})}var Xc={typeParameters:[{constraints:["key"]},{constraints:[]}],parameters:[new y(re(new k(0))),new y(v()),new k(1)]};async function Es(n){let{aptosConfig:e,creator:t,propertyKey:r,propertyType:i,propertyValue:o,digitalAssetAddress:s,digitalAssetType:a,options:c}=n;return h({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::update_typed_property",typeArguments:[_nullishCoalesce(a, () => (pe)),je[i]],functionArguments:[u.from(s),new b(r),o],abi:Xc},options:c})}function Is(n,e){let t=new Array;return e.forEach((r,i)=>{t.push(ci(n[i],r))}),t}function ci(n,e){let t=ke(e);return Nt(n,t,0,[]).bcsToBytes()}var ln=class{constructor(e){this.config=e}async getCollectionData(e){await A({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"});let{creatorAddress:t,collectionName:r,options:i}=e,o=u.from(t),s={collection_name:{_eq:r},creator_address:{_eq:o.toStringLong()}};return _optionalChain([i, 'optionalAccess', _166 => _166.tokenStandard])&&(s.token_standard={_eq:_nullishCoalesce(_optionalChain([i, 'optionalAccess', _167 => _167.tokenStandard]), () => ("v2"))}),Ot({aptosConfig:this.config,options:{where:s}})}async getCollectionDataByCreatorAddressAndCollectionName(e){return await A({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),ds({aptosConfig:this.config,...e})}async getCollectionDataByCreatorAddress(e){return await A({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),ls({aptosConfig:this.config,...e})}async getCollectionDataByCollectionId(e){return await A({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),gs({aptosConfig:this.config,...e})}async getCollectionId(e){return await A({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),ms({aptosConfig:this.config,...e})}async getDigitalAssetData(e){return await A({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),ss({aptosConfig:this.config,...e})}async getCurrentDigitalAssetOwnership(e){return await A({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),as({aptosConfig:this.config,...e})}async getOwnedDigitalAssets(e){return await A({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),cs({aptosConfig:this.config,...e})}async getDigitalAssetActivity(e){return await A({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),us({aptosConfig:this.config,...e})}async createCollectionTransaction(e){return ps({aptosConfig:this.config,...e})}async mintDigitalAssetTransaction(e){return ys({aptosConfig:this.config,...e})}async transferDigitalAssetTransaction(e){return fs({aptosConfig:this.config,...e})}async mintSoulBoundTransaction(e){return As({aptosConfig:this.config,...e})}async burnDigitalAssetTransaction(e){return hs({aptosConfig:this.config,...e})}async freezeDigitalAssetTransaferTransaction(e){return Ts({aptosConfig:this.config,...e})}async unfreezeDigitalAssetTransaferTransaction(e){return bs({aptosConfig:this.config,...e})}async setDigitalAssetDescriptionTransaction(e){return ws({aptosConfig:this.config,...e})}async setDigitalAssetNameTransaction(e){return Ss({aptosConfig:this.config,...e})}async setDigitalAssetURITransaction(e){return _s({aptosConfig:this.config,...e})}async addDigitalAssetPropertyTransaction(e){return xs({aptosConfig:this.config,...e})}async removeDigitalAssetPropertyTransaction(e){return vs({aptosConfig:this.config,...e})}async updateDigitalAssetPropertyTransaction(e){return Ps({aptosConfig:this.config,...e})}async addDigitalAssetTypedPropertyTransaction(e){return Cs({aptosConfig:this.config,...e})}async updateDigitalAssetTypedPropertyTransaction(e){return Es({aptosConfig:this.config,...e})}};var Us=300,Yc=n=>{if(n&&n.length>Us)throw new Error(`Event type length exceeds the maximum length of ${Us}`)};async function Rs(n){let{aptosConfig:e,eventType:t,options:r}=n,i={_or:[{account_address:{_eq:t.split("::")[0]}},{account_address:{_eq:"0x0000000000000000000000000000000000000000000000000000000000000000"},sequence_number:{_eq:0},creation_number:{_eq:0}}],indexed_type:{_eq:t}};return gn({aptosConfig:e,options:{...r,where:i}})}async function zs(n){let{accountAddress:e,aptosConfig:t,creationNumber:r,options:i}=n,s={account_address:{_eq:u.from(e).toStringLong()},creation_number:{_eq:r}};return gn({aptosConfig:t,options:{...i,where:s}})}async function ks(n){let{accountAddress:e,aptosConfig:t,eventType:r,options:i}=n,s={account_address:{_eq:u.from(e).toStringLong()},indexed_type:{_eq:r}};return gn({aptosConfig:t,options:{...i,where:s}})}async function gn(n){let{aptosConfig:e,options:t}=n;Yc(_optionalChain([t, 'optionalAccess', _168 => _168.where, 'optionalAccess', _169 => _169.indexed_type, 'optionalAccess', _170 => _170._eq]));let r={query:lo,variables:{where_condition:_optionalChain([t, 'optionalAccess', _171 => _171.where]),offset:_optionalChain([t, 'optionalAccess', _172 => _172.offset]),limit:_optionalChain([t, 'optionalAccess', _173 => _173.limit]),order_by:_optionalChain([t, 'optionalAccess', _174 => _174.orderBy])}};return(await f({aptosConfig:e,query:r,originMethod:"getEvents"})).events}var mn=class{constructor(e){this.config=e}async getModuleEventsByEventType(e){return await A({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"events_processor"}),Rs({aptosConfig:this.config,...e})}async getAccountEventsByCreationNumber(e){return await A({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"events_processor"}),zs({aptosConfig:this.config,...e})}async getAccountEventsByEventType(e){return await A({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"events_processor"}),ks({aptosConfig:this.config,...e})}async getEvents(e){return await A({config:this.config,minimumLedgerVersion:_optionalChain([e, 'optionalAccess', _175 => _175.minimumLedgerVersion]),processorType:"events_processor"}),gn({aptosConfig:this.config,...e})}};async function Ds(n){let{aptosConfig:e,accountAddress:t,amount:r,options:i}=n,o=_optionalChain([i, 'optionalAccess', _176 => _176.timeoutSecs])||20,{data:s}=await Wi({aptosConfig:e,path:"fund",body:{address:u.from(t).toString(),amount:r},originMethod:"fundAccount"}),a=s.txn_hashes[0],c=await Kt({aptosConfig:e,transactionHash:a,options:{timeoutSecs:o,checkSuccess:_optionalChain([i, 'optionalAccess', _177 => _177.checkSuccess])}});if(c.type==="user_transaction")return c;throw new Error(`Unexpected transaction received for fund account: ${c.type}`)}var yn=class{constructor(e){this.config=e}async fundAccount(e){let t=await Ds({aptosConfig:this.config,...e});return(_optionalChain([e, 'access', _178 => _178.options, 'optionalAccess', _179 => _179.waitForIndexer])===void 0||_optionalChain([e, 'access', _180 => _180.options, 'optionalAccess', _181 => _181.waitForIndexer]))&&await Jn({aptosConfig:this.config,minimumLedgerVersion:BigInt(t.version),processorType:"fungible_asset_processor"}),t}};async function ur(n){let{aptosConfig:e,options:t}=n,r={query:mo,variables:{where_condition:_optionalChain([t, 'optionalAccess', _182 => _182.where]),limit:_optionalChain([t, 'optionalAccess', _183 => _183.limit]),offset:_optionalChain([t, 'optionalAccess', _184 => _184.offset])}};return(await f({aptosConfig:e,query:r,originMethod:"getFungibleAssetMetadata"})).fungible_asset_metadata}async function Bs(n){let{aptosConfig:e,options:t}=n,r={query:go,variables:{where_condition:_optionalChain([t, 'optionalAccess', _185 => _185.where]),limit:_optionalChain([t, 'optionalAccess', _186 => _186.limit]),offset:_optionalChain([t, 'optionalAccess', _187 => _187.offset])}};return(await f({aptosConfig:e,query:r,originMethod:"getFungibleAssetActivities"})).fungible_asset_activities}async function Gs(n){let{aptosConfig:e,options:t}=n,r={query:uo,variables:{where_condition:_optionalChain([t, 'optionalAccess', _188 => _188.where]),limit:_optionalChain([t, 'optionalAccess', _189 => _189.limit]),offset:_optionalChain([t, 'optionalAccess', _190 => _190.offset])}};return(await f({aptosConfig:e,query:r,originMethod:"getCurrentFungibleAssetBalances"})).current_fungible_asset_balances}var Zc={typeParameters:[{constraints:[]}],parameters:[ke("0x1::object::Object"),new W,new $]};async function Ks(n){let{aptosConfig:e,sender:t,fungibleAssetMetadataAddress:r,recipient:i,amount:o,options:s}=n;return h({aptosConfig:e,sender:t.accountAddress,data:{function:"0x1::primary_fungible_store::transfer",typeArguments:["0x1::fungible_asset::Metadata"],functionArguments:[r,i,o],abi:Zc},options:s})}var fn=class{constructor(e){this.config=e}async getFungibleAssetMetadata(e){return await A({config:this.config,minimumLedgerVersion:_optionalChain([e, 'optionalAccess', _191 => _191.minimumLedgerVersion]),processorType:"fungible_asset_processor"}),ur({aptosConfig:this.config,...e})}async getFungibleAssetMetadataByAssetType(e){return await A({config:this.config,minimumLedgerVersion:_optionalChain([e, 'optionalAccess', _192 => _192.minimumLedgerVersion]),processorType:"fungible_asset_processor"}),(await ur({aptosConfig:this.config,options:{where:{asset_type:{_eq:e.assetType}}}}))[0]}async getFungibleAssetMetadataByCreatorAddress(e){return await A({config:this.config,minimumLedgerVersion:_optionalChain([e, 'optionalAccess', _193 => _193.minimumLedgerVersion]),processorType:"fungible_asset_processor"}),await ur({aptosConfig:this.config,options:{where:{creator_address:{_eq:u.from(e.creatorAddress).toStringLong()}}}})}async getFungibleAssetActivities(e){return await A({config:this.config,minimumLedgerVersion:_optionalChain([e, 'optionalAccess', _194 => _194.minimumLedgerVersion]),processorType:"fungible_asset_processor"}),Bs({aptosConfig:this.config,...e})}async getCurrentFungibleAssetBalances(e){return await A({config:this.config,minimumLedgerVersion:_optionalChain([e, 'optionalAccess', _195 => _195.minimumLedgerVersion]),processorType:"fungible_asset_processor"}),Gs({aptosConfig:this.config,...e})}async transferFungibleAsset(e){return Ks({aptosConfig:this.config,...e})}};var An=class{constructor(e){this.config=e}async getLedgerInfo(){return Hn({aptosConfig:this.config})}async getChainId(){return(await this.getLedgerInfo()).chain_id}async getBlockByVersion(e){return No({aptosConfig:this.config,...e})}async getBlockByHeight(e){return Oo({aptosConfig:this.config,...e})}async view(e){return _e({aptosConfig:this.config,...e})}async viewJson(e){return ts({aptosConfig:this.config,...e})}async getChainTopUserTransactions(e){return To({aptosConfig:this.config,...e})}async queryIndexer(e){return f({aptosConfig:this.config,...e})}async getIndexerLastSuccessVersion(){return Qn({aptosConfig:this.config})}async getProcessorStatus(e){return Wn({aptosConfig:this.config,processorType:e})}};var Ns=["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 Os(n){return!(!n||n.length<3||n.length>63||!/^[a-z\d][a-z\d-]{1,61}[a-z\d]$/.test(n))}function Xe(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(!Os(e))throw new Error(`${e} is not valid. ${Ns}`);if(t&&!Os(t))throw new Error(`${t} is not valid. ${Ns}`);return{domainName:t||e,subdomainName:t?e:void 0}}function Fs(n){if(!n)return!1;let e=new Date(n.domain_expiration_timestamp).getTime()<Date.now(),t=new Date(n.expiration_timestamp).getTime()<Date.now();return n.subdomain&&e?!1:n.subdomain&&n.subdomain_expiration_policy===1?!0:!t}var Jc="0x585fc9f0f0c54183b039ffc770ca282ebd87307916c215a3e692f2f8e4305e82",eu={testnet:"0x5f8fd2347449685cf41d4db97926ec3a096eaf381332be4f1318ad4d16a8497c",mainnet:"0x867ed1f6bf916171b1de3ee92849b8978b7d1b9e0a8cc982a3d19d535dfd9c0c",local:Jc,custom:null,devnet:null};function De(n){let e=eu[n.network];if(!e)throw new Error(`The ANS contract is not deployed to ${n.network}`);return e}var pr=n=>{if(n&&typeof n=="object"&&"vec"in n&&Array.isArray(n.vec))return n.vec[0]};async function Ms(n){let{aptosConfig:e,name:t}=n,r=De(e),{domainName:i,subdomainName:o}=Xe(t),s=await _e({aptosConfig:e,payload:{function:`${r}::router::get_owner_addr`,functionArguments:[i,o]}}),a=pr(s[0]);return a?u.from(a):void 0}async function qs(n){let{aptosConfig:e,expiration:t,name:r,sender:i,targetAddress:o,toAddress:s,options:a,transferable:c}=n,p=De(e),{domainName:l,subdomainName:w}=Xe(r),S=t.policy==="subdomain:independent"||t.policy==="subdomain:follow-domain";if(w&&!S)throw new Error("Subdomains must have an expiration policy of either 'subdomain:independent' or 'subdomain:follow-domain'");if(S&&!w)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 sa=fr*31536e3;return await h({aptosConfig:e,sender:i.accountAddress.toString(),data:{function:`${p}::router::register_domain`,functionArguments:[l,sa,o,s]},options:a})}if(!w)throw new Error(`${t.policy} requires a subdomain to be provided.`);let m=await ui({aptosConfig:e,name:l});if(!m)throw new Error("The domain does not exist");let E=t.policy==="subdomain:independent"?t.expirationDate:m;if(E>m)throw new Error("The subdomain expiration time cannot be greater than the domain expiration time");return await h({aptosConfig:e,sender:i.accountAddress.toString(),data:{function:`${p}::router::register_subdomain`,functionArguments:[l,w,Math.round(E/1e3),t.policy==="subdomain:follow-domain"?1:0,!!c,o,s]},options:a})}async function ui(n){let{aptosConfig:e,name:t}=n,r=De(e),{domainName:i,subdomainName:o}=Xe(t);try{let s=await _e({aptosConfig:e,payload:{function:`${r}::router::get_expiration`,functionArguments:[i,o]}});return Number(s[0])*1e3}catch (e5){return}}async function Vs(n){let{aptosConfig:e,address:t}=n,r=De(e),i=await _e({aptosConfig:e,payload:{function:`${r}::router::get_primary_name`,functionArguments:[u.from(t).toString()]}}),o=pr(i[1]),s=pr(i[0]);if(o)return[s,o].filter(Boolean).join(".")}async function $s(n){let{aptosConfig:e,sender:t,name:r,options:i}=n,o=De(e);if(!r)return await h({aptosConfig:e,sender:t.accountAddress.toString(),data:{function:`${o}::router::clear_primary_name`,functionArguments:[]},options:i});let{domainName:s,subdomainName:a}=Xe(r);return await h({aptosConfig:e,sender:t.accountAddress.toString(),data:{function:`${o}::router::set_primary_name`,functionArguments:[s,a]},options:i})}async function Ls(n){let{aptosConfig:e,name:t}=n,r=De(e),{domainName:i,subdomainName:o}=Xe(t),s=await _e({aptosConfig:e,payload:{function:`${r}::router::get_target_addr`,functionArguments:[i,o]}}),a=pr(s[0]);return a?u.from(a):void 0}async function Hs(n){let{aptosConfig:e,sender:t,name:r,address:i,options:o}=n,s=De(e),{domainName:a,subdomainName:c}=Xe(r);return await h({aptosConfig:e,sender:t.accountAddress.toString(),data:{function:`${s}::router::set_target_addr`,functionArguments:[a,c,i]},options:o})}async function Qs(n){let{aptosConfig:e,name:t}=n,{domainName:r,subdomainName:i=""}=Xe(t),a=(await f({aptosConfig:e,query:{query:Gt,variables:{where_condition:{domain:{_eq:r},subdomain:{_eq:i}},limit:1}},originMethod:"getName"})).current_aptos_names[0];return a&&(a=hn(a)),Fs(a)?a:void 0}async function Ws(n){let{aptosConfig:e,options:t,accountAddress:r}=n,i=await pi({aptosConfig:e});return(await f({aptosConfig:e,originMethod:"getAccountNames",query:{query:Gt,variables:{limit:_optionalChain([t, 'optionalAccess', _196 => _196.limit]),offset:_optionalChain([t, 'optionalAccess', _197 => _197.offset]),order_by:_optionalChain([t, 'optionalAccess', _198 => _198.orderBy]),where_condition:{..._nullishCoalesce(_optionalChain([n, 'access', _199 => _199.options, 'optionalAccess', _200 => _200.where]), () => ({})),owner_address:{_eq:r.toString()},expiration_timestamp:{_gte:i}}}}})).current_aptos_names.map(hn)}async function js(n){let{aptosConfig:e,options:t,accountAddress:r}=n,i=await pi({aptosConfig:e});return(await f({aptosConfig:e,originMethod:"getAccountDomains",query:{query:Gt,variables:{limit:_optionalChain([t, 'optionalAccess', _201 => _201.limit]),offset:_optionalChain([t, 'optionalAccess', _202 => _202.offset]),order_by:_optionalChain([t, 'optionalAccess', _203 => _203.orderBy]),where_condition:{..._nullishCoalesce(_optionalChain([n, 'access', _204 => _204.options, 'optionalAccess', _205 => _205.where]), () => ({})),owner_address:{_eq:r.toString()},expiration_timestamp:{_gte:i},subdomain:{_eq:""}}}}})).current_aptos_names.map(hn)}async function Xs(n){let{aptosConfig:e,options:t,accountAddress:r}=n,i=await pi({aptosConfig:e});return(await f({aptosConfig:e,originMethod:"getAccountSubdomains",query:{query:Gt,variables:{limit:_optionalChain([t, 'optionalAccess', _206 => _206.limit]),offset:_optionalChain([t, 'optionalAccess', _207 => _207.offset]),order_by:_optionalChain([t, 'optionalAccess', _208 => _208.orderBy]),where_condition:{..._nullishCoalesce(_optionalChain([n, 'access', _209 => _209.options, 'optionalAccess', _210 => _210.where]), () => ({})),owner_address:{_eq:r.toString()},expiration_timestamp:{_gte:i},subdomain:{_neq:""}}}}})).current_aptos_names.map(hn)}async function Ys(n){let{aptosConfig:e,options:t,domain:r}=n;return(await f({aptosConfig:e,originMethod:"getDomainSubdomains",query:{query:Gt,variables:{limit:_optionalChain([t, 'optionalAccess', _211 => _211.limit]),offset:_optionalChain([t, 'optionalAccess', _212 => _212.offset]),order_by:_optionalChain([t, 'optionalAccess', _213 => _213.orderBy]),where_condition:{..._nullishCoalesce(_optionalChain([n, 'access', _214 => _214.options, 'optionalAccess', _215 => _215.where]), () => ({})),domain:{_eq:r},subdomain:{_neq:""}}}}})).current_aptos_names.map(hn).filter(Fs)}async function pi(n){let{aptosConfig:e}=n,t=De(e),[r]=await _e({aptosConfig:e,payload:{function:`${t}::config::reregistration_grace_sec`,functionArguments:[]}}),i=r/60/60/24,o=()=>new Date;return new Date(o().setDate(o().getDate()-i)).toISOString()}async function Zs(n){let{aptosConfig:e,sender:t,name:r,years:i=1,options:o}=n,s=De(e),a=i*31536e3,{domainName:c,subdomainName:p}=Xe(r);if(p)throw new Error("Subdomains cannot be renewed");if(i!==1)throw new Error("Currently, only 1 year renewals are supported");return await h({aptosConfig:e,sender:t.accountAddress.toString(),data:{function:`${s}::router::renew_domain`,functionArguments:[c,a]},options:o})}function hn(n){return{...n,expiration_timestamp:new Date(n.expiration_timestamp).getTime()}}var Tn=class{constructor(e){this.config=e}async getOwnerAddress(e){return Ms({aptosConfig:this.config,...e})}async getExpiration(e){return ui({aptosConfig:this.config,...e})}async getTargetAddress(e){return Ls({aptosConfig:this.config,...e})}async setTargetAddress(e){return Hs({aptosConfig:this.config,...e})}async getPrimaryName(e){return Vs({aptosConfig:this.config,...e})}async setPrimaryName(e){return $s({aptosConfig:this.config,...e})}async registerName(e){return qs({aptosConfig:this.config,...e})}async renewDomain(e){return Zs({aptosConfig:this.config,...e})}async getName(e){return Qs({aptosConfig:this.config,...e})}async getAccountNames(e){return Ws({aptosConfig:this.config,...e})}async getAccountDomains(e){return js({aptosConfig:this.config,...e})}async getAccountSubdomains(e){return Xs({aptosConfig:this.config,...e})}async getDomainSubdomains(e){return Ys({aptosConfig:this.config,...e})}};async function Js(n){let{aptosConfig:e,poolAddress:t}=n,r=u.from(t).toStringLong(),o=await f({aptosConfig:e,query:{query:qr,variables:{where_condition:{pool_address:{_eq:r}}}}});return o.num_active_delegator_per_pool[0]?o.num_active_delegator_per_pool[0].num_active_delegator:0}async function ea(n){let{aptosConfig:e,options:t}=n,r={query:qr,variables:{order_by:_optionalChain([t, 'optionalAccess', _216 => _216.orderBy])}};return(await f({aptosConfig:e,query:r})).num_active_delegator_per_pool}async function ta(n){let{aptosConfig:e,delegatorAddress:t,poolAddress:r}=n,i={query:po,variables:{delegatorAddress:u.from(t).toStringLong(),poolAddress:u.from(r).toStringLong()}};return(await f({aptosConfig:e,query:i})).delegated_staking_activities}var bn=class{constructor(e){this.config=e}async getNumberOfDelegators(e){return await A({config:this.config,minimumLedgerVersion:_optionalChain([e, 'optionalAccess', _217 => _217.minimumLedgerVersion]),processorType:"stake_processor"}),Js({aptosConfig:this.config,...e})}async getNumberOfDelegatorsForAllPools(e){return await A({config:this.config,minimumLedgerVersion:_optionalChain([e, 'optionalAccess', _218 => _218.minimumLedgerVersion]),processorType:"stake_processor"}),ea({aptosConfig:this.config,...e})}async getDelegatedStakingActivities(e){return await A({config:this.config,minimumLedgerVersion:_optionalChain([e, 'optionalAccess', _219 => _219.minimumLedgerVersion]),processorType:"stake_processor"}),ta({aptosConfig:this.config,...e})}};var dr=class{constructor(e){this.config=e}async simple(e){return h({aptosConfig:this.config,...e})}async multiAgent(e){return h({aptosConfig:this.config,...e})}};function di(n,e,t){let r=t.value;return t.value=async function(...i){let[o]=i;if(o.transaction.feePayerAddress&&!o.feePayerAuthenticator)throw new Error("You are submitting a Fee Payer transaction but missing the feePayerAuthenticator");return r.apply(this,i)},t}function li(n,e,t){let r=t.value;return t.value=async function(...i){let[o]=i;if(o.transaction.feePayerAddress&&!o.feePayerPublicKey)throw new Error("You are simulating a Fee Payer transaction but missing the feePayerPublicKey");return r.apply(this,i)},t}var Ft=class{constructor(e){this.config=e}async simple(e){return ai({aptosConfig:this.config,...e})}async multiAgent(e){return ai({aptosConfig:this.config,...e})}};_chunkHBPH2AD3js.a.call(void 0, [li],Ft.prototype,"simple",1),_chunkHBPH2AD3js.a.call(void 0, [li],Ft.prototype,"multiAgent",1);var Mt=class{constructor(e){this.config=e}async simple(e){return cr({aptosConfig:this.config,...e})}async multiAgent(e){return cr({aptosConfig:this.config,...e})}};_chunkHBPH2AD3js.a.call(void 0, [di],Mt.prototype,"simple",1),_chunkHBPH2AD3js.a.call(void 0, [di],Mt.prototype,"multiAgent",1);var lr=class{constructor(e,t,r,i,o){this.lastUncommintedNumber=null;this.currentNumber=null;this.lock=!1;this.aptosConfig=e,this.account=t,this.maxWaitTime=r,this.maximumInFlight=i,this.sleepTime=o}async nextSequenceNumber(){for(;this.lock;)await _chunkHBPH2AD3js.b.call(void 0, this.sleepTime);this.lock=!0;let e=BigInt(0);try{if((this.lastUncommintedNumber===null||this.currentNumber===null)&&await this.initialize(),this.currentNumber-this.lastUncommintedNumber>=this.maximumInFlight){await this.update();let t=_chunkHBPH2AD3js.c.call(void 0, );for(;this.currentNumber-this.lastUncommintedNumber>=this.maximumInFlight;)await _chunkHBPH2AD3js.b.call(void 0, this.sleepTime),_chunkHBPH2AD3js.c.call(void 0, )-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 Se({aptosConfig:this.aptosConfig,accountAddress:this.account.accountAddress});this.currentNumber=BigInt(e),this.lastUncommintedNumber=BigInt(e)}async update(){let{sequence_number:e}=await Se({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 _chunkHBPH2AD3js.b.call(void 0, this.sleepTime);this.lock=!0;try{await this.update();let e=_chunkHBPH2AD3js.c.call(void 0, );for(;this.lastUncommintedNumber!==this.currentNumber;)_chunkHBPH2AD3js.c.call(void 0, )-e>this.maxWaitTime?(console.warn(`Waited over 30 seconds for a transaction to commit, resyncing ${this.account.accountAddress.toString()}`),await this.initialize()):(await _chunkHBPH2AD3js.b.call(void 0, this.sleepTime),await this.update())}catch(e){console.error("error in synchronizing this account sequence number with the one on chain",e)}finally{this.lock=!1}}}};var qt=class{constructor(){this.queue=[];this.pendingDequeue=[];this.cancelled=!1}enqueue(e){if(this.cancelled=!1,this.pendingDequeue.length>0){_optionalChain([this, 'access', _220 => _220.pendingDequeue, 'access', _221 => _221.shift, 'call', _222 => _222(), 'optionalAccess', _223 => _223.resolve, 'call', _224 => _224(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 Vt("Task cancelled"))}),this.pendingDequeue=[],this.queue.length=0}isCancelled(){return this.cancelled}pendingDequeueLength(){return this.pendingDequeue.length}},Vt=class extends Error{};var na="fulfilled",ra= exports.TransactionWorkerEventsEnum =(o=>(o.TransactionSent="transactionSent",o.TransactionSendFailed="transactionSendFailed",o.TransactionExecuted="transactionExecuted",o.TransactionExecutionFailed="transactionExecutionFailed",o.ExecutionFinish="executionFinish",o))(ra||{}),gr= exports.TransactionWorker =class extends _eventemitter32.default{constructor(t,r,i=30,o=100,s=10){super();this.taskQueue=new qt;this.transactionsQueue=new qt;this.outstandingTransactions=new qt;this.sentTransactions=[];this.executedTransactions=[];this.aptosConfig=t,this.account=r,this.started=!1,this.accountSequnceNumber=new lr(t,r,i,o,s)}async submitNextTransaction(){try{for(;;){let t=await this.accountSequnceNumber.nextSequenceNumber();if(t===null)return;let r=await this.generateNextTransaction(this.account,t);if(!r)return;let i=pn({aptosConfig:this.aptosConfig,transaction:r,signer:this.account});await this.outstandingTransactions.enqueue([i,t])}}catch(t){if(t instanceof Vt)return;throw new Error(`Submit transaction failed for ${this.account.accountAddress.toString()} with error ${t}`)}}async processTransactions(){try{for(;;){let t=[],r=[],[i,o]=await this.outstandingTransactions.dequeue();for(t.push(i),r.push(o);!this.outstandingTransactions.isEmpty();)[i,o]=await this.outstandingTransactions.dequeue(),t.push(i),r.push(o);let s=await Promise.allSettled(t);for(let a=0;a<s.length&&a<r.length;a+=1){let c=s[a];o=r[a],c.status===na?(this.sentTransactions.push([c.value.hash,o,null]),this.emit("transactionSent",{message:`transaction hash ${c.value.hash} has been committed to chain`,transactionHash:c.value.hash}),await this.checkTransaction(c,o)):(this.sentTransactions.push([c.status,o,c.reason]),this.emit("transactionSendFailed",{message:`failed to commit transaction ${this.sentTransactions.length} with error ${c.reason}`,error:c.reason}))}this.emit("executionFinish",{message:`execute ${s.length} transactions finished`})}}catch(t){if(t instanceof Vt)return;throw new Error(`Process execution failed for ${this.account.accountAddress.toString()} with error ${t}`)}}async checkTransaction(t,r){try{let i=[];i.push(Kt({aptosConfig:this.aptosConfig,transactionHash:t.value.hash}));let o=await Promise.allSettled(i);for(let s=0;s<o.length;s+=1){let a=o[s];a.status===na?(this.executedTransactions.push([a.value.hash,r,null]),this.emit("transactionExecuted",{message:`transaction hash ${a.value.hash} has been executed on chain`,transactionHash:t.value.hash})):(this.executedTransactions.push([a.status,r,a.reason]),this.emit("transactionExecutionFailed",{message:`failed to execute transaction ${this.executedTransactions.length} with error ${a.reason}`,error:a.reason}))}}catch(i){throw new Error(`Check transaction failed for ${this.account.accountAddress.toString()} with error ${i}`)}}async push(t,r){this.transactionsQueue.enqueue([t,r])}async generateNextTransaction(t,r){if(this.transactionsQueue.isEmpty())return;let[i,o]=await this.transactionsQueue.dequeue();return h({aptosConfig:this.aptosConfig,sender:t.accountAddress,data:i,options:{...o,accountSequenceNumber:r}})}async run(){try{for(;!this.taskQueue.isCancelled();)await(await this.taskQueue.dequeue())()}catch(t){throw new Error(`Unable to start transaction batching: ${t}`)}}start(){if(this.started)throw new Error("worker has already started");this.started=!0,this.taskQueue.enqueue(()=>this.submitNextTransaction()),this.taskQueue.enqueue(()=>this.processTransactions()),this.run()}stop(){if(this.taskQueue.isCancelled())throw new Error("worker has already stopped");this.started=!1,this.taskQueue.cancel()}};var mr=class extends _eventemitter32.default{constructor(e){super(),this.config=e}start(e){let{sender:t}=e;this.account=t,this.transactionWorker=new gr(this.config,t),this.transactionWorker.start(),this.registerToEvents()}push(e){let{data:t,options:r}=e;for(let i of t)this.transactionWorker.push(i,r)}registerToEvents(){this.transactionWorker.on("transactionSent",async e=>{this.emit("transactionSent",e)}),this.transactionWorker.on("transactionSendFailed",async e=>{this.emit("transactionSendFailed",e)}),this.transactionWorker.on("transactionExecuted",async e=>{this.emit("transactionExecuted",e)}),this.transactionWorker.on("transactionExecutionFailed",async e=>{this.emit("transactionExecutionFailed",e)}),this.transactionWorker.on("executionFinish",async e=>{this.emit("executionFinish",e)})}forSingleAccount(e){try{let{sender:t,data:r,options:i}=e;this.start({sender:t}),this.push({data:r,options:i})}catch(t){throw new Error(`failed to submit transactions with error: ${t}`)}}};var wn=class{constructor(e){this.config=e,this.build=new dr(this.config),this.simulate=new Ft(this.config),this.submit=new Mt(this.config),this.batch=new mr(this.config)}async getTransactions(e){return Wr({aptosConfig:this.config,...e})}async getTransactionByVersion(e){return Go({aptosConfig:this.config,...e})}async getTransactionByHash(e){return sn({aptosConfig:this.config,...e})}async isPendingTransaction(e){return Ko({aptosConfig:this.config,...e})}async waitForTransaction(e){return Kt({aptosConfig:this.config,...e})}async getGasPriceEstimation(){return Zn({aptosConfig:this.config})}getSigningMessage(e){return ns(e)}async publishPackageTransaction(e){return rs({aptosConfig:this.config,...e})}async rotateAuthKey(e){return is({aptosConfig:this.config,...e})}sign(e){return ar({...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,ar({signer:t,transaction:r})}async batchTransactionsForSingleAccount(e){try{let{sender:t,data:r,options:i}=e;this.batch.forSingleAccount({sender:t,data:r,options:i})}catch(t){throw new Error(`failed to submit transactions with error: ${t}`)}}async signAndSubmitTransaction(e){let{signer:t,transaction:r}=e;return pn({aptosConfig:this.config,signer:t,transaction:r})}};var Sn=class{constructor(e){this.config=e}async getTableItem(e){return jn({aptosConfig:this.config,...e})}async getTableItemsData(e){return await A({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"default_processor"}),bo({aptosConfig:this.config,...e})}async getTableItemsMetadata(e){return await A({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"default_processor"}),wo({aptosConfig:this.config,...e})}};async function yr(n){let{aptosConfig:e,jwt:t,ephemeralKeyPair:r,uidKey:i="sub",derivationPath:o}=n,s={jwt_b64:t,epk:r.getPublicKey().bcsToHex().toStringWithoutPrefix(),exp_date_secs:r.expiryDateSecs,epk_blinder:g.fromHexInput(r.blinder).toStringWithoutPrefix(),uid_key:i,derivation_path:o},{data:a}=await ji({aptosConfig:e,path:"fetch",body:s,originMethod:"getPepper",overrides:{WITH_CREDENTIALS:!1}});return g.fromHexInput(a.pepper).toUint8Array()}async function gi(n){let{aptosConfig:e,jwt:t,ephemeralKeyPair:r,pepper:i=await yr(n),uidKey:o="sub"}=n;if(g.fromHexInput(i).toUint8Array().length!==we.PEPPER_LENGTH)throw new Error(`Pepper needs to be ${we.PEPPER_LENGTH} bytes`);let{maxExpHorizonSecs:s}=await Zi({aptosConfig:e});if(s<r.expiryDateSecs-_chunkHBPH2AD3js.c.call(void 0, ))throw Error(`The EphemeralKeyPair is too long lived. It's lifespan must be less than ${s}`);let a={jwt_b64:t,epk:r.getPublicKey().bcsToHex().toStringWithoutPrefix(),epk_blinder:g.fromHexInput(r.blinder).toStringWithoutPrefix(),exp_date_secs:r.expiryDateSecs,exp_horizon_secs:s,pepper:g.fromHexInput(i).toStringWithoutPrefix(),uid_key:o},{data:c}=await Xi({aptosConfig:e,path:"prove",body:a,originMethod:"getProof",overrides:{WITH_CREDENTIALS:!1}}),p=c.proof,l=new St({a:p.a,b:p.b,c:p.c});return new Ue({proof:new _t(l,0),trainingWheelsSignature:Te.fromHex(c.training_wheels_signature),expHorizonSecs:s})}async function ia(n){let{aptosConfig:e,jwt:t,uidKey:r,proofFetchCallback:i,pepper:o=await yr(n)}=n,s=gi({...n,pepper:o}),a=i?s:await s,c=te.fromJwtAndPepper({jwt:t,pepper:o,uidKey:r}),p=await on({aptosConfig:e,authenticationKey:c.authKey().derivedAddress()});return we.create({...n,address:p,proof:a,pepper:o,proofFetchCallback:i})}var _n=class{constructor(e){this.config=e}async getPepper(e){return yr({aptosConfig:this.config,...e})}async getProof(e){return gi({aptosConfig:this.config,...e})}async deriveKeylessAccount(e){return ia({aptosConfig:this.config,...e})}};async function ru(n){let{aptosConfig:e,options:t}=n,r={query:Ln,variables:{where_condition:_optionalChain([t, 'optionalAccess', _225 => _225.where]),offset:_optionalChain([t, 'optionalAccess', _226 => _226.offset]),limit:_optionalChain([t, 'optionalAccess', _227 => _227.limit]),order_by:_optionalChain([t, 'optionalAccess', _228 => _228.orderBy])}};return(await f({aptosConfig:e,query:r,originMethod:"getObjectData"})).current_objects}async function oa(n){let{aptosConfig:e,objectAddress:t,options:r}=n,o={object_address:{_eq:u.from(t).toStringLong()}};return(await ru({aptosConfig:e,options:{...r,where:o}}))[0]}var xn=class{constructor(e){this.config=e}async getObjectDataByObjectAddress(e){return await A({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"objects_processor"}),oa({aptosConfig:this.config,...e})}};var j=class{constructor(e){this.config=new sr(e),this.account=new un(this.config),this.ans=new Tn(this.config),this.coin=new dn(this.config),this.digitalAsset=new ln(this.config),this.event=new mn(this.config),this.faucet=new yn(this.config),this.fungibleAsset=new fn(this.config),this.general=new An(this.config),this.staking=new bn(this.config),this.transaction=new wn(this.config),this.table=new Sn(this.config),this.keyless=new _n(this.config),this.object=new xn(this.config)}};function ie(n,e,t){Object.getOwnPropertyNames(e.prototype).forEach(r=>{let i=Object.getOwnPropertyDescriptor(e.prototype,r);i&&(i.value=function(...o){return this[t][r](...o)},Object.defineProperty(n.prototype,r,i))})}ie(j,un,"account");ie(j,Tn,"ans");ie(j,dn,"coin");ie(j,ln,"digitalAsset");ie(j,mn,"event");ie(j,yn,"faucet");ie(j,fn,"fungibleAsset");ie(j,An,"general");ie(j,bn,"staking");ie(j,wn,"transaction");ie(j,Sn,"table");ie(j,_n,"keyless");ie(j,xn,"object");exports.APTOS_BIP44_REGEX = Ta; exports.APTOS_COIN = it; exports.APTOS_FA = Fi; exports.APTOS_HARDENED_REGEX = ha; exports.Account = He; exports.AccountAddress = u; exports.AccountAuthenticator = H; exports.AccountAuthenticatorEd25519 = fe; exports.AccountAuthenticatorMultiEd25519 = Kn; exports.AccountAuthenticatorMultiKey = at; exports.AccountAuthenticatorSingleKey = Q; exports.AccountAuthenticatorVariant = Si; exports.AccountPublicKey = oe; exports.AccountSequenceNumber = lr; exports.AddressInvalidReason = ma; exports.AnyPublicKey = D; exports.AnyPublicKeyVariant = hr; exports.AnySignature = G; exports.AnySignatureVariant = _i; exports.Aptos = j; exports.AptosApiError = ye; exports.AptosApiType = Tt; exports.AptosConfig = sr; exports.AuthenticationKey = q; exports.Bool = I; exports.CKDPriv = zi; exports.ChainId = vt; exports.DEFAULT_MAX_GAS_AMOUNT = Ni; exports.DEFAULT_TXN_EXP_SEC_FROM_NOW = Oi; exports.DEFAULT_TXN_TIMEOUT_SEC = Bn; exports.DeriveScheme = Pi; exports.Deserializer = Y; exports.EPK_HORIZON_SECS = Gl; exports.Ed25519Account = kt; exports.Ed25519PrivateKey = L; exports.Ed25519PublicKey = x; exports.Ed25519Signature = P; exports.EntryFunction = ut; exports.EntryFunctionBytes = En; exports.EphemeralCertificate = wt; exports.EphemeralCertificateVariant = br; exports.EphemeralKeyPair = rn; exports.EphemeralPublicKey = rt; exports.EphemeralPublicKeyVariant = Tr; exports.EphemeralSignature = Te; exports.EphemeralSignatureVariant = xi; exports.FeePayerRawTransaction = dt; exports.FixedBytes = Je; exports.Groth16Zkp = St; exports.HARDENED_OFFSET = Ii; exports.Hex = g; exports.HexInvalidReason = ua; exports.Identifier = R; exports.KeyType = ba; exports.KeylessAccount = we; exports.KeylessConfiguration = Gr; exports.KeylessPublicKey = te; exports.KeylessSignature = Ie; exports.MAX_AUD_VAL_BYTES = Xa; exports.MAX_COMMITED_EPK_BYTES = Fl; exports.MAX_EXTRA_FIELD_BYTES = Nl; exports.MAX_ISS_VAL_BYTES = Kl; exports.MAX_JWT_HEADER_B64_BYTES = Ol; exports.MAX_UID_KEY_BYTES = Ya; exports.MAX_UID_VAL_BYTES = Za; exports.MimeType = In; exports.ModuleId = Xt; exports.MoveAbility = vi; exports.MoveFunctionVisibility = da; exports.MoveOption = M; exports.MoveString = b; exports.MoveVector = T; exports.MultiAgentRawTransaction = pt; exports.MultiAgentTransaction = qn; exports.MultiEd25519PublicKey = ft; exports.MultiEd25519Signature = tt; exports.MultiKey = xt; exports.MultiKeyAccount = Vn; exports.MultiKeySignature = st; exports.MultiSig = tn; exports.MultiSigTransactionPayload = nn; exports.Network = zr; exports.NetworkToChainId = kr; exports.NetworkToFaucetAPI = Li; exports.NetworkToIndexerAPI = Vi; exports.NetworkToNetworkName = Kd; exports.NetworkToNodeAPI = $i; exports.NetworkToPepperAPI = Ur; exports.NetworkToProverAPI = Rr; exports.ParsingError = Z; exports.ProcessorType = Ce; exports.PublicKey = et; exports.RAW_TRANSACTION_SALT = Mi; exports.RAW_TRANSACTION_WITH_DATA_SALT = Er; exports.RawTransaction = ue; exports.RawTransactionWithData = On; exports.RoleType = la; exports.RotationProofChallenge = Fn; exports.Script = en; exports.ScriptTransactionArgumentVariants = Lt; exports.Secp256k1PrivateKey = nt; exports.Secp256k1PublicKey = Pe; exports.Secp256k1Signature = ht; exports.Serializable = d; exports.Serialized = Ht; exports.Serializer = J; exports.Signature = B; exports.SignedTransaction = lt; exports.SigningScheme = Ae; exports.SigningSchemeInput = _r; exports.SimpleTransaction = Mn; exports.SingleKeyAccount = Dt; exports.StructTag = Re; exports.TransactionAuthenticator = ze; exports.TransactionAuthenticatorEd25519 = Ct; exports.TransactionAuthenticatorFeePayer = It; exports.TransactionAuthenticatorMultiAgent = Et; exports.TransactionAuthenticatorMultiEd25519 = Or; exports.TransactionAuthenticatorSingleSender = Ut; exports.TransactionAuthenticatorVariant = wi; exports.TransactionPayload = ct; exports.TransactionPayloadEntryFunction = Zt; exports.TransactionPayloadMultiSig = Jt; exports.TransactionPayloadScript = Yt; exports.TransactionPayloadVariants = Ti; exports.TransactionResponseType = Sr; exports.TransactionVariants = bi; exports.TransactionWorker = gr; exports.TransactionWorkerEventsEnum = ra; exports.TypeTag = z; exports.TypeTagAddress = W; exports.TypeTagBool = K; exports.TypeTagGeneric = k; exports.TypeTagParserError = N; exports.TypeTagParserErrorType = Tc; exports.TypeTagReference = Nn; exports.TypeTagSigner = Pt; exports.TypeTagStruct = y; exports.TypeTagU128 = $e; exports.TypeTagU16 = qe; exports.TypeTagU256 = Le; exports.TypeTagU32 = Ve; exports.TypeTagU64 = $; exports.TypeTagU8 = ce; exports.TypeTagVariants = hi; exports.TypeTagVector = C; exports.U128 = ge; exports.U16 = de; exports.U256 = me; exports.U32 = le; exports.U64 = O; exports.U8 = F; exports.ZeroKnowledgeSig = Ue; exports.ZkProof = _t; exports.ZkpVariant = wr; exports.aptosCoinStructTag = sm; exports.aptosRequest = Gn; exports.base64UrlDecode = _chunkHBPH2AD3js.e; exports.buildTransaction = oi; exports.checkOrConvertArgument = Nt; exports.convertAmountFromHumanReadableToOnChain = _chunkHBPH2AD3js.f; exports.convertAmountFromOnChainToHumanReadable = _chunkHBPH2AD3js.g; exports.convertArgument = ii; exports.convertNumber = er; exports.createObjectAddress = Nr; exports.createResourceAddress = Gg; exports.createTokenAddress = Kg; exports.deriveKey = xr; exports.deriveTransactionType = Fr; exports.deserializeFromScriptArgument = nc; exports.ensureBoolean = Ar; exports.fetchEntryFunctionAbi = jo; exports.fetchFunctionAbi = Wo; exports.fetchViewFunctionAbi = Xo; exports.findFirstNonSignerArg = Lo; exports.floorToWholeHour = _chunkHBPH2AD3js.d; exports.generateRawTransaction = Pc; exports.generateSignedTransaction = si; exports.generateSignedTransactionForSimulation = Zo; exports.generateSigningMessage = Rt; exports.generateSigningMessageForSerializable = hy; exports.generateSigningMessageForTransaction = zt; exports.generateTransactionPayload = or; exports.generateTransactionPayloadWithABI = _c; exports.generateUserTransactionHash = ch; exports.generateViewFunctionPayload = Yo; exports.generateViewFunctionPayloadWithABI = xc; exports.get = Dr; exports.getAptosFullNode = V; exports.getAptosPepperService = sl; exports.getAuthenticatorForSimulation = ir; exports.getFunctionParts = an; exports.getKeylessConfig = Zi; exports.hashValues = Jo; exports.isBcsAddress = nr; exports.isBcsBool = jr; exports.isBcsFixedBytes = mc; exports.isBcsString = Xr; exports.isBcsU128 = ti; exports.isBcsU16 = Zr; exports.isBcsU256 = ni; exports.isBcsU32 = Jr; exports.isBcsU64 = ei; exports.isBcsU8 = Yr; exports.isBlockEpilogueTransactionResponse = Du; exports.isBlockMetadataTransactionResponse = Ru; exports.isBool = Mo; exports.isCanonicalEd25519Signature = Sa; exports.isEd25519Signature = Bu; exports.isEmptyOption = qo; exports.isEncodedEntryFunctionArgument = Vo; exports.isEncodedStruct = _chunkHBPH2AD3js.i; exports.isFeePayerSignature = Nu; exports.isGenesisTransactionResponse = Uu; exports.isLargeNumber = tr; exports.isMultiAgentSignature = Ku; exports.isMultiEd25519Signature = Ou; exports.isNumber = gc; exports.isPendingTransactionResponse = Eu; exports.isScriptDataInput = $o; exports.isSecp256k1Signature = Gu; exports.isStateCheckpointTransactionResponse = zu; exports.isString = We; exports.isUserTransactionResponse = Iu; exports.isValidBIP44Path = Ui; exports.isValidHardenedPath = Ri; exports.isValidatorTransactionResponse = ku; exports.mnemonicToSeed = Un; exports.normalizeBundle = Hi; exports.nowInSeconds = _chunkHBPH2AD3js.c; exports.objectStructTag = re; exports.optionStructTag = am; exports.outOfRangeErrorMessage = pa; exports.paginateWithCursor = bt; exports.parseEncodedStruct = _chunkHBPH2AD3js.h; exports.parseTypeTag = ke; exports.post = jt; exports.postAptosFaucet = Wi; exports.postAptosFullNode = Fe; exports.postAptosIndexer = Qi; exports.postAptosPepperService = ji; exports.postAptosProvingService = Xi; exports.promiseFulfilledStatus = na; exports.request = Wa; exports.sleep = _chunkHBPH2AD3js.b; exports.splitPath = ki; exports.standardizeTypeTags = rr; exports.stringStructTag = v; exports.throwTypeMismatch = U; exports.validateNumberInRange = Ge;
|
|
473
473
|
//# sourceMappingURL=index.js.map
|