@aptos-labs/ts-sdk 1.35.0-zeta.0 → 1.35.0-zeta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/common/{accountAddress-D3UA_cOZ.d.ts → accountAddress-Ce4Cv60D.d.ts} +36 -2
- package/dist/common/{chunk-CSUBLTFA.js → chunk-JMOQXLED.js} +10 -2
- package/dist/common/chunk-JMOQXLED.js.map +1 -0
- package/dist/common/cli/index.d.ts +1 -1
- package/dist/common/cli/index.js +2 -2
- package/dist/common/index.d.ts +33 -19
- package/dist/common/index.js +1325 -1289
- package/dist/common/index.js.map +1 -1
- package/dist/esm/account/AbstractKeylessAccount.mjs +14 -14
- package/dist/esm/account/AbstractedAccount.mjs +17 -17
- package/dist/esm/account/Account.mjs +16 -16
- package/dist/esm/account/AccountUtils.mjs +21 -21
- package/dist/esm/account/Ed25519Account.mjs +14 -14
- package/dist/esm/account/EphemeralKeyPair.mjs +5 -5
- package/dist/esm/account/FederatedKeylessAccount.mjs +15 -15
- package/dist/esm/account/KeylessAccount.mjs +15 -15
- package/dist/esm/account/MultiEd25519Account.mjs +14 -14
- package/dist/esm/account/MultiKeyAccount.d.mts +1 -0
- package/dist/esm/account/MultiKeyAccount.mjs +17 -17
- package/dist/esm/account/SingleKeyAccount.mjs +14 -14
- package/dist/esm/account/index.mjs +24 -24
- package/dist/esm/account/utils.mjs +6 -6
- package/dist/esm/api/account/abstraction.mjs +36 -36
- package/dist/esm/api/account.mjs +40 -38
- package/dist/esm/api/ans.mjs +36 -36
- package/dist/esm/api/aptos.d.mts +0 -1
- package/dist/esm/api/aptos.mjs +71 -68
- package/dist/esm/api/coin.mjs +35 -34
- package/dist/esm/api/digitalAsset.mjs +36 -36
- package/dist/esm/api/event.mjs +10 -10
- package/dist/esm/api/experimental.mjs +23 -37
- package/dist/esm/api/faucet.mjs +9 -9
- package/dist/esm/api/fungibleAsset.mjs +36 -36
- package/dist/esm/api/general.d.mts +2 -2
- package/dist/esm/api/general.mjs +23 -37
- package/dist/esm/api/index.d.mts +0 -1
- package/dist/esm/api/index.mjs +71 -68
- package/dist/esm/api/keyless.mjs +37 -35
- package/dist/esm/api/object.mjs +10 -10
- package/dist/esm/api/staking.mjs +10 -10
- package/dist/esm/api/table.mjs +10 -10
- package/dist/esm/api/transaction.d.mts +30 -18
- package/dist/esm/api/transaction.mjs +43 -41
- package/dist/esm/api/transactionSubmission/build.mjs +34 -34
- package/dist/esm/api/transactionSubmission/management.mjs +38 -36
- package/dist/esm/api/transactionSubmission/sign.mjs +33 -33
- package/dist/esm/api/transactionSubmission/simulate.mjs +34 -34
- package/dist/esm/api/transactionSubmission/submit.mjs +34 -34
- package/dist/esm/api/utils.mjs +8 -8
- package/dist/esm/bcs/index.mjs +7 -7
- package/dist/esm/bcs/serializable/movePrimitives.mjs +1 -1
- package/dist/esm/bcs/serializable/moveStructs.mjs +1 -1
- package/dist/esm/{chunk-XGUYC57L.mjs → chunk-2FTF6J7F.mjs} +3 -3
- package/dist/esm/{chunk-LHQJNJUB.mjs → chunk-2HL7JEFC.mjs} +9 -9
- package/dist/esm/{chunk-EFJAJFI3.mjs → chunk-2WBJAKBO.mjs} +2 -2
- package/dist/esm/{chunk-J7WQ42OC.mjs → chunk-3DAVHDK4.mjs} +2 -2
- package/dist/esm/{chunk-QN5BQMWP.mjs → chunk-56UCIGTO.mjs} +2 -2
- package/dist/esm/{chunk-I6QE3PKO.mjs → chunk-5ORUQZAR.mjs} +2 -2
- package/dist/esm/{chunk-P64LPFEC.mjs → chunk-62LC4PPC.mjs} +2 -2
- package/dist/esm/{chunk-ZWD4BJVD.mjs → chunk-6OFCIXWS.mjs} +3 -3
- package/dist/esm/chunk-6OFCIXWS.mjs.map +1 -0
- package/dist/esm/{chunk-LL4RQKIB.mjs → chunk-6T3V5LXK.mjs} +1 -2
- package/dist/esm/{chunk-LL4RQKIB.mjs.map → chunk-6T3V5LXK.mjs.map} +1 -1
- package/dist/esm/{chunk-UXAUOSSB.mjs → chunk-7F32C225.mjs} +6 -6
- package/dist/esm/{chunk-ESZLRZTK.mjs → chunk-7WW735TU.mjs} +3 -3
- package/dist/esm/{chunk-BQ5JTYXK.mjs → chunk-A33OBGVN.mjs} +3 -3
- package/dist/esm/{chunk-LFMXR5C2.mjs → chunk-A7LYGPFL.mjs} +3 -3
- package/dist/esm/{chunk-SDIZSFCQ.mjs → chunk-BU43ZFDJ.mjs} +2 -2
- package/dist/esm/{chunk-YIHVPGHN.mjs → chunk-C7EEG6SW.mjs} +4 -4
- package/dist/esm/{chunk-XGB3QLVI.mjs → chunk-D6RXVCE3.mjs} +3 -3
- package/dist/esm/{chunk-SGKF62FT.mjs → chunk-DGDZNHUJ.mjs} +5 -3
- package/dist/esm/{chunk-SGKF62FT.mjs.map → chunk-DGDZNHUJ.mjs.map} +1 -1
- package/dist/esm/{chunk-WEOK7WVL.mjs → chunk-EBFKT35C.mjs} +2 -2
- package/dist/esm/{chunk-JOVCSFQC.mjs → chunk-F4VI7BNX.mjs} +2 -2
- package/dist/esm/{chunk-VGI2LPO3.mjs → chunk-FDMI4BUL.mjs} +32 -25
- package/dist/esm/chunk-FDMI4BUL.mjs.map +1 -0
- package/dist/esm/chunk-FRLS4GRM.mjs +62 -0
- package/dist/esm/chunk-FRLS4GRM.mjs.map +1 -0
- package/dist/esm/chunk-G3MHXDYA.mjs +1 -0
- package/dist/esm/chunk-G3MHXDYA.mjs.map +1 -0
- package/dist/esm/{chunk-ZNGTK5IZ.mjs → chunk-G6R77JKO.mjs} +29 -29
- package/dist/esm/{chunk-6PMKDSGB.mjs → chunk-G7BB6K4B.mjs} +2 -2
- package/dist/esm/{chunk-ODG7T6OV.mjs → chunk-GCQK2S5Q.mjs} +2 -2
- package/dist/esm/{chunk-4BXAKN6A.mjs → chunk-HBXBODME.mjs} +3 -3
- package/dist/esm/{chunk-UKZP2GAB.mjs → chunk-HKQY5GXT.mjs} +7 -191
- package/dist/esm/chunk-HKQY5GXT.mjs.map +1 -0
- package/dist/esm/{chunk-NMYFY7WN.mjs → chunk-HL337SEM.mjs} +3 -3
- package/dist/esm/{chunk-K3CXNID3.mjs → chunk-HQDHSKVS.mjs} +2 -2
- package/dist/esm/{chunk-S56SMMAK.mjs → chunk-I5G7XFGT.mjs} +3 -3
- package/dist/esm/{chunk-HQ6A6TYS.mjs → chunk-IJ7XCPP3.mjs} +17 -12
- package/dist/esm/chunk-IJ7XCPP3.mjs.map +1 -0
- package/dist/esm/{chunk-46VPRC7E.mjs → chunk-ILTEOGFF.mjs} +2 -2
- package/dist/esm/{chunk-KLZCGNPI.mjs → chunk-IP7GATDH.mjs} +6 -6
- package/dist/esm/{chunk-KLZCGNPI.mjs.map → chunk-IP7GATDH.mjs.map} +1 -1
- package/dist/esm/{chunk-MHZVL3EA.mjs → chunk-IQVHXOD3.mjs} +8 -8
- package/dist/esm/{chunk-4WNIKKIV.mjs → chunk-JAZJE3OR.mjs} +3 -3
- package/dist/esm/{chunk-SN6KXHPA.mjs → chunk-JEVGHYEP.mjs} +2 -2
- package/dist/esm/{chunk-OQ6XT2GF.mjs → chunk-JFMFZ2IL.mjs} +3 -3
- package/dist/esm/{chunk-HQTQEHHZ.mjs → chunk-JQIRRM7G.mjs} +4 -4
- package/dist/esm/{chunk-MG6UFOJW.mjs → chunk-K5OCDM3W.mjs} +6 -6
- package/dist/esm/{chunk-MG6UFOJW.mjs.map → chunk-K5OCDM3W.mjs.map} +1 -1
- package/dist/esm/{chunk-MUSTBCQX.mjs → chunk-KW64NP2F.mjs} +2 -2
- package/dist/esm/{chunk-DUOU3SNQ.mjs → chunk-ORCQEMJL.mjs} +3 -3
- package/dist/esm/{chunk-LSIXUJ5T.mjs → chunk-QYNYDQE3.mjs} +4 -4
- package/dist/esm/{chunk-5E2IDRDF.mjs → chunk-R45SPK6Q.mjs} +2 -2
- package/dist/esm/{chunk-KAKSJSCR.mjs → chunk-RCXGTN36.mjs} +2 -2
- package/dist/esm/{chunk-3QMLVT4L.mjs → chunk-SPI2HO3E.mjs} +2 -2
- package/dist/esm/{chunk-KEZG4OGH.mjs → chunk-SPVJXZL5.mjs} +208 -68
- package/dist/esm/chunk-SPVJXZL5.mjs.map +1 -0
- package/dist/esm/{chunk-QW7RQDZ5.mjs → chunk-SQNS4SFV.mjs} +9 -1
- package/dist/esm/{chunk-QW7RQDZ5.mjs.map → chunk-SQNS4SFV.mjs.map} +1 -1
- package/dist/esm/{chunk-MIVDDJAH.mjs → chunk-SRXIHVZE.mjs} +2 -2
- package/dist/esm/{chunk-2ZOIVB2U.mjs → chunk-T4BFWV46.mjs} +2 -2
- package/dist/esm/{chunk-TQDWZXFD.mjs → chunk-TDLL7QX5.mjs} +7 -7
- package/dist/esm/{chunk-Y4FHNC5I.mjs → chunk-TJDF4CXI.mjs} +2 -2
- package/dist/esm/{chunk-HMHFKEHQ.mjs → chunk-TL4Z4KHK.mjs} +2 -2
- package/dist/esm/{chunk-Y7KAC4I4.mjs → chunk-UGFIWCJQ.mjs} +2 -2
- package/dist/esm/{chunk-EBEO4SA4.mjs → chunk-UGKZQUGE.mjs} +4 -4
- package/dist/esm/{chunk-KCV4HRSJ.mjs → chunk-UK7SPHIE.mjs} +4 -4
- package/dist/esm/{chunk-KEKNIJHE.mjs → chunk-WHSS6I7T.mjs} +3 -3
- package/dist/esm/{chunk-3SCNBHUA.mjs → chunk-WLTQHGIJ.mjs} +5 -5
- package/dist/esm/{chunk-I4OHHVRF.mjs → chunk-WUM247HF.mjs} +2 -2
- package/dist/esm/{chunk-A3TQLIEM.mjs → chunk-WXQUBQK4.mjs} +2 -2
- package/dist/esm/{chunk-WPV52HGD.mjs → chunk-X4N5BN3S.mjs} +3 -3
- package/dist/esm/{chunk-KPAICS4T.mjs → chunk-XX6C2QGI.mjs} +2 -2
- package/dist/esm/{chunk-XXLSA7W7.mjs → chunk-Y3M32DIB.mjs} +2 -2
- package/dist/esm/{chunk-HLTYSM7H.mjs → chunk-YK66QBML.mjs} +2 -2
- package/dist/esm/{chunk-EMKV5DFX.mjs → chunk-YT7V6AVJ.mjs} +3 -3
- package/dist/esm/chunk-ZRBUAZZD.mjs +36 -0
- package/dist/esm/chunk-ZRBUAZZD.mjs.map +1 -0
- package/dist/esm/cli/index.mjs +1 -1
- package/dist/esm/cli/localNode.mjs +1 -1
- package/dist/esm/client/core.mjs +4 -4
- package/dist/esm/client/get.mjs +4 -4
- package/dist/esm/client/index.mjs +5 -5
- package/dist/esm/client/post.mjs +5 -5
- package/dist/esm/core/account/index.mjs +1 -1
- package/dist/esm/core/account/utils/address.mjs +1 -1
- package/dist/esm/core/account/utils/index.mjs +1 -1
- package/dist/esm/core/accountAddress.mjs +1 -1
- package/dist/esm/core/authenticationKey.mjs +1 -1
- package/dist/esm/core/crypto/abstraction.mjs +3 -3
- package/dist/esm/core/crypto/ed25519.mjs +3 -3
- package/dist/esm/core/crypto/ephemeral.mjs +3 -3
- package/dist/esm/core/crypto/federatedKeyless.mjs +5 -5
- package/dist/esm/core/crypto/index.mjs +5 -5
- package/dist/esm/core/crypto/keyless.mjs +5 -5
- package/dist/esm/core/crypto/multiEd25519.mjs +5 -5
- package/dist/esm/core/crypto/multiKey.mjs +5 -5
- package/dist/esm/core/crypto/privateKey.mjs +1 -1
- package/dist/esm/core/crypto/proof.mjs +3 -3
- package/dist/esm/core/crypto/publicKey.mjs +3 -3
- package/dist/esm/core/crypto/secp256k1.mjs +3 -3
- package/dist/esm/core/crypto/signature.mjs +3 -3
- package/dist/esm/core/crypto/singleKey.mjs +5 -5
- package/dist/esm/core/index.mjs +5 -5
- package/dist/esm/errors/index.mjs +2 -2
- package/dist/esm/index.d.mts +1 -1
- package/dist/esm/index.mjs +81 -74
- package/dist/esm/internal/abstraction.mjs +34 -34
- package/dist/esm/internal/account.d.mts +45 -5
- package/dist/esm/internal/account.mjs +44 -30
- package/dist/esm/internal/ans.mjs +35 -35
- package/dist/esm/internal/coin.mjs +34 -33
- package/dist/esm/internal/digitalAsset.mjs +34 -34
- package/dist/esm/internal/event.mjs +7 -7
- package/dist/esm/internal/experimental.mjs +22 -36
- package/dist/esm/internal/faucet.mjs +8 -8
- package/dist/esm/internal/fungibleAsset.mjs +34 -34
- package/dist/esm/internal/general.mjs +6 -6
- package/dist/esm/internal/keyless.mjs +36 -34
- package/dist/esm/internal/object.mjs +7 -7
- package/dist/esm/internal/staking.mjs +7 -7
- package/dist/esm/internal/table.mjs +7 -7
- package/dist/esm/internal/transaction.mjs +7 -7
- package/dist/esm/internal/transactionSubmission.d.mts +6 -36
- package/dist/esm/internal/transactionSubmission.mjs +33 -39
- package/dist/esm/internal/utils/index.d.mts +15 -0
- package/dist/esm/internal/utils/index.mjs +39 -0
- package/dist/esm/internal/utils/index.mjs.map +1 -0
- package/dist/esm/internal/utils/utils.d.mts +65 -0
- package/dist/esm/internal/utils/utils.mjs +38 -0
- package/dist/esm/internal/utils/utils.mjs.map +1 -0
- package/dist/esm/internal/view.mjs +22 -36
- package/dist/esm/transactions/authenticator/account.mjs +5 -5
- package/dist/esm/transactions/authenticator/index.mjs +5 -5
- package/dist/esm/transactions/authenticator/transaction.mjs +5 -5
- package/dist/esm/transactions/index.mjs +23 -37
- package/dist/esm/transactions/instances/index.mjs +14 -14
- package/dist/esm/transactions/instances/moduleId.mjs +5 -5
- package/dist/esm/transactions/instances/multiAgentTransaction.mjs +9 -9
- package/dist/esm/transactions/instances/rawTransaction.mjs +8 -8
- package/dist/esm/transactions/instances/rotationProofChallenge.mjs +3 -3
- package/dist/esm/transactions/instances/signedTransaction.mjs +9 -9
- package/dist/esm/transactions/instances/simpleTransaction.mjs +9 -9
- package/dist/esm/transactions/instances/transactionPayload.mjs +6 -6
- package/dist/esm/transactions/management/accountSequenceNumber.mjs +41 -29
- package/dist/esm/transactions/management/index.mjs +37 -35
- package/dist/esm/transactions/management/transactionWorker.mjs +37 -35
- package/dist/esm/transactions/scriptComposer/index.mjs +21 -35
- package/dist/esm/transactions/transactionBuilder/helpers.mjs +6 -6
- package/dist/esm/transactions/transactionBuilder/index.mjs +20 -34
- package/dist/esm/transactions/transactionBuilder/remoteAbi.mjs +9 -40
- package/dist/esm/transactions/transactionBuilder/signingMessage.mjs +13 -13
- package/dist/esm/transactions/transactionBuilder/transactionBuilder.mjs +19 -34
- package/dist/esm/transactions/typeTag/index.mjs +5 -5
- package/dist/esm/transactions/typeTag/parser.mjs +5 -5
- package/dist/esm/types/index.d.mts +1 -1
- package/dist/esm/types/index.mjs +5 -1
- package/dist/esm/types/types.d.mts +36 -2
- package/dist/esm/types/types.mjs +5 -1
- package/dist/esm/utils/helpers.mjs +1 -1
- package/dist/esm/utils/index.mjs +4 -4
- package/dist/esm/utils/normalizeBundle.mjs +3 -3
- package/package.json +25 -24
- package/src/account/MultiKeyAccount.ts +3 -2
- package/src/api/general.ts +2 -2
- package/src/api/transaction.ts +30 -29
- package/src/client/post.ts +0 -1
- package/src/internal/account.ts +230 -71
- package/src/internal/transactionSubmission.ts +4 -202
- package/src/internal/utils/index.ts +4 -0
- package/src/internal/utils/utils.ts +116 -0
- package/src/transactions/scriptComposer/index.ts +3 -1
- package/src/transactions/transactionBuilder/remoteAbi.ts +1 -1
- package/src/transactions/transactionBuilder/transactionBuilder.ts +7 -2
- package/src/types/types.ts +38 -1
- package/dist/common/chunk-CSUBLTFA.js.map +0 -1
- package/dist/esm/chunk-HQ6A6TYS.mjs.map +0 -1
- package/dist/esm/chunk-KEZG4OGH.mjs.map +0 -1
- package/dist/esm/chunk-UKZP2GAB.mjs.map +0 -1
- package/dist/esm/chunk-VGI2LPO3.mjs.map +0 -1
- package/dist/esm/chunk-ZWD4BJVD.mjs.map +0 -1
- /package/dist/esm/{chunk-XGUYC57L.mjs.map → chunk-2FTF6J7F.mjs.map} +0 -0
- /package/dist/esm/{chunk-LHQJNJUB.mjs.map → chunk-2HL7JEFC.mjs.map} +0 -0
- /package/dist/esm/{chunk-EFJAJFI3.mjs.map → chunk-2WBJAKBO.mjs.map} +0 -0
- /package/dist/esm/{chunk-J7WQ42OC.mjs.map → chunk-3DAVHDK4.mjs.map} +0 -0
- /package/dist/esm/{chunk-QN5BQMWP.mjs.map → chunk-56UCIGTO.mjs.map} +0 -0
- /package/dist/esm/{chunk-I6QE3PKO.mjs.map → chunk-5ORUQZAR.mjs.map} +0 -0
- /package/dist/esm/{chunk-P64LPFEC.mjs.map → chunk-62LC4PPC.mjs.map} +0 -0
- /package/dist/esm/{chunk-UXAUOSSB.mjs.map → chunk-7F32C225.mjs.map} +0 -0
- /package/dist/esm/{chunk-ESZLRZTK.mjs.map → chunk-7WW735TU.mjs.map} +0 -0
- /package/dist/esm/{chunk-BQ5JTYXK.mjs.map → chunk-A33OBGVN.mjs.map} +0 -0
- /package/dist/esm/{chunk-LFMXR5C2.mjs.map → chunk-A7LYGPFL.mjs.map} +0 -0
- /package/dist/esm/{chunk-SDIZSFCQ.mjs.map → chunk-BU43ZFDJ.mjs.map} +0 -0
- /package/dist/esm/{chunk-YIHVPGHN.mjs.map → chunk-C7EEG6SW.mjs.map} +0 -0
- /package/dist/esm/{chunk-XGB3QLVI.mjs.map → chunk-D6RXVCE3.mjs.map} +0 -0
- /package/dist/esm/{chunk-WEOK7WVL.mjs.map → chunk-EBFKT35C.mjs.map} +0 -0
- /package/dist/esm/{chunk-JOVCSFQC.mjs.map → chunk-F4VI7BNX.mjs.map} +0 -0
- /package/dist/esm/{chunk-ZNGTK5IZ.mjs.map → chunk-G6R77JKO.mjs.map} +0 -0
- /package/dist/esm/{chunk-6PMKDSGB.mjs.map → chunk-G7BB6K4B.mjs.map} +0 -0
- /package/dist/esm/{chunk-ODG7T6OV.mjs.map → chunk-GCQK2S5Q.mjs.map} +0 -0
- /package/dist/esm/{chunk-4BXAKN6A.mjs.map → chunk-HBXBODME.mjs.map} +0 -0
- /package/dist/esm/{chunk-NMYFY7WN.mjs.map → chunk-HL337SEM.mjs.map} +0 -0
- /package/dist/esm/{chunk-K3CXNID3.mjs.map → chunk-HQDHSKVS.mjs.map} +0 -0
- /package/dist/esm/{chunk-S56SMMAK.mjs.map → chunk-I5G7XFGT.mjs.map} +0 -0
- /package/dist/esm/{chunk-46VPRC7E.mjs.map → chunk-ILTEOGFF.mjs.map} +0 -0
- /package/dist/esm/{chunk-MHZVL3EA.mjs.map → chunk-IQVHXOD3.mjs.map} +0 -0
- /package/dist/esm/{chunk-4WNIKKIV.mjs.map → chunk-JAZJE3OR.mjs.map} +0 -0
- /package/dist/esm/{chunk-SN6KXHPA.mjs.map → chunk-JEVGHYEP.mjs.map} +0 -0
- /package/dist/esm/{chunk-OQ6XT2GF.mjs.map → chunk-JFMFZ2IL.mjs.map} +0 -0
- /package/dist/esm/{chunk-HQTQEHHZ.mjs.map → chunk-JQIRRM7G.mjs.map} +0 -0
- /package/dist/esm/{chunk-MUSTBCQX.mjs.map → chunk-KW64NP2F.mjs.map} +0 -0
- /package/dist/esm/{chunk-DUOU3SNQ.mjs.map → chunk-ORCQEMJL.mjs.map} +0 -0
- /package/dist/esm/{chunk-LSIXUJ5T.mjs.map → chunk-QYNYDQE3.mjs.map} +0 -0
- /package/dist/esm/{chunk-5E2IDRDF.mjs.map → chunk-R45SPK6Q.mjs.map} +0 -0
- /package/dist/esm/{chunk-KAKSJSCR.mjs.map → chunk-RCXGTN36.mjs.map} +0 -0
- /package/dist/esm/{chunk-3QMLVT4L.mjs.map → chunk-SPI2HO3E.mjs.map} +0 -0
- /package/dist/esm/{chunk-MIVDDJAH.mjs.map → chunk-SRXIHVZE.mjs.map} +0 -0
- /package/dist/esm/{chunk-2ZOIVB2U.mjs.map → chunk-T4BFWV46.mjs.map} +0 -0
- /package/dist/esm/{chunk-TQDWZXFD.mjs.map → chunk-TDLL7QX5.mjs.map} +0 -0
- /package/dist/esm/{chunk-Y4FHNC5I.mjs.map → chunk-TJDF4CXI.mjs.map} +0 -0
- /package/dist/esm/{chunk-HMHFKEHQ.mjs.map → chunk-TL4Z4KHK.mjs.map} +0 -0
- /package/dist/esm/{chunk-Y7KAC4I4.mjs.map → chunk-UGFIWCJQ.mjs.map} +0 -0
- /package/dist/esm/{chunk-EBEO4SA4.mjs.map → chunk-UGKZQUGE.mjs.map} +0 -0
- /package/dist/esm/{chunk-KCV4HRSJ.mjs.map → chunk-UK7SPHIE.mjs.map} +0 -0
- /package/dist/esm/{chunk-KEKNIJHE.mjs.map → chunk-WHSS6I7T.mjs.map} +0 -0
- /package/dist/esm/{chunk-3SCNBHUA.mjs.map → chunk-WLTQHGIJ.mjs.map} +0 -0
- /package/dist/esm/{chunk-I4OHHVRF.mjs.map → chunk-WUM247HF.mjs.map} +0 -0
- /package/dist/esm/{chunk-A3TQLIEM.mjs.map → chunk-WXQUBQK4.mjs.map} +0 -0
- /package/dist/esm/{chunk-WPV52HGD.mjs.map → chunk-X4N5BN3S.mjs.map} +0 -0
- /package/dist/esm/{chunk-KPAICS4T.mjs.map → chunk-XX6C2QGI.mjs.map} +0 -0
- /package/dist/esm/{chunk-XXLSA7W7.mjs.map → chunk-Y3M32DIB.mjs.map} +0 -0
- /package/dist/esm/{chunk-HLTYSM7H.mjs.map → chunk-YK66QBML.mjs.map} +0 -0
- /package/dist/esm/{chunk-EMKV5DFX.mjs.map → chunk-YT7V6AVJ.mjs.map} +0 -0
|
@@ -3,33 +3,18 @@ import {
|
|
|
3
3
|
generateSignedTransaction,
|
|
4
4
|
generateSignedTransactionForSimulation,
|
|
5
5
|
generateTransactionPayload
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import {
|
|
8
|
-
getInfo
|
|
9
|
-
} from "./chunk-KEZG4OGH.mjs";
|
|
10
|
-
import {
|
|
11
|
-
waitForTransaction
|
|
12
|
-
} from "./chunk-SDIZSFCQ.mjs";
|
|
13
|
-
import {
|
|
14
|
-
Account
|
|
15
|
-
} from "./chunk-KEKNIJHE.mjs";
|
|
6
|
+
} from "./chunk-IJ7XCPP3.mjs";
|
|
16
7
|
import {
|
|
17
8
|
AbstractKeylessAccount,
|
|
18
9
|
isKeylessSigner
|
|
19
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-ILTEOGFF.mjs";
|
|
20
11
|
import {
|
|
21
12
|
generateSigningMessageForTransaction
|
|
22
|
-
} from "./chunk-
|
|
23
|
-
import {
|
|
24
|
-
RotationProofChallenge
|
|
25
|
-
} from "./chunk-QJ6CGH7N.mjs";
|
|
13
|
+
} from "./chunk-F4VI7BNX.mjs";
|
|
26
14
|
import {
|
|
27
15
|
SignedTransaction
|
|
28
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-R45SPK6Q.mjs";
|
|
29
17
|
import {
|
|
30
|
-
TypeTagAddress,
|
|
31
|
-
TypeTagU64,
|
|
32
|
-
TypeTagU8,
|
|
33
18
|
TypeTagVector
|
|
34
19
|
} from "./chunk-DDZGHA66.mjs";
|
|
35
20
|
import {
|
|
@@ -40,22 +25,16 @@ import {
|
|
|
40
25
|
} from "./chunk-T573PCIR.mjs";
|
|
41
26
|
import {
|
|
42
27
|
postAptosFullNode
|
|
43
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-6T3V5LXK.mjs";
|
|
44
29
|
import {
|
|
45
30
|
AccountAddress
|
|
46
31
|
} from "./chunk-CXLXUSCG.mjs";
|
|
47
32
|
import {
|
|
48
33
|
MoveVector
|
|
49
34
|
} from "./chunk-KSK3XIGF.mjs";
|
|
50
|
-
import {
|
|
51
|
-
U8
|
|
52
|
-
} from "./chunk-QSYWLSSN.mjs";
|
|
53
35
|
import {
|
|
54
36
|
Deserializer
|
|
55
37
|
} from "./chunk-NUT2VOX2.mjs";
|
|
56
|
-
import {
|
|
57
|
-
APTOS_COIN
|
|
58
|
-
} from "./chunk-5QHMFYVL.mjs";
|
|
59
38
|
|
|
60
39
|
// src/internal/transactionSubmission.ts
|
|
61
40
|
async function generateTransaction(args) {
|
|
@@ -235,168 +214,8 @@ async function publicPackageTransaction(args) {
|
|
|
235
214
|
options
|
|
236
215
|
});
|
|
237
216
|
}
|
|
238
|
-
var rotateAuthKeyAbi = {
|
|
239
|
-
typeParameters: [],
|
|
240
|
-
parameters: [
|
|
241
|
-
new TypeTagU8(),
|
|
242
|
-
TypeTagVector.u8(),
|
|
243
|
-
new TypeTagU8(),
|
|
244
|
-
TypeTagVector.u8(),
|
|
245
|
-
TypeTagVector.u8(),
|
|
246
|
-
TypeTagVector.u8()
|
|
247
|
-
]
|
|
248
|
-
};
|
|
249
|
-
var rotateAuthKeyUnverifiedAbi = {
|
|
250
|
-
typeParameters: [],
|
|
251
|
-
parameters: [TypeTagVector.u8()]
|
|
252
|
-
};
|
|
253
|
-
async function rotateAuthKey(args) {
|
|
254
|
-
const { aptosConfig, fromAccount, toNewPrivateKey } = args;
|
|
255
|
-
const accountInfo = await getInfo({
|
|
256
|
-
aptosConfig,
|
|
257
|
-
accountAddress: fromAccount.accountAddress
|
|
258
|
-
});
|
|
259
|
-
const newAccount = Account.fromPrivateKey({ privateKey: toNewPrivateKey, legacy: true });
|
|
260
|
-
const challenge = new RotationProofChallenge({
|
|
261
|
-
sequenceNumber: BigInt(accountInfo.sequence_number),
|
|
262
|
-
originator: fromAccount.accountAddress,
|
|
263
|
-
currentAuthKey: AccountAddress.from(accountInfo.authentication_key),
|
|
264
|
-
newPublicKey: newAccount.publicKey
|
|
265
|
-
});
|
|
266
|
-
const challengeHex = challenge.bcsToBytes();
|
|
267
|
-
const proofSignedByCurrentPrivateKey = fromAccount.sign(challengeHex);
|
|
268
|
-
const proofSignedByNewPrivateKey = newAccount.sign(challengeHex);
|
|
269
|
-
const rawTxn = await generateTransaction({
|
|
270
|
-
aptosConfig,
|
|
271
|
-
sender: fromAccount.accountAddress,
|
|
272
|
-
data: {
|
|
273
|
-
function: "0x1::account::rotate_authentication_key",
|
|
274
|
-
functionArguments: [
|
|
275
|
-
new U8(fromAccount.signingScheme),
|
|
276
|
-
// from scheme
|
|
277
|
-
MoveVector.U8(fromAccount.publicKey.toUint8Array()),
|
|
278
|
-
new U8(newAccount.signingScheme),
|
|
279
|
-
// to scheme
|
|
280
|
-
MoveVector.U8(newAccount.publicKey.toUint8Array()),
|
|
281
|
-
MoveVector.U8(proofSignedByCurrentPrivateKey.toUint8Array()),
|
|
282
|
-
MoveVector.U8(proofSignedByNewPrivateKey.toUint8Array())
|
|
283
|
-
],
|
|
284
|
-
abi: rotateAuthKeyAbi
|
|
285
|
-
}
|
|
286
|
-
});
|
|
287
|
-
return signAndSubmitTransaction({
|
|
288
|
-
aptosConfig,
|
|
289
|
-
signer: fromAccount,
|
|
290
|
-
transaction: rawTxn
|
|
291
|
-
});
|
|
292
|
-
}
|
|
293
|
-
async function rotateAuthKeyToMultiEd25519(args) {
|
|
294
|
-
const { aptosConfig, fromAccount, multiEd25519Account } = args;
|
|
295
|
-
const accountInfo = await getInfo({
|
|
296
|
-
aptosConfig,
|
|
297
|
-
accountAddress: fromAccount.accountAddress
|
|
298
|
-
});
|
|
299
|
-
const newAccount = multiEd25519Account;
|
|
300
|
-
const challenge = new RotationProofChallenge({
|
|
301
|
-
sequenceNumber: BigInt(accountInfo.sequence_number),
|
|
302
|
-
originator: fromAccount.accountAddress,
|
|
303
|
-
currentAuthKey: AccountAddress.from(accountInfo.authentication_key),
|
|
304
|
-
newPublicKey: newAccount.publicKey
|
|
305
|
-
});
|
|
306
|
-
const challengeHex = challenge.bcsToBytes();
|
|
307
|
-
const proofSignedByCurrentPrivateKey = fromAccount.sign(challengeHex);
|
|
308
|
-
const proofSignedByNewPrivateKey = newAccount.sign(challengeHex);
|
|
309
|
-
const rawTxn = await generateTransaction({
|
|
310
|
-
aptosConfig,
|
|
311
|
-
sender: fromAccount.accountAddress,
|
|
312
|
-
data: {
|
|
313
|
-
function: "0x1::account::rotate_authentication_key",
|
|
314
|
-
functionArguments: [
|
|
315
|
-
new U8(fromAccount.signingScheme),
|
|
316
|
-
// from scheme
|
|
317
|
-
MoveVector.U8(fromAccount.publicKey.toUint8Array()),
|
|
318
|
-
new U8(newAccount.signingScheme),
|
|
319
|
-
// to scheme
|
|
320
|
-
MoveVector.U8(newAccount.publicKey.toUint8Array()),
|
|
321
|
-
MoveVector.U8(proofSignedByCurrentPrivateKey.toUint8Array()),
|
|
322
|
-
MoveVector.U8(proofSignedByNewPrivateKey.toUint8Array())
|
|
323
|
-
],
|
|
324
|
-
abi: rotateAuthKeyAbi
|
|
325
|
-
}
|
|
326
|
-
});
|
|
327
|
-
return signAndSubmitTransaction({
|
|
328
|
-
aptosConfig,
|
|
329
|
-
signer: fromAccount,
|
|
330
|
-
transaction: rawTxn
|
|
331
|
-
});
|
|
332
|
-
}
|
|
333
|
-
async function rotateAuthKeyWithVerificationTransaction(args) {
|
|
334
|
-
const { aptosConfig, fromAccount, toAccount } = args;
|
|
335
|
-
const rawTxn = await generateTransaction({
|
|
336
|
-
aptosConfig,
|
|
337
|
-
sender: fromAccount.accountAddress,
|
|
338
|
-
data: {
|
|
339
|
-
function: "0x1::account::rotate_authentication_key_call",
|
|
340
|
-
functionArguments: [MoveVector.U8(toAccount.publicKey.authKey().toUint8Array())],
|
|
341
|
-
abi: rotateAuthKeyUnverifiedAbi
|
|
342
|
-
}
|
|
343
|
-
});
|
|
344
|
-
const pendingTxn = await signAndSubmitTransaction({
|
|
345
|
-
aptosConfig,
|
|
346
|
-
signer: fromAccount,
|
|
347
|
-
transaction: rawTxn
|
|
348
|
-
});
|
|
349
|
-
const txnResponse = await waitForTransaction({
|
|
350
|
-
aptosConfig,
|
|
351
|
-
transactionHash: pendingTxn.hash
|
|
352
|
-
});
|
|
353
|
-
if (!txnResponse.success) {
|
|
354
|
-
throw new Error(`Failed to rotate authentication key - ${txnResponse}`);
|
|
355
|
-
}
|
|
356
|
-
const coinTxn = await transferCoinTransaction({
|
|
357
|
-
aptosConfig,
|
|
358
|
-
sender: toAccount.accountAddress,
|
|
359
|
-
recipient: toAccount.accountAddress,
|
|
360
|
-
amount: 1
|
|
361
|
-
});
|
|
362
|
-
const pendingCoinTxn = await signAndSubmitTransaction({
|
|
363
|
-
aptosConfig,
|
|
364
|
-
signer: fromAccount,
|
|
365
|
-
transaction: coinTxn
|
|
366
|
-
});
|
|
367
|
-
const coinTxnResponse = await waitForTransaction({
|
|
368
|
-
aptosConfig,
|
|
369
|
-
transactionHash: pendingCoinTxn.hash
|
|
370
|
-
});
|
|
371
|
-
if (!coinTxnResponse.success) {
|
|
372
|
-
throw new Error(`Failed to verify authentication key - ${coinTxnResponse}`);
|
|
373
|
-
}
|
|
374
|
-
return coinTxnResponse;
|
|
375
|
-
}
|
|
376
|
-
|
|
377
|
-
// src/internal/coin.ts
|
|
378
|
-
var coinTransferAbi = {
|
|
379
|
-
typeParameters: [{ constraints: [] }],
|
|
380
|
-
parameters: [new TypeTagAddress(), new TypeTagU64()]
|
|
381
|
-
};
|
|
382
|
-
async function transferCoinTransaction(args) {
|
|
383
|
-
const { aptosConfig, sender, recipient, amount, coinType, options } = args;
|
|
384
|
-
const coinStructType = coinType ?? APTOS_COIN;
|
|
385
|
-
return generateTransaction({
|
|
386
|
-
aptosConfig,
|
|
387
|
-
sender,
|
|
388
|
-
data: {
|
|
389
|
-
function: "0x1::aptos_account::transfer_coins",
|
|
390
|
-
typeArguments: [coinStructType],
|
|
391
|
-
functionArguments: [recipient, amount],
|
|
392
|
-
abi: coinTransferAbi
|
|
393
|
-
},
|
|
394
|
-
options
|
|
395
|
-
});
|
|
396
|
-
}
|
|
397
217
|
|
|
398
218
|
export {
|
|
399
|
-
transferCoinTransaction,
|
|
400
219
|
generateTransaction,
|
|
401
220
|
buildTransactionPayload,
|
|
402
221
|
buildRawTransaction,
|
|
@@ -407,9 +226,6 @@ export {
|
|
|
407
226
|
submitTransaction,
|
|
408
227
|
signAndSubmitTransaction,
|
|
409
228
|
signAndSubmitAsFeePayer,
|
|
410
|
-
publicPackageTransaction
|
|
411
|
-
rotateAuthKey,
|
|
412
|
-
rotateAuthKeyToMultiEd25519,
|
|
413
|
-
rotateAuthKeyWithVerificationTransaction
|
|
229
|
+
publicPackageTransaction
|
|
414
230
|
};
|
|
415
|
-
//# sourceMappingURL=chunk-
|
|
231
|
+
//# sourceMappingURL=chunk-HKQY5GXT.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/internal/transactionSubmission.ts"],"sourcesContent":["/**\n * This file contains the underlying implementations for exposed submission API surface in\n * the {@link api/transaction}. By moving the methods out into a separate file,\n * other namespaces and processes can access these methods without depending on the entire\n * transaction namespace and without having a dependency cycle error.\n * @group Implementation\n */\n\nimport { AptosConfig } from \"../api/aptosConfig\";\nimport { Deserializer, MoveVector } from \"../bcs\";\nimport { postAptosFullNode } from \"../client\";\nimport { Account, AbstractKeylessAccount, isKeylessSigner } from \"../account\";\nimport { AccountAddress, AccountAddressInput } from \"../core/accountAddress\";\nimport { FederatedKeylessPublicKey, KeylessPublicKey, KeylessSignature } from \"../core/crypto\";\nimport { AccountAuthenticator } from \"../transactions/authenticator/account\";\nimport {\n buildTransaction,\n generateTransactionPayload,\n generateSignedTransactionForSimulation,\n generateSignedTransaction,\n} from \"../transactions/transactionBuilder/transactionBuilder\";\nimport {\n InputGenerateTransactionData,\n AnyRawTransaction,\n InputSimulateTransactionData,\n InputGenerateTransactionOptions,\n InputGenerateTransactionPayloadDataWithRemoteABI,\n InputSubmitTransactionData,\n InputGenerateMultiAgentRawTransactionData,\n InputGenerateSingleSignerRawTransactionData,\n AnyTransactionPayloadInstance,\n EntryFunctionABI,\n} from \"../transactions/types\";\nimport { UserTransactionResponse, PendingTransactionResponse, MimeType, HexInput } from \"../types\";\nimport { SignedTransaction, TypeTagVector, generateSigningMessageForTransaction } from \"../transactions\";\nimport { SimpleTransaction } from \"../transactions/instances/simpleTransaction\";\nimport { MultiAgentTransaction } from \"../transactions/instances/multiAgentTransaction\";\n\n/**\n * We are defining function signatures, each with its specific input and output.\n * These are the possible function signature for `generateTransaction` function.\n * When we call `generateTransaction` function with the relevant type properties,\n * Typescript can infer the return type based on the appropriate function overload.\n * @group Implementation\n */\nexport async function generateTransaction(\n args: { aptosConfig: AptosConfig } & InputGenerateSingleSignerRawTransactionData,\n): Promise<SimpleTransaction>;\nexport async function generateTransaction(\n args: { aptosConfig: AptosConfig } & InputGenerateMultiAgentRawTransactionData,\n): Promise<MultiAgentTransaction>;\n/**\n * Generates any transaction by passing in the required arguments\n *\n * @param args.sender The transaction sender's account address as a AccountAddressInput\n * @param args.data EntryFunctionData | ScriptData | MultiSigData\n * @param args.feePayerAddress optional. For a fee payer (aka sponsored) transaction\n * @param args.secondarySignerAddresses optional. For a multi-agent or fee payer (aka sponsored) transactions\n * @param args.options optional. GenerateTransactionOptions type\n *\n * @example\n * For a single signer entry function\n * move function name, move function type arguments, move function arguments\n * `\n * data: {\n * function:\"0x1::aptos_account::transfer\",\n * typeArguments:[]\n * functionArguments :[receiverAddress,10]\n * }\n * `\n *\n * @example\n * For a single signer script function\n * module bytecode, move function type arguments, move function arguments\n * ```\n * data: {\n * bytecode:\"0x001234567\",\n * typeArguments:[],\n * functionArguments :[receiverAddress,10]\n * }\n * ```\n *\n * @return An instance of a RawTransaction, plus optional secondary/fee payer addresses\n * ```\n * {\n * rawTransaction: RawTransaction,\n * secondarySignerAddresses?: Array<AccountAddress>,\n * feePayerAddress?: AccountAddress\n * }\n * ```\n * @group Implementation\n */\nexport async function generateTransaction(\n args: { aptosConfig: AptosConfig } & InputGenerateTransactionData,\n): Promise<AnyRawTransaction> {\n const payload = await buildTransactionPayload(args);\n return buildRawTransaction(args, payload);\n}\n\n/**\n * Builds a transaction payload based on the provided configuration and input data.\n * This function is essential for preparing transaction data for execution on the Aptos blockchain.\n *\n * @param args - The arguments for building the transaction payload.\n * @param args.aptosConfig - Configuration settings for the Aptos network.\n * @param args.data - Input data required to generate the transaction payload, which may include bytecode, multisig address,\n * function name, function arguments, type arguments, and ABI.\n * @returns A promise that resolves to the generated transaction payload instance.\n * @group Implementation\n */\nexport async function buildTransactionPayload(\n args: { aptosConfig: AptosConfig } & InputGenerateTransactionData,\n): Promise<AnyTransactionPayloadInstance> {\n const { aptosConfig, data } = args;\n // Merge in aptosConfig for remote ABI on non-script payloads\n let generateTransactionPayloadData: InputGenerateTransactionPayloadDataWithRemoteABI;\n let payload: AnyTransactionPayloadInstance;\n\n if (\"bytecode\" in data) {\n // TODO: Add ABI checking later\n payload = await generateTransactionPayload(data);\n } else if (\"multisigAddress\" in data) {\n generateTransactionPayloadData = {\n aptosConfig,\n multisigAddress: data.multisigAddress,\n function: data.function,\n functionArguments: data.functionArguments,\n typeArguments: data.typeArguments,\n abi: data.abi,\n };\n payload = await generateTransactionPayload(generateTransactionPayloadData);\n } else {\n generateTransactionPayloadData = {\n aptosConfig,\n function: data.function,\n functionArguments: data.functionArguments,\n typeArguments: data.typeArguments,\n abi: data.abi,\n };\n payload = await generateTransactionPayload(generateTransactionPayloadData);\n }\n return payload;\n}\n\n/**\n * Builds a raw transaction based on the provided configuration and payload.\n * This function helps in creating a transaction that can be sent to the Aptos blockchain.\n *\n * @param args - The arguments for generating the transaction.\n * @param args.aptosConfig - The configuration settings for Aptos.\n * @param args.sender - The address of the sender of the transaction.\n * @param args.options - Additional options for the transaction.\n * @param payload - The payload of the transaction, which defines the action to be performed.\n * @group Implementation\n */\nexport async function buildRawTransaction(\n args: { aptosConfig: AptosConfig } & InputGenerateTransactionData,\n payload: AnyTransactionPayloadInstance,\n): Promise<AnyRawTransaction> {\n const { aptosConfig, sender, options } = args;\n\n let feePayerAddress;\n if (isFeePayerTransactionInput(args)) {\n feePayerAddress = AccountAddress.ZERO.toString();\n }\n\n if (isMultiAgentTransactionInput(args)) {\n const { secondarySignerAddresses } = args;\n return buildTransaction({\n aptosConfig,\n sender,\n payload,\n options,\n secondarySignerAddresses,\n feePayerAddress,\n });\n }\n\n return buildTransaction({\n aptosConfig,\n sender,\n payload,\n options,\n feePayerAddress,\n });\n}\n\n/**\n * Determine if the transaction input includes a fee payer.\n *\n * @param data - The input data for generating a transaction.\n * @param data.withFeePayer - Indicates whether a fee payer is included in the transaction input.\n * @returns A boolean value indicating if the transaction input has a fee payer.\n * @group Implementation\n */\nfunction isFeePayerTransactionInput(data: InputGenerateTransactionData): boolean {\n return data.withFeePayer === true;\n}\n\n/**\n * Determines whether the provided transaction input data includes multiple agent signatures.\n *\n * @param data - The transaction input data to evaluate.\n * @param data.secondarySignerAddresses - An array of secondary signer addresses, indicating multiple agents.\n * @group Implementation\n */\nfunction isMultiAgentTransactionInput(\n data: InputGenerateTransactionData,\n): data is InputGenerateMultiAgentRawTransactionData {\n return \"secondarySignerAddresses\" in data;\n}\n\n/**\n * Builds a signing message that can be signed by external signers.\n *\n * Note: Please prefer using `signTransaction` unless signing outside the SDK.\n *\n * @param args - The arguments for generating the signing message.\n * @param args.transaction - AnyRawTransaction, as generated by `generateTransaction()`.\n *\n * @returns The message to be signed.\n * @group Implementation\n */\nexport function getSigningMessage(args: { transaction: AnyRawTransaction }): Uint8Array {\n const { transaction } = args;\n return generateSigningMessageForTransaction(transaction);\n}\n\n/**\n * Sign a transaction that can later be submitted to the chain.\n *\n * @param args The arguments for signing the transaction.\n * @param args.signer The signer account to sign the transaction.\n * @param args.transaction An instance of a RawTransaction, plus optional secondary/fee payer addresses.\n *\n * @return The signer AccountAuthenticator.\n * @group Implementation\n */\nexport function signTransaction(args: { signer: Account; transaction: AnyRawTransaction }): AccountAuthenticator {\n const { signer, transaction } = args;\n return signer.signTransactionWithAuthenticator(transaction);\n}\n\nexport function signAsFeePayer(args: { signer: Account; transaction: AnyRawTransaction }): AccountAuthenticator {\n const { signer, transaction } = args;\n\n // if transaction doesn't hold a \"feePayerAddress\" prop it means\n // this is not a fee payer transaction\n if (!transaction.feePayerAddress) {\n throw new Error(`Transaction ${transaction} is not a Fee Payer transaction`);\n }\n\n // Set the feePayerAddress to the signer account address\n transaction.feePayerAddress = signer.accountAddress;\n\n return signTransaction({\n signer,\n transaction,\n });\n}\n\n/**\n * Simulates a transaction before signing it to evaluate its potential outcome.\n *\n * @param args The arguments for simulating the transaction.\n * @param args.aptosConfig The configuration for the Aptos network.\n * @param args.transaction The raw transaction to simulate.\n * @param args.signerPublicKey Optional. The signer public key.\n * @param args.secondarySignersPublicKeys Optional. For when the transaction involves multiple signers.\n * @param args.feePayerPublicKey Optional. For when the transaction is sponsored by a fee payer.\n * @param args.options Optional. A configuration object to customize the simulation process.\n * @param args.options.estimateGasUnitPrice Optional. Indicates whether to estimate the gas unit price.\n * @param args.options.estimateMaxGasAmount Optional. Indicates whether to estimate the maximum gas amount.\n * @param args.options.estimatePrioritizedGasUnitPrice Optional. Indicates whether to estimate the prioritized gas unit price.\n * @group Implementation\n */\nexport async function simulateTransaction(\n args: { aptosConfig: AptosConfig } & InputSimulateTransactionData,\n): Promise<Array<UserTransactionResponse>> {\n const { aptosConfig, transaction, signerPublicKey, secondarySignersPublicKeys, feePayerPublicKey, options } = args;\n\n const signedTransaction = generateSignedTransactionForSimulation({\n transaction,\n signerPublicKey,\n secondarySignersPublicKeys,\n feePayerPublicKey,\n options,\n });\n\n const { data } = await postAptosFullNode<Uint8Array, Array<UserTransactionResponse>>({\n aptosConfig,\n body: signedTransaction,\n path: \"transactions/simulate\",\n params: {\n estimate_gas_unit_price: args.options?.estimateGasUnitPrice ?? false,\n estimate_max_gas_amount: args.options?.estimateMaxGasAmount ?? false,\n estimate_prioritized_gas_unit_price: args.options?.estimatePrioritizedGasUnitPrice ?? false,\n },\n originMethod: \"simulateTransaction\",\n contentType: MimeType.BCS_SIGNED_TRANSACTION,\n });\n return data;\n}\n\n/**\n * Submit a transaction to the Aptos blockchain.\n *\n * @param args - The arguments for submitting the transaction.\n * @param args.aptosConfig - The configuration for connecting to the Aptos network.\n * @param args.transaction - The Aptos transaction data to be submitted.\n * @param args.senderAuthenticator - The account authenticator of the transaction sender.\n * @param args.secondarySignerAuthenticators - Optional. Authenticators for additional signers in a multi-signer transaction.\n *\n * @returns PendingTransactionResponse - The response containing the status of the submitted transaction.\n * @group Implementation\n */\nexport async function submitTransaction(\n args: {\n aptosConfig: AptosConfig;\n } & InputSubmitTransactionData,\n): Promise<PendingTransactionResponse> {\n const { aptosConfig } = args;\n const signedTransaction = generateSignedTransaction({ ...args });\n try {\n const { data } = await postAptosFullNode<Uint8Array, PendingTransactionResponse>({\n aptosConfig,\n body: signedTransaction,\n path: \"transactions\",\n originMethod: \"submitTransaction\",\n contentType: MimeType.BCS_SIGNED_TRANSACTION,\n });\n return data;\n } catch (e) {\n const signedTxn = SignedTransaction.deserialize(new Deserializer(signedTransaction));\n if (\n signedTxn.authenticator.isSingleSender() &&\n signedTxn.authenticator.sender.isSingleKey() &&\n (signedTxn.authenticator.sender.public_key.publicKey instanceof KeylessPublicKey ||\n signedTxn.authenticator.sender.public_key.publicKey instanceof FederatedKeylessPublicKey)\n ) {\n await AbstractKeylessAccount.fetchJWK({\n aptosConfig,\n publicKey: signedTxn.authenticator.sender.public_key.publicKey,\n kid: (signedTxn.authenticator.sender.signature.signature as KeylessSignature).getJwkKid(),\n });\n }\n throw e;\n }\n}\n\nexport type FeePayerOrFeePayerAuthenticatorOrNeither =\n | { feePayer: Account; feePayerAuthenticator?: never }\n | { feePayer?: never; feePayerAuthenticator: AccountAuthenticator }\n | { feePayer?: never; feePayerAuthenticator?: never };\n\nexport async function signAndSubmitTransaction(\n args: FeePayerOrFeePayerAuthenticatorOrNeither & {\n aptosConfig: AptosConfig;\n signer: Account;\n transaction: AnyRawTransaction;\n },\n): Promise<PendingTransactionResponse> {\n const { aptosConfig, signer, feePayer, transaction } = args;\n // If the signer contains a KeylessAccount, await proof fetching in case the proof\n // was fetched asynchronously.\n if (isKeylessSigner(signer)) {\n await signer.checkKeylessAccountValidity(aptosConfig);\n }\n if (isKeylessSigner(feePayer)) {\n await feePayer.checkKeylessAccountValidity(aptosConfig);\n }\n const feePayerAuthenticator =\n args.feePayerAuthenticator || (feePayer && signAsFeePayer({ signer: feePayer, transaction }));\n\n const senderAuthenticator = signTransaction({ signer, transaction });\n return submitTransaction({\n aptosConfig,\n transaction,\n senderAuthenticator,\n feePayerAuthenticator,\n });\n}\n\nexport async function signAndSubmitAsFeePayer(args: {\n aptosConfig: AptosConfig;\n feePayer: Account;\n senderAuthenticator: AccountAuthenticator;\n transaction: AnyRawTransaction;\n}): Promise<PendingTransactionResponse> {\n const { aptosConfig, senderAuthenticator, feePayer, transaction } = args;\n\n if (isKeylessSigner(feePayer)) {\n await feePayer.checkKeylessAccountValidity(aptosConfig);\n }\n\n const feePayerAuthenticator = signAsFeePayer({ signer: feePayer, transaction });\n\n return submitTransaction({\n aptosConfig,\n transaction,\n senderAuthenticator,\n feePayerAuthenticator,\n });\n}\n\nconst packagePublishAbi: EntryFunctionABI = {\n typeParameters: [],\n parameters: [TypeTagVector.u8(), new TypeTagVector(TypeTagVector.u8())],\n};\n\n/**\n * Publishes a package transaction to the Aptos blockchain.\n * This function allows you to create and send a transaction that publishes a package with the specified metadata and bytecode.\n *\n * @param args - The arguments for the package transaction.\n * @param args.aptosConfig - The configuration settings for the Aptos client.\n * @param args.account - The address of the account sending the transaction.\n * @param args.metadataBytes - The metadata associated with the package, represented as hexadecimal input.\n * @param args.moduleBytecode - An array of module bytecode, each represented as hexadecimal input.\n * @param args.options - Optional parameters for generating the transaction.\n * @group Implementation\n */\nexport async function publicPackageTransaction(args: {\n aptosConfig: AptosConfig;\n account: AccountAddressInput;\n metadataBytes: HexInput;\n moduleBytecode: Array<HexInput>;\n options?: InputGenerateTransactionOptions;\n}): Promise<SimpleTransaction> {\n const { aptosConfig, account, metadataBytes, moduleBytecode, options } = args;\n\n const totalByteCode = moduleBytecode.map((bytecode) => MoveVector.U8(bytecode));\n\n return generateTransaction({\n aptosConfig,\n sender: AccountAddress.from(account),\n data: {\n function: \"0x1::code::publish_package_txn\",\n functionArguments: [MoveVector.U8(metadataBytes), new MoveVector(totalByteCode)],\n abi: packagePublishAbi,\n },\n options,\n });\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4FA,eAAsB,oBACpB,MAC4B;AAC5B,QAAM,UAAU,MAAM,wBAAwB,IAAI;AAClD,SAAO,oBAAoB,MAAM,OAAO;AAC1C;AA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;AAC7B,QAAM,EAAE,aAAa,SAAS,eAAe,gBAAgB,QAAQ,IAAI;AAEzE,QAAM,gBAAgB,eAAe,IAAI,CAAC,aAAa,WAAW,GAAG,QAAQ,CAAC;AAE9E,SAAO,oBAAoB;AAAA,IACzB;AAAA,IACA,QAAQ,eAAe,KAAK,OAAO;AAAA,IACnC,MAAM;AAAA,MACJ,UAAU;AAAA,MACV,mBAAmB,CAAC,WAAW,GAAG,aAAa,GAAG,IAAI,WAAW,aAAa,CAAC;AAAA,MAC/E,KAAK;AAAA,IACP;AAAA,IACA;AAAA,EACF,CAAC;AACH;","names":[]}
|
|
@@ -2,10 +2,10 @@ import {
|
|
|
2
2
|
addAuthenticationFunctionTransaction,
|
|
3
3
|
removeAuthenticationFunctionTransaction,
|
|
4
4
|
removeDispatchableAuthenticatorTransaction
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-TL4Z4KHK.mjs";
|
|
6
6
|
import {
|
|
7
7
|
view
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-ORCQEMJL.mjs";
|
|
9
9
|
import {
|
|
10
10
|
TypeTagAddress
|
|
11
11
|
} from "./chunk-DDZGHA66.mjs";
|
|
@@ -216,4 +216,4 @@ var AccountAbstraction = class {
|
|
|
216
216
|
export {
|
|
217
217
|
AccountAbstraction
|
|
218
218
|
};
|
|
219
|
-
//# sourceMappingURL=chunk-
|
|
219
|
+
//# sourceMappingURL=chunk-HL337SEM.mjs.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
transferCoinTransaction
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-ZRBUAZZD.mjs";
|
|
4
4
|
|
|
5
5
|
// src/api/coin.ts
|
|
6
6
|
var Coin = class {
|
|
@@ -71,4 +71,4 @@ var Coin = class {
|
|
|
71
71
|
export {
|
|
72
72
|
Coin
|
|
73
73
|
};
|
|
74
|
-
//# sourceMappingURL=chunk-
|
|
74
|
+
//# sourceMappingURL=chunk-HQDHSKVS.mjs.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
fundAccount
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-JAZJE3OR.mjs";
|
|
4
4
|
import {
|
|
5
5
|
waitForIndexer
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-BU43ZFDJ.mjs";
|
|
7
7
|
|
|
8
8
|
// src/api/faucet.ts
|
|
9
9
|
var Faucet = class {
|
|
@@ -83,4 +83,4 @@ var Faucet = class {
|
|
|
83
83
|
export {
|
|
84
84
|
Faucet
|
|
85
85
|
};
|
|
86
|
-
//# sourceMappingURL=chunk-
|
|
86
|
+
//# sourceMappingURL=chunk-I5G7XFGT.mjs.map
|
|
@@ -3,33 +3,33 @@ import {
|
|
|
3
3
|
fetchEntryFunctionAbi,
|
|
4
4
|
fetchViewFunctionAbi,
|
|
5
5
|
standardizeTypeTags
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-6OFCIXWS.mjs";
|
|
7
7
|
import {
|
|
8
8
|
isScriptDataInput
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-JQIRRM7G.mjs";
|
|
10
10
|
import {
|
|
11
11
|
getInfo
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-FRLS4GRM.mjs";
|
|
13
13
|
import {
|
|
14
14
|
getGasPriceEstimation
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-BU43ZFDJ.mjs";
|
|
16
16
|
import {
|
|
17
17
|
getLedgerInfo
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-YK66QBML.mjs";
|
|
19
19
|
import {
|
|
20
20
|
MultiAgentTransaction
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-KW64NP2F.mjs";
|
|
22
22
|
import {
|
|
23
23
|
SignedTransaction
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-R45SPK6Q.mjs";
|
|
25
25
|
import {
|
|
26
26
|
SimpleTransaction
|
|
27
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-EBFKT35C.mjs";
|
|
28
28
|
import {
|
|
29
29
|
FeePayerRawTransaction,
|
|
30
30
|
MultiAgentRawTransaction,
|
|
31
31
|
RawTransaction
|
|
32
|
-
} from "./chunk-
|
|
32
|
+
} from "./chunk-XX6C2QGI.mjs";
|
|
33
33
|
import {
|
|
34
34
|
EntryFunction,
|
|
35
35
|
MultiSig,
|
|
@@ -38,7 +38,7 @@ import {
|
|
|
38
38
|
TransactionPayloadEntryFunction,
|
|
39
39
|
TransactionPayloadMultiSig,
|
|
40
40
|
TransactionPayloadScript
|
|
41
|
-
} from "./chunk-
|
|
41
|
+
} from "./chunk-UGKZQUGE.mjs";
|
|
42
42
|
import {
|
|
43
43
|
ChainId
|
|
44
44
|
} from "./chunk-MYEYZ7PF.mjs";
|
|
@@ -375,7 +375,12 @@ function getAuthenticatorForSimulation(publicKey) {
|
|
|
375
375
|
return new AccountAuthenticatorMultiKey(
|
|
376
376
|
accountPublicKey,
|
|
377
377
|
new MultiKeySignature({
|
|
378
|
-
signatures: accountPublicKey.publicKeys.map(() =>
|
|
378
|
+
signatures: accountPublicKey.publicKeys.map((pubKey) => {
|
|
379
|
+
if (KeylessPublicKey.isInstance(pubKey.publicKey) || FederatedKeylessPublicKey.isInstance(pubKey.publicKey)) {
|
|
380
|
+
return new AnySignature(KeylessSignature.getSimulationSignature());
|
|
381
|
+
}
|
|
382
|
+
return new AnySignature(invalidSignature);
|
|
383
|
+
}),
|
|
379
384
|
bitmap: accountPublicKey.createBitmap({
|
|
380
385
|
bits: Array(accountPublicKey.publicKeys.length).fill(0).map((_, i) => i)
|
|
381
386
|
})
|
|
@@ -472,4 +477,4 @@ export {
|
|
|
472
477
|
hashValues,
|
|
473
478
|
generateUserTransactionHash
|
|
474
479
|
};
|
|
475
|
-
//# sourceMappingURL=chunk-
|
|
480
|
+
//# sourceMappingURL=chunk-IJ7XCPP3.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/transactions/transactionBuilder/transactionBuilder.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\n/**\n * This file handles the transaction creation lifecycle.\n * It holds different operations to generate a transaction payload, a raw transaction,\n * and a signed transaction that can be simulated, signed and submitted to chain.\n */\nimport { sha3_256 as sha3Hash } from \"@noble/hashes/sha3\";\nimport { AptosConfig } from \"../../api/aptosConfig\";\nimport { AccountAddress, AccountAddressInput, Hex, PublicKey } from \"../../core\";\nimport {\n AnyPublicKey,\n AnySignature,\n KeylessPublicKey,\n KeylessSignature,\n Secp256k1PublicKey,\n FederatedKeylessPublicKey,\n MultiKey,\n MultiKeySignature,\n} from \"../../core/crypto\";\nimport { Ed25519PublicKey, Ed25519Signature } from \"../../core/crypto/ed25519\";\nimport { getInfo } from \"../../internal/utils\";\nimport { getLedgerInfo } from \"../../internal/general\";\nimport { getGasPriceEstimation } from \"../../internal/transaction\";\nimport { NetworkToChainId } from \"../../utils/apiEndpoints\";\nimport { DEFAULT_MAX_GAS_AMOUNT, DEFAULT_TXN_EXP_SEC_FROM_NOW } from \"../../utils/const\";\nimport { normalizeBundle } from \"../../utils/normalizeBundle\";\nimport {\n AccountAuthenticator,\n AccountAuthenticatorEd25519,\n AccountAuthenticatorMultiEd25519,\n AccountAuthenticatorMultiKey,\n AccountAuthenticatorNoAccountAuthenticator,\n AccountAuthenticatorSingleKey,\n} from \"../authenticator/account\";\nimport {\n TransactionAuthenticator,\n TransactionAuthenticatorEd25519,\n TransactionAuthenticatorFeePayer,\n TransactionAuthenticatorMultiAgent,\n TransactionAuthenticatorMultiEd25519,\n TransactionAuthenticatorSingleSender,\n} from \"../authenticator/transaction\";\nimport {\n ChainId,\n EntryFunction,\n FeePayerRawTransaction,\n MultiAgentRawTransaction,\n MultiSig,\n MultiSigTransactionPayload,\n RawTransaction,\n Script,\n TransactionPayloadEntryFunction,\n TransactionPayloadMultiSig,\n TransactionPayloadScript,\n} from \"../instances\";\nimport { SignedTransaction } from \"../instances/signedTransaction\";\nimport {\n AnyRawTransaction,\n AnyTransactionPayloadInstance,\n EntryFunctionArgumentTypes,\n InputGenerateMultiAgentRawTransactionArgs,\n InputGenerateRawTransactionArgs,\n InputGenerateSingleSignerRawTransactionArgs,\n InputGenerateTransactionOptions,\n InputScriptData,\n InputSimulateTransactionData,\n InputMultiSigDataWithRemoteABI,\n InputEntryFunctionDataWithRemoteABI,\n InputGenerateTransactionPayloadDataWithRemoteABI,\n InputSubmitTransactionData,\n InputGenerateTransactionPayloadDataWithABI,\n InputEntryFunctionDataWithABI,\n InputMultiSigDataWithABI,\n InputViewFunctionDataWithRemoteABI,\n InputViewFunctionDataWithABI,\n FunctionABI,\n} from \"../types\";\nimport { convertArgument, fetchEntryFunctionAbi, fetchViewFunctionAbi, standardizeTypeTags } from \"./remoteAbi\";\nimport { memoizeAsync } from \"../../utils/memoize\";\nimport { isScriptDataInput } from \"./helpers\";\nimport { SimpleTransaction } from \"../instances/simpleTransaction\";\nimport { MultiAgentTransaction } from \"../instances/multiAgentTransaction\";\nimport { getFunctionParts } from \"../../utils/helpers\";\n\n/**\n * Builds a transaction payload based on the provided arguments and returns a transaction payload.\n * This function uses the RemoteABI by default, but can also utilize a specified ABI.\n * When we call our `generateTransactionPayload` function with the relevant type properties,\n * Typescript can infer the return type based on the appropriate function overload.\n * @param args - The input data for generating the transaction payload.\n * @param args.function - The function to be called, specified in the format \"moduleAddress::moduleName::functionName\".\n * @param args.functionArguments - The arguments to pass to the function.\n * @param args.typeArguments - The type arguments for the function.\n * @param args.aptosConfig - The configuration settings for Aptos.\n * @param args.abi - The ABI to use for the transaction, if not using the RemoteABI.\n *\n * @returns TransactionPayload - The generated transaction payload, which can be of type TransactionPayloadScript,\n * TransactionPayloadMultiSig, or TransactionPayloadEntryFunction.\n * @group Implementation\n * @category Transactions\n */\nexport async function generateTransactionPayload(args: InputScriptData): Promise<TransactionPayloadScript>;\n/**\n * @group Implementation\n * @category Transactions\n */\nexport async function generateTransactionPayload(\n args: InputEntryFunctionDataWithRemoteABI,\n): Promise<TransactionPayloadEntryFunction>;\n/**\n * @group Implementation\n * @category Transactions\n */\nexport async function generateTransactionPayload(\n args: InputMultiSigDataWithRemoteABI,\n): Promise<TransactionPayloadMultiSig>;\n\n/**\n * Builds a transaction payload based on the data argument and returns\n * a transaction payload - TransactionPayloadScript | TransactionPayloadMultiSig | TransactionPayloadEntryFunction\n *\n * This uses the RemoteABI by default, and the remote ABI can be skipped by using generateTransactionPayloadWithABI\n *\n * @param args.data GenerateTransactionPayloadData\n *\n * @return TransactionPayload\n * @group Implementation\n * @category Transactions\n */\nexport async function generateTransactionPayload(\n args: InputGenerateTransactionPayloadDataWithRemoteABI,\n): Promise<AnyTransactionPayloadInstance> {\n if (isScriptDataInput(args)) {\n return generateTransactionPayloadScript(args);\n }\n const { moduleAddress, moduleName, functionName } = getFunctionParts(args.function);\n\n const functionAbi = await fetchAbi({\n key: \"entry-function\",\n moduleAddress,\n moduleName,\n functionName,\n aptosConfig: args.aptosConfig,\n abi: args.abi,\n fetch: fetchEntryFunctionAbi,\n });\n\n // Fill in the ABI\n return generateTransactionPayloadWithABI({ ...args, abi: functionAbi });\n}\n\n/**\n * Generates a transaction payload using the provided ABI and function details.\n * This function helps create a properly structured transaction payload for executing a specific function on a module.\n *\n * @param args - The input data required to generate the transaction payload.\n * @param args.abi - The ABI of the function to be executed.\n * @param args.function - The fully qualified name of the function in the format `moduleAddress::moduleName::functionName`.\n * @param args.typeArguments - An array of type arguments that correspond to the function's type parameters.\n * @param args.functionArguments - An array of arguments to be passed to the function.\n * @param args.multisigAddress - (Optional) The address for a multisig transaction if applicable.\n *\n * @throws Error if the type argument count does not match the ABI or if the number of function arguments is incorrect.\n * @group Implementation\n * @category Transactions\n */\nexport function generateTransactionPayloadWithABI(args: InputEntryFunctionDataWithABI): TransactionPayloadEntryFunction;\n/**\n * @group Implementation\n * @category Transactions\n */\nexport function generateTransactionPayloadWithABI(args: InputMultiSigDataWithABI): TransactionPayloadMultiSig;\n/**\n * @group Implementation\n * @category Transactions\n */\nexport function generateTransactionPayloadWithABI(\n args: InputGenerateTransactionPayloadDataWithABI,\n): AnyTransactionPayloadInstance {\n const functionAbi = args.abi;\n const { moduleAddress, moduleName, functionName } = getFunctionParts(args.function);\n\n // Ensure that all type arguments are typed properly\n const typeArguments = standardizeTypeTags(args.typeArguments);\n\n // Check the type argument count against the ABI\n if (typeArguments.length !== functionAbi.typeParameters.length) {\n throw new Error(\n `Type argument count mismatch, expected ${functionAbi.typeParameters.length}, received ${typeArguments.length}`,\n );\n }\n\n // Check all BCS types, and convert any non-BCS types\n const functionArguments: Array<EntryFunctionArgumentTypes> = args.functionArguments.map((arg, i) =>\n /**\n * Converts the argument for a specified function using its ABI and type arguments.\n * This function helps ensure that the correct number of arguments is provided for the function call.\n *\n * @param args - The arguments for the function call.\n * @param args.function - The specific function to be invoked.\n * @param functionAbi - The ABI (Application Binary Interface) of the function, which includes parameter details.\n * @param arg - The argument to be converted.\n * @param i - The index of the argument in the function call.\n * @param typeArguments - Additional type arguments that may be required for the conversion.\n * @group Implementation\n * @category Transactions\n */\n // TODO: Fix JSDoc\n convertArgument(args.function, functionAbi, arg, i, typeArguments),\n );\n\n // Check that all arguments are accounted for\n if (functionArguments.length !== functionAbi.parameters.length) {\n throw new Error(\n // eslint-disable-next-line max-len\n `Too few arguments for '${moduleAddress}::${moduleName}::${functionName}', expected ${functionAbi.parameters.length} but got ${functionArguments.length}`,\n );\n }\n\n // Generate entry function payload\n const entryFunctionPayload = EntryFunction.build(\n `${moduleAddress}::${moduleName}`,\n functionName,\n typeArguments,\n functionArguments,\n );\n\n // Send it as multi sig if it's a multisig payload\n if (\"multisigAddress\" in args) {\n const multisigAddress = AccountAddress.from(args.multisigAddress);\n return new TransactionPayloadMultiSig(\n new MultiSig(multisigAddress, new MultiSigTransactionPayload(entryFunctionPayload)),\n );\n }\n\n // Otherwise send as an entry function\n return new TransactionPayloadEntryFunction(entryFunctionPayload);\n}\n\n/**\n * Generates the payload for a view function call using the provided arguments.\n * This function helps in preparing the necessary data to interact with a specific view function on the blockchain.\n *\n * @param args - The input data required to generate the view function payload.\n * @param args.function - The function identifier in the format \"moduleAddress::moduleName::functionName\".\n * @param args.aptosConfig - Configuration settings for the Aptos client.\n * @param args.abi - The ABI (Application Binary Interface) of the module.\n *\n * @returns The generated payload for the view function call.\n * @group Implementation\n * @category Transactions\n */\nexport async function generateViewFunctionPayload(args: InputViewFunctionDataWithRemoteABI): Promise<EntryFunction> {\n const { moduleAddress, moduleName, functionName } = getFunctionParts(args.function);\n\n const functionAbi = await fetchAbi({\n key: \"view-function\",\n moduleAddress,\n moduleName,\n functionName,\n aptosConfig: args.aptosConfig,\n abi: args.abi,\n fetch: fetchViewFunctionAbi,\n });\n\n // Fill in the ABI\n return generateViewFunctionPayloadWithABI({ abi: functionAbi, ...args });\n}\n\n/**\n * Generates a payload for a view function call using the provided ABI and arguments.\n * This function ensures that the type arguments and function arguments are correctly formatted\n * and match the expected counts as defined in the ABI.\n *\n * @param args - The input data for generating the view function payload.\n * @param args.abi - The ABI of the function to be called.\n * @param args.function - The full name of the function in the format \"moduleAddress::moduleName::functionName\".\n * @param args.typeArguments - An array of type arguments to be used in the function call.\n * @param args.functionArguments - An array of arguments to be passed to the function.\n *\n * @throws Error if the type argument count does not match the ABI or if the function arguments\n * do not match the expected parameters defined in the ABI.\n * @group Implementation\n * @category Transactions\n */\nexport function generateViewFunctionPayloadWithABI(args: InputViewFunctionDataWithABI): EntryFunction {\n const functionAbi = args.abi;\n const { moduleAddress, moduleName, functionName } = getFunctionParts(args.function);\n\n // Ensure that all type arguments are typed properly\n const typeArguments = standardizeTypeTags(args.typeArguments);\n\n // Check the type argument count against the ABI\n if (typeArguments.length !== functionAbi.typeParameters.length) {\n throw new Error(\n `Type argument count mismatch, expected ${functionAbi.typeParameters.length}, received ${typeArguments.length}`,\n );\n }\n\n // Check all BCS types, and convert any non-BCS types\n const functionArguments: Array<EntryFunctionArgumentTypes> =\n args?.functionArguments?.map((arg, i) => convertArgument(args.function, functionAbi, arg, i, typeArguments)) ?? [];\n\n // Check that all arguments are accounted for\n if (functionArguments.length !== functionAbi.parameters.length) {\n throw new Error(\n // eslint-disable-next-line max-len\n `Too few arguments for '${moduleAddress}::${moduleName}::${functionName}', expected ${functionAbi.parameters.length} but got ${functionArguments.length}`,\n );\n }\n\n // Generate entry function payload\n return EntryFunction.build(`${moduleAddress}::${moduleName}`, functionName, typeArguments, functionArguments);\n}\n\n/**\n * Generates a transaction payload script based on the provided input data.\n * This function helps in creating a structured script for transaction processing.\n *\n * @param args - The input data required to generate the transaction payload script.\n * @param args.bytecode - The bytecode to be converted into a Uint8Array.\n * @param args.typeArguments - The type arguments that will be standardized.\n * @param args.functionArguments - The arguments for the function being called.\n * @returns A new instance of TransactionPayloadScript.\n * @group Implementation\n * @category Transactions\n */\nfunction generateTransactionPayloadScript(args: InputScriptData) {\n return new TransactionPayloadScript(\n new Script(\n Hex.fromHexInput(args.bytecode).toUint8Array(),\n standardizeTypeTags(args.typeArguments),\n args.functionArguments,\n ),\n );\n}\n\n/**\n * Generates a raw transaction that can be sent to the Aptos network.\n *\n * @param args - The arguments for generating the raw transaction.\n * @param args.aptosConfig - The configuration for the Aptos network.\n * @param args.sender - The transaction's sender account address as a hex input.\n * @param args.payload - The transaction payload, which can be created using generateTransactionPayload().\n * @param args.options - Optional parameters for transaction generation.\n * @param args.feePayerAddress - The address of the fee payer for sponsored transactions.\n *\n * @returns RawTransaction - The generated raw transaction.\n * @group Implementation\n * @category Transactions\n */\nexport async function generateRawTransaction(args: {\n aptosConfig: AptosConfig;\n sender: AccountAddressInput;\n payload: AnyTransactionPayloadInstance;\n options?: InputGenerateTransactionOptions;\n feePayerAddress?: AccountAddressInput;\n}): Promise<RawTransaction> {\n const { aptosConfig, sender, payload, options, feePayerAddress } = args;\n\n const getChainId = async () => {\n if (NetworkToChainId[aptosConfig.network]) {\n return { chainId: NetworkToChainId[aptosConfig.network] };\n }\n const info = await getLedgerInfo({ aptosConfig });\n return { chainId: info.chain_id };\n };\n\n const getGasUnitPrice = async () => {\n if (options?.gasUnitPrice) {\n return { gasEstimate: options.gasUnitPrice };\n }\n const estimation = await getGasPriceEstimation({ aptosConfig });\n return { gasEstimate: estimation.gas_estimate };\n };\n\n const getSequenceNumberForAny = async () => {\n const getSequenceNumber = async () => {\n if (options?.accountSequenceNumber !== undefined) {\n return options.accountSequenceNumber;\n }\n\n return (await getInfo({ aptosConfig, accountAddress: sender })).sequence_number;\n };\n\n /**\n * Check if is sponsored transaction to honor AIP-52\n * {@link https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-52.md}\n * @group Implementation\n * @category Transactions\n */\n if (feePayerAddress && AccountAddress.from(feePayerAddress).equals(AccountAddress.ZERO)) {\n // Handle sponsored transaction generation with the option that\n // the main signer has not been created on chain\n try {\n // Check if main signer has been created on chain, if not assign sequence number 0\n return await getSequenceNumber();\n } catch (e: any) {\n return 0;\n }\n } else {\n return getSequenceNumber();\n }\n };\n const [{ chainId }, { gasEstimate }, sequenceNumber] = await Promise.all([\n getChainId(),\n getGasUnitPrice(),\n getSequenceNumberForAny(),\n ]);\n\n const { maxGasAmount, gasUnitPrice, expireTimestamp } = {\n maxGasAmount: options?.maxGasAmount ? BigInt(options.maxGasAmount) : BigInt(DEFAULT_MAX_GAS_AMOUNT),\n gasUnitPrice: options?.gasUnitPrice ?? BigInt(gasEstimate),\n expireTimestamp: options?.expireTimestamp ?? BigInt(Math.floor(Date.now() / 1000) + DEFAULT_TXN_EXP_SEC_FROM_NOW),\n };\n\n return new RawTransaction(\n AccountAddress.from(sender),\n BigInt(sequenceNumber),\n payload,\n BigInt(maxGasAmount),\n BigInt(gasUnitPrice),\n BigInt(expireTimestamp),\n new ChainId(chainId),\n );\n}\n\n/**\n * Generates a transaction based on the provided arguments.\n * This function can create both simple and multi-agent transactions, allowing for flexible transaction handling.\n *\n * @param args - The input arguments for generating the transaction.\n * @param args.aptosConfig - The configuration settings for Aptos.\n * @param args.sender - The transaction's sender account address as a hex input.\n * @param args.payload - The transaction payload, which can be created using `generateTransactionPayload()`.\n * @param args.options - Optional. Transaction options object.\n * @param args.secondarySignerAddresses - Optional. An array of addresses for additional signers in a multi-signature transaction.\n * @param args.feePayerAddress - Optional. The address of the fee payer for sponsored transactions.\n * @returns An instance of a transaction, which may include secondary signer addresses and a fee payer address.\n * @group Implementation\n * @category Transactions\n */\nexport async function buildTransaction(args: InputGenerateSingleSignerRawTransactionArgs): Promise<SimpleTransaction>;\n/**\n * @group Implementation\n * @category Transactions\n */\nexport async function buildTransaction(args: InputGenerateMultiAgentRawTransactionArgs): Promise<MultiAgentTransaction>;\n\n/**\n * Generates a transaction based on the provided arguments\n *\n * Note: we can start with one function to support all different payload/transaction types,\n * and if to complex to use, we could have function for each type\n *\n * @param args.aptosConfig AptosConfig\n * @param args.sender The transaction's sender account address as a hex input\n * @param args.payload The transaction payload - can create by using generateTransactionPayload()\n * @param args.options optional. Transaction options object\n * @param args.secondarySignerAddresses optional. For when want to create a multi signers transaction\n * @param args.feePayerAddress optional. For when want to create a fee payer (aka sponsored) transaction\n *\n * @return An instance of a RawTransaction, plus optional secondary/fee payer addresses\n * ```\n * {\n * rawTransaction: RawTransaction,\n * secondarySignerAddresses?: Array<AccountAddress>,\n * feePayerAddress?: AccountAddress\n * }\n * ```\n * @group Implementation\n * @category Transactions\n */\nexport async function buildTransaction(args: InputGenerateRawTransactionArgs): Promise<AnyRawTransaction> {\n const { aptosConfig, sender, payload, options, feePayerAddress } = args;\n // generate raw transaction\n const rawTxn = await generateRawTransaction({\n aptosConfig,\n sender,\n payload,\n options,\n feePayerAddress,\n });\n\n // if multi agent transaction\n if (\"secondarySignerAddresses\" in args) {\n const signers: Array<AccountAddress> =\n args.secondarySignerAddresses?.map((signer) => AccountAddress.from(signer)) ?? [];\n\n return new MultiAgentTransaction(\n rawTxn,\n signers,\n args.feePayerAddress ? AccountAddress.from(args.feePayerAddress) : undefined,\n );\n }\n // return the raw transaction\n return new SimpleTransaction(rawTxn, args.feePayerAddress ? AccountAddress.from(args.feePayerAddress) : undefined);\n}\n\n/**\n * Generate a signed transaction for simulation before submitting it to the chain.\n * This function helps in preparing a transaction that can be simulated, allowing users to verify its validity and expected behavior.\n *\n * @param args - The input data required to generate the signed transaction for simulation.\n * @param args.transaction - An Aptos transaction type to sign.\n * @param args.signerPublicKey - The public key of the signer.\n * @param args.secondarySignersPublicKeys - Optional. The public keys of secondary signers if it is a multi-signer transaction.\n * @param args.feePayerPublicKey - Optional. The public key of the fee payer in a sponsored transaction.\n * @param args.options - Optional. Additional options for simulating the transaction.\n *\n * @returns A signed serialized transaction that can be simulated.\n * @group Implementation\n * @category Transactions\n */\nexport function generateSignedTransactionForSimulation(args: InputSimulateTransactionData): Uint8Array {\n const { signerPublicKey, transaction, secondarySignersPublicKeys, feePayerPublicKey } = args;\n\n const accountAuthenticator = getAuthenticatorForSimulation(signerPublicKey);\n\n // fee payer transaction\n if (transaction.feePayerAddress) {\n const transactionToSign = new FeePayerRawTransaction(\n transaction.rawTransaction,\n transaction.secondarySignerAddresses ?? [],\n transaction.feePayerAddress,\n );\n let secondaryAccountAuthenticators: Array<AccountAuthenticator> = [];\n if (transaction.secondarySignerAddresses) {\n if (secondarySignersPublicKeys) {\n secondaryAccountAuthenticators = secondarySignersPublicKeys.map((publicKey) =>\n getAuthenticatorForSimulation(publicKey),\n );\n } else {\n secondaryAccountAuthenticators = Array.from({ length: transaction.secondarySignerAddresses.length }, () =>\n getAuthenticatorForSimulation(undefined),\n );\n }\n }\n const feePayerAuthenticator = getAuthenticatorForSimulation(feePayerPublicKey);\n\n const transactionAuthenticator = new TransactionAuthenticatorFeePayer(\n accountAuthenticator,\n transaction.secondarySignerAddresses ?? [],\n secondaryAccountAuthenticators,\n {\n address: transaction.feePayerAddress,\n authenticator: feePayerAuthenticator,\n },\n );\n return new SignedTransaction(transactionToSign.raw_txn, transactionAuthenticator).bcsToBytes();\n }\n\n // multi agent transaction\n if (transaction.secondarySignerAddresses) {\n const transactionToSign = new MultiAgentRawTransaction(\n transaction.rawTransaction,\n transaction.secondarySignerAddresses,\n );\n\n let secondaryAccountAuthenticators: Array<AccountAuthenticator> = [];\n\n if (secondarySignersPublicKeys) {\n secondaryAccountAuthenticators = secondarySignersPublicKeys.map((publicKey) =>\n getAuthenticatorForSimulation(publicKey),\n );\n } else {\n secondaryAccountAuthenticators = Array.from({ length: transaction.secondarySignerAddresses.length }, () =>\n getAuthenticatorForSimulation(undefined),\n );\n }\n\n const transactionAuthenticator = new TransactionAuthenticatorMultiAgent(\n accountAuthenticator,\n transaction.secondarySignerAddresses,\n secondaryAccountAuthenticators,\n );\n\n return new SignedTransaction(transactionToSign.raw_txn, transactionAuthenticator).bcsToBytes();\n }\n\n // single signer raw transaction\n let transactionAuthenticator;\n if (accountAuthenticator instanceof AccountAuthenticatorEd25519) {\n transactionAuthenticator = new TransactionAuthenticatorEd25519(\n accountAuthenticator.public_key,\n accountAuthenticator.signature,\n );\n } else if (\n accountAuthenticator instanceof AccountAuthenticatorSingleKey ||\n accountAuthenticator instanceof AccountAuthenticatorMultiKey\n ) {\n transactionAuthenticator = new TransactionAuthenticatorSingleSender(accountAuthenticator);\n } else if (accountAuthenticator instanceof AccountAuthenticatorNoAccountAuthenticator) {\n transactionAuthenticator = new TransactionAuthenticatorSingleSender(accountAuthenticator);\n } else {\n throw new Error(\"Invalid public key\");\n }\n return new SignedTransaction(transaction.rawTransaction, transactionAuthenticator).bcsToBytes();\n}\n\n/**\n * @group Implementation\n * @category Transactions\n */\nexport function getAuthenticatorForSimulation(publicKey?: PublicKey) {\n if (!publicKey) {\n return new AccountAuthenticatorNoAccountAuthenticator();\n }\n\n // Wrap the public key types below with AnyPublicKey as they are only support through single sender.\n // Learn more about AnyPublicKey here - https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-55.md\n const convertToAnyPublicKey =\n KeylessPublicKey.isInstance(publicKey) ||\n FederatedKeylessPublicKey.isInstance(publicKey) ||\n Secp256k1PublicKey.isInstance(publicKey);\n const accountPublicKey = convertToAnyPublicKey ? new AnyPublicKey(publicKey) : publicKey;\n\n // No need to for the signature to be matching in scheme. All that matters for simulations is that it's not valid\n const invalidSignature = new Ed25519Signature(new Uint8Array(64));\n\n if (Ed25519PublicKey.isInstance(accountPublicKey)) {\n return new AccountAuthenticatorEd25519(accountPublicKey, invalidSignature);\n }\n\n if (AnyPublicKey.isInstance(accountPublicKey)) {\n if (KeylessPublicKey.isInstance(accountPublicKey.publicKey)) {\n return new AccountAuthenticatorSingleKey(\n accountPublicKey,\n new AnySignature(KeylessSignature.getSimulationSignature()),\n );\n }\n return new AccountAuthenticatorSingleKey(accountPublicKey, new AnySignature(invalidSignature));\n }\n\n if (MultiKey.isInstance(accountPublicKey)) {\n return new AccountAuthenticatorMultiKey(\n accountPublicKey,\n new MultiKeySignature({\n signatures: accountPublicKey.publicKeys.map((pubKey) => {\n if (KeylessPublicKey.isInstance(pubKey.publicKey) || FederatedKeylessPublicKey.isInstance(pubKey.publicKey)) {\n return new AnySignature(KeylessSignature.getSimulationSignature());\n }\n return new AnySignature(invalidSignature);\n }),\n bitmap: accountPublicKey.createBitmap({\n bits: Array(accountPublicKey.publicKeys.length)\n .fill(0)\n .map((_, i) => i),\n }),\n }),\n );\n }\n\n throw new Error(\"Unsupported PublicKey used for simulations\");\n}\n\n/**\n * Generate a signed transaction ready for submission to the blockchain.\n * This function prepares the transaction by authenticating the sender and any additional signers based on the provided arguments.\n *\n * @param args - The input data required to generate the signed transaction.\n * @param args.transaction - An Aptos transaction type containing the details of the transaction.\n * @param args.senderAuthenticator - The account authenticator of the transaction sender.\n * @param args.feePayerAuthenticator - The authenticator for the fee payer, required if the transaction has a fee payer address.\n * @param args.additionalSignersAuthenticators - Optional authenticators for additional signers in a multi-signer transaction.\n *\n * @returns A Uint8Array representing the signed transaction in bytes.\n *\n * @throws Error if the feePayerAuthenticator is not provided for a fee payer transaction.\n * @throws Error if additionalSignersAuthenticators are not provided for a multi-signer transaction.\n * @group Implementation\n * @category Transactions\n */\nexport function generateSignedTransaction(args: InputSubmitTransactionData): Uint8Array {\n const { transaction, feePayerAuthenticator, additionalSignersAuthenticators } = args;\n const senderAuthenticator = normalizeBundle(AccountAuthenticator, args.senderAuthenticator);\n\n let txnAuthenticator: TransactionAuthenticator;\n if (transaction.feePayerAddress) {\n if (!feePayerAuthenticator) {\n throw new Error(\"Must provide a feePayerAuthenticator argument to generate a signed fee payer transaction\");\n }\n txnAuthenticator = new TransactionAuthenticatorFeePayer(\n senderAuthenticator,\n transaction.secondarySignerAddresses ?? [],\n additionalSignersAuthenticators ?? [],\n {\n address: transaction.feePayerAddress,\n authenticator: feePayerAuthenticator,\n },\n );\n } else if (transaction.secondarySignerAddresses) {\n if (!additionalSignersAuthenticators) {\n throw new Error(\n \"Must provide a additionalSignersAuthenticators argument to generate a signed multi agent transaction\",\n );\n }\n txnAuthenticator = new TransactionAuthenticatorMultiAgent(\n senderAuthenticator,\n transaction.secondarySignerAddresses,\n additionalSignersAuthenticators,\n );\n } else if (senderAuthenticator instanceof AccountAuthenticatorEd25519) {\n txnAuthenticator = new TransactionAuthenticatorEd25519(\n senderAuthenticator.public_key,\n senderAuthenticator.signature,\n );\n } else if (senderAuthenticator instanceof AccountAuthenticatorMultiEd25519) {\n txnAuthenticator = new TransactionAuthenticatorMultiEd25519(\n senderAuthenticator.public_key,\n senderAuthenticator.signature,\n );\n } else {\n txnAuthenticator = new TransactionAuthenticatorSingleSender(senderAuthenticator);\n }\n\n return new SignedTransaction(transaction.rawTransaction, txnAuthenticator).bcsToBytes();\n}\n\n/**\n * Hashes the set of values using a SHA-3 256 hash algorithm.\n * @param input - An array of UTF-8 strings or Uint8Array byte arrays to be hashed.\n * @group Implementation\n * @category Transactions\n */\nexport function hashValues(input: (Uint8Array | string)[]): Uint8Array {\n const hash = sha3Hash.create();\n for (const item of input) {\n hash.update(item);\n }\n return hash.digest();\n}\n\n/**\n * The domain separated prefix for hashing transactions\n * @group Implementation\n * @category Transactions\n */\nconst TRANSACTION_PREFIX = hashValues([\"APTOS::Transaction\"]);\n\n/**\n * Generates a user transaction hash for the provided transaction payload, which must already have an authenticator.\n * This function helps ensure the integrity and uniqueness of the transaction by producing a hash based on the signed transaction data.\n *\n * @param args - The input data required to submit the transaction.\n * @param args.authenticator - The authenticator for the transaction.\n * @param args.payload - The payload containing the transaction details.\n * @param args.sender - The address of the sender initiating the transaction.\n * @param args.sequenceNumber - The sequence number of the transaction for the sender.\n * @group Implementation\n * @category Transactions\n */\nexport function generateUserTransactionHash(args: InputSubmitTransactionData): string {\n const signedTransaction = generateSignedTransaction(args);\n\n // Transaction signature is defined as, the domain separated prefix based on struct (Transaction)\n // Then followed by the type of the transaction for the enum, UserTransaction is 0\n // Then followed by BCS encoded bytes of the signed transaction\n return new Hex(hashValues([TRANSACTION_PREFIX, new Uint8Array([0]), signedTransaction])).toString();\n}\n\n/**\n * Fetches and caches ABIs while allowing for pass-through on provided ABIs.\n *\n * @param key - A unique identifier for the cached ABI.\n * @param moduleAddress - The address of the module from which to fetch the ABI.\n * @param moduleName - The name of the module containing the function.\n * @param functionName - The name of the function whose ABI is being fetched.\n * @param aptosConfig - Configuration settings for Aptos.\n * @param abi - An optional ABI to use if already available.\n * @param fetch - A function to fetch the ABI if it is not provided.\n * @group Implementation\n * @category Transactions\n */\nasync function fetchAbi<T extends FunctionABI>({\n key,\n moduleAddress,\n moduleName,\n functionName,\n aptosConfig,\n abi,\n fetch,\n}: {\n key: string;\n moduleAddress: string;\n moduleName: string;\n functionName: string;\n aptosConfig: AptosConfig;\n abi?: T;\n fetch: (moduleAddress: string, moduleName: string, functionName: string, aptosConfig: AptosConfig) => Promise<T>;\n}): Promise<T> {\n if (abi !== undefined) {\n return abi;\n }\n\n // We fetch the entry function ABI, and then pretend that we already had the ABI\n return memoizeAsync(\n async () => fetch(moduleAddress, moduleName, functionName, aptosConfig),\n `${key}-${aptosConfig.network}-${moduleAddress}-${moduleName}-${functionName}`,\n 1000 * 60 * 5, // 5 minutes\n )();\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAQA,SAAS,YAAY,gBAAgB;AA2HrC,eAAsB,2BACpB,MACwC;AACxC,MAAI,kBAAkB,IAAI,GAAG;AAC3B,WAAO,iCAAiC,IAAI;AAAA,EAC9C;AACA,QAAM,EAAE,eAAe,YAAY,aAAa,IAAI,iBAAiB,KAAK,QAAQ;AAElF,QAAM,cAAc,MAAM,SAAS;AAAA,IACjC,KAAK;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA,aAAa,KAAK;AAAA,IAClB,KAAK,KAAK;AAAA,IACV,OAAO;AAAA,EACT,CAAC;AAGD,SAAO,kCAAkC,EAAE,GAAG,MAAM,KAAK,YAAY,CAAC;AACxE;AA2BO,SAAS,kCACd,MAC+B;AAC/B,QAAM,cAAc,KAAK;AACzB,QAAM,EAAE,eAAe,YAAY,aAAa,IAAI,iBAAiB,KAAK,QAAQ;AAGlF,QAAM,gBAAgB,oBAAoB,KAAK,aAAa;AAG5D,MAAI,cAAc,WAAW,YAAY,eAAe,QAAQ;AAC9D,UAAM,IAAI;AAAA,MACR,0CAA0C,YAAY,eAAe,MAAM,cAAc,cAAc,MAAM;AAAA,IAC/G;AAAA,EACF;AAGA,QAAM,oBAAuD,KAAK,kBAAkB;AAAA,IAAI,CAAC,KAAK;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAe5F,gBAAgB,KAAK,UAAU,aAAa,KAAK,GAAG,aAAa;AAAA;AAAA,EACnE;AAGA,MAAI,kBAAkB,WAAW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,IACtB;AAAA,EACF,WAAW,+BAA+B,kCAAkC;AAC1E,uBAAmB,IAAI;AAAA,MACrB,oBAAoB;AAAA,MACpB,oBAAoB;AAAA,IACtB;AAAA,EACF,OAAO;AACL,uBAAmB,IAAI,qCAAqC,mBAAmB;AAAA,EACjF;AAEA,SAAO,IAAI,kBAAkB,YAAY,gBAAgB,gBAAgB,EAAE,WAAW;AACxF;AAQO,SAAS,WAAW,OAA4C;AACrE,QAAM,OAAO,SAAS,OAAO;AAC7B,aAAW,QAAQ,OAAO;AACxB,SAAK,OAAO,IAAI;AAAA,EAClB;AACA,SAAO,KAAK,OAAO;AACrB;AAOA,IAAM,qBAAqB,WAAW,CAAC,oBAAoB,CAAC;AAcrD,SAAS,4BAA4B,MAA0C;AACpF,QAAM,oBAAoB,0BAA0B,IAAI;AAKxD,SAAO,IAAI,IAAI,WAAW,CAAC,oBAAoB,IAAI,WAAW,CAAC,CAAC,CAAC,GAAG,iBAAiB,CAAC,CAAC,EAAE,SAAS;AACpG;AAeA,eAAe,SAAgC;AAAA,EAC7C;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAQe;AACb,MAAI,QAAQ,QAAW;AACrB,WAAO;AAAA,EACT;AAGA,SAAO;AAAA,IACL,YAAY,MAAM,eAAe,YAAY,cAAc,WAAW;AAAA,IACtE,GAAG,GAAG,IAAI,YAAY,OAAO,IAAI,aAAa,IAAI,UAAU,IAAI,YAAY;AAAA,IAC5E,MAAO,KAAK;AAAA;AAAA,EACd,EAAE;AACJ;","names":["transactionAuthenticator"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
deriveTransactionType,
|
|
3
3
|
generateSigningMessage
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-F4VI7BNX.mjs";
|
|
5
5
|
import {
|
|
6
6
|
AccountAuthenticatorSingleKey
|
|
7
7
|
} from "./chunk-AGKEC2IM.mjs";
|
|
@@ -404,4 +404,4 @@ export {
|
|
|
404
404
|
AbstractKeylessAccount,
|
|
405
405
|
TransactionAndProof
|
|
406
406
|
};
|
|
407
|
-
//# sourceMappingURL=chunk-
|
|
407
|
+
//# sourceMappingURL=chunk-ILTEOGFF.mjs.map
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import {
|
|
2
2
|
view,
|
|
3
3
|
viewJson
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-ORCQEMJL.mjs";
|
|
5
5
|
import {
|
|
6
6
|
getBlockByHeight,
|
|
7
7
|
getBlockByVersion
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-BU43ZFDJ.mjs";
|
|
9
9
|
import {
|
|
10
10
|
getChainTopUserTransactions,
|
|
11
11
|
getIndexerLastSuccessVersion,
|
|
12
12
|
getLedgerInfo,
|
|
13
13
|
getProcessorStatus,
|
|
14
14
|
queryIndexer
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-YK66QBML.mjs";
|
|
16
16
|
|
|
17
17
|
// src/api/general.ts
|
|
18
18
|
var General = class {
|
|
@@ -247,11 +247,11 @@ var General = class {
|
|
|
247
247
|
* async function runExample() {
|
|
248
248
|
* // Querying the Aptos Indexer for ledger information
|
|
249
249
|
* const topUserTransactions = await aptos.queryIndexer({
|
|
250
|
-
* query: `query MyQuery {
|
|
250
|
+
* query: { query: `query MyQuery {
|
|
251
251
|
* ledger_infos {
|
|
252
252
|
* chain_id
|
|
253
253
|
* }
|
|
254
|
-
* }`
|
|
254
|
+
* }`}
|
|
255
255
|
* });
|
|
256
256
|
*
|
|
257
257
|
* console.log(topUserTransactions);
|
|
@@ -319,4 +319,4 @@ var General = class {
|
|
|
319
319
|
export {
|
|
320
320
|
General
|
|
321
321
|
};
|
|
322
|
-
//# sourceMappingURL=chunk-
|
|
322
|
+
//# sourceMappingURL=chunk-IP7GATDH.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/api/general.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { AptosConfig } from \"./aptosConfig\";\nimport {\n getChainTopUserTransactions,\n getIndexerLastSuccessVersion,\n getLedgerInfo,\n getProcessorStatus,\n queryIndexer,\n} from \"../internal/general\";\nimport { getBlockByHeight, getBlockByVersion } from \"../internal/transaction\";\nimport { view, viewJson } from \"../internal/view\";\nimport {\n AnyNumber,\n Block,\n GetChainTopUserTransactionsResponse,\n GetProcessorStatusResponse,\n GraphqlQuery,\n LedgerInfo,\n LedgerVersionArg,\n MoveValue,\n} from \"../types\";\nimport { ProcessorType } from \"../utils/const\";\nimport { InputViewFunctionData, InputViewFunctionJsonData } from \"../transactions\";\n\n/**\n * A class to query various Aptos-related information and perform operations on the Aptos blockchain.\n * @group General\n */\nexport class General {\n readonly config: AptosConfig;\n\n /**\n * Initializes a new instance of the Aptos client with the specified configuration.\n * This allows users to interact with the Aptos blockchain using the provided settings.\n *\n * @param config - The configuration settings for the Aptos client.\n * @param config.network - The network to connect to (e.g., TESTNET, MAINNET).\n * @param config.nodeUrl - The URL of the Aptos node to connect to.\n *\n * @example\n * ```typescript\n * import { Aptos, AptosConfig, Network } from \"@aptos-labs/ts-sdk\";\n *\n * async function runExample() {\n * // Create a configuration for the Aptos client\n * const config = new AptosConfig({\n * network: Network.TESTNET, // specify the network\n * nodeUrl: \"https://testnet.aptos.dev\" // specify the node URL\n * });\n *\n * // Initialize the Aptos client with the configuration\n * const aptos = new Aptos(config);\n *\n * console.log(\"Aptos client initialized:\", aptos);\n * }\n * runExample().catch(console.error);\n * ```\n * @group General\n */\n constructor(config: AptosConfig) {\n this.config = config;\n }\n\n /**\n * Queries for the Aptos ledger information.\n *\n * @returns The Aptos Ledger Info, which includes details such as chain ID, epoch, and ledger version.\n *\n * @example\n * ```typescript\n * import { Aptos, AptosConfig, Network } from \"@aptos-labs/ts-sdk\";\n *\n * const config = new AptosConfig({ network: Network.TESTNET });\n * const aptos = new Aptos(config);\n *\n * async function runExample() {\n * // Fetching the ledger information\n * const ledgerInfo = await aptos.getLedgerInfo();\n *\n * console.log(ledgerInfo);\n * }\n * runExample().catch(console.error);\n * ```\n * @group General\n */\n async getLedgerInfo(): Promise<LedgerInfo> {\n return getLedgerInfo({ aptosConfig: this.config });\n }\n\n /**\n * Retrieves the chain ID of the Aptos blockchain.\n *\n * @example\n * ```typescript\n * import { Aptos, AptosConfig, Network } from \"@aptos-labs/ts-sdk\";\n *\n * const config = new AptosConfig({ network: Network.TESTNET });\n * const aptos = new Aptos(config);\n *\n * async function runExample() {\n * // Fetching the chain ID\n * const chainId = await aptos.getChainId();\n * console.log(\"Chain ID:\", chainId);\n * }\n * runExample().catch(console.error);\n *\n * @returns The chain ID of the Aptos blockchain.\n * ```\n * @group General\n */\n async getChainId(): Promise<number> {\n const result = await this.getLedgerInfo();\n return result.chain_id;\n }\n\n /**\n * Retrieves block information by the specified ledger version.\n *\n * @param args - The arguments for retrieving the block.\n * @param args.ledgerVersion - The ledger version to lookup block information for.\n * @param args.options - Optional parameters for the request.\n * @param args.options.withTransactions - If set to true, include all transactions in the block.\n *\n * @returns Block information with optional transactions.\n *\n * @example\n * ```typescript\n * import { Aptos, AptosConfig, Network } from \"@aptos-labs/ts-sdk\";\n *\n * const config = new AptosConfig({ network: Network.TESTNET });\n * const aptos = new Aptos(config);\n *\n * async function runExample() {\n * // Retrieve block information for a specific ledger version\n * const block = await aptos.getBlockByVersion({ ledgerVersion: 5 });\n * console.log(block);\n * }\n * runExample().catch(console.error);\n * ```\n * @group General\n */\n async getBlockByVersion(args: {\n ledgerVersion: AnyNumber;\n options?: { withTransactions?: boolean };\n }): Promise<Block> {\n return getBlockByVersion({\n aptosConfig: this.config,\n ...args,\n });\n }\n\n /**\n * Retrieve a block by its height, allowing for the inclusion of transactions if specified.\n *\n * @param args - The parameters for the block retrieval.\n * @param args.blockHeight - The block height to look up, starting at 0.\n * @param args.options - Optional settings for the retrieval.\n * @param args.options.withTransactions - If set to true, includes all transactions in the block.\n *\n * @returns The block with optional transactions included.\n *\n * @example\n * ```typescript\n * import { Aptos, AptosConfig, Network } from \"@aptos-labs/ts-sdk\";\n *\n * const config = new AptosConfig({ network: Network.TESTNET });\n * const aptos = new Aptos(config);\n *\n * async function runExample() {\n * // Retrieve the block at height 5, including transactions\n * const block = await aptos.getBlockByHeight({ blockHeight: 5, options: { withTransactions: true } });\n * console.log(block);\n * }\n * runExample().catch(console.error);\n * ```\n * @group General\n */\n async getBlockByHeight(args: { blockHeight: AnyNumber; options?: { withTransactions?: boolean } }): Promise<Block> {\n return getBlockByHeight({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Queries for a Move view function\n * @param args.payload Payload for the view function\n * @param args.options.ledgerVersion The ledger version to query, if not provided it will get the latest version\n *\n * @example\n * const data = await aptos.view({\n * payload: {\n * function: \"0x1::coin::balance\",\n * typeArguments: [\"0x1::aptos_coin::AptosCoin\"],\n * functionArguments: [accountAddress],\n * }\n * })\n *\n * @returns an array of Move values\n * @group General\n */\n async view<T extends Array<MoveValue>>(args: {\n payload: InputViewFunctionData;\n options?: LedgerVersionArg;\n }): Promise<T> {\n return view<T>({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Queries for a Move view function with JSON, this provides compatability with the old `aptos` package\n * @param args.payload Payload for the view function\n * @param args.options.ledgerVersion The ledger version to query, if not provided it will get the latest version\n *\n * @example\n * const data = await aptos.view({\n * payload: {\n * function: \"0x1::coin::balance\",\n * typeArguments: [\"0x1::aptos_coin::AptosCoin\"],\n * functionArguments: [accountAddress.toString()],\n * }\n * })\n *\n * @returns an array of Move values\n * @group General\n */\n async viewJson<T extends Array<MoveValue>>(args: {\n payload: InputViewFunctionJsonData;\n options?: LedgerVersionArg;\n }): Promise<T> {\n return viewJson<T>({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Queries the top user transactions based on the specified limit.\n *\n * @param args - The arguments for querying top user transactions.\n * @param args.limit - The number of transactions to return.\n * @returns GetChainTopUserTransactionsResponse\n *\n * @example\n * ```typescript\n * import { Aptos, AptosConfig, Network } from \"@aptos-labs/ts-sdk\";\n *\n * const config = new AptosConfig({ network: Network.TESTNET });\n * const aptos = new Aptos(config);\n *\n * async function runExample() {\n * // Fetch the top user transactions with a limit of 5\n * const topUserTransactions = await aptos.getChainTopUserTransactions({ limit: 5 });\n *\n * console.log(topUserTransactions);\n * }\n * runExample().catch(console.error);\n * ```\n * @group General\n */\n async getChainTopUserTransactions(args: { limit: number }): Promise<GetChainTopUserTransactionsResponse> {\n return getChainTopUserTransactions({\n aptosConfig: this.config,\n ...args,\n });\n }\n\n /**\n * Retrieves data from the Aptos Indexer using a GraphQL query.\n * This function allows you to execute complex queries to fetch specific data from the Aptos blockchain.\n *\n * @param args.query.query - A GraphQL query string.\n * @param args.query.variables - The variables for the query (optional).\n *\n * @return The provided T type.\n *\n * @example\n * ```typescript\n * import { Aptos, AptosConfig, Network } from \"@aptos-labs/ts-sdk\";\n *\n * const config = new AptosConfig({ network: Network.TESTNET });\n * const aptos = new Aptos(config);\n *\n * async function runExample() {\n * // Querying the Aptos Indexer for ledger information\n * const topUserTransactions = await aptos.queryIndexer({\n * query: `query MyQuery {\n * ledger_infos {\n * chain_id\n * }\n * }`\n * });\n *\n * console.log(topUserTransactions);\n * }\n * runExample().catch(console.error);\n * ```\n * @group General\n */\n async queryIndexer<T extends {}>(args: { query: GraphqlQuery }): Promise<T> {\n return queryIndexer<T>({\n aptosConfig: this.config,\n ...args,\n });\n }\n\n /**\n * Queries for the last successful indexer version, providing insight into the ledger version the indexer is updated to, which\n * may lag behind the full nodes.\n *\n * @example\n * ```typescript\n * import { Aptos, AptosConfig, Network } from \"@aptos-labs/ts-sdk\";\n *\n * const config = new AptosConfig({ network: Network.TESTNET });\n * const aptos = new Aptos(config);\n *\n * async function runExample() {\n * // Get the last successful indexer version\n * const version = await aptos.getIndexerLastSuccessVersion();\n * console.log(`Last successful indexer version: ${version}`);\n * }\n * runExample().catch(console.error);\n * ```\n * @group General\n */\n async getIndexerLastSuccessVersion(): Promise<bigint> {\n return getIndexerLastSuccessVersion({ aptosConfig: this.config });\n }\n\n /**\n * Query the processor status for a specific processor type.\n *\n * @param processorType The processor type to query.\n * @returns The status of the specified processor type.\n *\n * @example\n * ```typescript\n * import { Aptos, AptosConfig, Network } from \"@aptos-labs/ts-sdk\";\n *\n * const config = new AptosConfig({ network: Network.TESTNET });\n * const aptos = new Aptos(config);\n *\n * async function runExample() {\n * // Get the processor status for the account transactions processor\n * const status = await aptos.getProcessorStatus(\"account_transactions_processor\");\n * console.log(status);\n * }\n * runExample().catch(console.error);\n * ```\n * @group General\n */\n async getProcessorStatus(processorType: ProcessorType): Promise<GetProcessorStatusResponse[0]> {\n return getProcessorStatus({ aptosConfig: this.config, processorType });\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AA8BO,IAAM,UAAN,MAAc;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EA+BnB,YAAY,QAAqB;AAC/B,SAAK,SAAS;AAAA,EAChB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAwBA,MAAM,gBAAqC;AACzC,WAAO,cAAc,EAAE,aAAa,KAAK,OAAO,CAAC;AAAA,EACnD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAuBA,MAAM,aAA8B;AAClC,UAAM,SAAS,MAAM,KAAK,cAAc;AACxC,WAAO,OAAO;AAAA,EAChB;AAAA;AA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A;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAkCA,MAAM,aAA2B,MAA2C;AAC1E,WAAO,aAAgB;AAAA,MACrB,aAAa,KAAK;AAAA,MAClB,GAAG;AAAA,IACL,CAAC;AAAA,EACH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAsBA,MAAM,+BAAgD;AACpD,WAAO,6BAA6B,EAAE,aAAa,KAAK,OAAO,CAAC;AAAA,EAClE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAwBA,MAAM,mBAAmB,eAAsE;AAC7F,WAAO,mBAAmB,EAAE,aAAa,KAAK,QAAQ,cAAc,CAAC;AAAA,EACvE;AACF;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../src/api/general.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { AptosConfig } from \"./aptosConfig\";\nimport {\n getChainTopUserTransactions,\n getIndexerLastSuccessVersion,\n getLedgerInfo,\n getProcessorStatus,\n queryIndexer,\n} from \"../internal/general\";\nimport { getBlockByHeight, getBlockByVersion } from \"../internal/transaction\";\nimport { view, viewJson } from \"../internal/view\";\nimport {\n AnyNumber,\n Block,\n GetChainTopUserTransactionsResponse,\n GetProcessorStatusResponse,\n GraphqlQuery,\n LedgerInfo,\n LedgerVersionArg,\n MoveValue,\n} from \"../types\";\nimport { ProcessorType } from \"../utils/const\";\nimport { InputViewFunctionData, InputViewFunctionJsonData } from \"../transactions\";\n\n/**\n * A class to query various Aptos-related information and perform operations on the Aptos blockchain.\n * @group General\n */\nexport class General {\n readonly config: AptosConfig;\n\n /**\n * Initializes a new instance of the Aptos client with the specified configuration.\n * This allows users to interact with the Aptos blockchain using the provided settings.\n *\n * @param config - The configuration settings for the Aptos client.\n * @param config.network - The network to connect to (e.g., TESTNET, MAINNET).\n * @param config.nodeUrl - The URL of the Aptos node to connect to.\n *\n * @example\n * ```typescript\n * import { Aptos, AptosConfig, Network } from \"@aptos-labs/ts-sdk\";\n *\n * async function runExample() {\n * // Create a configuration for the Aptos client\n * const config = new AptosConfig({\n * network: Network.TESTNET, // specify the network\n * nodeUrl: \"https://testnet.aptos.dev\" // specify the node URL\n * });\n *\n * // Initialize the Aptos client with the configuration\n * const aptos = new Aptos(config);\n *\n * console.log(\"Aptos client initialized:\", aptos);\n * }\n * runExample().catch(console.error);\n * ```\n * @group General\n */\n constructor(config: AptosConfig) {\n this.config = config;\n }\n\n /**\n * Queries for the Aptos ledger information.\n *\n * @returns The Aptos Ledger Info, which includes details such as chain ID, epoch, and ledger version.\n *\n * @example\n * ```typescript\n * import { Aptos, AptosConfig, Network } from \"@aptos-labs/ts-sdk\";\n *\n * const config = new AptosConfig({ network: Network.TESTNET });\n * const aptos = new Aptos(config);\n *\n * async function runExample() {\n * // Fetching the ledger information\n * const ledgerInfo = await aptos.getLedgerInfo();\n *\n * console.log(ledgerInfo);\n * }\n * runExample().catch(console.error);\n * ```\n * @group General\n */\n async getLedgerInfo(): Promise<LedgerInfo> {\n return getLedgerInfo({ aptosConfig: this.config });\n }\n\n /**\n * Retrieves the chain ID of the Aptos blockchain.\n *\n * @example\n * ```typescript\n * import { Aptos, AptosConfig, Network } from \"@aptos-labs/ts-sdk\";\n *\n * const config = new AptosConfig({ network: Network.TESTNET });\n * const aptos = new Aptos(config);\n *\n * async function runExample() {\n * // Fetching the chain ID\n * const chainId = await aptos.getChainId();\n * console.log(\"Chain ID:\", chainId);\n * }\n * runExample().catch(console.error);\n *\n * @returns The chain ID of the Aptos blockchain.\n * ```\n * @group General\n */\n async getChainId(): Promise<number> {\n const result = await this.getLedgerInfo();\n return result.chain_id;\n }\n\n /**\n * Retrieves block information by the specified ledger version.\n *\n * @param args - The arguments for retrieving the block.\n * @param args.ledgerVersion - The ledger version to lookup block information for.\n * @param args.options - Optional parameters for the request.\n * @param args.options.withTransactions - If set to true, include all transactions in the block.\n *\n * @returns Block information with optional transactions.\n *\n * @example\n * ```typescript\n * import { Aptos, AptosConfig, Network } from \"@aptos-labs/ts-sdk\";\n *\n * const config = new AptosConfig({ network: Network.TESTNET });\n * const aptos = new Aptos(config);\n *\n * async function runExample() {\n * // Retrieve block information for a specific ledger version\n * const block = await aptos.getBlockByVersion({ ledgerVersion: 5 });\n * console.log(block);\n * }\n * runExample().catch(console.error);\n * ```\n * @group General\n */\n async getBlockByVersion(args: {\n ledgerVersion: AnyNumber;\n options?: { withTransactions?: boolean };\n }): Promise<Block> {\n return getBlockByVersion({\n aptosConfig: this.config,\n ...args,\n });\n }\n\n /**\n * Retrieve a block by its height, allowing for the inclusion of transactions if specified.\n *\n * @param args - The parameters for the block retrieval.\n * @param args.blockHeight - The block height to look up, starting at 0.\n * @param args.options - Optional settings for the retrieval.\n * @param args.options.withTransactions - If set to true, includes all transactions in the block.\n *\n * @returns The block with optional transactions included.\n *\n * @example\n * ```typescript\n * import { Aptos, AptosConfig, Network } from \"@aptos-labs/ts-sdk\";\n *\n * const config = new AptosConfig({ network: Network.TESTNET });\n * const aptos = new Aptos(config);\n *\n * async function runExample() {\n * // Retrieve the block at height 5, including transactions\n * const block = await aptos.getBlockByHeight({ blockHeight: 5, options: { withTransactions: true } });\n * console.log(block);\n * }\n * runExample().catch(console.error);\n * ```\n * @group General\n */\n async getBlockByHeight(args: { blockHeight: AnyNumber; options?: { withTransactions?: boolean } }): Promise<Block> {\n return getBlockByHeight({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Queries for a Move view function\n * @param args.payload Payload for the view function\n * @param args.options.ledgerVersion The ledger version to query, if not provided it will get the latest version\n *\n * @example\n * const data = await aptos.view({\n * payload: {\n * function: \"0x1::coin::balance\",\n * typeArguments: [\"0x1::aptos_coin::AptosCoin\"],\n * functionArguments: [accountAddress],\n * }\n * })\n *\n * @returns an array of Move values\n * @group General\n */\n async view<T extends Array<MoveValue>>(args: {\n payload: InputViewFunctionData;\n options?: LedgerVersionArg;\n }): Promise<T> {\n return view<T>({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Queries for a Move view function with JSON, this provides compatability with the old `aptos` package\n * @param args.payload Payload for the view function\n * @param args.options.ledgerVersion The ledger version to query, if not provided it will get the latest version\n *\n * @example\n * const data = await aptos.view({\n * payload: {\n * function: \"0x1::coin::balance\",\n * typeArguments: [\"0x1::aptos_coin::AptosCoin\"],\n * functionArguments: [accountAddress.toString()],\n * }\n * })\n *\n * @returns an array of Move values\n * @group General\n */\n async viewJson<T extends Array<MoveValue>>(args: {\n payload: InputViewFunctionJsonData;\n options?: LedgerVersionArg;\n }): Promise<T> {\n return viewJson<T>({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Queries the top user transactions based on the specified limit.\n *\n * @param args - The arguments for querying top user transactions.\n * @param args.limit - The number of transactions to return.\n * @returns GetChainTopUserTransactionsResponse\n *\n * @example\n * ```typescript\n * import { Aptos, AptosConfig, Network } from \"@aptos-labs/ts-sdk\";\n *\n * const config = new AptosConfig({ network: Network.TESTNET });\n * const aptos = new Aptos(config);\n *\n * async function runExample() {\n * // Fetch the top user transactions with a limit of 5\n * const topUserTransactions = await aptos.getChainTopUserTransactions({ limit: 5 });\n *\n * console.log(topUserTransactions);\n * }\n * runExample().catch(console.error);\n * ```\n * @group General\n */\n async getChainTopUserTransactions(args: { limit: number }): Promise<GetChainTopUserTransactionsResponse> {\n return getChainTopUserTransactions({\n aptosConfig: this.config,\n ...args,\n });\n }\n\n /**\n * Retrieves data from the Aptos Indexer using a GraphQL query.\n * This function allows you to execute complex queries to fetch specific data from the Aptos blockchain.\n *\n * @param args.query.query - A GraphQL query string.\n * @param args.query.variables - The variables for the query (optional).\n *\n * @return The provided T type.\n *\n * @example\n * ```typescript\n * import { Aptos, AptosConfig, Network } from \"@aptos-labs/ts-sdk\";\n *\n * const config = new AptosConfig({ network: Network.TESTNET });\n * const aptos = new Aptos(config);\n *\n * async function runExample() {\n * // Querying the Aptos Indexer for ledger information\n * const topUserTransactions = await aptos.queryIndexer({\n * query: { query: `query MyQuery {\n * ledger_infos {\n * chain_id\n * }\n * }`}\n * });\n *\n * console.log(topUserTransactions);\n * }\n * runExample().catch(console.error);\n * ```\n * @group General\n */\n async queryIndexer<T extends {}>(args: { query: GraphqlQuery }): Promise<T> {\n return queryIndexer<T>({\n aptosConfig: this.config,\n ...args,\n });\n }\n\n /**\n * Queries for the last successful indexer version, providing insight into the ledger version the indexer is updated to, which\n * may lag behind the full nodes.\n *\n * @example\n * ```typescript\n * import { Aptos, AptosConfig, Network } from \"@aptos-labs/ts-sdk\";\n *\n * const config = new AptosConfig({ network: Network.TESTNET });\n * const aptos = new Aptos(config);\n *\n * async function runExample() {\n * // Get the last successful indexer version\n * const version = await aptos.getIndexerLastSuccessVersion();\n * console.log(`Last successful indexer version: ${version}`);\n * }\n * runExample().catch(console.error);\n * ```\n * @group General\n */\n async getIndexerLastSuccessVersion(): Promise<bigint> {\n return getIndexerLastSuccessVersion({ aptosConfig: this.config });\n }\n\n /**\n * Query the processor status for a specific processor type.\n *\n * @param processorType The processor type to query.\n * @returns The status of the specified processor type.\n *\n * @example\n * ```typescript\n * import { Aptos, AptosConfig, Network } from \"@aptos-labs/ts-sdk\";\n *\n * const config = new AptosConfig({ network: Network.TESTNET });\n * const aptos = new Aptos(config);\n *\n * async function runExample() {\n * // Get the processor status for the account transactions processor\n * const status = await aptos.getProcessorStatus(\"account_transactions_processor\");\n * console.log(status);\n * }\n * runExample().catch(console.error);\n * ```\n * @group General\n */\n async getProcessorStatus(processorType: Proc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