@aptos-labs/ts-sdk 1.35.0 → 1.36.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-CuHovHdK.d.ts → accountAddress-jrha_M3l.d.ts} +1 -1
- package/dist/common/{chunk-RX5UBAME.js → chunk-PA2XFIP3.js} +3 -3
- package/dist/common/chunk-PA2XFIP3.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 +99 -31
- package/dist/common/index.js +31 -31
- package/dist/common/index.js.map +1 -1
- package/dist/esm/account/AbstractKeylessAccount.mjs +1 -1
- package/dist/esm/account/AbstractedAccount.mjs +1 -1
- package/dist/esm/account/Account.mjs +1 -1
- package/dist/esm/account/AccountUtils.mjs +1 -1
- package/dist/esm/account/Ed25519Account.mjs +1 -1
- package/dist/esm/account/EphemeralKeyPair.mjs +1 -1
- package/dist/esm/account/FederatedKeylessAccount.mjs +1 -1
- package/dist/esm/account/KeylessAccount.mjs +1 -1
- package/dist/esm/account/MultiEd25519Account.mjs +1 -1
- package/dist/esm/account/MultiKeyAccount.d.mts +1 -0
- 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/account/utils.mjs +1 -1
- package/dist/esm/api/account/abstraction.mjs +1 -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/coin.mjs +1 -1
- package/dist/esm/api/digitalAsset.mjs +1 -1
- package/dist/esm/api/event.mjs +1 -1
- package/dist/esm/api/experimental.mjs +1 -1
- package/dist/esm/api/faucet.mjs +1 -1
- package/dist/esm/api/fungibleAsset.mjs +1 -1
- package/dist/esm/api/general.d.mts +2 -2
- 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.d.mts +34 -13
- 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/sign.mjs.map +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/{chunk-EGCL6KA6.mjs → chunk-2N4EPY2J.mjs} +2 -2
- package/dist/esm/{chunk-YAGIE4GN.mjs → chunk-2OBSQ2FK.mjs} +2 -2
- package/dist/esm/{chunk-752TOOCA.mjs → chunk-2P27DDVV.mjs} +2 -2
- package/dist/esm/{chunk-RDPWCN4B.mjs → chunk-2SAOCLIU.mjs} +2 -2
- package/dist/esm/{chunk-44EHAKKW.mjs → chunk-36H47QOE.mjs} +2 -2
- package/dist/esm/{chunk-AQWKKSRN.mjs → chunk-3DHWWNJ3.mjs} +2 -2
- package/dist/esm/{chunk-DAJFOJ3L.mjs → chunk-4KKJ36IO.mjs} +2 -2
- package/dist/esm/{chunk-UJJGIPOA.mjs → chunk-4PW3JKQZ.mjs} +2 -2
- package/dist/esm/chunk-4QK4SKAT.mjs +2 -0
- package/dist/esm/{chunk-OLGEN23M.mjs.map → chunk-4QK4SKAT.mjs.map} +1 -1
- package/dist/esm/{chunk-B23VO5TB.mjs → chunk-4SWK3JHQ.mjs} +2 -2
- package/dist/esm/{chunk-XW3BXTCZ.mjs → chunk-553ZRNUL.mjs} +2 -2
- package/dist/esm/{chunk-ZS2IVRHT.mjs → chunk-5AD7ZF6G.mjs} +2 -2
- package/dist/esm/{chunk-GTVMJJQQ.mjs → chunk-5MVHOQKD.mjs} +2 -2
- package/dist/esm/{chunk-HKL4MFNL.mjs → chunk-5W5XV63W.mjs} +2 -2
- package/dist/esm/{chunk-P5CM4C2G.mjs → chunk-5WWU3WSU.mjs} +2 -2
- package/dist/esm/{chunk-FOEPRHAC.mjs → chunk-6FQDCTMA.mjs} +2 -2
- package/dist/esm/{chunk-5H5D6QVX.mjs → chunk-6IULVNLQ.mjs} +2 -2
- package/dist/esm/{chunk-2TRQERBL.mjs → chunk-6KI24ZRR.mjs} +2 -2
- package/dist/esm/{chunk-BPHCRTHD.mjs → chunk-6VGLRQBT.mjs} +2 -2
- package/dist/esm/{chunk-HBTJN4RJ.mjs → chunk-6YPM7TK2.mjs} +2 -2
- package/dist/esm/{chunk-XSBUL2WP.mjs → chunk-7HC33TEX.mjs} +2 -2
- package/dist/esm/{chunk-PC25RPDV.mjs → chunk-7KHKP7DY.mjs} +2 -2
- package/dist/esm/{chunk-MFLHAVIW.mjs → chunk-ACE3NEV6.mjs} +2 -2
- package/dist/esm/{chunk-CPFQUFVD.mjs → chunk-APGCD5FH.mjs} +2 -2
- package/dist/esm/{chunk-BHVSIRNF.mjs → chunk-CU6HQJSE.mjs} +2 -2
- package/dist/esm/{chunk-BHVSIRNF.mjs.map → chunk-CU6HQJSE.mjs.map} +1 -1
- package/dist/esm/{chunk-W4SMZ6IW.mjs → chunk-DAR3R4UP.mjs} +2 -2
- package/dist/esm/{chunk-3LDVJ2YK.mjs → chunk-DUJJUR7O.mjs} +2 -2
- package/dist/esm/{chunk-GU4MD5ST.mjs → chunk-EHTTY7EF.mjs} +2 -2
- package/dist/esm/{chunk-K233I26C.mjs → chunk-FCHN3LT7.mjs} +2 -2
- package/dist/esm/chunk-G3MHXDYA.mjs +1 -0
- package/dist/esm/{chunk-YXYYII5S.mjs → chunk-GJOUTA7U.mjs} +2 -2
- package/dist/esm/{chunk-6IJZRG3U.mjs → chunk-HTP5ZVX5.mjs} +2 -2
- package/dist/esm/{chunk-6IJZRG3U.mjs.map → chunk-HTP5ZVX5.mjs.map} +1 -1
- package/dist/esm/{chunk-IOHESHLR.mjs → chunk-HWMMVLTP.mjs} +2 -2
- package/dist/esm/chunk-HWNPKEOJ.mjs +2 -0
- package/dist/esm/chunk-HWNPKEOJ.mjs.map +1 -0
- package/dist/esm/chunk-IM4O756A.mjs +2 -0
- package/dist/esm/chunk-IM4O756A.mjs.map +1 -0
- package/dist/esm/{chunk-VDYUMBOT.mjs → chunk-JA7CXAVY.mjs} +2 -2
- package/dist/esm/{chunk-YLUULY6G.mjs → chunk-JBARRS6K.mjs} +2 -2
- package/dist/esm/{chunk-SJDHW55X.mjs → chunk-JLZGYZBX.mjs} +2 -2
- package/dist/esm/{chunk-QYJKCRVA.mjs → chunk-JXHGJ3AA.mjs} +2 -2
- package/dist/esm/chunk-K4JUKMMY.mjs +2 -0
- package/dist/esm/{chunk-G5F5ZOH5.mjs.map → chunk-K4JUKMMY.mjs.map} +1 -1
- package/dist/esm/{chunk-KK5HUWF6.mjs → chunk-KBC4ECVP.mjs} +2 -2
- package/dist/esm/chunk-LET633ZK.mjs +2 -0
- package/dist/esm/{chunk-5W2ERBGY.mjs.map → chunk-LET633ZK.mjs.map} +1 -1
- package/dist/esm/{chunk-27ESCVVC.mjs → chunk-M2GGYCLU.mjs} +2 -2
- package/dist/esm/{chunk-2YKERRHD.mjs → chunk-MY2BEHYF.mjs} +2 -2
- package/dist/esm/{chunk-MAWGZICD.mjs → chunk-MZVVBJVV.mjs} +2 -2
- package/dist/esm/chunk-N73S2K2V.mjs +2 -0
- package/dist/esm/chunk-NIDF2LHF.mjs +2 -0
- package/dist/esm/chunk-NIDF2LHF.mjs.map +1 -0
- package/dist/esm/{chunk-YWSDONJJ.mjs → chunk-OSZWSLJA.mjs} +2 -2
- package/dist/esm/chunk-P265EC4T.mjs +2 -0
- package/dist/esm/{chunk-E5PAUR4N.mjs.map → chunk-P265EC4T.mjs.map} +1 -1
- package/dist/esm/{chunk-U4DEYWFT.mjs → chunk-PE7KT5ZB.mjs} +2 -2
- package/dist/esm/{chunk-WLDYBSOG.mjs → chunk-PICZWW35.mjs} +2 -2
- package/dist/esm/{chunk-US2HZFOM.mjs → chunk-Q3AVJUBL.mjs} +2 -2
- package/dist/esm/{chunk-GI4AR6DQ.mjs → chunk-QLEZDMIK.mjs} +2 -2
- package/dist/esm/{chunk-7A2KHJ3D.mjs → chunk-QXTQNFEQ.mjs} +2 -2
- package/dist/esm/{chunk-OPD5EKOA.mjs → chunk-R6I6Z3AA.mjs} +2 -2
- package/dist/esm/{chunk-T7X4GZDU.mjs → chunk-SCLWOTHD.mjs} +2 -2
- package/dist/esm/{chunk-HVIF6DW6.mjs → chunk-SZU5Q6CF.mjs} +2 -2
- package/dist/esm/{chunk-ONGH5DXZ.mjs → chunk-T3VLXADE.mjs} +2 -2
- package/dist/esm/{chunk-WHVCUVZP.mjs → chunk-TJICLFR2.mjs} +2 -2
- package/dist/esm/{chunk-PYY2RXFP.mjs → chunk-U6ZD22B5.mjs} +2 -2
- package/dist/esm/{chunk-WFKPVKU3.mjs → chunk-UOBDL2BZ.mjs} +2 -2
- package/dist/esm/chunk-UP36QQGG.mjs +4 -0
- package/dist/esm/{chunk-VWZEJTGP.mjs.map → chunk-UP36QQGG.mjs.map} +1 -1
- package/dist/esm/{chunk-2ZLFQBT2.mjs → chunk-VIXTXBYA.mjs} +2 -2
- package/dist/esm/{chunk-Y65PKZLK.mjs → chunk-WYV4W2IM.mjs} +2 -2
- package/dist/esm/{chunk-TH5JCPN2.mjs → chunk-X5ORWYVO.mjs} +2 -2
- package/dist/esm/{chunk-2SAYQUUX.mjs → chunk-X5UJYMJU.mjs} +2 -2
- package/dist/esm/chunk-X5YB74NB.mjs +2 -0
- package/dist/esm/{chunk-BY3XFRUM.mjs.map → chunk-X5YB74NB.mjs.map} +1 -1
- package/dist/esm/{chunk-QUJM5W4L.mjs → chunk-X6H4G6NE.mjs} +2 -2
- package/dist/esm/{chunk-BQYKFATL.mjs → chunk-XFL3B4WZ.mjs} +2 -2
- package/dist/esm/{chunk-67A5U2X6.mjs → chunk-XX4SFNZY.mjs} +2 -2
- package/dist/esm/{chunk-CPAAEEF4.mjs → chunk-YMXJ6GYE.mjs} +2 -2
- package/dist/esm/chunk-ZJCTELB4.mjs +2 -0
- package/dist/esm/chunk-ZJCTELB4.mjs.map +1 -0
- package/dist/esm/{chunk-GRRBXHVG.mjs → chunk-ZOY6N6UM.mjs} +2 -2
- package/dist/esm/{chunk-TWETGZ3W.mjs → chunk-ZVYTHOS5.mjs} +2 -2
- package/dist/esm/cli/index.mjs +1 -1
- package/dist/esm/cli/localNode.mjs +1 -1
- package/dist/esm/client/core.mjs +1 -1
- package/dist/esm/client/get.mjs +1 -1
- package/dist/esm/client/index.mjs +1 -1
- package/dist/esm/client/post.mjs +1 -1
- package/dist/esm/core/crypto/federatedKeyless.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/singleKey.d.mts +2 -2
- package/dist/esm/core/crypto/singleKey.mjs +1 -1
- package/dist/esm/core/index.mjs +1 -1
- package/dist/esm/errors/index.mjs +1 -1
- package/dist/esm/index.d.mts +2 -2
- package/dist/esm/index.mjs +1 -1
- package/dist/esm/internal/abstraction.mjs +1 -1
- package/dist/esm/internal/account.d.mts +43 -3
- 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/experimental.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.d.mts +3 -22
- package/dist/esm/internal/transactionSubmission.mjs +1 -1
- package/dist/esm/internal/utils/index.d.mts +15 -0
- package/dist/esm/internal/utils/index.mjs +2 -0
- package/dist/esm/internal/utils/utils.d.mts +65 -0
- package/dist/esm/internal/utils/utils.mjs +2 -0
- package/dist/esm/internal/utils/utils.mjs.map +1 -0
- package/dist/esm/internal/view.mjs +1 -1
- package/dist/esm/transactions/authenticator/account.mjs +1 -1
- package/dist/esm/transactions/authenticator/index.mjs +1 -1
- package/dist/esm/transactions/authenticator/transaction.mjs +1 -1
- package/dist/esm/transactions/index.d.mts +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/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/scriptComposer/index.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/helpers.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/index.d.mts +1 -1
- package/dist/esm/transactions/transactionBuilder/index.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/remoteAbi.d.mts +29 -18
- 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.d.mts +16 -0
- package/dist/esm/transactions/typeTag/index.mjs +1 -1
- package/dist/esm/transactions/typeTag/parser.mjs +1 -1
- package/dist/esm/utils/helpers.d.mts +20 -1
- package/dist/esm/utils/helpers.mjs +1 -1
- package/dist/esm/utils/index.d.mts +1 -1
- package/dist/esm/utils/index.mjs +1 -1
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +26 -25
- package/src/account/MultiKeyAccount.ts +3 -2
- package/src/api/general.ts +2 -2
- package/src/api/transaction.ts +30 -9
- package/src/internal/account.ts +201 -59
- package/src/internal/transactionSubmission.ts +4 -81
- package/src/internal/utils/index.ts +4 -0
- package/src/internal/utils/utils.ts +116 -0
- package/src/transactions/scriptComposer/index.ts +22 -7
- package/src/transactions/transactionBuilder/remoteAbi.ts +106 -34
- package/src/transactions/transactionBuilder/transactionBuilder.ts +7 -2
- package/src/transactions/typeTag/index.ts +22 -0
- package/src/utils/helpers.ts +22 -0
- package/src/version.ts +1 -1
- package/dist/common/chunk-RX5UBAME.js.map +0 -1
- package/dist/esm/chunk-53IBOHXB.mjs +0 -2
- package/dist/esm/chunk-53IBOHXB.mjs.map +0 -1
- package/dist/esm/chunk-5W2ERBGY.mjs +0 -2
- package/dist/esm/chunk-BY3XFRUM.mjs +0 -2
- package/dist/esm/chunk-CXLNTATW.mjs +0 -2
- package/dist/esm/chunk-E5PAUR4N.mjs +0 -2
- package/dist/esm/chunk-FJ5J7CVW.mjs +0 -2
- package/dist/esm/chunk-FJ5J7CVW.mjs.map +0 -1
- package/dist/esm/chunk-G5F5ZOH5.mjs +0 -2
- package/dist/esm/chunk-HYJQHVDZ.mjs +0 -2
- package/dist/esm/chunk-HYJQHVDZ.mjs.map +0 -1
- package/dist/esm/chunk-JXCZTOYC.mjs +0 -1
- package/dist/esm/chunk-L6KVC7CJ.mjs +0 -2
- package/dist/esm/chunk-L6KVC7CJ.mjs.map +0 -1
- package/dist/esm/chunk-OLGEN23M.mjs +0 -2
- package/dist/esm/chunk-PIPDQFL2.mjs +0 -2
- package/dist/esm/chunk-PIPDQFL2.mjs.map +0 -1
- package/dist/esm/chunk-UIRAXHDH.mjs +0 -1
- package/dist/esm/chunk-VWZEJTGP.mjs +0 -4
- package/dist/esm/chunk-W2C5KRUQ.mjs +0 -2
- package/dist/esm/chunk-W2C5KRUQ.mjs.map +0 -1
- package/dist/esm/chunk-XRVZAEQO.mjs +0 -2
- package/dist/esm/chunk-XRVZAEQO.mjs.map +0 -1
- /package/dist/esm/{chunk-EGCL6KA6.mjs.map → chunk-2N4EPY2J.mjs.map} +0 -0
- /package/dist/esm/{chunk-YAGIE4GN.mjs.map → chunk-2OBSQ2FK.mjs.map} +0 -0
- /package/dist/esm/{chunk-752TOOCA.mjs.map → chunk-2P27DDVV.mjs.map} +0 -0
- /package/dist/esm/{chunk-RDPWCN4B.mjs.map → chunk-2SAOCLIU.mjs.map} +0 -0
- /package/dist/esm/{chunk-44EHAKKW.mjs.map → chunk-36H47QOE.mjs.map} +0 -0
- /package/dist/esm/{chunk-AQWKKSRN.mjs.map → chunk-3DHWWNJ3.mjs.map} +0 -0
- /package/dist/esm/{chunk-DAJFOJ3L.mjs.map → chunk-4KKJ36IO.mjs.map} +0 -0
- /package/dist/esm/{chunk-UJJGIPOA.mjs.map → chunk-4PW3JKQZ.mjs.map} +0 -0
- /package/dist/esm/{chunk-B23VO5TB.mjs.map → chunk-4SWK3JHQ.mjs.map} +0 -0
- /package/dist/esm/{chunk-XW3BXTCZ.mjs.map → chunk-553ZRNUL.mjs.map} +0 -0
- /package/dist/esm/{chunk-ZS2IVRHT.mjs.map → chunk-5AD7ZF6G.mjs.map} +0 -0
- /package/dist/esm/{chunk-GTVMJJQQ.mjs.map → chunk-5MVHOQKD.mjs.map} +0 -0
- /package/dist/esm/{chunk-HKL4MFNL.mjs.map → chunk-5W5XV63W.mjs.map} +0 -0
- /package/dist/esm/{chunk-P5CM4C2G.mjs.map → chunk-5WWU3WSU.mjs.map} +0 -0
- /package/dist/esm/{chunk-FOEPRHAC.mjs.map → chunk-6FQDCTMA.mjs.map} +0 -0
- /package/dist/esm/{chunk-5H5D6QVX.mjs.map → chunk-6IULVNLQ.mjs.map} +0 -0
- /package/dist/esm/{chunk-2TRQERBL.mjs.map → chunk-6KI24ZRR.mjs.map} +0 -0
- /package/dist/esm/{chunk-BPHCRTHD.mjs.map → chunk-6VGLRQBT.mjs.map} +0 -0
- /package/dist/esm/{chunk-HBTJN4RJ.mjs.map → chunk-6YPM7TK2.mjs.map} +0 -0
- /package/dist/esm/{chunk-XSBUL2WP.mjs.map → chunk-7HC33TEX.mjs.map} +0 -0
- /package/dist/esm/{chunk-PC25RPDV.mjs.map → chunk-7KHKP7DY.mjs.map} +0 -0
- /package/dist/esm/{chunk-MFLHAVIW.mjs.map → chunk-ACE3NEV6.mjs.map} +0 -0
- /package/dist/esm/{chunk-CPFQUFVD.mjs.map → chunk-APGCD5FH.mjs.map} +0 -0
- /package/dist/esm/{chunk-W4SMZ6IW.mjs.map → chunk-DAR3R4UP.mjs.map} +0 -0
- /package/dist/esm/{chunk-3LDVJ2YK.mjs.map → chunk-DUJJUR7O.mjs.map} +0 -0
- /package/dist/esm/{chunk-GU4MD5ST.mjs.map → chunk-EHTTY7EF.mjs.map} +0 -0
- /package/dist/esm/{chunk-K233I26C.mjs.map → chunk-FCHN3LT7.mjs.map} +0 -0
- /package/dist/esm/{chunk-JXCZTOYC.mjs.map → chunk-G3MHXDYA.mjs.map} +0 -0
- /package/dist/esm/{chunk-YXYYII5S.mjs.map → chunk-GJOUTA7U.mjs.map} +0 -0
- /package/dist/esm/{chunk-IOHESHLR.mjs.map → chunk-HWMMVLTP.mjs.map} +0 -0
- /package/dist/esm/{chunk-VDYUMBOT.mjs.map → chunk-JA7CXAVY.mjs.map} +0 -0
- /package/dist/esm/{chunk-YLUULY6G.mjs.map → chunk-JBARRS6K.mjs.map} +0 -0
- /package/dist/esm/{chunk-SJDHW55X.mjs.map → chunk-JLZGYZBX.mjs.map} +0 -0
- /package/dist/esm/{chunk-QYJKCRVA.mjs.map → chunk-JXHGJ3AA.mjs.map} +0 -0
- /package/dist/esm/{chunk-KK5HUWF6.mjs.map → chunk-KBC4ECVP.mjs.map} +0 -0
- /package/dist/esm/{chunk-27ESCVVC.mjs.map → chunk-M2GGYCLU.mjs.map} +0 -0
- /package/dist/esm/{chunk-2YKERRHD.mjs.map → chunk-MY2BEHYF.mjs.map} +0 -0
- /package/dist/esm/{chunk-MAWGZICD.mjs.map → chunk-MZVVBJVV.mjs.map} +0 -0
- /package/dist/esm/{chunk-CXLNTATW.mjs.map → chunk-N73S2K2V.mjs.map} +0 -0
- /package/dist/esm/{chunk-YWSDONJJ.mjs.map → chunk-OSZWSLJA.mjs.map} +0 -0
- /package/dist/esm/{chunk-U4DEYWFT.mjs.map → chunk-PE7KT5ZB.mjs.map} +0 -0
- /package/dist/esm/{chunk-WLDYBSOG.mjs.map → chunk-PICZWW35.mjs.map} +0 -0
- /package/dist/esm/{chunk-US2HZFOM.mjs.map → chunk-Q3AVJUBL.mjs.map} +0 -0
- /package/dist/esm/{chunk-GI4AR6DQ.mjs.map → chunk-QLEZDMIK.mjs.map} +0 -0
- /package/dist/esm/{chunk-7A2KHJ3D.mjs.map → chunk-QXTQNFEQ.mjs.map} +0 -0
- /package/dist/esm/{chunk-OPD5EKOA.mjs.map → chunk-R6I6Z3AA.mjs.map} +0 -0
- /package/dist/esm/{chunk-T7X4GZDU.mjs.map → chunk-SCLWOTHD.mjs.map} +0 -0
- /package/dist/esm/{chunk-HVIF6DW6.mjs.map → chunk-SZU5Q6CF.mjs.map} +0 -0
- /package/dist/esm/{chunk-ONGH5DXZ.mjs.map → chunk-T3VLXADE.mjs.map} +0 -0
- /package/dist/esm/{chunk-WHVCUVZP.mjs.map → chunk-TJICLFR2.mjs.map} +0 -0
- /package/dist/esm/{chunk-PYY2RXFP.mjs.map → chunk-U6ZD22B5.mjs.map} +0 -0
- /package/dist/esm/{chunk-WFKPVKU3.mjs.map → chunk-UOBDL2BZ.mjs.map} +0 -0
- /package/dist/esm/{chunk-2ZLFQBT2.mjs.map → chunk-VIXTXBYA.mjs.map} +0 -0
- /package/dist/esm/{chunk-Y65PKZLK.mjs.map → chunk-WYV4W2IM.mjs.map} +0 -0
- /package/dist/esm/{chunk-TH5JCPN2.mjs.map → chunk-X5ORWYVO.mjs.map} +0 -0
- /package/dist/esm/{chunk-2SAYQUUX.mjs.map → chunk-X5UJYMJU.mjs.map} +0 -0
- /package/dist/esm/{chunk-QUJM5W4L.mjs.map → chunk-X6H4G6NE.mjs.map} +0 -0
- /package/dist/esm/{chunk-BQYKFATL.mjs.map → chunk-XFL3B4WZ.mjs.map} +0 -0
- /package/dist/esm/{chunk-67A5U2X6.mjs.map → chunk-XX4SFNZY.mjs.map} +0 -0
- /package/dist/esm/{chunk-CPAAEEF4.mjs.map → chunk-YMXJ6GYE.mjs.map} +0 -0
- /package/dist/esm/{chunk-GRRBXHVG.mjs.map → chunk-ZOY6N6UM.mjs.map} +0 -0
- /package/dist/esm/{chunk-TWETGZ3W.mjs.map → chunk-ZVYTHOS5.mjs.map} +0 -0
- /package/dist/esm/{chunk-UIRAXHDH.mjs.map → internal/utils/index.mjs.map} +0 -0
package/dist/common/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } function _optionalChainDelete(ops) { const result = _optionalChain(ops); return result == null ? true : result; }var _chunkRX5UBAMEjs = require('./chunk-RX5UBAME.js');var C=class n{constructor(e){this.buffer=new ArrayBuffer(e.length),new Uint8Array(this.buffer).set(e,0),this.offset=0}static fromHex(e){let t=_chunkRX5UBAMEjs.j.hexInputToUint8Array(e);return new n(t)}read(e){if(this.offset+e>this.buffer.byteLength)throw new Error("Reached to the end of buffer");let t=this.buffer.slice(this.offset,this.offset+e);return this.offset+=e,t}remaining(){return this.buffer.byteLength-this.offset}deserializeStr(){let e=this.deserializeBytes();return new TextDecoder().decode(e)}deserializeOptionStr(){return this.deserializeOption("string")}deserializeOption(e,t){if(this.deserializeBool()){if(e==="string")return this.deserializeStr();if(e==="bytes")return this.deserializeBytes();if(e==="fixedBytes"){if(t===void 0)throw new Error("Fixed bytes length not provided");return this.deserializeFixedBytes(t)}return this.deserialize(e)}}deserializeBytes(){let e=this.deserializeUleb128AsU32();return new Uint8Array(this.read(e))}deserializeFixedBytes(e){return new Uint8Array(this.read(e))}deserializeBool(){let e=new Uint8Array(this.read(1))[0];if(e!==1&&e!==0)throw new Error("Invalid boolean value");return e===1}deserializeU8(){return new DataView(this.read(1)).getUint8(0)}deserializeU16(){return new DataView(this.read(2)).getUint16(0,!0)}deserializeU32(){return new DataView(this.read(4)).getUint32(0,!0)}deserializeU64(){let e=this.deserializeU32(),t=this.deserializeU32();return BigInt(BigInt(t)<<BigInt(32)|BigInt(e))}deserializeU128(){let e=this.deserializeU64(),t=this.deserializeU64();return BigInt(t<<BigInt(64)|e)}deserializeU256(){let e=this.deserializeU128(),t=this.deserializeU128();return BigInt(t<<BigInt(128)|e)}deserializeUleb128AsU32(){let e=BigInt(0),t=0;for(;e<_chunkRX5UBAMEjs.d;){let r=this.deserializeU8();if(e|=BigInt(r&127)<<BigInt(t),!(r&128))break;t+=7}if(e>_chunkRX5UBAMEjs.d)throw new Error("Overflow while parsing uleb128-encoded uint32 value");return Number(e)}deserialize(e){return e.deserialize(this)}deserializeVector(e){let t=this.deserializeUleb128AsU32(),r=new Array;for(let i=0;i<t;i+=1)r.push(this.deserialize(e));return r}};var gt=class n extends _chunkRX5UBAMEjs.l{constructor(e){super(),this.value=_chunkRX5UBAMEjs.j.fromHexInput(e).toUint8Array()}serialize(e){e.serializeFixedBytes(this.value)}serializeForEntryFunction(e){e.serialize(this)}serializeForScriptFunction(e){e.serialize(this)}static deserialize(e,t){let r=e.deserializeFixedBytes(t);return new n(r)}};var Jn=class n extends _chunkRX5UBAMEjs.l{constructor(e){super(),this.value=new gt(e)}serialize(e){e.serialize(this.value)}serializeForEntryFunction(e){e.serializeU32AsUleb128(this.value.value.length),e.serialize(this)}static deserialize(e,t){let r=gt.deserialize(e,t);return new n(r.value)}};var U=class n extends _chunkRX5UBAMEjs.l{constructor(e){super(),_chunkRX5UBAMEjs.n.call(void 0, e),this.value=e}serialize(e){e.serializeBool(this.value)}serializeForEntryFunction(e){let t=this.bcsToBytes();e.serializeBytes(t)}serializeForScriptFunction(e){e.serializeU32AsUleb128(5),e.serialize(this)}deserialize(e){return new me(e.deserializeU256())}static deserialize(e){return new n(e.deserializeBool())}},X= exports.U8 =class n extends _chunkRX5UBAMEjs.l{constructor(e){super(),_chunkRX5UBAMEjs.p.call(void 0, e,0,_chunkRX5UBAMEjs.b),this.value=e}serialize(e){e.serializeU8(this.value)}serializeForEntryFunction(e){let t=this.bcsToBytes();e.serializeBytes(t)}serializeForScriptFunction(e){e.serializeU32AsUleb128(0),e.serialize(this)}static deserialize(e){return new n(e.deserializeU8())}},we= exports.U16 =class n extends _chunkRX5UBAMEjs.l{constructor(e){super(),_chunkRX5UBAMEjs.p.call(void 0, e,0,_chunkRX5UBAMEjs.c),this.value=e}serialize(e){e.serializeU16(this.value)}serializeForEntryFunction(e){let t=this.bcsToBytes();e.serializeBytes(t)}serializeForScriptFunction(e){e.serializeU32AsUleb128(6),e.serialize(this)}static deserialize(e){return new n(e.deserializeU16())}},Se= exports.U32 =class n extends _chunkRX5UBAMEjs.l{constructor(e){super(),_chunkRX5UBAMEjs.p.call(void 0, e,0,_chunkRX5UBAMEjs.d),this.value=e}serialize(e){e.serializeU32(this.value)}serializeForEntryFunction(e){let t=this.bcsToBytes();e.serializeBytes(t)}serializeForScriptFunction(e){e.serializeU32AsUleb128(7),e.serialize(this)}static deserialize(e){return new n(e.deserializeU32())}},W= exports.U64 =class n extends _chunkRX5UBAMEjs.l{constructor(e){super(),_chunkRX5UBAMEjs.p.call(void 0, e,BigInt(0),_chunkRX5UBAMEjs.e),this.value=BigInt(e)}serialize(e){e.serializeU64(this.value)}serializeForEntryFunction(e){let t=this.bcsToBytes();e.serializeBytes(t)}serializeForScriptFunction(e){e.serializeU32AsUleb128(1),e.serialize(this)}static deserialize(e){return new n(e.deserializeU64())}},_e= exports.U128 =class n extends _chunkRX5UBAMEjs.l{constructor(e){super(),_chunkRX5UBAMEjs.p.call(void 0, e,BigInt(0),_chunkRX5UBAMEjs.f),this.value=BigInt(e)}serialize(e){e.serializeU128(this.value)}serializeForEntryFunction(e){let t=this.bcsToBytes();e.serializeBytes(t)}serializeForScriptFunction(e){e.serializeU32AsUleb128(2),e.serialize(this)}static deserialize(e){return new n(e.deserializeU128())}},me= exports.U256 =class n extends _chunkRX5UBAMEjs.l{constructor(e){super(),_chunkRX5UBAMEjs.p.call(void 0, e,BigInt(0),_chunkRX5UBAMEjs.g),this.value=BigInt(e)}serialize(e){e.serializeU256(this.value)}serializeForEntryFunction(e){let t=this.bcsToBytes();e.serializeBytes(t)}serializeForScriptFunction(e){e.serializeU32AsUleb128(8),e.serialize(this)}static deserialize(e){return new n(e.deserializeU256())}};var _=class n extends _chunkRX5UBAMEjs.l{constructor(e){super(),this.values=e}serializeForEntryFunction(e){let t=this.bcsToBytes();e.serializeBytes(t)}serializeForScriptFunction(e){if(this.values[0]!==void 0&&!(this.values[0]instanceof X)){new cn(this.bcsToBytes()).serializeForScriptFunction(e);return}e.serializeU32AsUleb128(4),e.serialize(this)}static U8(e){let t;if(Array.isArray(e)&&e.length===0)t=[];else if(Array.isArray(e)&&typeof e[0]=="number")t=e;else if(typeof e=="string"){let r=_chunkRX5UBAMEjs.j.fromHexInput(e);t=Array.from(r.toUint8Array())}else if(e instanceof Uint8Array)t=Array.from(e);else throw new Error("Invalid input type, must be an number[], Uint8Array, or hex string");return new n(t.map(r=>new X(r)))}static U16(e){return new n(e.map(t=>new we(t)))}static U32(e){return new n(e.map(t=>new Se(t)))}static U64(e){return new n(e.map(t=>new W(t)))}static U128(e){return new n(e.map(t=>new _e(t)))}static U256(e){return new n(e.map(t=>new me(t)))}static Bool(e){return new n(e.map(t=>new U(t)))}static MoveString(e){return new n(e.map(t=>new P(t)))}serialize(e){e.serializeVector(this.values)}static deserialize(e,t){let r=e.deserializeUleb128AsU32(),i=new Array;for(let o=0;o<r;o+=1)i.push(t.deserialize(e));return new n(i)}},cn= exports.Serialized =class n extends _chunkRX5UBAMEjs.l{constructor(e){super(),this.value=_chunkRX5UBAMEjs.j.fromHexInput(e).toUint8Array()}serialize(e){e.serializeBytes(this.value)}serializeForEntryFunction(e){this.serialize(e)}serializeForScriptFunction(e){e.serializeU32AsUleb128(9),this.serialize(e)}static deserialize(e){return new n(e.deserializeBytes())}toMoveVector(e){let t=new C(this.bcsToBytes());t.deserializeUleb128AsU32();let r=t.deserializeVector(e);return new _(r)}},P= exports.MoveString =class n extends _chunkRX5UBAMEjs.l{constructor(e){super(),this.value=e}serialize(e){e.serializeStr(this.value)}serializeForEntryFunction(e){let t=this.bcsToBytes();e.serializeBytes(t)}serializeForScriptFunction(e){let r=new TextEncoder().encode(this.value);_.U8(r).serializeForScriptFunction(e)}static deserialize(e){return new n(e.deserializeStr())}},Y= exports.MoveOption =class n extends _chunkRX5UBAMEjs.l{constructor(e){super(),typeof e<"u"&&e!==null?this.vec=new _([e]):this.vec=new _([]),[this.value]=this.vec.values}serializeForEntryFunction(e){let t=this.bcsToBytes();e.serializeBytes(t)}unwrap(){if(this.isSome())return this.vec.values[0];throw new Error("Called unwrap on a MoveOption with no value")}isSome(){return this.vec.values.length===1}serialize(e){this.vec.serialize(e)}static U8(e){return new n(e!=null?new X(e):void 0)}static U16(e){return new n(e!=null?new we(e):void 0)}static U32(e){return new n(e!=null?new Se(e):void 0)}static U64(e){return new n(e!=null?new W(e):void 0)}static U128(e){return new n(e!=null?new _e(e):void 0)}static U256(e){return new n(e!=null?new me(e):void 0)}static Bool(e){return new n(e!=null?new U(e):void 0)}static MoveString(e){return new n(e!=null?new P(e):void 0)}static deserialize(e,t){let r=_.deserialize(e,t);return new n(r.values[0])}};var _ed25519 = require('@noble/curves/ed25519');var _sha3 = require('@noble/hashes/sha3');var rt=class rt extends _chunkRX5UBAMEjs.l{constructor(e){super();let{data:t}=e,r=_chunkRX5UBAMEjs.j.fromHexInput(t);if(r.toUint8Array().length!==rt.LENGTH)throw new Error(`Authentication Key length should be ${rt.LENGTH}`);this.data=r}serialize(e){e.serializeFixedBytes(this.data.toUint8Array())}static deserialize(e){let t=e.deserializeFixedBytes(rt.LENGTH);return new rt({data:t})}toUint8Array(){return this.data.toUint8Array()}static fromSchemeAndBytes(e){let{scheme:t,input:r}=e,i=_chunkRX5UBAMEjs.j.fromHexInput(r).toUint8Array(),o=new Uint8Array([...i,t]),s=_sha3.sha3_256.create();s.update(o);let a=s.digest();return new rt({data:a})}static fromPublicKeyAndScheme(e){let{publicKey:t}=e;return t.authKey()}static fromPublicKey(e){let{publicKey:t}=e;return t.authKey()}derivedAddress(){return new (0, _chunkRX5UBAMEjs.Z)(this.data.toUint8Array())}};rt.LENGTH=32;var B=rt;var _hmac = require('@noble/hashes/hmac');var _sha512 = require('@noble/hashes/sha512');var _bip39 = require('@scure/bip39'); var Xi = _interopRequireWildcard(_bip39);var rc=/^m\/44'\/637'\/[0-9]+'\/[0-9]+'\/[0-9]+'?$/,ic= exports.APTOS_BIP44_REGEX =/^m\/44'\/637'\/[0-9]+'\/[0-9]+\/[0-9]+$/,oc= exports.KeyType =(e=>(e.ED25519="ed25519 seed",e))(oc||{}),Yi= exports.HARDENED_OFFSET =2147483648;function Zi(n){return ic.test(n)}function eo(n){return rc.test(n)}var Lr=(n,e)=>{let t=_hmac.hmac.create(_sha512.sha512,n).update(e).digest();return{key:t.slice(0,32),chainCode:t.slice(32)}},to= exports.CKDPriv =({key:n,chainCode:e},t)=>{let r=new ArrayBuffer(4);new DataView(r).setUint32(0,t);let i=new Uint8Array(r),o=new Uint8Array([0]),s=new Uint8Array([...o,...n,...i]);return Lr(e,s)},sc=n=>n.replace(/'/g,""),no= exports.splitPath =n=>n.split("/").slice(1).map(sc),Xn= exports.mnemonicToSeed =n=>{let e=n.trim().split(/\s+/).map(t=>t.toLowerCase()).join(" ");return Xi.mnemonicToSeedSync(e)};var un=class un{static formatPrivateKey(e,t){let r=un.AIP80_PREFIXES[t],i=e;return typeof i=="string"&&i.startsWith(r)&&(i=i.split("-")[2]),`${r}${_chunkRX5UBAMEjs.j.fromHexInput(i).toString()}`}static parseHexInput(e,t,r){let i,o=un.AIP80_PREFIXES[t];if(typeof e=="string")if(!r&&!e.startsWith(o))i=_chunkRX5UBAMEjs.j.fromHexInput(e),r!==!1&&console.warn("[Aptos SDK] It is recommended that private keys are AIP-80 compliant (https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-80.md). You can fix the private key by formatting it with `PrivateKey.formatPrivateKey(privateKey: string, type: 'ed25519' | 'secp256k1'): string`.");else if(e.startsWith(o))i=_chunkRX5UBAMEjs.j.fromHexString(e.split("-")[2]);else throw r?new Error("Invalid HexString input while parsing private key. Must AIP-80 compliant string."):new Error("Invalid HexString input while parsing private key.");else i=_chunkRX5UBAMEjs.j.fromHexInput(e);return i}};un.AIP80_PREFIXES={ed25519:"ed25519-priv-",secp256k1:"secp256k1-priv-"};var it=un;var mt=class extends _chunkRX5UBAMEjs.l{toUint8Array(){return this.bcsToBytes()}toString(){let e=this.toUint8Array();return _chunkRX5UBAMEjs.j.fromHexInput(e).toString()}},oe= exports.AccountPublicKey =class extends mt{};var M=class extends _chunkRX5UBAMEjs.l{toUint8Array(){return this.bcsToBytes()}toString(){let e=this.toUint8Array();return _chunkRX5UBAMEjs.j.fromHexInput(e).toString()}};var Ot=n=>typeof n=="string"?_chunkRX5UBAMEjs.j.isValid(n).valid?n:new TextEncoder().encode(n):n;var Hr=[237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16];function ac(n){let e=n.toUint8Array().slice(32);for(let t=Hr.length-1;t>=0;t-=1){if(e[t]<Hr[t])return!0;if(e[t]>Hr[t])return!1}return!1}var ot=class ot extends oe{constructor(e){super();let t=_chunkRX5UBAMEjs.j.fromHexInput(e);if(t.toUint8Array().length!==ot.LENGTH)throw new Error(`PublicKey length should be ${ot.LENGTH}`);this.key=t}verifySignature(e){let{message:t,signature:r}=e;if(!ac(r))return!1;let i=Ot(t),o=_chunkRX5UBAMEjs.j.fromHexInput(i).toUint8Array(),s=r.toUint8Array(),a=this.key.toUint8Array();return _ed25519.ed25519.verify(s,o,a)}authKey(){return B.fromSchemeAndBytes({scheme:0,input:this.toUint8Array()})}toUint8Array(){return this.key.toUint8Array()}serialize(e){e.serializeBytes(this.key.toUint8Array())}static deserialize(e){let t=e.deserializeBytes();return new ot(t)}static isPublicKey(e){return e instanceof ot}static isInstance(e){return"key"in e&&_optionalChain([e, 'access', _2 => _2.key, 'optionalAccess', _3 => _3.data, 'optionalAccess', _4 => _4.length])===ot.LENGTH}};ot.LENGTH=32;var x=ot,ye=class ye extends _chunkRX5UBAMEjs.l{constructor(e,t){super();let r=it.parseHexInput(e,"ed25519",t);if(r.toUint8Array().length!==ye.LENGTH)throw new Error(`PrivateKey length should be ${ye.LENGTH}`);this.signingKey=r}static generate(){let e=_ed25519.ed25519.utils.randomPrivateKey();return new ye(e,!1)}static fromDerivationPath(e,t){if(!eo(e))throw new Error(`Invalid derivation path ${e}`);return ye.fromDerivationPathInner(e,Xn(t))}static fromDerivationPathInner(e,t,r=Yi){let{key:i,chainCode:o}=Lr(ye.SLIP_0010_SEED,t),s=no(e).map(c=>parseInt(c,10)),{key:a}=s.reduce((c,d)=>to(c,d+r),{key:i,chainCode:o});return new ye(a,!1)}publicKey(){let e=_ed25519.ed25519.getPublicKey(this.signingKey.toUint8Array());return new x(e)}sign(e){let t=Ot(e),r=_chunkRX5UBAMEjs.j.fromHexInput(t).toUint8Array(),i=_ed25519.ed25519.sign(r,this.signingKey.toUint8Array());return new I(i)}toUint8Array(){return this.signingKey.toUint8Array()}toString(){return this.toHexString()}toHexString(){return this.signingKey.toString()}toAIP80String(){return it.formatPrivateKey(this.signingKey.toString(),"ed25519")}serialize(e){e.serializeBytes(this.toUint8Array())}static deserialize(e){let t=e.deserializeBytes();return new ye(t,!1)}static isPrivateKey(e){return e instanceof ye}};ye.LENGTH=32,ye.SLIP_0010_SEED="ed25519 seed";var q=ye,Ft=class Ft extends M{constructor(e){super();let t=_chunkRX5UBAMEjs.j.fromHexInput(e);if(t.toUint8Array().length!==Ft.LENGTH)throw new Error(`Signature length should be ${Ft.LENGTH}`);this.data=t}toUint8Array(){return this.data.toUint8Array()}serialize(e){e.serializeBytes(this.data.toUint8Array())}static deserialize(e){let t=e.deserializeBytes();return new Ft(t)}};Ft.LENGTH=64;var I=Ft;var _secp256k1 = require('@noble/curves/secp256k1');var _bip32 = require('@scure/bip32');var Ee=class Ee extends mt{constructor(e){super();let t=_chunkRX5UBAMEjs.j.fromHexInput(e),{length:r}=t.toUint8Array();if(r===Ee.LENGTH)this.key=t;else if(r===Ee.COMPRESSED_LENGTH){let i=_secp256k1.secp256k1.ProjectivePoint.fromHex(t.toUint8Array());this.key=_chunkRX5UBAMEjs.j.fromHexInput(i.toRawBytes(!1))}else throw new Error(`PublicKey length should be ${Ee.LENGTH} or ${Ee.COMPRESSED_LENGTH}, received ${r}`)}verifySignature(e){let{message:t,signature:r}=e,i=Ot(t),o=_chunkRX5UBAMEjs.j.fromHexInput(i).toUint8Array(),s=_sha3.sha3_256.call(void 0, o),a=r.toUint8Array();return _secp256k1.secp256k1.verify(a,s,this.key.toUint8Array(),{lowS:!0})}toUint8Array(){return this.key.toUint8Array()}serialize(e){e.serializeBytes(this.key.toUint8Array())}deserialize(e){let t=e.deserializeBytes();return new yt(t)}static deserialize(e){let t=e.deserializeBytes();return new Ee(t)}static isPublicKey(e){return e instanceof Ee}static isInstance(e){return"key"in e&&_optionalChain([e, 'access', _5 => _5.key, 'optionalAccess', _6 => _6.data, 'optionalAccess', _7 => _7.length])===Ee.LENGTH}};Ee.LENGTH=65,Ee.COMPRESSED_LENGTH=33;var Ne=Ee,ve=class ve extends _chunkRX5UBAMEjs.l{constructor(e,t){super();let r=it.parseHexInput(e,"secp256k1",t);if(r.toUint8Array().length!==ve.LENGTH)throw new Error(`PrivateKey length should be ${ve.LENGTH}`);this.key=r}static generate(){let e=_secp256k1.secp256k1.utils.randomPrivateKey();return new ve(e,!1)}static fromDerivationPath(e,t){if(!Zi(e))throw new Error(`Invalid derivation path ${e}`);return ve.fromDerivationPathInner(e,Xn(t))}static fromDerivationPathInner(e,t){let{privateKey:r}=_bip32.HDKey.fromMasterSeed(t).derive(e);if(r===null)throw new Error("Invalid key");return new ve(r,!1)}sign(e){let t=Ot(e),r=_chunkRX5UBAMEjs.j.fromHexInput(t),i=_sha3.sha3_256.call(void 0, r.toUint8Array()),o=_secp256k1.secp256k1.sign(i,this.key.toUint8Array(),{lowS:!0});return new yt(o.toCompactRawBytes())}publicKey(){let e=_secp256k1.secp256k1.getPublicKey(this.key.toUint8Array(),!1);return new Ne(e)}toUint8Array(){return this.key.toUint8Array()}toString(){return this.toHexString()}toHexString(){return this.key.toString()}toAIP80String(){return it.formatPrivateKey(this.key.toString(),"secp256k1")}serialize(e){e.serializeBytes(this.toUint8Array())}static deserialize(e){let t=e.deserializeBytes();return new ve(t,!1)}static isPrivateKey(e){return e instanceof ve}};ve.LENGTH=32;var Ge=ve,Nt=class Nt extends M{constructor(e){super();let t=_chunkRX5UBAMEjs.j.fromHexInput(e);if(t.toUint8Array().length!==Nt.LENGTH)throw new Error(`Signature length should be ${Nt.LENGTH}, received ${t.toUint8Array().length}`);this.data=t}toUint8Array(){return this.data.toUint8Array()}serialize(e){e.serializeBytes(this.data.toUint8Array())}static deserialize(e){let t=e.deserializeBytes();return new Nt(t)}};Nt.LENGTH=64;var yt=Nt;var _jwtdecode = require('jwt-decode');var ft=class n extends mt{constructor(e){super();let t=e.constructor.name;switch(t){case x.name:this.publicKey=e,this.variant=0;break;default:throw new Error(`Unsupported key for EphemeralPublicKey - ${t}`)}}verifySignature(e){let{message:t,signature:r}=e;return this.publicKey.verifySignature({message:t,signature:r.signature})}serialize(e){if(this.publicKey instanceof x)e.serializeU32AsUleb128(0),this.publicKey.serialize(e);else throw new Error("Unknown public key type")}static deserialize(e){let t=e.deserializeUleb128AsU32();switch(t){case 0:return new n(x.deserialize(e));default:throw new Error(`Unknown variant index for EphemeralPublicKey: ${t}`)}}static isPublicKey(e){return e instanceof n}},Ce= exports.EphemeralSignature =class n extends M{constructor(e){super();let t=e.constructor.name;switch(t){case I.name:this.signature=e;break;default:throw new Error(`Unsupported signature for EphemeralSignature - ${t}`)}}static fromHex(e){let t=_chunkRX5UBAMEjs.j.fromHexInput(e),r=new C(t.toUint8Array());return n.deserialize(r)}serialize(e){if(this.signature instanceof I)e.serializeU32AsUleb128(0),this.signature.serialize(e);else throw new Error("Unknown signature type")}static deserialize(e){let t=e.deserializeUleb128AsU32();switch(t){case 0:return new n(I.deserialize(e));default:throw new Error(`Unknown variant index for EphemeralSignature: ${t}`)}}};var _poseidonlite = require('poseidon-lite');var $r=[_poseidonlite.poseidon1,_poseidonlite.poseidon2,_poseidonlite.poseidon3,_poseidonlite.poseidon4,_poseidonlite.poseidon5,_poseidonlite.poseidon6,_poseidonlite.poseidon7,_poseidonlite.poseidon8,_poseidonlite.poseidon9,_poseidonlite.poseidon10,_poseidonlite.poseidon11,_poseidonlite.poseidon12,_poseidonlite.poseidon13,_poseidonlite.poseidon14,_poseidonlite.poseidon15,_poseidonlite.poseidon16],oo=31,Pc=16,io=(Pc-1)*oo;function Zn(n,e){let r=new TextEncoder().encode(n);return xc(r,e)}function xc(n,e){if(n.length>e)throw new Error(`Inputted bytes of length ${n} is longer than ${e}`);let t=Wr(n,e);return ln(t)}function Ic(n,e){if(n.length>e)throw new Error(`Input bytes of length ${n} is longer than ${e}`);let t=Kc(n,e);return vc(t)}function Wr(n,e){if(n.length>e)throw new Error(`Input bytes of length ${n} is longer than ${e}`);return Ic(n,e).concat([BigInt(n.length)])}function vc(n){if(n.length>io)throw new Error(`Can't pack more than ${io}. Was given ${n.length} bytes`);return Cc(n,oo).map(e=>pn(e))}function Cc(n,e){let t=[];for(let r=0;r<n.length;r+=e)t.push(n.subarray(r,r+e));return t}function pn(n){let e=BigInt(0);for(let t=n.length-1;t>=0;t-=1)e=e<<BigInt(8)|BigInt(n[t]);return e}function so(n,e){let t=BigInt(n),r=new Uint8Array(e);for(let i=0;i<e;i+=1)r[i]=Number(t&BigInt(255)),t>>=BigInt(8);return r}function Kc(n,e){if(e<n.length)throw new Error("Padded size must be greater than or equal to the input array size.");let t=new Uint8Array(e);t.set(n);for(let r=n.length;r<e;r+=1)t[r]=0;return t}function ln(n){if(n.length>$r.length)throw new Error(`Unable to hash input of length ${n.length}. Max input length is ${$r.length}`);return $r[n.length-1](n)}var er=class extends _chunkRX5UBAMEjs.l{};var Qr="1.35.0";var ao={mainnet:"https://api.mainnet.aptoslabs.com/v1/graphql",testnet:"https://api.testnet.aptoslabs.com/v1/graphql",devnet:"https://api.devnet.aptoslabs.com/v1/graphql",local:"http://127.0.0.1:8090/v1/graphql"},co= exports.NetworkToNodeAPI ={mainnet:"https://api.mainnet.aptoslabs.com/v1",testnet:"https://api.testnet.aptoslabs.com/v1",devnet:"https://api.devnet.aptoslabs.com/v1",local:"http://127.0.0.1:8080/v1"},uo= exports.NetworkToFaucetAPI ={devnet:"https://faucet.devnet.aptoslabs.com",local:"http://127.0.0.1:8081"},jr= exports.NetworkToPepperAPI ={mainnet:"https://api.mainnet.aptoslabs.com/keyless/pepper/v0",testnet:"https://api.testnet.aptoslabs.com/keyless/pepper/v0",devnet:"https://api.devnet.aptoslabs.com/keyless/pepper/v0",local:"https://api.devnet.aptoslabs.com/keyless/pepper/v0"},Jr= exports.NetworkToProverAPI ={mainnet:"https://api.mainnet.aptoslabs.com/keyless/prover/v0",testnet:"https://api.testnet.aptoslabs.com/keyless/prover/v0",devnet:"https://api.devnet.aptoslabs.com/keyless/prover/v0",local:"https://api.devnet.aptoslabs.com/keyless/prover/v0"},Xr= exports.Network =(o=>(o.MAINNET="mainnet",o.TESTNET="testnet",o.DEVNET="devnet",o.LOCAL="local",o.CUSTOM="custom",o))(Xr||{}),Yr= exports.NetworkToChainId ={mainnet:1,testnet:2,local:4},pl= exports.NetworkToNetworkName ={mainnet:"mainnet",testnet:"testnet",devnet:"devnet",local:"local",custom:"custom"};var At=(o=>(o.FULLNODE="Fullnode",o.INDEXER="Indexer",o.FAUCET="Faucet",o.PEPPER="Pepper",o.PROVER="Prover",o))(At||{}),po= exports.DEFAULT_MAX_GAS_AMOUNT =2e5,lo= exports.DEFAULT_TXN_EXP_SEC_FROM_NOW =20,tr= exports.DEFAULT_TXN_TIMEOUT_SEC =20,ht= exports.APTOS_COIN ="0x1::aptos_coin::AptosCoin",go= exports.APTOS_FA ="0x000000000000000000000000000000000000000000000000000000000000000a",mo= exports.RAW_TRANSACTION_SALT ="APTOS::RawTransaction",Zr= exports.RAW_TRANSACTION_WITH_DATA_SALT ="APTOS::RawTransactionWithData",Be= exports.ProcessorType =(c=>(c.ACCOUNT_TRANSACTION_PROCESSOR="account_transactions_processor",c.DEFAULT="default_processor",c.EVENTS_PROCESSOR="events_processor",c.FUNGIBLE_ASSET_PROCESSOR="fungible_asset_processor",c.STAKE_PROCESSOR="stake_processor",c.TOKEN_V2_PROCESSOR="token_v2_processor",c.USER_TRANSACTION_PROCESSOR="user_transaction_processor",c.OBJECT_PROCESSOR="objects_processor",c))(Be||{}),yo= exports.FIREBASE_AUTH_ISS_PATTERN =/^https:\/\/securetoken\.google\.com\/[a-zA-Z0-9-_]+$/;function fo(n,e){let t=e.bcsToBytes(),r=new C(t);return n.deserialize(r)}var Rc=(o=>(o[o.API_ERROR=0]="API_ERROR",o[o.EXTERNAL_API_ERROR=1]="EXTERNAL_API_ERROR",o[o.SESSION_EXPIRED=2]="SESSION_EXPIRED",o[o.INVALID_STATE=3]="INVALID_STATE",o[o.UNKNOWN=4]="UNKNOWN",o))(Rc||{}),Uc= exports.KeylessErrorResolutionTip =(d=>(d.REAUTHENTICATE="Re-authentiate to continue using your keyless account",d.REAUTHENTICATE_UNSURE="Try re-authentiating. If the error persists join the telegram group at https://t.me/+h5CN-W35yUFiYzkx for further support",d.UPDATE_REQUEST_PARAMS="Update the invalid request parameters and reauthenticate.",d.RATE_LIMIT_EXCEEDED="Cache the keyless account and reuse it to avoid making too many requests. Keyless accounts are valid until either the EphemeralKeyPair expires, when the JWK is rotated, or when the proof verifying key is changed, whichever comes soonest.",d.SERVER_ERROR="Try again later. See aptosApiError error for more context. For additional support join the telegram group at https://t.me/+h5CN-W35yUFiYzkx",d.CALL_PRECHECK="Call `await account.checkKeylessAccountValidity()` to wait for asyncronous changes and check for account validity before signing or serializing.",d.REINSTANTIATE="Try instantiating the account again. Avoid manipulating the account object directly",d.JOIN_SUPPORT_GROUP="For support join the telegram group at https://t.me/+h5CN-W35yUFiYzkx",d.UNKNOWN="Error unknown. For support join the telegram group at https://t.me/+h5CN-W35yUFiYzkx",d))(Uc||{}),nr= exports.KeylessErrorType =(f=>(f[f.EPHEMERAL_KEY_PAIR_EXPIRED=0]="EPHEMERAL_KEY_PAIR_EXPIRED",f[f.PROOF_NOT_FOUND=1]="PROOF_NOT_FOUND",f[f.ASYNC_PROOF_FETCH_FAILED=2]="ASYNC_PROOF_FETCH_FAILED",f[f.INVALID_PROOF_VERIFICATION_FAILED=3]="INVALID_PROOF_VERIFICATION_FAILED",f[f.INVALID_PROOF_VERIFICATION_KEY_NOT_FOUND=4]="INVALID_PROOF_VERIFICATION_KEY_NOT_FOUND",f[f.INVALID_JWT_SIG=5]="INVALID_JWT_SIG",f[f.INVALID_JWT_JWK_NOT_FOUND=6]="INVALID_JWT_JWK_NOT_FOUND",f[f.INVALID_JWT_ISS_NOT_RECOGNIZED=7]="INVALID_JWT_ISS_NOT_RECOGNIZED",f[f.INVALID_JWT_FEDERATED_ISS_NOT_SUPPORTED=8]="INVALID_JWT_FEDERATED_ISS_NOT_SUPPORTED",f[f.INVALID_TW_SIG_VERIFICATION_FAILED=9]="INVALID_TW_SIG_VERIFICATION_FAILED",f[f.INVALID_TW_SIG_PUBLIC_KEY_NOT_FOUND=10]="INVALID_TW_SIG_PUBLIC_KEY_NOT_FOUND",f[f.INVALID_EXPIRY_HORIZON=11]="INVALID_EXPIRY_HORIZON",f[f.JWT_PARSING_ERROR=12]="JWT_PARSING_ERROR",f[f.JWK_FETCH_FAILED=13]="JWK_FETCH_FAILED",f[f.JWK_FETCH_FAILED_FEDERATED=14]="JWK_FETCH_FAILED_FEDERATED",f[f.RATE_LIMIT_EXCEEDED=15]="RATE_LIMIT_EXCEEDED",f[f.PEPPER_SERVICE_INTERNAL_ERROR=16]="PEPPER_SERVICE_INTERNAL_ERROR",f[f.PEPPER_SERVICE_BAD_REQUEST=17]="PEPPER_SERVICE_BAD_REQUEST",f[f.PEPPER_SERVICE_OTHER=18]="PEPPER_SERVICE_OTHER",f[f.PROVER_SERVICE_INTERNAL_ERROR=19]="PROVER_SERVICE_INTERNAL_ERROR",f[f.PROVER_SERVICE_BAD_REQUEST=20]="PROVER_SERVICE_BAD_REQUEST",f[f.PROVER_SERVICE_OTHER=21]="PROVER_SERVICE_OTHER",f[f.FULL_NODE_CONFIG_LOOKUP_ERROR=22]="FULL_NODE_CONFIG_LOOKUP_ERROR",f[f.FULL_NODE_VERIFICATION_KEY_LOOKUP_ERROR=23]="FULL_NODE_VERIFICATION_KEY_LOOKUP_ERROR",f[f.FULL_NODE_JWKS_LOOKUP_ERROR=24]="FULL_NODE_JWKS_LOOKUP_ERROR",f[f.FULL_NODE_OTHER=25]="FULL_NODE_OTHER",f[f.UNKNOWN=26]="UNKNOWN",f))(nr||{}),Ao={0:["The ephemeral keypair has expired.",2,"Re-authentiate to continue using your keyless account"],1:["The required proof could not be found.",3,"Call `await account.checkKeylessAccountValidity()` to wait for asyncronous changes and check for account validity before signing or serializing."],2:["The required proof failed to fetch.",3,"Try re-authentiating. If the error persists join the telegram group at https://t.me/+h5CN-W35yUFiYzkx for further support"],3:["The provided proof is invalid.",3,"Try re-authentiating. If the error persists join the telegram group at https://t.me/+h5CN-W35yUFiYzkx for further support"],4:["The verification key used to authenticate was updated.",2,"Re-authentiate to continue using your keyless account"],5:["The JWK was found, but JWT failed verification",3,"Try re-authentiating. If the error persists join the telegram group at https://t.me/+h5CN-W35yUFiYzkx for further support"],6:["The JWK required to verify the JWT could not be found. The JWK may have been rotated out.",2,"Re-authentiate to continue using your keyless account"],7:["The JWT issuer is not recognized.",3,"Update the invalid request parameters and reauthenticate."],8:["The JWT issuer is not supported by the Federated Keyless ",0,"Try re-authentiating. If the error persists join the telegram group at https://t.me/+h5CN-W35yUFiYzkx for further support"],9:["The training wheels signature is invalid.",3,"Try re-authentiating. If the error persists join the telegram group at https://t.me/+h5CN-W35yUFiYzkx for further support"],10:["The public key used to verify the training wheels signature was not found.",2,"Re-authentiate to continue using your keyless account"],11:["The expiry horizon is invalid.",2,"Re-authentiate to continue using your keyless account"],13:["Failed to fetch JWKS.",1,"For support join the telegram group at https://t.me/+h5CN-W35yUFiYzkx"],14:["Failed to fetch JWKS for Federated Keyless provider.",1,"For support join the telegram group at https://t.me/+h5CN-W35yUFiYzkx"],15:["Rate limit exceeded. Too many requests in a short period.",0,"Cache the keyless account and reuse it to avoid making too many requests. Keyless accounts are valid until either the EphemeralKeyPair expires, when the JWK is rotated, or when the proof verifying key is changed, whichever comes soonest."],16:["Internal error from Pepper service.",0,"Try again later. See aptosApiError error for more context. For additional support join the telegram group at https://t.me/+h5CN-W35yUFiYzkx"],17:["Bad request sent to Pepper service.",0,"Update the invalid request parameters and reauthenticate."],18:["Unknown error from Pepper service.",0,"Try again later. See aptosApiError error for more context. For additional support join the telegram group at https://t.me/+h5CN-W35yUFiYzkx"],19:["Internal error from Prover service.",0,"Try again later. See aptosApiError error for more context. For additional support join the telegram group at https://t.me/+h5CN-W35yUFiYzkx"],20:["Bad request sent to Prover service.",0,"Update the invalid request parameters and reauthenticate."],21:["Unknown error from Prover service.",0,"Try again later. See aptosApiError error for more context. For additional support join the telegram group at https://t.me/+h5CN-W35yUFiYzkx"],12:["Error when parsing JWT. This should never happen. Join https://t.me/+h5CN-W35yUFiYzkx for support",3,"Try instantiating the account again. Avoid manipulating the account object directly"],22:["Error when looking up on-chain keyless configuration.",0,"Try again later. See aptosApiError error for more context. For additional support join the telegram group at https://t.me/+h5CN-W35yUFiYzkx"],23:["Error when looking up on-chain verification key.",0,"Try again later. See aptosApiError error for more context. For additional support join the telegram group at https://t.me/+h5CN-W35yUFiYzkx"],24:["Error when looking up on-chain JWKS.",0,"Try again later. See aptosApiError error for more context. For additional support join the telegram group at https://t.me/+h5CN-W35yUFiYzkx"],25:["Unknown error from full node.",0,"Try again later. See aptosApiError error for more context. For additional support join the telegram group at https://t.me/+h5CN-W35yUFiYzkx"],26:["An unknown error has occurred.",4,"Error unknown. For support join the telegram group at https://t.me/+h5CN-W35yUFiYzkx"]},D= exports.KeylessError =class n extends Error{constructor(e){let{innerError:t,category:r,resolutionTip:i,type:o,message:s=Ao[o][0],details:a}=e;super(s),this.name="KeylessError",this.innerError=t,this.category=r,this.resolutionTip=i,this.type=o,this.details=a,this.message=n.constructMessage(s,i,t,a)}static constructMessage(e,t,r,i){let o=`
|
|
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 _chunkPA2XFIP3js = require('./chunk-PA2XFIP3.js');var C=class n{constructor(e){this.buffer=new ArrayBuffer(e.length),new Uint8Array(this.buffer).set(e,0),this.offset=0}static fromHex(e){let t=_chunkPA2XFIP3js.j.hexInputToUint8Array(e);return new n(t)}read(e){if(this.offset+e>this.buffer.byteLength)throw new Error("Reached to the end of buffer");let t=this.buffer.slice(this.offset,this.offset+e);return this.offset+=e,t}remaining(){return this.buffer.byteLength-this.offset}deserializeStr(){let e=this.deserializeBytes();return new TextDecoder().decode(e)}deserializeOptionStr(){return this.deserializeOption("string")}deserializeOption(e,t){if(this.deserializeBool()){if(e==="string")return this.deserializeStr();if(e==="bytes")return this.deserializeBytes();if(e==="fixedBytes"){if(t===void 0)throw new Error("Fixed bytes length not provided");return this.deserializeFixedBytes(t)}return this.deserialize(e)}}deserializeBytes(){let e=this.deserializeUleb128AsU32();return new Uint8Array(this.read(e))}deserializeFixedBytes(e){return new Uint8Array(this.read(e))}deserializeBool(){let e=new Uint8Array(this.read(1))[0];if(e!==1&&e!==0)throw new Error("Invalid boolean value");return e===1}deserializeU8(){return new DataView(this.read(1)).getUint8(0)}deserializeU16(){return new DataView(this.read(2)).getUint16(0,!0)}deserializeU32(){return new DataView(this.read(4)).getUint32(0,!0)}deserializeU64(){let e=this.deserializeU32(),t=this.deserializeU32();return BigInt(BigInt(t)<<BigInt(32)|BigInt(e))}deserializeU128(){let e=this.deserializeU64(),t=this.deserializeU64();return BigInt(t<<BigInt(64)|e)}deserializeU256(){let e=this.deserializeU128(),t=this.deserializeU128();return BigInt(t<<BigInt(128)|e)}deserializeUleb128AsU32(){let e=BigInt(0),t=0;for(;e<_chunkPA2XFIP3js.d;){let r=this.deserializeU8();if(e|=BigInt(r&127)<<BigInt(t),!(r&128))break;t+=7}if(e>_chunkPA2XFIP3js.d)throw new Error("Overflow while parsing uleb128-encoded uint32 value");return Number(e)}deserialize(e){return e.deserialize(this)}deserializeVector(e){let t=this.deserializeUleb128AsU32(),r=new Array;for(let i=0;i<t;i+=1)r.push(this.deserialize(e));return r}};var we=class n extends _chunkPA2XFIP3js.l{constructor(e){super(),this.value=_chunkPA2XFIP3js.j.fromHexInput(e).toUint8Array()}serialize(e){e.serializeFixedBytes(this.value)}serializeForEntryFunction(e){e.serialize(this)}serializeForScriptFunction(e){e.serialize(this)}static deserialize(e,t){let r=e.deserializeFixedBytes(t);return new n(r)}};var Yn=class n extends _chunkPA2XFIP3js.l{constructor(e){super(),this.value=new we(e)}serialize(e){e.serialize(this.value)}serializeForEntryFunction(e){e.serializeU32AsUleb128(this.value.value.length),e.serialize(this)}static deserialize(e,t){let r=we.deserialize(e,t);return new n(r.value)}};var D=class n extends _chunkPA2XFIP3js.l{constructor(e){super(),_chunkPA2XFIP3js.n.call(void 0, e),this.value=e}serialize(e){e.serializeBool(this.value)}serializeForEntryFunction(e){let t=this.bcsToBytes();e.serializeBytes(t)}serializeForScriptFunction(e){e.serializeU32AsUleb128(5),e.serialize(this)}deserialize(e){return new ye(e.deserializeU256())}static deserialize(e){return new n(e.deserializeBool())}},X= exports.U8 =class n extends _chunkPA2XFIP3js.l{constructor(e){super(),_chunkPA2XFIP3js.p.call(void 0, e,0,_chunkPA2XFIP3js.b),this.value=e}serialize(e){e.serializeU8(this.value)}serializeForEntryFunction(e){let t=this.bcsToBytes();e.serializeBytes(t)}serializeForScriptFunction(e){e.serializeU32AsUleb128(0),e.serialize(this)}static deserialize(e){return new n(e.deserializeU8())}},Se= exports.U16 =class n extends _chunkPA2XFIP3js.l{constructor(e){super(),_chunkPA2XFIP3js.p.call(void 0, e,0,_chunkPA2XFIP3js.c),this.value=e}serialize(e){e.serializeU16(this.value)}serializeForEntryFunction(e){let t=this.bcsToBytes();e.serializeBytes(t)}serializeForScriptFunction(e){e.serializeU32AsUleb128(6),e.serialize(this)}static deserialize(e){return new n(e.deserializeU16())}},_e= exports.U32 =class n extends _chunkPA2XFIP3js.l{constructor(e){super(),_chunkPA2XFIP3js.p.call(void 0, e,0,_chunkPA2XFIP3js.d),this.value=e}serialize(e){e.serializeU32(this.value)}serializeForEntryFunction(e){let t=this.bcsToBytes();e.serializeBytes(t)}serializeForScriptFunction(e){e.serializeU32AsUleb128(7),e.serialize(this)}static deserialize(e){return new n(e.deserializeU32())}},W= exports.U64 =class n extends _chunkPA2XFIP3js.l{constructor(e){super(),_chunkPA2XFIP3js.p.call(void 0, e,BigInt(0),_chunkPA2XFIP3js.e),this.value=BigInt(e)}serialize(e){e.serializeU64(this.value)}serializeForEntryFunction(e){let t=this.bcsToBytes();e.serializeBytes(t)}serializeForScriptFunction(e){e.serializeU32AsUleb128(1),e.serialize(this)}static deserialize(e){return new n(e.deserializeU64())}},Ee= exports.U128 =class n extends _chunkPA2XFIP3js.l{constructor(e){super(),_chunkPA2XFIP3js.p.call(void 0, e,BigInt(0),_chunkPA2XFIP3js.f),this.value=BigInt(e)}serialize(e){e.serializeU128(this.value)}serializeForEntryFunction(e){let t=this.bcsToBytes();e.serializeBytes(t)}serializeForScriptFunction(e){e.serializeU32AsUleb128(2),e.serialize(this)}static deserialize(e){return new n(e.deserializeU128())}},ye= exports.U256 =class n extends _chunkPA2XFIP3js.l{constructor(e){super(),_chunkPA2XFIP3js.p.call(void 0, e,BigInt(0),_chunkPA2XFIP3js.g),this.value=BigInt(e)}serialize(e){e.serializeU256(this.value)}serializeForEntryFunction(e){let t=this.bcsToBytes();e.serializeBytes(t)}serializeForScriptFunction(e){e.serializeU32AsUleb128(8),e.serialize(this)}static deserialize(e){return new n(e.deserializeU256())}};var S=class n extends _chunkPA2XFIP3js.l{constructor(e){super(),this.values=e}serializeForEntryFunction(e){let t=this.bcsToBytes();e.serializeBytes(t)}serializeForScriptFunction(e){if(this.values[0]!==void 0&&!(this.values[0]instanceof X)){new pn(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=_chunkPA2XFIP3js.j.fromHexInput(e);t=Array.from(r.toUint8Array())}else if(e instanceof Uint8Array)t=Array.from(e);else throw new Error("Invalid input type, must be an number[], Uint8Array, or hex string");return new n(t.map(r=>new X(r)))}static U16(e){return new n(e.map(t=>new Se(t)))}static U32(e){return new n(e.map(t=>new _e(t)))}static U64(e){return new n(e.map(t=>new W(t)))}static U128(e){return new n(e.map(t=>new Ee(t)))}static U256(e){return new n(e.map(t=>new ye(t)))}static Bool(e){return new n(e.map(t=>new D(t)))}static MoveString(e){return new n(e.map(t=>new P(t)))}serialize(e){e.serializeVector(this.values)}static deserialize(e,t){let r=e.deserializeUleb128AsU32(),i=new Array;for(let o=0;o<r;o+=1)i.push(t.deserialize(e));return new n(i)}},pn= exports.Serialized =class n extends _chunkPA2XFIP3js.l{constructor(e){super(),this.value=_chunkPA2XFIP3js.j.fromHexInput(e).toUint8Array()}serialize(e){e.serializeBytes(this.value)}serializeForEntryFunction(e){this.serialize(e)}serializeForScriptFunction(e){e.serializeU32AsUleb128(9),this.serialize(e)}static deserialize(e){return new n(e.deserializeBytes())}toMoveVector(e){let t=new C(this.bcsToBytes());t.deserializeUleb128AsU32();let r=t.deserializeVector(e);return new S(r)}},P= exports.MoveString =class n extends _chunkPA2XFIP3js.l{constructor(e){super(),this.value=e}serialize(e){e.serializeStr(this.value)}serializeForEntryFunction(e){let t=this.bcsToBytes();e.serializeBytes(t)}serializeForScriptFunction(e){let r=new TextEncoder().encode(this.value);S.U8(r).serializeForScriptFunction(e)}static deserialize(e){return new n(e.deserializeStr())}},Y= exports.MoveOption =class n extends _chunkPA2XFIP3js.l{constructor(e){super(),typeof e<"u"&&e!==null?this.vec=new S([e]):this.vec=new S([]),[this.value]=this.vec.values}serializeForEntryFunction(e){let t=this.bcsToBytes();e.serializeBytes(t)}unwrap(){if(this.isSome())return this.vec.values[0];throw new Error("Called unwrap on a MoveOption with no value")}isSome(){return this.vec.values.length===1}serialize(e){this.vec.serialize(e)}static U8(e){return new n(e!=null?new X(e):void 0)}static U16(e){return new n(e!=null?new Se(e):void 0)}static U32(e){return new n(e!=null?new _e(e):void 0)}static U64(e){return new n(e!=null?new W(e):void 0)}static U128(e){return new n(e!=null?new Ee(e):void 0)}static U256(e){return new n(e!=null?new ye(e):void 0)}static Bool(e){return new n(e!=null?new D(e):void 0)}static MoveString(e){return new n(e!=null?new P(e):void 0)}static deserialize(e,t){let r=S.deserialize(e,t);return new n(r.values[0])}};var _ed25519 = require('@noble/curves/ed25519');var _sha3 = require('@noble/hashes/sha3');var rt=class rt extends _chunkPA2XFIP3js.l{constructor(e){super();let{data:t}=e,r=_chunkPA2XFIP3js.j.fromHexInput(t);if(r.toUint8Array().length!==rt.LENGTH)throw new Error(`Authentication Key length should be ${rt.LENGTH}`);this.data=r}serialize(e){e.serializeFixedBytes(this.data.toUint8Array())}static deserialize(e){let t=e.deserializeFixedBytes(rt.LENGTH);return new rt({data:t})}toUint8Array(){return this.data.toUint8Array()}static fromSchemeAndBytes(e){let{scheme:t,input:r}=e,i=_chunkPA2XFIP3js.j.fromHexInput(r).toUint8Array(),o=new Uint8Array([...i,t]),s=_sha3.sha3_256.create();s.update(o);let a=s.digest();return new rt({data:a})}static fromPublicKeyAndScheme(e){let{publicKey:t}=e;return t.authKey()}static fromPublicKey(e){let{publicKey:t}=e;return t.authKey()}derivedAddress(){return new (0, _chunkPA2XFIP3js.Z)(this.data.toUint8Array())}};rt.LENGTH=32;var G=rt;var _hmac = require('@noble/hashes/hmac');var _sha512 = require('@noble/hashes/sha512');var _bip39 = require('@scure/bip39'); var to = _interopRequireWildcard(_bip39);var sc=/^m\/44'\/637'\/[0-9]+'\/[0-9]+'\/[0-9]+'?$/,ac= exports.APTOS_BIP44_REGEX =/^m\/44'\/637'\/[0-9]+'\/[0-9]+\/[0-9]+$/,cc= exports.KeyType =(e=>(e.ED25519="ed25519 seed",e))(cc||{}),no= exports.HARDENED_OFFSET =2147483648;function ro(n){return ac.test(n)}function io(n){return sc.test(n)}var Wr=(n,e)=>{let t=_hmac.hmac.create(_sha512.sha512,n).update(e).digest();return{key:t.slice(0,32),chainCode:t.slice(32)}},oo= 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 Wr(e,s)},uc=n=>n.replace(/'/g,""),so= exports.splitPath =n=>n.split("/").slice(1).map(uc),Zn= exports.mnemonicToSeed =n=>{let e=n.trim().split(/\s+/).map(t=>t.toLowerCase()).join(" ");return to.mnemonicToSeedSync(e)};var ln=class ln{static formatPrivateKey(e,t){let r=ln.AIP80_PREFIXES[t],i=e;return typeof i=="string"&&i.startsWith(r)&&(i=i.split("-")[2]),`${r}${_chunkPA2XFIP3js.j.fromHexInput(i).toString()}`}static parseHexInput(e,t,r){let i,o=ln.AIP80_PREFIXES[t];if(typeof e=="string")if(!r&&!e.startsWith(o))i=_chunkPA2XFIP3js.j.fromHexInput(e),r!==!1&&console.warn("[Aptos SDK] It is recommended that private keys are AIP-80 compliant (https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-80.md). You can fix the private key by formatting it with `PrivateKey.formatPrivateKey(privateKey: string, type: 'ed25519' | 'secp256k1'): string`.");else if(e.startsWith(o))i=_chunkPA2XFIP3js.j.fromHexString(e.split("-")[2]);else throw r?new Error("Invalid HexString input while parsing private key. Must AIP-80 compliant string."):new Error("Invalid HexString input while parsing private key.");else i=_chunkPA2XFIP3js.j.fromHexInput(e);return i}};ln.AIP80_PREFIXES={ed25519:"ed25519-priv-",secp256k1:"secp256k1-priv-"};var it=ln;var yt=class extends _chunkPA2XFIP3js.l{toUint8Array(){return this.bcsToBytes()}toString(){let e=this.toUint8Array();return _chunkPA2XFIP3js.j.fromHexInput(e).toString()}},oe= exports.AccountPublicKey =class extends yt{};var M=class extends _chunkPA2XFIP3js.l{toUint8Array(){return this.bcsToBytes()}toString(){let e=this.toUint8Array();return _chunkPA2XFIP3js.j.fromHexInput(e).toString()}};var Bt=n=>typeof n=="string"?_chunkPA2XFIP3js.j.isValid(n).valid?n:new TextEncoder().encode(n):n;var Qr=[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 dc(n){let e=n.toUint8Array().slice(32);for(let t=Qr.length-1;t>=0;t-=1){if(e[t]<Qr[t])return!0;if(e[t]>Qr[t])return!1}return!1}var ot=class ot extends oe{constructor(e){super();let t=_chunkPA2XFIP3js.j.fromHexInput(e);if(t.toUint8Array().length!==ot.LENGTH)throw new Error(`PublicKey length should be ${ot.LENGTH}`);this.key=t}verifySignature(e){let{message:t,signature:r}=e;if(!dc(r))return!1;let i=Bt(t),o=_chunkPA2XFIP3js.j.fromHexInput(i).toUint8Array(),s=r.toUint8Array(),a=this.key.toUint8Array();return _ed25519.ed25519.verify(s,o,a)}authKey(){return G.fromSchemeAndBytes({scheme:0,input:this.toUint8Array()})}toUint8Array(){return this.key.toUint8Array()}serialize(e){e.serializeBytes(this.key.toUint8Array())}static deserialize(e){let t=e.deserializeBytes();return new ot(t)}static isPublicKey(e){return e instanceof ot}static isInstance(e){return"key"in e&&_optionalChain([e, 'access', _2 => _2.key, 'optionalAccess', _3 => _3.data, 'optionalAccess', _4 => _4.length])===ot.LENGTH}};ot.LENGTH=32;var v=ot,fe=class fe extends _chunkPA2XFIP3js.l{constructor(e,t){super();let r=it.parseHexInput(e,"ed25519",t);if(r.toUint8Array().length!==fe.LENGTH)throw new Error(`PrivateKey length should be ${fe.LENGTH}`);this.signingKey=r}static generate(){let e=_ed25519.ed25519.utils.randomPrivateKey();return new fe(e,!1)}static fromDerivationPath(e,t){if(!io(e))throw new Error(`Invalid derivation path ${e}`);return fe.fromDerivationPathInner(e,Zn(t))}static fromDerivationPathInner(e,t,r=no){let{key:i,chainCode:o}=Wr(fe.SLIP_0010_SEED,t),s=so(e).map(c=>parseInt(c,10)),{key:a}=s.reduce((c,d)=>oo(c,d+r),{key:i,chainCode:o});return new fe(a,!1)}publicKey(){let e=_ed25519.ed25519.getPublicKey(this.signingKey.toUint8Array());return new v(e)}sign(e){let t=Bt(e),r=_chunkPA2XFIP3js.j.fromHexInput(t).toUint8Array(),i=_ed25519.ed25519.sign(r,this.signingKey.toUint8Array());return new I(i)}toUint8Array(){return this.signingKey.toUint8Array()}toString(){return this.toHexString()}toHexString(){return this.signingKey.toString()}toAIP80String(){return it.formatPrivateKey(this.signingKey.toString(),"ed25519")}serialize(e){e.serializeBytes(this.toUint8Array())}static deserialize(e){let t=e.deserializeBytes();return new fe(t,!1)}static isPrivateKey(e){return e instanceof fe}};fe.LENGTH=32,fe.SLIP_0010_SEED="ed25519 seed";var H=fe,Gt=class Gt extends M{constructor(e){super();let t=_chunkPA2XFIP3js.j.fromHexInput(e);if(t.toUint8Array().length!==Gt.LENGTH)throw new Error(`Signature length should be ${Gt.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 Gt(t)}};Gt.LENGTH=64;var I=Gt;var _secp256k1 = require('@noble/curves/secp256k1');var _bip32 = require('@scure/bip32');var Pe=class Pe extends yt{constructor(e){super();let t=_chunkPA2XFIP3js.j.fromHexInput(e),{length:r}=t.toUint8Array();if(r===Pe.LENGTH)this.key=t;else if(r===Pe.COMPRESSED_LENGTH){let i=_secp256k1.secp256k1.ProjectivePoint.fromHex(t.toUint8Array());this.key=_chunkPA2XFIP3js.j.fromHexInput(i.toRawBytes(!1))}else throw new Error(`PublicKey length should be ${Pe.LENGTH} or ${Pe.COMPRESSED_LENGTH}, received ${r}`)}verifySignature(e){let{message:t,signature:r}=e,i=Bt(t),o=_chunkPA2XFIP3js.j.fromHexInput(i).toUint8Array(),s=_sha3.sha3_256.call(void 0, o),a=r.toUint8Array();return _secp256k1.secp256k1.verify(a,s,this.key.toUint8Array(),{lowS:!0})}toUint8Array(){return this.key.toUint8Array()}serialize(e){e.serializeBytes(this.key.toUint8Array())}deserialize(e){let t=e.deserializeBytes();return new ft(t)}static deserialize(e){let t=e.deserializeBytes();return new Pe(t)}static isPublicKey(e){return e instanceof Pe}static isInstance(e){return"key"in e&&_optionalChain([e, 'access', _5 => _5.key, 'optionalAccess', _6 => _6.data, 'optionalAccess', _7 => _7.length])===Pe.LENGTH}};Pe.LENGTH=65,Pe.COMPRESSED_LENGTH=33;var Ne=Pe,Ke=class Ke extends _chunkPA2XFIP3js.l{constructor(e,t){super();let r=it.parseHexInput(e,"secp256k1",t);if(r.toUint8Array().length!==Ke.LENGTH)throw new Error(`PrivateKey length should be ${Ke.LENGTH}`);this.key=r}static generate(){let e=_secp256k1.secp256k1.utils.randomPrivateKey();return new Ke(e,!1)}static fromDerivationPath(e,t){if(!ro(e))throw new Error(`Invalid derivation path ${e}`);return Ke.fromDerivationPathInner(e,Zn(t))}static fromDerivationPathInner(e,t){let{privateKey:r}=_bip32.HDKey.fromMasterSeed(t).derive(e);if(r===null)throw new Error("Invalid key");return new Ke(r,!1)}sign(e){let t=Bt(e),r=_chunkPA2XFIP3js.j.fromHexInput(t),i=_sha3.sha3_256.call(void 0, r.toUint8Array()),o=_secp256k1.secp256k1.sign(i,this.key.toUint8Array(),{lowS:!0});return new ft(o.toCompactRawBytes())}publicKey(){let e=_secp256k1.secp256k1.getPublicKey(this.key.toUint8Array(),!1);return new Ne(e)}toUint8Array(){return this.key.toUint8Array()}toString(){return this.toHexString()}toHexString(){return this.key.toString()}toAIP80String(){return it.formatPrivateKey(this.key.toString(),"secp256k1")}serialize(e){e.serializeBytes(this.toUint8Array())}static deserialize(e){let t=e.deserializeBytes();return new Ke(t,!1)}static isPrivateKey(e){return e instanceof Ke}};Ke.LENGTH=32;var Be=Ke,Mt=class Mt extends M{constructor(e){super();let t=_chunkPA2XFIP3js.j.fromHexInput(e);if(t.toUint8Array().length!==Mt.LENGTH)throw new Error(`Signature length should be ${Mt.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 Mt(t)}};Mt.LENGTH=64;var ft=Mt;var _jwtdecode = require('jwt-decode');var At=class n extends yt{constructor(e){super();let t=e.constructor.name;switch(t){case v.name:this.publicKey=e,this.variant=0;break;default:throw new Error(`Unsupported key for EphemeralPublicKey - ${t}`)}}verifySignature(e){let{message:t,signature:r}=e;return this.publicKey.verifySignature({message:t,signature:r.signature})}serialize(e){if(this.publicKey instanceof v)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(v.deserialize(e));default:throw new Error(`Unknown variant index for EphemeralPublicKey: ${t}`)}}static isPublicKey(e){return e instanceof n}},Re= exports.EphemeralSignature =class n extends M{constructor(e){super();let t=e.constructor.name;switch(t){case I.name:this.signature=e;break;default:throw new Error(`Unsupported signature for EphemeralSignature - ${t}`)}}static fromHex(e){let t=_chunkPA2XFIP3js.j.fromHexInput(e),r=new C(t.toUint8Array());return n.deserialize(r)}serialize(e){if(this.signature instanceof I)e.serializeU32AsUleb128(0),this.signature.serialize(e);else throw new Error("Unknown signature type")}static deserialize(e){let t=e.deserializeUleb128AsU32();switch(t){case 0:return new n(I.deserialize(e));default:throw new Error(`Unknown variant index for EphemeralSignature: ${t}`)}}};var _poseidonlite = require('poseidon-lite');var jr=[_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],uo=31,Ic=16,co=(Ic-1)*uo;function tr(n,e){let r=new TextEncoder().encode(n);return Cc(r,e)}function Cc(n,e){if(n.length>e)throw new Error(`Inputted bytes of length ${n} is longer than ${e}`);let t=Jr(n,e);return yn(t)}function Kc(n,e){if(n.length>e)throw new Error(`Input bytes of length ${n} is longer than ${e}`);let t=Dc(n,e);return Rc(t)}function Jr(n,e){if(n.length>e)throw new Error(`Input bytes of length ${n} is longer than ${e}`);return Kc(n,e).concat([BigInt(n.length)])}function Rc(n){if(n.length>co)throw new Error(`Can't pack more than ${co}. Was given ${n.length} bytes`);return Uc(n,uo).map(e=>mn(e))}function Uc(n,e){let t=[];for(let r=0;r<n.length;r+=e)t.push(n.subarray(r,r+e));return t}function mn(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 po(n,e){let t=BigInt(n),r=new Uint8Array(e);for(let i=0;i<e;i+=1)r[i]=Number(t&BigInt(255)),t>>=BigInt(8);return r}function Dc(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 yn(n){if(n.length>jr.length)throw new Error(`Unable to hash input of length ${n.length}. Max input length is ${jr.length}`);return jr[n.length-1](n)}var nr=class extends _chunkPA2XFIP3js.l{};var Xr="1.36.0";var lo={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"},go= 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"},mo= exports.NetworkToFaucetAPI ={devnet:"https://faucet.devnet.aptoslabs.com",local:"http://127.0.0.1:8081"},Yr= 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"},Zr= 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"},ei= exports.Network =(o=>(o.MAINNET="mainnet",o.TESTNET="testnet",o.DEVNET="devnet",o.LOCAL="local",o.CUSTOM="custom",o))(ei||{}),ti= exports.NetworkToChainId ={mainnet:1,testnet:2,local:4},Al= exports.NetworkToNetworkName ={mainnet:"mainnet",testnet:"testnet",devnet:"devnet",local:"local",custom:"custom"};var ht=(o=>(o.FULLNODE="Fullnode",o.INDEXER="Indexer",o.FAUCET="Faucet",o.PEPPER="Pepper",o.PROVER="Prover",o))(ht||{}),yo= exports.DEFAULT_MAX_GAS_AMOUNT =2e5,fo= exports.DEFAULT_TXN_EXP_SEC_FROM_NOW =20,rr= exports.DEFAULT_TXN_TIMEOUT_SEC =20,Tt= exports.APTOS_COIN ="0x1::aptos_coin::AptosCoin",Ao= exports.APTOS_FA ="0x000000000000000000000000000000000000000000000000000000000000000a",ho= exports.RAW_TRANSACTION_SALT ="APTOS::RawTransaction",ni= exports.RAW_TRANSACTION_WITH_DATA_SALT ="APTOS::RawTransactionWithData",Ge= 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))(Ge||{}),To= exports.FIREBASE_AUTH_ISS_PATTERN =/^https:\/\/securetoken\.google\.com\/[a-zA-Z0-9-_]+$/;function bo(n,e){let t=e.bcsToBytes(),r=new C(t);return n.deserialize(r)}var zc=(o=>(o[o.API_ERROR=0]="API_ERROR",o[o.EXTERNAL_API_ERROR=1]="EXTERNAL_API_ERROR",o[o.SESSION_EXPIRED=2]="SESSION_EXPIRED",o[o.INVALID_STATE=3]="INVALID_STATE",o[o.UNKNOWN=4]="UNKNOWN",o))(zc||{}),kc= exports.KeylessErrorResolutionTip =(d=>(d.REAUTHENTICATE="Re-authentiate to continue using your keyless account",d.REAUTHENTICATE_UNSURE="Try re-authentiating. If the error persists join the telegram group at https://t.me/+h5CN-W35yUFiYzkx for further support",d.UPDATE_REQUEST_PARAMS="Update the invalid request parameters and reauthenticate.",d.RATE_LIMIT_EXCEEDED="Cache the keyless account and reuse it to avoid making too many requests. Keyless accounts are valid until either the EphemeralKeyPair expires, when the JWK is rotated, or when the proof verifying key is changed, whichever comes soonest.",d.SERVER_ERROR="Try again later. See aptosApiError error for more context. For additional support join the telegram group at https://t.me/+h5CN-W35yUFiYzkx",d.CALL_PRECHECK="Call `await account.checkKeylessAccountValidity()` to wait for asyncronous changes and check for account validity before signing or serializing.",d.REINSTANTIATE="Try instantiating the account again. Avoid manipulating the account object directly",d.JOIN_SUPPORT_GROUP="For support join the telegram group at https://t.me/+h5CN-W35yUFiYzkx",d.UNKNOWN="Error unknown. For support join the telegram group at https://t.me/+h5CN-W35yUFiYzkx",d))(kc||{}),ir= exports.KeylessErrorType =(f=>(f[f.EPHEMERAL_KEY_PAIR_EXPIRED=0]="EPHEMERAL_KEY_PAIR_EXPIRED",f[f.PROOF_NOT_FOUND=1]="PROOF_NOT_FOUND",f[f.ASYNC_PROOF_FETCH_FAILED=2]="ASYNC_PROOF_FETCH_FAILED",f[f.INVALID_PROOF_VERIFICATION_FAILED=3]="INVALID_PROOF_VERIFICATION_FAILED",f[f.INVALID_PROOF_VERIFICATION_KEY_NOT_FOUND=4]="INVALID_PROOF_VERIFICATION_KEY_NOT_FOUND",f[f.INVALID_JWT_SIG=5]="INVALID_JWT_SIG",f[f.INVALID_JWT_JWK_NOT_FOUND=6]="INVALID_JWT_JWK_NOT_FOUND",f[f.INVALID_JWT_ISS_NOT_RECOGNIZED=7]="INVALID_JWT_ISS_NOT_RECOGNIZED",f[f.INVALID_JWT_FEDERATED_ISS_NOT_SUPPORTED=8]="INVALID_JWT_FEDERATED_ISS_NOT_SUPPORTED",f[f.INVALID_TW_SIG_VERIFICATION_FAILED=9]="INVALID_TW_SIG_VERIFICATION_FAILED",f[f.INVALID_TW_SIG_PUBLIC_KEY_NOT_FOUND=10]="INVALID_TW_SIG_PUBLIC_KEY_NOT_FOUND",f[f.INVALID_EXPIRY_HORIZON=11]="INVALID_EXPIRY_HORIZON",f[f.JWT_PARSING_ERROR=12]="JWT_PARSING_ERROR",f[f.JWK_FETCH_FAILED=13]="JWK_FETCH_FAILED",f[f.JWK_FETCH_FAILED_FEDERATED=14]="JWK_FETCH_FAILED_FEDERATED",f[f.RATE_LIMIT_EXCEEDED=15]="RATE_LIMIT_EXCEEDED",f[f.PEPPER_SERVICE_INTERNAL_ERROR=16]="PEPPER_SERVICE_INTERNAL_ERROR",f[f.PEPPER_SERVICE_BAD_REQUEST=17]="PEPPER_SERVICE_BAD_REQUEST",f[f.PEPPER_SERVICE_OTHER=18]="PEPPER_SERVICE_OTHER",f[f.PROVER_SERVICE_INTERNAL_ERROR=19]="PROVER_SERVICE_INTERNAL_ERROR",f[f.PROVER_SERVICE_BAD_REQUEST=20]="PROVER_SERVICE_BAD_REQUEST",f[f.PROVER_SERVICE_OTHER=21]="PROVER_SERVICE_OTHER",f[f.FULL_NODE_CONFIG_LOOKUP_ERROR=22]="FULL_NODE_CONFIG_LOOKUP_ERROR",f[f.FULL_NODE_VERIFICATION_KEY_LOOKUP_ERROR=23]="FULL_NODE_VERIFICATION_KEY_LOOKUP_ERROR",f[f.FULL_NODE_JWKS_LOOKUP_ERROR=24]="FULL_NODE_JWKS_LOOKUP_ERROR",f[f.FULL_NODE_OTHER=25]="FULL_NODE_OTHER",f[f.UNKNOWN=26]="UNKNOWN",f))(ir||{}),wo={0:["The ephemeral keypair has expired.",2,"Re-authentiate to continue using your keyless account"],1:["The required proof could not be found.",3,"Call `await account.checkKeylessAccountValidity()` to wait for asyncronous changes and check for account validity before signing or serializing."],2:["The required proof failed to fetch.",3,"Try re-authentiating. If the error persists join the telegram group at https://t.me/+h5CN-W35yUFiYzkx for further support"],3:["The provided proof is invalid.",3,"Try re-authentiating. If the error persists join the telegram group at https://t.me/+h5CN-W35yUFiYzkx for further support"],4:["The verification key used to authenticate was updated.",2,"Re-authentiate to continue using your keyless account"],5:["The JWK was found, but JWT failed verification",3,"Try re-authentiating. If the error persists join the telegram group at https://t.me/+h5CN-W35yUFiYzkx for further support"],6:["The JWK required to verify the JWT could not be found. The JWK may have been rotated out.",2,"Re-authentiate to continue using your keyless account"],7:["The JWT issuer is not recognized.",3,"Update the invalid request parameters and reauthenticate."],8:["The JWT issuer is not supported by the Federated Keyless ",0,"Try re-authentiating. If the error persists join the telegram group at https://t.me/+h5CN-W35yUFiYzkx for further support"],9:["The training wheels signature is invalid.",3,"Try re-authentiating. If the error persists join the telegram group at https://t.me/+h5CN-W35yUFiYzkx for further support"],10:["The public key used to verify the training wheels signature was not found.",2,"Re-authentiate to continue using your keyless account"],11:["The expiry horizon is invalid.",2,"Re-authentiate to continue using your keyless account"],13:["Failed to fetch JWKS.",1,"For support join the telegram group at https://t.me/+h5CN-W35yUFiYzkx"],14:["Failed to fetch JWKS for Federated Keyless provider.",1,"For support join the telegram group at https://t.me/+h5CN-W35yUFiYzkx"],15:["Rate limit exceeded. Too many requests in a short period.",0,"Cache the keyless account and reuse it to avoid making too many requests. Keyless accounts are valid until either the EphemeralKeyPair expires, when the JWK is rotated, or when the proof verifying key is changed, whichever comes soonest."],16:["Internal error from Pepper service.",0,"Try again later. See aptosApiError error for more context. For additional support join the telegram group at https://t.me/+h5CN-W35yUFiYzkx"],17:["Bad request sent to Pepper service.",0,"Update the invalid request parameters and reauthenticate."],18:["Unknown error from Pepper service.",0,"Try again later. See aptosApiError error for more context. For additional support join the telegram group at https://t.me/+h5CN-W35yUFiYzkx"],19:["Internal error from Prover service.",0,"Try again later. See aptosApiError error for more context. For additional support join the telegram group at https://t.me/+h5CN-W35yUFiYzkx"],20:["Bad request sent to Prover service.",0,"Update the invalid request parameters and reauthenticate."],21:["Unknown error from Prover service.",0,"Try again later. See aptosApiError error for more context. For additional support join the telegram group at https://t.me/+h5CN-W35yUFiYzkx"],12:["Error when parsing JWT. This should never happen. Join https://t.me/+h5CN-W35yUFiYzkx for support",3,"Try instantiating the account again. Avoid manipulating the account object directly"],22:["Error when looking up on-chain keyless configuration.",0,"Try again later. See aptosApiError error for more context. For additional support join the telegram group at https://t.me/+h5CN-W35yUFiYzkx"],23:["Error when looking up on-chain verification key.",0,"Try again later. See aptosApiError error for more context. For additional support join the telegram group at https://t.me/+h5CN-W35yUFiYzkx"],24:["Error when looking up on-chain JWKS.",0,"Try again later. See aptosApiError error for more context. For additional support join the telegram group at https://t.me/+h5CN-W35yUFiYzkx"],25:["Unknown error from full node.",0,"Try again later. See aptosApiError error for more context. For additional support join the telegram group at https://t.me/+h5CN-W35yUFiYzkx"],26:["An unknown error has occurred.",4,"Error unknown. For support join the telegram group at https://t.me/+h5CN-W35yUFiYzkx"]},z= exports.KeylessError =class n extends Error{constructor(e){let{innerError:t,category:r,resolutionTip:i,type:o,message:s=wo[o][0],details:a}=e;super(s),this.name="KeylessError",this.innerError=t,this.category=r,this.resolutionTip=i,this.type=o,this.details=a,this.message=n.constructMessage(s,i,t,a)}static constructMessage(e,t,r,i){let o=`
|
|
2
2
|
Message: ${e}`;return i&&(o+=`
|
|
3
3
|
Details: ${i}`),r instanceof Z?o+=`
|
|
4
4
|
AptosApiError: ${r.message}`:r!==void 0&&(o+=`
|
|
5
|
-
Error: ${
|
|
6
|
-
KeylessErrorResolutionTip: ${t}`,o}static fromErrorType(e){let{error:t,type:r,details:i}=e,[o,s,a]=Ao[r];return new n({message:o,details:i,innerError:t,category:s,resolutionTip:a,type:r})}},Z= exports.AptosApiError =class extends Error{constructor({apiType:e,aptosRequest:t,aptosResponse:r}){super(Dc({apiType:e,aptosRequest:t,aptosResponse:r})),this.name="AptosApiError",this.url=r.url,this.status=r.status,this.statusText=r.statusText,this.data=r.data,this.request=t}};function Dc({apiType:n,aptosRequest:e,aptosResponse:t}){let r=_optionalChain([t, 'access', _8 => _8.headers, 'optionalAccess', _9 => _9.traceparent, 'optionalAccess', _10 => _10.split, 'call', _11 => _11("-"), 'access', _12 => _12[1]]),i=r?`(trace_id:${r}) `:"",o=`Request to [${n}]: ${e.method} ${_nullishCoalesce(t.url, () => (e.url))} ${i}failed with`;return n==="Indexer"&&_optionalChain([t, 'access', _13 => _13.data, 'optionalAccess', _14 => _14.errors, 'optionalAccess', _15 => _15[0], 'optionalAccess', _16 => _16.message])!=null?`${o}: ${t.data.errors[0].message}`:_optionalChain([t, 'access', _17 => _17.data, 'optionalAccess', _18 => _18.message])!=null&&_optionalChain([t, 'access', _19 => _19.data, 'optionalAccess', _20 => _20.error_code])!=null?`${o}: ${JSON.stringify(t.data)}`:`${o} status: ${t.statusText}(code:${t.status}) and response body: ${zc(t.data)}`}var ei=400;function zc(n){let e=JSON.stringify(n);return e.length<=ei?e:`truncated(original_size:${e.length}): ${e.slice(0,ei/2)}...${e.slice(-ei/2)}`}async function kc(n,e){let{url:t,method:r,body:i,contentType:o,params:s,overrides:a,originMethod:c}=n,d={..._optionalChain([a, 'optionalAccess', _21 => _21.HEADERS]),"x-aptos-client":`aptos-typescript-sdk/${Qr}`,"content-type":_nullishCoalesce(o, () => ("application/json")),"x-aptos-typescript-sdk-origin-method":c};return _optionalChain([a, 'optionalAccess', _22 => _22.AUTH_TOKEN])&&(d.Authorization=`Bearer ${_optionalChain([a, 'optionalAccess', _23 => _23.AUTH_TOKEN])}`),_optionalChain([a, 'optionalAccess', _24 => _24.API_KEY])&&(d.Authorization=`Bearer ${_optionalChain([a, 'optionalAccess', _25 => _25.API_KEY])}`),e.provider({url:t,method:r,body:i,params:s,headers:d,overrides:a})}async function Oc(n,e){if(e.binaryProvider===void 0)throw new Error("Binary provider is not provided");let{url:t,method:r,body:i,contentType:o,acceptType:s,params:a,overrides:c,originMethod:d}=n,l={..._optionalChain([c, 'optionalAccess', _26 => _26.HEADERS]),"x-aptos-client":`aptos-typescript-sdk/${Qr}`,"content-type":_nullishCoalesce(o, () => ("application/json")),accept:_nullishCoalesce(s, () => ("application/x-bcs")),"x-aptos-typescript-sdk-origin-method":d};return _optionalChain([c, 'optionalAccess', _27 => _27.AUTH_TOKEN])&&(l.Authorization=`Bearer ${_optionalChain([c, 'optionalAccess', _28 => _28.AUTH_TOKEN])}`),_optionalChain([c, 'optionalAccess', _29 => _29.API_KEY])&&(l.Authorization=`Bearer ${_optionalChain([c, 'optionalAccess', _30 => _30.API_KEY])}`),e.binaryProvider({acceptType:"application/x-bcs",url:t,method:r,body:i,params:a,headers:l,overrides:c})}async function rr(n,e,t){let{url:r,path:i}=n,o=i?`${r}/${i}`:r,s=await kc({...n,url:o},e.client),a={status:s.status,statusText:_nullishCoalesce(s.statusText, () => ("No status text provided")),data:s.data,headers:s.headers,config:s.config,request:s.request,url:o};if(a.status===401)throw new Z({apiType:t,aptosRequest:n,aptosResponse:a});if(t==="Indexer"){let c=a.data;if(c.errors)throw new Z({apiType:t,aptosRequest:n,aptosResponse:a});a.data=c.data}else if((t==="Pepper"||t==="Prover")&&a.status>=400)throw new Z({apiType:t,aptosRequest:n,aptosResponse:a});if(a.status>=200&&a.status<300)return a;throw new Z({apiType:t,aptosRequest:n,aptosResponse:a})}async function ir(n,e,t){let{url:r,path:i}=n,o=i?`${r}/${i}`:r,s=await Oc({...n,url:o},e.client),a={status:s.status,statusText:_nullishCoalesce(s.statusText, () => ("No status text provided")),data:s.data,headers:s.headers,config:s.config,request:s.request,url:o};if(a.status===401)throw new Z({apiType:t,aptosRequest:n,aptosResponse:a});if(t==="Indexer"){let c=a.data;if(c.errors)throw new Z({apiType:t,aptosRequest:n,aptosResponse:a});a.data=c.data}else if((t==="Pepper"||t==="Prover")&&a.status>=400)throw new Z({apiType:t,aptosRequest:n,aptosResponse:a});if(a.status>=200&&a.status<300)return a;throw new Z({apiType:t,aptosRequest:n,aptosResponse:a})}async function or(n){let{aptosConfig:e,overrides:t,params:r,contentType:i,acceptType:o,path:s,originMethod:a,type:c}=n,d=e.getRequestUrl(c);return rr({url:d,method:"GET",originMethod:a,path:s,contentType:i,acceptType:o,params:r,overrides:{...e.clientConfig,...t}},e,n.type)}async function Fc(n){let{aptosConfig:e,overrides:t,params:r,contentType:i,acceptType:o,path:s,originMethod:a,type:c}=n,d=e.getRequestUrl(c);return ir({url:d,method:"GET",originMethod:a,path:s,contentType:i,acceptType:o,params:r,overrides:{...e.clientConfig,...t}},e,n.type)}async function L(n){let{aptosConfig:e}=n;return or({...n,type:"Fullnode",overrides:{...e.clientConfig,...e.fullnodeConfig,...n.overrides,HEADERS:{..._optionalChain([e, 'access', _31 => _31.clientConfig, 'optionalAccess', _32 => _32.HEADERS]),..._optionalChain([e, 'access', _33 => _33.fullnodeConfig, 'optionalAccess', _34 => _34.HEADERS])}}})}async function Nl(n){let{aptosConfig:e}=n;return Fc({...n,type:"Fullnode",overrides:{...e.clientConfig,...e.fullnodeConfig,...n.overrides,HEADERS:{..._optionalChain([e, 'access', _35 => _35.clientConfig, 'optionalAccess', _36 => _36.HEADERS]),..._optionalChain([e, 'access', _37 => _37.fullnodeConfig, 'optionalAccess', _38 => _38.HEADERS])}}})}async function Gl(n){return or({...n,type:"Pepper"})}async function sr(n){let e=[],t,r=n.params;do{let i=await or({type:"Fullnode",aptosConfig:n.aptosConfig,originMethod:n.originMethod,path:n.path,params:r,overrides:n.overrides});t=i.headers["x-aptos-cursor"],delete i.headers,e.push(...i.data),r.start=t}while(t!=null);return e}async function ti(n){let e=[],t,r=n.params,i=r.limit;do{let o=await or({type:"Fullnode",aptosConfig:n.aptosConfig,originMethod:n.originMethod,path:n.path,params:r,overrides:n.overrides});if(t=o.headers["x-aptos-cursor"],delete o.headers,e.push(...o.data),r.offset=t,i!==void 0){let s=i-e.length;if(s<=0)break;r.limit=s}}while(t!=null);return e}async function gn(n){let{type:e,originMethod:t,path:r,body:i,acceptType:o,contentType:s,params:a,aptosConfig:c,overrides:d}=n,l=c.getRequestUrl(e);return rr({url:l,method:"POST",originMethod:t,path:r,body:i,contentType:s,acceptType:o,params:a,overrides:d},c,n.type)}async function Nc(n){let{type:e,originMethod:t,path:r,body:i,acceptType:o,contentType:s,params:a,aptosConfig:c,overrides:d}=n,l=c.getRequestUrl(e);return ir({url:l,method:"POST",originMethod:t,path:r,body:i,contentType:s,acceptType:o,params:a,overrides:d},c,n.type)}async function st(n){let{aptosConfig:e}=n;return gn({...n,type:"Fullnode",overrides:{...e.clientConfig,...e.fullnodeConfig,...n.overrides,HEADERS:{..._optionalChain([e, 'access', _39 => _39.clientConfig, 'optionalAccess', _40 => _40.HEADERS]),..._optionalChain([e, 'access', _41 => _41.fullnodeConfig, 'optionalAccess', _42 => _42.HEADERS])}}})}async function ho(n){let{aptosConfig:e}=n;return Nc({...n,type:"Fullnode",overrides:{...e.clientConfig,...e.fullnodeConfig,...n.overrides,HEADERS:{..._optionalChain([e, 'access', _43 => _43.clientConfig, 'optionalAccess', _44 => _44.HEADERS]),..._optionalChain([e, 'access', _45 => _45.fullnodeConfig, 'optionalAccess', _46 => _46.HEADERS])}}})}async function To(n){let{aptosConfig:e}=n;return gn({...n,type:"Indexer",overrides:{...e.clientConfig,...e.indexerConfig,...n.overrides,HEADERS:{..._optionalChain([e, 'access', _47 => _47.clientConfig, 'optionalAccess', _48 => _48.HEADERS]),..._optionalChain([e, 'access', _49 => _49.indexerConfig, 'optionalAccess', _50 => _50.HEADERS])}}})}async function bo(n){let{aptosConfig:e}=n,t={...e,clientConfig:{...e.clientConfig}};return _optionalChainDelete([t, 'optionalAccess', _51 => _51.clientConfig, 'optionalAccess', _52 => delete _52.API_KEY]),gn({...n,type:"Faucet",overrides:{...t.clientConfig,...t.faucetConfig,...n.overrides,HEADERS:{..._optionalChain([t, 'access', _53 => _53.clientConfig, 'optionalAccess', _54 => _54.HEADERS]),..._optionalChain([t, 'access', _55 => _55.faucetConfig, 'optionalAccess', _56 => _56.HEADERS])}}})}async function wo(n){return gn({...n,type:"Pepper"})}async function So(n){return gn({...n,type:"Prover"})}var ni=new Map;function Ke(n,e,t){return async(...r)=>{if(ni.has(e)){let{value:o,timestamp:s}=ni.get(e);if(t===void 0||Date.now()-s<=t)return o}let i=await n(...r);return ni.set(e,{value:i,timestamp:Date.now()}),i}}var hg=1e7,Bc= exports.MAX_AUD_VAL_BYTES =120,Mc= exports.MAX_UID_KEY_BYTES =30,Vc= exports.MAX_UID_VAL_BYTES =330,Tg= exports.MAX_ISS_VAL_BYTES =120,bg= exports.MAX_EXTRA_FIELD_BYTES =350,wg= exports.MAX_JWT_HEADER_B64_BYTES =300,Sg= exports.MAX_COMMITED_EPK_BYTES =93,Re=class Re extends oe{constructor(e,t){super();let r=_chunkRX5UBAMEjs.j.fromHexInput(t).toUint8Array();if(r.length!==Re.ID_COMMITMENT_LENGTH)throw new Error(`Id Commitment length in bytes should be ${Re.ID_COMMITMENT_LENGTH}`);this.iss=e,this.idCommitment=r}authKey(){let e=new _chunkRX5UBAMEjs.m;return e.serializeU32AsUleb128(3),e.serializeFixedBytes(this.bcsToBytes()),B.fromSchemeAndBytes({scheme:2,input:e.toUint8Array()})}verifySignature(e){throw new Error("Not yet implemented")}serialize(e){e.serializeStr(this.iss),e.serializeBytes(this.idCommitment)}static deserialize(e){let t=e.deserializeStr(),r=e.deserializeBytes();return new Re(t,r)}static load(e){let t=e.deserializeStr(),r=e.deserializeBytes();return new Re(t,r)}static isPublicKey(e){return e instanceof Re}static create(e){return _o(e),new Re(e.iss,_o(e))}static fromJwtAndPepper(e){let{jwt:t,pepper:r,uidKey:i="sub"}=e,o=_jwtdecode.jwtDecode.call(void 0, t);if(typeof o.iss!="string")throw new Error("iss was not found");if(typeof o.aud!="string")throw new Error("aud was not found or an array of values");let s=o[i];return Re.create({iss:o.iss,uidKey:i,uidVal:s,aud:o.aud,pepper:r})}static isInstance(e){return"iss"in e&&typeof e.iss=="string"&&"idCommitment"in e&&e.idCommitment instanceof Uint8Array}};Re.ID_COMMITMENT_LENGTH=32;var k=Re;function _o(n){let{uidKey:e,uidVal:t,aud:r,pepper:i}=n,o=[pn(_chunkRX5UBAMEjs.j.fromHexInput(i).toUint8Array()),Zn(r,Bc),Zn(t,Vc),Zn(e,Mc)];return so(ln(o),k.ID_COMMITMENT_LENGTH)}var Ve=class n extends M{constructor(e){super();let{jwtHeader:t,ephemeralCertificate:r,expiryDateSecs:i,ephemeralPublicKey:o,ephemeralSignature:s}=e;this.jwtHeader=t,this.ephemeralCertificate=r,this.expiryDateSecs=i,this.ephemeralPublicKey=o,this.ephemeralSignature=s}getJwkKid(){return Hc(this.jwtHeader).kid}serialize(e){this.ephemeralCertificate.serialize(e),e.serializeStr(this.jwtHeader),e.serializeU64(this.expiryDateSecs),this.ephemeralPublicKey.serialize(e),this.ephemeralSignature.serialize(e)}static deserialize(e){let t=Gt.deserialize(e),r=e.deserializeStr(),i=e.deserializeU64(),o=ft.deserialize(e),s=Ce.deserialize(e);return new n({jwtHeader:r,expiryDateSecs:Number(i),ephemeralCertificate:t,ephemeralPublicKey:o,ephemeralSignature:s})}static getSimulationSignature(){return new n({jwtHeader:"{}",ephemeralCertificate:new Gt(new Pe({proof:new Mt(new Bt({a:new Uint8Array(32),b:new Uint8Array(64),c:new Uint8Array(32)}),0),expHorizonSecs:0}),0),expiryDateSecs:0,ephemeralPublicKey:new ft(new x(new Uint8Array(32))),ephemeralSignature:new Ce(new I(new Uint8Array(64)))})}static isSignature(e){return e instanceof n}},Gt= exports.EphemeralCertificate =class n extends M{constructor(e,t){super(),this.signature=e,this.variant=t}toUint8Array(){return this.signature.toUint8Array()}serialize(e){e.serializeU32AsUleb128(this.variant),this.signature.serialize(e)}static deserialize(e){let t=e.deserializeUleb128AsU32();switch(t){case 0:return new n(Pe.deserialize(e),t);default:throw new Error(`Unknown variant index for EphemeralCertificate: ${t}`)}}},Me=class n extends _chunkRX5UBAMEjs.l{constructor(e){if(super(),this.data=_chunkRX5UBAMEjs.j.fromHexInput(e).toUint8Array(),this.data.length!==32)throw new Error("Input needs to be 32 bytes")}serialize(e){e.serializeFixedBytes(this.data)}static deserialize(e){let t=e.deserializeFixedBytes(32);return new n(t)}},Tt=class n extends _chunkRX5UBAMEjs.l{constructor(e){if(super(),this.data=_chunkRX5UBAMEjs.j.fromHexInput(e).toUint8Array(),this.data.length!==64)throw new Error("Input needs to be 64 bytes")}serialize(e){e.serializeFixedBytes(this.data)}static deserialize(e){let t=e.deserializeFixedBytes(64);return new n(t)}},Bt= exports.Groth16Zkp =class n extends er{constructor(e){super();let{a:t,b:r,c:i}=e;this.a=new Me(t),this.b=new Tt(r),this.c=new Me(i)}serialize(e){this.a.serialize(e),this.b.serialize(e),this.c.serialize(e)}static deserialize(e){let t=Me.deserialize(e).bcsToBytes(),r=Tt.deserialize(e).bcsToBytes(),i=Me.deserialize(e).bcsToBytes();return new n({a:t,b:r,c:i})}},Mt= exports.ZkProof =class n extends _chunkRX5UBAMEjs.l{constructor(e,t){super(),this.proof=e,this.variant=t}serialize(e){e.serializeU32AsUleb128(this.variant),this.proof.serialize(e)}static deserialize(e){let t=e.deserializeUleb128AsU32();switch(t){case 0:return new n(Bt.deserialize(e),t);default:throw new Error(`Unknown variant index for ZkProof: ${t}`)}}},Pe= exports.ZeroKnowledgeSig =class n extends M{constructor(e){super();let{proof:t,expHorizonSecs:r,trainingWheelsSignature:i,extraField:o,overrideAudVal:s}=e;this.proof=t,this.expHorizonSecs=r,this.trainingWheelsSignature=i,this.extraField=o,this.overrideAudVal=s}static fromBytes(e){return n.deserialize(new C(e))}serialize(e){this.proof.serialize(e),e.serializeU64(this.expHorizonSecs),e.serializeOption(this.extraField),e.serializeOption(this.overrideAudVal),e.serializeOption(this.trainingWheelsSignature)}static deserialize(e){let t=Mt.deserialize(e),r=Number(e.deserializeU64()),i=e.deserializeOption("string"),o=e.deserializeOption("string"),s=e.deserializeOption(Ce);return new n({proof:t,expHorizonSecs:r,trainingWheelsSignature:s,extraField:i,overrideAudVal:o})}},ri= exports.KeylessConfiguration =class n{constructor(e,t){this.verificationKey=e,this.maxExpHorizonSecs=t}static create(e,t){return new n(new ii({alphaG1:e.alpha_g1,betaG2:e.beta_g2,deltaG2:e.delta_g2,gammaAbcG1:e.gamma_abc_g1,gammaG2:e.gamma_g2}),t)}},ii= exports.Groth16VerificationKey =class n{constructor(e){let{alphaG1:t,betaG2:r,deltaG2:i,gammaAbcG1:o,gammaG2:s}=e;this.alphaG1=new Me(t),this.betaG2=new Tt(r),this.deltaG2=new Tt(i),this.gammaAbcG1=[new Me(o[0]),new Me(o[1])],this.gammaG2=new Tt(s)}hash(){let e=new _chunkRX5UBAMEjs.m;return this.serialize(e),_sha3.sha3_256.create().update(e.toUint8Array()).digest()}serialize(e){this.alphaG1.serialize(e),this.betaG2.serialize(e),this.deltaG2.serialize(e),this.gammaAbcG1[0].serialize(e),this.gammaAbcG1[1].serialize(e),this.gammaG2.serialize(e)}static fromGroth16VerificationKeyResponse(e){return new n({alphaG1:e.alpha_g1,betaG2:e.beta_g2,deltaG2:e.delta_g2,gammaAbcG1:e.gamma_abc_g1,gammaG2:e.gamma_g2})}};async function mn(n){let{aptosConfig:e}=n;try{return await Ke(async()=>{let t=await qc(n),r=await Lc(n);return ri.create(r,Number(t.max_exp_horizon_secs))},`keyless-configuration-${e.network}`,1e3*60*5)()}catch(t){throw t instanceof D?t:D.fromErrorType({type:25,error:t})}}function qe(n){let{jwt:e,uidKey:t="sub"}=n,r;try{r=_jwtdecode.jwtDecode.call(void 0, e)}catch(o){throw D.fromErrorType({type:12,details:`Failed to parse JWT - ${_chunkRX5UBAMEjs.$.call(void 0, o)}`})}if(typeof r.iss!="string")throw D.fromErrorType({type:12,details:"JWT is missing 'iss' in the payload. This should never happen."});if(typeof r.aud!="string")throw D.fromErrorType({type:12,details:"JWT is missing 'aud' in the payload or 'aud' is an array of values."});let i=r[t];return{iss:r.iss,aud:r.aud,uidVal:i}}async function qc(n){let{aptosConfig:e,options:t}=n,r="0x1::keyless_account::Configuration";try{let{data:i}=await L({aptosConfig:e,originMethod:"getKeylessConfigurationResource",path:`accounts/${_chunkRX5UBAMEjs.Z.from("0x1").toString()}/resource/${r}`,params:{ledger_version:_optionalChain([t, 'optionalAccess', _57 => _57.ledgerVersion])}});return i.data}catch(i){throw D.fromErrorType({type:22,error:i})}}async function Lc(n){let{aptosConfig:e,options:t}=n,r="0x1::keyless_account::Groth16VerificationKey";try{let{data:i}=await L({aptosConfig:e,originMethod:"getGroth16VerificationKeyResource",path:`accounts/${_chunkRX5UBAMEjs.Z.from("0x1").toString()}/resource/${r}`,params:{ledger_version:_optionalChain([t, 'optionalAccess', _58 => _58.ledgerVersion])}});return i.data}catch(i){throw D.fromErrorType({type:23,error:i})}}async function Po(n){let{aptosConfig:e,jwkAddr:t,options:r}=n,i;if(t){let s="0x1::jwks::FederatedJWKs",{data:a}=await L({aptosConfig:e,originMethod:"getKeylessJWKs",path:`accounts/${_chunkRX5UBAMEjs.Z.from(t).toString()}/resource/${s}`,params:{ledger_version:_optionalChain([r, 'optionalAccess', _59 => _59.ledgerVersion])}});i=a}else{let s="0x1::jwks::PatchedJWKs",{data:a}=await L({aptosConfig:e,originMethod:"getKeylessJWKs",path:`accounts/0x1/resource/${s}`,params:{ledger_version:_optionalChain([r, 'optionalAccess', _60 => _60.ledgerVersion])}});i=a}let o=new Map;for(let s of i.data.jwks.entries){let a=[];for(let c of s.jwks){let{data:d}=c.variant,l=new C(_chunkRX5UBAMEjs.j.fromHexInput(d).toUint8Array()),h=oi.deserialize(l);a.push(h)}o.set(_chunkRX5UBAMEjs.k.call(void 0, s.issuer),a)}return o}var oi=class n extends _chunkRX5UBAMEjs.l{constructor(e){super();let{kid:t,kty:r,alg:i,e:o,n:s}=e;this.kid=t,this.kty=r,this.alg=i,this.e=o,this.n=s}serialize(e){e.serializeStr(this.kid),e.serializeStr(this.kty),e.serializeStr(this.alg),e.serializeStr(this.e),e.serializeStr(this.n)}static fromMoveStruct(e){let{data:t}=e.variant,r=new C(_chunkRX5UBAMEjs.j.fromHexInput(t).toUint8Array());return n.deserialize(r)}static deserialize(e){let t=e.deserializeStr(),r=e.deserializeStr(),i=e.deserializeStr(),o=e.deserializeStr(),s=e.deserializeStr();return new n({kid:t,kty:r,alg:i,n:o,e:s})}};function Hc(n){try{let e=JSON.parse(n);if(e.kid===void 0)throw new Error("JWT header missing kid");return e}catch (e2){throw new Error("Failed to parse JWT header.")}}var ne=class n extends oe{constructor(e,t){super(),this.jwkAddress=_chunkRX5UBAMEjs.Z.from(e),this.keylessPublicKey=t}authKey(){let e=new _chunkRX5UBAMEjs.m;return e.serializeU32AsUleb128(4),e.serializeFixedBytes(this.bcsToBytes()),B.fromSchemeAndBytes({scheme:2,input:e.toUint8Array()})}verifySignature(e){throw new Error("Not yet implemented")}serialize(e){this.jwkAddress.serialize(e),this.keylessPublicKey.serialize(e)}static deserialize(e){let t=_chunkRX5UBAMEjs.Z.deserialize(e),r=k.deserialize(e);return new n(t,r)}static isPublicKey(e){return e instanceof n}static create(e){return new n(e.jwkAddress,k.create(e))}static fromJwtAndPepper(e){return new n(e.jwkAddress,k.fromJwtAndPepper(e))}static isInstance(e){return"jwkAddress"in e&&e.jwkAddress instanceof _chunkRX5UBAMEjs.Z&&"keylessPublicKey"in e&&e.keylessPublicKey instanceof k}};var O=class n extends oe{constructor(e){if(super(),this.publicKey=e,e instanceof x)this.variant=0;else if(e instanceof Ne)this.variant=1;else if(e instanceof k)this.variant=3;else if(e instanceof ne)this.variant=4;else throw new Error("Unsupported public key type")}verifySignature(e){let{message:t,signature:r}=e;return H.isInstance(r)?this.publicKey.verifySignature({message:t,signature:r.signature}):!1}authKey(){return B.fromSchemeAndBytes({scheme:2,input:this.toUint8Array()})}toUint8Array(){return this.bcsToBytes()}serialize(e){e.serializeU32AsUleb128(this.variant),this.publicKey.serialize(e)}static deserialize(e){let t=e.deserializeUleb128AsU32(),r;switch(t){case 0:r=x.deserialize(e);break;case 1:r=Ne.deserialize(e);break;case 3:r=k.deserialize(e);break;case 4:r=ne.deserialize(e);break;default:throw new Error(`Unknown variant index for AnyPublicKey: ${t}`)}return new n(r)}static isPublicKey(e){return e instanceof n}isEd25519(){return this.publicKey instanceof x}isSecp256k1PublicKey(){return this.publicKey instanceof Ne}static isInstance(e){return"publicKey"in e&&"variant"in e}},H= exports.AnySignature =class n extends M{constructor(e){if(super(),this.signature=e,e instanceof I)this.variant=0;else if(e instanceof yt)this.variant=1;else if(e instanceof Ve)this.variant=3;else throw new Error("Unsupported signature type")}toUint8Array(){return console.warn("[Aptos SDK] Calls to AnySignature.toUint8Array() will soon return the underlying signature bytes. Use AnySignature.bcsToBytes() instead."),this.bcsToBytes()}serialize(e){e.serializeU32AsUleb128(this.variant),this.signature.serialize(e)}static deserialize(e){let t=e.deserializeUleb128AsU32(),r;switch(t){case 0:r=I.deserialize(e);break;case 1:r=yt.deserialize(e);break;case 3:r=Ve.deserialize(e);break;default:throw new Error(`Unknown variant index for AnySignature: ${t}`)}return new n(r)}static isInstance(e){return"signature"in e&&typeof e.signature=="object"&&e.signature!==null&&"toUint8Array"in e.signature}};function $c(n){let e=n;return e-=e>>1&1431655765,e=(e&858993459)+(e>>2&858993459),(e+(e>>4)&252645135)*16843009>>24}var yn=class extends oe{constructor(e){super(),this.publicKeys=e.publicKeys}createBitmap(e){let{bits:t}=e,r=128,i=new Uint8Array([0,0,0,0]),o=new Set;return t.forEach((s,a)=>{if(a+1>this.publicKeys.length)throw new Error(`Signature index ${a+1} is out of public keys range, ${this.publicKeys.length}.`);if(o.has(s))throw new Error(`Duplicate bit ${s} detected.`);o.add(s);let c=Math.floor(s/8),d=i[c];d|=r>>s%8,i[c]=d}),i}getIndex(e){let t=this.publicKeys.findIndex(r=>r.toString()===e.toString());if(t!==-1)return t;throw new Error(`Public key ${e} not found in multi key set ${this.publicKeys}`)}},Ue= exports.MultiKey =class n extends yn{constructor(e){let{publicKeys:t,signaturesRequired:r}=e;if(super({publicKeys:t}),r<1)throw new Error("The number of required signatures needs to be greater than 0");if(t.length<r)throw new Error(`Provided ${t.length} public keys is smaller than the ${r} required signatures`);this.publicKeys=t.map(i=>i instanceof O?i:new O(i)),this.signaturesRequired=r}verifySignature(e){throw new Error("not implemented")}authKey(){return B.fromSchemeAndBytes({scheme:3,input:this.toUint8Array()})}serialize(e){e.serializeVector(this.publicKeys),e.serializeU8(this.signaturesRequired)}static deserialize(e){let t=e.deserializeVector(O),r=e.deserializeU8();return new n({publicKeys:t,signaturesRequired:r})}getIndex(e){let t=e instanceof O?e:new O(e);return super.getIndex(t)}static isInstance(e){return"publicKeys"in e&&"signaturesRequired"in e}},ue=class ue extends M{constructor(e){super();let{signatures:t,bitmap:r}=e;if(t.length>ue.MAX_SIGNATURES_SUPPORTED)throw new Error(`The number of signatures cannot be greater than ${ue.MAX_SIGNATURES_SUPPORTED}`);if(this.signatures=t.map(o=>o instanceof H?o:new H(o)),!(r instanceof Uint8Array))this.bitmap=ue.createBitmap({bits:r});else{if(r.length!==ue.BITMAP_LEN)throw new Error(`"bitmap" length should be ${ue.BITMAP_LEN}`);this.bitmap=r}let i=this.bitmap.reduce((o,s)=>o+$c(s),0);if(i!==this.signatures.length)throw new Error(`Expecting ${i} signatures from the bitmap, but got ${this.signatures.length}`)}static createBitmap(e){let{bits:t}=e,r=128,i=new Uint8Array([0,0,0,0]),o=new Set;return t.forEach(s=>{if(s>=ue.MAX_SIGNATURES_SUPPORTED)throw new Error(`Cannot have a signature larger than ${ue.MAX_SIGNATURES_SUPPORTED-1}.`);if(o.has(s))throw new Error("Duplicate bits detected.");o.add(s);let a=Math.floor(s/8),c=i[a];c|=r>>s%8,i[a]=c}),i}serialize(e){e.serializeVector(this.signatures),e.serializeBytes(this.bitmap)}static deserialize(e){let t=e.deserializeVector(H),r=e.deserializeBytes();return new ue({signatures:t,bitmap:r})}};ue.BITMAP_LEN=4,ue.MAX_SIGNATURES_SUPPORTED=ue.BITMAP_LEN*8;var Le=ue;var fe=class fe extends yn{constructor(e){let{publicKeys:t,threshold:r}=e;if(super({publicKeys:t}),t.length>fe.MAX_KEYS||t.length<fe.MIN_KEYS)throw new Error(`Must have between ${fe.MIN_KEYS} and ${fe.MAX_KEYS} public keys, inclusive`);if(r<fe.MIN_THRESHOLD||r>t.length)throw new Error(`Threshold must be between ${fe.MIN_THRESHOLD} and ${t.length}, inclusive`);this.publicKeys=t,this.threshold=r}verifySignature(e){let{message:t,signature:r}=e;if(!(r instanceof He))return!1;let i=[];for(let o=0;o<4;o+=1)for(let s=0;s<8;s+=1)if((r.bitmap[o]&1<<7-s)!==0){let c=o*8+s;i.push(c)}if(i.length!==r.signatures.length)throw new Error("Bitmap and signatures length mismatch");if(i.length<this.threshold)throw new Error("Not enough signatures");for(let o=0;o<i.length;o+=1)if(!this.publicKeys[i[o]].verifySignature({message:t,signature:r.signatures[o]}))return!1;return!0}authKey(){return B.fromSchemeAndBytes({scheme:1,input:this.toUint8Array()})}toUint8Array(){let e=new Uint8Array(this.publicKeys.length*x.LENGTH+1);return this.publicKeys.forEach((t,r)=>{e.set(t.toUint8Array(),r*x.LENGTH)}),e[this.publicKeys.length*x.LENGTH]=this.threshold,e}serialize(e){e.serializeBytes(this.toUint8Array())}static deserialize(e){let t=e.deserializeBytes(),r=t[t.length-1],i=[];for(let o=0;o<t.length-1;o+=x.LENGTH){let s=o;i.push(new x(t.subarray(s,s+x.LENGTH)))}return new fe({publicKeys:i,threshold:r})}getIndex(e){return super.getIndex(e)}};fe.MAX_KEYS=32,fe.MIN_KEYS=2,fe.MIN_THRESHOLD=1;var Vt=fe,de=class de extends M{constructor(e){super();let{signatures:t,bitmap:r}=e;if(t.length>de.MAX_SIGNATURES_SUPPORTED)throw new Error(`The number of signatures cannot be greater than ${de.MAX_SIGNATURES_SUPPORTED}`);if(this.signatures=t,!(r instanceof Uint8Array))this.bitmap=de.createBitmap({bits:r});else{if(r.length!==de.BITMAP_LEN)throw new Error(`"bitmap" length should be ${de.BITMAP_LEN}`);this.bitmap=r}}toUint8Array(){let e=new Uint8Array(this.signatures.length*I.LENGTH+de.BITMAP_LEN);return this.signatures.forEach((t,r)=>{e.set(t.toUint8Array(),r*I.LENGTH)}),e.set(this.bitmap,this.signatures.length*I.LENGTH),e}serialize(e){e.serializeBytes(this.toUint8Array())}static deserialize(e){let t=e.deserializeBytes(),r=t.subarray(t.length-4),i=[];for(let o=0;o<t.length-r.length;o+=I.LENGTH){let s=o;i.push(new I(t.subarray(s,s+I.LENGTH)))}return new de({signatures:i,bitmap:r})}static createBitmap(e){let{bits:t}=e,r=128,i=new Uint8Array([0,0,0,0]),o=new Set;return t.forEach((s,a)=>{if(s>=de.MAX_SIGNATURES_SUPPORTED)throw new Error(`Cannot have a signature larger than ${de.MAX_SIGNATURES_SUPPORTED-1}.`);if(o.has(s))throw new Error("Duplicate bits detected.");if(a>0&&s<=t[a-1])throw new Error("The bits need to be sorted in ascending order.");o.add(s);let c=Math.floor(s/8),d=i[c];d|=r>>s%8,i[c]=d}),i}};de.MAX_SIGNATURES_SUPPORTED=32,de.BITMAP_LEN=4;var He=de;var ar=(n,e)=>{let t=n.bcsToBytes(),r=typeof e=="string"?Buffer.from(e,"utf8"):e,i=new Uint8Array([...t,...r,254]);return new (0, _chunkRX5UBAMEjs.Z)(_sha3.sha3_256.call(void 0, i))},Im= exports.createResourceAddress =(n,e)=>{let t=n.bcsToBytes(),r=typeof e=="string"?Buffer.from(e,"utf8"):e,i=new Uint8Array([...t,...r,255]);return new (0, _chunkRX5UBAMEjs.Z)(_sha3.sha3_256.call(void 0, i))},vm= exports.createTokenAddress =(n,e,t)=>{let r=`${e}::${t}`;return ar(n,r)};var Q=class extends _chunkRX5UBAMEjs.l{static deserialize(e){let t=e.deserializeUleb128AsU32();switch(t){case 0:return xe.load(e);case 1:return $e.load(e);case 2:return se.load(e);case 3:return De.load(e);case 4:return qt.load(e);case 5:return fn.load(e);default:throw new Error(`Unknown variant index for AccountAuthenticator: ${t}`)}}isEd25519(){return this instanceof xe}isMultiEd25519(){return this instanceof $e}isSingleKey(){return this instanceof se}isMultiKey(){return this instanceof De}},xe= exports.AccountAuthenticatorEd25519 =class n extends Q{constructor(e,t){super(),this.public_key=e,this.signature=t}serialize(e){e.serializeU32AsUleb128(0),this.public_key.serialize(e),this.signature.serialize(e)}static load(e){let t=x.deserialize(e),r=I.deserialize(e);return new n(t,r)}},$e= exports.AccountAuthenticatorMultiEd25519 =class n extends Q{constructor(e,t){super(),this.public_key=e,this.signature=t}serialize(e){e.serializeU32AsUleb128(1),this.public_key.serialize(e),this.signature.serialize(e)}static load(e){let t=Vt.deserialize(e),r=He.deserialize(e);return new n(t,r)}},se= exports.AccountAuthenticatorSingleKey =class n extends Q{constructor(e,t){super(),this.public_key=e,this.signature=t}serialize(e){e.serializeU32AsUleb128(2),this.public_key.serialize(e),this.signature.serialize(e)}static load(e){let t=O.deserialize(e),r=H.deserialize(e);return new n(t,r)}},De= exports.AccountAuthenticatorMultiKey =class n extends Q{constructor(e,t){super(),this.public_keys=e,this.signatures=t}serialize(e){e.serializeU32AsUleb128(3),this.public_keys.serialize(e),this.signatures.serialize(e)}static load(e){let t=Ue.deserialize(e),r=Le.deserialize(e);return new n(t,r)}},qt= exports.AccountAuthenticatorNoAccountAuthenticator =class n extends Q{serialize(e){e.serializeU32AsUleb128(4)}static load(e){return new n}},fn= exports.AccountAuthenticatorAbstraction =class n extends Q{constructor(e,t,r){if(super(),!_chunkRX5UBAMEjs.ia.call(void 0, e))throw new Error(`Invalid function info ${e} passed into AccountAuthenticatorAbstraction`);this.functionInfo=e,this.authenticator=_chunkRX5UBAMEjs.j.fromHexInput(r),this.signingMessageDigest=_chunkRX5UBAMEjs.j.fromHexInput(_chunkRX5UBAMEjs.j.fromHexInput(t).toUint8Array())}serialize(e){e.serializeU32AsUleb128(5);let{moduleAddress:t,moduleName:r,functionName:i}=_chunkRX5UBAMEjs.ha.call(void 0, this.functionInfo);_chunkRX5UBAMEjs.Z.fromString(t).serialize(e),e.serializeStr(r),e.serializeStr(i),e.serializeU32AsUleb128(0),e.serializeBytes(this.signingMessageDigest.toUint8Array()),e.serializeFixedBytes(this.authenticator.toUint8Array())}static load(e){let t=_chunkRX5UBAMEjs.Z.deserialize(e),r=e.deserializeStr(),i=e.deserializeStr(),o=e.deserializeUleb128AsU32();if(o===0){let s=e.deserializeBytes(),a=e.deserializeFixedBytes(e.remaining());return new n(`${t}::${r}::${i}`,s,a)}throw new Error(`Unknown variant index for AccountAuthenticatorAbstraction: ${o}`)}};var Lt=class n extends _chunkRX5UBAMEjs.l{constructor(e){super(),this.chainId=e}serialize(e){e.serializeU8(this.chainId)}static deserialize(e){let t=e.deserializeU8();return new n(t)}};var K=class n extends _chunkRX5UBAMEjs.l{constructor(e){super(),this.identifier=e}serialize(e){e.serializeStr(this.identifier)}static deserialize(e){let t=e.deserializeStr();return new n(t)}};var An=class n extends _chunkRX5UBAMEjs.l{constructor(e,t){super(),this.address=e,this.name=t}static fromStr(e){let t=e.split("::");if(t.length!==2)throw new Error("Invalid module id.");return new n(_chunkRX5UBAMEjs.Z.fromString(t[0]),new K(t[1]))}serialize(e){this.address.serialize(e),this.name.serialize(e)}static deserialize(e){let t=_chunkRX5UBAMEjs.Z.deserialize(e),r=K.deserialize(e);return new n(t,r)}};var N=class n extends _chunkRX5UBAMEjs.l{deserialize(e){let t=_chunkRX5UBAMEjs.Z.deserialize(e),r=K.deserialize(e),i=K.deserialize(e),o=e.deserializeVector(n);return new ze(t,r,i,o)}static deserialize(e){let t=e.deserializeUleb128AsU32();switch(t){case 0:return V.load(e);case 1:return pe.load(e);case 2:return j.load(e);case 3:return je.load(e);case 4:return F.load(e);case 5:return bt.load(e);case 6:return v.load(e);case 7:return A.load(e);case 8:return We.load(e);case 9:return Qe.load(e);case 10:return Je.load(e);case 255:return G.load(e);default:throw new Error(`Unknown variant index for TypeTag: ${t}`)}}isBool(){return this instanceof V}isAddress(){return this instanceof F}isGeneric(){return this instanceof G}isSigner(){return this instanceof bt}isVector(){return this instanceof v}isStruct(){return this instanceof A}isU8(){return this instanceof pe}isU16(){return this instanceof We}isU32(){return this instanceof Qe}isU64(){return this instanceof j}isU128(){return this instanceof je}isU256(){return this instanceof Je}isPrimitive(){return this instanceof bt||this instanceof F||this instanceof V||this instanceof pe||this instanceof We||this instanceof Qe||this instanceof j||this instanceof je||this instanceof Je}},V= exports.TypeTagBool =class n extends N{toString(){return"bool"}serialize(e){e.serializeU32AsUleb128(0)}static load(e){return new n}},pe= exports.TypeTagU8 =class n extends N{toString(){return"u8"}serialize(e){e.serializeU32AsUleb128(1)}static load(e){return new n}},We= exports.TypeTagU16 =class n extends N{toString(){return"u16"}serialize(e){e.serializeU32AsUleb128(8)}static load(e){return new n}},Qe= exports.TypeTagU32 =class n extends N{toString(){return"u32"}serialize(e){e.serializeU32AsUleb128(9)}static load(e){return new n}},j= exports.TypeTagU64 =class n extends N{toString(){return"u64"}serialize(e){e.serializeU32AsUleb128(2)}static load(e){return new n}},je= exports.TypeTagU128 =class n extends N{toString(){return"u128"}serialize(e){e.serializeU32AsUleb128(3)}static load(e){return new n}},Je= exports.TypeTagU256 =class n extends N{toString(){return"u256"}serialize(e){e.serializeU32AsUleb128(10)}static load(e){return new n}},F= exports.TypeTagAddress =class n extends N{toString(){return"address"}serialize(e){e.serializeU32AsUleb128(4)}static load(e){return new n}},bt= exports.TypeTagSigner =class n extends N{toString(){return"signer"}serialize(e){e.serializeU32AsUleb128(5)}static load(e){return new n}},cr= exports.TypeTagReference =class n extends N{constructor(t){super();this.value=t}toString(){return`&${this.value.toString()}`}serialize(t){t.serializeU32AsUleb128(254)}static load(t){let r=N.deserialize(t);return new n(r)}},G= exports.TypeTagGeneric =class n extends N{constructor(t){super();this.value=t;if(t<0)throw new Error("Generic type parameter index cannot be negative")}toString(){return`T${this.value}`}serialize(t){t.serializeU32AsUleb128(255),t.serializeU32(this.value)}static load(t){let r=t.deserializeU32();return new n(r)}},v= exports.TypeTagVector =class n extends N{constructor(t){super();this.value=t}toString(){return`vector<${this.value.toString()}>`}static u8(){return new n(new pe)}serialize(t){t.serializeU32AsUleb128(6),this.value.serialize(t)}static load(t){let r=N.deserialize(t);return new n(r)}},A= exports.TypeTagStruct =class n extends N{constructor(t){super();this.value=t}toString(){let t="";return this.value.typeArgs.length>0&&(t=`<${this.value.typeArgs.map(r=>r.toString()).join(", ")}>`),`${this.value.address.toString()}::${this.value.moduleName.identifier}::${this.value.name.identifier}${t}`}serialize(t){t.serializeU32AsUleb128(7),this.value.serialize(t)}static load(t){let r=ze.deserialize(t);return new n(r)}isTypeTag(t,r,i){return this.value.moduleName.identifier===r&&this.value.name.identifier===i&&this.value.address.equals(t)}isString(){return this.isTypeTag(_chunkRX5UBAMEjs.Z.ONE,"string","String")}isOption(){return this.isTypeTag(_chunkRX5UBAMEjs.Z.ONE,"option","Option")}isObject(){return this.isTypeTag(_chunkRX5UBAMEjs.Z.ONE,"object","Object")}},ze= exports.StructTag =class n extends _chunkRX5UBAMEjs.l{constructor(e,t,r,i){super(),this.address=e,this.moduleName=t,this.name=r,this.typeArgs=i}serialize(e){e.serialize(this.address),e.serialize(this.moduleName),e.serialize(this.name),e.serializeVector(this.typeArgs)}static deserialize(e){let t=_chunkRX5UBAMEjs.Z.deserialize(e),r=K.deserialize(e),i=K.deserialize(e),o=e.deserializeVector(N);return new n(t,r,i,o)}};function hy(){return new ze(_chunkRX5UBAMEjs.Z.ONE,new K("aptos_coin"),new K("AptosCoin"),[])}function E(){return new ze(_chunkRX5UBAMEjs.Z.ONE,new K("string"),new K("String"),[])}function Ty(n){return new ze(_chunkRX5UBAMEjs.Z.ONE,new K("option"),new K("Option"),[n])}function le(n){return new ze(_chunkRX5UBAMEjs.Z.ONE,new K("object"),new K("Object"),[n])}function Wc(n){let e=n.deserializeUleb128AsU32();switch(e){case 0:return X.deserialize(n);case 1:return W.deserialize(n);case 2:return _e.deserialize(n);case 3:return _chunkRX5UBAMEjs.Z.deserialize(n);case 4:return _.deserialize(n,X);case 5:return U.deserialize(n);case 6:return we.deserialize(n);case 7:return Se.deserialize(n);case 8:return me.deserialize(n);case 9:return cn.deserialize(n);default:throw new Error(`Unknown variant index for ScriptTransactionArgument: ${e}`)}}var wt=class extends _chunkRX5UBAMEjs.l{static deserialize(e){let t=e.deserializeUleb128AsU32();switch(t){case 0:return St.load(e);case 2:return hn.load(e);case 3:return Tn.load(e);default:throw new Error(`Unknown variant index for TransactionPayload: ${t}`)}}},St= exports.TransactionPayloadScript =class n extends wt{constructor(e){super(),this.script=e}serialize(e){e.serializeU32AsUleb128(0),this.script.serialize(e)}static load(e){let t=bn.deserialize(e);return new n(t)}},hn= exports.TransactionPayloadEntryFunction =class n extends wt{constructor(e){super(),this.entryFunction=e}serialize(e){e.serializeU32AsUleb128(2),this.entryFunction.serialize(e)}static load(e){let t=_t.deserialize(e);return new n(t)}},Tn= exports.TransactionPayloadMultiSig =class n extends wt{constructor(e){super(),this.multiSig=e}serialize(e){e.serializeU32AsUleb128(3),this.multiSig.serialize(e)}static load(e){let t=wn.deserialize(e);return new n(t)}},_t= exports.EntryFunction =class n{constructor(e,t,r,i){this.module_name=e,this.function_name=t,this.type_args=r,this.args=i}static build(e,t,r,i){return new n(An.fromStr(e),new K(t),r,i)}serialize(e){this.module_name.serialize(e),this.function_name.serialize(e),e.serializeVector(this.type_args),e.serializeU32AsUleb128(this.args.length),this.args.forEach(t=>{t.serializeForEntryFunction(e)})}static deserialize(e){let t=An.deserialize(e),r=K.deserialize(e),i=e.deserializeVector(N),o=e.deserializeUleb128AsU32(),s=new Array;for(let a=0;a<o;a+=1){let c=e.deserializeUleb128AsU32(),d=Jn.deserialize(e,c);s.push(d)}return new n(t,r,i,s)}},bn= exports.Script =class n{constructor(e,t,r){this.bytecode=e,this.type_args=t,this.args=r}serialize(e){e.serializeBytes(this.bytecode),e.serializeVector(this.type_args),e.serializeU32AsUleb128(this.args.length),this.args.forEach(t=>{t.serializeForScriptFunction(e)})}static deserialize(e){let t=e.deserializeBytes(),r=e.deserializeVector(N),i=e.deserializeUleb128AsU32(),o=new Array;for(let s=0;s<i;s+=1){let a=Wc(e);o.push(a)}return new n(t,r,o)}},wn= exports.MultiSig =class n{constructor(e,t){this.multisig_address=e,this.transaction_payload=t}serialize(e){this.multisig_address.serialize(e),this.transaction_payload===void 0?e.serializeBool(!1):(e.serializeBool(!0),this.transaction_payload.serialize(e))}static deserialize(e){let t=_chunkRX5UBAMEjs.Z.deserialize(e),r=e.deserializeBool(),i;return r&&(i=Sn.deserialize(e)),new n(t,i)}},Sn= exports.MultiSigTransactionPayload =class n extends _chunkRX5UBAMEjs.l{constructor(e){super(),this.transaction_payload=e}serialize(e){e.serializeU32AsUleb128(0),this.transaction_payload.serialize(e)}static deserialize(e){return e.deserializeUleb128AsU32(),new n(_t.deserialize(e))}};var Ae=class n extends _chunkRX5UBAMEjs.l{constructor(e,t,r,i,o,s,a){super(),this.sender=e,this.sequence_number=t,this.payload=r,this.max_gas_amount=i,this.gas_unit_price=o,this.expiration_timestamp_secs=s,this.chain_id=a}serialize(e){this.sender.serialize(e),e.serializeU64(this.sequence_number),this.payload.serialize(e),e.serializeU64(this.max_gas_amount),e.serializeU64(this.gas_unit_price),e.serializeU64(this.expiration_timestamp_secs),this.chain_id.serialize(e)}static deserialize(e){let t=_chunkRX5UBAMEjs.Z.deserialize(e),r=e.deserializeU64(),i=wt.deserialize(e),o=e.deserializeU64(),s=e.deserializeU64(),a=e.deserializeU64(),c=Lt.deserialize(e);return new n(t,r,i,o,s,a,c)}},ur= exports.RawTransactionWithData =class extends _chunkRX5UBAMEjs.l{static deserialize(e){let t=e.deserializeUleb128AsU32();switch(t){case 0:return Et.load(e);case 1:return Pt.load(e);default:throw new Error(`Unknown variant index for RawTransactionWithData: ${t}`)}}},Et= exports.MultiAgentRawTransaction =class n extends ur{constructor(e,t){super(),this.raw_txn=e,this.secondary_signer_addresses=t}serialize(e){e.serializeU32AsUleb128(0),this.raw_txn.serialize(e),e.serializeVector(this.secondary_signer_addresses)}static load(e){let t=Ae.deserialize(e),r=e.deserializeVector(_chunkRX5UBAMEjs.Z);return new n(t,r)}},Pt= exports.FeePayerRawTransaction =class n extends ur{constructor(e,t,r){super(),this.raw_txn=e,this.secondary_signer_addresses=t,this.fee_payer_address=r}serialize(e){e.serializeU32AsUleb128(1),this.raw_txn.serialize(e),e.serializeVector(this.secondary_signer_addresses),this.fee_payer_address.serialize(e)}static load(e){let t=Ae.deserialize(e),r=e.deserializeVector(_chunkRX5UBAMEjs.Z),i=_chunkRX5UBAMEjs.Z.deserialize(e);return new n(t,r,i)}};var dr=class extends _chunkRX5UBAMEjs.l{constructor(t){super();this.accountAddress=_chunkRX5UBAMEjs.Z.ONE;this.moduleName=new P("account");this.structName=new P("RotationProofChallenge");this.sequenceNumber=new W(t.sequenceNumber),this.originator=t.originator,this.currentAuthKey=t.currentAuthKey,this.newPublicKey=_.U8(t.newPublicKey.toUint8Array())}serialize(t){t.serialize(this.accountAddress),t.serialize(this.moduleName),t.serialize(this.structName),t.serialize(this.sequenceNumber),t.serialize(this.originator),t.serialize(this.currentAuthKey),t.serialize(this.newPublicKey)}};var Xe=class extends _chunkRX5UBAMEjs.l{static deserialize(e){let t=e.deserializeUleb128AsU32();switch(t){case 0:return xt.load(e);case 1:return Ht.load(e);case 2:return It.load(e);case 3:return vt.load(e);case 4:return at.load(e);default:throw new Error(`Unknown variant index for TransactionAuthenticator: ${t}`)}}isEd25519(){return this instanceof xt}isMultiEd25519(){return this instanceof Ht}isMultiAgent(){return this instanceof It}isFeePayer(){return this instanceof vt}isSingleSender(){return this instanceof at}},xt= exports.TransactionAuthenticatorEd25519 =class n extends Xe{constructor(e,t){super(),this.public_key=e,this.signature=t}serialize(e){e.serializeU32AsUleb128(0),this.public_key.serialize(e),this.signature.serialize(e)}static load(e){let t=x.deserialize(e),r=I.deserialize(e);return new n(t,r)}},Ht= exports.TransactionAuthenticatorMultiEd25519 =class n extends Xe{constructor(e,t){super(),this.public_key=e,this.signature=t}serialize(e){e.serializeU32AsUleb128(1),this.public_key.serialize(e),this.signature.serialize(e)}static load(e){let t=Vt.deserialize(e),r=He.deserialize(e);return new n(t,r)}},It= exports.TransactionAuthenticatorMultiAgent =class n extends Xe{constructor(e,t,r){super(),this.sender=e,this.secondary_signer_addresses=t,this.secondary_signers=r}serialize(e){e.serializeU32AsUleb128(2),this.sender.serialize(e),e.serializeVector(this.secondary_signer_addresses),e.serializeVector(this.secondary_signers)}static load(e){let t=Q.deserialize(e),r=e.deserializeVector(_chunkRX5UBAMEjs.Z),i=e.deserializeVector(Q);return new n(t,r,i)}},vt= exports.TransactionAuthenticatorFeePayer =class n extends Xe{constructor(e,t,r,i){super(),this.sender=e,this.secondary_signer_addresses=t,this.secondary_signers=r,this.fee_payer=i}serialize(e){e.serializeU32AsUleb128(3),this.sender.serialize(e),e.serializeVector(this.secondary_signer_addresses),e.serializeVector(this.secondary_signers),this.fee_payer.address.serialize(e),this.fee_payer.authenticator.serialize(e)}static load(e){let t=Q.deserialize(e),r=e.deserializeVector(_chunkRX5UBAMEjs.Z),i=e.deserializeVector(Q),o=_chunkRX5UBAMEjs.Z.deserialize(e),s=Q.deserialize(e),a={address:o,authenticator:s};return new n(t,r,i,a)}},at= exports.TransactionAuthenticatorSingleSender =class n extends Xe{constructor(e){super(),this.sender=e}serialize(e){e.serializeU32AsUleb128(4),this.sender.serialize(e)}static load(e){let t=Q.deserialize(e);return new n(t)}};var Ye=class n extends _chunkRX5UBAMEjs.l{constructor(e,t){super(),this.raw_txn=e,this.authenticator=t}serialize(e){this.raw_txn.serialize(e),this.authenticator.serialize(e)}static deserialize(e){let t=Ae.deserialize(e),r=Xe.deserialize(e);return new n(t,r)}};var $t=class n extends _chunkRX5UBAMEjs.l{constructor(e,t){super(),this.rawTransaction=e,this.feePayerAddress=t}serialize(e){this.rawTransaction.serialize(e),this.feePayerAddress===void 0?e.serializeBool(!1):(e.serializeBool(!0),this.feePayerAddress.serialize(e))}static deserialize(e){let t=Ae.deserialize(e),r=e.deserializeBool(),i;return r&&(i=_chunkRX5UBAMEjs.Z.deserialize(e)),new n(t,i)}};var pr=class n extends _chunkRX5UBAMEjs.l{constructor(e,t,r){super(),this.rawTransaction=e,this.feePayerAddress=r,this.secondarySignerAddresses=t}serialize(e){this.rawTransaction.serialize(e),e.serializeVector(this.secondarySignerAddresses),this.feePayerAddress===void 0?e.serializeBool(!1):(e.serializeBool(!0),this.feePayerAddress.serialize(e))}static deserialize(e){let t=Ae.deserialize(e),r=e.deserializeVector(_chunkRX5UBAMEjs.Z),i=e.deserializeBool(),o;return i&&(o=_chunkRX5UBAMEjs.Z.deserialize(e)),new n(t,r,o)}};function si(n){return n.feePayerAddress?new Pt(n.rawTransaction,_nullishCoalesce(n.secondarySignerAddresses, () => ([])),n.feePayerAddress):n.secondarySignerAddresses?new Et(n.rawTransaction,n.secondarySignerAddresses):n.rawTransaction}function Wt(n,e){let t=_sha3.sha3_256.create();if(!e.startsWith("APTOS::"))throw new Error(`Domain separator needs to start with 'APTOS::'. Provided - ${e}`);t.update(e);let r=t.digest(),i=n,o=new Uint8Array(r.length+i.length);return o.set(r),o.set(i,r.length),o}function Rf(n){return Wt(n.bcsToBytes(),`APTOS::${n.constructor.name}`)}function Ie(n){let e=si(n);return n.feePayerAddress?Wt(e.bcsToBytes(),Zr):n.secondarySignerAddresses?Wt(e.bcsToBytes(),Zr):Wt(e.bcsToBytes(),mo)}var he=class n{constructor(e){this.signingScheme=0;let{privateKey:t,address:r}=e;this.privateKey=t,this.publicKey=t.publicKey(),this.accountAddress=r?_chunkRX5UBAMEjs.Z.from(r):this.publicKey.authKey().derivedAddress()}static generate(){let e=q.generate();return new n({privateKey:e})}static fromDerivationPath(e){let{path:t,mnemonic:r}=e,i=q.fromDerivationPath(t,r);return new n({privateKey:i})}verifySignature(e){return this.publicKey.verifySignature(e)}signWithAuthenticator(e){return new xe(this.publicKey,this.privateKey.sign(e))}signTransactionWithAuthenticator(e){return new xe(this.publicKey,this.signTransaction(e))}sign(e){return this.privateKey.sign(e)}signTransaction(e){return this.sign(Ie(e))}};function ai(n){return typeof n=="object"&&n!==null&&"getAnyPublicKey"in n&&typeof n.getAnyPublicKey=="function"}var Te=class n{constructor(e){this.signingScheme=2;let{privateKey:t,address:r}=e;this.privateKey=t,this.publicKey=new O(t.publicKey()),this.accountAddress=r?_chunkRX5UBAMEjs.Z.from(r):this.publicKey.authKey().derivedAddress()}getAnyPublicKey(){return this.publicKey}static generate(e={}){let{scheme:t=0}=e,r;switch(t){case 0:r=q.generate();break;case 2:r=Ge.generate();break;default:throw new Error(`Unsupported signature scheme ${t}`)}return new n({privateKey:r})}static fromDerivationPath(e){let{scheme:t=0,path:r,mnemonic:i}=e,o;switch(t){case 0:o=q.fromDerivationPath(r,i);break;case 2:o=Ge.fromDerivationPath(r,i);break;default:throw new Error(`Unsupported signature scheme ${t}`)}return new n({privateKey:o})}verifySignature(e){return this.publicKey.verifySignature(e)}signWithAuthenticator(e){return new se(this.publicKey,this.sign(e))}signTransactionWithAuthenticator(e){return new se(this.publicKey,this.signTransaction(e))}sign(e){return new H(this.privateKey.sign(e))}signTransaction(e){return this.sign(Ie(e))}static fromEd25519Account(e){return new n({privateKey:e.privateKey,address:e.accountAddress})}};var ke=class{static generate(e={}){let{scheme:t=0,legacy:r=!0}=e;return t===0&&r?he.generate():Te.generate({scheme:t})}static fromPrivateKey(e){let{privateKey:t,address:r,legacy:i=!0}=e;return t instanceof q&&i?new he({privateKey:t,address:r}):new Te({privateKey:t,address:r})}static fromPrivateKeyAndAddress(e){return this.fromPrivateKey(e)}static fromDerivationPath(e){let{scheme:t=0,mnemonic:r,path:i,legacy:o=!0}=e;return t===0&&o?he.fromDerivationPath({mnemonic:r,path:i}):Te.fromDerivationPath({scheme:t,mnemonic:r,path:i})}static authKey(e){let{publicKey:t}=e;return t.authKey()}verifySignature(e){return this.publicKey.verifySignature(e)}};var _utils = require('@noble/hashes/utils');var Jc=1209600,Qt=class Qt extends _chunkRX5UBAMEjs.l{constructor(e){super();let{privateKey:t,expiryDateSecs:r,blinder:i}=e;this.privateKey=t,this.publicKey=new ft(t.publicKey()),this.expiryDateSecs=r||_chunkRX5UBAMEjs.ba.call(void 0, _chunkRX5UBAMEjs.aa.call(void 0, )+Jc),this.blinder=i!==void 0?_chunkRX5UBAMEjs.j.fromHexInput(i).toUint8Array():Xc();let o=Wr(this.publicKey.bcsToBytes(),93);o.push(BigInt(this.expiryDateSecs)),o.push(pn(this.blinder));let s=ln(o);this.nonce=s.toString()}getPublicKey(){return this.publicKey}isExpired(){return Math.floor(Date.now()/1e3)>this.expiryDateSecs}serialize(e){e.serializeU32AsUleb128(this.publicKey.variant),e.serializeBytes(this.privateKey.toUint8Array()),e.serializeU64(this.expiryDateSecs),e.serializeFixedBytes(this.blinder)}static deserialize(e){let t=e.deserializeUleb128AsU32(),r;switch(t){case 0:r=q.deserialize(e);break;default:throw new Error(`Unknown variant index for EphemeralPublicKey: ${t}`)}let i=e.deserializeU64(),o=e.deserializeFixedBytes(31);return new Qt({privateKey:r,expiryDateSecs:Number(i),blinder:o})}static fromBytes(e){return Qt.deserialize(new C(e))}static generate(e){let t;switch(_optionalChain([e, 'optionalAccess', _61 => _61.scheme])){case 0:default:t=q.generate()}return new Qt({privateKey:t,expiryDateSecs:_optionalChain([e, 'optionalAccess', _62 => _62.expiryDateSecs])})}sign(e){if(this.isExpired())throw new Error("EphemeralKeyPair has expired");return new Ce(this.privateKey.sign(e))}};Qt.BLINDER_LENGTH=31;var Ct=Qt;function Xc(){return _utils.randomBytes.call(void 0, Ct.BLINDER_LENGTH)}var _eventemitter3 = require('eventemitter3'); var _eventemitter32 = _interopRequireDefault(_eventemitter3);function lr(n){return n!=null&&typeof n.checkKeylessAccountValidity=="function"}var jt=class jt extends _chunkRX5UBAMEjs.l{constructor(t){super();this.signingScheme=2;let{address:r,ephemeralKeyPair:i,publicKey:o,uidKey:s,uidVal:a,aud:c,pepper:d,proof:l,proofFetchCallback:h,jwt:p,verificationKeyHash:g}=t;if(this.ephemeralKeyPair=i,this.publicKey=o,this.accountAddress=r?_chunkRX5UBAMEjs.Z.from(r):this.publicKey.authKey().derivedAddress(),this.uidKey=s,this.uidVal=a,this.aud=c,this.jwt=p,this.emitter=new _eventemitter32.default,this.proofOrPromise=l,l instanceof Pe)this.proof=l;else{if(h===void 0)throw new Error("Must provide callback for async proof fetch");this.emitter.on("proofFetchFinish",async R=>{await h(R),this.emitter.removeAllListeners()}),this.init(l)}let b=_chunkRX5UBAMEjs.j.fromHexInput(d).toUint8Array();if(b.length!==jt.PEPPER_LENGTH)throw new Error(`Pepper length in bytes should be ${jt.PEPPER_LENGTH}`);if(this.pepper=b,g!==void 0){if(_chunkRX5UBAMEjs.j.hexInputToUint8Array(g).length!==32)throw new Error("verificationKeyHash must be 32 bytes");this.verificationKeyHash=_chunkRX5UBAMEjs.j.hexInputToUint8Array(g)}}getAnyPublicKey(){return new O(this.publicKey)}async init(t){try{this.proof=await t,this.emitter.emit("proofFetchFinish",{status:"Success"})}catch(r){r instanceof Error?this.emitter.emit("proofFetchFinish",{status:"Failed",error:r.toString()}):this.emitter.emit("proofFetchFinish",{status:"Failed",error:"Unknown"})}}serialize(t){if(this.accountAddress.serialize(t),t.serializeStr(this.jwt),t.serializeStr(this.uidKey),t.serializeFixedBytes(this.pepper),this.ephemeralKeyPair.serialize(t),this.proof===void 0)throw new Error("Cannot serialize - proof undefined");this.proof.serialize(t),t.serializeOption(this.verificationKeyHash,32)}static partialDeserialize(t){let r=_chunkRX5UBAMEjs.Z.deserialize(t),i=t.deserializeStr(),o=t.deserializeStr(),s=t.deserializeFixedBytes(31),a=Ct.deserialize(t),c=Pe.deserialize(t),d=t.deserializeOption("fixedBytes",32);return{address:r,jwt:i,uidKey:o,pepper:s,ephemeralKeyPair:a,proof:c,verificationKeyHash:d}}isExpired(){return this.ephemeralKeyPair.isExpired()}signWithAuthenticator(t){let r=new H(this.sign(t)),i=new O(this.publicKey);return new se(i,r)}signTransactionWithAuthenticator(t){let r=new H(this.signTransaction(t)),i=new O(this.publicKey);return new se(i,r)}async waitForProofFetch(){this.proofOrPromise instanceof Promise&&await this.proofOrPromise}async checkKeylessAccountValidity(t){if(this.isExpired())throw D.fromErrorType({type:0});if(await this.waitForProofFetch(),this.proof===void 0)throw D.fromErrorType({type:2});let r=_jwtdecode.jwtDecode.call(void 0, this.jwt,{header:!0});if(r.kid===void 0)throw D.fromErrorType({type:12,details:"checkKeylessAccountValidity failed. JWT is missing 'kid' in header. This should never happen."});if(this.verificationKeyHash!==void 0){let{verificationKey:i}=await mn({aptosConfig:t});if(_chunkRX5UBAMEjs.j.hexInputToString(i.hash())!==_chunkRX5UBAMEjs.j.hexInputToString(this.verificationKeyHash))throw D.fromErrorType({type:4})}else console.warn("[Aptos SDK] The verification key hash was not set. Proof may be invalid if the verification key has rotated.");await jt.fetchJWK({aptosConfig:t,publicKey:this.publicKey,kid:r.kid})}sign(t){let{expiryDateSecs:r}=this.ephemeralKeyPair;if(this.isExpired())throw D.fromErrorType({type:0});if(this.proof===void 0)throw D.fromErrorType({type:1,details:"Proof not found - make sure to call `await account.checkKeylessAccountValidity()` before signing."});let i=this.ephemeralKeyPair.getPublicKey(),o=this.ephemeralKeyPair.sign(t);return new Ve({jwtHeader:_chunkRX5UBAMEjs.ca.call(void 0, this.jwt.split(".")[0]),ephemeralCertificate:new Gt(this.proof,0),expiryDateSecs:r,ephemeralPublicKey:i,ephemeralSignature:o})}signTransaction(t){if(this.proof===void 0)throw D.fromErrorType({type:1,details:"Proof not found - make sure to call `await account.checkKeylessAccountValidity()` before signing."});let r=si(t),o=new ci(r,this.proof.proof).hash();return this.sign(o)}verifySignature(t){let{message:r,signature:i}=t;return!(this.isExpired()||!this.ephemeralKeyPair.getPublicKey().verifySignature({message:r,signature:i.ephemeralSignature}))}static async fetchJWK(t){let{aptosConfig:r,publicKey:i,kid:o}=t,s=i instanceof k?i:i.keylessPublicKey,{iss:a}=s,c,d=i instanceof ne?i.jwkAddress:void 0;try{c=await Po({aptosConfig:r,jwkAddr:d})}catch(p){throw D.fromErrorType({type:24,error:p,details:`Failed to fetch ${d?"Federated":"Patched"}JWKs ${d?`for address ${d}`:"0x1"}`})}let l=c.get(a);if(l===void 0)throw D.fromErrorType({type:7,details:`JWKs for issuer ${a} not found.`});let h=l.find(p=>p.kid===o);if(h===void 0)throw D.fromErrorType({type:6,details:`JWK with kid '${o}' for issuer '${a}' not found.`});return h}};jt.PEPPER_LENGTH=31;var ge=jt,ci= exports.TransactionAndProof =class extends _chunkRX5UBAMEjs.l{constructor(t,r){super();this.domainSeparator="APTOS::TransactionAndProof";this.transaction=t,this.proof=r}serialize(t){t.serializeFixedBytes(this.transaction.bcsToBytes()),t.serializeOption(this.proof)}hash(){return Wt(this.bcsToBytes(),this.domainSeparator)}};var Ze=class n extends ge{constructor(e){let t=k.create(e);super({publicKey:t,...e}),this.publicKey=t}serialize(e){super.serialize(e)}static deserialize(e){let{address:t,proof:r,ephemeralKeyPair:i,jwt:o,uidKey:s,pepper:a,verificationKeyHash:c}=ge.partialDeserialize(e),{iss:d,aud:l,uidVal:h}=qe({jwt:o,uidKey:s});return new n({address:t,proof:r,ephemeralKeyPair:i,iss:d,uidKey:s,uidVal:h,aud:l,pepper:a,jwt:o,verificationKeyHash:c})}static fromBytes(e){return n.deserialize(new C(_chunkRX5UBAMEjs.j.hexInputToUint8Array(e)))}static create(e){let{address:t,proof:r,jwt:i,ephemeralKeyPair:o,pepper:s,uidKey:a="sub",proofFetchCallback:c,verificationKey:d}=e,{iss:l,aud:h,uidVal:p}=qe({jwt:i,uidKey:a});return new n({address:t,proof:r,ephemeralKeyPair:o,iss:l,uidKey:a,uidVal:p,aud:h,pepper:s,jwt:i,proofFetchCallback:c,verificationKeyHash:d?d.hash():void 0})}};var Kt=class n extends ge{constructor(e){let t=ne.create(e);super({publicKey:t,...e}),this.publicKey=t,this.audless=_nullishCoalesce(e.audless, () => (!1))}serialize(e){super.serialize(e),this.publicKey.jwkAddress.serialize(e)}static deserialize(e){let{address:t,proof:r,ephemeralKeyPair:i,jwt:o,uidKey:s,pepper:a,verificationKeyHash:c}=ge.partialDeserialize(e),d=_chunkRX5UBAMEjs.Z.deserialize(e),{iss:l,aud:h,uidVal:p}=qe({jwt:o,uidKey:s});return new n({address:t,proof:r,ephemeralKeyPair:i,iss:l,uidKey:s,uidVal:p,aud:h,pepper:a,jwt:o,verificationKeyHash:c,jwkAddress:d})}static fromBytes(e){return n.deserialize(C.fromHex(e))}static create(e){let{address:t,proof:r,jwt:i,ephemeralKeyPair:o,pepper:s,jwkAddress:a,uidKey:c="sub",proofFetchCallback:d,verificationKey:l}=e,{iss:h,aud:p,uidVal:g}=qe({jwt:i,uidKey:c});return new n({address:t,proof:r,ephemeralKeyPair:o,iss:h,uidKey:c,uidVal:g,aud:p,pepper:s,jwkAddress:_chunkRX5UBAMEjs.Z.from(a),jwt:i,proofFetchCallback:d,verificationKeyHash:l?l.hash():void 0})}};var _n=class n{constructor(e){this.signingScheme=3;let{multiKey:t,address:r}=e,i=e.signers.map(a=>a instanceof he?Te.fromEd25519Account(a):a);if(t.signaturesRequired>i.length)throw new Error(`Not enough signers provided to satisfy the required signatures. Need ${t.signaturesRequired} signers, but only ${i.length} provided`);if(t.signaturesRequired<i.length)throw new Error(`More signers provided than required. Need ${t.signaturesRequired} signers, but ${i.length} provided`);this.publicKey=t,this.accountAddress=r?_chunkRX5UBAMEjs.Z.from(r):this.publicKey.authKey().derivedAddress();let o=[];for(let a of i)o.push(this.publicKey.getIndex(a.getAnyPublicKey()));let s=i.map((a,c)=>[a,o[c]]);s.sort((a,c)=>a[1]-c[1]),this.signers=s.map(a=>a[0]),this.signerIndicies=s.map(a=>a[1]),this.signaturesBitmap=this.publicKey.createBitmap({bits:o})}static fromPublicKeysAndSigners(e){let{publicKeys:t,signaturesRequired:r,signers:i}=e,o=new Ue({publicKeys:t,signaturesRequired:r});return new n({multiKey:o,signers:i})}static isMultiKeySigner(e){return e instanceof n}signWithAuthenticator(e){return new De(this.publicKey,this.sign(e))}signTransactionWithAuthenticator(e){return new De(this.publicKey,this.signTransaction(e))}async waitForProofFetch(){let t=this.signers.filter(r=>r instanceof ge).map(async r=>r.waitForProofFetch());await Promise.all(t)}async checkKeylessAccountValidity(e){let r=this.signers.filter(i=>i instanceof ge).map(i=>i.checkKeylessAccountValidity(e));await Promise.all(r)}sign(e){let t=[];for(let r of this.signers)t.push(r.sign(e));return new Le({signatures:t,bitmap:this.signaturesBitmap})}signTransaction(e){let t=[];for(let r of this.signers)t.push(r.signTransaction(e));return new Le({signatures:t,bitmap:this.signaturesBitmap})}verifySignature(e){let{message:t,signature:r}=e;if(!this.signerIndicies.every((o,s)=>s===0||o>=this.signerIndicies[s-1]))return!1;for(let o=0;o<r.signatures.length;o+=1){let s=r.signatures[o];if(!this.publicKey.publicKeys[this.signerIndicies[o]].verifySignature({message:t,signature:s}))return!1}return!0}};var Io=class{constructor(e){this.signingScheme=1;let{signers:t,publicKey:r,address:i}=e;if(this.publicKey=r,this.accountAddress=i?_chunkRX5UBAMEjs.Z.from(i):this.publicKey.authKey().derivedAddress(),r.threshold>t.length)throw new Error(`Not enough signers provided to satisfy the required signatures. Need ${r.threshold} signers, but only ${t.length} provided`);if(r.threshold<t.length)throw new Error(`More signers provided than required. Need ${r.threshold} signers, but ${t.length} provided`);let o=[];for(let a of t)o.push(this.publicKey.getIndex(a.publicKey()));let s=t.map((a,c)=>[a,o[c]]);s.sort((a,c)=>a[1]-c[1]),this.signers=s.map(a=>a[0]),this.signerIndices=s.map(a=>a[1]),this.signaturesBitmap=this.publicKey.createBitmap({bits:o})}verifySignature(e){return this.publicKey.verifySignature(e)}signWithAuthenticator(e){return new $e(this.publicKey,this.sign(e))}signTransactionWithAuthenticator(e){return new $e(this.publicKey,this.signTransaction(e))}sign(e){let t=[];for(let r of this.signers)t.push(r.sign(e));return new He({signatures:t,bitmap:this.signaturesBitmap})}signTransaction(e){return this.sign(Ie(e))}};function vo(n){let e=n.deserializeUleb128AsU32();if(!Object.values(_chunkRX5UBAMEjs.U).includes(e))throw new Error(`Deserialization of Account failed: SigningScheme variant ${e} is invalid`);return{address:_chunkRX5UBAMEjs.Z.deserialize(n),signingScheme:e}}function Co(n,e){if(e.serializeStr(n.jwt),e.serializeStr(n.uidKey),e.serializeFixedBytes(n.pepper),n.ephemeralKeyPair.serialize(e),n.proof===void 0)throw new Error("Cannot serialize - proof undefined");n.proof.serialize(e),e.serializeOption(n.verificationKeyHash,32)}function Ko(n){let e=n.deserializeStr(),t=n.deserializeStr(),r=n.deserializeFixedBytes(31),i=Ct.deserialize(n),o=Pe.deserialize(n),s=n.deserializeOption("fixedBytes",32);return{jwt:e,uidKey:t,pepper:r,ephemeralKeyPair:i,proof:o,verificationKeyHash:s}}var Ro;(h=>{function n(p){let g=new _chunkRX5UBAMEjs.m;switch(g.serializeU32AsUleb128(p.signingScheme),p.accountAddress.serialize(g),p.signingScheme){case 0:return p.privateKey.serialize(g),g.toUint8Array();case 2:{if(!ai(p))throw new Error("Account is not a SingleKeySigner");let b=p.getAnyPublicKey();switch(g.serializeU32AsUleb128(b.variant),b.variant){case 3:return Co(p,g),g.toUint8Array();case 4:{let R=p;return Co(R,g),R.publicKey.jwkAddress.serialize(g),g.serializeBool(R.audless),g.toUint8Array()}case 1:case 0:return p.privateKey.serialize(g),g.toUint8Array();default:throw new Error(`Invalid public key variant: ${b.variant}`)}}case 3:{let b=p;return b.publicKey.serialize(g),g.serializeU32AsUleb128(b.signers.length),b.signers.forEach(R=>{g.serializeFixedBytes(n(R))}),g.toUint8Array()}default:throw new Error(`Deserialization of Account failed: invalid signingScheme value ${p.signingScheme}`)}}h.toBytes=n;function e(p){return _chunkRX5UBAMEjs.j.hexInputToStringWithoutPrefix(n(p))}h.toHexStringWithoutPrefix=e;function t(p){return _chunkRX5UBAMEjs.j.hexInputToString(n(p))}h.toHexString=t;function r(p){let{address:g,signingScheme:b}=vo(p);switch(b){case 0:{let R=q.deserialize(p);return new he({privateKey:R,address:g})}case 2:{let R=p.deserializeUleb128AsU32();switch(R){case 0:{let ee=q.deserialize(p);return new Te({privateKey:ee,address:g})}case 1:{let ee=Ge.deserialize(p);return new Te({privateKey:ee,address:g})}case 3:{let ee=Ko(p),dt=qe(ee);return new Ze({...ee,...dt})}case 4:{let ee=Ko(p),dt=_chunkRX5UBAMEjs.Z.deserialize(p),Dt=p.deserializeBool(),zt=qe(ee);return new Kt({...ee,...zt,jwkAddress:dt,audless:Dt})}default:throw new Error(`Unsupported public key variant ${R}`)}}case 3:{let R=Ue.deserialize(p),ee=p.deserializeUleb128AsU32(),dt=new Array;for(let Dt=0;Dt<ee;Dt+=1){let zt=r(p);if(!ai(zt)&&!(zt instanceof he))throw new Error("Deserialization of MultiKeyAccount failed. Signer is not a SingleKeySigner or Ed25519Account");dt.push(zt)}return new _n({multiKey:R,signers:dt,address:g})}default:throw new Error(`Deserialization of Account failed: invalid signingScheme value ${b}`)}}h.deserialize=r;function i(p){let g=d(p);if(!(g instanceof Ze))throw new Error("Deserialization of KeylessAccount failed");return g}h.keylessAccountFromHex=i;function o(p){let g=d(p);if(!(g instanceof Kt))throw new Error("Deserialization of FederatedKeylessAccount failed");return g}h.federatedKeylessAccountFromHex=o;function s(p){let g=d(p);if(!(g instanceof _n))throw new Error("Deserialization of MultiKeyAccount failed");return g}h.multiKeyAccountFromHex=s;function a(p){let g=d(p);if(!(g instanceof Te))throw new Error("Deserialization of SingleKeyAccount failed");return g}h.singleKeyAccountFromHex=a;function c(p){let g=d(p);if(!(g instanceof he))throw new Error("Deserialization of Ed25519Account failed");return g}h.ed25519AccountFromHex=c;function d(p){return r(C.fromHex(p))}h.fromHex=d;function l(p){return d(p)}h.fromBytes=l})(Ro||(Ro= exports.AccountUtils ={}));var En=class n extends M{constructor(e){super(),this.value=_chunkRX5UBAMEjs.j.fromHexInput(e)}serialize(e){e.serializeBytes(this.value.toUint8Array())}static deserialize(e){return new n(e.deserializeBytes())}},gr=class extends oe{constructor(e){super(),this.accountAddress=e}authKey(){return new B({data:this.accountAddress.toUint8Array()})}verifySignature(e){throw new Error("This function is not implemented for AbstractPublicKey.")}serialize(e){throw new Error("This function is not implemented for AbstractPublicKey.")}};var Do=class n extends ke{constructor({signer:t,accountAddress:r,authenticationFunction:i}){super();this.signingScheme=2;if(!_chunkRX5UBAMEjs.ia.call(void 0, i))throw new Error(`Invalid authentication function ${i} passed into AbstractedAccount`);this.authenticationFunction=i,this.accountAddress=r,this.publicKey=new gr(this.accountAddress),this.sign=o=>new En(t(o))}static fromPermissionedSigner({signer:t,accountAddress:r}){return new n({signer:i=>{let o=new _chunkRX5UBAMEjs.m;return t.publicKey.serialize(o),t.sign(i).serialize(o),o.toUint8Array()},accountAddress:_nullishCoalesce(r, () => (t.accountAddress)),authenticationFunction:"0x1::permissioned_delegation::authenticate"})}signWithAuthenticator(t){return new fn(this.authenticationFunction,_sha3.sha3_256.call(void 0, t),this.sign(_sha3.sha3_256.call(void 0, t)).toUint8Array())}signTransactionWithAuthenticator(t){return this.signWithAuthenticator(Ie(t))}signTransaction(t){return this.sign(Ie(t))}setSigner(t){this.sign=r=>new En(t(r))}};var eu=`
|
|
5
|
+
Error: ${_chunkPA2XFIP3js.$.call(void 0, r)}`),o+=`
|
|
6
|
+
KeylessErrorResolutionTip: ${t}`,o}static fromErrorType(e){let{error:t,type:r,details:i}=e,[o,s,a]=wo[r];return new n({message:o,details:i,innerError:t,category:s,resolutionTip:a,type:r})}},Z= exports.AptosApiError =class extends Error{constructor({apiType:e,aptosRequest:t,aptosResponse:r}){super(Oc({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 Oc({apiType:n,aptosRequest:e,aptosResponse:t}){let r=_optionalChain([t, 'access', _8 => _8.headers, 'optionalAccess', _9 => _9.traceparent, 'optionalAccess', _10 => _10.split, 'call', _11 => _11("-"), 'access', _12 => _12[1]]),i=r?`(trace_id:${r}) `:"",o=`Request to [${n}]: ${e.method} ${_nullishCoalesce(t.url, () => (e.url))} ${i}failed with`;return n==="Indexer"&&_optionalChain([t, 'access', _13 => _13.data, 'optionalAccess', _14 => _14.errors, 'optionalAccess', _15 => _15[0], 'optionalAccess', _16 => _16.message])!=null?`${o}: ${t.data.errors[0].message}`:_optionalChain([t, 'access', _17 => _17.data, 'optionalAccess', _18 => _18.message])!=null&&_optionalChain([t, 'access', _19 => _19.data, 'optionalAccess', _20 => _20.error_code])!=null?`${o}: ${JSON.stringify(t.data)}`:`${o} status: ${t.statusText}(code:${t.status}) and response body: ${Fc(t.data)}`}var ri=400;function Fc(n){let e=JSON.stringify(n);return e.length<=ri?e:`truncated(original_size:${e.length}): ${e.slice(0,ri/2)}...${e.slice(-ri/2)}`}async function Nc(n,e){let{url:t,method:r,body:i,contentType:o,params:s,overrides:a,originMethod:c}=n,d={..._optionalChain([a, 'optionalAccess', _21 => _21.HEADERS]),"x-aptos-client":`aptos-typescript-sdk/${Xr}`,"content-type":_nullishCoalesce(o, () => ("application/json")),"x-aptos-typescript-sdk-origin-method":c};return _optionalChain([a, 'optionalAccess', _22 => _22.AUTH_TOKEN])&&(d.Authorization=`Bearer ${_optionalChain([a, 'optionalAccess', _23 => _23.AUTH_TOKEN])}`),_optionalChain([a, 'optionalAccess', _24 => _24.API_KEY])&&(d.Authorization=`Bearer ${_optionalChain([a, 'optionalAccess', _25 => _25.API_KEY])}`),e.provider({url:t,method:r,body:i,params:s,headers:d,overrides:a})}async function Bc(n,e){if(e.binaryProvider===void 0)throw new Error("Binary provider is not provided");let{url:t,method:r,body:i,contentType:o,acceptType:s,params:a,overrides:c,originMethod:d}=n,l={..._optionalChain([c, 'optionalAccess', _26 => _26.HEADERS]),"x-aptos-client":`aptos-typescript-sdk/${Xr}`,"content-type":_nullishCoalesce(o, () => ("application/json")),accept:_nullishCoalesce(s, () => ("application/x-bcs")),"x-aptos-typescript-sdk-origin-method":d};return _optionalChain([c, 'optionalAccess', _27 => _27.AUTH_TOKEN])&&(l.Authorization=`Bearer ${_optionalChain([c, 'optionalAccess', _28 => _28.AUTH_TOKEN])}`),_optionalChain([c, 'optionalAccess', _29 => _29.API_KEY])&&(l.Authorization=`Bearer ${_optionalChain([c, 'optionalAccess', _30 => _30.API_KEY])}`),e.binaryProvider({acceptType:"application/x-bcs",url:t,method:r,body:i,params:a,headers:l,overrides:c})}async function or(n,e,t){let{url:r,path:i}=n,o=i?`${r}/${i}`:r,s=await Nc({...n,url:o},e.client),a={status:s.status,statusText:_nullishCoalesce(s.statusText, () => ("No status text provided")),data:s.data,headers:s.headers,config:s.config,request:s.request,url:o};if(a.status===401)throw new Z({apiType:t,aptosRequest:n,aptosResponse:a});if(t==="Indexer"){let c=a.data;if(c.errors)throw new Z({apiType:t,aptosRequest:n,aptosResponse:a});a.data=c.data}else if((t==="Pepper"||t==="Prover")&&a.status>=400)throw new Z({apiType:t,aptosRequest:n,aptosResponse:a});if(a.status>=200&&a.status<300)return a;throw new Z({apiType:t,aptosRequest:n,aptosResponse:a})}async function sr(n,e,t){let{url:r,path:i}=n,o=i?`${r}/${i}`:r,s=await Bc({...n,url:o},e.client),a={status:s.status,statusText:_nullishCoalesce(s.statusText, () => ("No status text provided")),data:s.data,headers:s.headers,config:s.config,request:s.request,url:o};if(a.status===401)throw new Z({apiType:t,aptosRequest:n,aptosResponse:a});if(t==="Indexer"){let c=a.data;if(c.errors)throw new Z({apiType:t,aptosRequest:n,aptosResponse:a});a.data=c.data}else if((t==="Pepper"||t==="Prover")&&a.status>=400)throw new Z({apiType:t,aptosRequest:n,aptosResponse:a});if(a.status>=200&&a.status<300)return a;throw new Z({apiType:t,aptosRequest:n,aptosResponse:a})}async function ar(n){let{aptosConfig:e,overrides:t,params:r,contentType:i,acceptType:o,path:s,originMethod:a,type:c}=n,d=e.getRequestUrl(c);return or({url:d,method:"GET",originMethod:a,path:s,contentType:i,acceptType:o,params:r,overrides:{...e.clientConfig,...t}},e,n.type)}async function Gc(n){let{aptosConfig:e,overrides:t,params:r,contentType:i,acceptType:o,path:s,originMethod:a,type:c}=n,d=e.getRequestUrl(c);return sr({url:d,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 ar({...n,type:"Fullnode",overrides:{...e.clientConfig,...e.fullnodeConfig,...n.overrides,HEADERS:{..._optionalChain([e, 'access', _31 => _31.clientConfig, 'optionalAccess', _32 => _32.HEADERS]),..._optionalChain([e, 'access', _33 => _33.fullnodeConfig, 'optionalAccess', _34 => _34.HEADERS])}}})}async function Ll(n){let{aptosConfig:e}=n;return Gc({...n,type:"Fullnode",overrides:{...e.clientConfig,...e.fullnodeConfig,...n.overrides,HEADERS:{..._optionalChain([e, 'access', _35 => _35.clientConfig, 'optionalAccess', _36 => _36.HEADERS]),..._optionalChain([e, 'access', _37 => _37.fullnodeConfig, 'optionalAccess', _38 => _38.HEADERS])}}})}async function Hl(n){return ar({...n,type:"Pepper"})}async function cr(n){let e=[],t,r=n.params;do{let i=await ar({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 ur(n){let e=[],t,r=n.params,i=r.limit;do{let o=await ar({type:"Fullnode",aptosConfig:n.aptosConfig,originMethod:n.originMethod,path:n.path,params:r,overrides:n.overrides});if(t=o.headers["x-aptos-cursor"],delete o.headers,e.push(...o.data),r.offset=t,i!==void 0){let s=i-e.length;if(s<=0)break;r.limit=s}}while(t!=null);return e}async function fn(n){let{type:e,originMethod:t,path:r,body:i,acceptType:o,contentType:s,params:a,aptosConfig:c,overrides:d}=n,l=c.getRequestUrl(e);return or({url:l,method:"POST",originMethod:t,path:r,body:i,contentType:s,acceptType:o,params:a,overrides:d},c,n.type)}async function Mc(n){let{type:e,originMethod:t,path:r,body:i,acceptType:o,contentType:s,params:a,aptosConfig:c,overrides:d}=n,l=c.getRequestUrl(e);return sr({url:l,method:"POST",originMethod:t,path:r,body:i,contentType:s,acceptType:o,params:a,overrides:d},c,n.type)}async function st(n){let{aptosConfig:e}=n;return fn({...n,type:"Fullnode",overrides:{...e.clientConfig,...e.fullnodeConfig,...n.overrides,HEADERS:{..._optionalChain([e, 'access', _39 => _39.clientConfig, 'optionalAccess', _40 => _40.HEADERS]),..._optionalChain([e, 'access', _41 => _41.fullnodeConfig, 'optionalAccess', _42 => _42.HEADERS])}}})}async function So(n){let{aptosConfig:e}=n;return Mc({...n,type:"Fullnode",overrides:{...e.clientConfig,...e.fullnodeConfig,...n.overrides,HEADERS:{..._optionalChain([e, 'access', _43 => _43.clientConfig, 'optionalAccess', _44 => _44.HEADERS]),..._optionalChain([e, 'access', _45 => _45.fullnodeConfig, 'optionalAccess', _46 => _46.HEADERS])}}})}async function _o(n){let{aptosConfig:e}=n;return fn({...n,type:"Indexer",overrides:{...e.clientConfig,...e.indexerConfig,...n.overrides,HEADERS:{..._optionalChain([e, 'access', _47 => _47.clientConfig, 'optionalAccess', _48 => _48.HEADERS]),..._optionalChain([e, 'access', _49 => _49.indexerConfig, 'optionalAccess', _50 => _50.HEADERS])}}})}async function Eo(n){let{aptosConfig:e}=n,t={...e,clientConfig:{...e.clientConfig}};return _optionalChainDelete([t, 'optionalAccess', _51 => _51.clientConfig, 'optionalAccess', _52 => delete _52.API_KEY]),fn({...n,type:"Faucet",overrides:{...t.clientConfig,...t.faucetConfig,...n.overrides,HEADERS:{..._optionalChain([t, 'access', _53 => _53.clientConfig, 'optionalAccess', _54 => _54.HEADERS]),..._optionalChain([t, 'access', _55 => _55.faucetConfig, 'optionalAccess', _56 => _56.HEADERS])}}})}async function Po(n){return fn({...n,type:"Pepper"})}async function xo(n){return fn({...n,type:"Prover"})}var ii=new Map;function Ue(n,e,t){return async(...r)=>{if(ii.has(e)){let{value:o,timestamp:s}=ii.get(e);if(t===void 0||Date.now()-s<=t)return o}let i=await n(...r);return ii.set(e,{value:i,timestamp:Date.now()}),i}}var Eg=1e7,qc= exports.MAX_AUD_VAL_BYTES =120,Lc= exports.MAX_UID_KEY_BYTES =30,Hc= exports.MAX_UID_VAL_BYTES =330,Pg= exports.MAX_ISS_VAL_BYTES =120,xg= exports.MAX_EXTRA_FIELD_BYTES =350,vg= exports.MAX_JWT_HEADER_B64_BYTES =300,Ig= exports.MAX_COMMITED_EPK_BYTES =93,De=class De extends oe{constructor(e,t){super();let r=_chunkPA2XFIP3js.j.fromHexInput(t).toUint8Array();if(r.length!==De.ID_COMMITMENT_LENGTH)throw new Error(`Id Commitment length in bytes should be ${De.ID_COMMITMENT_LENGTH}`);this.iss=e,this.idCommitment=r}authKey(){let e=new _chunkPA2XFIP3js.m;return e.serializeU32AsUleb128(3),e.serializeFixedBytes(this.bcsToBytes()),G.fromSchemeAndBytes({scheme:2,input:e.toUint8Array()})}verifySignature(e){throw new Error("Not yet implemented")}serialize(e){e.serializeStr(this.iss),e.serializeBytes(this.idCommitment)}static deserialize(e){let t=e.deserializeStr(),r=e.deserializeBytes();return new De(t,r)}static load(e){let t=e.deserializeStr(),r=e.deserializeBytes();return new De(t,r)}static isPublicKey(e){return e instanceof De}static create(e){return vo(e),new De(e.iss,vo(e))}static fromJwtAndPepper(e){let{jwt:t,pepper:r,uidKey:i="sub"}=e,o=_jwtdecode.jwtDecode.call(void 0, t);if(typeof o.iss!="string")throw new Error("iss was not found");if(typeof o.aud!="string")throw new Error("aud was not found or an array of values");let s=o[i];return De.create({iss:o.iss,uidKey:i,uidVal:s,aud:o.aud,pepper:r})}static isInstance(e){return"iss"in e&&typeof e.iss=="string"&&"idCommitment"in e&&e.idCommitment instanceof Uint8Array}};De.ID_COMMITMENT_LENGTH=32;var k=De;function vo(n){let{uidKey:e,uidVal:t,aud:r,pepper:i}=n,o=[mn(_chunkPA2XFIP3js.j.fromHexInput(i).toUint8Array()),tr(r,qc),tr(t,Hc),tr(e,Lc)];return po(yn(o),k.ID_COMMITMENT_LENGTH)}var ze=class n extends M{constructor(e){super();let{jwtHeader:t,ephemeralCertificate:r,expiryDateSecs:i,ephemeralPublicKey:o,ephemeralSignature:s}=e;this.jwtHeader=t,this.ephemeralCertificate=r,this.expiryDateSecs=i,this.ephemeralPublicKey=o,this.ephemeralSignature=s}getJwkKid(){return Qc(this.jwtHeader).kid}serialize(e){this.ephemeralCertificate.serialize(e),e.serializeStr(this.jwtHeader),e.serializeU64(this.expiryDateSecs),this.ephemeralPublicKey.serialize(e),this.ephemeralSignature.serialize(e)}static deserialize(e){let t=Vt.deserialize(e),r=e.deserializeStr(),i=e.deserializeU64(),o=At.deserialize(e),s=Re.deserialize(e);return new n({jwtHeader:r,expiryDateSecs:Number(i),ephemeralCertificate:t,ephemeralPublicKey:o,ephemeralSignature:s})}static getSimulationSignature(){return new n({jwtHeader:"{}",ephemeralCertificate:new Vt(new xe({proof:new Lt(new qt({a:new Uint8Array(32),b:new Uint8Array(64),c:new Uint8Array(32)}),0),expHorizonSecs:0}),0),expiryDateSecs:0,ephemeralPublicKey:new At(new v(new Uint8Array(32))),ephemeralSignature:new Re(new I(new Uint8Array(64)))})}static isSignature(e){return e instanceof n}},Vt= exports.EphemeralCertificate =class n extends M{constructor(e,t){super(),this.signature=e,this.variant=t}toUint8Array(){return this.signature.toUint8Array()}serialize(e){e.serializeU32AsUleb128(this.variant),this.signature.serialize(e)}static deserialize(e){let t=e.deserializeUleb128AsU32();switch(t){case 0:return new n(xe.deserialize(e),t);default:throw new Error(`Unknown variant index for EphemeralCertificate: ${t}`)}}},Me=class n extends _chunkPA2XFIP3js.l{constructor(e){if(super(),this.data=_chunkPA2XFIP3js.j.fromHexInput(e).toUint8Array(),this.data.length!==32)throw new Error("Input needs to be 32 bytes")}serialize(e){e.serializeFixedBytes(this.data)}static deserialize(e){let t=e.deserializeFixedBytes(32);return new n(t)}},bt=class n extends _chunkPA2XFIP3js.l{constructor(e){if(super(),this.data=_chunkPA2XFIP3js.j.fromHexInput(e).toUint8Array(),this.data.length!==64)throw new Error("Input needs to be 64 bytes")}serialize(e){e.serializeFixedBytes(this.data)}static deserialize(e){let t=e.deserializeFixedBytes(64);return new n(t)}},qt= exports.Groth16Zkp =class n extends nr{constructor(e){super();let{a:t,b:r,c:i}=e;this.a=new Me(t),this.b=new bt(r),this.c=new Me(i)}serialize(e){this.a.serialize(e),this.b.serialize(e),this.c.serialize(e)}static deserialize(e){let t=Me.deserialize(e).bcsToBytes(),r=bt.deserialize(e).bcsToBytes(),i=Me.deserialize(e).bcsToBytes();return new n({a:t,b:r,c:i})}},Lt= exports.ZkProof =class n extends _chunkPA2XFIP3js.l{constructor(e,t){super(),this.proof=e,this.variant=t}serialize(e){e.serializeU32AsUleb128(this.variant),this.proof.serialize(e)}static deserialize(e){let t=e.deserializeUleb128AsU32();switch(t){case 0:return new n(qt.deserialize(e),t);default:throw new Error(`Unknown variant index for ZkProof: ${t}`)}}},xe= exports.ZeroKnowledgeSig =class n extends M{constructor(e){super();let{proof:t,expHorizonSecs:r,trainingWheelsSignature:i,extraField:o,overrideAudVal:s}=e;this.proof=t,this.expHorizonSecs=r,this.trainingWheelsSignature=i,this.extraField=o,this.overrideAudVal=s}static fromBytes(e){return n.deserialize(new C(e))}serialize(e){this.proof.serialize(e),e.serializeU64(this.expHorizonSecs),e.serializeOption(this.extraField),e.serializeOption(this.overrideAudVal),e.serializeOption(this.trainingWheelsSignature)}static deserialize(e){let t=Lt.deserialize(e),r=Number(e.deserializeU64()),i=e.deserializeOption("string"),o=e.deserializeOption("string"),s=e.deserializeOption(Re);return new n({proof:t,expHorizonSecs:r,trainingWheelsSignature:s,extraField:i,overrideAudVal:o})}},oi= exports.KeylessConfiguration =class n{constructor(e,t){this.verificationKey=e,this.maxExpHorizonSecs=t}static create(e,t){return new n(new si({alphaG1:e.alpha_g1,betaG2:e.beta_g2,deltaG2:e.delta_g2,gammaAbcG1:e.gamma_abc_g1,gammaG2:e.gamma_g2}),t)}},si= exports.Groth16VerificationKey =class n{constructor(e){let{alphaG1:t,betaG2:r,deltaG2:i,gammaAbcG1:o,gammaG2:s}=e;this.alphaG1=new Me(t),this.betaG2=new bt(r),this.deltaG2=new bt(i),this.gammaAbcG1=[new Me(o[0]),new Me(o[1])],this.gammaG2=new bt(s)}hash(){let e=new _chunkPA2XFIP3js.m;return this.serialize(e),_sha3.sha3_256.create().update(e.toUint8Array()).digest()}serialize(e){this.alphaG1.serialize(e),this.betaG2.serialize(e),this.deltaG2.serialize(e),this.gammaAbcG1[0].serialize(e),this.gammaAbcG1[1].serialize(e),this.gammaG2.serialize(e)}static fromGroth16VerificationKeyResponse(e){return new n({alphaG1:e.alpha_g1,betaG2:e.beta_g2,deltaG2:e.delta_g2,gammaAbcG1:e.gamma_abc_g1,gammaG2:e.gamma_g2})}};async function An(n){let{aptosConfig:e}=n;try{return await Ue(async()=>{let t=await $c(n),r=await Wc(n);return oi.create(r,Number(t.max_exp_horizon_secs))},`keyless-configuration-${e.network}`,1e3*60*5)()}catch(t){throw t instanceof z?t:z.fromErrorType({type:25,error:t})}}function Ve(n){let{jwt:e,uidKey:t="sub"}=n,r;try{r=_jwtdecode.jwtDecode.call(void 0, e)}catch(o){throw z.fromErrorType({type:12,details:`Failed to parse JWT - ${_chunkPA2XFIP3js.$.call(void 0, o)}`})}if(typeof r.iss!="string")throw z.fromErrorType({type:12,details:"JWT is missing 'iss' in the payload. This should never happen."});if(typeof r.aud!="string")throw z.fromErrorType({type:12,details:"JWT is missing 'aud' in the payload or 'aud' is an array of values."});let i=r[t];return{iss:r.iss,aud:r.aud,uidVal:i}}async function $c(n){let{aptosConfig:e,options:t}=n,r="0x1::keyless_account::Configuration";try{let{data:i}=await V({aptosConfig:e,originMethod:"getKeylessConfigurationResource",path:`accounts/${_chunkPA2XFIP3js.Z.from("0x1").toString()}/resource/${r}`,params:{ledger_version:_optionalChain([t, 'optionalAccess', _57 => _57.ledgerVersion])}});return i.data}catch(i){throw z.fromErrorType({type:22,error:i})}}async function Wc(n){let{aptosConfig:e,options:t}=n,r="0x1::keyless_account::Groth16VerificationKey";try{let{data:i}=await V({aptosConfig:e,originMethod:"getGroth16VerificationKeyResource",path:`accounts/${_chunkPA2XFIP3js.Z.from("0x1").toString()}/resource/${r}`,params:{ledger_version:_optionalChain([t, 'optionalAccess', _58 => _58.ledgerVersion])}});return i.data}catch(i){throw z.fromErrorType({type:23,error:i})}}async function Co(n){let{aptosConfig:e,jwkAddr:t,options:r}=n,i;if(t){let s="0x1::jwks::FederatedJWKs",{data:a}=await V({aptosConfig:e,originMethod:"getKeylessJWKs",path:`accounts/${_chunkPA2XFIP3js.Z.from(t).toString()}/resource/${s}`,params:{ledger_version:_optionalChain([r, 'optionalAccess', _59 => _59.ledgerVersion])}});i=a}else{let s="0x1::jwks::PatchedJWKs",{data:a}=await V({aptosConfig:e,originMethod:"getKeylessJWKs",path:`accounts/0x1/resource/${s}`,params:{ledger_version:_optionalChain([r, 'optionalAccess', _60 => _60.ledgerVersion])}});i=a}let o=new Map;for(let s of i.data.jwks.entries){let a=[];for(let c of s.jwks){let{data:d}=c.variant,l=new C(_chunkPA2XFIP3js.j.fromHexInput(d).toUint8Array()),h=ai.deserialize(l);a.push(h)}o.set(_chunkPA2XFIP3js.k.call(void 0, s.issuer),a)}return o}var ai=class n extends _chunkPA2XFIP3js.l{constructor(e){super();let{kid:t,kty:r,alg:i,e:o,n:s}=e;this.kid=t,this.kty=r,this.alg=i,this.e=o,this.n=s}serialize(e){e.serializeStr(this.kid),e.serializeStr(this.kty),e.serializeStr(this.alg),e.serializeStr(this.e),e.serializeStr(this.n)}static fromMoveStruct(e){let{data:t}=e.variant,r=new C(_chunkPA2XFIP3js.j.fromHexInput(t).toUint8Array());return n.deserialize(r)}static deserialize(e){let t=e.deserializeStr(),r=e.deserializeStr(),i=e.deserializeStr(),o=e.deserializeStr(),s=e.deserializeStr();return new n({kid:t,kty:r,alg:i,n:o,e:s})}};function Qc(n){try{let e=JSON.parse(n);if(e.kid===void 0)throw new Error("JWT header missing kid");return e}catch (e2){throw new Error("Failed to parse JWT header.")}}var ee=class n extends oe{constructor(e,t){super(),this.jwkAddress=_chunkPA2XFIP3js.Z.from(e),this.keylessPublicKey=t}authKey(){let e=new _chunkPA2XFIP3js.m;return e.serializeU32AsUleb128(4),e.serializeFixedBytes(this.bcsToBytes()),G.fromSchemeAndBytes({scheme:2,input:e.toUint8Array()})}verifySignature(e){throw new Error("Not yet implemented")}serialize(e){this.jwkAddress.serialize(e),this.keylessPublicKey.serialize(e)}static deserialize(e){let t=_chunkPA2XFIP3js.Z.deserialize(e),r=k.deserialize(e);return new n(t,r)}static isPublicKey(e){return e instanceof n}static create(e){return new n(e.jwkAddress,k.create(e))}static fromJwtAndPepper(e){return new n(e.jwkAddress,k.fromJwtAndPepper(e))}static isInstance(e){return"jwkAddress"in e&&e.jwkAddress instanceof _chunkPA2XFIP3js.Z&&"keylessPublicKey"in e&&e.keylessPublicKey instanceof k}};var O=class n extends oe{constructor(e){if(super(),this.publicKey=e,e instanceof v)this.variant=0;else if(e instanceof Ne)this.variant=1;else if(e instanceof k)this.variant=3;else if(e instanceof ee)this.variant=4;else throw new Error("Unsupported public key type")}verifySignature(e){let{message:t,signature:r}=e;return q.isInstance(r)?this.publicKey.verifySignature({message:t,signature:r.signature}):!1}authKey(){return G.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=v.deserialize(e);break;case 1:r=Ne.deserialize(e);break;case 3:r=k.deserialize(e);break;case 4: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 v}isSecp256k1PublicKey(){return this.publicKey instanceof Ne}static isInstance(e){return"publicKey"in e&&"variant"in e}},q= exports.AnySignature =class n extends M{constructor(e){if(super(),this.signature=e,e instanceof I)this.variant=0;else if(e instanceof ft)this.variant=1;else if(e instanceof ze)this.variant=3;else throw new Error("Unsupported signature type")}toUint8Array(){return console.warn("[Aptos SDK] Calls to AnySignature.toUint8Array() will soon return the underlying signature bytes. Use AnySignature.bcsToBytes() instead."),this.bcsToBytes()}serialize(e){e.serializeU32AsUleb128(this.variant),this.signature.serialize(e)}static deserialize(e){let t=e.deserializeUleb128AsU32(),r;switch(t){case 0:r=I.deserialize(e);break;case 1:r=ft.deserialize(e);break;case 3:r=ze.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 jc(n){let e=n;return e-=e>>1&1431655765,e=(e&858993459)+(e>>2&858993459),(e+(e>>4)&252645135)*16843009>>24}var hn=class extends oe{constructor(e){super(),this.publicKeys=e.publicKeys}createBitmap(e){let{bits:t}=e,r=128,i=new Uint8Array([0,0,0,0]),o=new Set;return t.forEach((s,a)=>{if(a+1>this.publicKeys.length)throw new Error(`Signature index ${a+1} is out of public keys range, ${this.publicKeys.length}.`);if(o.has(s))throw new Error(`Duplicate bit ${s} detected.`);o.add(s);let c=Math.floor(s/8),d=i[c];d|=r>>s%8,i[c]=d}),i}getIndex(e){let t=this.publicKeys.findIndex(r=>r.toString()===e.toString());if(t!==-1)return t;throw new Error(`Public key ${e} not found in multi key set ${this.publicKeys}`)}},ke= exports.MultiKey =class n extends hn{constructor(e){let{publicKeys:t,signaturesRequired:r}=e;if(super({publicKeys:t}),r<1)throw new Error("The number of required signatures needs to be greater than 0");if(t.length<r)throw new Error(`Provided ${t.length} public keys is smaller than the ${r} required signatures`);this.publicKeys=t.map(i=>i instanceof O?i:new O(i)),this.signaturesRequired=r}verifySignature(e){throw new Error("not implemented")}authKey(){return G.fromSchemeAndBytes({scheme:3,input:this.toUint8Array()})}serialize(e){e.serializeVector(this.publicKeys),e.serializeU8(this.signaturesRequired)}static deserialize(e){let t=e.deserializeVector(O),r=e.deserializeU8();return new n({publicKeys:t,signaturesRequired:r})}getIndex(e){let t=e instanceof O?e:new O(e);return super.getIndex(t)}static isInstance(e){return"publicKeys"in e&&"signaturesRequired"in e}},de=class de extends M{constructor(e){super();let{signatures:t,bitmap:r}=e;if(t.length>de.MAX_SIGNATURES_SUPPORTED)throw new Error(`The number of signatures cannot be greater than ${de.MAX_SIGNATURES_SUPPORTED}`);if(this.signatures=t.map(o=>o instanceof q?o:new q(o)),!(r instanceof Uint8Array))this.bitmap=de.createBitmap({bits:r});else{if(r.length!==de.BITMAP_LEN)throw new Error(`"bitmap" length should be ${de.BITMAP_LEN}`);this.bitmap=r}let i=this.bitmap.reduce((o,s)=>o+jc(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>=de.MAX_SIGNATURES_SUPPORTED)throw new Error(`Cannot have a signature larger than ${de.MAX_SIGNATURES_SUPPORTED-1}.`);if(o.has(s))throw new Error("Duplicate bits detected.");o.add(s);let a=Math.floor(s/8),c=i[a];c|=r>>s%8,i[a]=c}),i}serialize(e){e.serializeVector(this.signatures),e.serializeBytes(this.bitmap)}static deserialize(e){let t=e.deserializeVector(q),r=e.deserializeBytes();return new de({signatures:t,bitmap:r})}};de.BITMAP_LEN=4,de.MAX_SIGNATURES_SUPPORTED=de.BITMAP_LEN*8;var qe=de;var Ae=class Ae extends hn{constructor(e){let{publicKeys:t,threshold:r}=e;if(super({publicKeys:t}),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 Le))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 G.fromSchemeAndBytes({scheme:1,input:this.toUint8Array()})}toUint8Array(){let e=new Uint8Array(this.publicKeys.length*v.LENGTH+1);return this.publicKeys.forEach((t,r)=>{e.set(t.toUint8Array(),r*v.LENGTH)}),e[this.publicKeys.length*v.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+=v.LENGTH){let s=o;i.push(new v(t.subarray(s,s+v.LENGTH)))}return new Ae({publicKeys:i,threshold:r})}getIndex(e){return super.getIndex(e)}};Ae.MAX_KEYS=32,Ae.MIN_KEYS=2,Ae.MIN_THRESHOLD=1;var Ht=Ae,pe=class pe extends M{constructor(e){super();let{signatures:t,bitmap:r}=e;if(t.length>pe.MAX_SIGNATURES_SUPPORTED)throw new Error(`The number of signatures cannot be greater than ${pe.MAX_SIGNATURES_SUPPORTED}`);if(this.signatures=t,!(r instanceof Uint8Array))this.bitmap=pe.createBitmap({bits:r});else{if(r.length!==pe.BITMAP_LEN)throw new Error(`"bitmap" length should be ${pe.BITMAP_LEN}`);this.bitmap=r}}toUint8Array(){let e=new Uint8Array(this.signatures.length*I.LENGTH+pe.BITMAP_LEN);return this.signatures.forEach((t,r)=>{e.set(t.toUint8Array(),r*I.LENGTH)}),e.set(this.bitmap,this.signatures.length*I.LENGTH),e}serialize(e){e.serializeBytes(this.toUint8Array())}static deserialize(e){let t=e.deserializeBytes(),r=t.subarray(t.length-4),i=[];for(let o=0;o<t.length-r.length;o+=I.LENGTH){let s=o;i.push(new I(t.subarray(s,s+I.LENGTH)))}return new pe({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>=pe.MAX_SIGNATURES_SUPPORTED)throw new Error(`Cannot have a signature larger than ${pe.MAX_SIGNATURES_SUPPORTED-1}.`);if(o.has(s))throw new Error("Duplicate bits detected.");if(a>0&&s<=t[a-1])throw new Error("The bits need to be sorted in ascending order.");o.add(s);let c=Math.floor(s/8),d=i[c];d|=r>>s%8,i[c]=d}),i}};pe.MAX_SIGNATURES_SUPPORTED=32,pe.BITMAP_LEN=4;var Le=pe;var dr=(n,e)=>{let t=n.bcsToBytes(),r=typeof e=="string"?Buffer.from(e,"utf8"):e,i=new Uint8Array([...t,...r,254]);return new (0, _chunkPA2XFIP3js.Z)(_sha3.sha3_256.call(void 0, i))},Dm= exports.createResourceAddress =(n,e)=>{let t=n.bcsToBytes(),r=typeof e=="string"?Buffer.from(e,"utf8"):e,i=new Uint8Array([...t,...r,255]);return new (0, _chunkPA2XFIP3js.Z)(_sha3.sha3_256.call(void 0, i))},zm= exports.createTokenAddress =(n,e,t)=>{let r=`${e}::${t}`;return dr(n,r)};var Q=class extends _chunkPA2XFIP3js.l{static deserialize(e){let t=e.deserializeUleb128AsU32();switch(t){case 0:return ve.load(e);case 1:return He.load(e);case 2:return se.load(e);case 3:return Oe.load(e);case 4:return $t.load(e);case 5:return Tn.load(e);default:throw new Error(`Unknown variant index for AccountAuthenticator: ${t}`)}}isEd25519(){return this instanceof ve}isMultiEd25519(){return this instanceof He}isSingleKey(){return this instanceof se}isMultiKey(){return this instanceof Oe}},ve= exports.AccountAuthenticatorEd25519 =class n extends Q{constructor(e,t){super(),this.public_key=e,this.signature=t}serialize(e){e.serializeU32AsUleb128(0),this.public_key.serialize(e),this.signature.serialize(e)}static load(e){let t=v.deserialize(e),r=I.deserialize(e);return new n(t,r)}},He= exports.AccountAuthenticatorMultiEd25519 =class n extends Q{constructor(e,t){super(),this.public_key=e,this.signature=t}serialize(e){e.serializeU32AsUleb128(1),this.public_key.serialize(e),this.signature.serialize(e)}static load(e){let t=Ht.deserialize(e),r=Le.deserialize(e);return new n(t,r)}},se= exports.AccountAuthenticatorSingleKey =class n extends Q{constructor(e,t){super(),this.public_key=e,this.signature=t}serialize(e){e.serializeU32AsUleb128(2),this.public_key.serialize(e),this.signature.serialize(e)}static load(e){let t=O.deserialize(e),r=q.deserialize(e);return new n(t,r)}},Oe= exports.AccountAuthenticatorMultiKey =class n extends Q{constructor(e,t){super(),this.public_keys=e,this.signatures=t}serialize(e){e.serializeU32AsUleb128(3),this.public_keys.serialize(e),this.signatures.serialize(e)}static load(e){let t=ke.deserialize(e),r=qe.deserialize(e);return new n(t,r)}},$t= exports.AccountAuthenticatorNoAccountAuthenticator =class n extends Q{serialize(e){e.serializeU32AsUleb128(4)}static load(e){return new n}},Tn= exports.AccountAuthenticatorAbstraction =class n extends Q{constructor(e,t,r){if(super(),!_chunkPA2XFIP3js.ia.call(void 0, e))throw new Error(`Invalid function info ${e} passed into AccountAuthenticatorAbstraction`);this.functionInfo=e,this.authenticator=_chunkPA2XFIP3js.j.fromHexInput(r),this.signingMessageDigest=_chunkPA2XFIP3js.j.fromHexInput(_chunkPA2XFIP3js.j.fromHexInput(t).toUint8Array())}serialize(e){e.serializeU32AsUleb128(5);let{moduleAddress:t,moduleName:r,functionName:i}=_chunkPA2XFIP3js.ha.call(void 0, this.functionInfo);_chunkPA2XFIP3js.Z.fromString(t).serialize(e),e.serializeStr(r),e.serializeStr(i),e.serializeU32AsUleb128(0),e.serializeBytes(this.signingMessageDigest.toUint8Array()),e.serializeFixedBytes(this.authenticator.toUint8Array())}static load(e){let t=_chunkPA2XFIP3js.Z.deserialize(e),r=e.deserializeStr(),i=e.deserializeStr(),o=e.deserializeUleb128AsU32();if(o===0){let s=e.deserializeBytes(),a=e.deserializeFixedBytes(e.remaining());return new n(`${t}::${r}::${i}`,s,a)}throw new Error(`Unknown variant index for AccountAuthenticatorAbstraction: ${o}`)}};var Wt=class n extends _chunkPA2XFIP3js.l{constructor(e){super(),this.chainId=e}serialize(e){e.serializeU8(this.chainId)}static deserialize(e){let t=e.deserializeU8();return new n(t)}};var K=class n extends _chunkPA2XFIP3js.l{constructor(e){super(),this.identifier=e}serialize(e){e.serializeStr(this.identifier)}static deserialize(e){let t=e.deserializeStr();return new n(t)}};var bn=class n extends _chunkPA2XFIP3js.l{constructor(e,t){super(),this.address=e,this.name=t}static fromStr(e){let t=e.split("::");if(t.length!==2)throw new Error("Invalid module id.");return new n(_chunkPA2XFIP3js.Z.fromString(t[0]),new K(t[1]))}serialize(e){this.address.serialize(e),this.name.serialize(e)}static deserialize(e){let t=_chunkPA2XFIP3js.Z.deserialize(e),r=K.deserialize(e);return new n(t,r)}};var N=class n extends _chunkPA2XFIP3js.l{deserialize(e){let t=_chunkPA2XFIP3js.Z.deserialize(e),r=K.deserialize(e),i=K.deserialize(e),o=e.deserializeVector(n);return new Fe(t,r,i,o)}static deserialize(e){let t=e.deserializeUleb128AsU32();switch(t){case 0:return L.load(e);case 1:return le.load(e);case 2:return j.load(e);case 3:return Qe.load(e);case 4:return F.load(e);case 5:return wt.load(e);case 6:return x.load(e);case 7:return A.load(e);case 8:return $e.load(e);case 9:return We.load(e);case 10:return je.load(e);case 255:return B.load(e);default:throw new Error(`Unknown variant index for TypeTag: ${t}`)}}isBool(){return this instanceof L}isAddress(){return this instanceof F}isGeneric(){return this instanceof B}isSigner(){return this instanceof wt}isVector(){return this instanceof x}isStruct(){return this instanceof A}isU8(){return this instanceof le}isU16(){return this instanceof $e}isU32(){return this instanceof We}isU64(){return this instanceof j}isU128(){return this instanceof Qe}isU256(){return this instanceof je}isPrimitive(){return this instanceof wt||this instanceof F||this instanceof L||this instanceof le||this instanceof $e||this instanceof We||this instanceof j||this instanceof Qe||this instanceof je}},L= exports.TypeTagBool =class n extends N{toString(){return"bool"}serialize(e){e.serializeU32AsUleb128(0)}static load(e){return new n}},le= exports.TypeTagU8 =class n extends N{toString(){return"u8"}serialize(e){e.serializeU32AsUleb128(1)}static load(e){return new n}},$e= exports.TypeTagU16 =class n extends N{toString(){return"u16"}serialize(e){e.serializeU32AsUleb128(8)}static load(e){return new n}},We= exports.TypeTagU32 =class n extends N{toString(){return"u32"}serialize(e){e.serializeU32AsUleb128(9)}static load(e){return new n}},j= exports.TypeTagU64 =class n extends N{toString(){return"u64"}serialize(e){e.serializeU32AsUleb128(2)}static load(e){return new n}},Qe= exports.TypeTagU128 =class n extends N{toString(){return"u128"}serialize(e){e.serializeU32AsUleb128(3)}static load(e){return new n}},je= exports.TypeTagU256 =class n extends N{toString(){return"u256"}serialize(e){e.serializeU32AsUleb128(10)}static load(e){return new n}},F= exports.TypeTagAddress =class n extends N{toString(){return"address"}serialize(e){e.serializeU32AsUleb128(4)}static load(e){return new n}},wt= exports.TypeTagSigner =class n extends N{toString(){return"signer"}serialize(e){e.serializeU32AsUleb128(5)}static load(e){return new n}},pr= exports.TypeTagReference =class n extends N{constructor(t){super();this.value=t}toString(){return`&${this.value.toString()}`}serialize(t){t.serializeU32AsUleb128(254)}static load(t){let r=N.deserialize(t);return new n(r)}},B= exports.TypeTagGeneric =class n extends N{constructor(t){super();this.value=t;if(t<0)throw new Error("Generic type parameter index cannot be negative")}toString(){return`T${this.value}`}serialize(t){t.serializeU32AsUleb128(255),t.serializeU32(this.value)}static load(t){let r=t.deserializeU32();return new n(r)}},x= exports.TypeTagVector =class n extends N{constructor(t){super();this.value=t}toString(){return`vector<${this.value.toString()}>`}static u8(){return new n(new le)}serialize(t){t.serializeU32AsUleb128(6),this.value.serialize(t)}static load(t){let r=N.deserialize(t);return new n(r)}},A= exports.TypeTagStruct =class n extends N{constructor(t){super();this.value=t}toString(){let t="";return this.value.typeArgs.length>0&&(t=`<${this.value.typeArgs.map(r=>r.toString()).join(", ")}>`),`${this.value.address.toString()}::${this.value.moduleName.identifier}::${this.value.name.identifier}${t}`}serialize(t){t.serializeU32AsUleb128(7),this.value.serialize(t)}static load(t){let r=Fe.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(_chunkPA2XFIP3js.Z.ONE,"string","String")}isOption(){return this.isTypeTag(_chunkPA2XFIP3js.Z.ONE,"option","Option")}isObject(){return this.isTypeTag(_chunkPA2XFIP3js.Z.ONE,"object","Object")}isDelegationKey(){return this.isTypeTag(_chunkPA2XFIP3js.Z.ONE,"permissioned_delegation","DelegationKey")}isRateLimiter(){return this.isTypeTag(_chunkPA2XFIP3js.Z.ONE,"rate_limiter","RateLimiter")}},Fe= exports.StructTag =class n extends _chunkPA2XFIP3js.l{constructor(e,t,r,i){super(),this.address=e,this.moduleName=t,this.name=r,this.typeArgs=i}serialize(e){e.serialize(this.address),e.serialize(this.moduleName),e.serialize(this.name),e.serializeVector(this.typeArgs)}static deserialize(e){let t=_chunkPA2XFIP3js.Z.deserialize(e),r=K.deserialize(e),i=K.deserialize(e),o=e.deserializeVector(N);return new n(t,r,i,o)}};function Ey(){return new Fe(_chunkPA2XFIP3js.Z.ONE,new K("aptos_coin"),new K("AptosCoin"),[])}function E(){return new Fe(_chunkPA2XFIP3js.Z.ONE,new K("string"),new K("String"),[])}function Py(n){return new Fe(_chunkPA2XFIP3js.Z.ONE,new K("option"),new K("Option"),[n])}function ge(n){return new Fe(_chunkPA2XFIP3js.Z.ONE,new K("object"),new K("Object"),[n])}function Jc(n){let e=n.deserializeUleb128AsU32();switch(e){case 0:return X.deserialize(n);case 1:return W.deserialize(n);case 2:return Ee.deserialize(n);case 3:return _chunkPA2XFIP3js.Z.deserialize(n);case 4:return S.deserialize(n,X);case 5:return D.deserialize(n);case 6:return Se.deserialize(n);case 7:return _e.deserialize(n);case 8:return ye.deserialize(n);case 9:return pn.deserialize(n);default:throw new Error(`Unknown variant index for ScriptTransactionArgument: ${e}`)}}var St=class extends _chunkPA2XFIP3js.l{static deserialize(e){let t=e.deserializeUleb128AsU32();switch(t){case 0:return _t.load(e);case 2:return wn.load(e);case 3:return Sn.load(e);default:throw new Error(`Unknown variant index for TransactionPayload: ${t}`)}}},_t= exports.TransactionPayloadScript =class n extends St{constructor(e){super(),this.script=e}serialize(e){e.serializeU32AsUleb128(0),this.script.serialize(e)}static load(e){let t=_n.deserialize(e);return new n(t)}},wn= exports.TransactionPayloadEntryFunction =class n extends St{constructor(e){super(),this.entryFunction=e}serialize(e){e.serializeU32AsUleb128(2),this.entryFunction.serialize(e)}static load(e){let t=Et.deserialize(e);return new n(t)}},Sn= exports.TransactionPayloadMultiSig =class n extends St{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)}},Et= 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(bn.fromStr(e),new K(t),r,i)}serialize(e){this.module_name.serialize(e),this.function_name.serialize(e),e.serializeVector(this.type_args),e.serializeU32AsUleb128(this.args.length),this.args.forEach(t=>{t.serializeForEntryFunction(e)})}static deserialize(e){let t=bn.deserialize(e),r=K.deserialize(e),i=e.deserializeVector(N),o=e.deserializeUleb128AsU32(),s=new Array;for(let a=0;a<o;a+=1){let c=e.deserializeUleb128AsU32(),d=Yn.deserialize(e,c);s.push(d)}return new n(t,r,i,s)}},_n= exports.Script =class n{constructor(e,t,r){this.bytecode=e,this.type_args=t,this.args=r}serialize(e){e.serializeBytes(this.bytecode),e.serializeVector(this.type_args),e.serializeU32AsUleb128(this.args.length),this.args.forEach(t=>{t.serializeForScriptFunction(e)})}static deserialize(e){let t=e.deserializeBytes(),r=e.deserializeVector(N),i=e.deserializeUleb128AsU32(),o=new Array;for(let s=0;s<i;s+=1){let a=Jc(e);o.push(a)}return new n(t,r,o)}},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=_chunkPA2XFIP3js.Z.deserialize(e),r=e.deserializeBool(),i;return r&&(i=Pn.deserialize(e)),new n(t,i)}},Pn= exports.MultiSigTransactionPayload =class n extends _chunkPA2XFIP3js.l{constructor(e){super(),this.transaction_payload=e}serialize(e){e.serializeU32AsUleb128(0),this.transaction_payload.serialize(e)}static deserialize(e){return e.deserializeUleb128AsU32(),new n(Et.deserialize(e))}};var he=class n extends _chunkPA2XFIP3js.l{constructor(e,t,r,i,o,s,a){super(),this.sender=e,this.sequence_number=t,this.payload=r,this.max_gas_amount=i,this.gas_unit_price=o,this.expiration_timestamp_secs=s,this.chain_id=a}serialize(e){this.sender.serialize(e),e.serializeU64(this.sequence_number),this.payload.serialize(e),e.serializeU64(this.max_gas_amount),e.serializeU64(this.gas_unit_price),e.serializeU64(this.expiration_timestamp_secs),this.chain_id.serialize(e)}static deserialize(e){let t=_chunkPA2XFIP3js.Z.deserialize(e),r=e.deserializeU64(),i=St.deserialize(e),o=e.deserializeU64(),s=e.deserializeU64(),a=e.deserializeU64(),c=Wt.deserialize(e);return new n(t,r,i,o,s,a,c)}},lr= exports.RawTransactionWithData =class extends _chunkPA2XFIP3js.l{static deserialize(e){let t=e.deserializeUleb128AsU32();switch(t){case 0:return Pt.load(e);case 1:return xt.load(e);default:throw new Error(`Unknown variant index for RawTransactionWithData: ${t}`)}}},Pt= exports.MultiAgentRawTransaction =class n extends lr{constructor(e,t){super(),this.raw_txn=e,this.secondary_signer_addresses=t}serialize(e){e.serializeU32AsUleb128(0),this.raw_txn.serialize(e),e.serializeVector(this.secondary_signer_addresses)}static load(e){let t=he.deserialize(e),r=e.deserializeVector(_chunkPA2XFIP3js.Z);return new n(t,r)}},xt= exports.FeePayerRawTransaction =class n extends lr{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=he.deserialize(e),r=e.deserializeVector(_chunkPA2XFIP3js.Z),i=_chunkPA2XFIP3js.Z.deserialize(e);return new n(t,r,i)}};var gr=class extends _chunkPA2XFIP3js.l{constructor(t){super();this.accountAddress=_chunkPA2XFIP3js.Z.ONE;this.moduleName=new P("account");this.structName=new P("RotationProofChallenge");this.sequenceNumber=new W(t.sequenceNumber),this.originator=t.originator,this.currentAuthKey=t.currentAuthKey,this.newPublicKey=S.U8(t.newPublicKey.toUint8Array())}serialize(t){t.serialize(this.accountAddress),t.serialize(this.moduleName),t.serialize(this.structName),t.serialize(this.sequenceNumber),t.serialize(this.originator),t.serialize(this.currentAuthKey),t.serialize(this.newPublicKey)}};var Je=class extends _chunkPA2XFIP3js.l{static deserialize(e){let t=e.deserializeUleb128AsU32();switch(t){case 0:return vt.load(e);case 1:return Qt.load(e);case 2:return It.load(e);case 3:return Ct.load(e);case 4:return at.load(e);default:throw new Error(`Unknown variant index for TransactionAuthenticator: ${t}`)}}isEd25519(){return this instanceof vt}isMultiEd25519(){return this instanceof Qt}isMultiAgent(){return this instanceof It}isFeePayer(){return this instanceof Ct}isSingleSender(){return this instanceof at}},vt= exports.TransactionAuthenticatorEd25519 =class n extends Je{constructor(e,t){super(),this.public_key=e,this.signature=t}serialize(e){e.serializeU32AsUleb128(0),this.public_key.serialize(e),this.signature.serialize(e)}static load(e){let t=v.deserialize(e),r=I.deserialize(e);return new n(t,r)}},Qt= exports.TransactionAuthenticatorMultiEd25519 =class n extends Je{constructor(e,t){super(),this.public_key=e,this.signature=t}serialize(e){e.serializeU32AsUleb128(1),this.public_key.serialize(e),this.signature.serialize(e)}static load(e){let t=Ht.deserialize(e),r=Le.deserialize(e);return new n(t,r)}},It= exports.TransactionAuthenticatorMultiAgent =class n extends Je{constructor(e,t,r){super(),this.sender=e,this.secondary_signer_addresses=t,this.secondary_signers=r}serialize(e){e.serializeU32AsUleb128(2),this.sender.serialize(e),e.serializeVector(this.secondary_signer_addresses),e.serializeVector(this.secondary_signers)}static load(e){let t=Q.deserialize(e),r=e.deserializeVector(_chunkPA2XFIP3js.Z),i=e.deserializeVector(Q);return new n(t,r,i)}},Ct= exports.TransactionAuthenticatorFeePayer =class n extends Je{constructor(e,t,r,i){super(),this.sender=e,this.secondary_signer_addresses=t,this.secondary_signers=r,this.fee_payer=i}serialize(e){e.serializeU32AsUleb128(3),this.sender.serialize(e),e.serializeVector(this.secondary_signer_addresses),e.serializeVector(this.secondary_signers),this.fee_payer.address.serialize(e),this.fee_payer.authenticator.serialize(e)}static load(e){let t=Q.deserialize(e),r=e.deserializeVector(_chunkPA2XFIP3js.Z),i=e.deserializeVector(Q),o=_chunkPA2XFIP3js.Z.deserialize(e),s=Q.deserialize(e),a={address:o,authenticator:s};return new n(t,r,i,a)}},at= exports.TransactionAuthenticatorSingleSender =class n extends Je{constructor(e){super(),this.sender=e}serialize(e){e.serializeU32AsUleb128(4),this.sender.serialize(e)}static load(e){let t=Q.deserialize(e);return new n(t)}};var Xe=class n extends _chunkPA2XFIP3js.l{constructor(e,t){super(),this.raw_txn=e,this.authenticator=t}serialize(e){this.raw_txn.serialize(e),this.authenticator.serialize(e)}static deserialize(e){let t=he.deserialize(e),r=Je.deserialize(e);return new n(t,r)}};var jt=class n extends _chunkPA2XFIP3js.l{constructor(e,t){super(),this.rawTransaction=e,this.feePayerAddress=t}serialize(e){this.rawTransaction.serialize(e),this.feePayerAddress===void 0?e.serializeBool(!1):(e.serializeBool(!0),this.feePayerAddress.serialize(e))}static deserialize(e){let t=he.deserialize(e),r=e.deserializeBool(),i;return r&&(i=_chunkPA2XFIP3js.Z.deserialize(e)),new n(t,i)}};var mr=class n extends _chunkPA2XFIP3js.l{constructor(e,t,r){super(),this.rawTransaction=e,this.feePayerAddress=r,this.secondarySignerAddresses=t}serialize(e){this.rawTransaction.serialize(e),e.serializeVector(this.secondarySignerAddresses),this.feePayerAddress===void 0?e.serializeBool(!1):(e.serializeBool(!0),this.feePayerAddress.serialize(e))}static deserialize(e){let t=he.deserialize(e),r=e.deserializeVector(_chunkPA2XFIP3js.Z),i=e.deserializeBool(),o;return i&&(o=_chunkPA2XFIP3js.Z.deserialize(e)),new n(t,r,o)}};function ci(n){return n.feePayerAddress?new xt(n.rawTransaction,_nullishCoalesce(n.secondarySignerAddresses, () => ([])),n.feePayerAddress):n.secondarySignerAddresses?new Pt(n.rawTransaction,n.secondarySignerAddresses):n.rawTransaction}function Jt(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 Ff(n){return Jt(n.bcsToBytes(),`APTOS::${n.constructor.name}`)}function Ie(n){let e=ci(n);return n.feePayerAddress?Jt(e.bcsToBytes(),ni):n.secondarySignerAddresses?Jt(e.bcsToBytes(),ni):Jt(e.bcsToBytes(),ho)}var ae=class n{constructor(e){this.signingScheme=0;let{privateKey:t,address:r}=e;this.privateKey=t,this.publicKey=t.publicKey(),this.accountAddress=r?_chunkPA2XFIP3js.Z.from(r):this.publicKey.authKey().derivedAddress()}static generate(){let e=H.generate();return new n({privateKey:e})}static fromDerivationPath(e){let{path:t,mnemonic:r}=e,i=H.fromDerivationPath(t,r);return new n({privateKey:i})}verifySignature(e){return this.publicKey.verifySignature(e)}signWithAuthenticator(e){return new ve(this.publicKey,this.privateKey.sign(e))}signTransactionWithAuthenticator(e){return new ve(this.publicKey,this.signTransaction(e))}sign(e){return this.privateKey.sign(e)}signTransaction(e){return this.sign(Ie(e))}};function ui(n){return typeof n=="object"&&n!==null&&"getAnyPublicKey"in n&&typeof n.getAnyPublicKey=="function"}var Te=class n{constructor(e){this.signingScheme=2;let{privateKey:t,address:r}=e;this.privateKey=t,this.publicKey=new O(t.publicKey()),this.accountAddress=r?_chunkPA2XFIP3js.Z.from(r):this.publicKey.authKey().derivedAddress()}getAnyPublicKey(){return this.publicKey}static generate(e={}){let{scheme:t=0}=e,r;switch(t){case 0:r=H.generate();break;case 2:r=Be.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=H.fromDerivationPath(r,i);break;case 2:o=Be.fromDerivationPath(r,i);break;default:throw new Error(`Unsupported signature scheme ${t}`)}return new n({privateKey:o})}verifySignature(e){return this.publicKey.verifySignature(e)}signWithAuthenticator(e){return new se(this.publicKey,this.sign(e))}signTransactionWithAuthenticator(e){return new se(this.publicKey,this.signTransaction(e))}sign(e){return new q(this.privateKey.sign(e))}signTransaction(e){return this.sign(Ie(e))}static fromEd25519Account(e){return new n({privateKey:e.privateKey,address:e.accountAddress})}};var Ye=class{static generate(e={}){let{scheme:t=0,legacy:r=!0}=e;return t===0&&r?ae.generate():Te.generate({scheme:t})}static fromPrivateKey(e){let{privateKey:t,address:r,legacy:i=!0}=e;return t instanceof H&&i?new ae({privateKey:t,address:r}):new Te({privateKey:t,address:r})}static fromPrivateKeyAndAddress(e){return this.fromPrivateKey(e)}static fromDerivationPath(e){let{scheme:t=0,mnemonic:r,path:i,legacy:o=!0}=e;return t===0&&o?ae.fromDerivationPath({mnemonic:r,path:i}):Te.fromDerivationPath({scheme:t,mnemonic:r,path:i})}static authKey(e){let{publicKey:t}=e;return t.authKey()}verifySignature(e){return this.publicKey.verifySignature(e)}};var _utils = require('@noble/hashes/utils');var Zc=1209600,Xt=class Xt extends _chunkPA2XFIP3js.l{constructor(e){super();let{privateKey:t,expiryDateSecs:r,blinder:i}=e;this.privateKey=t,this.publicKey=new At(t.publicKey()),this.expiryDateSecs=r||_chunkPA2XFIP3js.ba.call(void 0, _chunkPA2XFIP3js.aa.call(void 0, )+Zc),this.blinder=i!==void 0?_chunkPA2XFIP3js.j.fromHexInput(i).toUint8Array():eu();let o=Jr(this.publicKey.bcsToBytes(),93);o.push(BigInt(this.expiryDateSecs)),o.push(mn(this.blinder));let s=yn(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=H.deserialize(e);break;default:throw new Error(`Unknown variant index for EphemeralPublicKey: ${t}`)}let i=e.deserializeU64(),o=e.deserializeFixedBytes(31);return new Xt({privateKey:r,expiryDateSecs:Number(i),blinder:o})}static fromBytes(e){return Xt.deserialize(new C(e))}static generate(e){let t;switch(_optionalChain([e, 'optionalAccess', _61 => _61.scheme])){case 0:default:t=H.generate()}return new Xt({privateKey:t,expiryDateSecs:_optionalChain([e, 'optionalAccess', _62 => _62.expiryDateSecs])})}sign(e){if(this.isExpired())throw new Error("EphemeralKeyPair has expired");return new Re(this.privateKey.sign(e))}};Xt.BLINDER_LENGTH=31;var Kt=Xt;function eu(){return _utils.randomBytes.call(void 0, Kt.BLINDER_LENGTH)}var _eventemitter3 = require('eventemitter3'); var _eventemitter32 = _interopRequireDefault(_eventemitter3);function yr(n){return n!=null&&typeof n.checkKeylessAccountValidity=="function"}var Yt=class Yt extends _chunkPA2XFIP3js.l{constructor(t){super();this.signingScheme=2;let{address:r,ephemeralKeyPair:i,publicKey:o,uidKey:s,uidVal:a,aud:c,pepper:d,proof:l,proofFetchCallback:h,jwt:p,verificationKeyHash:g}=t;if(this.ephemeralKeyPair=i,this.publicKey=o,this.accountAddress=r?_chunkPA2XFIP3js.Z.from(r):this.publicKey.authKey().derivedAddress(),this.uidKey=s,this.uidVal=a,this.aud=c,this.jwt=p,this.emitter=new _eventemitter32.default,this.proofOrPromise=l,l instanceof xe)this.proof=l;else{if(h===void 0)throw new Error("Must provide callback for async proof fetch");this.emitter.on("proofFetchFinish",async U=>{await h(U),this.emitter.removeAllListeners()}),this.init(l)}let w=_chunkPA2XFIP3js.j.fromHexInput(d).toUint8Array();if(w.length!==Yt.PEPPER_LENGTH)throw new Error(`Pepper length in bytes should be ${Yt.PEPPER_LENGTH}`);if(this.pepper=w,g!==void 0){if(_chunkPA2XFIP3js.j.hexInputToUint8Array(g).length!==32)throw new Error("verificationKeyHash must be 32 bytes");this.verificationKeyHash=_chunkPA2XFIP3js.j.hexInputToUint8Array(g)}}getAnyPublicKey(){return new O(this.publicKey)}async init(t){try{this.proof=await t,this.emitter.emit("proofFetchFinish",{status:"Success"})}catch(r){r instanceof Error?this.emitter.emit("proofFetchFinish",{status:"Failed",error:r.toString()}):this.emitter.emit("proofFetchFinish",{status:"Failed",error:"Unknown"})}}serialize(t){if(this.accountAddress.serialize(t),t.serializeStr(this.jwt),t.serializeStr(this.uidKey),t.serializeFixedBytes(this.pepper),this.ephemeralKeyPair.serialize(t),this.proof===void 0)throw new Error("Cannot serialize - proof undefined");this.proof.serialize(t),t.serializeOption(this.verificationKeyHash,32)}static partialDeserialize(t){let r=_chunkPA2XFIP3js.Z.deserialize(t),i=t.deserializeStr(),o=t.deserializeStr(),s=t.deserializeFixedBytes(31),a=Kt.deserialize(t),c=xe.deserialize(t),d=t.deserializeOption("fixedBytes",32);return{address:r,jwt:i,uidKey:o,pepper:s,ephemeralKeyPair:a,proof:c,verificationKeyHash:d}}isExpired(){return this.ephemeralKeyPair.isExpired()}signWithAuthenticator(t){let r=new q(this.sign(t)),i=new O(this.publicKey);return new se(i,r)}signTransactionWithAuthenticator(t){let r=new q(this.signTransaction(t)),i=new O(this.publicKey);return new se(i,r)}async waitForProofFetch(){this.proofOrPromise instanceof Promise&&await this.proofOrPromise}async checkKeylessAccountValidity(t){if(this.isExpired())throw z.fromErrorType({type:0});if(await this.waitForProofFetch(),this.proof===void 0)throw z.fromErrorType({type:2});let r=_jwtdecode.jwtDecode.call(void 0, this.jwt,{header:!0});if(r.kid===void 0)throw z.fromErrorType({type:12,details:"checkKeylessAccountValidity failed. JWT is missing 'kid' in header. This should never happen."});if(this.verificationKeyHash!==void 0){let{verificationKey:i}=await An({aptosConfig:t});if(_chunkPA2XFIP3js.j.hexInputToString(i.hash())!==_chunkPA2XFIP3js.j.hexInputToString(this.verificationKeyHash))throw z.fromErrorType({type:4})}else console.warn("[Aptos SDK] The verification key hash was not set. Proof may be invalid if the verification key has rotated.");await Yt.fetchJWK({aptosConfig:t,publicKey:this.publicKey,kid:r.kid})}sign(t){let{expiryDateSecs:r}=this.ephemeralKeyPair;if(this.isExpired())throw z.fromErrorType({type:0});if(this.proof===void 0)throw z.fromErrorType({type:1,details:"Proof not found - make sure to call `await account.checkKeylessAccountValidity()` before signing."});let i=this.ephemeralKeyPair.getPublicKey(),o=this.ephemeralKeyPair.sign(t);return new ze({jwtHeader:_chunkPA2XFIP3js.ca.call(void 0, this.jwt.split(".")[0]),ephemeralCertificate:new Vt(this.proof,0),expiryDateSecs:r,ephemeralPublicKey:i,ephemeralSignature:o})}signTransaction(t){if(this.proof===void 0)throw z.fromErrorType({type:1,details:"Proof not found - make sure to call `await account.checkKeylessAccountValidity()` before signing."});let r=ci(t),o=new di(r,this.proof.proof).hash();return this.sign(o)}verifySignature(t){let{message:r,signature:i}=t;return!(this.isExpired()||!this.ephemeralKeyPair.getPublicKey().verifySignature({message:r,signature:i.ephemeralSignature}))}static async fetchJWK(t){let{aptosConfig:r,publicKey:i,kid:o}=t,s=i instanceof k?i:i.keylessPublicKey,{iss:a}=s,c,d=i instanceof ee?i.jwkAddress:void 0;try{c=await Co({aptosConfig:r,jwkAddr:d})}catch(p){throw z.fromErrorType({type:24,error:p,details:`Failed to fetch ${d?"Federated":"Patched"}JWKs ${d?`for address ${d}`:"0x1"}`})}let l=c.get(a);if(l===void 0)throw z.fromErrorType({type:7,details:`JWKs for issuer ${a} not found.`});let h=l.find(p=>p.kid===o);if(h===void 0)throw z.fromErrorType({type:6,details:`JWK with kid '${o}' for issuer '${a}' not found.`});return h}};Yt.PEPPER_LENGTH=31;var me=Yt,di= exports.TransactionAndProof =class extends _chunkPA2XFIP3js.l{constructor(t,r){super();this.domainSeparator="APTOS::TransactionAndProof";this.transaction=t,this.proof=r}serialize(t){t.serializeFixedBytes(this.transaction.bcsToBytes()),t.serializeOption(this.proof)}hash(){return Jt(this.bcsToBytes(),this.domainSeparator)}};var Ze=class n extends me{constructor(e){let t=k.create(e);super({publicKey:t,...e}),this.publicKey=t}serialize(e){super.serialize(e)}static deserialize(e){let{address:t,proof:r,ephemeralKeyPair:i,jwt:o,uidKey:s,pepper:a,verificationKeyHash:c}=me.partialDeserialize(e),{iss:d,aud:l,uidVal:h}=Ve({jwt:o,uidKey:s});return new n({address:t,proof:r,ephemeralKeyPair:i,iss:d,uidKey:s,uidVal:h,aud:l,pepper:a,jwt:o,verificationKeyHash:c})}static fromBytes(e){return n.deserialize(new C(_chunkPA2XFIP3js.j.hexInputToUint8Array(e)))}static create(e){let{address:t,proof:r,jwt:i,ephemeralKeyPair:o,pepper:s,uidKey:a="sub",proofFetchCallback:c,verificationKey:d}=e,{iss:l,aud:h,uidVal:p}=Ve({jwt:i,uidKey:a});return new n({address:t,proof:r,ephemeralKeyPair:o,iss:l,uidKey:a,uidVal:p,aud:h,pepper:s,jwt:i,proofFetchCallback:c,verificationKeyHash:d?d.hash():void 0})}};var Rt=class n extends me{constructor(e){let t=ee.create(e);super({publicKey:t,...e}),this.publicKey=t,this.audless=_nullishCoalesce(e.audless, () => (!1))}serialize(e){super.serialize(e),this.publicKey.jwkAddress.serialize(e)}static deserialize(e){let{address:t,proof:r,ephemeralKeyPair:i,jwt:o,uidKey:s,pepper:a,verificationKeyHash:c}=me.partialDeserialize(e),d=_chunkPA2XFIP3js.Z.deserialize(e),{iss:l,aud:h,uidVal:p}=Ve({jwt:o,uidKey:s});return new n({address:t,proof:r,ephemeralKeyPair:i,iss:l,uidKey:s,uidVal:p,aud:h,pepper:a,jwt:o,verificationKeyHash:c,jwkAddress:d})}static fromBytes(e){return n.deserialize(C.fromHex(e))}static create(e){let{address:t,proof:r,jwt:i,ephemeralKeyPair:o,pepper:s,jwkAddress:a,uidKey:c="sub",proofFetchCallback:d,verificationKey:l}=e,{iss:h,aud:p,uidVal:g}=Ve({jwt:i,uidKey:c});return new n({address:t,proof:r,ephemeralKeyPair:o,iss:h,uidKey:c,uidVal:g,aud:p,pepper:s,jwkAddress:_chunkPA2XFIP3js.Z.from(a),jwt:i,proofFetchCallback:d,verificationKeyHash:l?l.hash():void 0})}};var xn=class n{constructor(e){this.signingScheme=3;let{multiKey:t,address:r}=e,i=e.signers.map(a=>a instanceof ae?Te.fromEd25519Account(a):a);if(t.signaturesRequired>i.length)throw new Error(`Not enough signers provided to satisfy the required signatures. Need ${t.signaturesRequired} signers, but only ${i.length} provided`);if(t.signaturesRequired<i.length)throw new Error(`More signers provided than required. Need ${t.signaturesRequired} signers, but ${i.length} provided`);this.publicKey=t,this.accountAddress=r?_chunkPA2XFIP3js.Z.from(r):this.publicKey.authKey().derivedAddress();let o=[];for(let a of i)o.push(this.publicKey.getIndex(a.getAnyPublicKey()));let s=i.map((a,c)=>[a,o[c]]);s.sort((a,c)=>a[1]-c[1]),this.signers=s.map(a=>a[0]),this.signerIndicies=s.map(a=>a[1]),this.signaturesBitmap=this.publicKey.createBitmap({bits:o})}static fromPublicKeysAndSigners(e){let{address:t,publicKeys:r,signaturesRequired:i,signers:o}=e,s=new ke({publicKeys:r,signaturesRequired:i});return new n({multiKey:s,signers:o,address:t})}static isMultiKeySigner(e){return e instanceof n}signWithAuthenticator(e){return new Oe(this.publicKey,this.sign(e))}signTransactionWithAuthenticator(e){return new Oe(this.publicKey,this.signTransaction(e))}async waitForProofFetch(){let t=this.signers.filter(r=>r instanceof me).map(async r=>r.waitForProofFetch());await Promise.all(t)}async checkKeylessAccountValidity(e){let r=this.signers.filter(i=>i instanceof me).map(i=>i.checkKeylessAccountValidity(e));await Promise.all(r)}sign(e){let t=[];for(let r of this.signers)t.push(r.sign(e));return new qe({signatures:t,bitmap:this.signaturesBitmap})}signTransaction(e){let t=[];for(let r of this.signers)t.push(r.signTransaction(e));return new qe({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 fr=class{constructor(e){this.signingScheme=1;let{signers:t,publicKey:r,address:i}=e;if(this.publicKey=r,this.accountAddress=i?_chunkPA2XFIP3js.Z.from(i):this.publicKey.authKey().derivedAddress(),r.threshold>t.length)throw new Error(`Not enough signers provided to satisfy the required signatures. Need ${r.threshold} signers, but only ${t.length} provided`);if(r.threshold<t.length)throw new Error(`More signers provided than required. Need ${r.threshold} signers, but ${t.length} provided`);let o=[];for(let a of t)o.push(this.publicKey.getIndex(a.publicKey()));let s=t.map((a,c)=>[a,o[c]]);s.sort((a,c)=>a[1]-c[1]),this.signers=s.map(a=>a[0]),this.signerIndices=s.map(a=>a[1]),this.signaturesBitmap=this.publicKey.createBitmap({bits:o})}verifySignature(e){return this.publicKey.verifySignature(e)}signWithAuthenticator(e){return new He(this.publicKey,this.sign(e))}signTransactionWithAuthenticator(e){return new He(this.publicKey,this.signTransaction(e))}sign(e){let t=[];for(let r of this.signers)t.push(r.sign(e));return new Le({signatures:t,bitmap:this.signaturesBitmap})}signTransaction(e){return this.sign(Ie(e))}};function Ro(n){let e=n.deserializeUleb128AsU32();if(!Object.values(_chunkPA2XFIP3js.U).includes(e))throw new Error(`Deserialization of Account failed: SigningScheme variant ${e} is invalid`);return{address:_chunkPA2XFIP3js.Z.deserialize(n),signingScheme:e}}function Uo(n,e){if(e.serializeStr(n.jwt),e.serializeStr(n.uidKey),e.serializeFixedBytes(n.pepper),n.ephemeralKeyPair.serialize(e),n.proof===void 0)throw new Error("Cannot serialize - proof undefined");n.proof.serialize(e),e.serializeOption(n.verificationKeyHash,32)}function Do(n){let e=n.deserializeStr(),t=n.deserializeStr(),r=n.deserializeFixedBytes(31),i=Kt.deserialize(n),o=xe.deserialize(n),s=n.deserializeOption("fixedBytes",32);return{jwt:e,uidKey:t,pepper:r,ephemeralKeyPair:i,proof:o,verificationKeyHash:s}}var zo;(h=>{function n(p){let g=new _chunkPA2XFIP3js.m;switch(g.serializeU32AsUleb128(p.signingScheme),p.accountAddress.serialize(g),p.signingScheme){case 0:return p.privateKey.serialize(g),g.toUint8Array();case 2:{if(!ui(p))throw new Error("Account is not a SingleKeySigner");let w=p.getAnyPublicKey();switch(g.serializeU32AsUleb128(w.variant),w.variant){case 3:return Uo(p,g),g.toUint8Array();case 4:{let U=p;return Uo(U,g),U.publicKey.jwkAddress.serialize(g),g.serializeBool(U.audless),g.toUint8Array()}case 1:case 0:return p.privateKey.serialize(g),g.toUint8Array();default:throw new Error(`Invalid public key variant: ${w.variant}`)}}case 3:{let w=p;return w.publicKey.serialize(g),g.serializeU32AsUleb128(w.signers.length),w.signers.forEach(U=>{g.serializeFixedBytes(n(U))}),g.toUint8Array()}default:throw new Error(`Deserialization of Account failed: invalid signingScheme value ${p.signingScheme}`)}}h.toBytes=n;function e(p){return _chunkPA2XFIP3js.j.hexInputToStringWithoutPrefix(n(p))}h.toHexStringWithoutPrefix=e;function t(p){return _chunkPA2XFIP3js.j.hexInputToString(n(p))}h.toHexString=t;function r(p){let{address:g,signingScheme:w}=Ro(p);switch(w){case 0:{let U=H.deserialize(p);return new ae({privateKey:U,address:g})}case 2:{let U=p.deserializeUleb128AsU32();switch(U){case 0:{let te=H.deserialize(p);return new Te({privateKey:te,address:g})}case 1:{let te=Be.deserialize(p);return new Te({privateKey:te,address:g})}case 3:{let te=Do(p),lt=Ve(te);return new Ze({...te,...lt})}case 4:{let te=Do(p),lt=_chunkPA2XFIP3js.Z.deserialize(p),kt=p.deserializeBool(),Ot=Ve(te);return new Rt({...te,...Ot,jwkAddress:lt,audless:kt})}default:throw new Error(`Unsupported public key variant ${U}`)}}case 3:{let U=ke.deserialize(p),te=p.deserializeUleb128AsU32(),lt=new Array;for(let kt=0;kt<te;kt+=1){let Ot=r(p);if(!ui(Ot)&&!(Ot instanceof ae))throw new Error("Deserialization of MultiKeyAccount failed. Signer is not a SingleKeySigner or Ed25519Account");lt.push(Ot)}return new xn({multiKey:U,signers:lt,address:g})}default:throw new Error(`Deserialization of Account failed: invalid signingScheme value ${w}`)}}h.deserialize=r;function i(p){let g=d(p);if(!(g instanceof Ze))throw new Error("Deserialization of KeylessAccount failed");return g}h.keylessAccountFromHex=i;function o(p){let g=d(p);if(!(g instanceof Rt))throw new Error("Deserialization of FederatedKeylessAccount failed");return g}h.federatedKeylessAccountFromHex=o;function s(p){let g=d(p);if(!(g instanceof xn))throw new Error("Deserialization of MultiKeyAccount failed");return g}h.multiKeyAccountFromHex=s;function a(p){let g=d(p);if(!(g instanceof Te))throw new Error("Deserialization of SingleKeyAccount failed");return g}h.singleKeyAccountFromHex=a;function c(p){let g=d(p);if(!(g instanceof ae))throw new Error("Deserialization of Ed25519Account failed");return g}h.ed25519AccountFromHex=c;function d(p){return r(C.fromHex(p))}h.fromHex=d;function l(p){return d(p)}h.fromBytes=l})(zo||(zo= exports.AccountUtils ={}));var vn=class n extends M{constructor(e){super(),this.value=_chunkPA2XFIP3js.j.fromHexInput(e)}serialize(e){e.serializeBytes(this.value.toUint8Array())}static deserialize(e){return new n(e.deserializeBytes())}},Ar=class extends oe{constructor(e){super(),this.accountAddress=e}authKey(){return new G({data:this.accountAddress.toUint8Array()})}verifySignature(e){throw new Error("This function is not implemented for AbstractPublicKey.")}serialize(e){throw new Error("This function is not implemented for AbstractPublicKey.")}};var Oo=class n extends Ye{constructor({signer:t,accountAddress:r,authenticationFunction:i}){super();this.signingScheme=2;if(!_chunkPA2XFIP3js.ia.call(void 0, i))throw new Error(`Invalid authentication function ${i} passed into AbstractedAccount`);this.authenticationFunction=i,this.accountAddress=r,this.publicKey=new Ar(this.accountAddress),this.sign=o=>new vn(t(o))}static fromPermissionedSigner({signer:t,accountAddress:r}){return new n({signer:i=>{let o=new _chunkPA2XFIP3js.m;return t.publicKey.serialize(o),t.sign(i).serialize(o),o.toUint8Array()},accountAddress:_nullishCoalesce(r, () => (t.accountAddress)),authenticationFunction:"0x1::permissioned_delegation::authenticate"})}signWithAuthenticator(t){return new Tn(this.authenticationFunction,_sha3.sha3_256.call(void 0, t),this.sign(_sha3.sha3_256.call(void 0, t)).toUint8Array())}signTransactionWithAuthenticator(t){return this.signWithAuthenticator(Ie(t))}signTransaction(t){return this.sign(Ie(t))}setSigner(t){this.sign=r=>new vn(t(r))}};var ru=`
|
|
7
7
|
fragment TokenActivitiesFields on token_activities_v2 {
|
|
8
8
|
after_value
|
|
9
9
|
before_value
|
|
@@ -21,7 +21,7 @@ KeylessErrorResolutionTip: ${t}`,o}static fromErrorType(e){let{error:t,type:r,de
|
|
|
21
21
|
transaction_version
|
|
22
22
|
type
|
|
23
23
|
}
|
|
24
|
-
`,
|
|
24
|
+
`,iu=`
|
|
25
25
|
fragment AnsTokenFragment on current_aptos_names {
|
|
26
26
|
domain
|
|
27
27
|
expiration_timestamp
|
|
@@ -33,7 +33,7 @@ KeylessErrorResolutionTip: ${t}`,o}static fromErrorType(e){let{error:t,type:r,de
|
|
|
33
33
|
subdomain_expiration_policy
|
|
34
34
|
domain_expiration_timestamp
|
|
35
35
|
}
|
|
36
|
-
`,
|
|
36
|
+
`,hr=`
|
|
37
37
|
fragment CurrentTokenOwnershipFields on current_token_ownerships_v2 {
|
|
38
38
|
token_standard
|
|
39
39
|
token_properties_mutated_v1
|
|
@@ -80,7 +80,7 @@ KeylessErrorResolutionTip: ${t}`,o}static fromErrorType(e){let{error:t,type:r,de
|
|
|
80
80
|
}
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
|
-
`,
|
|
83
|
+
`,Fo=`
|
|
84
84
|
query getAccountCoinsCount($address: String) {
|
|
85
85
|
current_fungible_asset_balances_aggregate(
|
|
86
86
|
where: {owner_address: {_eq: $address}}
|
|
@@ -90,7 +90,7 @@ KeylessErrorResolutionTip: ${t}`,o}static fromErrorType(e){let{error:t,type:r,de
|
|
|
90
90
|
}
|
|
91
91
|
}
|
|
92
92
|
}
|
|
93
|
-
`,
|
|
93
|
+
`,No=`
|
|
94
94
|
query getAccountCoinsData($where_condition: current_fungible_asset_balances_bool_exp!, $offset: Int, $limit: Int, $order_by: [current_fungible_asset_balances_order_by!]) {
|
|
95
95
|
current_fungible_asset_balances(
|
|
96
96
|
where: $where_condition
|
|
@@ -123,7 +123,7 @@ KeylessErrorResolutionTip: ${t}`,o}static fromErrorType(e){let{error:t,type:r,de
|
|
|
123
123
|
}
|
|
124
124
|
}
|
|
125
125
|
}
|
|
126
|
-
`,
|
|
126
|
+
`,Bo=`
|
|
127
127
|
query getAccountCollectionsWithOwnedTokens($where_condition: current_collection_ownership_v2_view_bool_exp!, $offset: Int, $limit: Int, $order_by: [current_collection_ownership_v2_view_order_by!]) {
|
|
128
128
|
current_collection_ownership_v2_view(
|
|
129
129
|
where: $where_condition
|
|
@@ -157,7 +157,7 @@ KeylessErrorResolutionTip: ${t}`,o}static fromErrorType(e){let{error:t,type:r,de
|
|
|
157
157
|
single_token_uri
|
|
158
158
|
}
|
|
159
159
|
}
|
|
160
|
-
`,
|
|
160
|
+
`,Go=`
|
|
161
161
|
query getAccountOwnedTokens($where_condition: current_token_ownerships_v2_bool_exp!, $offset: Int, $limit: Int, $order_by: [current_token_ownerships_v2_order_by!]) {
|
|
162
162
|
current_token_ownerships_v2(
|
|
163
163
|
where: $where_condition
|
|
@@ -168,7 +168,7 @@ KeylessErrorResolutionTip: ${t}`,o}static fromErrorType(e){let{error:t,type:r,de
|
|
|
168
168
|
...CurrentTokenOwnershipFields
|
|
169
169
|
}
|
|
170
170
|
}
|
|
171
|
-
${
|
|
171
|
+
${hr}`,ST=`
|
|
172
172
|
query getAccountOwnedTokensByTokenData($where_condition: current_token_ownerships_v2_bool_exp!, $offset: Int, $limit: Int, $order_by: [current_token_ownerships_v2_order_by!]) {
|
|
173
173
|
current_token_ownerships_v2(
|
|
174
174
|
where: $where_condition
|
|
@@ -179,7 +179,7 @@ KeylessErrorResolutionTip: ${t}`,o}static fromErrorType(e){let{error:t,type:r,de
|
|
|
179
179
|
...CurrentTokenOwnershipFields
|
|
180
180
|
}
|
|
181
181
|
}
|
|
182
|
-
${
|
|
182
|
+
${hr}`,Mo=`
|
|
183
183
|
query getAccountOwnedTokensFromCollection($where_condition: current_token_ownerships_v2_bool_exp!, $offset: Int, $limit: Int, $order_by: [current_token_ownerships_v2_order_by!]) {
|
|
184
184
|
current_token_ownerships_v2(
|
|
185
185
|
where: $where_condition
|
|
@@ -190,7 +190,7 @@ KeylessErrorResolutionTip: ${t}`,o}static fromErrorType(e){let{error:t,type:r,de
|
|
|
190
190
|
...CurrentTokenOwnershipFields
|
|
191
191
|
}
|
|
192
192
|
}
|
|
193
|
-
${
|
|
193
|
+
${hr}`,Vo=`
|
|
194
194
|
query getAccountTokensCount($where_condition: current_token_ownerships_v2_bool_exp, $offset: Int, $limit: Int) {
|
|
195
195
|
current_token_ownerships_v2_aggregate(
|
|
196
196
|
where: $where_condition
|
|
@@ -202,7 +202,7 @@ KeylessErrorResolutionTip: ${t}`,o}static fromErrorType(e){let{error:t,type:r,de
|
|
|
202
202
|
}
|
|
203
203
|
}
|
|
204
204
|
}
|
|
205
|
-
`,
|
|
205
|
+
`,qo=`
|
|
206
206
|
query getAccountTransactionsCount($address: String) {
|
|
207
207
|
account_transactions_aggregate(where: {account_address: {_eq: $address}}) {
|
|
208
208
|
aggregate {
|
|
@@ -210,13 +210,13 @@ KeylessErrorResolutionTip: ${t}`,o}static fromErrorType(e){let{error:t,type:r,de
|
|
|
210
210
|
}
|
|
211
211
|
}
|
|
212
212
|
}
|
|
213
|
-
`,
|
|
213
|
+
`,Lo=`
|
|
214
214
|
query getChainTopUserTransactions($limit: Int) {
|
|
215
215
|
user_transactions(limit: $limit, order_by: {version: desc}) {
|
|
216
216
|
version
|
|
217
217
|
}
|
|
218
218
|
}
|
|
219
|
-
`,
|
|
219
|
+
`,Ho=`
|
|
220
220
|
query getCollectionData($where_condition: current_collections_v2_bool_exp!) {
|
|
221
221
|
current_collections_v2(where: $where_condition) {
|
|
222
222
|
uri
|
|
@@ -246,7 +246,7 @@ KeylessErrorResolutionTip: ${t}`,o}static fromErrorType(e){let{error:t,type:r,de
|
|
|
246
246
|
}
|
|
247
247
|
}
|
|
248
248
|
}
|
|
249
|
-
|
|
249
|
+
`,$o=`
|
|
250
250
|
query getCurrentFungibleAssetBalances($where_condition: current_fungible_asset_balances_bool_exp, $offset: Int, $limit: Int) {
|
|
251
251
|
current_fungible_asset_balances(
|
|
252
252
|
where: $where_condition
|
|
@@ -264,7 +264,7 @@ KeylessErrorResolutionTip: ${t}`,o}static fromErrorType(e){let{error:t,type:r,de
|
|
|
264
264
|
token_standard
|
|
265
265
|
}
|
|
266
266
|
}
|
|
267
|
-
`,
|
|
267
|
+
`,Wo=`
|
|
268
268
|
query getDelegatedStakingActivities($delegatorAddress: String, $poolAddress: String) {
|
|
269
269
|
delegated_staking_activities(
|
|
270
270
|
where: {delegator_address: {_eq: $delegatorAddress}, pool_address: {_eq: $poolAddress}}
|
|
@@ -277,7 +277,7 @@ KeylessErrorResolutionTip: ${t}`,o}static fromErrorType(e){let{error:t,type:r,de
|
|
|
277
277
|
transaction_version
|
|
278
278
|
}
|
|
279
279
|
}
|
|
280
|
-
`,
|
|
280
|
+
`,Qo=`
|
|
281
281
|
query getEvents($where_condition: events_bool_exp, $offset: Int, $limit: Int, $order_by: [events_order_by!]) {
|
|
282
282
|
events(
|
|
283
283
|
where: $where_condition
|
|
@@ -296,7 +296,7 @@ KeylessErrorResolutionTip: ${t}`,o}static fromErrorType(e){let{error:t,type:r,de
|
|
|
296
296
|
indexed_type
|
|
297
297
|
}
|
|
298
298
|
}
|
|
299
|
-
|
|
299
|
+
`,jo=`
|
|
300
300
|
query getFungibleAssetActivities($where_condition: fungible_asset_activities_bool_exp, $offset: Int, $limit: Int) {
|
|
301
301
|
fungible_asset_activities(
|
|
302
302
|
where: $where_condition
|
|
@@ -321,7 +321,7 @@ KeylessErrorResolutionTip: ${t}`,o}static fromErrorType(e){let{error:t,type:r,de
|
|
|
321
321
|
type
|
|
322
322
|
}
|
|
323
323
|
}
|
|
324
|
-
`,
|
|
324
|
+
`,Jo=`
|
|
325
325
|
query getFungibleAssetMetadata($where_condition: fungible_asset_metadata_bool_exp, $offset: Int, $limit: Int) {
|
|
326
326
|
fungible_asset_metadata(where: $where_condition, offset: $offset, limit: $limit) {
|
|
327
327
|
icon_uri
|
|
@@ -340,7 +340,7 @@ KeylessErrorResolutionTip: ${t}`,o}static fromErrorType(e){let{error:t,type:r,de
|
|
|
340
340
|
maximum_v2
|
|
341
341
|
}
|
|
342
342
|
}
|
|
343
|
-
`,
|
|
343
|
+
`,Zt=`
|
|
344
344
|
query getNames($offset: Int, $limit: Int, $where_condition: current_aptos_names_bool_exp, $order_by: [current_aptos_names_order_by!]) {
|
|
345
345
|
current_aptos_names(
|
|
346
346
|
limit: $limit
|
|
@@ -351,14 +351,14 @@ KeylessErrorResolutionTip: ${t}`,o}static fromErrorType(e){let{error:t,type:r,de
|
|
|
351
351
|
...AnsTokenFragment
|
|
352
352
|
}
|
|
353
353
|
}
|
|
354
|
-
${
|
|
354
|
+
${iu}`,pi=`
|
|
355
355
|
query getNumberOfDelegators($where_condition: num_active_delegator_per_pool_bool_exp, $order_by: [num_active_delegator_per_pool_order_by!]) {
|
|
356
356
|
num_active_delegator_per_pool(where: $where_condition, order_by: $order_by) {
|
|
357
357
|
num_active_delegator
|
|
358
358
|
pool_address
|
|
359
359
|
}
|
|
360
360
|
}
|
|
361
|
-
`,
|
|
361
|
+
`,Tr=`
|
|
362
362
|
query getObjectData($where_condition: current_objects_bool_exp, $offset: Int, $limit: Int, $order_by: [current_objects_order_by!]) {
|
|
363
363
|
current_objects(
|
|
364
364
|
where: $where_condition
|
|
@@ -375,7 +375,7 @@ KeylessErrorResolutionTip: ${t}`,o}static fromErrorType(e){let{error:t,type:r,de
|
|
|
375
375
|
is_deleted
|
|
376
376
|
}
|
|
377
377
|
}
|
|
378
|
-
`,
|
|
378
|
+
`,li=`
|
|
379
379
|
query getProcessorStatus($where_condition: processor_status_bool_exp) {
|
|
380
380
|
processor_status(where: $where_condition) {
|
|
381
381
|
last_success_version
|
|
@@ -383,7 +383,7 @@ KeylessErrorResolutionTip: ${t}`,o}static fromErrorType(e){let{error:t,type:r,de
|
|
|
383
383
|
last_updated
|
|
384
384
|
}
|
|
385
385
|
}
|
|
386
|
-
`,
|
|
386
|
+
`,Xo=`
|
|
387
387
|
query getTableItemsData($where_condition: table_items_bool_exp!, $offset: Int, $limit: Int, $order_by: [table_items_order_by!]) {
|
|
388
388
|
table_items(
|
|
389
389
|
where: $where_condition
|
|
@@ -399,7 +399,7 @@ KeylessErrorResolutionTip: ${t}`,o}static fromErrorType(e){let{error:t,type:r,de
|
|
|
399
399
|
write_set_change_index
|
|
400
400
|
}
|
|
401
401
|
}
|
|
402
|
-
`,
|
|
402
|
+
`,Yo=`
|
|
403
403
|
query getTableItemsMetadata($where_condition: table_metadatas_bool_exp!, $offset: Int, $limit: Int, $order_by: [table_metadatas_order_by!]) {
|
|
404
404
|
table_metadatas(
|
|
405
405
|
where: $where_condition
|
|
@@ -412,7 +412,7 @@ KeylessErrorResolutionTip: ${t}`,o}static fromErrorType(e){let{error:t,type:r,de
|
|
|
412
412
|
value_type
|
|
413
413
|
}
|
|
414
414
|
}
|
|
415
|
-
`,
|
|
415
|
+
`,Zo=`
|
|
416
416
|
query getTokenActivity($where_condition: token_activities_v2_bool_exp!, $offset: Int, $limit: Int, $order_by: [token_activities_v2_order_by!]) {
|
|
417
417
|
token_activities_v2(
|
|
418
418
|
where: $where_condition
|
|
@@ -423,7 +423,7 @@ KeylessErrorResolutionTip: ${t}`,o}static fromErrorType(e){let{error:t,type:r,de
|
|
|
423
423
|
...TokenActivitiesFields
|
|
424
424
|
}
|
|
425
425
|
}
|
|
426
|
-
${
|
|
426
|
+
${ru}`,gi=`
|
|
427
427
|
query getCurrentTokenOwnership($where_condition: current_token_ownerships_v2_bool_exp!, $offset: Int, $limit: Int, $order_by: [current_token_ownerships_v2_order_by!]) {
|
|
428
428
|
current_token_ownerships_v2(
|
|
429
429
|
where: $where_condition
|
|
@@ -434,7 +434,7 @@ KeylessErrorResolutionTip: ${t}`,o}static fromErrorType(e){let{error:t,type:r,de
|
|
|
434
434
|
...CurrentTokenOwnershipFields
|
|
435
435
|
}
|
|
436
436
|
}
|
|
437
|
-
${
|
|
437
|
+
${hr}`,es=`
|
|
438
438
|
query getTokenData($where_condition: current_token_datas_v2_bool_exp, $offset: Int, $limit: Int, $order_by: [current_token_datas_v2_order_by!]) {
|
|
439
439
|
current_token_datas_v2(
|
|
440
440
|
where: $where_condition
|
|
@@ -474,7 +474,7 @@ KeylessErrorResolutionTip: ${t}`,o}static fromErrorType(e){let{error:t,type:r,de
|
|
|
474
474
|
}
|
|
475
475
|
}
|
|
476
476
|
}
|
|
477
|
-
`;async function fr(n){let{aptosConfig:e}=n,{data:t}=await L({aptosConfig:e,originMethod:"getLedgerInfo",path:""});return t}async function Yo(n){let{aptosConfig:e,limit:t}=n;return(await T({aptosConfig:e,query:{query:Mo,variables:{limit:t}},originMethod:"getChainTopUserTransactions"})).user_transactions}async function T(n){let{aptosConfig:e,query:t,originMethod:r}=n,{data:i}=await To({aptosConfig:e,originMethod:_nullishCoalesce(r, () => ("queryIndexer")),path:"",body:t,overrides:{WITH_CREDENTIALS:!1}});return i}async function nu(n){let{aptosConfig:e}=n;return(await T({aptosConfig:e,query:{query:di},originMethod:"getProcessorStatuses"})).processor_status}async function Ar(n){let e=await nu({aptosConfig:n.aptosConfig});return BigInt(e[0].last_success_version)}async function hr(n){let{aptosConfig:e,processorType:t}=n;return(await T({aptosConfig:e,query:{query:di,variables:{where_condition:{processor:{_eq:t}}}},originMethod:"getProcessorStatus"})).processor_status[0]}async function Tr(n){let{aptosConfig:e,handle:t,data:r,options:i}=n;return(await st({aptosConfig:e,originMethod:"getTableItem",path:`tables/${t}/item`,params:{ledger_version:_optionalChain([i, 'optionalAccess', _63 => _63.ledgerVersion])},body:r})).data}async function Zo(n){let{aptosConfig:e,options:t}=n,r={query:Qo,variables:{where_condition:_optionalChain([t, 'optionalAccess', _64 => _64.where]),offset:_optionalChain([t, 'optionalAccess', _65 => _65.offset]),limit:_optionalChain([t, 'optionalAccess', _66 => _66.limit]),order_by:_optionalChain([t, 'optionalAccess', _67 => _67.orderBy])}};return(await T({aptosConfig:e,query:r,originMethod:"getTableItemsData"})).table_items}async function es(n){let{aptosConfig:e,options:t}=n,r={query:jo,variables:{where_condition:_optionalChain([t, 'optionalAccess', _68 => _68.where]),offset:_optionalChain([t, 'optionalAccess', _69 => _69.offset]),limit:_optionalChain([t, 'optionalAccess', _70 => _70.limit]),order_by:_optionalChain([t, 'optionalAccess', _71 => _71.orderBy])}};return(await T({aptosConfig:e,query:r,originMethod:"getTableItemsMetadata"})).table_metadatas}async function Oe(n){let{aptosConfig:e,accountAddress:t}=n,{data:r}=await L({aptosConfig:e,originMethod:"getInfo",path:`accounts/${_chunkRX5UBAMEjs.Z.from(t).toString()}`});return r}async function rs(n){let{aptosConfig:e,accountAddress:t,options:r}=n;return ti({aptosConfig:e,originMethod:"getModules",path:`accounts/${_chunkRX5UBAMEjs.Z.from(t).toString()}/modules`,params:{ledger_version:_optionalChain([r, 'optionalAccess', _72 => _72.ledgerVersion]),offset:_optionalChain([r, 'optionalAccess', _73 => _73.offset]),limit:_nullishCoalesce(_optionalChain([r, 'optionalAccess', _74 => _74.limit]), () => (1e3))}})}async function br(n){return _optionalChain([n, 'access', _75 => _75.options, 'optionalAccess', _76 => _76.ledgerVersion])!==void 0?ts(n):Ke(async()=>ts(n),`module-${n.accountAddress}-${n.moduleName}`,1e3*60*5)()}async function ts(n){let{aptosConfig:e,accountAddress:t,moduleName:r,options:i}=n,{data:o}=await L({aptosConfig:e,originMethod:"getModule",path:`accounts/${_chunkRX5UBAMEjs.Z.from(t).toString()}/module/${r}`,params:{ledger_version:_optionalChain([i, 'optionalAccess', _77 => _77.ledgerVersion])}});return o}async function is(n){let{aptosConfig:e,accountAddress:t,options:r}=n;return sr({aptosConfig:e,originMethod:"getTransactions",path:`accounts/${_chunkRX5UBAMEjs.Z.from(t).toString()}/transactions`,params:{start:_optionalChain([r, 'optionalAccess', _78 => _78.offset]),limit:_optionalChain([r, 'optionalAccess', _79 => _79.limit])}})}async function os(n){let{aptosConfig:e,accountAddress:t,options:r}=n;return ti({aptosConfig:e,originMethod:"getResources",path:`accounts/${_chunkRX5UBAMEjs.Z.from(t).toString()}/resources`,params:{ledger_version:_optionalChain([r, 'optionalAccess', _80 => _80.ledgerVersion]),offset:_optionalChain([r, 'optionalAccess', _81 => _81.offset]),limit:_nullishCoalesce(_optionalChain([r, 'optionalAccess', _82 => _82.limit]), () => (999))}})}async function li(n){let{aptosConfig:e,accountAddress:t,resourceType:r,options:i}=n,{data:o}=await L({aptosConfig:e,originMethod:"getResource",path:`accounts/${_chunkRX5UBAMEjs.Z.from(t).toString()}/resource/${r}`,params:{ledger_version:_optionalChain([i, 'optionalAccess', _83 => _83.ledgerVersion])}});return o.data}async function Xt(n){let{aptosConfig:e,authenticationKey:t,options:r}=n,i=await li({aptosConfig:e,accountAddress:"0x1",resourceType:"0x1::account::OriginatingAddress",options:r}),{address_map:{handle:o}}=i,s=_chunkRX5UBAMEjs.Z.from(t);try{let a=await Tr({aptosConfig:e,handle:o,data:{key:s.toString(),key_type:"address",value_type:"address"},options:r});return _chunkRX5UBAMEjs.Z.from(a)}catch(a){if(a instanceof Z&&a.data.error_code==="table_item_not_found")return s;throw a}}async function ss(n){let{aptosConfig:e,accountAddress:t}=n,i={owner_address:{_eq:_chunkRX5UBAMEjs.Z.from(t).toStringLong()},amount:{_gt:0}},s=await T({aptosConfig:e,query:{query:Go,variables:{where_condition:i}},originMethod:"getAccountTokensCount"});return s.current_token_ownerships_v2_aggregate.aggregate?s.current_token_ownerships_v2_aggregate.aggregate.count:0}async function as(n){let{aptosConfig:e,accountAddress:t,options:r}=n,o={owner_address:{_eq:_chunkRX5UBAMEjs.Z.from(t).toStringLong()},amount:{_gt:0}};_optionalChain([r, 'optionalAccess', _84 => _84.tokenStandard])&&(o.token_standard={_eq:_optionalChain([r, 'optionalAccess', _85 => _85.tokenStandard])});let s={query:Fo,variables:{where_condition:o,offset:_optionalChain([r, 'optionalAccess', _86 => _86.offset]),limit:_optionalChain([r, 'optionalAccess', _87 => _87.limit]),order_by:_optionalChain([r, 'optionalAccess', _88 => _88.orderBy])}};return(await T({aptosConfig:e,query:s,originMethod:"getAccountOwnedTokens"})).current_token_ownerships_v2}async function cs(n){let{aptosConfig:e,accountAddress:t,collectionAddress:r,options:i}=n,o=_chunkRX5UBAMEjs.Z.from(t).toStringLong(),s=_chunkRX5UBAMEjs.Z.from(r).toStringLong(),a={owner_address:{_eq:o},current_token_data:{collection_id:{_eq:s}},amount:{_gt:0}};_optionalChain([i, 'optionalAccess', _89 => _89.tokenStandard])&&(a.token_standard={_eq:_optionalChain([i, 'optionalAccess', _90 => _90.tokenStandard])});let c={query:No,variables:{where_condition:a,offset:_optionalChain([i, 'optionalAccess', _91 => _91.offset]),limit:_optionalChain([i, 'optionalAccess', _92 => _92.limit]),order_by:_optionalChain([i, 'optionalAccess', _93 => _93.orderBy])}};return(await T({aptosConfig:e,query:c,originMethod:"getAccountOwnedTokensFromCollectionAddress"})).current_token_ownerships_v2}async function us(n){let{aptosConfig:e,accountAddress:t,options:r}=n,o={owner_address:{_eq:_chunkRX5UBAMEjs.Z.from(t).toStringLong()}};_optionalChain([r, 'optionalAccess', _94 => _94.tokenStandard])&&(o.current_collection={token_standard:{_eq:_optionalChain([r, 'optionalAccess', _95 => _95.tokenStandard])}});let s={query:Oo,variables:{where_condition:o,offset:_optionalChain([r, 'optionalAccess', _96 => _96.offset]),limit:_optionalChain([r, 'optionalAccess', _97 => _97.limit]),order_by:_optionalChain([r, 'optionalAccess', _98 => _98.orderBy])}};return(await T({aptosConfig:e,query:s,originMethod:"getAccountCollectionsWithOwnedTokens"})).current_collection_ownership_v2_view}async function ds(n){let{aptosConfig:e,accountAddress:t}=n,r=_chunkRX5UBAMEjs.Z.from(t).toStringLong(),o=await T({aptosConfig:e,query:{query:Bo,variables:{address:r}},originMethod:"getAccountTransactionsCount"});return o.account_transactions_aggregate.aggregate?o.account_transactions_aggregate.aggregate.count:0}async function ps(n){let{aptosConfig:e,accountAddress:t,options:r}=n,i=_chunkRX5UBAMEjs.Z.from(t).toStringLong(),o={..._optionalChain([r, 'optionalAccess', _99 => _99.where]),owner_address:{_eq:i}},s={query:ko,variables:{where_condition:o,offset:_optionalChain([r, 'optionalAccess', _100 => _100.offset]),limit:_optionalChain([r, 'optionalAccess', _101 => _101.limit]),order_by:_optionalChain([r, 'optionalAccess', _102 => _102.orderBy])}};return(await T({aptosConfig:e,query:s,originMethod:"getAccountCoinsData"})).current_fungible_asset_balances}async function ls(n){let{aptosConfig:e,accountAddress:t}=n,r=_chunkRX5UBAMEjs.Z.from(t).toStringLong(),o=await T({aptosConfig:e,query:{query:zo,variables:{address:r}},originMethod:"getAccountCoinsCount"});if(!o.current_fungible_asset_balances_aggregate.aggregate)throw Error("Failed to get the count of account coins");return o.current_fungible_asset_balances_aggregate.aggregate.count}async function gs(n){let{aptosConfig:e,accountAddress:t,options:r}=n,o={owner_address:{_eq:_chunkRX5UBAMEjs.Z.from(t).toStringLong()}},s={query:yr,variables:{where_condition:o,offset:_optionalChain([r, 'optionalAccess', _103 => _103.offset]),limit:_optionalChain([r, 'optionalAccess', _104 => _104.limit]),order_by:_optionalChain([r, 'optionalAccess', _105 => _105.orderBy])}};return(await T({aptosConfig:e,query:s,originMethod:"getAccountOwnedObjects"})).current_objects}async function ms(n){let{aptosConfig:e,privateKey:t}=n,r=new O(t.publicKey());if(t instanceof Ge){let o=B.fromPublicKey({publicKey:r}).derivedAddress();return ke.fromPrivateKey({privateKey:t,address:o})}if(t instanceof q){let i=B.fromPublicKey({publicKey:r});if(await ns({authKey:i,aptosConfig:e})){let c=i.derivedAddress();return ke.fromPrivateKey({privateKey:t,address:c,legacy:!1})}let s=B.fromPublicKey({publicKey:r.publicKey});if(await ns({authKey:s,aptosConfig:e})){let c=s.derivedAddress();return ke.fromPrivateKey({privateKey:t,address:c,legacy:!0})}}throw new Error(`Can't derive account from private key ${t}`)}async function ns(n){let{aptosConfig:e,authKey:t}=n,r=await Xt({aptosConfig:e,authenticationKey:t.derivedAddress()});try{return await Oe({aptosConfig:e,accountAddress:r}),!0}catch(i){if(i.status===404)return!1;throw new Error(`Error while looking for an account info ${r.toString()}`)}}async function mi(n){let{aptosConfig:e,options:t}=n;return sr({aptosConfig:e,originMethod:"getTransactions",path:"transactions",params:{start:_optionalChain([t, 'optionalAccess', _106 => _106.offset]),limit:_optionalChain([t, 'optionalAccess', _107 => _107.limit])}})}async function Sr(n){let{aptosConfig:e}=n;return Ke(async()=>{let{data:t}=await L({aptosConfig:e,originMethod:"getGasPriceEstimation",path:"estimate_gas_price"});return t},`gas-price-${e.network}`,1e3*60*5)()}async function ys(n){let{aptosConfig:e,ledgerVersion:t}=n,{data:r}=await L({aptosConfig:e,originMethod:"getTransactionByVersion",path:`transactions/by_version/${t}`});return r}async function Pn(n){let{aptosConfig:e,transactionHash:t}=n,{data:r}=await L({aptosConfig:e,path:`transactions/by_hash/${t}`,originMethod:"getTransactionByHash"});return r}async function fs(n){let{aptosConfig:e,transactionHash:t}=n;try{return(await Pn({aptosConfig:e,transactionHash:t})).type==="pending_transaction"}catch(r){if(_optionalChain([r, 'optionalAccess', _108 => _108.status])===404)return!0;throw r}}async function ru(n){let{aptosConfig:e,transactionHash:t}=n,{data:r}=await L({aptosConfig:e,path:`transactions/wait_by_hash/${t}`,originMethod:"longWaitForTransaction"});return r}async function Yt(n){let{aptosConfig:e,transactionHash:t,options:r}=n,i=_nullishCoalesce(_optionalChain([r, 'optionalAccess', _109 => _109.timeoutSecs]), () => (20)),o=_nullishCoalesce(_optionalChain([r, 'optionalAccess', _110 => _110.checkSuccess]), () => (!0)),s=!0,a=0,c,d,l=200,h=1.5;function p(g){if(!(g instanceof Z)||(d=g,g.status!==404&&g.status>=400&&g.status<500))throw g}try{c=await Pn({aptosConfig:e,transactionHash:t}),s=c.type==="pending_transaction"}catch(g){p(g)}if(s){let g=Date.now();try{c=await ru({aptosConfig:e,transactionHash:t}),s=c.type==="pending_transaction"}catch(b){p(b)}a=(Date.now()-g)/1e3}for(;s&&!(a>=i);){try{if(c=await Pn({aptosConfig:e,transactionHash:t}),s=c.type==="pending_transaction",!s)break}catch(g){p(g)}await _chunkRX5UBAMEjs._.call(void 0, l),a+=l/1e3,l*=h}if(c===void 0)throw d||new wr(`Fetching transaction ${t} failed and timed out after ${i} seconds`,c);if(c.type==="pending_transaction")throw new wr(`Transaction ${t} timed out in pending state after ${i} seconds`,c);if(!o)return c;if(!c.success)throw new gi(`Transaction ${t} failed with an error: ${c.vm_status}`,c);return c}async function _r(n){let{aptosConfig:e,processorType:t}=n,r=BigInt(n.minimumLedgerVersion),i=3e3,o=new Date().getTime(),s=BigInt(-1);for(;s<r;){if(new Date().getTime()-o>i)throw new Error("waitForLastSuccessIndexerVersionSync timeout");if(t===void 0?s=await Ar({aptosConfig:e}):s=(await hr({aptosConfig:e,processorType:t})).last_success_version,s>=r)break;await _chunkRX5UBAMEjs._.call(void 0, 200)}}var wr=class extends Error{constructor(e,t){super(e),this.lastSubmittedTransaction=t}},gi=class extends Error{constructor(e,t){super(e),this.transaction=t}};async function As(n){let{aptosConfig:e,ledgerVersion:t,options:r}=n,{data:i}=await L({aptosConfig:e,originMethod:"getBlockByVersion",path:`blocks/by_version/${t}`,params:{with_transactions:_optionalChain([r, 'optionalAccess', _111 => _111.withTransactions])}});return Ts({block:i,...n})}async function hs(n){let{aptosConfig:e,blockHeight:t,options:r}=n,{data:i}=await L({aptosConfig:e,originMethod:"getBlockByHeight",path:`blocks/by_height/${t}`,params:{with_transactions:_optionalChain([r, 'optionalAccess', _112 => _112.withTransactions])}});return Ts({block:i,...n})}async function Ts(n){let{aptosConfig:e,block:t,options:r}=n;if(_optionalChain([r, 'optionalAccess', _113 => _113.withTransactions])){t.transactions=_nullishCoalesce(t.transactions, () => ([]));let i=t.transactions[t.transactions.length-1],o=BigInt(t.first_version),s=BigInt(t.last_version),a=_optionalChain([i, 'optionalAccess', _114 => _114.version]),c;if(a===void 0?c=o-1n:c=BigInt(a),c===s)return t;let d=[],l=100n;for(let p=c+1n;p<s;p+=BigInt(100))d.push(mi({aptosConfig:e,options:{offset:p,limit:Math.min(Number(l),Number(s-p+1n))}}));let h=await Promise.all(d);for(let p of h)t.transactions.push(...p)}return t}async function S(n){n.minimumLedgerVersion!==void 0&&await _r({aptosConfig:n.config,minimumLedgerVersion:n.minimumLedgerVersion,processorType:n.processorType})}function bs(n){return typeof n=="boolean"}function et(n){return typeof n=="string"}function iu(n){return typeof n=="number"}function Er(n){if(iu(n))return n;if(et(n)&&n!=="")return Number.parseInt(n,10)}function Pr(n){return typeof n=="number"||typeof n=="bigint"||typeof n=="string"}function ws(n){return n==null}function Ss(n){return yi(n)||Ai(n)||hi(n)||Ti(n)||bi(n)||wi(n)||Si(n)||xr(n)||fi(n)||ou(n)||n instanceof _||n instanceof Y}function yi(n){return n instanceof U}function xr(n){return n instanceof _chunkRX5UBAMEjs.Z}function fi(n){return n instanceof P}function ou(n){return n instanceof gt}function Ai(n){return n instanceof X}function hi(n){return n instanceof we}function Ti(n){return n instanceof Se}function bi(n){return n instanceof W}function wi(n){return n instanceof _e}function Si(n){return n instanceof me}function _s(n){return"bytecode"in n}function z(n,e){throw new Error(`Type mismatch for argument ${e}, expected '${n}'`)}function Es(n){let e=n.params.findIndex(t=>t!=="signer"&&t!=="&signer");return e<0?n.params.length:e}function Ps(n){return!!n.match(/^[_a-zA-Z0-9]+$/)}function xs(n){return!!n.match(/\s/)}function su(n){return!!n.match(/^T[0-9]+$/)}function au(n){return!!n.match(/^&.+$/)}function cu(n){switch(n){case"signer":case"address":case"bool":case"u8":case"u16":case"u32":case"u64":case"u128":case"u256":return!0;default:return!1}}function uu(n,e){let t=e;for(;t<n.length;t+=1){let r=n[t];if(!xs(r))break}return t}var du=(b=>(b.InvalidTypeTag="unknown type",b.UnexpectedGenericType="unexpected generic type",b.UnexpectedTypeArgumentClose="unexpected '>'",b.UnexpectedWhitespaceCharacter="unexpected whitespace character",b.UnexpectedComma="unexpected ','",b.TypeArgumentCountMismatch="type argument count doesn't match expected amount",b.MissingTypeArgumentClose="no matching '>' for '<'",b.MissingTypeArgument="no type argument before ','",b.UnexpectedPrimitiveTypeArguments="primitive types not expected to have type arguments",b.UnexpectedVectorTypeArgumentCount="vector type expected to have exactly one type argument",b.UnexpectedStructFormat="unexpected struct format, must be of the form 0xaddress::module_name::struct_name",b.InvalidModuleNameCharacter="module name must only contain alphanumeric or '_' characters",b.InvalidStructNameCharacter="struct name must only contain alphanumeric or '_' characters",b.InvalidAddress="struct address must be valid",b))(du||{}),$= exports.TypeTagParserError =class extends Error{constructor(e,t){super(`Failed to parse typeTag '${e}', ${t}`)}};function Fe(n,e){let t=_nullishCoalesce(_optionalChain([e, 'optionalAccess', _115 => _115.allowGenerics]), () => (!1)),r=[],i=[],o=[],s=0,a="",c=1;for(;s<n.length;){let d=n[s];if(d==="<")r.push({savedExpectedTypes:c,savedStr:a,savedTypes:o}),a="",o=[],c=1;else if(d===">"){if(a!==""){let b=xn(a,i,t);o.push(b)}let l=r.pop();if(l===void 0)throw new $(n,"unexpected '>'");if(c!==o.length)throw new $(n,"type argument count doesn't match expected amount");let{savedStr:h,savedTypes:p,savedExpectedTypes:g}=l;i=o,o=p,a=h,c=g}else if(d===","){if(r.length===0)throw new $(n,"unexpected ','");if(a.length===0)throw new $(n,"no type argument before ','");let l=xn(a,i,t);i=[],o.push(l),a="",c+=1}else if(xs(d)){let l=!1;if(a.length!==0){let p=xn(a,i,t);i=[],o.push(p),a="",l=!0}s=uu(n,s);let h=n[s];if(s<n.length&&l&&h!==","&&h!==">")throw new $(n,"unexpected whitespace character");continue}else a+=d;s+=1}if(r.length>0)throw new $(n,"no matching '>' for '<'");switch(o.length){case 0:return xn(a,i,t);case 1:if(a==="")return o[0];throw new $(n,"unexpected ','");default:throw new $(n,"unexpected whitespace character")}}function xn(n,e,t){let r=n.trim(),i=r.toLowerCase();if(cu(i)&&e.length>0)throw new $(n,"primitive types not expected to have type arguments");switch(r.toLowerCase()){case"signer":return new bt;case"bool":return new V;case"address":return new F;case"u8":return new pe;case"u16":return new We;case"u32":return new Qe;case"u64":return new j;case"u128":return new je;case"u256":return new Je;case"vector":if(e.length!==1)throw new $(n,"vector type expected to have exactly one type argument");return new v(e[0]);default:if(au(r)){let a=r.substring(1);return new cr(xn(a,e,t))}if(su(r)){if(t)return new G(Number(r.split("T")[1]));throw new $(n,"unexpected generic type")}if(!r.match(/:/))throw new $(n,"unknown type");let o=r.split("::");if(o.length!==3)throw new $(n,"unexpected struct format, must be of the form 0xaddress::module_name::struct_name");let s;try{s=_chunkRX5UBAMEjs.Z.fromString(o[0])}catch (e3){throw new $(n,"struct address must be valid")}if(!Ps(o[1]))throw new $(n,"module name must only contain alphanumeric or '_' characters");if(!Ps(o[2]))throw new $(n,"struct name must only contain alphanumeric or '_' characters");return new A(new ze(s,new K(o[1]),new K(o[2]),e))}}var pu=new TextEncoder;function Zt(n){return _nullishCoalesce(_optionalChain([n, 'optionalAccess', _116 => _116.map, 'call', _117 => _117(e=>et(e)?Fe(e):e)]), () => ([]))}async function Ei(n,e,t,r){let i=await br({aptosConfig:r,accountAddress:n,moduleName:e});if(i.abi)return i.abi.exposed_functions.find(o=>o.name===t)}async function Is(n,e,t,r){let i=await Ei(n,e,t,r);if(!i)throw new Error(`Could not find function ABI for '${n}::${e}::${t}'`);let o=[];for(let s=0;s<i.params.length;s+=1)o.push(Fe(i.params[s],{allowGenerics:!0}));return{typeParameters:i.generic_type_params,parameters:o}}async function vs(n,e,t,r){let i=await Ei(n,e,t,r);if(!i)throw new Error(`Could not find entry function ABI for '${n}::${e}::${t}'`);if(!i.is_entry)throw new Error(`'${n}::${e}::${t}' is not an entry function`);let o=Es(i),s=[];for(let a=o;a<i.params.length;a+=1)s.push(Fe(i.params[a],{allowGenerics:!0}));return{signers:o,typeParameters:i.generic_type_params,parameters:s}}async function Cs(n,e,t,r){let i=await Ei(n,e,t,r);if(!i)throw new Error(`Could not find view function ABI for '${n}::${e}::${t}'`);if(!i.is_view)throw new Error(`'${n}::${e}::${t}' is not an view function`);let o=[];for(let a=0;a<i.params.length;a+=1)o.push(Fe(i.params[a],{allowGenerics:!0}));let s=[];for(let a=0;a<i.return.length;a+=1)s.push(Fe(i.return[a],{allowGenerics:!0}));return{typeParameters:i.generic_type_params,parameters:o,returnTypes:s}}function Ks(n,e,t,r,i){return n instanceof _chunkRX5UBAMEjs.X?n:_chunkRX5UBAMEjs.X.newBytes(Ir(e,t,n,r,i).bcsToBytes())}function Ir(n,e,t,r,i){if(r>=e.parameters.length)throw new Error(`Too many arguments for '${n}', expected ${e.parameters.length}`);let o=e.parameters[r];return Rt(t,o,r,i)}function Rt(n,e,t,r){return Ss(n)?(_i(e,n,t),n):lu(n,e,t,r)}function lu(n,e,t,r){if(e.isBool()){if(bs(n))return new U(n);if(et(n)){if(n==="true")return new U(!0);if(n==="false")return new U(!1)}z("boolean",t)}if(e.isAddress()){if(et(n))return _chunkRX5UBAMEjs.Z.fromString(n);z("string | AccountAddress",t)}if(e.isU8()){let i=Er(n);if(i!==void 0)return new X(i);z("number | string",t)}if(e.isU16()){let i=Er(n);if(i!==void 0)return new we(i);z("number | string",t)}if(e.isU32()){let i=Er(n);if(i!==void 0)return new Se(i);z("number | string",t)}if(e.isU64()){if(Pr(n))return new W(BigInt(n));z("bigint | number | string",t)}if(e.isU128()){if(Pr(n))return new _e(BigInt(n));z("bigint | number | string",t)}if(e.isU256()){if(Pr(n))return new me(BigInt(n));z("bigint | number | string",t)}if(e.isGeneric()){let i=e.value;if(i<0||i>=r.length)throw new Error(`Generic argument ${e.toString()} is invalid for argument ${t}`);return Rt(n,r[i],t,r)}if(e.isVector()){if(e.value.isU8()){if(et(n))return _.U8(pu.encode(n));if(n instanceof Uint8Array)return _.U8(n);if(n instanceof ArrayBuffer)return _.U8(new Uint8Array(n))}if(et(n)&&n.startsWith("["))return Rt(JSON.parse(n),e,t,r);if(Array.isArray(n))return new _(n.map(i=>Rt(i,e.value,t,r)));throw new Error(`Type mismatch for argument ${t}, type '${e.toString()}'`)}if(e.isStruct()){if(e.isString()){if(et(n))return new P(n);z("string",t)}if(e.isObject()){if(et(n))return _chunkRX5UBAMEjs.Z.fromString(n);z("string | AccountAddress",t)}if(e.isOption()){if(ws(n)){let i=e.value.typeArgs[0];return i instanceof V?new Y(null):i instanceof F?new Y(null):i instanceof pe?new Y(null):i instanceof We?new Y(null):i instanceof Qe?new Y(null):i instanceof j?new Y(null):i instanceof je?new Y(null):i instanceof Je?new Y(null):new Y(null)}return new Y(Rt(n,e.value.typeArgs[0],t,r))}throw new Error(`Unsupported struct input type for argument ${t}, type '${e.toString()}'`)}throw new Error(`Type mismatch for argument ${t}, type '${e.toString()}'`)}function _i(n,e,t){if(n.isBool()){if(yi(e))return;z("Bool",t)}if(n.isAddress()){if(xr(e))return;z("AccountAddress",t)}if(n.isU8()){if(Ai(e))return;z("U8",t)}if(n.isU16()){if(hi(e))return;z("U16",t)}if(n.isU32()){if(Ti(e))return;z("U32",t)}if(n.isU64()){if(bi(e))return;z("U64",t)}if(n.isU128()){if(wi(e))return;z("U128",t)}if(n.isU256()){if(Si(e))return;z("U256",t)}if(n.isVector()){if(e instanceof _){e.values.length>0&&_i(n.value,e.values[0],t);return}z("MoveVector",t)}if(n instanceof A){if(n.isString()){if(fi(e))return;z("MoveString",t)}if(n.isObject()){if(xr(e))return;z("AccountAddress",t)}if(n.isOption()){if(e instanceof Y){e.value!==void 0&&_i(n.value.typeArgs[0],e.value,t);return}z("MoveOption",t)}}throw new Error(`Type mismatch for argument ${t}, expected '${n.toString()}'`)}async function vr(n){if(_s(n))return fu(n);let{moduleAddress:e,moduleName:t,functionName:r}=_chunkRX5UBAMEjs.ha.call(void 0, n.function),i=await Ds({key:"entry-function",moduleAddress:e,moduleName:t,functionName:r,aptosConfig:n.aptosConfig,abi:n.abi,fetch:vs});return mu({...n,abi:i})}function mu(n){let e=n.abi,{moduleAddress:t,moduleName:r,functionName:i}=_chunkRX5UBAMEjs.ha.call(void 0, n.function),o=Zt(n.typeArguments);if(o.length!==e.typeParameters.length)throw new Error(`Type argument count mismatch, expected ${e.typeParameters.length}, received ${o.length}`);let s=n.functionArguments.map((c,d)=>Ir(n.function,e,c,d,o));if(s.length!==e.parameters.length)throw new Error(`Too few arguments for '${t}::${r}::${i}', expected ${e.parameters.length} but got ${s.length}`);let a=_t.build(`${t}::${r}`,i,o,s);if("multisigAddress"in n){let c=_chunkRX5UBAMEjs.Z.from(n.multisigAddress);return new Tn(new wn(c,new Sn(a)))}return new hn(a)}async function Cr(n){let{moduleAddress:e,moduleName:t,functionName:r}=_chunkRX5UBAMEjs.ha.call(void 0, n.function),i=await Ds({key:"view-function",moduleAddress:e,moduleName:t,functionName:r,aptosConfig:n.aptosConfig,abi:n.abi,fetch:Cs});return yu({abi:i,...n})}function yu(n){let e=n.abi,{moduleAddress:t,moduleName:r,functionName:i}=_chunkRX5UBAMEjs.ha.call(void 0, n.function),o=Zt(n.typeArguments);if(o.length!==e.typeParameters.length)throw new Error(`Type argument count mismatch, expected ${e.typeParameters.length}, received ${o.length}`);let s=_nullishCoalesce(_optionalChain([n, 'optionalAccess', _118 => _118.functionArguments, 'optionalAccess', _119 => _119.map, 'call', _120 => _120((a,c)=>Ir(n.function,e,a,c,o))]), () => ([]));if(s.length!==e.parameters.length)throw new Error(`Too few arguments for '${t}::${r}::${i}', expected ${e.parameters.length} but got ${s.length}`);return _t.build(`${t}::${r}`,i,o,s)}function fu(n){return new St(new bn(_chunkRX5UBAMEjs.j.fromHexInput(n.bytecode).toUint8Array(),Zt(n.typeArguments),n.functionArguments))}async function Pi(n){let{aptosConfig:e,sender:t,payload:r,options:i,feePayerAddress:o}=n,s=async()=>Yr[e.network]?{chainId:Yr[e.network]}:{chainId:(await fr({aptosConfig:e})).chain_id},a=async()=>_optionalChain([i, 'optionalAccess', _121 => _121.gasUnitPrice])?{gasEstimate:i.gasUnitPrice}:{gasEstimate:(await Sr({aptosConfig:e})).gas_estimate},c=async()=>{let R=async()=>_optionalChain([i, 'optionalAccess', _122 => _122.accountSequenceNumber])!==void 0?i.accountSequenceNumber:(await Oe({aptosConfig:e,accountAddress:t})).sequence_number;if(o&&_chunkRX5UBAMEjs.Z.from(o).equals(_chunkRX5UBAMEjs.Z.ZERO))try{return await R()}catch (e4){return 0}else return R()},[{chainId:d},{gasEstimate:l},h]=await Promise.all([s(),a(),c()]),{maxGasAmount:p,gasUnitPrice:g,expireTimestamp:b}={maxGasAmount:_optionalChain([i, 'optionalAccess', _123 => _123.maxGasAmount])?BigInt(i.maxGasAmount):BigInt(2e5),gasUnitPrice:_nullishCoalesce(_optionalChain([i, 'optionalAccess', _124 => _124.gasUnitPrice]), () => (BigInt(l))),expireTimestamp:_nullishCoalesce(_optionalChain([i, 'optionalAccess', _125 => _125.expireTimestamp]), () => (BigInt(Math.floor(Date.now()/1e3)+20)))};return new Ae(_chunkRX5UBAMEjs.Z.from(t),BigInt(h),r,BigInt(p),BigInt(g),BigInt(b),new Lt(d))}async function xi(n){let{aptosConfig:e,sender:t,payload:r,options:i,feePayerAddress:o}=n,s=await Pi({aptosConfig:e,sender:t,payload:r,options:i,feePayerAddress:o});if("secondarySignerAddresses"in n){let a=_nullishCoalesce(_optionalChain([n, 'access', _126 => _126.secondarySignerAddresses, 'optionalAccess', _127 => _127.map, 'call', _128 => _128(c=>_chunkRX5UBAMEjs.Z.from(c))]), () => ([]));return new pr(s,a,n.feePayerAddress?_chunkRX5UBAMEjs.Z.from(n.feePayerAddress):void 0)}return new $t(s,n.feePayerAddress?_chunkRX5UBAMEjs.Z.from(n.feePayerAddress):void 0)}function Rs(n){let{signerPublicKey:e,transaction:t,secondarySignersPublicKeys:r,feePayerPublicKey:i}=n,o=en(e);if(t.feePayerAddress){let a=new Pt(t.rawTransaction,_nullishCoalesce(t.secondarySignerAddresses, () => ([])),t.feePayerAddress),c=[];t.secondarySignerAddresses&&(r?c=r.map(h=>en(h)):c=Array.from({length:t.secondarySignerAddresses.length},()=>en(void 0)));let d=en(i),l=new vt(o,_nullishCoalesce(t.secondarySignerAddresses, () => ([])),c,{address:t.feePayerAddress,authenticator:d});return new Ye(a.raw_txn,l).bcsToBytes()}if(t.secondarySignerAddresses){let a=new Et(t.rawTransaction,t.secondarySignerAddresses),c=[];r?c=r.map(l=>en(l)):c=Array.from({length:t.secondarySignerAddresses.length},()=>en(void 0));let d=new It(o,t.secondarySignerAddresses,c);return new Ye(a.raw_txn,d).bcsToBytes()}let s;if(o instanceof xe)s=new xt(o.public_key,o.signature);else if(o instanceof se||o instanceof De)s=new at(o);else if(o instanceof qt)s=new at(o);else throw new Error("Invalid public key");return new Ye(t.rawTransaction,s).bcsToBytes()}function en(n){if(!n)return new qt;let t=k.isInstance(n)||ne.isInstance(n)||Ne.isInstance(n)?new O(n):n,r=new I(new Uint8Array(64));if(x.isInstance(t))return new xe(t,r);if(O.isInstance(t))return k.isInstance(t.publicKey)?new se(t,new H(Ve.getSimulationSignature())):new se(t,new H(r));if(Ue.isInstance(t))return new De(t,new Le({signatures:t.publicKeys.map(()=>new H(r)),bitmap:t.createBitmap({bits:Array(t.publicKeys.length).fill(0).map((i,o)=>o)})}));throw new Error("Unsupported PublicKey used for simulations")}function Ii(n){let{transaction:e,feePayerAuthenticator:t,additionalSignersAuthenticators:r}=n,i=fo(Q,n.senderAuthenticator),o;if(e.feePayerAddress){if(!t)throw new Error("Must provide a feePayerAuthenticator argument to generate a signed fee payer transaction");o=new vt(i,_nullishCoalesce(e.secondarySignerAddresses, () => ([])),_nullishCoalesce(r, () => ([])),{address:e.feePayerAddress,authenticator:t})}else if(e.secondarySignerAddresses){if(!r)throw new Error("Must provide a additionalSignersAuthenticators argument to generate a signed multi agent transaction");o=new It(i,e.secondarySignerAddresses,r)}else i instanceof xe?o=new xt(i.public_key,i.signature):i instanceof $e?o=new Ht(i.public_key,i.signature):o=new at(i);return new Ye(e.rawTransaction,o).bcsToBytes()}function Us(n){let e=_sha3.sha3_256.create();for(let t of n)e.update(t);return e.digest()}var Au=Us(["APTOS::Transaction"]);function Lb(n){let e=Ii(n);return new (0, _chunkRX5UBAMEjs.j)(Us([Au,new Uint8Array([0]),e])).toString()}async function Ds({key:n,moduleAddress:e,moduleName:t,functionName:r,aptosConfig:i,abi:o,fetch:s}){return o!==void 0?o:Ke(async()=>s(e,t,r,i),`${n}-${i.network}-${e}-${t}-${r}`,1e3*60*5)()}var _scriptcomposerpack = require('@aptos-labs/script-composer-pack');var Kr=class n{constructor(e){this.config=e,this.builder=void 0}async init(){if(!n.transactionComposer){let e=await Promise.resolve().then(() => _interopRequireWildcard(require("@aptos-labs/script-composer-pack"))),{TransactionComposer:t,initSync:r}=e;_scriptcomposerpack.ScriptComposerWasm.isInitialized||_scriptcomposerpack.ScriptComposerWasm.init(),r({module:_scriptcomposerpack.ScriptComposerWasm.wasm}),n.transactionComposer=t}this.builder=n.transactionComposer.single_signer()}async addBatchedCalls(e){let{moduleAddress:t,moduleName:r,functionName:i}=_chunkRX5UBAMEjs.ha.call(void 0, e.function),o=this.config.getRequestUrl("Fullnode");await this.builder.load_module(o,`${t}::${r}`),e.typeArguments!==void 0&&await Promise.all(e.typeArguments.map(d=>this.builder.load_type_tag(o,d.toString())));let s=Zt(e.typeArguments),a=await Is(t,r,i,this.config);if(s.length!==a.typeParameters.length)throw new Error(`Type argument count mismatch, expected ${a.typeParameters.length}, received ${s.length}`);let c=e.functionArguments.map((d,l)=>Ks(d,i,a,l,s));return this.builder.add_batched_call(`${t}::${r}`,i,s.map(d=>d.toString()),c)}build(){return this.builder.generate_batched_calls(!0)}};async function ae(n){let{aptosConfig:e,payload:t,options:r}=n,i=await Cr({...t,aptosConfig:e}),o=new _chunkRX5UBAMEjs.m;i.serialize(o);let s=o.toUint8Array(),{data:a}=await st({aptosConfig:e,path:"view",originMethod:"view",contentType:"application/x.aptos.view_function+bcs",params:{ledger_version:_optionalChain([r, 'optionalAccess', _129 => _129.ledgerVersion])},body:s});return a}async function zs(n){let{aptosConfig:e,payload:t,options:r}=n,{data:i}=await st({aptosConfig:e,originMethod:"viewJson",path:"view",params:{ledger_version:_optionalChain([r, 'optionalAccess', _130 => _130.ledgerVersion])},body:{function:t.function,type_arguments:_nullishCoalesce(t.typeArguments, () => ([])),arguments:_nullishCoalesce(t.functionArguments, () => ([]))}});return i}async function w(n){let e=await hu(n);return Tu(n,e)}async function hu(n){let{aptosConfig:e,data:t}=n,r,i;return"bytecode"in t?i=await vr(t):"multisigAddress"in t?(r={aptosConfig:e,multisigAddress:t.multisigAddress,function:t.function,functionArguments:t.functionArguments,typeArguments:t.typeArguments,abi:t.abi},i=await vr(r)):(r={aptosConfig:e,function:t.function,functionArguments:t.functionArguments,typeArguments:t.typeArguments,abi:t.abi},i=await vr(r)),i}async function Tu(n,e){let{aptosConfig:t,sender:r,options:i}=n,o;if(bu(n)&&(o=_chunkRX5UBAMEjs.Z.ZERO.toString()),wu(n)){let{secondarySignerAddresses:s}=n;return xi({aptosConfig:t,sender:r,payload:e,options:i,secondarySignerAddresses:s,feePayerAddress:o})}return xi({aptosConfig:t,sender:r,payload:e,options:i,feePayerAddress:o})}function bu(n){return n.withFeePayer===!0}function wu(n){return"secondarySignerAddresses"in n}function ks(n){let{transaction:e}=n;return Ie(e)}function Rr(n){let{signer:e,transaction:t}=n;return e.signTransactionWithAuthenticator(t)}function Ur(n){let{signer:e,transaction:t}=n;if(!t.feePayerAddress)throw new Error(`Transaction ${t} is not a Fee Payer transaction`);return t.feePayerAddress=e.accountAddress,Rr({signer:e,transaction:t})}async function Ci(n){let{aptosConfig:e,transaction:t,signerPublicKey:r,secondarySignersPublicKeys:i,feePayerPublicKey:o,options:s}=n,a=Rs({transaction:t,signerPublicKey:r,secondarySignersPublicKeys:i,feePayerPublicKey:o,options:s}),{data:c}=await st({aptosConfig:e,body:a,path:"transactions/simulate",params:{estimate_gas_unit_price:_nullishCoalesce(_optionalChain([n, 'access', _131 => _131.options, 'optionalAccess', _132 => _132.estimateGasUnitPrice]), () => (!1)),estimate_max_gas_amount:_nullishCoalesce(_optionalChain([n, 'access', _133 => _133.options, 'optionalAccess', _134 => _134.estimateMaxGasAmount]), () => (!1)),estimate_prioritized_gas_unit_price:_nullishCoalesce(_optionalChain([n, 'access', _135 => _135.options, 'optionalAccess', _136 => _136.estimatePrioritizedGasUnitPrice]), () => (!1))},originMethod:"simulateTransaction",contentType:"application/x.aptos.signed_transaction+bcs"});return c}async function In(n){let{aptosConfig:e}=n,t=Ii({...n});try{let{data:r}=await st({aptosConfig:e,body:t,path:"transactions",originMethod:"submitTransaction",contentType:"application/x.aptos.signed_transaction+bcs"});return r}catch(r){let i=Ye.deserialize(new C(t));throw i.authenticator.isSingleSender()&&i.authenticator.sender.isSingleKey()&&(i.authenticator.sender.public_key.publicKey instanceof k||i.authenticator.sender.public_key.publicKey instanceof ne)&&await ge.fetchJWK({aptosConfig:e,publicKey:i.authenticator.sender.public_key.publicKey,kid:i.authenticator.sender.signature.signature.getJwkKid()}),r}}async function vn(n){let{aptosConfig:e,signer:t,feePayer:r,transaction:i}=n;lr(t)&&await t.checkKeylessAccountValidity(e),lr(r)&&await r.checkKeylessAccountValidity(e);let o=n.feePayerAuthenticator||r&&Ur({signer:r,transaction:i}),s=Rr({signer:t,transaction:i});return In({aptosConfig:e,transaction:i,senderAuthenticator:s,feePayerAuthenticator:o})}async function Os(n){let{aptosConfig:e,senderAuthenticator:t,feePayer:r,transaction:i}=n;lr(r)&&await r.checkKeylessAccountValidity(e);let o=Ur({signer:r,transaction:i});return In({aptosConfig:e,transaction:i,senderAuthenticator:t,feePayerAuthenticator:o})}var Su={typeParameters:[],parameters:[v.u8(),new v(v.u8())]};async function Fs(n){let{aptosConfig:e,account:t,metadataBytes:r,moduleBytecode:i,options:o}=n,s=i.map(a=>_.U8(a));return w({aptosConfig:e,sender:_chunkRX5UBAMEjs.Z.from(t),data:{function:"0x1::code::publish_package_txn",functionArguments:[_.U8(r),new _(s)],abi:Su},options:o})}var _u={typeParameters:[],parameters:[new pe,v.u8(),new pe,v.u8(),v.u8(),v.u8()]};async function Ns(n){let{aptosConfig:e,fromAccount:t,toNewPrivateKey:r}=n,i=await Oe({aptosConfig:e,accountAddress:t.accountAddress}),o=ke.fromPrivateKey({privateKey:r,legacy:!0}),a=new dr({sequenceNumber:BigInt(i.sequence_number),originator:t.accountAddress,currentAuthKey:_chunkRX5UBAMEjs.Z.from(i.authentication_key),newPublicKey:o.publicKey}).bcsToBytes(),c=t.sign(a),d=o.sign(a),l=await w({aptosConfig:e,sender:t.accountAddress,data:{function:"0x1::account::rotate_authentication_key",functionArguments:[new X(t.signingScheme),_.U8(t.publicKey.toUint8Array()),new X(o.signingScheme),_.U8(o.publicKey.toUint8Array()),_.U8(c.toUint8Array()),_.U8(d.toUint8Array())],abi:_u}});return vn({aptosConfig:e,signer:t,transaction:l})}async function Gs(n){let{aptosConfig:e,sender:t,authenticationFunction:r,options:i}=n,{moduleAddress:o,moduleName:s,functionName:a}=_chunkRX5UBAMEjs.ha.call(void 0, r);return w({aptosConfig:e,sender:t,data:{function:"0x1::account_abstraction::add_authentication_function",typeArguments:[],functionArguments:[o,s,a],abi:{typeParameters:[],parameters:[new F,new A(E()),new A(E())]}},options:i})}async function Bs(n){let{aptosConfig:e,sender:t,authenticationFunction:r,options:i}=n,{moduleAddress:o,moduleName:s,functionName:a}=_chunkRX5UBAMEjs.ha.call(void 0, r);return w({aptosConfig:e,sender:t,data:{function:"0x1::account_abstraction::remove_authentication_function",typeArguments:[],functionArguments:[o,s,a],abi:{typeParameters:[],parameters:[new F,new A(E()),new A(E())]}},options:i})}async function Ms(n){let{aptosConfig:e,sender:t,options:r}=n;return w({aptosConfig:e,sender:t,data:{function:"0x1::account_abstraction::remove_authenticator",typeArguments:[],functionArguments:[],abi:{typeParameters:[],parameters:[]}},options:r})}var Ut=class{constructor(e){this.config=e;this.isAccountAbstractionEnabled=async e=>{let t=await this.getAuthenticationFunction(e),{moduleAddress:r,moduleName:i,functionName:o}=_chunkRX5UBAMEjs.ha.call(void 0, e.authenticationFunction);return _nullishCoalesce(_optionalChain([t, 'optionalAccess', _137 => _137.some, 'call', _138 => _138(s=>_chunkRX5UBAMEjs.Z.fromString(r).equals(s.moduleAddress)&&i===s.moduleName&&o===s.functionName)]), () => (!1))};this.enableAccountAbstractionTransaction=this.addAuthenticationFunctionTransaction;this.disableAccountAbstractionTransaction=async e=>{let{accountAddress:t,authenticationFunction:r,options:i}=e;return r?this.removeAuthenticationFunctionTransaction({accountAddress:t,authenticationFunction:r,options:i}):this.removeDispatchableAuthenticatorTransaction({accountAddress:t,options:i})}}async addAuthenticationFunctionTransaction(e){let{accountAddress:t,authenticationFunction:r,options:i}=e;return Gs({aptosConfig:this.config,authenticationFunction:r,sender:t,options:i})}async removeAuthenticationFunctionTransaction(e){let{accountAddress:t,authenticationFunction:r,options:i}=e;return Bs({aptosConfig:this.config,sender:t,authenticationFunction:r,options:i})}async removeDispatchableAuthenticatorTransaction(e){let{accountAddress:t,options:r}=e;return Ms({aptosConfig:this.config,sender:t,options:r})}async getAuthenticationFunction(e){let{accountAddress:t}=e,[{vec:r}]=await ae({aptosConfig:this.config,payload:{function:"0x1::account_abstraction::dispatchable_authenticator",functionArguments:[_chunkRX5UBAMEjs.Z.from(t)],abi:{typeParameters:[],parameters:[new F],returnTypes:[]}}});if(r.length!==0)return r[0].map(i=>({moduleAddress:_chunkRX5UBAMEjs.Z.fromString(i.module_address),moduleName:i.module_name,functionName:i.function_name}))}};var Cn=class{constructor(e){this.config=e;this.abstraction=new Ut(e)}async getAccountInfo(e){return Oe({aptosConfig:this.config,...e})}async getAccountModules(e){return rs({aptosConfig:this.config,...e})}async getAccountModule(e){return br({aptosConfig:this.config,...e})}async getAccountTransactions(e){return is({aptosConfig:this.config,...e})}async getAccountResources(e){return os({aptosConfig:this.config,...e})}async getAccountResource(e){return li({aptosConfig:this.config,...e})}async lookupOriginalAccountAddress(e){return Xt({aptosConfig:this.config,...e})}async getAccountTokensCount(e){return await S({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"account_transactions_processor"}),ss({aptosConfig:this.config,...e})}async getAccountOwnedTokens(e){return await S({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),as({aptosConfig:this.config,...e})}async getAccountOwnedTokensFromCollectionAddress(e){return await S({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),cs({aptosConfig:this.config,...e})}async getAccountCollectionsWithOwnedTokens(e){return await S({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),us({aptosConfig:this.config,...e})}async getAccountTransactionsCount(e){return await S({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"account_transactions_processor"}),ds({aptosConfig:this.config,...e})}async getAccountCoinsData(e){return await S({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"fungible_asset_processor"}),ps({aptosConfig:this.config,...e})}async getAccountCoinsCount(e){return await S({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"fungible_asset_processor"}),ls({aptosConfig:this.config,...e})}async getAccountAPTAmount(e){return this.getAccountCoinAmount({coinType:ht,faMetadataAddress:go,...e})}async getAccountCoinAmount(e){let{accountAddress:t,coinType:r,faMetadataAddress:i,minimumLedgerVersion:o}=e;o&&console.warn(`minimumLedgerVersion is not used anymore, here for backward
|
|
477
|
+
`;async function br(n){let{aptosConfig:e}=n,{data:t}=await V({aptosConfig:e,originMethod:"getLedgerInfo",path:""});return t}async function ts(n){let{aptosConfig:e,limit:t}=n;return(await b({aptosConfig:e,query:{query:Lo,variables:{limit:t}},originMethod:"getChainTopUserTransactions"})).user_transactions}async function b(n){let{aptosConfig:e,query:t,originMethod:r}=n,{data:i}=await _o({aptosConfig:e,originMethod:_nullishCoalesce(r, () => ("queryIndexer")),path:"",body:t,overrides:{WITH_CREDENTIALS:!1}});return i}async function ou(n){let{aptosConfig:e}=n;return(await b({aptosConfig:e,query:{query:li},originMethod:"getProcessorStatuses"})).processor_status}async function wr(n){let e=await ou({aptosConfig:n.aptosConfig});return BigInt(e[0].last_success_version)}async function Sr(n){let{aptosConfig:e,processorType:t}=n;return(await b({aptosConfig:e,query:{query:li,variables:{where_condition:{processor:{_eq:t}}}},originMethod:"getProcessorStatus"})).processor_status[0]}async function rs(n){let{aptosConfig:e,accountAddress:t,options:r}=n;return ur({aptosConfig:e,originMethod:"getModules",path:`accounts/${_chunkPA2XFIP3js.Z.from(t).toString()}/modules`,params:{ledger_version:_optionalChain([r, 'optionalAccess', _63 => _63.ledgerVersion]),offset:_optionalChain([r, 'optionalAccess', _64 => _64.offset]),limit:_nullishCoalesce(_optionalChain([r, 'optionalAccess', _65 => _65.limit]), () => (1e3))}})}async function _r(n){let{aptosConfig:e,accountAddress:t}=n,{data:r}=await V({aptosConfig:e,originMethod:"getInfo",path:`accounts/${_chunkPA2XFIP3js.Z.from(t).toString()}`});return r}async function is(n){return _optionalChain([n, 'access', _66 => _66.options, 'optionalAccess', _67 => _67.ledgerVersion])!==void 0?ns(n):Ue(async()=>ns(n),`module-${n.accountAddress}-${n.moduleName}`,1e3*60*5)()}async function ns(n){let{aptosConfig:e,accountAddress:t,moduleName:r,options:i}=n,{data:o}=await V({aptosConfig:e,originMethod:"getModule",path:`accounts/${_chunkPA2XFIP3js.Z.from(t).toString()}/module/${r}`,params:{ledger_version:_optionalChain([i, 'optionalAccess', _68 => _68.ledgerVersion])}});return o}async function Er(n){let{aptosConfig:e,handle:t,data:r,options:i}=n;return(await st({aptosConfig:e,originMethod:"getTableItem",path:`tables/${t}/item`,params:{ledger_version:_optionalChain([i, 'optionalAccess', _69 => _69.ledgerVersion])},body:r})).data}async function os(n){let{aptosConfig:e,options:t}=n,r={query:Xo,variables:{where_condition:_optionalChain([t, 'optionalAccess', _70 => _70.where]),offset:_optionalChain([t, 'optionalAccess', _71 => _71.offset]),limit:_optionalChain([t, 'optionalAccess', _72 => _72.limit]),order_by:_optionalChain([t, 'optionalAccess', _73 => _73.orderBy])}};return(await b({aptosConfig:e,query:r,originMethod:"getTableItemsData"})).table_items}async function ss(n){let{aptosConfig:e,options:t}=n,r={query:Yo,variables:{where_condition:_optionalChain([t, 'optionalAccess', _74 => _74.where]),offset:_optionalChain([t, 'optionalAccess', _75 => _75.offset]),limit:_optionalChain([t, 'optionalAccess', _76 => _76.limit]),order_by:_optionalChain([t, 'optionalAccess', _77 => _77.orderBy])}};return(await b({aptosConfig:e,query:r,originMethod:"getTableItemsMetadata"})).table_metadatas}async function yi(n){let{aptosConfig:e,options:t}=n;return cr({aptosConfig:e,originMethod:"getTransactions",path:"transactions",params:{start:_optionalChain([t, 'optionalAccess', _78 => _78.offset]),limit:_optionalChain([t, 'optionalAccess', _79 => _79.limit])}})}async function xr(n){let{aptosConfig:e}=n;return Ue(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 as(n){let{aptosConfig:e,ledgerVersion:t}=n,{data:r}=await V({aptosConfig:e,originMethod:"getTransactionByVersion",path:`transactions/by_version/${t}`});return r}async function In(n){let{aptosConfig:e,transactionHash:t}=n,{data:r}=await V({aptosConfig:e,path:`transactions/by_hash/${t}`,originMethod:"getTransactionByHash"});return r}async function cs(n){let{aptosConfig:e,transactionHash:t}=n;try{return(await In({aptosConfig:e,transactionHash:t})).type==="pending_transaction"}catch(r){if(_optionalChain([r, 'optionalAccess', _80 => _80.status])===404)return!0;throw r}}async function su(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 ct(n){let{aptosConfig:e,transactionHash:t,options:r}=n,i=_nullishCoalesce(_optionalChain([r, 'optionalAccess', _81 => _81.timeoutSecs]), () => (20)),o=_nullishCoalesce(_optionalChain([r, 'optionalAccess', _82 => _82.checkSuccess]), () => (!0)),s=!0,a=0,c,d,l=200,h=1.5;function p(g){if(!(g instanceof Z)||(d=g,g.status!==404&&g.status>=400&&g.status<500))throw g}try{c=await In({aptosConfig:e,transactionHash:t}),s=c.type==="pending_transaction"}catch(g){p(g)}if(s){let g=Date.now();try{c=await su({aptosConfig:e,transactionHash:t}),s=c.type==="pending_transaction"}catch(w){p(w)}a=(Date.now()-g)/1e3}for(;s&&!(a>=i);){try{if(c=await In({aptosConfig:e,transactionHash:t}),s=c.type==="pending_transaction",!s)break}catch(g){p(g)}await _chunkPA2XFIP3js._.call(void 0, l),a+=l/1e3,l*=h}if(c===void 0)throw d||new Pr(`Fetching transaction ${t} failed and timed out after ${i} seconds`,c);if(c.type==="pending_transaction")throw new Pr(`Transaction ${t} timed out in pending state after ${i} seconds`,c);if(!o)return c;if(!c.success)throw new mi(`Transaction ${t} failed with an error: ${c.vm_status}`,c);return c}async function vr(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 wr({aptosConfig:e}):s=(await Sr({aptosConfig:e,processorType:t})).last_success_version,s>=r)break;await _chunkPA2XFIP3js._.call(void 0, 200)}}var Pr=class extends Error{constructor(e,t){super(e),this.lastSubmittedTransaction=t}},mi=class extends Error{constructor(e,t){super(e),this.transaction=t}};async function us(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', _83 => _83.withTransactions])}});return ps({block:i,...n})}async function ds(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', _84 => _84.withTransactions])}});return ps({block:i,...n})}async function ps(n){let{aptosConfig:e,block:t,options:r}=n;if(_optionalChain([r, 'optionalAccess', _85 => _85.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', _86 => _86.version]),c;if(a===void 0?c=o-1n:c=BigInt(a),c===s)return t;let d=[],l=100n;for(let p=c+1n;p<s;p+=BigInt(100))d.push(yi({aptosConfig:e,options:{offset:p,limit:Math.min(Number(l),Number(s-p+1n))}}));let h=await Promise.all(d);for(let p of h)t.transactions.push(...p)}return t}function ls(n){return!!n.match(/^[_a-zA-Z0-9]+$/)}function gs(n){return!!n.match(/\s/)}function au(n){return!!n.match(/^T[0-9]+$/)}function cu(n){return!!n.match(/^&.+$/)}function uu(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 du(n,e){let t=e;for(;t<n.length;t+=1){let r=n[t];if(!gs(r))break}return t}var pu=(w=>(w.InvalidTypeTag="unknown type",w.UnexpectedGenericType="unexpected generic type",w.UnexpectedTypeArgumentClose="unexpected '>'",w.UnexpectedWhitespaceCharacter="unexpected whitespace character",w.UnexpectedComma="unexpected ','",w.TypeArgumentCountMismatch="type argument count doesn't match expected amount",w.MissingTypeArgumentClose="no matching '>' for '<'",w.MissingTypeArgument="no type argument before ','",w.UnexpectedPrimitiveTypeArguments="primitive types not expected to have type arguments",w.UnexpectedVectorTypeArgumentCount="vector type expected to have exactly one type argument",w.UnexpectedStructFormat="unexpected struct format, must be of the form 0xaddress::module_name::struct_name",w.InvalidModuleNameCharacter="module name must only contain alphanumeric or '_' characters",w.InvalidStructNameCharacter="struct name must only contain alphanumeric or '_' characters",w.InvalidAddress="struct address must be valid",w))(pu||{}),$= exports.TypeTagParserError =class extends Error{constructor(e,t){super(`Failed to parse typeTag '${e}', ${t}`)}};function Ce(n,e){let t=_nullishCoalesce(_optionalChain([e, 'optionalAccess', _87 => _87.allowGenerics]), () => (!1)),r=[],i=[],o=[],s=0,a="",c=1;for(;s<n.length;){let d=n[s];if(d==="<")r.push({savedExpectedTypes:c,savedStr:a,savedTypes:o}),a="",o=[],c=1;else if(d===">"){if(a!==""){let w=Cn(a,i,t);o.push(w)}let l=r.pop();if(l===void 0)throw new $(n,"unexpected '>'");if(c!==o.length)throw new $(n,"type argument count doesn't match expected amount");let{savedStr:h,savedTypes:p,savedExpectedTypes:g}=l;i=o,o=p,a=h,c=g}else if(d===","){if(r.length===0)throw new $(n,"unexpected ','");if(a.length===0)throw new $(n,"no type argument before ','");let l=Cn(a,i,t);i=[],o.push(l),a="",c+=1}else if(gs(d)){let l=!1;if(a.length!==0){let p=Cn(a,i,t);i=[],o.push(p),a="",l=!0}s=du(n,s);let h=n[s];if(s<n.length&&l&&h!==","&&h!==">")throw new $(n,"unexpected whitespace character");continue}else a+=d;s+=1}if(r.length>0)throw new $(n,"no matching '>' for '<'");switch(o.length){case 0:return Cn(a,i,t);case 1:if(a==="")return o[0];throw new $(n,"unexpected ','");default:throw new $(n,"unexpected whitespace character")}}function Cn(n,e,t){let r=n.trim(),i=r.toLowerCase();if(uu(i)&&e.length>0)throw new $(n,"primitive types not expected to have type arguments");switch(r.toLowerCase()){case"signer":return new wt;case"bool":return new L;case"address":return new F;case"u8":return new le;case"u16":return new $e;case"u32":return new We;case"u64":return new j;case"u128":return new Qe;case"u256":return new je;case"vector":if(e.length!==1)throw new $(n,"vector type expected to have exactly one type argument");return new x(e[0]);default:if(cu(r)){let a=r.substring(1);return new pr(Cn(a,e,t))}if(au(r)){if(t)return new B(Number(r.split("T")[1]));throw new $(n,"unexpected generic type")}if(!r.match(/:/))throw new $(n,"unknown type");let o=r.split("::");if(o.length!==3)throw new $(n,"unexpected struct format, must be of the form 0xaddress::module_name::struct_name");let s;try{s=_chunkPA2XFIP3js.Z.fromString(o[0])}catch (e3){throw new $(n,"struct address must be valid")}if(!ls(o[1]))throw new $(n,"module name must only contain alphanumeric or '_' characters");if(!ls(o[2]))throw new $(n,"struct name must only contain alphanumeric or '_' characters");return new A(new Fe(s,new K(o[1]),new K(o[2]),e))}}function ms(n){return typeof n=="boolean"}function et(n){return typeof n=="string"}function lu(n){return typeof n=="number"}function Ir(n){if(lu(n))return n;if(et(n)&&n!=="")return Number.parseInt(n,10)}function Cr(n){return typeof n=="number"||typeof n=="bigint"||typeof n=="string"}function ys(n){return n==null}function fs(n){return fi(n)||hi(n)||Ti(n)||bi(n)||wi(n)||Si(n)||_i(n)||Kr(n)||Ai(n)||gu(n)||n instanceof S||n instanceof Y}function fi(n){return n instanceof D}function Kr(n){return n instanceof _chunkPA2XFIP3js.Z}function Ai(n){return n instanceof P}function gu(n){return n instanceof we}function hi(n){return n instanceof X}function Ti(n){return n instanceof Se}function bi(n){return n instanceof _e}function wi(n){return n instanceof W}function Si(n){return n instanceof Ee}function _i(n){return n instanceof ye}function As(n){return"bytecode"in n}function R(n,e){throw new Error(`Type mismatch for argument ${e}, expected '${n}'`)}function hs(n){let e=n.params.findIndex(t=>t!=="signer"&&t!=="&signer");return e<0?n.params.length:e}var mu=new TextEncoder;function en(n){return _nullishCoalesce(_optionalChain([n, 'optionalAccess', _88 => _88.map, 'call', _89 => _89(e=>et(e)?Ce(e):e)]), () => ([]))}async function Pi(n,e,t){return(await Rr({aptosConfig:t,accountAddress:n,moduleName:e})).abi}async function xi(n,e,t,r){let i=await Pi(n,e,r);if(!i)throw new Error(`Could not find module ABI for '${n}::${e}'`);return i.exposed_functions.find(o=>o.name===t)}async function mb(n,e,t,r){let i=await xi(n,e,t,r);if(!i)throw new Error(`Could not find function ABI for '${n}::${e}::${t}'`);let o=[];for(let s=0;s<i.params.length;s+=1)o.push(Ce(i.params[s],{allowGenerics:!0}));return{typeParameters:i.generic_type_params,parameters:o}}async function Ts(n,e,t,r){let i=await xi(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=hs(i),s=[];for(let a=o;a<i.params.length;a+=1)s.push(Ce(i.params[a],{allowGenerics:!0}));return{signers:o,typeParameters:i.generic_type_params,parameters:s}}async function bs(n,e,t,r){let i=await xi(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(Ce(i.params[a],{allowGenerics:!0}));let s=[];for(let a=0;a<i.return.length;a+=1)s.push(Ce(i.return[a],{allowGenerics:!0}));return{typeParameters:i.generic_type_params,parameters:o,returnTypes:s}}function yb(n,e,t,r,i){return n instanceof _chunkPA2XFIP3js.X?n:_chunkPA2XFIP3js.X.newBytes(tn(e,t,n,r,i).bcsToBytes())}function tn(n,e,t,r,i,o){let s;if("exposed_functions"in e){let a=e.exposed_functions.find(c=>c.name===n);if(!a)throw new Error(`Could not find function ABI for '${e.address}::${e.name}::${n}'`);if(r>=a.params.length)throw new Error(`Too many arguments for '${n}', expected ${a.params.length}`);s=Ce(a.params[r],{allowGenerics:!0})}else{if(r>=e.parameters.length)throw new Error(`Too many arguments for '${n}', expected ${e.parameters.length}`);s=e.parameters[r]}return Ut(t,s,r,i,"exposed_functions"in e?e:void 0,o)}function Ut(n,e,t,r,i,o){return fs(n)?(Ei(e,n,t),n):yu(n,e,t,r,i,o)}function yu(n,e,t,r,i,o){if(e.isBool()){if(ms(n))return new D(n);if(et(n)){if(n==="true")return new D(!0);if(n==="false")return new D(!1)}R("boolean",t)}if(e.isAddress()){if(et(n))return _chunkPA2XFIP3js.Z.fromString(n);R("string | AccountAddress",t)}if(e.isU8()){let s=Ir(n);if(s!==void 0)return new X(s);R("number | string",t)}if(e.isU16()){let s=Ir(n);if(s!==void 0)return new Se(s);R("number | string",t)}if(e.isU32()){let s=Ir(n);if(s!==void 0)return new _e(s);R("number | string",t)}if(e.isU64()){if(Cr(n))return new W(BigInt(n));R("bigint | number | string",t)}if(e.isU128()){if(Cr(n))return new Ee(BigInt(n));R("bigint | number | string",t)}if(e.isU256()){if(Cr(n))return new ye(BigInt(n));R("bigint | number | string",t)}if(e.isGeneric()){let s=e.value;if(s<0||s>=r.length)throw new Error(`Generic argument ${e.toString()} is invalid for argument ${t}`);return Ut(n,r[s],t,r,i)}if(e.isVector()){if(e.value.isU8()){if(et(n))return S.U8(mu.encode(n));if(n instanceof Uint8Array)return S.U8(n);if(n instanceof ArrayBuffer)return S.U8(new Uint8Array(n))}if(et(n)&&n.startsWith("["))return Ut(JSON.parse(n),e,t,r);if(Array.isArray(n))return new S(n.map(s=>Ut(s,e.value,t,r,i)));throw new Error(`Type mismatch for argument ${t}, type '${e.toString()}'`)}if(e.isStruct()){if(e.isString()){if(et(n))return new P(n);R("string",t)}if(e.isObject()){if(et(n))return _chunkPA2XFIP3js.Z.fromString(n);R("string | AccountAddress",t)}if(e.isDelegationKey()||e.isRateLimiter()){if(n instanceof Uint8Array)return new we(n);R("Uint8Array",t)}if(e.isOption()){if(ys(n)){let a=e.value.typeArgs[0];return a instanceof L?new Y(null):a instanceof F?new Y(null):a instanceof le?new Y(null):a instanceof $e?new Y(null):a instanceof We?new Y(null):a instanceof j?new Y(null):a instanceof Qe?new Y(null):a instanceof je?new Y(null):new Y(null)}return new Y(Ut(n,e.value.typeArgs[0],t,r,i))}if(_optionalChain([i, 'optionalAccess', _90 => _90.structs, 'access', _91 => _91.find, 'call', _92 => _92(a=>a.name===e.value.name.identifier), 'optionalAccess', _93 => _93.fields, 'access', _94 => _94.length])===0&&n instanceof Uint8Array)return new we(n);if(n instanceof Uint8Array&&_optionalChain([o, 'optionalAccess', _95 => _95.allowUnknownStructs]))return console.warn(`Unsupported struct input type for argument ${t}. Continuing since 'allowUnknownStructs' is enabled.`),new we(n);throw new Error(`Unsupported struct input type for argument ${t}, type '${e.toString()}'`)}throw new Error(`Type mismatch for argument ${t}, type '${e.toString()}'`)}function Ei(n,e,t){if(n.isBool()){if(fi(e))return;R("Bool",t)}if(n.isAddress()){if(Kr(e))return;R("AccountAddress",t)}if(n.isU8()){if(hi(e))return;R("U8",t)}if(n.isU16()){if(Ti(e))return;R("U16",t)}if(n.isU32()){if(bi(e))return;R("U32",t)}if(n.isU64()){if(wi(e))return;R("U64",t)}if(n.isU128()){if(Si(e))return;R("U128",t)}if(n.isU256()){if(_i(e))return;R("U256",t)}if(n.isVector()){if(e instanceof S){e.values.length>0&&Ei(n.value,e.values[0],t);return}R("MoveVector",t)}if(n instanceof A){if(n.isString()){if(Ai(e))return;R("MoveString",t)}if(n.isObject()){if(Kr(e))return;R("AccountAddress",t)}if(n.isOption()){if(e instanceof Y){e.value!==void 0&&Ei(n.value.typeArgs[0],e.value,t);return}R("MoveOption",t)}}throw new Error(`Type mismatch for argument ${t}, expected '${n.toString()}'`)}async function Ur(n){if(As(n))return Tu(n);let{moduleAddress:e,moduleName:t,functionName:r}=_chunkPA2XFIP3js.ha.call(void 0, n.function),i=await _s({key:"entry-function",moduleAddress:e,moduleName:t,functionName:r,aptosConfig:n.aptosConfig,abi:n.abi,fetch:Ts});return Au({...n,abi:i})}function Au(n){let e=n.abi,{moduleAddress:t,moduleName:r,functionName:i}=_chunkPA2XFIP3js.ha.call(void 0, n.function),o=en(n.typeArguments);if(o.length!==e.typeParameters.length)throw new Error(`Type argument count mismatch, expected ${e.typeParameters.length}, received ${o.length}`);let s=n.functionArguments.map((c,d)=>tn(n.function,e,c,d,o));if(s.length!==e.parameters.length)throw new Error(`Too few arguments for '${t}::${r}::${i}', expected ${e.parameters.length} but got ${s.length}`);let a=Et.build(`${t}::${r}`,i,o,s);if("multisigAddress"in n){let c=_chunkPA2XFIP3js.Z.from(n.multisigAddress);return new Sn(new En(c,new Pn(a)))}return new wn(a)}async function Dr(n){let{moduleAddress:e,moduleName:t,functionName:r}=_chunkPA2XFIP3js.ha.call(void 0, n.function),i=await _s({key:"view-function",moduleAddress:e,moduleName:t,functionName:r,aptosConfig:n.aptosConfig,abi:n.abi,fetch:bs});return hu({abi:i,...n})}function hu(n){let e=n.abi,{moduleAddress:t,moduleName:r,functionName:i}=_chunkPA2XFIP3js.ha.call(void 0, n.function),o=en(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', _96 => _96.functionArguments, 'optionalAccess', _97 => _97.map, 'call', _98 => _98((a,c)=>tn(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 Et.build(`${t}::${r}`,i,o,s)}function Tu(n){return new _t(new _n(_chunkPA2XFIP3js.j.fromHexInput(n.bytecode).toUint8Array(),en(n.typeArguments),n.functionArguments))}async function vi(n){let{aptosConfig:e,sender:t,payload:r,options:i,feePayerAddress:o}=n,s=async()=>ti[e.network]?{chainId:ti[e.network]}:{chainId:(await br({aptosConfig:e})).chain_id},a=async()=>_optionalChain([i, 'optionalAccess', _99 => _99.gasUnitPrice])?{gasEstimate:i.gasUnitPrice}:{gasEstimate:(await xr({aptosConfig:e})).gas_estimate},c=async()=>{let U=async()=>_optionalChain([i, 'optionalAccess', _100 => _100.accountSequenceNumber])!==void 0?i.accountSequenceNumber:(await _r({aptosConfig:e,accountAddress:t})).sequence_number;if(o&&_chunkPA2XFIP3js.Z.from(o).equals(_chunkPA2XFIP3js.Z.ZERO))try{return await U()}catch (e4){return 0}else return U()},[{chainId:d},{gasEstimate:l},h]=await Promise.all([s(),a(),c()]),{maxGasAmount:p,gasUnitPrice:g,expireTimestamp:w}={maxGasAmount:_optionalChain([i, 'optionalAccess', _101 => _101.maxGasAmount])?BigInt(i.maxGasAmount):BigInt(2e5),gasUnitPrice:_nullishCoalesce(_optionalChain([i, 'optionalAccess', _102 => _102.gasUnitPrice]), () => (BigInt(l))),expireTimestamp:_nullishCoalesce(_optionalChain([i, 'optionalAccess', _103 => _103.expireTimestamp]), () => (BigInt(Math.floor(Date.now()/1e3)+20)))};return new he(_chunkPA2XFIP3js.Z.from(t),BigInt(h),r,BigInt(p),BigInt(g),BigInt(w),new Wt(d))}async function Ii(n){let{aptosConfig:e,sender:t,payload:r,options:i,feePayerAddress:o}=n,s=await vi({aptosConfig:e,sender:t,payload:r,options:i,feePayerAddress:o});if("secondarySignerAddresses"in n){let a=_nullishCoalesce(_optionalChain([n, 'access', _104 => _104.secondarySignerAddresses, 'optionalAccess', _105 => _105.map, 'call', _106 => _106(c=>_chunkPA2XFIP3js.Z.from(c))]), () => ([]));return new mr(s,a,n.feePayerAddress?_chunkPA2XFIP3js.Z.from(n.feePayerAddress):void 0)}return new jt(s,n.feePayerAddress?_chunkPA2XFIP3js.Z.from(n.feePayerAddress):void 0)}function ws(n){let{signerPublicKey:e,transaction:t,secondarySignersPublicKeys:r,feePayerPublicKey:i}=n,o=nn(e);if(t.feePayerAddress){let a=new xt(t.rawTransaction,_nullishCoalesce(t.secondarySignerAddresses, () => ([])),t.feePayerAddress),c=[];t.secondarySignerAddresses&&(r?c=r.map(h=>nn(h)):c=Array.from({length:t.secondarySignerAddresses.length},()=>nn(void 0)));let d=nn(i),l=new Ct(o,_nullishCoalesce(t.secondarySignerAddresses, () => ([])),c,{address:t.feePayerAddress,authenticator:d});return new Xe(a.raw_txn,l).bcsToBytes()}if(t.secondarySignerAddresses){let a=new Pt(t.rawTransaction,t.secondarySignerAddresses),c=[];r?c=r.map(l=>nn(l)):c=Array.from({length:t.secondarySignerAddresses.length},()=>nn(void 0));let d=new It(o,t.secondarySignerAddresses,c);return new Xe(a.raw_txn,d).bcsToBytes()}let s;if(o instanceof ve)s=new vt(o.public_key,o.signature);else if(o instanceof se||o instanceof Oe)s=new at(o);else if(o instanceof $t)s=new at(o);else throw new Error("Invalid public key");return new Xe(t.rawTransaction,s).bcsToBytes()}function nn(n){if(!n)return new $t;let t=k.isInstance(n)||ee.isInstance(n)||Ne.isInstance(n)?new O(n):n,r=new I(new Uint8Array(64));if(v.isInstance(t))return new ve(t,r);if(O.isInstance(t))return k.isInstance(t.publicKey)?new se(t,new q(ze.getSimulationSignature())):new se(t,new q(r));if(ke.isInstance(t))return new Oe(t,new qe({signatures:t.publicKeys.map(i=>k.isInstance(i.publicKey)||ee.isInstance(i.publicKey)?new q(ze.getSimulationSignature()):new q(r)),bitmap:t.createBitmap({bits:Array(t.publicKeys.length).fill(0).map((i,o)=>o)})}));throw new Error("Unsupported PublicKey used for simulations")}function Ci(n){let{transaction:e,feePayerAuthenticator:t,additionalSignersAuthenticators:r}=n,i=bo(Q,n.senderAuthenticator),o;if(e.feePayerAddress){if(!t)throw new Error("Must provide a feePayerAuthenticator argument to generate a signed fee payer transaction");o=new Ct(i,_nullishCoalesce(e.secondarySignerAddresses, () => ([])),_nullishCoalesce(r, () => ([])),{address:e.feePayerAddress,authenticator:t})}else if(e.secondarySignerAddresses){if(!r)throw new Error("Must provide a additionalSignersAuthenticators argument to generate a signed multi agent transaction");o=new It(i,e.secondarySignerAddresses,r)}else i instanceof ve?o=new vt(i.public_key,i.signature):i instanceof He?o=new Qt(i.public_key,i.signature):o=new at(i);return new Xe(e.rawTransaction,o).bcsToBytes()}function Ss(n){let e=_sha3.sha3_256.create();for(let t of n)e.update(t);return e.digest()}var bu=Ss(["APTOS::Transaction"]);function Gb(n){let e=Ci(n);return new (0, _chunkPA2XFIP3js.j)(Ss([bu,new Uint8Array([0]),e])).toString()}async function _s({key:n,moduleAddress:e,moduleName:t,functionName:r,aptosConfig:i,abi:o,fetch:s}){return o!==void 0?o:Ue(async()=>s(e,t,r,i),`${n}-${i.network}-${e}-${t}-${r}`,1e3*60*5)()}var _scriptcomposerpack = require('@aptos-labs/script-composer-pack');var zr=class n{constructor(e){this.config=e,this.builder=void 0}async init(){if(!n.transactionComposer){let e=await Promise.resolve().then(() => _interopRequireWildcard(require("@aptos-labs/script-composer-pack"))),{TransactionComposer:t,initSync:r}=e;_scriptcomposerpack.ScriptComposerWasm.isInitialized||_scriptcomposerpack.ScriptComposerWasm.init(),r({module:_scriptcomposerpack.ScriptComposerWasm.wasm}),n.transactionComposer=t}this.builder=n.transactionComposer.single_signer()}async addBatchedCalls(e){let{moduleAddress:t,moduleName:r,functionName:i}=_chunkPA2XFIP3js.ha.call(void 0, e.function),o=this.config.getRequestUrl("Fullnode");if(await this.builder.load_module(o,`${t}::${r}`),e.typeArguments!==void 0)for(let l of e.typeArguments)await this.builder.load_type_tag(o,l.toString());let s=en(e.typeArguments),a=await Pi(t,r,this.config);if(!a)throw new Error(`Could not find module ABI for '${t}::${r}'`);let c=_optionalChain([a, 'optionalAccess', _107 => _107.exposed_functions, 'access', _108 => _108.find, 'call', _109 => _109(l=>l.name===i)]);if(!c)throw new Error(`Could not find function ABI for '${t}::${r}::${i}'`);if(s.length!==c.generic_type_params.length)throw new Error(`Type argument count mismatch, expected ${_optionalChain([c, 'optionalAccess', _110 => _110.generic_type_params, 'access', _111 => _111.length])}, received ${s.length}`);let d=e.functionArguments.map((l,h)=>l instanceof _chunkPA2XFIP3js.X?l:_chunkPA2XFIP3js.X.newBytes(tn(i,a,l,h,s,{allowUnknownStructs:!0}).bcsToBytes()));return this.builder.add_batched_call(`${t}::${r}`,i,s.map(l=>l.toString()),d)}build(){return this.builder.generate_batched_calls(!0)}};async function T(n){let e=await wu(n);return Su(n,e)}async function wu(n){let{aptosConfig:e,data:t}=n,r,i;return"bytecode"in t?i=await Ur(t):"multisigAddress"in t?(r={aptosConfig:e,multisigAddress:t.multisigAddress,function:t.function,functionArguments:t.functionArguments,typeArguments:t.typeArguments,abi:t.abi},i=await Ur(r)):(r={aptosConfig:e,function:t.function,functionArguments:t.functionArguments,typeArguments:t.typeArguments,abi:t.abi},i=await Ur(r)),i}async function Su(n,e){let{aptosConfig:t,sender:r,options:i}=n,o;if(_u(n)&&(o=_chunkPA2XFIP3js.Z.ZERO.toString()),Eu(n)){let{secondarySignerAddresses:s}=n;return Ii({aptosConfig:t,sender:r,payload:e,options:i,secondarySignerAddresses:s,feePayerAddress:o})}return Ii({aptosConfig:t,sender:r,payload:e,options:i,feePayerAddress:o})}function _u(n){return n.withFeePayer===!0}function Eu(n){return"secondarySignerAddresses"in n}function Es(n){let{transaction:e}=n;return Ie(e)}function kr(n){let{signer:e,transaction:t}=n;return e.signTransactionWithAuthenticator(t)}function Or(n){let{signer:e,transaction:t}=n;if(!t.feePayerAddress)throw new Error(`Transaction ${t} is not a Fee Payer transaction`);return t.feePayerAddress=e.accountAddress,kr({signer:e,transaction:t})}async function Ri(n){let{aptosConfig:e,transaction:t,signerPublicKey:r,secondarySignersPublicKeys:i,feePayerPublicKey:o,options:s}=n,a=ws({transaction:t,signerPublicKey:r,secondarySignersPublicKeys:i,feePayerPublicKey:o,options:s}),{data:c}=await st({aptosConfig:e,body:a,path:"transactions/simulate",params:{estimate_gas_unit_price:_nullishCoalesce(_optionalChain([n, 'access', _112 => _112.options, 'optionalAccess', _113 => _113.estimateGasUnitPrice]), () => (!1)),estimate_max_gas_amount:_nullishCoalesce(_optionalChain([n, 'access', _114 => _114.options, 'optionalAccess', _115 => _115.estimateMaxGasAmount]), () => (!1)),estimate_prioritized_gas_unit_price:_nullishCoalesce(_optionalChain([n, 'access', _116 => _116.options, 'optionalAccess', _117 => _117.estimatePrioritizedGasUnitPrice]), () => (!1))},originMethod:"simulateTransaction",contentType:"application/x.aptos.signed_transaction+bcs"});return c}async function Kn(n){let{aptosConfig:e}=n,t=Ci({...n});try{let{data:r}=await st({aptosConfig:e,body:t,path:"transactions",originMethod:"submitTransaction",contentType:"application/x.aptos.signed_transaction+bcs"});return r}catch(r){let i=Xe.deserialize(new C(t));throw i.authenticator.isSingleSender()&&i.authenticator.sender.isSingleKey()&&(i.authenticator.sender.public_key.publicKey instanceof k||i.authenticator.sender.public_key.publicKey instanceof ee)&&await me.fetchJWK({aptosConfig:e,publicKey:i.authenticator.sender.public_key.publicKey,kid:i.authenticator.sender.signature.signature.getJwkKid()}),r}}async function ut(n){let{aptosConfig:e,signer:t,feePayer:r,transaction:i}=n;yr(t)&&await t.checkKeylessAccountValidity(e),yr(r)&&await r.checkKeylessAccountValidity(e);let o=n.feePayerAuthenticator||r&&Or({signer:r,transaction:i}),s=kr({signer:t,transaction:i});return Kn({aptosConfig:e,transaction:i,senderAuthenticator:s,feePayerAuthenticator:o})}async function Ps(n){let{aptosConfig:e,senderAuthenticator:t,feePayer:r,transaction:i}=n;yr(r)&&await r.checkKeylessAccountValidity(e);let o=Or({signer:r,transaction:i});return Kn({aptosConfig:e,transaction:i,senderAuthenticator:t,feePayerAuthenticator:o})}var Pu={typeParameters:[],parameters:[x.u8(),new x(x.u8())]};async function xs(n){let{aptosConfig:e,account:t,metadataBytes:r,moduleBytecode:i,options:o}=n,s=i.map(a=>S.U8(a));return T({aptosConfig:e,sender:_chunkPA2XFIP3js.Z.from(t),data:{function:"0x1::code::publish_package_txn",functionArguments:[S.U8(r),new S(s)],abi:Pu},options:o})}async function Dt(n){return _r(n)}async function Is(n){return rs(n)}async function Rr(n){return is(n)}async function Cs(n){let{aptosConfig:e,accountAddress:t,options:r}=n;return cr({aptosConfig:e,originMethod:"getTransactions",path:`accounts/${_chunkPA2XFIP3js.Z.from(t).toString()}/transactions`,params:{start:_optionalChain([r, 'optionalAccess', _118 => _118.offset]),limit:_optionalChain([r, 'optionalAccess', _119 => _119.limit])}})}async function Ks(n){let{aptosConfig:e,accountAddress:t,options:r}=n;return ur({aptosConfig:e,originMethod:"getResources",path:`accounts/${_chunkPA2XFIP3js.Z.from(t).toString()}/resources`,params:{ledger_version:_optionalChain([r, 'optionalAccess', _120 => _120.ledgerVersion]),offset:_optionalChain([r, 'optionalAccess', _121 => _121.offset]),limit:_nullishCoalesce(_optionalChain([r, 'optionalAccess', _122 => _122.limit]), () => (999))}})}async function Di(n){let{aptosConfig:e,accountAddress:t,resourceType:r,options:i}=n,{data:o}=await V({aptosConfig:e,originMethod:"getResource",path:`accounts/${_chunkPA2XFIP3js.Z.from(t).toString()}/resource/${r}`,params:{ledger_version:_optionalChain([i, 'optionalAccess', _123 => _123.ledgerVersion])}});return o.data}async function rn(n){let{aptosConfig:e,authenticationKey:t,options:r}=n,i=await Di({aptosConfig:e,accountAddress:"0x1",resourceType:"0x1::account::OriginatingAddress",options:r}),{address_map:{handle:o}}=i,s=_chunkPA2XFIP3js.Z.from(t);try{let a=await Er({aptosConfig:e,handle:o,data:{key:s.toString(),key_type:"address",value_type:"address"},options:r});return _chunkPA2XFIP3js.Z.from(a)}catch(a){if(a instanceof Z&&a.data.error_code==="table_item_not_found")return s;throw a}}async function Rs(n){let{aptosConfig:e,accountAddress:t}=n,i={owner_address:{_eq:_chunkPA2XFIP3js.Z.from(t).toStringLong()},amount:{_gt:0}},s=await b({aptosConfig:e,query:{query:Vo,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 Us(n){let{aptosConfig:e,accountAddress:t,options:r}=n,o={owner_address:{_eq:_chunkPA2XFIP3js.Z.from(t).toStringLong()},amount:{_gt:0}};_optionalChain([r, 'optionalAccess', _124 => _124.tokenStandard])&&(o.token_standard={_eq:_optionalChain([r, 'optionalAccess', _125 => _125.tokenStandard])});let s={query:Go,variables:{where_condition:o,offset:_optionalChain([r, 'optionalAccess', _126 => _126.offset]),limit:_optionalChain([r, 'optionalAccess', _127 => _127.limit]),order_by:_optionalChain([r, 'optionalAccess', _128 => _128.orderBy])}};return(await b({aptosConfig:e,query:s,originMethod:"getAccountOwnedTokens"})).current_token_ownerships_v2}async function Ds(n){let{aptosConfig:e,accountAddress:t,collectionAddress:r,options:i}=n,o=_chunkPA2XFIP3js.Z.from(t).toStringLong(),s=_chunkPA2XFIP3js.Z.from(r).toStringLong(),a={owner_address:{_eq:o},current_token_data:{collection_id:{_eq:s}},amount:{_gt:0}};_optionalChain([i, 'optionalAccess', _129 => _129.tokenStandard])&&(a.token_standard={_eq:_optionalChain([i, 'optionalAccess', _130 => _130.tokenStandard])});let c={query:Mo,variables:{where_condition:a,offset:_optionalChain([i, 'optionalAccess', _131 => _131.offset]),limit:_optionalChain([i, 'optionalAccess', _132 => _132.limit]),order_by:_optionalChain([i, 'optionalAccess', _133 => _133.orderBy])}};return(await b({aptosConfig:e,query:c,originMethod:"getAccountOwnedTokensFromCollectionAddress"})).current_token_ownerships_v2}async function zs(n){let{aptosConfig:e,accountAddress:t,options:r}=n,o={owner_address:{_eq:_chunkPA2XFIP3js.Z.from(t).toStringLong()}};_optionalChain([r, 'optionalAccess', _134 => _134.tokenStandard])&&(o.current_collection={token_standard:{_eq:_optionalChain([r, 'optionalAccess', _135 => _135.tokenStandard])}});let s={query:Bo,variables:{where_condition:o,offset:_optionalChain([r, 'optionalAccess', _136 => _136.offset]),limit:_optionalChain([r, 'optionalAccess', _137 => _137.limit]),order_by:_optionalChain([r, 'optionalAccess', _138 => _138.orderBy])}};return(await b({aptosConfig:e,query:s,originMethod:"getAccountCollectionsWithOwnedTokens"})).current_collection_ownership_v2_view}async function ks(n){let{aptosConfig:e,accountAddress:t}=n,r=_chunkPA2XFIP3js.Z.from(t).toStringLong(),o=await b({aptosConfig:e,query:{query:qo,variables:{address:r}},originMethod:"getAccountTransactionsCount"});return o.account_transactions_aggregate.aggregate?o.account_transactions_aggregate.aggregate.count:0}async function Os(n){let{aptosConfig:e,accountAddress:t,options:r}=n,i=_chunkPA2XFIP3js.Z.from(t).toStringLong(),o={..._optionalChain([r, 'optionalAccess', _139 => _139.where]),owner_address:{_eq:i}},s={query:No,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 b({aptosConfig:e,query:s,originMethod:"getAccountCoinsData"})).current_fungible_asset_balances}async function Fs(n){let{aptosConfig:e,accountAddress:t}=n,r=_chunkPA2XFIP3js.Z.from(t).toStringLong(),o=await b({aptosConfig:e,query:{query:Fo,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 Ns(n){let{aptosConfig:e,accountAddress:t,options:r}=n,o={owner_address:{_eq:_chunkPA2XFIP3js.Z.from(t).toStringLong()}},s={query:Tr,variables:{where_condition:o,offset:_optionalChain([r, 'optionalAccess', _143 => _143.offset]),limit:_optionalChain([r, 'optionalAccess', _144 => _144.limit]),order_by:_optionalChain([r, 'optionalAccess', _145 => _145.orderBy])}};return(await b({aptosConfig:e,query:s,originMethod:"getAccountOwnedObjects"})).current_objects}async function Bs(n){let{aptosConfig:e,privateKey:t}=n,r=new O(t.publicKey());if(t instanceof Be){let o=G.fromPublicKey({publicKey:r}).derivedAddress();return Ye.fromPrivateKey({privateKey:t,address:o})}if(t instanceof H){let i=G.fromPublicKey({publicKey:r});if(await vs({authKey:i,aptosConfig:e})){let c=i.derivedAddress();return Ye.fromPrivateKey({privateKey:t,address:c,legacy:!1})}let s=G.fromPublicKey({publicKey:r.publicKey});if(await vs({authKey:s,aptosConfig:e})){let c=s.derivedAddress();return Ye.fromPrivateKey({privateKey:t,address:c,legacy:!0})}}throw new Error(`Can't derive account from private key ${t}`)}async function vs(n){let{aptosConfig:e,authKey:t}=n,r=await rn({aptosConfig:e,authenticationKey:t.derivedAddress()});try{return await Dt({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()}`)}}var xu={typeParameters:[],parameters:[new le,x.u8(),new le,x.u8(),x.u8(),x.u8()]};async function Gs(n){let{aptosConfig:e,fromAccount:t,dangerouslySkipVerification:r}=n;if("toNewPrivateKey"in n)return Ui({aptosConfig:e,fromAccount:t,toNewPrivateKey:n.toNewPrivateKey});let i;if("toAccount"in n){if(n.toAccount instanceof ae)return Ui({aptosConfig:e,fromAccount:t,toNewPrivateKey:n.toAccount.privateKey});if(n.toAccount instanceof fr)return Ui({aptosConfig:e,fromAccount:t,toAccount:n.toAccount});i=n.toAccount.publicKey.authKey()}else if("toAuthKey"in n)i=n.toAuthKey;else throw new Error("Invalid arguments");let o=await Iu({aptosConfig:e,fromAccount:t,toAuthKey:i});if(r===!0)return o;let s=await ct({aptosConfig:e,transactionHash:o.hash});if(!s.success)throw new Error(`Failed to rotate authentication key - ${s}`);let a=await T({aptosConfig:e,sender:t.accountAddress,data:{function:"0x1::account::set_originating_address",functionArguments:[]}});return ut({aptosConfig:e,signer:n.toAccount,transaction:a})}async function Ui(n){let{aptosConfig:e,fromAccount:t}=n,r=await Dt({aptosConfig:e,accountAddress:t.accountAddress}),i;"toNewPrivateKey"in n?i=Ye.fromPrivateKey({privateKey:n.toNewPrivateKey,legacy:!0}):i=n.toAccount;let s=new gr({sequenceNumber:BigInt(r.sequence_number),originator:t.accountAddress,currentAuthKey:_chunkPA2XFIP3js.Z.from(r.authentication_key),newPublicKey:i.publicKey}).bcsToBytes(),a=t.sign(s),c=i.sign(s),d=await T({aptosConfig:e,sender:t.accountAddress,data:{function:"0x1::account::rotate_authentication_key",functionArguments:[new X(t.signingScheme),S.U8(t.publicKey.toUint8Array()),new X(i.signingScheme),S.U8(i.publicKey.toUint8Array()),S.U8(a.toUint8Array()),S.U8(c.toUint8Array())],abi:xu}});return ut({aptosConfig:e,signer:t,transaction:d})}var vu={typeParameters:[],parameters:[x.u8()]};async function Iu(n){let{aptosConfig:e,fromAccount:t,toAuthKey:r}=n,i=r,o=await T({aptosConfig:e,sender:t.accountAddress,data:{function:"0x1::account::rotate_authentication_key_call",functionArguments:[S.U8(i.toUint8Array())],abi:vu}});return ut({aptosConfig:e,signer:t,transaction:o})}async function _(n){n.minimumLedgerVersion!==void 0&&await vr({aptosConfig:n.config,minimumLedgerVersion:n.minimumLedgerVersion,processorType:n.processorType})}async function ce(n){let{aptosConfig:e,payload:t,options:r}=n,i=await Dr({...t,aptosConfig:e}),o=new _chunkPA2XFIP3js.m;i.serialize(o);let s=o.toUint8Array(),{data:a}=await st({aptosConfig:e,path:"view",originMethod:"view",contentType:"application/x.aptos.view_function+bcs",params:{ledger_version:_optionalChain([r, 'optionalAccess', _146 => _146.ledgerVersion])},body:s});return a}async function Ms(n){let{aptosConfig:e,payload:t,options:r}=n,{data:i}=await st({aptosConfig:e,originMethod:"viewJson",path:"view",params:{ledger_version:_optionalChain([r, 'optionalAccess', _147 => _147.ledgerVersion])},body:{function:t.function,type_arguments:_nullishCoalesce(t.typeArguments, () => ([])),arguments:_nullishCoalesce(t.functionArguments, () => ([]))}});return i}async function Vs(n){let{aptosConfig:e,sender:t,authenticationFunction:r,options:i}=n,{moduleAddress:o,moduleName:s,functionName:a}=_chunkPA2XFIP3js.ha.call(void 0, r);return T({aptosConfig:e,sender:t,data:{function:"0x1::account_abstraction::add_authentication_function",typeArguments:[],functionArguments:[o,s,a],abi:{typeParameters:[],parameters:[new F,new A(E()),new A(E())]}},options:i})}async function qs(n){let{aptosConfig:e,sender:t,authenticationFunction:r,options:i}=n,{moduleAddress:o,moduleName:s,functionName:a}=_chunkPA2XFIP3js.ha.call(void 0, r);return T({aptosConfig:e,sender:t,data:{function:"0x1::account_abstraction::remove_authentication_function",typeArguments:[],functionArguments:[o,s,a],abi:{typeParameters:[],parameters:[new F,new A(E()),new A(E())]}},options:i})}async function Ls(n){let{aptosConfig:e,sender:t,options:r}=n;return T({aptosConfig:e,sender:t,data:{function:"0x1::account_abstraction::remove_authenticator",typeArguments:[],functionArguments:[],abi:{typeParameters:[],parameters:[]}},options:r})}var zt=class{constructor(e){this.config=e;this.isAccountAbstractionEnabled=async e=>{let t=await this.getAuthenticationFunction(e),{moduleAddress:r,moduleName:i,functionName:o}=_chunkPA2XFIP3js.ha.call(void 0, e.authenticationFunction);return _nullishCoalesce(_optionalChain([t, 'optionalAccess', _148 => _148.some, 'call', _149 => _149(s=>_chunkPA2XFIP3js.Z.fromString(r).equals(s.moduleAddress)&&i===s.moduleName&&o===s.functionName)]), () => (!1))};this.enableAccountAbstractionTransaction=this.addAuthenticationFunctionTransaction;this.disableAccountAbstractionTransaction=async e=>{let{accountAddress:t,authenticationFunction:r,options:i}=e;return r?this.removeAuthenticationFunctionTransaction({accountAddress:t,authenticationFunction:r,options:i}):this.removeDispatchableAuthenticatorTransaction({accountAddress:t,options:i})}}async addAuthenticationFunctionTransaction(e){let{accountAddress:t,authenticationFunction:r,options:i}=e;return Vs({aptosConfig:this.config,authenticationFunction:r,sender:t,options:i})}async removeAuthenticationFunctionTransaction(e){let{accountAddress:t,authenticationFunction:r,options:i}=e;return qs({aptosConfig:this.config,sender:t,authenticationFunction:r,options:i})}async removeDispatchableAuthenticatorTransaction(e){let{accountAddress:t,options:r}=e;return Ls({aptosConfig:this.config,sender:t,options:r})}async getAuthenticationFunction(e){let{accountAddress:t}=e,[{vec:r}]=await ce({aptosConfig:this.config,payload:{function:"0x1::account_abstraction::dispatchable_authenticator",functionArguments:[_chunkPA2XFIP3js.Z.from(t)],abi:{typeParameters:[],parameters:[new F],returnTypes:[]}}});if(r.length!==0)return r[0].map(i=>({moduleAddress:_chunkPA2XFIP3js.Z.fromString(i.module_address),moduleName:i.module_name,functionName:i.function_name}))}};var Rn=class{constructor(e){this.config=e;this.abstraction=new zt(e)}async getAccountInfo(e){return Dt({aptosConfig:this.config,...e})}async getAccountModules(e){return Is({aptosConfig:this.config,...e})}async getAccountModule(e){return Rr({aptosConfig:this.config,...e})}async getAccountTransactions(e){return Cs({aptosConfig:this.config,...e})}async getAccountResources(e){return Ks({aptosConfig:this.config,...e})}async getAccountResource(e){return Di({aptosConfig:this.config,...e})}async lookupOriginalAccountAddress(e){return rn({aptosConfig:this.config,...e})}async getAccountTokensCount(e){return await _({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"account_transactions_processor"}),Rs({aptosConfig:this.config,...e})}async getAccountOwnedTokens(e){return await _({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),Us({aptosConfig:this.config,...e})}async getAccountOwnedTokensFromCollectionAddress(e){return await _({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),Ds({aptosConfig:this.config,...e})}async getAccountCollectionsWithOwnedTokens(e){return await _({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),zs({aptosConfig:this.config,...e})}async getAccountTransactionsCount(e){return await _({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"account_transactions_processor"}),ks({aptosConfig:this.config,...e})}async getAccountCoinsData(e){return await _({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"fungible_asset_processor"}),Os({aptosConfig:this.config,...e})}async getAccountCoinsCount(e){return await _({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"fungible_asset_processor"}),Fs({aptosConfig:this.config,...e})}async getAccountAPTAmount(e){return this.getAccountCoinAmount({coinType:Tt,faMetadataAddress:Ao,...e})}async getAccountCoinAmount(e){let{accountAddress:t,coinType:r,faMetadataAddress:i,minimumLedgerVersion:o}=e;o&&console.warn(`minimumLedgerVersion is not used anymore, here for backward
|
|
478
478
|
compatibility see https://github.com/aptos-labs/aptos-ts-sdk/pull/519,
|
|
479
|
-
will be removed in the near future`);let s=r;r===void 0&&i!==void 0&&(s=await Ke(async()=>{try{let d=(await ae({aptosConfig:this.config,payload:{function:"0x1::coin::paired_coin",functionArguments:[i]}})).at(0);if(d.vec.length>0&&_chunkRX5UBAMEjs.ga.call(void 0, d.vec[0]))return _chunkRX5UBAMEjs.fa.call(void 0, d.vec[0])}catch (e5){}},`coin-mapping-${i.toString()}`,1e3*60*5)());let a;if(r!==void 0&&i!==void 0)a=_chunkRX5UBAMEjs.Z.from(i).toStringLong();else if(r!==void 0&&i===void 0)r===ht?a=_chunkRX5UBAMEjs.Z.A.toStringLong():a=ar(_chunkRX5UBAMEjs.Z.A,r).toStringLong();else if(r===void 0&&i!==void 0){let d=_chunkRX5UBAMEjs.Z.from(i);a=d.toStringLong(),d===_chunkRX5UBAMEjs.Z.A&&(s=ht)}else throw new Error("Either coinType, faMetadataAddress, or both must be provided");if(s!==void 0){let[d]=await ae({aptosConfig:this.config,payload:{function:"0x1::coin::balance",typeArguments:[s],functionArguments:[t]}});return parseInt(d,10)}let[c]=await ae({aptosConfig:this.config,payload:{function:"0x1::primary_fungible_store::balance",typeArguments:["0x1::object::ObjectCore"],functionArguments:[t,a]}});return parseInt(c,10)}async getAccountOwnedObjects(e){return await S({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"default_processor"}),gs({aptosConfig:this.config,...e})}async deriveAccountFromPrivateKey(e){return ms({aptosConfig:this.config,...e})}};var _aptosclient = require('@aptos-labs/aptos-client'); var _aptosclient2 = _interopRequireDefault(_aptosclient);var Dr=class{constructor(e){this.network=_nullishCoalesce(_optionalChain([e, 'optionalAccess', _139 => _139.network]), () => ("devnet")),this.fullnode=_optionalChain([e, 'optionalAccess', _140 => _140.fullnode]),this.faucet=_optionalChain([e, 'optionalAccess', _141 => _141.faucet]),this.pepper=_optionalChain([e, 'optionalAccess', _142 => _142.pepper]),this.prover=_optionalChain([e, 'optionalAccess', _143 => _143.prover]),this.indexer=_optionalChain([e, 'optionalAccess', _144 => _144.indexer]),this.client=_nullishCoalesce(_optionalChain([e, 'optionalAccess', _145 => _145.client]), () => ({provider:_aptosclient2.default,binaryProvider:_aptosclient.bcsRequest})),this.clientConfig=_nullishCoalesce(_optionalChain([e, 'optionalAccess', _146 => _146.clientConfig]), () => ({})),this.fullnodeConfig=_nullishCoalesce(_optionalChain([e, 'optionalAccess', _147 => _147.fullnodeConfig]), () => ({})),this.indexerConfig=_nullishCoalesce(_optionalChain([e, 'optionalAccess', _148 => _148.indexerConfig]), () => ({})),this.faucetConfig=_nullishCoalesce(_optionalChain([e, 'optionalAccess', _149 => _149.faucetConfig]), () => ({}))}getRequestUrl(e){switch(e){case"Fullnode":if(this.fullnode!==void 0)return this.fullnode;if(this.network==="custom")throw new Error("Please provide a custom full node url");return co[this.network];case"Faucet":if(this.faucet!==void 0)return this.faucet;if(this.network==="testnet")throw new Error("There is no way to programmatically mint testnet APT, you must use the minting site at https://aptos.dev/network/faucet");if(this.network==="mainnet")throw new Error("There is no mainnet faucet");if(this.network==="custom")throw new Error("Please provide a custom faucet url");return uo[this.network];case"Indexer":if(this.indexer!==void 0)return this.indexer;if(this.network==="custom")throw new Error("Please provide a custom indexer url");return ao[this.network];case"Pepper":if(this.pepper!==void 0)return this.pepper;if(this.network==="custom")throw new Error("Please provide a custom pepper service url");return jr[this.network];case"Prover":if(this.prover!==void 0)return this.prover;if(this.network==="custom")throw new Error("Please provide a custom prover service url");return Jr[this.network];default:throw Error(`apiType ${e} is not supported`)}}isPepperServiceRequest(e){return jr[this.network]===e}isProverServiceRequest(e){return Jr[this.network]===e}};var xu={typeParameters:[{constraints:[]}],parameters:[new F,new j]};async function Vs(n){let{aptosConfig:e,sender:t,recipient:r,amount:i,coinType:o,options:s}=n;return w({aptosConfig:e,sender:t,data:{function:"0x1::aptos_account::transfer_coins",typeArguments:[_nullishCoalesce(o, () => (ht))],functionArguments:[r,i],abi:xu},options:s})}var Kn=class{constructor(e){this.config=e}async transferCoinTransaction(e){return Vs({aptosConfig:this.config,...e})}};var ct={BOOLEAN:"bool",U8:"u8",U16:"u16",U32:"u32",U64:"u64",U128:"u128",U256:"u256",ADDRESS:"address",STRING:"0x1::string::String",ARRAY:"vector<u8>"},be="0x4::token::Token";async function qs(n){let{aptosConfig:e,digitalAssetAddress:t}=n,r={token_data_id:{_eq:_chunkRX5UBAMEjs.Z.from(t).toStringLong()}};return(await T({aptosConfig:e,query:{query:Xo,variables:{where_condition:r}},originMethod:"getDigitalAssetData"})).current_token_datas_v2[0]}async function Ls(n){let{aptosConfig:e,digitalAssetAddress:t}=n,r={token_data_id:{_eq:_chunkRX5UBAMEjs.Z.from(t).toStringLong()},amount:{_gt:0}};return(await T({aptosConfig:e,query:{query:pi,variables:{where_condition:r}},originMethod:"getCurrentDigitalAssetOwnership"})).current_token_ownerships_v2[0]}async function Hs(n){let{aptosConfig:e,ownerAddress:t,options:r}=n,i={owner_address:{_eq:_chunkRX5UBAMEjs.Z.from(t).toStringLong()},amount:{_gt:0}},o={query:pi,variables:{where_condition:i,offset:_optionalChain([r, 'optionalAccess', _150 => _150.offset]),limit:_optionalChain([r, 'optionalAccess', _151 => _151.limit]),order_by:_optionalChain([r, 'optionalAccess', _152 => _152.orderBy])}};return(await T({aptosConfig:e,query:o,originMethod:"getOwnedDigitalAssets"})).current_token_ownerships_v2}async function $s(n){let{aptosConfig:e,digitalAssetAddress:t,options:r}=n,i={token_data_id:{_eq:_chunkRX5UBAMEjs.Z.from(t).toStringLong()}},o={query:Jo,variables:{where_condition:i,offset:_optionalChain([r, 'optionalAccess', _153 => _153.offset]),limit:_optionalChain([r, 'optionalAccess', _154 => _154.limit]),order_by:_optionalChain([r, 'optionalAccess', _155 => _155.orderBy])}};return(await T({aptosConfig:e,query:o,originMethod:"getDigitalAssetActivity"})).token_activities_v2}var Iu={typeParameters:[],parameters:[new A(E()),new j,new A(E()),new A(E()),new V,new V,new V,new V,new V,new V,new V,new V,new V,new j,new j]};async function Ws(n){let{aptosConfig:e,options:t,creator:r}=n;return w({aptosConfig:e,sender:r.accountAddress,data:{function:"0x4::aptos_token::create_collection",functionArguments:[new P(n.description),new W(_nullishCoalesce(n.maxSupply, () => (_chunkRX5UBAMEjs.e))),new P(n.name),new P(n.uri),new U(_nullishCoalesce(n.mutableDescription, () => (!0))),new U(_nullishCoalesce(n.mutableRoyalty, () => (!0))),new U(_nullishCoalesce(n.mutableURI, () => (!0))),new U(_nullishCoalesce(n.mutableTokenDescription, () => (!0))),new U(_nullishCoalesce(n.mutableTokenName, () => (!0))),new U(_nullishCoalesce(n.mutableTokenProperties, () => (!0))),new U(_nullishCoalesce(n.mutableTokenURI, () => (!0))),new U(_nullishCoalesce(n.tokensBurnableByCreator, () => (!0))),new U(_nullishCoalesce(n.tokensFreezableByCreator, () => (!0))),new W(_nullishCoalesce(n.royaltyNumerator, () => (0))),new W(_nullishCoalesce(n.royaltyDenominator, () => (1)))],abi:Iu},options:t})}async function tn(n){let{aptosConfig:e,options:t}=n,r=_optionalChain([t, 'optionalAccess', _156 => _156.where]);_optionalChain([t, 'optionalAccess', _157 => _157.tokenStandard])&&(r.token_standard={_eq:_nullishCoalesce(_optionalChain([t, 'optionalAccess', _158 => _158.tokenStandard]), () => ("v2"))});let i={query:Vo,variables:{where_condition:r,offset:_optionalChain([t, 'optionalAccess', _159 => _159.offset]),limit:_optionalChain([t, 'optionalAccess', _160 => _160.limit])}};return(await T({aptosConfig:e,query:i,originMethod:"getCollectionData"})).current_collections_v2[0]}async function Qs(n){let{aptosConfig:e,creatorAddress:t,collectionName:r,options:i}=n,o=_chunkRX5UBAMEjs.Z.from(t),s={collection_name:{_eq:r},creator_address:{_eq:o.toStringLong()}};return _optionalChain([i, 'optionalAccess', _161 => _161.tokenStandard])&&(s.token_standard={_eq:_nullishCoalesce(_optionalChain([i, 'optionalAccess', _162 => _162.tokenStandard]), () => ("v2"))}),tn({aptosConfig:e,options:{...i,where:s}})}async function js(n){let{aptosConfig:e,creatorAddress:t,options:r}=n,o={creator_address:{_eq:_chunkRX5UBAMEjs.Z.from(t).toStringLong()}};return _optionalChain([r, 'optionalAccess', _163 => _163.tokenStandard])&&(o.token_standard={_eq:_nullishCoalesce(_optionalChain([r, 'optionalAccess', _164 => _164.tokenStandard]), () => ("v2"))}),tn({aptosConfig:e,options:{...r,where:o}})}async function Js(n){let{aptosConfig:e,collectionId:t,options:r}=n,o={collection_id:{_eq:_chunkRX5UBAMEjs.Z.from(t).toStringLong()}};return _optionalChain([r, 'optionalAccess', _165 => _165.tokenStandard])&&(o.token_standard={_eq:_nullishCoalesce(_optionalChain([r, 'optionalAccess', _166 => _166.tokenStandard]), () => ("v2"))}),tn({aptosConfig:e,options:{...r,where:o}})}async function Xs(n){let{creatorAddress:e,collectionName:t,options:r,aptosConfig:i}=n,o=_chunkRX5UBAMEjs.Z.from(e),s={collection_name:{_eq:t},creator_address:{_eq:o.toStringLong()}};return _optionalChain([r, 'optionalAccess', _167 => _167.tokenStandard])&&(s.token_standard={_eq:_nullishCoalesce(_optionalChain([r, 'optionalAccess', _168 => _168.tokenStandard]), () => ("v2"))}),(await tn({aptosConfig:i,options:{where:s}})).collection_id}var vu={typeParameters:[],parameters:[new A(E()),new A(E()),new A(E()),new A(E()),new v(new A(E())),new v(new A(E())),new v(v.u8())]};async function Ys(n){let{aptosConfig:e,options:t,creator:r,collection:i,description:o,name:s,uri:a,propertyKeys:c,propertyTypes:d,propertyValues:l}=n,h=_optionalChain([d, 'optionalAccess', _169 => _169.map, 'call', _170 => _170(p=>ct[p])]);return w({aptosConfig:e,sender:r.accountAddress,data:{function:"0x4::aptos_token::mint",functionArguments:[new P(i),new P(o),new P(s),new P(a),_.MoveString(_nullishCoalesce(c, () => ([]))),_.MoveString(_nullishCoalesce(h, () => ([]))),la(_nullishCoalesce(l, () => ([])),_nullishCoalesce(h, () => ([])))],abi:vu},options:t})}var Cu={typeParameters:[{constraints:["key"]}],parameters:[new A(le(new G(0))),new F]};async function Zs(n){let{aptosConfig:e,sender:t,digitalAssetAddress:r,recipient:i,digitalAssetType:o,options:s}=n;return w({aptosConfig:e,sender:t.accountAddress,data:{function:"0x1::object::transfer",typeArguments:[_nullishCoalesce(o, () => (be))],functionArguments:[_chunkRX5UBAMEjs.Z.from(r),_chunkRX5UBAMEjs.Z.from(i)],abi:Cu},options:s})}var Ku={typeParameters:[],parameters:[new A(E()),new A(E()),new A(E()),new A(E()),new v(new A(E())),new v(new A(E())),new v(v.u8()),new F]};async function ea(n){let{aptosConfig:e,account:t,collection:r,description:i,name:o,uri:s,recipient:a,propertyKeys:c,propertyTypes:d,propertyValues:l,options:h}=n;if(_optionalChain([c, 'optionalAccess', _171 => _171.length])!==_optionalChain([l, 'optionalAccess', _172 => _172.length]))throw new Error("Property keys and property values counts do not match");if(_optionalChain([d, 'optionalAccess', _173 => _173.length])!==_optionalChain([l, 'optionalAccess', _174 => _174.length]))throw new Error("Property types and property values counts do not match");let p=_optionalChain([d, 'optionalAccess', _175 => _175.map, 'call', _176 => _176(g=>ct[g])]);return w({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::mint_soul_bound",functionArguments:[r,i,o,s,_.MoveString(_nullishCoalesce(c, () => ([]))),_.MoveString(_nullishCoalesce(p, () => ([]))),la(_nullishCoalesce(l, () => ([])),_nullishCoalesce(p, () => ([]))),a],abi:Ku},options:h})}var Ru={typeParameters:[{constraints:["key"]}],parameters:[new A(le(new G(0)))]};async function ta(n){let{aptosConfig:e,creator:t,digitalAssetAddress:r,digitalAssetType:i,options:o}=n;return w({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::burn",typeArguments:[_nullishCoalesce(i, () => (be))],functionArguments:[_chunkRX5UBAMEjs.Z.from(r)],abi:Ru},options:o})}var Uu={typeParameters:[{constraints:["key"]}],parameters:[new A(le(new G(0)))]};async function na(n){let{aptosConfig:e,creator:t,digitalAssetAddress:r,digitalAssetType:i,options:o}=n;return w({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::freeze_transfer",typeArguments:[_nullishCoalesce(i, () => (be))],functionArguments:[r],abi:Uu},options:o})}var Du={typeParameters:[{constraints:["key"]}],parameters:[new A(le(new G(0)))]};async function ra(n){let{aptosConfig:e,creator:t,digitalAssetAddress:r,digitalAssetType:i,options:o}=n;return w({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::unfreeze_transfer",typeArguments:[_nullishCoalesce(i, () => (be))],functionArguments:[r],abi:Du},options:o})}var zu={typeParameters:[{constraints:["key"]}],parameters:[new A(le(new G(0))),new A(E())]};async function ia(n){let{aptosConfig:e,creator:t,description:r,digitalAssetAddress:i,digitalAssetType:o,options:s}=n;return w({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::set_description",typeArguments:[_nullishCoalesce(o, () => (be))],functionArguments:[_chunkRX5UBAMEjs.Z.from(i),new P(r)],abi:zu},options:s})}var ku={typeParameters:[{constraints:["key"]}],parameters:[new A(le(new G(0))),new A(E())]};async function oa(n){let{aptosConfig:e,creator:t,name:r,digitalAssetAddress:i,digitalAssetType:o,options:s}=n;return w({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::set_name",typeArguments:[_nullishCoalesce(o, () => (be))],functionArguments:[_chunkRX5UBAMEjs.Z.from(i),new P(r)],abi:ku},options:s})}var Ou={typeParameters:[{constraints:["key"]}],parameters:[new A(le(new G(0))),new A(E())]};async function sa(n){let{aptosConfig:e,creator:t,uri:r,digitalAssetAddress:i,digitalAssetType:o,options:s}=n;return w({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::set_uri",typeArguments:[_nullishCoalesce(o, () => (be))],functionArguments:[_chunkRX5UBAMEjs.Z.from(i),new P(r)],abi:Ou},options:s})}var Fu={typeParameters:[{constraints:["key"]}],parameters:[new A(le(new G(0))),new A(E()),new A(E()),v.u8()]};async function aa(n){let{aptosConfig:e,creator:t,propertyKey:r,propertyType:i,propertyValue:o,digitalAssetAddress:s,digitalAssetType:a,options:c}=n;return w({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::add_property",typeArguments:[_nullishCoalesce(a, () => (be))],functionArguments:[_chunkRX5UBAMEjs.Z.from(s),new P(r),new P(ct[i]),_.U8(Ki(o,ct[i]))],abi:Fu},options:c})}var Nu={typeParameters:[{constraints:["key"]}],parameters:[new A(le(new G(0))),new A(E())]};async function ca(n){let{aptosConfig:e,creator:t,propertyKey:r,digitalAssetAddress:i,digitalAssetType:o,options:s}=n;return w({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::remove_property",typeArguments:[_nullishCoalesce(o, () => (be))],functionArguments:[_chunkRX5UBAMEjs.Z.from(i),new P(r)],abi:Nu},options:s})}var Gu={typeParameters:[{constraints:["key"]}],parameters:[new A(le(new G(0))),new A(E()),new A(E()),v.u8()]};async function ua(n){let{aptosConfig:e,creator:t,propertyKey:r,propertyType:i,propertyValue:o,digitalAssetAddress:s,digitalAssetType:a,options:c}=n;return w({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::update_property",typeArguments:[_nullishCoalesce(a, () => (be))],functionArguments:[_chunkRX5UBAMEjs.Z.from(s),new P(r),new P(ct[i]),Ki(o,ct[i])],abi:Gu},options:c})}var Bu={typeParameters:[{constraints:["key"]},{constraints:[]}],parameters:[new A(le(new G(0))),new A(E()),new G(1)]};async function da(n){let{aptosConfig:e,creator:t,propertyKey:r,propertyType:i,propertyValue:o,digitalAssetAddress:s,digitalAssetType:a,options:c}=n;return w({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::add_typed_property",typeArguments:[_nullishCoalesce(a, () => (be)),ct[i]],functionArguments:[_chunkRX5UBAMEjs.Z.from(s),new P(r),o],abi:Bu},options:c})}var Mu={typeParameters:[{constraints:["key"]},{constraints:[]}],parameters:[new A(le(new G(0))),new A(E()),new G(1)]};async function pa(n){let{aptosConfig:e,creator:t,propertyKey:r,propertyType:i,propertyValue:o,digitalAssetAddress:s,digitalAssetType:a,options:c}=n;return w({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::update_typed_property",typeArguments:[_nullishCoalesce(a, () => (be)),ct[i]],functionArguments:[_chunkRX5UBAMEjs.Z.from(s),new P(r),o],abi:Mu},options:c})}function la(n,e){let t=new Array;return e.forEach((r,i)=>{t.push(Ki(n[i],r))}),t}function Ki(n,e){let t=Fe(e);return Rt(n,t,0,[]).bcsToBytes()}var Rn=class{constructor(e){this.config=e}async getCollectionData(e){await S({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"});let{creatorAddress:t,collectionName:r,options:i}=e,o=_chunkRX5UBAMEjs.Z.from(t),s={collection_name:{_eq:r},creator_address:{_eq:o.toStringLong()}};return _optionalChain([i, 'optionalAccess', _177 => _177.tokenStandard])&&(s.token_standard={_eq:_nullishCoalesce(_optionalChain([i, 'optionalAccess', _178 => _178.tokenStandard]), () => ("v2"))}),tn({aptosConfig:this.config,options:{where:s}})}async getCollectionDataByCreatorAddressAndCollectionName(e){return await S({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),Qs({aptosConfig:this.config,...e})}async getCollectionDataByCreatorAddress(e){return await S({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),js({aptosConfig:this.config,...e})}async getCollectionDataByCollectionId(e){return await S({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),Js({aptosConfig:this.config,...e})}async getCollectionId(e){return await S({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),Xs({aptosConfig:this.config,...e})}async getDigitalAssetData(e){return await S({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),qs({aptosConfig:this.config,...e})}async getCurrentDigitalAssetOwnership(e){return await S({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),Ls({aptosConfig:this.config,...e})}async getOwnedDigitalAssets(e){return await S({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),Hs({aptosConfig:this.config,...e})}async getDigitalAssetActivity(e){return await S({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),$s({aptosConfig:this.config,...e})}async createCollectionTransaction(e){return Ws({aptosConfig:this.config,...e})}async mintDigitalAssetTransaction(e){return Ys({aptosConfig:this.config,...e})}async transferDigitalAssetTransaction(e){return Zs({aptosConfig:this.config,...e})}async mintSoulBoundTransaction(e){return ea({aptosConfig:this.config,...e})}async burnDigitalAssetTransaction(e){return ta({aptosConfig:this.config,...e})}async freezeDigitalAssetTransaferTransaction(e){return na({aptosConfig:this.config,...e})}async unfreezeDigitalAssetTransaferTransaction(e){return ra({aptosConfig:this.config,...e})}async setDigitalAssetDescriptionTransaction(e){return ia({aptosConfig:this.config,...e})}async setDigitalAssetNameTransaction(e){return oa({aptosConfig:this.config,...e})}async setDigitalAssetURITransaction(e){return sa({aptosConfig:this.config,...e})}async addDigitalAssetPropertyTransaction(e){return aa({aptosConfig:this.config,...e})}async removeDigitalAssetPropertyTransaction(e){return ca({aptosConfig:this.config,...e})}async updateDigitalAssetPropertyTransaction(e){return ua({aptosConfig:this.config,...e})}async addDigitalAssetTypedPropertyTransaction(e){return da({aptosConfig:this.config,...e})}async updateDigitalAssetTypedPropertyTransaction(e){return pa({aptosConfig:this.config,...e})}};var ga=300,Vu=n=>{if(n&&n.length>ga)throw new Error(`Event type length exceeds the maximum length of ${ga}`)};async function ma(n){let{aptosConfig:e,eventType:t,options:r}=n,i={_or:[{account_address:{_eq:t.split("::")[0]}},{account_address:{_eq:"0x0000000000000000000000000000000000000000000000000000000000000000"},sequence_number:{_eq:0},creation_number:{_eq:0}}],indexed_type:{_eq:t}};return Un({aptosConfig:e,options:{...r,where:i}})}async function ya(n){let{accountAddress:e,aptosConfig:t,creationNumber:r,options:i}=n,s={account_address:{_eq:_chunkRX5UBAMEjs.Z.from(e).toStringLong()},creation_number:{_eq:r}};return Un({aptosConfig:t,options:{...i,where:s}})}async function fa(n){let{accountAddress:e,aptosConfig:t,eventType:r,options:i}=n,s={account_address:{_eq:_chunkRX5UBAMEjs.Z.from(e).toStringLong()},indexed_type:{_eq:r}};return Un({aptosConfig:t,options:{...i,where:s}})}async function Un(n){let{aptosConfig:e,options:t}=n;Vu(_optionalChain([t, 'optionalAccess', _179 => _179.where, 'optionalAccess', _180 => _180.indexed_type, 'optionalAccess', _181 => _181._eq]));let r={query:Ho,variables:{where_condition:_optionalChain([t, 'optionalAccess', _182 => _182.where]),offset:_optionalChain([t, 'optionalAccess', _183 => _183.offset]),limit:_optionalChain([t, 'optionalAccess', _184 => _184.limit]),order_by:_optionalChain([t, 'optionalAccess', _185 => _185.orderBy])}};return(await T({aptosConfig:e,query:r,originMethod:"getEvents"})).events}var Dn=class{constructor(e){this.config=e}async getModuleEventsByEventType(e){return await S({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"events_processor"}),ma({aptosConfig:this.config,...e})}async getAccountEventsByCreationNumber(e){return await S({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"events_processor"}),ya({aptosConfig:this.config,...e})}async getAccountEventsByEventType(e){return await S({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"events_processor"}),fa({aptosConfig:this.config,...e})}async getEvents(e){return await S({config:this.config,minimumLedgerVersion:_optionalChain([e, 'optionalAccess', _186 => _186.minimumLedgerVersion]),processorType:"events_processor"}),Un({aptosConfig:this.config,...e})}};async function Aa(n){let{aptosConfig:e,accountAddress:t,amount:r,options:i}=n,o=_optionalChain([i, 'optionalAccess', _187 => _187.timeoutSecs])||20,{data:s}=await bo({aptosConfig:e,path:"fund",body:{address:_chunkRX5UBAMEjs.Z.from(t).toString(),amount:r},originMethod:"fundAccount"}),a=s.txn_hashes[0],c=await Yt({aptosConfig:e,transactionHash:a,options:{timeoutSecs:o,checkSuccess:_optionalChain([i, 'optionalAccess', _188 => _188.checkSuccess])}});if(c.type==="user_transaction")return c;throw new Error(`Unexpected transaction received for fund account: ${c.type}`)}var zn=class{constructor(e){this.config=e}async fundAccount(e){let t=await Aa({aptosConfig:this.config,...e});return(_optionalChain([e, 'access', _189 => _189.options, 'optionalAccess', _190 => _190.waitForIndexer])===void 0||_optionalChain([e, 'access', _191 => _191.options, 'optionalAccess', _192 => _192.waitForIndexer]))&&await _r({aptosConfig:this.config,minimumLedgerVersion:BigInt(t.version),processorType:"fungible_asset_processor"}),t}};async function zr(n){let{aptosConfig:e,options:t}=n,r={query:Wo,variables:{where_condition:_optionalChain([t, 'optionalAccess', _193 => _193.where]),limit:_optionalChain([t, 'optionalAccess', _194 => _194.limit]),offset:_optionalChain([t, 'optionalAccess', _195 => _195.offset])}};return(await T({aptosConfig:e,query:r,originMethod:"getFungibleAssetMetadata"})).fungible_asset_metadata}async function ha(n){let{aptosConfig:e,options:t}=n,r={query:$o,variables:{where_condition:_optionalChain([t, 'optionalAccess', _196 => _196.where]),limit:_optionalChain([t, 'optionalAccess', _197 => _197.limit]),offset:_optionalChain([t, 'optionalAccess', _198 => _198.offset])}};return(await T({aptosConfig:e,query:r,originMethod:"getFungibleAssetActivities"})).fungible_asset_activities}async function Ta(n){let{aptosConfig:e,options:t}=n,r={query:qo,variables:{where_condition:_optionalChain([t, 'optionalAccess', _199 => _199.where]),limit:_optionalChain([t, 'optionalAccess', _200 => _200.limit]),offset:_optionalChain([t, 'optionalAccess', _201 => _201.offset])}};return(await T({aptosConfig:e,query:r,originMethod:"getCurrentFungibleAssetBalances"})).current_fungible_asset_balances}var qu={typeParameters:[{constraints:[]}],parameters:[Fe("0x1::object::Object"),new F,new j]};async function ba(n){let{aptosConfig:e,sender:t,fungibleAssetMetadataAddress:r,recipient:i,amount:o,options:s}=n;return w({aptosConfig:e,sender:t.accountAddress,data:{function:"0x1::primary_fungible_store::transfer",typeArguments:["0x1::fungible_asset::Metadata"],functionArguments:[r,i,o],abi:qu},options:s})}var kn=class{constructor(e){this.config=e}async getFungibleAssetMetadata(e){return await S({config:this.config,minimumLedgerVersion:_optionalChain([e, 'optionalAccess', _202 => _202.minimumLedgerVersion]),processorType:"fungible_asset_processor"}),zr({aptosConfig:this.config,...e})}async getFungibleAssetMetadataByAssetType(e){return await S({config:this.config,minimumLedgerVersion:_optionalChain([e, 'optionalAccess', _203 => _203.minimumLedgerVersion]),processorType:"fungible_asset_processor"}),(await zr({aptosConfig:this.config,options:{where:{asset_type:{_eq:e.assetType}}}}))[0]}async getFungibleAssetMetadataByCreatorAddress(e){return await S({config:this.config,minimumLedgerVersion:_optionalChain([e, 'optionalAccess', _204 => _204.minimumLedgerVersion]),processorType:"fungible_asset_processor"}),await zr({aptosConfig:this.config,options:{where:{creator_address:{_eq:_chunkRX5UBAMEjs.Z.from(e.creatorAddress).toStringLong()}}}})}async getFungibleAssetActivities(e){return await S({config:this.config,minimumLedgerVersion:_optionalChain([e, 'optionalAccess', _205 => _205.minimumLedgerVersion]),processorType:"fungible_asset_processor"}),ha({aptosConfig:this.config,...e})}async getCurrentFungibleAssetBalances(e){return await S({config:this.config,minimumLedgerVersion:_optionalChain([e, 'optionalAccess', _206 => _206.minimumLedgerVersion]),processorType:"fungible_asset_processor"}),Ta({aptosConfig:this.config,...e})}async transferFungibleAsset(e){return ba({aptosConfig:this.config,...e})}};var On=class{constructor(e){this.config=e}async getLedgerInfo(){return fr({aptosConfig:this.config})}async getChainId(){return(await this.getLedgerInfo()).chain_id}async getBlockByVersion(e){return As({aptosConfig:this.config,...e})}async getBlockByHeight(e){return hs({aptosConfig:this.config,...e})}async view(e){return ae({aptosConfig:this.config,...e})}async viewJson(e){return zs({aptosConfig:this.config,...e})}async getChainTopUserTransactions(e){return Yo({aptosConfig:this.config,...e})}async queryIndexer(e){return T({aptosConfig:this.config,...e})}async getIndexerLastSuccessVersion(){return Ar({aptosConfig:this.config})}async getProcessorStatus(e){return hr({aptosConfig:this.config,processorType:e})}};var wa=["A name must be between 3 and 63 characters long,","and can only contain lowercase a-z, 0-9, and hyphens.","A name may not start or end with a hyphen."].join(" ");function Sa(n){return!(!n||n.length<3||n.length>63||!/^[a-z\d][a-z\d-]{1,61}[a-z\d]$/.test(n))}function ut(n){let[e,t,...r]=n.replace(/\.apt$/,"").split(".");if(r.length>0)throw new Error(`${n} is invalid. A name can only have two parts, a domain and a subdomain separated by a "."`);if(!Sa(e))throw new Error(`${e} is not valid. ${wa}`);if(t&&!Sa(t))throw new Error(`${t} is not valid. ${wa}`);return{domainName:t||e,subdomainName:t?e:void 0}}function _a(n){if(!n)return!1;let e=new Date(n.domain_expiration_timestamp).getTime()<Date.now(),t=new Date(n.expiration_timestamp).getTime()<Date.now();return n.subdomain&&e?!1:n.subdomain&&n.subdomain_expiration_policy===1?!0:!t}var Lu="0x585fc9f0f0c54183b039ffc770ca282ebd87307916c215a3e692f2f8e4305e82",Hu={testnet:"0x5f8fd2347449685cf41d4db97926ec3a096eaf381332be4f1318ad4d16a8497c",mainnet:"0x867ed1f6bf916171b1de3ee92849b8978b7d1b9e0a8cc982a3d19d535dfd9c0c",local:Lu,custom:null,devnet:null};function tt(n){let e=Hu[n.network];if(!e)throw new Error(`The ANS contract is not deployed to ${n.network}`);return e}var kr=n=>{if(n&&typeof n=="object"&&"vec"in n&&Array.isArray(n.vec))return n.vec[0]};async function Ea(n){let{aptosConfig:e,name:t}=n,r=tt(e),{domainName:i,subdomainName:o}=ut(t),s=await ae({aptosConfig:e,payload:{function:`${r}::router::get_owner_addr`,functionArguments:[i,o]}}),a=kr(s[0]);return a?_chunkRX5UBAMEjs.Z.from(a):void 0}async function Pa(n){let{aptosConfig:e,expiration:t,name:r,sender:i,targetAddress:o,toAddress:s,options:a,transferable:c}=n,d=tt(e),{domainName:l,subdomainName:h}=ut(r),p=t.policy==="subdomain:independent"||t.policy==="subdomain:follow-domain";if(h&&!p)throw new Error("Subdomains must have an expiration policy of either 'subdomain:independent' or 'subdomain:follow-domain'");if(p&&!h)throw new Error(`Policy is set to ${t.policy} but no subdomain was provided`);if(t.policy==="domain"){let ee=_nullishCoalesce(t.years, () => (1));if(ee!==1)throw new Error("For now, names can only be registered for 1 year at a time");let Dt=ee*31536e3;return await w({aptosConfig:e,sender:i.accountAddress.toString(),data:{function:`${d}::router::register_domain`,functionArguments:[l,Dt,o,s]},options:a})}if(!h)throw new Error(`${t.policy} requires a subdomain to be provided.`);let g=await Ri({aptosConfig:e,name:l});if(!g)throw new Error("The domain does not exist");let b=t.policy==="subdomain:independent"?t.expirationDate:g;if(b>g)throw new Error("The subdomain expiration time cannot be greater than the domain expiration time");return await w({aptosConfig:e,sender:i.accountAddress.toString(),data:{function:`${d}::router::register_subdomain`,functionArguments:[l,h,Math.round(b/1e3),t.policy==="subdomain:follow-domain"?1:0,!!c,o,s]},options:a})}async function Ri(n){let{aptosConfig:e,name:t}=n,r=tt(e),{domainName:i,subdomainName:o}=ut(t);try{let s=await ae({aptosConfig:e,payload:{function:`${r}::router::get_expiration`,functionArguments:[i,o]}});return Number(s[0])*1e3}catch (e6){return}}async function xa(n){let{aptosConfig:e,address:t}=n,r=tt(e),i=await ae({aptosConfig:e,payload:{function:`${r}::router::get_primary_name`,functionArguments:[_chunkRX5UBAMEjs.Z.from(t).toString()]}}),o=kr(i[1]),s=kr(i[0]);if(o)return[s,o].filter(Boolean).join(".")}async function Ia(n){let{aptosConfig:e,sender:t,name:r,options:i}=n,o=tt(e);if(!r)return await w({aptosConfig:e,sender:t.accountAddress.toString(),data:{function:`${o}::router::clear_primary_name`,functionArguments:[]},options:i});let{domainName:s,subdomainName:a}=ut(r);return await w({aptosConfig:e,sender:t.accountAddress.toString(),data:{function:`${o}::router::set_primary_name`,functionArguments:[s,a]},options:i})}async function va(n){let{aptosConfig:e,name:t}=n,r=tt(e),{domainName:i,subdomainName:o}=ut(t),s=await ae({aptosConfig:e,payload:{function:`${r}::router::get_target_addr`,functionArguments:[i,o]}}),a=kr(s[0]);return a?_chunkRX5UBAMEjs.Z.from(a):void 0}async function Ca(n){let{aptosConfig:e,sender:t,name:r,address:i,options:o}=n,s=tt(e),{domainName:a,subdomainName:c}=ut(r);return await w({aptosConfig:e,sender:t.accountAddress.toString(),data:{function:`${s}::router::set_target_addr`,functionArguments:[a,c,i]},options:o})}async function Ka(n){let{aptosConfig:e,name:t}=n,{domainName:r,subdomainName:i=""}=ut(t),a=(await T({aptosConfig:e,query:{query:Jt,variables:{where_condition:{domain:{_eq:r},subdomain:{_eq:i}},limit:1}},originMethod:"getName"})).current_aptos_names[0];return a&&(a=Fn(a)),_a(a)?a:void 0}async function Ra(n){let{aptosConfig:e,options:t,accountAddress:r}=n,i=await Ui({aptosConfig:e});return(await T({aptosConfig:e,originMethod:"getAccountNames",query:{query:Jt,variables:{limit:_optionalChain([t, 'optionalAccess', _207 => _207.limit]),offset:_optionalChain([t, 'optionalAccess', _208 => _208.offset]),order_by:_optionalChain([t, 'optionalAccess', _209 => _209.orderBy]),where_condition:{..._nullishCoalesce(_optionalChain([n, 'access', _210 => _210.options, 'optionalAccess', _211 => _211.where]), () => ({})),owner_address:{_eq:r.toString()},expiration_timestamp:{_gte:i}}}}})).current_aptos_names.map(Fn)}async function Ua(n){let{aptosConfig:e,options:t,accountAddress:r}=n,i=await Ui({aptosConfig:e});return(await T({aptosConfig:e,originMethod:"getAccountDomains",query:{query:Jt,variables:{limit:_optionalChain([t, 'optionalAccess', _212 => _212.limit]),offset:_optionalChain([t, 'optionalAccess', _213 => _213.offset]),order_by:_optionalChain([t, 'optionalAccess', _214 => _214.orderBy]),where_condition:{..._nullishCoalesce(_optionalChain([n, 'access', _215 => _215.options, 'optionalAccess', _216 => _216.where]), () => ({})),owner_address:{_eq:r.toString()},expiration_timestamp:{_gte:i},subdomain:{_eq:""}}}}})).current_aptos_names.map(Fn)}async function Da(n){let{aptosConfig:e,options:t,accountAddress:r}=n,i=await Ui({aptosConfig:e});return(await T({aptosConfig:e,originMethod:"getAccountSubdomains",query:{query:Jt,variables:{limit:_optionalChain([t, 'optionalAccess', _217 => _217.limit]),offset:_optionalChain([t, 'optionalAccess', _218 => _218.offset]),order_by:_optionalChain([t, 'optionalAccess', _219 => _219.orderBy]),where_condition:{..._nullishCoalesce(_optionalChain([n, 'access', _220 => _220.options, 'optionalAccess', _221 => _221.where]), () => ({})),owner_address:{_eq:r.toString()},expiration_timestamp:{_gte:i},subdomain:{_neq:""}}}}})).current_aptos_names.map(Fn)}async function za(n){let{aptosConfig:e,options:t,domain:r}=n;return(await T({aptosConfig:e,originMethod:"getDomainSubdomains",query:{query:Jt,variables:{limit:_optionalChain([t, 'optionalAccess', _222 => _222.limit]),offset:_optionalChain([t, 'optionalAccess', _223 => _223.offset]),order_by:_optionalChain([t, 'optionalAccess', _224 => _224.orderBy]),where_condition:{..._nullishCoalesce(_optionalChain([n, 'access', _225 => _225.options, 'optionalAccess', _226 => _226.where]), () => ({})),domain:{_eq:r},subdomain:{_neq:""}}}}})).current_aptos_names.map(Fn).filter(_a)}async function Ui(n){let{aptosConfig:e}=n,t=tt(e),[r]=await ae({aptosConfig:e,payload:{function:`${t}::config::reregistration_grace_sec`,functionArguments:[]}}),i=r/60/60/24,o=()=>new Date;return new Date(o().setDate(o().getDate()-i)).toISOString()}async function ka(n){let{aptosConfig:e,sender:t,name:r,years:i=1,options:o}=n,s=tt(e),a=i*31536e3,{domainName:c,subdomainName:d}=ut(r);if(d)throw new Error("Subdomains cannot be renewed");if(i!==1)throw new Error("Currently, only 1 year renewals are supported");return await w({aptosConfig:e,sender:t.accountAddress.toString(),data:{function:`${s}::router::renew_domain`,functionArguments:[c,a]},options:o})}function Fn(n){return{...n,expiration_timestamp:new Date(n.expiration_timestamp).getTime()}}var Nn=class{constructor(e){this.config=e}async getOwnerAddress(e){return Ea({aptosConfig:this.config,...e})}async getExpiration(e){return Ri({aptosConfig:this.config,...e})}async getTargetAddress(e){return va({aptosConfig:this.config,...e})}async setTargetAddress(e){return Ca({aptosConfig:this.config,...e})}async getPrimaryName(e){return xa({aptosConfig:this.config,...e})}async setPrimaryName(e){return Ia({aptosConfig:this.config,...e})}async registerName(e){return Pa({aptosConfig:this.config,...e})}async renewDomain(e){return ka({aptosConfig:this.config,...e})}async getName(e){return Ka({aptosConfig:this.config,...e})}async getAccountNames(e){return Ra({aptosConfig:this.config,...e})}async getAccountDomains(e){return Ua({aptosConfig:this.config,...e})}async getAccountSubdomains(e){return Da({aptosConfig:this.config,...e})}async getDomainSubdomains(e){return za({aptosConfig:this.config,...e})}};async function Oa(n){let{aptosConfig:e,poolAddress:t}=n,r=_chunkRX5UBAMEjs.Z.from(t).toStringLong(),o=await T({aptosConfig:e,query:{query:ui,variables:{where_condition:{pool_address:{_eq:r}}}}});return o.num_active_delegator_per_pool[0]?o.num_active_delegator_per_pool[0].num_active_delegator:0}async function Fa(n){let{aptosConfig:e,options:t}=n,r={query:ui,variables:{order_by:_optionalChain([t, 'optionalAccess', _227 => _227.orderBy])}};return(await T({aptosConfig:e,query:r})).num_active_delegator_per_pool}async function Na(n){let{aptosConfig:e,delegatorAddress:t,poolAddress:r}=n,i={query:Lo,variables:{delegatorAddress:_chunkRX5UBAMEjs.Z.from(t).toStringLong(),poolAddress:_chunkRX5UBAMEjs.Z.from(r).toStringLong()}};return(await T({aptosConfig:e,query:i})).delegated_staking_activities}var Gn=class{constructor(e){this.config=e}async getNumberOfDelegators(e){return await S({config:this.config,minimumLedgerVersion:_optionalChain([e, 'optionalAccess', _228 => _228.minimumLedgerVersion]),processorType:"stake_processor"}),Oa({aptosConfig:this.config,...e})}async getNumberOfDelegatorsForAllPools(e){return await S({config:this.config,minimumLedgerVersion:_optionalChain([e, 'optionalAccess', _229 => _229.minimumLedgerVersion]),processorType:"stake_processor"}),Fa({aptosConfig:this.config,...e})}async getDelegatedStakingActivities(e){return await S({config:this.config,minimumLedgerVersion:_optionalChain([e, 'optionalAccess', _230 => _230.minimumLedgerVersion]),processorType:"stake_processor"}),Na({aptosConfig:this.config,...e})}};var Or=class{constructor(e){this.config=e}async simple(e){return w({aptosConfig:this.config,...e})}async scriptComposer(e){let t=new Kr(this.config);await t.init();let i=(await e.builder(t)).build(),o=await Pi({aptosConfig:this.config,payload:St.load(new C(i)),...e});return new $t(o,e.withFeePayer===!0?_chunkRX5UBAMEjs.Z.ZERO:void 0)}async multiAgent(e){return w({aptosConfig:this.config,...e})}};function Di(n,e,t){let r=t.value;return t.value=async function(...i){let[o]=i;if(o.transaction.feePayerAddress&&!o.feePayerAuthenticator)throw new Error("You are submitting a Fee Payer transaction but missing the feePayerAuthenticator");return r.apply(this,i)},t}function zi(n,e,t){let r=t.value;return t.value=async function(...i){return r.apply(this,i)},t}var nn=class{constructor(e){this.config=e}async simple(e){return Ci({aptosConfig:this.config,...e})}async multiAgent(e){return Ci({aptosConfig:this.config,...e})}};_chunkRX5UBAMEjs.a.call(void 0, [zi],nn.prototype,"simple",1),_chunkRX5UBAMEjs.a.call(void 0, [zi],nn.prototype,"multiAgent",1);var rn=class{constructor(e){this.config=e}async simple(e){return In({aptosConfig:this.config,...e})}async multiAgent(e){return In({aptosConfig:this.config,...e})}};_chunkRX5UBAMEjs.a.call(void 0, [Di],rn.prototype,"simple",1),_chunkRX5UBAMEjs.a.call(void 0, [Di],rn.prototype,"multiAgent",1);var Fr=class{constructor(e,t,r,i,o){this.lastUncommintedNumber=null;this.currentNumber=null;this.lock=!1;this.aptosConfig=e,this.account=t,this.maxWaitTime=r,this.maximumInFlight=i,this.sleepTime=o}async nextSequenceNumber(){for(;this.lock;)await _chunkRX5UBAMEjs._.call(void 0, this.sleepTime);this.lock=!0;let e=BigInt(0);try{if((this.lastUncommintedNumber===null||this.currentNumber===null)&&await this.initialize(),this.currentNumber-this.lastUncommintedNumber>=this.maximumInFlight){await this.update();let t=_chunkRX5UBAMEjs.aa.call(void 0, );for(;this.currentNumber-this.lastUncommintedNumber>=this.maximumInFlight;)await _chunkRX5UBAMEjs._.call(void 0, this.sleepTime),_chunkRX5UBAMEjs.aa.call(void 0, )-t>this.maxWaitTime?(console.warn(`Waited over 30 seconds for a transaction to commit, re-syncing ${this.account.accountAddress.toString()}`),await this.initialize()):await this.update()}e=this.currentNumber,this.currentNumber+=BigInt(1)}catch(t){console.error("error in getting next sequence number for this account",t)}finally{this.lock=!1}return e}async initialize(){let{sequence_number:e}=await Oe({aptosConfig:this.aptosConfig,accountAddress:this.account.accountAddress});this.currentNumber=BigInt(e),this.lastUncommintedNumber=BigInt(e)}async update(){let{sequence_number:e}=await Oe({aptosConfig:this.aptosConfig,accountAddress:this.account.accountAddress});return this.lastUncommintedNumber=BigInt(e),this.lastUncommintedNumber}async synchronize(){if(this.lastUncommintedNumber!==this.currentNumber){for(;this.lock;)await _chunkRX5UBAMEjs._.call(void 0, this.sleepTime);this.lock=!0;try{await this.update();let e=_chunkRX5UBAMEjs.aa.call(void 0, );for(;this.lastUncommintedNumber!==this.currentNumber;)_chunkRX5UBAMEjs.aa.call(void 0, )-e>this.maxWaitTime?(console.warn(`Waited over 30 seconds for a transaction to commit, re-syncing ${this.account.accountAddress.toString()}`),await this.initialize()):(await _chunkRX5UBAMEjs._.call(void 0, this.sleepTime),await this.update())}catch(e){console.error("error in synchronizing this account sequence number with the one on chain",e)}finally{this.lock=!1}}}};var on=class{constructor(){this.queue=[];this.pendingDequeue=[];this.cancelled=!1}enqueue(e){if(this.cancelled=!1,this.pendingDequeue.length>0){_optionalChain([this, 'access', _231 => _231.pendingDequeue, 'access', _232 => _232.shift, 'call', _233 => _233(), 'optionalAccess', _234 => _234.resolve, 'call', _235 => _235(e)]);return}this.queue.push(e)}async dequeue(){return this.queue.length>0?Promise.resolve(this.queue.shift()):new Promise((e,t)=>{this.pendingDequeue.push({resolve:e,reject:t})})}isEmpty(){return this.queue.length===0}cancel(){this.cancelled=!0,this.pendingDequeue.forEach(async({reject:e})=>{e(new sn("Task cancelled"))}),this.pendingDequeue=[],this.queue.length=0}isCancelled(){return this.cancelled}pendingDequeueLength(){return this.pendingDequeue.length}},sn=class extends Error{};var Ga="fulfilled",Ba= exports.TransactionWorkerEventsEnum =(o=>(o.TransactionSent="transactionSent",o.TransactionSendFailed="transactionSendFailed",o.TransactionExecuted="transactionExecuted",o.TransactionExecutionFailed="transactionExecutionFailed",o.ExecutionFinish="executionFinish",o))(Ba||{}),Nr= exports.TransactionWorker =class extends _eventemitter32.default{constructor(t,r,i=30,o=100,s=10){super();this.taskQueue=new on;this.transactionsQueue=new on;this.outstandingTransactions=new on;this.sentTransactions=[];this.executedTransactions=[];this.aptosConfig=t,this.account=r,this.started=!1,this.accountSequnceNumber=new Fr(t,r,i,o,s)}async submitNextTransaction(){try{for(;;){let t=await this.accountSequnceNumber.nextSequenceNumber();if(t===null)return;let r=await this.generateNextTransaction(this.account,t);if(!r)return;let i=vn({aptosConfig:this.aptosConfig,transaction:r,signer:this.account});await this.outstandingTransactions.enqueue([i,t])}}catch(t){if(t instanceof sn)return;throw new Error(`Submit transaction failed for ${this.account.accountAddress.toString()} with error ${t}`)}}async processTransactions(){try{for(;;){let t=[],r=[],[i,o]=await this.outstandingTransactions.dequeue();for(t.push(i),r.push(o);!this.outstandingTransactions.isEmpty();)[i,o]=await this.outstandingTransactions.dequeue(),t.push(i),r.push(o);let s=await Promise.allSettled(t);for(let a=0;a<s.length&&a<r.length;a+=1){let c=s[a];o=r[a],c.status===Ga?(this.sentTransactions.push([c.value.hash,o,null]),this.emit("transactionSent",{message:`transaction hash ${c.value.hash} has been committed to chain`,transactionHash:c.value.hash}),await this.checkTransaction(c,o)):(this.sentTransactions.push([c.status,o,c.reason]),this.emit("transactionSendFailed",{message:`failed to commit transaction ${this.sentTransactions.length} with error ${c.reason}`,error:c.reason}))}this.emit("executionFinish",{message:`execute ${s.length} transactions finished`})}}catch(t){if(t instanceof sn)return;throw new Error(`Process execution failed for ${this.account.accountAddress.toString()} with error ${t}`)}}async checkTransaction(t,r){try{let i=[];i.push(Yt({aptosConfig:this.aptosConfig,transactionHash:t.value.hash}));let o=await Promise.allSettled(i);for(let s=0;s<o.length;s+=1){let a=o[s];a.status===Ga?(this.executedTransactions.push([a.value.hash,r,null]),this.emit("transactionExecuted",{message:`transaction hash ${a.value.hash} has been executed on chain`,transactionHash:t.value.hash})):(this.executedTransactions.push([a.status,r,a.reason]),this.emit("transactionExecutionFailed",{message:`failed to execute transaction ${this.executedTransactions.length} with error ${a.reason}`,error:a.reason}))}}catch(i){throw new Error(`Check transaction failed for ${this.account.accountAddress.toString()} with error ${i}`)}}async push(t,r){this.transactionsQueue.enqueue([t,r])}async generateNextTransaction(t,r){if(this.transactionsQueue.isEmpty())return;let[i,o]=await this.transactionsQueue.dequeue();return w({aptosConfig:this.aptosConfig,sender:t.accountAddress,data:i,options:{...o,accountSequenceNumber:r}})}async run(){try{for(;!this.taskQueue.isCancelled();)await(await this.taskQueue.dequeue())()}catch(t){throw new Error(`Unable to start transaction batching: ${t}`)}}start(){if(this.started)throw new Error("worker has already started");this.started=!0,this.taskQueue.enqueue(()=>this.submitNextTransaction()),this.taskQueue.enqueue(()=>this.processTransactions()),this.run()}stop(){if(this.taskQueue.isCancelled())throw new Error("worker has already stopped");this.started=!1,this.taskQueue.cancel()}};var Gr=class extends _eventemitter32.default{constructor(e){super(),this.config=e}start(e){let{sender:t}=e;this.account=t,this.transactionWorker=new Nr(this.config,t),this.transactionWorker.start(),this.registerToEvents()}push(e){let{data:t,options:r}=e;for(let i of t)this.transactionWorker.push(i,r)}registerToEvents(){this.transactionWorker.on("transactionSent",async e=>{this.emit("transactionSent",e)}),this.transactionWorker.on("transactionSendFailed",async e=>{this.emit("transactionSendFailed",e)}),this.transactionWorker.on("transactionExecuted",async e=>{this.emit("transactionExecuted",e)}),this.transactionWorker.on("transactionExecutionFailed",async e=>{this.emit("transactionExecutionFailed",e)}),this.transactionWorker.on("executionFinish",async e=>{this.emit("executionFinish",e)})}forSingleAccount(e){try{let{sender:t,data:r,options:i}=e;this.start({sender:t}),this.push({data:r,options:i})}catch(t){throw new Error(`failed to submit transactions with error: ${t}`)}}};var Bn=class{constructor(e){this.config=e,this.build=new Or(this.config),this.simulate=new nn(this.config),this.submit=new rn(this.config),this.batch=new Gr(this.config)}async getTransactions(e){return mi({aptosConfig:this.config,...e})}async getTransactionByVersion(e){return ys({aptosConfig:this.config,...e})}async getTransactionByHash(e){return Pn({aptosConfig:this.config,...e})}async isPendingTransaction(e){return fs({aptosConfig:this.config,...e})}async waitForTransaction(e){return Yt({aptosConfig:this.config,...e})}async getGasPriceEstimation(){return Sr({aptosConfig:this.config})}getSigningMessage(e){return ks(e)}async publishPackageTransaction(e){return Fs({aptosConfig:this.config,...e})}async rotateAuthKey(e){return Ns({aptosConfig:this.config,...e})}sign(e){return Rr({...e})}signAsFeePayer(e){return Ur({...e})}async batchTransactionsForSingleAccount(e){try{let{sender:t,data:r,options:i}=e;this.batch.forSingleAccount({sender:t,data:r,options:i})}catch(t){throw new Error(`failed to submit transactions with error: ${t}`)}}async signAndSubmitTransaction(e){return vn({aptosConfig:this.config,...e})}async signAndSubmitAsFeePayer(e){return Os({aptosConfig:this.config,...e})}};var Mn=class{constructor(e){this.config=e}async getTableItem(e){return Tr({aptosConfig:this.config,...e})}async getTableItemsData(e){return await S({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"default_processor"}),Zo({aptosConfig:this.config,...e})}async getTableItemsMetadata(e){return await S({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"default_processor"}),es({aptosConfig:this.config,...e})}};async function Br(n){let{aptosConfig:e,jwt:t,ephemeralKeyPair:r,uidKey:i="sub",derivationPath:o}=n,s={jwt_b64:t,epk:r.getPublicKey().bcsToHex().toStringWithoutPrefix(),exp_date_secs:r.expiryDateSecs,epk_blinder:_chunkRX5UBAMEjs.j.fromHexInput(r.blinder).toStringWithoutPrefix(),uid_key:i,derivation_path:o},{data:a}=await wo({aptosConfig:e,path:"fetch",body:s,originMethod:"getPepper",overrides:{WITH_CREDENTIALS:!1}});return _chunkRX5UBAMEjs.j.fromHexInput(a.pepper).toUint8Array()}async function ki(n){let{aptosConfig:e,jwt:t,ephemeralKeyPair:r,pepper:i=await Br(n),uidKey:o="sub",maxExpHorizonSecs:s=(await mn({aptosConfig:e})).maxExpHorizonSecs}=n;if(_chunkRX5UBAMEjs.j.fromHexInput(i).toUint8Array().length!==Ze.PEPPER_LENGTH)throw new Error(`Pepper needs to be ${Ze.PEPPER_LENGTH} bytes`);let a=_jwtdecode.jwtDecode.call(void 0, t);if(typeof a.iat!="number")throw new Error("iat was not found");if(s<r.expiryDateSecs-a.iat)throw Error(`The EphemeralKeyPair is too long lived. It's lifespan must be less than ${s}`);let c={jwt_b64:t,epk:r.getPublicKey().bcsToHex().toStringWithoutPrefix(),epk_blinder:_chunkRX5UBAMEjs.j.fromHexInput(r.blinder).toStringWithoutPrefix(),exp_date_secs:r.expiryDateSecs,exp_horizon_secs:s,pepper:_chunkRX5UBAMEjs.j.fromHexInput(i).toStringWithoutPrefix(),uid_key:o},{data:d}=await So({aptosConfig:e,path:"prove",body:c,originMethod:"getProof",overrides:{WITH_CREDENTIALS:!1}}),l=d.proof,h=new Bt({a:l.a,b:l.b,c:l.c});return new Pe({proof:new Mt(h,0),trainingWheelsSignature:Ce.fromHex(d.training_wheels_signature),expHorizonSecs:s})}async function Ma(n){let{aptosConfig:e,jwt:t,jwkAddress:r,uidKey:i,proofFetchCallback:o,pepper:s=await Br(n)}=n,{verificationKey:a,maxExpHorizonSecs:c}=await mn({aptosConfig:e}),d=ki({...n,pepper:s,maxExpHorizonSecs:c}),l=o?d:await d;if(r!==void 0){let g=ne.fromJwtAndPepper({jwt:t,pepper:s,jwkAddress:r,uidKey:i}),b=await Xt({aptosConfig:e,authenticationKey:g.authKey().derivedAddress()});return Kt.create({...n,address:b,proof:l,pepper:s,proofFetchCallback:o,jwkAddress:r,verificationKey:a})}let h=k.fromJwtAndPepper({jwt:t,pepper:s,uidKey:i}),p=await Xt({aptosConfig:e,authenticationKey:h.authKey().derivedAddress()});return Ze.create({...n,address:p,proof:l,pepper:s,proofFetchCallback:o,verificationKey:a})}async function Va(n){let{aptosConfig:e,sender:t,iss:r,options:i}=n,{jwksUrl:o}=n;o===void 0&&(yo.test(r)?o="https://www.googleapis.com/service_accounts/v1/jwk/securetoken@system.gserviceaccount.com":o=r.endsWith("/")?`${r}.well-known/jwks.json`:`${r}/.well-known/jwks.json`);let s;try{if(s=await fetch(o),!s.ok)throw new Error(`${s.status} ${s.statusText}`)}catch(c){let d;throw c instanceof Error?d=`${c.message}`:d=`error unknown - ${c}`,D.fromErrorType({type:14,details:`Failed to fetch JWKS at ${o}: ${d}`})}let a=await s.json();return w({aptosConfig:e,sender:t.accountAddress,data:{function:"0x1::jwks::update_federated_jwk_set",functionArguments:[r,_.MoveString(a.keys.map(c=>c.kid)),_.MoveString(a.keys.map(c=>c.alg)),_.MoveString(a.keys.map(c=>c.e)),_.MoveString(a.keys.map(c=>c.n))]},options:i})}var Vn=class{constructor(e){this.config=e}async getPepper(e){return Br({aptosConfig:this.config,...e})}async getProof(e){return ki({aptosConfig:this.config,...e})}async deriveKeylessAccount(e){return Ma({aptosConfig:this.config,...e})}async updateFederatedKeylessJwkSetTransaction(e){return Va({aptosConfig:this.config,...e})}};async function ju(n){let{aptosConfig:e,options:t}=n,r={query:yr,variables:{where_condition:_optionalChain([t, 'optionalAccess', _236 => _236.where]),offset:_optionalChain([t, 'optionalAccess', _237 => _237.offset]),limit:_optionalChain([t, 'optionalAccess', _238 => _238.limit]),order_by:_optionalChain([t, 'optionalAccess', _239 => _239.orderBy])}};return(await T({aptosConfig:e,query:r,originMethod:"getObjectData"})).current_objects}async function qa(n){let{aptosConfig:e,objectAddress:t,options:r}=n,o={object_address:{_eq:_chunkRX5UBAMEjs.Z.from(t).toStringLong()}};return(await ju({aptosConfig:e,options:{...r,where:o}}))[0]}var qn=class{constructor(e){this.config=e}async getObjectDataByObjectAddress(e){return await S({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"objects_processor"}),qa({aptosConfig:this.config,...e})}};async function La(n){let{aptosConfig:e,payload:t,options:r}=n,i=await Cr({...t,aptosConfig:e}),o=new _chunkRX5UBAMEjs.m;i.serialize(o);let s=o.toUint8Array(),{data:a}=await ho({aptosConfig:e,path:"view",originMethod:"view",contentType:"application/x.aptos.view_function+bcs",acceptType:"application/x-bcs",params:{ledger_version:_optionalChain([r, 'optionalAccess', _240 => _240.ledgerVersion])},body:s}),c=new Uint8Array(a);return _optionalChain([r, 'optionalAccess', _241 => _241.convert])?r.convert(c):c}var Ln=class{constructor(e){this.config=e}async viewBinary(e){return La({...e,aptosConfig:this.config})}};var J=class{constructor(e){this.config=new Dr(e),this.account=new Cn(this.config),this.abstraction=new Ut(this.config),this.ans=new Nn(this.config),this.coin=new Kn(this.config),this.digitalAsset=new Rn(this.config),this.event=new Dn(this.config),this.experimental=new Ln(this.config),this.faucet=new zn(this.config),this.fungibleAsset=new kn(this.config),this.general=new On(this.config),this.staking=new Gn(this.config),this.transaction=new Bn(this.config),this.table=new Mn(this.config),this.keyless=new Vn(this.config),this.object=new qn(this.config)}};function re(n,e,t){Object.getOwnPropertyNames(e.prototype).forEach(r=>{let i=Object.getOwnPropertyDescriptor(e.prototype,r);i&&(i.value=function(...o){return this[t][r](...o)},Object.defineProperty(n.prototype,r,i))})}re(J,Cn,"account");re(J,Ut,"abstraction");re(J,Nn,"ans");re(J,Kn,"coin");re(J,Rn,"digitalAsset");re(J,Dn,"event");re(J,Ln,"experimental");re(J,zn,"faucet");re(J,kn,"fungibleAsset");re(J,On,"general");re(J,Gn,"staking");re(J,Bn,"transaction");re(J,Mn,"table");re(J,Vn,"keyless");re(J,qn,"object");exports.APTOS_BIP44_REGEX = ic; exports.APTOS_COIN = ht; exports.APTOS_FA = go; exports.APTOS_HARDENED_REGEX = rc; exports.AbstractKeylessAccount = ge; exports.AbstractMultiKey = yn; exports.AbstractedAccount = Do; exports.Account = ke; exports.AccountAddress = _chunkRX5UBAMEjs.Z; exports.AccountAuthenticator = Q; exports.AccountAuthenticatorAbstraction = fn; exports.AccountAuthenticatorEd25519 = xe; exports.AccountAuthenticatorMultiEd25519 = $e; exports.AccountAuthenticatorMultiKey = De; exports.AccountAuthenticatorNoAccountAuthenticator = qt; exports.AccountAuthenticatorSingleKey = se; exports.AccountAuthenticatorVariant = _chunkRX5UBAMEjs.w; exports.AccountPublicKey = oe; exports.AccountSequenceNumber = Fr; exports.AccountUtils = Ro; exports.AddressInvalidReason = _chunkRX5UBAMEjs.Y; exports.AnyPublicKey = O; exports.AnyPublicKeyVariant = _chunkRX5UBAMEjs.y; exports.AnySignature = H; exports.AnySignatureVariant = _chunkRX5UBAMEjs.z; exports.Aptos = J; exports.AptosApiError = Z; exports.AptosApiType = At; exports.AptosConfig = Dr; exports.AptosScriptComposer = Kr; exports.AuthenticationKey = B; exports.Bool = U; exports.CKDPriv = to; exports.CallArgument = _chunkRX5UBAMEjs.X; exports.ChainId = Lt; exports.DEFAULT_MAX_GAS_AMOUNT = po; exports.DEFAULT_TXN_EXP_SEC_FROM_NOW = lo; exports.DEFAULT_TXN_TIMEOUT_SEC = tr; exports.DeriveScheme = _chunkRX5UBAMEjs.W; exports.Deserializer = C; exports.EPK_HORIZON_SECS = hg; exports.Ed25519Account = he; exports.Ed25519PrivateKey = q; exports.Ed25519PublicKey = x; exports.Ed25519Signature = I; exports.EntryFunction = _t; exports.EntryFunctionBytes = Jn; exports.EphemeralCertificate = Gt; exports.EphemeralCertificateVariant = _chunkRX5UBAMEjs.C; exports.EphemeralKeyPair = Ct; exports.EphemeralPublicKey = ft; exports.EphemeralPublicKeyVariant = _chunkRX5UBAMEjs.A; exports.EphemeralSignature = Ce; exports.EphemeralSignatureVariant = _chunkRX5UBAMEjs.B; exports.FIREBASE_AUTH_ISS_PATTERN = yo; exports.FederatedKeylessAccount = Kt; exports.FederatedKeylessPublicKey = ne; exports.FeePayerRawTransaction = Pt; exports.FixedBytes = gt; exports.Groth16VerificationKey = ii; exports.Groth16Zkp = Bt; exports.HARDENED_OFFSET = Yi; exports.Hex = _chunkRX5UBAMEjs.j; exports.HexInvalidReason = _chunkRX5UBAMEjs.i; exports.Identifier = K; exports.KeyType = oc; exports.KeylessAccount = Ze; exports.KeylessConfiguration = ri; exports.KeylessError = D; exports.KeylessErrorCategory = Rc; exports.KeylessErrorResolutionTip = Uc; exports.KeylessErrorType = nr; exports.KeylessPublicKey = k; exports.KeylessSignature = Ve; exports.MAX_AUD_VAL_BYTES = Bc; exports.MAX_COMMITED_EPK_BYTES = Sg; exports.MAX_EXTRA_FIELD_BYTES = bg; exports.MAX_ISS_VAL_BYTES = Tg; exports.MAX_JWT_HEADER_B64_BYTES = wg; exports.MAX_UID_KEY_BYTES = Mc; exports.MAX_UID_VAL_BYTES = Vc; exports.MimeType = _chunkRX5UBAMEjs.q; exports.ModuleId = An; exports.MoveAbility = _chunkRX5UBAMEjs.S; exports.MoveFunctionVisibility = _chunkRX5UBAMEjs.R; exports.MoveJWK = oi; exports.MoveOption = Y; exports.MoveString = P; exports.MoveVector = _; exports.MultiAgentRawTransaction = Et; exports.MultiAgentTransaction = pr; exports.MultiEd25519Account = Io; exports.MultiEd25519PublicKey = Vt; exports.MultiEd25519Signature = He; exports.MultiKey = Ue; exports.MultiKeyAccount = _n; exports.MultiKeySignature = Le; exports.MultiSig = wn; exports.MultiSigTransactionPayload = Sn; exports.Network = Xr; exports.NetworkToChainId = Yr; exports.NetworkToFaucetAPI = uo; exports.NetworkToIndexerAPI = ao; exports.NetworkToNetworkName = pl; exports.NetworkToNodeAPI = co; exports.NetworkToPepperAPI = jr; exports.NetworkToProverAPI = Jr; exports.ParsingError = _chunkRX5UBAMEjs.h; exports.PrivateKey = it; exports.PrivateKeyVariants = _chunkRX5UBAMEjs.x; exports.ProcessorType = Be; exports.PublicKey = mt; exports.RAW_TRANSACTION_SALT = mo; exports.RAW_TRANSACTION_WITH_DATA_SALT = Zr; exports.RawTransaction = Ae; exports.RawTransactionWithData = ur; exports.RoleType = _chunkRX5UBAMEjs.T; exports.RotationProofChallenge = dr; exports.Script = bn; exports.ScriptTransactionArgumentVariants = _chunkRX5UBAMEjs.s; exports.Secp256k1PrivateKey = Ge; exports.Secp256k1PublicKey = Ne; exports.Secp256k1Signature = yt; exports.Serializable = _chunkRX5UBAMEjs.l; exports.Serialized = cn; exports.Serializer = _chunkRX5UBAMEjs.m; exports.Signature = M; exports.SignedTransaction = Ye; exports.SigningScheme = _chunkRX5UBAMEjs.U; exports.SigningSchemeInput = _chunkRX5UBAMEjs.V; exports.SimpleTransaction = $t; exports.SingleKeyAccount = Te; exports.StructTag = ze; exports.TransactionAndProof = ci; exports.TransactionAuthenticator = Xe; exports.TransactionAuthenticatorEd25519 = xt; exports.TransactionAuthenticatorFeePayer = vt; exports.TransactionAuthenticatorMultiAgent = It; exports.TransactionAuthenticatorMultiEd25519 = Ht; exports.TransactionAuthenticatorSingleSender = at; exports.TransactionAuthenticatorVariant = _chunkRX5UBAMEjs.v; exports.TransactionPayload = wt; exports.TransactionPayloadEntryFunction = hn; exports.TransactionPayloadMultiSig = Tn; exports.TransactionPayloadScript = St; exports.TransactionPayloadVariants = _chunkRX5UBAMEjs.t; exports.TransactionResponseType = _chunkRX5UBAMEjs.E; exports.TransactionVariants = _chunkRX5UBAMEjs.u; exports.TransactionWorker = Nr; exports.TransactionWorkerEventsEnum = Ba; exports.TypeTag = N; exports.TypeTagAddress = F; exports.TypeTagBool = V; exports.TypeTagGeneric = G; exports.TypeTagParserError = $; exports.TypeTagParserErrorType = du; exports.TypeTagReference = cr; exports.TypeTagSigner = bt; exports.TypeTagStruct = A; exports.TypeTagU128 = je; exports.TypeTagU16 = We; exports.TypeTagU256 = Je; exports.TypeTagU32 = Qe; exports.TypeTagU64 = j; exports.TypeTagU8 = pe; exports.TypeTagVariants = _chunkRX5UBAMEjs.r; exports.TypeTagVector = v; exports.U128 = _e; exports.U16 = we; exports.U256 = me; exports.U32 = Se; exports.U64 = W; exports.U8 = X; exports.ZeroKnowledgeSig = Pe; exports.ZkProof = Mt; exports.ZkpVariant = _chunkRX5UBAMEjs.D; exports.aptosBinaryRequest = ir; exports.aptosCoinStructTag = hy; exports.aptosRequest = rr; exports.base64UrlDecode = _chunkRX5UBAMEjs.ca; exports.bigIntToBytesLE = so; exports.binaryRequest = Oc; exports.buildTransaction = xi; exports.bytesToBigIntLE = pn; exports.checkOrConvertArgument = Rt; exports.convertAmountFromHumanReadableToOnChain = _chunkRX5UBAMEjs.da; exports.convertAmountFromOnChainToHumanReadable = _chunkRX5UBAMEjs.ea; exports.convertArgument = Ir; exports.convertCallArgument = Ks; exports.convertNumber = Er; exports.createObjectAddress = ar; exports.createResourceAddress = Im; exports.createTokenAddress = vm; exports.deriveKey = Lr; exports.deriveTransactionType = si; exports.deserializeFromScriptArgument = Wc; exports.ensureBoolean = _chunkRX5UBAMEjs.n; exports.fetchEntryFunctionAbi = vs; exports.fetchFunctionAbi = Ei; exports.fetchMoveFunctionAbi = Is; exports.fetchViewFunctionAbi = Cs; exports.findFirstNonSignerArg = Es; exports.floorToWholeHour = _chunkRX5UBAMEjs.ba; exports.generateRawTransaction = Pi; exports.generateSignedTransaction = Ii; exports.generateSignedTransactionForSimulation = Rs; exports.generateSigningMessage = Wt; exports.generateSigningMessageForSerializable = Rf; exports.generateSigningMessageForTransaction = Ie; exports.generateTransactionPayload = vr; exports.generateTransactionPayloadWithABI = mu; exports.generateUserTransactionHash = Lb; exports.generateViewFunctionPayload = Cr; exports.generateViewFunctionPayloadWithABI = yu; exports.get = or; exports.getAptosFullNode = L; exports.getAptosPepperService = Gl; exports.getAuthenticatorForSimulation = en; exports.getBinary = Fc; exports.getBinaryAptosFullNode = Nl; exports.getErrorMessage = _chunkRX5UBAMEjs.$; exports.getFunctionParts = _chunkRX5UBAMEjs.ha; exports.getIssAudAndUidVal = qe; exports.getKeylessConfig = mn; exports.getKeylessJWKs = Po; exports.hashStrToField = Zn; exports.hashValues = Us; exports.hexToAsciiString = _chunkRX5UBAMEjs.k; exports.isBcsAddress = xr; exports.isBcsBool = yi; exports.isBcsFixedBytes = ou; exports.isBcsString = fi; exports.isBcsU128 = wi; exports.isBcsU16 = hi; exports.isBcsU256 = Si; exports.isBcsU32 = Ti; exports.isBcsU64 = bi; exports.isBcsU8 = Ai; exports.isBlockEpilogueTransactionResponse = _chunkRX5UBAMEjs.L; exports.isBlockMetadataTransactionResponse = _chunkRX5UBAMEjs.I; exports.isBool = bs; exports.isCanonicalEd25519Signature = ac; exports.isEd25519Signature = _chunkRX5UBAMEjs.M; exports.isEmptyOption = ws; exports.isEncodedEntryFunctionArgument = Ss; exports.isEncodedStruct = _chunkRX5UBAMEjs.ga; exports.isFeePayerSignature = _chunkRX5UBAMEjs.P; exports.isGenesisTransactionResponse = _chunkRX5UBAMEjs.H; exports.isKeylessSigner = lr; exports.isLargeNumber = Pr; exports.isMultiAgentSignature = _chunkRX5UBAMEjs.O; exports.isMultiEd25519Signature = _chunkRX5UBAMEjs.Q; exports.isNumber = iu; exports.isPendingTransactionResponse = _chunkRX5UBAMEjs.F; exports.isScriptDataInput = _s; exports.isSecp256k1Signature = _chunkRX5UBAMEjs.N; exports.isSingleKeySigner = ai; exports.isStateCheckpointTransactionResponse = _chunkRX5UBAMEjs.J; exports.isString = et; exports.isUserTransactionResponse = _chunkRX5UBAMEjs.G; exports.isValidBIP44Path = Zi; exports.isValidFunctionInfo = _chunkRX5UBAMEjs.ia; exports.isValidHardenedPath = eo; exports.isValidatorTransactionResponse = _chunkRX5UBAMEjs.K; exports.mnemonicToSeed = Xn; exports.normalizeBundle = fo; exports.nowInSeconds = _chunkRX5UBAMEjs.aa; exports.objectStructTag = le; exports.optionStructTag = Ty; exports.outOfRangeErrorMessage = _chunkRX5UBAMEjs.o; exports.padAndPackBytesWithLen = Wr; exports.paginateWithCursor = sr; exports.paginateWithObfuscatedCursor = ti; exports.parseEncodedStruct = _chunkRX5UBAMEjs.fa; exports.parseJwtHeader = Hc; exports.parseTypeTag = Fe; exports.poseidonHash = ln; exports.post = gn; exports.postAptosFaucet = bo; exports.postAptosFullNode = st; exports.postAptosIndexer = To; exports.postAptosPepperService = wo; exports.postAptosProvingService = So; exports.postBinary = Nc; exports.postBinaryAptosFullNode = ho; exports.promiseFulfilledStatus = Ga; exports.request = kc; exports.sleep = _chunkRX5UBAMEjs._; exports.splitPath = no; exports.standardizeTypeTags = Zt; exports.stringStructTag = E; exports.throwTypeMismatch = z; exports.validateNumberInRange = _chunkRX5UBAMEjs.p;
|
|
479
|
+
will be removed in the near future`);let s=r;r===void 0&&i!==void 0&&(s=await Ue(async()=>{try{let d=(await ce({aptosConfig:this.config,payload:{function:"0x1::coin::paired_coin",functionArguments:[i]}})).at(0);if(d.vec.length>0&&_chunkPA2XFIP3js.ga.call(void 0, d.vec[0]))return _chunkPA2XFIP3js.fa.call(void 0, d.vec[0])}catch (e5){}},`coin-mapping-${i.toString()}`,1e3*60*5)());let a;if(r!==void 0&&i!==void 0)a=_chunkPA2XFIP3js.Z.from(i).toStringLong();else if(r!==void 0&&i===void 0)r===Tt?a=_chunkPA2XFIP3js.Z.A.toStringLong():a=dr(_chunkPA2XFIP3js.Z.A,r).toStringLong();else if(r===void 0&&i!==void 0){let d=_chunkPA2XFIP3js.Z.from(i);a=d.toStringLong(),d===_chunkPA2XFIP3js.Z.A&&(s=Tt)}else throw new Error("Either coinType, faMetadataAddress, or both must be provided");if(s!==void 0){let[d]=await ce({aptosConfig:this.config,payload:{function:"0x1::coin::balance",typeArguments:[s],functionArguments:[t]}});return parseInt(d,10)}let[c]=await ce({aptosConfig:this.config,payload:{function:"0x1::primary_fungible_store::balance",typeArguments:["0x1::object::ObjectCore"],functionArguments:[t,a]}});return parseInt(c,10)}async getAccountOwnedObjects(e){return await _({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"default_processor"}),Ns({aptosConfig:this.config,...e})}async deriveAccountFromPrivateKey(e){return Bs({aptosConfig:this.config,...e})}};var _aptosclient = require('@aptos-labs/aptos-client'); var _aptosclient2 = _interopRequireDefault(_aptosclient);var Fr=class{constructor(e){this.network=_nullishCoalesce(_optionalChain([e, 'optionalAccess', _150 => _150.network]), () => ("devnet")),this.fullnode=_optionalChain([e, 'optionalAccess', _151 => _151.fullnode]),this.faucet=_optionalChain([e, 'optionalAccess', _152 => _152.faucet]),this.pepper=_optionalChain([e, 'optionalAccess', _153 => _153.pepper]),this.prover=_optionalChain([e, 'optionalAccess', _154 => _154.prover]),this.indexer=_optionalChain([e, 'optionalAccess', _155 => _155.indexer]),this.client=_nullishCoalesce(_optionalChain([e, 'optionalAccess', _156 => _156.client]), () => ({provider:_aptosclient2.default,binaryProvider:_aptosclient.bcsRequest})),this.clientConfig=_nullishCoalesce(_optionalChain([e, 'optionalAccess', _157 => _157.clientConfig]), () => ({})),this.fullnodeConfig=_nullishCoalesce(_optionalChain([e, 'optionalAccess', _158 => _158.fullnodeConfig]), () => ({})),this.indexerConfig=_nullishCoalesce(_optionalChain([e, 'optionalAccess', _159 => _159.indexerConfig]), () => ({})),this.faucetConfig=_nullishCoalesce(_optionalChain([e, 'optionalAccess', _160 => _160.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 go[this.network];case"Faucet":if(this.faucet!==void 0)return this.faucet;if(this.network==="testnet")throw new Error("There is no way to programmatically mint testnet APT, you must use the minting site at https://aptos.dev/network/faucet");if(this.network==="mainnet")throw new Error("There is no mainnet faucet");if(this.network==="custom")throw new Error("Please provide a custom faucet url");return mo[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 lo[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 Yr[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 Zr[this.network];default:throw Error(`apiType ${e} is not supported`)}}isPepperServiceRequest(e){return Yr[this.network]===e}isProverServiceRequest(e){return Zr[this.network]===e}};var Ru={typeParameters:[{constraints:[]}],parameters:[new F,new j]};async function Hs(n){let{aptosConfig:e,sender:t,recipient:r,amount:i,coinType:o,options:s}=n;return T({aptosConfig:e,sender:t,data:{function:"0x1::aptos_account::transfer_coins",typeArguments:[_nullishCoalesce(o, () => (Tt))],functionArguments:[r,i],abi:Ru},options:s})}var Un=class{constructor(e){this.config=e}async transferCoinTransaction(e){return Hs({aptosConfig:this.config,...e})}};var dt={BOOLEAN:"bool",U8:"u8",U16:"u16",U32:"u32",U64:"u64",U128:"u128",U256:"u256",ADDRESS:"address",STRING:"0x1::string::String",ARRAY:"vector<u8>"},be="0x4::token::Token";async function $s(n){let{aptosConfig:e,digitalAssetAddress:t}=n,r={token_data_id:{_eq:_chunkPA2XFIP3js.Z.from(t).toStringLong()}};return(await b({aptosConfig:e,query:{query:es,variables:{where_condition:r}},originMethod:"getDigitalAssetData"})).current_token_datas_v2[0]}async function Ws(n){let{aptosConfig:e,digitalAssetAddress:t}=n,r={token_data_id:{_eq:_chunkPA2XFIP3js.Z.from(t).toStringLong()},amount:{_gt:0}};return(await b({aptosConfig:e,query:{query:gi,variables:{where_condition:r}},originMethod:"getCurrentDigitalAssetOwnership"})).current_token_ownerships_v2[0]}async function Qs(n){let{aptosConfig:e,ownerAddress:t,options:r}=n,i={owner_address:{_eq:_chunkPA2XFIP3js.Z.from(t).toStringLong()},amount:{_gt:0}},o={query:gi,variables:{where_condition:i,offset:_optionalChain([r, 'optionalAccess', _161 => _161.offset]),limit:_optionalChain([r, 'optionalAccess', _162 => _162.limit]),order_by:_optionalChain([r, 'optionalAccess', _163 => _163.orderBy])}};return(await b({aptosConfig:e,query:o,originMethod:"getOwnedDigitalAssets"})).current_token_ownerships_v2}async function js(n){let{aptosConfig:e,digitalAssetAddress:t,options:r}=n,i={token_data_id:{_eq:_chunkPA2XFIP3js.Z.from(t).toStringLong()}},o={query:Zo,variables:{where_condition:i,offset:_optionalChain([r, 'optionalAccess', _164 => _164.offset]),limit:_optionalChain([r, 'optionalAccess', _165 => _165.limit]),order_by:_optionalChain([r, 'optionalAccess', _166 => _166.orderBy])}};return(await b({aptosConfig:e,query:o,originMethod:"getDigitalAssetActivity"})).token_activities_v2}var Uu={typeParameters:[],parameters:[new A(E()),new j,new A(E()),new A(E()),new L,new L,new L,new L,new L,new L,new L,new L,new L,new j,new j]};async function Js(n){let{aptosConfig:e,options:t,creator:r}=n;return T({aptosConfig:e,sender:r.accountAddress,data:{function:"0x4::aptos_token::create_collection",functionArguments:[new P(n.description),new W(_nullishCoalesce(n.maxSupply, () => (_chunkPA2XFIP3js.e))),new P(n.name),new P(n.uri),new D(_nullishCoalesce(n.mutableDescription, () => (!0))),new D(_nullishCoalesce(n.mutableRoyalty, () => (!0))),new D(_nullishCoalesce(n.mutableURI, () => (!0))),new D(_nullishCoalesce(n.mutableTokenDescription, () => (!0))),new D(_nullishCoalesce(n.mutableTokenName, () => (!0))),new D(_nullishCoalesce(n.mutableTokenProperties, () => (!0))),new D(_nullishCoalesce(n.mutableTokenURI, () => (!0))),new D(_nullishCoalesce(n.tokensBurnableByCreator, () => (!0))),new D(_nullishCoalesce(n.tokensFreezableByCreator, () => (!0))),new W(_nullishCoalesce(n.royaltyNumerator, () => (0))),new W(_nullishCoalesce(n.royaltyDenominator, () => (1)))],abi:Uu},options:t})}async function on(n){let{aptosConfig:e,options:t}=n,r=_optionalChain([t, 'optionalAccess', _167 => _167.where]);_optionalChain([t, 'optionalAccess', _168 => _168.tokenStandard])&&(r.token_standard={_eq:_nullishCoalesce(_optionalChain([t, 'optionalAccess', _169 => _169.tokenStandard]), () => ("v2"))});let i={query:Ho,variables:{where_condition:r,offset:_optionalChain([t, 'optionalAccess', _170 => _170.offset]),limit:_optionalChain([t, 'optionalAccess', _171 => _171.limit])}};return(await b({aptosConfig:e,query:i,originMethod:"getCollectionData"})).current_collections_v2[0]}async function Xs(n){let{aptosConfig:e,creatorAddress:t,collectionName:r,options:i}=n,o=_chunkPA2XFIP3js.Z.from(t),s={collection_name:{_eq:r},creator_address:{_eq:o.toStringLong()}};return _optionalChain([i, 'optionalAccess', _172 => _172.tokenStandard])&&(s.token_standard={_eq:_nullishCoalesce(_optionalChain([i, 'optionalAccess', _173 => _173.tokenStandard]), () => ("v2"))}),on({aptosConfig:e,options:{...i,where:s}})}async function Ys(n){let{aptosConfig:e,creatorAddress:t,options:r}=n,o={creator_address:{_eq:_chunkPA2XFIP3js.Z.from(t).toStringLong()}};return _optionalChain([r, 'optionalAccess', _174 => _174.tokenStandard])&&(o.token_standard={_eq:_nullishCoalesce(_optionalChain([r, 'optionalAccess', _175 => _175.tokenStandard]), () => ("v2"))}),on({aptosConfig:e,options:{...r,where:o}})}async function Zs(n){let{aptosConfig:e,collectionId:t,options:r}=n,o={collection_id:{_eq:_chunkPA2XFIP3js.Z.from(t).toStringLong()}};return _optionalChain([r, 'optionalAccess', _176 => _176.tokenStandard])&&(o.token_standard={_eq:_nullishCoalesce(_optionalChain([r, 'optionalAccess', _177 => _177.tokenStandard]), () => ("v2"))}),on({aptosConfig:e,options:{...r,where:o}})}async function ea(n){let{creatorAddress:e,collectionName:t,options:r,aptosConfig:i}=n,o=_chunkPA2XFIP3js.Z.from(e),s={collection_name:{_eq:t},creator_address:{_eq:o.toStringLong()}};return _optionalChain([r, 'optionalAccess', _178 => _178.tokenStandard])&&(s.token_standard={_eq:_nullishCoalesce(_optionalChain([r, 'optionalAccess', _179 => _179.tokenStandard]), () => ("v2"))}),(await on({aptosConfig:i,options:{where:s}})).collection_id}var Du={typeParameters:[],parameters:[new A(E()),new A(E()),new A(E()),new A(E()),new x(new A(E())),new x(new A(E())),new x(x.u8())]};async function ta(n){let{aptosConfig:e,options:t,creator:r,collection:i,description:o,name:s,uri:a,propertyKeys:c,propertyTypes:d,propertyValues:l}=n,h=_optionalChain([d, 'optionalAccess', _180 => _180.map, 'call', _181 => _181(p=>dt[p])]);return T({aptosConfig:e,sender:r.accountAddress,data:{function:"0x4::aptos_token::mint",functionArguments:[new P(i),new P(o),new P(s),new P(a),S.MoveString(_nullishCoalesce(c, () => ([]))),S.MoveString(_nullishCoalesce(h, () => ([]))),ya(_nullishCoalesce(l, () => ([])),_nullishCoalesce(h, () => ([])))],abi:Du},options:t})}var zu={typeParameters:[{constraints:["key"]}],parameters:[new A(ge(new B(0))),new F]};async function na(n){let{aptosConfig:e,sender:t,digitalAssetAddress:r,recipient:i,digitalAssetType:o,options:s}=n;return T({aptosConfig:e,sender:t.accountAddress,data:{function:"0x1::object::transfer",typeArguments:[_nullishCoalesce(o, () => (be))],functionArguments:[_chunkPA2XFIP3js.Z.from(r),_chunkPA2XFIP3js.Z.from(i)],abi:zu},options:s})}var ku={typeParameters:[],parameters:[new A(E()),new A(E()),new A(E()),new A(E()),new x(new A(E())),new x(new A(E())),new x(x.u8()),new F]};async function ra(n){let{aptosConfig:e,account:t,collection:r,description:i,name:o,uri:s,recipient:a,propertyKeys:c,propertyTypes:d,propertyValues:l,options:h}=n;if(_optionalChain([c, 'optionalAccess', _182 => _182.length])!==_optionalChain([l, 'optionalAccess', _183 => _183.length]))throw new Error("Property keys and property values counts do not match");if(_optionalChain([d, 'optionalAccess', _184 => _184.length])!==_optionalChain([l, 'optionalAccess', _185 => _185.length]))throw new Error("Property types and property values counts do not match");let p=_optionalChain([d, 'optionalAccess', _186 => _186.map, 'call', _187 => _187(g=>dt[g])]);return T({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::mint_soul_bound",functionArguments:[r,i,o,s,S.MoveString(_nullishCoalesce(c, () => ([]))),S.MoveString(_nullishCoalesce(p, () => ([]))),ya(_nullishCoalesce(l, () => ([])),_nullishCoalesce(p, () => ([]))),a],abi:ku},options:h})}var Ou={typeParameters:[{constraints:["key"]}],parameters:[new A(ge(new B(0)))]};async function ia(n){let{aptosConfig:e,creator:t,digitalAssetAddress:r,digitalAssetType:i,options:o}=n;return T({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::burn",typeArguments:[_nullishCoalesce(i, () => (be))],functionArguments:[_chunkPA2XFIP3js.Z.from(r)],abi:Ou},options:o})}var Fu={typeParameters:[{constraints:["key"]}],parameters:[new A(ge(new B(0)))]};async function oa(n){let{aptosConfig:e,creator:t,digitalAssetAddress:r,digitalAssetType:i,options:o}=n;return T({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::freeze_transfer",typeArguments:[_nullishCoalesce(i, () => (be))],functionArguments:[r],abi:Fu},options:o})}var Nu={typeParameters:[{constraints:["key"]}],parameters:[new A(ge(new B(0)))]};async function sa(n){let{aptosConfig:e,creator:t,digitalAssetAddress:r,digitalAssetType:i,options:o}=n;return T({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::unfreeze_transfer",typeArguments:[_nullishCoalesce(i, () => (be))],functionArguments:[r],abi:Nu},options:o})}var Bu={typeParameters:[{constraints:["key"]}],parameters:[new A(ge(new B(0))),new A(E())]};async function aa(n){let{aptosConfig:e,creator:t,description:r,digitalAssetAddress:i,digitalAssetType:o,options:s}=n;return T({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::set_description",typeArguments:[_nullishCoalesce(o, () => (be))],functionArguments:[_chunkPA2XFIP3js.Z.from(i),new P(r)],abi:Bu},options:s})}var Gu={typeParameters:[{constraints:["key"]}],parameters:[new A(ge(new B(0))),new A(E())]};async function ca(n){let{aptosConfig:e,creator:t,name:r,digitalAssetAddress:i,digitalAssetType:o,options:s}=n;return T({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::set_name",typeArguments:[_nullishCoalesce(o, () => (be))],functionArguments:[_chunkPA2XFIP3js.Z.from(i),new P(r)],abi:Gu},options:s})}var Mu={typeParameters:[{constraints:["key"]}],parameters:[new A(ge(new B(0))),new A(E())]};async function ua(n){let{aptosConfig:e,creator:t,uri:r,digitalAssetAddress:i,digitalAssetType:o,options:s}=n;return T({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::set_uri",typeArguments:[_nullishCoalesce(o, () => (be))],functionArguments:[_chunkPA2XFIP3js.Z.from(i),new P(r)],abi:Mu},options:s})}var Vu={typeParameters:[{constraints:["key"]}],parameters:[new A(ge(new B(0))),new A(E()),new A(E()),x.u8()]};async function da(n){let{aptosConfig:e,creator:t,propertyKey:r,propertyType:i,propertyValue:o,digitalAssetAddress:s,digitalAssetType:a,options:c}=n;return T({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::add_property",typeArguments:[_nullishCoalesce(a, () => (be))],functionArguments:[_chunkPA2XFIP3js.Z.from(s),new P(r),new P(dt[i]),S.U8(zi(o,dt[i]))],abi:Vu},options:c})}var qu={typeParameters:[{constraints:["key"]}],parameters:[new A(ge(new B(0))),new A(E())]};async function pa(n){let{aptosConfig:e,creator:t,propertyKey:r,digitalAssetAddress:i,digitalAssetType:o,options:s}=n;return T({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::remove_property",typeArguments:[_nullishCoalesce(o, () => (be))],functionArguments:[_chunkPA2XFIP3js.Z.from(i),new P(r)],abi:qu},options:s})}var Lu={typeParameters:[{constraints:["key"]}],parameters:[new A(ge(new B(0))),new A(E()),new A(E()),x.u8()]};async function la(n){let{aptosConfig:e,creator:t,propertyKey:r,propertyType:i,propertyValue:o,digitalAssetAddress:s,digitalAssetType:a,options:c}=n;return T({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::update_property",typeArguments:[_nullishCoalesce(a, () => (be))],functionArguments:[_chunkPA2XFIP3js.Z.from(s),new P(r),new P(dt[i]),zi(o,dt[i])],abi:Lu},options:c})}var Hu={typeParameters:[{constraints:["key"]},{constraints:[]}],parameters:[new A(ge(new B(0))),new A(E()),new B(1)]};async function ga(n){let{aptosConfig:e,creator:t,propertyKey:r,propertyType:i,propertyValue:o,digitalAssetAddress:s,digitalAssetType:a,options:c}=n;return T({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::add_typed_property",typeArguments:[_nullishCoalesce(a, () => (be)),dt[i]],functionArguments:[_chunkPA2XFIP3js.Z.from(s),new P(r),o],abi:Hu},options:c})}var $u={typeParameters:[{constraints:["key"]},{constraints:[]}],parameters:[new A(ge(new B(0))),new A(E()),new B(1)]};async function ma(n){let{aptosConfig:e,creator:t,propertyKey:r,propertyType:i,propertyValue:o,digitalAssetAddress:s,digitalAssetType:a,options:c}=n;return T({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::update_typed_property",typeArguments:[_nullishCoalesce(a, () => (be)),dt[i]],functionArguments:[_chunkPA2XFIP3js.Z.from(s),new P(r),o],abi:$u},options:c})}function ya(n,e){let t=new Array;return e.forEach((r,i)=>{t.push(zi(n[i],r))}),t}function zi(n,e){let t=Ce(e);return Ut(n,t,0,[]).bcsToBytes()}var Dn=class{constructor(e){this.config=e}async getCollectionData(e){await _({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"});let{creatorAddress:t,collectionName:r,options:i}=e,o=_chunkPA2XFIP3js.Z.from(t),s={collection_name:{_eq:r},creator_address:{_eq:o.toStringLong()}};return _optionalChain([i, 'optionalAccess', _188 => _188.tokenStandard])&&(s.token_standard={_eq:_nullishCoalesce(_optionalChain([i, 'optionalAccess', _189 => _189.tokenStandard]), () => ("v2"))}),on({aptosConfig:this.config,options:{where:s}})}async getCollectionDataByCreatorAddressAndCollectionName(e){return await _({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),Xs({aptosConfig:this.config,...e})}async getCollectionDataByCreatorAddress(e){return await _({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),Ys({aptosConfig:this.config,...e})}async getCollectionDataByCollectionId(e){return await _({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),Zs({aptosConfig:this.config,...e})}async getCollectionId(e){return await _({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),ea({aptosConfig:this.config,...e})}async getDigitalAssetData(e){return await _({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),$s({aptosConfig:this.config,...e})}async getCurrentDigitalAssetOwnership(e){return await _({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),Ws({aptosConfig:this.config,...e})}async getOwnedDigitalAssets(e){return await _({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),Qs({aptosConfig:this.config,...e})}async getDigitalAssetActivity(e){return await _({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),js({aptosConfig:this.config,...e})}async createCollectionTransaction(e){return Js({aptosConfig:this.config,...e})}async mintDigitalAssetTransaction(e){return ta({aptosConfig:this.config,...e})}async transferDigitalAssetTransaction(e){return na({aptosConfig:this.config,...e})}async mintSoulBoundTransaction(e){return ra({aptosConfig:this.config,...e})}async burnDigitalAssetTransaction(e){return ia({aptosConfig:this.config,...e})}async freezeDigitalAssetTransaferTransaction(e){return oa({aptosConfig:this.config,...e})}async unfreezeDigitalAssetTransaferTransaction(e){return sa({aptosConfig:this.config,...e})}async setDigitalAssetDescriptionTransaction(e){return aa({aptosConfig:this.config,...e})}async setDigitalAssetNameTransaction(e){return ca({aptosConfig:this.config,...e})}async setDigitalAssetURITransaction(e){return ua({aptosConfig:this.config,...e})}async addDigitalAssetPropertyTransaction(e){return da({aptosConfig:this.config,...e})}async removeDigitalAssetPropertyTransaction(e){return pa({aptosConfig:this.config,...e})}async updateDigitalAssetPropertyTransaction(e){return la({aptosConfig:this.config,...e})}async addDigitalAssetTypedPropertyTransaction(e){return ga({aptosConfig:this.config,...e})}async updateDigitalAssetTypedPropertyTransaction(e){return ma({aptosConfig:this.config,...e})}};var fa=300,Wu=n=>{if(n&&n.length>fa)throw new Error(`Event type length exceeds the maximum length of ${fa}`)};async function Aa(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 zn({aptosConfig:e,options:{...r,where:i}})}async function ha(n){let{accountAddress:e,aptosConfig:t,creationNumber:r,options:i}=n,s={account_address:{_eq:_chunkPA2XFIP3js.Z.from(e).toStringLong()},creation_number:{_eq:r}};return zn({aptosConfig:t,options:{...i,where:s}})}async function Ta(n){let{accountAddress:e,aptosConfig:t,eventType:r,options:i}=n,s={account_address:{_eq:_chunkPA2XFIP3js.Z.from(e).toStringLong()},indexed_type:{_eq:r}};return zn({aptosConfig:t,options:{...i,where:s}})}async function zn(n){let{aptosConfig:e,options:t}=n;Wu(_optionalChain([t, 'optionalAccess', _190 => _190.where, 'optionalAccess', _191 => _191.indexed_type, 'optionalAccess', _192 => _192._eq]));let r={query:Qo,variables:{where_condition:_optionalChain([t, 'optionalAccess', _193 => _193.where]),offset:_optionalChain([t, 'optionalAccess', _194 => _194.offset]),limit:_optionalChain([t, 'optionalAccess', _195 => _195.limit]),order_by:_optionalChain([t, 'optionalAccess', _196 => _196.orderBy])}};return(await b({aptosConfig:e,query:r,originMethod:"getEvents"})).events}var kn=class{constructor(e){this.config=e}async getModuleEventsByEventType(e){return await _({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"events_processor"}),Aa({aptosConfig:this.config,...e})}async getAccountEventsByCreationNumber(e){return await _({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"events_processor"}),ha({aptosConfig:this.config,...e})}async getAccountEventsByEventType(e){return await _({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"events_processor"}),Ta({aptosConfig:this.config,...e})}async getEvents(e){return await _({config:this.config,minimumLedgerVersion:_optionalChain([e, 'optionalAccess', _197 => _197.minimumLedgerVersion]),processorType:"events_processor"}),zn({aptosConfig:this.config,...e})}};async function ba(n){let{aptosConfig:e,accountAddress:t,amount:r,options:i}=n,o=_optionalChain([i, 'optionalAccess', _198 => _198.timeoutSecs])||20,{data:s}=await Eo({aptosConfig:e,path:"fund",body:{address:_chunkPA2XFIP3js.Z.from(t).toString(),amount:r},originMethod:"fundAccount"}),a=s.txn_hashes[0],c=await ct({aptosConfig:e,transactionHash:a,options:{timeoutSecs:o,checkSuccess:_optionalChain([i, 'optionalAccess', _199 => _199.checkSuccess])}});if(c.type==="user_transaction")return c;throw new Error(`Unexpected transaction received for fund account: ${c.type}`)}var On=class{constructor(e){this.config=e}async fundAccount(e){let t=await ba({aptosConfig:this.config,...e});return(_optionalChain([e, 'access', _200 => _200.options, 'optionalAccess', _201 => _201.waitForIndexer])===void 0||_optionalChain([e, 'access', _202 => _202.options, 'optionalAccess', _203 => _203.waitForIndexer]))&&await vr({aptosConfig:this.config,minimumLedgerVersion:BigInt(t.version),processorType:"fungible_asset_processor"}),t}};async function Nr(n){let{aptosConfig:e,options:t}=n,r={query:Jo,variables:{where_condition:_optionalChain([t, 'optionalAccess', _204 => _204.where]),limit:_optionalChain([t, 'optionalAccess', _205 => _205.limit]),offset:_optionalChain([t, 'optionalAccess', _206 => _206.offset])}};return(await b({aptosConfig:e,query:r,originMethod:"getFungibleAssetMetadata"})).fungible_asset_metadata}async function wa(n){let{aptosConfig:e,options:t}=n,r={query:jo,variables:{where_condition:_optionalChain([t, 'optionalAccess', _207 => _207.where]),limit:_optionalChain([t, 'optionalAccess', _208 => _208.limit]),offset:_optionalChain([t, 'optionalAccess', _209 => _209.offset])}};return(await b({aptosConfig:e,query:r,originMethod:"getFungibleAssetActivities"})).fungible_asset_activities}async function Sa(n){let{aptosConfig:e,options:t}=n,r={query:$o,variables:{where_condition:_optionalChain([t, 'optionalAccess', _210 => _210.where]),limit:_optionalChain([t, 'optionalAccess', _211 => _211.limit]),offset:_optionalChain([t, 'optionalAccess', _212 => _212.offset])}};return(await b({aptosConfig:e,query:r,originMethod:"getCurrentFungibleAssetBalances"})).current_fungible_asset_balances}var Qu={typeParameters:[{constraints:[]}],parameters:[Ce("0x1::object::Object"),new F,new j]};async function _a(n){let{aptosConfig:e,sender:t,fungibleAssetMetadataAddress:r,recipient:i,amount:o,options:s}=n;return T({aptosConfig:e,sender:t.accountAddress,data:{function:"0x1::primary_fungible_store::transfer",typeArguments:["0x1::fungible_asset::Metadata"],functionArguments:[r,i,o],abi:Qu},options:s})}var Fn=class{constructor(e){this.config=e}async getFungibleAssetMetadata(e){return await _({config:this.config,minimumLedgerVersion:_optionalChain([e, 'optionalAccess', _213 => _213.minimumLedgerVersion]),processorType:"fungible_asset_processor"}),Nr({aptosConfig:this.config,...e})}async getFungibleAssetMetadataByAssetType(e){return await _({config:this.config,minimumLedgerVersion:_optionalChain([e, 'optionalAccess', _214 => _214.minimumLedgerVersion]),processorType:"fungible_asset_processor"}),(await Nr({aptosConfig:this.config,options:{where:{asset_type:{_eq:e.assetType}}}}))[0]}async getFungibleAssetMetadataByCreatorAddress(e){return await _({config:this.config,minimumLedgerVersion:_optionalChain([e, 'optionalAccess', _215 => _215.minimumLedgerVersion]),processorType:"fungible_asset_processor"}),await Nr({aptosConfig:this.config,options:{where:{creator_address:{_eq:_chunkPA2XFIP3js.Z.from(e.creatorAddress).toStringLong()}}}})}async getFungibleAssetActivities(e){return await _({config:this.config,minimumLedgerVersion:_optionalChain([e, 'optionalAccess', _216 => _216.minimumLedgerVersion]),processorType:"fungible_asset_processor"}),wa({aptosConfig:this.config,...e})}async getCurrentFungibleAssetBalances(e){return await _({config:this.config,minimumLedgerVersion:_optionalChain([e, 'optionalAccess', _217 => _217.minimumLedgerVersion]),processorType:"fungible_asset_processor"}),Sa({aptosConfig:this.config,...e})}async transferFungibleAsset(e){return _a({aptosConfig:this.config,...e})}};var Nn=class{constructor(e){this.config=e}async getLedgerInfo(){return br({aptosConfig:this.config})}async getChainId(){return(await this.getLedgerInfo()).chain_id}async getBlockByVersion(e){return us({aptosConfig:this.config,...e})}async getBlockByHeight(e){return ds({aptosConfig:this.config,...e})}async view(e){return ce({aptosConfig:this.config,...e})}async viewJson(e){return Ms({aptosConfig:this.config,...e})}async getChainTopUserTransactions(e){return ts({aptosConfig:this.config,...e})}async queryIndexer(e){return b({aptosConfig:this.config,...e})}async getIndexerLastSuccessVersion(){return wr({aptosConfig:this.config})}async getProcessorStatus(e){return Sr({aptosConfig:this.config,processorType:e})}};var Ea=["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 Pa(n){return!(!n||n.length<3||n.length>63||!/^[a-z\d][a-z\d-]{1,61}[a-z\d]$/.test(n))}function pt(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(!Pa(e))throw new Error(`${e} is not valid. ${Ea}`);if(t&&!Pa(t))throw new Error(`${t} is not valid. ${Ea}`);return{domainName:t||e,subdomainName:t?e:void 0}}function xa(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 ju="0x585fc9f0f0c54183b039ffc770ca282ebd87307916c215a3e692f2f8e4305e82",Ju={testnet:"0x5f8fd2347449685cf41d4db97926ec3a096eaf381332be4f1318ad4d16a8497c",mainnet:"0x867ed1f6bf916171b1de3ee92849b8978b7d1b9e0a8cc982a3d19d535dfd9c0c",local:ju,custom:null,devnet:null};function tt(n){let e=Ju[n.network];if(!e)throw new Error(`The ANS contract is not deployed to ${n.network}`);return e}var Br=n=>{if(n&&typeof n=="object"&&"vec"in n&&Array.isArray(n.vec))return n.vec[0]};async function va(n){let{aptosConfig:e,name:t}=n,r=tt(e),{domainName:i,subdomainName:o}=pt(t),s=await ce({aptosConfig:e,payload:{function:`${r}::router::get_owner_addr`,functionArguments:[i,o]}}),a=Br(s[0]);return a?_chunkPA2XFIP3js.Z.from(a):void 0}async function Ia(n){let{aptosConfig:e,expiration:t,name:r,sender:i,targetAddress:o,toAddress:s,options:a,transferable:c}=n,d=tt(e),{domainName:l,subdomainName:h}=pt(r),p=t.policy==="subdomain:independent"||t.policy==="subdomain:follow-domain";if(h&&!p)throw new Error("Subdomains must have an expiration policy of either 'subdomain:independent' or 'subdomain:follow-domain'");if(p&&!h)throw new Error(`Policy is set to ${t.policy} but no subdomain was provided`);if(t.policy==="domain"){let te=_nullishCoalesce(t.years, () => (1));if(te!==1)throw new Error("For now, names can only be registered for 1 year at a time");let kt=te*31536e3;return await T({aptosConfig:e,sender:i.accountAddress.toString(),data:{function:`${d}::router::register_domain`,functionArguments:[l,kt,o,s]},options:a})}if(!h)throw new Error(`${t.policy} requires a subdomain to be provided.`);let g=await ki({aptosConfig:e,name:l});if(!g)throw new Error("The domain does not exist");let w=t.policy==="subdomain:independent"?t.expirationDate:g;if(w>g)throw new Error("The subdomain expiration time cannot be greater than the domain expiration time");return await T({aptosConfig:e,sender:i.accountAddress.toString(),data:{function:`${d}::router::register_subdomain`,functionArguments:[l,h,Math.round(w/1e3),t.policy==="subdomain:follow-domain"?1:0,!!c,o,s]},options:a})}async function ki(n){let{aptosConfig:e,name:t}=n,r=tt(e),{domainName:i,subdomainName:o}=pt(t);try{let s=await ce({aptosConfig:e,payload:{function:`${r}::router::get_expiration`,functionArguments:[i,o]}});return Number(s[0])*1e3}catch (e6){return}}async function Ca(n){let{aptosConfig:e,address:t}=n,r=tt(e),i=await ce({aptosConfig:e,payload:{function:`${r}::router::get_primary_name`,functionArguments:[_chunkPA2XFIP3js.Z.from(t).toString()]}}),o=Br(i[1]),s=Br(i[0]);if(o)return[s,o].filter(Boolean).join(".")}async function Ka(n){let{aptosConfig:e,sender:t,name:r,options:i}=n,o=tt(e);if(!r)return await T({aptosConfig:e,sender:t.accountAddress.toString(),data:{function:`${o}::router::clear_primary_name`,functionArguments:[]},options:i});let{domainName:s,subdomainName:a}=pt(r);return await T({aptosConfig:e,sender:t.accountAddress.toString(),data:{function:`${o}::router::set_primary_name`,functionArguments:[s,a]},options:i})}async function Ra(n){let{aptosConfig:e,name:t}=n,r=tt(e),{domainName:i,subdomainName:o}=pt(t),s=await ce({aptosConfig:e,payload:{function:`${r}::router::get_target_addr`,functionArguments:[i,o]}}),a=Br(s[0]);return a?_chunkPA2XFIP3js.Z.from(a):void 0}async function Ua(n){let{aptosConfig:e,sender:t,name:r,address:i,options:o}=n,s=tt(e),{domainName:a,subdomainName:c}=pt(r);return await T({aptosConfig:e,sender:t.accountAddress.toString(),data:{function:`${s}::router::set_target_addr`,functionArguments:[a,c,i]},options:o})}async function Da(n){let{aptosConfig:e,name:t}=n,{domainName:r,subdomainName:i=""}=pt(t),a=(await b({aptosConfig:e,query:{query:Zt,variables:{where_condition:{domain:{_eq:r},subdomain:{_eq:i}},limit:1}},originMethod:"getName"})).current_aptos_names[0];return a&&(a=Bn(a)),xa(a)?a:void 0}async function za(n){let{aptosConfig:e,options:t,accountAddress:r}=n,i=await Oi({aptosConfig:e});return(await b({aptosConfig:e,originMethod:"getAccountNames",query:{query:Zt,variables:{limit:_optionalChain([t, 'optionalAccess', _218 => _218.limit]),offset:_optionalChain([t, 'optionalAccess', _219 => _219.offset]),order_by:_optionalChain([t, 'optionalAccess', _220 => _220.orderBy]),where_condition:{..._nullishCoalesce(_optionalChain([n, 'access', _221 => _221.options, 'optionalAccess', _222 => _222.where]), () => ({})),owner_address:{_eq:r.toString()},expiration_timestamp:{_gte:i}}}}})).current_aptos_names.map(Bn)}async function ka(n){let{aptosConfig:e,options:t,accountAddress:r}=n,i=await Oi({aptosConfig:e});return(await b({aptosConfig:e,originMethod:"getAccountDomains",query:{query:Zt,variables:{limit:_optionalChain([t, 'optionalAccess', _223 => _223.limit]),offset:_optionalChain([t, 'optionalAccess', _224 => _224.offset]),order_by:_optionalChain([t, 'optionalAccess', _225 => _225.orderBy]),where_condition:{..._nullishCoalesce(_optionalChain([n, 'access', _226 => _226.options, 'optionalAccess', _227 => _227.where]), () => ({})),owner_address:{_eq:r.toString()},expiration_timestamp:{_gte:i},subdomain:{_eq:""}}}}})).current_aptos_names.map(Bn)}async function Oa(n){let{aptosConfig:e,options:t,accountAddress:r}=n,i=await Oi({aptosConfig:e});return(await b({aptosConfig:e,originMethod:"getAccountSubdomains",query:{query:Zt,variables:{limit:_optionalChain([t, 'optionalAccess', _228 => _228.limit]),offset:_optionalChain([t, 'optionalAccess', _229 => _229.offset]),order_by:_optionalChain([t, 'optionalAccess', _230 => _230.orderBy]),where_condition:{..._nullishCoalesce(_optionalChain([n, 'access', _231 => _231.options, 'optionalAccess', _232 => _232.where]), () => ({})),owner_address:{_eq:r.toString()},expiration_timestamp:{_gte:i},subdomain:{_neq:""}}}}})).current_aptos_names.map(Bn)}async function Fa(n){let{aptosConfig:e,options:t,domain:r}=n;return(await b({aptosConfig:e,originMethod:"getDomainSubdomains",query:{query:Zt,variables:{limit:_optionalChain([t, 'optionalAccess', _233 => _233.limit]),offset:_optionalChain([t, 'optionalAccess', _234 => _234.offset]),order_by:_optionalChain([t, 'optionalAccess', _235 => _235.orderBy]),where_condition:{..._nullishCoalesce(_optionalChain([n, 'access', _236 => _236.options, 'optionalAccess', _237 => _237.where]), () => ({})),domain:{_eq:r},subdomain:{_neq:""}}}}})).current_aptos_names.map(Bn).filter(xa)}async function Oi(n){let{aptosConfig:e}=n,t=tt(e),[r]=await ce({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 Na(n){let{aptosConfig:e,sender:t,name:r,years:i=1,options:o}=n,s=tt(e),a=i*31536e3,{domainName:c,subdomainName:d}=pt(r);if(d)throw new Error("Subdomains cannot be renewed");if(i!==1)throw new Error("Currently, only 1 year renewals are supported");return await T({aptosConfig:e,sender:t.accountAddress.toString(),data:{function:`${s}::router::renew_domain`,functionArguments:[c,a]},options:o})}function Bn(n){return{...n,expiration_timestamp:new Date(n.expiration_timestamp).getTime()}}var Gn=class{constructor(e){this.config=e}async getOwnerAddress(e){return va({aptosConfig:this.config,...e})}async getExpiration(e){return ki({aptosConfig:this.config,...e})}async getTargetAddress(e){return Ra({aptosConfig:this.config,...e})}async setTargetAddress(e){return Ua({aptosConfig:this.config,...e})}async getPrimaryName(e){return Ca({aptosConfig:this.config,...e})}async setPrimaryName(e){return Ka({aptosConfig:this.config,...e})}async registerName(e){return Ia({aptosConfig:this.config,...e})}async renewDomain(e){return Na({aptosConfig:this.config,...e})}async getName(e){return Da({aptosConfig:this.config,...e})}async getAccountNames(e){return za({aptosConfig:this.config,...e})}async getAccountDomains(e){return ka({aptosConfig:this.config,...e})}async getAccountSubdomains(e){return Oa({aptosConfig:this.config,...e})}async getDomainSubdomains(e){return Fa({aptosConfig:this.config,...e})}};async function Ba(n){let{aptosConfig:e,poolAddress:t}=n,r=_chunkPA2XFIP3js.Z.from(t).toStringLong(),o=await b({aptosConfig:e,query:{query:pi,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 Ga(n){let{aptosConfig:e,options:t}=n,r={query:pi,variables:{order_by:_optionalChain([t, 'optionalAccess', _238 => _238.orderBy])}};return(await b({aptosConfig:e,query:r})).num_active_delegator_per_pool}async function Ma(n){let{aptosConfig:e,delegatorAddress:t,poolAddress:r}=n,i={query:Wo,variables:{delegatorAddress:_chunkPA2XFIP3js.Z.from(t).toStringLong(),poolAddress:_chunkPA2XFIP3js.Z.from(r).toStringLong()}};return(await b({aptosConfig:e,query:i})).delegated_staking_activities}var Mn=class{constructor(e){this.config=e}async getNumberOfDelegators(e){return await _({config:this.config,minimumLedgerVersion:_optionalChain([e, 'optionalAccess', _239 => _239.minimumLedgerVersion]),processorType:"stake_processor"}),Ba({aptosConfig:this.config,...e})}async getNumberOfDelegatorsForAllPools(e){return await _({config:this.config,minimumLedgerVersion:_optionalChain([e, 'optionalAccess', _240 => _240.minimumLedgerVersion]),processorType:"stake_processor"}),Ga({aptosConfig:this.config,...e})}async getDelegatedStakingActivities(e){return await _({config:this.config,minimumLedgerVersion:_optionalChain([e, 'optionalAccess', _241 => _241.minimumLedgerVersion]),processorType:"stake_processor"}),Ma({aptosConfig:this.config,...e})}};var Gr=class{constructor(e){this.config=e}async simple(e){return T({aptosConfig:this.config,...e})}async scriptComposer(e){let t=new zr(this.config);await t.init();let i=(await e.builder(t)).build(),o=await vi({aptosConfig:this.config,payload:_t.load(new C(i)),...e});return new jt(o,e.withFeePayer===!0?_chunkPA2XFIP3js.Z.ZERO:void 0)}async multiAgent(e){return T({aptosConfig:this.config,...e})}};function Fi(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 Ni(n,e,t){let r=t.value;return t.value=async function(...i){return r.apply(this,i)},t}var sn=class{constructor(e){this.config=e}async simple(e){return Ri({aptosConfig:this.config,...e})}async multiAgent(e){return Ri({aptosConfig:this.config,...e})}};_chunkPA2XFIP3js.a.call(void 0, [Ni],sn.prototype,"simple",1),_chunkPA2XFIP3js.a.call(void 0, [Ni],sn.prototype,"multiAgent",1);var an=class{constructor(e){this.config=e}async simple(e){return Kn({aptosConfig:this.config,...e})}async multiAgent(e){return Kn({aptosConfig:this.config,...e})}};_chunkPA2XFIP3js.a.call(void 0, [Fi],an.prototype,"simple",1),_chunkPA2XFIP3js.a.call(void 0, [Fi],an.prototype,"multiAgent",1);var Mr=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 _chunkPA2XFIP3js._.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=_chunkPA2XFIP3js.aa.call(void 0, );for(;this.currentNumber-this.lastUncommintedNumber>=this.maximumInFlight;)await _chunkPA2XFIP3js._.call(void 0, this.sleepTime),_chunkPA2XFIP3js.aa.call(void 0, )-t>this.maxWaitTime?(console.warn(`Waited over 30 seconds for a transaction to commit, re-syncing ${this.account.accountAddress.toString()}`),await this.initialize()):await this.update()}e=this.currentNumber,this.currentNumber+=BigInt(1)}catch(t){console.error("error in getting next sequence number for this account",t)}finally{this.lock=!1}return e}async initialize(){let{sequence_number:e}=await Dt({aptosConfig:this.aptosConfig,accountAddress:this.account.accountAddress});this.currentNumber=BigInt(e),this.lastUncommintedNumber=BigInt(e)}async update(){let{sequence_number:e}=await Dt({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 _chunkPA2XFIP3js._.call(void 0, this.sleepTime);this.lock=!0;try{await this.update();let e=_chunkPA2XFIP3js.aa.call(void 0, );for(;this.lastUncommintedNumber!==this.currentNumber;)_chunkPA2XFIP3js.aa.call(void 0, )-e>this.maxWaitTime?(console.warn(`Waited over 30 seconds for a transaction to commit, re-syncing ${this.account.accountAddress.toString()}`),await this.initialize()):(await _chunkPA2XFIP3js._.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 cn=class{constructor(){this.queue=[];this.pendingDequeue=[];this.cancelled=!1}enqueue(e){if(this.cancelled=!1,this.pendingDequeue.length>0){_optionalChain([this, 'access', _242 => _242.pendingDequeue, 'access', _243 => _243.shift, 'call', _244 => _244(), 'optionalAccess', _245 => _245.resolve, 'call', _246 => _246(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 un("Task cancelled"))}),this.pendingDequeue=[],this.queue.length=0}isCancelled(){return this.cancelled}pendingDequeueLength(){return this.pendingDequeue.length}},un=class extends Error{};var Va="fulfilled",qa= exports.TransactionWorkerEventsEnum =(o=>(o.TransactionSent="transactionSent",o.TransactionSendFailed="transactionSendFailed",o.TransactionExecuted="transactionExecuted",o.TransactionExecutionFailed="transactionExecutionFailed",o.ExecutionFinish="executionFinish",o))(qa||{}),Vr= exports.TransactionWorker =class extends _eventemitter32.default{constructor(t,r,i=30,o=100,s=10){super();this.taskQueue=new cn;this.transactionsQueue=new cn;this.outstandingTransactions=new cn;this.sentTransactions=[];this.executedTransactions=[];this.aptosConfig=t,this.account=r,this.started=!1,this.accountSequnceNumber=new Mr(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=ut({aptosConfig:this.aptosConfig,transaction:r,signer:this.account});await this.outstandingTransactions.enqueue([i,t])}}catch(t){if(t instanceof un)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===Va?(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 un)return;throw new Error(`Process execution failed for ${this.account.accountAddress.toString()} with error ${t}`)}}async checkTransaction(t,r){try{let i=[];i.push(ct({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===Va?(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 T({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 qr=class extends _eventemitter32.default{constructor(e){super(),this.config=e}start(e){let{sender:t}=e;this.account=t,this.transactionWorker=new Vr(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 Vn=class{constructor(e){this.config=e,this.build=new Gr(this.config),this.simulate=new sn(this.config),this.submit=new an(this.config),this.batch=new qr(this.config)}async getTransactions(e){return yi({aptosConfig:this.config,...e})}async getTransactionByVersion(e){return as({aptosConfig:this.config,...e})}async getTransactionByHash(e){return In({aptosConfig:this.config,...e})}async isPendingTransaction(e){return cs({aptosConfig:this.config,...e})}async waitForTransaction(e){return ct({aptosConfig:this.config,...e})}async getGasPriceEstimation(){return xr({aptosConfig:this.config})}getSigningMessage(e){return Es(e)}async publishPackageTransaction(e){return xs({aptosConfig:this.config,...e})}async rotateAuthKey(e){return Gs({aptosConfig:this.config,...e})}sign(e){return kr({...e})}signAsFeePayer(e){return Or({...e})}async batchTransactionsForSingleAccount(e){try{let{sender:t,data:r,options:i}=e;this.batch.forSingleAccount({sender:t,data:r,options:i})}catch(t){throw new Error(`failed to submit transactions with error: ${t}`)}}async signAndSubmitTransaction(e){return ut({aptosConfig:this.config,...e})}async signAndSubmitAsFeePayer(e){return Ps({aptosConfig:this.config,...e})}};var qn=class{constructor(e){this.config=e}async getTableItem(e){return Er({aptosConfig:this.config,...e})}async getTableItemsData(e){return await _({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"default_processor"}),os({aptosConfig:this.config,...e})}async getTableItemsMetadata(e){return await _({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"default_processor"}),ss({aptosConfig:this.config,...e})}};async function Lr(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:_chunkPA2XFIP3js.j.fromHexInput(r.blinder).toStringWithoutPrefix(),uid_key:i,derivation_path:o},{data:a}=await Po({aptosConfig:e,path:"fetch",body:s,originMethod:"getPepper",overrides:{WITH_CREDENTIALS:!1}});return _chunkPA2XFIP3js.j.fromHexInput(a.pepper).toUint8Array()}async function Bi(n){let{aptosConfig:e,jwt:t,ephemeralKeyPair:r,pepper:i=await Lr(n),uidKey:o="sub",maxExpHorizonSecs:s=(await An({aptosConfig:e})).maxExpHorizonSecs}=n;if(_chunkPA2XFIP3js.j.fromHexInput(i).toUint8Array().length!==Ze.PEPPER_LENGTH)throw new Error(`Pepper needs to be ${Ze.PEPPER_LENGTH} bytes`);let a=_jwtdecode.jwtDecode.call(void 0, t);if(typeof a.iat!="number")throw new Error("iat was not found");if(s<r.expiryDateSecs-a.iat)throw Error(`The EphemeralKeyPair is too long lived. It's lifespan must be less than ${s}`);let c={jwt_b64:t,epk:r.getPublicKey().bcsToHex().toStringWithoutPrefix(),epk_blinder:_chunkPA2XFIP3js.j.fromHexInput(r.blinder).toStringWithoutPrefix(),exp_date_secs:r.expiryDateSecs,exp_horizon_secs:s,pepper:_chunkPA2XFIP3js.j.fromHexInput(i).toStringWithoutPrefix(),uid_key:o},{data:d}=await xo({aptosConfig:e,path:"prove",body:c,originMethod:"getProof",overrides:{WITH_CREDENTIALS:!1}}),l=d.proof,h=new qt({a:l.a,b:l.b,c:l.c});return new xe({proof:new Lt(h,0),trainingWheelsSignature:Re.fromHex(d.training_wheels_signature),expHorizonSecs:s})}async function La(n){let{aptosConfig:e,jwt:t,jwkAddress:r,uidKey:i,proofFetchCallback:o,pepper:s=await Lr(n)}=n,{verificationKey:a,maxExpHorizonSecs:c}=await An({aptosConfig:e}),d=Bi({...n,pepper:s,maxExpHorizonSecs:c}),l=o?d:await d;if(r!==void 0){let g=ee.fromJwtAndPepper({jwt:t,pepper:s,jwkAddress:r,uidKey:i}),w=await rn({aptosConfig:e,authenticationKey:g.authKey().derivedAddress()});return Rt.create({...n,address:w,proof:l,pepper:s,proofFetchCallback:o,jwkAddress:r,verificationKey:a})}let h=k.fromJwtAndPepper({jwt:t,pepper:s,uidKey:i}),p=await rn({aptosConfig:e,authenticationKey:h.authKey().derivedAddress()});return Ze.create({...n,address:p,proof:l,pepper:s,proofFetchCallback:o,verificationKey:a})}async function Ha(n){let{aptosConfig:e,sender:t,iss:r,options:i}=n,{jwksUrl:o}=n;o===void 0&&(To.test(r)?o="https://www.googleapis.com/service_accounts/v1/jwk/securetoken@system.gserviceaccount.com":o=r.endsWith("/")?`${r}.well-known/jwks.json`:`${r}/.well-known/jwks.json`);let s;try{if(s=await fetch(o),!s.ok)throw new Error(`${s.status} ${s.statusText}`)}catch(c){let d;throw c instanceof Error?d=`${c.message}`:d=`error unknown - ${c}`,z.fromErrorType({type:14,details:`Failed to fetch JWKS at ${o}: ${d}`})}let a=await s.json();return T({aptosConfig:e,sender:t.accountAddress,data:{function:"0x1::jwks::update_federated_jwk_set",functionArguments:[r,S.MoveString(a.keys.map(c=>c.kid)),S.MoveString(a.keys.map(c=>c.alg)),S.MoveString(a.keys.map(c=>c.e)),S.MoveString(a.keys.map(c=>c.n))]},options:i})}var Ln=class{constructor(e){this.config=e}async getPepper(e){return Lr({aptosConfig:this.config,...e})}async getProof(e){return Bi({aptosConfig:this.config,...e})}async deriveKeylessAccount(e){return La({aptosConfig:this.config,...e})}async updateFederatedKeylessJwkSetTransaction(e){return Ha({aptosConfig:this.config,...e})}};async function ed(n){let{aptosConfig:e,options:t}=n,r={query:Tr,variables:{where_condition:_optionalChain([t, 'optionalAccess', _247 => _247.where]),offset:_optionalChain([t, 'optionalAccess', _248 => _248.offset]),limit:_optionalChain([t, 'optionalAccess', _249 => _249.limit]),order_by:_optionalChain([t, 'optionalAccess', _250 => _250.orderBy])}};return(await b({aptosConfig:e,query:r,originMethod:"getObjectData"})).current_objects}async function $a(n){let{aptosConfig:e,objectAddress:t,options:r}=n,o={object_address:{_eq:_chunkPA2XFIP3js.Z.from(t).toStringLong()}};return(await ed({aptosConfig:e,options:{...r,where:o}}))[0]}var Hn=class{constructor(e){this.config=e}async getObjectDataByObjectAddress(e){return await _({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"objects_processor"}),$a({aptosConfig:this.config,...e})}};async function Wa(n){let{aptosConfig:e,payload:t,options:r}=n,i=await Dr({...t,aptosConfig:e}),o=new _chunkPA2XFIP3js.m;i.serialize(o);let s=o.toUint8Array(),{data:a}=await So({aptosConfig:e,path:"view",originMethod:"view",contentType:"application/x.aptos.view_function+bcs",acceptType:"application/x-bcs",params:{ledger_version:_optionalChain([r, 'optionalAccess', _251 => _251.ledgerVersion])},body:s}),c=new Uint8Array(a);return _optionalChain([r, 'optionalAccess', _252 => _252.convert])?r.convert(c):c}var $n=class{constructor(e){this.config=e}async viewBinary(e){return Wa({...e,aptosConfig:this.config})}};var J=class{constructor(e){this.config=new Fr(e),this.account=new Rn(this.config),this.abstraction=new zt(this.config),this.ans=new Gn(this.config),this.coin=new Un(this.config),this.digitalAsset=new Dn(this.config),this.event=new kn(this.config),this.experimental=new $n(this.config),this.faucet=new On(this.config),this.fungibleAsset=new Fn(this.config),this.general=new Nn(this.config),this.staking=new Mn(this.config),this.transaction=new Vn(this.config),this.table=new qn(this.config),this.keyless=new Ln(this.config),this.object=new Hn(this.config)}};function re(n,e,t){Object.getOwnPropertyNames(e.prototype).forEach(r=>{let i=Object.getOwnPropertyDescriptor(e.prototype,r);i&&(i.value=function(...o){return this[t][r](...o)},Object.defineProperty(n.prototype,r,i))})}re(J,Rn,"account");re(J,zt,"abstraction");re(J,Gn,"ans");re(J,Un,"coin");re(J,Dn,"digitalAsset");re(J,kn,"event");re(J,$n,"experimental");re(J,On,"faucet");re(J,Fn,"fungibleAsset");re(J,Nn,"general");re(J,Mn,"staking");re(J,Vn,"transaction");re(J,qn,"table");re(J,Ln,"keyless");re(J,Hn,"object");exports.APTOS_BIP44_REGEX = ac; exports.APTOS_COIN = Tt; exports.APTOS_FA = Ao; exports.APTOS_HARDENED_REGEX = sc; exports.AbstractKeylessAccount = me; exports.AbstractMultiKey = hn; exports.AbstractedAccount = Oo; exports.Account = Ye; exports.AccountAddress = _chunkPA2XFIP3js.Z; exports.AccountAuthenticator = Q; exports.AccountAuthenticatorAbstraction = Tn; exports.AccountAuthenticatorEd25519 = ve; exports.AccountAuthenticatorMultiEd25519 = He; exports.AccountAuthenticatorMultiKey = Oe; exports.AccountAuthenticatorNoAccountAuthenticator = $t; exports.AccountAuthenticatorSingleKey = se; exports.AccountAuthenticatorVariant = _chunkPA2XFIP3js.w; exports.AccountPublicKey = oe; exports.AccountSequenceNumber = Mr; exports.AccountUtils = zo; exports.AddressInvalidReason = _chunkPA2XFIP3js.Y; exports.AnyPublicKey = O; exports.AnyPublicKeyVariant = _chunkPA2XFIP3js.y; exports.AnySignature = q; exports.AnySignatureVariant = _chunkPA2XFIP3js.z; exports.Aptos = J; exports.AptosApiError = Z; exports.AptosApiType = ht; exports.AptosConfig = Fr; exports.AptosScriptComposer = zr; exports.AuthenticationKey = G; exports.Bool = D; exports.CKDPriv = oo; exports.CallArgument = _chunkPA2XFIP3js.X; exports.ChainId = Wt; exports.DEFAULT_MAX_GAS_AMOUNT = yo; exports.DEFAULT_TXN_EXP_SEC_FROM_NOW = fo; exports.DEFAULT_TXN_TIMEOUT_SEC = rr; exports.DeriveScheme = _chunkPA2XFIP3js.W; exports.Deserializer = C; exports.EPK_HORIZON_SECS = Eg; exports.Ed25519Account = ae; exports.Ed25519PrivateKey = H; exports.Ed25519PublicKey = v; exports.Ed25519Signature = I; exports.EntryFunction = Et; exports.EntryFunctionBytes = Yn; exports.EphemeralCertificate = Vt; exports.EphemeralCertificateVariant = _chunkPA2XFIP3js.C; exports.EphemeralKeyPair = Kt; exports.EphemeralPublicKey = At; exports.EphemeralPublicKeyVariant = _chunkPA2XFIP3js.A; exports.EphemeralSignature = Re; exports.EphemeralSignatureVariant = _chunkPA2XFIP3js.B; exports.FIREBASE_AUTH_ISS_PATTERN = To; exports.FederatedKeylessAccount = Rt; exports.FederatedKeylessPublicKey = ee; exports.FeePayerRawTransaction = xt; exports.FixedBytes = we; exports.Groth16VerificationKey = si; exports.Groth16Zkp = qt; exports.HARDENED_OFFSET = no; exports.Hex = _chunkPA2XFIP3js.j; exports.HexInvalidReason = _chunkPA2XFIP3js.i; exports.Identifier = K; exports.KeyType = cc; exports.KeylessAccount = Ze; exports.KeylessConfiguration = oi; exports.KeylessError = z; exports.KeylessErrorCategory = zc; exports.KeylessErrorResolutionTip = kc; exports.KeylessErrorType = ir; exports.KeylessPublicKey = k; exports.KeylessSignature = ze; exports.MAX_AUD_VAL_BYTES = qc; exports.MAX_COMMITED_EPK_BYTES = Ig; exports.MAX_EXTRA_FIELD_BYTES = xg; exports.MAX_ISS_VAL_BYTES = Pg; exports.MAX_JWT_HEADER_B64_BYTES = vg; exports.MAX_UID_KEY_BYTES = Lc; exports.MAX_UID_VAL_BYTES = Hc; exports.MimeType = _chunkPA2XFIP3js.q; exports.ModuleId = bn; exports.MoveAbility = _chunkPA2XFIP3js.S; exports.MoveFunctionVisibility = _chunkPA2XFIP3js.R; exports.MoveJWK = ai; exports.MoveOption = Y; exports.MoveString = P; exports.MoveVector = S; exports.MultiAgentRawTransaction = Pt; exports.MultiAgentTransaction = mr; exports.MultiEd25519Account = fr; exports.MultiEd25519PublicKey = Ht; exports.MultiEd25519Signature = Le; exports.MultiKey = ke; exports.MultiKeyAccount = xn; exports.MultiKeySignature = qe; exports.MultiSig = En; exports.MultiSigTransactionPayload = Pn; exports.Network = ei; exports.NetworkToChainId = ti; exports.NetworkToFaucetAPI = mo; exports.NetworkToIndexerAPI = lo; exports.NetworkToNetworkName = Al; exports.NetworkToNodeAPI = go; exports.NetworkToPepperAPI = Yr; exports.NetworkToProverAPI = Zr; exports.ParsingError = _chunkPA2XFIP3js.h; exports.PrivateKey = it; exports.PrivateKeyVariants = _chunkPA2XFIP3js.x; exports.ProcessorType = Ge; exports.PublicKey = yt; exports.RAW_TRANSACTION_SALT = ho; exports.RAW_TRANSACTION_WITH_DATA_SALT = ni; exports.RawTransaction = he; exports.RawTransactionWithData = lr; exports.RoleType = _chunkPA2XFIP3js.T; exports.RotationProofChallenge = gr; exports.Script = _n; exports.ScriptTransactionArgumentVariants = _chunkPA2XFIP3js.s; exports.Secp256k1PrivateKey = Be; exports.Secp256k1PublicKey = Ne; exports.Secp256k1Signature = ft; exports.Serializable = _chunkPA2XFIP3js.l; exports.Serialized = pn; exports.Serializer = _chunkPA2XFIP3js.m; exports.Signature = M; exports.SignedTransaction = Xe; exports.SigningScheme = _chunkPA2XFIP3js.U; exports.SigningSchemeInput = _chunkPA2XFIP3js.V; exports.SimpleTransaction = jt; exports.SingleKeyAccount = Te; exports.StructTag = Fe; exports.TransactionAndProof = di; exports.TransactionAuthenticator = Je; exports.TransactionAuthenticatorEd25519 = vt; exports.TransactionAuthenticatorFeePayer = Ct; exports.TransactionAuthenticatorMultiAgent = It; exports.TransactionAuthenticatorMultiEd25519 = Qt; exports.TransactionAuthenticatorSingleSender = at; exports.TransactionAuthenticatorVariant = _chunkPA2XFIP3js.v; exports.TransactionPayload = St; exports.TransactionPayloadEntryFunction = wn; exports.TransactionPayloadMultiSig = Sn; exports.TransactionPayloadScript = _t; exports.TransactionPayloadVariants = _chunkPA2XFIP3js.t; exports.TransactionResponseType = _chunkPA2XFIP3js.E; exports.TransactionVariants = _chunkPA2XFIP3js.u; exports.TransactionWorker = Vr; exports.TransactionWorkerEventsEnum = qa; exports.TypeTag = N; exports.TypeTagAddress = F; exports.TypeTagBool = L; exports.TypeTagGeneric = B; exports.TypeTagParserError = $; exports.TypeTagParserErrorType = pu; exports.TypeTagReference = pr; exports.TypeTagSigner = wt; exports.TypeTagStruct = A; exports.TypeTagU128 = Qe; exports.TypeTagU16 = $e; exports.TypeTagU256 = je; exports.TypeTagU32 = We; exports.TypeTagU64 = j; exports.TypeTagU8 = le; exports.TypeTagVariants = _chunkPA2XFIP3js.r; exports.TypeTagVector = x; exports.U128 = Ee; exports.U16 = Se; exports.U256 = ye; exports.U32 = _e; exports.U64 = W; exports.U8 = X; exports.ZeroKnowledgeSig = xe; exports.ZkProof = Lt; exports.ZkpVariant = _chunkPA2XFIP3js.D; exports.aptosBinaryRequest = sr; exports.aptosCoinStructTag = Ey; exports.aptosRequest = or; exports.base64UrlDecode = _chunkPA2XFIP3js.ca; exports.bigIntToBytesLE = po; exports.binaryRequest = Bc; exports.buildTransaction = Ii; exports.bytesToBigIntLE = mn; exports.checkOrConvertArgument = Ut; exports.convertAmountFromHumanReadableToOnChain = _chunkPA2XFIP3js.da; exports.convertAmountFromOnChainToHumanReadable = _chunkPA2XFIP3js.ea; exports.convertArgument = tn; exports.convertCallArgument = yb; exports.convertNumber = Ir; exports.createObjectAddress = dr; exports.createResourceAddress = Dm; exports.createTokenAddress = zm; exports.deriveKey = Wr; exports.deriveTransactionType = ci; exports.deserializeFromScriptArgument = Jc; exports.ensureBoolean = _chunkPA2XFIP3js.n; exports.fetchEntryFunctionAbi = Ts; exports.fetchFunctionAbi = xi; exports.fetchModuleAbi = Pi; exports.fetchMoveFunctionAbi = mb; exports.fetchViewFunctionAbi = bs; exports.findFirstNonSignerArg = hs; exports.floorToWholeHour = _chunkPA2XFIP3js.ba; exports.generateRawTransaction = vi; exports.generateSignedTransaction = Ci; exports.generateSignedTransactionForSimulation = ws; exports.generateSigningMessage = Jt; exports.generateSigningMessageForSerializable = Ff; exports.generateSigningMessageForTransaction = Ie; exports.generateTransactionPayload = Ur; exports.generateTransactionPayloadWithABI = Au; exports.generateUserTransactionHash = Gb; exports.generateViewFunctionPayload = Dr; exports.generateViewFunctionPayloadWithABI = hu; exports.get = ar; exports.getAptosFullNode = V; exports.getAptosPepperService = Hl; exports.getAuthenticatorForSimulation = nn; exports.getBinary = Gc; exports.getBinaryAptosFullNode = Ll; exports.getErrorMessage = _chunkPA2XFIP3js.$; exports.getFunctionParts = _chunkPA2XFIP3js.ha; exports.getIssAudAndUidVal = Ve; exports.getKeylessConfig = An; exports.getKeylessJWKs = Co; exports.hashStrToField = tr; exports.hashValues = Ss; exports.hexToAsciiString = _chunkPA2XFIP3js.k; exports.isBcsAddress = Kr; exports.isBcsBool = fi; exports.isBcsFixedBytes = gu; exports.isBcsString = Ai; exports.isBcsU128 = Si; exports.isBcsU16 = Ti; exports.isBcsU256 = _i; exports.isBcsU32 = bi; exports.isBcsU64 = wi; exports.isBcsU8 = hi; exports.isBlockEpilogueTransactionResponse = _chunkPA2XFIP3js.L; exports.isBlockMetadataTransactionResponse = _chunkPA2XFIP3js.I; exports.isBool = ms; exports.isCanonicalEd25519Signature = dc; exports.isEd25519Signature = _chunkPA2XFIP3js.M; exports.isEmptyOption = ys; exports.isEncodedEntryFunctionArgument = fs; exports.isEncodedStruct = _chunkPA2XFIP3js.ga; exports.isFeePayerSignature = _chunkPA2XFIP3js.P; exports.isGenesisTransactionResponse = _chunkPA2XFIP3js.H; exports.isKeylessSigner = yr; exports.isLargeNumber = Cr; exports.isMultiAgentSignature = _chunkPA2XFIP3js.O; exports.isMultiEd25519Signature = _chunkPA2XFIP3js.Q; exports.isNumber = lu; exports.isPendingTransactionResponse = _chunkPA2XFIP3js.F; exports.isScriptDataInput = As; exports.isSecp256k1Signature = _chunkPA2XFIP3js.N; exports.isSingleKeySigner = ui; exports.isStateCheckpointTransactionResponse = _chunkPA2XFIP3js.J; exports.isString = et; exports.isUserTransactionResponse = _chunkPA2XFIP3js.G; exports.isValidBIP44Path = ro; exports.isValidFunctionInfo = _chunkPA2XFIP3js.ia; exports.isValidHardenedPath = io; exports.isValidatorTransactionResponse = _chunkPA2XFIP3js.K; exports.mnemonicToSeed = Zn; exports.normalizeBundle = bo; exports.nowInSeconds = _chunkPA2XFIP3js.aa; exports.objectStructTag = ge; exports.optionStructTag = Py; exports.outOfRangeErrorMessage = _chunkPA2XFIP3js.o; exports.padAndPackBytesWithLen = Jr; exports.paginateWithCursor = cr; exports.paginateWithObfuscatedCursor = ur; exports.parseEncodedStruct = _chunkPA2XFIP3js.fa; exports.parseJwtHeader = Qc; exports.parseTypeTag = Ce; exports.poseidonHash = yn; exports.post = fn; exports.postAptosFaucet = Eo; exports.postAptosFullNode = st; exports.postAptosIndexer = _o; exports.postAptosPepperService = Po; exports.postAptosProvingService = xo; exports.postBinary = Mc; exports.postBinaryAptosFullNode = So; exports.promiseFulfilledStatus = Va; exports.request = Nc; exports.sleep = _chunkPA2XFIP3js._; exports.splitPath = so; exports.standardizeTypeTags = en; exports.stringStructTag = E; exports.throwTypeMismatch = R; exports.truncateAddress = _chunkPA2XFIP3js.ja; exports.validateNumberInRange = _chunkPA2XFIP3js.p;
|
|
480
480
|
//# sourceMappingURL=index.js.map
|