@aptos-labs/ts-sdk 1.29.1 → 1.31.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/common/{accountAddress-DUCC2ffJ.d.ts → accountAddress-DnSqjhSl.d.ts} +700 -245
- package/dist/common/{chunk-HBPH2AD3.js → chunk-7IYTZDXV.js} +1 -1
- package/dist/common/chunk-7IYTZDXV.js.map +1 -0
- package/dist/common/cli/index.d.ts +123 -126
- package/dist/common/cli/index.js +1 -1
- package/dist/common/cli/index.js.map +1 -1
- package/dist/common/index.d.ts +5919 -1627
- package/dist/common/index.js +11 -9
- package/dist/common/index.js.map +1 -1
- package/dist/esm/Ed25519Account-DpH9qAcg.d.mts +470 -0
- package/dist/esm/account/AbstractKeylessAccount.d.mts +5 -5
- package/dist/esm/account/AbstractKeylessAccount.mjs +1 -1
- package/dist/esm/account/Account.d.mts +2 -2
- package/dist/esm/account/Account.mjs +1 -1
- package/dist/esm/account/Ed25519Account.d.mts +2 -2
- package/dist/esm/account/Ed25519Account.mjs +1 -1
- package/dist/esm/account/EphemeralKeyPair.d.mts +49 -14
- package/dist/esm/account/EphemeralKeyPair.mjs +1 -1
- package/dist/esm/account/FederatedKeylessAccount.d.mts +3 -3
- package/dist/esm/account/FederatedKeylessAccount.mjs +1 -1
- package/dist/esm/account/KeylessAccount.d.mts +37 -3
- package/dist/esm/account/KeylessAccount.mjs +1 -1
- package/dist/esm/account/MultiKeyAccount.d.mts +54 -34
- package/dist/esm/account/MultiKeyAccount.mjs +1 -1
- package/dist/esm/account/SingleKeyAccount.d.mts +2 -2
- package/dist/esm/account/SingleKeyAccount.mjs +1 -1
- package/dist/esm/account/index.d.mts +2 -2
- package/dist/esm/account/index.mjs +1 -1
- package/dist/esm/api/account.d.mts +448 -161
- package/dist/esm/api/account.mjs +1 -1
- package/dist/esm/api/ans.d.mts +369 -122
- package/dist/esm/api/ans.mjs +1 -1
- package/dist/esm/api/aptos.d.mts +40 -7
- package/dist/esm/api/aptos.mjs +1 -1
- package/dist/esm/api/aptosConfig.d.mts +102 -14
- package/dist/esm/api/aptosConfig.mjs +1 -1
- package/dist/esm/api/coin.d.mts +52 -15
- package/dist/esm/api/coin.mjs +1 -1
- package/dist/esm/api/digitalAsset.d.mts +710 -300
- package/dist/esm/api/digitalAsset.mjs +1 -1
- package/dist/esm/api/event.d.mts +129 -26
- package/dist/esm/api/event.mjs +1 -1
- package/dist/esm/api/faucet.d.mts +44 -7
- package/dist/esm/api/faucet.mjs +1 -1
- package/dist/esm/api/fungibleAsset.d.mts +152 -49
- package/dist/esm/api/fungibleAsset.mjs +1 -1
- package/dist/esm/api/general.d.mts +171 -55
- package/dist/esm/api/general.mjs +1 -1
- package/dist/esm/api/index.d.mts +2 -2
- package/dist/esm/api/index.mjs +1 -1
- package/dist/esm/api/keyless.d.mts +86 -14
- package/dist/esm/api/keyless.mjs +1 -1
- package/dist/esm/api/object.d.mts +51 -7
- package/dist/esm/api/object.mjs +1 -1
- package/dist/esm/api/staking.d.mts +86 -17
- package/dist/esm/api/staking.mjs +1 -1
- package/dist/esm/api/table.d.mts +118 -38
- package/dist/esm/api/table.mjs +1 -1
- package/dist/esm/api/transaction.d.mts +440 -109
- package/dist/esm/api/transaction.mjs +1 -1
- package/dist/esm/api/transactionSubmission/build.d.mts +99 -13
- package/dist/esm/api/transactionSubmission/build.mjs +1 -1
- package/dist/esm/api/transactionSubmission/helpers.d.mts +79 -0
- package/dist/esm/api/transactionSubmission/helpers.mjs +1 -1
- package/dist/esm/api/transactionSubmission/management.d.mts +111 -12
- package/dist/esm/api/transactionSubmission/management.mjs +1 -1
- package/dist/esm/api/transactionSubmission/sign.d.mts +97 -3
- package/dist/esm/api/transactionSubmission/sign.mjs +1 -1
- package/dist/esm/api/transactionSubmission/sign.mjs.map +1 -1
- package/dist/esm/api/transactionSubmission/simulate.d.mts +140 -15
- package/dist/esm/api/transactionSubmission/simulate.mjs +1 -1
- package/dist/esm/api/transactionSubmission/submit.d.mts +104 -13
- package/dist/esm/api/transactionSubmission/submit.mjs +1 -1
- package/dist/esm/api/utils.d.mts +26 -3
- package/dist/esm/api/utils.mjs +1 -1
- package/dist/esm/bcs/consts.mjs +1 -1
- package/dist/esm/bcs/deserializer.d.mts +82 -32
- package/dist/esm/bcs/deserializer.mjs +1 -1
- package/dist/esm/bcs/index.mjs +1 -1
- package/dist/esm/bcs/serializable/entryFunctionBytes.d.mts +25 -6
- package/dist/esm/bcs/serializable/entryFunctionBytes.mjs +1 -1
- package/dist/esm/bcs/serializable/fixedBytes.d.mts +51 -21
- package/dist/esm/bcs/serializable/fixedBytes.mjs +1 -1
- package/dist/esm/bcs/serializable/movePrimitives.d.mts +79 -0
- package/dist/esm/bcs/serializable/movePrimitives.mjs +1 -1
- package/dist/esm/bcs/serializable/moveStructs.d.mts +119 -32
- package/dist/esm/bcs/serializable/moveStructs.mjs +1 -1
- package/dist/esm/bcs/serializer.d.mts +111 -76
- package/dist/esm/bcs/serializer.mjs +1 -1
- package/dist/esm/chunk-22ZSW5EN.mjs +2 -0
- package/dist/esm/chunk-22ZSW5EN.mjs.map +1 -0
- package/dist/esm/{chunk-7V6DEA7G.mjs → chunk-2652SPOM.mjs} +2 -2
- package/dist/esm/chunk-2652SPOM.mjs.map +1 -0
- package/dist/esm/chunk-2CGJLPHP.mjs +2 -0
- package/dist/esm/{chunk-555I4YHP.mjs.map → chunk-2CGJLPHP.mjs.map} +1 -1
- package/dist/esm/{chunk-U6Z4FNB7.mjs → chunk-2CJC43CV.mjs} +1 -1
- package/dist/esm/chunk-2CJC43CV.mjs.map +1 -0
- package/dist/esm/{chunk-PUZ25PTD.mjs → chunk-2GEIHUHT.mjs} +2 -2
- package/dist/esm/chunk-2GEIHUHT.mjs.map +1 -0
- package/dist/esm/{chunk-FRGXKOU5.mjs → chunk-3H5DGQKX.mjs} +2 -2
- package/dist/esm/chunk-3H5DGQKX.mjs.map +1 -0
- package/dist/esm/chunk-4CDDWSKZ.mjs +2 -0
- package/dist/esm/chunk-4CDDWSKZ.mjs.map +1 -0
- package/dist/esm/{chunk-L5NY7TMI.mjs → chunk-4JXB6V5O.mjs} +2 -2
- package/dist/esm/chunk-4JXB6V5O.mjs.map +1 -0
- package/dist/esm/{chunk-5655UVIK.mjs → chunk-4LKLOUMG.mjs} +2 -2
- package/dist/esm/chunk-4LKLOUMG.mjs.map +1 -0
- package/dist/esm/chunk-4OV7QU2U.mjs +2 -0
- package/dist/esm/chunk-4OV7QU2U.mjs.map +1 -0
- package/dist/esm/chunk-4VU2ABLU.mjs +2 -0
- package/dist/esm/chunk-4VU2ABLU.mjs.map +1 -0
- package/dist/esm/{chunk-25NSCK4Q.mjs → chunk-4ZK3JNQT.mjs} +2 -2
- package/dist/esm/chunk-4ZK3JNQT.mjs.map +1 -0
- package/dist/esm/{chunk-SWHLSREF.mjs → chunk-5N6KJ7KS.mjs} +2 -2
- package/dist/esm/chunk-5N6KJ7KS.mjs.map +1 -0
- package/dist/esm/{chunk-WWZ3METZ.mjs → chunk-5S3Z7MT4.mjs} +2 -2
- package/dist/esm/chunk-5S3Z7MT4.mjs.map +1 -0
- package/dist/esm/{chunk-46D5QX3G.mjs → chunk-5SGSPCOY.mjs} +2 -2
- package/dist/esm/chunk-5SGSPCOY.mjs.map +1 -0
- package/dist/esm/chunk-6DMDYBV6.mjs +2 -0
- package/dist/esm/chunk-6DMDYBV6.mjs.map +1 -0
- package/dist/esm/chunk-6FLHGOKP.mjs +2 -0
- package/dist/esm/chunk-6FLHGOKP.mjs.map +1 -0
- package/dist/esm/{chunk-LG7RJQ57.mjs → chunk-6Q2O5G3J.mjs} +1 -1
- package/dist/esm/chunk-6Q2O5G3J.mjs.map +1 -0
- package/dist/esm/{chunk-BRFHAO2Y.mjs → chunk-73GCGRFW.mjs} +2 -2
- package/dist/esm/chunk-73GCGRFW.mjs.map +1 -0
- package/dist/esm/{chunk-XK3JFCP3.mjs → chunk-7JK7UG4E.mjs} +2 -2
- package/dist/esm/chunk-7JK7UG4E.mjs.map +1 -0
- package/dist/esm/{chunk-44GYWUSH.mjs → chunk-7XS45O6M.mjs} +1 -1
- package/dist/esm/chunk-7XS45O6M.mjs.map +1 -0
- package/dist/esm/{chunk-RNTXQYJQ.mjs → chunk-A2AEFKXS.mjs} +2 -2
- package/dist/esm/chunk-A2AEFKXS.mjs.map +1 -0
- package/dist/esm/{chunk-E37YRKWK.mjs → chunk-AGBA3Y7A.mjs} +2 -2
- package/dist/esm/chunk-AGBA3Y7A.mjs.map +1 -0
- package/dist/esm/chunk-AITN3DO4.mjs +2 -0
- package/dist/esm/chunk-AITN3DO4.mjs.map +1 -0
- package/dist/esm/{chunk-OY2IX7HW.mjs → chunk-AT2ZGTXQ.mjs} +2 -2
- package/dist/esm/chunk-AT2ZGTXQ.mjs.map +1 -0
- package/dist/esm/{chunk-TVFIUUVY.mjs → chunk-AZ6LVQEG.mjs} +2 -2
- package/dist/esm/chunk-AZ6LVQEG.mjs.map +1 -0
- package/dist/esm/chunk-BAGUHYFD.mjs +2 -0
- package/dist/esm/chunk-BAGUHYFD.mjs.map +1 -0
- package/dist/esm/{chunk-EWZ2M5BW.mjs → chunk-BG2TZI3H.mjs} +2 -2
- package/dist/esm/chunk-BG2TZI3H.mjs.map +1 -0
- package/dist/esm/chunk-BOWPP6YG.mjs +2 -0
- package/dist/esm/chunk-BOWPP6YG.mjs.map +1 -0
- package/dist/esm/{chunk-GFGX3QDP.mjs → chunk-BVVHGSWC.mjs} +2 -2
- package/dist/esm/chunk-BVVHGSWC.mjs.map +1 -0
- package/dist/esm/{chunk-BD6BJETG.mjs → chunk-CC7VOPYH.mjs} +2 -2
- package/dist/esm/chunk-CC7VOPYH.mjs.map +1 -0
- package/dist/esm/{chunk-K2O24YLZ.mjs → chunk-CDQGPCHU.mjs} +2 -2
- package/dist/esm/chunk-CDQGPCHU.mjs.map +1 -0
- package/dist/esm/{chunk-HSPBA2TZ.mjs → chunk-CL6EEMSL.mjs} +2 -2
- package/dist/esm/chunk-CL6EEMSL.mjs.map +1 -0
- package/dist/esm/{chunk-SCHZ67F3.mjs → chunk-D3OEQLUE.mjs} +1 -1
- package/dist/esm/{chunk-SCHZ67F3.mjs.map → chunk-D3OEQLUE.mjs.map} +1 -1
- package/dist/esm/{chunk-NNRAQP36.mjs → chunk-DMSHPWA5.mjs} +2 -2
- package/dist/esm/chunk-DMSHPWA5.mjs.map +1 -0
- package/dist/esm/{chunk-STGYDB5E.mjs → chunk-EE7GDBA5.mjs} +2 -2
- package/dist/esm/chunk-EE7GDBA5.mjs.map +1 -0
- package/dist/esm/{chunk-CPPBQDHB.mjs → chunk-EUGLLGYW.mjs} +2 -2
- package/dist/esm/chunk-EUGLLGYW.mjs.map +1 -0
- package/dist/esm/{chunk-CVDR5SJR.mjs → chunk-F2RY4YQ7.mjs} +2 -2
- package/dist/esm/chunk-F2RY4YQ7.mjs.map +1 -0
- package/dist/esm/chunk-FTZGP6XW.mjs +2 -0
- package/dist/esm/chunk-FTZGP6XW.mjs.map +1 -0
- package/dist/esm/{chunk-6RZZIOGH.mjs → chunk-GLATLXF6.mjs} +2 -2
- package/dist/esm/chunk-GLATLXF6.mjs.map +1 -0
- package/dist/esm/{chunk-SRPI2FFA.mjs → chunk-GMKKHGXK.mjs} +1 -1
- package/dist/esm/chunk-GMKKHGXK.mjs.map +1 -0
- package/dist/esm/{chunk-TDGQGILY.mjs → chunk-GQABU3RQ.mjs} +1 -1
- package/dist/esm/chunk-GQABU3RQ.mjs.map +1 -0
- package/dist/esm/{chunk-AH44UPM4.mjs → chunk-HBIDHQ2M.mjs} +1 -1
- package/dist/esm/chunk-HBIDHQ2M.mjs.map +1 -0
- package/dist/esm/chunk-HM5HITUC.mjs +4 -0
- package/dist/esm/chunk-HM5HITUC.mjs.map +1 -0
- package/dist/esm/{chunk-6EMN3BOV.mjs → chunk-I2NMCLNW.mjs} +1 -1
- package/dist/esm/chunk-I2NMCLNW.mjs.map +1 -0
- package/dist/esm/{chunk-NH2S6SB2.mjs → chunk-IAVI3H4V.mjs} +2 -2
- package/dist/esm/chunk-IAVI3H4V.mjs.map +1 -0
- package/dist/esm/chunk-IBLZ6MZU.mjs +2 -0
- package/dist/esm/chunk-IBLZ6MZU.mjs.map +1 -0
- package/dist/esm/chunk-IECDO22V.mjs +2 -0
- package/dist/esm/chunk-IECDO22V.mjs.map +1 -0
- package/dist/esm/{chunk-3YKAGVHZ.mjs → chunk-IFXUWUP2.mjs} +2 -2
- package/dist/esm/chunk-IFXUWUP2.mjs.map +1 -0
- package/dist/esm/{chunk-EXP5STXZ.mjs → chunk-J245N3XF.mjs} +1 -1
- package/dist/esm/chunk-J245N3XF.mjs.map +1 -0
- package/dist/esm/{chunk-MS4MRLGA.mjs → chunk-JGNMNCQB.mjs} +2 -2
- package/dist/esm/chunk-JGNMNCQB.mjs.map +1 -0
- package/dist/esm/{chunk-SR24OGHJ.mjs → chunk-JN36BNWA.mjs} +2 -2
- package/dist/esm/chunk-JN36BNWA.mjs.map +1 -0
- package/dist/esm/{chunk-DAXKRXRK.mjs → chunk-JNRMHDRA.mjs} +2 -2
- package/dist/esm/chunk-JNRMHDRA.mjs.map +1 -0
- package/dist/esm/{chunk-SAPUZZEU.mjs → chunk-JVTDP4KV.mjs} +2 -2
- package/dist/esm/chunk-JVTDP4KV.mjs.map +1 -0
- package/dist/esm/{chunk-FVA2OPG4.mjs → chunk-KDMSOCZY.mjs} +1 -1
- package/dist/esm/{chunk-BCUSI3N6.mjs → chunk-KFNDDPOW.mjs} +2 -2
- package/dist/esm/chunk-KFNDDPOW.mjs.map +1 -0
- package/dist/esm/chunk-KIW54KWR.mjs +2 -0
- package/dist/esm/{chunk-QPP6BX53.mjs → chunk-KM6UXNC7.mjs} +2 -2
- package/dist/esm/chunk-KM6UXNC7.mjs.map +1 -0
- package/dist/esm/{chunk-PKXEB7XP.mjs → chunk-KRVLR3L4.mjs} +2 -2
- package/dist/esm/chunk-KRVLR3L4.mjs.map +1 -0
- package/dist/esm/{chunk-XH7YKEYR.mjs → chunk-KW4FVBDD.mjs} +2 -2
- package/dist/esm/chunk-KW4FVBDD.mjs.map +1 -0
- package/dist/esm/{chunk-AFOPNDOJ.mjs → chunk-KYJU5PWF.mjs} +2 -2
- package/dist/esm/chunk-KYJU5PWF.mjs.map +1 -0
- package/dist/esm/{chunk-X4KEZTUQ.mjs → chunk-L5J3V3HW.mjs} +2 -2
- package/dist/esm/chunk-L5J3V3HW.mjs.map +1 -0
- package/dist/esm/{chunk-LDFTE4MM.mjs → chunk-LDZPO76C.mjs} +2 -2
- package/dist/esm/chunk-LDZPO76C.mjs.map +1 -0
- package/dist/esm/{chunk-UAL27G6B.mjs → chunk-LEKBJ2EG.mjs} +1 -1
- package/dist/esm/chunk-LEKBJ2EG.mjs.map +1 -0
- package/dist/esm/{chunk-YHAPZP5A.mjs → chunk-M22UGFQ5.mjs} +2 -2
- package/dist/esm/chunk-M22UGFQ5.mjs.map +1 -0
- package/dist/esm/{chunk-TMW2HIXC.mjs → chunk-MK2QAHXC.mjs} +2 -2
- package/dist/esm/chunk-MK2QAHXC.mjs.map +1 -0
- package/dist/esm/{chunk-QCUFTD7K.mjs → chunk-MSHZ4FWB.mjs} +2 -2
- package/dist/esm/chunk-MSHZ4FWB.mjs.map +1 -0
- package/dist/esm/{chunk-KEYAPEAX.mjs → chunk-N47FTRYO.mjs} +1 -1
- package/dist/esm/chunk-N47FTRYO.mjs.map +1 -0
- package/dist/esm/{chunk-QIW56MUH.mjs → chunk-NODYW7DM.mjs} +2 -2
- package/dist/esm/chunk-NODYW7DM.mjs.map +1 -0
- package/dist/esm/chunk-OAEDFM7T.mjs +2 -0
- package/dist/esm/chunk-OAEDFM7T.mjs.map +1 -0
- package/dist/esm/chunk-ONBFUPEC.mjs +2 -0
- package/dist/esm/chunk-ONBFUPEC.mjs.map +1 -0
- package/dist/esm/chunk-OTY3NO7Q.mjs +2 -0
- package/dist/esm/chunk-OTY3NO7Q.mjs.map +1 -0
- package/dist/esm/{chunk-ZGO2SK6F.mjs → chunk-OXM4BVAY.mjs} +2 -2
- package/dist/esm/chunk-OXM4BVAY.mjs.map +1 -0
- package/dist/esm/{chunk-YJCZU6PR.mjs → chunk-OZN3OOJV.mjs} +2 -2
- package/dist/esm/chunk-OZN3OOJV.mjs.map +1 -0
- package/dist/esm/{chunk-DAJOX4PL.mjs → chunk-P3J54CQG.mjs} +2 -2
- package/dist/esm/chunk-P3J54CQG.mjs.map +1 -0
- package/dist/esm/{chunk-WP7WF54Q.mjs → chunk-PCLU4KLY.mjs} +2 -2
- package/dist/esm/chunk-PCLU4KLY.mjs.map +1 -0
- package/dist/esm/{chunk-LR65XHSF.mjs → chunk-PHP47DI4.mjs} +2 -2
- package/dist/esm/chunk-PHP47DI4.mjs.map +1 -0
- package/dist/esm/chunk-PRZ7AIGA.mjs +2 -0
- package/dist/esm/chunk-PRZ7AIGA.mjs.map +1 -0
- package/dist/esm/chunk-QQIVWB6G.mjs +2 -0
- package/dist/esm/chunk-QQIVWB6G.mjs.map +1 -0
- package/dist/esm/{chunk-TS3PYRAT.mjs → chunk-RAJTNQNL.mjs} +2 -2
- package/dist/esm/chunk-RAJTNQNL.mjs.map +1 -0
- package/dist/esm/{chunk-XONG5JZ4.mjs → chunk-RBJNSUSU.mjs} +2 -2
- package/dist/esm/chunk-RBJNSUSU.mjs.map +1 -0
- package/dist/esm/{chunk-EV2USF7B.mjs → chunk-RNJHULIT.mjs} +2 -2
- package/dist/esm/chunk-RNJHULIT.mjs.map +1 -0
- package/dist/esm/{chunk-IYQISVDX.mjs → chunk-RNRNGJDA.mjs} +2 -2
- package/dist/esm/chunk-RNRNGJDA.mjs.map +1 -0
- package/dist/esm/{chunk-N5JNKD5F.mjs → chunk-SGQFWWLQ.mjs} +2 -2
- package/dist/esm/chunk-SGQFWWLQ.mjs.map +1 -0
- package/dist/esm/{chunk-7ZLBJUVZ.mjs → chunk-SOLWFAUY.mjs} +2 -2
- package/dist/esm/chunk-SOLWFAUY.mjs.map +1 -0
- package/dist/esm/{chunk-MO4IZXLK.mjs → chunk-T5BCTWGK.mjs} +2 -2
- package/dist/esm/chunk-T5BCTWGK.mjs.map +1 -0
- package/dist/esm/{chunk-U67PFBTL.mjs → chunk-TPJLAYW6.mjs} +2 -2
- package/dist/esm/chunk-TPJLAYW6.mjs.map +1 -0
- package/dist/esm/{chunk-XXHW3ZT3.mjs → chunk-UCRROMZN.mjs} +2 -2
- package/dist/esm/chunk-UCRROMZN.mjs.map +1 -0
- package/dist/esm/{chunk-QLN2URFX.mjs → chunk-UGL2GPGK.mjs} +2 -2
- package/dist/esm/chunk-UGL2GPGK.mjs.map +1 -0
- package/dist/esm/{chunk-NMD45OTM.mjs → chunk-V5NDNR36.mjs} +2 -2
- package/dist/esm/chunk-V5NDNR36.mjs.map +1 -0
- package/dist/esm/{chunk-KYSDF3CA.mjs → chunk-VYMRIKUV.mjs} +2 -2
- package/dist/esm/chunk-VYMRIKUV.mjs.map +1 -0
- package/dist/esm/{chunk-KXBIA4KR.mjs → chunk-WSZCPSV4.mjs} +2 -2
- package/dist/esm/chunk-WSZCPSV4.mjs.map +1 -0
- package/dist/esm/{chunk-B2CXRZL5.mjs → chunk-WV2VJQDS.mjs} +2 -2
- package/dist/esm/chunk-WV2VJQDS.mjs.map +1 -0
- package/dist/esm/{chunk-B6M7QBUO.mjs → chunk-WZCKSN2U.mjs} +2 -2
- package/dist/esm/chunk-WZCKSN2U.mjs.map +1 -0
- package/dist/esm/{chunk-25TIHDS6.mjs → chunk-XFJD6QIP.mjs} +2 -2
- package/dist/esm/chunk-XFJD6QIP.mjs.map +1 -0
- package/dist/esm/{chunk-ECWOLU5T.mjs → chunk-XFY4O2S3.mjs} +2 -2
- package/dist/esm/chunk-XFY4O2S3.mjs.map +1 -0
- package/dist/esm/chunk-XOCRDV2V.mjs +2 -0
- package/dist/esm/chunk-XOCRDV2V.mjs.map +1 -0
- package/dist/esm/{chunk-TL7DR54X.mjs → chunk-XQ7ONNII.mjs} +2 -2
- package/dist/esm/chunk-XQ7ONNII.mjs.map +1 -0
- package/dist/esm/chunk-Y267I7DC.mjs +2 -0
- package/dist/esm/chunk-Y267I7DC.mjs.map +1 -0
- package/dist/esm/{chunk-G7MWTE2J.mjs → chunk-YZ5BCOGI.mjs} +2 -2
- package/dist/esm/{chunk-LXLISEQ4.mjs → chunk-ZINOJTLU.mjs} +2 -2
- package/dist/esm/chunk-ZINOJTLU.mjs.map +1 -0
- package/dist/esm/{chunk-2TQIU7CG.mjs → chunk-ZPIMARUG.mjs} +2 -2
- package/dist/esm/chunk-ZPIMARUG.mjs.map +1 -0
- package/dist/esm/chunk-ZPQUCT22.mjs +2 -0
- package/dist/esm/chunk-ZPQUCT22.mjs.map +1 -0
- package/dist/esm/cli/index.mjs +1 -1
- package/dist/esm/cli/localNode.d.mts +26 -10
- package/dist/esm/cli/localNode.mjs +1 -1
- package/dist/esm/cli/move.d.mts +104 -123
- package/dist/esm/cli/move.mjs +1 -1
- package/dist/esm/client/core.d.mts +21 -6
- package/dist/esm/client/core.mjs +1 -1
- package/dist/esm/client/get.d.mts +34 -6
- package/dist/esm/client/get.mjs +1 -1
- package/dist/esm/client/index.mjs +1 -1
- package/dist/esm/client/post.d.mts +63 -6
- package/dist/esm/client/post.mjs +1 -1
- package/dist/esm/client/types.d.mts +21 -8
- package/dist/esm/client/types.mjs +1 -1
- package/dist/esm/core/account/index.mjs +1 -1
- package/dist/esm/core/account/utils/address.d.mts +1 -1
- package/dist/esm/core/account/utils/address.mjs +1 -1
- package/dist/esm/core/account/utils/index.mjs +1 -1
- package/dist/esm/core/accountAddress.d.mts +63 -48
- package/dist/esm/core/accountAddress.mjs +1 -1
- package/dist/esm/core/authenticationKey.d.mts +1 -1
- package/dist/esm/core/authenticationKey.mjs +1 -1
- package/dist/esm/core/common.d.mts +6 -0
- package/dist/esm/core/common.mjs +1 -1
- package/dist/esm/core/crypto/ed25519.d.mts +77 -26
- package/dist/esm/core/crypto/ed25519.mjs +1 -1
- package/dist/esm/core/crypto/ephemeral.d.mts +36 -14
- package/dist/esm/core/crypto/ephemeral.mjs +1 -1
- package/dist/esm/core/crypto/federatedKeyless.d.mts +2 -14
- package/dist/esm/core/crypto/federatedKeyless.mjs +1 -1
- package/dist/esm/core/crypto/hdKey.d.mts +9 -6
- package/dist/esm/core/crypto/hdKey.mjs +1 -1
- package/dist/esm/core/crypto/index.d.mts +1 -1
- package/dist/esm/core/crypto/index.mjs +1 -1
- package/dist/esm/core/crypto/keyless.d.mts +126 -45
- package/dist/esm/core/crypto/keyless.mjs +1 -1
- package/dist/esm/core/crypto/multiEd25519.d.mts +45 -6
- package/dist/esm/core/crypto/multiEd25519.mjs +1 -1
- package/dist/esm/core/crypto/multiKey.d.mts +58 -7
- package/dist/esm/core/crypto/multiKey.mjs +1 -1
- package/dist/esm/core/crypto/poseidon.d.mts +35 -5
- package/dist/esm/core/crypto/poseidon.mjs +1 -1
- package/dist/esm/core/crypto/privateKey.d.mts +10 -6
- package/dist/esm/core/crypto/proof.d.mts +2 -6
- package/dist/esm/core/crypto/proof.mjs +1 -1
- package/dist/esm/core/crypto/publicKey.d.mts +1 -1
- package/dist/esm/core/crypto/publicKey.mjs +1 -1
- package/dist/esm/core/crypto/secp256k1.d.mts +72 -27
- package/dist/esm/core/crypto/secp256k1.mjs +1 -1
- package/dist/esm/core/crypto/signature.d.mts +5 -4
- package/dist/esm/core/crypto/signature.mjs +1 -1
- package/dist/esm/core/crypto/singleKey.d.mts +63 -5
- package/dist/esm/core/crypto/singleKey.mjs +1 -1
- package/dist/esm/core/crypto/utils.mjs +1 -1
- package/dist/esm/core/hex.d.mts +27 -28
- package/dist/esm/core/hex.mjs +1 -1
- package/dist/esm/core/index.d.mts +1 -1
- package/dist/esm/core/index.mjs +1 -1
- package/dist/esm/index.d.mts +2 -2
- package/dist/esm/index.mjs +1 -1
- package/dist/esm/internal/account.d.mts +191 -12
- package/dist/esm/internal/account.mjs +1 -1
- package/dist/esm/internal/ans.d.mts +206 -14
- package/dist/esm/internal/ans.mjs +1 -1
- package/dist/esm/internal/coin.d.mts +13 -1
- package/dist/esm/internal/coin.mjs +1 -1
- package/dist/esm/internal/digitalAsset.d.mts +330 -2
- package/dist/esm/internal/digitalAsset.mjs +1 -1
- package/dist/esm/internal/event.d.mts +39 -0
- package/dist/esm/internal/event.mjs +1 -1
- package/dist/esm/internal/faucet.d.mts +14 -0
- package/dist/esm/internal/faucet.mjs +1 -1
- package/dist/esm/internal/fungibleAsset.d.mts +48 -2
- package/dist/esm/internal/fungibleAsset.mjs +1 -1
- package/dist/esm/internal/general.d.mts +46 -0
- package/dist/esm/internal/general.mjs +1 -1
- package/dist/esm/internal/keyless.d.mts +41 -4
- package/dist/esm/internal/keyless.mjs +1 -1
- package/dist/esm/internal/object.d.mts +21 -0
- package/dist/esm/internal/object.mjs +1 -1
- package/dist/esm/internal/staking.d.mts +26 -0
- package/dist/esm/internal/staking.mjs +1 -1
- package/dist/esm/internal/table.d.mts +33 -1
- package/dist/esm/internal/table.mjs +1 -1
- package/dist/esm/internal/transaction.d.mts +107 -5
- package/dist/esm/internal/transaction.mjs +1 -1
- package/dist/esm/internal/transactionSubmission.d.mts +72 -29
- package/dist/esm/internal/transactionSubmission.mjs +1 -1
- package/dist/esm/internal/view.d.mts +1 -1
- package/dist/esm/internal/view.mjs +1 -1
- package/dist/esm/publicKey-_tPa99ea.d.mts +151 -0
- package/dist/esm/transactions/authenticator/account.d.mts +66 -17
- package/dist/esm/transactions/authenticator/account.mjs +1 -1
- package/dist/esm/transactions/authenticator/index.d.mts +1 -1
- package/dist/esm/transactions/authenticator/index.mjs +1 -1
- package/dist/esm/transactions/authenticator/transaction.d.mts +53 -20
- 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/chainId.d.mts +20 -1
- package/dist/esm/transactions/instances/chainId.mjs +1 -1
- package/dist/esm/transactions/instances/identifier.d.mts +21 -3
- package/dist/esm/transactions/instances/identifier.mjs +1 -1
- package/dist/esm/transactions/instances/index.d.mts +1 -1
- package/dist/esm/transactions/instances/index.mjs +1 -1
- package/dist/esm/transactions/instances/moduleId.d.mts +22 -8
- package/dist/esm/transactions/instances/moduleId.mjs +1 -1
- package/dist/esm/transactions/instances/multiAgentTransaction.d.mts +24 -8
- package/dist/esm/transactions/instances/multiAgentTransaction.mjs +1 -1
- package/dist/esm/transactions/instances/rawTransaction.d.mts +31 -4
- package/dist/esm/transactions/instances/rawTransaction.mjs +1 -1
- package/dist/esm/transactions/instances/rotationProofChallenge.d.mts +25 -3
- package/dist/esm/transactions/instances/rotationProofChallenge.mjs +1 -1
- package/dist/esm/transactions/instances/signedTransaction.d.mts +29 -7
- package/dist/esm/transactions/instances/signedTransaction.mjs +1 -1
- package/dist/esm/transactions/instances/simpleTransaction.d.mts +23 -8
- package/dist/esm/transactions/instances/simpleTransaction.mjs +1 -1
- package/dist/esm/transactions/instances/transactionArgument.d.mts +23 -0
- package/dist/esm/transactions/instances/transactionPayload.d.mts +72 -26
- package/dist/esm/transactions/instances/transactionPayload.mjs +1 -1
- package/dist/esm/transactions/management/accountSequenceNumber.d.mts +37 -11
- package/dist/esm/transactions/management/accountSequenceNumber.mjs +1 -1
- package/dist/esm/transactions/management/asyncQueue.d.mts +22 -19
- package/dist/esm/transactions/management/asyncQueue.mjs +1 -1
- package/dist/esm/transactions/management/index.d.mts +2 -2
- package/dist/esm/transactions/management/index.mjs +1 -1
- package/dist/esm/transactions/management/transactionWorker.d.mts +67 -36
- package/dist/esm/transactions/management/transactionWorker.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/helpers.d.mts +74 -4
- 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 +45 -23
- package/dist/esm/transactions/transactionBuilder/remoteAbi.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/signingMessage.d.mts +20 -15
- package/dist/esm/transactions/transactionBuilder/signingMessage.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/transactionBuilder.d.mts +101 -30
- package/dist/esm/transactions/transactionBuilder/transactionBuilder.mjs +1 -1
- package/dist/esm/transactions/typeTag/index.d.mts +244 -3
- package/dist/esm/transactions/typeTag/index.mjs +1 -1
- package/dist/esm/transactions/typeTag/parser.d.mts +31 -2
- package/dist/esm/transactions/typeTag/parser.mjs +1 -1
- package/dist/esm/transactions/types.d.mts +82 -34
- package/dist/esm/types/generated/queries.mjs +1 -1
- package/dist/esm/types/generated/types.mjs +1 -1
- package/dist/esm/types/index.d.mts +320 -59
- package/dist/esm/types/index.mjs +1 -1
- package/dist/esm/types/indexer.d.mts +65 -2
- package/dist/esm/types/keyless.d.mts +18 -0
- package/dist/esm/utils/apiEndpoints.d.mts +3 -0
- package/dist/esm/utils/apiEndpoints.mjs +1 -1
- package/dist/esm/utils/const.d.mts +2 -4
- package/dist/esm/utils/const.mjs +1 -1
- package/dist/esm/utils/helpers.d.mts +25 -10
- package/dist/esm/utils/helpers.mjs +1 -1
- package/dist/esm/utils/index.mjs +1 -1
- package/dist/esm/utils/memoize.d.mts +12 -10
- package/dist/esm/utils/memoize.mjs +1 -1
- package/dist/esm/utils/normalizeBundle.d.mts +11 -5
- package/dist/esm/utils/normalizeBundle.mjs +1 -1
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +3 -2
- package/src/account/AbstractKeylessAccount.ts +4 -3
- package/src/account/Account.ts +88 -54
- package/src/account/Ed25519Account.ts +56 -21
- package/src/account/EphemeralKeyPair.ts +50 -15
- package/src/account/FederatedKeylessAccount.ts +1 -1
- package/src/account/KeylessAccount.ts +37 -1
- package/src/account/MultiKeyAccount.ts +56 -35
- package/src/account/SingleKeyAccount.ts +60 -28
- package/src/api/account.ts +454 -160
- package/src/api/ans.ts +367 -120
- package/src/api/aptos.ts +38 -5
- package/src/api/aptosConfig.ts +102 -14
- package/src/api/coin.ts +49 -12
- package/src/api/digitalAsset.ts +707 -296
- package/src/api/event.ts +128 -25
- package/src/api/faucet.ts +44 -7
- package/src/api/fungibleAsset.ts +149 -46
- package/src/api/general.ts +168 -52
- package/src/api/keyless.ts +119 -22
- package/src/api/object.ts +49 -5
- package/src/api/staking.ts +84 -15
- package/src/api/table.ts +117 -37
- package/src/api/transaction.ts +438 -107
- package/src/api/transactionSubmission/build.ts +98 -12
- package/src/api/transactionSubmission/helpers.ts +79 -0
- package/src/api/transactionSubmission/management.ts +110 -10
- package/src/api/transactionSubmission/sign.ts +96 -2
- package/src/api/transactionSubmission/simulate.ts +139 -14
- package/src/api/transactionSubmission/submit.ts +103 -12
- package/src/api/utils.ts +26 -3
- package/src/bcs/deserializer.ts +82 -32
- package/src/bcs/serializable/entryFunctionBytes.ts +27 -6
- package/src/bcs/serializable/fixedBytes.ts +55 -25
- package/src/bcs/serializable/movePrimitives.ts +91 -0
- package/src/bcs/serializable/moveStructs.ts +123 -35
- package/src/bcs/serializer.ts +131 -84
- package/src/cli/localNode.ts +46 -17
- package/src/cli/move.ts +135 -137
- package/src/client/core.ts +22 -7
- package/src/client/get.ts +34 -6
- package/src/client/post.ts +63 -6
- package/src/client/types.ts +40 -13
- package/src/core/account/utils/address.ts +1 -1
- package/src/core/accountAddress.ts +63 -50
- package/src/core/authenticationKey.ts +47 -20
- package/src/core/common.ts +6 -0
- package/src/core/crypto/ed25519.ts +76 -25
- package/src/core/crypto/ephemeral.ts +37 -21
- package/src/core/crypto/federatedKeyless.ts +1 -20
- package/src/core/crypto/hdKey.ts +10 -7
- package/src/core/crypto/keyless.ts +140 -63
- package/src/core/crypto/multiEd25519.ts +44 -5
- package/src/core/crypto/multiKey.ts +66 -19
- package/src/core/crypto/poseidon.ts +72 -5
- package/src/core/crypto/privateKey.ts +9 -5
- package/src/core/crypto/proof.ts +3 -12
- package/src/core/crypto/publicKey.ts +15 -5
- package/src/core/crypto/secp256k1.ts +76 -26
- package/src/core/crypto/signature.ts +7 -4
- package/src/core/crypto/singleKey.ts +62 -5
- package/src/core/hex.ts +27 -28
- package/src/internal/account.ts +248 -12
- package/src/internal/ans.ts +219 -15
- package/src/internal/coin.ts +12 -0
- package/src/internal/digitalAsset.ts +344 -3
- package/src/internal/event.ts +51 -0
- package/src/internal/faucet.ts +14 -0
- package/src/internal/fungibleAsset.ts +46 -0
- package/src/internal/general.ts +46 -0
- package/src/internal/keyless.ts +41 -3
- package/src/internal/object.ts +21 -0
- package/src/internal/queries/getTableItemsData.graphql +1 -1
- package/src/internal/queries/getTableItemsMetadata.graphql +1 -1
- package/src/internal/staking.ts +27 -1
- package/src/internal/table.ts +32 -0
- package/src/internal/transaction.ts +120 -7
- package/src/internal/transactionSubmission.ts +86 -30
- package/src/transactions/authenticator/account.ts +65 -16
- package/src/transactions/authenticator/transaction.ts +52 -19
- package/src/transactions/instances/chainId.ts +20 -1
- package/src/transactions/instances/identifier.ts +21 -3
- package/src/transactions/instances/moduleId.ts +22 -8
- package/src/transactions/instances/multiAgentTransaction.ts +26 -10
- package/src/transactions/instances/rawTransaction.ts +31 -4
- package/src/transactions/instances/rotationProofChallenge.ts +24 -2
- package/src/transactions/instances/signedTransaction.ts +28 -6
- package/src/transactions/instances/simpleTransaction.ts +26 -11
- package/src/transactions/instances/transactionArgument.ts +26 -0
- package/src/transactions/instances/transactionPayload.ts +73 -26
- package/src/transactions/management/accountSequenceNumber.ts +38 -11
- package/src/transactions/management/asyncQueue.ts +22 -19
- package/src/transactions/management/transactionWorker.ts +66 -40
- package/src/transactions/transactionBuilder/helpers.ts +130 -3
- package/src/transactions/transactionBuilder/remoteAbi.ts +71 -30
- package/src/transactions/transactionBuilder/signingMessage.ts +19 -14
- package/src/transactions/transactionBuilder/transactionBuilder.ts +153 -40
- package/src/transactions/typeTag/index.ts +264 -3
- package/src/transactions/typeTag/parser.ts +54 -20
- package/src/transactions/types.ts +81 -33
- package/src/types/index.ts +338 -61
- package/src/types/indexer.ts +82 -2
- package/src/types/keyless.ts +21 -0
- package/src/utils/apiEndpoints.ts +3 -0
- package/src/utils/const.ts +2 -4
- package/src/utils/helpers.ts +25 -10
- package/src/utils/memoize.ts +12 -10
- package/src/utils/normalizeBundle.ts +11 -5
- package/src/version.ts +1 -1
- package/dist/common/chunk-HBPH2AD3.js.map +0 -1
- package/dist/esm/Ed25519Account-B1VMJOY2.d.mts +0 -361
- package/dist/esm/chunk-25NSCK4Q.mjs.map +0 -1
- package/dist/esm/chunk-25TIHDS6.mjs.map +0 -1
- package/dist/esm/chunk-2TQIU7CG.mjs.map +0 -1
- package/dist/esm/chunk-3MCYLML2.mjs +0 -2
- package/dist/esm/chunk-3MCYLML2.mjs.map +0 -1
- package/dist/esm/chunk-3YKAGVHZ.mjs.map +0 -1
- package/dist/esm/chunk-44GYWUSH.mjs.map +0 -1
- package/dist/esm/chunk-46D5QX3G.mjs.map +0 -1
- package/dist/esm/chunk-555I4YHP.mjs +0 -2
- package/dist/esm/chunk-5655UVIK.mjs.map +0 -1
- package/dist/esm/chunk-6EMN3BOV.mjs.map +0 -1
- package/dist/esm/chunk-6QGVRNV6.mjs +0 -2
- package/dist/esm/chunk-6QGVRNV6.mjs.map +0 -1
- package/dist/esm/chunk-6RZZIOGH.mjs.map +0 -1
- package/dist/esm/chunk-7V6DEA7G.mjs.map +0 -1
- package/dist/esm/chunk-7ZLBJUVZ.mjs.map +0 -1
- package/dist/esm/chunk-AFOPNDOJ.mjs.map +0 -1
- package/dist/esm/chunk-AH44UPM4.mjs.map +0 -1
- package/dist/esm/chunk-B2CXRZL5.mjs.map +0 -1
- package/dist/esm/chunk-B5NYEWNM.mjs +0 -2
- package/dist/esm/chunk-B5NYEWNM.mjs.map +0 -1
- package/dist/esm/chunk-B6M7QBUO.mjs.map +0 -1
- package/dist/esm/chunk-BCUSI3N6.mjs.map +0 -1
- package/dist/esm/chunk-BD6BJETG.mjs.map +0 -1
- package/dist/esm/chunk-BF4ZE37Q.mjs +0 -2
- package/dist/esm/chunk-BF4ZE37Q.mjs.map +0 -1
- package/dist/esm/chunk-BKEJMQQ6.mjs +0 -2
- package/dist/esm/chunk-BKEJMQQ6.mjs.map +0 -1
- package/dist/esm/chunk-BRFHAO2Y.mjs.map +0 -1
- package/dist/esm/chunk-BSUYPXRD.mjs +0 -2
- package/dist/esm/chunk-BSUYPXRD.mjs.map +0 -1
- package/dist/esm/chunk-CCMHWJ3Q.mjs +0 -2
- package/dist/esm/chunk-CCMHWJ3Q.mjs.map +0 -1
- package/dist/esm/chunk-CPPBQDHB.mjs.map +0 -1
- package/dist/esm/chunk-CVDR5SJR.mjs.map +0 -1
- package/dist/esm/chunk-DAJOX4PL.mjs.map +0 -1
- package/dist/esm/chunk-DAXKRXRK.mjs.map +0 -1
- package/dist/esm/chunk-DF4WKSTK.mjs +0 -2
- package/dist/esm/chunk-DF4WKSTK.mjs.map +0 -1
- package/dist/esm/chunk-E37YRKWK.mjs.map +0 -1
- package/dist/esm/chunk-ECWOLU5T.mjs.map +0 -1
- package/dist/esm/chunk-EV2USF7B.mjs.map +0 -1
- package/dist/esm/chunk-EWZ2M5BW.mjs.map +0 -1
- package/dist/esm/chunk-EXP5STXZ.mjs.map +0 -1
- package/dist/esm/chunk-FRGXKOU5.mjs.map +0 -1
- package/dist/esm/chunk-GFGX3QDP.mjs.map +0 -1
- package/dist/esm/chunk-GGR3P2TG.mjs +0 -2
- package/dist/esm/chunk-GGR3P2TG.mjs.map +0 -1
- package/dist/esm/chunk-HAT5S2XX.mjs +0 -2
- package/dist/esm/chunk-HAT5S2XX.mjs.map +0 -1
- package/dist/esm/chunk-HPZ2S4FE.mjs +0 -2
- package/dist/esm/chunk-HPZ2S4FE.mjs.map +0 -1
- package/dist/esm/chunk-HSPBA2TZ.mjs.map +0 -1
- package/dist/esm/chunk-IMGLHDIA.mjs +0 -2
- package/dist/esm/chunk-IMGLHDIA.mjs.map +0 -1
- package/dist/esm/chunk-IYQISVDX.mjs.map +0 -1
- package/dist/esm/chunk-K2O24YLZ.mjs.map +0 -1
- package/dist/esm/chunk-KA6FZNWP.mjs +0 -2
- package/dist/esm/chunk-KA6FZNWP.mjs.map +0 -1
- package/dist/esm/chunk-KEYAPEAX.mjs.map +0 -1
- package/dist/esm/chunk-KXBIA4KR.mjs.map +0 -1
- package/dist/esm/chunk-KYSDF3CA.mjs.map +0 -1
- package/dist/esm/chunk-L5NY7TMI.mjs.map +0 -1
- package/dist/esm/chunk-LDFTE4MM.mjs.map +0 -1
- package/dist/esm/chunk-LG3DAAPD.mjs +0 -2
- package/dist/esm/chunk-LG3DAAPD.mjs.map +0 -1
- package/dist/esm/chunk-LG7RJQ57.mjs.map +0 -1
- package/dist/esm/chunk-LGD5KU56.mjs +0 -2
- package/dist/esm/chunk-LGD5KU56.mjs.map +0 -1
- package/dist/esm/chunk-LR65XHSF.mjs.map +0 -1
- package/dist/esm/chunk-LXLISEQ4.mjs.map +0 -1
- package/dist/esm/chunk-M2QV232A.mjs +0 -2
- package/dist/esm/chunk-M2QV232A.mjs.map +0 -1
- package/dist/esm/chunk-MEWFJJJN.mjs +0 -2
- package/dist/esm/chunk-MEWFJJJN.mjs.map +0 -1
- package/dist/esm/chunk-MO4IZXLK.mjs.map +0 -1
- package/dist/esm/chunk-MS4MRLGA.mjs.map +0 -1
- package/dist/esm/chunk-N5JNKD5F.mjs.map +0 -1
- package/dist/esm/chunk-NH2S6SB2.mjs.map +0 -1
- package/dist/esm/chunk-NMD45OTM.mjs.map +0 -1
- package/dist/esm/chunk-NNRAQP36.mjs.map +0 -1
- package/dist/esm/chunk-OY2IX7HW.mjs.map +0 -1
- package/dist/esm/chunk-PKXEB7XP.mjs.map +0 -1
- package/dist/esm/chunk-PNXUYOYI.mjs +0 -2
- package/dist/esm/chunk-PNXUYOYI.mjs.map +0 -1
- package/dist/esm/chunk-PUZ25PTD.mjs.map +0 -1
- package/dist/esm/chunk-Q4XR6QOZ.mjs +0 -2
- package/dist/esm/chunk-QCUFTD7K.mjs.map +0 -1
- package/dist/esm/chunk-QDIKOQRK.mjs +0 -2
- package/dist/esm/chunk-QDIKOQRK.mjs.map +0 -1
- package/dist/esm/chunk-QIW56MUH.mjs.map +0 -1
- package/dist/esm/chunk-QLN2URFX.mjs.map +0 -1
- package/dist/esm/chunk-QPP6BX53.mjs.map +0 -1
- package/dist/esm/chunk-RNTXQYJQ.mjs.map +0 -1
- package/dist/esm/chunk-SAPUZZEU.mjs.map +0 -1
- package/dist/esm/chunk-SR24OGHJ.mjs.map +0 -1
- package/dist/esm/chunk-SRPI2FFA.mjs.map +0 -1
- package/dist/esm/chunk-STGYDB5E.mjs.map +0 -1
- package/dist/esm/chunk-SWHLSREF.mjs.map +0 -1
- package/dist/esm/chunk-TDGQGILY.mjs.map +0 -1
- package/dist/esm/chunk-TL7DR54X.mjs.map +0 -1
- package/dist/esm/chunk-TMW2HIXC.mjs.map +0 -1
- package/dist/esm/chunk-TS3PYRAT.mjs.map +0 -1
- package/dist/esm/chunk-TVFIUUVY.mjs.map +0 -1
- package/dist/esm/chunk-U67PFBTL.mjs.map +0 -1
- package/dist/esm/chunk-U6Z4FNB7.mjs.map +0 -1
- package/dist/esm/chunk-UAL27G6B.mjs.map +0 -1
- package/dist/esm/chunk-WP7WF54Q.mjs.map +0 -1
- package/dist/esm/chunk-WS4RPKL6.mjs +0 -2
- package/dist/esm/chunk-WS4RPKL6.mjs.map +0 -1
- package/dist/esm/chunk-WWZ3METZ.mjs.map +0 -1
- package/dist/esm/chunk-X4KEZTUQ.mjs.map +0 -1
- package/dist/esm/chunk-XH7YKEYR.mjs.map +0 -1
- package/dist/esm/chunk-XK3JFCP3.mjs.map +0 -1
- package/dist/esm/chunk-XONG5JZ4.mjs.map +0 -1
- package/dist/esm/chunk-XXHW3ZT3.mjs.map +0 -1
- package/dist/esm/chunk-Y7F2V3R6.mjs +0 -2
- package/dist/esm/chunk-Y7F2V3R6.mjs.map +0 -1
- package/dist/esm/chunk-YHAPZP5A.mjs.map +0 -1
- package/dist/esm/chunk-YJCZU6PR.mjs.map +0 -1
- package/dist/esm/chunk-ZGO2SK6F.mjs.map +0 -1
- package/dist/esm/publicKey-B3XRNhHO.d.mts +0 -113
- /package/dist/esm/{chunk-FVA2OPG4.mjs.map → chunk-KDMSOCZY.mjs.map} +0 -0
- /package/dist/esm/{chunk-Q4XR6QOZ.mjs.map → chunk-KIW54KWR.mjs.map} +0 -0
- /package/dist/esm/{chunk-G7MWTE2J.mjs.map → chunk-YZ5BCOGI.mjs.map} +0 -0
package/dist/common/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } function _optionalChainDelete(ops) { const result = _optionalChain(ops); return result == null ? true : result; }var _chunkHBPH2AD3js = require('./chunk-HBPH2AD3.js');var In=255,Un=65535,Ce=4294967295,Ze=18446744073709551615n,Wt=340282366920938463463374607431768211455n,Rn=115792089237316195423570985008687907853269984665640564039457584007913129639935n;var q=class{constructor(e){this.buffer=new ArrayBuffer(e.length),new Uint8Array(this.buffer).set(e,0),this.offset=0}read(e){if(this.offset+e>this.buffer.byteLength)throw new Error("Reached to the end of buffer");let t=this.buffer.slice(this.offset,this.offset+e);return this.offset+=e,t}remaining(){return this.buffer.byteLength-this.offset}deserializeStr(){let e=this.deserializeBytes();return new TextDecoder().decode(e)}deserializeOptionStr(){return this.deserializeBool()?this.deserializeStr():void 0}deserializeOption(e){return this.deserializeBool()?this.deserialize(e):void 0}deserializeBytes(){let e=this.deserializeUleb128AsU32();return new Uint8Array(this.read(e))}deserializeFixedBytes(e){return new Uint8Array(this.read(e))}deserializeBool(){let e=new Uint8Array(this.read(1))[0];if(e!==1&&e!==0)throw new Error("Invalid boolean value");return e===1}deserializeU8(){return new DataView(this.read(1)).getUint8(0)}deserializeU16(){return new DataView(this.read(2)).getUint16(0,!0)}deserializeU32(){return new DataView(this.read(4)).getUint32(0,!0)}deserializeU64(){let e=this.deserializeU32(),t=this.deserializeU32();return BigInt(BigInt(t)<<BigInt(32)|BigInt(e))}deserializeU128(){let e=this.deserializeU64(),t=this.deserializeU64();return BigInt(t<<BigInt(64)|e)}deserializeU256(){let e=this.deserializeU128(),t=this.deserializeU128();return BigInt(t<<BigInt(128)|e)}deserializeUleb128AsU32(){let e=BigInt(0),t=0;for(;e<Ce;){let r=this.deserializeU8();if(e|=BigInt(r&127)<<BigInt(t),!(r&128))break;t+=7}if(e>Ce)throw new Error("Overflow while parsing uleb128-encoded uint32 value");return Number(e)}deserialize(e){return e.deserialize(this)}deserializeVector(e){let t=this.deserializeUleb128AsU32(),r=new Array;for(let i=0;i<t;i+=1)r.push(this.deserialize(e));return r}};var _utils = require('@noble/hashes/utils');var J=class extends Error{constructor(e,t){super(e),this.invalidReason=t}};var ma=(r=>(r.TOO_SHORT="too_short",r.INVALID_LENGTH="invalid_length",r.INVALID_HEX_CHARS="invalid_hex_chars",r))(ma||{}),g= exports.Hex =class n{constructor(e){this.data=e}toUint8Array(){return this.data}toStringWithoutPrefix(){return _utils.bytesToHex.call(void 0, this.data)}toString(){return`0x${this.toStringWithoutPrefix()}`}static fromHexString(e){let t=e;if(t.startsWith("0x")&&(t=t.slice(2)),t.length===0)throw new J("Hex string is too short, must be at least 1 char long, excluding the optional leading 0x.","too_short");if(t.length%2!==0)throw new J("Hex string must be an even number of hex characters.","invalid_length");try{return new n(_utils.hexToBytes.call(void 0, t))}catch(r){throw new J(`Hex string contains invalid hex characters: ${_optionalChain([r, 'optionalAccess', _2 => _2.message])}`,"invalid_hex_chars")}}static fromHexInput(e){return e instanceof Uint8Array?new n(e):n.fromHexString(e)}static isValid(e){try{return n.fromHexString(e),{valid:!0}}catch(t){return{valid:!1,invalidReason:_optionalChain([t, 'optionalAccess', _3 => _3.invalidReason]),invalidReasonMessage:_optionalChain([t, 'optionalAccess', _4 => _4.message])}}}equals(e){return this.data.length!==e.data.length?!1:this.data.every((t,r)=>t===e.data[r])}};var l=class{bcsToBytes(){let e=new V;return this.serialize(e),e.toUint8Array()}bcsToHex(){let e=this.bcsToBytes();return g.fromHexInput(e)}},V= exports.Serializer =class{constructor(e=64){if(e<=0)throw new Error("Length needs to be greater than 0");this.buffer=new ArrayBuffer(e),this.offset=0}ensureBufferWillHandleSize(e){for(;this.buffer.byteLength<this.offset+e;){let t=new ArrayBuffer(this.buffer.byteLength*2);new Uint8Array(t).set(new Uint8Array(this.buffer)),this.buffer=t}}appendToBuffer(e){this.ensureBufferWillHandleSize(e.length),new Uint8Array(this.buffer,this.offset).set(e),this.offset+=e.length}serializeWithFunction(e,t,r){this.ensureBufferWillHandleSize(t);let i=new DataView(this.buffer,this.offset);e.apply(i,[0,r,!0]),this.offset+=t}serializeStr(e){let t=new TextEncoder;this.serializeBytes(t.encode(e))}serializeBytes(e){this.serializeU32AsUleb128(e.length),this.appendToBuffer(e)}serializeFixedBytes(e){this.appendToBuffer(e)}serializeBool(e){Sr(e);let t=e?1:0;this.appendToBuffer(new Uint8Array([t]))}serializeU8(e){this.appendToBuffer(new Uint8Array([e]))}serializeU16(e){this.serializeWithFunction(DataView.prototype.setUint16,2,e)}serializeU32(e){this.serializeWithFunction(DataView.prototype.setUint32,4,e)}serializeU64(e){let t=BigInt(e)&BigInt(Ce),r=BigInt(e)>>BigInt(32);this.serializeU32(Number(t)),this.serializeU32(Number(r))}serializeU128(e){let t=BigInt(e)&Ze,r=BigInt(e)>>BigInt(64);this.serializeU64(t),this.serializeU64(r)}serializeU256(e){let t=BigInt(e)&Wt,r=BigInt(e)>>BigInt(128);this.serializeU128(t),this.serializeU128(r)}serializeU32AsUleb128(e){let t=e,r=[];for(;t>>>7;)r.push(t&127|128),t>>>=7;r.push(t),this.appendToBuffer(new Uint8Array(r))}toUint8Array(){return new Uint8Array(this.buffer).slice(0,this.offset)}serialize(e){e.serialize(this)}serializeVector(e){this.serializeU32AsUleb128(e.length),e.forEach(t=>{t.serialize(this)})}serializeOption(e){let t=e!==void 0;this.serializeBool(t),t&&e.serialize(this)}serializeOptionStr(e){e===void 0?this.serializeU32AsUleb128(0):(this.serializeU32AsUleb128(1),this.serializeStr(e))}};_chunkHBPH2AD3js.a.call(void 0, [Ye(0,In)],V.prototype,"serializeU8",1),_chunkHBPH2AD3js.a.call(void 0, [Ye(0,Un)],V.prototype,"serializeU16",1),_chunkHBPH2AD3js.a.call(void 0, [Ye(0,Ce)],V.prototype,"serializeU32",1),_chunkHBPH2AD3js.a.call(void 0, [Ye(BigInt(0),Ze)],V.prototype,"serializeU64",1),_chunkHBPH2AD3js.a.call(void 0, [Ye(BigInt(0),Wt)],V.prototype,"serializeU128",1),_chunkHBPH2AD3js.a.call(void 0, [Ye(BigInt(0),Rn)],V.prototype,"serializeU256",1),_chunkHBPH2AD3js.a.call(void 0, [Ye(0,Ce)],V.prototype,"serializeU32AsUleb128",1);function Sr(n){if(typeof n!="boolean")throw new Error(`${n} is not a boolean value`)}var ya=(n,e,t)=>`${n} is out of range: [${e}, ${t}]`;function Ge(n,e,t){let r=BigInt(n);if(r>BigInt(t)||r<BigInt(e))throw new Error(ya(n,e,t))}function Ye(n,e){return(t,r,i)=>{let o=i.value;return i.value=function(a){return Ge(a,n,e),o.apply(this,[a])},i}}var Je=class n extends l{constructor(e){super(),this.value=g.fromHexInput(e).toUint8Array()}serialize(e){e.serializeFixedBytes(this.value)}serializeForEntryFunction(e){e.serialize(this)}serializeForScriptFunction(e){e.serialize(this)}static deserialize(e,t){let r=e.deserializeFixedBytes(t);return new n(r)}};var Kn=class n extends l{constructor(e){super(),this.value=new Je(e)}serialize(e){e.serialize(this.value)}serializeForEntryFunction(e){e.serializeU32AsUleb128(this.value.value.length),e.serialize(this)}static deserialize(e,t){let r=Je.deserialize(e,t);return new n(r.value)}};var zn=(i=>(i.JSON="application/json",i.BCS="application/x-bcs",i.BCS_SIGNED_TRANSACTION="application/x.aptos.signed_transaction+bcs",i.BCS_VIEW_FUNCTION="application/x.aptos.view_function+bcs",i))(zn||{}),wi= exports.TypeTagVariants =(m=>(m[m.Bool=0]="Bool",m[m.U8=1]="U8",m[m.U64=2]="U64",m[m.U128=3]="U128",m[m.Address=4]="Address",m[m.Signer=5]="Signer",m[m.Vector=6]="Vector",m[m.Struct=7]="Struct",m[m.U16=8]="U16",m[m.U32=9]="U32",m[m.U256=10]="U256",m[m.Reference=254]="Reference",m[m.Generic=255]="Generic",m))(wi||{}),jt= exports.ScriptTransactionArgumentVariants =(p=>(p[p.U8=0]="U8",p[p.U64=1]="U64",p[p.U128=2]="U128",p[p.Address=3]="Address",p[p.U8Vector=4]="U8Vector",p[p.Bool=5]="Bool",p[p.U16=6]="U16",p[p.U32=7]="U32",p[p.U256=8]="U256",p[p.Serialized=9]="Serialized",p))(jt||{}),Si= exports.TransactionPayloadVariants =(r=>(r[r.Script=0]="Script",r[r.EntryFunction=2]="EntryFunction",r[r.Multisig=3]="Multisig",r))(Si||{}),xi= exports.TransactionVariants =(t=>(t[t.MultiAgentTransaction=0]="MultiAgentTransaction",t[t.FeePayerTransaction=1]="FeePayerTransaction",t))(xi||{}),_i= exports.TransactionAuthenticatorVariant =(o=>(o[o.Ed25519=0]="Ed25519",o[o.MultiEd25519=1]="MultiEd25519",o[o.MultiAgent=2]="MultiAgent",o[o.FeePayer=3]="FeePayer",o[o.SingleSender=4]="SingleSender",o))(_i||{}),Pi= exports.AccountAuthenticatorVariant =(i=>(i[i.Ed25519=0]="Ed25519",i[i.MultiEd25519=1]="MultiEd25519",i[i.SingleKey=2]="SingleKey",i[i.MultiKey=3]="MultiKey",i))(Pi||{}),kn= exports.AnyPublicKeyVariant =(i=>(i[i.Ed25519=0]="Ed25519",i[i.Secp256k1=1]="Secp256k1",i[i.Keyless=3]="Keyless",i[i.FederatedKeyless=4]="FederatedKeyless",i))(kn||{}),vi= exports.AnySignatureVariant =(r=>(r[r.Ed25519=0]="Ed25519",r[r.Secp256k1=1]="Secp256k1",r[r.Keyless=3]="Keyless",r))(vi||{}),xr= exports.EphemeralPublicKeyVariant =(e=>(e[e.Ed25519=0]="Ed25519",e))(xr||{}),Ci= exports.EphemeralSignatureVariant =(e=>(e[e.Ed25519=0]="Ed25519",e))(Ci||{}),_r= exports.EphemeralCertificateVariant =(e=>(e[e.ZkProof=0]="ZkProof",e))(_r||{}),Pr= exports.ZkpVariant =(e=>(e[e.Groth16=0]="Groth16",e))(Pr||{}),vr= exports.TransactionResponseType =(a=>(a.Pending="pending_transaction",a.User="user_transaction",a.Genesis="genesis_transaction",a.BlockMetadata="block_metadata_transaction",a.StateCheckpoint="state_checkpoint_transaction",a.Validator="validator_transaction",a.BlockEpilogue="block_epilogue_transaction",a))(vr||{});function Du(n){return n.type==="pending_transaction"}function Bu(n){return n.type==="user_transaction"}function Gu(n){return n.type==="genesis_transaction"}function Fu(n){return n.type==="block_metadata_transaction"}function Nu(n){return n.type==="state_checkpoint_transaction"}function Ou(n){return n.type==="validator_transaction"}function Mu(n){return n.type==="block_epilogue_transaction"}function qu(n){return"signature"in n&&n.signature==="ed25519_signature"}function Vu(n){return"signature"in n&&n.signature==="secp256k1_ecdsa_signature"}function $u(n){return n.type==="multi_agent_signature"}function Lu(n){return n.type==="fee_payer_signature"}function Hu(n){return n.type==="multi_ed25519_signature"}var fa=(r=>(r.PRIVATE="private",r.PUBLIC="public",r.FRIEND="friend",r))(fa||{}),Ei= exports.MoveAbility =(i=>(i.STORE="store",i.DROP="drop",i.KEY="key",i.COPY="copy",i))(Ei||{}),Aa= exports.RoleType =(t=>(t.VALIDATOR="validator",t.FULL_NODE="full_node",t))(Aa||{}),me= exports.SigningScheme =(i=>(i[i.Ed25519=0]="Ed25519",i[i.MultiEd25519=1]="MultiEd25519",i[i.SingleKey=2]="SingleKey",i[i.MultiKey=3]="MultiKey",i))(me||{}),Cr= exports.SigningSchemeInput =(t=>(t[t.Ed25519=0]="Ed25519",t[t.Secp256k1Ecdsa=2]="Secp256k1Ecdsa",t))(Cr||{}),Ii= exports.DeriveScheme =(o=>(o[o.DeriveAuid=251]="DeriveAuid",o[o.DeriveObjectAddressFromObject=252]="DeriveObjectAddressFromObject",o[o.DeriveObjectAddressFromGuid=253]="DeriveObjectAddressFromGuid",o[o.DeriveObjectAddressFromSeed=254]="DeriveObjectAddressFromSeed",o[o.DeriveResourceAccountAddress=255]="DeriveResourceAccountAddress",o))(Ii||{});var I=class n extends l{constructor(e){super(),Sr(e),this.value=e}serialize(e){e.serializeBool(this.value)}serializeForEntryFunction(e){let t=this.bcsToBytes();e.serializeBytes(t)}serializeForScriptFunction(e){e.serializeU32AsUleb128(5),e.serialize(this)}static deserialize(e){return new n(e.deserializeBool())}},$= exports.U8 =class n extends l{constructor(e){super(),Ge(e,0,In),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())}},ye= exports.U16 =class n extends l{constructor(e){super(),Ge(e,0,Un),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())}},fe= exports.U32 =class n extends l{constructor(e){super(),Ge(e,0,Ce),this.value=e}serialize(e){e.serializeU32(this.value)}serializeForEntryFunction(e){let t=this.bcsToBytes();e.serializeBytes(t)}serializeForScriptFunction(e){e.serializeU32AsUleb128(7),e.serialize(this)}static deserialize(e){return new n(e.deserializeU32())}},O= exports.U64 =class n extends l{constructor(e){super(),Ge(e,BigInt(0),Ze),this.value=BigInt(e)}serialize(e){e.serializeU64(this.value)}serializeForEntryFunction(e){let t=this.bcsToBytes();e.serializeBytes(t)}serializeForScriptFunction(e){e.serializeU32AsUleb128(1),e.serialize(this)}static deserialize(e){return new n(e.deserializeU64())}},Ae= exports.U128 =class n extends l{constructor(e){super(),Ge(e,BigInt(0),Wt),this.value=BigInt(e)}serialize(e){e.serializeU128(this.value)}serializeForEntryFunction(e){let t=this.bcsToBytes();e.serializeBytes(t)}serializeForScriptFunction(e){e.serializeU32AsUleb128(2),e.serialize(this)}static deserialize(e){return new n(e.deserializeU128())}},he= exports.U256 =class n extends l{constructor(e){super(),Ge(e,BigInt(0),Rn),this.value=BigInt(e)}serialize(e){e.serializeU256(this.value)}serializeForEntryFunction(e){let t=this.bcsToBytes();e.serializeBytes(t)}serializeForScriptFunction(e){e.serializeU32AsUleb128(8),e.serialize(this)}static deserialize(e){return new n(e.deserializeU256())}};var h=class n extends 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 $)){new Xt(this.bcsToBytes()).serializeForScriptFunction(e);return}e.serializeU32AsUleb128(4),e.serialize(this)}static U8(e){let t;if(Array.isArray(e)&&e.length===0)t=[];else if(Array.isArray(e)&&typeof e[0]=="number")t=e;else if(typeof e=="string"){let r=g.fromHexInput(e);t=Array.from(r.toUint8Array())}else if(e instanceof Uint8Array)t=Array.from(e);else throw new Error("Invalid input type, must be an number[], Uint8Array, or hex string");return new n(t.map(r=>new $(r)))}static U16(e){return new n(e.map(t=>new ye(t)))}static U32(e){return new n(e.map(t=>new fe(t)))}static U64(e){return new n(e.map(t=>new O(t)))}static U128(e){return new n(e.map(t=>new Ae(t)))}static U256(e){return new n(e.map(t=>new he(t)))}static Bool(e){return new n(e.map(t=>new I(t)))}static MoveString(e){return new n(e.map(t=>new S(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)}},Xt= exports.Serialized =class n extends l{constructor(e){super(),this.value=g.fromHexInput(e).toUint8Array()}serialize(e){e.serializeBytes(this.value)}serializeForEntryFunction(e){this.serialize(e)}serializeForScriptFunction(e){e.serializeU32AsUleb128(9),this.serialize(e)}static deserialize(e){return new n(e.deserializeBytes())}toMoveVector(e){let t=new q(this.bcsToBytes());t.deserializeUleb128AsU32();let r=t.deserializeVector(e);return new h(r)}},S= exports.MoveString =class n extends 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);h.U8(r).serializeForScriptFunction(e)}static deserialize(e){return new n(e.deserializeStr())}},L= exports.MoveOption =class n extends l{constructor(e){super(),typeof e<"u"&&e!==null?this.vec=new h([e]):this.vec=new h([]),[this.value]=this.vec.values}serializeForEntryFunction(e){let t=this.bcsToBytes();e.serializeBytes(t)}unwrap(){if(this.isSome())return this.vec.values[0];throw new Error("Called unwrap on a MoveOption with no value")}isSome(){return this.vec.values.length===1}serialize(e){this.vec.serialize(e)}static U8(e){return new n(e!=null?new $(e):void 0)}static U16(e){return new n(e!=null?new ye(e):void 0)}static U32(e){return new n(e!=null?new fe(e):void 0)}static U64(e){return new n(e!=null?new O(e):void 0)}static U128(e){return new n(e!=null?new Ae(e):void 0)}static U256(e){return new n(e!=null?new he(e):void 0)}static Bool(e){return new n(e!=null?new I(e):void 0)}static MoveString(e){return new n(e!=null?new S(e):void 0)}static deserialize(e,t){let r=h.deserialize(e,t);return new n(r.values[0])}};var _ed25519 = require('@noble/curves/ed25519');var _sha3 = require('@noble/hashes/sha3');var ba=(a=>(a.INCORRECT_NUMBER_OF_BYTES="incorrect_number_of_bytes",a.INVALID_HEX_CHARS="invalid_hex_chars",a.TOO_SHORT="too_short",a.TOO_LONG="too_long",a.LEADING_ZERO_X_REQUIRED="leading_zero_x_required",a.LONG_FORM_REQUIRED_UNLESS_SPECIAL="long_form_required_unless_special",a.INVALID_PADDING_ZEROES="INVALID_PADDING_ZEROES",a))(ba||{}),x=class x extends l{constructor(e){if(super(),e.length!==x.LENGTH)throw new J("AccountAddress data should be exactly 32 bytes long","incorrect_number_of_bytes");this.data=e}isSpecial(){return this.data.slice(0,this.data.length-1).every(e=>e===0)&&this.data[this.data.length-1]<16}toString(){return`0x${this.toStringWithoutPrefix()}`}toStringWithoutPrefix(){let e=_utils.bytesToHex.call(void 0, this.data);return this.isSpecial()&&(e=e[e.length-1]),e}toStringLong(){return`0x${this.toStringLongWithoutPrefix()}`}toStringLongWithoutPrefix(){return _utils.bytesToHex.call(void 0, this.data)}toUint8Array(){return this.data}serialize(e){e.serializeFixedBytes(this.data)}serializeForEntryFunction(e){let t=this.bcsToBytes();e.serializeBytes(t)}serializeForScriptFunction(e){e.serializeU32AsUleb128(3),e.serialize(this)}static deserialize(e){let t=e.deserializeFixedBytes(x.LENGTH);return new x(t)}static fromStringStrict(e){if(!e.startsWith("0x"))throw new J("Hex string must start with a leading 0x.","leading_zero_x_required");let t=x.fromString(e);if(e.length!==x.LONG_STRING_LENGTH+2)if(t.isSpecial()){if(e.length!==3)throw new J(`The given hex string ${e} is a special address not in LONG form, it must be 0x0 to 0xf without padding zeroes.`,"INVALID_PADDING_ZEROES")}else throw new J(`The given hex string ${e} is not a special address, it must be represented as 0x + 64 chars.`,"long_form_required_unless_special");return t}static fromString(e){let t=e;if(e.startsWith("0x")&&(t=e.slice(2)),t.length===0)throw new J("Hex string is too short, must be 1 to 64 chars long, excluding the leading 0x.","too_short");if(t.length>64)throw new J("Hex string is too long, must be 1 to 64 chars long, excluding the leading 0x.","too_long");let r;try{r=_utils.hexToBytes.call(void 0, t.padStart(64,"0"))}catch(i){throw new J(`Hex characters are invalid: ${_optionalChain([i, 'optionalAccess', _5 => _5.message])}`,"invalid_hex_chars")}return new x(r)}static from(e){return typeof e=="string"?x.fromString(e):e instanceof Uint8Array?new x(e):e}static fromStrict(e){return typeof e=="string"?x.fromStringStrict(e):e instanceof Uint8Array?new x(e):e}static isValid(e){try{return e.strict?x.fromStrict(e.input):x.from(e.input),{valid:!0}}catch(t){return{valid:!1,invalidReason:_optionalChain([t, 'optionalAccess', _6 => _6.invalidReason]),invalidReasonMessage:_optionalChain([t, 'optionalAccess', _7 => _7.message])}}}equals(e){return this.data.length!==e.data.length?!1:this.data.every((t,r)=>t===e.data[r])}};x.LENGTH=32,x.LONG_STRING_LENGTH=64,x.ZERO=x.from("0x0"),x.ONE=x.from("0x1"),x.TWO=x.from("0x2"),x.THREE=x.from("0x3"),x.FOUR=x.from("0x4"),x.A=x.from("0xA");var u=x;var Fe=class Fe extends l{constructor(e){super();let{data:t}=e,r=g.fromHexInput(t);if(r.toUint8Array().length!==Fe.LENGTH)throw new Error(`Authentication Key length should be ${Fe.LENGTH}`);this.data=r}serialize(e){e.serializeFixedBytes(this.data.toUint8Array())}static deserialize(e){let t=e.deserializeFixedBytes(Fe.LENGTH);return new Fe({data:t})}toString(){return this.data.toString()}toUint8Array(){return this.data.toUint8Array()}static fromSchemeAndBytes(e){let{scheme:t,input:r}=e,i=g.fromHexInput(r).toUint8Array(),o=new Uint8Array([...i,t]),s=_sha3.sha3_256.create();s.update(o);let a=s.digest();return new Fe({data:a})}static fromPublicKeyAndScheme(e){let{publicKey:t}=e;return t.authKey()}static fromPublicKey(e){let{publicKey:t}=e;return t.authKey()}derivedAddress(){return new u(this.data.toUint8Array())}};Fe.LENGTH=32;var D=Fe;var _hmac = require('@noble/hashes/hmac');var _sha512 = require('@noble/hashes/sha512');var _bip39 = require('@scure/bip39'); var Ri = _interopRequireWildcard(_bip39);var xa=/^m\/44'\/637'\/[0-9]+'\/[0-9]+'\/[0-9]+'?$/,_a= exports.APTOS_BIP44_REGEX =/^m\/44'\/637'\/[0-9]+'\/[0-9]+\/[0-9]+$/,Pa= exports.KeyType =(e=>(e.ED25519="ed25519 seed",e))(Pa||{}),Ki= exports.HARDENED_OFFSET =2147483648;function zi(n){return _a.test(n)}function ki(n){return xa.test(n)}var Er=(n,e)=>{let t=_hmac.hmac.create(_sha512.sha512,n).update(e).digest();return{key:t.slice(0,32),chainCode:t.slice(32)}},Di= 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 Er(e,s)},va=n=>n.replace("'",""),Bi= exports.splitPath =n=>n.split("/").slice(1).map(va),Dn= exports.mnemonicToSeed =n=>{let e=n.trim().split(/\s+/).map(t=>t.toLowerCase()).join(" ");return Ri.mnemonicToSeedSync(e)};var et=class extends l{toString(){let e=this.toUint8Array();return g.fromHexInput(e).toString()}},ee= exports.AccountPublicKey =class extends et{};var B=class extends l{toString(){let e=this.toUint8Array();return g.fromHexInput(e).toString()}};var mt=n=>typeof n=="string"?g.isValid(n).valid?n:new TextEncoder().encode(n):n;var Ir=[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 Ca(n){let e=n.toUint8Array().slice(32);for(let t=Ir.length-1;t>=0;t-=1){if(e[t]<Ir[t])return!0;if(e[t]>Ir[t])return!1}return!1}var Ne=class Ne extends ee{constructor(e){super();let t=g.fromHexInput(e);if(t.toUint8Array().length!==Ne.LENGTH)throw new Error(`PublicKey length should be ${Ne.LENGTH}`);this.key=t}verifySignature(e){let{message:t,signature:r}=e;if(!Ca(r))return!1;let i=mt(t),o=g.fromHexInput(i).toUint8Array(),s=r.toUint8Array(),a=this.key.toUint8Array();return _ed25519.ed25519.verify(s,o,a)}authKey(){return D.fromSchemeAndBytes({scheme:0,input:this.toUint8Array()})}toUint8Array(){return this.key.toUint8Array()}serialize(e){e.serializeBytes(this.key.toUint8Array())}static deserialize(e){let t=e.deserializeBytes();return new Ne(t)}static isPublicKey(e){return e instanceof Ne}static isInstance(e){return"key"in e&&_optionalChain([e, 'access', _8 => _8.key, 'optionalAccess', _9 => _9.data, 'optionalAccess', _10 => _10.length])===Ne.LENGTH}};Ne.LENGTH=32;var _=Ne,se=class se extends l{constructor(e){super();let t=g.fromHexInput(e);if(t.toUint8Array().length!==se.LENGTH)throw new Error(`PrivateKey length should be ${se.LENGTH}`);this.signingKey=t}static generate(){let e=_ed25519.ed25519.utils.randomPrivateKey();return new se(e)}static fromDerivationPath(e,t){if(!ki(e))throw new Error(`Invalid derivation path ${e}`);return se.fromDerivationPathInner(e,Dn(t))}static fromDerivationPathInner(e,t,r=Ki){let{key:i,chainCode:o}=Er(se.SLIP_0010_SEED,t),s=Bi(e).map(c=>parseInt(c,10)),{key:a}=s.reduce((c,d)=>Di(c,d+r),{key:i,chainCode:o});return new se(a)}publicKey(){let e=_ed25519.ed25519.getPublicKey(this.signingKey.toUint8Array());return new _(e)}sign(e){let t=mt(e),r=g.fromHexInput(t).toUint8Array(),i=_ed25519.ed25519.sign(r,this.signingKey.toUint8Array());return new v(i)}toUint8Array(){return this.signingKey.toUint8Array()}toString(){return this.signingKey.toString()}serialize(e){e.serializeBytes(this.toUint8Array())}static deserialize(e){let t=e.deserializeBytes();return new se(t)}static isPrivateKey(e){return e instanceof se}};se.LENGTH=32,se.SLIP_0010_SEED="ed25519 seed";var W=se,yt=class yt extends B{constructor(e){super();let t=g.fromHexInput(e);if(t.toUint8Array().length!==yt.LENGTH)throw new Error(`Signature length should be ${yt.LENGTH}`);this.data=t}toUint8Array(){return this.data.toUint8Array()}serialize(e){e.serializeBytes(this.data.toUint8Array())}static deserialize(e){let t=e.deserializeBytes();return new yt(t)}};yt.LENGTH=64;var v=yt;var ae=class ae extends ee{constructor(e){super();let{publicKeys:t,threshold:r}=e;if(t.length>ae.MAX_KEYS||t.length<ae.MIN_KEYS)throw new Error(`Must have between ${ae.MIN_KEYS} and ${ae.MAX_KEYS} public keys, inclusive`);if(r<ae.MIN_THRESHOLD||r>t.length)throw new Error(`Threshold must be between ${ae.MIN_THRESHOLD} and ${t.length}, inclusive`);this.publicKeys=t,this.threshold=r}verifySignature(e){let{message:t,signature:r}=e;if(!(r instanceof tt))return!1;let i=[];for(let o=0;o<4;o+=1)for(let s=0;s<8;s+=1)if((r.bitmap[o]&1<<7-s)!==0){let c=o*8+s;i.push(c)}if(i.length!==r.signatures.length)throw new Error("Bitmap and signatures length mismatch");if(i.length<this.threshold)throw new Error("Not enough signatures");for(let o=0;o<i.length;o+=1)if(!this.publicKeys[i[o]].verifySignature({message:t,signature:r.signatures[o]}))return!1;return!0}authKey(){return D.fromSchemeAndBytes({scheme:1,input:this.toUint8Array()})}toUint8Array(){let e=new Uint8Array(this.publicKeys.length*_.LENGTH+1);return this.publicKeys.forEach((t,r)=>{e.set(t.toUint8Array(),r*_.LENGTH)}),e[this.publicKeys.length*_.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+=_.LENGTH){let s=o;i.push(new _(t.subarray(s,s+_.LENGTH)))}return new ae({publicKeys:i,threshold:r})}};ae.MAX_KEYS=32,ae.MIN_KEYS=2,ae.MIN_THRESHOLD=1;var ft=ae,ne=class ne extends B{constructor(e){super();let{signatures:t,bitmap:r}=e;if(t.length>ne.MAX_SIGNATURES_SUPPORTED)throw new Error(`The number of signatures cannot be greater than ${ne.MAX_SIGNATURES_SUPPORTED}`);if(this.signatures=t,!(r instanceof Uint8Array))this.bitmap=ne.createBitmap({bits:r});else{if(r.length!==ne.BITMAP_LEN)throw new Error(`"bitmap" length should be ${ne.BITMAP_LEN}`);this.bitmap=r}}toUint8Array(){let e=new Uint8Array(this.signatures.length*v.LENGTH+ne.BITMAP_LEN);return this.signatures.forEach((t,r)=>{e.set(t.toUint8Array(),r*v.LENGTH)}),e.set(this.bitmap,this.signatures.length*v.LENGTH),e}serialize(e){e.serializeBytes(this.toUint8Array())}static deserialize(e){let t=e.deserializeBytes(),r=t.subarray(t.length-4),i=[];for(let o=0;o<t.length-r.length;o+=v.LENGTH){let s=o;i.push(new v(t.subarray(s,s+v.LENGTH)))}return new ne({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>=ne.MAX_SIGNATURES_SUPPORTED)throw new Error(`Cannot have a signature larger than ${ne.MAX_SIGNATURES_SUPPORTED-1}.`);if(o.has(s))throw new Error("Duplicate bits detected.");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}};ne.MAX_SIGNATURES_SUPPORTED=32,ne.BITMAP_LEN=4;var tt=ne;var _secp256k1 = require('@noble/curves/secp256k1');var _bip32 = require('@scure/bip32');var Oe=class Oe extends et{constructor(e){super();let t=g.fromHexInput(e);if(t.toUint8Array().length!==Oe.LENGTH)throw new Error(`PublicKey length should be ${Oe.LENGTH}`);this.key=t}verifySignature(e){let{message:t,signature:r}=e,i=mt(t),o=g.fromHexInput(i).toUint8Array(),s=_sha3.sha3_256.call(void 0, o),a=r.toUint8Array();return _secp256k1.secp256k1.verify(a,s,this.key.toUint8Array(),{lowS:!0})}toUint8Array(){return this.key.toUint8Array()}serialize(e){e.serializeBytes(this.key.toUint8Array())}static deserialize(e){let t=e.deserializeBytes();return new Oe(t)}static isPublicKey(e){return e instanceof Oe}static isInstance(e){return"key"in e&&_optionalChain([e, 'access', _11 => _11.key, 'optionalAccess', _12 => _12.data, 'optionalAccess', _13 => _13.length])===Oe.LENGTH}};Oe.LENGTH=65;var Ee=Oe,Se=class Se extends l{constructor(e){super();let t=g.fromHexInput(e);if(t.toUint8Array().length!==Se.LENGTH)throw new Error(`PrivateKey length should be ${Se.LENGTH}`);this.key=t}static generate(){let e=_secp256k1.secp256k1.utils.randomPrivateKey();return new Se(e)}static fromDerivationPath(e,t){if(!zi(e))throw new Error(`Invalid derivation path ${e}`);return Se.fromDerivationPathInner(e,Dn(t))}static fromDerivationPathInner(e,t){let{privateKey:r}=_bip32.HDKey.fromMasterSeed(t).derive(e);if(r===null)throw new Error("Invalid key");return new Se(r)}sign(e){let t=mt(e),r=g.fromHexInput(t),i=_sha3.sha3_256.call(void 0, r.toUint8Array()),o=_secp256k1.secp256k1.sign(i,this.key.toUint8Array(),{lowS:!0});return new ht(o.toCompactRawBytes())}publicKey(){let e=_secp256k1.secp256k1.getPublicKey(this.key.toUint8Array(),!1);return new Ee(e)}toUint8Array(){return this.key.toUint8Array()}toString(){return this.key.toString()}serialize(e){e.serializeBytes(this.toUint8Array())}static deserialize(e){let t=e.deserializeBytes();return new Se(t)}static isPrivateKey(e){return e instanceof Se}};Se.LENGTH=32;var nt=Se,At=class At extends B{constructor(e){super();let t=g.fromHexInput(e);if(t.toUint8Array().length!==At.LENGTH)throw new Error(`Signature length should be ${At.LENGTH}, received ${t.toUint8Array().length}`);this.data=t}toUint8Array(){return this.data.toUint8Array()}serialize(e){e.serializeBytes(this.data.toUint8Array())}static deserialize(e){let t=e.deserializeBytes();return new At(t)}};At.LENGTH=64;var ht=At;var _jwtdecode = require('jwt-decode');var rt=class n extends et{constructor(e){super();let t=e.constructor.name;switch(t){case _.name:this.publicKey=e,this.variant=0;break;default:throw new Error(`Unsupported key for EphemeralPublicKey - ${t}`)}}toUint8Array(){return this.bcsToBytes()}verifySignature(e){let{message:t,signature:r}=e;return this.publicKey.verifySignature({message:t,signature:r.signature})}serialize(e){if(this.publicKey instanceof _)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(_.deserialize(e));default:throw new Error(`Unknown variant index for EphemeralPublicKey: ${t}`)}}static isPublicKey(e){return e instanceof n}},xe= exports.EphemeralSignature =class n extends B{constructor(e){super();let t=e.constructor.name;switch(t){case v.name:this.signature=e;break;default:throw new Error(`Unsupported signature for EphemeralSignature - ${t}`)}}toUint8Array(){return this.bcsToBytes()}static fromHex(e){let t=g.fromHexInput(e),r=new q(t.toUint8Array());return n.deserialize(r)}serialize(e){if(this.signature instanceof v)e.serializeU32AsUleb128(0),this.signature.serialize(e);else throw new Error("Unknown signature type")}static deserialize(e){let t=e.deserializeUleb128AsU32();switch(t){case 0:return new n(v.deserialize(e));default:throw new Error(`Unknown variant index for EphemeralSignature: ${t}`)}}};var _poseidonlite = require('poseidon-lite');var Ur=[_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],Ni=31,La=16,Fi=(La-1)*Ni;function Fn(n,e){let r=new TextEncoder().encode(n);return Ha(r,e)}function Ha(n,e){if(n.length>e)throw new Error(`Inputted bytes of length ${n} is longer than ${e}`);let t=Rr(n,e);return Yt(t)}function Qa(n,e){if(n.length>e)throw new Error(`Input bytes of length ${n} is longer than ${e}`);let t=Xa(n,e);return Wa(t)}function Rr(n,e){if(n.length>e)throw new Error(`Input bytes of length ${n} is longer than ${e}`);return Qa(n,e).concat([BigInt(n.length)])}function Wa(n){if(n.length>Fi)throw new Error(`Can't pack more than ${Fi}. Was given ${n.length} bytes`);return ja(n,Ni).map(e=>Zt(e))}function ja(n,e){let t=[];for(let r=0;r<n.length;r+=e)t.push(n.subarray(r,r+e));return t}function Zt(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 Oi(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 Xa(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 Yt(n){if(n.length>Ur.length)throw new Error(`Unable to hash input of length ${n.length}. Max input length is ${Ur.length}`);return Ur[n.length-1](n)}var Nn=class extends l{toString(){let e=this.bcsToBytes();return g.fromHexInput(e).toString()}};var bt=(o=>(o.FULLNODE="Fullnode",o.INDEXER="Indexer",o.FAUCET="Faucet",o.PEPPER="Pepper",o.PROVER="Prover",o))(bt||{}),Mi= exports.DEFAULT_MAX_GAS_AMOUNT =2e5,qi= exports.DEFAULT_TXN_EXP_SEC_FROM_NOW =20,On= exports.DEFAULT_TXN_TIMEOUT_SEC =20,Tt= exports.APTOS_COIN ="0x1::aptos_coin::AptosCoin",Vi= exports.APTOS_FA ="0x000000000000000000000000000000000000000000000000000000000000000a",$i= exports.RAW_TRANSACTION_SALT ="APTOS::RawTransaction",Kr= exports.RAW_TRANSACTION_WITH_DATA_SALT ="APTOS::RawTransactionWithData",Ie= 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))(Ie||{});var be=class extends Error{constructor({apiType:e,aptosRequest:t,aptosResponse:r}){super(Za({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 Za({apiType:n,aptosRequest:e,aptosResponse:t}){let r=_optionalChain([t, 'access', _14 => _14.headers, 'optionalAccess', _15 => _15.traceparent, 'optionalAccess', _16 => _16.split, 'call', _17 => _17("-"), 'access', _18 => _18[1]]),i=r?`(trace_id:${r}) `:"",o=`Request to [${n}]: ${e.method} ${_nullishCoalesce(t.url, () => (e.url))} ${i}failed with`;return n==="Indexer"&&_optionalChain([t, 'access', _19 => _19.data, 'optionalAccess', _20 => _20.errors, 'optionalAccess', _21 => _21[0], 'optionalAccess', _22 => _22.message])!=null?`${o}: ${t.data.errors[0].message}`:_optionalChain([t, 'access', _23 => _23.data, 'optionalAccess', _24 => _24.message])!=null&&_optionalChain([t, 'access', _25 => _25.data, 'optionalAccess', _26 => _26.error_code])!=null?`${o}: ${JSON.stringify(t.data)}`:`${o} status: ${t.statusText}(code:${t.status}) and response body: ${Ya(t.data)}`}var zr=400;function Ya(n){let e=JSON.stringify(n);return e.length<=zr?e:`truncated(original_size:${e.length}): ${e.slice(0,zr/2)}...${e.slice(-zr/2)}`}var Li="1.29.1";var Hi={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"},Qi= 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"},Wi= exports.NetworkToFaucetAPI ={mainnet:"https://faucet.mainnet.aptoslabs.com",testnet:"https://faucet.testnet.aptoslabs.com",devnet:"https://faucet.devnet.aptoslabs.com",local:"http://127.0.0.1:8081"},kr= 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"},Dr= 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"},Br= exports.Network =(o=>(o.MAINNET="mainnet",o.TESTNET="testnet",o.DEVNET="devnet",o.LOCAL="local",o.CUSTOM="custom",o))(Br||{}),Gr= exports.NetworkToChainId ={mainnet:1,testnet:2,local:4},$d= exports.NetworkToNetworkName ={mainnet:"mainnet",testnet:"testnet",devnet:"devnet",local:"local",custom:"custom"};function ji(n,e){let t=e.bcsToBytes(),r=new q(t);return n.deserialize(r)}async function Ja(n,e){let{url:t,method:r,body:i,contentType:o,params:s,overrides:a,originMethod:c}=n,d={..._optionalChain([a, 'optionalAccess', _27 => _27.HEADERS]),"x-aptos-client":`aptos-typescript-sdk/${Li}`,"content-type":_nullishCoalesce(o, () => ("application/json")),"x-aptos-typescript-sdk-origin-method":c};return _optionalChain([a, 'optionalAccess', _28 => _28.AUTH_TOKEN])&&(d.Authorization=`Bearer ${_optionalChain([a, 'optionalAccess', _29 => _29.AUTH_TOKEN])}`),_optionalChain([a, 'optionalAccess', _30 => _30.API_KEY])&&(d.Authorization=`Bearer ${_optionalChain([a, 'optionalAccess', _31 => _31.API_KEY])}`),e.provider({url:t,method:r,body:i,params:s,headers:d,overrides:a})}async function Mn(n,e,t){let{url:r,path:i}=n,o=i?`${r}/${i}`:r,s=await Ja({...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 be({apiType:t,aptosRequest:n,aptosResponse:a});if(t==="Indexer"){let c=a.data;if(c.errors)throw new be({apiType:t,aptosRequest:n,aptosResponse:a});a.data=c.data}else if((t==="Pepper"||t==="Prover")&&a.status>=400)throw new be({apiType:t,aptosRequest:n,aptosResponse:a});if(a.status>=200&&a.status<300)return a;throw new be({apiType:t,aptosRequest:n,aptosResponse:a})}async function Fr(n){let{aptosConfig:e,overrides:t,params:r,contentType:i,acceptType:o,path:s,originMethod:a,type:c}=n,d=e.getRequestUrl(c);return Mn({url:d,method:"GET",originMethod:a,path:s,contentType:i,acceptType:o,params:r,overrides:{...e.clientConfig,...t}},e,n.type)}async function H(n){let{aptosConfig:e}=n;return Fr({...n,type:"Fullnode",overrides:{...e.clientConfig,...e.fullnodeConfig,...n.overrides,HEADERS:{..._optionalChain([e, 'access', _32 => _32.clientConfig, 'optionalAccess', _33 => _33.HEADERS]),..._optionalChain([e, 'access', _34 => _34.fullnodeConfig, 'optionalAccess', _35 => _35.HEADERS])}}})}async function gl(n){return Fr({...n,type:"Pepper"})}async function wt(n){let e=[],t,r=n.params;do{let i=await Fr({type:"Fullnode",aptosConfig:n.aptosConfig,originMethod:n.originMethod,path:n.path,params:r,overrides:n.overrides});t=i.headers["x-aptos-cursor"],delete i.headers,e.push(...i.data),r.start=t}while(t!=null);return e}async function Jt(n){let{type:e,originMethod:t,path:r,body:i,acceptType:o,contentType:s,params:a,aptosConfig:c,overrides:d}=n,p=c.getRequestUrl(e);return Mn({url:p,method:"POST",originMethod:t,path:r,body:i,contentType:s,acceptType:o,params:a,overrides:d},c,n.type)}async function Me(n){let{aptosConfig:e}=n;return Jt({...n,type:"Fullnode",overrides:{...e.clientConfig,...e.fullnodeConfig,...n.overrides,HEADERS:{..._optionalChain([e, 'access', _36 => _36.clientConfig, 'optionalAccess', _37 => _37.HEADERS]),..._optionalChain([e, 'access', _38 => _38.fullnodeConfig, 'optionalAccess', _39 => _39.HEADERS])}}})}async function Xi(n){let{aptosConfig:e}=n;return Jt({...n,type:"Indexer",overrides:{...e.clientConfig,...e.indexerConfig,...n.overrides,HEADERS:{..._optionalChain([e, 'access', _40 => _40.clientConfig, 'optionalAccess', _41 => _41.HEADERS]),..._optionalChain([e, 'access', _42 => _42.indexerConfig, 'optionalAccess', _43 => _43.HEADERS])}}})}async function Zi(n){let{aptosConfig:e}=n,t={...e,clientConfig:{...e.clientConfig}};return _optionalChainDelete([t, 'optionalAccess', _44 => _44.clientConfig, 'optionalAccess', _45 => delete _45.API_KEY]),Jt({...n,type:"Faucet",overrides:{...t.clientConfig,...t.faucetConfig,...n.overrides,HEADERS:{..._optionalChain([t, 'access', _46 => _46.clientConfig, 'optionalAccess', _47 => _47.HEADERS]),..._optionalChain([t, 'access', _48 => _48.faucetConfig, 'optionalAccess', _49 => _49.HEADERS])}}})}async function Yi(n){return Jt({...n,type:"Pepper"})}async function Ji(n){return Jt({...n,type:"Prover"})}var Nr=new Map;function _e(n,e,t){return async(...r)=>{if(Nr.has(e)){let{value:o,timestamp:s}=Nr.get(e);if(t===void 0||Date.now()-s<=t)return o}let i=await n(...r);return Nr.set(e,{value:i,timestamp:Date.now()}),i}}var Vl=1e7,tc= exports.MAX_AUD_VAL_BYTES =120,nc= exports.MAX_UID_KEY_BYTES =30,rc= exports.MAX_UID_VAL_BYTES =330,$l= exports.MAX_ISS_VAL_BYTES =120,Ll= exports.MAX_EXTRA_FIELD_BYTES =350,Hl= exports.MAX_JWT_HEADER_B64_BYTES =300,Ql= exports.MAX_COMMITED_EPK_BYTES =93,Pe=class Pe extends ee{constructor(e,t){super();let r=g.fromHexInput(t).toUint8Array();if(r.length!==Pe.ID_COMMITMENT_LENGTH)throw new Error(`Id Commitment length in bytes should be ${Pe.ID_COMMITMENT_LENGTH}`);this.iss=e,this.idCommitment=r}authKey(){let e=new V;return e.serializeU32AsUleb128(3),e.serializeFixedBytes(this.bcsToBytes()),D.fromSchemeAndBytes({scheme:2,input:e.toUint8Array()})}toUint8Array(){return this.bcsToBytes()}toString(){return g.fromHexInput(this.toUint8Array()).toString()}verifySignature(e){throw new Error("Not yet implemented")}serialize(e){e.serializeStr(this.iss),e.serializeBytes(this.idCommitment)}static deserialize(e){let t=e.deserializeStr(),r=e.deserializeBytes();return new Pe(t,r)}static load(e){let t=e.deserializeStr(),r=e.deserializeBytes();return new Pe(t,r)}static isPublicKey(e){return e instanceof Pe}static create(e){return eo(e),new Pe(e.iss,eo(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 Pe.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}};Pe.ID_COMMITMENT_LENGTH=32;var G=Pe;function eo(n){let{uidKey:e,uidVal:t,aud:r,pepper:i}=n,o=[Zt(g.fromHexInput(i).toUint8Array()),Fn(r,tc),Fn(t,rc),Fn(e,nc)];return Oi(Yt(o),G.ID_COMMITMENT_LENGTH)}var Re=class n extends B{constructor(e){super();let{jwtHeader:t,ephemeralCertificate:r,expiryDateSecs:i,ephemeralPublicKey:o,ephemeralSignature:s}=e;this.jwtHeader=t,this.ephemeralCertificate=r,this.expiryDateSecs=i,this.ephemeralPublicKey=o,this.ephemeralSignature=s}toUint8Array(){return this.bcsToBytes()}serialize(e){this.ephemeralCertificate.serialize(e),e.serializeStr(this.jwtHeader),e.serializeU64(this.expiryDateSecs),this.ephemeralPublicKey.serialize(e),this.ephemeralSignature.serialize(e)}static deserialize(e){let t=St.deserialize(e),r=e.deserializeStr(),i=e.deserializeU64(),o=rt.deserialize(e),s=xe.deserialize(e);return new n({jwtHeader:r,expiryDateSecs:Number(i),ephemeralCertificate:t,ephemeralPublicKey:o,ephemeralSignature:s})}static getSimulationSignature(){return new n({jwtHeader:"{}",ephemeralCertificate:new St(new ce({proof:new _t(new xt({a:new Uint8Array(32),b:new Uint8Array(64),c:new Uint8Array(32)}),0),expHorizonSecs:0}),0),expiryDateSecs:0,ephemeralPublicKey:new rt(new _(new Uint8Array(32))),ephemeralSignature:new xe(new v(new Uint8Array(64)))})}static isSignature(e){return e instanceof n}},St= exports.EphemeralCertificate =class n extends B{constructor(e,t){super(),this.signature=e,this.variant=t}toUint8Array(){return this.signature.toUint8Array()}serialize(e){e.serializeU32AsUleb128(this.variant),this.signature.serialize(e)}static deserialize(e){let t=e.deserializeUleb128AsU32();switch(t){case 0:return new n(ce.deserialize(e),t);default:throw new Error(`Unknown variant index for EphemeralCertificate: ${t}`)}}},Ue=class n extends l{constructor(e){if(super(),this.data=g.fromHexInput(e).toUint8Array(),this.data.length!==32)throw new Error("Input needs to be 32 bytes")}serialize(e){e.serializeFixedBytes(this.data)}static deserialize(e){let t=e.deserializeFixedBytes(32);return new n(t)}},it=class n extends l{constructor(e){if(super(),this.data=g.fromHexInput(e).toUint8Array(),this.data.length!==64)throw new Error("Input needs to be 64 bytes")}serialize(e){e.serializeFixedBytes(this.data)}static deserialize(e){let t=e.deserializeFixedBytes(64);return new n(t)}},xt= exports.Groth16Zkp =class n extends Nn{constructor(e){super();let{a:t,b:r,c:i}=e;this.a=new Ue(t),this.b=new it(r),this.c=new Ue(i)}serialize(e){this.a.serialize(e),this.b.serialize(e),this.c.serialize(e)}static deserialize(e){let t=Ue.deserialize(e).bcsToBytes(),r=it.deserialize(e).bcsToBytes(),i=Ue.deserialize(e).bcsToBytes();return new n({a:t,b:r,c:i})}},_t= exports.ZkProof =class n extends 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(xt.deserialize(e),t);default:throw new Error(`Unknown variant index for ZkProof: ${t}`)}}},ce= exports.ZeroKnowledgeSig =class n extends B{constructor(e){super();let{proof:t,expHorizonSecs:r,trainingWheelsSignature:i,extraField:o,overrideAudVal:s}=e;this.proof=t,this.expHorizonSecs=r,this.trainingWheelsSignature=i,this.extraField=o,this.overrideAudVal=s}toUint8Array(){return this.bcsToBytes()}static fromBytes(e){return n.deserialize(new q(e))}serialize(e){this.proof.serialize(e),e.serializeU64(this.expHorizonSecs),e.serializeOptionStr(this.extraField),e.serializeOptionStr(this.overrideAudVal),e.serializeOption(this.trainingWheelsSignature)}static deserialize(e){let t=_t.deserialize(e),r=Number(e.deserializeU64()),i=e.deserializeOptionStr(),o=e.deserializeOptionStr(),s=e.deserializeOption(xe);return new n({proof:t,expHorizonSecs:r,trainingWheelsSignature:s,extraField:i,overrideAudVal:o})}},Or= exports.KeylessConfiguration =class n{constructor(e,t){this.verficationKey=e,this.maxExpHorizonSecs=t}static create(e,t){return new n(new Mr({alphaG1:e.alpha_g1,betaG2:e.beta_g2,deltaG2:e.delta_g2,gammaAbcG1:e.gamma_abc_g1,gammaG2:e.gamma_g2}),t)}},Mr=class n{constructor(e){let{alphaG1:t,betaG2:r,deltaG2:i,gammaAbcG1:o,gammaG2:s}=e;this.alphaG1=new Ue(t),this.betaG2=new it(r),this.deltaG2=new it(i),this.gammaAbcG1=[new Ue(o[0]),new Ue(o[1])],this.gammaG2=new it(s)}static fromGroth16VerificationKeyResponse(e){return new n({alphaG1:e.alpha_g1,betaG2:e.beta_g2,deltaG2:e.delta_g2,gammaAbcG1:e.gamma_abc_g1,gammaG2:e.gamma_g2})}};async function to(n){let{aptosConfig:e}=n;return _e(async()=>{let t=await ic(n),r=await oc(n);return Or.create(r,Number(t.max_exp_horizon_secs))},`keyless-configuration-${e.network}`,1e3*60*5)()}async function ic(n){let{aptosConfig:e,options:t}=n,r="0x1::keyless_account::Configuration",{data:i}=await H({aptosConfig:e,originMethod:"getKeylessConfigurationResource",path:`accounts/${u.from("0x1").toString()}/resource/${r}`,params:{ledger_version:_optionalChain([t, 'optionalAccess', _50 => _50.ledgerVersion])}});return i.data}async function oc(n){let{aptosConfig:e,options:t}=n,r="0x1::keyless_account::Groth16VerificationKey",{data:i}=await H({aptosConfig:e,originMethod:"getGroth16VerificationKeyResource",path:`accounts/${u.from("0x1").toString()}/resource/${r}`,params:{ledger_version:_optionalChain([t, 'optionalAccess', _51 => _51.ledgerVersion])}});return i.data}var Te=class n extends ee{constructor(e,t){super(),this.jwkAddress=u.from(e),this.keylessPublicKey=t}authKey(){let e=new V;return e.serializeU32AsUleb128(4),e.serializeFixedBytes(this.bcsToBytes()),D.fromSchemeAndBytes({scheme:2,input:e.toUint8Array()})}toUint8Array(){return this.bcsToBytes()}toString(){return g.fromHexInput(this.toUint8Array()).toString()}verifySignature(e){throw new Error("Not yet implemented")}serialize(e){this.jwkAddress.serialize(e),this.keylessPublicKey.serialize(e)}static deserialize(e){let t=u.deserialize(e),r=G.deserialize(e);return new n(t,r)}static isPublicKey(e){return e instanceof n}static create(e){return new n(e.jwkAddress,G.create(e))}static fromJwtAndPepper(e){return new n(e.jwkAddress,G.fromJwtAndPepper(e))}static isInstance(e){return"jwkAddress"in e&&e.jwkAddress instanceof u&&"keylessPublicKey"in e&&e.keylessPublicKey instanceof G}};var k=class n extends ee{constructor(e){if(super(),this.publicKey=e,e instanceof _)this.variant=0;else if(e instanceof Ee)this.variant=1;else if(e instanceof G)this.variant=3;else if(e instanceof Te)this.variant=4;else throw new Error("Unsupported public key type")}verifySignature(e){let{message:t,signature:r}=e;return M.isInstance(r)?this.publicKey.verifySignature({message:t,signature:r.signature}):!1}authKey(){return D.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=_.deserialize(e);break;case 1:r=Ee.deserialize(e);break;case 3:r=G.deserialize(e);break;case 4:r=Te.deserialize(e);break;default:throw new Error(`Unknown variant index for AnyPublicKey: ${t}`)}return new n(r)}static isPublicKey(e){return e instanceof n}isEd25519(){return this.publicKey instanceof _}isSecp256k1PublicKey(){return this.publicKey instanceof Ee}static isInstance(e){return"publicKey"in e&&"variant"in e}},M= exports.AnySignature =class n extends B{constructor(e){if(super(),this.signature=e,e instanceof v)this.variant=0;else if(e instanceof ht)this.variant=1;else if(e instanceof Re)this.variant=3;else throw new Error("Unsupported signature type")}toUint8Array(){return console.warn("[Aptos SDK] Calls to AnySignature.toUint8Array() will soon return the underlying signature bytes. Use AnySignature.bcsToBytes() instead."),this.bcsToBytes()}serialize(e){e.serializeU32AsUleb128(this.variant),this.signature.serialize(e)}static deserialize(e){let t=e.deserializeUleb128AsU32(),r;switch(t){case 0:r=v.deserialize(e);break;case 1:r=ht.deserialize(e);break;case 3:r=Re.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 sc(n){let e=n;return e-=e>>1&1431655765,e=(e&858993459)+(e>>2&858993459),(e+(e>>4)&252645135)*16843009>>24}var Pt=class n extends ee{constructor(e){super();let{publicKeys:t,signaturesRequired:r}=e;if(r<1)throw new Error("The number of required signatures needs to be greater than 0");if(t.length<r)throw new Error(`Provided ${t.length} public keys is smaller than the ${r} required signatures`);this.publicKeys=t.map(i=>i instanceof k?i:new k(i)),this.signaturesRequired=r}verifySignature(e){throw new Error("not implemented")}authKey(){return D.fromSchemeAndBytes({scheme:3,input:this.toUint8Array()})}toUint8Array(){return this.bcsToBytes()}serialize(e){e.serializeVector(this.publicKeys),e.serializeU8(this.signaturesRequired)}static deserialize(e){let t=e.deserializeVector(k),r=e.deserializeU8();return new n({publicKeys:t,signaturesRequired:r})}createBitmap(e){let{bits:t}=e,r=128,i=new Uint8Array([0,0,0,0]),o=new Set;return t.forEach((s,a)=>{if(a+1>this.publicKeys.length)throw new Error(`Signature index ${a+1} is out of public keys range, ${this.publicKeys.length}.`);if(o.has(s))throw new Error(`Duplicate bit ${s} detected.`);o.add(s);let c=Math.floor(s/8),d=i[c];d|=r>>s%8,i[c]=d}),i}getIndex(e){let t=e instanceof k?e:new k(e),r=this.publicKeys.findIndex(i=>i.toString()===t.toString());if(r!==-1)return r;throw new Error("Public key not found in MultiKey")}},re=class re extends B{constructor(e){super();let{signatures:t,bitmap:r}=e;if(t.length>re.MAX_SIGNATURES_SUPPORTED)throw new Error(`The number of signatures cannot be greater than ${re.MAX_SIGNATURES_SUPPORTED}`);if(this.signatures=t.map(o=>o instanceof M?o:new M(o)),!(r instanceof Uint8Array))this.bitmap=re.createBitmap({bits:r});else{if(r.length!==re.BITMAP_LEN)throw new Error(`"bitmap" length should be ${re.BITMAP_LEN}`);this.bitmap=r}let i=this.bitmap.reduce((o,s)=>o+sc(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>=re.MAX_SIGNATURES_SUPPORTED)throw new Error(`Cannot have a signature larger than ${re.MAX_SIGNATURES_SUPPORTED-1}.`);if(o.has(s))throw new Error("Duplicate bits detected.");o.add(s);let a=Math.floor(s/8),c=i[a];c|=r>>s%8,i[a]=c}),i}toUint8Array(){return this.bcsToBytes()}serialize(e){e.serializeVector(this.signatures),e.serializeBytes(this.bitmap)}static deserialize(e){let t=e.deserializeVector(M),r=e.deserializeBytes();return new re({signatures:t,bitmap:r})}};re.BITMAP_LEN=4,re.MAX_SIGNATURES_SUPPORTED=re.BITMAP_LEN*8;var ot=re;var j=class extends l{static deserialize(e){let t=e.deserializeUleb128AsU32();switch(t){case 0:return we.load(e);case 1:return qn.load(e);case 2:return te.load(e);case 3:return st.load(e);default:throw new Error(`Unknown variant index for AccountAuthenticator: ${t}`)}}isEd25519(){return this instanceof we}isMultiEd25519(){return this instanceof qn}isSingleKey(){return this instanceof te}isMultiKey(){return this instanceof st}},we= exports.AccountAuthenticatorEd25519 =class n extends j{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=_.deserialize(e),r=v.deserialize(e);return new n(t,r)}},qn= exports.AccountAuthenticatorMultiEd25519 =class n extends j{constructor(e,t){super(),this.public_key=e,this.signature=t}serialize(e){e.serializeU32AsUleb128(1),this.public_key.serialize(e),this.signature.serialize(e)}static load(e){let t=ft.deserialize(e),r=tt.deserialize(e);return new n(t,r)}},te= exports.AccountAuthenticatorSingleKey =class n extends j{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=k.deserialize(e),r=M.deserialize(e);return new n(t,r)}},st= exports.AccountAuthenticatorMultiKey =class n extends j{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=Pt.deserialize(e),r=ot.deserialize(e);return new n(t,r)}};var vt=class n extends 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 R=class n extends 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 qr=(n,e)=>{let t=n.bcsToBytes(),r=typeof e=="string"?Buffer.from(e,"utf8"):e,i=new Uint8Array([...t,...r,254]);return new u(_sha3.sha3_256.call(void 0, i))},om= exports.createResourceAddress =(n,e)=>{let t=n.bcsToBytes(),r=typeof e=="string"?Buffer.from(e,"utf8"):e,i=new Uint8Array([...t,...r,255]);return new u(_sha3.sha3_256.call(void 0, i))},sm= exports.createTokenAddress =(n,e,t)=>{let r=`${e}::${t}`;return qr(n,r)};var en=class n extends 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(u.fromString(t[0]),new R(t[1]))}serialize(e){this.address.serialize(e),this.name.serialize(e)}static deserialize(e){let t=u.deserialize(e),r=R.deserialize(e);return new n(t,r)}};var K=class extends l{static deserialize(e){let t=e.deserializeUleb128AsU32();switch(t){case 0:return F.load(e);case 1:return ue.load(e);case 2:return Q.load(e);case 3:return $e.load(e);case 4:return X.load(e);case 5:return Ct.load(e);case 6:return C.load(e);case 7:return y.load(e);case 8:return qe.load(e);case 9:return Ve.load(e);case 10:return Le.load(e);case 255:return z.load(e);default:throw new Error(`Unknown variant index for TypeTag: ${t}`)}}isBool(){return this instanceof F}isAddress(){return this instanceof X}isGeneric(){return this instanceof z}isSigner(){return this instanceof Ct}isVector(){return this instanceof C}isStruct(){return this instanceof y}isU8(){return this instanceof ue}isU16(){return this instanceof qe}isU32(){return this instanceof Ve}isU64(){return this instanceof Q}isU128(){return this instanceof $e}isU256(){return this instanceof Le}},F= exports.TypeTagBool =class n extends K{toString(){return"bool"}serialize(e){e.serializeU32AsUleb128(0)}static load(e){return new n}},ue= exports.TypeTagU8 =class n extends K{toString(){return"u8"}serialize(e){e.serializeU32AsUleb128(1)}static load(e){return new n}},qe= exports.TypeTagU16 =class n extends K{toString(){return"u16"}serialize(e){e.serializeU32AsUleb128(8)}static load(e){return new n}},Ve= exports.TypeTagU32 =class n extends K{toString(){return"u32"}serialize(e){e.serializeU32AsUleb128(9)}static load(e){return new n}},Q= exports.TypeTagU64 =class n extends K{toString(){return"u64"}serialize(e){e.serializeU32AsUleb128(2)}static load(e){return new n}},$e= exports.TypeTagU128 =class n extends K{toString(){return"u128"}serialize(e){e.serializeU32AsUleb128(3)}static load(e){return new n}},Le= exports.TypeTagU256 =class n extends K{toString(){return"u256"}serialize(e){e.serializeU32AsUleb128(10)}static load(e){return new n}},X= exports.TypeTagAddress =class n extends K{toString(){return"address"}serialize(e){e.serializeU32AsUleb128(4)}static load(e){return new n}},Ct= exports.TypeTagSigner =class n extends K{toString(){return"signer"}serialize(e){e.serializeU32AsUleb128(5)}static load(e){return new n}},Vn= exports.TypeTagReference =class n extends K{constructor(t){super();this.value=t}toString(){return`&${this.value.toString()}`}serialize(t){t.serializeU32AsUleb128(254)}static load(t){let r=K.deserialize(t);return new n(r)}},z= exports.TypeTagGeneric =class n extends K{constructor(t){super();this.value=t;if(t<0)throw new Error("Generic type parameter index cannot be negative")}toString(){return`T${this.value}`}serialize(t){t.serializeU32AsUleb128(255),t.serializeU32(this.value)}static load(t){let r=t.deserializeU32();return new n(r)}},C= exports.TypeTagVector =class n extends K{constructor(t){super();this.value=t}toString(){return`vector<${this.value.toString()}>`}static u8(){return new n(new ue)}serialize(t){t.serializeU32AsUleb128(6),this.value.serialize(t)}static load(t){let r=K.deserialize(t);return new n(r)}},y= exports.TypeTagStruct =class n extends K{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=Ke.deserialize(t);return new n(r)}isTypeTag(t,r,i){return this.value.moduleName.identifier===r&&this.value.name.identifier===i&&this.value.address.equals(t)}isString(){return this.isTypeTag(u.ONE,"string","String")}isOption(){return this.isTypeTag(u.ONE,"option","Option")}isObject(){return this.isTypeTag(u.ONE,"object","Object")}},Ke= exports.StructTag =class n extends 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=u.deserialize(e),r=R.deserialize(e),i=R.deserialize(e),o=e.deserializeVector(K);return new n(t,r,i,o)}};function Im(){return new Ke(u.ONE,new R("aptos_coin"),new R("AptosCoin"),[])}function P(){return new Ke(u.ONE,new R("string"),new R("String"),[])}function Um(n){return new Ke(u.ONE,new R("option"),new R("Option"),[n])}function ie(n){return new Ke(u.ONE,new R("object"),new R("Object"),[n])}function ac(n){let e=n.deserializeUleb128AsU32();switch(e){case 0:return $.deserialize(n);case 1:return O.deserialize(n);case 2:return Ae.deserialize(n);case 3:return u.deserialize(n);case 4:return h.deserialize(n,$);case 5:return I.deserialize(n);case 6:return ye.deserialize(n);case 7:return fe.deserialize(n);case 8:return he.deserialize(n);case 9:return Xt.deserialize(n);default:throw new Error(`Unknown variant index for ScriptTransactionArgument: ${e}`)}}var at=class extends l{static deserialize(e){let t=e.deserializeUleb128AsU32();switch(t){case 0:return tn.load(e);case 2:return nn.load(e);case 3:return rn.load(e);default:throw new Error(`Unknown variant index for TransactionPayload: ${t}`)}}},tn= exports.TransactionPayloadScript =class n extends at{constructor(e){super(),this.script=e}serialize(e){e.serializeU32AsUleb128(0),this.script.serialize(e)}static load(e){let t=on.deserialize(e);return new n(t)}},nn= exports.TransactionPayloadEntryFunction =class n extends at{constructor(e){super(),this.entryFunction=e}serialize(e){e.serializeU32AsUleb128(2),this.entryFunction.serialize(e)}static load(e){let t=ct.deserialize(e);return new n(t)}},rn= exports.TransactionPayloadMultiSig =class n extends at{constructor(e){super(),this.multiSig=e}serialize(e){e.serializeU32AsUleb128(3),this.multiSig.serialize(e)}static load(e){let t=sn.deserialize(e);return new n(t)}},ct= 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(en.fromStr(e),new R(t),r,i)}serialize(e){this.module_name.serialize(e),this.function_name.serialize(e),e.serializeVector(this.type_args),e.serializeU32AsUleb128(this.args.length),this.args.forEach(t=>{t.serializeForEntryFunction(e)})}static deserialize(e){let t=en.deserialize(e),r=R.deserialize(e),i=e.deserializeVector(K),o=e.deserializeUleb128AsU32(),s=new Array;for(let a=0;a<o;a+=1){let c=e.deserializeUleb128AsU32(),d=Kn.deserialize(e,c);s.push(d)}return new n(t,r,i,s)}},on= 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(K),i=e.deserializeUleb128AsU32(),o=new Array;for(let s=0;s<i;s+=1){let a=ac(e);o.push(a)}return new n(t,r,o)}},sn= exports.MultiSig =class n{constructor(e,t){this.multisig_address=e,this.transaction_payload=t}serialize(e){this.multisig_address.serialize(e),this.transaction_payload===void 0?e.serializeBool(!1):(e.serializeBool(!0),this.transaction_payload.serialize(e))}static deserialize(e){let t=u.deserialize(e),r=e.deserializeBool(),i;return r&&(i=an.deserialize(e)),new n(t,i)}},an= exports.MultiSigTransactionPayload =class n extends 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(ct.deserialize(e))}};var pe=class n extends 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=u.deserialize(e),r=e.deserializeU64(),i=at.deserialize(e),o=e.deserializeU64(),s=e.deserializeU64(),a=e.deserializeU64(),c=vt.deserialize(e);return new n(t,r,i,o,s,a,c)}},$n= exports.RawTransactionWithData =class extends l{static deserialize(e){let t=e.deserializeUleb128AsU32();switch(t){case 0:return ut.load(e);case 1:return pt.load(e);default:throw new Error(`Unknown variant index for RawTransactionWithData: ${t}`)}}},ut= exports.MultiAgentRawTransaction =class n extends $n{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=pe.deserialize(e),r=e.deserializeVector(u);return new n(t,r)}},pt= exports.FeePayerRawTransaction =class n extends $n{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=pe.deserialize(e),r=e.deserializeVector(u),i=u.deserialize(e);return new n(t,r,i)}};var Ln=class extends l{constructor(t){super();this.accountAddress=u.ONE;this.moduleName=new S("account");this.structName=new S("RotationProofChallenge");this.sequenceNumber=new O(t.sequenceNumber),this.originator=t.originator,this.currentAuthKey=t.currentAuthKey,this.newPublicKey=h.U8(t.newPublicKey.toUint8Array())}serialize(t){t.serialize(this.accountAddress),t.serialize(this.moduleName),t.serialize(this.structName),t.serialize(this.sequenceNumber),t.serialize(this.originator),t.serialize(this.currentAuthKey),t.serialize(this.newPublicKey)}};var ze=class extends l{static deserialize(e){let t=e.deserializeUleb128AsU32();switch(t){case 0:return Et.load(e);case 1:return Vr.load(e);case 2:return It.load(e);case 3:return Ut.load(e);case 4:return Rt.load(e);default:throw new Error(`Unknown variant index for TransactionAuthenticator: ${t}`)}}},Et= exports.TransactionAuthenticatorEd25519 =class n extends ze{constructor(e,t){super(),this.public_key=e,this.signature=t}serialize(e){e.serializeU32AsUleb128(0),this.public_key.serialize(e),this.signature.serialize(e)}static load(e){let t=_.deserialize(e),r=v.deserialize(e);return new n(t,r)}},Vr= exports.TransactionAuthenticatorMultiEd25519 =class n extends ze{constructor(e,t){super(),this.public_key=e,this.signature=t}serialize(e){e.serializeU32AsUleb128(1),this.public_key.serialize(e),this.signature.serialize(e)}static load(e){let t=ft.deserialize(e),r=tt.deserialize(e);return new n(t,r)}},It= exports.TransactionAuthenticatorMultiAgent =class n extends ze{constructor(e,t,r){super(),this.sender=e,this.secondary_signer_addresses=t,this.secondary_signers=r}serialize(e){e.serializeU32AsUleb128(2),this.sender.serialize(e),e.serializeVector(this.secondary_signer_addresses),e.serializeVector(this.secondary_signers)}static load(e){let t=j.deserialize(e),r=e.deserializeVector(u),i=e.deserializeVector(j);return new n(t,r,i)}},Ut= exports.TransactionAuthenticatorFeePayer =class n extends ze{constructor(e,t,r,i){super(),this.sender=e,this.secondary_signer_addresses=t,this.secondary_signers=r,this.fee_payer=i}serialize(e){e.serializeU32AsUleb128(3),this.sender.serialize(e),e.serializeVector(this.secondary_signer_addresses),e.serializeVector(this.secondary_signers),this.fee_payer.address.serialize(e),this.fee_payer.authenticator.serialize(e)}static load(e){let t=j.deserialize(e),r=e.deserializeVector(u),i=e.deserializeVector(j),o=u.deserialize(e),s=j.deserialize(e),a={address:o,authenticator:s};return new n(t,r,i,a)}},Rt= exports.TransactionAuthenticatorSingleSender =class n extends ze{constructor(e){super(),this.sender=e}serialize(e){e.serializeU32AsUleb128(4),this.sender.serialize(e)}static load(e){let t=j.deserialize(e);return new n(t)}};var dt=class n extends 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=pe.deserialize(e),r=ze.deserialize(e);return new n(t,r)}};var Hn=class n extends 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=pe.deserialize(e),r=e.deserializeBool(),i;return r&&(i=u.deserialize(e)),new n(t,i)}};var Qn=class n extends 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=pe.deserialize(e),r=e.deserializeVector(u),i=e.deserializeBool(),o;return i&&(o=u.deserialize(e)),new n(t,r,o)}};function $r(n){return n.feePayerAddress?new pt(n.rawTransaction,_nullishCoalesce(n.secondarySignerAddresses, () => ([])),n.feePayerAddress):n.secondarySignerAddresses?new ut(n.rawTransaction,n.secondarySignerAddresses):n.rawTransaction}function Kt(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 My(n){return Kt(n.bcsToBytes(),`APTOS::${n.constructor.name}`)}function zt(n){let e=$r(n);return n.feePayerAddress?Kt(e.bcsToBytes(),Kr):n.secondarySignerAddresses?Kt(e.bcsToBytes(),Kr):Kt(e.bcsToBytes(),$i)}var kt=class n{constructor(e){this.signingScheme=0;let{privateKey:t,address:r}=e;this.privateKey=t,this.publicKey=t.publicKey(),this.accountAddress=r?u.from(r):this.publicKey.authKey().derivedAddress()}static generate(){let e=W.generate();return new n({privateKey:e})}static fromDerivationPath(e){let{path:t,mnemonic:r}=e,i=W.fromDerivationPath(t,r);return new n({privateKey:i})}verifySignature(e){return this.publicKey.verifySignature(e)}signWithAuthenticator(e){return new we(this.publicKey,this.privateKey.sign(e))}signTransactionWithAuthenticator(e){return new we(this.publicKey,this.signTransaction(e))}sign(e){return this.privateKey.sign(e)}signTransaction(e){return this.sign(zt(e))}};var Dt=class n{constructor(e){this.signingScheme=2;let{privateKey:t,address:r}=e;this.privateKey=t,this.publicKey=new k(t.publicKey()),this.accountAddress=r?u.from(r):this.publicKey.authKey().derivedAddress()}static generate(e={}){let{scheme:t=0}=e,r;switch(t){case 0:r=W.generate();break;case 2:r=nt.generate();break;default:throw new Error(`Unsupported signature scheme ${t}`)}return new n({privateKey:r})}static fromDerivationPath(e){let{scheme:t=0,path:r,mnemonic:i}=e,o;switch(t){case 0:o=W.fromDerivationPath(r,i);break;case 2:o=nt.fromDerivationPath(r,i);break;default:throw new Error(`Unsupported signature scheme ${t}`)}return new n({privateKey:o})}verifySignature(e){return this.publicKey.verifySignature(e)}signWithAuthenticator(e){return new te(this.publicKey,this.sign(e))}signTransactionWithAuthenticator(e){return new te(this.publicKey,this.signTransaction(e))}sign(e){return new M(this.privateKey.sign(e))}signTransaction(e){return this.sign(zt(e))}};var He=class{static generate(e={}){let{scheme:t=0,legacy:r=!0}=e;return t===0&&r?kt.generate():Dt.generate({scheme:t})}static fromPrivateKey(e){let{privateKey:t,address:r,legacy:i=!0}=e;return t instanceof W&&i?new kt({privateKey:t,address:r}):new Dt({privateKey:t,address:r})}static fromPrivateKeyAndAddress(e){return this.fromPrivateKey(e)}static fromDerivationPath(e){let{scheme:t=0,mnemonic:r,path:i,legacy:o=!0}=e;return t===0&&o?kt.fromDerivationPath({mnemonic:r,path:i}):Dt.fromDerivationPath({scheme:t,mnemonic:r,path:i})}static authKey(e){let{publicKey:t}=e;return t.authKey()}verifySignature(e){return this.publicKey.verifySignature(e)}};var pc=1209600,Bt=class Bt extends l{constructor(e){super();let{privateKey:t,expiryDateSecs:r,blinder:i}=e;this.privateKey=t,this.publicKey=new rt(t.publicKey()),this.expiryDateSecs=r||_chunkHBPH2AD3js.d.call(void 0, _chunkHBPH2AD3js.c.call(void 0, )+pc),this.blinder=i!==void 0?g.fromHexInput(i).toUint8Array():dc();let o=Rr(this.publicKey.bcsToBytes(),93);o.push(BigInt(this.expiryDateSecs)),o.push(Zt(this.blinder));let s=Yt(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=W.deserialize(e);break;default:throw new Error(`Unknown variant index for EphemeralPublicKey: ${t}`)}let i=e.deserializeU64(),o=e.deserializeFixedBytes(31);return new Bt({privateKey:r,expiryDateSecs:Number(i),blinder:o})}static fromBytes(e){return Bt.deserialize(new q(e))}static generate(e){let t;switch(_optionalChain([e, 'optionalAccess', _52 => _52.scheme])){case 0:default:t=W.generate()}return new Bt({privateKey:t,expiryDateSecs:_optionalChain([e, 'optionalAccess', _53 => _53.expiryDateSecs])})}sign(e){if(this.isExpired())throw new Error("EphemeralKeyPair has expired");return new xe(this.privateKey.sign(e))}};Bt.BLINDER_LENGTH=31;var lt=Bt;function dc(){return _utils.randomBytes.call(void 0, lt.BLINDER_LENGTH)}var _eventemitter3 = require('eventemitter3'); var _eventemitter32 = _interopRequireDefault(_eventemitter3);var cn=class cn extends l{constructor(e){super();let{address:t,ephemeralKeyPair:r,publicKey:i,uidKey:o,uidVal:s,aud:a,pepper:c,proof:d,proofFetchCallback:p,jwt:T}=e;if(this.ephemeralKeyPair=r,this.publicKey=i,this.accountAddress=t?u.from(t):this.publicKey.authKey().derivedAddress(),this.uidKey=o,this.uidVal=s,this.aud=a,this.jwt=T,this.emitter=new _eventemitter32.default,this.proofOrPromise=d,d instanceof ce)this.proof=d;else{if(p===void 0)throw new Error("Must provide callback for async proof fetch");this.emitter.on("proofFetchFinish",async m=>{await p(m),this.emitter.removeAllListeners()}),this.init(d)}this.signingScheme=2;let w=g.fromHexInput(c).toUint8Array();if(w.length!==cn.PEPPER_LENGTH)throw new Error(`Pepper length in bytes should be ${cn.PEPPER_LENGTH}`);this.pepper=w}async init(e){try{this.proof=await e,this.emitter.emit("proofFetchFinish",{status:"Success"})}catch(t){t instanceof Error?this.emitter.emit("proofFetchFinish",{status:"Failed",error:t.toString()}):this.emitter.emit("proofFetchFinish",{status:"Failed",error:"Unknown"})}}serialize(e){if(e.serializeStr(this.jwt),e.serializeStr(this.uidKey),e.serializeFixedBytes(this.pepper),this.ephemeralKeyPair.serialize(e),this.proof===void 0)throw new Error("Cannot serialize - proof undefined");this.proof.serialize(e)}isExpired(){return this.ephemeralKeyPair.isExpired()}signWithAuthenticator(e){let t=new M(this.sign(e)),r=new k(this.publicKey);return new te(r,t)}signTransactionWithAuthenticator(e){let t=new M(this.signTransaction(e)),r=new k(this.publicKey);return new te(r,t)}async waitForProofFetch(){this.proofOrPromise instanceof Promise&&await this.proofOrPromise}sign(e){let{expiryDateSecs:t}=this.ephemeralKeyPair;if(this.isExpired())throw new Error("EphemeralKeyPair is expired");if(this.proof===void 0)throw new Error("Proof not found - make sure to call `await account.waitForProofFetch()` before signing.");let r=this.ephemeralKeyPair.getPublicKey(),i=this.ephemeralKeyPair.sign(e);return new Re({jwtHeader:_chunkHBPH2AD3js.e.call(void 0, this.jwt.split(".")[0]),ephemeralCertificate:new St(this.proof,0),expiryDateSecs:t,ephemeralPublicKey:r,ephemeralSignature:i})}signTransaction(e){if(this.proof===void 0)throw new Error("Proof not found - make sure to call `await account.waitForProofFetch()` before signing.");let t=$r(e),i=new Lr(t,this.proof.proof).hash();return this.sign(i)}verifySignature(e){let{message:t,signature:r}=e;return!(this.isExpired()||!this.ephemeralKeyPair.getPublicKey().verifySignature({message:t,signature:r.ephemeralSignature}))}};cn.PEPPER_LENGTH=31;var de=cn,Lr= exports.TransactionAndProof =class extends 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 Kt(this.bcsToBytes(),this.domainSeparator)}};var Gt=class n extends de{constructor(e){let t=G.create(e);super({publicKey:t,...e}),this.publicKey=t}serialize(e){if(e.serializeStr(this.jwt),e.serializeStr(this.uidKey),e.serializeFixedBytes(this.pepper),this.ephemeralKeyPair.serialize(e),this.proof===void 0)throw new Error("Cannot serialize - proof undefined");this.proof.serialize(e)}static deserialize(e){let t=e.deserializeStr(),r=e.deserializeStr(),i=e.deserializeFixedBytes(31),o=lt.deserialize(e),s=ce.deserialize(e);return n.create({proof:s,pepper:i,uidKey:r,jwt:t,ephemeralKeyPair:o})}static fromBytes(e){return n.deserialize(new q(e))}static create(e){let{address:t,proof:r,jwt:i,ephemeralKeyPair:o,pepper:s,uidKey:a="sub",proofFetchCallback:c}=e,d=_jwtdecode.jwtDecode.call(void 0, i);if(typeof d.iss!="string")throw new Error("iss was not found");if(typeof d.aud!="string")throw new Error("aud was not found or an array of values");let p=d[a];return new n({address:t,proof:r,ephemeralKeyPair:o,iss:d.iss,uidKey:a,uidVal:p,aud:d.aud,pepper:s,jwt:i,proofFetchCallback:c})}};var Wn=class n extends de{constructor(e){let t=Te.create(e);super({publicKey:t,...e}),this.publicKey=t}serialize(e){if(this.proof===void 0)throw new Error("Cannot serialize - proof undefined");e.serializeStr(this.jwt),e.serializeStr(this.uidKey),e.serializeFixedBytes(this.pepper),this.publicKey.jwkAddress.serialize(e),this.ephemeralKeyPair.serialize(e),this.proof.serialize(e)}static deserialize(e){let t=e.deserializeStr(),r=e.deserializeStr(),i=e.deserializeFixedBytes(31),o=u.deserialize(e),s=lt.deserialize(e),a=ce.deserialize(e);return n.create({proof:a,pepper:i,jwkAddress:o,uidKey:r,jwt:t,ephemeralKeyPair:s})}static fromBytes(e){return n.deserialize(new q(e))}static create(e){let{address:t,proof:r,jwt:i,ephemeralKeyPair:o,pepper:s,jwkAddress:a,uidKey:c="sub",proofFetchCallback:d}=e,p=_jwtdecode.jwtDecode.call(void 0, i);if(typeof p.iss!="string")throw new Error("iss was not found");if(typeof p.aud!="string")throw new Error("aud was not found or an array of values");let T=p[c];return new n({address:t,proof:r,ephemeralKeyPair:o,iss:p.iss,uidKey:c,uidVal:T,aud:p.aud,pepper:s,jwkAddress:u.from(a),jwt:i,proofFetchCallback:d})}};var Ft=class n{constructor(e){let{multiKey:t,signers:r,address:i}=e;this.publicKey=t,this.signingScheme=3,this.accountAddress=i?u.from(i):this.publicKey.authKey().derivedAddress();let o=[];for(let a of r)o.push(this.publicKey.getIndex(a.publicKey));let s=r.map((a,c)=>[a,o[c]]);s.sort((a,c)=>a[1]-c[1]),this.signers=s.map(a=>a[0]),this.signerIndicies=s.map(a=>a[1]),this.signaturesBitmap=this.publicKey.createBitmap({bits:o})}static fromPublicKeysAndSigners(e){let{publicKeys:t,signaturesRequired:r,signers:i}=e,o=new Pt({publicKeys:t,signaturesRequired:r});return new n({multiKey:o,signers:i})}static isMultiKeySigner(e){return e instanceof n}signWithAuthenticator(e){return new st(this.publicKey,this.sign(e))}signTransactionWithAuthenticator(e){return new st(this.publicKey,this.signTransaction(e))}async waitForProofFetch(){let t=this.signers.filter(r=>r instanceof de).map(async r=>r.waitForProofFetch());await Promise.all(t)}sign(e){let t=[];for(let r of this.signers)t.push(r.sign(e));return new ot({signatures:t,bitmap:this.signaturesBitmap})}signTransaction(e){let t=[];for(let r of this.signers)t.push(r.signTransaction(e));return new ot({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 yc=`
|
|
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 _chunk7IYTZDXVjs = require('./chunk-7IYTZDXV.js');var In=255,Un=65535,Ie=4294967295,et=18446744073709551615n,Wt=340282366920938463463374607431768211455n,Rn=115792089237316195423570985008687907853269984665640564039457584007913129639935n;var V=class{constructor(e){this.buffer=new ArrayBuffer(e.length),new Uint8Array(this.buffer).set(e,0),this.offset=0}read(e){if(this.offset+e>this.buffer.byteLength)throw new Error("Reached to the end of buffer");let t=this.buffer.slice(this.offset,this.offset+e);return this.offset+=e,t}remaining(){return this.buffer.byteLength-this.offset}deserializeStr(){let e=this.deserializeBytes();return new TextDecoder().decode(e)}deserializeOptionStr(){return this.deserializeBool()?this.deserializeStr():void 0}deserializeOption(e){return this.deserializeBool()?this.deserialize(e):void 0}deserializeBytes(){let e=this.deserializeUleb128AsU32();return new Uint8Array(this.read(e))}deserializeFixedBytes(e){return new Uint8Array(this.read(e))}deserializeBool(){let e=new Uint8Array(this.read(1))[0];if(e!==1&&e!==0)throw new Error("Invalid boolean value");return e===1}deserializeU8(){return new DataView(this.read(1)).getUint8(0)}deserializeU16(){return new DataView(this.read(2)).getUint16(0,!0)}deserializeU32(){return new DataView(this.read(4)).getUint32(0,!0)}deserializeU64(){let e=this.deserializeU32(),t=this.deserializeU32();return BigInt(BigInt(t)<<BigInt(32)|BigInt(e))}deserializeU128(){let e=this.deserializeU64(),t=this.deserializeU64();return BigInt(t<<BigInt(64)|e)}deserializeU256(){let e=this.deserializeU128(),t=this.deserializeU128();return BigInt(t<<BigInt(128)|e)}deserializeUleb128AsU32(){let e=BigInt(0),t=0;for(;e<Ie;){let r=this.deserializeU8();if(e|=BigInt(r&127)<<BigInt(t),!(r&128))break;t+=7}if(e>Ie)throw new Error("Overflow while parsing uleb128-encoded uint32 value");return Number(e)}deserialize(e){return e.deserialize(this)}deserializeVector(e){let t=this.deserializeUleb128AsU32(),r=new Array;for(let i=0;i<t;i+=1)r.push(this.deserialize(e));return r}};var _utils = require('@noble/hashes/utils');var J=class extends Error{constructor(e,t){super(e),this.invalidReason=t}};var ma=(r=>(r.TOO_SHORT="too_short",r.INVALID_LENGTH="invalid_length",r.INVALID_HEX_CHARS="invalid_hex_chars",r))(ma||{}),m= exports.Hex =class n{constructor(e){this.data=e}toUint8Array(){return this.data}toStringWithoutPrefix(){return _utils.bytesToHex.call(void 0, this.data)}toString(){return`0x${this.toStringWithoutPrefix()}`}static fromHexString(e){let t=e;if(t.startsWith("0x")&&(t=t.slice(2)),t.length===0)throw new J("Hex string is too short, must be at least 1 char long, excluding the optional leading 0x.","too_short");if(t.length%2!==0)throw new J("Hex string must be an even number of hex characters.","invalid_length");try{return new n(_utils.hexToBytes.call(void 0, t))}catch(r){throw new J(`Hex string contains invalid hex characters: ${_optionalChain([r, 'optionalAccess', _2 => _2.message])}`,"invalid_hex_chars")}}static fromHexInput(e){return e instanceof Uint8Array?new n(e):n.fromHexString(e)}static isValid(e){try{return n.fromHexString(e),{valid:!0}}catch(t){return{valid:!1,invalidReason:_optionalChain([t, 'optionalAccess', _3 => _3.invalidReason]),invalidReasonMessage:_optionalChain([t, 'optionalAccess', _4 => _4.message])}}}equals(e){return this.data.length!==e.data.length?!1:this.data.every((t,r)=>t===e.data[r])}};var l=class{bcsToBytes(){let e=new $;return this.serialize(e),e.toUint8Array()}bcsToHex(){let e=this.bcsToBytes();return m.fromHexInput(e)}toStringWithoutPrefix(){return this.bcsToHex().toStringWithoutPrefix()}toString(){return`0x${this.toStringWithoutPrefix()}`}},$= exports.Serializer =class{constructor(e=64){if(e<=0)throw new Error("Length needs to be greater than 0");this.buffer=new ArrayBuffer(e),this.offset=0}ensureBufferWillHandleSize(e){for(;this.buffer.byteLength<this.offset+e;){let t=new ArrayBuffer(this.buffer.byteLength*2);new Uint8Array(t).set(new Uint8Array(this.buffer)),this.buffer=t}}appendToBuffer(e){this.ensureBufferWillHandleSize(e.length),new Uint8Array(this.buffer,this.offset).set(e),this.offset+=e.length}serializeWithFunction(e,t,r){this.ensureBufferWillHandleSize(t);let i=new DataView(this.buffer,this.offset);e.apply(i,[0,r,!0]),this.offset+=t}serializeStr(e){let t=new TextEncoder;this.serializeBytes(t.encode(e))}serializeBytes(e){this.serializeU32AsUleb128(e.length),this.appendToBuffer(e)}serializeFixedBytes(e){this.appendToBuffer(e)}serializeBool(e){xr(e);let t=e?1:0;this.appendToBuffer(new Uint8Array([t]))}serializeU8(e){this.appendToBuffer(new Uint8Array([e]))}serializeU16(e){this.serializeWithFunction(DataView.prototype.setUint16,2,e)}serializeU32(e){this.serializeWithFunction(DataView.prototype.setUint32,4,e)}serializeU64(e){let t=BigInt(e)&BigInt(Ie),r=BigInt(e)>>BigInt(32);this.serializeU32(Number(t)),this.serializeU32(Number(r))}serializeU128(e){let t=BigInt(e)&et,r=BigInt(e)>>BigInt(64);this.serializeU64(t),this.serializeU64(r)}serializeU256(e){let t=BigInt(e)&Wt,r=BigInt(e)>>BigInt(128);this.serializeU128(t),this.serializeU128(r)}serializeU32AsUleb128(e){let t=e,r=[];for(;t>>>7;)r.push(t&127|128),t>>>=7;r.push(t),this.appendToBuffer(new Uint8Array(r))}toUint8Array(){return new Uint8Array(this.buffer).slice(0,this.offset)}serialize(e){e.serialize(this)}serializeVector(e){this.serializeU32AsUleb128(e.length),e.forEach(t=>{t.serialize(this)})}serializeOption(e){let t=e!==void 0;this.serializeBool(t),t&&e.serialize(this)}serializeOptionStr(e){e===void 0?this.serializeU32AsUleb128(0):(this.serializeU32AsUleb128(1),this.serializeStr(e))}};_chunk7IYTZDXVjs.a.call(void 0, [tt(0,In)],$.prototype,"serializeU8",1),_chunk7IYTZDXVjs.a.call(void 0, [tt(0,Un)],$.prototype,"serializeU16",1),_chunk7IYTZDXVjs.a.call(void 0, [tt(0,Ie)],$.prototype,"serializeU32",1),_chunk7IYTZDXVjs.a.call(void 0, [tt(BigInt(0),et)],$.prototype,"serializeU64",1),_chunk7IYTZDXVjs.a.call(void 0, [tt(BigInt(0),Wt)],$.prototype,"serializeU128",1),_chunk7IYTZDXVjs.a.call(void 0, [tt(BigInt(0),Rn)],$.prototype,"serializeU256",1),_chunk7IYTZDXVjs.a.call(void 0, [tt(0,Ie)],$.prototype,"serializeU32AsUleb128",1);function xr(n){if(typeof n!="boolean")throw new Error(`${n} is not a boolean value`)}var ya=(n,e,t)=>`${n} is out of range: [${e}, ${t}]`;function Ve(n,e,t){let r=BigInt(n);if(r>BigInt(t)||r<BigInt(e))throw new Error(ya(n,e,t))}function tt(n,e){return(t,r,i)=>{let o=i.value;return i.value=function(a){return Ve(a,n,e),o.apply(this,[a])},i}}var nt=class n extends l{constructor(e){super(),this.value=m.fromHexInput(e).toUint8Array()}serialize(e){e.serializeFixedBytes(this.value)}serializeForEntryFunction(e){e.serialize(this)}serializeForScriptFunction(e){e.serialize(this)}static deserialize(e,t){let r=e.deserializeFixedBytes(t);return new n(r)}};var Kn=class n extends l{constructor(e){super(),this.value=new nt(e)}serialize(e){e.serialize(this.value)}serializeForEntryFunction(e){e.serializeU32AsUleb128(this.value.value.length),e.serialize(this)}static deserialize(e,t){let r=nt.deserialize(e,t);return new n(r.value)}};var zn=(i=>(i.JSON="application/json",i.BCS="application/x-bcs",i.BCS_SIGNED_TRANSACTION="application/x.aptos.signed_transaction+bcs",i.BCS_VIEW_FUNCTION="application/x.aptos.view_function+bcs",i))(zn||{}),wi= exports.TypeTagVariants =(g=>(g[g.Bool=0]="Bool",g[g.U8=1]="U8",g[g.U64=2]="U64",g[g.U128=3]="U128",g[g.Address=4]="Address",g[g.Signer=5]="Signer",g[g.Vector=6]="Vector",g[g.Struct=7]="Struct",g[g.U16=8]="U16",g[g.U32=9]="U32",g[g.U256=10]="U256",g[g.Reference=254]="Reference",g[g.Generic=255]="Generic",g))(wi||{}),jt= exports.ScriptTransactionArgumentVariants =(d=>(d[d.U8=0]="U8",d[d.U64=1]="U64",d[d.U128=2]="U128",d[d.Address=3]="Address",d[d.U8Vector=4]="U8Vector",d[d.Bool=5]="Bool",d[d.U16=6]="U16",d[d.U32=7]="U32",d[d.U256=8]="U256",d[d.Serialized=9]="Serialized",d))(jt||{}),Si= exports.TransactionPayloadVariants =(r=>(r[r.Script=0]="Script",r[r.EntryFunction=2]="EntryFunction",r[r.Multisig=3]="Multisig",r))(Si||{}),xi= exports.TransactionVariants =(t=>(t[t.MultiAgentTransaction=0]="MultiAgentTransaction",t[t.FeePayerTransaction=1]="FeePayerTransaction",t))(xi||{}),_i= exports.TransactionAuthenticatorVariant =(o=>(o[o.Ed25519=0]="Ed25519",o[o.MultiEd25519=1]="MultiEd25519",o[o.MultiAgent=2]="MultiAgent",o[o.FeePayer=3]="FeePayer",o[o.SingleSender=4]="SingleSender",o))(_i||{}),Pi= exports.AccountAuthenticatorVariant =(i=>(i[i.Ed25519=0]="Ed25519",i[i.MultiEd25519=1]="MultiEd25519",i[i.SingleKey=2]="SingleKey",i[i.MultiKey=3]="MultiKey",i))(Pi||{}),kn= exports.AnyPublicKeyVariant =(i=>(i[i.Ed25519=0]="Ed25519",i[i.Secp256k1=1]="Secp256k1",i[i.Keyless=3]="Keyless",i[i.FederatedKeyless=4]="FederatedKeyless",i))(kn||{}),vi= exports.AnySignatureVariant =(r=>(r[r.Ed25519=0]="Ed25519",r[r.Secp256k1=1]="Secp256k1",r[r.Keyless=3]="Keyless",r))(vi||{}),_r= exports.EphemeralPublicKeyVariant =(e=>(e[e.Ed25519=0]="Ed25519",e))(_r||{}),Ci= exports.EphemeralSignatureVariant =(e=>(e[e.Ed25519=0]="Ed25519",e))(Ci||{}),Pr= exports.EphemeralCertificateVariant =(e=>(e[e.ZkProof=0]="ZkProof",e))(Pr||{}),vr= exports.ZkpVariant =(e=>(e[e.Groth16=0]="Groth16",e))(vr||{}),Cr= exports.TransactionResponseType =(a=>(a.Pending="pending_transaction",a.User="user_transaction",a.Genesis="genesis_transaction",a.BlockMetadata="block_metadata_transaction",a.StateCheckpoint="state_checkpoint_transaction",a.Validator="validator_transaction",a.BlockEpilogue="block_epilogue_transaction",a))(Cr||{});function Du(n){return n.type==="pending_transaction"}function Bu(n){return n.type==="user_transaction"}function Gu(n){return n.type==="genesis_transaction"}function Fu(n){return n.type==="block_metadata_transaction"}function Ou(n){return n.type==="state_checkpoint_transaction"}function Nu(n){return n.type==="validator_transaction"}function Mu(n){return n.type==="block_epilogue_transaction"}function qu(n){return"signature"in n&&n.signature==="ed25519_signature"}function Vu(n){return"signature"in n&&n.signature==="secp256k1_ecdsa_signature"}function $u(n){return n.type==="multi_agent_signature"}function Lu(n){return n.type==="fee_payer_signature"}function Hu(n){return n.type==="multi_ed25519_signature"}var fa=(r=>(r.PRIVATE="private",r.PUBLIC="public",r.FRIEND="friend",r))(fa||{}),Ei= exports.MoveAbility =(i=>(i.STORE="store",i.DROP="drop",i.KEY="key",i.COPY="copy",i))(Ei||{}),Aa= exports.RoleType =(t=>(t.VALIDATOR="validator",t.FULL_NODE="full_node",t))(Aa||{}),ye= exports.SigningScheme =(i=>(i[i.Ed25519=0]="Ed25519",i[i.MultiEd25519=1]="MultiEd25519",i[i.SingleKey=2]="SingleKey",i[i.MultiKey=3]="MultiKey",i))(ye||{}),Er= exports.SigningSchemeInput =(t=>(t[t.Ed25519=0]="Ed25519",t[t.Secp256k1Ecdsa=2]="Secp256k1Ecdsa",t))(Er||{}),Ii= exports.DeriveScheme =(o=>(o[o.DeriveAuid=251]="DeriveAuid",o[o.DeriveObjectAddressFromObject=252]="DeriveObjectAddressFromObject",o[o.DeriveObjectAddressFromGuid=253]="DeriveObjectAddressFromGuid",o[o.DeriveObjectAddressFromSeed=254]="DeriveObjectAddressFromSeed",o[o.DeriveResourceAccountAddress=255]="DeriveResourceAccountAddress",o))(Ii||{});var U=class n extends l{constructor(e){super(),xr(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 ae(e.deserializeU256())}static deserialize(e){return new n(e.deserializeBool())}},L= exports.U8 =class n extends l{constructor(e){super(),Ve(e,0,In),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())}},fe= exports.U16 =class n extends l{constructor(e){super(),Ve(e,0,Un),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())}},Ae= exports.U32 =class n extends l{constructor(e){super(),Ve(e,0,Ie),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())}},M= exports.U64 =class n extends l{constructor(e){super(),Ve(e,BigInt(0),et),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())}},he= exports.U128 =class n extends l{constructor(e){super(),Ve(e,BigInt(0),Wt),this.value=BigInt(e)}serialize(e){e.serializeU128(this.value)}serializeForEntryFunction(e){let t=this.bcsToBytes();e.serializeBytes(t)}serializeForScriptFunction(e){e.serializeU32AsUleb128(2),e.serialize(this)}static deserialize(e){return new n(e.deserializeU128())}},ae= exports.U256 =class n extends l{constructor(e){super(),Ve(e,BigInt(0),Rn),this.value=BigInt(e)}serialize(e){e.serializeU256(this.value)}serializeForEntryFunction(e){let t=this.bcsToBytes();e.serializeBytes(t)}serializeForScriptFunction(e){e.serializeU32AsUleb128(8),e.serialize(this)}static deserialize(e){return new n(e.deserializeU256())}};var h=class n extends 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 L)){new Xt(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=m.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 L(r)))}static U16(e){return new n(e.map(t=>new fe(t)))}static U32(e){return new n(e.map(t=>new Ae(t)))}static U64(e){return new n(e.map(t=>new M(t)))}static U128(e){return new n(e.map(t=>new he(t)))}static U256(e){return new n(e.map(t=>new ae(t)))}static Bool(e){return new n(e.map(t=>new U(t)))}static MoveString(e){return new n(e.map(t=>new S(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)}},Xt= exports.Serialized =class n extends l{constructor(e){super(),this.value=m.fromHexInput(e).toUint8Array()}serialize(e){e.serializeBytes(this.value)}serializeForEntryFunction(e){this.serialize(e)}serializeForScriptFunction(e){e.serializeU32AsUleb128(9),this.serialize(e)}static deserialize(e){return new n(e.deserializeBytes())}toMoveVector(e){let t=new V(this.bcsToBytes());t.deserializeUleb128AsU32();let r=t.deserializeVector(e);return new h(r)}},S= exports.MoveString =class n extends 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);h.U8(r).serializeForScriptFunction(e)}static deserialize(e){return new n(e.deserializeStr())}},H= exports.MoveOption =class n extends l{constructor(e){super(),typeof e<"u"&&e!==null?this.vec=new h([e]):this.vec=new h([]),[this.value]=this.vec.values}serializeForEntryFunction(e){let t=this.bcsToBytes();e.serializeBytes(t)}unwrap(){if(this.isSome())return this.vec.values[0];throw new Error("Called unwrap on a MoveOption with no value")}isSome(){return this.vec.values.length===1}serialize(e){this.vec.serialize(e)}static U8(e){return new n(e!=null?new L(e):void 0)}static U16(e){return new n(e!=null?new fe(e):void 0)}static U32(e){return new n(e!=null?new Ae(e):void 0)}static U64(e){return new n(e!=null?new M(e):void 0)}static U128(e){return new n(e!=null?new he(e):void 0)}static U256(e){return new n(e!=null?new ae(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 S(e):void 0)}static deserialize(e,t){let r=h.deserialize(e,t);return new n(r.values[0])}};var _ed25519 = require('@noble/curves/ed25519');var _sha3 = require('@noble/hashes/sha3');var ba=(a=>(a.INCORRECT_NUMBER_OF_BYTES="incorrect_number_of_bytes",a.INVALID_HEX_CHARS="invalid_hex_chars",a.TOO_SHORT="too_short",a.TOO_LONG="too_long",a.LEADING_ZERO_X_REQUIRED="leading_zero_x_required",a.LONG_FORM_REQUIRED_UNLESS_SPECIAL="long_form_required_unless_special",a.INVALID_PADDING_ZEROES="INVALID_PADDING_ZEROES",a))(ba||{}),x=class x extends l{constructor(e){if(super(),e.length!==x.LENGTH)throw new J("AccountAddress data should be exactly 32 bytes long","incorrect_number_of_bytes");this.data=e}isSpecial(){return this.data.slice(0,this.data.length-1).every(e=>e===0)&&this.data[this.data.length-1]<16}toString(){return`0x${this.toStringWithoutPrefix()}`}toStringWithoutPrefix(){let e=_utils.bytesToHex.call(void 0, this.data);return this.isSpecial()&&(e=e[e.length-1]),e}toStringLong(){return`0x${this.toStringLongWithoutPrefix()}`}toStringLongWithoutPrefix(){return _utils.bytesToHex.call(void 0, this.data)}toUint8Array(){return this.data}serialize(e){e.serializeFixedBytes(this.data)}serializeForEntryFunction(e){let t=this.bcsToBytes();e.serializeBytes(t)}serializeForScriptFunction(e){e.serializeU32AsUleb128(3),e.serialize(this)}static deserialize(e){let t=e.deserializeFixedBytes(x.LENGTH);return new x(t)}static fromStringStrict(e){if(!e.startsWith("0x"))throw new J("Hex string must start with a leading 0x.","leading_zero_x_required");let t=x.fromString(e);if(e.length!==x.LONG_STRING_LENGTH+2)if(t.isSpecial()){if(e.length!==3)throw new J(`The given hex string ${e} is a special address not in LONG form, it must be 0x0 to 0xf without padding zeroes.`,"INVALID_PADDING_ZEROES")}else throw new J(`The given hex string ${e} is not a special address, it must be represented as 0x + 64 chars.`,"long_form_required_unless_special");return t}static fromString(e){let t=e;if(e.startsWith("0x")&&(t=e.slice(2)),t.length===0)throw new J("Hex string is too short, must be 1 to 64 chars long, excluding the leading 0x.","too_short");if(t.length>64)throw new J("Hex string is too long, must be 1 to 64 chars long, excluding the leading 0x.","too_long");let r;try{r=_utils.hexToBytes.call(void 0, t.padStart(64,"0"))}catch(i){throw new J(`Hex characters are invalid: ${_optionalChain([i, 'optionalAccess', _5 => _5.message])}`,"invalid_hex_chars")}return new x(r)}static from(e){return typeof e=="string"?x.fromString(e):e instanceof Uint8Array?new x(e):e}static fromStrict(e){return typeof e=="string"?x.fromStringStrict(e):e instanceof Uint8Array?new x(e):e}static isValid(e){try{return e.strict?x.fromStrict(e.input):x.from(e.input),{valid:!0}}catch(t){return{valid:!1,invalidReason:_optionalChain([t, 'optionalAccess', _6 => _6.invalidReason]),invalidReasonMessage:_optionalChain([t, 'optionalAccess', _7 => _7.message])}}}equals(e){return this.data.length!==e.data.length?!1:this.data.every((t,r)=>t===e.data[r])}};x.LENGTH=32,x.LONG_STRING_LENGTH=64,x.ZERO=x.from("0x0"),x.ONE=x.from("0x1"),x.TWO=x.from("0x2"),x.THREE=x.from("0x3"),x.FOUR=x.from("0x4"),x.A=x.from("0xA");var u=x;var $e=class $e extends l{constructor(e){super();let{data:t}=e,r=m.fromHexInput(t);if(r.toUint8Array().length!==$e.LENGTH)throw new Error(`Authentication Key length should be ${$e.LENGTH}`);this.data=r}serialize(e){e.serializeFixedBytes(this.data.toUint8Array())}static deserialize(e){let t=e.deserializeFixedBytes($e.LENGTH);return new $e({data:t})}toUint8Array(){return this.data.toUint8Array()}static fromSchemeAndBytes(e){let{scheme:t,input:r}=e,i=m.fromHexInput(r).toUint8Array(),o=new Uint8Array([...i,t]),s=_sha3.sha3_256.create();s.update(o);let a=s.digest();return new $e({data:a})}static fromPublicKeyAndScheme(e){let{publicKey:t}=e;return t.authKey()}static fromPublicKey(e){let{publicKey:t}=e;return t.authKey()}derivedAddress(){return new u(this.data.toUint8Array())}};$e.LENGTH=32;var B=$e;var _hmac = require('@noble/hashes/hmac');var _sha512 = require('@noble/hashes/sha512');var _bip39 = require('@scure/bip39'); var Ri = _interopRequireWildcard(_bip39);var xa=/^m\/44'\/637'\/[0-9]+'\/[0-9]+'\/[0-9]+'?$/,_a= exports.APTOS_BIP44_REGEX =/^m\/44'\/637'\/[0-9]+'\/[0-9]+\/[0-9]+$/,Pa= exports.KeyType =(e=>(e.ED25519="ed25519 seed",e))(Pa||{}),Ki= exports.HARDENED_OFFSET =2147483648;function zi(n){return _a.test(n)}function ki(n){return xa.test(n)}var Ir=(n,e)=>{let t=_hmac.hmac.create(_sha512.sha512,n).update(e).digest();return{key:t.slice(0,32),chainCode:t.slice(32)}},Di= 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 Ir(e,s)},va=n=>n.replace(/'/g,""),Bi= exports.splitPath =n=>n.split("/").slice(1).map(va),Dn= exports.mnemonicToSeed =n=>{let e=n.trim().split(/\s+/).map(t=>t.toLowerCase()).join(" ");return Ri.mnemonicToSeedSync(e)};var rt=class extends l{toUint8Array(){return this.bcsToBytes()}toString(){let e=this.toUint8Array();return m.fromHexInput(e).toString()}},ee= exports.AccountPublicKey =class extends rt{};var G=class extends l{toUint8Array(){return this.bcsToBytes()}toString(){let e=this.toUint8Array();return m.fromHexInput(e).toString()}};var ht=n=>typeof n=="string"?m.isValid(n).valid?n:new TextEncoder().encode(n):n;var Ur=[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 Ca(n){let e=n.toUint8Array().slice(32);for(let t=Ur.length-1;t>=0;t-=1){if(e[t]<Ur[t])return!0;if(e[t]>Ur[t])return!1}return!1}var Le=class Le extends ee{constructor(e){super();let t=m.fromHexInput(e);if(t.toUint8Array().length!==Le.LENGTH)throw new Error(`PublicKey length should be ${Le.LENGTH}`);this.key=t}verifySignature(e){let{message:t,signature:r}=e;if(!Ca(r))return!1;let i=ht(t),o=m.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 Le(t)}static isPublicKey(e){return e instanceof Le}static isInstance(e){return"key"in e&&_optionalChain([e, 'access', _8 => _8.key, 'optionalAccess', _9 => _9.data, 'optionalAccess', _10 => _10.length])===Le.LENGTH}};Le.LENGTH=32;var _=Le,ce=class ce extends l{constructor(e){super();let t=m.fromHexInput(e);if(t.toUint8Array().length!==ce.LENGTH)throw new Error(`PrivateKey length should be ${ce.LENGTH}`);this.signingKey=t}static generate(){let e=_ed25519.ed25519.utils.randomPrivateKey();return new ce(e)}static fromDerivationPath(e,t){if(!ki(e))throw new Error(`Invalid derivation path ${e}`);return ce.fromDerivationPathInner(e,Dn(t))}static fromDerivationPathInner(e,t,r=Ki){let{key:i,chainCode:o}=Ir(ce.SLIP_0010_SEED,t),s=Bi(e).map(c=>parseInt(c,10)),{key:a}=s.reduce((c,p)=>Di(c,p+r),{key:i,chainCode:o});return new ce(a)}publicKey(){let e=_ed25519.ed25519.getPublicKey(this.signingKey.toUint8Array());return new _(e)}sign(e){let t=ht(e),r=m.fromHexInput(t).toUint8Array(),i=_ed25519.ed25519.sign(r,this.signingKey.toUint8Array());return new v(i)}toUint8Array(){return this.signingKey.toUint8Array()}toString(){return this.signingKey.toString()}serialize(e){e.serializeBytes(this.toUint8Array())}static deserialize(e){let t=e.deserializeBytes();return new ce(t)}static isPrivateKey(e){return e instanceof ce}};ce.LENGTH=32,ce.SLIP_0010_SEED="ed25519 seed";var j=ce,bt=class bt extends G{constructor(e){super();let t=m.fromHexInput(e);if(t.toUint8Array().length!==bt.LENGTH)throw new Error(`Signature length should be ${bt.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 bt(t)}};bt.LENGTH=64;var v=bt;var ue=class ue extends ee{constructor(e){super();let{publicKeys:t,threshold:r}=e;if(t.length>ue.MAX_KEYS||t.length<ue.MIN_KEYS)throw new Error(`Must have between ${ue.MIN_KEYS} and ${ue.MAX_KEYS} public keys, inclusive`);if(r<ue.MIN_THRESHOLD||r>t.length)throw new Error(`Threshold must be between ${ue.MIN_THRESHOLD} and ${t.length}, inclusive`);this.publicKeys=t,this.threshold=r}verifySignature(e){let{message:t,signature:r}=e;if(!(r instanceof it))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*_.LENGTH+1);return this.publicKeys.forEach((t,r)=>{e.set(t.toUint8Array(),r*_.LENGTH)}),e[this.publicKeys.length*_.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+=_.LENGTH){let s=o;i.push(new _(t.subarray(s,s+_.LENGTH)))}return new ue({publicKeys:i,threshold:r})}};ue.MAX_KEYS=32,ue.MIN_KEYS=2,ue.MIN_THRESHOLD=1;var Tt=ue,ne=class ne extends G{constructor(e){super();let{signatures:t,bitmap:r}=e;if(t.length>ne.MAX_SIGNATURES_SUPPORTED)throw new Error(`The number of signatures cannot be greater than ${ne.MAX_SIGNATURES_SUPPORTED}`);if(this.signatures=t,!(r instanceof Uint8Array))this.bitmap=ne.createBitmap({bits:r});else{if(r.length!==ne.BITMAP_LEN)throw new Error(`"bitmap" length should be ${ne.BITMAP_LEN}`);this.bitmap=r}}toUint8Array(){let e=new Uint8Array(this.signatures.length*v.LENGTH+ne.BITMAP_LEN);return this.signatures.forEach((t,r)=>{e.set(t.toUint8Array(),r*v.LENGTH)}),e.set(this.bitmap,this.signatures.length*v.LENGTH),e}serialize(e){e.serializeBytes(this.toUint8Array())}static deserialize(e){let t=e.deserializeBytes(),r=t.subarray(t.length-4),i=[];for(let o=0;o<t.length-r.length;o+=v.LENGTH){let s=o;i.push(new v(t.subarray(s,s+v.LENGTH)))}return new ne({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>=ne.MAX_SIGNATURES_SUPPORTED)throw new Error(`Cannot have a signature larger than ${ne.MAX_SIGNATURES_SUPPORTED-1}.`);if(o.has(s))throw new Error("Duplicate bits detected.");if(a>0&&s<=t[a-1])throw new Error("The bits need to be sorted in ascending order.");o.add(s);let c=Math.floor(s/8),p=i[c];p|=r>>s%8,i[c]=p}),i}};ne.MAX_SIGNATURES_SUPPORTED=32,ne.BITMAP_LEN=4;var it=ne;var _secp256k1 = require('@noble/curves/secp256k1');var _bip32 = require('@scure/bip32');var He=class He extends rt{constructor(e){super();let t=m.fromHexInput(e);if(t.toUint8Array().length!==He.LENGTH)throw new Error(`PublicKey length should be ${He.LENGTH}`);this.key=t}verifySignature(e){let{message:t,signature:r}=e,i=ht(t),o=m.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 st(t)}static deserialize(e){let t=e.deserializeBytes();return new He(t)}static isPublicKey(e){return e instanceof He}static isInstance(e){return"key"in e&&_optionalChain([e, 'access', _11 => _11.key, 'optionalAccess', _12 => _12.data, 'optionalAccess', _13 => _13.length])===He.LENGTH}};He.LENGTH=65;var Ue=He,Se=class Se extends l{constructor(e){super();let t=m.fromHexInput(e);if(t.toUint8Array().length!==Se.LENGTH)throw new Error(`PrivateKey length should be ${Se.LENGTH}`);this.key=t}static generate(){let e=_secp256k1.secp256k1.utils.randomPrivateKey();return new Se(e)}static fromDerivationPath(e,t){if(!zi(e))throw new Error(`Invalid derivation path ${e}`);return Se.fromDerivationPathInner(e,Dn(t))}static fromDerivationPathInner(e,t){let{privateKey:r}=_bip32.HDKey.fromMasterSeed(t).derive(e);if(r===null)throw new Error("Invalid key");return new Se(r)}sign(e){let t=ht(e),r=m.fromHexInput(t),i=_sha3.sha3_256.call(void 0, r.toUint8Array()),o=_secp256k1.secp256k1.sign(i,this.key.toUint8Array(),{lowS:!0});return new st(o.toCompactRawBytes())}publicKey(){let e=_secp256k1.secp256k1.getPublicKey(this.key.toUint8Array(),!1);return new Ue(e)}toUint8Array(){return this.key.toUint8Array()}toString(){return this.key.toString()}serialize(e){e.serializeBytes(this.toUint8Array())}static deserialize(e){let t=e.deserializeBytes();return new Se(t)}static isPrivateKey(e){return e instanceof Se}};Se.LENGTH=32;var ot=Se,wt=class wt extends G{constructor(e){super();let t=m.fromHexInput(e);if(t.toUint8Array().length!==wt.LENGTH)throw new Error(`Signature length should be ${wt.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 wt(t)}};wt.LENGTH=64;var st=wt;var _jwtdecode = require('jwt-decode');var at=class n extends rt{constructor(e){super();let t=e.constructor.name;switch(t){case _.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 _)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(_.deserialize(e));default:throw new Error(`Unknown variant index for EphemeralPublicKey: ${t}`)}}static isPublicKey(e){return e instanceof n}},xe= exports.EphemeralSignature =class n extends G{constructor(e){super();let t=e.constructor.name;switch(t){case v.name:this.signature=e;break;default:throw new Error(`Unsupported signature for EphemeralSignature - ${t}`)}}static fromHex(e){let t=m.fromHexInput(e),r=new V(t.toUint8Array());return n.deserialize(r)}serialize(e){if(this.signature instanceof v)e.serializeU32AsUleb128(0),this.signature.serialize(e);else throw new Error("Unknown signature type")}static deserialize(e){let t=e.deserializeUleb128AsU32();switch(t){case 0:return new n(v.deserialize(e));default:throw new Error(`Unknown variant index for EphemeralSignature: ${t}`)}}};var _poseidonlite = require('poseidon-lite');var Rr=[_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],Oi=31,La=16,Fi=(La-1)*Oi;function Fn(n,e){let r=new TextEncoder().encode(n);return Ha(r,e)}function Ha(n,e){if(n.length>e)throw new Error(`Inputted bytes of length ${n} is longer than ${e}`);let t=Kr(n,e);return Yt(t)}function Qa(n,e){if(n.length>e)throw new Error(`Input bytes of length ${n} is longer than ${e}`);let t=Xa(n,e);return Wa(t)}function Kr(n,e){if(n.length>e)throw new Error(`Input bytes of length ${n} is longer than ${e}`);return Qa(n,e).concat([BigInt(n.length)])}function Wa(n){if(n.length>Fi)throw new Error(`Can't pack more than ${Fi}. Was given ${n.length} bytes`);return ja(n,Oi).map(e=>Zt(e))}function ja(n,e){let t=[];for(let r=0;r<n.length;r+=e)t.push(n.subarray(r,r+e));return t}function Zt(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 Ni(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 Xa(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 Yt(n){if(n.length>Rr.length)throw new Error(`Unable to hash input of length ${n.length}. Max input length is ${Rr.length}`);return Rr[n.length-1](n)}var On=class extends l{};var St=(o=>(o.FULLNODE="Fullnode",o.INDEXER="Indexer",o.FAUCET="Faucet",o.PEPPER="Pepper",o.PROVER="Prover",o))(St||{}),Mi= exports.DEFAULT_MAX_GAS_AMOUNT =2e5,qi= exports.DEFAULT_TXN_EXP_SEC_FROM_NOW =20,Nn= exports.DEFAULT_TXN_TIMEOUT_SEC =20,ct= exports.APTOS_COIN ="0x1::aptos_coin::AptosCoin",Vi= exports.APTOS_FA ="0x000000000000000000000000000000000000000000000000000000000000000a",$i= exports.RAW_TRANSACTION_SALT ="APTOS::RawTransaction",zr= exports.RAW_TRANSACTION_WITH_DATA_SALT ="APTOS::RawTransactionWithData",Re= 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))(Re||{});var be=class extends Error{constructor({apiType:e,aptosRequest:t,aptosResponse:r}){super(Za({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 Za({apiType:n,aptosRequest:e,aptosResponse:t}){let r=_optionalChain([t, 'access', _14 => _14.headers, 'optionalAccess', _15 => _15.traceparent, 'optionalAccess', _16 => _16.split, 'call', _17 => _17("-"), 'access', _18 => _18[1]]),i=r?`(trace_id:${r}) `:"",o=`Request to [${n}]: ${e.method} ${_nullishCoalesce(t.url, () => (e.url))} ${i}failed with`;return n==="Indexer"&&_optionalChain([t, 'access', _19 => _19.data, 'optionalAccess', _20 => _20.errors, 'optionalAccess', _21 => _21[0], 'optionalAccess', _22 => _22.message])!=null?`${o}: ${t.data.errors[0].message}`:_optionalChain([t, 'access', _23 => _23.data, 'optionalAccess', _24 => _24.message])!=null&&_optionalChain([t, 'access', _25 => _25.data, 'optionalAccess', _26 => _26.error_code])!=null?`${o}: ${JSON.stringify(t.data)}`:`${o} status: ${t.statusText}(code:${t.status}) and response body: ${Ya(t.data)}`}var kr=400;function Ya(n){let e=JSON.stringify(n);return e.length<=kr?e:`truncated(original_size:${e.length}): ${e.slice(0,kr/2)}...${e.slice(-kr/2)}`}var Li="1.31.0";var Hi={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"},Qi= 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"},Wi= exports.NetworkToFaucetAPI ={mainnet:"https://faucet.mainnet.aptoslabs.com",testnet:"https://faucet.testnet.aptoslabs.com",devnet:"https://faucet.devnet.aptoslabs.com",local:"http://127.0.0.1:8081"},Dr= 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"},Br= 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"},Gr= exports.Network =(o=>(o.MAINNET="mainnet",o.TESTNET="testnet",o.DEVNET="devnet",o.LOCAL="local",o.CUSTOM="custom",o))(Gr||{}),Fr= exports.NetworkToChainId ={mainnet:1,testnet:2,local:4},Vd= exports.NetworkToNetworkName ={mainnet:"mainnet",testnet:"testnet",devnet:"devnet",local:"local",custom:"custom"};function ji(n,e){let t=e.bcsToBytes(),r=new V(t);return n.deserialize(r)}async function Ja(n,e){let{url:t,method:r,body:i,contentType:o,params:s,overrides:a,originMethod:c}=n,p={..._optionalChain([a, 'optionalAccess', _27 => _27.HEADERS]),"x-aptos-client":`aptos-typescript-sdk/${Li}`,"content-type":_nullishCoalesce(o, () => ("application/json")),"x-aptos-typescript-sdk-origin-method":c};return _optionalChain([a, 'optionalAccess', _28 => _28.AUTH_TOKEN])&&(p.Authorization=`Bearer ${_optionalChain([a, 'optionalAccess', _29 => _29.AUTH_TOKEN])}`),_optionalChain([a, 'optionalAccess', _30 => _30.API_KEY])&&(p.Authorization=`Bearer ${_optionalChain([a, 'optionalAccess', _31 => _31.API_KEY])}`),e.provider({url:t,method:r,body:i,params:s,headers:p,overrides:a})}async function Mn(n,e,t){let{url:r,path:i}=n,o=i?`${r}/${i}`:r,s=await Ja({...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 be({apiType:t,aptosRequest:n,aptosResponse:a});if(t==="Indexer"){let c=a.data;if(c.errors)throw new be({apiType:t,aptosRequest:n,aptosResponse:a});a.data=c.data}else if((t==="Pepper"||t==="Prover")&&a.status>=400)throw new be({apiType:t,aptosRequest:n,aptosResponse:a});if(a.status>=200&&a.status<300)return a;throw new be({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,p=e.getRequestUrl(c);return Mn({url:p,method:"GET",originMethod:a,path:s,contentType:i,acceptType:o,params:r,overrides:{...e.clientConfig,...t}},e,n.type)}async function Q(n){let{aptosConfig:e}=n;return Or({...n,type:"Fullnode",overrides:{...e.clientConfig,...e.fullnodeConfig,...n.overrides,HEADERS:{..._optionalChain([e, 'access', _32 => _32.clientConfig, 'optionalAccess', _33 => _33.HEADERS]),..._optionalChain([e, 'access', _34 => _34.fullnodeConfig, 'optionalAccess', _35 => _35.HEADERS])}}})}async function ll(n){return Or({...n,type:"Pepper"})}async function xt(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 Jt(n){let{type:e,originMethod:t,path:r,body:i,acceptType:o,contentType:s,params:a,aptosConfig:c,overrides:p}=n,d=c.getRequestUrl(e);return Mn({url:d,method:"POST",originMethod:t,path:r,body:i,contentType:s,acceptType:o,params:a,overrides:p},c,n.type)}async function Qe(n){let{aptosConfig:e}=n;return Jt({...n,type:"Fullnode",overrides:{...e.clientConfig,...e.fullnodeConfig,...n.overrides,HEADERS:{..._optionalChain([e, 'access', _36 => _36.clientConfig, 'optionalAccess', _37 => _37.HEADERS]),..._optionalChain([e, 'access', _38 => _38.fullnodeConfig, 'optionalAccess', _39 => _39.HEADERS])}}})}async function Xi(n){let{aptosConfig:e}=n;return Jt({...n,type:"Indexer",overrides:{...e.clientConfig,...e.indexerConfig,...n.overrides,HEADERS:{..._optionalChain([e, 'access', _40 => _40.clientConfig, 'optionalAccess', _41 => _41.HEADERS]),..._optionalChain([e, 'access', _42 => _42.indexerConfig, 'optionalAccess', _43 => _43.HEADERS])}}})}async function Zi(n){let{aptosConfig:e}=n,t={...e,clientConfig:{...e.clientConfig}};return _optionalChainDelete([t, 'optionalAccess', _44 => _44.clientConfig, 'optionalAccess', _45 => delete _45.API_KEY]),Jt({...n,type:"Faucet",overrides:{...t.clientConfig,...t.faucetConfig,...n.overrides,HEADERS:{..._optionalChain([t, 'access', _46 => _46.clientConfig, 'optionalAccess', _47 => _47.HEADERS]),..._optionalChain([t, 'access', _48 => _48.faucetConfig, 'optionalAccess', _49 => _49.HEADERS])}}})}async function Yi(n){return Jt({...n,type:"Pepper"})}async function Ji(n){return Jt({...n,type:"Prover"})}var Nr=new Map;function _e(n,e,t){return async(...r)=>{if(Nr.has(e)){let{value:o,timestamp:s}=Nr.get(e);if(t===void 0||Date.now()-s<=t)return o}let i=await n(...r);return Nr.set(e,{value:i,timestamp:Date.now()}),i}}var ql=1e7,tc= exports.MAX_AUD_VAL_BYTES =120,nc= exports.MAX_UID_KEY_BYTES =30,rc= exports.MAX_UID_VAL_BYTES =330,Vl= exports.MAX_ISS_VAL_BYTES =120,$l= exports.MAX_EXTRA_FIELD_BYTES =350,Ll= exports.MAX_JWT_HEADER_B64_BYTES =300,Hl= exports.MAX_COMMITED_EPK_BYTES =93,Pe=class Pe extends ee{constructor(e,t){super();let r=m.fromHexInput(t).toUint8Array();if(r.length!==Pe.ID_COMMITMENT_LENGTH)throw new Error(`Id Commitment length in bytes should be ${Pe.ID_COMMITMENT_LENGTH}`);this.iss=e,this.idCommitment=r}authKey(){let e=new $;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 Pe(t,r)}static load(e){let t=e.deserializeStr(),r=e.deserializeBytes();return new Pe(t,r)}static isPublicKey(e){return e instanceof Pe}static create(e){return eo(e),new Pe(e.iss,eo(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 Pe.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}};Pe.ID_COMMITMENT_LENGTH=32;var F=Pe;function eo(n){let{uidKey:e,uidVal:t,aud:r,pepper:i}=n,o=[Zt(m.fromHexInput(i).toUint8Array()),Fn(r,tc),Fn(t,rc),Fn(e,nc)];return Ni(Yt(o),F.ID_COMMITMENT_LENGTH)}var ze=class n extends G{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}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=_t.deserialize(e),r=e.deserializeStr(),i=e.deserializeU64(),o=at.deserialize(e),s=xe.deserialize(e);return new n({jwtHeader:r,expiryDateSecs:Number(i),ephemeralCertificate:t,ephemeralPublicKey:o,ephemeralSignature:s})}static getSimulationSignature(){return new n({jwtHeader:"{}",ephemeralCertificate:new _t(new pe({proof:new vt(new Pt({a:new Uint8Array(32),b:new Uint8Array(64),c:new Uint8Array(32)}),0),expHorizonSecs:0}),0),expiryDateSecs:0,ephemeralPublicKey:new at(new _(new Uint8Array(32))),ephemeralSignature:new xe(new v(new Uint8Array(64)))})}static isSignature(e){return e instanceof n}},_t= exports.EphemeralCertificate =class n extends G{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}`)}}},Ke=class n extends l{constructor(e){if(super(),this.data=m.fromHexInput(e).toUint8Array(),this.data.length!==32)throw new Error("Input needs to be 32 bytes")}serialize(e){e.serializeFixedBytes(this.data)}static deserialize(e){let t=e.deserializeFixedBytes(32);return new n(t)}},ut=class n extends l{constructor(e){if(super(),this.data=m.fromHexInput(e).toUint8Array(),this.data.length!==64)throw new Error("Input needs to be 64 bytes")}serialize(e){e.serializeFixedBytes(this.data)}static deserialize(e){let t=e.deserializeFixedBytes(64);return new n(t)}},Pt= exports.Groth16Zkp =class n extends On{constructor(e){super();let{a:t,b:r,c:i}=e;this.a=new Ke(t),this.b=new ut(r),this.c=new Ke(i)}serialize(e){this.a.serialize(e),this.b.serialize(e),this.c.serialize(e)}static deserialize(e){let t=Ke.deserialize(e).bcsToBytes(),r=ut.deserialize(e).bcsToBytes(),i=Ke.deserialize(e).bcsToBytes();return new n({a:t,b:r,c:i})}},vt= exports.ZkProof =class n extends 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(Pt.deserialize(e),t);default:throw new Error(`Unknown variant index for ZkProof: ${t}`)}}},pe= exports.ZeroKnowledgeSig =class n extends G{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 V(e))}serialize(e){this.proof.serialize(e),e.serializeU64(this.expHorizonSecs),e.serializeOptionStr(this.extraField),e.serializeOptionStr(this.overrideAudVal),e.serializeOption(this.trainingWheelsSignature)}static deserialize(e){let t=vt.deserialize(e),r=Number(e.deserializeU64()),i=e.deserializeOptionStr(),o=e.deserializeOptionStr(),s=e.deserializeOption(xe);return new n({proof:t,expHorizonSecs:r,trainingWheelsSignature:s,extraField:i,overrideAudVal:o})}},Mr= exports.KeylessConfiguration =class n{constructor(e,t){this.verficationKey=e,this.maxExpHorizonSecs=t}static create(e,t){return new n(new qr({alphaG1:e.alpha_g1,betaG2:e.beta_g2,deltaG2:e.delta_g2,gammaAbcG1:e.gamma_abc_g1,gammaG2:e.gamma_g2}),t)}},qr=class n{constructor(e){let{alphaG1:t,betaG2:r,deltaG2:i,gammaAbcG1:o,gammaG2:s}=e;this.alphaG1=new Ke(t),this.betaG2=new ut(r),this.deltaG2=new ut(i),this.gammaAbcG1=[new Ke(o[0]),new Ke(o[1])],this.gammaG2=new ut(s)}static fromGroth16VerificationKeyResponse(e){return new n({alphaG1:e.alpha_g1,betaG2:e.beta_g2,deltaG2:e.delta_g2,gammaAbcG1:e.gamma_abc_g1,gammaG2:e.gamma_g2})}};async function to(n){let{aptosConfig:e}=n;return _e(async()=>{let t=await ic(n),r=await oc(n);return Mr.create(r,Number(t.max_exp_horizon_secs))},`keyless-configuration-${e.network}`,1e3*60*5)()}async function ic(n){let{aptosConfig:e,options:t}=n,r="0x1::keyless_account::Configuration",{data:i}=await Q({aptosConfig:e,originMethod:"getKeylessConfigurationResource",path:`accounts/${u.from("0x1").toString()}/resource/${r}`,params:{ledger_version:_optionalChain([t, 'optionalAccess', _50 => _50.ledgerVersion])}});return i.data}async function oc(n){let{aptosConfig:e,options:t}=n,r="0x1::keyless_account::Groth16VerificationKey",{data:i}=await Q({aptosConfig:e,originMethod:"getGroth16VerificationKeyResource",path:`accounts/${u.from("0x1").toString()}/resource/${r}`,params:{ledger_version:_optionalChain([t, 'optionalAccess', _51 => _51.ledgerVersion])}});return i.data}var Te=class n extends ee{constructor(e,t){super(),this.jwkAddress=u.from(e),this.keylessPublicKey=t}authKey(){let e=new $;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=u.deserialize(e),r=F.deserialize(e);return new n(t,r)}static isPublicKey(e){return e instanceof n}static create(e){return new n(e.jwkAddress,F.create(e))}static fromJwtAndPepper(e){return new n(e.jwkAddress,F.fromJwtAndPepper(e))}static isInstance(e){return"jwkAddress"in e&&e.jwkAddress instanceof u&&"keylessPublicKey"in e&&e.keylessPublicKey instanceof F}};var k=class n extends ee{constructor(e){if(super(),this.publicKey=e,e instanceof _)this.variant=0;else if(e instanceof Ue)this.variant=1;else if(e instanceof F)this.variant=3;else if(e instanceof Te)this.variant=4;else throw new Error("Unsupported public key type")}verifySignature(e){let{message:t,signature:r}=e;return O.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=_.deserialize(e);break;case 1:r=Ue.deserialize(e);break;case 3:r=F.deserialize(e);break;case 4:r=Te.deserialize(e);break;default:throw new Error(`Unknown variant index for AnyPublicKey: ${t}`)}return new n(r)}static isPublicKey(e){return e instanceof n}isEd25519(){return this.publicKey instanceof _}isSecp256k1PublicKey(){return this.publicKey instanceof Ue}static isInstance(e){return"publicKey"in e&&"variant"in e}},O= exports.AnySignature =class n extends G{constructor(e){if(super(),this.signature=e,e instanceof v)this.variant=0;else if(e instanceof st)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=v.deserialize(e);break;case 1:r=st.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 sc(n){let e=n;return e-=e>>1&1431655765,e=(e&858993459)+(e>>2&858993459),(e+(e>>4)&252645135)*16843009>>24}var We=class n extends ee{constructor(e){super();let{publicKeys:t,signaturesRequired:r}=e;if(r<1)throw new Error("The number of required signatures needs to be greater than 0");if(t.length<r)throw new Error(`Provided ${t.length} public keys is smaller than the ${r} required signatures`);this.publicKeys=t.map(i=>i instanceof k?i:new k(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(k),r=e.deserializeU8();return new n({publicKeys:t,signaturesRequired:r})}createBitmap(e){let{bits:t}=e,r=128,i=new Uint8Array([0,0,0,0]),o=new Set;return t.forEach((s,a)=>{if(a+1>this.publicKeys.length)throw new Error(`Signature index ${a+1} is out of public keys range, ${this.publicKeys.length}.`);if(o.has(s))throw new Error(`Duplicate bit ${s} detected.`);o.add(s);let c=Math.floor(s/8),p=i[c];p|=r>>s%8,i[c]=p}),i}getIndex(e){let t=e instanceof k?e:new k(e),r=this.publicKeys.findIndex(i=>i.toString()===t.toString());if(r!==-1)return r;throw new Error("Public key not found in MultiKey")}static isInstance(e){return"publicKeys"in e&&"signaturesRequired"in e}},re=class re extends G{constructor(e){super();let{signatures:t,bitmap:r}=e;if(t.length>re.MAX_SIGNATURES_SUPPORTED)throw new Error(`The number of signatures cannot be greater than ${re.MAX_SIGNATURES_SUPPORTED}`);if(this.signatures=t.map(o=>o instanceof O?o:new O(o)),!(r instanceof Uint8Array))this.bitmap=re.createBitmap({bits:r});else{if(r.length!==re.BITMAP_LEN)throw new Error(`"bitmap" length should be ${re.BITMAP_LEN}`);this.bitmap=r}let i=this.bitmap.reduce((o,s)=>o+sc(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>=re.MAX_SIGNATURES_SUPPORTED)throw new Error(`Cannot have a signature larger than ${re.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(O),r=e.deserializeBytes();return new re({signatures:t,bitmap:r})}};re.BITMAP_LEN=4,re.MAX_SIGNATURES_SUPPORTED=re.BITMAP_LEN*8;var ke=re;var X=class extends l{static deserialize(e){let t=e.deserializeUleb128AsU32();switch(t){case 0:return we.load(e);case 1:return qn.load(e);case 2:return te.load(e);case 3:return ve.load(e);default:throw new Error(`Unknown variant index for AccountAuthenticator: ${t}`)}}isEd25519(){return this instanceof we}isMultiEd25519(){return this instanceof qn}isSingleKey(){return this instanceof te}isMultiKey(){return this instanceof ve}},we= exports.AccountAuthenticatorEd25519 =class n extends X{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=_.deserialize(e),r=v.deserialize(e);return new n(t,r)}},qn= exports.AccountAuthenticatorMultiEd25519 =class n extends X{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=Tt.deserialize(e),r=it.deserialize(e);return new n(t,r)}},te= exports.AccountAuthenticatorSingleKey =class n extends X{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=k.deserialize(e),r=O.deserialize(e);return new n(t,r)}},ve= exports.AccountAuthenticatorMultiKey =class n extends X{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=We.deserialize(e),r=ke.deserialize(e);return new n(t,r)}};var Ct=class n extends 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 I=class n extends 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 Vn=(n,e)=>{let t=n.bcsToBytes(),r=typeof e=="string"?Buffer.from(e,"utf8"):e,i=new Uint8Array([...t,...r,254]);return new u(_sha3.sha3_256.call(void 0, i))},rm= exports.createResourceAddress =(n,e)=>{let t=n.bcsToBytes(),r=typeof e=="string"?Buffer.from(e,"utf8"):e,i=new Uint8Array([...t,...r,255]);return new u(_sha3.sha3_256.call(void 0, i))},im= exports.createTokenAddress =(n,e,t)=>{let r=`${e}::${t}`;return Vn(n,r)};var en=class n extends 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(u.fromString(t[0]),new I(t[1]))}serialize(e){this.address.serialize(e),this.name.serialize(e)}static deserialize(e){let t=u.deserialize(e),r=I.deserialize(e);return new n(t,r)}};var K=class n extends l{deserialize(e){let t=u.deserialize(e),r=I.deserialize(e),i=I.deserialize(e),o=e.deserializeVector(n);return new Ce(t,r,i,o)}static deserialize(e){let t=e.deserializeUleb128AsU32();switch(t){case 0:return D.load(e);case 1:return ie.load(e);case 2:return q.load(e);case 3:return Ge.load(e);case 4:return W.load(e);case 5:return pt.load(e);case 6:return C.load(e);case 7:return y.load(e);case 8:return De.load(e);case 9:return Be.load(e);case 10:return Fe.load(e);case 255:return z.load(e);default:throw new Error(`Unknown variant index for TypeTag: ${t}`)}}isBool(){return this instanceof D}isAddress(){return this instanceof W}isGeneric(){return this instanceof z}isSigner(){return this instanceof pt}isVector(){return this instanceof C}isStruct(){return this instanceof y}isU8(){return this instanceof ie}isU16(){return this instanceof De}isU32(){return this instanceof Be}isU64(){return this instanceof q}isU128(){return this instanceof Ge}isU256(){return this instanceof Fe}isPrimitive(){return this instanceof pt||this instanceof W||this instanceof D||this instanceof ie||this instanceof De||this instanceof Be||this instanceof q||this instanceof Ge||this instanceof Fe}},D= exports.TypeTagBool =class n extends K{toString(){return"bool"}serialize(e){e.serializeU32AsUleb128(0)}static load(e){return new n}},ie= exports.TypeTagU8 =class n extends K{toString(){return"u8"}serialize(e){e.serializeU32AsUleb128(1)}static load(e){return new n}},De= exports.TypeTagU16 =class n extends K{toString(){return"u16"}serialize(e){e.serializeU32AsUleb128(8)}static load(e){return new n}},Be= exports.TypeTagU32 =class n extends K{toString(){return"u32"}serialize(e){e.serializeU32AsUleb128(9)}static load(e){return new n}},q= exports.TypeTagU64 =class n extends K{toString(){return"u64"}serialize(e){e.serializeU32AsUleb128(2)}static load(e){return new n}},Ge= exports.TypeTagU128 =class n extends K{toString(){return"u128"}serialize(e){e.serializeU32AsUleb128(3)}static load(e){return new n}},Fe= exports.TypeTagU256 =class n extends K{toString(){return"u256"}serialize(e){e.serializeU32AsUleb128(10)}static load(e){return new n}},W= exports.TypeTagAddress =class n extends K{toString(){return"address"}serialize(e){e.serializeU32AsUleb128(4)}static load(e){return new n}},pt= exports.TypeTagSigner =class n extends K{toString(){return"signer"}serialize(e){e.serializeU32AsUleb128(5)}static load(e){return new n}},$n= exports.TypeTagReference =class n extends K{constructor(t){super();this.value=t}toString(){return`&${this.value.toString()}`}serialize(t){t.serializeU32AsUleb128(254)}static load(t){let r=K.deserialize(t);return new n(r)}},z= exports.TypeTagGeneric =class n extends K{constructor(t){super();this.value=t;if(t<0)throw new Error("Generic type parameter index cannot be negative")}toString(){return`T${this.value}`}serialize(t){t.serializeU32AsUleb128(255),t.serializeU32(this.value)}static load(t){let r=t.deserializeU32();return new n(r)}},C= exports.TypeTagVector =class n extends K{constructor(t){super();this.value=t}toString(){return`vector<${this.value.toString()}>`}static u8(){return new n(new ie)}serialize(t){t.serializeU32AsUleb128(6),this.value.serialize(t)}static load(t){let r=K.deserialize(t);return new n(r)}},y= exports.TypeTagStruct =class n extends K{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=Ce.deserialize(t);return new n(r)}isTypeTag(t,r,i){return this.value.moduleName.identifier===r&&this.value.name.identifier===i&&this.value.address.equals(t)}isString(){return this.isTypeTag(u.ONE,"string","String")}isOption(){return this.isTypeTag(u.ONE,"option","Option")}isObject(){return this.isTypeTag(u.ONE,"object","Object")}},Ce= exports.StructTag =class n extends 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=u.deserialize(e),r=I.deserialize(e),i=I.deserialize(e),o=e.deserializeVector(K);return new n(t,r,i,o)}};function Cm(){return new Ce(u.ONE,new I("aptos_coin"),new I("AptosCoin"),[])}function P(){return new Ce(u.ONE,new I("string"),new I("String"),[])}function Em(n){return new Ce(u.ONE,new I("option"),new I("Option"),[n])}function oe(n){return new Ce(u.ONE,new I("object"),new I("Object"),[n])}function ac(n){let e=n.deserializeUleb128AsU32();switch(e){case 0:return L.deserialize(n);case 1:return M.deserialize(n);case 2:return he.deserialize(n);case 3:return u.deserialize(n);case 4:return h.deserialize(n,L);case 5:return U.deserialize(n);case 6:return fe.deserialize(n);case 7:return Ae.deserialize(n);case 8:return ae.deserialize(n);case 9:return Xt.deserialize(n);default:throw new Error(`Unknown variant index for ScriptTransactionArgument: ${e}`)}}var dt=class extends l{static deserialize(e){let t=e.deserializeUleb128AsU32();switch(t){case 0:return tn.load(e);case 2:return nn.load(e);case 3:return rn.load(e);default:throw new Error(`Unknown variant index for TransactionPayload: ${t}`)}}},tn= exports.TransactionPayloadScript =class n extends dt{constructor(e){super(),this.script=e}serialize(e){e.serializeU32AsUleb128(0),this.script.serialize(e)}static load(e){let t=on.deserialize(e);return new n(t)}},nn= exports.TransactionPayloadEntryFunction =class n extends dt{constructor(e){super(),this.entryFunction=e}serialize(e){e.serializeU32AsUleb128(2),this.entryFunction.serialize(e)}static load(e){let t=lt.deserialize(e);return new n(t)}},rn= exports.TransactionPayloadMultiSig =class n extends dt{constructor(e){super(),this.multiSig=e}serialize(e){e.serializeU32AsUleb128(3),this.multiSig.serialize(e)}static load(e){let t=sn.deserialize(e);return new n(t)}},lt= 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(en.fromStr(e),new I(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=en.deserialize(e),r=I.deserialize(e),i=e.deserializeVector(K),o=e.deserializeUleb128AsU32(),s=new Array;for(let a=0;a<o;a+=1){let c=e.deserializeUleb128AsU32(),p=Kn.deserialize(e,c);s.push(p)}return new n(t,r,i,s)}},on= 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(K),i=e.deserializeUleb128AsU32(),o=new Array;for(let s=0;s<i;s+=1){let a=ac(e);o.push(a)}return new n(t,r,o)}},sn= exports.MultiSig =class n{constructor(e,t){this.multisig_address=e,this.transaction_payload=t}serialize(e){this.multisig_address.serialize(e),this.transaction_payload===void 0?e.serializeBool(!1):(e.serializeBool(!0),this.transaction_payload.serialize(e))}static deserialize(e){let t=u.deserialize(e),r=e.deserializeBool(),i;return r&&(i=an.deserialize(e)),new n(t,i)}},an= exports.MultiSigTransactionPayload =class n extends 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(lt.deserialize(e))}};var de=class n extends 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=u.deserialize(e),r=e.deserializeU64(),i=dt.deserialize(e),o=e.deserializeU64(),s=e.deserializeU64(),a=e.deserializeU64(),c=Ct.deserialize(e);return new n(t,r,i,o,s,a,c)}},Ln= exports.RawTransactionWithData =class extends l{static deserialize(e){let t=e.deserializeUleb128AsU32();switch(t){case 0:return gt.load(e);case 1:return mt.load(e);default:throw new Error(`Unknown variant index for RawTransactionWithData: ${t}`)}}},gt= exports.MultiAgentRawTransaction =class n extends Ln{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=de.deserialize(e),r=e.deserializeVector(u);return new n(t,r)}},mt= exports.FeePayerRawTransaction =class n extends Ln{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=de.deserialize(e),r=e.deserializeVector(u),i=u.deserialize(e);return new n(t,r,i)}};var Hn=class extends l{constructor(t){super();this.accountAddress=u.ONE;this.moduleName=new S("account");this.structName=new S("RotationProofChallenge");this.sequenceNumber=new M(t.sequenceNumber),this.originator=t.originator,this.currentAuthKey=t.currentAuthKey,this.newPublicKey=h.U8(t.newPublicKey.toUint8Array())}serialize(t){t.serialize(this.accountAddress),t.serialize(this.moduleName),t.serialize(this.structName),t.serialize(this.sequenceNumber),t.serialize(this.originator),t.serialize(this.currentAuthKey),t.serialize(this.newPublicKey)}};var Oe=class extends l{static deserialize(e){let t=e.deserializeUleb128AsU32();switch(t){case 0:return Et.load(e);case 1:return Vr.load(e);case 2:return It.load(e);case 3:return Ut.load(e);case 4:return Rt.load(e);default:throw new Error(`Unknown variant index for TransactionAuthenticator: ${t}`)}}},Et= exports.TransactionAuthenticatorEd25519 =class n extends Oe{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=_.deserialize(e),r=v.deserialize(e);return new n(t,r)}},Vr= exports.TransactionAuthenticatorMultiEd25519 =class n extends Oe{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=Tt.deserialize(e),r=it.deserialize(e);return new n(t,r)}},It= exports.TransactionAuthenticatorMultiAgent =class n extends Oe{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=X.deserialize(e),r=e.deserializeVector(u),i=e.deserializeVector(X);return new n(t,r,i)}},Ut= exports.TransactionAuthenticatorFeePayer =class n extends Oe{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=X.deserialize(e),r=e.deserializeVector(u),i=e.deserializeVector(X),o=u.deserialize(e),s=X.deserialize(e),a={address:o,authenticator:s};return new n(t,r,i,a)}},Rt= exports.TransactionAuthenticatorSingleSender =class n extends Oe{constructor(e){super(),this.sender=e}serialize(e){e.serializeU32AsUleb128(4),this.sender.serialize(e)}static load(e){let t=X.deserialize(e);return new n(t)}};var yt=class n extends 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=de.deserialize(e),r=Oe.deserialize(e);return new n(t,r)}};var Qn=class n extends 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=de.deserialize(e),r=e.deserializeBool(),i;return r&&(i=u.deserialize(e)),new n(t,i)}};var Wn=class n extends 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=de.deserialize(e),r=e.deserializeVector(u),i=e.deserializeBool(),o;return i&&(o=u.deserialize(e)),new n(t,r,o)}};function $r(n){return n.feePayerAddress?new mt(n.rawTransaction,_nullishCoalesce(n.secondarySignerAddresses, () => ([])),n.feePayerAddress):n.secondarySignerAddresses?new gt(n.rawTransaction,n.secondarySignerAddresses):n.rawTransaction}function Kt(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 Oy(n){return Kt(n.bcsToBytes(),`APTOS::${n.constructor.name}`)}function zt(n){let e=$r(n);return n.feePayerAddress?Kt(e.bcsToBytes(),zr):n.secondarySignerAddresses?Kt(e.bcsToBytes(),zr):Kt(e.bcsToBytes(),$i)}var kt=class n{constructor(e){this.signingScheme=0;let{privateKey:t,address:r}=e;this.privateKey=t,this.publicKey=t.publicKey(),this.accountAddress=r?u.from(r):this.publicKey.authKey().derivedAddress()}static generate(){let e=j.generate();return new n({privateKey:e})}static fromDerivationPath(e){let{path:t,mnemonic:r}=e,i=j.fromDerivationPath(t,r);return new n({privateKey:i})}verifySignature(e){return this.publicKey.verifySignature(e)}signWithAuthenticator(e){return new we(this.publicKey,this.privateKey.sign(e))}signTransactionWithAuthenticator(e){return new we(this.publicKey,this.signTransaction(e))}sign(e){return this.privateKey.sign(e)}signTransaction(e){return this.sign(zt(e))}};var Dt=class n{constructor(e){this.signingScheme=2;let{privateKey:t,address:r}=e;this.privateKey=t,this.publicKey=new k(t.publicKey()),this.accountAddress=r?u.from(r):this.publicKey.authKey().derivedAddress()}static generate(e={}){let{scheme:t=0}=e,r;switch(t){case 0:r=j.generate();break;case 2:r=ot.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=j.fromDerivationPath(r,i);break;case 2:o=ot.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 te(this.publicKey,this.sign(e))}signTransactionWithAuthenticator(e){return new te(this.publicKey,this.signTransaction(e))}sign(e){return new O(this.privateKey.sign(e))}signTransaction(e){return this.sign(zt(e))}};var je=class{static generate(e={}){let{scheme:t=0,legacy:r=!0}=e;return t===0&&r?kt.generate():Dt.generate({scheme:t})}static fromPrivateKey(e){let{privateKey:t,address:r,legacy:i=!0}=e;return t instanceof j&&i?new kt({privateKey:t,address:r}):new Dt({privateKey:t,address:r})}static fromPrivateKeyAndAddress(e){return this.fromPrivateKey(e)}static fromDerivationPath(e){let{scheme:t=0,mnemonic:r,path:i,legacy:o=!0}=e;return t===0&&o?kt.fromDerivationPath({mnemonic:r,path:i}):Dt.fromDerivationPath({scheme:t,mnemonic:r,path:i})}static authKey(e){let{publicKey:t}=e;return t.authKey()}verifySignature(e){return this.publicKey.verifySignature(e)}};var pc=1209600,Bt=class Bt extends l{constructor(e){super();let{privateKey:t,expiryDateSecs:r,blinder:i}=e;this.privateKey=t,this.publicKey=new at(t.publicKey()),this.expiryDateSecs=r||_chunk7IYTZDXVjs.d.call(void 0, _chunk7IYTZDXVjs.c.call(void 0, )+pc),this.blinder=i!==void 0?m.fromHexInput(i).toUint8Array():dc();let o=Kr(this.publicKey.bcsToBytes(),93);o.push(BigInt(this.expiryDateSecs)),o.push(Zt(this.blinder));let s=Yt(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=j.deserialize(e);break;default:throw new Error(`Unknown variant index for EphemeralPublicKey: ${t}`)}let i=e.deserializeU64(),o=e.deserializeFixedBytes(31);return new Bt({privateKey:r,expiryDateSecs:Number(i),blinder:o})}static fromBytes(e){return Bt.deserialize(new V(e))}static generate(e){let t;switch(_optionalChain([e, 'optionalAccess', _52 => _52.scheme])){case 0:default:t=j.generate()}return new Bt({privateKey:t,expiryDateSecs:_optionalChain([e, 'optionalAccess', _53 => _53.expiryDateSecs])})}sign(e){if(this.isExpired())throw new Error("EphemeralKeyPair has expired");return new xe(this.privateKey.sign(e))}};Bt.BLINDER_LENGTH=31;var ft=Bt;function dc(){return _utils.randomBytes.call(void 0, ft.BLINDER_LENGTH)}var _eventemitter3 = require('eventemitter3'); var _eventemitter32 = _interopRequireDefault(_eventemitter3);var cn=class cn extends l{constructor(e){super();let{address:t,ephemeralKeyPair:r,publicKey:i,uidKey:o,uidVal:s,aud:a,pepper:c,proof:p,proofFetchCallback:d,jwt:T}=e;if(this.ephemeralKeyPair=r,this.publicKey=i,this.accountAddress=t?u.from(t):this.publicKey.authKey().derivedAddress(),this.uidKey=o,this.uidVal=s,this.aud=a,this.jwt=T,this.emitter=new _eventemitter32.default,this.proofOrPromise=p,p instanceof pe)this.proof=p;else{if(d===void 0)throw new Error("Must provide callback for async proof fetch");this.emitter.on("proofFetchFinish",async g=>{await d(g),this.emitter.removeAllListeners()}),this.init(p)}this.signingScheme=2;let w=m.fromHexInput(c).toUint8Array();if(w.length!==cn.PEPPER_LENGTH)throw new Error(`Pepper length in bytes should be ${cn.PEPPER_LENGTH}`);this.pepper=w}async init(e){try{this.proof=await e,this.emitter.emit("proofFetchFinish",{status:"Success"})}catch(t){t instanceof Error?this.emitter.emit("proofFetchFinish",{status:"Failed",error:t.toString()}):this.emitter.emit("proofFetchFinish",{status:"Failed",error:"Unknown"})}}serialize(e){if(e.serializeStr(this.jwt),e.serializeStr(this.uidKey),e.serializeFixedBytes(this.pepper),this.ephemeralKeyPair.serialize(e),this.proof===void 0)throw new Error("Cannot serialize - proof undefined");this.proof.serialize(e)}isExpired(){return this.ephemeralKeyPair.isExpired()}signWithAuthenticator(e){let t=new O(this.sign(e)),r=new k(this.publicKey);return new te(r,t)}signTransactionWithAuthenticator(e){let t=new O(this.signTransaction(e)),r=new k(this.publicKey);return new te(r,t)}async waitForProofFetch(){this.proofOrPromise instanceof Promise&&await this.proofOrPromise}sign(e){let{expiryDateSecs:t}=this.ephemeralKeyPair;if(this.isExpired())throw new Error("EphemeralKeyPair is expired");if(this.proof===void 0)throw new Error("Proof not found - make sure to call `await account.waitForProofFetch()` before signing.");let r=this.ephemeralKeyPair.getPublicKey(),i=this.ephemeralKeyPair.sign(e);return new ze({jwtHeader:_chunk7IYTZDXVjs.e.call(void 0, this.jwt.split(".")[0]),ephemeralCertificate:new _t(this.proof,0),expiryDateSecs:t,ephemeralPublicKey:r,ephemeralSignature:i})}signTransaction(e){if(this.proof===void 0)throw new Error("Proof not found - make sure to call `await account.waitForProofFetch()` before signing.");let t=$r(e),i=new Lr(t,this.proof.proof).hash();return this.sign(i)}verifySignature(e){let{message:t,signature:r}=e;return!(this.isExpired()||!this.ephemeralKeyPair.getPublicKey().verifySignature({message:t,signature:r.ephemeralSignature}))}};cn.PEPPER_LENGTH=31;var le=cn,Lr= exports.TransactionAndProof =class extends 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 Kt(this.bcsToBytes(),this.domainSeparator)}};var Gt=class n extends le{constructor(e){let t=F.create(e);super({publicKey:t,...e}),this.publicKey=t}serialize(e){if(e.serializeStr(this.jwt),e.serializeStr(this.uidKey),e.serializeFixedBytes(this.pepper),this.ephemeralKeyPair.serialize(e),this.proof===void 0)throw new Error("Cannot serialize - proof undefined");this.proof.serialize(e)}static deserialize(e){let t=e.deserializeStr(),r=e.deserializeStr(),i=e.deserializeFixedBytes(31),o=ft.deserialize(e),s=pe.deserialize(e);return n.create({proof:s,pepper:i,uidKey:r,jwt:t,ephemeralKeyPair:o})}static fromBytes(e){return n.deserialize(new V(e))}static create(e){let{address:t,proof:r,jwt:i,ephemeralKeyPair:o,pepper:s,uidKey:a="sub",proofFetchCallback:c}=e,p=_jwtdecode.jwtDecode.call(void 0, i);if(typeof p.iss!="string")throw new Error("iss was not found");if(typeof p.aud!="string")throw new Error("aud was not found or an array of values");let d=p[a];return new n({address:t,proof:r,ephemeralKeyPair:o,iss:p.iss,uidKey:a,uidVal:d,aud:p.aud,pepper:s,jwt:i,proofFetchCallback:c})}};var jn=class n extends le{constructor(e){let t=Te.create(e);super({publicKey:t,...e}),this.publicKey=t}serialize(e){if(this.proof===void 0)throw new Error("Cannot serialize - proof undefined");e.serializeStr(this.jwt),e.serializeStr(this.uidKey),e.serializeFixedBytes(this.pepper),this.publicKey.jwkAddress.serialize(e),this.ephemeralKeyPair.serialize(e),this.proof.serialize(e)}static deserialize(e){let t=e.deserializeStr(),r=e.deserializeStr(),i=e.deserializeFixedBytes(31),o=u.deserialize(e),s=ft.deserialize(e),a=pe.deserialize(e);return n.create({proof:a,pepper:i,jwkAddress:o,uidKey:r,jwt:t,ephemeralKeyPair:s})}static fromBytes(e){return n.deserialize(new V(e))}static create(e){let{address:t,proof:r,jwt:i,ephemeralKeyPair:o,pepper:s,jwkAddress:a,uidKey:c="sub",proofFetchCallback:p}=e,d=_jwtdecode.jwtDecode.call(void 0, i);if(typeof d.iss!="string")throw new Error("iss was not found");if(typeof d.aud!="string")throw new Error("aud was not found or an array of values");let T=d[c];return new n({address:t,proof:r,ephemeralKeyPair:o,iss:d.iss,uidKey:c,uidVal:T,aud:d.aud,pepper:s,jwkAddress:u.from(a),jwt:i,proofFetchCallback:p})}};var Ft=class n{constructor(e){let{multiKey:t,signers:r,address:i}=e;this.publicKey=t,this.signingScheme=3,this.accountAddress=i?u.from(i):this.publicKey.authKey().derivedAddress();let o=[];for(let a of r)o.push(this.publicKey.getIndex(a.publicKey));let s=r.map((a,c)=>[a,o[c]]);s.sort((a,c)=>a[1]-c[1]),this.signers=s.map(a=>a[0]),this.signerIndicies=s.map(a=>a[1]),this.signaturesBitmap=this.publicKey.createBitmap({bits:o})}static fromPublicKeysAndSigners(e){let{publicKeys:t,signaturesRequired:r,signers:i}=e,o=new We({publicKeys:t,signaturesRequired:r});return new n({multiKey:o,signers:i})}static isMultiKeySigner(e){return e instanceof n}signWithAuthenticator(e){return new ve(this.publicKey,this.sign(e))}signTransactionWithAuthenticator(e){return new ve(this.publicKey,this.signTransaction(e))}async waitForProofFetch(){let t=this.signers.filter(r=>r instanceof le).map(async r=>r.waitForProofFetch());await Promise.all(t)}sign(e){let t=[];for(let r of this.signers)t.push(r.sign(e));return new ke({signatures:t,bitmap:this.signaturesBitmap})}signTransaction(e){let t=[];for(let r of this.signers)t.push(r.signTransaction(e));return new ke({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 yc=`
|
|
2
2
|
fragment TokenActivitiesFields on token_activities_v2 {
|
|
3
3
|
after_value
|
|
4
4
|
before_value
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
subdomain_expiration_policy
|
|
29
29
|
domain_expiration_timestamp
|
|
30
30
|
}
|
|
31
|
-
`,
|
|
31
|
+
`,Xn=`
|
|
32
32
|
fragment CurrentTokenOwnershipFields on current_token_ownerships_v2 {
|
|
33
33
|
token_standard
|
|
34
34
|
token_properties_mutated_v1
|
|
@@ -163,7 +163,7 @@
|
|
|
163
163
|
...CurrentTokenOwnershipFields
|
|
164
164
|
}
|
|
165
165
|
}
|
|
166
|
-
${
|
|
166
|
+
${Xn}`,vA=`
|
|
167
167
|
query getAccountOwnedTokensByTokenData($where_condition: current_token_ownerships_v2_bool_exp!, $offset: Int, $limit: Int, $order_by: [current_token_ownerships_v2_order_by!]) {
|
|
168
168
|
current_token_ownerships_v2(
|
|
169
169
|
where: $where_condition
|
|
@@ -174,7 +174,7 @@
|
|
|
174
174
|
...CurrentTokenOwnershipFields
|
|
175
175
|
}
|
|
176
176
|
}
|
|
177
|
-
${
|
|
177
|
+
${Xn}`,ao=`
|
|
178
178
|
query getAccountOwnedTokensFromCollection($where_condition: current_token_ownerships_v2_bool_exp!, $offset: Int, $limit: Int, $order_by: [current_token_ownerships_v2_order_by!]) {
|
|
179
179
|
current_token_ownerships_v2(
|
|
180
180
|
where: $where_condition
|
|
@@ -185,7 +185,7 @@
|
|
|
185
185
|
...CurrentTokenOwnershipFields
|
|
186
186
|
}
|
|
187
187
|
}
|
|
188
|
-
${
|
|
188
|
+
${Xn}`,co=`
|
|
189
189
|
query getAccountTokensCount($where_condition: current_token_ownerships_v2_bool_exp, $offset: Int, $limit: Int) {
|
|
190
190
|
current_token_ownerships_v2_aggregate(
|
|
191
191
|
where: $where_condition
|
|
@@ -335,7 +335,7 @@
|
|
|
335
335
|
maximum_v2
|
|
336
336
|
}
|
|
337
337
|
}
|
|
338
|
-
`,
|
|
338
|
+
`,Ot=`
|
|
339
339
|
query getNames($offset: Int, $limit: Int, $where_condition: current_aptos_names_bool_exp, $order_by: [current_aptos_names_order_by!]) {
|
|
340
340
|
current_aptos_names(
|
|
341
341
|
limit: $limit
|
|
@@ -353,7 +353,7 @@
|
|
|
353
353
|
pool_address
|
|
354
354
|
}
|
|
355
355
|
}
|
|
356
|
-
`,
|
|
356
|
+
`,Zn=`
|
|
357
357
|
query getObjectData($where_condition: current_objects_bool_exp, $offset: Int, $limit: Int, $order_by: [current_objects_order_by!]) {
|
|
358
358
|
current_objects(
|
|
359
359
|
where: $where_condition
|
|
@@ -429,7 +429,7 @@
|
|
|
429
429
|
...CurrentTokenOwnershipFields
|
|
430
430
|
}
|
|
431
431
|
}
|
|
432
|
-
${
|
|
432
|
+
${Xn}`,wo=`
|
|
433
433
|
query getTokenData($where_condition: current_token_datas_v2_bool_exp, $offset: Int, $limit: Int, $order_by: [current_token_datas_v2_order_by!]) {
|
|
434
434
|
current_token_datas_v2(
|
|
435
435
|
where: $where_condition
|
|
@@ -469,5 +469,7 @@
|
|
|
469
469
|
}
|
|
470
470
|
}
|
|
471
471
|
}
|
|
472
|
-
`;async function Zn(n){let{aptosConfig:e}=n,{data:t}=await H({aptosConfig:e,originMethod:"getLedgerInfo",path:""});return t}async function So(n){let{aptosConfig:e,limit:t}=n;return(await f({aptosConfig:e,query:{query:po,variables:{limit:t}},originMethod:"getChainTopUserTransactions"})).user_transactions}async function f(n){let{aptosConfig:e,query:t,originMethod:r}=n,{data:i}=await Xi({aptosConfig:e,originMethod:_nullishCoalesce(r, () => ("queryIndexer")),path:"",body:t,overrides:{WITH_CREDENTIALS:!1}});return i}async function Ac(n){let{aptosConfig:e}=n;return(await f({aptosConfig:e,query:{query:Qr},originMethod:"getProcessorStatuses"})).processor_status}async function Yn(n){let e=await Ac({aptosConfig:n.aptosConfig});return BigInt(e[0].last_success_version)}async function Jn(n){let{aptosConfig:e,processorType:t}=n;return(await f({aptosConfig:e,query:{query:Qr,variables:{where_condition:{processor:{_eq:t}}}},originMethod:"getProcessorStatus"})).processor_status[0]}async function er(n){let{aptosConfig:e,handle:t,data:r,options:i}=n;return(await Me({aptosConfig:e,originMethod:"getTableItem",path:`tables/${t}/item`,params:{ledger_version:_optionalChain([i, 'optionalAccess', _54 => _54.ledgerVersion])},body:r})).data}async function xo(n){let{aptosConfig:e,options:t}=n,r={query:ho,variables:{where_condition:_optionalChain([t, 'optionalAccess', _55 => _55.where]),offset:_optionalChain([t, 'optionalAccess', _56 => _56.offset]),limit:_optionalChain([t, 'optionalAccess', _57 => _57.limit]),order_by:_optionalChain([t, 'optionalAccess', _58 => _58.orderBy])}};return(await f({aptosConfig:e,query:r,originMethod:"getTableItemsData"})).table_items}async function _o(n){let{aptosConfig:e,options:t}=n,r={query:bo,variables:{where_condition:_optionalChain([t, 'optionalAccess', _59 => _59.where]),offset:_optionalChain([t, 'optionalAccess', _60 => _60.offset]),limit:_optionalChain([t, 'optionalAccess', _61 => _61.limit]),order_by:_optionalChain([t, 'optionalAccess', _62 => _62.orderBy])}};return(await f({aptosConfig:e,query:r,originMethod:"getTableItemsMetadata"})).table_metadatas}async function ve(n){let{aptosConfig:e,accountAddress:t}=n,{data:r}=await H({aptosConfig:e,originMethod:"getInfo",path:`accounts/${u.from(t).toString()}`});return r}async function Co(n){let{aptosConfig:e,accountAddress:t,options:r}=n;return wt({aptosConfig:e,originMethod:"getModules",path:`accounts/${u.from(t).toString()}/modules`,params:{ledger_version:_optionalChain([r, 'optionalAccess', _63 => _63.ledgerVersion]),start:_optionalChain([r, 'optionalAccess', _64 => _64.offset]),limit:_nullishCoalesce(_optionalChain([r, 'optionalAccess', _65 => _65.limit]), () => (1e3))}})}async function tr(n){return _optionalChain([n, 'access', _66 => _66.options, 'optionalAccess', _67 => _67.ledgerVersion])!==void 0?Po(n):_e(async()=>Po(n),`module-${n.accountAddress}-${n.moduleName}`,1e3*60*5)()}async function Po(n){let{aptosConfig:e,accountAddress:t,moduleName:r,options:i}=n,{data:o}=await H({aptosConfig:e,originMethod:"getModule",path:`accounts/${u.from(t).toString()}/module/${r}`,params:{ledger_version:_optionalChain([i, 'optionalAccess', _68 => _68.ledgerVersion])}});return o}async function Eo(n){let{aptosConfig:e,accountAddress:t,options:r}=n;return wt({aptosConfig:e,originMethod:"getTransactions",path:`accounts/${u.from(t).toString()}/transactions`,params:{start:_optionalChain([r, 'optionalAccess', _69 => _69.offset]),limit:_optionalChain([r, 'optionalAccess', _70 => _70.limit])}})}async function Io(n){let{aptosConfig:e,accountAddress:t,options:r}=n;return wt({aptosConfig:e,originMethod:"getResources",path:`accounts/${u.from(t).toString()}/resources`,params:{ledger_version:_optionalChain([r, 'optionalAccess', _71 => _71.ledgerVersion]),start:_optionalChain([r, 'optionalAccess', _72 => _72.offset]),limit:_nullishCoalesce(_optionalChain([r, 'optionalAccess', _73 => _73.limit]), () => (999))}})}async function jr(n){let{aptosConfig:e,accountAddress:t,resourceType:r,options:i}=n,{data:o}=await H({aptosConfig:e,originMethod:"getResource",path:`accounts/${u.from(t).toString()}/resource/${r}`,params:{ledger_version:_optionalChain([i, 'optionalAccess', _74 => _74.ledgerVersion])}});return o.data}async function Ot(n){let{aptosConfig:e,authenticationKey:t,options:r}=n,i=await jr({aptosConfig:e,accountAddress:"0x1",resourceType:"0x1::account::OriginatingAddress",options:r}),{address_map:{handle:o}}=i,s=u.from(t);try{let a=await er({aptosConfig:e,handle:o,data:{key:s.toString(),key_type:"address",value_type:"address"},options:r});return u.from(a)}catch(a){if(a instanceof be&&a.data.error_code==="table_item_not_found")return s;throw a}}async function Uo(n){let{aptosConfig:e,accountAddress:t}=n,i={owner_address:{_eq:u.from(t).toStringLong()},amount:{_gt:0}},s=await f({aptosConfig:e,query:{query:co,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 Ro(n){let{aptosConfig:e,accountAddress:t,options:r}=n,o={owner_address:{_eq:u.from(t).toStringLong()},amount:{_gt:0}};_optionalChain([r, 'optionalAccess', _75 => _75.tokenStandard])&&(o.token_standard={_eq:_optionalChain([r, 'optionalAccess', _76 => _76.tokenStandard])});let s={query:so,variables:{where_condition:o,offset:_optionalChain([r, 'optionalAccess', _77 => _77.offset]),limit:_optionalChain([r, 'optionalAccess', _78 => _78.limit]),order_by:_optionalChain([r, 'optionalAccess', _79 => _79.orderBy])}};return(await f({aptosConfig:e,query:s,originMethod:"getAccountOwnedTokens"})).current_token_ownerships_v2}async function Ko(n){let{aptosConfig:e,accountAddress:t,collectionAddress:r,options:i}=n,o=u.from(t).toStringLong(),s=u.from(r).toStringLong(),a={owner_address:{_eq:o},current_token_data:{collection_id:{_eq:s}},amount:{_gt:0}};_optionalChain([i, 'optionalAccess', _80 => _80.tokenStandard])&&(a.token_standard={_eq:_optionalChain([i, 'optionalAccess', _81 => _81.tokenStandard])});let c={query:ao,variables:{where_condition:a,offset:_optionalChain([i, 'optionalAccess', _82 => _82.offset]),limit:_optionalChain([i, 'optionalAccess', _83 => _83.limit]),order_by:_optionalChain([i, 'optionalAccess', _84 => _84.orderBy])}};return(await f({aptosConfig:e,query:c,originMethod:"getAccountOwnedTokensFromCollectionAddress"})).current_token_ownerships_v2}async function zo(n){let{aptosConfig:e,accountAddress:t,options:r}=n,o={owner_address:{_eq:u.from(t).toStringLong()}};_optionalChain([r, 'optionalAccess', _85 => _85.tokenStandard])&&(o.current_collection={token_standard:{_eq:_optionalChain([r, 'optionalAccess', _86 => _86.tokenStandard])}});let s={query:oo,variables:{where_condition:o,offset:_optionalChain([r, 'optionalAccess', _87 => _87.offset]),limit:_optionalChain([r, 'optionalAccess', _88 => _88.limit]),order_by:_optionalChain([r, 'optionalAccess', _89 => _89.orderBy])}};return(await f({aptosConfig:e,query:s,originMethod:"getAccountCollectionsWithOwnedTokens"})).current_collection_ownership_v2_view}async function ko(n){let{aptosConfig:e,accountAddress:t}=n,r=u.from(t).toStringLong(),o=await f({aptosConfig:e,query:{query:uo,variables:{address:r}},originMethod:"getAccountTransactionsCount"});return o.account_transactions_aggregate.aggregate?o.account_transactions_aggregate.aggregate.count:0}async function Do(n){let{aptosConfig:e,accountAddress:t,options:r}=n,i=u.from(t).toStringLong(),o={..._optionalChain([r, 'optionalAccess', _90 => _90.where]),owner_address:{_eq:i}},s={query:io,variables:{where_condition:o,offset:_optionalChain([r, 'optionalAccess', _91 => _91.offset]),limit:_optionalChain([r, 'optionalAccess', _92 => _92.limit]),order_by:_optionalChain([r, 'optionalAccess', _93 => _93.orderBy])}};return(await f({aptosConfig:e,query:s,originMethod:"getAccountCoinsData"})).current_fungible_asset_balances}async function Bo(n){let{aptosConfig:e,accountAddress:t}=n,r=u.from(t).toStringLong(),o=await f({aptosConfig:e,query:{query:ro,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 Go(n){let{aptosConfig:e,accountAddress:t,options:r}=n,o={owner_address:{_eq:u.from(t).toStringLong()}},s={query:Xn,variables:{where_condition:o,offset:_optionalChain([r, 'optionalAccess', _94 => _94.offset]),limit:_optionalChain([r, 'optionalAccess', _95 => _95.limit]),order_by:_optionalChain([r, 'optionalAccess', _96 => _96.orderBy])}};return(await f({aptosConfig:e,query:s,originMethod:"getAccountOwnedObjects"})).current_objects}async function Fo(n){let{aptosConfig:e,privateKey:t}=n,r=new k(t.publicKey());if(t instanceof nt){let o=D.fromPublicKey({publicKey:r}).derivedAddress();return He.fromPrivateKey({privateKey:t,address:o})}if(t instanceof W){let i=D.fromPublicKey({publicKey:r});if(await vo({authKey:i,aptosConfig:e})){let c=i.derivedAddress();return He.fromPrivateKey({privateKey:t,address:c,legacy:!1})}let s=D.fromPublicKey({publicKey:r.publicKey});if(await vo({authKey:s,aptosConfig:e})){let c=s.derivedAddress();return He.fromPrivateKey({privateKey:t,address:c,legacy:!0})}}throw new Error(`Can't derive account from private key ${t}`)}async function vo(n){let{aptosConfig:e,authKey:t}=n,r=await Ot({aptosConfig:e,authenticationKey:t.derivedAddress()});try{return await ve({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 Zr(n){let{aptosConfig:e,options:t}=n;return wt({aptosConfig:e,originMethod:"getTransactions",path:"transactions",params:{start:_optionalChain([t, 'optionalAccess', _97 => _97.offset]),limit:_optionalChain([t, 'optionalAccess', _98 => _98.limit])}})}async function rr(n){let{aptosConfig:e}=n;return _e(async()=>{let{data:t}=await H({aptosConfig:e,originMethod:"getGasPriceEstimation",path:"estimate_gas_price"});return t},`gas-price-${e.network}`,1e3*60*5)()}async function No(n){let{aptosConfig:e,ledgerVersion:t}=n,{data:r}=await H({aptosConfig:e,originMethod:"getTransactionByVersion",path:`transactions/by_version/${t}`});return r}async function un(n){let{aptosConfig:e,transactionHash:t}=n,{data:r}=await H({aptosConfig:e,path:`transactions/by_hash/${t}`,originMethod:"getTransactionByHash"});return r}async function Oo(n){let{aptosConfig:e,transactionHash:t}=n;try{return(await un({aptosConfig:e,transactionHash:t})).type==="pending_transaction"}catch(r){if(_optionalChain([r, 'optionalAccess', _99 => _99.status])===404)return!0;throw r}}async function hc(n){let{aptosConfig:e,transactionHash:t}=n,{data:r}=await H({aptosConfig:e,path:`transactions/wait_by_hash/${t}`,originMethod:"longWaitForTransaction"});return r}async function Mt(n){let{aptosConfig:e,transactionHash:t,options:r}=n,i=_nullishCoalesce(_optionalChain([r, 'optionalAccess', _100 => _100.timeoutSecs]), () => (20)),o=_nullishCoalesce(_optionalChain([r, 'optionalAccess', _101 => _101.checkSuccess]), () => (!0)),s=!0,a=0,c,d,p=200,T=1.5;function w(m){if(!(m instanceof be)||(d=m,m.status!==404&&m.status>=400&&m.status<500))throw m}try{c=await un({aptosConfig:e,transactionHash:t}),s=c.type==="pending_transaction"}catch(m){w(m)}if(s){let m=Date.now();try{c=await hc({aptosConfig:e,transactionHash:t}),s=c.type==="pending_transaction"}catch(E){w(E)}a=(Date.now()-m)/1e3}for(;s&&!(a>=i);){try{if(c=await un({aptosConfig:e,transactionHash:t}),s=c.type==="pending_transaction",!s)break}catch(m){w(m)}await _chunkHBPH2AD3js.b.call(void 0, p),a+=p/1e3,p*=T}if(c===void 0)throw d||new nr(`Fetching transaction ${t} failed and timed out after ${i} seconds`,c);if(c.type==="pending_transaction")throw new nr(`Transaction ${t} timed out in pending state after ${i} seconds`,c);if(!o)return c;if(!c.success)throw new Xr(`Transaction ${t} failed with an error: ${c.vm_status}`,c);return c}async function ir(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 Yn({aptosConfig:e}):s=(await Jn({aptosConfig:e,processorType:t})).last_success_version,s>=r)break;await _chunkHBPH2AD3js.b.call(void 0, 200)}}var nr=class extends Error{constructor(e,t){super(e),this.lastSubmittedTransaction=t}},Xr=class extends Error{constructor(e,t){super(e),this.transaction=t}};async function Mo(n){let{aptosConfig:e,ledgerVersion:t,options:r}=n,{data:i}=await H({aptosConfig:e,originMethod:"getBlockByVersion",path:`blocks/by_version/${t}`,params:{with_transactions:_optionalChain([r, 'optionalAccess', _102 => _102.withTransactions])}});return Vo({block:i,...n})}async function qo(n){let{aptosConfig:e,blockHeight:t,options:r}=n,{data:i}=await H({aptosConfig:e,originMethod:"getBlockByHeight",path:`blocks/by_height/${t}`,params:{with_transactions:_optionalChain([r, 'optionalAccess', _103 => _103.withTransactions])}});return Vo({block:i,...n})}async function Vo(n){let{aptosConfig:e,block:t,options:r}=n;if(_optionalChain([r, 'optionalAccess', _104 => _104.withTransactions])){t.transactions=_nullishCoalesce(t.transactions, () => ([]));let i=t.transactions[t.transactions.length-1],o=BigInt(t.first_version),s=BigInt(t.last_version),a=_optionalChain([i, 'optionalAccess', _105 => _105.version]),c;if(a===void 0?c=o-1n:c=BigInt(a),c===s)return t;let d=[],p=100n;for(let w=c+1n;w<s;w+=BigInt(100))d.push(Zr({aptosConfig:e,options:{offset:w,limit:Math.min(Number(p),Number(s-w+1n))}}));let T=await Promise.all(d);for(let w of T)t.transactions.push(...w)}return t}async function A(n){n.minimumLedgerVersion!==void 0&&await ir({aptosConfig:n.config,minimumLedgerVersion:n.minimumLedgerVersion,processorType:n.processorType})}function $o(n){return typeof n=="boolean"}function Qe(n){return typeof n=="string"}function bc(n){return typeof n=="number"}function or(n){if(bc(n))return n;if(Qe(n)&&n!=="")return Number.parseInt(n,10)}function sr(n){return typeof n=="number"||typeof n=="bigint"||typeof n=="string"}function Lo(n){return n==null}function Ho(n){return Yr(n)||ei(n)||ti(n)||ni(n)||ri(n)||ii(n)||oi(n)||ar(n)||Jr(n)||Tc(n)||n instanceof h||n instanceof L}function Yr(n){return n instanceof I}function ar(n){return n instanceof u}function Jr(n){return n instanceof S}function Tc(n){return n instanceof Je}function ei(n){return n instanceof $}function ti(n){return n instanceof ye}function ni(n){return n instanceof fe}function ri(n){return n instanceof O}function ii(n){return n instanceof Ae}function oi(n){return n instanceof he}function Qo(n){return"bytecode"in n}function U(n,e){throw new Error(`Type mismatch for argument ${e}, expected '${n}'`)}function Wo(n){let e=n.params.findIndex(t=>t!=="signer"&&t!=="&signer");return e<0?n.params.length:e}function pn(n){let e=n.split("::");if(e.length!==3)throw new Error(`Invalid function ${n}`);let t=e[0],r=e[1],i=e[2];return{moduleAddress:t,moduleName:r,functionName:i}}function jo(n){return!!n.match(/^[_a-zA-Z0-9]+$/)}function Xo(n){return!!n.match(/\s/)}function wc(n){return!!n.match(/^T[0-9]+$/)}function Sc(n){return!!n.match(/^&.+$/)}function xc(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 _c(n,e){let t=e;for(;t<n.length;t+=1){let r=n[t];if(!Xo(r))break}return t}var Pc=(E=>(E.InvalidTypeTag="unknown type",E.UnexpectedGenericType="unexpected generic type",E.UnexpectedTypeArgumentClose="unexpected '>'",E.UnexpectedWhitespaceCharacter="unexpected whitespace character",E.UnexpectedComma="unexpected ','",E.TypeArgumentCountMismatch="type argument count doesn't match expected amount",E.MissingTypeArgumentClose="no matching '>' for '<'",E.MissingTypeArgument="no type argument before ','",E.UnexpectedPrimitiveTypeArguments="primitive types not expected to have type arguments",E.UnexpectedVectorTypeArgumentCount="vector type expected to have exactly one type argument",E.UnexpectedStructFormat="unexpected struct format, must be of the form 0xaddress::module_name::struct_name",E.InvalidModuleNameCharacter="module name must only contain alphanumeric or '_' characters",E.InvalidStructNameCharacter="struct name must only contain alphanumeric or '_' characters",E.InvalidAddress="struct address must be valid",E))(Pc||{}),N= exports.TypeTagParserError =class extends Error{constructor(e,t){super(`Failed to parse typeTag '${e}', ${t}`)}};function ke(n,e){let t=_nullishCoalesce(_optionalChain([e, 'optionalAccess', _106 => _106.allowGenerics]), () => (!1)),r=[],i=[],o=[],s=0,a="",c=1;for(;s<n.length;){let d=n[s];if(d==="<")r.push({savedExpectedTypes:c,savedStr:a,savedTypes:o}),a="",o=[],c=1;else if(d===">"){if(a!==""){let E=dn(a,i,t);o.push(E)}let p=r.pop();if(p===void 0)throw new N(n,"unexpected '>'");if(c!==o.length)throw new N(n,"type argument count doesn't match expected amount");let{savedStr:T,savedTypes:w,savedExpectedTypes:m}=p;i=o,o=w,a=T,c=m}else if(d===","){if(r.length===0)throw new N(n,"unexpected ','");if(a.length===0)throw new N(n,"no type argument before ','");let p=dn(a,i,t);i=[],o.push(p),a="",c+=1}else if(Xo(d)){let p=!1;if(a.length!==0){let w=dn(a,i,t);i=[],o.push(w),a="",p=!0}s=_c(n,s);let T=n[s];if(s<n.length&&p&&T!==","&&T!==">")throw new N(n,"unexpected whitespace character");continue}else a+=d;s+=1}if(r.length>0)throw new N(n,"no matching '>' for '<'");switch(o.length){case 0:return dn(a,i,t);case 1:if(a==="")return o[0];throw new N(n,"unexpected ','");default:throw new N(n,"unexpected whitespace character")}}function dn(n,e,t){let r=n.trim(),i=r.toLowerCase();if(xc(i)&&e.length>0)throw new N(n,"primitive types not expected to have type arguments");switch(r.toLowerCase()){case"signer":return new Ct;case"bool":return new F;case"address":return new X;case"u8":return new ue;case"u16":return new qe;case"u32":return new Ve;case"u64":return new Q;case"u128":return new $e;case"u256":return new Le;case"vector":if(e.length!==1)throw new N(n,"vector type expected to have exactly one type argument");return new C(e[0]);default:if(Sc(r)){let a=r.substring(1);return new Vn(dn(a,e,t))}if(wc(r)){if(t)return new z(Number(r.split("T")[1]));throw new N(n,"unexpected generic type")}if(!r.match(/:/))throw new N(n,"unknown type");let o=r.split("::");if(o.length!==3)throw new N(n,"unexpected struct format, must be of the form 0xaddress::module_name::struct_name");let s;try{s=u.fromString(o[0])}catch (e2){throw new N(n,"struct address must be valid")}if(!jo(o[1]))throw new N(n,"module name must only contain alphanumeric or '_' characters");if(!jo(o[2]))throw new N(n,"struct name must only contain alphanumeric or '_' characters");return new y(new Ke(s,new R(o[1]),new R(o[2]),e))}}var vc=new TextEncoder;function cr(n){return _nullishCoalesce(_optionalChain([n, 'optionalAccess', _107 => _107.map, 'call', _108 => _108(e=>Qe(e)?ke(e):e)]), () => ([]))}async function Zo(n,e,t,r){let i=await tr({aptosConfig:r,accountAddress:n,moduleName:e});if(i.abi)return i.abi.exposed_functions.find(o=>o.name===t)}async function Yo(n,e,t,r){let i=await Zo(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=Wo(i),s=[];for(let a=o;a<i.params.length;a+=1)s.push(ke(i.params[a],{allowGenerics:!0}));return{signers:o,typeParameters:i.generic_type_params,parameters:s}}async function Jo(n,e,t,r){let i=await Zo(n,e,t,r);if(!i)throw new Error(`Could not find view function ABI for '${n}::${e}::${t}'`);if(!i.is_view)throw new Error(`'${n}::${e}::${t}' is not an view function`);let o=[];for(let a=0;a<i.params.length;a+=1)o.push(ke(i.params[a],{allowGenerics:!0}));let s=[];for(let a=0;a<i.return.length;a+=1)s.push(ke(i.return[a],{allowGenerics:!0}));return{typeParameters:i.generic_type_params,parameters:o,returnTypes:s}}function ai(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 qt(t,o,r,i)}function qt(n,e,t,r){return Ho(n)?(si(e,n,t),n):Cc(n,e,t,r)}function Cc(n,e,t,r){if(e.isBool()){if($o(n))return new I(n);if(Qe(n)){if(n==="true")return new I(!0);if(n==="false")return new I(!1)}U("boolean",t)}if(e.isAddress()){if(Qe(n))return u.fromString(n);U("string | AccountAddress",t)}if(e.isU8()){let i=or(n);if(i!==void 0)return new $(i);U("number | string",t)}if(e.isU16()){let i=or(n);if(i!==void 0)return new ye(i);U("number | string",t)}if(e.isU32()){let i=or(n);if(i!==void 0)return new fe(i);U("number | string",t)}if(e.isU64()){if(sr(n))return new O(BigInt(n));U("bigint | number | string",t)}if(e.isU128()){if(sr(n))return new Ae(BigInt(n));U("bigint | number | string",t)}if(e.isU256()){if(sr(n))return new he(BigInt(n));U("bigint | number | string",t)}if(e.isGeneric()){let i=e.value;if(i<0||i>=r.length)throw new Error(`Generic argument ${e.toString()} is invalid for argument ${t}`);return qt(n,r[i],t,r)}if(e.isVector()){if(e.value.isU8()){if(Qe(n))return h.U8(vc.encode(n));if(n instanceof Uint8Array)return h.U8(n);if(n instanceof ArrayBuffer)return h.U8(new Uint8Array(n))}if(Array.isArray(n))return new h(n.map(i=>qt(i,e.value,t,r)));throw new Error(`Type mismatch for argument ${t}, type '${e.toString()}'`)}if(e.isStruct()){if(e.isString()){if(Qe(n))return new S(n);U("string",t)}if(e.isObject()){if(Qe(n))return u.fromString(n);U("string | AccountAddress",t)}if(e.isOption()){if(Lo(n)){let i=e.value.typeArgs[0];return i instanceof F?new L(null):i instanceof X?new L(null):i instanceof ue?new L(null):i instanceof qe?new L(null):i instanceof Ve?new L(null):i instanceof Q?new L(null):i instanceof $e?new L(null):i instanceof Le?new L(null):new L(null)}return new L(qt(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 si(n,e,t){if(n.isBool()){if(Yr(e))return;U("Bool",t)}if(n.isAddress()){if(ar(e))return;U("AccountAddress",t)}if(n.isU8()){if(ei(e))return;U("U8",t)}if(n.isU16()){if(ti(e))return;U("U16",t)}if(n.isU32()){if(ni(e))return;U("U32",t)}if(n.isU64()){if(ri(e))return;U("U64",t)}if(n.isU128()){if(ii(e))return;U("U128",t)}if(n.isU256()){if(oi(e))return;U("U256",t)}if(n.isVector()){if(e instanceof h){e.values.length>0&&si(n.value,e.values[0],t);return}U("MoveVector",t)}if(n instanceof y){if(n.isString()){if(Jr(e))return;U("MoveString",t)}if(n.isObject()){if(ar(e))return;U("AccountAddress",t)}if(n.isOption()){if(e instanceof L){e.value!==void 0&&si(n.value.typeArgs[0],e.value,t);return}U("MoveOption",t)}}throw new Error(`Type mismatch for argument ${t}, expected '${n.toString()}'`)}async function pr(n){if(Qo(n))return Rc(n);let{moduleAddress:e,moduleName:t,functionName:r}=pn(n.function),i=await rs({key:"entry-function",moduleAddress:e,moduleName:t,functionName:r,aptosConfig:n.aptosConfig,abi:n.abi,fetch:Yo});return Ic({...n,abi:i})}function Ic(n){let e=n.abi,{moduleAddress:t,moduleName:r,functionName:i}=pn(n.function),o=cr(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)=>ai(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=ct.build(`${t}::${r}`,i,o,s);if("multisigAddress"in n){let c=u.from(n.multisigAddress);return new rn(new sn(c,new an(a)))}return new nn(a)}async function es(n){let{moduleAddress:e,moduleName:t,functionName:r}=pn(n.function),i=await rs({key:"view-function",moduleAddress:e,moduleName:t,functionName:r,aptosConfig:n.aptosConfig,abi:n.abi,fetch:Jo});return Uc({abi:i,...n})}function Uc(n){let e=n.abi,{moduleAddress:t,moduleName:r,functionName:i}=pn(n.function),o=cr(n.typeArguments);if(o.length!==e.typeParameters.length)throw new Error(`Type argument count mismatch, expected ${e.typeParameters.length}, received ${o.length}`);let s=_nullishCoalesce(_optionalChain([n, 'optionalAccess', _109 => _109.functionArguments, 'optionalAccess', _110 => _110.map, 'call', _111 => _111((a,c)=>ai(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 ct.build(`${t}::${r}`,i,o,s)}function Rc(n){return new tn(new on(g.fromHexInput(n.bytecode).toUint8Array(),cr(n.typeArguments),n.functionArguments))}async function Kc(n){let{aptosConfig:e,sender:t,payload:r,options:i,feePayerAddress:o}=n,s=async()=>Gr[e.network]?{chainId:Gr[e.network]}:{chainId:(await Zn({aptosConfig:e})).chain_id},a=async()=>_optionalChain([i, 'optionalAccess', _112 => _112.gasUnitPrice])?{gasEstimate:i.gasUnitPrice}:{gasEstimate:(await rr({aptosConfig:e})).gas_estimate},c=async()=>{let gt=async()=>_optionalChain([i, 'optionalAccess', _113 => _113.accountSequenceNumber])!==void 0?i.accountSequenceNumber:(await ve({aptosConfig:e,accountAddress:t})).sequence_number;if(o&&u.from(o).equals(u.ZERO))try{return await gt()}catch (e3){return 0}else return gt()},[{chainId:d},{gasEstimate:p},T]=await Promise.all([s(),a(),c()]),{maxGasAmount:w,gasUnitPrice:m,expireTimestamp:E}={maxGasAmount:_optionalChain([i, 'optionalAccess', _114 => _114.maxGasAmount])?BigInt(i.maxGasAmount):BigInt(2e5),gasUnitPrice:_nullishCoalesce(_optionalChain([i, 'optionalAccess', _115 => _115.gasUnitPrice]), () => (BigInt(p))),expireTimestamp:_nullishCoalesce(_optionalChain([i, 'optionalAccess', _116 => _116.expireTimestamp]), () => (BigInt(Math.floor(Date.now()/1e3)+20)))};return new pe(u.from(t),BigInt(T),r,BigInt(w),BigInt(m),BigInt(E),new vt(d))}async function ci(n){let{aptosConfig:e,sender:t,payload:r,options:i,feePayerAddress:o}=n,s=await Kc({aptosConfig:e,sender:t,payload:r,options:i,feePayerAddress:o});if("secondarySignerAddresses"in n){let a=_nullishCoalesce(_optionalChain([n, 'access', _117 => _117.secondarySignerAddresses, 'optionalAccess', _118 => _118.map, 'call', _119 => _119(c=>u.from(c))]), () => ([]));return new Qn(s,a,n.feePayerAddress?u.from(n.feePayerAddress):void 0)}return new Hn(s,n.feePayerAddress?u.from(n.feePayerAddress):void 0)}function ts(n){let{signerPublicKey:e,transaction:t,secondarySignersPublicKeys:r,feePayerPublicKey:i}=n,o=ur(e);if(t.feePayerAddress){let a=new pt(t.rawTransaction,_nullishCoalesce(t.secondarySignerAddresses, () => ([])),t.feePayerAddress),c=[];if(r&&(c=r.map(T=>ur(T))),!i)throw new Error("Must provide a feePayerPublicKey argument to generate a signed fee payer transaction for simulation");let d=ur(i),p=new Ut(o,_nullishCoalesce(t.secondarySignerAddresses, () => ([])),c,{address:t.feePayerAddress,authenticator:d});return new dt(a.raw_txn,p).bcsToBytes()}if(t.secondarySignerAddresses){let a=new ut(t.rawTransaction,t.secondarySignerAddresses),c=[];if(!r)throw new Error("Must provide a secondarySignersPublicKeys argument to generate a signed multi agent transaction for simulation");c=r.map(p=>ur(p));let d=new It(o,t.secondarySignerAddresses,c);return new dt(a.raw_txn,d).bcsToBytes()}let s;if(o instanceof we)s=new Et(o.public_key,o.signature);else if(o instanceof te)s=new Rt(o);else throw new Error("Invalid public key");return new dt(t.rawTransaction,s).bcsToBytes()}function ur(n){let t=G.isInstance(n)||Te.isInstance(n)||Ee.isInstance(n)?new k(n):n,r=new v(new Uint8Array(64));if(_.isInstance(t))return new we(t,r);if(k.isInstance(t))return G.isInstance(t.publicKey)?new te(t,new M(Re.getSimulationSignature())):new te(t,new M(r));throw new Error("Unsupported public key")}function ui(n){let{transaction:e,feePayerAuthenticator:t,additionalSignersAuthenticators:r}=n,i=ji(j,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 Ut(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 we?o=new Et(i.public_key,i.signature):o=new Rt(i);return new dt(e.rawTransaction,o).bcsToBytes()}function ns(n){let e=_sha3.sha3_256.create();for(let t of n)e.update(t);return e.digest()}var zc=ns(["APTOS::Transaction"]);function Xh(n){let e=ui(n);return new g(ns([zc,new Uint8Array([0]),e])).toString()}async function rs({key:n,moduleAddress:e,moduleName:t,functionName:r,aptosConfig:i,abi:o,fetch:s}){return o!==void 0?o:_e(async()=>s(e,t,r,i),`${n}-${i.network}-${e}-${t}-${r}`,1e3*60*5)()}async function le(n){let{aptosConfig:e,payload:t,options:r}=n,i=await es({...t,aptosConfig:e}),o=new V;i.serialize(o);let s=o.toUint8Array(),{data:a}=await Me({aptosConfig:e,path:"view",originMethod:"view",contentType:"application/x.aptos.view_function+bcs",params:{ledger_version:_optionalChain([r, 'optionalAccess', _120 => _120.ledgerVersion])},body:s});return a}async function is(n){let{aptosConfig:e,payload:t,options:r}=n,{data:i}=await Me({aptosConfig:e,originMethod:"viewJson",path:"view",params:{ledger_version:_optionalChain([r, 'optionalAccess', _121 => _121.ledgerVersion])},body:{function:t.function,type_arguments:_nullishCoalesce(t.typeArguments, () => ([])),arguments:_nullishCoalesce(t.functionArguments, () => ([]))}});return i}var ln=class{constructor(e){this.config=e}async getAccountInfo(e){return ve({aptosConfig:this.config,...e})}async getAccountModules(e){return Co({aptosConfig:this.config,...e})}async getAccountModule(e){return tr({aptosConfig:this.config,...e})}async getAccountTransactions(e){return Eo({aptosConfig:this.config,...e})}async getAccountResources(e){return Io({aptosConfig:this.config,...e})}async getAccountResource(e){return jr({aptosConfig:this.config,...e})}async lookupOriginalAccountAddress(e){return Ot({aptosConfig:this.config,...e})}async getAccountTokensCount(e){return await A({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"account_transactions_processor"}),Uo({aptosConfig:this.config,...e})}async getAccountOwnedTokens(e){return await A({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),Ro({aptosConfig:this.config,...e})}async getAccountOwnedTokensFromCollectionAddress(e){return await A({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),Ko({aptosConfig:this.config,...e})}async getAccountCollectionsWithOwnedTokens(e){return await A({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),zo({aptosConfig:this.config,...e})}async getAccountTransactionsCount(e){return await A({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"account_transactions_processor"}),ko({aptosConfig:this.config,...e})}async getAccountCoinsData(e){return await A({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"fungible_asset_processor"}),Do({aptosConfig:this.config,...e})}async getAccountCoinsCount(e){return await A({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"fungible_asset_processor"}),Bo({aptosConfig:this.config,...e})}async getAccountAPTAmount(e){return this.getAccountCoinAmount({coinType:Tt,faMetadataAddress:Vi,...e})}async getAccountCoinAmount(e){let{accountAddress:t,coinType:r,faMetadataAddress:i}=e,o=r;r===void 0&&i!==void 0&&(o=await _e(async()=>{try{let c=(await le({aptosConfig:this.config,payload:{function:"0x1::coin::paired_coin",functionArguments:[i]}})).at(0);if(c.vec.length>0&&_chunkHBPH2AD3js.i.call(void 0, c.vec[0]))return _chunkHBPH2AD3js.h.call(void 0, c.vec[0])}catch (e4){}},`coin-mapping-${i.toString()}`,1e3*60*5)());let s;if(r!==void 0&&i!==void 0)s=u.from(i).toStringLong();else if(r!==void 0&&i===void 0)r===Tt?s=u.A.toStringLong():s=qr(u.A,r).toStringLong();else if(r===void 0&&i!==void 0){let c=u.from(i);s=c.toStringLong(),c===u.A&&(o=Tt)}else throw new Error("Either coinType, faMetadataAddress, or both must be provided");if(o!==void 0){let[c]=await le({aptosConfig:this.config,payload:{function:"0x1::coin::balance",typeArguments:[o],functionArguments:[t]}});return parseInt(c,10)}let[a]=await le({aptosConfig:this.config,payload:{function:"0x1::primary_fungible_store::balance",typeArguments:["0x1::object::ObjectCore"],functionArguments:[t,s]}});return parseInt(a,10)}async getAccountOwnedObjects(e){return await A({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"default_processor"}),Go({aptosConfig:this.config,...e})}async deriveAccountFromPrivateKey(e){return Fo({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', _122 => _122.network]), () => ("devnet")),this.fullnode=_optionalChain([e, 'optionalAccess', _123 => _123.fullnode]),this.faucet=_optionalChain([e, 'optionalAccess', _124 => _124.faucet]),this.pepper=_optionalChain([e, 'optionalAccess', _125 => _125.pepper]),this.prover=_optionalChain([e, 'optionalAccess', _126 => _126.prover]),this.indexer=_optionalChain([e, 'optionalAccess', _127 => _127.indexer]),this.client=_nullishCoalesce(_optionalChain([e, 'optionalAccess', _128 => _128.client]), () => ({provider:_aptosclient2.default})),this.clientConfig=_nullishCoalesce(_optionalChain([e, 'optionalAccess', _129 => _129.clientConfig]), () => ({})),this.fullnodeConfig=_nullishCoalesce(_optionalChain([e, 'optionalAccess', _130 => _130.fullnodeConfig]), () => ({})),this.indexerConfig=_nullishCoalesce(_optionalChain([e, 'optionalAccess', _131 => _131.indexerConfig]), () => ({})),this.faucetConfig=_nullishCoalesce(_optionalChain([e, 'optionalAccess', _132 => _132.faucetConfig]), () => ({}))}getRequestUrl(e){switch(e){case"Fullnode":if(this.fullnode!==void 0)return this.fullnode;if(this.network==="custom")throw new Error("Please provide a custom full node url");return Qi[this.network];case"Faucet":if(this.faucet!==void 0)return this.faucet;if(this.network==="custom")throw new Error("Please provide a custom faucet url");return Wi[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 Hi[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 kr[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 Dr[this.network];default:throw Error(`apiType ${e} is not supported`)}}isPepperServiceRequest(e){return kr[this.network]===e}isProverServiceRequest(e){return Dr[this.network]===e}};async function b(n){let e=await Dc(n);return Bc(n,e)}async function Dc(n){let{aptosConfig:e,data:t}=n,r,i;return"bytecode"in t?i=await pr(t):"multisigAddress"in t?(r={aptosConfig:e,multisigAddress:t.multisigAddress,function:t.function,functionArguments:t.functionArguments,typeArguments:t.typeArguments,abi:t.abi},i=await pr(r)):(r={aptosConfig:e,function:t.function,functionArguments:t.functionArguments,typeArguments:t.typeArguments,abi:t.abi},i=await pr(r)),i}async function Bc(n,e){let{aptosConfig:t,sender:r,options:i}=n,o;if(Gc(n)&&(o=u.ZERO.toString()),Fc(n)){let{secondarySignerAddresses:s}=n;return ci({aptosConfig:t,sender:r,payload:e,options:i,secondarySignerAddresses:s,feePayerAddress:o})}return ci({aptosConfig:t,sender:r,payload:e,options:i,feePayerAddress:o})}function Gc(n){return n.withFeePayer===!0}function Fc(n){return"secondarySignerAddresses"in n}function os(n){let{transaction:e}=n;return zt(e)}function lr(n){let{signer:e,transaction:t}=n;return e.signTransactionWithAuthenticator(t)}function gr(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,lr({signer:e,transaction:t})}async function pi(n){let{aptosConfig:e,transaction:t,signerPublicKey:r,secondarySignersPublicKeys:i,feePayerPublicKey:o,options:s}=n,a=ts({transaction:t,signerPublicKey:r,secondarySignersPublicKeys:i,feePayerPublicKey:o,options:s}),{data:c}=await Me({aptosConfig:e,body:a,path:"transactions/simulate",params:{estimate_gas_unit_price:_nullishCoalesce(_optionalChain([n, 'access', _133 => _133.options, 'optionalAccess', _134 => _134.estimateGasUnitPrice]), () => (!1)),estimate_max_gas_amount:_nullishCoalesce(_optionalChain([n, 'access', _135 => _135.options, 'optionalAccess', _136 => _136.estimateMaxGasAmount]), () => (!1)),estimate_prioritized_gas_unit_price:_nullishCoalesce(_optionalChain([n, 'access', _137 => _137.options, 'optionalAccess', _138 => _138.estimatePrioritizedGasUnitPrice]), () => (!1))},originMethod:"simulateTransaction",contentType:"application/x.aptos.signed_transaction+bcs"});return c}async function gn(n){let{aptosConfig:e}=n,t=ui({...n}),{data:r}=await Me({aptosConfig:e,body:t,path:"transactions",originMethod:"submitTransaction",contentType:"application/x.aptos.signed_transaction+bcs"});return r}async function mn(n){let{aptosConfig:e,signer:t,feePayer:r,transaction:i}=n;(t instanceof de||t instanceof Ft)&&await t.waitForProofFetch(),(r instanceof de||r instanceof Ft)&&await r.waitForProofFetch();let o=n.feePayerAuthenticator||r&&gr({signer:r,transaction:i}),s=lr({signer:t,transaction:i});return gn({aptosConfig:e,transaction:i,senderAuthenticator:s,feePayerAuthenticator:o})}async function ss(n){let{aptosConfig:e,senderAuthenticator:t,feePayer:r,transaction:i}=n;(r instanceof de||r instanceof Ft)&&await r.waitForProofFetch();let o=gr({signer:r,transaction:i});return gn({aptosConfig:e,transaction:i,senderAuthenticator:t,feePayerAuthenticator:o})}var Nc={typeParameters:[],parameters:[C.u8(),new C(C.u8())]};async function as(n){let{aptosConfig:e,account:t,metadataBytes:r,moduleBytecode:i,options:o}=n,s=i.map(a=>h.U8(a));return b({aptosConfig:e,sender:u.from(t),data:{function:"0x1::code::publish_package_txn",functionArguments:[h.U8(r),new h(s)],abi:Nc},options:o})}var Oc={typeParameters:[],parameters:[new ue,C.u8(),new ue,C.u8(),C.u8(),C.u8()]};async function cs(n){let{aptosConfig:e,fromAccount:t,toNewPrivateKey:r}=n,i=await ve({aptosConfig:e,accountAddress:t.accountAddress}),o=He.fromPrivateKey({privateKey:r,legacy:!0}),a=new Ln({sequenceNumber:BigInt(i.sequence_number),originator:t.accountAddress,currentAuthKey:u.from(i.authentication_key),newPublicKey:o.publicKey}).bcsToBytes(),c=t.sign(a),d=o.sign(a),p=await b({aptosConfig:e,sender:t.accountAddress,data:{function:"0x1::account::rotate_authentication_key",functionArguments:[new $(t.signingScheme),h.U8(t.publicKey.toUint8Array()),new $(o.signingScheme),h.U8(o.publicKey.toUint8Array()),h.U8(c.toUint8Array()),h.U8(d.toUint8Array())],abi:Oc}});return mn({aptosConfig:e,signer:t,transaction:p})}var Mc={typeParameters:[{constraints:[]}],parameters:[new X,new Q]};async function us(n){let{aptosConfig:e,sender:t,recipient:r,amount:i,coinType:o,options:s}=n;return b({aptosConfig:e,sender:t,data:{function:"0x1::aptos_account::transfer_coins",typeArguments:[_nullishCoalesce(o, () => (Tt))],functionArguments:[r,i],abi:Mc},options:s})}var yn=class{constructor(e){this.config=e}async transferCoinTransaction(e){return us({aptosConfig:this.config,...e})}};var We={BOOLEAN:"bool",U8:"u8",U16:"u16",U32:"u32",U64:"u64",U128:"u128",U256:"u256",ADDRESS:"address",STRING:"0x1::string::String",ARRAY:"vector<u8>"},ge="0x4::token::Token";async function ps(n){let{aptosConfig:e,digitalAssetAddress:t}=n,r={token_data_id:{_eq:u.from(t).toStringLong()}};return(await f({aptosConfig:e,query:{query:wo,variables:{where_condition:r}},originMethod:"getDigitalAssetData"})).current_token_datas_v2[0]}async function ds(n){let{aptosConfig:e,digitalAssetAddress:t}=n,r={token_data_id:{_eq:u.from(t).toStringLong()},amount:{_gt:0}};return(await f({aptosConfig:e,query:{query:Wr,variables:{where_condition:r}},originMethod:"getCurrentDigitalAssetOwnership"})).current_token_ownerships_v2[0]}async function ls(n){let{aptosConfig:e,ownerAddress:t,options:r}=n,i={owner_address:{_eq:u.from(t).toStringLong()},amount:{_gt:0}},o={query:Wr,variables:{where_condition:i,offset:_optionalChain([r, 'optionalAccess', _139 => _139.offset]),limit:_optionalChain([r, 'optionalAccess', _140 => _140.limit]),order_by:_optionalChain([r, 'optionalAccess', _141 => _141.orderBy])}};return(await f({aptosConfig:e,query:o,originMethod:"getOwnedDigitalAssets"})).current_token_ownerships_v2}async function gs(n){let{aptosConfig:e,digitalAssetAddress:t,options:r}=n,i={token_data_id:{_eq:u.from(t).toStringLong()}},o={query:To,variables:{where_condition:i,offset:_optionalChain([r, 'optionalAccess', _142 => _142.offset]),limit:_optionalChain([r, 'optionalAccess', _143 => _143.limit]),order_by:_optionalChain([r, 'optionalAccess', _144 => _144.orderBy])}};return(await f({aptosConfig:e,query:o,originMethod:"getDigitalAssetActivity"})).token_activities_v2}var qc={typeParameters:[],parameters:[new y(P()),new Q,new y(P()),new y(P()),new F,new F,new F,new F,new F,new F,new F,new F,new F,new Q,new Q]};async function ms(n){let{aptosConfig:e,options:t,creator:r}=n;return b({aptosConfig:e,sender:r.accountAddress,data:{function:"0x4::aptos_token::create_collection",functionArguments:[new S(n.description),new O(_nullishCoalesce(n.maxSupply, () => (Ze))),new S(n.name),new S(n.uri),new I(_nullishCoalesce(n.mutableDescription, () => (!0))),new I(_nullishCoalesce(n.mutableRoyalty, () => (!0))),new I(_nullishCoalesce(n.mutableURI, () => (!0))),new I(_nullishCoalesce(n.mutableTokenDescription, () => (!0))),new I(_nullishCoalesce(n.mutableTokenName, () => (!0))),new I(_nullishCoalesce(n.mutableTokenProperties, () => (!0))),new I(_nullishCoalesce(n.mutableTokenURI, () => (!0))),new I(_nullishCoalesce(n.tokensBurnableByCreator, () => (!0))),new I(_nullishCoalesce(n.tokensFreezableByCreator, () => (!0))),new O(_nullishCoalesce(n.royaltyNumerator, () => (0))),new O(_nullishCoalesce(n.royaltyDenominator, () => (1)))],abi:qc},options:t})}async function Vt(n){let{aptosConfig:e,options:t}=n,r=_optionalChain([t, 'optionalAccess', _145 => _145.where]);_optionalChain([t, 'optionalAccess', _146 => _146.tokenStandard])&&(r.token_standard={_eq:_nullishCoalesce(_optionalChain([t, 'optionalAccess', _147 => _147.tokenStandard]), () => ("v2"))});let i={query:lo,variables:{where_condition:r,offset:_optionalChain([t, 'optionalAccess', _148 => _148.offset]),limit:_optionalChain([t, 'optionalAccess', _149 => _149.limit])}};return(await f({aptosConfig:e,query:i,originMethod:"getCollectionData"})).current_collections_v2[0]}async function ys(n){let{aptosConfig:e,creatorAddress:t,collectionName:r,options:i}=n,o=u.from(t),s={collection_name:{_eq:r},creator_address:{_eq:o.toStringLong()}};return _optionalChain([i, 'optionalAccess', _150 => _150.tokenStandard])&&(s.token_standard={_eq:_nullishCoalesce(_optionalChain([i, 'optionalAccess', _151 => _151.tokenStandard]), () => ("v2"))}),Vt({aptosConfig:e,options:{...i,where:s}})}async function fs(n){let{aptosConfig:e,creatorAddress:t,options:r}=n,o={creator_address:{_eq:u.from(t).toStringLong()}};return _optionalChain([r, 'optionalAccess', _152 => _152.tokenStandard])&&(o.token_standard={_eq:_nullishCoalesce(_optionalChain([r, 'optionalAccess', _153 => _153.tokenStandard]), () => ("v2"))}),Vt({aptosConfig:e,options:{...r,where:o}})}async function As(n){let{aptosConfig:e,collectionId:t,options:r}=n,o={collection_id:{_eq:u.from(t).toStringLong()}};return _optionalChain([r, 'optionalAccess', _154 => _154.tokenStandard])&&(o.token_standard={_eq:_nullishCoalesce(_optionalChain([r, 'optionalAccess', _155 => _155.tokenStandard]), () => ("v2"))}),Vt({aptosConfig:e,options:{...r,where:o}})}async function hs(n){let{creatorAddress:e,collectionName:t,options:r,aptosConfig:i}=n,o=u.from(e),s={collection_name:{_eq:t},creator_address:{_eq:o.toStringLong()}};return _optionalChain([r, 'optionalAccess', _156 => _156.tokenStandard])&&(s.token_standard={_eq:_nullishCoalesce(_optionalChain([r, 'optionalAccess', _157 => _157.tokenStandard]), () => ("v2"))}),(await Vt({aptosConfig:i,options:{where:s}})).collection_id}var Vc={typeParameters:[],parameters:[new y(P()),new y(P()),new y(P()),new y(P()),new C(new y(P())),new C(new y(P())),new C(C.u8())]};async function bs(n){let{aptosConfig:e,options:t,creator:r,collection:i,description:o,name:s,uri:a,propertyKeys:c,propertyTypes:d,propertyValues:p}=n,T=_optionalChain([d, 'optionalAccess', _158 => _158.map, 'call', _159 => _159(w=>We[w])]);return b({aptosConfig:e,sender:r.accountAddress,data:{function:"0x4::aptos_token::mint",functionArguments:[new S(i),new S(o),new S(s),new S(a),h.MoveString(_nullishCoalesce(c, () => ([]))),h.MoveString(_nullishCoalesce(T, () => ([]))),zs(_nullishCoalesce(p, () => ([])),_nullishCoalesce(T, () => ([])))],abi:Vc},options:t})}var $c={typeParameters:[{constraints:["key"]}],parameters:[new y(ie(new z(0))),new X]};async function Ts(n){let{aptosConfig:e,sender:t,digitalAssetAddress:r,recipient:i,digitalAssetType:o,options:s}=n;return b({aptosConfig:e,sender:t.accountAddress,data:{function:"0x1::object::transfer",typeArguments:[_nullishCoalesce(o, () => (ge))],functionArguments:[u.from(r),u.from(i)],abi:$c},options:s})}var Lc={typeParameters:[],parameters:[new y(P()),new y(P()),new y(P()),new y(P()),new C(new y(P())),new C(new y(P())),new C(C.u8()),new X]};async function ws(n){let{aptosConfig:e,account:t,collection:r,description:i,name:o,uri:s,recipient:a,propertyKeys:c,propertyTypes:d,propertyValues:p,options:T}=n;if(_optionalChain([c, 'optionalAccess', _160 => _160.length])!==_optionalChain([p, 'optionalAccess', _161 => _161.length]))throw new Error("Property keys and property values counts do not match");if(_optionalChain([d, 'optionalAccess', _162 => _162.length])!==_optionalChain([p, 'optionalAccess', _163 => _163.length]))throw new Error("Property types and property values counts do not match");let w=_optionalChain([d, 'optionalAccess', _164 => _164.map, 'call', _165 => _165(m=>We[m])]);return b({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::mint_soul_bound",functionArguments:[r,i,o,s,h.MoveString(_nullishCoalesce(c, () => ([]))),h.MoveString(_nullishCoalesce(w, () => ([]))),zs(_nullishCoalesce(p, () => ([])),_nullishCoalesce(w, () => ([]))),a],abi:Lc},options:T})}var Hc={typeParameters:[{constraints:["key"]}],parameters:[new y(ie(new z(0)))]};async function Ss(n){let{aptosConfig:e,creator:t,digitalAssetAddress:r,digitalAssetType:i,options:o}=n;return b({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::burn",typeArguments:[_nullishCoalesce(i, () => (ge))],functionArguments:[u.from(r)],abi:Hc},options:o})}var Qc={typeParameters:[{constraints:["key"]}],parameters:[new y(ie(new z(0)))]};async function xs(n){let{aptosConfig:e,creator:t,digitalAssetAddress:r,digitalAssetType:i,options:o}=n;return b({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::freeze_transfer",typeArguments:[_nullishCoalesce(i, () => (ge))],functionArguments:[r],abi:Qc},options:o})}var Wc={typeParameters:[{constraints:["key"]}],parameters:[new y(ie(new z(0)))]};async function _s(n){let{aptosConfig:e,creator:t,digitalAssetAddress:r,digitalAssetType:i,options:o}=n;return b({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::unfreeze_transfer",typeArguments:[_nullishCoalesce(i, () => (ge))],functionArguments:[r],abi:Wc},options:o})}var jc={typeParameters:[{constraints:["key"]}],parameters:[new y(ie(new z(0))),new y(P())]};async function Ps(n){let{aptosConfig:e,creator:t,description:r,digitalAssetAddress:i,digitalAssetType:o,options:s}=n;return b({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::set_description",typeArguments:[_nullishCoalesce(o, () => (ge))],functionArguments:[u.from(i),new S(r)],abi:jc},options:s})}var Xc={typeParameters:[{constraints:["key"]}],parameters:[new y(ie(new z(0))),new y(P())]};async function vs(n){let{aptosConfig:e,creator:t,name:r,digitalAssetAddress:i,digitalAssetType:o,options:s}=n;return b({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::set_name",typeArguments:[_nullishCoalesce(o, () => (ge))],functionArguments:[u.from(i),new S(r)],abi:Xc},options:s})}var Zc={typeParameters:[{constraints:["key"]}],parameters:[new y(ie(new z(0))),new y(P())]};async function Cs(n){let{aptosConfig:e,creator:t,uri:r,digitalAssetAddress:i,digitalAssetType:o,options:s}=n;return b({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::set_uri",typeArguments:[_nullishCoalesce(o, () => (ge))],functionArguments:[u.from(i),new S(r)],abi:Zc},options:s})}var Yc={typeParameters:[{constraints:["key"]}],parameters:[new y(ie(new z(0))),new y(P()),new y(P()),C.u8()]};async function Es(n){let{aptosConfig:e,creator:t,propertyKey:r,propertyType:i,propertyValue:o,digitalAssetAddress:s,digitalAssetType:a,options:c}=n;return b({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::add_property",typeArguments:[_nullishCoalesce(a, () => (ge))],functionArguments:[u.from(s),new S(r),new S(We[i]),h.U8(di(o,We[i]))],abi:Yc},options:c})}var Jc={typeParameters:[{constraints:["key"]}],parameters:[new y(ie(new z(0))),new y(P())]};async function Is(n){let{aptosConfig:e,creator:t,propertyKey:r,digitalAssetAddress:i,digitalAssetType:o,options:s}=n;return b({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::remove_property",typeArguments:[_nullishCoalesce(o, () => (ge))],functionArguments:[u.from(i),new S(r)],abi:Jc},options:s})}var eu={typeParameters:[{constraints:["key"]}],parameters:[new y(ie(new z(0))),new y(P()),new y(P()),C.u8()]};async function Us(n){let{aptosConfig:e,creator:t,propertyKey:r,propertyType:i,propertyValue:o,digitalAssetAddress:s,digitalAssetType:a,options:c}=n;return b({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::update_property",typeArguments:[_nullishCoalesce(a, () => (ge))],functionArguments:[u.from(s),new S(r),new S(We[i]),di(o,We[i])],abi:eu},options:c})}var tu={typeParameters:[{constraints:["key"]},{constraints:[]}],parameters:[new y(ie(new z(0))),new y(P()),new z(1)]};async function Rs(n){let{aptosConfig:e,creator:t,propertyKey:r,propertyType:i,propertyValue:o,digitalAssetAddress:s,digitalAssetType:a,options:c}=n;return b({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::add_typed_property",typeArguments:[_nullishCoalesce(a, () => (ge)),We[i]],functionArguments:[u.from(s),new S(r),o],abi:tu},options:c})}var nu={typeParameters:[{constraints:["key"]},{constraints:[]}],parameters:[new y(ie(new z(0))),new y(P()),new z(1)]};async function Ks(n){let{aptosConfig:e,creator:t,propertyKey:r,propertyType:i,propertyValue:o,digitalAssetAddress:s,digitalAssetType:a,options:c}=n;return b({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::update_typed_property",typeArguments:[_nullishCoalesce(a, () => (ge)),We[i]],functionArguments:[u.from(s),new S(r),o],abi:nu},options:c})}function zs(n,e){let t=new Array;return e.forEach((r,i)=>{t.push(di(n[i],r))}),t}function di(n,e){let t=ke(e);return qt(n,t,0,[]).bcsToBytes()}var fn=class{constructor(e){this.config=e}async getCollectionData(e){await A({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"});let{creatorAddress:t,collectionName:r,options:i}=e,o=u.from(t),s={collection_name:{_eq:r},creator_address:{_eq:o.toStringLong()}};return _optionalChain([i, 'optionalAccess', _166 => _166.tokenStandard])&&(s.token_standard={_eq:_nullishCoalesce(_optionalChain([i, 'optionalAccess', _167 => _167.tokenStandard]), () => ("v2"))}),Vt({aptosConfig:this.config,options:{where:s}})}async getCollectionDataByCreatorAddressAndCollectionName(e){return await A({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),ys({aptosConfig:this.config,...e})}async getCollectionDataByCreatorAddress(e){return await A({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),fs({aptosConfig:this.config,...e})}async getCollectionDataByCollectionId(e){return await A({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),As({aptosConfig:this.config,...e})}async getCollectionId(e){return await A({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),hs({aptosConfig:this.config,...e})}async getDigitalAssetData(e){return await A({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),ps({aptosConfig:this.config,...e})}async getCurrentDigitalAssetOwnership(e){return await A({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),ds({aptosConfig:this.config,...e})}async getOwnedDigitalAssets(e){return await A({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),ls({aptosConfig:this.config,...e})}async getDigitalAssetActivity(e){return await A({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),gs({aptosConfig:this.config,...e})}async createCollectionTransaction(e){return ms({aptosConfig:this.config,...e})}async mintDigitalAssetTransaction(e){return bs({aptosConfig:this.config,...e})}async transferDigitalAssetTransaction(e){return Ts({aptosConfig:this.config,...e})}async mintSoulBoundTransaction(e){return ws({aptosConfig:this.config,...e})}async burnDigitalAssetTransaction(e){return Ss({aptosConfig:this.config,...e})}async freezeDigitalAssetTransaferTransaction(e){return xs({aptosConfig:this.config,...e})}async unfreezeDigitalAssetTransaferTransaction(e){return _s({aptosConfig:this.config,...e})}async setDigitalAssetDescriptionTransaction(e){return Ps({aptosConfig:this.config,...e})}async setDigitalAssetNameTransaction(e){return vs({aptosConfig:this.config,...e})}async setDigitalAssetURITransaction(e){return Cs({aptosConfig:this.config,...e})}async addDigitalAssetPropertyTransaction(e){return Es({aptosConfig:this.config,...e})}async removeDigitalAssetPropertyTransaction(e){return Is({aptosConfig:this.config,...e})}async updateDigitalAssetPropertyTransaction(e){return Us({aptosConfig:this.config,...e})}async addDigitalAssetTypedPropertyTransaction(e){return Rs({aptosConfig:this.config,...e})}async updateDigitalAssetTypedPropertyTransaction(e){return Ks({aptosConfig:this.config,...e})}};var ks=300,ru=n=>{if(n&&n.length>ks)throw new Error(`Event type length exceeds the maximum length of ${ks}`)};async function Ds(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 An({aptosConfig:e,options:{...r,where:i}})}async function Bs(n){let{accountAddress:e,aptosConfig:t,creationNumber:r,options:i}=n,s={account_address:{_eq:u.from(e).toStringLong()},creation_number:{_eq:r}};return An({aptosConfig:t,options:{...i,where:s}})}async function Gs(n){let{accountAddress:e,aptosConfig:t,eventType:r,options:i}=n,s={account_address:{_eq:u.from(e).toStringLong()},indexed_type:{_eq:r}};return An({aptosConfig:t,options:{...i,where:s}})}async function An(n){let{aptosConfig:e,options:t}=n;ru(_optionalChain([t, 'optionalAccess', _168 => _168.where, 'optionalAccess', _169 => _169.indexed_type, 'optionalAccess', _170 => _170._eq]));let r={query:yo,variables:{where_condition:_optionalChain([t, 'optionalAccess', _171 => _171.where]),offset:_optionalChain([t, 'optionalAccess', _172 => _172.offset]),limit:_optionalChain([t, 'optionalAccess', _173 => _173.limit]),order_by:_optionalChain([t, 'optionalAccess', _174 => _174.orderBy])}};return(await f({aptosConfig:e,query:r,originMethod:"getEvents"})).events}var hn=class{constructor(e){this.config=e}async getModuleEventsByEventType(e){return await A({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"events_processor"}),Ds({aptosConfig:this.config,...e})}async getAccountEventsByCreationNumber(e){return await A({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"events_processor"}),Bs({aptosConfig:this.config,...e})}async getAccountEventsByEventType(e){return await A({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"events_processor"}),Gs({aptosConfig:this.config,...e})}async getEvents(e){return await A({config:this.config,minimumLedgerVersion:_optionalChain([e, 'optionalAccess', _175 => _175.minimumLedgerVersion]),processorType:"events_processor"}),An({aptosConfig:this.config,...e})}};async function Fs(n){let{aptosConfig:e,accountAddress:t,amount:r,options:i}=n,o=_optionalChain([i, 'optionalAccess', _176 => _176.timeoutSecs])||20,{data:s}=await Zi({aptosConfig:e,path:"fund",body:{address:u.from(t).toString(),amount:r},originMethod:"fundAccount"}),a=s.txn_hashes[0],c=await Mt({aptosConfig:e,transactionHash:a,options:{timeoutSecs:o,checkSuccess:_optionalChain([i, 'optionalAccess', _177 => _177.checkSuccess])}});if(c.type==="user_transaction")return c;throw new Error(`Unexpected transaction received for fund account: ${c.type}`)}var bn=class{constructor(e){this.config=e}async fundAccount(e){let t=await Fs({aptosConfig:this.config,...e});return(_optionalChain([e, 'access', _178 => _178.options, 'optionalAccess', _179 => _179.waitForIndexer])===void 0||_optionalChain([e, 'access', _180 => _180.options, 'optionalAccess', _181 => _181.waitForIndexer]))&&await ir({aptosConfig:this.config,minimumLedgerVersion:BigInt(t.version),processorType:"fungible_asset_processor"}),t}};async function mr(n){let{aptosConfig:e,options:t}=n,r={query:Ao,variables:{where_condition:_optionalChain([t, 'optionalAccess', _182 => _182.where]),limit:_optionalChain([t, 'optionalAccess', _183 => _183.limit]),offset:_optionalChain([t, 'optionalAccess', _184 => _184.offset])}};return(await f({aptosConfig:e,query:r,originMethod:"getFungibleAssetMetadata"})).fungible_asset_metadata}async function Ns(n){let{aptosConfig:e,options:t}=n,r={query:fo,variables:{where_condition:_optionalChain([t, 'optionalAccess', _185 => _185.where]),limit:_optionalChain([t, 'optionalAccess', _186 => _186.limit]),offset:_optionalChain([t, 'optionalAccess', _187 => _187.offset])}};return(await f({aptosConfig:e,query:r,originMethod:"getFungibleAssetActivities"})).fungible_asset_activities}async function Os(n){let{aptosConfig:e,options:t}=n,r={query:go,variables:{where_condition:_optionalChain([t, 'optionalAccess', _188 => _188.where]),limit:_optionalChain([t, 'optionalAccess', _189 => _189.limit]),offset:_optionalChain([t, 'optionalAccess', _190 => _190.offset])}};return(await f({aptosConfig:e,query:r,originMethod:"getCurrentFungibleAssetBalances"})).current_fungible_asset_balances}var iu={typeParameters:[{constraints:[]}],parameters:[ke("0x1::object::Object"),new X,new Q]};async function Ms(n){let{aptosConfig:e,sender:t,fungibleAssetMetadataAddress:r,recipient:i,amount:o,options:s}=n;return b({aptosConfig:e,sender:t.accountAddress,data:{function:"0x1::primary_fungible_store::transfer",typeArguments:["0x1::fungible_asset::Metadata"],functionArguments:[r,i,o],abi:iu},options:s})}var Tn=class{constructor(e){this.config=e}async getFungibleAssetMetadata(e){return await A({config:this.config,minimumLedgerVersion:_optionalChain([e, 'optionalAccess', _191 => _191.minimumLedgerVersion]),processorType:"fungible_asset_processor"}),mr({aptosConfig:this.config,...e})}async getFungibleAssetMetadataByAssetType(e){return await A({config:this.config,minimumLedgerVersion:_optionalChain([e, 'optionalAccess', _192 => _192.minimumLedgerVersion]),processorType:"fungible_asset_processor"}),(await mr({aptosConfig:this.config,options:{where:{asset_type:{_eq:e.assetType}}}}))[0]}async getFungibleAssetMetadataByCreatorAddress(e){return await A({config:this.config,minimumLedgerVersion:_optionalChain([e, 'optionalAccess', _193 => _193.minimumLedgerVersion]),processorType:"fungible_asset_processor"}),await mr({aptosConfig:this.config,options:{where:{creator_address:{_eq:u.from(e.creatorAddress).toStringLong()}}}})}async getFungibleAssetActivities(e){return await A({config:this.config,minimumLedgerVersion:_optionalChain([e, 'optionalAccess', _194 => _194.minimumLedgerVersion]),processorType:"fungible_asset_processor"}),Ns({aptosConfig:this.config,...e})}async getCurrentFungibleAssetBalances(e){return await A({config:this.config,minimumLedgerVersion:_optionalChain([e, 'optionalAccess', _195 => _195.minimumLedgerVersion]),processorType:"fungible_asset_processor"}),Os({aptosConfig:this.config,...e})}async transferFungibleAsset(e){return Ms({aptosConfig:this.config,...e})}};var wn=class{constructor(e){this.config=e}async getLedgerInfo(){return Zn({aptosConfig:this.config})}async getChainId(){return(await this.getLedgerInfo()).chain_id}async getBlockByVersion(e){return Mo({aptosConfig:this.config,...e})}async getBlockByHeight(e){return qo({aptosConfig:this.config,...e})}async view(e){return le({aptosConfig:this.config,...e})}async viewJson(e){return is({aptosConfig:this.config,...e})}async getChainTopUserTransactions(e){return So({aptosConfig:this.config,...e})}async queryIndexer(e){return f({aptosConfig:this.config,...e})}async getIndexerLastSuccessVersion(){return Yn({aptosConfig:this.config})}async getProcessorStatus(e){return Jn({aptosConfig:this.config,processorType:e})}};var qs=["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 Vs(n){return!(!n||n.length<3||n.length>63||!/^[a-z\d][a-z\d-]{1,61}[a-z\d]$/.test(n))}function je(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(!Vs(e))throw new Error(`${e} is not valid. ${qs}`);if(t&&!Vs(t))throw new Error(`${t} is not valid. ${qs}`);return{domainName:t||e,subdomainName:t?e:void 0}}function $s(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 ou="0x585fc9f0f0c54183b039ffc770ca282ebd87307916c215a3e692f2f8e4305e82",su={testnet:"0x5f8fd2347449685cf41d4db97926ec3a096eaf381332be4f1318ad4d16a8497c",mainnet:"0x867ed1f6bf916171b1de3ee92849b8978b7d1b9e0a8cc982a3d19d535dfd9c0c",local:ou,custom:null,devnet:null};function De(n){let e=su[n.network];if(!e)throw new Error(`The ANS contract is not deployed to ${n.network}`);return e}var yr=n=>{if(n&&typeof n=="object"&&"vec"in n&&Array.isArray(n.vec))return n.vec[0]};async function Ls(n){let{aptosConfig:e,name:t}=n,r=De(e),{domainName:i,subdomainName:o}=je(t),s=await le({aptosConfig:e,payload:{function:`${r}::router::get_owner_addr`,functionArguments:[i,o]}}),a=yr(s[0]);return a?u.from(a):void 0}async function Hs(n){let{aptosConfig:e,expiration:t,name:r,sender:i,targetAddress:o,toAddress:s,options:a,transferable:c}=n,d=De(e),{domainName:p,subdomainName:T}=je(r),w=t.policy==="subdomain:independent"||t.policy==="subdomain:follow-domain";if(T&&!w)throw new Error("Subdomains must have an expiration policy of either 'subdomain:independent' or 'subdomain:follow-domain'");if(w&&!T)throw new Error(`Policy is set to ${t.policy} but no subdomain was provided`);if(t.policy==="domain"){let wr=_nullishCoalesce(t.years, () => (1));if(wr!==1)throw new Error("For now, names can only be registered for 1 year at a time");let da=wr*31536e3;return await b({aptosConfig:e,sender:i.accountAddress.toString(),data:{function:`${d}::router::register_domain`,functionArguments:[p,da,o,s]},options:a})}if(!T)throw new Error(`${t.policy} requires a subdomain to be provided.`);let m=await li({aptosConfig:e,name:p});if(!m)throw new Error("The domain does not exist");let E=t.policy==="subdomain:independent"?t.expirationDate:m;if(E>m)throw new Error("The subdomain expiration time cannot be greater than the domain expiration time");return await b({aptosConfig:e,sender:i.accountAddress.toString(),data:{function:`${d}::router::register_subdomain`,functionArguments:[p,T,Math.round(E/1e3),t.policy==="subdomain:follow-domain"?1:0,!!c,o,s]},options:a})}async function li(n){let{aptosConfig:e,name:t}=n,r=De(e),{domainName:i,subdomainName:o}=je(t);try{let s=await le({aptosConfig:e,payload:{function:`${r}::router::get_expiration`,functionArguments:[i,o]}});return Number(s[0])*1e3}catch (e5){return}}async function Qs(n){let{aptosConfig:e,address:t}=n,r=De(e),i=await le({aptosConfig:e,payload:{function:`${r}::router::get_primary_name`,functionArguments:[u.from(t).toString()]}}),o=yr(i[1]),s=yr(i[0]);if(o)return[s,o].filter(Boolean).join(".")}async function Ws(n){let{aptosConfig:e,sender:t,name:r,options:i}=n,o=De(e);if(!r)return await b({aptosConfig:e,sender:t.accountAddress.toString(),data:{function:`${o}::router::clear_primary_name`,functionArguments:[]},options:i});let{domainName:s,subdomainName:a}=je(r);return await b({aptosConfig:e,sender:t.accountAddress.toString(),data:{function:`${o}::router::set_primary_name`,functionArguments:[s,a]},options:i})}async function js(n){let{aptosConfig:e,name:t}=n,r=De(e),{domainName:i,subdomainName:o}=je(t),s=await le({aptosConfig:e,payload:{function:`${r}::router::get_target_addr`,functionArguments:[i,o]}}),a=yr(s[0]);return a?u.from(a):void 0}async function Xs(n){let{aptosConfig:e,sender:t,name:r,address:i,options:o}=n,s=De(e),{domainName:a,subdomainName:c}=je(r);return await b({aptosConfig:e,sender:t.accountAddress.toString(),data:{function:`${s}::router::set_target_addr`,functionArguments:[a,c,i]},options:o})}async function Zs(n){let{aptosConfig:e,name:t}=n,{domainName:r,subdomainName:i=""}=je(t),a=(await f({aptosConfig:e,query:{query:Nt,variables:{where_condition:{domain:{_eq:r},subdomain:{_eq:i}},limit:1}},originMethod:"getName"})).current_aptos_names[0];return a&&(a=Sn(a)),$s(a)?a:void 0}async function Ys(n){let{aptosConfig:e,options:t,accountAddress:r}=n,i=await gi({aptosConfig:e});return(await f({aptosConfig:e,originMethod:"getAccountNames",query:{query:Nt,variables:{limit:_optionalChain([t, 'optionalAccess', _196 => _196.limit]),offset:_optionalChain([t, 'optionalAccess', _197 => _197.offset]),order_by:_optionalChain([t, 'optionalAccess', _198 => _198.orderBy]),where_condition:{..._nullishCoalesce(_optionalChain([n, 'access', _199 => _199.options, 'optionalAccess', _200 => _200.where]), () => ({})),owner_address:{_eq:r.toString()},expiration_timestamp:{_gte:i}}}}})).current_aptos_names.map(Sn)}async function Js(n){let{aptosConfig:e,options:t,accountAddress:r}=n,i=await gi({aptosConfig:e});return(await f({aptosConfig:e,originMethod:"getAccountDomains",query:{query:Nt,variables:{limit:_optionalChain([t, 'optionalAccess', _201 => _201.limit]),offset:_optionalChain([t, 'optionalAccess', _202 => _202.offset]),order_by:_optionalChain([t, 'optionalAccess', _203 => _203.orderBy]),where_condition:{..._nullishCoalesce(_optionalChain([n, 'access', _204 => _204.options, 'optionalAccess', _205 => _205.where]), () => ({})),owner_address:{_eq:r.toString()},expiration_timestamp:{_gte:i},subdomain:{_eq:""}}}}})).current_aptos_names.map(Sn)}async function ea(n){let{aptosConfig:e,options:t,accountAddress:r}=n,i=await gi({aptosConfig:e});return(await f({aptosConfig:e,originMethod:"getAccountSubdomains",query:{query:Nt,variables:{limit:_optionalChain([t, 'optionalAccess', _206 => _206.limit]),offset:_optionalChain([t, 'optionalAccess', _207 => _207.offset]),order_by:_optionalChain([t, 'optionalAccess', _208 => _208.orderBy]),where_condition:{..._nullishCoalesce(_optionalChain([n, 'access', _209 => _209.options, 'optionalAccess', _210 => _210.where]), () => ({})),owner_address:{_eq:r.toString()},expiration_timestamp:{_gte:i},subdomain:{_neq:""}}}}})).current_aptos_names.map(Sn)}async function ta(n){let{aptosConfig:e,options:t,domain:r}=n;return(await f({aptosConfig:e,originMethod:"getDomainSubdomains",query:{query:Nt,variables:{limit:_optionalChain([t, 'optionalAccess', _211 => _211.limit]),offset:_optionalChain([t, 'optionalAccess', _212 => _212.offset]),order_by:_optionalChain([t, 'optionalAccess', _213 => _213.orderBy]),where_condition:{..._nullishCoalesce(_optionalChain([n, 'access', _214 => _214.options, 'optionalAccess', _215 => _215.where]), () => ({})),domain:{_eq:r},subdomain:{_neq:""}}}}})).current_aptos_names.map(Sn).filter($s)}async function gi(n){let{aptosConfig:e}=n,t=De(e),[r]=await le({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=De(e),a=i*31536e3,{domainName:c,subdomainName:d}=je(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 b({aptosConfig:e,sender:t.accountAddress.toString(),data:{function:`${s}::router::renew_domain`,functionArguments:[c,a]},options:o})}function Sn(n){return{...n,expiration_timestamp:new Date(n.expiration_timestamp).getTime()}}var xn=class{constructor(e){this.config=e}async getOwnerAddress(e){return Ls({aptosConfig:this.config,...e})}async getExpiration(e){return li({aptosConfig:this.config,...e})}async getTargetAddress(e){return js({aptosConfig:this.config,...e})}async setTargetAddress(e){return Xs({aptosConfig:this.config,...e})}async getPrimaryName(e){return Qs({aptosConfig:this.config,...e})}async setPrimaryName(e){return Ws({aptosConfig:this.config,...e})}async registerName(e){return Hs({aptosConfig:this.config,...e})}async renewDomain(e){return na({aptosConfig:this.config,...e})}async getName(e){return Zs({aptosConfig:this.config,...e})}async getAccountNames(e){return Ys({aptosConfig:this.config,...e})}async getAccountDomains(e){return Js({aptosConfig:this.config,...e})}async getAccountSubdomains(e){return ea({aptosConfig:this.config,...e})}async getDomainSubdomains(e){return ta({aptosConfig:this.config,...e})}};async function ra(n){let{aptosConfig:e,poolAddress:t}=n,r=u.from(t).toStringLong(),o=await f({aptosConfig:e,query:{query:Hr,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 ia(n){let{aptosConfig:e,options:t}=n,r={query:Hr,variables:{order_by:_optionalChain([t, 'optionalAccess', _216 => _216.orderBy])}};return(await f({aptosConfig:e,query:r})).num_active_delegator_per_pool}async function oa(n){let{aptosConfig:e,delegatorAddress:t,poolAddress:r}=n,i={query:mo,variables:{delegatorAddress:u.from(t).toStringLong(),poolAddress:u.from(r).toStringLong()}};return(await f({aptosConfig:e,query:i})).delegated_staking_activities}var _n=class{constructor(e){this.config=e}async getNumberOfDelegators(e){return await A({config:this.config,minimumLedgerVersion:_optionalChain([e, 'optionalAccess', _217 => _217.minimumLedgerVersion]),processorType:"stake_processor"}),ra({aptosConfig:this.config,...e})}async getNumberOfDelegatorsForAllPools(e){return await A({config:this.config,minimumLedgerVersion:_optionalChain([e, 'optionalAccess', _218 => _218.minimumLedgerVersion]),processorType:"stake_processor"}),ia({aptosConfig:this.config,...e})}async getDelegatedStakingActivities(e){return await A({config:this.config,minimumLedgerVersion:_optionalChain([e, 'optionalAccess', _219 => _219.minimumLedgerVersion]),processorType:"stake_processor"}),oa({aptosConfig:this.config,...e})}};var fr=class{constructor(e){this.config=e}async simple(e){return b({aptosConfig:this.config,...e})}async multiAgent(e){return b({aptosConfig:this.config,...e})}};function mi(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 yi(n,e,t){let r=t.value;return t.value=async function(...i){let[o]=i;if(o.transaction.feePayerAddress&&!o.feePayerPublicKey)throw new Error("You are simulating a Fee Payer transaction but missing the feePayerPublicKey");return r.apply(this,i)},t}var $t=class{constructor(e){this.config=e}async simple(e){return pi({aptosConfig:this.config,...e})}async multiAgent(e){return pi({aptosConfig:this.config,...e})}};_chunkHBPH2AD3js.a.call(void 0, [yi],$t.prototype,"simple",1),_chunkHBPH2AD3js.a.call(void 0, [yi],$t.prototype,"multiAgent",1);var Lt=class{constructor(e){this.config=e}async simple(e){return gn({aptosConfig:this.config,...e})}async multiAgent(e){return gn({aptosConfig:this.config,...e})}};_chunkHBPH2AD3js.a.call(void 0, [mi],Lt.prototype,"simple",1),_chunkHBPH2AD3js.a.call(void 0, [mi],Lt.prototype,"multiAgent",1);var Ar=class{constructor(e,t,r,i,o){this.lastUncommintedNumber=null;this.currentNumber=null;this.lock=!1;this.aptosConfig=e,this.account=t,this.maxWaitTime=r,this.maximumInFlight=i,this.sleepTime=o}async nextSequenceNumber(){for(;this.lock;)await _chunkHBPH2AD3js.b.call(void 0, this.sleepTime);this.lock=!0;let e=BigInt(0);try{if((this.lastUncommintedNumber===null||this.currentNumber===null)&&await this.initialize(),this.currentNumber-this.lastUncommintedNumber>=this.maximumInFlight){await this.update();let t=_chunkHBPH2AD3js.c.call(void 0, );for(;this.currentNumber-this.lastUncommintedNumber>=this.maximumInFlight;)await _chunkHBPH2AD3js.b.call(void 0, this.sleepTime),_chunkHBPH2AD3js.c.call(void 0, )-t>this.maxWaitTime?(console.warn(`Waited over 30 seconds for a transaction to commit, resyncing ${this.account.accountAddress.toString()}`),await this.initialize()):await this.update()}e=this.currentNumber,this.currentNumber+=BigInt(1)}catch(t){console.error("error in getting next sequence number for this account",t)}finally{this.lock=!1}return e}async initialize(){let{sequence_number:e}=await ve({aptosConfig:this.aptosConfig,accountAddress:this.account.accountAddress});this.currentNumber=BigInt(e),this.lastUncommintedNumber=BigInt(e)}async update(){let{sequence_number:e}=await ve({aptosConfig:this.aptosConfig,accountAddress:this.account.accountAddress});return this.lastUncommintedNumber=BigInt(e),this.lastUncommintedNumber}async synchronize(){if(this.lastUncommintedNumber!==this.currentNumber){for(;this.lock;)await _chunkHBPH2AD3js.b.call(void 0, this.sleepTime);this.lock=!0;try{await this.update();let e=_chunkHBPH2AD3js.c.call(void 0, );for(;this.lastUncommintedNumber!==this.currentNumber;)_chunkHBPH2AD3js.c.call(void 0, )-e>this.maxWaitTime?(console.warn(`Waited over 30 seconds for a transaction to commit, resyncing ${this.account.accountAddress.toString()}`),await this.initialize()):(await _chunkHBPH2AD3js.b.call(void 0, this.sleepTime),await this.update())}catch(e){console.error("error in synchronizing this account sequence number with the one on chain",e)}finally{this.lock=!1}}}};var Ht=class{constructor(){this.queue=[];this.pendingDequeue=[];this.cancelled=!1}enqueue(e){if(this.cancelled=!1,this.pendingDequeue.length>0){_optionalChain([this, 'access', _220 => _220.pendingDequeue, 'access', _221 => _221.shift, 'call', _222 => _222(), 'optionalAccess', _223 => _223.resolve, 'call', _224 => _224(e)]);return}this.queue.push(e)}async dequeue(){return this.queue.length>0?Promise.resolve(this.queue.shift()):new Promise((e,t)=>{this.pendingDequeue.push({resolve:e,reject:t})})}isEmpty(){return this.queue.length===0}cancel(){this.cancelled=!0,this.pendingDequeue.forEach(async({reject:e})=>{e(new Qt("Task cancelled"))}),this.pendingDequeue=[],this.queue.length=0}isCancelled(){return this.cancelled}pendingDequeueLength(){return this.pendingDequeue.length}},Qt=class extends Error{};var sa="fulfilled",aa= exports.TransactionWorkerEventsEnum =(o=>(o.TransactionSent="transactionSent",o.TransactionSendFailed="transactionSendFailed",o.TransactionExecuted="transactionExecuted",o.TransactionExecutionFailed="transactionExecutionFailed",o.ExecutionFinish="executionFinish",o))(aa||{}),hr= exports.TransactionWorker =class extends _eventemitter32.default{constructor(t,r,i=30,o=100,s=10){super();this.taskQueue=new Ht;this.transactionsQueue=new Ht;this.outstandingTransactions=new Ht;this.sentTransactions=[];this.executedTransactions=[];this.aptosConfig=t,this.account=r,this.started=!1,this.accountSequnceNumber=new Ar(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=mn({aptosConfig:this.aptosConfig,transaction:r,signer:this.account});await this.outstandingTransactions.enqueue([i,t])}}catch(t){if(t instanceof Qt)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===sa?(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 Qt)return;throw new Error(`Process execution failed for ${this.account.accountAddress.toString()} with error ${t}`)}}async checkTransaction(t,r){try{let i=[];i.push(Mt({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===sa?(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 b({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 br=class extends _eventemitter32.default{constructor(e){super(),this.config=e}start(e){let{sender:t}=e;this.account=t,this.transactionWorker=new hr(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 Pn=class{constructor(e){this.config=e,this.build=new fr(this.config),this.simulate=new $t(this.config),this.submit=new Lt(this.config),this.batch=new br(this.config)}async getTransactions(e){return Zr({aptosConfig:this.config,...e})}async getTransactionByVersion(e){return No({aptosConfig:this.config,...e})}async getTransactionByHash(e){return un({aptosConfig:this.config,...e})}async isPendingTransaction(e){return Oo({aptosConfig:this.config,...e})}async waitForTransaction(e){return Mt({aptosConfig:this.config,...e})}async getGasPriceEstimation(){return rr({aptosConfig:this.config})}getSigningMessage(e){return os(e)}async publishPackageTransaction(e){return as({aptosConfig:this.config,...e})}async rotateAuthKey(e){return cs({aptosConfig:this.config,...e})}sign(e){return lr({...e})}signAsFeePayer(e){return gr({...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 mn({aptosConfig:this.config,...e})}async signAndSubmitAsFeePayer(e){return ss({aptosConfig:this.config,...e})}};var vn=class{constructor(e){this.config=e}async getTableItem(e){return er({aptosConfig:this.config,...e})}async getTableItemsData(e){return await A({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"default_processor"}),xo({aptosConfig:this.config,...e})}async getTableItemsMetadata(e){return await A({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"default_processor"}),_o({aptosConfig:this.config,...e})}};async function Tr(n){let{aptosConfig:e,jwt:t,ephemeralKeyPair:r,uidKey:i="sub",derivationPath:o}=n,s={jwt_b64:t,epk:r.getPublicKey().bcsToHex().toStringWithoutPrefix(),exp_date_secs:r.expiryDateSecs,epk_blinder:g.fromHexInput(r.blinder).toStringWithoutPrefix(),uid_key:i,derivation_path:o},{data:a}=await Yi({aptosConfig:e,path:"fetch",body:s,originMethod:"getPepper",overrides:{WITH_CREDENTIALS:!1}});return g.fromHexInput(a.pepper).toUint8Array()}async function fi(n){let{aptosConfig:e,jwt:t,ephemeralKeyPair:r,pepper:i=await Tr(n),uidKey:o="sub"}=n;if(g.fromHexInput(i).toUint8Array().length!==Gt.PEPPER_LENGTH)throw new Error(`Pepper needs to be ${Gt.PEPPER_LENGTH} bytes`);let{maxExpHorizonSecs:s}=await to({aptosConfig:e}),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:g.fromHexInput(r.blinder).toStringWithoutPrefix(),exp_date_secs:r.expiryDateSecs,exp_horizon_secs:s,pepper:g.fromHexInput(i).toStringWithoutPrefix(),uid_key:o},{data:d}=await Ji({aptosConfig:e,path:"prove",body:c,originMethod:"getProof",overrides:{WITH_CREDENTIALS:!1}}),p=d.proof,T=new xt({a:p.a,b:p.b,c:p.c});return new ce({proof:new _t(T,0),trainingWheelsSignature:xe.fromHex(d.training_wheels_signature),expHorizonSecs:s})}async function ca(n){let{aptosConfig:e,jwt:t,jwkAddress:r,uidKey:i,proofFetchCallback:o,pepper:s=await Tr(n)}=n,a=fi({...n,pepper:s}),c=o?a:await a;if(r!==void 0){let T=Te.fromJwtAndPepper({jwt:t,pepper:s,jwkAddress:r,uidKey:i}),w=await Ot({aptosConfig:e,authenticationKey:T.authKey().derivedAddress()});return Wn.create({...n,address:w,proof:c,pepper:s,proofFetchCallback:o,jwkAddress:r})}let d=G.fromJwtAndPepper({jwt:t,pepper:s,uidKey:i}),p=await Ot({aptosConfig:e,authenticationKey:d.authKey().derivedAddress()});return Gt.create({...n,address:p,proof:c,pepper:s,proofFetchCallback:o})}async function ua(n){let{aptosConfig:e,sender:t,iss:r}=n,i=_nullishCoalesce(n.jwksUrl, () => ((r.endsWith("/")?`${r}.well-known/jwks.json`:`${r}/.well-known/jwks.json`))),o=await fetch(i);if(!o.ok)throw new Error(`Failed to fetch JWKS: ${o.status} ${o.statusText}`);let s=await o.json();return b({aptosConfig:e,sender:t.accountAddress,data:{function:"0x1::jwks::update_federated_jwk_set",functionArguments:[r,h.MoveString(s.keys.map(a=>a.kid)),h.MoveString(s.keys.map(a=>a.alg)),h.MoveString(s.keys.map(a=>a.e)),h.MoveString(s.keys.map(a=>a.n))]}})}var Cn=class{constructor(e){this.config=e}async getPepper(e){return Tr({aptosConfig:this.config,...e})}async getProof(e){return fi({aptosConfig:this.config,...e})}async deriveKeylessAccount(e){return ca({aptosConfig:this.config,...e})}async updateFederatedKeylessJwkSetTransaction(e){return ua({aptosConfig:this.config,...e})}};async function pu(n){let{aptosConfig:e,options:t}=n,r={query:Xn,variables:{where_condition:_optionalChain([t, 'optionalAccess', _225 => _225.where]),offset:_optionalChain([t, 'optionalAccess', _226 => _226.offset]),limit:_optionalChain([t, 'optionalAccess', _227 => _227.limit]),order_by:_optionalChain([t, 'optionalAccess', _228 => _228.orderBy])}};return(await f({aptosConfig:e,query:r,originMethod:"getObjectData"})).current_objects}async function pa(n){let{aptosConfig:e,objectAddress:t,options:r}=n,o={object_address:{_eq:u.from(t).toStringLong()}};return(await pu({aptosConfig:e,options:{...r,where:o}}))[0]}var En=class{constructor(e){this.config=e}async getObjectDataByObjectAddress(e){return await A({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"objects_processor"}),pa({aptosConfig:this.config,...e})}};var Z=class{constructor(e){this.config=new dr(e),this.account=new ln(this.config),this.ans=new xn(this.config),this.coin=new yn(this.config),this.digitalAsset=new fn(this.config),this.event=new hn(this.config),this.faucet=new bn(this.config),this.fungibleAsset=new Tn(this.config),this.general=new wn(this.config),this.staking=new _n(this.config),this.transaction=new Pn(this.config),this.table=new vn(this.config),this.keyless=new Cn(this.config),this.object=new En(this.config)}};function oe(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))})}oe(Z,ln,"account");oe(Z,xn,"ans");oe(Z,yn,"coin");oe(Z,fn,"digitalAsset");oe(Z,hn,"event");oe(Z,bn,"faucet");oe(Z,Tn,"fungibleAsset");oe(Z,wn,"general");oe(Z,_n,"staking");oe(Z,Pn,"transaction");oe(Z,vn,"table");oe(Z,Cn,"keyless");oe(Z,En,"object");exports.APTOS_BIP44_REGEX = _a; exports.APTOS_COIN = Tt; exports.APTOS_FA = Vi; exports.APTOS_HARDENED_REGEX = xa; exports.AbstractKeylessAccount = de; exports.Account = He; exports.AccountAddress = u; exports.AccountAuthenticator = j; exports.AccountAuthenticatorEd25519 = we; exports.AccountAuthenticatorMultiEd25519 = qn; exports.AccountAuthenticatorMultiKey = st; exports.AccountAuthenticatorSingleKey = te; exports.AccountAuthenticatorVariant = Pi; exports.AccountPublicKey = ee; exports.AccountSequenceNumber = Ar; exports.AddressInvalidReason = ba; exports.AnyPublicKey = k; exports.AnyPublicKeyVariant = kn; exports.AnySignature = M; exports.AnySignatureVariant = vi; exports.Aptos = Z; exports.AptosApiError = be; exports.AptosApiType = bt; exports.AptosConfig = dr; exports.AuthenticationKey = D; exports.Bool = I; exports.CKDPriv = Di; exports.ChainId = vt; exports.DEFAULT_MAX_GAS_AMOUNT = Mi; exports.DEFAULT_TXN_EXP_SEC_FROM_NOW = qi; exports.DEFAULT_TXN_TIMEOUT_SEC = On; exports.DeriveScheme = Ii; exports.Deserializer = q; exports.EPK_HORIZON_SECS = Vl; exports.Ed25519Account = kt; exports.Ed25519PrivateKey = W; exports.Ed25519PublicKey = _; exports.Ed25519Signature = v; exports.EntryFunction = ct; exports.EntryFunctionBytes = Kn; exports.EphemeralCertificate = St; exports.EphemeralCertificateVariant = _r; exports.EphemeralKeyPair = lt; exports.EphemeralPublicKey = rt; exports.EphemeralPublicKeyVariant = xr; exports.EphemeralSignature = xe; exports.EphemeralSignatureVariant = Ci; exports.FederatedKeylessAccount = Wn; exports.FederatedKeylessPublicKey = Te; exports.FeePayerRawTransaction = pt; exports.FixedBytes = Je; exports.Groth16Zkp = xt; exports.HARDENED_OFFSET = Ki; exports.Hex = g; exports.HexInvalidReason = ma; exports.Identifier = R; exports.KeyType = Pa; exports.KeylessAccount = Gt; exports.KeylessConfiguration = Or; exports.KeylessPublicKey = G; exports.KeylessSignature = Re; exports.MAX_AUD_VAL_BYTES = tc; exports.MAX_COMMITED_EPK_BYTES = Ql; exports.MAX_EXTRA_FIELD_BYTES = Ll; exports.MAX_ISS_VAL_BYTES = $l; exports.MAX_JWT_HEADER_B64_BYTES = Hl; exports.MAX_UID_KEY_BYTES = nc; exports.MAX_UID_VAL_BYTES = rc; exports.MimeType = zn; exports.ModuleId = en; exports.MoveAbility = Ei; exports.MoveFunctionVisibility = fa; exports.MoveOption = L; exports.MoveString = S; exports.MoveVector = h; exports.MultiAgentRawTransaction = ut; exports.MultiAgentTransaction = Qn; exports.MultiEd25519PublicKey = ft; exports.MultiEd25519Signature = tt; exports.MultiKey = Pt; exports.MultiKeyAccount = Ft; exports.MultiKeySignature = ot; exports.MultiSig = sn; exports.MultiSigTransactionPayload = an; exports.Network = Br; exports.NetworkToChainId = Gr; exports.NetworkToFaucetAPI = Wi; exports.NetworkToIndexerAPI = Hi; exports.NetworkToNetworkName = $d; exports.NetworkToNodeAPI = Qi; exports.NetworkToPepperAPI = kr; exports.NetworkToProverAPI = Dr; exports.ParsingError = J; exports.ProcessorType = Ie; exports.PublicKey = et; exports.RAW_TRANSACTION_SALT = $i; exports.RAW_TRANSACTION_WITH_DATA_SALT = Kr; exports.RawTransaction = pe; exports.RawTransactionWithData = $n; exports.RoleType = Aa; exports.RotationProofChallenge = Ln; exports.Script = on; exports.ScriptTransactionArgumentVariants = jt; exports.Secp256k1PrivateKey = nt; exports.Secp256k1PublicKey = Ee; exports.Secp256k1Signature = ht; exports.Serializable = l; exports.Serialized = Xt; exports.Serializer = V; exports.Signature = B; exports.SignedTransaction = dt; exports.SigningScheme = me; exports.SigningSchemeInput = Cr; exports.SimpleTransaction = Hn; exports.SingleKeyAccount = Dt; exports.StructTag = Ke; exports.TransactionAndProof = Lr; exports.TransactionAuthenticator = ze; exports.TransactionAuthenticatorEd25519 = Et; exports.TransactionAuthenticatorFeePayer = Ut; exports.TransactionAuthenticatorMultiAgent = It; exports.TransactionAuthenticatorMultiEd25519 = Vr; exports.TransactionAuthenticatorSingleSender = Rt; exports.TransactionAuthenticatorVariant = _i; exports.TransactionPayload = at; exports.TransactionPayloadEntryFunction = nn; exports.TransactionPayloadMultiSig = rn; exports.TransactionPayloadScript = tn; exports.TransactionPayloadVariants = Si; exports.TransactionResponseType = vr; exports.TransactionVariants = xi; exports.TransactionWorker = hr; exports.TransactionWorkerEventsEnum = aa; exports.TypeTag = K; exports.TypeTagAddress = X; exports.TypeTagBool = F; exports.TypeTagGeneric = z; exports.TypeTagParserError = N; exports.TypeTagParserErrorType = Pc; exports.TypeTagReference = Vn; exports.TypeTagSigner = Ct; exports.TypeTagStruct = y; exports.TypeTagU128 = $e; exports.TypeTagU16 = qe; exports.TypeTagU256 = Le; exports.TypeTagU32 = Ve; exports.TypeTagU64 = Q; exports.TypeTagU8 = ue; exports.TypeTagVariants = wi; exports.TypeTagVector = C; exports.U128 = Ae; exports.U16 = ye; exports.U256 = he; exports.U32 = fe; exports.U64 = O; exports.U8 = $; exports.ZeroKnowledgeSig = ce; exports.ZkProof = _t; exports.ZkpVariant = Pr; exports.aptosCoinStructTag = Im; exports.aptosRequest = Mn; exports.base64UrlDecode = _chunkHBPH2AD3js.e; exports.bigIntToBytesLE = Oi; exports.buildTransaction = ci; exports.bytesToBigIntLE = Zt; exports.checkOrConvertArgument = qt; exports.convertAmountFromHumanReadableToOnChain = _chunkHBPH2AD3js.f; exports.convertAmountFromOnChainToHumanReadable = _chunkHBPH2AD3js.g; exports.convertArgument = ai; exports.convertNumber = or; exports.createObjectAddress = qr; exports.createResourceAddress = om; exports.createTokenAddress = sm; exports.deriveKey = Er; exports.deriveTransactionType = $r; exports.deserializeFromScriptArgument = ac; exports.ensureBoolean = Sr; exports.fetchEntryFunctionAbi = Yo; exports.fetchFunctionAbi = Zo; exports.fetchViewFunctionAbi = Jo; exports.findFirstNonSignerArg = Wo; exports.floorToWholeHour = _chunkHBPH2AD3js.d; exports.generateRawTransaction = Kc; exports.generateSignedTransaction = ui; exports.generateSignedTransactionForSimulation = ts; exports.generateSigningMessage = Kt; exports.generateSigningMessageForSerializable = My; exports.generateSigningMessageForTransaction = zt; exports.generateTransactionPayload = pr; exports.generateTransactionPayloadWithABI = Ic; exports.generateUserTransactionHash = Xh; exports.generateViewFunctionPayload = es; exports.generateViewFunctionPayloadWithABI = Uc; exports.get = Fr; exports.getAptosFullNode = H; exports.getAptosPepperService = gl; exports.getAuthenticatorForSimulation = ur; exports.getFunctionParts = pn; exports.getKeylessConfig = to; exports.hashStrToField = Fn; exports.hashValues = ns; exports.isBcsAddress = ar; exports.isBcsBool = Yr; exports.isBcsFixedBytes = Tc; exports.isBcsString = Jr; exports.isBcsU128 = ii; exports.isBcsU16 = ti; exports.isBcsU256 = oi; exports.isBcsU32 = ni; exports.isBcsU64 = ri; exports.isBcsU8 = ei; exports.isBlockEpilogueTransactionResponse = Mu; exports.isBlockMetadataTransactionResponse = Fu; exports.isBool = $o; exports.isCanonicalEd25519Signature = Ca; exports.isEd25519Signature = qu; exports.isEmptyOption = Lo; exports.isEncodedEntryFunctionArgument = Ho; exports.isEncodedStruct = _chunkHBPH2AD3js.i; exports.isFeePayerSignature = Lu; exports.isGenesisTransactionResponse = Gu; exports.isLargeNumber = sr; exports.isMultiAgentSignature = $u; exports.isMultiEd25519Signature = Hu; exports.isNumber = bc; exports.isPendingTransactionResponse = Du; exports.isScriptDataInput = Qo; exports.isSecp256k1Signature = Vu; exports.isStateCheckpointTransactionResponse = Nu; exports.isString = Qe; exports.isUserTransactionResponse = Bu; exports.isValidBIP44Path = zi; exports.isValidHardenedPath = ki; exports.isValidatorTransactionResponse = Ou; exports.mnemonicToSeed = Dn; exports.normalizeBundle = ji; exports.nowInSeconds = _chunkHBPH2AD3js.c; exports.objectStructTag = ie; exports.optionStructTag = Um; exports.outOfRangeErrorMessage = ya; exports.padAndPackBytesWithLen = Rr; exports.paginateWithCursor = wt; exports.parseEncodedStruct = _chunkHBPH2AD3js.h; exports.parseTypeTag = ke; exports.poseidonHash = Yt; exports.post = Jt; exports.postAptosFaucet = Zi; exports.postAptosFullNode = Me; exports.postAptosIndexer = Xi; exports.postAptosPepperService = Yi; exports.postAptosProvingService = Ji; exports.promiseFulfilledStatus = sa; exports.request = Ja; exports.sleep = _chunkHBPH2AD3js.b; exports.splitPath = Bi; exports.standardizeTypeTags = cr; exports.stringStructTag = P; exports.throwTypeMismatch = U; exports.validateNumberInRange = Ge;
|
|
472
|
+
`;async function Yn(n){let{aptosConfig:e}=n,{data:t}=await Q({aptosConfig:e,originMethod:"getLedgerInfo",path:""});return t}async function So(n){let{aptosConfig:e,limit:t}=n;return(await f({aptosConfig:e,query:{query:po,variables:{limit:t}},originMethod:"getChainTopUserTransactions"})).user_transactions}async function f(n){let{aptosConfig:e,query:t,originMethod:r}=n,{data:i}=await Xi({aptosConfig:e,originMethod:_nullishCoalesce(r, () => ("queryIndexer")),path:"",body:t,overrides:{WITH_CREDENTIALS:!1}});return i}async function Ac(n){let{aptosConfig:e}=n;return(await f({aptosConfig:e,query:{query:Qr},originMethod:"getProcessorStatuses"})).processor_status}async function Jn(n){let e=await Ac({aptosConfig:n.aptosConfig});return BigInt(e[0].last_success_version)}async function er(n){let{aptosConfig:e,processorType:t}=n;return(await f({aptosConfig:e,query:{query:Qr,variables:{where_condition:{processor:{_eq:t}}}},originMethod:"getProcessorStatus"})).processor_status[0]}async function tr(n){let{aptosConfig:e,handle:t,data:r,options:i}=n;return(await Qe({aptosConfig:e,originMethod:"getTableItem",path:`tables/${t}/item`,params:{ledger_version:_optionalChain([i, 'optionalAccess', _54 => _54.ledgerVersion])},body:r})).data}async function xo(n){let{aptosConfig:e,options:t}=n,r={query:ho,variables:{where_condition:_optionalChain([t, 'optionalAccess', _55 => _55.where]),offset:_optionalChain([t, 'optionalAccess', _56 => _56.offset]),limit:_optionalChain([t, 'optionalAccess', _57 => _57.limit]),order_by:_optionalChain([t, 'optionalAccess', _58 => _58.orderBy])}};return(await f({aptosConfig:e,query:r,originMethod:"getTableItemsData"})).table_items}async function _o(n){let{aptosConfig:e,options:t}=n,r={query:bo,variables:{where_condition:_optionalChain([t, 'optionalAccess', _59 => _59.where]),offset:_optionalChain([t, 'optionalAccess', _60 => _60.offset]),limit:_optionalChain([t, 'optionalAccess', _61 => _61.limit]),order_by:_optionalChain([t, 'optionalAccess', _62 => _62.orderBy])}};return(await f({aptosConfig:e,query:r,originMethod:"getTableItemsMetadata"})).table_metadatas}async function Ee(n){let{aptosConfig:e,accountAddress:t}=n,{data:r}=await Q({aptosConfig:e,originMethod:"getInfo",path:`accounts/${u.from(t).toString()}`});return r}async function Co(n){let{aptosConfig:e,accountAddress:t,options:r}=n;return xt({aptosConfig:e,originMethod:"getModules",path:`accounts/${u.from(t).toString()}/modules`,params:{ledger_version:_optionalChain([r, 'optionalAccess', _63 => _63.ledgerVersion]),start:_optionalChain([r, 'optionalAccess', _64 => _64.offset]),limit:_nullishCoalesce(_optionalChain([r, 'optionalAccess', _65 => _65.limit]), () => (1e3))}})}async function nr(n){return _optionalChain([n, 'access', _66 => _66.options, 'optionalAccess', _67 => _67.ledgerVersion])!==void 0?Po(n):_e(async()=>Po(n),`module-${n.accountAddress}-${n.moduleName}`,1e3*60*5)()}async function Po(n){let{aptosConfig:e,accountAddress:t,moduleName:r,options:i}=n,{data:o}=await Q({aptosConfig:e,originMethod:"getModule",path:`accounts/${u.from(t).toString()}/module/${r}`,params:{ledger_version:_optionalChain([i, 'optionalAccess', _68 => _68.ledgerVersion])}});return o}async function Eo(n){let{aptosConfig:e,accountAddress:t,options:r}=n;return xt({aptosConfig:e,originMethod:"getTransactions",path:`accounts/${u.from(t).toString()}/transactions`,params:{start:_optionalChain([r, 'optionalAccess', _69 => _69.offset]),limit:_optionalChain([r, 'optionalAccess', _70 => _70.limit])}})}async function Io(n){let{aptosConfig:e,accountAddress:t,options:r}=n;return xt({aptosConfig:e,originMethod:"getResources",path:`accounts/${u.from(t).toString()}/resources`,params:{ledger_version:_optionalChain([r, 'optionalAccess', _71 => _71.ledgerVersion]),start:_optionalChain([r, 'optionalAccess', _72 => _72.offset]),limit:_nullishCoalesce(_optionalChain([r, 'optionalAccess', _73 => _73.limit]), () => (999))}})}async function jr(n){let{aptosConfig:e,accountAddress:t,resourceType:r,options:i}=n,{data:o}=await Q({aptosConfig:e,originMethod:"getResource",path:`accounts/${u.from(t).toString()}/resource/${r}`,params:{ledger_version:_optionalChain([i, 'optionalAccess', _74 => _74.ledgerVersion])}});return o.data}async function Nt(n){let{aptosConfig:e,authenticationKey:t,options:r}=n,i=await jr({aptosConfig:e,accountAddress:"0x1",resourceType:"0x1::account::OriginatingAddress",options:r}),{address_map:{handle:o}}=i,s=u.from(t);try{let a=await tr({aptosConfig:e,handle:o,data:{key:s.toString(),key_type:"address",value_type:"address"},options:r});return u.from(a)}catch(a){if(a instanceof be&&a.data.error_code==="table_item_not_found")return s;throw a}}async function Uo(n){let{aptosConfig:e,accountAddress:t}=n,i={owner_address:{_eq:u.from(t).toStringLong()},amount:{_gt:0}},s=await f({aptosConfig:e,query:{query:co,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 Ro(n){let{aptosConfig:e,accountAddress:t,options:r}=n,o={owner_address:{_eq:u.from(t).toStringLong()},amount:{_gt:0}};_optionalChain([r, 'optionalAccess', _75 => _75.tokenStandard])&&(o.token_standard={_eq:_optionalChain([r, 'optionalAccess', _76 => _76.tokenStandard])});let s={query:so,variables:{where_condition:o,offset:_optionalChain([r, 'optionalAccess', _77 => _77.offset]),limit:_optionalChain([r, 'optionalAccess', _78 => _78.limit]),order_by:_optionalChain([r, 'optionalAccess', _79 => _79.orderBy])}};return(await f({aptosConfig:e,query:s,originMethod:"getAccountOwnedTokens"})).current_token_ownerships_v2}async function Ko(n){let{aptosConfig:e,accountAddress:t,collectionAddress:r,options:i}=n,o=u.from(t).toStringLong(),s=u.from(r).toStringLong(),a={owner_address:{_eq:o},current_token_data:{collection_id:{_eq:s}},amount:{_gt:0}};_optionalChain([i, 'optionalAccess', _80 => _80.tokenStandard])&&(a.token_standard={_eq:_optionalChain([i, 'optionalAccess', _81 => _81.tokenStandard])});let c={query:ao,variables:{where_condition:a,offset:_optionalChain([i, 'optionalAccess', _82 => _82.offset]),limit:_optionalChain([i, 'optionalAccess', _83 => _83.limit]),order_by:_optionalChain([i, 'optionalAccess', _84 => _84.orderBy])}};return(await f({aptosConfig:e,query:c,originMethod:"getAccountOwnedTokensFromCollectionAddress"})).current_token_ownerships_v2}async function zo(n){let{aptosConfig:e,accountAddress:t,options:r}=n,o={owner_address:{_eq:u.from(t).toStringLong()}};_optionalChain([r, 'optionalAccess', _85 => _85.tokenStandard])&&(o.current_collection={token_standard:{_eq:_optionalChain([r, 'optionalAccess', _86 => _86.tokenStandard])}});let s={query:oo,variables:{where_condition:o,offset:_optionalChain([r, 'optionalAccess', _87 => _87.offset]),limit:_optionalChain([r, 'optionalAccess', _88 => _88.limit]),order_by:_optionalChain([r, 'optionalAccess', _89 => _89.orderBy])}};return(await f({aptosConfig:e,query:s,originMethod:"getAccountCollectionsWithOwnedTokens"})).current_collection_ownership_v2_view}async function ko(n){let{aptosConfig:e,accountAddress:t}=n,r=u.from(t).toStringLong(),o=await f({aptosConfig:e,query:{query:uo,variables:{address:r}},originMethod:"getAccountTransactionsCount"});return o.account_transactions_aggregate.aggregate?o.account_transactions_aggregate.aggregate.count:0}async function Do(n){let{aptosConfig:e,accountAddress:t,options:r}=n,i=u.from(t).toStringLong(),o={..._optionalChain([r, 'optionalAccess', _90 => _90.where]),owner_address:{_eq:i}},s={query:io,variables:{where_condition:o,offset:_optionalChain([r, 'optionalAccess', _91 => _91.offset]),limit:_optionalChain([r, 'optionalAccess', _92 => _92.limit]),order_by:_optionalChain([r, 'optionalAccess', _93 => _93.orderBy])}};return(await f({aptosConfig:e,query:s,originMethod:"getAccountCoinsData"})).current_fungible_asset_balances}async function Bo(n){let{aptosConfig:e,accountAddress:t}=n,r=u.from(t).toStringLong(),o=await f({aptosConfig:e,query:{query:ro,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 Go(n){let{aptosConfig:e,accountAddress:t,options:r}=n,o={owner_address:{_eq:u.from(t).toStringLong()}},s={query:Zn,variables:{where_condition:o,offset:_optionalChain([r, 'optionalAccess', _94 => _94.offset]),limit:_optionalChain([r, 'optionalAccess', _95 => _95.limit]),order_by:_optionalChain([r, 'optionalAccess', _96 => _96.orderBy])}};return(await f({aptosConfig:e,query:s,originMethod:"getAccountOwnedObjects"})).current_objects}async function Fo(n){let{aptosConfig:e,privateKey:t}=n,r=new k(t.publicKey());if(t instanceof ot){let o=B.fromPublicKey({publicKey:r}).derivedAddress();return je.fromPrivateKey({privateKey:t,address:o})}if(t instanceof j){let i=B.fromPublicKey({publicKey:r});if(await vo({authKey:i,aptosConfig:e})){let c=i.derivedAddress();return je.fromPrivateKey({privateKey:t,address:c,legacy:!1})}let s=B.fromPublicKey({publicKey:r.publicKey});if(await vo({authKey:s,aptosConfig:e})){let c=s.derivedAddress();return je.fromPrivateKey({privateKey:t,address:c,legacy:!0})}}throw new Error(`Can't derive account from private key ${t}`)}async function vo(n){let{aptosConfig:e,authKey:t}=n,r=await Nt({aptosConfig:e,authenticationKey:t.derivedAddress()});try{return await Ee({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 Zr(n){let{aptosConfig:e,options:t}=n;return xt({aptosConfig:e,originMethod:"getTransactions",path:"transactions",params:{start:_optionalChain([t, 'optionalAccess', _97 => _97.offset]),limit:_optionalChain([t, 'optionalAccess', _98 => _98.limit])}})}async function ir(n){let{aptosConfig:e}=n;return _e(async()=>{let{data:t}=await Q({aptosConfig:e,originMethod:"getGasPriceEstimation",path:"estimate_gas_price"});return t},`gas-price-${e.network}`,1e3*60*5)()}async function Oo(n){let{aptosConfig:e,ledgerVersion:t}=n,{data:r}=await Q({aptosConfig:e,originMethod:"getTransactionByVersion",path:`transactions/by_version/${t}`});return r}async function un(n){let{aptosConfig:e,transactionHash:t}=n,{data:r}=await Q({aptosConfig:e,path:`transactions/by_hash/${t}`,originMethod:"getTransactionByHash"});return r}async function No(n){let{aptosConfig:e,transactionHash:t}=n;try{return(await un({aptosConfig:e,transactionHash:t})).type==="pending_transaction"}catch(r){if(_optionalChain([r, 'optionalAccess', _99 => _99.status])===404)return!0;throw r}}async function hc(n){let{aptosConfig:e,transactionHash:t}=n,{data:r}=await Q({aptosConfig:e,path:`transactions/wait_by_hash/${t}`,originMethod:"longWaitForTransaction"});return r}async function Mt(n){let{aptosConfig:e,transactionHash:t,options:r}=n,i=_nullishCoalesce(_optionalChain([r, 'optionalAccess', _100 => _100.timeoutSecs]), () => (20)),o=_nullishCoalesce(_optionalChain([r, 'optionalAccess', _101 => _101.checkSuccess]), () => (!0)),s=!0,a=0,c,p,d=200,T=1.5;function w(g){if(!(g instanceof be)||(p=g,g.status!==404&&g.status>=400&&g.status<500))throw g}try{c=await un({aptosConfig:e,transactionHash:t}),s=c.type==="pending_transaction"}catch(g){w(g)}if(s){let g=Date.now();try{c=await hc({aptosConfig:e,transactionHash:t}),s=c.type==="pending_transaction"}catch(E){w(E)}a=(Date.now()-g)/1e3}for(;s&&!(a>=i);){try{if(c=await un({aptosConfig:e,transactionHash:t}),s=c.type==="pending_transaction",!s)break}catch(g){w(g)}await _chunk7IYTZDXVjs.b.call(void 0, d),a+=d/1e3,d*=T}if(c===void 0)throw p||new rr(`Fetching transaction ${t} failed and timed out after ${i} seconds`,c);if(c.type==="pending_transaction")throw new rr(`Transaction ${t} timed out in pending state after ${i} seconds`,c);if(!o)return c;if(!c.success)throw new Xr(`Transaction ${t} failed with an error: ${c.vm_status}`,c);return c}async function or(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 Jn({aptosConfig:e}):s=(await er({aptosConfig:e,processorType:t})).last_success_version,s>=r)break;await _chunk7IYTZDXVjs.b.call(void 0, 200)}}var rr=class extends Error{constructor(e,t){super(e),this.lastSubmittedTransaction=t}},Xr=class extends Error{constructor(e,t){super(e),this.transaction=t}};async function Mo(n){let{aptosConfig:e,ledgerVersion:t,options:r}=n,{data:i}=await Q({aptosConfig:e,originMethod:"getBlockByVersion",path:`blocks/by_version/${t}`,params:{with_transactions:_optionalChain([r, 'optionalAccess', _102 => _102.withTransactions])}});return Vo({block:i,...n})}async function qo(n){let{aptosConfig:e,blockHeight:t,options:r}=n,{data:i}=await Q({aptosConfig:e,originMethod:"getBlockByHeight",path:`blocks/by_height/${t}`,params:{with_transactions:_optionalChain([r, 'optionalAccess', _103 => _103.withTransactions])}});return Vo({block:i,...n})}async function Vo(n){let{aptosConfig:e,block:t,options:r}=n;if(_optionalChain([r, 'optionalAccess', _104 => _104.withTransactions])){t.transactions=_nullishCoalesce(t.transactions, () => ([]));let i=t.transactions[t.transactions.length-1],o=BigInt(t.first_version),s=BigInt(t.last_version),a=_optionalChain([i, 'optionalAccess', _105 => _105.version]),c;if(a===void 0?c=o-1n:c=BigInt(a),c===s)return t;let p=[],d=100n;for(let w=c+1n;w<s;w+=BigInt(100))p.push(Zr({aptosConfig:e,options:{offset:w,limit:Math.min(Number(d),Number(s-w+1n))}}));let T=await Promise.all(p);for(let w of T)t.transactions.push(...w)}return t}async function A(n){n.minimumLedgerVersion!==void 0&&await or({aptosConfig:n.config,minimumLedgerVersion:n.minimumLedgerVersion,processorType:n.processorType})}function $o(n){return typeof n=="boolean"}function Xe(n){return typeof n=="string"}function bc(n){return typeof n=="number"}function sr(n){if(bc(n))return n;if(Xe(n)&&n!=="")return Number.parseInt(n,10)}function ar(n){return typeof n=="number"||typeof n=="bigint"||typeof n=="string"}function Lo(n){return n==null}function Ho(n){return Yr(n)||ei(n)||ti(n)||ni(n)||ri(n)||ii(n)||oi(n)||cr(n)||Jr(n)||Tc(n)||n instanceof h||n instanceof H}function Yr(n){return n instanceof U}function cr(n){return n instanceof u}function Jr(n){return n instanceof S}function Tc(n){return n instanceof nt}function ei(n){return n instanceof L}function ti(n){return n instanceof fe}function ni(n){return n instanceof Ae}function ri(n){return n instanceof M}function ii(n){return n instanceof he}function oi(n){return n instanceof ae}function Qo(n){return"bytecode"in n}function R(n,e){throw new Error(`Type mismatch for argument ${e}, expected '${n}'`)}function Wo(n){let e=n.params.findIndex(t=>t!=="signer"&&t!=="&signer");return e<0?n.params.length:e}function pn(n){let e=n.split("::");if(e.length!==3)throw new Error(`Invalid function ${n}`);let t=e[0],r=e[1],i=e[2];return{moduleAddress:t,moduleName:r,functionName:i}}function jo(n){return!!n.match(/^[_a-zA-Z0-9]+$/)}function Xo(n){return!!n.match(/\s/)}function wc(n){return!!n.match(/^T[0-9]+$/)}function Sc(n){return!!n.match(/^&.+$/)}function xc(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 _c(n,e){let t=e;for(;t<n.length;t+=1){let r=n[t];if(!Xo(r))break}return t}var Pc=(E=>(E.InvalidTypeTag="unknown type",E.UnexpectedGenericType="unexpected generic type",E.UnexpectedTypeArgumentClose="unexpected '>'",E.UnexpectedWhitespaceCharacter="unexpected whitespace character",E.UnexpectedComma="unexpected ','",E.TypeArgumentCountMismatch="type argument count doesn't match expected amount",E.MissingTypeArgumentClose="no matching '>' for '<'",E.MissingTypeArgument="no type argument before ','",E.UnexpectedPrimitiveTypeArguments="primitive types not expected to have type arguments",E.UnexpectedVectorTypeArgumentCount="vector type expected to have exactly one type argument",E.UnexpectedStructFormat="unexpected struct format, must be of the form 0xaddress::module_name::struct_name",E.InvalidModuleNameCharacter="module name must only contain alphanumeric or '_' characters",E.InvalidStructNameCharacter="struct name must only contain alphanumeric or '_' characters",E.InvalidAddress="struct address must be valid",E))(Pc||{}),N= exports.TypeTagParserError =class extends Error{constructor(e,t){super(`Failed to parse typeTag '${e}', ${t}`)}};function Ne(n,e){let t=_nullishCoalesce(_optionalChain([e, 'optionalAccess', _106 => _106.allowGenerics]), () => (!1)),r=[],i=[],o=[],s=0,a="",c=1;for(;s<n.length;){let p=n[s];if(p==="<")r.push({savedExpectedTypes:c,savedStr:a,savedTypes:o}),a="",o=[],c=1;else if(p===">"){if(a!==""){let E=dn(a,i,t);o.push(E)}let d=r.pop();if(d===void 0)throw new N(n,"unexpected '>'");if(c!==o.length)throw new N(n,"type argument count doesn't match expected amount");let{savedStr:T,savedTypes:w,savedExpectedTypes:g}=d;i=o,o=w,a=T,c=g}else if(p===","){if(r.length===0)throw new N(n,"unexpected ','");if(a.length===0)throw new N(n,"no type argument before ','");let d=dn(a,i,t);i=[],o.push(d),a="",c+=1}else if(Xo(p)){let d=!1;if(a.length!==0){let w=dn(a,i,t);i=[],o.push(w),a="",d=!0}s=_c(n,s);let T=n[s];if(s<n.length&&d&&T!==","&&T!==">")throw new N(n,"unexpected whitespace character");continue}else a+=p;s+=1}if(r.length>0)throw new N(n,"no matching '>' for '<'");switch(o.length){case 0:return dn(a,i,t);case 1:if(a==="")return o[0];throw new N(n,"unexpected ','");default:throw new N(n,"unexpected whitespace character")}}function dn(n,e,t){let r=n.trim(),i=r.toLowerCase();if(xc(i)&&e.length>0)throw new N(n,"primitive types not expected to have type arguments");switch(r.toLowerCase()){case"signer":return new pt;case"bool":return new D;case"address":return new W;case"u8":return new ie;case"u16":return new De;case"u32":return new Be;case"u64":return new q;case"u128":return new Ge;case"u256":return new Fe;case"vector":if(e.length!==1)throw new N(n,"vector type expected to have exactly one type argument");return new C(e[0]);default:if(Sc(r)){let a=r.substring(1);return new $n(dn(a,e,t))}if(wc(r)){if(t)return new z(Number(r.split("T")[1]));throw new N(n,"unexpected generic type")}if(!r.match(/:/))throw new N(n,"unknown type");let o=r.split("::");if(o.length!==3)throw new N(n,"unexpected struct format, must be of the form 0xaddress::module_name::struct_name");let s;try{s=u.fromString(o[0])}catch (e2){throw new N(n,"struct address must be valid")}if(!jo(o[1]))throw new N(n,"module name must only contain alphanumeric or '_' characters");if(!jo(o[2]))throw new N(n,"struct name must only contain alphanumeric or '_' characters");return new y(new Ce(s,new I(o[1]),new I(o[2]),e))}}var vc=new TextEncoder;function ur(n){return _nullishCoalesce(_optionalChain([n, 'optionalAccess', _107 => _107.map, 'call', _108 => _108(e=>Xe(e)?Ne(e):e)]), () => ([]))}async function Zo(n,e,t,r){let i=await nr({aptosConfig:r,accountAddress:n,moduleName:e});if(i.abi)return i.abi.exposed_functions.find(o=>o.name===t)}async function Yo(n,e,t,r){let i=await Zo(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=Wo(i),s=[];for(let a=o;a<i.params.length;a+=1)s.push(Ne(i.params[a],{allowGenerics:!0}));return{signers:o,typeParameters:i.generic_type_params,parameters:s}}async function Jo(n,e,t,r){let i=await Zo(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(Ne(i.params[a],{allowGenerics:!0}));let s=[];for(let a=0;a<i.return.length;a+=1)s.push(Ne(i.return[a],{allowGenerics:!0}));return{typeParameters:i.generic_type_params,parameters:o,returnTypes:s}}function ai(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 qt(t,o,r,i)}function qt(n,e,t,r){return Ho(n)?(si(e,n,t),n):Cc(n,e,t,r)}function Cc(n,e,t,r){if(e.isBool()){if($o(n))return new U(n);if(Xe(n)){if(n==="true")return new U(!0);if(n==="false")return new U(!1)}R("boolean",t)}if(e.isAddress()){if(Xe(n))return u.fromString(n);R("string | AccountAddress",t)}if(e.isU8()){let i=sr(n);if(i!==void 0)return new L(i);R("number | string",t)}if(e.isU16()){let i=sr(n);if(i!==void 0)return new fe(i);R("number | string",t)}if(e.isU32()){let i=sr(n);if(i!==void 0)return new Ae(i);R("number | string",t)}if(e.isU64()){if(ar(n))return new M(BigInt(n));R("bigint | number | string",t)}if(e.isU128()){if(ar(n))return new he(BigInt(n));R("bigint | number | string",t)}if(e.isU256()){if(ar(n))return new ae(BigInt(n));R("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 qt(n,r[i],t,r)}if(e.isVector()){if(e.value.isU8()){if(Xe(n))return h.U8(vc.encode(n));if(n instanceof Uint8Array)return h.U8(n);if(n instanceof ArrayBuffer)return h.U8(new Uint8Array(n))}if(Array.isArray(n))return new h(n.map(i=>qt(i,e.value,t,r)));throw new Error(`Type mismatch for argument ${t}, type '${e.toString()}'`)}if(e.isStruct()){if(e.isString()){if(Xe(n))return new S(n);R("string",t)}if(e.isObject()){if(Xe(n))return u.fromString(n);R("string | AccountAddress",t)}if(e.isOption()){if(Lo(n)){let i=e.value.typeArgs[0];return i instanceof D?new H(null):i instanceof W?new H(null):i instanceof ie?new H(null):i instanceof De?new H(null):i instanceof Be?new H(null):i instanceof q?new H(null):i instanceof Ge?new H(null):i instanceof Fe?new H(null):new H(null)}return new H(qt(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 si(n,e,t){if(n.isBool()){if(Yr(e))return;R("Bool",t)}if(n.isAddress()){if(cr(e))return;R("AccountAddress",t)}if(n.isU8()){if(ei(e))return;R("U8",t)}if(n.isU16()){if(ti(e))return;R("U16",t)}if(n.isU32()){if(ni(e))return;R("U32",t)}if(n.isU64()){if(ri(e))return;R("U64",t)}if(n.isU128()){if(ii(e))return;R("U128",t)}if(n.isU256()){if(oi(e))return;R("U256",t)}if(n.isVector()){if(e instanceof h){e.values.length>0&&si(n.value,e.values[0],t);return}R("MoveVector",t)}if(n instanceof y){if(n.isString()){if(Jr(e))return;R("MoveString",t)}if(n.isObject()){if(cr(e))return;R("AccountAddress",t)}if(n.isOption()){if(e instanceof H){e.value!==void 0&&si(n.value.typeArgs[0],e.value,t);return}R("MoveOption",t)}}throw new Error(`Type mismatch for argument ${t}, expected '${n.toString()}'`)}async function dr(n){if(Qo(n))return Rc(n);let{moduleAddress:e,moduleName:t,functionName:r}=pn(n.function),i=await rs({key:"entry-function",moduleAddress:e,moduleName:t,functionName:r,aptosConfig:n.aptosConfig,abi:n.abi,fetch:Yo});return Ic({...n,abi:i})}function Ic(n){let e=n.abi,{moduleAddress:t,moduleName:r,functionName:i}=pn(n.function),o=ur(n.typeArguments);if(o.length!==e.typeParameters.length)throw new Error(`Type argument count mismatch, expected ${e.typeParameters.length}, received ${o.length}`);let s=n.functionArguments.map((c,p)=>ai(n.function,e,c,p,o));if(s.length!==e.parameters.length)throw new Error(`Too few arguments for '${t}::${r}::${i}', expected ${e.parameters.length} but got ${s.length}`);let a=lt.build(`${t}::${r}`,i,o,s);if("multisigAddress"in n){let c=u.from(n.multisigAddress);return new rn(new sn(c,new an(a)))}return new nn(a)}async function es(n){let{moduleAddress:e,moduleName:t,functionName:r}=pn(n.function),i=await rs({key:"view-function",moduleAddress:e,moduleName:t,functionName:r,aptosConfig:n.aptosConfig,abi:n.abi,fetch:Jo});return Uc({abi:i,...n})}function Uc(n){let e=n.abi,{moduleAddress:t,moduleName:r,functionName:i}=pn(n.function),o=ur(n.typeArguments);if(o.length!==e.typeParameters.length)throw new Error(`Type argument count mismatch, expected ${e.typeParameters.length}, received ${o.length}`);let s=_nullishCoalesce(_optionalChain([n, 'optionalAccess', _109 => _109.functionArguments, 'optionalAccess', _110 => _110.map, 'call', _111 => _111((a,c)=>ai(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 lt.build(`${t}::${r}`,i,o,s)}function Rc(n){return new tn(new on(m.fromHexInput(n.bytecode).toUint8Array(),ur(n.typeArguments),n.functionArguments))}async function Kc(n){let{aptosConfig:e,sender:t,payload:r,options:i,feePayerAddress:o}=n,s=async()=>Fr[e.network]?{chainId:Fr[e.network]}:{chainId:(await Yn({aptosConfig:e})).chain_id},a=async()=>_optionalChain([i, 'optionalAccess', _112 => _112.gasUnitPrice])?{gasEstimate:i.gasUnitPrice}:{gasEstimate:(await ir({aptosConfig:e})).gas_estimate},c=async()=>{let At=async()=>_optionalChain([i, 'optionalAccess', _113 => _113.accountSequenceNumber])!==void 0?i.accountSequenceNumber:(await Ee({aptosConfig:e,accountAddress:t})).sequence_number;if(o&&u.from(o).equals(u.ZERO))try{return await At()}catch (e3){return 0}else return At()},[{chainId:p},{gasEstimate:d},T]=await Promise.all([s(),a(),c()]),{maxGasAmount:w,gasUnitPrice:g,expireTimestamp:E}={maxGasAmount:_optionalChain([i, 'optionalAccess', _114 => _114.maxGasAmount])?BigInt(i.maxGasAmount):BigInt(2e5),gasUnitPrice:_nullishCoalesce(_optionalChain([i, 'optionalAccess', _115 => _115.gasUnitPrice]), () => (BigInt(d))),expireTimestamp:_nullishCoalesce(_optionalChain([i, 'optionalAccess', _116 => _116.expireTimestamp]), () => (BigInt(Math.floor(Date.now()/1e3)+20)))};return new de(u.from(t),BigInt(T),r,BigInt(w),BigInt(g),BigInt(E),new Ct(p))}async function ci(n){let{aptosConfig:e,sender:t,payload:r,options:i,feePayerAddress:o}=n,s=await Kc({aptosConfig:e,sender:t,payload:r,options:i,feePayerAddress:o});if("secondarySignerAddresses"in n){let a=_nullishCoalesce(_optionalChain([n, 'access', _117 => _117.secondarySignerAddresses, 'optionalAccess', _118 => _118.map, 'call', _119 => _119(c=>u.from(c))]), () => ([]));return new Wn(s,a,n.feePayerAddress?u.from(n.feePayerAddress):void 0)}return new Qn(s,n.feePayerAddress?u.from(n.feePayerAddress):void 0)}function ts(n){let{signerPublicKey:e,transaction:t,secondarySignersPublicKeys:r,feePayerPublicKey:i}=n,o=pr(e);if(t.feePayerAddress){let a=new mt(t.rawTransaction,_nullishCoalesce(t.secondarySignerAddresses, () => ([])),t.feePayerAddress),c=[];if(r&&(c=r.map(T=>pr(T))),!i)throw new Error("Must provide a feePayerPublicKey argument to generate a signed fee payer transaction for simulation");let p=pr(i),d=new Ut(o,_nullishCoalesce(t.secondarySignerAddresses, () => ([])),c,{address:t.feePayerAddress,authenticator:p});return new yt(a.raw_txn,d).bcsToBytes()}if(t.secondarySignerAddresses){let a=new gt(t.rawTransaction,t.secondarySignerAddresses),c=[];if(!r)throw new Error("Must provide a secondarySignersPublicKeys argument to generate a signed multi agent transaction for simulation");c=r.map(d=>pr(d));let p=new It(o,t.secondarySignerAddresses,c);return new yt(a.raw_txn,p).bcsToBytes()}let s;if(o instanceof we)s=new Et(o.public_key,o.signature);else if(o instanceof te||o instanceof ve)s=new Rt(o);else throw new Error("Invalid public key");return new yt(t.rawTransaction,s).bcsToBytes()}function pr(n){let t=F.isInstance(n)||Te.isInstance(n)||Ue.isInstance(n)?new k(n):n,r=new v(new Uint8Array(64));if(_.isInstance(t))return new we(t,r);if(k.isInstance(t))return F.isInstance(t.publicKey)?new te(t,new O(ze.getSimulationSignature())):new te(t,new O(r));if(We.isInstance(t))return new ve(t,new ke({signatures:t.publicKeys.map(()=>new O(r)),bitmap:t.createBitmap({bits:Array(t.publicKeys.length).fill(0).map((i,o)=>o)})}));throw new Error("Unsupported PublicKey used for simulations")}function ui(n){let{transaction:e,feePayerAuthenticator:t,additionalSignersAuthenticators:r}=n,i=ji(X,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 Ut(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 we?o=new Et(i.public_key,i.signature):o=new Rt(i);return new yt(e.rawTransaction,o).bcsToBytes()}function ns(n){let e=_sha3.sha3_256.create();for(let t of n)e.update(t);return e.digest()}var zc=ns(["APTOS::Transaction"]);function jh(n){let e=ui(n);return new m(ns([zc,new Uint8Array([0]),e])).toString()}async function rs({key:n,moduleAddress:e,moduleName:t,functionName:r,aptosConfig:i,abi:o,fetch:s}){return o!==void 0?o:_e(async()=>s(e,t,r,i),`${n}-${i.network}-${e}-${t}-${r}`,1e3*60*5)()}async function ge(n){let{aptosConfig:e,payload:t,options:r}=n,i=await es({...t,aptosConfig:e}),o=new $;i.serialize(o);let s=o.toUint8Array(),{data:a}=await Qe({aptosConfig:e,path:"view",originMethod:"view",contentType:"application/x.aptos.view_function+bcs",params:{ledger_version:_optionalChain([r, 'optionalAccess', _120 => _120.ledgerVersion])},body:s});return a}async function is(n){let{aptosConfig:e,payload:t,options:r}=n,{data:i}=await Qe({aptosConfig:e,originMethod:"viewJson",path:"view",params:{ledger_version:_optionalChain([r, 'optionalAccess', _121 => _121.ledgerVersion])},body:{function:t.function,type_arguments:_nullishCoalesce(t.typeArguments, () => ([])),arguments:_nullishCoalesce(t.functionArguments, () => ([]))}});return i}var ln=class{constructor(e){this.config=e}async getAccountInfo(e){return Ee({aptosConfig:this.config,...e})}async getAccountModules(e){return Co({aptosConfig:this.config,...e})}async getAccountModule(e){return nr({aptosConfig:this.config,...e})}async getAccountTransactions(e){return Eo({aptosConfig:this.config,...e})}async getAccountResources(e){return Io({aptosConfig:this.config,...e})}async getAccountResource(e){return jr({aptosConfig:this.config,...e})}async lookupOriginalAccountAddress(e){return Nt({aptosConfig:this.config,...e})}async getAccountTokensCount(e){return await A({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"account_transactions_processor"}),Uo({aptosConfig:this.config,...e})}async getAccountOwnedTokens(e){return await A({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),Ro({aptosConfig:this.config,...e})}async getAccountOwnedTokensFromCollectionAddress(e){return await A({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),Ko({aptosConfig:this.config,...e})}async getAccountCollectionsWithOwnedTokens(e){return await A({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),zo({aptosConfig:this.config,...e})}async getAccountTransactionsCount(e){return await A({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"account_transactions_processor"}),ko({aptosConfig:this.config,...e})}async getAccountCoinsData(e){return await A({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"fungible_asset_processor"}),Do({aptosConfig:this.config,...e})}async getAccountCoinsCount(e){return await A({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"fungible_asset_processor"}),Bo({aptosConfig:this.config,...e})}async getAccountAPTAmount(e){return this.getAccountCoinAmount({coinType:ct,faMetadataAddress:Vi,...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
|
|
473
|
+
compatibility see https://github.com/aptos-labs/aptos-ts-sdk/pull/519,
|
|
474
|
+
will be removed in the near future`);let s=r;r===void 0&&i!==void 0&&(s=await _e(async()=>{try{let p=(await ge({aptosConfig:this.config,payload:{function:"0x1::coin::paired_coin",functionArguments:[i]}})).at(0);if(p.vec.length>0&&_chunk7IYTZDXVjs.i.call(void 0, p.vec[0]))return _chunk7IYTZDXVjs.h.call(void 0, p.vec[0])}catch (e4){}},`coin-mapping-${i.toString()}`,1e3*60*5)());let a;if(r!==void 0&&i!==void 0)a=u.from(i).toStringLong();else if(r!==void 0&&i===void 0)r===ct?a=u.A.toStringLong():a=Vn(u.A,r).toStringLong();else if(r===void 0&&i!==void 0){let p=u.from(i);a=p.toStringLong(),p===u.A&&(s=ct)}else throw new Error("Either coinType, faMetadataAddress, or both must be provided");if(s!==void 0){let[p]=await ge({aptosConfig:this.config,payload:{function:"0x1::coin::balance",typeArguments:[s],functionArguments:[t]}});return parseInt(p,10)}let[c]=await ge({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 A({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"default_processor"}),Go({aptosConfig:this.config,...e})}async deriveAccountFromPrivateKey(e){return Fo({aptosConfig:this.config,...e})}};var _aptosclient = require('@aptos-labs/aptos-client'); var _aptosclient2 = _interopRequireDefault(_aptosclient);var lr=class{constructor(e){this.network=_nullishCoalesce(_optionalChain([e, 'optionalAccess', _122 => _122.network]), () => ("devnet")),this.fullnode=_optionalChain([e, 'optionalAccess', _123 => _123.fullnode]),this.faucet=_optionalChain([e, 'optionalAccess', _124 => _124.faucet]),this.pepper=_optionalChain([e, 'optionalAccess', _125 => _125.pepper]),this.prover=_optionalChain([e, 'optionalAccess', _126 => _126.prover]),this.indexer=_optionalChain([e, 'optionalAccess', _127 => _127.indexer]),this.client=_nullishCoalesce(_optionalChain([e, 'optionalAccess', _128 => _128.client]), () => ({provider:_aptosclient2.default})),this.clientConfig=_nullishCoalesce(_optionalChain([e, 'optionalAccess', _129 => _129.clientConfig]), () => ({})),this.fullnodeConfig=_nullishCoalesce(_optionalChain([e, 'optionalAccess', _130 => _130.fullnodeConfig]), () => ({})),this.indexerConfig=_nullishCoalesce(_optionalChain([e, 'optionalAccess', _131 => _131.indexerConfig]), () => ({})),this.faucetConfig=_nullishCoalesce(_optionalChain([e, 'optionalAccess', _132 => _132.faucetConfig]), () => ({}))}getRequestUrl(e){switch(e){case"Fullnode":if(this.fullnode!==void 0)return this.fullnode;if(this.network==="custom")throw new Error("Please provide a custom full node url");return Qi[this.network];case"Faucet":if(this.faucet!==void 0)return this.faucet;if(this.network==="custom")throw new Error("Please provide a custom faucet url");return Wi[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 Hi[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 Dr[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 Br[this.network];default:throw Error(`apiType ${e} is not supported`)}}isPepperServiceRequest(e){return Dr[this.network]===e}isProverServiceRequest(e){return Br[this.network]===e}};async function b(n){let e=await Dc(n);return Bc(n,e)}async function Dc(n){let{aptosConfig:e,data:t}=n,r,i;return"bytecode"in t?i=await dr(t):"multisigAddress"in t?(r={aptosConfig:e,multisigAddress:t.multisigAddress,function:t.function,functionArguments:t.functionArguments,typeArguments:t.typeArguments,abi:t.abi},i=await dr(r)):(r={aptosConfig:e,function:t.function,functionArguments:t.functionArguments,typeArguments:t.typeArguments,abi:t.abi},i=await dr(r)),i}async function Bc(n,e){let{aptosConfig:t,sender:r,options:i}=n,o;if(Gc(n)&&(o=u.ZERO.toString()),Fc(n)){let{secondarySignerAddresses:s}=n;return ci({aptosConfig:t,sender:r,payload:e,options:i,secondarySignerAddresses:s,feePayerAddress:o})}return ci({aptosConfig:t,sender:r,payload:e,options:i,feePayerAddress:o})}function Gc(n){return n.withFeePayer===!0}function Fc(n){return"secondarySignerAddresses"in n}function os(n){let{transaction:e}=n;return zt(e)}function gr(n){let{signer:e,transaction:t}=n;return e.signTransactionWithAuthenticator(t)}function mr(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,gr({signer:e,transaction:t})}async function pi(n){let{aptosConfig:e,transaction:t,signerPublicKey:r,secondarySignersPublicKeys:i,feePayerPublicKey:o,options:s}=n,a=ts({transaction:t,signerPublicKey:r,secondarySignersPublicKeys:i,feePayerPublicKey:o,options:s}),{data:c}=await Qe({aptosConfig:e,body:a,path:"transactions/simulate",params:{estimate_gas_unit_price:_nullishCoalesce(_optionalChain([n, 'access', _133 => _133.options, 'optionalAccess', _134 => _134.estimateGasUnitPrice]), () => (!1)),estimate_max_gas_amount:_nullishCoalesce(_optionalChain([n, 'access', _135 => _135.options, 'optionalAccess', _136 => _136.estimateMaxGasAmount]), () => (!1)),estimate_prioritized_gas_unit_price:_nullishCoalesce(_optionalChain([n, 'access', _137 => _137.options, 'optionalAccess', _138 => _138.estimatePrioritizedGasUnitPrice]), () => (!1))},originMethod:"simulateTransaction",contentType:"application/x.aptos.signed_transaction+bcs"});return c}async function gn(n){let{aptosConfig:e}=n,t=ui({...n}),{data:r}=await Qe({aptosConfig:e,body:t,path:"transactions",originMethod:"submitTransaction",contentType:"application/x.aptos.signed_transaction+bcs"});return r}async function mn(n){let{aptosConfig:e,signer:t,feePayer:r,transaction:i}=n;(t instanceof le||t instanceof Ft)&&await t.waitForProofFetch(),(r instanceof le||r instanceof Ft)&&await r.waitForProofFetch();let o=n.feePayerAuthenticator||r&&mr({signer:r,transaction:i}),s=gr({signer:t,transaction:i});return gn({aptosConfig:e,transaction:i,senderAuthenticator:s,feePayerAuthenticator:o})}async function ss(n){let{aptosConfig:e,senderAuthenticator:t,feePayer:r,transaction:i}=n;(r instanceof le||r instanceof Ft)&&await r.waitForProofFetch();let o=mr({signer:r,transaction:i});return gn({aptosConfig:e,transaction:i,senderAuthenticator:t,feePayerAuthenticator:o})}var Oc={typeParameters:[],parameters:[C.u8(),new C(C.u8())]};async function as(n){let{aptosConfig:e,account:t,metadataBytes:r,moduleBytecode:i,options:o}=n,s=i.map(a=>h.U8(a));return b({aptosConfig:e,sender:u.from(t),data:{function:"0x1::code::publish_package_txn",functionArguments:[h.U8(r),new h(s)],abi:Oc},options:o})}var Nc={typeParameters:[],parameters:[new ie,C.u8(),new ie,C.u8(),C.u8(),C.u8()]};async function cs(n){let{aptosConfig:e,fromAccount:t,toNewPrivateKey:r}=n,i=await Ee({aptosConfig:e,accountAddress:t.accountAddress}),o=je.fromPrivateKey({privateKey:r,legacy:!0}),a=new Hn({sequenceNumber:BigInt(i.sequence_number),originator:t.accountAddress,currentAuthKey:u.from(i.authentication_key),newPublicKey:o.publicKey}).bcsToBytes(),c=t.sign(a),p=o.sign(a),d=await b({aptosConfig:e,sender:t.accountAddress,data:{function:"0x1::account::rotate_authentication_key",functionArguments:[new L(t.signingScheme),h.U8(t.publicKey.toUint8Array()),new L(o.signingScheme),h.U8(o.publicKey.toUint8Array()),h.U8(c.toUint8Array()),h.U8(p.toUint8Array())],abi:Nc}});return mn({aptosConfig:e,signer:t,transaction:d})}var Mc={typeParameters:[{constraints:[]}],parameters:[new W,new q]};async function us(n){let{aptosConfig:e,sender:t,recipient:r,amount:i,coinType:o,options:s}=n;return b({aptosConfig:e,sender:t,data:{function:"0x1::aptos_account::transfer_coins",typeArguments:[_nullishCoalesce(o, () => (ct))],functionArguments:[r,i],abi:Mc},options:s})}var yn=class{constructor(e){this.config=e}async transferCoinTransaction(e){return us({aptosConfig:this.config,...e})}};var Ze={BOOLEAN:"bool",U8:"u8",U16:"u16",U32:"u32",U64:"u64",U128:"u128",U256:"u256",ADDRESS:"address",STRING:"0x1::string::String",ARRAY:"vector<u8>"},me="0x4::token::Token";async function ps(n){let{aptosConfig:e,digitalAssetAddress:t}=n,r={token_data_id:{_eq:u.from(t).toStringLong()}};return(await f({aptosConfig:e,query:{query:wo,variables:{where_condition:r}},originMethod:"getDigitalAssetData"})).current_token_datas_v2[0]}async function ds(n){let{aptosConfig:e,digitalAssetAddress:t}=n,r={token_data_id:{_eq:u.from(t).toStringLong()},amount:{_gt:0}};return(await f({aptosConfig:e,query:{query:Wr,variables:{where_condition:r}},originMethod:"getCurrentDigitalAssetOwnership"})).current_token_ownerships_v2[0]}async function ls(n){let{aptosConfig:e,ownerAddress:t,options:r}=n,i={owner_address:{_eq:u.from(t).toStringLong()},amount:{_gt:0}},o={query:Wr,variables:{where_condition:i,offset:_optionalChain([r, 'optionalAccess', _139 => _139.offset]),limit:_optionalChain([r, 'optionalAccess', _140 => _140.limit]),order_by:_optionalChain([r, 'optionalAccess', _141 => _141.orderBy])}};return(await f({aptosConfig:e,query:o,originMethod:"getOwnedDigitalAssets"})).current_token_ownerships_v2}async function gs(n){let{aptosConfig:e,digitalAssetAddress:t,options:r}=n,i={token_data_id:{_eq:u.from(t).toStringLong()}},o={query:To,variables:{where_condition:i,offset:_optionalChain([r, 'optionalAccess', _142 => _142.offset]),limit:_optionalChain([r, 'optionalAccess', _143 => _143.limit]),order_by:_optionalChain([r, 'optionalAccess', _144 => _144.orderBy])}};return(await f({aptosConfig:e,query:o,originMethod:"getDigitalAssetActivity"})).token_activities_v2}var qc={typeParameters:[],parameters:[new y(P()),new q,new y(P()),new y(P()),new D,new D,new D,new D,new D,new D,new D,new D,new D,new q,new q]};async function ms(n){let{aptosConfig:e,options:t,creator:r}=n;return b({aptosConfig:e,sender:r.accountAddress,data:{function:"0x4::aptos_token::create_collection",functionArguments:[new S(n.description),new M(_nullishCoalesce(n.maxSupply, () => (et))),new S(n.name),new S(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 M(_nullishCoalesce(n.royaltyNumerator, () => (0))),new M(_nullishCoalesce(n.royaltyDenominator, () => (1)))],abi:qc},options:t})}async function Vt(n){let{aptosConfig:e,options:t}=n,r=_optionalChain([t, 'optionalAccess', _145 => _145.where]);_optionalChain([t, 'optionalAccess', _146 => _146.tokenStandard])&&(r.token_standard={_eq:_nullishCoalesce(_optionalChain([t, 'optionalAccess', _147 => _147.tokenStandard]), () => ("v2"))});let i={query:lo,variables:{where_condition:r,offset:_optionalChain([t, 'optionalAccess', _148 => _148.offset]),limit:_optionalChain([t, 'optionalAccess', _149 => _149.limit])}};return(await f({aptosConfig:e,query:i,originMethod:"getCollectionData"})).current_collections_v2[0]}async function ys(n){let{aptosConfig:e,creatorAddress:t,collectionName:r,options:i}=n,o=u.from(t),s={collection_name:{_eq:r},creator_address:{_eq:o.toStringLong()}};return _optionalChain([i, 'optionalAccess', _150 => _150.tokenStandard])&&(s.token_standard={_eq:_nullishCoalesce(_optionalChain([i, 'optionalAccess', _151 => _151.tokenStandard]), () => ("v2"))}),Vt({aptosConfig:e,options:{...i,where:s}})}async function fs(n){let{aptosConfig:e,creatorAddress:t,options:r}=n,o={creator_address:{_eq:u.from(t).toStringLong()}};return _optionalChain([r, 'optionalAccess', _152 => _152.tokenStandard])&&(o.token_standard={_eq:_nullishCoalesce(_optionalChain([r, 'optionalAccess', _153 => _153.tokenStandard]), () => ("v2"))}),Vt({aptosConfig:e,options:{...r,where:o}})}async function As(n){let{aptosConfig:e,collectionId:t,options:r}=n,o={collection_id:{_eq:u.from(t).toStringLong()}};return _optionalChain([r, 'optionalAccess', _154 => _154.tokenStandard])&&(o.token_standard={_eq:_nullishCoalesce(_optionalChain([r, 'optionalAccess', _155 => _155.tokenStandard]), () => ("v2"))}),Vt({aptosConfig:e,options:{...r,where:o}})}async function hs(n){let{creatorAddress:e,collectionName:t,options:r,aptosConfig:i}=n,o=u.from(e),s={collection_name:{_eq:t},creator_address:{_eq:o.toStringLong()}};return _optionalChain([r, 'optionalAccess', _156 => _156.tokenStandard])&&(s.token_standard={_eq:_nullishCoalesce(_optionalChain([r, 'optionalAccess', _157 => _157.tokenStandard]), () => ("v2"))}),(await Vt({aptosConfig:i,options:{where:s}})).collection_id}var Vc={typeParameters:[],parameters:[new y(P()),new y(P()),new y(P()),new y(P()),new C(new y(P())),new C(new y(P())),new C(C.u8())]};async function bs(n){let{aptosConfig:e,options:t,creator:r,collection:i,description:o,name:s,uri:a,propertyKeys:c,propertyTypes:p,propertyValues:d}=n,T=_optionalChain([p, 'optionalAccess', _158 => _158.map, 'call', _159 => _159(w=>Ze[w])]);return b({aptosConfig:e,sender:r.accountAddress,data:{function:"0x4::aptos_token::mint",functionArguments:[new S(i),new S(o),new S(s),new S(a),h.MoveString(_nullishCoalesce(c, () => ([]))),h.MoveString(_nullishCoalesce(T, () => ([]))),zs(_nullishCoalesce(d, () => ([])),_nullishCoalesce(T, () => ([])))],abi:Vc},options:t})}var $c={typeParameters:[{constraints:["key"]}],parameters:[new y(oe(new z(0))),new W]};async function Ts(n){let{aptosConfig:e,sender:t,digitalAssetAddress:r,recipient:i,digitalAssetType:o,options:s}=n;return b({aptosConfig:e,sender:t.accountAddress,data:{function:"0x1::object::transfer",typeArguments:[_nullishCoalesce(o, () => (me))],functionArguments:[u.from(r),u.from(i)],abi:$c},options:s})}var Lc={typeParameters:[],parameters:[new y(P()),new y(P()),new y(P()),new y(P()),new C(new y(P())),new C(new y(P())),new C(C.u8()),new W]};async function ws(n){let{aptosConfig:e,account:t,collection:r,description:i,name:o,uri:s,recipient:a,propertyKeys:c,propertyTypes:p,propertyValues:d,options:T}=n;if(_optionalChain([c, 'optionalAccess', _160 => _160.length])!==_optionalChain([d, 'optionalAccess', _161 => _161.length]))throw new Error("Property keys and property values counts do not match");if(_optionalChain([p, 'optionalAccess', _162 => _162.length])!==_optionalChain([d, 'optionalAccess', _163 => _163.length]))throw new Error("Property types and property values counts do not match");let w=_optionalChain([p, 'optionalAccess', _164 => _164.map, 'call', _165 => _165(g=>Ze[g])]);return b({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::mint_soul_bound",functionArguments:[r,i,o,s,h.MoveString(_nullishCoalesce(c, () => ([]))),h.MoveString(_nullishCoalesce(w, () => ([]))),zs(_nullishCoalesce(d, () => ([])),_nullishCoalesce(w, () => ([]))),a],abi:Lc},options:T})}var Hc={typeParameters:[{constraints:["key"]}],parameters:[new y(oe(new z(0)))]};async function Ss(n){let{aptosConfig:e,creator:t,digitalAssetAddress:r,digitalAssetType:i,options:o}=n;return b({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::burn",typeArguments:[_nullishCoalesce(i, () => (me))],functionArguments:[u.from(r)],abi:Hc},options:o})}var Qc={typeParameters:[{constraints:["key"]}],parameters:[new y(oe(new z(0)))]};async function xs(n){let{aptosConfig:e,creator:t,digitalAssetAddress:r,digitalAssetType:i,options:o}=n;return b({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::freeze_transfer",typeArguments:[_nullishCoalesce(i, () => (me))],functionArguments:[r],abi:Qc},options:o})}var Wc={typeParameters:[{constraints:["key"]}],parameters:[new y(oe(new z(0)))]};async function _s(n){let{aptosConfig:e,creator:t,digitalAssetAddress:r,digitalAssetType:i,options:o}=n;return b({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::unfreeze_transfer",typeArguments:[_nullishCoalesce(i, () => (me))],functionArguments:[r],abi:Wc},options:o})}var jc={typeParameters:[{constraints:["key"]}],parameters:[new y(oe(new z(0))),new y(P())]};async function Ps(n){let{aptosConfig:e,creator:t,description:r,digitalAssetAddress:i,digitalAssetType:o,options:s}=n;return b({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::set_description",typeArguments:[_nullishCoalesce(o, () => (me))],functionArguments:[u.from(i),new S(r)],abi:jc},options:s})}var Xc={typeParameters:[{constraints:["key"]}],parameters:[new y(oe(new z(0))),new y(P())]};async function vs(n){let{aptosConfig:e,creator:t,name:r,digitalAssetAddress:i,digitalAssetType:o,options:s}=n;return b({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::set_name",typeArguments:[_nullishCoalesce(o, () => (me))],functionArguments:[u.from(i),new S(r)],abi:Xc},options:s})}var Zc={typeParameters:[{constraints:["key"]}],parameters:[new y(oe(new z(0))),new y(P())]};async function Cs(n){let{aptosConfig:e,creator:t,uri:r,digitalAssetAddress:i,digitalAssetType:o,options:s}=n;return b({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::set_uri",typeArguments:[_nullishCoalesce(o, () => (me))],functionArguments:[u.from(i),new S(r)],abi:Zc},options:s})}var Yc={typeParameters:[{constraints:["key"]}],parameters:[new y(oe(new z(0))),new y(P()),new y(P()),C.u8()]};async function Es(n){let{aptosConfig:e,creator:t,propertyKey:r,propertyType:i,propertyValue:o,digitalAssetAddress:s,digitalAssetType:a,options:c}=n;return b({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::add_property",typeArguments:[_nullishCoalesce(a, () => (me))],functionArguments:[u.from(s),new S(r),new S(Ze[i]),h.U8(di(o,Ze[i]))],abi:Yc},options:c})}var Jc={typeParameters:[{constraints:["key"]}],parameters:[new y(oe(new z(0))),new y(P())]};async function Is(n){let{aptosConfig:e,creator:t,propertyKey:r,digitalAssetAddress:i,digitalAssetType:o,options:s}=n;return b({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::remove_property",typeArguments:[_nullishCoalesce(o, () => (me))],functionArguments:[u.from(i),new S(r)],abi:Jc},options:s})}var eu={typeParameters:[{constraints:["key"]}],parameters:[new y(oe(new z(0))),new y(P()),new y(P()),C.u8()]};async function Us(n){let{aptosConfig:e,creator:t,propertyKey:r,propertyType:i,propertyValue:o,digitalAssetAddress:s,digitalAssetType:a,options:c}=n;return b({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::update_property",typeArguments:[_nullishCoalesce(a, () => (me))],functionArguments:[u.from(s),new S(r),new S(Ze[i]),di(o,Ze[i])],abi:eu},options:c})}var tu={typeParameters:[{constraints:["key"]},{constraints:[]}],parameters:[new y(oe(new z(0))),new y(P()),new z(1)]};async function Rs(n){let{aptosConfig:e,creator:t,propertyKey:r,propertyType:i,propertyValue:o,digitalAssetAddress:s,digitalAssetType:a,options:c}=n;return b({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::add_typed_property",typeArguments:[_nullishCoalesce(a, () => (me)),Ze[i]],functionArguments:[u.from(s),new S(r),o],abi:tu},options:c})}var nu={typeParameters:[{constraints:["key"]},{constraints:[]}],parameters:[new y(oe(new z(0))),new y(P()),new z(1)]};async function Ks(n){let{aptosConfig:e,creator:t,propertyKey:r,propertyType:i,propertyValue:o,digitalAssetAddress:s,digitalAssetType:a,options:c}=n;return b({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::update_typed_property",typeArguments:[_nullishCoalesce(a, () => (me)),Ze[i]],functionArguments:[u.from(s),new S(r),o],abi:nu},options:c})}function zs(n,e){let t=new Array;return e.forEach((r,i)=>{t.push(di(n[i],r))}),t}function di(n,e){let t=Ne(e);return qt(n,t,0,[]).bcsToBytes()}var fn=class{constructor(e){this.config=e}async getCollectionData(e){await A({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"});let{creatorAddress:t,collectionName:r,options:i}=e,o=u.from(t),s={collection_name:{_eq:r},creator_address:{_eq:o.toStringLong()}};return _optionalChain([i, 'optionalAccess', _166 => _166.tokenStandard])&&(s.token_standard={_eq:_nullishCoalesce(_optionalChain([i, 'optionalAccess', _167 => _167.tokenStandard]), () => ("v2"))}),Vt({aptosConfig:this.config,options:{where:s}})}async getCollectionDataByCreatorAddressAndCollectionName(e){return await A({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),ys({aptosConfig:this.config,...e})}async getCollectionDataByCreatorAddress(e){return await A({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),fs({aptosConfig:this.config,...e})}async getCollectionDataByCollectionId(e){return await A({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),As({aptosConfig:this.config,...e})}async getCollectionId(e){return await A({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),hs({aptosConfig:this.config,...e})}async getDigitalAssetData(e){return await A({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),ps({aptosConfig:this.config,...e})}async getCurrentDigitalAssetOwnership(e){return await A({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),ds({aptosConfig:this.config,...e})}async getOwnedDigitalAssets(e){return await A({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),ls({aptosConfig:this.config,...e})}async getDigitalAssetActivity(e){return await A({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),gs({aptosConfig:this.config,...e})}async createCollectionTransaction(e){return ms({aptosConfig:this.config,...e})}async mintDigitalAssetTransaction(e){return bs({aptosConfig:this.config,...e})}async transferDigitalAssetTransaction(e){return Ts({aptosConfig:this.config,...e})}async mintSoulBoundTransaction(e){return ws({aptosConfig:this.config,...e})}async burnDigitalAssetTransaction(e){return Ss({aptosConfig:this.config,...e})}async freezeDigitalAssetTransaferTransaction(e){return xs({aptosConfig:this.config,...e})}async unfreezeDigitalAssetTransaferTransaction(e){return _s({aptosConfig:this.config,...e})}async setDigitalAssetDescriptionTransaction(e){return Ps({aptosConfig:this.config,...e})}async setDigitalAssetNameTransaction(e){return vs({aptosConfig:this.config,...e})}async setDigitalAssetURITransaction(e){return Cs({aptosConfig:this.config,...e})}async addDigitalAssetPropertyTransaction(e){return Es({aptosConfig:this.config,...e})}async removeDigitalAssetPropertyTransaction(e){return Is({aptosConfig:this.config,...e})}async updateDigitalAssetPropertyTransaction(e){return Us({aptosConfig:this.config,...e})}async addDigitalAssetTypedPropertyTransaction(e){return Rs({aptosConfig:this.config,...e})}async updateDigitalAssetTypedPropertyTransaction(e){return Ks({aptosConfig:this.config,...e})}};var ks=300,ru=n=>{if(n&&n.length>ks)throw new Error(`Event type length exceeds the maximum length of ${ks}`)};async function Ds(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 An({aptosConfig:e,options:{...r,where:i}})}async function Bs(n){let{accountAddress:e,aptosConfig:t,creationNumber:r,options:i}=n,s={account_address:{_eq:u.from(e).toStringLong()},creation_number:{_eq:r}};return An({aptosConfig:t,options:{...i,where:s}})}async function Gs(n){let{accountAddress:e,aptosConfig:t,eventType:r,options:i}=n,s={account_address:{_eq:u.from(e).toStringLong()},indexed_type:{_eq:r}};return An({aptosConfig:t,options:{...i,where:s}})}async function An(n){let{aptosConfig:e,options:t}=n;ru(_optionalChain([t, 'optionalAccess', _168 => _168.where, 'optionalAccess', _169 => _169.indexed_type, 'optionalAccess', _170 => _170._eq]));let r={query:yo,variables:{where_condition:_optionalChain([t, 'optionalAccess', _171 => _171.where]),offset:_optionalChain([t, 'optionalAccess', _172 => _172.offset]),limit:_optionalChain([t, 'optionalAccess', _173 => _173.limit]),order_by:_optionalChain([t, 'optionalAccess', _174 => _174.orderBy])}};return(await f({aptosConfig:e,query:r,originMethod:"getEvents"})).events}var hn=class{constructor(e){this.config=e}async getModuleEventsByEventType(e){return await A({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"events_processor"}),Ds({aptosConfig:this.config,...e})}async getAccountEventsByCreationNumber(e){return await A({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"events_processor"}),Bs({aptosConfig:this.config,...e})}async getAccountEventsByEventType(e){return await A({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"events_processor"}),Gs({aptosConfig:this.config,...e})}async getEvents(e){return await A({config:this.config,minimumLedgerVersion:_optionalChain([e, 'optionalAccess', _175 => _175.minimumLedgerVersion]),processorType:"events_processor"}),An({aptosConfig:this.config,...e})}};async function Fs(n){let{aptosConfig:e,accountAddress:t,amount:r,options:i}=n,o=_optionalChain([i, 'optionalAccess', _176 => _176.timeoutSecs])||20,{data:s}=await Zi({aptosConfig:e,path:"fund",body:{address:u.from(t).toString(),amount:r},originMethod:"fundAccount"}),a=s.txn_hashes[0],c=await Mt({aptosConfig:e,transactionHash:a,options:{timeoutSecs:o,checkSuccess:_optionalChain([i, 'optionalAccess', _177 => _177.checkSuccess])}});if(c.type==="user_transaction")return c;throw new Error(`Unexpected transaction received for fund account: ${c.type}`)}var bn=class{constructor(e){this.config=e}async fundAccount(e){let t=await Fs({aptosConfig:this.config,...e});return(_optionalChain([e, 'access', _178 => _178.options, 'optionalAccess', _179 => _179.waitForIndexer])===void 0||_optionalChain([e, 'access', _180 => _180.options, 'optionalAccess', _181 => _181.waitForIndexer]))&&await or({aptosConfig:this.config,minimumLedgerVersion:BigInt(t.version),processorType:"fungible_asset_processor"}),t}};async function yr(n){let{aptosConfig:e,options:t}=n,r={query:Ao,variables:{where_condition:_optionalChain([t, 'optionalAccess', _182 => _182.where]),limit:_optionalChain([t, 'optionalAccess', _183 => _183.limit]),offset:_optionalChain([t, 'optionalAccess', _184 => _184.offset])}};return(await f({aptosConfig:e,query:r,originMethod:"getFungibleAssetMetadata"})).fungible_asset_metadata}async function Os(n){let{aptosConfig:e,options:t}=n,r={query:fo,variables:{where_condition:_optionalChain([t, 'optionalAccess', _185 => _185.where]),limit:_optionalChain([t, 'optionalAccess', _186 => _186.limit]),offset:_optionalChain([t, 'optionalAccess', _187 => _187.offset])}};return(await f({aptosConfig:e,query:r,originMethod:"getFungibleAssetActivities"})).fungible_asset_activities}async function Ns(n){let{aptosConfig:e,options:t}=n,r={query:go,variables:{where_condition:_optionalChain([t, 'optionalAccess', _188 => _188.where]),limit:_optionalChain([t, 'optionalAccess', _189 => _189.limit]),offset:_optionalChain([t, 'optionalAccess', _190 => _190.offset])}};return(await f({aptosConfig:e,query:r,originMethod:"getCurrentFungibleAssetBalances"})).current_fungible_asset_balances}var iu={typeParameters:[{constraints:[]}],parameters:[Ne("0x1::object::Object"),new W,new q]};async function Ms(n){let{aptosConfig:e,sender:t,fungibleAssetMetadataAddress:r,recipient:i,amount:o,options:s}=n;return b({aptosConfig:e,sender:t.accountAddress,data:{function:"0x1::primary_fungible_store::transfer",typeArguments:["0x1::fungible_asset::Metadata"],functionArguments:[r,i,o],abi:iu},options:s})}var Tn=class{constructor(e){this.config=e}async getFungibleAssetMetadata(e){return await A({config:this.config,minimumLedgerVersion:_optionalChain([e, 'optionalAccess', _191 => _191.minimumLedgerVersion]),processorType:"fungible_asset_processor"}),yr({aptosConfig:this.config,...e})}async getFungibleAssetMetadataByAssetType(e){return await A({config:this.config,minimumLedgerVersion:_optionalChain([e, 'optionalAccess', _192 => _192.minimumLedgerVersion]),processorType:"fungible_asset_processor"}),(await yr({aptosConfig:this.config,options:{where:{asset_type:{_eq:e.assetType}}}}))[0]}async getFungibleAssetMetadataByCreatorAddress(e){return await A({config:this.config,minimumLedgerVersion:_optionalChain([e, 'optionalAccess', _193 => _193.minimumLedgerVersion]),processorType:"fungible_asset_processor"}),await yr({aptosConfig:this.config,options:{where:{creator_address:{_eq:u.from(e.creatorAddress).toStringLong()}}}})}async getFungibleAssetActivities(e){return await A({config:this.config,minimumLedgerVersion:_optionalChain([e, 'optionalAccess', _194 => _194.minimumLedgerVersion]),processorType:"fungible_asset_processor"}),Os({aptosConfig:this.config,...e})}async getCurrentFungibleAssetBalances(e){return await A({config:this.config,minimumLedgerVersion:_optionalChain([e, 'optionalAccess', _195 => _195.minimumLedgerVersion]),processorType:"fungible_asset_processor"}),Ns({aptosConfig:this.config,...e})}async transferFungibleAsset(e){return Ms({aptosConfig:this.config,...e})}};var wn=class{constructor(e){this.config=e}async getLedgerInfo(){return Yn({aptosConfig:this.config})}async getChainId(){return(await this.getLedgerInfo()).chain_id}async getBlockByVersion(e){return Mo({aptosConfig:this.config,...e})}async getBlockByHeight(e){return qo({aptosConfig:this.config,...e})}async view(e){return ge({aptosConfig:this.config,...e})}async viewJson(e){return is({aptosConfig:this.config,...e})}async getChainTopUserTransactions(e){return So({aptosConfig:this.config,...e})}async queryIndexer(e){return f({aptosConfig:this.config,...e})}async getIndexerLastSuccessVersion(){return Jn({aptosConfig:this.config})}async getProcessorStatus(e){return er({aptosConfig:this.config,processorType:e})}};var qs=["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 Vs(n){return!(!n||n.length<3||n.length>63||!/^[a-z\d][a-z\d-]{1,61}[a-z\d]$/.test(n))}function Ye(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(!Vs(e))throw new Error(`${e} is not valid. ${qs}`);if(t&&!Vs(t))throw new Error(`${t} is not valid. ${qs}`);return{domainName:t||e,subdomainName:t?e:void 0}}function $s(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 ou="0x585fc9f0f0c54183b039ffc770ca282ebd87307916c215a3e692f2f8e4305e82",su={testnet:"0x5f8fd2347449685cf41d4db97926ec3a096eaf381332be4f1318ad4d16a8497c",mainnet:"0x867ed1f6bf916171b1de3ee92849b8978b7d1b9e0a8cc982a3d19d535dfd9c0c",local:ou,custom:null,devnet:null};function Me(n){let e=su[n.network];if(!e)throw new Error(`The ANS contract is not deployed to ${n.network}`);return e}var fr=n=>{if(n&&typeof n=="object"&&"vec"in n&&Array.isArray(n.vec))return n.vec[0]};async function Ls(n){let{aptosConfig:e,name:t}=n,r=Me(e),{domainName:i,subdomainName:o}=Ye(t),s=await ge({aptosConfig:e,payload:{function:`${r}::router::get_owner_addr`,functionArguments:[i,o]}}),a=fr(s[0]);return a?u.from(a):void 0}async function Hs(n){let{aptosConfig:e,expiration:t,name:r,sender:i,targetAddress:o,toAddress:s,options:a,transferable:c}=n,p=Me(e),{domainName:d,subdomainName:T}=Ye(r),w=t.policy==="subdomain:independent"||t.policy==="subdomain:follow-domain";if(T&&!w)throw new Error("Subdomains must have an expiration policy of either 'subdomain:independent' or 'subdomain:follow-domain'");if(w&&!T)throw new Error(`Policy is set to ${t.policy} but no subdomain was provided`);if(t.policy==="domain"){let Sr=_nullishCoalesce(t.years, () => (1));if(Sr!==1)throw new Error("For now, names can only be registered for 1 year at a time");let da=Sr*31536e3;return await b({aptosConfig:e,sender:i.accountAddress.toString(),data:{function:`${p}::router::register_domain`,functionArguments:[d,da,o,s]},options:a})}if(!T)throw new Error(`${t.policy} requires a subdomain to be provided.`);let g=await li({aptosConfig:e,name:d});if(!g)throw new Error("The domain does not exist");let E=t.policy==="subdomain:independent"?t.expirationDate:g;if(E>g)throw new Error("The subdomain expiration time cannot be greater than the domain expiration time");return await b({aptosConfig:e,sender:i.accountAddress.toString(),data:{function:`${p}::router::register_subdomain`,functionArguments:[d,T,Math.round(E/1e3),t.policy==="subdomain:follow-domain"?1:0,!!c,o,s]},options:a})}async function li(n){let{aptosConfig:e,name:t}=n,r=Me(e),{domainName:i,subdomainName:o}=Ye(t);try{let s=await ge({aptosConfig:e,payload:{function:`${r}::router::get_expiration`,functionArguments:[i,o]}});return Number(s[0])*1e3}catch (e5){return}}async function Qs(n){let{aptosConfig:e,address:t}=n,r=Me(e),i=await ge({aptosConfig:e,payload:{function:`${r}::router::get_primary_name`,functionArguments:[u.from(t).toString()]}}),o=fr(i[1]),s=fr(i[0]);if(o)return[s,o].filter(Boolean).join(".")}async function Ws(n){let{aptosConfig:e,sender:t,name:r,options:i}=n,o=Me(e);if(!r)return await b({aptosConfig:e,sender:t.accountAddress.toString(),data:{function:`${o}::router::clear_primary_name`,functionArguments:[]},options:i});let{domainName:s,subdomainName:a}=Ye(r);return await b({aptosConfig:e,sender:t.accountAddress.toString(),data:{function:`${o}::router::set_primary_name`,functionArguments:[s,a]},options:i})}async function js(n){let{aptosConfig:e,name:t}=n,r=Me(e),{domainName:i,subdomainName:o}=Ye(t),s=await ge({aptosConfig:e,payload:{function:`${r}::router::get_target_addr`,functionArguments:[i,o]}}),a=fr(s[0]);return a?u.from(a):void 0}async function Xs(n){let{aptosConfig:e,sender:t,name:r,address:i,options:o}=n,s=Me(e),{domainName:a,subdomainName:c}=Ye(r);return await b({aptosConfig:e,sender:t.accountAddress.toString(),data:{function:`${s}::router::set_target_addr`,functionArguments:[a,c,i]},options:o})}async function Zs(n){let{aptosConfig:e,name:t}=n,{domainName:r,subdomainName:i=""}=Ye(t),a=(await f({aptosConfig:e,query:{query:Ot,variables:{where_condition:{domain:{_eq:r},subdomain:{_eq:i}},limit:1}},originMethod:"getName"})).current_aptos_names[0];return a&&(a=Sn(a)),$s(a)?a:void 0}async function Ys(n){let{aptosConfig:e,options:t,accountAddress:r}=n,i=await gi({aptosConfig:e});return(await f({aptosConfig:e,originMethod:"getAccountNames",query:{query:Ot,variables:{limit:_optionalChain([t, 'optionalAccess', _196 => _196.limit]),offset:_optionalChain([t, 'optionalAccess', _197 => _197.offset]),order_by:_optionalChain([t, 'optionalAccess', _198 => _198.orderBy]),where_condition:{..._nullishCoalesce(_optionalChain([n, 'access', _199 => _199.options, 'optionalAccess', _200 => _200.where]), () => ({})),owner_address:{_eq:r.toString()},expiration_timestamp:{_gte:i}}}}})).current_aptos_names.map(Sn)}async function Js(n){let{aptosConfig:e,options:t,accountAddress:r}=n,i=await gi({aptosConfig:e});return(await f({aptosConfig:e,originMethod:"getAccountDomains",query:{query:Ot,variables:{limit:_optionalChain([t, 'optionalAccess', _201 => _201.limit]),offset:_optionalChain([t, 'optionalAccess', _202 => _202.offset]),order_by:_optionalChain([t, 'optionalAccess', _203 => _203.orderBy]),where_condition:{..._nullishCoalesce(_optionalChain([n, 'access', _204 => _204.options, 'optionalAccess', _205 => _205.where]), () => ({})),owner_address:{_eq:r.toString()},expiration_timestamp:{_gte:i},subdomain:{_eq:""}}}}})).current_aptos_names.map(Sn)}async function ea(n){let{aptosConfig:e,options:t,accountAddress:r}=n,i=await gi({aptosConfig:e});return(await f({aptosConfig:e,originMethod:"getAccountSubdomains",query:{query:Ot,variables:{limit:_optionalChain([t, 'optionalAccess', _206 => _206.limit]),offset:_optionalChain([t, 'optionalAccess', _207 => _207.offset]),order_by:_optionalChain([t, 'optionalAccess', _208 => _208.orderBy]),where_condition:{..._nullishCoalesce(_optionalChain([n, 'access', _209 => _209.options, 'optionalAccess', _210 => _210.where]), () => ({})),owner_address:{_eq:r.toString()},expiration_timestamp:{_gte:i},subdomain:{_neq:""}}}}})).current_aptos_names.map(Sn)}async function ta(n){let{aptosConfig:e,options:t,domain:r}=n;return(await f({aptosConfig:e,originMethod:"getDomainSubdomains",query:{query:Ot,variables:{limit:_optionalChain([t, 'optionalAccess', _211 => _211.limit]),offset:_optionalChain([t, 'optionalAccess', _212 => _212.offset]),order_by:_optionalChain([t, 'optionalAccess', _213 => _213.orderBy]),where_condition:{..._nullishCoalesce(_optionalChain([n, 'access', _214 => _214.options, 'optionalAccess', _215 => _215.where]), () => ({})),domain:{_eq:r},subdomain:{_neq:""}}}}})).current_aptos_names.map(Sn).filter($s)}async function gi(n){let{aptosConfig:e}=n,t=Me(e),[r]=await ge({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=Me(e),a=i*31536e3,{domainName:c,subdomainName:p}=Ye(r);if(p)throw new Error("Subdomains cannot be renewed");if(i!==1)throw new Error("Currently, only 1 year renewals are supported");return await b({aptosConfig:e,sender:t.accountAddress.toString(),data:{function:`${s}::router::renew_domain`,functionArguments:[c,a]},options:o})}function Sn(n){return{...n,expiration_timestamp:new Date(n.expiration_timestamp).getTime()}}var xn=class{constructor(e){this.config=e}async getOwnerAddress(e){return Ls({aptosConfig:this.config,...e})}async getExpiration(e){return li({aptosConfig:this.config,...e})}async getTargetAddress(e){return js({aptosConfig:this.config,...e})}async setTargetAddress(e){return Xs({aptosConfig:this.config,...e})}async getPrimaryName(e){return Qs({aptosConfig:this.config,...e})}async setPrimaryName(e){return Ws({aptosConfig:this.config,...e})}async registerName(e){return Hs({aptosConfig:this.config,...e})}async renewDomain(e){return na({aptosConfig:this.config,...e})}async getName(e){return Zs({aptosConfig:this.config,...e})}async getAccountNames(e){return Ys({aptosConfig:this.config,...e})}async getAccountDomains(e){return Js({aptosConfig:this.config,...e})}async getAccountSubdomains(e){return ea({aptosConfig:this.config,...e})}async getDomainSubdomains(e){return ta({aptosConfig:this.config,...e})}};async function ra(n){let{aptosConfig:e,poolAddress:t}=n,r=u.from(t).toStringLong(),o=await f({aptosConfig:e,query:{query:Hr,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 ia(n){let{aptosConfig:e,options:t}=n,r={query:Hr,variables:{order_by:_optionalChain([t, 'optionalAccess', _216 => _216.orderBy])}};return(await f({aptosConfig:e,query:r})).num_active_delegator_per_pool}async function oa(n){let{aptosConfig:e,delegatorAddress:t,poolAddress:r}=n,i={query:mo,variables:{delegatorAddress:u.from(t).toStringLong(),poolAddress:u.from(r).toStringLong()}};return(await f({aptosConfig:e,query:i})).delegated_staking_activities}var _n=class{constructor(e){this.config=e}async getNumberOfDelegators(e){return await A({config:this.config,minimumLedgerVersion:_optionalChain([e, 'optionalAccess', _217 => _217.minimumLedgerVersion]),processorType:"stake_processor"}),ra({aptosConfig:this.config,...e})}async getNumberOfDelegatorsForAllPools(e){return await A({config:this.config,minimumLedgerVersion:_optionalChain([e, 'optionalAccess', _218 => _218.minimumLedgerVersion]),processorType:"stake_processor"}),ia({aptosConfig:this.config,...e})}async getDelegatedStakingActivities(e){return await A({config:this.config,minimumLedgerVersion:_optionalChain([e, 'optionalAccess', _219 => _219.minimumLedgerVersion]),processorType:"stake_processor"}),oa({aptosConfig:this.config,...e})}};var Ar=class{constructor(e){this.config=e}async simple(e){return b({aptosConfig:this.config,...e})}async multiAgent(e){return b({aptosConfig:this.config,...e})}};function mi(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 yi(n,e,t){let r=t.value;return t.value=async function(...i){let[o]=i;if(o.transaction.feePayerAddress&&!o.feePayerPublicKey)throw new Error("You are simulating a Fee Payer transaction but missing the feePayerPublicKey");return r.apply(this,i)},t}var $t=class{constructor(e){this.config=e}async simple(e){return pi({aptosConfig:this.config,...e})}async multiAgent(e){return pi({aptosConfig:this.config,...e})}};_chunk7IYTZDXVjs.a.call(void 0, [yi],$t.prototype,"simple",1),_chunk7IYTZDXVjs.a.call(void 0, [yi],$t.prototype,"multiAgent",1);var Lt=class{constructor(e){this.config=e}async simple(e){return gn({aptosConfig:this.config,...e})}async multiAgent(e){return gn({aptosConfig:this.config,...e})}};_chunk7IYTZDXVjs.a.call(void 0, [mi],Lt.prototype,"simple",1),_chunk7IYTZDXVjs.a.call(void 0, [mi],Lt.prototype,"multiAgent",1);var hr=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 _chunk7IYTZDXVjs.b.call(void 0, this.sleepTime);this.lock=!0;let e=BigInt(0);try{if((this.lastUncommintedNumber===null||this.currentNumber===null)&&await this.initialize(),this.currentNumber-this.lastUncommintedNumber>=this.maximumInFlight){await this.update();let t=_chunk7IYTZDXVjs.c.call(void 0, );for(;this.currentNumber-this.lastUncommintedNumber>=this.maximumInFlight;)await _chunk7IYTZDXVjs.b.call(void 0, this.sleepTime),_chunk7IYTZDXVjs.c.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 Ee({aptosConfig:this.aptosConfig,accountAddress:this.account.accountAddress});this.currentNumber=BigInt(e),this.lastUncommintedNumber=BigInt(e)}async update(){let{sequence_number:e}=await Ee({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 _chunk7IYTZDXVjs.b.call(void 0, this.sleepTime);this.lock=!0;try{await this.update();let e=_chunk7IYTZDXVjs.c.call(void 0, );for(;this.lastUncommintedNumber!==this.currentNumber;)_chunk7IYTZDXVjs.c.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 _chunk7IYTZDXVjs.b.call(void 0, this.sleepTime),await this.update())}catch(e){console.error("error in synchronizing this account sequence number with the one on chain",e)}finally{this.lock=!1}}}};var Ht=class{constructor(){this.queue=[];this.pendingDequeue=[];this.cancelled=!1}enqueue(e){if(this.cancelled=!1,this.pendingDequeue.length>0){_optionalChain([this, 'access', _220 => _220.pendingDequeue, 'access', _221 => _221.shift, 'call', _222 => _222(), 'optionalAccess', _223 => _223.resolve, 'call', _224 => _224(e)]);return}this.queue.push(e)}async dequeue(){return this.queue.length>0?Promise.resolve(this.queue.shift()):new Promise((e,t)=>{this.pendingDequeue.push({resolve:e,reject:t})})}isEmpty(){return this.queue.length===0}cancel(){this.cancelled=!0,this.pendingDequeue.forEach(async({reject:e})=>{e(new Qt("Task cancelled"))}),this.pendingDequeue=[],this.queue.length=0}isCancelled(){return this.cancelled}pendingDequeueLength(){return this.pendingDequeue.length}},Qt=class extends Error{};var sa="fulfilled",aa= exports.TransactionWorkerEventsEnum =(o=>(o.TransactionSent="transactionSent",o.TransactionSendFailed="transactionSendFailed",o.TransactionExecuted="transactionExecuted",o.TransactionExecutionFailed="transactionExecutionFailed",o.ExecutionFinish="executionFinish",o))(aa||{}),br= exports.TransactionWorker =class extends _eventemitter32.default{constructor(t,r,i=30,o=100,s=10){super();this.taskQueue=new Ht;this.transactionsQueue=new Ht;this.outstandingTransactions=new Ht;this.sentTransactions=[];this.executedTransactions=[];this.aptosConfig=t,this.account=r,this.started=!1,this.accountSequnceNumber=new hr(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=mn({aptosConfig:this.aptosConfig,transaction:r,signer:this.account});await this.outstandingTransactions.enqueue([i,t])}}catch(t){if(t instanceof Qt)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===sa?(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 Qt)return;throw new Error(`Process execution failed for ${this.account.accountAddress.toString()} with error ${t}`)}}async checkTransaction(t,r){try{let i=[];i.push(Mt({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===sa?(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 b({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 Tr=class extends _eventemitter32.default{constructor(e){super(),this.config=e}start(e){let{sender:t}=e;this.account=t,this.transactionWorker=new br(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 Pn=class{constructor(e){this.config=e,this.build=new Ar(this.config),this.simulate=new $t(this.config),this.submit=new Lt(this.config),this.batch=new Tr(this.config)}async getTransactions(e){return Zr({aptosConfig:this.config,...e})}async getTransactionByVersion(e){return Oo({aptosConfig:this.config,...e})}async getTransactionByHash(e){return un({aptosConfig:this.config,...e})}async isPendingTransaction(e){return No({aptosConfig:this.config,...e})}async waitForTransaction(e){return Mt({aptosConfig:this.config,...e})}async getGasPriceEstimation(){return ir({aptosConfig:this.config})}getSigningMessage(e){return os(e)}async publishPackageTransaction(e){return as({aptosConfig:this.config,...e})}async rotateAuthKey(e){return cs({aptosConfig:this.config,...e})}sign(e){return gr({...e})}signAsFeePayer(e){return mr({...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 mn({aptosConfig:this.config,...e})}async signAndSubmitAsFeePayer(e){return ss({aptosConfig:this.config,...e})}};var vn=class{constructor(e){this.config=e}async getTableItem(e){return tr({aptosConfig:this.config,...e})}async getTableItemsData(e){return await A({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"default_processor"}),xo({aptosConfig:this.config,...e})}async getTableItemsMetadata(e){return await A({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"default_processor"}),_o({aptosConfig:this.config,...e})}};async function wr(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:m.fromHexInput(r.blinder).toStringWithoutPrefix(),uid_key:i,derivation_path:o},{data:a}=await Yi({aptosConfig:e,path:"fetch",body:s,originMethod:"getPepper",overrides:{WITH_CREDENTIALS:!1}});return m.fromHexInput(a.pepper).toUint8Array()}async function fi(n){let{aptosConfig:e,jwt:t,ephemeralKeyPair:r,pepper:i=await wr(n),uidKey:o="sub"}=n;if(m.fromHexInput(i).toUint8Array().length!==Gt.PEPPER_LENGTH)throw new Error(`Pepper needs to be ${Gt.PEPPER_LENGTH} bytes`);let{maxExpHorizonSecs:s}=await to({aptosConfig:e}),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:m.fromHexInput(r.blinder).toStringWithoutPrefix(),exp_date_secs:r.expiryDateSecs,exp_horizon_secs:s,pepper:m.fromHexInput(i).toStringWithoutPrefix(),uid_key:o},{data:p}=await Ji({aptosConfig:e,path:"prove",body:c,originMethod:"getProof",overrides:{WITH_CREDENTIALS:!1}}),d=p.proof,T=new Pt({a:d.a,b:d.b,c:d.c});return new pe({proof:new vt(T,0),trainingWheelsSignature:xe.fromHex(p.training_wheels_signature),expHorizonSecs:s})}async function ca(n){let{aptosConfig:e,jwt:t,jwkAddress:r,uidKey:i,proofFetchCallback:o,pepper:s=await wr(n)}=n,a=fi({...n,pepper:s}),c=o?a:await a;if(r!==void 0){let T=Te.fromJwtAndPepper({jwt:t,pepper:s,jwkAddress:r,uidKey:i}),w=await Nt({aptosConfig:e,authenticationKey:T.authKey().derivedAddress()});return jn.create({...n,address:w,proof:c,pepper:s,proofFetchCallback:o,jwkAddress:r})}let p=F.fromJwtAndPepper({jwt:t,pepper:s,uidKey:i}),d=await Nt({aptosConfig:e,authenticationKey:p.authKey().derivedAddress()});return Gt.create({...n,address:d,proof:c,pepper:s,proofFetchCallback:o})}async function ua(n){let{aptosConfig:e,sender:t,iss:r,options:i}=n,o=_nullishCoalesce(n.jwksUrl, () => ((r.endsWith("/")?`${r}.well-known/jwks.json`:`${r}/.well-known/jwks.json`))),s=await fetch(o);if(!s.ok)throw new Error(`Failed to fetch JWKS: ${s.status} ${s.statusText}`);let a=await s.json();return b({aptosConfig:e,sender:t.accountAddress,data:{function:"0x1::jwks::update_federated_jwk_set",functionArguments:[r,h.MoveString(a.keys.map(c=>c.kid)),h.MoveString(a.keys.map(c=>c.alg)),h.MoveString(a.keys.map(c=>c.e)),h.MoveString(a.keys.map(c=>c.n))]},options:i})}var Cn=class{constructor(e){this.config=e}async getPepper(e){return wr({aptosConfig:this.config,...e})}async getProof(e){return fi({aptosConfig:this.config,...e})}async deriveKeylessAccount(e){return ca({aptosConfig:this.config,...e})}async updateFederatedKeylessJwkSetTransaction(e){return ua({aptosConfig:this.config,...e})}};async function pu(n){let{aptosConfig:e,options:t}=n,r={query:Zn,variables:{where_condition:_optionalChain([t, 'optionalAccess', _225 => _225.where]),offset:_optionalChain([t, 'optionalAccess', _226 => _226.offset]),limit:_optionalChain([t, 'optionalAccess', _227 => _227.limit]),order_by:_optionalChain([t, 'optionalAccess', _228 => _228.orderBy])}};return(await f({aptosConfig:e,query:r,originMethod:"getObjectData"})).current_objects}async function pa(n){let{aptosConfig:e,objectAddress:t,options:r}=n,o={object_address:{_eq:u.from(t).toStringLong()}};return(await pu({aptosConfig:e,options:{...r,where:o}}))[0]}var En=class{constructor(e){this.config=e}async getObjectDataByObjectAddress(e){return await A({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"objects_processor"}),pa({aptosConfig:this.config,...e})}};var Z=class{constructor(e){this.config=new lr(e),this.account=new ln(this.config),this.ans=new xn(this.config),this.coin=new yn(this.config),this.digitalAsset=new fn(this.config),this.event=new hn(this.config),this.faucet=new bn(this.config),this.fungibleAsset=new Tn(this.config),this.general=new wn(this.config),this.staking=new _n(this.config),this.transaction=new Pn(this.config),this.table=new vn(this.config),this.keyless=new Cn(this.config),this.object=new En(this.config)}};function se(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))})}se(Z,ln,"account");se(Z,xn,"ans");se(Z,yn,"coin");se(Z,fn,"digitalAsset");se(Z,hn,"event");se(Z,bn,"faucet");se(Z,Tn,"fungibleAsset");se(Z,wn,"general");se(Z,_n,"staking");se(Z,Pn,"transaction");se(Z,vn,"table");se(Z,Cn,"keyless");se(Z,En,"object");exports.APTOS_BIP44_REGEX = _a; exports.APTOS_COIN = ct; exports.APTOS_FA = Vi; exports.APTOS_HARDENED_REGEX = xa; exports.AbstractKeylessAccount = le; exports.Account = je; exports.AccountAddress = u; exports.AccountAuthenticator = X; exports.AccountAuthenticatorEd25519 = we; exports.AccountAuthenticatorMultiEd25519 = qn; exports.AccountAuthenticatorMultiKey = ve; exports.AccountAuthenticatorSingleKey = te; exports.AccountAuthenticatorVariant = Pi; exports.AccountPublicKey = ee; exports.AccountSequenceNumber = hr; exports.AddressInvalidReason = ba; exports.AnyPublicKey = k; exports.AnyPublicKeyVariant = kn; exports.AnySignature = O; exports.AnySignatureVariant = vi; exports.Aptos = Z; exports.AptosApiError = be; exports.AptosApiType = St; exports.AptosConfig = lr; exports.AuthenticationKey = B; exports.Bool = U; exports.CKDPriv = Di; exports.ChainId = Ct; exports.DEFAULT_MAX_GAS_AMOUNT = Mi; exports.DEFAULT_TXN_EXP_SEC_FROM_NOW = qi; exports.DEFAULT_TXN_TIMEOUT_SEC = Nn; exports.DeriveScheme = Ii; exports.Deserializer = V; exports.EPK_HORIZON_SECS = ql; exports.Ed25519Account = kt; exports.Ed25519PrivateKey = j; exports.Ed25519PublicKey = _; exports.Ed25519Signature = v; exports.EntryFunction = lt; exports.EntryFunctionBytes = Kn; exports.EphemeralCertificate = _t; exports.EphemeralCertificateVariant = Pr; exports.EphemeralKeyPair = ft; exports.EphemeralPublicKey = at; exports.EphemeralPublicKeyVariant = _r; exports.EphemeralSignature = xe; exports.EphemeralSignatureVariant = Ci; exports.FederatedKeylessAccount = jn; exports.FederatedKeylessPublicKey = Te; exports.FeePayerRawTransaction = mt; exports.FixedBytes = nt; exports.Groth16Zkp = Pt; exports.HARDENED_OFFSET = Ki; exports.Hex = m; exports.HexInvalidReason = ma; exports.Identifier = I; exports.KeyType = Pa; exports.KeylessAccount = Gt; exports.KeylessConfiguration = Mr; exports.KeylessPublicKey = F; exports.KeylessSignature = ze; exports.MAX_AUD_VAL_BYTES = tc; exports.MAX_COMMITED_EPK_BYTES = Hl; exports.MAX_EXTRA_FIELD_BYTES = $l; exports.MAX_ISS_VAL_BYTES = Vl; exports.MAX_JWT_HEADER_B64_BYTES = Ll; exports.MAX_UID_KEY_BYTES = nc; exports.MAX_UID_VAL_BYTES = rc; exports.MimeType = zn; exports.ModuleId = en; exports.MoveAbility = Ei; exports.MoveFunctionVisibility = fa; exports.MoveOption = H; exports.MoveString = S; exports.MoveVector = h; exports.MultiAgentRawTransaction = gt; exports.MultiAgentTransaction = Wn; exports.MultiEd25519PublicKey = Tt; exports.MultiEd25519Signature = it; exports.MultiKey = We; exports.MultiKeyAccount = Ft; exports.MultiKeySignature = ke; exports.MultiSig = sn; exports.MultiSigTransactionPayload = an; exports.Network = Gr; exports.NetworkToChainId = Fr; exports.NetworkToFaucetAPI = Wi; exports.NetworkToIndexerAPI = Hi; exports.NetworkToNetworkName = Vd; exports.NetworkToNodeAPI = Qi; exports.NetworkToPepperAPI = Dr; exports.NetworkToProverAPI = Br; exports.ParsingError = J; exports.ProcessorType = Re; exports.PublicKey = rt; exports.RAW_TRANSACTION_SALT = $i; exports.RAW_TRANSACTION_WITH_DATA_SALT = zr; exports.RawTransaction = de; exports.RawTransactionWithData = Ln; exports.RoleType = Aa; exports.RotationProofChallenge = Hn; exports.Script = on; exports.ScriptTransactionArgumentVariants = jt; exports.Secp256k1PrivateKey = ot; exports.Secp256k1PublicKey = Ue; exports.Secp256k1Signature = st; exports.Serializable = l; exports.Serialized = Xt; exports.Serializer = $; exports.Signature = G; exports.SignedTransaction = yt; exports.SigningScheme = ye; exports.SigningSchemeInput = Er; exports.SimpleTransaction = Qn; exports.SingleKeyAccount = Dt; exports.StructTag = Ce; exports.TransactionAndProof = Lr; exports.TransactionAuthenticator = Oe; exports.TransactionAuthenticatorEd25519 = Et; exports.TransactionAuthenticatorFeePayer = Ut; exports.TransactionAuthenticatorMultiAgent = It; exports.TransactionAuthenticatorMultiEd25519 = Vr; exports.TransactionAuthenticatorSingleSender = Rt; exports.TransactionAuthenticatorVariant = _i; exports.TransactionPayload = dt; exports.TransactionPayloadEntryFunction = nn; exports.TransactionPayloadMultiSig = rn; exports.TransactionPayloadScript = tn; exports.TransactionPayloadVariants = Si; exports.TransactionResponseType = Cr; exports.TransactionVariants = xi; exports.TransactionWorker = br; exports.TransactionWorkerEventsEnum = aa; exports.TypeTag = K; exports.TypeTagAddress = W; exports.TypeTagBool = D; exports.TypeTagGeneric = z; exports.TypeTagParserError = N; exports.TypeTagParserErrorType = Pc; exports.TypeTagReference = $n; exports.TypeTagSigner = pt; exports.TypeTagStruct = y; exports.TypeTagU128 = Ge; exports.TypeTagU16 = De; exports.TypeTagU256 = Fe; exports.TypeTagU32 = Be; exports.TypeTagU64 = q; exports.TypeTagU8 = ie; exports.TypeTagVariants = wi; exports.TypeTagVector = C; exports.U128 = he; exports.U16 = fe; exports.U256 = ae; exports.U32 = Ae; exports.U64 = M; exports.U8 = L; exports.ZeroKnowledgeSig = pe; exports.ZkProof = vt; exports.ZkpVariant = vr; exports.aptosCoinStructTag = Cm; exports.aptosRequest = Mn; exports.base64UrlDecode = _chunk7IYTZDXVjs.e; exports.bigIntToBytesLE = Ni; exports.buildTransaction = ci; exports.bytesToBigIntLE = Zt; exports.checkOrConvertArgument = qt; exports.convertAmountFromHumanReadableToOnChain = _chunk7IYTZDXVjs.f; exports.convertAmountFromOnChainToHumanReadable = _chunk7IYTZDXVjs.g; exports.convertArgument = ai; exports.convertNumber = sr; exports.createObjectAddress = Vn; exports.createResourceAddress = rm; exports.createTokenAddress = im; exports.deriveKey = Ir; exports.deriveTransactionType = $r; exports.deserializeFromScriptArgument = ac; exports.ensureBoolean = xr; exports.fetchEntryFunctionAbi = Yo; exports.fetchFunctionAbi = Zo; exports.fetchViewFunctionAbi = Jo; exports.findFirstNonSignerArg = Wo; exports.floorToWholeHour = _chunk7IYTZDXVjs.d; exports.generateRawTransaction = Kc; exports.generateSignedTransaction = ui; exports.generateSignedTransactionForSimulation = ts; exports.generateSigningMessage = Kt; exports.generateSigningMessageForSerializable = Oy; exports.generateSigningMessageForTransaction = zt; exports.generateTransactionPayload = dr; exports.generateTransactionPayloadWithABI = Ic; exports.generateUserTransactionHash = jh; exports.generateViewFunctionPayload = es; exports.generateViewFunctionPayloadWithABI = Uc; exports.get = Or; exports.getAptosFullNode = Q; exports.getAptosPepperService = ll; exports.getAuthenticatorForSimulation = pr; exports.getFunctionParts = pn; exports.getKeylessConfig = to; exports.hashStrToField = Fn; exports.hashValues = ns; exports.isBcsAddress = cr; exports.isBcsBool = Yr; exports.isBcsFixedBytes = Tc; exports.isBcsString = Jr; exports.isBcsU128 = ii; exports.isBcsU16 = ti; exports.isBcsU256 = oi; exports.isBcsU32 = ni; exports.isBcsU64 = ri; exports.isBcsU8 = ei; exports.isBlockEpilogueTransactionResponse = Mu; exports.isBlockMetadataTransactionResponse = Fu; exports.isBool = $o; exports.isCanonicalEd25519Signature = Ca; exports.isEd25519Signature = qu; exports.isEmptyOption = Lo; exports.isEncodedEntryFunctionArgument = Ho; exports.isEncodedStruct = _chunk7IYTZDXVjs.i; exports.isFeePayerSignature = Lu; exports.isGenesisTransactionResponse = Gu; exports.isLargeNumber = ar; exports.isMultiAgentSignature = $u; exports.isMultiEd25519Signature = Hu; exports.isNumber = bc; exports.isPendingTransactionResponse = Du; exports.isScriptDataInput = Qo; exports.isSecp256k1Signature = Vu; exports.isStateCheckpointTransactionResponse = Ou; exports.isString = Xe; exports.isUserTransactionResponse = Bu; exports.isValidBIP44Path = zi; exports.isValidHardenedPath = ki; exports.isValidatorTransactionResponse = Nu; exports.mnemonicToSeed = Dn; exports.normalizeBundle = ji; exports.nowInSeconds = _chunk7IYTZDXVjs.c; exports.objectStructTag = oe; exports.optionStructTag = Em; exports.outOfRangeErrorMessage = ya; exports.padAndPackBytesWithLen = Kr; exports.paginateWithCursor = xt; exports.parseEncodedStruct = _chunk7IYTZDXVjs.h; exports.parseTypeTag = Ne; exports.poseidonHash = Yt; exports.post = Jt; exports.postAptosFaucet = Zi; exports.postAptosFullNode = Qe; exports.postAptosIndexer = Xi; exports.postAptosPepperService = Yi; exports.postAptosProvingService = Ji; exports.promiseFulfilledStatus = sa; exports.request = Ja; exports.sleep = _chunk7IYTZDXVjs.b; exports.splitPath = Bi; exports.standardizeTypeTags = ur; exports.stringStructTag = P; exports.throwTypeMismatch = R; exports.validateNumberInRange = Ve;
|
|
473
475
|
//# sourceMappingURL=index.js.map
|